diff options
author | daryll <daryll> | 2000-06-09 02:29:33 +0000 |
---|---|---|
committer | daryll <daryll> | 2000-06-09 02:29:33 +0000 |
commit | cc07bbc7e27656dc17fdb830f9d5dc1aa0169e30 (patch) | |
tree | f88d74713c9ca146f1e68d1aab0dc1e2bf2c5d21 | |
parent | 4b274a3060b167202592c2d892cd75057b729fdf (diff) |
Merge the latest version of the trunk into my tdfx-2-0 branch.tdfx-2-0-20000608-merge
167 files changed, 21632 insertions, 9111 deletions
diff --git a/xc/config/cf/Imake.tmpl b/xc/config/cf/Imake.tmpl index d4bf580c8..432a3a241 100644 --- a/xc/config/cf/Imake.tmpl +++ b/xc/config/cf/Imake.tmpl @@ -561,6 +561,15 @@ TCLIBDIR = TclLibDir #endif #endif +/* + * SystemUsrLibDir is independent of ProjectRoot. It is used primarily + * to allow links for shared libraries in /usr/lib for compliance to + * various standards (e.g., Linux/OpenGL). + */ +#ifndef SystemUsrLibDir +#define SystemUsrLibDir /usr/lib +#endif + #ifndef ShLibDir #define ShLibDir UsrLibDir #endif @@ -1260,6 +1269,7 @@ TCLIBDIR = TclLibDir INCROOT = IncRoot /* base of where to put header files */ USRLIBDIR = UsrLibDir /* nonshared libraries */ VARLIBDIR = VarLibDir /* xdm runtime files */ + SYSTEMUSRLIBDIR = SystemUsrLibDir /* system's "/usr/lib" */ SHLIBDIR = ShLibDir /* shared libraries */ LINTLIBDIR = LintlibDir /* lint libraries */ MANPATH = ManPath /* top of manual page tree */ diff --git a/xc/config/cf/X11.tmpl b/xc/config/cf/X11.tmpl index 2e2fbf4cf..d55f6eb04 100644 --- a/xc/config/cf/X11.tmpl +++ b/xc/config/cf/X11.tmpl @@ -1422,7 +1422,7 @@ ProjectUnsharedLibReferences(XTHRSTUB,XThrStub,$(XTHRSTUBSRC),XBuildLibDir) #define SharedLibGlx HasSharedLibraries #endif #ifndef NormalLibGlx -#define NormalLibGlx YES +#define NormalLibGlx (!SharedLibX11 | ForceNormalLib) #endif #ifndef DebugLibGlx #define DebugLibGlx NO @@ -1430,6 +1430,9 @@ ProjectUnsharedLibReferences(XTHRSTUB,XThrStub,$(XTHRSTUBSRC),XBuildLibDir) #ifndef ProfileLibGlx #define ProfileLibGlx NO #endif +#ifndef LinkGLToUsrLib +#define LinkGLToUsrLib NO +#endif #endif #ifndef SharedLibXext diff --git a/xc/config/cf/linux.cf b/xc/config/cf/linux.cf index d51ba9785..be7f79931 100644 --- a/xc/config/cf/linux.cf +++ b/xc/config/cf/linux.cf @@ -512,6 +512,10 @@ XCOMM binutils: (LinuxBinUtilsMajorVersion) #define StaticLibrary(libpath,libname) -Wl,-Bstatic Concat(-L,libpath) Concat(-l,libname) -Wl,-Bdynamic #endif +#ifndef LinkGLToUsrLib +#define LinkGLToUsrLib YES +#endif + #define HasGnuMake YES #define MakeNamedTargetSubdir(dir,flags,subname)\ diff --git a/xc/extras/Mesa/include/GL/gl.h b/xc/extras/Mesa/include/GL/gl.h index 03988f43b..f7d1224cf 100644 --- a/xc/extras/Mesa/include/GL/gl.h +++ b/xc/extras/Mesa/include/GL/gl.h @@ -32,113 +32,57 @@ #endif +/********************************************************************** + * Begin system-specific stuff. + */ #if defined(__BEOS__) #include <stdlib.h> /* to get some BeOS-isms */ #endif - #if !defined(OPENSTEP) && (defined(NeXT) || defined(NeXT_PDO)) #define OPENSTEP #endif - -/* - * XXX move as many of these pragma's and MS Windows-isms into - * the new src/glheader.h file. - */ - #if defined(_WIN32) && !defined(__WIN32__) -# define __WIN32__ +#define __WIN32__ #endif -#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__)) -# pragma warning( disable : 4068 ) /* unknown pragma */ -# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ -# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ -# pragma warning( disable : 4127 ) /* conditional expression is constant */ -# if defined(MESA_MINWARN) -# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ -# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ -# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ -# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ -# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ -# endif +#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) # if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ # define GLAPI __declspec(dllexport) -# define WGLAPI __declspec(dllexport) # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ # define GLAPI __declspec(dllimport) -# define WGLAPI __declspec(dllimport) # else /* for use with static link lib build of Win32 edition only */ # define GLAPI extern -# define WGLAPI __declspec(dllimport) # endif /* _STATIC_MESA support */ # define GLAPIENTRY __stdcall -# define GLAPIENTRYP __stdcall * -# define GLCALLBACK __stdcall -# define GLCALLBACKP __stdcall * -# if defined(__CYGWIN32__) -# define GLCALLBACKPCAST * -# else -# define GLCALLBACKPCAST __stdcall * -# endif -# define GLWINAPI __stdcall -# define GLWINAPIV __cdecl #else /* non-Windows compilation */ # define GLAPI extern # define GLAPIENTRY -# define GLAPIENTRYP * -# define GLCALLBACK -# define GLCALLBACKP * -# define GLCALLBACKPCAST * -# define GLWINAPI -# define GLWINAPIV -#endif /* WIN32 / CYGWIN32 bracket */ - -/* compatability guard so we don't need to change client code */ - -#if defined(_WIN32) && !defined(_WINDEF_) && !defined(OPENSTEP) -# define CALLBACK GLCALLBACK -typedef int (GLAPIENTRY *PROC)(); -typedef void *HGLRC; -typedef void *HDC; -typedef unsigned long COLORREF; -#endif +#endif /* WIN32 / CYGWIN bracket */ -#if defined(_WIN32) && !defined(_WINGDI_) && !defined(OPENSTEP) -# define WGL_FONT_LINES 0 -# define WGL_FONT_POLYGONS 1 -# ifdef UNICODE -# define wglUseFontBitmaps wglUseFontBitmapsW -# define wglUseFontOutlines wglUseFontOutlinesW -# else -# define wglUseFontBitmaps wglUseFontBitmapsA -# define wglUseFontOutlines wglUseFontOutlinesA -# endif /* !UNICODE */ -typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; -typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; -typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) #include <gl/mesa_wgl.h> #endif -#ifdef __cplusplus -extern "C" { +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import on #endif +/* + * End system-specific stuff. + **********************************************************************/ -#ifdef macintosh - #pragma enumsalwaysint on - #if PRAGMA_IMPORT_SUPPORTED - #pragma import on - #endif + +#ifdef __cplusplus +extern "C" { #endif #define GL_VERSION_1_1 1 #define GL_VERSION_1_2 1 -#define GL_HAS_GLEXT 1 @@ -1778,14 +1722,93 @@ GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, - /* - * XXX these extensions may eventually be moved into glext.h + * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) */ +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 + +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 + +GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); +GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); +GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); +GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); +GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +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 */ + + + + +#if defined(GL_GLEXT_LEGACY) /* - * GL_EXT_abgr (number 1) + * 1. GL_EXT_abgr */ #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 @@ -1797,7 +1820,7 @@ GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, /* - * GL_EXT_blend_color (number 2) + * 2. GL_EXT_blend_color */ #ifndef GL_EXT_blend_color #define GL_EXT_blend_color 1 @@ -1815,7 +1838,7 @@ GLAPI void GLAPIENTRY glBlendColorEXT( GLclampf red, GLclampf green, GLclampf bl /* - * GL_EXT_polygon_offset (number 3) + * 3. GL_EXT_polygon_offset */ #ifndef GL_EXT_polygon_offset #define GL_EXT_polygon_offset 1 @@ -1831,7 +1854,7 @@ GLAPI void GLAPIENTRY glPolygonOffsetEXT( GLfloat factor, GLfloat bias ); /* - * GL_EXT_texture3D (number 6) + * 6. GL_EXT_texture3D */ #ifndef GL_EXT_texture3D #define GL_EXT_texture3D 1 @@ -1858,7 +1881,7 @@ GLAPI void GLAPIENTRY glCopyTexSubImage3DEXT( GLenum target, GLint level, GLint /* - * GL_EXT_texture_object (number 20) + * 20. GL_EXT_texture_object */ #ifndef GL_EXT_texture_object #define GL_EXT_texture_object 1 @@ -1885,7 +1908,7 @@ GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture ); /* - * GL_EXT_rescale_normal (number 27) + * 27. GL_EXT_rescale_normal */ #ifndef GL_EXT_rescale_normal #define GL_EXT_rescale_normal 1 @@ -1897,7 +1920,7 @@ GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture ); /* - * GL_EXT_vertex_array (number 30) + * 30. GL_EXT_vertex_array */ #ifndef GL_EXT_vertex_array #define GL_EXT_vertex_array 1 @@ -1958,7 +1981,7 @@ GLAPI void GLAPIENTRY glDrawArraysEXT( GLenum mode, GLint first, GLsizei count ) /* - * GL_SGIS_texture_edge_clamp (number 35) + * 35. GL_SGIS_texture_edge_clamp */ #ifndef GL_SGIS_texture_edge_clamp #define GL_SGIS_texture_edge_clamp 1 @@ -1970,7 +1993,7 @@ GLAPI void GLAPIENTRY glDrawArraysEXT( GLenum mode, GLint first, GLsizei count ) /* - * GL_EXT_blend_minmax (number 37) + * 37. GL_EXT_blend_minmax */ #ifndef GL_EXT_blend_minmax #define GL_EXT_blend_minmax 1 @@ -1987,7 +2010,7 @@ GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); /* - * GL_EXT_blend_subtract (number 38) (requires GL_EXT_blend_max ) + * 38. GL_EXT_blend_subtract (requires GL_EXT_blend_max ) */ #ifndef GL_EXT_blend_subtract #define GL_EXT_blend_subtract 1 @@ -2000,7 +2023,7 @@ GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); /* - * GL_EXT_blend_logic_op (number 39) + * 39. GL_EXT_blend_logic_op */ #ifndef GL_EXT_blend_logic_op #define GL_EXT_blend_logic_op 1 @@ -2012,7 +2035,7 @@ GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); /* - * GL_EXT_point_parameters (number 54) + * 54. GL_EXT_point_parameters */ #ifndef GL_EXT_point_parameters #define GL_EXT_point_parameters 1 @@ -2024,47 +2047,15 @@ GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); GLAPI void GLAPIENTRY glPointParameterfEXT( GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glPointParameterfvEXT( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glPointParameterfSGIS(GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glPointParameterfvSGIS(GLenum pname, const GLfloat *params); #endif /* GL_EXT_point_parameters */ /* - * GL_PGI_misc_hints (number 77) - */ -#ifndef GL_PGI_misc_hints -#define GL_PGI_misc_hints 1 - -#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 107000 -#define GL_STRICT_DEPTHFUNC_HINT_PGI 107030 -#define GL_STRICT_LIGHTING_HINT_PGI 107031 -#define GL_STRICT_SCISSOR_HINT_PGI 107032 -#define GL_FULL_STIPPLE_HINT_PGI 107033 -#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 107011 -#define GL_NATIVE_GRAPHICS_END_HINT_PGI 107012 -#define GL_CONSERVE_MEMORY_HINT_PGI 107005 -#define GL_RECLAIM_MEMORY_HINT_PGI 107006 -#define GL_ALWAYS_FAST_HINT_PGI 107020 -#define GL_ALWAYS_SOFT_HINT_PGI 107021 -#define GL_ALLOW_DRAW_OBJ_HINT_PGI 107022 -#define GL_ALLOW_DRAW_WIN_HINT_PGI 107023 -#define GL_ALLOW_DRAW_FRG_HINT_PGI 107024 -#define GL_ALLOW_DRAW_SPN_HINT_PGI 107024 -#define GL_ALLOW_DRAW_MEM_HINT_PGI 107025 -#define GL_CLIP_NEAR_HINT_PGI 107040 -#define GL_CLIP_FAR_HINT_PGI 107041 -#define GL_WIDE_LINE_HINT_PGI 107042 -#define GL_BACK_NORMALS_HINT_PGI 107043 -#define GL_NATIVE_GRAPHICS_HANDLE_PGI 107010 - -GLAPI void GLAPIENTRY glHintPGI(GLenum target, GLint mode); - -#endif /* GL_PGI_misc_hints */ - - - -/* - * GL_EXT_paletted_texture (number 78) + * 78. GL_EXT_paletted_texture */ #ifndef GL_EXT_paletted_texture #define GL_EXT_paletted_texture 1 @@ -2101,19 +2092,19 @@ GLAPI void GLAPIENTRY glGetColorTableParameterivEXT( GLenum target, GLenum pname /* - * GL_EXT_clip_volume_hint (number 79) + * 79. GL_EXT_clip_volume_hint */ #ifndef GL_EXT_clip_volume_hint #define GL_EXT_clip_volume_hint 1 -#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 #endif /* GL_EXT_clip_volume_hint */ /* - * GL_EXT_compiled_vertex_array (number 97) + * 97. GL_EXT_compiled_vertex_array */ #ifndef GL_EXT_compiled_vertex_array #define GL_EXT_compiled_vertex_array 1 @@ -2126,10 +2117,20 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); #endif /* GL_EXT_compiled_vertex_array */ +/* + * 137. GL_HP_occlusion_test + */ +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 + +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 + +#endif /* GL_HP_occlusion_test */ /* - * GL_EXT_shared_texture_palette (number 141) (req's GL_EXT_paletted_texture) + * 141. GL_EXT_shared_texture_palette (req's GL_EXT_paletted_texture) */ #ifndef GL_EXT_shared_texture_palette #define GL_EXT_shared_texture_palette 1 @@ -2141,7 +2142,7 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); /* - * GL_EXT_stencil_wrap (number 176) + * 176. GL_EXT_stencil_wrap */ #ifndef GL_EXT_stencil_wrap #define GL_EXT_stencil_wrap 1 @@ -2154,24 +2155,7 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); /* - * GL_EXT_blend_func_separate (EXT number 173) (aka GL_INGR_blend_func_separate) - */ -#ifndef GL_EXT_blend_func_separate -#define GL_EXT_blend_func_separate 1 - -#define GL_BLEND_DST_RGB_EXT 0x80C8 -#define GL_BLEND_SRC_RGB_EXT 0x80C9 -#define GL_BLEND_DST_ALPHA_EXT 0x80CA -#define GL_BLEND_SRC_ALPHA_EXT 0x80CB - -GLAPI void GLAPIENTRY glBlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha ); - -#endif /* GL_EXT_blend_func_separate */ - - - -/* - * GL_NV_texgen_reflection (number 179) + * 179. GL_NV_texgen_reflection */ #ifndef GL_NV_texgen_reflection #define GL_NV_texgen_reflection 1 @@ -2184,7 +2168,7 @@ GLAPI void GLAPIENTRY glBlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorR /* - * GL_EXT_texture_env_add (number 185) + * 185. GL_EXT_texture_env_add */ #ifndef GL_EXT_texture_env_add #define GL_EXT_texture_env_add 1 @@ -2195,89 +2179,10 @@ GLAPI void GLAPIENTRY glBlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorR -/* - * GL_ARB_multitexture (ARB 0) - */ -#ifndef GL_ARB_multitexture -#define GL_ARB_multitexture 1 - -#define GL_TEXTURE0_ARB 0x84C0 -#define GL_TEXTURE1_ARB 0x84C1 -#define GL_TEXTURE2_ARB 0x84C2 -#define GL_TEXTURE3_ARB 0x84C3 -#define GL_TEXTURE4_ARB 0x84C4 -#define GL_TEXTURE5_ARB 0x84C5 -#define GL_TEXTURE6_ARB 0x84C6 -#define GL_TEXTURE7_ARB 0x84C7 -#define GL_TEXTURE8_ARB 0x84C8 -#define GL_TEXTURE9_ARB 0x84C9 -#define GL_TEXTURE10_ARB 0x84CA -#define GL_TEXTURE11_ARB 0x84CB -#define GL_TEXTURE12_ARB 0x84CC -#define GL_TEXTURE13_ARB 0x84CD -#define GL_TEXTURE14_ARB 0x84CE -#define GL_TEXTURE15_ARB 0x84CF -#define GL_TEXTURE16_ARB 0x84D0 -#define GL_TEXTURE17_ARB 0x84D1 -#define GL_TEXTURE18_ARB 0x84D2 -#define GL_TEXTURE19_ARB 0x84D3 -#define GL_TEXTURE20_ARB 0x84D4 -#define GL_TEXTURE21_ARB 0x84D5 -#define GL_TEXTURE22_ARB 0x84D6 -#define GL_TEXTURE23_ARB 0x84D7 -#define GL_TEXTURE24_ARB 0x84D8 -#define GL_TEXTURE25_ARB 0x84D9 -#define GL_TEXTURE26_ARB 0x84DA -#define GL_TEXTURE27_ARB 0x84DB -#define GL_TEXTURE28_ARB 0x84DC -#define GL_TEXTURE29_ARB 0x84DD -#define GL_TEXTURE30_ARB 0x84DE -#define GL_TEXTURE31_ARB 0x84DF -#define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 - -GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); -GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); -GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); -GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); -GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); -GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); -GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); -GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); -GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); -GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); -GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); -GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); -GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); -GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); -GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); -GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); -GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); -GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); -GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); -GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); -GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); -GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); -GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); -GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); -GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); -GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); -GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); -GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); -GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); -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 */ - /* - * GL_MESA_window_pos (197) + * 197. GL_MESA_window_pos */ #ifndef GL_MESA_window_pos #define GL_MESA_window_pos 1 @@ -2312,7 +2217,7 @@ GLAPI void GLAPIENTRY glWindowPos4dvMESA( const GLdouble *p ); /* - * GL_MESA_resize_bufffers (196) + * 196. GL_MESA_resize_bufffers */ #ifndef GL_MESA_resize_bufffers #define GL_MESA_resize_buffers 1 @@ -2322,52 +2227,27 @@ GLAPI void GLAPIENTRY glResizeBuffersMESA( void ); #endif /* GL_MESA_resize_bufffers */ +#else /* GL_GLEXT_LEGACY */ -/* - * GL_ARB_tranpose_matrix (ARB 2) - */ -#ifndef GL_ARB_transpose_matrix -#define GL_ARB_transpose_matrix 1 - -#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 - -GLAPI void GLAPIENTRY glLoadTransposeMatrixdARB( const GLdouble m[16] ); -GLAPI void GLAPIENTRY glLoadTransposeMatrixfARB( const GLfloat m[16] ); -GLAPI void GLAPIENTRY glMultTransposeMatrixdARB( const GLdouble m[16] ); -GLAPI void GLAPIENTRY glMultTransposeMatrixfARB( const GLfloat m[16] ); +#include <GL/glext.h> -#endif /* GL_ARB_tranpose_matrix */ +#endif /* GL_GLEXT_LEGACY */ -/* - * GL_ARB_multisample (ARB 4) +/********************************************************************** + * Begin system-specific stuff */ -#ifndef GL_ARB_multisample -#define GL_ARB_multisample 1 - -GLAPI void GLAPIENTRY glSampleCoverageARB(GLclampf value, GLboolean invert); - -GLAPI void GLAPIENTRY glSamplePassARB(GLenum pass); - -#endif /* GL_ARB_multisample */ - - - #if defined(__BEOS__) || defined(__QUICKDRAW__) #pragma export off #endif - -#ifdef macintosh - #pragma enumsalwaysint reset - #if PRAGMA_IMPORT_SUPPORTED - #pragma import off - #endif +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import off #endif +/* + * End system-specific stuff + **********************************************************************/ #ifdef __cplusplus diff --git a/xc/extras/Mesa/include/GL/glext.h b/xc/extras/Mesa/include/GL/glext.h index 4c7ccbb2f..0eb4ca49a 100644 --- a/xc/extras/Mesa/include/GL/glext.h +++ b/xc/extras/Mesa/include/GL/glext.h @@ -3,9 +3,10 @@ /* - * XXX Many extensions need to be added yet. * XXX Some token values aren't known (grep for ?) * XXX This file may be automatically generated in the future. + * XXX There are some doubly-defined tokens with different values! Search + * for "DUPLICATE". */ @@ -14,7 +15,7 @@ extern "C" { #endif -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__CYGWIN__) #define WIN32_LEAN_AND_MEAN 1 #include <windows.h> #endif @@ -23,7 +24,7 @@ extern "C" { #define GLAPI extern #endif -#ifdef GLAPIENTRY +#if defined(GLAPIENTRY) && !defined(APIENTRY) #define APIENTRY GLAPIENTRY #endif @@ -32,7 +33,31 @@ extern "C" { #endif -#define GL_GLEXT_VERSION_EXT 1 +/* + * Versions: + * 1. Brian Paul, 24 Feb 2000 + * Intial Version + * 2. Brian Paul, 7 Mar 2000 + * Added GL_HP_occlusion_test, GL_EXT_texture_lod_bias + * 3. Brian Paul, 20 Mar 2000 + * Added all missing extensions up to number 137 + * 4. Brian Paul, 23 Mar 2000 + * Now have all extenions up to number 197 + * 5. Brian Paul, 27 Mar 2000 + * Added GL_ARB_texture_compression + * 6. Brian Paul, 5 Apr 2000 + * Added GL_ARB_multisample tokens, added GL_ARB_texture_env_add + * 7. Brian Paul, 7 Apr 2000 + * Minor clean-ups, temporary token values for GL_SGIS_pixel_texture + * 8. Brian Paul, 15 Apr 2000 + * Added GL_EXT_texture_cube_map, GL_NV_texgen_emboss, adding some + * missing tokens values. + * 9. Brian Paul, 4 May 2000 + * Added a bunch of missing token values. + * 10. Brian Paul, 11 May 2000 + * Added extensions 198 .. 212. + */ +#define GL_GLEXT_VERSION_EXT 10 /* @@ -86,6 +111,65 @@ typedef void (APIENTRY * PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bia /* + * 4. GL_EXT_texture + */ +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 + +#define GL_ALPHA4_EXT 0x803B +#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA12_EXT 0x803D +#define GL_ALPHA16_EXT 0x803E +#define GL_LUMINANCE4_EXT 0x803F +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE12_EXT 0x8041 +#define GL_LUMINANCE16_EXT 0x8042 +#define GL_LUMINANCE4_ALPHA4_EXT 0x8043 +#define GL_LUMINANCE6_ALPHA2_EXT 0x8044 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_LUMINANCE12_ALPHA4_EXT 0x8046 +#define GL_LUMINANCE12_ALPHA12_EXT 0x8047 +#define GL_LUMINANCE16_ALPHA16_EXT 0x8048 +#define GL_INTENSITY_EXT 0x8049 +#define GL_INTENSITY4_EXT 0x804A +#define GL_INTENSITY8_EXT 0x804B +#define GL_INTENSITY12_EXT 0x804C +#define GL_INTENSITY16_EXT 0x804D +#define GL_RGB2_EXT 0x804E +#define GL_RGB4_EXT 0x804F +#define GL_RGB5_EXT 0x8050 +#define GL_RGB8_EXT 0x8051 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB12_EXT 0x8053 +#define GL_RGB16_EXT 0x8054 +#define GL_RGBA2_EXT 0x8055 +#define GL_RGBA4_EXT 0x8056 +#define GL_RGB5_A1_EXT 0x8057 +#define GL_RGBA8_EXT 0x8058 +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGBA12_EXT 0x805A +#define GL_RGBA16_EXT 0x805B +#define GL_TEXTURE_RED_SIZE_EXT 0x805C +#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D +#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E +#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061 +#define GL_REPLACE_EXT 0x8062 +#define GL_PROXY_TEXTURE_1D_EXT 0x8063 +#define GL_PROXY_TEXTURE_2D_EXT 0x8064 + +#endif /* GL_EXT_texture */ + + + +/* + * 5. unknown + */ + + + +/* * 6. GL_EXT_texture3D */ #ifndef GL_EXT_texture3D @@ -120,8 +204,8 @@ typedef void (APIENTRY * PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint le #ifndef GL_SGI_texture_filter4 #define GL_SGI_texture_filter4 1 -#define GL_FILTER4_SGIS ? -#define GL_TEXTURE_FILTER4_SIZE_SGIS ? +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 GLAPI void APIENTRY glGetTexFilterFuncSGIS(GLenum target, GLenum filter, GLfloat *weights); GLAPI void APIENTRY glTexFilterFuncSGIS(GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); @@ -134,6 +218,12 @@ typedef void (APIENTRY * PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filt /* + * 8. unknown + */ + + + +/* * 9. GL_EXT_subtexture */ #ifndef GL_EXT_subtexture @@ -299,22 +389,22 @@ typedef void (APIENTRY * PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum i #ifndef GL_SGI_color_table #define GL_SGI_color_table 1 -#define COLOR_TABLE_SGI 0x80D0 -#define POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 -#define POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 -#define PROXY_COLOR_TABLE_SGI 0x80D3 -#define PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 -#define PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 -#define COLOR_TABLE_SCALE_SGI 0x80D6 -#define COLOR_TABLE_BIAS_SGI 0x80D7 -#define COLOR_TABLE_FORMAT_SGI 0x80D8 -#define COLOR_TABLE_WIDTH_SGI 0x80D9 -#define COLOR_TABLE_RED_SIZE_SGI 0x80DA -#define COLOR_TABLE_GREEN_SIZE_SGI 0x80DB -#define COLOR_TABLE_BLUE_SIZE_SGI 0x80DC -#define COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD -#define COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE -#define COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF +#define GL_COLOR_TABLE_SGI 0x80D0 /* DUPLICATE! */ +#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2 +#define GL_PROXY_COLOR_TABLE_SGI 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5 +#define GL_COLOR_TABLE_SCALE_SGI 0x80D6 +#define GL_COLOR_TABLE_BIAS_SGI 0x80D7 +#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8 +#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF GLAPI void APIENTRY glColorTableParameterfvSGI(GLenum target, GLenum pname, const GLfloat *params); GLAPI void APIENTRY glColorTableParameterivSGI(GLenum target, GLenum pname, const GLint *params); @@ -342,6 +432,9 @@ typedef void (APIENTRY * PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum forma #ifndef GL_SGIX_pixel_texture #define GL_SGIX_pixel_texture 1 +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B + GLAPI void APIENTRY glPixelTexGenSGIX(GLenum mode); typedef void (APIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); @@ -356,10 +449,10 @@ typedef void (APIENTRY * PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); #ifndef GL_SGIS_pixel_texture #define GL_SGIS_pixel_texture 1 -#define GL_PIXEL_TEXTURE_SGIS ? -#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS ? -#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS ? -#define GL_PIXEL_GROUP_COLOR_SGIS ? +#define GL_PIXEL_TEXTURE_SGIS 0x8353 +#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354 +#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355 +#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356 GLAPI void APIENTRY glPixelTexGenParameterfSGIS(GLenum target, GLfloat value); GLAPI void APIENTRY glPixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value); @@ -385,21 +478,21 @@ typedef void (APIENTRY * PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum target, #ifndef GL_SGIS_texture4D #define GL_SGIS_texture4D 1 -#define GL_PACK_SKIP_VOLUMES_SGIS ? -#define GL_PACK_IMAGE_DEPTH_SGIS ? -#define GL_UNPACK_SKIP_VOLUMES_SGIS ? -#define GL_UNPACK_IMAGE_DEPTH_SGIS ? -#define GL_TEXTURE_4D_SGIS ? -#define GL_PROXY_TEXTURE_4D_SGIS ? -#define GL_TEXTURE_4DSIZE_SGIS ? -#define GL_TEXTURE_WRAP_Q_SGIS ? -#define GL_MAX_4D_TEXTURE_SIZE_SGIS ? -#define GL_TEXTURE_4D_BINDING_SGIS ? - -GLAPI void APIENTRY glTexImage4DSGIS(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels); +#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130 +#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131 +#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132 +#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133 +#define GL_TEXTURE_4D_SGIS 0x8134 +#define GL_PROXY_TEXTURE_4D_SGIS 0x8135 +#define GL_TEXTURE_4DSIZE_SGIS 0x8136 +#define GL_TEXTURE_WRAP_Q_SGIS 0x8137 +#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138 +#define GL_TEXTURE_4D_BINDING_SGIS 0x814F + +GLAPI void APIENTRY glTexImage4DSGIS(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels); GLAPI void APIENTRY glTexSubImage4DSGIS(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void *pixels); -typedef void (APIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRY * PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels); typedef void (APIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLenum format, GLenum type, const void *pixels); #endif /* GL_SGIS_texture4D */ @@ -407,6 +500,40 @@ typedef void (APIENTRY * PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level /* + * 17. GL_SGI_texture_color_table + */ +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 + +#define GL_COLOR_TABLE_SGI_80BC 0x80BC /* DUPLICATE! */ +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD + +#endif /* GL_SGI_texture_color_table */ + + + +/* + * 18. GL_EXT_cmyka + */ +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 + +#define GL_CMYK_EXT 0x800C +#define GL_CMYKA_EXT 0x800D +#define GL_PACK_CMYK_HINT_EXT 0x800E +#define GL_UNPACK_CMYK_HINT_EXT 0x800F + +#endif /* GL_EXT_cmyka */ + + + +/* + * 19. unknown + */ + + + +/* * 20. GL_EXT_texture_object */ #ifndef GL_EXT_texture_object @@ -497,6 +624,22 @@ typedef void (APIENTRY * PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, /* + * 24. GL_SGIS_texture_lod + */ + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 + +#define GL_TEXTURE_MIN_LOD_SGIS 0x813A +#define GL_TEXTURE_MAX_LOD_SGIS 0x813B +#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C +#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D + +#endif /* GL_SGIS_texture_lod */ + + + +/* * 25. GL_SGIS_multisample */ @@ -532,6 +675,12 @@ typedef void (APIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); /* + * 26. unknown + */ + + + +/* * 27. GL_EXT_rescale_normal */ #ifndef GL_EXT_rescale_normal @@ -544,6 +693,18 @@ typedef void (APIENTRY * PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); /* + * 28. GLX_EXT_visual_info + */ + + + +/* + * 29. unknown + */ + + + +/* * 30. GL_EXT_vertex_array */ #ifndef GL_EXT_vertex_array @@ -607,6 +768,66 @@ typedef void (APIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GL /* + * 31. GL_EXT_misc_attribute + */ +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 + +#define GL_MISC_BIT_EXT ? + +#endif /* GL_EXT_misc_attribute */ + + + +/* + * 32. GL_SGIS_generate_mipmap + */ +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 + +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 + +#endif /* GL_SGIS_generate_mipmap */ + + + +/* + * 33. GL_SGIX_clipmap + */ +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 + +#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170 +#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171 +#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172 +#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173 +#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174 +#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175 +#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176 +#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177 +#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178 + +#endif /* GL_SGIX_clipmap */ + + + +/* + * 34. GL_SGIX_shadow + */ +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 + +#define GL_TEXTURE_COMPARE_SGIX 0x819A +#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B +#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C +#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D + +#endif /* GL_SGIX_shadow */ + + + +/* * 35. GL_SGIS_texture_edge_clamp */ #ifndef GL_SGIS_texture_edge_clamp @@ -619,6 +840,18 @@ typedef void (APIENTRY * PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GL /* + * 36. GL_SGIS_texture_border_clamp + */ +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 + +#define GL_CLAMP_TO_BORDER_SGIS 0x812D + +#endif /* GL_SGIS_texture_border_clamp */ + + + +/* * 37. GL_EXT_blend_minmax */ #ifndef GL_EXT_blend_minmax @@ -663,6 +896,70 @@ typedef void (APIENTRY * PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); /* + * 40. GLX_SGI_swap_control + * 41. GLX_SGI_video_sync + * 42. GLX_SGI_make_current_read + * 43. GLX_SGIX_video_source + * 44. GLX_EXT_visual_rating + */ + + + +/* + * 45. GL_SGIX_interlace + */ +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 + +#define GL_INTERLACE_SGIX 0x8094 + +#endif /* GL_SGIX_interlace */ + + + +/* + * 46. unknown + * 47. GLX_EXT_import_context + * 49. GLX_SGIX_fbconfig + * 50. GLX_SGIX_pbuffer + */ + + + +/* + * 51. GL_SGIS_texture_select + */ +#ifndef GL_SGIS_texture_select +#define GL_SGIS_texture_select 1 + +#define GL_DUAL_ALPHA4_SGIS 0x8110 +#define GL_DUAL_ALPHA8_SGIS 0x8111 +#define GL_DUAL_ALPHA12_SGIS 0x8112 +#define GL_DUAL_ALPHA16_SGIS 0x8113 +#define GL_DUAL_LUMINANCE4_SGIS 0x8114 +#define GL_DUAL_LUMINANCE8_SGIS 0x8115 +#define GL_DUAL_LUMINANCE12_SGIS 0x8116 +#define GL_DUAL_LUMINANCE16_SGIS 0x8117 +#define GL_DUAL_INTENSITY4_SGIS 0x8118 +#define GL_DUAL_INTENSITY8_SGIS 0x8119 +#define GL_DUAL_INTENSITY12_SGIS 0x811A +#define GL_DUAL_INTENSITY16_SGIS 0x811B +#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C +#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS0 x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 + +#endif /* GL_SGIS_texture_select */ + + + +/* * 52. GL_SGIX_sprite */ #ifndef GL_SGIX_sprite @@ -691,6 +988,12 @@ typedef void (APIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GL /* + * 53. unknown + */ + + + +/* * 54. GL_EXT_point_parameters */ #ifndef GL_EXT_point_parameters @@ -703,9 +1006,13 @@ typedef void (APIENTRY * PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GL GLAPI void APIENTRY glPointParameterfEXT(GLenum pname, GLfloat param); GLAPI void APIENTRY glPointParameterfvEXT(GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glPointParameterfSGIS(GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfvSGIS(GLenum pname, const GLfloat *params); typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); typedef void (APIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRY * PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); #endif /* GL_EXT_point_parameters */ @@ -734,7 +1041,23 @@ typedef void (APIENTRY * PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); typedef void (APIENTRY * PFNGLSTARTINSTRUMENTSSGIXPROC) (void); typedef void (APIENTRY * PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); -#endif +#endif /* GL_SGIX_instruments */ + + + +/* + * 56. GL_SGIX_texture_scale_bias + */ +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 + +#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179 +#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A +#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B +#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C + +#endif /* GL_SGIX_texture_scale_bias */ + /* @@ -770,6 +1093,12 @@ typedef void (APIENTRY * PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); /* + * 59. unknown + */ + + + +/* * 60. GL_SGIX_reference_plane */ #ifndef GL_SGIX_reference_plane @@ -801,9 +1130,137 @@ typedef void (APIENTRY * PFNGLFLUSHRASTERSGIXPROC) (void); /* - * 74. GL_EXT_color_subtable + * 62. GLX_SGI_cushion + */ + + + +/* + * 63. GL_SGIX_depth_texture + */ +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 + +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 + +#endif /* GL_SGIX_depth_texture */ + + + +/* + * 64. GL_SGIS_fog_function + */ +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 + +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C + +#endif /* GL_SGIS_fog_function */ + + + +/* + * 65. GL_SGIX_fog_offset + */ +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 + +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 + +#endif /* GL_SGIX_fog_offset */ + + + +/* + * 66. GL_HP_image_transform + */ +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 + +#define GL_IMAGE_SCALE_X_HP 0x8155 +#define GL_IMAGE_SCALE_Y_HP 0x8156 +#define GL_IMAGE_TRANSLATE_X_HP 0x8157 +#define GL_IMAGE_TRANSLATE_Y_HP 0x8158 +#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159 +#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A +#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B +#define GL_IMAGE_MAG_FILTER_HP 0x815C +#define GL_IMAGE_MIN_FILTER_HP 0x815D +#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E +#define GL_CUBIC_HP 0x815F +#define GL_AVERAGE_HP 0x8160 +#define GL_IMAGE_TRANSFORM_2D_HP 0x8161 +#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162 +#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163 + +GLAPI void APIENTRY glImageTransformParameteriHP(GLenum target, GLenum pname, const GLint param); +GLAPI void APIENTRY glImageTransformParameterfHP(GLenum target, GLenum pname, const GLfloat param); +GLAPI void APIENTRY glImageTransformParameterivHP(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glImageTransformParameterfvHP(GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY GetImageTransformParameterivHP(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetImageTransformParameterfvHP(GLenum target, GLenum pname,const GLfloat* params); + +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, const GLint param); +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, const GLfloat param); +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERIVHPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRY * PFNGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRY * PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname,const GLfloat* params); + +#endif /* GL_HP_image_transform */ + + + +/* + * 67. GL_HP_convolution_border_modes + */ +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 + +#define GL_IGNORE_BORDER_HP 0x8150 +#define GL_CONSTANT_BORDER_HP 0x8151 +#define GL_REPLICATE_BORDER_HP 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154 + +#endif /* GL_HP_convolution_border_modes */ + + + +/* + * 68. unknown */ + + +/* + * 69. GL_SGIX_texture_add_env + */ +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 + +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE + +#endif /* GL_SGIX_texture_add_env */ + + + +/* + * 70. unknown + * 71. unknown + * 72. unknown + * 73. unknown + */ + + + +/* + * 74. GL_EXT_color_subtable + */ #ifndef GL_EXT_color_subtable #define GL_EXT_color_subtable 1 @@ -813,7 +1270,47 @@ GLAPI void APIENTRY glCopyColorSubTableEXT(GLenum target, GLsizei start, GLint x typedef void (APIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); -#endif +#endif /* GL_EXT_color_subtable */ + + + +/* + * 75. GLU_EXT_object_space_tess + */ + + + +/* + * 76. GL_PGI_vertex_hints + */ +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 + +#define GL_VERTEX_DATA_HINT_PGI 107050 +#define GL_VERTEX_CONSISTENT_HINT_PGI 107051 +#define GL_VATERIAL_SIDE_HINT_PGI 107052 +#define GL_VAX_VERTEX_HINT_PGI 107053 +#define GL_VOLOR3_BIT_PGI 0x00010000 +#define GL_VOLOR4_BIT_PGI 0x00020000 +#define GL_VDGEFLAG_BIT_PGI 0x00040000 +#define GL_VNDEX_BIT_PGI 0x00080000 +#define GL_VAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_VAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_VAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_VAT_EMISSION_BIT_PGI 0x00800000 +#define GL_VAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_VAT_SHININESS_BIT_PGI 0x02000000 +#define GL_VAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_VORMAL_BIT_PGI 0x08000000 +#define GL_VEXCOORD1_BIT_PGI 0x10000000 +#define GL_VEXCOORD2_BIT_PGI 0x20000000 +#define GL_VEXCOORD3_BIT_PGI 0x40000000 +#define GL_VEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 + +#endif /* GL_PGI_vertex_hints */ + /* @@ -836,7 +1333,6 @@ typedef void (APIENTRY * PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei #define GL_ALLOW_DRAW_OBJ_HINT_PGI 107022 #define GL_ALLOW_DRAW_WIN_HINT_PGI 107023 #define GL_ALLOW_DRAW_FRG_HINT_PGI 107024 -#define GL_ALLOW_DRAW_SPN_HINT_PGI 107024 #define GL_ALLOW_DRAW_MEM_HINT_PGI 107025 #define GL_CLIP_NEAR_HINT_PGI 107040 #define GL_CLIP_FAR_HINT_PGI 107041 @@ -882,7 +1378,9 @@ GLAPI void APIENTRY glGetColorTableParameterfvEXT(GLenum target, GLenum pname, G GLAPI void APIENTRY glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint *params); typedef void (APIENTRY * PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +#ifndef GL_EXT_color_subtable typedef void (APIENTRY * PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +#endif typedef void (APIENTRY * PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); typedef void (APIENTRY * PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); @@ -930,14 +1428,72 @@ typedef void (APIENTRY * PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum name /* + * 81. GL_SGIX_ir_instrument1 + */ +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 + +#define GL_IR_INSTRUMENT1_SGIX 0x817F + +#endif /* GL_SGIX_ir_instrument1 */ + + + +/* + * 82. unknown + * 83. GLX_SGIX_video_resize + */ + + + +/* + * 84. GL_SGIX_texture_lod_bias + */ +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 + +#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E +#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F +#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190 + +#endif /* GL_SGIX_texture_lod_bias */ + + + +/* + * 85. GLU_SGI_filter4_parameters + * 86. GLX_SGIX_dm_buffer + * 87. unknown + * 88. unknown + * 89. unknown + * 90. unknown + * 91. GLX_SGIX_swap_group + * 92. GLX_SGIX_swap_barrier + */ + + + +/* + * 93. GL_EXT_index_texture + */ +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 + +/* No new tokens or functions */ + +#endif /* GL_EXT_index_texture */ + + + +/* * 94. GL_EXT_index_material */ #ifndef GL_EXT_index_material #define GL_EXT_index_material 1 -#define GL_INDEX_MATERIAL_EXT ? -#define GL_INDEX_MATERIAL_PARAMETER_EXT ? -#define GL_INDEX_MATERIAL_FACE_EXT ? +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA GLAPI void APIENTRY glIndexMaterialEXT(GLenum face, GLenum mode); @@ -953,9 +1509,9 @@ typedef void (APIENTRY * PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); #ifndef GL_EXT_index_func #define GL_EXT_index_func 1 -#define GL_INDEX_TEST_EXT ? -#define GL_INDEX_TEST_FUNC_EXT ? -#define GL_INDEX_TEST_REF_EXT ? +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 GLAPI void APIENTRY glIndexFuncEXT(GLenum func, GLfloat ref); @@ -966,6 +1522,25 @@ typedef void (APIENTRY * PFNGLINDEXFUNCEXTPROC) (GLenum func, GLfloat ref); /* + * 96. GL_EXT_index_array_formats + */ +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 + +#define GL_IUI_V2F_EXT 0x81AD +#define GL_IUI_V3F_EXT 0x81AE +#define GL_IUI_N3F_V2F_EXT 0x81AF +#define GL_IUI_N3F_V3F_EXT 0x81B0 +#define GL_T2F_IUI_V2F_EXT 0x81B1 +#define GL_T2F_IUI_V3F_EXT 0x81B2 +#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3 +#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4 + +#endif /* GL_EXT_index_array_formats */ + + + +/* * 97. GL_EXT_compiled_vertex_array */ #ifndef GL_EXT_compiled_vertex_array @@ -1005,6 +1580,26 @@ typedef void (APIENTRY * PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat* pa /* + * 99. unknown + * 100. GLU_EXT_nurbs_tessellator + */ + + + +/* + * 101. GL_SGIX_ycrcb + */ +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 + +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC + +#endif /* GL_SGIX_ycrcb */ + + + +/* * 102. GL_SGIX_fragment_lighting */ #ifndef GL_SGIX_fragment_lighting @@ -1053,6 +1648,161 @@ typedef void (APIENTRY * PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); /* + * 103. unknown + * 104. unknown + * 105. unknown + * 106. unknown + * 107. unknown + * 108. unknown + * 109. unknown + */ + + + +/* + * 110. GL_IBM_rasterpos_clip + */ +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 + +#endif /* GL_IBM_rasterpos_clip */ + + + +/* + * 111. GL_HP_texture_lighting + */ +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 + +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 + +#endif /* GL_HP_texture_lighting */ + + + +/* + * 112. GL_EXT_draw_range_elements + */ +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 + +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 + +GLAPI void APIENTRY glDrawRangeElementsEXT(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); + +typedef void (APIENTRY * PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); + +#endif /* GL_EXT_draw_range_elements */ + + + +/* + * 113. GL_WIN_phong_shading + */ +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 + +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB + +#endif /* GL_WIN_phong_shading */ + + + +/* + * 114. GL_WIN_specular_fog + */ +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 + +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC + +#endif /* GL_WIN_specular_fog */ + + + +/* + * 115. unknown + * 116. unknown + */ + + + +/* + * 117. GL_EXT_light_texture + */ +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 + +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A + +#define GL_FRAGMENT_DEPTH_EXT_834B 0x834B /* DUPLICATE! */ +#define GL_FRAGMENT_COLOR_EXT 0x834C +#define GL_ATTENUATION_EXT 0x834D +#define GL_SHADOW_ATTENUATION_EXT 0x834E +#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F +#define GL_TEXTURE_LIGHT_EXT 0x8350 +#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351 +#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352 + +GLAPI void APIENTRY glApplyTextureEXT(GLenum mode); +GLAPI void APIENTRY glTextureLightEXT(GLenum pname); +GLAPI void APIENTRY glTextureMaterialEXT(GLenum face, GLenum mode); + +typedef void (APIENTRY * PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRY * PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRY * PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); + +#endif /* GL_EXT_light_texture */ + + + +/* + * 118. unknown + */ + + + +/* + * 119. GL_SGIX_blend_alpha_minmax + */ +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 + +#endif /* GL_SGIX_blend_alpha_minmax */ + + + +/* + * 120. GL_EXT_scene_marker + */ +#ifndef GL_EXT_scene_marker +#define GL_EXT_scene_marker 1 + +#endif /* GL_EXT_scene_marker */ + + + +/* + * 121. unknown + * 122. unknown + * 123. unknown + * 124. unknown + * 125. unknown + * 126. unknown + * 127. unknown + * 128. unknown + */ + + + +/* * 129. GL_EXT_bgra */ #ifndef GL_EXT_bgra @@ -1066,6 +1816,122 @@ typedef void (APIENTRY * PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); /* + * 130. unknown + * 131. unknown + * 132. unknown + * 133. unknown + * 134. unknown + */ + + + +/* + * 135. GL_INTEL_texture_scissor + */ +#ifndef GL_INTEL_texture_scissor +#define GL_INTEL_texture_scissor 1 + +#define GL_TEXTURE_SCISSOR_INTEL ? +#define GL_TEXTURE_SCISSOR_S_INTEL ? +#define GL_TEXTURE_SCISSOR_T_INTEL ? +#define GL_TEXTURE_SCISSOR_R_INTEL ? + +GLAPI void APIENTRY glTexScissorINTEL(GLenum target, GLclampf tlow, GLclampf thigh); +GLAPI void APIENTRY glTexScissorFuncINTEL(GLenum target, GLenum lfunc, GLenum hfunc); + +typedef void (APIENTRY * PFNGLTEXSCISSORINTELPROC) (GLenum target, GLclampf tlow, GLclampf thigh); +typedef void (APIENTRY * PFNGLTEXSCISSORFUNCINTELPROC) (GLenum target, GLenum lfunc, GLenum hfunc); + +#endif /* GL_INTEL_texture_scissor */ + + + +/* + * 136. GL_INTEL_parallel_arrays + */ +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 + +#define GL_PARALLEL_ARRAYS_INTEL 0x83F4 +#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5 +#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6 +#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7 +#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8 + +GLAPI void APIENTRY glVertexPointervINTEL(GLint size, GLenum type, const void ** pointer); +GLAPI void APIENTRY glNormalPointervINTEL(GLenum type, const void** pointer); +GLAPI void APIENTRY glColorPointervINTEL(GLint size, GLenum type, const void** pointer); +GLAPI void APIENTRY glTexCoordPointervINTEL(GLint size, GLenum type, const void** pointer); + +typedef void (APIENTRY * PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void ** pointer); +typedef void (APIENTRY * PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void** pointer); +typedef void (APIENTRY * PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); +typedef void (APIENTRY * PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void** pointer); + +#endif /* GL_INTEL_parallel_arrays */ + + + +/* + * 137. GL_HP_occlusion_test + */ +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 + +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 + +#endif /* GL_HP_occlusion_test */ + + + +/* + * 138. GL_EXT_pixel_transform + */ +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 + +#define GL_PIXEL_MAG_FILTER_EXT 0x8331 +#define GL_PIXEL_MIN_FILTER_EXT 0x8332 +#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333 +#define GL_CUBIC_EXT 0x8334 +#define GL_AVERAGE_EXT 0x8335 +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 + +GLAPI void APIENTRY glPixelTransformParameteriEXT(GLenum target, GLenum pname, const GLint param); +GLAPI void APIENTRY glPixelTransformParameterfEXT(GLenum target, GLenum pname, const GLfloat param); +GLAPI void APIENTRY glPixelTransformParameterivEXT(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glPixelTransformParameterfvEXT(GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glGetPixelTransformParameterivEXT(GLenum target, GLenum pname, const GLint *params); +GLAPI void APIENTRY glGetPixelTransformParameterfvEXT(GLenum target, GLenum pname, const GLfloat *params); + +#endif /* GL_EXT_pixel_transform */ + + + +/* + * 139. GL_EXT_pixel_transform_color_table + */ +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 + +#define GL_PIXEL_TRANSFORM_COLOR_TABLE_EXT ? +#define GL_PROXY_PIXEL_TRANSFORM_COLOR_TABLE_EXT ? + +#endif /* GL_EXT_pixel_transform_color_table */ + + + +/* + * 140. unknown + */ + + + +/* * 141. GL_EXT_shared_texture_palette (req's GL_EXT_paletted_texture) */ #ifndef GL_EXT_shared_texture_palette @@ -1078,6 +1944,147 @@ typedef void (APIENTRY * PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); /* + * 142. unknown + * 143. unknown + */ + + + +/* + * 144. GL_EXT_separate_specular_color + */ +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 + +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA + +#endif /* GL_EXT_separate_specular_color */ + + + +/* + * 145. GL_EXT_secondary_color + */ +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 + +#define GL_COLOR_SUM_EXT 0x8458 +#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D +#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E + +GLAPI void APIENTRY glSecondaryColor3bEXT(GLbyte red, GLbyte green, GLbyte blue); +GLAPI void APIENTRY glSecondaryColor3dEXT(GLdouble red, GLdouble green, GLdouble blue); +GLAPI void APIENTRY glSecondaryColor3fEXT(GLfloat red, GLfloat green, GLfloat blue); +GLAPI void APIENTRY glSecondaryColor3iEXT(GLint red, GLint green, GLint blue); +GLAPI void APIENTRY glSecondaryColor3sEXT(GLshort red, GLshort green, GLshort blue); +GLAPI void APIENTRY glSecondaryColor3ubEXT(GLubyte red, GLubyte green, GLubyte blue); +GLAPI void APIENTRY glSecondaryColor3uiEXT(GLuint red, GLuint green, GLuint blue); +GLAPI void APIENTRY glSecondaryColor3usEXT(GLushort red, GLushort green, GLushort blue); +GLAPI void APIENTRY glSecondaryColor4bEXT(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +GLAPI void APIENTRY glSecondaryColor4dEXT(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); +GLAPI void APIENTRY glSecondaryColor4fEXT(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY glSecondaryColor4iEXT(GLint red, GLint green, GLint blue, GLint alpha); +GLAPI void APIENTRY glSecondaryColor4sEXT(GLshort red, GLshort green, GLshort blue, GLshort alpha); +GLAPI void APIENTRY glSecondaryColor4ubEXT(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GLAPI void APIENTRY glSecondaryColor4uiEXT(GLuint red, GLuint green, GLuint blue, GLuint alpha); +GLAPI void APIENTRY glSecondaryColor4usEXT(GLushort red, GLushort green, GLushort blue, GLushort alpha); +GLAPI void APIENTRY glSecondaryColor3bvEXT(const GLbyte *v); +GLAPI void APIENTRY glSecondaryColor3dvEXT(const GLdouble *v); +GLAPI void APIENTRY glSecondaryColor3fvEXT(const GLfloat *v); +GLAPI void APIENTRY glSecondaryColor3ivEXT(const GLint *v); +GLAPI void APIENTRY glSecondaryColor3svEXT(const GLshort *v); +GLAPI void APIENTRY glSecondaryColor3ubvEXT(const GLubyte *v); +GLAPI void APIENTRY glSecondaryColor3uivEXT(const GLuint *v); +GLAPI void APIENTRY glSecondaryColor3usvEXT(const GLushort *v); +GLAPI void APIENTRY glSecondaryColor4bvEXT(const GLbyte *v); +GLAPI void APIENTRY glSecondaryColor4dvEXT(const GLdouble *v); +GLAPI void APIENTRY glSecondaryColor4fvEXT(const GLfloat *v); +GLAPI void APIENTRY glSecondaryColor4ivEXT(const GLint *v); +GLAPI void APIENTRY glSecondaryColor4svEXT(const GLshort *v); +GLAPI void APIENTRY glSecondaryColor4ubvEXT(const GLubyte *v); +GLAPI void APIENTRY glSecondaryColor4uivEXT(const GLuint *v); +GLAPI void APIENTRY glSecondaryColor4usvEXT(const GLushort *v); +GLAPI void APIENTRY glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLvoid *pointer); + +#endif /* GL_EXT_secondary_color */ + + + +/* + * 146. GL_EXT_texture_env + */ +#ifndef GL_EXT_texture_env +#define GL_EXT_texture_env 1 + +#define GL_TEXTURE_ENV0_EXT 0x? +#define GL_TEXTURE_ENV1_EXT (GL_TEXTURE_ENV0_EXT+1) +#define GL_TEXTURE_ENV2_EXT (GL_TEXTURE_ENV0_EXT+2) +#define GL_TEXTURE_ENV3_EXT (GL_TEXTURE_ENV0_EXT+3) +#define GL_TEXTURE_ENV4_EXT (GL_TEXTURE_ENV0_EXT+4) +#define GL_TEXTURE_ENV5_EXT (GL_TEXTURE_ENV0_EXT+5) +#define GL_TEXTURE_ENV6_EXT (GL_TEXTURE_ENV0_EXT+6) +#define GL_TEXTURE_ENV7_EXT (GL_TEXTURE_ENV0_EXT+7) +#define GL_TEXTURE_ENV8_EXT (GL_TEXTURE_ENV0_EXT+8) +#define GL_TEXTURE_ENV9_EXT (GL_TEXTURE_ENV0_EXT+9) +#define GL_TEXTURE_ENV10_EXT (GL_TEXTURE_ENV0_EXT+10) +#define GL_TEXTURE_ENV11_EXT (GL_TEXTURE_ENV0_EXT+11) +#define GL_TEXTURE_ENV12_EXT (GL_TEXTURE_ENV0_EXT+12) +#define GL_TEXTURE_ENV13_EXT (GL_TEXTURE_ENV0_EXT+13) +#define GL_TEXTURE_ENV14_EXT (GL_TEXTURE_ENV0_EXT+14) +#define GL_TEXTURE_ENV15_EXT (GL_TEXTURE_ENV0_EXT+15) +#define GL_TEXTURE_ENV_MODE_ALPHA_EXT 0x? +#define GL_ENV_COPY_EXT 0x? +#define GL_ENV_REPLACE_EXT 0x? +#define GL_ENV_MODULATE_EXT 0x? +#define GL_ENV_ADD_EXT 0x? +#define GL_ENV_SUBTRACT_EXT 0x? +#define GL_ENV_REVERSE_SUBTRACT_EXT 0x? +#define GL_ENV_BLEND_EXT 0x? +#define GL_ENV_REVERSE_BLEND_EXT 0x? +#define GL_TEXTURE_ENV_SHIFT_EXT 0x? + +#endif /* GL_EXT_texture_env */ + + + +/* + * 147. GL_EXT_texture_perturb_normal + */ +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 + +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF + +GLAPI void APIENTRY glTextureNormalEXT(GLenum mode); + +typedef void (APIENTRY * PFNGLTEXTURENORMALEXT) (GLenum mode); + +#endif /* GL_EXT_texture_perturb_normal */ + + + +/* + * 148. GL_EXT_multi_draw_arrays + */ +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 + +GLAPI void APIENTRY glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); + +typedef void (APIENTRY * PFNGLMULTIDRAWARRAYSEXT) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); + +#endif /* GL_EXT_multi_draw_arrays */ + + + +/* * 149. GL_EXT_fog_coord */ #ifndef GL_EXT_fog_coord @@ -1085,7 +2092,7 @@ typedef void (APIENTRY * PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); #define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 #define GL_FOG_COORDINATE_EXT 0x8451 -#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 /* DUPLICATE! */ #define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 #define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 #define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 @@ -1109,6 +2116,106 @@ typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stri /* + * 150. unknown + * 151. unknown + * 152. unknown + * 153. unknown + * 154. unknown + */ + + + +/* + * 155. GL_REND_screen_coordinates + */ +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 + +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 + +#endif /* GL_REND_screen_coordinates */ + + + +/* + * 156. GL_EXT_coordinate_frame + */ +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 + +#define GL_TANGENT_ARRAY_EXT 0x8439 +#define GL_BINORMAL_ARRAY_EXT 0x843A +#define GL_CURRENT_TANGENT_EXT 0x843B +#define GL_CURRENT_BINORMAL_EXT 0x843C +#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E +#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F +#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440 +#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441 +#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442 +#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443 +#define GL_MAP1_TANGENT_EXT 0x8444 +#define GL_MAP2_TANGENT_EXT 0x8445 +#define GL_MAP1_BINORMAL_EXT 0x8446 +#define GL_MAP2_BINORMAL_EXT 0x8447 + +GLAPI void APIENTRY glTangent3bEXT(GLbyte x, GLbyte y, GLbyte z); +GLAPI void APIENTRY glTangent3dEXT(GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glTangent3fEXT(GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTangent3iEXT(GLint x, GLint y, GLint z); +GLAPI void APIENTRY glTangent3sEXT(GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glTangent3bvEXT(const GLbyte *v); +GLAPI void APIENTRY glTangent3dvEXT(const GLdouble *v); +GLAPI void APIENTRY glTangent3fvEXT(const GLfloat *v); +GLAPI void APIENTRY glTangent3ivEXT(const GLint *v); +GLAPI void APIENTRY glTangent3svEXT(const GLshort *v); +GLAPI void APIENTRY glBinormal3bEXT(GLbyte x, GLbyte y, GLbyte z); +GLAPI void APIENTRY glBinormal3dEXT(GLdouble x, GLdouble y, GLdouble z); +GLAPI void APIENTRY glBinormal3fEXT(GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glBinormal3iEXT(GLint x, GLint y, GLint z); +GLAPI void APIENTRY glBinormal3sEXT(GLshort x, GLshort y, GLshort z); +GLAPI void APIENTRY glBinormal3bvEXT(const GLbyte *v); +GLAPI void APIENTRY glBinormal3dvEXT(const GLdouble *v); +GLAPI void APIENTRY glBinormal3fvEXT(const GLfloat *v); +GLAPI void APIENTRY glBinormal3ivEXT(const GLint *v); +GLAPI void APIENTRY glBinormal3svEXT(const GLshort *v); +GLAPI void APIENTRY glTangentPointerEXT(GLenum type, GLsizei stride, GLvoid *pointer); +GLAPI void APIENTRY glBinormalPointerEXT(GLenum type, GLsizei stride, GLvoid *pointer); + +typedef void (APIENTRY * PFNGLTANGENT3BEXT) (GLbyte x, GLbyte y, GLbyte z); +typedef void (APIENTRY * PFNGLTANGENT3DEXT) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRY * PFNGLTANGENT3FEXT) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTANGENT3IEXT) (GLint x, GLint y, GLint z); +typedef void (APIENTRY * PFNGLTANGENT3SEXT) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRY * PFNGLTANGENT3BVEXT) (const GLbyte *v); +typedef void (APIENTRY * PFNGLTANGENT3DVEXT) (const GLdouble *v); +typedef void (APIENTRY * PFNGLTANGENT3FVEXT) (const GLfloat *v); +typedef void (APIENTRY * PFNGLTANGENT3IVEXT) (const GLint *v); +typedef void (APIENTRY * PFNGLTANGENT3SVEXT) (const GLshort *v); +typedef void (APIENTRY * PFNGLBINORMAL3BEXT) (GLbyte x, GLbyte y, GLbyte z); +typedef void (APIENTRY * PFNGLBINORMAL3DEXT) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRY * PFNGLBINORMAL3FEXT) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLBINORMAL3IEXT) (GLint x, GLint y, GLint z); +typedef void (APIENTRY * PFNGLBINORMAL3SEXT) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRY * PFNGLBINORMAL3BVEXT) (const GLbyte *v); +typedef void (APIENTRY * PFNGLBINORMAL3DVEXT) (const GLdouble *v); +typedef void (APIENTRY * PFNGLBINORMAL3FVEXT) (const GLfloat *v); +typedef void (APIENTRY * PFNGLBINORMAL3IVEXT) (const GLint *v); +typedef void (APIENTRY * PFNGLBINORMAL3SVEXT) (const GLshort *v); +typedef void (APIENTRY * PFNGLTANGENTPOINTEREXT) (GLenum type, GLsizei stride, GLvoid *pointer); +typedef void (APIENTRY * PFNGLBINORMALPOINTEREXT) (GLenum type, GLsizei stride, GLvoid *pointer); + +#endif /* GL_EXT_coordinate_frame */ + + + +/* + * 157. unknown + */ + + + +/* * 158. GL_EXT_texture_env_combine */ #ifndef GL_EXT_texture_env_combine @@ -1141,6 +2248,232 @@ typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stri /* + * 159. GL_APPLE_specular_vector + */ +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 + +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 + +#endif /* GL_APPLE_specular_vector */ + + + +/* + * 160. GL_APPLE_transform_hint + */ +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 + +#define GL_TRANSFORM_HINT_APPLE 0x85B1 + +#endif /* GL_APPLE_transform_hint */ + + + +/* + * 161. unknown + * 162. unknown + */ + + + +/* + * 163. GL_SUNX_constant_data + */ +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 + +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 + +GLAPI void APIENTRY glFinishTextureSUNX(void); + +typedef void (APIENTRY * PFNGLFINISHTEXTURESUNX) (void); + +#endif /* GL_SUNX_constant_data */ + + + +/* + * 164. GL_SUN_global_alpha + */ +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 + +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA + +GLAPI void APIENTRY glGlobalAlphaFactorbSUN(GLbyte factor); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN(GLshort factor); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN(GLint factor); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN(GLfloat factor); +GLAPI void APIENTRY glGlobalAlphaFactordSUN(GLdouble factor); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN(GLubyte factor); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN(GLushort factor); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN(GLuint factor); + +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORBSUN) (GLbyte factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORSSUN) (GLshort factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORISUN) (GLint factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORFSUN) (GLfloat factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORDSUN) (GLdouble factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUBSUN) (GLubyte factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUSSUN) (GLushort factor); +typedef void (APIENTRY * PFNGLGLOBALALPHAFACTORUISUN) (GLuint factor); + +#endif /* GL_SUN_global_alpha */ + + + +/* + * 165. GL_SUN_triangle_list + */ +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 + +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#define GL_RESTART_SUN 0x01 +#define GL_REPLACE_MIDDLE_SUN 0x02 +#define GL_REPLACE_OLDEST_SUN 0x03 +#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0 +#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1 +#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2 +#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3 +#define GL_R1UI_V3F_SUN 0x85C4 +#define GL_R1UI_C4UB_V3F_SUN 0x85C5 +#define GL_R1UI_C3F_V3F_SUN 0x85C6 +#define GL_R1UI_N3F_V3F_SUN 0x85C7 +#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8 +#define GL_R1UI_T2F_V3F_SUN 0x85C9 +#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA +#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB + +GLAPI void APIENTRY glReplacementCodeuiSUN(GLuint code); +GLAPI void APIENTRY glReplacementCodeusSUN(GLushort code); +GLAPI void APIENTRY glReplacementCodeubSUN(GLubyte code); +GLAPI void APIENTRY glReplacementCodeuivSUN(const GLuint *code); +GLAPI void APIENTRY glReplacementCodeusvSUN(const GLushort *code); +GLAPI void APIENTRY glReplacementCodeubvSUN(const GLubyte *code); +GLAPI void APIENTRY glReplacementCodePointerSUN(GLenum type, GLsizei stride, const GLvoid *pointer); + +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUISUN) (GLuint code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSSUN) (GLushort code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBSUN) (GLubyte code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVSUN) (const GLuint *code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUSVSUN) (const GLushort *code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUBVSUN) (const GLubyte *code); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEPOINTERSUN) (GLenum type, GLsizei stride, const GLvoid *pointer); + +#endif /* GL_SUN_triangle_list */ + + + +/* + * 166. GL_SUN_vertex + */ +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 + +GLAPI void APIENTRY glColor4ubVertex2fSUN(GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +GLAPI void APIENTRY glColor4ubVertex2fvSUN(const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glColor4ubVertex3fSUN(GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor4ubVertex3fvSUN(const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glColor3fVertex3fSUN(GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor3fVertex3fvSUN(const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glNormal3fVertex3fSUN(GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glNormal3fVertex3fvSUN(const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN(GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN(const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN(GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN(const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN(GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN(const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN(GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN(const GLfloat *tc, const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN(GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN(const GLfloat *tc, const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN(GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN(const GLfloat *tc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN(GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN(const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN(GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN(const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN(GLuint rc, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN(const GLuint *rc, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN(GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN(const GLuint *rc, const GLubyte *c, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN(GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN(const GLuint *rc, const GLfloat *c, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN(GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN(const GLuint *rc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN(GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN(const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN(GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN(const GLuint *rc, const GLfloat *tc, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN(GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN(const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN(GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN(const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); + +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FSUN) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX2FVSUN) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FSUN) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLCOLOR4UBVERTEX3FVSUN) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FSUN) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLCOLOR3FVERTEX3FVSUN) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FSUN) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLNORMAL3FVERTEX3FVSUN) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FSUN) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLCOLOR4FNORMAL3FVERTEX3FVSUN) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FSUN) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FVERTEX3FVSUN) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FSUN) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLTEXCOORD4FVERTEX4FVSUN) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUN) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUN) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUN) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUN) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUN) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUN) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUN) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUN) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUN) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRY * PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUN) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FSUN) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUIVERTEX3FVSUN) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUN) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUN) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUN) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUN) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUN) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUN) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUN) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUN) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUN) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUN) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUN) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUN) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUN) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRY * PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUN) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); + +#endif /* GL_SUN_vertex */ + + + +/* + * 167. WGL_EXT_display_color_table + * 168. WGL_EXT_extensions_string + * 169. WGL_EXT_make_current_read + * 170. WGL_EXT_pixel_format + * 171. WGL_EXT_pbuffer + * 172. WGL_EXT_swap_control + */ + + + +/* * 173. GL_EXT_blend_func_separate */ #ifndef GL_EXT_blend_func_separate @@ -1179,6 +2512,45 @@ typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLe /* + * 174. GL_INGR_color_clamp + */ +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 + +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 +#define GL_RED_MIN_CLAMP_INGR 0x8560 +#define GL_GREEN_MIN_CLAMP_INGR 0x8561 +#define GL_BLUE_MIN_CLAMP_INGR 0x8562 +#define GL_ALPHA_MIN_CLAMP_INGR 0x8563 +#define GL_RED_MAX_CLAMP_INGR 0x8564 +#define GL_GREEN_MAX_CLAMP_INGR 0x8565 +#define GL_BLUE_MAX_CLAMP_INGR 0x8566 +#define GL_ALPHA_MAX_CLAMP_INGR 0x8567 + +#endif /* GL_INGR_color_clamp */ + + + +/* + * 175. GL_INGR_interlace_read + */ +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 + +#define GL_INTERLACE_READ_INGR 0x8568 + +#endif /* GL_INGR_interlace_read */ + + + +/* * 176. GL_EXT_stencil_wrap */ #ifndef GL_EXT_stencil_wrap @@ -1192,6 +2564,27 @@ typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLe /* + * 177. WGL_EXT_depth_float + */ + + + +/* + * 178. GL_EXT_422_pixels + */ +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 + +#define GL_422_EXT 0x80CC +#define GL_422_REV_EXT 0x80CD +#define GL_422_AVERAGE_EXT 0x80CE +#define GL_422_REV_AVERAGE_EXT 0x80CF + +#endif /* GL_EXT_422_pixels */ + + + +/* * 179. GL_NV_texgen_reflection */ #ifndef GL_NV_texgen_reflection @@ -1205,6 +2598,32 @@ typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLe /* + * 180. unknown + * 181. unknown + */ + + + +/* + * 182. GL_SUN_convolution_border_modes + */ +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 + +#define GL_WRAP_BORDER_SUN 0x81D4 + +#endif /* GL_SUN_convolution_border_modes */ + + + +/* + * 183. GLX_SUN_transparent_index + * 184. unknown + */ + + + +/* * 185. GL_EXT_texture_env_add */ #ifndef GL_EXT_texture_env_add @@ -1217,16 +2636,28 @@ typedef void (APIENTRY * PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLe /* - * ??. GL_WIN_swap_hint + * 186. GL_EXT_texture_lod_bias */ -#ifndef GL_WIN_swap_hint -#define GL_WIN_swap_hint 1 +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 -GLAPI void APIENTRY glAddSwapHintRectWIN(GLint x, GLint y, GLsizei width, GLsizei height); +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 -typedef void (APIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +#endif /* GL_EXT_texture_lod_bias */ -#endif /* GL_WIN_swap_hint */ + + +/* + * 187. GL_EXT_texture_filter_anisotropic + */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 + +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF + +#endif /* GL_EXT_texture_filter_anisotropic */ @@ -1238,12 +2669,12 @@ typedef void (APIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei #define GL_VERTEX_WEIGHTING_EXT 0x8509 #define GL_MODELVIEW0_EXT 0x1700 -#define GL_MODELVIEW1_EXT 0x850a -#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850b -#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850c -#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850d -#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850e -#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850f +#define GL_MODELVIEW1_EXT 0x850A +#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B +#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C +#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D +#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E +#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F #define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3 #define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 #define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 @@ -1256,7 +2687,7 @@ typedef void (APIENTRY * PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); typedef void (APIENTRY * PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); -#endif +#endif /* GL_EXT_vertex_weighting */ @@ -1269,7 +2700,7 @@ typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum ty #define GL_MAX_SHININESS_NV 0x8507 #define GL_MAX_SPOT_EXPONENT_NV 0x8508 -#endif +#endif /* GL_NV_light_max_exponent */ @@ -1279,14 +2710,19 @@ typedef void (APIENTRY * PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum ty #ifndef GL_NV_vertex_array_range #define GL_NV_vertex_array_range 1 -/* TOKENS? */ +#define GL_VERTEX_ARRAY_RANGE_NV 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E +#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F +#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520 +#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521 GLAPI void APIENTRY glFlushVertexArrayRangeNV(void); GLAPI void APIENTRY glVertexArrayRangeNV(GLsizei size, const GLvoid * pointer); typedef void (APIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRY * PFNGLVERTEXARRAYRANGENV) (GLsizei size, const GLvoid * pointer); -#endif +#endif /* GL_NV_vertex_array_range */ @@ -1296,7 +2732,57 @@ typedef void (APIENTRY * PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); #ifndef GL_NV_register_combiners #define GL_NV_register_combiners 1 -/* TOKENS? */ +#define GL_REGISTER_COMBINERS_NV 0x8522 +#define GL_COMBINER0_NV 0x8550 +#define GL_COMBINER1_NV 0x8551 +#define GL_COMBINER2_NV 0x8552 +#define GL_COMBINER3_NV 0x8553 +#define GL_COMBINER4_NV 0x8554 +#define GL_COMBINER5_NV 0x8555 +#define GL_COMBINER6_NV 0x8556 +#define GL_COMBINER7_NV 0x8557 +#define GL_VARIABLE_A_NV 0x8523 +#define GL_VARIABLE_B_NV 0x8524 +#define GL_VARIABLE_C_NV 0x8525 +#define GL_VARIABLE_D_NV 0x8526 +#define GL_VARIABLE_E_NV 0x8527 +#define GL_VARIABLE_F_NV 0x8528 +#define GL_VARIABLE_G_NV 0x8529 +#define GL_CONSTANT_COLOR0_NV 0x852A +#define GL_CONSTANT_COLOR1_NV 0x852B +#define GL_PRIMARY_COLOR_NV 0x852C +#define GL_SECONDARY_COLOR_NV 0x852D +#define GL_SPARE0_NV 0x852E +#define GL_SPARE1_NV 0x852F +#define GL_UNSIGNED_IDENTITY_NV 0x8536 +#define GL_UNSIGNED_INVERT_NV 0x8537 +#define GL_EXPAND_NORMAL_NV 0x8538 +#define GL_EXPAND_NEGATE_NV 0x8539 +#define GL_HALF_BIAS_NORMAL_NV 0x853A +#define GL_HALF_BIAS_NEGATE_NV 0x853B +#define GL_SIGNED_IDENTITY_NV 0x853C +#define GL_SIGNED_NEGATE_NV 0x853D +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#define GL_SCALE_BY_TWO_NV 0x853E +#define GL_SCALE_BY_FOUR_NV 0x853F +#define GL_SCALE_BY_ONE_HALF_NV 0x8540 +#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541 +#define GL_DISCARD_NV 0x8530 +#define GL_COMBINER_INPUT_NV 0x8542 +#define GL_COMBINER_MAPPING_NV 0x8543 +#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544 +#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545 +#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546 +#define GL_COMBINER_MUX_SUM_NV 0x8547 +#define GL_COMBINER_SCALE_NV 0x8548 +#define GL_COMBINER_BIAS_NV 0x8549 +#define GL_COMBINER_AB_OUTPUT_NV 0x854A +#define GL_COMBINER_CD_OUTPUT_NV 0x854B +#define GL_COMBINER_SUM_OUTPUT_NV 0x854C +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#define GL_MAX_GENERAL_COMBINERS_NV 0x854D #ifdef VMS /*VMS only allows externals of maximal 31 characters! */ @@ -1345,15 +2831,21 @@ typedef void (APIENTRY * PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum va #ifndef GL_NV_fog_distance #define GL_NV_fog_distance 1 -#define GL_FOG_DISTANCE_MODE_NV 0x855a -#define GL_EYE_RADIAL_NV 0x855b -#define GL_EYE_PLANE_ABSOLUTE_NV 0x855c +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C #endif /* GL_NV_fog_distance*/ /* + * 193. unknown + */ + + + +/* * 194. GL_NV_blend_square */ #ifndef GL_NV_blend_square @@ -1455,7 +2947,196 @@ typedef void (APIENTRY * PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *p); /* - * ARB 0. GL_ARB_multitexture + * 198. GL_EXT_texture_compression_s3tc + */ +#ifndef GL_EXT_texture_compression_s3tc +#define GL_EXT_texture_compression_s3tc 1 + +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 + +#endif /* GL_EXT_texture_compression_s3tc */ + + + +/* + * 199. GL_IBM_cull_vertex + */ +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 + +#define GL_CULL_VERTEX_IBM 103050 + +#endif /* GL_IBM_cull_vertex */ + + +/* + * 200. GL_IBM_multimode_draw_arrays + */ +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 + +GLAPI void APIENTRY glMultiModeDrawArraysIBM(GLenum *mode, GLint *first, GLsizei *count, GLsizei primcount, GLint modestride); +GLAPI void APIENTRY glMultiModeDrawElementsIBM(GLenum *mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount, GLint modestride); + +typedef void (APIENTRY * PFNGLGLMULTIMODEDRAWARRAYSIBMPROC) (GLenum *mode, GLint *first, GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRY * PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (GLenum *mode, GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount, GLint modestride); + +#endif /* GL_IBM_multimode_draw_arrays */ + + + +/* + * 201. GL_IBM_vertex_array_lists + */ +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 + +#define GL_VERTEX_ARRAY_LIST_IBM 103070 +#define GL_NORMAL_ARRAY_LIST_IBM 103071 +#define GL_COLOR_ARRAY_LIST_IBM 103072 +#define GL_INDEX_ARRAY_LIST_IBM 103073 +#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074 +#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075 +#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076 +#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077 +#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080 +#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081 +#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082 +#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083 +#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084 +#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085 +#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086 +#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087 + +GLAPI void APIENTRY glColorPointerListIBM(GLint size, GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +GLAPI void APIENTRY glSecondaryColorPointerListIBM(GLint size, GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +GLAPI void APIENTRY glEdgeFlagPointerListIBM(GLint stride, const GLboolean **pointer, GLint ptrstride); +GLAPI void APIENTRY glFogCoordPointerListIBM(GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +GLAPI void APIENTRY glIndexPointerListIBM(GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +GLAPI void APIENTRY glNormalPointerListIBM(GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +GLAPI void APIENTRY glTexCoordPointerListIBM(GLint size, GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +GLAPI void APIENTRY glVertexPointerListIBM(GLint size, GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); + +typedef void (APIENTRY * PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean **pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); +typedef void (APIENTRY * PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid **pointer, GLint ptrstride); + +#endif /* GL_IBM_multimode_draw_arrays */ + + + +/* + * 202. ? + * 203. ? + * 204. ? + * 205. ? + */ + + +/* + * 206. GL_3DFX_texture_compression_FXT1 + */ +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 + +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 + +#endif /* GL_3DFX_texture_compression_FXT1 */ + + + +/* + * 207. GL_3DFX_multisample + */ +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 + +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 + +#endif /* GL_3DFX_multisample */ + + + +/* + * 208. GL_3DFX_tbuffer + */ +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 + +GLAPI void APIENTRY glTbufferMask3DFX(GLuint mask); + +typedef void (APIENTRY * PFNGLTBUFFERMASK3DFXPROC) (GLuint mask ); + +#endif /* GL_3DFX_tbuffer */ + + + +/* + * 209. WGL_EXT_multisample + */ +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 + +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#define GL_SAMPLE_MASK_EXT 0x80A0 + +GLAPI void APIENTRY glSampleMaskEXT(GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSamplePatternEXT(GLenum pattern); + +typedef void (APIENTRY * PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRY * PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); + +#endif /* WGL_EXT_multisample */ + + + +/* + * 210. GL_SGIX_vertex_preclip + */ +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 + +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF + +#endif /* GL_SGIX_vertex_preclip */ + + + +/* + * 212. GL_SGIX_resample + */ +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 + +#define GL_PACK_RESAMPLE_SGIX 0x842E +#define GL_UNPACK_RESAMPLE_SGIX 0x842F +#define GL_RESAMPLE_REPLICATE_SGIX 0x8433 +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434 +#define GL_RESAMPLE_DECIMATE_SGIX 0x0 /*?*/ + +#endif /* GL_SGIX_resample */ + + + +/* + * ARB 1. GL_ARB_multitexture */ #ifndef GL_ARB_multitexture #define GL_ARB_multitexture 1 @@ -1571,7 +3252,12 @@ typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLs /* - * ARB 2. GL_ARB_tranpose_matrix + * ARB 2. GLX_ARB_get_proc_address + */ + + +/* + * ARB 3. GL_ARB_tranpose_matrix */ #ifndef GL_ARB_transpose_matrix #define GL_ARB_transpose_matrix 1 @@ -1581,10 +3267,10 @@ typedef void (APIENTRY * PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLs #define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5 #define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6 -GLAPI void APIENTRY glLoadTransposeMatrixdARB( const GLdouble m[16] ); -GLAPI void APIENTRY glLoadTransposeMatrixfARB( const GLfloat m[16] ); -GLAPI void APIENTRY glMultTransposeMatrixdARB( const GLdouble m[16] ); -GLAPI void APIENTRY glMultTransposeMatrixfARB( const GLfloat m[16] ); +GLAPI void APIENTRY glLoadTransposeMatrixdARB(const GLdouble m[16]); +GLAPI void APIENTRY glLoadTransposeMatrixfARB(const GLfloat m[16]); +GLAPI void APIENTRY glMultTransposeMatrixdARB(const GLdouble m[16]); +GLAPI void APIENTRY glMultTransposeMatrixfARB(const GLfloat m[16]); typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXDARBPROC) ( const GLdouble m[16] ); typedef void (APIENTRY * PFNGLLOADTRANSPOSEMATRIXFARBPROC) ( const GLfloat m[16] ); @@ -1596,11 +3282,37 @@ typedef void (APIENTRY * PFNGLMULTTRANSPOSEMATRIXFARBPROC) ( const GLfloat m[16] /* - * ARB 4. GL_ARB_multisample + * ARB 4. WGL_ARB_buffer_region + */ + + + +/* + * ARB 5. GL_ARB_multisample */ #ifndef GL_ARB_multisample #define GL_ARB_multisample 1 +#define GL_MULTISAMPLE_ARBfunda 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F +#define GL_SAMPLE_COVERAGE_ARB 0x80A0 +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#define GL_1PASS_ARB 0x80A1 +#define GL_2PASS_0_ARB 0x80A2 +#define GL_2PASS_1_ARB 0x80A3 +#define GL_4PASS_0_ARB 0x80A4 +#define GL_4PASS_1_ARB 0x80A5 +#define GL_4PASS_2_ARB 0x80A6 +#define GL_4PASS_3_ARB 0x80A7 +#define GL_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_MAX_PASSES_ARB 0x84E7 +#define GL_SAMPLE_PASS_ARB 0x84E8 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +/* Note: there are more tokens for GLX and WGL */ + GLAPI void APIENTRY glSamplePassARB(GLenum pass); GLAPI void APIENTRY glSampleCoverageARB(GLclampf value, GLboolean invert); @@ -1611,6 +3323,158 @@ typedef void (APIENTRY * PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean +/* + * ARB 6. GL_ARB_texture_env_add + */ +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 + +/* No new tokens or functions */ + +#endif /* GL_ARB_texture_env_add */ + + + +/* + * ARB 7. GL_ARB_texture_cube_map + */ +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 + +#define GL_NORMAL_MAP_ARB 0x8511 +#define GL_REFLECTION_MAP_ARB 0x8512 +#define GL_TEXTURE_CUBE_MAP_ARB 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C + +#endif /* GL_ARB_texture_cube_map */ + + + +/* + * ARB 8. WGL_ARB_extensions_string + * ARB 9. WGL_ARB_pixel_format + * ARB 10. WGL_ARB_make_current_read + * ARB 11. WGL_ARB_pbuffer + */ + + + +/* + * ARB 12. GL_ARB_texture_compression + */ +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 + +#define GL_COMPRESSED_ALPHA_ARB 0x84E9 +#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB +#define GL_COMPRESSED_INTENSITY_ARB 0x84EC +#define GL_COMPRESSED_RGB_ARB 0x84ED +#define GL_COMPRESSED_RGBA_ARB 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0 +#define GL_TEXTURE_COMPRESSED_ARB 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3 + +GLAPI void APIENTRY glCompressedTexImage3DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexImage2DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexImage1DARB(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glGetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img); + +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRY * PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLvoid *img); + +#endif /* GL_ARB_texture_compression */ + + + +/* + * ? GL_NV_texgen_emboss + */ + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 + +#define GL_EMBOSS_MAP_NV 0x855F +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E + +#endif /* GL_NV_texgen_emboss */ + + + +/* + * ?. GL_WIN_swap_hint + */ +#ifndef GL_WIN_swap_hint +#define GL_WIN_swap_hint 1 + +GLAPI void APIENTRY glAddSwapHintRectWIN(GLint x, GLint y, GLsizei width, GLsizei height); + +typedef void (APIENTRY * PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height); + +#endif /* GL_WIN_swap_hint */ + + + +/* + * ?. GL_IBM_cull_vertex + */ +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 + +#define GL_CULL_VERTEX_IBM 0x1928A + +#endif /* GL_IBM_cull_vertex */ + + + +/* + * ?. GL_IBM_static_data + */ +#ifndef GL_IBM_static_data +#define GL_IBM_static_data 1 + +#define GL_ALL_STATIC_DATA_IBM 0x19294 +#define GL_STATIC_VERTEX_ARRAY_IBM 0x19295 + +GLAPI void APIENTRY glFlushStaticDataIBM(GLenum target); + +typedef void (APIENTRY * PFNGLFLUSHSTATICDATAIBM) (GLenum target); + +#endif /* GL_IBM_static_data */ + + + +/* + * ?. GL_IBM_texture_mirrored_repeat + */ +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_IBM_texture_mirrored_repeat 1 + +#define GL_MIRRORED_REPEAT_IBM 0x8370 + +#endif /* GL_IBM_texture_mirrored_repeat */ + + + #ifdef __cplusplus } #endif diff --git a/xc/extras/Mesa/include/GL/osmesa.h b/xc/extras/Mesa/include/GL/osmesa.h new file mode 100644 index 000000000..c3bc43d0c --- /dev/null +++ b/xc/extras/Mesa/include/GL/osmesa.h @@ -0,0 +1,246 @@ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * Mesa Off-Screen rendering interface. + * + * This is an operating system and window system independent interface to + * Mesa which allows one to render images into a client-supplied buffer in + * main memory. Such images may manipulated or saved in whatever way the + * client wants. + * + * These are the API functions: + * OSMesaCreateContext - create a new Off-Screen Mesa rendering context + * OSMesaMakeCurrent - bind an OSMesaContext to a client's image buffer + * and make the specified context the current one. + * OSMesaDestroyContext - destroy an OSMesaContext + * OSMesaGetCurrentContext - return thread's current context ID + * OSMesaPixelStore - controls how pixels are stored in image buffer + * OSMesaGetIntegerv - return OSMesa state parameters + * + * + * The limits on the width and height of an image buffer are MAX_WIDTH and + * MAX_HEIGHT as defined in Mesa/src/config.h. Defaults are 1280 and 1024. + * You can increase them as needed but beware that many temporary arrays in + * Mesa are dimensioned by MAX_WIDTH or MAX_HEIGHT. + */ + + +#ifndef OSMESA_H +#define OSMESA_H + + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "GL/gl.h" + + +#define OSMESA_MAJOR_VERSION 3 +#define OSMESA_MINOR_VERSION 3 + + + +/* + * Values for the format parameter of OSMesaCreateContext() + * New in version 2.0. + */ +#define OSMESA_COLOR_INDEX GL_COLOR_INDEX +#define OSMESA_RGBA GL_RGBA +#define OSMESA_BGRA 0x1 +#define OSMESA_ARGB 0x2 +#define OSMESA_RGB GL_RGB +#define OSMESA_BGR 0x4 + + +/* + * OSMesaPixelStore() parameters: + * New in version 2.0. + */ +#define OSMESA_ROW_LENGTH 0x10 +#define OSMESA_Y_UP 0x11 + + +/* + * Accepted by OSMesaGetIntegerv: + */ +#define OSMESA_WIDTH 0x20 +#define OSMESA_HEIGHT 0x21 +#define OSMESA_FORMAT 0x22 +#define OSMESA_TYPE 0x23 + + +typedef struct osmesa_context *OSMesaContext; + + +#if defined(__BEOS__) || defined(__QUICKDRAW__) +#pragma export on +#endif + + +/* + * Create an Off-Screen Mesa rendering context. The only attribute needed is + * an RGBA vs Color-Index mode flag. + * + * Input: format - one of OSMESA_COLOR_INDEX, OSMESA_RGBA, OSMESA_BGRA, + * OSMESA_ARGB, OSMESA_RGB, or OSMESA_BGR. + * sharelist - specifies another OSMesaContext with which to share + * display lists. NULL indicates no sharing. + * Return: an OSMesaContext or 0 if error + */ +GLAPI OSMesaContext GLAPIENTRY OSMesaCreateContext( GLenum format, + OSMesaContext sharelist ); + + + + +/* + * Destroy an Off-Screen Mesa rendering context. + * + * Input: ctx - the context to destroy + */ +GLAPI void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx ); + + + +/* + * Bind an OSMesaContext to an image buffer. The image buffer is just a + * block of memory which the client provides. Its size must be at least + * as large as width*height*sizeof(type). Its address should be a multiple + * of 4 if using RGBA mode. + * + * Image data is stored in the order of glDrawPixels: row-major order + * with the lower-left image pixel stored in the first array position + * (ie. bottom-to-top). + * + * Since the only type initially supported is GL_UNSIGNED_BYTE, if the + * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA + * value. If the context is in color indexed mode, each pixel will be + * stored as a 1-byte value. + * + * If the context's viewport hasn't been initialized yet, it will now be + * initialized to (0,0,width,height). + * + * Input: ctx - the rendering context + * buffer - the image buffer memory + * type - data type for pixel components, only GL_UNSIGNED_BYTE + * supported now + * width, height - size of image buffer in pixels, at least 1 + * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx, + * invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1, + * width>internal limit or height>internal limit. + */ +GLAPI GLboolean GLAPIENTRY OSMesaMakeCurrent( OSMesaContext ctx, + void *buffer, GLenum type, + GLsizei width, GLsizei height ); + + + + +/* + * Return the current Off-Screen Mesa rendering context handle. + */ +GLAPI OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void ); + + + +/* + * Set pixel store/packing parameters for the current context. + * This is similar to glPixelStore. + * Input: pname - OSMESA_ROW_LENGTH + * specify actual pixels per row in image buffer + * 0 = same as image width (default) + * OSMESA_Y_UP + * zero = Y coordinates increase downward + * non-zero = Y coordinates increase upward (default) + * value - the value for the parameter pname + * + * New in version 2.0. + */ +GLAPI void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value ); + + + +/* + * Return an integer value like glGetIntegerv. + * Input: pname - + * OSMESA_WIDTH return current image width + * OSMESA_HEIGHT return current image height + * OSMESA_FORMAT return image format + * OSMESA_TYPE return color component data type + * OSMESA_ROW_LENGTH return row length in pixels + * OSMESA_Y_UP returns 1 or 0 to indicate Y axis direction + * value - pointer to integer in which to return result. + */ +GLAPI void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value ); + + + +/* + * Return the depth buffer associated with an OSMesa context. + * Input: c - the OSMesa context + * Output: width, height - size of buffer in pixels + * bytesPerValue - bytes per depth value (2 or 4) + * buffer - pointer to depth buffer values + * Return: GL_TRUE or GL_FALSE to indicate success or failure. + * + * New in Mesa 2.4. + */ +GLAPI GLboolean GLAPIENTRY OSMesaGetDepthBuffer( OSMesaContext c, + GLint *width, GLint *height, + GLint *bytesPerValue, + void **buffer ); + + +/* + * Return the color buffer associated with an OSMesa context. + * Input: c - the OSMesa context + * Output: width, height - size of buffer in pixels + * format - buffer format (OSMESA_FORMAT) + * buffer - pointer to depth buffer values + * Return: GL_TRUE or GL_FALSE to indicate success or failure. + * + * New in Mesa 3.3. + */ +GLAPI GLboolean GLAPIENTRY OSMesaGetColorBuffer( OSMesaContext c, + GLint *width, GLint *height, + GLint *format, + void **buffer ); + + +#if defined(__BEOS__) || defined(__QUICKDRAW__) +#pragma export off +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/xc/extras/Mesa/src/FX/fxapi.c b/xc/extras/Mesa/src/FX/fxapi.c index 425778a12..6d680bcb9 100644 --- a/xc/extras/Mesa/src/FX/fxapi.c +++ b/xc/extras/Mesa/src/FX/fxapi.c @@ -623,7 +623,7 @@ #if defined(FX) #include "fxdrv.h" -fxMesaContext fxMesaCurrentCtx=NULL; +static fxMesaContext fxMesaCurrentCtx=NULL; /* * Status of 3Dfx hardware initialization @@ -987,7 +987,8 @@ fxMesaContext GLAPIENTRY fxMesaCreateContext(GLuint win, else if (voodoo->nTexelfx == 2 && voodoo->fbiRev == 260 && voodoo->tmuConfig[0].tmuRev == 4 && - voodoo->tmuConfig[0].tmuRam == 2) { + (voodoo->tmuConfig[0].tmuRam == 2 || + voodoo->tmuConfig[0].tmuRam == 4)) { /* Voodoo 2 */ useBGR = GL_TRUE; system = "Voodoo2"; diff --git a/xc/extras/Mesa/src/FX/fxdd.c b/xc/extras/Mesa/src/FX/fxdd.c index edf43aa48..0d6f8b673 100644 --- a/xc/extras/Mesa/src/FX/fxdd.c +++ b/xc/extras/Mesa/src/FX/fxdd.c @@ -971,7 +971,7 @@ static const GLubyte *fxDDGetString(GLcontext *ctx, GLenum name) } } /* now make the GL_RENDERER string */ - sprintf(buffer, "Mesa DRI %s 20000420", hardware); + sprintf(buffer, "Mesa DRI %s 20000608", hardware); return buffer; } case GL_VENDOR: @@ -1192,7 +1192,6 @@ void fxDDInitExtensions( GLcontext *ctx ) gl_extensions_disable(ctx, "GL_EXT_blend_minmax"); gl_extensions_disable(ctx, "GL_EXT_blend_subtract"); gl_extensions_disable(ctx, "GL_EXT_blend_color"); - gl_extensions_disable(ctx, "GL_EXT_paletted_texture"); gl_extensions_add(ctx, DEFAULT_ON, "3DFX_set_global_palette", 0); diff --git a/xc/extras/Mesa/src/FX/fxddtex.c b/xc/extras/Mesa/src/FX/fxddtex.c index f57508df8..69ceebaa9 100644 --- a/xc/extras/Mesa/src/FX/fxddtex.c +++ b/xc/extras/Mesa/src/FX/fxddtex.c @@ -325,31 +325,31 @@ void fxDDTexParam(GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; - tfxTexInfo *ti=fxTMGetTexInfo(tObj); + fxMesaContext fxMesa = FX_CONTEXT(ctx); + tfxTexInfo *ti = fxTMGetTexInfo(tObj); - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDTexDel(%d,%x)\n",tObj->Name,(GLuint)ti); + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDTexDel(%d,%p)\n", tObj->Name, ti); } if (!ti) return; - fxTMFreeTexture(fxMesa,tObj); + fxTMFreeTexture(fxMesa, tObj); FREE(ti); - tObj->DriverData=NULL; + tObj->DriverData = NULL; - ctx->NewState|=NEW_TEXTURING; + ctx->NewState |= NEW_TEXTURING; } /* - * Convert gl_color_table table to Glide's format. + * Convert a gl_color_table texture palette to Glide's format. */ - -static void convertPalette(FxU32 data[256], const struct gl_color_table *table) +static void +convertPalette(FxU32 data[256], const struct gl_color_table *table) { const GLubyte *tableUB = (const GLubyte *) table->Table; GLint width = table->Size; @@ -415,28 +415,28 @@ static void convertPalette(FxU32 data[256], const struct gl_color_table *table) void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + fxMesaContext fxMesa = FX_CONTEXT(ctx); if (tObj) { /* per-texture palette */ tfxTexInfo *ti; - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDTexPalette(%d,%x)\n", - tObj->Name,(GLuint)tObj->DriverData); + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDTexPalette(%d,%x)\n", + tObj->Name, (GLuint) tObj->DriverData); } if (!tObj->DriverData) - tObj->DriverData=fxAllocTexObjData(fxMesa); - ti=fxTMGetTexInfo(tObj); + tObj->DriverData = fxAllocTexObjData(fxMesa); + ti = fxTMGetTexInfo(tObj); convertPalette(ti->palette.data, &tObj->Palette); - fxTexInvalidate(ctx,tObj); + fxTexInvalidate(ctx, tObj); } else { /* global texture palette */ - if (MESA_VERBOSE&VERBOSE_DRIVER) { - fprintf(stderr,"fxmesa: fxDDTexPalette(global)\n"); + if (MESA_VERBOSE & VERBOSE_DRIVER) { + fprintf(stderr, "fxmesa: fxDDTexPalette(global)\n"); } convertPalette(fxMesa->glbPalette.data, &ctx->Texture.Palette); - fxMesa->new_state|=FX_NEW_TEXTURING; + fxMesa->new_state |= FX_NEW_TEXTURING; ctx->Driver.RenderStart = fxSetupFXUnits; } } @@ -444,33 +444,35 @@ void fxDDTexPalette(GLcontext *ctx, struct gl_texture_object *tObj) void fxDDTexUseGlbPalette(GLcontext *ctx, GLboolean state) { - fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; + fxMesaContext fxMesa = FX_CONTEXT(ctx); if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDTexUseGlbPalette(%d)\n",state); } - if(state) { - fxMesa->haveGlobalPaletteTexture=1; + if (state) { + fxMesa->haveGlobalPaletteTexture = 1; - FX_grTexDownloadTable(GR_TMU0,GR_TEXTABLE_PALETTE,&(fxMesa->glbPalette)); + FX_grTexDownloadTable(GR_TMU0,GR_TEXTABLE_PALETTE, &(fxMesa->glbPalette)); if (fxMesa->haveTwoTMUs) - FX_grTexDownloadTable(GR_TMU1,GR_TEXTABLE_PALETTE,&(fxMesa->glbPalette)); - } else { - fxMesa->haveGlobalPaletteTexture=0; + FX_grTexDownloadTable(GR_TMU1, GR_TEXTABLE_PALETTE, &(fxMesa->glbPalette)); + } + else { + fxMesa->haveGlobalPaletteTexture = 0; - if((ctx->Texture.Unit[0].Current==ctx->Texture.Unit[0].CurrentD[2]) && - (ctx->Texture.Unit[0].Current!=NULL)) { - struct gl_texture_object *tObj=ctx->Texture.Unit[0].Current; + if ((ctx->Texture.Unit[0].Current == ctx->Texture.Unit[0].CurrentD[2]) && + (ctx->Texture.Unit[0].Current != NULL)) { + struct gl_texture_object *tObj = ctx->Texture.Unit[0].Current; if (!tObj->DriverData) - tObj->DriverData=fxAllocTexObjData(fxMesa); + tObj->DriverData = fxAllocTexObjData(fxMesa); - fxTexInvalidate(ctx,tObj); + fxTexInvalidate(ctx, tObj); } } } + static int logbase2(int n) { GLint i = 1; diff --git a/xc/extras/Mesa/src/FX/fxdrv.h b/xc/extras/Mesa/src/FX/fxdrv.h index 640a94744..eea75fc56 100644 --- a/xc/extras/Mesa/src/FX/fxdrv.h +++ b/xc/extras/Mesa/src/FX/fxdrv.h @@ -50,14 +50,10 @@ * you turn debugging on/off from the debugger. */ -#ifndef XFree86Server -#include <math.h> -#include <stdio.h> -#include <stdlib.h> -#include <limits.h> -#include <assert.h> -#else +#ifdef XFree86Server #include "GL/xf86glx.h" +#else +#include "glheader.h" #endif diff --git a/xc/extras/Mesa/src/FX/fxglidew.c b/xc/extras/Mesa/src/FX/fxglidew.c index 692a05dde..f01644a60 100644 --- a/xc/extras/Mesa/src/FX/fxglidew.c +++ b/xc/extras/Mesa/src/FX/fxglidew.c @@ -169,7 +169,17 @@ extern FxU32 FX_grTexMaxAddress(GrChipID_t tmu) { FxBool FX_grSstControl(FxU32 code) { #if defined(FX_GLIDE3) - (void) code; + /* The glide 3 sources call for grEnable/grDisable to be called in exchange + * for grSstControl. */ + switch(code) { + case GR_CONTROL_ACTIVATE: + grEnable(GR_PASSTHRU); + break; + case GR_CONTROL_DEACTIVATE: + grDisable(GR_PASSTHRU); + break; + } + /* Appearently GR_CONTROL_RESIZE can be ignored. */ return 1; /* OK? */ #else FxU32 result; @@ -400,6 +410,10 @@ int FX_grSstQueryHardware(GrHwConfiguration *c) return i; } + +#endif /* FX_GLIDE3 */ + +/* It appears to me that this function is needed either way. */ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, GrScreenResolution_t screen_resolution, GrScreenRefresh_t refresh_rate, @@ -438,7 +452,6 @@ FX_GrContext_t FX_grSstWinOpen( FxU32 hWnd, -#endif #else /* diff --git a/xc/extras/Mesa/src/FX/fxtritmp.h b/xc/extras/Mesa/src/FX/fxtritmp.h index 559ffcaef..6411d167a 100644 --- a/xc/extras/Mesa/src/FX/fxtritmp.h +++ b/xc/extras/Mesa/src/FX/fxtritmp.h @@ -259,12 +259,10 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, } } -#define DRAW_LINE(tmp0, tmp1, width) \ - if (width <= 1.0F) { \ - FX_grDrawLine(tmp0, tmp1); \ - } \ - else { \ - GrVertex verts[4]; \ +#define DRAW_LINE(tmp0, tmp1, width) \ + do { \ + const float xoff = 0.125, yoff = 0.125; \ + GrVertex verts[4]; \ float dx, dy, wx, wy; \ \ dx = tmp0->x - tmp1->x; \ @@ -283,20 +281,20 @@ static void TAG(fx_quad)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint e3, verts[2] = *tmp1; \ verts[3] = *tmp1; \ \ - verts[0].x = tmp0->x - wx; \ - verts[0].y = tmp0->y - wy; \ + verts[0].x = tmp0->x - wx + xoff; \ + verts[0].y = tmp0->y - wy + yoff; \ \ - verts[1].x = tmp0->x + wx; \ - verts[1].y = tmp0->y + wy; \ + verts[1].x = tmp0->x + wx + xoff; \ + verts[1].y = tmp0->y + wy + yoff; \ \ - verts[2].x = tmp1->x + wx; \ - verts[2].y = tmp1->y + wy; \ + verts[2].x = tmp1->x + wx + xoff; \ + verts[2].y = tmp1->y + wy + yoff; \ \ - verts[3].x = tmp1->x - wx; \ - verts[3].y = tmp1->y - wy; \ + verts[3].x = tmp1->x - wx + xoff; \ + verts[3].y = tmp1->y - wy + yoff; \ \ FX_grDrawPolygonVertexList(4, verts); \ - } + } while (0) #if (IND & FX_OFFSET) == 0 static void TAG(fx_line)(GLcontext *ctx, GLuint e1, GLuint e2, GLuint pv) diff --git a/xc/extras/Mesa/src/OSmesa/osmesa.c b/xc/extras/Mesa/src/OSmesa/osmesa.c new file mode 100644 index 000000000..62b18f9e6 --- /dev/null +++ b/xc/extras/Mesa/src/OSmesa/osmesa.c @@ -0,0 +1,1637 @@ + +/* + * Mesa 3-D graphics library + * Version: 3.3 + * + * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* + * Off-Screen Mesa rendering / Rendering into client memory space + * + * Note on thread safety: this driver is thread safe. All + * functions are reentrant. The notion of current context is + * managed by the core gl_make_current() and gl_get_current_context() + * functions. Those functions are thread-safe. + */ + + +#ifdef PC_HEADER +#include "all.h" +#else +#include "glheader.h" +#include "GL/osmesa.h" +#include "context.h" +#include "depth.h" +#include "mem.h" +#include "matrix.h" +#include "types.h" +#include "vb.h" +#include "extensions.h" +#endif + + +/* + * This is the OS/Mesa context struct. + * Notice how it includes a GLcontext. By doing this we're mimicking + * C++ inheritance/derivation. + * Later, we can cast a GLcontext pointer into an OSMesaContext pointer + * or vice versa. + */ +struct osmesa_context { + GLcontext gl_ctx; /* The core GL/Mesa context */ + GLvisual *gl_visual; /* Describes the buffers */ + GLframebuffer *gl_buffer; /* Depth, stencil, accum, etc buffers */ + GLenum format; /* either GL_RGBA or GL_COLOR_INDEX */ + void *buffer; /* the image buffer */ + GLint width, height; /* size of image buffer */ + GLuint pixel; /* current color index or RGBA pixel value */ + GLuint clearpixel; /* pixel for clearing the color buffer */ + GLint rowlength; /* number of pixels per row */ + GLint userRowLength; /* user-specified number of pixels per row */ + GLint rshift, gshift; /* bit shifts for RGBA formats */ + GLint bshift, ashift; + GLint rind, gind, bind; /* index offsets for RGBA formats */ + void *rowaddr[MAX_HEIGHT]; /* address of first pixel in each image row */ + GLboolean yup; /* TRUE -> Y increases upward */ + /* FALSE -> Y increases downward */ +}; + + + +/* A forward declaration: */ +static void osmesa_update_state( GLcontext *ctx ); + + + +/**********************************************************************/ +/***** Public Functions *****/ +/**********************************************************************/ + + +/* + * Create an Off-Screen Mesa rendering context. The only attribute needed is + * an RGBA vs Color-Index mode flag. + * + * Input: format - either GL_RGBA or GL_COLOR_INDEX + * sharelist - specifies another OSMesaContext with which to share + * display lists. NULL indicates no sharing. + * Return: an OSMesaContext or 0 if error + */ +OSMesaContext GLAPIENTRY +OSMesaCreateContext( GLenum format, OSMesaContext sharelist ) +{ + OSMesaContext osmesa; + GLint rshift, gshift, bshift, ashift; + GLint rind, gind, bind; + GLint indexBits, alphaBits; + GLboolean rgbmode; + GLboolean swalpha; + GLuint i4 = 1; + GLubyte *i1 = (GLubyte *) &i4; + GLint little_endian = *i1; + + swalpha = GL_FALSE; + rind = gind = bind = 0; + if (format==OSMESA_COLOR_INDEX) { + indexBits = 8; + rshift = gshift = bshift = ashift = 0; + rgbmode = GL_FALSE; + } + else if (format==OSMESA_RGBA) { + indexBits = 0; + alphaBits = 8; + if (little_endian) { + rshift = 0; + gshift = 8; + bshift = 16; + ashift = 24; + } + else { + rshift = 24; + gshift = 16; + bshift = 8; + ashift = 0; + } + rgbmode = GL_TRUE; + } + else if (format==OSMESA_BGRA) { + indexBits = 0; + alphaBits = 8; + if (little_endian) { + ashift = 0; + rshift = 8; + gshift = 16; + bshift = 24; + } + else { + bshift = 24; + gshift = 16; + rshift = 8; + ashift = 0; + } + rgbmode = GL_TRUE; + } + else if (format==OSMESA_ARGB) { + indexBits = 0; + alphaBits = 8; + if (little_endian) { + bshift = 0; + gshift = 8; + rshift = 16; + ashift = 24; + } + else { + ashift = 24; + rshift = 16; + gshift = 8; + bshift = 0; + } + rgbmode = GL_TRUE; + } + else if (format==OSMESA_RGB) { + indexBits = 0; + alphaBits = 0; + bshift = 0; + gshift = 8; + rshift = 16; + ashift = 24; + bind = 2; + gind = 1; + rind = 0; + rgbmode = GL_TRUE; + swalpha = GL_TRUE; + } + else if (format==OSMESA_BGR) { + indexBits = 0; + alphaBits = 0; + bshift = 0; + gshift = 8; + rshift = 16; + ashift = 24; + bind = 0; + gind = 1; + rind = 2; + rgbmode = GL_TRUE; + swalpha = GL_TRUE; + } + else { + return NULL; + } + + + osmesa = (OSMesaContext) CALLOC_STRUCT(osmesa_context); + if (osmesa) { + osmesa->gl_visual = gl_create_visual( rgbmode, + swalpha, /* software alpha */ + GL_FALSE, /* double buffer */ + GL_FALSE, /* stereo */ + DEFAULT_SOFTWARE_DEPTH_BITS, + STENCIL_BITS, + rgbmode ? ACCUM_BITS : 0, + indexBits, + 8, 8, 8, alphaBits ); + if (!osmesa->gl_visual) { + FREE(osmesa); + return NULL; + } + + if (!_mesa_initialize_context(&osmesa->gl_ctx, + osmesa->gl_visual, + sharelist ? &sharelist->gl_ctx + : (GLcontext *) NULL, + (void *) osmesa, GL_TRUE )) { + _mesa_destroy_visual( osmesa->gl_visual ); + FREE(osmesa); + return NULL; + } + gl_extensions_enable(&(osmesa->gl_ctx),"GL_HP_occlusion_test"); + gl_extensions_enable(&(osmesa->gl_ctx), "GL_ARB_texture_cube_map"); + + osmesa->gl_buffer = gl_create_framebuffer( osmesa->gl_visual, + osmesa->gl_visual->DepthBits > 0, + osmesa->gl_visual->StencilBits > 0, + osmesa->gl_visual->AccumRedBits > 0, + osmesa->gl_visual->AlphaBits > 0 ); + + if (!osmesa->gl_buffer) { + gl_destroy_visual( osmesa->gl_visual ); + gl_free_context_data( &osmesa->gl_ctx ); + FREE(osmesa); + return NULL; + } + osmesa->format = format; + osmesa->buffer = NULL; + osmesa->width = 0; + osmesa->height = 0; + osmesa->pixel = 0; + osmesa->clearpixel = 0; + osmesa->userRowLength = 0; + osmesa->rowlength = 0; + osmesa->yup = GL_TRUE; + osmesa->rshift = rshift; + osmesa->gshift = gshift; + osmesa->bshift = bshift; + osmesa->ashift = ashift; + osmesa->rind = rind; + osmesa->gind = gind; + osmesa->bind = bind; + } + return osmesa; +} + + + +/* + * Destroy an Off-Screen Mesa rendering context. + * + * Input: ctx - the context to destroy + */ +void GLAPIENTRY OSMesaDestroyContext( OSMesaContext ctx ) +{ + if (ctx) { + gl_destroy_visual( ctx->gl_visual ); + gl_destroy_framebuffer( ctx->gl_buffer ); + gl_free_context_data( &ctx->gl_ctx ); + FREE( ctx ); + } +} + + + +/* + * Recompute the values of the context's rowaddr array. + */ +static void compute_row_addresses( OSMesaContext ctx ) +{ + GLint i; + + if (ctx->yup) { + /* Y=0 is bottom line of window */ + if (ctx->format==OSMESA_COLOR_INDEX) { + /* 1-byte CI mode */ + GLubyte *origin = (GLubyte *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + i * ctx->rowlength; + } + } + else { + if ((ctx->format==OSMESA_RGB) || (ctx->format==OSMESA_BGR)) { + /* 3-byte RGB mode */ + GLubyte *origin = (GLubyte *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + (i * (ctx->rowlength*3)); + } + } else { + /* 4-byte RGBA mode */ + GLuint *origin = (GLuint *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + i * ctx->rowlength; + } + } + } + } + else { + /* Y=0 is top line of window */ + if (ctx->format==OSMESA_COLOR_INDEX) { + /* 1-byte CI mode */ + GLubyte *origin = (GLubyte *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + (ctx->height-i-1) * ctx->rowlength; + } + } + else { + if ((ctx->format==OSMESA_RGB) || (ctx->format==OSMESA_BGR)) { + /* 3-byte RGB mode */ + GLubyte *origin = (GLubyte *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + ((ctx->height-i-1) * (ctx->rowlength*3)); + } + } else { + /* 4-byte RGBA mode */ + GLuint *origin = (GLuint *) ctx->buffer; + for (i=0;i<MAX_HEIGHT;i++) { + ctx->rowaddr[i] = origin + (ctx->height-i-1) * ctx->rowlength; + } + } + } + } +} + + +/* + * Bind an OSMesaContext to an image buffer. The image buffer is just a + * block of memory which the client provides. Its size must be at least + * as large as width*height*sizeof(type). Its address should be a multiple + * of 4 if using RGBA mode. + * + * Image data is stored in the order of glDrawPixels: row-major order + * with the lower-left image pixel stored in the first array position + * (ie. bottom-to-top). + * + * Since the only type initially supported is GL_UNSIGNED_BYTE, if the + * context is in RGBA mode, each pixel will be stored as a 4-byte RGBA + * value. If the context is in color indexed mode, each pixel will be + * stored as a 1-byte value. + * + * If the context's viewport hasn't been initialized yet, it will now be + * initialized to (0,0,width,height). + * + * Input: ctx - the rendering context + * buffer - the image buffer memory + * type - data type for pixel components, only GL_UNSIGNED_BYTE + * supported now + * width, height - size of image buffer in pixels, at least 1 + * Return: GL_TRUE if success, GL_FALSE if error because of invalid ctx, + * invalid buffer address, type!=GL_UNSIGNED_BYTE, width<1, height<1, + * width>internal limit or height>internal limit. + */ +GLboolean GLAPIENTRY +OSMesaMakeCurrent( OSMesaContext ctx, void *buffer, GLenum type, + GLsizei width, GLsizei height ) +{ + if (!ctx || !buffer || type!=GL_UNSIGNED_BYTE + || width<1 || height<1 || width>MAX_WIDTH || height>MAX_HEIGHT) { + return GL_FALSE; + } + + osmesa_update_state( &ctx->gl_ctx ); + gl_make_current( &ctx->gl_ctx, ctx->gl_buffer ); + + ctx->buffer = buffer; + ctx->width = width; + ctx->height = height; + if (ctx->userRowLength) + ctx->rowlength = ctx->userRowLength; + else + ctx->rowlength = width; + + compute_row_addresses( ctx ); + + /* init viewport */ + if (ctx->gl_ctx.Viewport.Width==0) { + /* initialize viewport and scissor box to buffer size */ + _mesa_Viewport( 0, 0, width, height ); + ctx->gl_ctx.Scissor.Width = width; + ctx->gl_ctx.Scissor.Height = height; + } + + return GL_TRUE; +} + + + +OSMesaContext GLAPIENTRY OSMesaGetCurrentContext( void ) +{ + GLcontext *ctx = gl_get_current_context(); + if (ctx) + return (OSMesaContext) ctx; + else + return NULL; +} + + + +void GLAPIENTRY OSMesaPixelStore( GLint pname, GLint value ) +{ + OSMesaContext ctx = OSMesaGetCurrentContext(); + + switch (pname) { + case OSMESA_ROW_LENGTH: + if (value<0) { + gl_error( &ctx->gl_ctx, GL_INVALID_VALUE, + "OSMesaPixelStore(value)" ); + return; + } + ctx->userRowLength = value; + ctx->rowlength = value; + break; + case OSMESA_Y_UP: + ctx->yup = value ? GL_TRUE : GL_FALSE; + break; + default: + gl_error( &ctx->gl_ctx, GL_INVALID_ENUM, "OSMesaPixelStore(pname)" ); + return; + } + + compute_row_addresses( ctx ); +} + + +void GLAPIENTRY OSMesaGetIntegerv( GLint pname, GLint *value ) +{ + OSMesaContext ctx = OSMesaGetCurrentContext(); + + switch (pname) { + case OSMESA_WIDTH: + *value = ctx->width; + return; + case OSMESA_HEIGHT: + *value = ctx->height; + return; + case OSMESA_FORMAT: + *value = ctx->format; + return; + case OSMESA_TYPE: + *value = GL_UNSIGNED_BYTE; + return; + case OSMESA_ROW_LENGTH: + *value = ctx->rowlength; + return; + case OSMESA_Y_UP: + *value = ctx->yup; + return; + default: + gl_error(&ctx->gl_ctx, GL_INVALID_ENUM, "OSMesaGetIntergerv(pname)"); + return; + } +} + +/* + * Return the depth buffer associated with an OSMesa context. + * Input: c - the OSMesa context + * Output: width, height - size of buffer in pixels + * bytesPerValue - bytes per depth value (2 or 4) + * buffer - pointer to depth buffer values + * Return: GL_TRUE or GL_FALSE to indicate success or failure. + */ +GLboolean GLAPIENTRY +OSMesaGetDepthBuffer( OSMesaContext c, GLint *width, GLint *height, + GLint *bytesPerValue, void **buffer ) +{ + if ((!c->gl_buffer) || (!c->gl_buffer->DepthBuffer)) { + *width = 0; + *height = 0; + *bytesPerValue = 0; + *buffer = 0; + return GL_FALSE; + } + else { + *width = c->gl_buffer->Width; + *height = c->gl_buffer->Height; + *bytesPerValue = sizeof(GLdepth); + *buffer = c->gl_buffer->DepthBuffer; + return GL_TRUE; + } +} + +/* + * Return the color buffer associated with an OSMesa context. + * Input: c - the OSMesa context + * Output: width, height - size of buffer in pixels + * format - the pixel format (OSMESA_FORMAT) + * buffer - pointer to color buffer values + * Return: GL_TRUE or GL_FALSE to indicate success or failure. + */ +GLboolean GLAPIENTRY +OSMesaGetColorBuffer( OSMesaContext c, GLint *width, + GLint *height, GLint *format, void **buffer ) +{ + if (!c->buffer) { + *width = 0; + *height = 0; + *format = 0; + *buffer = 0; + return GL_FALSE; + } + else { + *width = c->width; + *height = c->height; + *format = c->format; + *buffer = c->buffer; + return GL_TRUE; + } +} + +/**********************************************************************/ +/*** Device Driver Functions ***/ +/**********************************************************************/ + + +/* + * Useful macros: + */ +#define PACK_RGBA(R,G,B,A) ( ((R) << osmesa->rshift) \ + | ((G) << osmesa->gshift) \ + | ((B) << osmesa->bshift) \ + | ((A) << osmesa->ashift) ) + +#define PACK_RGBA2(R,G,B,A) ( ((R) << rshift) \ + | ((G) << gshift) \ + | ((B) << bshift) \ + | ((A) << ashift) ) + +#define UNPACK_RED(P) (((P) >> osmesa->rshift) & 0xff) +#define UNPACK_GREEN(P) (((P) >> osmesa->gshift) & 0xff) +#define UNPACK_BLUE(P) (((P) >> osmesa->bshift) & 0xff) +#define UNPACK_ALPHA(P) (((P) >> osmesa->ashift) & 0xff) + +#define PIXELADDR1(X,Y) ((GLubyte *) osmesa->rowaddr[Y] + (X)) +#define PIXELADDR3(X,Y) ((GLubyte *) osmesa->rowaddr[Y] + ((X)*3)) +#define PIXELADDR4(X,Y) ((GLuint *) osmesa->rowaddr[Y] + (X)) + + + + +static GLboolean set_draw_buffer( GLcontext *ctx, GLenum mode ) +{ + (void) ctx; + if (mode==GL_FRONT_LEFT) { + return GL_TRUE; + } + else { + return GL_FALSE; + } +} + + +static void set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode ) +{ + /* separate read buffer not supported */ + ASSERT(buffer == ctx->DrawBuffer); + ASSERT(mode == GL_FRONT_LEFT); +} + + +static void clear_index( GLcontext *ctx, GLuint index ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + osmesa->clearpixel = index; +} + + + +static void clear_color( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + osmesa->clearpixel = PACK_RGBA( r, g, b, a ); +} + + + +static GLbitfield clear( GLcontext *ctx, GLbitfield mask, GLboolean all, + GLint x, GLint y, GLint width, GLint height ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; + + /* we can't handle color or index masking */ + if (*colorMask != 0xffffffff || ctx->Color.IndexMask != 0xffffffff) + return mask; + + /* sanity check - we only have a front-left buffer */ + ASSERT((mask & (DD_FRONT_RIGHT_BIT | DD_BACK_LEFT_BIT | DD_BACK_RIGHT_BIT)) == 0); + + if (mask & DD_FRONT_LEFT_BIT) { + if (osmesa->format==OSMESA_COLOR_INDEX) { + if (all) { + /* Clear whole CI buffer */ + MEMSET(osmesa->buffer, osmesa->clearpixel, + osmesa->rowlength * osmesa->height); + } + else { + /* Clear part of CI buffer */ + GLint i, j; + for (i=0;i<height;i++) { + GLubyte *ptr1 = PIXELADDR1( x, (y+i) ); + for (j=0;j<width;j++) { + *ptr1++ = osmesa->clearpixel; + } + } + } + } + else if ((osmesa->format==OSMESA_RGB)||(osmesa->format==OSMESA_BGR)) { + GLubyte rval = UNPACK_RED(osmesa->clearpixel); + GLubyte gval = UNPACK_GREEN(osmesa->clearpixel); + GLubyte bval = UNPACK_BLUE(osmesa->clearpixel); + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + if (all) { + GLuint i, n; + GLubyte *ptr3 = (GLubyte *) osmesa->buffer; + /* Clear whole RGB buffer */ + n = osmesa->rowlength * osmesa->height; + for (i=0;i<n;i++) { + ptr3[rind] = rval; + ptr3[gind] = gval; + ptr3[bind] = bval; + ptr3 += 3; + } + } + else { + /* Clear part of RGB buffer */ + GLint i, j; + for (i=0;i<height;i++) { + GLubyte *ptr3 = PIXELADDR3( x, (y+i) ); + for (j=0;j<width;j++) { + ptr3[rind] = rval; + ptr3[gind] = gval; + ptr3[bind] = bval; + ptr3 += 3; + } + } + } + } + else { + if (all) { + /* Clear whole RGBA buffer */ + GLuint i, n, *ptr4; + n = osmesa->rowlength * osmesa->height; + ptr4 = (GLuint *) osmesa->buffer; + if (osmesa->clearpixel) { + for (i=0;i<n;i++) { + *ptr4++ = osmesa->clearpixel; + } + } + else { + BZERO(ptr4, n * sizeof(GLuint)); + } + } + else { + /* Clear part of RGBA buffer */ + GLint i, j; + for (i=0;i<height;i++) { + GLuint *ptr4 = PIXELADDR4( x, (y+i) ); + for (j=0;j<width;j++) { + *ptr4++ = osmesa->clearpixel; + } + } + } + } + } + /* have Mesa clear all other buffers */ + return mask & (~DD_FRONT_LEFT_BIT); +} + + + +static void set_index( GLcontext *ctx, GLuint index ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + osmesa->pixel = index; +} + + + +static void set_color( GLcontext *ctx, + GLubyte r, GLubyte g, GLubyte b, GLubyte a ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + osmesa->pixel = PACK_RGBA( r, g, b, a ); +} + + + +static void buffer_size( GLcontext *ctx, GLuint *width, GLuint *height ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + *width = osmesa->width; + *height = osmesa->height; +} + + +/**********************************************************************/ +/***** Read/write spans/arrays of RGBA pixels *****/ +/**********************************************************************/ + +/* Write RGBA pixels to an RGBA (or permuted) buffer. */ +static void write_rgba_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4( x, y ); + GLuint i; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint ashift = osmesa->ashift; + if (mask) { + for (i=0;i<n;i++,ptr4++) { + if (mask[i]) { + *ptr4 = PACK_RGBA2( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); + } + } + } + else { + for (i=0;i<n;i++,ptr4++) { + *ptr4 = PACK_RGBA2( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); + } + } +} + + +/* Write RGBA pixels to an RGBA buffer. This is the fastest span-writer. */ +static void write_rgba_span_rgba( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgba[][4], + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4( x, y ); + const GLuint *rgba4 = (const GLuint *) rgba; + GLuint i; + if (mask) { + for (i=0;i<n;i++) { + if (mask[i]) { + ptr4[i] = rgba4[i]; + } + } + } + else { + MEMCPY( ptr4, rgba4, n * 4 ); + } +} + + +/* Write RGB pixels to an RGBA (or permuted) buffer. */ +static void write_rgb_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgb[][3], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4( x, y ); + GLuint i; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint ashift = osmesa->ashift; + if (mask) { + for (i=0;i<n;i++,ptr4++) { + if (mask[i]) { + *ptr4 = PACK_RGBA2( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP], 255 ); + } + } + } + else { + for (i=0;i<n;i++,ptr4++) { + *ptr4 = PACK_RGBA2( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP], 255); + } + } +} + + + +static void write_monocolor_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4(x,y); + GLuint i; + for (i=0;i<n;i++,ptr4++) { + if (mask[i]) { + *ptr4 = osmesa->pixel; + } + } +} + + + +static void write_rgba_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint ashift = osmesa->ashift; + for (i=0;i<n;i++) { + if (mask[i]) { + GLuint *ptr4 = PIXELADDR4(x[i],y[i]); + *ptr4 = PACK_RGBA2( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); + } + } +} + + + +static void write_monocolor_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i]) { + GLuint *ptr4 = PIXELADDR4(x[i],y[i]); + *ptr4 = osmesa->pixel; + } + } +} + + +static void read_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, + GLubyte rgba[][4] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLuint *ptr4 = PIXELADDR4(x,y); + for (i=0;i<n;i++) { + GLuint pixel = *ptr4++; + rgba[i][RCOMP] = UNPACK_RED(pixel); + rgba[i][GCOMP] = UNPACK_GREEN(pixel); + rgba[i][BCOMP] = UNPACK_BLUE(pixel); + rgba[i][ACOMP] = UNPACK_ALPHA(pixel); + } +} + + +/* Read RGBA pixels from an RGBA buffer */ +static void read_rgba_span_rgba( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + GLubyte rgba[][4] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint *ptr4 = PIXELADDR4(x,y); + MEMCPY( rgba, ptr4, n * 4 * sizeof(GLubyte) ); +} + + +static void read_rgba_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i]) { + GLuint *ptr4 = PIXELADDR4(x[i],y[i]); + GLuint pixel = *ptr4; + rgba[i][RCOMP] = UNPACK_RED(pixel); + rgba[i][GCOMP] = UNPACK_GREEN(pixel); + rgba[i][BCOMP] = UNPACK_BLUE(pixel); + rgba[i][ACOMP] = UNPACK_ALPHA(pixel); + } + } +} + +/**********************************************************************/ +/***** 3 byte RGB pixel support funcs *****/ +/**********************************************************************/ + +/* Write RGBA pixels to an RGB or BGR buffer. */ +static void write_rgba_span3( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr3 = PIXELADDR3( x, y); + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + if (mask) { + for (i=0;i<n;i++,ptr3+=3) { + if (mask[i]) { + ptr3[rind] = rgba[i][RCOMP]; + ptr3[gind] = rgba[i][GCOMP]; + ptr3[bind] = rgba[i][BCOMP]; + } + } + } + else { + for (i=0;i<n;i++,ptr3+=3) { + ptr3[rind] = rgba[i][RCOMP]; + ptr3[gind] = rgba[i][GCOMP]; + ptr3[bind] = rgba[i][BCOMP]; + } + } +} + +/* Write RGB pixels to an RGB or BGR buffer. */ +static void write_rgb_span3( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + CONST GLubyte rgb[][3], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr3 = PIXELADDR3( x, y); + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + if (mask) { + for (i=0;i<n;i++,ptr3+=3) { + if (mask[i]) { + ptr3[rind] = rgb[i][RCOMP]; + ptr3[gind] = rgb[i][GCOMP]; + ptr3[bind] = rgb[i][BCOMP]; + } + } + } + else { + for (i=0;i<n;i++,ptr3+=3) { + ptr3[rind] = rgb[i][RCOMP]; + ptr3[gind] = rgb[i][GCOMP]; + ptr3[bind] = rgb[i][BCOMP]; + } + } +} + + +static void write_monocolor_span3( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + + GLubyte rval = UNPACK_RED(osmesa->pixel); + GLubyte gval = UNPACK_GREEN(osmesa->pixel); + GLubyte bval = UNPACK_BLUE(osmesa->pixel); + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + GLubyte *ptr3 = PIXELADDR3( x, y); + GLuint i; + for (i=0;i<n;i++,ptr3+=3) { + if (mask[i]) { + ptr3[rind] = rval; + ptr3[gind] = gval; + ptr3[bind] = bval; + } + } +} + +static void write_rgba_pixels3( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + CONST GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + for (i=0;i<n;i++) { + if (mask[i]) { + GLubyte *ptr3 = PIXELADDR3(x[i],y[i]); + ptr3[rind] = rgba[i][RCOMP]; + ptr3[gind] = rgba[i][GCOMP]; + ptr3[bind] = rgba[i][BCOMP]; + } + } +} + +static void write_monocolor_pixels3( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + GLubyte rval = UNPACK_RED(osmesa->pixel); + GLubyte gval = UNPACK_GREEN(osmesa->pixel); + GLubyte bval = UNPACK_BLUE(osmesa->pixel); + for (i=0;i<n;i++) { + if (mask[i]) { + GLubyte *ptr3 = PIXELADDR3(x[i],y[i]); + ptr3[rind] = rval; + ptr3[gind] = gval; + ptr3[bind] = bval; + } + } +} + +static void read_rgba_span3( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + GLubyte rgba[][4] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + const GLubyte *ptr3 = PIXELADDR3( x, y); + for (i=0;i<n;i++,ptr3+=3) { + rgba[i][RCOMP] = ptr3[rind]; + rgba[i][GCOMP] = ptr3[gind]; + rgba[i][BCOMP] = ptr3[bind]; + rgba[i][ACOMP] = 0; + } +} + +static void read_rgba_pixels3( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLubyte rgba[][4], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + GLint rind = osmesa->rind; + GLint gind = osmesa->gind; + GLint bind = osmesa->bind; + for (i=0;i<n;i++) { + if (mask[i]) { + const GLubyte *ptr3 = PIXELADDR3(x[i],y[i]); + rgba[i][RCOMP] = ptr3[rind]; + rgba[i][GCOMP] = ptr3[gind]; + rgba[i][BCOMP] = ptr3[bind]; + rgba[i][ACOMP] = 0; + } + } +} + + +/**********************************************************************/ +/***** Read/write spans/arrays of CI pixels *****/ +/**********************************************************************/ + +/* Write 32-bit color index to buffer */ +static void write_index32_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLuint index[], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr1 = PIXELADDR1(x,y); + GLuint i; + if (mask) { + for (i=0;i<n;i++,ptr1++) { + if (mask[i]) { + *ptr1 = (GLubyte) index[i]; + } + } + } + else { + for (i=0;i<n;i++,ptr1++) { + *ptr1 = (GLubyte) index[i]; + } + } +} + + +/* Write 8-bit color index to buffer */ +static void write_index8_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte index[], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr1 = PIXELADDR1(x,y); + GLuint i; + if (mask) { + for (i=0;i<n;i++,ptr1++) { + if (mask[i]) { + *ptr1 = (GLubyte) index[i]; + } + } + } + else { + MEMCPY( ptr1, index, n ); + } +} + + +static void write_monoindex_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *ptr1 = PIXELADDR1(x,y); + GLuint i; + for (i=0;i<n;i++,ptr1++) { + if (mask[i]) { + *ptr1 = (GLubyte) osmesa->pixel; + } + } +} + + +static void write_index_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLuint index[], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i]) { + GLubyte *ptr1 = PIXELADDR1(x[i],y[i]); + *ptr1 = (GLubyte) index[i]; + } + } +} + + +static void write_monoindex_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i]) { + GLubyte *ptr1 = PIXELADDR1(x[i],y[i]); + *ptr1 = (GLubyte) osmesa->pixel; + } + } +} + + +static void read_index_span( const GLcontext *ctx, + GLuint n, GLint x, GLint y, GLuint index[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + const GLubyte *ptr1 = PIXELADDR1(x,y); + for (i=0;i<n;i++,ptr1++) { + index[i] = (GLuint) *ptr1; + } +} + + +static void read_index_pixels( const GLcontext *ctx, + GLuint n, const GLint x[], const GLint y[], + GLuint index[], const GLubyte mask[] ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLuint i; + for (i=0;i<n;i++) { + if (mask[i] ) { + const GLubyte *ptr1 = PIXELADDR1(x[i],y[i]); + index[i] = (GLuint) *ptr1; + } + } +} + + + +/**********************************************************************/ +/***** Optimized line rendering *****/ +/**********************************************************************/ + + +/* + * Draw a flat-shaded, RGB line into an osmesa buffer. + */ +static void flat_rgba_line( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + unsigned long pixel = PACK_RGBA( color[0], color[1], color[2], color[3] ); + +#define INTERP_XY 1 +#define CLIP_HACK 1 +#define PLOT(X,Y) { GLuint *ptr4 = PIXELADDR4(X,Y); *ptr4 = pixel; } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Draw a flat-shaded, Z-less, RGB line into an osmesa buffer. + */ +static void flat_rgba_z_line( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + unsigned long pixel = PACK_RGBA( color[0], color[1], color[2], color[3] ); + +#define INTERP_XY 1 +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define CLIP_HACK 1 +#define PLOT(X,Y) \ + if (Z < *zPtr) { \ + GLuint *ptr4 = PIXELADDR4(X,Y); \ + *ptr4 = pixel; \ + *zPtr = Z; \ + } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Draw a flat-shaded, alpha-blended, RGB line into an osmesa buffer. + */ +static void flat_blend_rgba_line( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + struct vertex_buffer *VB = ctx->VB; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint avalue = VB->ColorPtr->data[pvert][3]; + GLint msavalue = 255 - avalue; + GLint rvalue = VB->ColorPtr->data[pvert][0]*avalue; + GLint gvalue = VB->ColorPtr->data[pvert][1]*avalue; + GLint bvalue = VB->ColorPtr->data[pvert][2]*avalue; + +#define INTERP_XY 1 +#define CLIP_HACK 1 +#define PLOT(X,Y) \ + { GLuint *ptr4 = PIXELADDR4(X,Y); \ + GLuint pixel = 0; \ + pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift);\ + pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift);\ + pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift);\ + *ptr4 = pixel; \ + } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer. + */ +static void flat_blend_rgba_z_line( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + struct vertex_buffer *VB = ctx->VB; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint avalue = VB->ColorPtr->data[pvert][3]; + GLint msavalue = 256 - avalue; + GLint rvalue = VB->ColorPtr->data[pvert][0]*avalue; + GLint gvalue = VB->ColorPtr->data[pvert][1]*avalue; + GLint bvalue = VB->ColorPtr->data[pvert][2]*avalue; + +#define INTERP_XY 1 +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define CLIP_HACK 1 +#define PLOT(X,Y) \ + if (Z < *zPtr) { \ + GLuint *ptr4 = PIXELADDR4(X,Y); \ + GLuint pixel = 0; \ + pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift); \ + pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift); \ + pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift); \ + *ptr4 = pixel; \ + } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Draw a flat-shaded, Z-less, alpha-blended, RGB line into an osmesa buffer. + */ +static void flat_blend_rgba_z_line_write( GLcontext *ctx, + GLuint vert0, GLuint vert1, GLuint pvert ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + struct vertex_buffer *VB = ctx->VB; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint avalue = VB->ColorPtr->data[pvert][3]; + GLint msavalue = 256 - avalue; + GLint rvalue = VB->ColorPtr->data[pvert][0]*avalue; + GLint gvalue = VB->ColorPtr->data[pvert][1]*avalue; + GLint bvalue = VB->ColorPtr->data[pvert][2]*avalue; + +#define INTERP_XY 1 +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define CLIP_HACK 1 +#define PLOT(X,Y) \ + if (Z < *zPtr) { \ + GLuint *ptr4 = PIXELADDR4(X,Y); \ + GLuint pixel = 0; \ + pixel |=((((((*ptr4) >> rshift) & 0xff)*msavalue+rvalue)>>8) << rshift); \ + pixel |=((((((*ptr4) >> gshift) & 0xff)*msavalue+gvalue)>>8) << gshift); \ + pixel |=((((((*ptr4) >> bshift) & 0xff)*msavalue+bvalue)>>8) << bshift); \ + *ptr4 = pixel; \ + *zPtr = Z; \ + } + +#ifdef WIN32 +#include "..\linetemp.h" +#else +#include "linetemp.h" +#endif +} + + +/* + * Analyze context state to see if we can provide a fast line drawing + * function, like those in lines.c. Otherwise, return NULL. + */ +static line_func choose_line_function( GLcontext *ctx ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + + if (ctx->Line.SmoothFlag) return NULL; + if (ctx->Texture.Enabled) return NULL; + if (ctx->Light.ShadeModel!=GL_FLAT) return NULL; + + if (ctx->Line.Width==1.0F + && ctx->Line.StippleFlag==GL_FALSE) { + + if (ctx->RasterMask==DEPTH_BIT + && ctx->Depth.Func==GL_LESS + && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_rgba_z_line; + default: + return NULL; + } + } + + if (ctx->RasterMask==0) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_rgba_line; + default: + return NULL; + } + } + + if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT) + && ctx->Depth.Func==GL_LESS + && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA + && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendSrcA==GL_SRC_ALPHA + && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_blend_rgba_z_line_write; + default: + return NULL; + } + } + + if (ctx->RasterMask==(DEPTH_BIT|BLEND_BIT) + && ctx->Depth.Func==GL_LESS + && ctx->Depth.Mask==GL_FALSE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA + && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendSrcA==GL_SRC_ALPHA + && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_blend_rgba_z_line; + default: + return NULL; + } + } + + if (ctx->RasterMask==BLEND_BIT + && ctx->Color.BlendSrcRGB==GL_SRC_ALPHA + && ctx->Color.BlendDstRGB==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendSrcA==GL_SRC_ALPHA + && ctx->Color.BlendDstA==GL_ONE_MINUS_SRC_ALPHA + && ctx->Color.BlendEquation==GL_FUNC_ADD_EXT) { + switch(osmesa->format) { + case OSMESA_RGBA: + case OSMESA_BGRA: + case OSMESA_ARGB: + return flat_blend_rgba_line; + default: + return NULL; + } + } + + } + return NULL; +} + + +/**********************************************************************/ +/***** Optimized triangle rendering *****/ +/**********************************************************************/ + + +/* + * Smooth-shaded, z-less triangle, RGBA color. + */ +static void smooth_rgba_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, + GLuint v2, GLuint pv ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + GLint rshift = osmesa->rshift; + GLint gshift = osmesa->gshift; + GLint bshift = osmesa->bshift; + GLint ashift = osmesa->ashift; + (void) pv; + +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define INTERP_RGB 1 +#define INTERP_ALPHA 1 +#define INNER_LOOP( LEFT, RIGHT, Y ) \ +{ \ + GLint i, len = RIGHT-LEFT; \ + GLuint *img = PIXELADDR4(LEFT,Y); \ + for (i=0;i<len;i++,img++) { \ + GLdepth z = FixedToDepth(ffz); \ + if (z < zRow[i]) { \ + *img = PACK_RGBA2( FixedToInt(ffr), FixedToInt(ffg), \ + FixedToInt(ffb), FixedToInt(ffa) ); \ + zRow[i] = z; \ + } \ + ffr += fdrdx; ffg += fdgdx; ffb += fdbdx; ffa += fdadx;\ + ffz += fdzdx; \ + } \ +} +#ifdef WIN32 +#include "..\tritemp.h" +#else +#include "tritemp.h" +#endif +} + + + + +/* + * Flat-shaded, z-less triangle, RGBA color. + */ +static void flat_rgba_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, + GLuint v2, GLuint pv ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; +#define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE +#define SETUP_CODE \ + GLubyte r = VB->ColorPtr->data[pv][0]; \ + GLubyte g = VB->ColorPtr->data[pv][1]; \ + GLubyte b = VB->ColorPtr->data[pv][2]; \ + GLubyte a = VB->ColorPtr->data[pv][3]; \ + GLuint pixel = PACK_RGBA(r,g,b,a); + +#define INNER_LOOP( LEFT, RIGHT, Y ) \ +{ \ + GLint i, len = RIGHT-LEFT; \ + GLuint *img = PIXELADDR4(LEFT,Y); \ + for (i=0;i<len;i++,img++) { \ + GLdepth z = FixedToDepth(ffz); \ + if (z < zRow[i]) { \ + *img = pixel; \ + zRow[i] = z; \ + } \ + ffz += fdzdx; \ + } \ +} +#ifdef WIN32 +#include "..\tritemp.h" +#else +#include "tritemp.h" +#endif +} + + + +/* + * Return pointer to an accelerated triangle function if possible. + */ +static triangle_func choose_triangle_function( GLcontext *ctx ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + + if ((osmesa->format==OSMESA_RGB)||(osmesa->format==OSMESA_BGR)) return NULL; + + if (ctx->Polygon.SmoothFlag) return NULL; + if (ctx->Polygon.StippleFlag) return NULL; + if (ctx->Texture.Enabled) return NULL; + + if (ctx->RasterMask==DEPTH_BIT + && ctx->Depth.Func==GL_LESS + && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS + && osmesa->format!=OSMESA_COLOR_INDEX) { + if (ctx->Light.ShadeModel==GL_SMOOTH) { + return smooth_rgba_z_triangle; + } + else { + return flat_rgba_z_triangle; + } + } + return NULL; +} + + + +static const GLubyte *get_string( GLcontext *ctx, GLenum name ) +{ + (void) ctx; + switch (name) { + case GL_RENDERER: + return (const GLubyte *) "Mesa OffScreen"; + default: + return NULL; + } +} + + +static void osmesa_update_state( GLcontext *ctx ) +{ + OSMesaContext osmesa = (OSMesaContext) ctx; + + ASSERT((void *) osmesa == (void *) ctx->DriverCtx); + + ctx->Driver.GetString = get_string; + ctx->Driver.UpdateState = osmesa_update_state; + + ctx->Driver.SetDrawBuffer = set_draw_buffer; + ctx->Driver.SetReadBuffer = set_read_buffer; + ctx->Driver.Color = set_color; + ctx->Driver.Index = set_index; + ctx->Driver.ClearIndex = clear_index; + ctx->Driver.ClearColor = clear_color; + ctx->Driver.Clear = clear; + + ctx->Driver.GetBufferSize = buffer_size; + + ctx->Driver.PointsFunc = NULL; + ctx->Driver.LineFunc = choose_line_function( ctx ); + ctx->Driver.TriangleFunc = choose_triangle_function( ctx ); + + + /* RGB(A) span/pixel functions */ + if ((osmesa->format==OSMESA_RGB) || (osmesa->format==OSMESA_BGR)) { + /* 3 bytes / pixel in frame buffer */ + ctx->Driver.WriteRGBASpan = write_rgba_span3; + ctx->Driver.WriteRGBSpan = write_rgb_span3; + ctx->Driver.WriteRGBAPixels = write_rgba_pixels3; + ctx->Driver.WriteMonoRGBASpan = write_monocolor_span3; + ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels3; + ctx->Driver.ReadRGBASpan = read_rgba_span3; + ctx->Driver.ReadRGBAPixels = read_rgba_pixels3; + } + else { + /* 4 bytes / pixel in frame buffer */ + if (osmesa->format==OSMESA_RGBA + && RCOMP==0 && GCOMP==1 && BCOMP==2 && ACOMP==3) + ctx->Driver.WriteRGBASpan = write_rgba_span_rgba; + else + ctx->Driver.WriteRGBASpan = write_rgba_span; + ctx->Driver.WriteRGBSpan = write_rgb_span; + ctx->Driver.WriteRGBAPixels = write_rgba_pixels; + ctx->Driver.WriteMonoRGBASpan = write_monocolor_span; + ctx->Driver.WriteMonoRGBAPixels = write_monocolor_pixels; + if (osmesa->format==OSMESA_RGBA + && RCOMP==0 && GCOMP==1 && BCOMP==2 && ACOMP==3) + ctx->Driver.ReadRGBASpan = read_rgba_span_rgba; + else + ctx->Driver.ReadRGBASpan = read_rgba_span; + ctx->Driver.ReadRGBAPixels = read_rgba_pixels; + } + + /* CI span/pixel functions */ + ctx->Driver.WriteCI32Span = write_index32_span; + ctx->Driver.WriteCI8Span = write_index8_span; + ctx->Driver.WriteMonoCISpan = write_monoindex_span; + ctx->Driver.WriteCI32Pixels = write_index_pixels; + ctx->Driver.WriteMonoCIPixels = write_monoindex_pixels; + ctx->Driver.ReadCI32Span = read_index_span; + ctx->Driver.ReadCI32Pixels = read_index_pixels; +} diff --git a/xc/extras/Mesa/src/X/fakeglx.c b/xc/extras/Mesa/src/X/fakeglx.c index 16fb2f622..d613c0a83 100644 --- a/xc/extras/Mesa/src/X/fakeglx.c +++ b/xc/extras/Mesa/src/X/fakeglx.c @@ -47,7 +47,9 @@ #include "context.h" #include "config.h" #include "macros.h" +#include "mmath.h" #include "types.h" +#include "xfonts.h" #include "xmesaP.h" @@ -70,6 +72,7 @@ /* Silence compiler warnings */ +extern void Fake_glXDummyFunc( void ); void Fake_glXDummyFunc( void ) { (void) kernel8; @@ -226,7 +229,9 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, GLboolean rgbFlag, GLboolean alphaFlag, GLboolean dbFlag, GLboolean stereoFlag, GLint depth_size, GLint stencil_size, - GLint accum_size, GLint level ) + GLint accumRedSize, GLint accumGreenSize, + GLint accumBlueSize, GLint accumAlphaSize, + GLint level ) { GLboolean ximageFlag = GL_TRUE; XMesaVisual xmvis; @@ -269,7 +274,10 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, && (v->gl_visual->AlphaBits > 0) == alphaFlag && (v->gl_visual->DepthBits >= depth_size || depth_size == 0) && (v->gl_visual->StencilBits >= stencil_size || stencil_size == 0) - && (v->gl_visual->AccumBits >= accum_size || accum_size == 0)) { + && (v->gl_visual->AccumRedBits >= accumRedSize || accumRedSize == 0) + && (v->gl_visual->AccumGreenBits >= accumGreenSize || accumGreenSize == 0) + && (v->gl_visual->AccumBlueBits >= accumBlueSize || accumBlueSize == 0) + && (v->gl_visual->AccumAlphaBits >= accumAlphaSize || accumAlphaSize == 0)) { /* now either compare XVisualInfo pointers or visual IDs */ if ((!comparePointers && v->visinfo->visualid == vinfo->visualid) || (comparePointers && v->vishandle == vinfo)) { @@ -287,7 +295,10 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, xmvis = XMesaCreateVisual( dpy, vinfo, rgbFlag, alphaFlag, dbFlag, stereoFlag, ximageFlag, - depth_size, stencil_size, accum_size, level ); + depth_size, stencil_size, + accumRedSize, accumBlueSize, + accumBlueSize, accumAlphaSize, 0, level, + GLX_NONE_EXT ); if (xmvis) { VisualTable[NumVisuals] = xmvis; NumVisuals++; @@ -299,6 +310,11 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo, /* * Create a GLX visual from a regular XVisualInfo. + * This is called when Fake GLX is given an XVisualInfo which wasn't + * returned by glXChooseVisual. Since this is the first time we're + * considering this visual we'll take a guess at reasonable values + * for depth buffer size, stencil size, accum size, etc. + * This is the best we can do with a client-side emulation of GLX. */ static XMesaVisual create_glx_visual( Display *dpy, XVisualInfo *visinfo ) @@ -315,7 +331,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) GL_FALSE, /* stereo */ 0, /* depth bits */ 0, /* stencil bits */ - 0, /* accum bits */ + 0,0,0,0, /* accum bits */ vislevel /* level */ ); } @@ -328,9 +344,12 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) GL_FALSE, /* alpha */ GL_TRUE, /* double */ GL_FALSE, /* stereo */ - 8*sizeof(GLdepth), - 8*sizeof(GLstencil), - 8*sizeof(GLaccum), + DEFAULT_SOFTWARE_DEPTH_BITS, + 8 * sizeof(GLstencil), + 8 * sizeof(GLaccum), /* r */ + 8 * sizeof(GLaccum), /* g */ + 8 * sizeof(GLaccum), /* b */ + 8 * sizeof(GLaccum), /* a */ 0 /* level */ ); } @@ -436,21 +455,6 @@ static int transparent_pixel( XMesaVisual glxvis ) /* - * Return number of bits set in n. - */ -static int bitcount( unsigned long n ) -{ - int bits; - for (bits=0; n>0; n=n>>1) { - if (n&1) { - bits++; - } - } - return bits; -} - - -/* * Try to get an X visual which matches the given arguments. */ static XVisualInfo *get_visual( Display *dpy, int scr, @@ -483,9 +487,9 @@ static XVisualInfo *get_visual( Display *dpy, int scr, * 10 bits per color channel. Mesa's limited to a max of 8 bits/channel. */ if (vis && depth > 24 && (xclass==TrueColor || xclass==DirectColor)) { - if (bitcount(vis->red_mask) <= 8 - && bitcount(vis->green_mask) <= 8 - && bitcount(vis->blue_mask) <= 8) { + if (_mesa_bitcount((GLuint) vis->red_mask ) <= 8 && + _mesa_bitcount((GLuint) vis->green_mask) <= 8 && + _mesa_bitcount((GLuint) vis->blue_mask ) <= 8) { return vis; } else { @@ -860,11 +864,15 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) GLboolean stereo_flag = GL_FALSE; GLint depth_size = 0; GLint stencil_size = 0; - GLint accum_size = 0; + GLint accumRedSize = 0; + GLint accumGreenSize = 0; + GLint accumBlueSize = 0; + GLint accumAlphaSize = 0; int level = 0; int visual_type = DONT_CARE; int trans_type = DONT_CARE; int trans_value = DONT_CARE; + GLint caveat = DONT_CARE; parselist = list; @@ -927,13 +935,31 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) stencil_size = *parselist++; break; case GLX_ACCUM_RED_SIZE: + parselist++; + { + GLint size = *parselist++; + accumRedSize = MAX2( accumRedSize, size ); + } + break; case GLX_ACCUM_GREEN_SIZE: + parselist++; + { + GLint size = *parselist++; + accumGreenSize = MAX2( accumGreenSize, size ); + } + break; case GLX_ACCUM_BLUE_SIZE: + parselist++; + { + GLint size = *parselist++; + accumBlueSize = MAX2( accumBlueSize, size ); + } + break; case GLX_ACCUM_ALPHA_SIZE: parselist++; { GLint size = *parselist++; - accum_size = MAX2( accum_size, size ); + accumAlphaSize = MAX2( accumAlphaSize, size ); } break; @@ -961,6 +987,14 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) parselist++; break; + /* + * GLX_EXT_visual_info extension + */ + case GLX_VISUAL_CAVEAT_EXT: + parselist++; + caveat = *parselist++; /* ignored for now */ + break; + case None: break; default: @@ -990,7 +1024,7 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) else { /* Get a color index visual */ vis = choose_x_visual( dpy, screen, rgb_flag, min_ci, visual_type ); - accum_size = 0; + accumRedSize = accumGreenSize = accumBlueSize = accumAlphaSize = 0; } } else { @@ -1013,9 +1047,33 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list ) } if (vis) { + /* Note: we're not exactly obeying the glXChooseVisual rules here. + * When GLX_DEPTH_SIZE = 1 is specified we're supposed to choose the + * largest depth buffer size, which is 32bits/value. However, we + * return 16 to maintain performance with earlier versions of Mesa. + */ + if (depth_size == 1) + depth_size = DEFAULT_SOFTWARE_DEPTH_BITS; + else if (depth_size > 24) + depth_size = 31; + else if (depth_size > 16) + depth_size = 24; + /* we only support one size of stencil and accum buffers. */ + if (stencil_size > 0) + stencil_size = STENCIL_BITS; + if (accumRedSize > 0) + accumRedSize = ACCUM_BITS; + if (accumGreenSize > 0) + accumGreenSize = ACCUM_BITS; + if (accumBlueSize > 0) + accumBlueSize = ACCUM_BITS; + if (accumAlphaSize > 0) + accumAlphaSize = ACCUM_BITS; if (!save_glx_visual( dpy, vis, rgb_flag, alpha_flag, double_flag, - stereo_flag, - depth_size, stencil_size, accum_size, level )) + stereo_flag, depth_size, stencil_size, + accumRedSize, accumGreenSize, + accumBlueSize, accumAlphaSize, + level )) return NULL; } @@ -1227,6 +1285,7 @@ Fake_glXQueryExtension( Display *dpy, int *errorb, int *event ) } +extern void _kw_ungrab_all( Display *dpy ); void _kw_ungrab_all( Display *dpy ) { XUngrabPointer( dpy, CurrentTime ); @@ -1372,15 +1431,16 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, *value = glxvis->gl_visual->StencilBits; return 0; case GLX_ACCUM_RED_SIZE: + *value = glxvis->gl_visual->AccumRedBits; + return 0; case GLX_ACCUM_GREEN_SIZE: + *value = glxvis->gl_visual->AccumGreenBits; + return 0; case GLX_ACCUM_BLUE_SIZE: - *value = glxvis->gl_visual->AccumBits; + *value = glxvis->gl_visual->AccumBlueBits; return 0; case GLX_ACCUM_ALPHA_SIZE: - if (glxvis->gl_visual->AlphaBits > 0) - *value = glxvis->gl_visual->AccumBits; - else - *value = 0; + *value = glxvis->gl_visual->AccumAlphaBits; return 0; /* @@ -1438,6 +1498,17 @@ Fake_glXGetConfig( Display *dpy, XVisualInfo *visinfo, return 0; /* + * GLX_EXT_visual_info extension + */ + case GLX_VISUAL_CAVEAT_EXT: + /* test for zero, just in case */ + if (glxvis->VisualCaveat > 0) + *value = glxvis->VisualCaveat; + else + *value = GLX_NONE_EXT; + return 0; + + /* * Extensions */ default: @@ -1472,10 +1543,10 @@ static const char *get_extensions( void ) #ifdef FX const char *fx = getenv("MESA_GLX_FX"); if (fx && fx[0] != 'd') { - return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_MESA_set_3dfx_mode GLX_ARB_get_proc_address"; + return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_MESA_set_3dfx_mode GLX_ARB_get_proc_address"; } #endif - return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_ARB_get_proc_address"; + return "GLX_MESA_pixmap_colormap GLX_EXT_visual_info GLX_EXT_visual_rating GLX_MESA_release_buffers GLX_MESA_copy_sub_buffer GLX_SGI_video_sync GLX_ARB_get_proc_address"; } @@ -1544,7 +1615,7 @@ Fake_glXGetClientString( Display *dpy, int name ) * GLX 1.3 and later */ -static GLXFBConfig +static GLXFBConfig * Fake_glXChooseFBConfig( Display *dpy, int screen, const int *attribList, int *nitems ) { @@ -1568,6 +1639,16 @@ Fake_glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, } +static GLXFBConfig * +Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements ) +{ + (void) dpy; + (void) screen; + (void) nelements; + return 0; +} + + static XVisualInfo * Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config ) { @@ -1742,9 +1823,7 @@ Fake_glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) -extern void Fake_glXUseXFont( Font font, int first, int count, int listbase ); - - +extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void); struct _glxapi_table *_mesa_GetGLXDispatchTable(void) { static struct _glxapi_table glx; @@ -1799,6 +1878,7 @@ struct _glxapi_table *_mesa_GetGLXDispatchTable(void) glx.DestroyWindow = Fake_glXDestroyWindow; /*glx.GetCurrentReadDrawable = Fake_glXGetCurrentReadDrawable;*/ glx.GetFBConfigAttrib = Fake_glXGetFBConfigAttrib; + glx.GetFBConfigs = Fake_glXGetFBConfigs; glx.GetSelectedEvent = Fake_glXGetSelectedEvent; glx.GetVisualFromFBConfig = Fake_glXGetVisualFromFBConfig; glx.MakeContextCurrent = Fake_glXMakeContextCurrent; diff --git a/xc/extras/Mesa/src/X/xfonts.c b/xc/extras/Mesa/src/X/xfonts.c index c71e65324..2a1aca33c 100644 --- a/xc/extras/Mesa/src/X/xfonts.c +++ b/xc/extras/Mesa/src/X/xfonts.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -43,8 +43,10 @@ #include "GL/xmesa.h" #include "context.h" #include "mem.h" +#include "xfonts.h" #include "xmesaP.h" + /* Some debugging info. */ #ifdef DEBUG @@ -372,7 +374,7 @@ bm_height); glEndList (); } - free (bm); + FREE(bm); XFreeFontInfo( NULL, fs, 0 ); XFreeGC (dpy, gc); @@ -385,6 +387,8 @@ bm_height); glPixelStorei(GL_UNPACK_ALIGNMENT, alignment); } + +extern void xmesa_xfonts_dummy( void ); void xmesa_xfonts_dummy( void ) { /* silence unused var warnings */ diff --git a/xc/extras/Mesa/src/X/xmesa1.c b/xc/extras/Mesa/src/X/xmesa1.c index b132f3bb3..92aad010c 100644 --- a/xc/extras/Mesa/src/X/xmesa1.c +++ b/xc/extras/Mesa/src/X/xmesa1.c @@ -64,6 +64,7 @@ #include "GL/xmesa.h" #include "xmesaP.h" #include "context.h" +#include "extensions.h" #include "matrix.h" #include "mem.h" #include "types.h" @@ -1354,10 +1355,11 @@ static GLboolean initialize_visual_and_buffer( int client, /* * Convert an RGBA color to a pixel value. */ -unsigned long xmesa_color_to_pixel( XMesaContext xmesa, - GLubyte r, GLubyte g, GLubyte b, GLubyte a) +unsigned long +xmesa_color_to_pixel( XMesaContext xmesa, GLubyte r, GLubyte g, GLubyte b, GLubyte a, + GLuint pixelFormat) { - switch (xmesa->pixelformat) { + switch (pixelFormat) { case PF_INDEX: return 0; case PF_TRUECOLOR: @@ -1618,6 +1620,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list } gl_extensions_enable(c->gl_ctx, "GL_HP_occlusion_test"); + gl_extensions_enable(c->gl_ctx, "GL_ARB_texture_cube_map"); if (CHECK_BYTE_ORDER(v)) { c->swapbytes = GL_FALSE; @@ -2068,13 +2071,14 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, * can be different for different windows. */ c->pixel = xmesa_color_to_pixel( c, c->red, c->green, - c->blue, c->alpha ); + c->blue, c->alpha, c->pixelformat ); XMesaSetForeground( c->display, c->xm_buffer->gc1, c->pixel ); c->clearpixel = xmesa_color_to_pixel( c, c->clearcolor[0], c->clearcolor[1], c->clearcolor[2], - c->clearcolor[3] ); + c->clearcolor[3], + c->xm_visual->undithered_pf); XMesaSetForeground(c->display, c->xm_buffer->cleargc, c->clearpixel); } @@ -2174,13 +2178,13 @@ GLboolean XMesaSetFXmode( GLint mode ) if (XMesa) { if (mode == XMESA_FX_WINDOW) { if (XMesa->xm_buffer->FXisHackUsable) { - grSstControl(GR_CONTROL_DEACTIVATE); + FX_grSstControl(GR_CONTROL_DEACTIVATE); XMesa->xm_buffer->FXwindowHack = GL_TRUE; return GL_TRUE; } } else if (mode == XMESA_FX_FULLSCREEN) { - grSstControl(GR_CONTROL_ACTIVATE); + FX_grSstControl(GR_CONTROL_ACTIVATE); XMesa->xm_buffer->FXwindowHack = GL_FALSE; return GL_TRUE; } @@ -2280,7 +2284,7 @@ static void FXgetImage( XMesaBuffer b ) (pixbuf[x] & 0xf800) >> 8, (pixbuf[x] & 0x07e0) >> 3, (pixbuf[x] & 0x001f) << 3, - 0xff)); + 0xff, XMesa->pixelformat)); } } } diff --git a/xc/extras/Mesa/src/X/xmesa2.c b/xc/extras/Mesa/src/X/xmesa2.c index 75340eb43..77b8d4b05 100644 --- a/xc/extras/Mesa/src/X/xmesa2.c +++ b/xc/extras/Mesa/src/X/xmesa2.c @@ -36,8 +36,12 @@ #include "drawpix.h" #include "mem.h" #include "state.h" +#include "depth.h" +#include "macros.h" +#include "vb.h" #include "types.h" #include "xmesaP.h" +#include "extensions.h" @@ -347,7 +351,8 @@ static void clear_color( GLcontext *ctx, xmesa->clearcolor[1] = g; xmesa->clearcolor[2] = b; xmesa->clearcolor[3] = a; - xmesa->clearpixel = xmesa_color_to_pixel( xmesa, r, g, b, a ); + xmesa->clearpixel = xmesa_color_to_pixel( xmesa, r, g, b, a, + xmesa->xm_visual->undithered_pf ); XMesaSetForeground( xmesa->display, xmesa->xm_buffer->cleargc, xmesa->clearpixel ); } @@ -430,7 +435,7 @@ static void set_color( GLcontext *ctx, xmesa->green = g; xmesa->blue = b; xmesa->alpha = a; - xmesa->pixel = xmesa_color_to_pixel( xmesa, r, g, b, a );; + xmesa->pixel = xmesa_color_to_pixel( xmesa, r, g, b, a, xmesa->pixelformat );; XMesaSetForeground( xmesa->display, xmesa->xm_buffer->gc1, xmesa->pixel ); } @@ -713,7 +718,7 @@ clear_16bit_ximage( GLcontext *ctx, GLboolean all, } -/* Optimized code provided by Nozomi Ytow <nozomi@biol.tsukuba.ac.jp> */ +/* Optimized code provided by Nozomi Ytow <noz@xfree86.org> */ static void clear_24bit_ximage( GLcontext *ctx, GLboolean all, GLint x, GLint y, GLint width, GLint height ) @@ -731,14 +736,31 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, } if (all) { - register GLint n = xmesa->xm_buffer->width * xmesa->xm_buffer->height; - register bgr_t *ptr3 = (bgr_t *) xmesa->xm_buffer->backimage->data; if (r==g && g==b) { /* same value for all three components (gray) */ - MEMSET(ptr3, r, 3 * n); + const GLint w3 = xmesa->xm_buffer->width * 3; + const GLint h = xmesa->xm_buffer->height; + GLint i; + for (i = 0; i < h; i++) { + bgr_t *ptr3 = PIXELADDR3(xmesa->xm_buffer, 0, i); + MEMSET(ptr3, r, w3); + } } else { /* the usual case */ + const GLint w = xmesa->xm_buffer->width; + const GLint h = xmesa->xm_buffer->height; + GLint i, j; + for (i = 0; i < h; i++) { + bgr_t *ptr3 = PIXELADDR3(xmesa->xm_buffer, 0, i); + for (j = 0; j < w; j++) { + ptr3->r = r; + ptr3->g = g; + ptr3->b = b; + ptr3++; + } + } +#if 0 /* this code doesn't work for all window widths */ register GLuint *ptr4 = (GLuint *) ptr3; register GLuint px; GLuint pixel4[3]; @@ -805,6 +827,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, case 0: break; } +#endif } } else { @@ -819,6 +842,17 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, } else { /* non-gray clear color */ + GLint i, j; + for (j = 0; j < height; j++) { + bgr_t *ptr3 = PIXELADDR3( xmesa->xm_buffer, x, y+j ); + for (i = 0; i < width; i++) { + ptr3->r = r; + ptr3->g = g; + ptr3->b = b; + ptr3++; + } + } +#if 0 /* this code might not always (seems ptr3 always == ptr4) */ GLint j; GLuint pixel4[3]; pixel4[0] = clearPixel | (clearPixel << 24); @@ -889,6 +923,7 @@ clear_24bit_ximage( GLcontext *ctx, GLboolean all, break; } } +#endif } } } @@ -2342,9 +2377,24 @@ static void write_span_5R6G5B_ximage( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - for (i=0;i<n;i++) { - ptr[i] = PACK_5R6G5B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2) { + GLuint p0, p1; + p0 = PACK_5R6G5B(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); + p1 = PACK_5R6G5B(rgba[i+1][RCOMP], rgba[i+1][GCOMP], rgba[i+1][BCOMP]); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + ptr[n] = PACK_5R6G5B(rgba[n][RCOMP], rgba[n][GCOMP], rgba[n][BCOMP]); + } +#else + for (i = 0; i < n; i++) { + ptr[i] = PACK_5R6G5B(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); } +#endif } } @@ -2366,9 +2416,24 @@ static void write_span_DITHER_5R6G5B_ximage( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - for (i=0;i<n;i++,x++) { - PACK_TRUEDITHER( ptr[i], x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2, x += 2) { + GLuint p0, p1; + PACK_TRUEDITHER( p0, x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); + PACK_TRUEDITHER( p1, x+1, y, rgba[i+1][RCOMP], rgba[i+1][GCOMP], rgba[i+1][BCOMP] ); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + PACK_TRUEDITHER( ptr[n], x+n, y, rgba[n][RCOMP], rgba[n][GCOMP], rgba[n][BCOMP]); } +#else + for (i = 0; i < n; i++, x++) { + PACK_TRUEDITHER( ptr[i], x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); + } +#endif } } @@ -2390,9 +2455,24 @@ static void write_span_rgb_5R6G5B_ximage( RGB_SPAN_ARGS ) } else { /* draw all pixels */ +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2) { + GLuint p0, p1; + p0 = PACK_5R6G5B(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); + p1 = PACK_5R6G5B(rgb[i+1][RCOMP], rgb[i+1][GCOMP], rgb[i+1][BCOMP]); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + ptr[n] = PACK_5R6G5B(rgb[n][RCOMP], rgb[n][GCOMP], rgb[n][BCOMP]); + } +#else for (i=0;i<n;i++) { ptr[i] = PACK_5R6G5B( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); } +#endif } } @@ -2414,9 +2494,24 @@ static void write_span_rgb_DITHER_5R6G5B_ximage( RGB_SPAN_ARGS ) } else { /* draw all pixels */ +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint *ptr32 = (GLuint *) ptr; + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2, x += 2) { + GLuint p0, p1; + PACK_TRUEDITHER( p0, x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); + PACK_TRUEDITHER( p1, x+1, y, rgb[i+1][RCOMP], rgb[i+1][GCOMP], rgb[i+1][BCOMP] ); + *ptr32++ = (p1 << 16) | p0; + } + if (extraPixel) { + PACK_TRUEDITHER( ptr[n], x+n, y, rgb[n][RCOMP], rgb[n][GCOMP], rgb[n][BCOMP]); + } +#else for (i=0;i<n;i++,x++) { PACK_TRUEDITHER( ptr[i], x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); } +#endif } } @@ -4280,7 +4375,6 @@ static void read_color_span( const GLcontext *ctx, { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaBuffer source; - register GLuint i; if (xmesa->use_read_buffer) source = xmesa->xm_read_buffer; @@ -4288,10 +4382,11 @@ static void read_color_span( const GLcontext *ctx, source = xmesa->xm_buffer; if (source->buffer) { + /* Read from Pixmap or Window */ XMesaImage *span = NULL; int error; #ifdef XFree86Server - span = XMesaCreateImage(GET_VISUAL_DEPTH(xmesa->xm_visual), n, 1, NULL); + span = XMesaCreateImage(xmesa->xm_visual->BitsPerPixel, n, 1, NULL); span->data = (char *)MALLOC(span->height * span->bytes_per_line); error = (!span->data); (*xmesa->display->GetImage)(source->buffer, @@ -4307,18 +4402,17 @@ static void read_color_span( const GLcontext *ctx, switch (xmesa->pixelformat) { case PF_TRUECOLOR: case PF_TRUEDITHER: - case PF_5R6G5B: - case PF_DITHER_5R6G5B: { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); - GLubyte *pixelToR = xmesa->xm_visual->PixelToR; - GLubyte *pixelToG = xmesa->xm_visual->PixelToG; - GLubyte *pixelToB = xmesa->xm_visual->PixelToB; GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; + GLuint i; for (i=0;i<n;i++) { unsigned long p; p = XMesaGetPixel( span, i, 0 ); @@ -4329,9 +4423,31 @@ static void read_color_span( const GLcontext *ctx, } } break; + case PF_5R6G5B: + case PF_DITHER_5R6G5B: + { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; + GLuint i; + for (i=0;i<n;i++) { + unsigned long p = XMesaGetPixel( span, i, 0 ); + /* fast, but not quite accurate + rgba[i][RCOMP] = ((p >> 8) & 0xf8); + rgba[i][GCOMP] = ((p >> 3) & 0xfc); + rgba[i][BCOMP] = ((p << 3) & 0xff); + */ + rgba[i][RCOMP] = pixelToR[p >> 11]; + rgba[i][GCOMP] = pixelToG[(p >> 5) & 0x3f]; + rgba[i][BCOMP] = pixelToB[p & 0x1f]; + rgba[i][ACOMP] = 255; + } + } + break; case PF_8A8B8G8R: { - GLuint *ptr4 = (GLuint *) span->data; + const GLuint *ptr4 = (GLuint *) span->data; + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ( p4 & 0xff); @@ -4343,7 +4459,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B: { - GLuint *ptr4 = (GLuint *) span->data; + const GLuint *ptr4 = (GLuint *) span->data; + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); @@ -4355,7 +4472,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B24: { - bgr_t *ptr3 = (bgr_t *) span->data; + const bgr_t *ptr3 = (bgr_t *) span->data; + GLuint i; for (i=0;i<n;i++) { rgba[i][RCOMP] = ptr3[i].r; rgba[i][GCOMP] = ptr3[i].g; @@ -4367,6 +4485,7 @@ static void read_color_span( const GLcontext *ctx, case PF_HPCR: { GLubyte *ptr1 = (GLubyte *) span->data; + GLuint i; for (i=0;i<n;i++) { GLubyte p = *ptr1++; rgba[i][RCOMP] = p & 0xE0; @@ -4384,7 +4503,8 @@ static void read_color_span( const GLcontext *ctx, GLubyte *gTable = source->pixel_to_g; GLubyte *bTable = source->pixel_to_b; if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { - GLubyte *ptr1 = (GLubyte *) span->data; + const GLubyte *ptr1 = (GLubyte *) span->data; + GLuint i; for (i=0;i<n;i++) { unsigned long p = *ptr1++; rgba[i][RCOMP] = rTable[p]; @@ -4394,9 +4514,9 @@ static void read_color_span( const GLcontext *ctx, } } else { + GLuint i; for (i=0;i<n;i++) { - unsigned long p; - p = XMesaGetPixel( span, i, 0 ); + unsigned long p = XMesaGetPixel( span, i, 0 ); rgba[i][RCOMP] = rTable[p]; rgba[i][GCOMP] = gTable[p]; rgba[i][BCOMP] = bTable[p]; @@ -4408,6 +4528,7 @@ static void read_color_span( const GLcontext *ctx, case PF_1BIT: { int bitFlip = xmesa->xm_visual->bitFlip; + GLuint i; for (i=0;i<n;i++) { unsigned long p; p = XMesaGetPixel( span, i, 0 ) ^ bitFlip; @@ -4425,6 +4546,7 @@ static void read_color_span( const GLcontext *ctx, } else { /* return black pixels */ + GLuint i; for (i=0;i<n;i++) { rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = rgba[i][ACOMP] = 0; } @@ -4434,22 +4556,22 @@ static void read_color_span( const GLcontext *ctx, } } else if (source->backimage) { + /* Read from XImage back buffer */ switch (xmesa->pixelformat) { case PF_TRUECOLOR: case PF_TRUEDITHER: - case PF_5R6G5B: - case PF_DITHER_5R6G5B: { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; unsigned long rMask = GET_REDMASK(xmesa->xm_visual); unsigned long gMask = GET_GREENMASK(xmesa->xm_visual); unsigned long bMask = GET_BLUEMASK(xmesa->xm_visual); - GLubyte *pixelToR = xmesa->xm_visual->PixelToR; - GLubyte *pixelToG = xmesa->xm_visual->PixelToG; - GLubyte *pixelToB = xmesa->xm_visual->PixelToB; GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; XMesaImage *img = source->backimage; + GLuint i; y = FLIP(source, y); for (i=0;i<n;i++) { unsigned long p; @@ -4461,9 +4583,58 @@ static void read_color_span( const GLcontext *ctx, } } break; + case PF_5R6G5B: + case PF_DITHER_5R6G5B: + { + const GLubyte *pixelToR = xmesa->xm_visual->PixelToR; + const GLubyte *pixelToG = xmesa->xm_visual->PixelToG; + const GLubyte *pixelToB = xmesa->xm_visual->PixelToB; + const GLushort *ptr2 = PIXELADDR2( source, x, y ); + const GLuint *ptr4 = (const GLuint *) ptr2; + GLuint i; +#if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */ + GLuint extraPixel = (n & 1); + n -= extraPixel; + for (i = 0; i < n; i += 2) { + const GLuint p = *ptr4++; + const GLuint p0 = p & 0xffff; + const GLuint p1 = p >> 16; + /* fast, but not quite accurate + rgba[i][RCOMP] = ((p >> 8) & 0xf8); + rgba[i][GCOMP] = ((p >> 3) & 0xfc); + rgba[i][BCOMP] = ((p << 3) & 0xff); + */ + rgba[i][RCOMP] = pixelToR[p0 >> 11]; + rgba[i][GCOMP] = pixelToG[(p0 >> 5) & 0x3f]; + rgba[i][BCOMP] = pixelToB[p0 & 0x1f]; + rgba[i][ACOMP] = 255; + rgba[i+1][RCOMP] = pixelToR[p1 >> 11]; + rgba[i+1][GCOMP] = pixelToG[(p1 >> 5) & 0x3f]; + rgba[i+1][BCOMP] = pixelToB[p1 & 0x1f]; + rgba[i+1][ACOMP] = 255; + } + if (extraPixel) { + GLushort p = ptr2[n]; + rgba[n][RCOMP] = pixelToR[p >> 11]; + rgba[n][GCOMP] = pixelToG[(p >> 5) & 0x3f]; + rgba[n][BCOMP] = pixelToB[p & 0x1f]; + rgba[n][ACOMP] = 255; + } +#else + for (i = 0; i < n; i++) { + const GLushort p = ptr2[i]; + rgba[i][RCOMP] = pixelToR[p >> 11]; + rgba[i][GCOMP] = pixelToG[(p >> 5) & 0x3f]; + rgba[i][BCOMP] = pixelToB[p & 0x1f]; + rgba[i][ACOMP] = 255; + } +#endif + } + break; case PF_8A8B8G8R: { - GLuint *ptr4 = PIXELADDR4( source, x, y ); + const GLuint *ptr4 = PIXELADDR4( source, x, y ); + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ( p4 & 0xff); @@ -4475,7 +4646,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B: { - GLuint *ptr4 = PIXELADDR4( source, x, y ); + const GLuint *ptr4 = PIXELADDR4( source, x, y ); + GLuint i; for (i=0;i<n;i++) { GLuint p4 = *ptr4++; rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); @@ -4487,7 +4659,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_8R8G8B24: { - bgr_t *ptr3 = PIXELADDR3( source, x, y ); + const bgr_t *ptr3 = PIXELADDR3( source, x, y ); + GLuint i; for (i=0;i<n;i++) { rgba[i][RCOMP] = ptr3[i].r; rgba[i][GCOMP] = ptr3[i].g; @@ -4498,7 +4671,8 @@ static void read_color_span( const GLcontext *ctx, break; case PF_HPCR: { - GLubyte *ptr1 = PIXELADDR1( source, x, y ); + const GLubyte *ptr1 = PIXELADDR1( source, x, y ); + GLuint i; for (i=0;i<n;i++) { GLubyte p = *ptr1++; rgba[i][RCOMP] = p & 0xE0; @@ -4512,11 +4686,12 @@ static void read_color_span( const GLcontext *ctx, case PF_LOOKUP: case PF_GRAYSCALE: { - GLubyte *rTable = source->pixel_to_r; - GLubyte *gTable = source->pixel_to_g; - GLubyte *bTable = source->pixel_to_b; + const GLubyte *rTable = source->pixel_to_r; + const GLubyte *gTable = source->pixel_to_g; + const GLubyte *bTable = source->pixel_to_b; if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { GLubyte *ptr1 = PIXELADDR1( source, x, y ); + GLuint i; for (i=0;i<n;i++) { unsigned long p = *ptr1++; rgba[i][RCOMP] = rTable[p]; @@ -4527,10 +4702,10 @@ static void read_color_span( const GLcontext *ctx, } else { XMesaImage *img = source->backimage; + GLuint i; y = FLIP(source, y); for (i=0;i<n;i++,x++) { - unsigned long p; - p = XMesaGetPixel( img, x, y ); + unsigned long p = XMesaGetPixel( img, x, y ); rgba[i][RCOMP] = rTable[p]; rgba[i][GCOMP] = gTable[p]; rgba[i][BCOMP] = bTable[p]; @@ -4543,6 +4718,7 @@ static void read_color_span( const GLcontext *ctx, { XMesaImage *img = source->backimage; int bitFlip = xmesa->xm_visual->bitFlip; + GLuint i; y = FLIP(source, y); for (i=0;i<n;i++,x++) { unsigned long p; @@ -4936,7 +5112,6 @@ static const GLubyte *get_string( GLcontext *ctx, GLenum name ) } - static void update_span_funcs( GLcontext *ctx ) { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; diff --git a/xc/extras/Mesa/src/X/xmesa3.c b/xc/extras/Mesa/src/X/xmesa3.c index ba98c5e1d..c7e4c21c8 100644 --- a/xc/extras/Mesa/src/X/xmesa3.c +++ b/xc/extras/Mesa/src/X/xmesa3.c @@ -66,7 +66,7 @@ static void draw_points_ANY_pixmap( GLcontext *ctx, GLuint first, GLuint last ) register int x, y; const GLubyte *color = VB->ColorPtr->data[i]; unsigned long pixel = xmesa_color_to_pixel( xmesa, - color[0], color[1], color[2], color[3] ); + color[0], color[1], color[2], color[3], xmesa->pixelformat); XMesaSetForeground( dpy, gc, pixel ); x = (GLint) VB->Win.data[i][0]; y = FLIP( xmesa->xm_buffer, (GLint) VB->Win.data[i][1] ); @@ -131,7 +131,8 @@ static void flat_pixmap_line( GLcontext *ctx, unsigned long pixel; if (xmesa->xm_visual->gl_visual->RGBAflag) { const GLubyte *color = VB->ColorPtr->data[pv]; - pixel = xmesa_color_to_pixel( xmesa, color[0], color[1], color[2], color[3] ); + pixel = xmesa_color_to_pixel( xmesa, color[0], color[1], color[2], color[3], + xmesa->pixelformat ); } else { pixel = VB->IndexPtr->data[pv]; @@ -353,6 +354,7 @@ static void flat_TRUECOLOR_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define CLIP_HACK 1 #define PLOT(X,Y) \ if (Z < *zPtr) { \ @@ -375,6 +377,7 @@ static void flat_8A8B8G8R_z_line( GLcontext *ctx, GLuint pixel = PACK_8B8G8R( color[0], color[1], color[2] ); #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) @@ -400,6 +403,7 @@ static void flat_8R8G8B_z_line( GLcontext *ctx, GLuint pixel = PACK_8R8G8B( color[0], color[1], color[2] ); #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) @@ -424,6 +428,7 @@ static void flat_8R8G8B24_z_line( GLcontext *ctx, const GLubyte *color = ctx->VB->ColorPtr->data[pv]; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) @@ -451,6 +456,7 @@ static void flat_5R6G5B_z_line( GLcontext *ctx, GLushort pixel = PACK_5R6G5B( color[0], color[1], color[2] ); #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) @@ -474,6 +480,7 @@ static void flat_DITHER_5R6G5B_z_line( GLcontext *ctx, const GLubyte *color = ctx->VB->ColorPtr->data[pv]; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) @@ -500,6 +507,7 @@ static void flat_DITHER8_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) @@ -526,6 +534,7 @@ static void flat_LOOKUP8_z_line( GLcontext *ctx, pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] ); #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) @@ -552,6 +561,7 @@ static void flat_HPCR_z_line( GLcontext *ctx, #define INTERP_XY 1 #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) @@ -670,6 +680,7 @@ line_func xmesa_get_line_func( GLcontext *ctx ) && ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Line.Width==1.0F) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: diff --git a/xc/extras/Mesa/src/X/xmesa4.c b/xc/extras/Mesa/src/X/xmesa4.c index 844447595..195a531f0 100644 --- a/xc/extras/Mesa/src/X/xmesa4.c +++ b/xc/extras/Mesa/src/X/xmesa4.c @@ -66,8 +66,9 @@ static void flat_pixmap_triangle( GLcontext *ctx, unsigned long pixel; if (xmesa->xm_visual->gl_visual->RGBAflag) { pixel = xmesa_color_to_pixel( xmesa, - VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], - VB->ColorPtr->data[pv][2], VB->ColorPtr->data[pv][3] ); + VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], + VB->ColorPtr->data[pv][2], VB->ColorPtr->data[pv][3], + xmesa->pixelformat ); } else { pixel = VB->IndexPtr->data[pv]; @@ -97,6 +98,7 @@ static void smooth_TRUECOLOR_z_triangle( GLcontext *ctx, XMesaImage *img = xmesa->xm_buffer->backimage; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -129,6 +131,7 @@ static void smooth_8A8B8G8R_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint @@ -161,6 +164,7 @@ static void smooth_8R8G8B_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint @@ -193,6 +197,7 @@ static void smooth_8R8G8B24_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE bgr_t @@ -228,6 +233,7 @@ static void smooth_TRUEDITHER_z_triangle( GLcontext *ctx, XMesaImage *img = xmesa->xm_buffer->backimage; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -259,6 +265,7 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort @@ -267,7 +274,7 @@ static void smooth_5R6G5B_z_triangle( GLcontext *ctx, { \ GLint i, len = RIGHT-LEFT; \ for (i=0;i<len;i++) { \ - GLdepth z = FixedToDepth(ffz); \ + DEPTH_TYPE z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ pRow[i] = PACK_5R6G5B( FixedToInt(ffr), FixedToInt(ffg), \ FixedToInt(ffb) ); \ @@ -291,6 +298,7 @@ static void smooth_DITHER_5R6G5B_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort @@ -323,6 +331,7 @@ static void smooth_DITHER8_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -357,6 +366,7 @@ static void smooth_DITHER_z_triangle( GLcontext *ctx, XMesaImage *img = xmesa->xm_buffer->backimage; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -390,6 +400,7 @@ static void smooth_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -423,6 +434,7 @@ static void smooth_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; (void) pv; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INTERP_RGB 1 #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte @@ -455,6 +467,7 @@ static void flat_TRUECOLOR_z_triangle( GLcontext *ctx, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ unsigned long pixel; \ PACK_TRUECOLOR(pixel, VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2]); @@ -483,6 +496,7 @@ static void flat_8A8B8G8R_z_triangle( GLcontext *ctx, GLuint v0, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -513,6 +527,7 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR4(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLuint #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -544,6 +559,7 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; const GLubyte *color = ctx->VB->ColorPtr->data[pv]; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR3(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE bgr_t #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -575,6 +591,7 @@ static void flat_TRUEDITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint i, xx = LEFT, yy = FLIP(xmesa->xm_buffer,Y), len = RIGHT-LEFT; \ @@ -602,6 +619,7 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -612,7 +630,7 @@ static void flat_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { \ GLint i, len = RIGHT-LEFT; \ for (i=0;i<len;i++) { \ - GLdepth z = FixedToDepth(ffz); \ + DEPTH_TYPE z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ pRow[i] = (PIXEL_TYPE) p; \ zRow[i] = z; \ @@ -633,6 +651,7 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; const GLubyte *color = ctx->VB->ColorPtr->data[pv]; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR2(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLushort #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -640,7 +659,7 @@ static void flat_DITHER_5R6G5B_z_triangle( GLcontext *ctx, GLuint v0, { \ GLint i, len = RIGHT-LEFT; \ for (i=0;i<len;i++) { \ - GLdepth z = FixedToDepth(ffz); \ + DEPTH_TYPE z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ PACK_TRUEDITHER(pRow[i], LEFT+i, Y, color[RCOMP], \ color[GCOMP], color[BCOMP]); \ @@ -661,6 +680,7 @@ static void flat_DITHER8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -693,6 +713,7 @@ static void flat_DITHER_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ FLAT_DITHER_SETUP( VB->ColorPtr->data[pv][0], VB->ColorPtr->data[pv][1], VB->ColorPtr->data[pv][2] ); @@ -722,6 +743,7 @@ static void flat_HPCR_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -753,6 +775,7 @@ static void flat_LOOKUP8_z_triangle( GLcontext *ctx, GLuint v0, GLuint v1, { XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; #define INTERP_Z 1 +#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define PIXEL_ADDRESS(X,Y) PIXELADDR1(xmesa->xm_buffer,X,Y) #define PIXEL_TYPE GLubyte #define BYTES_PER_ROW (xmesa->xm_buffer->backimage->bytes_per_line) @@ -1432,6 +1455,7 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) && ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: @@ -1463,6 +1487,7 @@ triangle_func xmesa_get_triangle_func( GLcontext *ctx ) && ctx->RasterMask==DEPTH_BIT && ctx->Depth.Func==GL_LESS && ctx->Depth.Mask==GL_TRUE + && ctx->Visual->DepthBits == DEFAULT_SOFTWARE_DEPTH_BITS && ctx->Polygon.StippleFlag==GL_FALSE) { switch (xmesa->pixelformat) { case PF_TRUECOLOR: diff --git a/xc/extras/Mesa/src/X/xmesaP.h b/xc/extras/Mesa/src/X/xmesaP.h index 9b79f4314..987877509 100644 --- a/xc/extras/Mesa/src/X/xmesaP.h +++ b/xc/extras/Mesa/src/X/xmesaP.h @@ -85,6 +85,7 @@ struct xmesa_visual { GLint BitsPerPixel; /* True bits per pixel for XImages */ GLint level; /* 0=normal, 1=overlay, etc */ + GLint VisualCaveat; /* for GLX_EXT_visual_rating extension */ GLboolean ximage_flag; /* Use XImage for back buffer (not pixmap)? */ @@ -510,8 +511,9 @@ static int const kernel1[16] = { * External functions: */ -extern unsigned long xmesa_color_to_pixel( XMesaContext xmesa, - GLubyte r, GLubyte g, GLubyte b, GLubyte a ); +extern unsigned long +xmesa_color_to_pixel( XMesaContext xmesa, GLubyte r, GLubyte g, GLubyte b, GLubyte a, + GLuint pixelFormat ); extern void xmesa_alloc_back_buffer( XMesaBuffer b ); diff --git a/xc/extras/Mesa/src/X86/glapi_x86.S b/xc/extras/Mesa/src/X86/glapi_x86.S index a9566ea46..3afd50e0a 100644 --- a/xc/extras/Mesa/src/X86/glapi_x86.S +++ b/xc/extras/Mesa/src/X86/glapi_x86.S @@ -1,37 +1,4 @@ - -/* - * Mesa 3-D graphics library - * Version: 3.3 - * - * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/* - * X86-optimized dispatch code contibuted by Josh Vanderhoof - * - * This file will be machine-generated from the gl.spec file at some point - * in the future. - */ - - +/* DO NOT EDIT - This file generated automatically with glx86asm.py script */ #include "assyntax.h" #include "glapioffsets.h" @@ -51,45 +18,22 @@ #define GLOBL_FN(x) GLOBL x #endif -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Accum)) -GL_PREFIX(Accum): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Accum)) - JMP(GL_OFFSET(_gloffset_Accum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AlphaFunc)) -GL_PREFIX(AlphaFunc): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_AlphaFunc)) - JMP(GL_OFFSET(_gloffset_AlphaFunc)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Begin)) -GL_PREFIX(Begin): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Begin)) - JMP(GL_OFFSET(_gloffset_Begin)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Bitmap)) -GL_PREFIX(Bitmap): +GLOBL_FN(GL_PREFIX(NewList)) +GL_PREFIX(NewList): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Bitmap)) - JMP(GL_OFFSET(_gloffset_Bitmap)) + JZ(GLNAME(_glapi_fallback_NewList)) + JMP(GL_OFFSET(_gloffset_NewList)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendFunc)) -GL_PREFIX(BlendFunc): +GLOBL_FN(GL_PREFIX(EndList)) +GL_PREFIX(EndList): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendFunc)) - JMP(GL_OFFSET(_gloffset_BlendFunc)) + JZ(GLNAME(_glapi_fallback_EndList)) + JMP(GL_OFFSET(_gloffset_EndList)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CallList)) @@ -108,60 +52,44 @@ GL_PREFIX(CallLists): JMP(GL_OFFSET(_gloffset_CallLists)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Clear)) -GL_PREFIX(Clear): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Clear)) - JMP(GL_OFFSET(_gloffset_Clear)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearAccum)) -GL_PREFIX(ClearAccum): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearAccum)) - JMP(GL_OFFSET(_gloffset_ClearAccum)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearColor)) -GL_PREFIX(ClearColor): +GLOBL_FN(GL_PREFIX(DeleteLists)) +GL_PREFIX(DeleteLists): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearColor)) - JMP(GL_OFFSET(_gloffset_ClearColor)) + JZ(GLNAME(_glapi_fallback_DeleteLists)) + JMP(GL_OFFSET(_gloffset_DeleteLists)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearDepth)) -GL_PREFIX(ClearDepth): +GLOBL_FN(GL_PREFIX(GenLists)) +GL_PREFIX(GenLists): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearDepth)) - JMP(GL_OFFSET(_gloffset_ClearDepth)) + JZ(GLNAME(_glapi_fallback_GenLists)) + JMP(GL_OFFSET(_gloffset_GenLists)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearIndex)) -GL_PREFIX(ClearIndex): +GLOBL_FN(GL_PREFIX(ListBase)) +GL_PREFIX(ListBase): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearIndex)) - JMP(GL_OFFSET(_gloffset_ClearIndex)) + JZ(GLNAME(_glapi_fallback_ListBase)) + JMP(GL_OFFSET(_gloffset_ListBase)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClearStencil)) -GL_PREFIX(ClearStencil): +GLOBL_FN(GL_PREFIX(Begin)) +GL_PREFIX(Begin): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClearStencil)) - JMP(GL_OFFSET(_gloffset_ClearStencil)) + JZ(GLNAME(_glapi_fallback_Begin)) + JMP(GL_OFFSET(_gloffset_Begin)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ClipPlane)) -GL_PREFIX(ClipPlane): +GLOBL_FN(GL_PREFIX(Bitmap)) +GL_PREFIX(Bitmap): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ClipPlane)) - JMP(GL_OFFSET(_gloffset_ClipPlane)) + JZ(GLNAME(_glapi_fallback_Bitmap)) + JMP(GL_OFFSET(_gloffset_Bitmap)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3b)) @@ -172,6 +100,14 @@ GL_PREFIX(Color3b): JMP(GL_OFFSET(_gloffset_Color3b)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3bv)) +GL_PREFIX(Color3bv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3bv)) + JMP(GL_OFFSET(_gloffset_Color3bv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3d)) GL_PREFIX(Color3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -180,6 +116,14 @@ GL_PREFIX(Color3d): JMP(GL_OFFSET(_gloffset_Color3d)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3dv)) +GL_PREFIX(Color3dv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3dv)) + JMP(GL_OFFSET(_gloffset_Color3dv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3f)) GL_PREFIX(Color3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -188,6 +132,14 @@ GL_PREFIX(Color3f): JMP(GL_OFFSET(_gloffset_Color3f)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3fv)) +GL_PREFIX(Color3fv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3fv)) + JMP(GL_OFFSET(_gloffset_Color3fv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3i)) GL_PREFIX(Color3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -196,6 +148,14 @@ GL_PREFIX(Color3i): JMP(GL_OFFSET(_gloffset_Color3i)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3iv)) +GL_PREFIX(Color3iv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3iv)) + JMP(GL_OFFSET(_gloffset_Color3iv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3s)) GL_PREFIX(Color3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -204,6 +164,14 @@ GL_PREFIX(Color3s): JMP(GL_OFFSET(_gloffset_Color3s)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3sv)) +GL_PREFIX(Color3sv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3sv)) + JMP(GL_OFFSET(_gloffset_Color3sv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ub)) GL_PREFIX(Color3ub): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -212,6 +180,14 @@ GL_PREFIX(Color3ub): JMP(GL_OFFSET(_gloffset_Color3ub)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3ubv)) +GL_PREFIX(Color3ubv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3ubv)) + JMP(GL_OFFSET(_gloffset_Color3ubv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3ui)) GL_PREFIX(Color3ui): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -220,6 +196,14 @@ GL_PREFIX(Color3ui): JMP(GL_OFFSET(_gloffset_Color3ui)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3uiv)) +GL_PREFIX(Color3uiv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3uiv)) + JMP(GL_OFFSET(_gloffset_Color3uiv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color3us)) GL_PREFIX(Color3us): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -228,6 +212,14 @@ GL_PREFIX(Color3us): JMP(GL_OFFSET(_gloffset_Color3us)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color3usv)) +GL_PREFIX(Color3usv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color3usv)) + JMP(GL_OFFSET(_gloffset_Color3usv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4b)) GL_PREFIX(Color4b): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -236,6 +228,14 @@ GL_PREFIX(Color4b): JMP(GL_OFFSET(_gloffset_Color4b)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4bv)) +GL_PREFIX(Color4bv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4bv)) + JMP(GL_OFFSET(_gloffset_Color4bv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4d)) GL_PREFIX(Color4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -244,6 +244,14 @@ GL_PREFIX(Color4d): JMP(GL_OFFSET(_gloffset_Color4d)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4dv)) +GL_PREFIX(Color4dv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4dv)) + JMP(GL_OFFSET(_gloffset_Color4dv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4f)) GL_PREFIX(Color4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -252,6 +260,14 @@ GL_PREFIX(Color4f): JMP(GL_OFFSET(_gloffset_Color4f)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4fv)) +GL_PREFIX(Color4fv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4fv)) + JMP(GL_OFFSET(_gloffset_Color4fv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4i)) GL_PREFIX(Color4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -260,6 +276,14 @@ GL_PREFIX(Color4i): JMP(GL_OFFSET(_gloffset_Color4i)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4iv)) +GL_PREFIX(Color4iv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4iv)) + JMP(GL_OFFSET(_gloffset_Color4iv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4s)) GL_PREFIX(Color4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -268,6 +292,14 @@ GL_PREFIX(Color4s): JMP(GL_OFFSET(_gloffset_Color4s)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4sv)) +GL_PREFIX(Color4sv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4sv)) + JMP(GL_OFFSET(_gloffset_Color4sv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ub)) GL_PREFIX(Color4ub): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -276,6 +308,14 @@ GL_PREFIX(Color4ub): JMP(GL_OFFSET(_gloffset_Color4ub)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(Color4ubv)) +GL_PREFIX(Color4ubv): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_Color4ubv)) + JMP(GL_OFFSET(_gloffset_Color4ubv)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Color4ui)) GL_PREFIX(Color4ui): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -284,2260 +324,2260 @@ GL_PREFIX(Color4ui): JMP(GL_OFFSET(_gloffset_Color4ui)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4us)) -GL_PREFIX(Color4us): +GLOBL_FN(GL_PREFIX(Color4uiv)) +GL_PREFIX(Color4uiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4us)) - JMP(GL_OFFSET(_gloffset_Color4us)) + JZ(GLNAME(_glapi_fallback_Color4uiv)) + JMP(GL_OFFSET(_gloffset_Color4uiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3bv)) -GL_PREFIX(Color3bv): +GLOBL_FN(GL_PREFIX(Color4us)) +GL_PREFIX(Color4us): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3bv)) - JMP(GL_OFFSET(_gloffset_Color3bv)) + JZ(GLNAME(_glapi_fallback_Color4us)) + JMP(GL_OFFSET(_gloffset_Color4us)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3dv)) -GL_PREFIX(Color3dv): +GLOBL_FN(GL_PREFIX(Color4usv)) +GL_PREFIX(Color4usv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3dv)) - JMP(GL_OFFSET(_gloffset_Color3dv)) + JZ(GLNAME(_glapi_fallback_Color4usv)) + JMP(GL_OFFSET(_gloffset_Color4usv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3fv)) -GL_PREFIX(Color3fv): +GLOBL_FN(GL_PREFIX(EdgeFlag)) +GL_PREFIX(EdgeFlag): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3fv)) - JMP(GL_OFFSET(_gloffset_Color3fv)) + JZ(GLNAME(_glapi_fallback_EdgeFlag)) + JMP(GL_OFFSET(_gloffset_EdgeFlag)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3iv)) -GL_PREFIX(Color3iv): +GLOBL_FN(GL_PREFIX(EdgeFlagv)) +GL_PREFIX(EdgeFlagv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3iv)) - JMP(GL_OFFSET(_gloffset_Color3iv)) + JZ(GLNAME(_glapi_fallback_EdgeFlagv)) + JMP(GL_OFFSET(_gloffset_EdgeFlagv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3sv)) -GL_PREFIX(Color3sv): +GLOBL_FN(GL_PREFIX(End)) +GL_PREFIX(End): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3sv)) - JMP(GL_OFFSET(_gloffset_Color3sv)) + JZ(GLNAME(_glapi_fallback_End)) + JMP(GL_OFFSET(_gloffset_End)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3ubv)) -GL_PREFIX(Color3ubv): +GLOBL_FN(GL_PREFIX(Indexd)) +GL_PREFIX(Indexd): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3ubv)) - JMP(GL_OFFSET(_gloffset_Color3ubv)) + JZ(GLNAME(_glapi_fallback_Indexd)) + JMP(GL_OFFSET(_gloffset_Indexd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3uiv)) -GL_PREFIX(Color3uiv): +GLOBL_FN(GL_PREFIX(Indexdv)) +GL_PREFIX(Indexdv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3uiv)) - JMP(GL_OFFSET(_gloffset_Color3uiv)) + JZ(GLNAME(_glapi_fallback_Indexdv)) + JMP(GL_OFFSET(_gloffset_Indexdv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color3usv)) -GL_PREFIX(Color3usv): +GLOBL_FN(GL_PREFIX(Indexf)) +GL_PREFIX(Indexf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color3usv)) - JMP(GL_OFFSET(_gloffset_Color3usv)) + JZ(GLNAME(_glapi_fallback_Indexf)) + JMP(GL_OFFSET(_gloffset_Indexf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4bv)) -GL_PREFIX(Color4bv): +GLOBL_FN(GL_PREFIX(Indexfv)) +GL_PREFIX(Indexfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4bv)) - JMP(GL_OFFSET(_gloffset_Color4bv)) + JZ(GLNAME(_glapi_fallback_Indexfv)) + JMP(GL_OFFSET(_gloffset_Indexfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4dv)) -GL_PREFIX(Color4dv): +GLOBL_FN(GL_PREFIX(Indexi)) +GL_PREFIX(Indexi): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4dv)) - JMP(GL_OFFSET(_gloffset_Color4dv)) + JZ(GLNAME(_glapi_fallback_Indexi)) + JMP(GL_OFFSET(_gloffset_Indexi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4fv)) -GL_PREFIX(Color4fv): +GLOBL_FN(GL_PREFIX(Indexiv)) +GL_PREFIX(Indexiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4fv)) - JMP(GL_OFFSET(_gloffset_Color4fv)) + JZ(GLNAME(_glapi_fallback_Indexiv)) + JMP(GL_OFFSET(_gloffset_Indexiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4iv)) -GL_PREFIX(Color4iv): +GLOBL_FN(GL_PREFIX(Indexs)) +GL_PREFIX(Indexs): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4iv)) - JMP(GL_OFFSET(_gloffset_Color4iv)) + JZ(GLNAME(_glapi_fallback_Indexs)) + JMP(GL_OFFSET(_gloffset_Indexs)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4sv)) -GL_PREFIX(Color4sv): +GLOBL_FN(GL_PREFIX(Indexsv)) +GL_PREFIX(Indexsv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4sv)) - JMP(GL_OFFSET(_gloffset_Color4sv)) + JZ(GLNAME(_glapi_fallback_Indexsv)) + JMP(GL_OFFSET(_gloffset_Indexsv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4ubv)) -GL_PREFIX(Color4ubv): +GLOBL_FN(GL_PREFIX(Normal3b)) +GL_PREFIX(Normal3b): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4ubv)) - JMP(GL_OFFSET(_gloffset_Color4ubv)) + JZ(GLNAME(_glapi_fallback_Normal3b)) + JMP(GL_OFFSET(_gloffset_Normal3b)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4uiv)) -GL_PREFIX(Color4uiv): +GLOBL_FN(GL_PREFIX(Normal3bv)) +GL_PREFIX(Normal3bv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4uiv)) - JMP(GL_OFFSET(_gloffset_Color4uiv)) + JZ(GLNAME(_glapi_fallback_Normal3bv)) + JMP(GL_OFFSET(_gloffset_Normal3bv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Color4usv)) -GL_PREFIX(Color4usv): +GLOBL_FN(GL_PREFIX(Normal3d)) +GL_PREFIX(Normal3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Color4usv)) - JMP(GL_OFFSET(_gloffset_Color4usv)) + JZ(GLNAME(_glapi_fallback_Normal3d)) + JMP(GL_OFFSET(_gloffset_Normal3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorMask)) -GL_PREFIX(ColorMask): +GLOBL_FN(GL_PREFIX(Normal3dv)) +GL_PREFIX(Normal3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorMask)) - JMP(GL_OFFSET(_gloffset_ColorMask)) + JZ(GLNAME(_glapi_fallback_Normal3dv)) + JMP(GL_OFFSET(_gloffset_Normal3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorMaterial)) -GL_PREFIX(ColorMaterial): +GLOBL_FN(GL_PREFIX(Normal3f)) +GL_PREFIX(Normal3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorMaterial)) - JMP(GL_OFFSET(_gloffset_ColorMaterial)) + JZ(GLNAME(_glapi_fallback_Normal3f)) + JMP(GL_OFFSET(_gloffset_Normal3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyPixels)) -GL_PREFIX(CopyPixels): +GLOBL_FN(GL_PREFIX(Normal3fv)) +GL_PREFIX(Normal3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyPixels)) - JMP(GL_OFFSET(_gloffset_CopyPixels)) + JZ(GLNAME(_glapi_fallback_Normal3fv)) + JMP(GL_OFFSET(_gloffset_Normal3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CullFace)) -GL_PREFIX(CullFace): +GLOBL_FN(GL_PREFIX(Normal3i)) +GL_PREFIX(Normal3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CullFace)) - JMP(GL_OFFSET(_gloffset_CullFace)) + JZ(GLNAME(_glapi_fallback_Normal3i)) + JMP(GL_OFFSET(_gloffset_Normal3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthFunc)) -GL_PREFIX(DepthFunc): +GLOBL_FN(GL_PREFIX(Normal3iv)) +GL_PREFIX(Normal3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DepthFunc)) - JMP(GL_OFFSET(_gloffset_DepthFunc)) + JZ(GLNAME(_glapi_fallback_Normal3iv)) + JMP(GL_OFFSET(_gloffset_Normal3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthMask)) -GL_PREFIX(DepthMask): +GLOBL_FN(GL_PREFIX(Normal3s)) +GL_PREFIX(Normal3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DepthMask)) - JMP(GL_OFFSET(_gloffset_DepthMask)) + JZ(GLNAME(_glapi_fallback_Normal3s)) + JMP(GL_OFFSET(_gloffset_Normal3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DepthRange)) -GL_PREFIX(DepthRange): +GLOBL_FN(GL_PREFIX(Normal3sv)) +GL_PREFIX(Normal3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DepthRange)) - JMP(GL_OFFSET(_gloffset_DepthRange)) + JZ(GLNAME(_glapi_fallback_Normal3sv)) + JMP(GL_OFFSET(_gloffset_Normal3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteLists)) -GL_PREFIX(DeleteLists): +GLOBL_FN(GL_PREFIX(RasterPos2d)) +GL_PREFIX(RasterPos2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DeleteLists)) - JMP(GL_OFFSET(_gloffset_DeleteLists)) + JZ(GLNAME(_glapi_fallback_RasterPos2d)) + JMP(GL_OFFSET(_gloffset_RasterPos2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Disable)) -GL_PREFIX(Disable): +GLOBL_FN(GL_PREFIX(RasterPos2dv)) +GL_PREFIX(RasterPos2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Disable)) - JMP(GL_OFFSET(_gloffset_Disable)) + JZ(GLNAME(_glapi_fallback_RasterPos2dv)) + JMP(GL_OFFSET(_gloffset_RasterPos2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawBuffer)) -GL_PREFIX(DrawBuffer): +GLOBL_FN(GL_PREFIX(RasterPos2f)) +GL_PREFIX(RasterPos2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawBuffer)) - JMP(GL_OFFSET(_gloffset_DrawBuffer)) + JZ(GLNAME(_glapi_fallback_RasterPos2f)) + JMP(GL_OFFSET(_gloffset_RasterPos2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawElements)) -GL_PREFIX(DrawElements): +GLOBL_FN(GL_PREFIX(RasterPos2fv)) +GL_PREFIX(RasterPos2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawElements)) - JMP(GL_OFFSET(_gloffset_DrawElements)) + JZ(GLNAME(_glapi_fallback_RasterPos2fv)) + JMP(GL_OFFSET(_gloffset_RasterPos2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawPixels)) -GL_PREFIX(DrawPixels): +GLOBL_FN(GL_PREFIX(RasterPos2i)) +GL_PREFIX(RasterPos2i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawPixels)) - JMP(GL_OFFSET(_gloffset_DrawPixels)) + JZ(GLNAME(_glapi_fallback_RasterPos2i)) + JMP(GL_OFFSET(_gloffset_RasterPos2i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Enable)) -GL_PREFIX(Enable): +GLOBL_FN(GL_PREFIX(RasterPos2iv)) +GL_PREFIX(RasterPos2iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Enable)) - JMP(GL_OFFSET(_gloffset_Enable)) + JZ(GLNAME(_glapi_fallback_RasterPos2iv)) + JMP(GL_OFFSET(_gloffset_RasterPos2iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(End)) -GL_PREFIX(End): +GLOBL_FN(GL_PREFIX(RasterPos2s)) +GL_PREFIX(RasterPos2s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_End)) - JMP(GL_OFFSET(_gloffset_End)) + JZ(GLNAME(_glapi_fallback_RasterPos2s)) + JMP(GL_OFFSET(_gloffset_RasterPos2s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EndList)) -GL_PREFIX(EndList): +GLOBL_FN(GL_PREFIX(RasterPos2sv)) +GL_PREFIX(RasterPos2sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EndList)) - JMP(GL_OFFSET(_gloffset_EndList)) + JZ(GLNAME(_glapi_fallback_RasterPos2sv)) + JMP(GL_OFFSET(_gloffset_RasterPos2sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1d)) -GL_PREFIX(EvalCoord1d): +GLOBL_FN(GL_PREFIX(RasterPos3d)) +GL_PREFIX(RasterPos3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1d)) - JMP(GL_OFFSET(_gloffset_EvalCoord1d)) + JZ(GLNAME(_glapi_fallback_RasterPos3d)) + JMP(GL_OFFSET(_gloffset_RasterPos3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1f)) -GL_PREFIX(EvalCoord1f): +GLOBL_FN(GL_PREFIX(RasterPos3dv)) +GL_PREFIX(RasterPos3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1f)) - JMP(GL_OFFSET(_gloffset_EvalCoord1f)) + JZ(GLNAME(_glapi_fallback_RasterPos3dv)) + JMP(GL_OFFSET(_gloffset_RasterPos3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1dv)) -GL_PREFIX(EvalCoord1dv): +GLOBL_FN(GL_PREFIX(RasterPos3f)) +GL_PREFIX(RasterPos3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1dv)) - JMP(GL_OFFSET(_gloffset_EvalCoord1dv)) + JZ(GLNAME(_glapi_fallback_RasterPos3f)) + JMP(GL_OFFSET(_gloffset_RasterPos3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord1fv)) -GL_PREFIX(EvalCoord1fv): +GLOBL_FN(GL_PREFIX(RasterPos3fv)) +GL_PREFIX(RasterPos3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord1fv)) - JMP(GL_OFFSET(_gloffset_EvalCoord1fv)) + JZ(GLNAME(_glapi_fallback_RasterPos3fv)) + JMP(GL_OFFSET(_gloffset_RasterPos3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2d)) -GL_PREFIX(EvalCoord2d): +GLOBL_FN(GL_PREFIX(RasterPos3i)) +GL_PREFIX(RasterPos3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2d)) - JMP(GL_OFFSET(_gloffset_EvalCoord2d)) + JZ(GLNAME(_glapi_fallback_RasterPos3i)) + JMP(GL_OFFSET(_gloffset_RasterPos3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2f)) -GL_PREFIX(EvalCoord2f): +GLOBL_FN(GL_PREFIX(RasterPos3iv)) +GL_PREFIX(RasterPos3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2f)) - JMP(GL_OFFSET(_gloffset_EvalCoord2f)) + JZ(GLNAME(_glapi_fallback_RasterPos3iv)) + JMP(GL_OFFSET(_gloffset_RasterPos3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2dv)) -GL_PREFIX(EvalCoord2dv): +GLOBL_FN(GL_PREFIX(RasterPos3s)) +GL_PREFIX(RasterPos3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2dv)) - JMP(GL_OFFSET(_gloffset_EvalCoord2dv)) + JZ(GLNAME(_glapi_fallback_RasterPos3s)) + JMP(GL_OFFSET(_gloffset_RasterPos3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalCoord2fv)) -GL_PREFIX(EvalCoord2fv): +GLOBL_FN(GL_PREFIX(RasterPos3sv)) +GL_PREFIX(RasterPos3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalCoord2fv)) - JMP(GL_OFFSET(_gloffset_EvalCoord2fv)) + JZ(GLNAME(_glapi_fallback_RasterPos3sv)) + JMP(GL_OFFSET(_gloffset_RasterPos3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalPoint1)) -GL_PREFIX(EvalPoint1): +GLOBL_FN(GL_PREFIX(RasterPos4d)) +GL_PREFIX(RasterPos4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalPoint1)) - JMP(GL_OFFSET(_gloffset_EvalPoint1)) + JZ(GLNAME(_glapi_fallback_RasterPos4d)) + JMP(GL_OFFSET(_gloffset_RasterPos4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalPoint2)) -GL_PREFIX(EvalPoint2): +GLOBL_FN(GL_PREFIX(RasterPos4dv)) +GL_PREFIX(RasterPos4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalPoint2)) - JMP(GL_OFFSET(_gloffset_EvalPoint2)) + JZ(GLNAME(_glapi_fallback_RasterPos4dv)) + JMP(GL_OFFSET(_gloffset_RasterPos4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalMesh1)) -GL_PREFIX(EvalMesh1): +GLOBL_FN(GL_PREFIX(RasterPos4f)) +GL_PREFIX(RasterPos4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalMesh1)) - JMP(GL_OFFSET(_gloffset_EvalMesh1)) + JZ(GLNAME(_glapi_fallback_RasterPos4f)) + JMP(GL_OFFSET(_gloffset_RasterPos4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlag)) -GL_PREFIX(EdgeFlag): +GLOBL_FN(GL_PREFIX(RasterPos4fv)) +GL_PREFIX(RasterPos4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlag)) - JMP(GL_OFFSET(_gloffset_EdgeFlag)) + JZ(GLNAME(_glapi_fallback_RasterPos4fv)) + JMP(GL_OFFSET(_gloffset_RasterPos4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlagv)) -GL_PREFIX(EdgeFlagv): +GLOBL_FN(GL_PREFIX(RasterPos4i)) +GL_PREFIX(RasterPos4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlagv)) - JMP(GL_OFFSET(_gloffset_EdgeFlagv)) + JZ(GLNAME(_glapi_fallback_RasterPos4i)) + JMP(GL_OFFSET(_gloffset_RasterPos4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EvalMesh2)) -GL_PREFIX(EvalMesh2): +GLOBL_FN(GL_PREFIX(RasterPos4iv)) +GL_PREFIX(RasterPos4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EvalMesh2)) - JMP(GL_OFFSET(_gloffset_EvalMesh2)) + JZ(GLNAME(_glapi_fallback_RasterPos4iv)) + JMP(GL_OFFSET(_gloffset_RasterPos4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FeedbackBuffer)) -GL_PREFIX(FeedbackBuffer): +GLOBL_FN(GL_PREFIX(RasterPos4s)) +GL_PREFIX(RasterPos4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FeedbackBuffer)) - JMP(GL_OFFSET(_gloffset_FeedbackBuffer)) + JZ(GLNAME(_glapi_fallback_RasterPos4s)) + JMP(GL_OFFSET(_gloffset_RasterPos4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Finish)) -GL_PREFIX(Finish): +GLOBL_FN(GL_PREFIX(RasterPos4sv)) +GL_PREFIX(RasterPos4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Finish)) - JMP(GL_OFFSET(_gloffset_Finish)) + JZ(GLNAME(_glapi_fallback_RasterPos4sv)) + JMP(GL_OFFSET(_gloffset_RasterPos4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Flush)) -GL_PREFIX(Flush): +GLOBL_FN(GL_PREFIX(Rectd)) +GL_PREFIX(Rectd): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Flush)) - JMP(GL_OFFSET(_gloffset_Flush)) + JZ(GLNAME(_glapi_fallback_Rectd)) + JMP(GL_OFFSET(_gloffset_Rectd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogf)) -GL_PREFIX(Fogf): +GLOBL_FN(GL_PREFIX(Rectdv)) +GL_PREFIX(Rectdv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogf)) - JMP(GL_OFFSET(_gloffset_Fogf)) + JZ(GLNAME(_glapi_fallback_Rectdv)) + JMP(GL_OFFSET(_gloffset_Rectdv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogi)) -GL_PREFIX(Fogi): +GLOBL_FN(GL_PREFIX(Rectf)) +GL_PREFIX(Rectf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogi)) - JMP(GL_OFFSET(_gloffset_Fogi)) + JZ(GLNAME(_glapi_fallback_Rectf)) + JMP(GL_OFFSET(_gloffset_Rectf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogfv)) -GL_PREFIX(Fogfv): +GLOBL_FN(GL_PREFIX(Rectfv)) +GL_PREFIX(Rectfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogfv)) - JMP(GL_OFFSET(_gloffset_Fogfv)) + JZ(GLNAME(_glapi_fallback_Rectfv)) + JMP(GL_OFFSET(_gloffset_Rectfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Fogiv)) -GL_PREFIX(Fogiv): +GLOBL_FN(GL_PREFIX(Recti)) +GL_PREFIX(Recti): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Fogiv)) - JMP(GL_OFFSET(_gloffset_Fogiv)) + JZ(GLNAME(_glapi_fallback_Recti)) + JMP(GL_OFFSET(_gloffset_Recti)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(FrontFace)) -GL_PREFIX(FrontFace): +GLOBL_FN(GL_PREFIX(Rectiv)) +GL_PREFIX(Rectiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_FrontFace)) - JMP(GL_OFFSET(_gloffset_FrontFace)) + JZ(GLNAME(_glapi_fallback_Rectiv)) + JMP(GL_OFFSET(_gloffset_Rectiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Frustum)) -GL_PREFIX(Frustum): +GLOBL_FN(GL_PREFIX(Rects)) +GL_PREFIX(Rects): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Frustum)) - JMP(GL_OFFSET(_gloffset_Frustum)) + JZ(GLNAME(_glapi_fallback_Rects)) + JMP(GL_OFFSET(_gloffset_Rects)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenLists)) -GL_PREFIX(GenLists): +GLOBL_FN(GL_PREFIX(Rectsv)) +GL_PREFIX(Rectsv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GenLists)) - JMP(GL_OFFSET(_gloffset_GenLists)) + JZ(GLNAME(_glapi_fallback_Rectsv)) + JMP(GL_OFFSET(_gloffset_Rectsv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetBooleanv)) -GL_PREFIX(GetBooleanv): +GLOBL_FN(GL_PREFIX(TexCoord1d)) +GL_PREFIX(TexCoord1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetBooleanv)) - JMP(GL_OFFSET(_gloffset_GetBooleanv)) + JZ(GLNAME(_glapi_fallback_TexCoord1d)) + JMP(GL_OFFSET(_gloffset_TexCoord1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetClipPlane)) -GL_PREFIX(GetClipPlane): +GLOBL_FN(GL_PREFIX(TexCoord1dv)) +GL_PREFIX(TexCoord1dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetClipPlane)) - JMP(GL_OFFSET(_gloffset_GetClipPlane)) + JZ(GLNAME(_glapi_fallback_TexCoord1dv)) + JMP(GL_OFFSET(_gloffset_TexCoord1dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetDoublev)) -GL_PREFIX(GetDoublev): +GLOBL_FN(GL_PREFIX(TexCoord1f)) +GL_PREFIX(TexCoord1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetDoublev)) - JMP(GL_OFFSET(_gloffset_GetDoublev)) + JZ(GLNAME(_glapi_fallback_TexCoord1f)) + JMP(GL_OFFSET(_gloffset_TexCoord1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetError)) -GL_PREFIX(GetError): +GLOBL_FN(GL_PREFIX(TexCoord1fv)) +GL_PREFIX(TexCoord1fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetError)) - JMP(GL_OFFSET(_gloffset_GetError)) + JZ(GLNAME(_glapi_fallback_TexCoord1fv)) + JMP(GL_OFFSET(_gloffset_TexCoord1fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetFloatv)) -GL_PREFIX(GetFloatv): +GLOBL_FN(GL_PREFIX(TexCoord1i)) +GL_PREFIX(TexCoord1i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetFloatv)) - JMP(GL_OFFSET(_gloffset_GetFloatv)) + JZ(GLNAME(_glapi_fallback_TexCoord1i)) + JMP(GL_OFFSET(_gloffset_TexCoord1i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetIntegerv)) -GL_PREFIX(GetIntegerv): +GLOBL_FN(GL_PREFIX(TexCoord1iv)) +GL_PREFIX(TexCoord1iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetIntegerv)) - JMP(GL_OFFSET(_gloffset_GetIntegerv)) + JZ(GLNAME(_glapi_fallback_TexCoord1iv)) + JMP(GL_OFFSET(_gloffset_TexCoord1iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetLightfv)) -GL_PREFIX(GetLightfv): +GLOBL_FN(GL_PREFIX(TexCoord1s)) +GL_PREFIX(TexCoord1s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetLightfv)) - JMP(GL_OFFSET(_gloffset_GetLightfv)) + JZ(GLNAME(_glapi_fallback_TexCoord1s)) + JMP(GL_OFFSET(_gloffset_TexCoord1s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetLightiv)) -GL_PREFIX(GetLightiv): +GLOBL_FN(GL_PREFIX(TexCoord1sv)) +GL_PREFIX(TexCoord1sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetLightiv)) - JMP(GL_OFFSET(_gloffset_GetLightiv)) + JZ(GLNAME(_glapi_fallback_TexCoord1sv)) + JMP(GL_OFFSET(_gloffset_TexCoord1sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMapdv)) -GL_PREFIX(GetMapdv): +GLOBL_FN(GL_PREFIX(TexCoord2d)) +GL_PREFIX(TexCoord2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMapdv)) - JMP(GL_OFFSET(_gloffset_GetMapdv)) + JZ(GLNAME(_glapi_fallback_TexCoord2d)) + JMP(GL_OFFSET(_gloffset_TexCoord2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMapfv)) -GL_PREFIX(GetMapfv): +GLOBL_FN(GL_PREFIX(TexCoord2dv)) +GL_PREFIX(TexCoord2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMapfv)) - JMP(GL_OFFSET(_gloffset_GetMapfv)) + JZ(GLNAME(_glapi_fallback_TexCoord2dv)) + JMP(GL_OFFSET(_gloffset_TexCoord2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMapiv)) -GL_PREFIX(GetMapiv): +GLOBL_FN(GL_PREFIX(TexCoord2f)) +GL_PREFIX(TexCoord2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMapiv)) - JMP(GL_OFFSET(_gloffset_GetMapiv)) + JZ(GLNAME(_glapi_fallback_TexCoord2f)) + JMP(GL_OFFSET(_gloffset_TexCoord2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMaterialfv)) -GL_PREFIX(GetMaterialfv): +GLOBL_FN(GL_PREFIX(TexCoord2fv)) +GL_PREFIX(TexCoord2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMaterialfv)) - JMP(GL_OFFSET(_gloffset_GetMaterialfv)) + JZ(GLNAME(_glapi_fallback_TexCoord2fv)) + JMP(GL_OFFSET(_gloffset_TexCoord2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetMaterialiv)) -GL_PREFIX(GetMaterialiv): +GLOBL_FN(GL_PREFIX(TexCoord2i)) +GL_PREFIX(TexCoord2i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetMaterialiv)) - JMP(GL_OFFSET(_gloffset_GetMaterialiv)) + JZ(GLNAME(_glapi_fallback_TexCoord2i)) + JMP(GL_OFFSET(_gloffset_TexCoord2i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelMapfv)) -GL_PREFIX(GetPixelMapfv): +GLOBL_FN(GL_PREFIX(TexCoord2iv)) +GL_PREFIX(TexCoord2iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelMapfv)) - JMP(GL_OFFSET(_gloffset_GetPixelMapfv)) + JZ(GLNAME(_glapi_fallback_TexCoord2iv)) + JMP(GL_OFFSET(_gloffset_TexCoord2iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelMapuiv)) -GL_PREFIX(GetPixelMapuiv): +GLOBL_FN(GL_PREFIX(TexCoord2s)) +GL_PREFIX(TexCoord2s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelMapuiv)) - JMP(GL_OFFSET(_gloffset_GetPixelMapuiv)) + JZ(GLNAME(_glapi_fallback_TexCoord2s)) + JMP(GL_OFFSET(_gloffset_TexCoord2s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelMapusv)) -GL_PREFIX(GetPixelMapusv): +GLOBL_FN(GL_PREFIX(TexCoord2sv)) +GL_PREFIX(TexCoord2sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelMapusv)) - JMP(GL_OFFSET(_gloffset_GetPixelMapusv)) + JZ(GLNAME(_glapi_fallback_TexCoord2sv)) + JMP(GL_OFFSET(_gloffset_TexCoord2sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPolygonStipple)) -GL_PREFIX(GetPolygonStipple): +GLOBL_FN(GL_PREFIX(TexCoord3d)) +GL_PREFIX(TexCoord3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPolygonStipple)) - JMP(GL_OFFSET(_gloffset_GetPolygonStipple)) + JZ(GLNAME(_glapi_fallback_TexCoord3d)) + JMP(GL_OFFSET(_gloffset_TexCoord3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetString)) -GL_PREFIX(GetString): +GLOBL_FN(GL_PREFIX(TexCoord3dv)) +GL_PREFIX(TexCoord3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetString)) - JMP(GL_OFFSET(_gloffset_GetString)) + JZ(GLNAME(_glapi_fallback_TexCoord3dv)) + JMP(GL_OFFSET(_gloffset_TexCoord3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexEnvfv)) -GL_PREFIX(GetTexEnvfv): +GLOBL_FN(GL_PREFIX(TexCoord3f)) +GL_PREFIX(TexCoord3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexEnvfv)) - JMP(GL_OFFSET(_gloffset_GetTexEnvfv)) + JZ(GLNAME(_glapi_fallback_TexCoord3f)) + JMP(GL_OFFSET(_gloffset_TexCoord3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexEnviv)) -GL_PREFIX(GetTexEnviv): +GLOBL_FN(GL_PREFIX(TexCoord3fv)) +GL_PREFIX(TexCoord3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexEnviv)) - JMP(GL_OFFSET(_gloffset_GetTexEnviv)) + JZ(GLNAME(_glapi_fallback_TexCoord3fv)) + JMP(GL_OFFSET(_gloffset_TexCoord3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexGeniv)) -GL_PREFIX(GetTexGeniv): +GLOBL_FN(GL_PREFIX(TexCoord3i)) +GL_PREFIX(TexCoord3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexGeniv)) - JMP(GL_OFFSET(_gloffset_GetTexGeniv)) + JZ(GLNAME(_glapi_fallback_TexCoord3i)) + JMP(GL_OFFSET(_gloffset_TexCoord3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexGendv)) -GL_PREFIX(GetTexGendv): +GLOBL_FN(GL_PREFIX(TexCoord3iv)) +GL_PREFIX(TexCoord3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexGendv)) - JMP(GL_OFFSET(_gloffset_GetTexGendv)) + JZ(GLNAME(_glapi_fallback_TexCoord3iv)) + JMP(GL_OFFSET(_gloffset_TexCoord3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexGenfv)) -GL_PREFIX(GetTexGenfv): +GLOBL_FN(GL_PREFIX(TexCoord3s)) +GL_PREFIX(TexCoord3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexGenfv)) - JMP(GL_OFFSET(_gloffset_GetTexGenfv)) + JZ(GLNAME(_glapi_fallback_TexCoord3s)) + JMP(GL_OFFSET(_gloffset_TexCoord3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexImage)) -GL_PREFIX(GetTexImage): +GLOBL_FN(GL_PREFIX(TexCoord3sv)) +GL_PREFIX(TexCoord3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexImage)) - JMP(GL_OFFSET(_gloffset_GetTexImage)) + JZ(GLNAME(_glapi_fallback_TexCoord3sv)) + JMP(GL_OFFSET(_gloffset_TexCoord3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexLevelParameterfv)) -GL_PREFIX(GetTexLevelParameterfv): +GLOBL_FN(GL_PREFIX(TexCoord4d)) +GL_PREFIX(TexCoord4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexLevelParameterfv)) - JMP(GL_OFFSET(_gloffset_GetTexLevelParameterfv)) + JZ(GLNAME(_glapi_fallback_TexCoord4d)) + JMP(GL_OFFSET(_gloffset_TexCoord4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexLevelParameteriv)) -GL_PREFIX(GetTexLevelParameteriv): +GLOBL_FN(GL_PREFIX(TexCoord4dv)) +GL_PREFIX(TexCoord4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexLevelParameteriv)) - JMP(GL_OFFSET(_gloffset_GetTexLevelParameteriv)) + JZ(GLNAME(_glapi_fallback_TexCoord4dv)) + JMP(GL_OFFSET(_gloffset_TexCoord4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexParameterfv)) -GL_PREFIX(GetTexParameterfv): +GLOBL_FN(GL_PREFIX(TexCoord4f)) +GL_PREFIX(TexCoord4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexParameterfv)) - JMP(GL_OFFSET(_gloffset_GetTexParameterfv)) + JZ(GLNAME(_glapi_fallback_TexCoord4f)) + JMP(GL_OFFSET(_gloffset_TexCoord4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetTexParameteriv)) -GL_PREFIX(GetTexParameteriv): +GLOBL_FN(GL_PREFIX(TexCoord4fv)) +GL_PREFIX(TexCoord4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetTexParameteriv)) - JMP(GL_OFFSET(_gloffset_GetTexParameteriv)) + JZ(GLNAME(_glapi_fallback_TexCoord4fv)) + JMP(GL_OFFSET(_gloffset_TexCoord4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Hint)) -GL_PREFIX(Hint): +GLOBL_FN(GL_PREFIX(TexCoord4i)) +GL_PREFIX(TexCoord4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Hint)) - JMP(GL_OFFSET(_gloffset_Hint)) + JZ(GLNAME(_glapi_fallback_TexCoord4i)) + JMP(GL_OFFSET(_gloffset_TexCoord4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexd)) -GL_PREFIX(Indexd): +GLOBL_FN(GL_PREFIX(TexCoord4iv)) +GL_PREFIX(TexCoord4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexd)) - JMP(GL_OFFSET(_gloffset_Indexd)) + JZ(GLNAME(_glapi_fallback_TexCoord4iv)) + JMP(GL_OFFSET(_gloffset_TexCoord4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexdv)) -GL_PREFIX(Indexdv): +GLOBL_FN(GL_PREFIX(TexCoord4s)) +GL_PREFIX(TexCoord4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexdv)) - JMP(GL_OFFSET(_gloffset_Indexdv)) + JZ(GLNAME(_glapi_fallback_TexCoord4s)) + JMP(GL_OFFSET(_gloffset_TexCoord4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexf)) -GL_PREFIX(Indexf): +GLOBL_FN(GL_PREFIX(TexCoord4sv)) +GL_PREFIX(TexCoord4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexf)) - JMP(GL_OFFSET(_gloffset_Indexf)) + JZ(GLNAME(_glapi_fallback_TexCoord4sv)) + JMP(GL_OFFSET(_gloffset_TexCoord4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexfv)) -GL_PREFIX(Indexfv): +GLOBL_FN(GL_PREFIX(Vertex2d)) +GL_PREFIX(Vertex2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexfv)) - JMP(GL_OFFSET(_gloffset_Indexfv)) + JZ(GLNAME(_glapi_fallback_Vertex2d)) + JMP(GL_OFFSET(_gloffset_Vertex2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexi)) -GL_PREFIX(Indexi): +GLOBL_FN(GL_PREFIX(Vertex2dv)) +GL_PREFIX(Vertex2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexi)) - JMP(GL_OFFSET(_gloffset_Indexi)) + JZ(GLNAME(_glapi_fallback_Vertex2dv)) + JMP(GL_OFFSET(_gloffset_Vertex2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexiv)) -GL_PREFIX(Indexiv): +GLOBL_FN(GL_PREFIX(Vertex2f)) +GL_PREFIX(Vertex2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexiv)) - JMP(GL_OFFSET(_gloffset_Indexiv)) + JZ(GLNAME(_glapi_fallback_Vertex2f)) + JMP(GL_OFFSET(_gloffset_Vertex2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexs)) -GL_PREFIX(Indexs): +GLOBL_FN(GL_PREFIX(Vertex2fv)) +GL_PREFIX(Vertex2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexs)) - JMP(GL_OFFSET(_gloffset_Indexs)) + JZ(GLNAME(_glapi_fallback_Vertex2fv)) + JMP(GL_OFFSET(_gloffset_Vertex2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Indexsv)) -GL_PREFIX(Indexsv): +GLOBL_FN(GL_PREFIX(Vertex2i)) +GL_PREFIX(Vertex2i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Indexsv)) - JMP(GL_OFFSET(_gloffset_Indexsv)) + JZ(GLNAME(_glapi_fallback_Vertex2i)) + JMP(GL_OFFSET(_gloffset_Vertex2i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexMask)) -GL_PREFIX(IndexMask): +GLOBL_FN(GL_PREFIX(Vertex2iv)) +GL_PREFIX(Vertex2iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IndexMask)) - JMP(GL_OFFSET(_gloffset_IndexMask)) + JZ(GLNAME(_glapi_fallback_Vertex2iv)) + JMP(GL_OFFSET(_gloffset_Vertex2iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(InitNames)) -GL_PREFIX(InitNames): +GLOBL_FN(GL_PREFIX(Vertex2s)) +GL_PREFIX(Vertex2s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_InitNames)) - JMP(GL_OFFSET(_gloffset_InitNames)) + JZ(GLNAME(_glapi_fallback_Vertex2s)) + JMP(GL_OFFSET(_gloffset_Vertex2s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsEnabled)) -GL_PREFIX(IsEnabled): +GLOBL_FN(GL_PREFIX(Vertex2sv)) +GL_PREFIX(Vertex2sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsEnabled)) - JMP(GL_OFFSET(_gloffset_IsEnabled)) + JZ(GLNAME(_glapi_fallback_Vertex2sv)) + JMP(GL_OFFSET(_gloffset_Vertex2sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsList)) -GL_PREFIX(IsList): +GLOBL_FN(GL_PREFIX(Vertex3d)) +GL_PREFIX(Vertex3d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsList)) - JMP(GL_OFFSET(_gloffset_IsList)) + JZ(GLNAME(_glapi_fallback_Vertex3d)) + JMP(GL_OFFSET(_gloffset_Vertex3d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lightf)) -GL_PREFIX(Lightf): +GLOBL_FN(GL_PREFIX(Vertex3dv)) +GL_PREFIX(Vertex3dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lightf)) - JMP(GL_OFFSET(_gloffset_Lightf)) + JZ(GLNAME(_glapi_fallback_Vertex3dv)) + JMP(GL_OFFSET(_gloffset_Vertex3dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lighti)) -GL_PREFIX(Lighti): +GLOBL_FN(GL_PREFIX(Vertex3f)) +GL_PREFIX(Vertex3f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lighti)) - JMP(GL_OFFSET(_gloffset_Lighti)) + JZ(GLNAME(_glapi_fallback_Vertex3f)) + JMP(GL_OFFSET(_gloffset_Vertex3f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lightfv)) -GL_PREFIX(Lightfv): +GLOBL_FN(GL_PREFIX(Vertex3fv)) +GL_PREFIX(Vertex3fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lightfv)) - JMP(GL_OFFSET(_gloffset_Lightfv)) + JZ(GLNAME(_glapi_fallback_Vertex3fv)) + JMP(GL_OFFSET(_gloffset_Vertex3fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Lightiv)) -GL_PREFIX(Lightiv): +GLOBL_FN(GL_PREFIX(Vertex3i)) +GL_PREFIX(Vertex3i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Lightiv)) - JMP(GL_OFFSET(_gloffset_Lightiv)) + JZ(GLNAME(_glapi_fallback_Vertex3i)) + JMP(GL_OFFSET(_gloffset_Vertex3i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModelf)) -GL_PREFIX(LightModelf): +GLOBL_FN(GL_PREFIX(Vertex3iv)) +GL_PREFIX(Vertex3iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModelf)) - JMP(GL_OFFSET(_gloffset_LightModelf)) + JZ(GLNAME(_glapi_fallback_Vertex3iv)) + JMP(GL_OFFSET(_gloffset_Vertex3iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModeli)) -GL_PREFIX(LightModeli): +GLOBL_FN(GL_PREFIX(Vertex3s)) +GL_PREFIX(Vertex3s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModeli)) - JMP(GL_OFFSET(_gloffset_LightModeli)) + JZ(GLNAME(_glapi_fallback_Vertex3s)) + JMP(GL_OFFSET(_gloffset_Vertex3s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModelfv)) -GL_PREFIX(LightModelfv): +GLOBL_FN(GL_PREFIX(Vertex3sv)) +GL_PREFIX(Vertex3sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModelfv)) - JMP(GL_OFFSET(_gloffset_LightModelfv)) + JZ(GLNAME(_glapi_fallback_Vertex3sv)) + JMP(GL_OFFSET(_gloffset_Vertex3sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LightModeliv)) -GL_PREFIX(LightModeliv): +GLOBL_FN(GL_PREFIX(Vertex4d)) +GL_PREFIX(Vertex4d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LightModeliv)) - JMP(GL_OFFSET(_gloffset_LightModeliv)) + JZ(GLNAME(_glapi_fallback_Vertex4d)) + JMP(GL_OFFSET(_gloffset_Vertex4d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LineWidth)) -GL_PREFIX(LineWidth): +GLOBL_FN(GL_PREFIX(Vertex4dv)) +GL_PREFIX(Vertex4dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LineWidth)) - JMP(GL_OFFSET(_gloffset_LineWidth)) + JZ(GLNAME(_glapi_fallback_Vertex4dv)) + JMP(GL_OFFSET(_gloffset_Vertex4dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LineStipple)) -GL_PREFIX(LineStipple): +GLOBL_FN(GL_PREFIX(Vertex4f)) +GL_PREFIX(Vertex4f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LineStipple)) - JMP(GL_OFFSET(_gloffset_LineStipple)) + JZ(GLNAME(_glapi_fallback_Vertex4f)) + JMP(GL_OFFSET(_gloffset_Vertex4f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ListBase)) -GL_PREFIX(ListBase): +GLOBL_FN(GL_PREFIX(Vertex4fv)) +GL_PREFIX(Vertex4fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ListBase)) - JMP(GL_OFFSET(_gloffset_ListBase)) + JZ(GLNAME(_glapi_fallback_Vertex4fv)) + JMP(GL_OFFSET(_gloffset_Vertex4fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadIdentity)) -GL_PREFIX(LoadIdentity): +GLOBL_FN(GL_PREFIX(Vertex4i)) +GL_PREFIX(Vertex4i): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadIdentity)) - JMP(GL_OFFSET(_gloffset_LoadIdentity)) + JZ(GLNAME(_glapi_fallback_Vertex4i)) + JMP(GL_OFFSET(_gloffset_Vertex4i)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadMatrixd)) -GL_PREFIX(LoadMatrixd): +GLOBL_FN(GL_PREFIX(Vertex4iv)) +GL_PREFIX(Vertex4iv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadMatrixd)) - JMP(GL_OFFSET(_gloffset_LoadMatrixd)) + JZ(GLNAME(_glapi_fallback_Vertex4iv)) + JMP(GL_OFFSET(_gloffset_Vertex4iv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadMatrixf)) -GL_PREFIX(LoadMatrixf): +GLOBL_FN(GL_PREFIX(Vertex4s)) +GL_PREFIX(Vertex4s): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadMatrixf)) - JMP(GL_OFFSET(_gloffset_LoadMatrixf)) + JZ(GLNAME(_glapi_fallback_Vertex4s)) + JMP(GL_OFFSET(_gloffset_Vertex4s)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadName)) -GL_PREFIX(LoadName): +GLOBL_FN(GL_PREFIX(Vertex4sv)) +GL_PREFIX(Vertex4sv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadName)) - JMP(GL_OFFSET(_gloffset_LoadName)) + JZ(GLNAME(_glapi_fallback_Vertex4sv)) + JMP(GL_OFFSET(_gloffset_Vertex4sv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LogicOp)) -GL_PREFIX(LogicOp): +GLOBL_FN(GL_PREFIX(ClipPlane)) +GL_PREFIX(ClipPlane): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LogicOp)) - JMP(GL_OFFSET(_gloffset_LogicOp)) + JZ(GLNAME(_glapi_fallback_ClipPlane)) + JMP(GL_OFFSET(_gloffset_ClipPlane)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map1d)) -GL_PREFIX(Map1d): +GLOBL_FN(GL_PREFIX(ColorMaterial)) +GL_PREFIX(ColorMaterial): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map1d)) - JMP(GL_OFFSET(_gloffset_Map1d)) + JZ(GLNAME(_glapi_fallback_ColorMaterial)) + JMP(GL_OFFSET(_gloffset_ColorMaterial)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map1f)) -GL_PREFIX(Map1f): +GLOBL_FN(GL_PREFIX(CullFace)) +GL_PREFIX(CullFace): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map1f)) - JMP(GL_OFFSET(_gloffset_Map1f)) + JZ(GLNAME(_glapi_fallback_CullFace)) + JMP(GL_OFFSET(_gloffset_CullFace)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map2d)) -GL_PREFIX(Map2d): +GLOBL_FN(GL_PREFIX(Fogf)) +GL_PREFIX(Fogf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map2d)) - JMP(GL_OFFSET(_gloffset_Map2d)) + JZ(GLNAME(_glapi_fallback_Fogf)) + JMP(GL_OFFSET(_gloffset_Fogf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Map2f)) -GL_PREFIX(Map2f): +GLOBL_FN(GL_PREFIX(Fogfv)) +GL_PREFIX(Fogfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Map2f)) - JMP(GL_OFFSET(_gloffset_Map2f)) + JZ(GLNAME(_glapi_fallback_Fogfv)) + JMP(GL_OFFSET(_gloffset_Fogfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid1d)) -GL_PREFIX(MapGrid1d): +GLOBL_FN(GL_PREFIX(Fogi)) +GL_PREFIX(Fogi): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid1d)) - JMP(GL_OFFSET(_gloffset_MapGrid1d)) + JZ(GLNAME(_glapi_fallback_Fogi)) + JMP(GL_OFFSET(_gloffset_Fogi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid1f)) -GL_PREFIX(MapGrid1f): +GLOBL_FN(GL_PREFIX(Fogiv)) +GL_PREFIX(Fogiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid1f)) - JMP(GL_OFFSET(_gloffset_MapGrid1f)) + JZ(GLNAME(_glapi_fallback_Fogiv)) + JMP(GL_OFFSET(_gloffset_Fogiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid2d)) -GL_PREFIX(MapGrid2d): +GLOBL_FN(GL_PREFIX(FrontFace)) +GL_PREFIX(FrontFace): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid2d)) - JMP(GL_OFFSET(_gloffset_MapGrid2d)) + JZ(GLNAME(_glapi_fallback_FrontFace)) + JMP(GL_OFFSET(_gloffset_FrontFace)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MapGrid2f)) -GL_PREFIX(MapGrid2f): +GLOBL_FN(GL_PREFIX(Hint)) +GL_PREFIX(Hint): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MapGrid2f)) - JMP(GL_OFFSET(_gloffset_MapGrid2f)) + JZ(GLNAME(_glapi_fallback_Hint)) + JMP(GL_OFFSET(_gloffset_Hint)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materialf)) -GL_PREFIX(Materialf): +GLOBL_FN(GL_PREFIX(Lightf)) +GL_PREFIX(Lightf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materialf)) - JMP(GL_OFFSET(_gloffset_Materialf)) + JZ(GLNAME(_glapi_fallback_Lightf)) + JMP(GL_OFFSET(_gloffset_Lightf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materiali)) -GL_PREFIX(Materiali): +GLOBL_FN(GL_PREFIX(Lightfv)) +GL_PREFIX(Lightfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materiali)) - JMP(GL_OFFSET(_gloffset_Materiali)) + JZ(GLNAME(_glapi_fallback_Lightfv)) + JMP(GL_OFFSET(_gloffset_Lightfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materialfv)) -GL_PREFIX(Materialfv): +GLOBL_FN(GL_PREFIX(Lighti)) +GL_PREFIX(Lighti): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materialfv)) - JMP(GL_OFFSET(_gloffset_Materialfv)) + JZ(GLNAME(_glapi_fallback_Lighti)) + JMP(GL_OFFSET(_gloffset_Lighti)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Materialiv)) -GL_PREFIX(Materialiv): +GLOBL_FN(GL_PREFIX(Lightiv)) +GL_PREFIX(Lightiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Materialiv)) - JMP(GL_OFFSET(_gloffset_Materialiv)) + JZ(GLNAME(_glapi_fallback_Lightiv)) + JMP(GL_OFFSET(_gloffset_Lightiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MatrixMode)) -GL_PREFIX(MatrixMode): +GLOBL_FN(GL_PREFIX(LightModelf)) +GL_PREFIX(LightModelf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MatrixMode)) - JMP(GL_OFFSET(_gloffset_MatrixMode)) + JZ(GLNAME(_glapi_fallback_LightModelf)) + JMP(GL_OFFSET(_gloffset_LightModelf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultMatrixd)) -GL_PREFIX(MultMatrixd): +GLOBL_FN(GL_PREFIX(LightModelfv)) +GL_PREFIX(LightModelfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultMatrixd)) - JMP(GL_OFFSET(_gloffset_MultMatrixd)) + JZ(GLNAME(_glapi_fallback_LightModelfv)) + JMP(GL_OFFSET(_gloffset_LightModelfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultMatrixf)) -GL_PREFIX(MultMatrixf): +GLOBL_FN(GL_PREFIX(LightModeli)) +GL_PREFIX(LightModeli): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultMatrixf)) - JMP(GL_OFFSET(_gloffset_MultMatrixf)) + JZ(GLNAME(_glapi_fallback_LightModeli)) + JMP(GL_OFFSET(_gloffset_LightModeli)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(NewList)) -GL_PREFIX(NewList): +GLOBL_FN(GL_PREFIX(LightModeliv)) +GL_PREFIX(LightModeliv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_NewList)) - JMP(GL_OFFSET(_gloffset_NewList)) + JZ(GLNAME(_glapi_fallback_LightModeliv)) + JMP(GL_OFFSET(_gloffset_LightModeliv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3b)) -GL_PREFIX(Normal3b): +GLOBL_FN(GL_PREFIX(LineStipple)) +GL_PREFIX(LineStipple): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3b)) - JMP(GL_OFFSET(_gloffset_Normal3b)) + JZ(GLNAME(_glapi_fallback_LineStipple)) + JMP(GL_OFFSET(_gloffset_LineStipple)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3bv)) -GL_PREFIX(Normal3bv): +GLOBL_FN(GL_PREFIX(LineWidth)) +GL_PREFIX(LineWidth): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3bv)) - JMP(GL_OFFSET(_gloffset_Normal3bv)) + JZ(GLNAME(_glapi_fallback_LineWidth)) + JMP(GL_OFFSET(_gloffset_LineWidth)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3d)) -GL_PREFIX(Normal3d): +GLOBL_FN(GL_PREFIX(Materialf)) +GL_PREFIX(Materialf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3d)) - JMP(GL_OFFSET(_gloffset_Normal3d)) + JZ(GLNAME(_glapi_fallback_Materialf)) + JMP(GL_OFFSET(_gloffset_Materialf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3dv)) -GL_PREFIX(Normal3dv): +GLOBL_FN(GL_PREFIX(Materialfv)) +GL_PREFIX(Materialfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3dv)) - JMP(GL_OFFSET(_gloffset_Normal3dv)) + JZ(GLNAME(_glapi_fallback_Materialfv)) + JMP(GL_OFFSET(_gloffset_Materialfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3f)) -GL_PREFIX(Normal3f): +GLOBL_FN(GL_PREFIX(Materiali)) +GL_PREFIX(Materiali): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3f)) - JMP(GL_OFFSET(_gloffset_Normal3f)) + JZ(GLNAME(_glapi_fallback_Materiali)) + JMP(GL_OFFSET(_gloffset_Materiali)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3fv)) -GL_PREFIX(Normal3fv): +GLOBL_FN(GL_PREFIX(Materialiv)) +GL_PREFIX(Materialiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3fv)) - JMP(GL_OFFSET(_gloffset_Normal3fv)) + JZ(GLNAME(_glapi_fallback_Materialiv)) + JMP(GL_OFFSET(_gloffset_Materialiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3i)) -GL_PREFIX(Normal3i): +GLOBL_FN(GL_PREFIX(PointSize)) +GL_PREFIX(PointSize): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3i)) - JMP(GL_OFFSET(_gloffset_Normal3i)) + JZ(GLNAME(_glapi_fallback_PointSize)) + JMP(GL_OFFSET(_gloffset_PointSize)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3iv)) -GL_PREFIX(Normal3iv): +GLOBL_FN(GL_PREFIX(PolygonMode)) +GL_PREFIX(PolygonMode): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3iv)) - JMP(GL_OFFSET(_gloffset_Normal3iv)) + JZ(GLNAME(_glapi_fallback_PolygonMode)) + JMP(GL_OFFSET(_gloffset_PolygonMode)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3s)) -GL_PREFIX(Normal3s): +GLOBL_FN(GL_PREFIX(PolygonStipple)) +GL_PREFIX(PolygonStipple): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3s)) - JMP(GL_OFFSET(_gloffset_Normal3s)) + JZ(GLNAME(_glapi_fallback_PolygonStipple)) + JMP(GL_OFFSET(_gloffset_PolygonStipple)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Normal3sv)) -GL_PREFIX(Normal3sv): +GLOBL_FN(GL_PREFIX(Scissor)) +GL_PREFIX(Scissor): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Normal3sv)) - JMP(GL_OFFSET(_gloffset_Normal3sv)) + JZ(GLNAME(_glapi_fallback_Scissor)) + JMP(GL_OFFSET(_gloffset_Scissor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Ortho)) -GL_PREFIX(Ortho): +GLOBL_FN(GL_PREFIX(ShadeModel)) +GL_PREFIX(ShadeModel): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Ortho)) - JMP(GL_OFFSET(_gloffset_Ortho)) + JZ(GLNAME(_glapi_fallback_ShadeModel)) + JMP(GL_OFFSET(_gloffset_ShadeModel)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PassThrough)) -GL_PREFIX(PassThrough): +GLOBL_FN(GL_PREFIX(TexParameterf)) +GL_PREFIX(TexParameterf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PassThrough)) - JMP(GL_OFFSET(_gloffset_PassThrough)) + JZ(GLNAME(_glapi_fallback_TexParameterf)) + JMP(GL_OFFSET(_gloffset_TexParameterf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelMapfv)) -GL_PREFIX(PixelMapfv): +GLOBL_FN(GL_PREFIX(TexParameterfv)) +GL_PREFIX(TexParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelMapfv)) - JMP(GL_OFFSET(_gloffset_PixelMapfv)) + JZ(GLNAME(_glapi_fallback_TexParameterfv)) + JMP(GL_OFFSET(_gloffset_TexParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelMapuiv)) -GL_PREFIX(PixelMapuiv): +GLOBL_FN(GL_PREFIX(TexParameteri)) +GL_PREFIX(TexParameteri): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelMapuiv)) - JMP(GL_OFFSET(_gloffset_PixelMapuiv)) + JZ(GLNAME(_glapi_fallback_TexParameteri)) + JMP(GL_OFFSET(_gloffset_TexParameteri)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelMapusv)) -GL_PREFIX(PixelMapusv): +GLOBL_FN(GL_PREFIX(TexParameteriv)) +GL_PREFIX(TexParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelMapusv)) - JMP(GL_OFFSET(_gloffset_PixelMapusv)) + JZ(GLNAME(_glapi_fallback_TexParameteriv)) + JMP(GL_OFFSET(_gloffset_TexParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelStoref)) -GL_PREFIX(PixelStoref): +GLOBL_FN(GL_PREFIX(TexImage1D)) +GL_PREFIX(TexImage1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelStoref)) - JMP(GL_OFFSET(_gloffset_PixelStoref)) + JZ(GLNAME(_glapi_fallback_TexImage1D)) + JMP(GL_OFFSET(_gloffset_TexImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelStorei)) -GL_PREFIX(PixelStorei): +GLOBL_FN(GL_PREFIX(TexImage2D)) +GL_PREFIX(TexImage2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelStorei)) - JMP(GL_OFFSET(_gloffset_PixelStorei)) + JZ(GLNAME(_glapi_fallback_TexImage2D)) + JMP(GL_OFFSET(_gloffset_TexImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTransferf)) -GL_PREFIX(PixelTransferf): +GLOBL_FN(GL_PREFIX(TexEnvf)) +GL_PREFIX(TexEnvf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTransferf)) - JMP(GL_OFFSET(_gloffset_PixelTransferf)) + JZ(GLNAME(_glapi_fallback_TexEnvf)) + JMP(GL_OFFSET(_gloffset_TexEnvf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTransferi)) -GL_PREFIX(PixelTransferi): +GLOBL_FN(GL_PREFIX(TexEnvfv)) +GL_PREFIX(TexEnvfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTransferi)) - JMP(GL_OFFSET(_gloffset_PixelTransferi)) + JZ(GLNAME(_glapi_fallback_TexEnvfv)) + JMP(GL_OFFSET(_gloffset_TexEnvfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelZoom)) -GL_PREFIX(PixelZoom): +GLOBL_FN(GL_PREFIX(TexEnvi)) +GL_PREFIX(TexEnvi): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelZoom)) - JMP(GL_OFFSET(_gloffset_PixelZoom)) + JZ(GLNAME(_glapi_fallback_TexEnvi)) + JMP(GL_OFFSET(_gloffset_TexEnvi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointSize)) -GL_PREFIX(PointSize): +GLOBL_FN(GL_PREFIX(TexEnviv)) +GL_PREFIX(TexEnviv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointSize)) - JMP(GL_OFFSET(_gloffset_PointSize)) + JZ(GLNAME(_glapi_fallback_TexEnviv)) + JMP(GL_OFFSET(_gloffset_TexEnviv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonMode)) -GL_PREFIX(PolygonMode): +GLOBL_FN(GL_PREFIX(TexGend)) +GL_PREFIX(TexGend): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonMode)) - JMP(GL_OFFSET(_gloffset_PolygonMode)) + JZ(GLNAME(_glapi_fallback_TexGend)) + JMP(GL_OFFSET(_gloffset_TexGend)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonStipple)) -GL_PREFIX(PolygonStipple): +GLOBL_FN(GL_PREFIX(TexGendv)) +GL_PREFIX(TexGendv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonStipple)) - JMP(GL_OFFSET(_gloffset_PolygonStipple)) + JZ(GLNAME(_glapi_fallback_TexGendv)) + JMP(GL_OFFSET(_gloffset_TexGendv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopAttrib)) -GL_PREFIX(PopAttrib): +GLOBL_FN(GL_PREFIX(TexGenf)) +GL_PREFIX(TexGenf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopAttrib)) - JMP(GL_OFFSET(_gloffset_PopAttrib)) + JZ(GLNAME(_glapi_fallback_TexGenf)) + JMP(GL_OFFSET(_gloffset_TexGenf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopMatrix)) -GL_PREFIX(PopMatrix): +GLOBL_FN(GL_PREFIX(TexGenfv)) +GL_PREFIX(TexGenfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopMatrix)) - JMP(GL_OFFSET(_gloffset_PopMatrix)) + JZ(GLNAME(_glapi_fallback_TexGenfv)) + JMP(GL_OFFSET(_gloffset_TexGenfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PopName)) -GL_PREFIX(PopName): +GLOBL_FN(GL_PREFIX(TexGeni)) +GL_PREFIX(TexGeni): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PopName)) - JMP(GL_OFFSET(_gloffset_PopName)) + JZ(GLNAME(_glapi_fallback_TexGeni)) + JMP(GL_OFFSET(_gloffset_TexGeni)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushAttrib)) -GL_PREFIX(PushAttrib): +GLOBL_FN(GL_PREFIX(TexGeniv)) +GL_PREFIX(TexGeniv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushAttrib)) - JMP(GL_OFFSET(_gloffset_PushAttrib)) + JZ(GLNAME(_glapi_fallback_TexGeniv)) + JMP(GL_OFFSET(_gloffset_TexGeniv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushMatrix)) -GL_PREFIX(PushMatrix): +GLOBL_FN(GL_PREFIX(FeedbackBuffer)) +GL_PREFIX(FeedbackBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushMatrix)) - JMP(GL_OFFSET(_gloffset_PushMatrix)) + JZ(GLNAME(_glapi_fallback_FeedbackBuffer)) + JMP(GL_OFFSET(_gloffset_FeedbackBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PushName)) -GL_PREFIX(PushName): +GLOBL_FN(GL_PREFIX(SelectBuffer)) +GL_PREFIX(SelectBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PushName)) - JMP(GL_OFFSET(_gloffset_PushName)) + JZ(GLNAME(_glapi_fallback_SelectBuffer)) + JMP(GL_OFFSET(_gloffset_SelectBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2d)) -GL_PREFIX(RasterPos2d): +GLOBL_FN(GL_PREFIX(RenderMode)) +GL_PREFIX(RenderMode): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2d)) - JMP(GL_OFFSET(_gloffset_RasterPos2d)) + JZ(GLNAME(_glapi_fallback_RenderMode)) + JMP(GL_OFFSET(_gloffset_RenderMode)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2f)) -GL_PREFIX(RasterPos2f): +GLOBL_FN(GL_PREFIX(InitNames)) +GL_PREFIX(InitNames): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2f)) - JMP(GL_OFFSET(_gloffset_RasterPos2f)) + JZ(GLNAME(_glapi_fallback_InitNames)) + JMP(GL_OFFSET(_gloffset_InitNames)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2i)) -GL_PREFIX(RasterPos2i): +GLOBL_FN(GL_PREFIX(LoadName)) +GL_PREFIX(LoadName): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2i)) - JMP(GL_OFFSET(_gloffset_RasterPos2i)) + JZ(GLNAME(_glapi_fallback_LoadName)) + JMP(GL_OFFSET(_gloffset_LoadName)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2s)) -GL_PREFIX(RasterPos2s): +GLOBL_FN(GL_PREFIX(PassThrough)) +GL_PREFIX(PassThrough): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2s)) - JMP(GL_OFFSET(_gloffset_RasterPos2s)) + JZ(GLNAME(_glapi_fallback_PassThrough)) + JMP(GL_OFFSET(_gloffset_PassThrough)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3d)) -GL_PREFIX(RasterPos3d): +GLOBL_FN(GL_PREFIX(PopName)) +GL_PREFIX(PopName): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3d)) - JMP(GL_OFFSET(_gloffset_RasterPos3d)) + JZ(GLNAME(_glapi_fallback_PopName)) + JMP(GL_OFFSET(_gloffset_PopName)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3f)) -GL_PREFIX(RasterPos3f): +GLOBL_FN(GL_PREFIX(PushName)) +GL_PREFIX(PushName): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3f)) - JMP(GL_OFFSET(_gloffset_RasterPos3f)) + JZ(GLNAME(_glapi_fallback_PushName)) + JMP(GL_OFFSET(_gloffset_PushName)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3i)) -GL_PREFIX(RasterPos3i): +GLOBL_FN(GL_PREFIX(DrawBuffer)) +GL_PREFIX(DrawBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3i)) - JMP(GL_OFFSET(_gloffset_RasterPos3i)) + JZ(GLNAME(_glapi_fallback_DrawBuffer)) + JMP(GL_OFFSET(_gloffset_DrawBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3s)) -GL_PREFIX(RasterPos3s): +GLOBL_FN(GL_PREFIX(Clear)) +GL_PREFIX(Clear): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3s)) - JMP(GL_OFFSET(_gloffset_RasterPos3s)) + JZ(GLNAME(_glapi_fallback_Clear)) + JMP(GL_OFFSET(_gloffset_Clear)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4d)) -GL_PREFIX(RasterPos4d): +GLOBL_FN(GL_PREFIX(ClearAccum)) +GL_PREFIX(ClearAccum): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4d)) - JMP(GL_OFFSET(_gloffset_RasterPos4d)) + JZ(GLNAME(_glapi_fallback_ClearAccum)) + JMP(GL_OFFSET(_gloffset_ClearAccum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4f)) -GL_PREFIX(RasterPos4f): +GLOBL_FN(GL_PREFIX(ClearIndex)) +GL_PREFIX(ClearIndex): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4f)) - JMP(GL_OFFSET(_gloffset_RasterPos4f)) + JZ(GLNAME(_glapi_fallback_ClearIndex)) + JMP(GL_OFFSET(_gloffset_ClearIndex)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4i)) -GL_PREFIX(RasterPos4i): +GLOBL_FN(GL_PREFIX(ClearColor)) +GL_PREFIX(ClearColor): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4i)) - JMP(GL_OFFSET(_gloffset_RasterPos4i)) + JZ(GLNAME(_glapi_fallback_ClearColor)) + JMP(GL_OFFSET(_gloffset_ClearColor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4s)) -GL_PREFIX(RasterPos4s): +GLOBL_FN(GL_PREFIX(ClearStencil)) +GL_PREFIX(ClearStencil): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4s)) - JMP(GL_OFFSET(_gloffset_RasterPos4s)) + JZ(GLNAME(_glapi_fallback_ClearStencil)) + JMP(GL_OFFSET(_gloffset_ClearStencil)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2dv)) -GL_PREFIX(RasterPos2dv): +GLOBL_FN(GL_PREFIX(ClearDepth)) +GL_PREFIX(ClearDepth): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2dv)) - JMP(GL_OFFSET(_gloffset_RasterPos2dv)) + JZ(GLNAME(_glapi_fallback_ClearDepth)) + JMP(GL_OFFSET(_gloffset_ClearDepth)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2fv)) -GL_PREFIX(RasterPos2fv): +GLOBL_FN(GL_PREFIX(StencilMask)) +GL_PREFIX(StencilMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2fv)) - JMP(GL_OFFSET(_gloffset_RasterPos2fv)) + JZ(GLNAME(_glapi_fallback_StencilMask)) + JMP(GL_OFFSET(_gloffset_StencilMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2iv)) -GL_PREFIX(RasterPos2iv): +GLOBL_FN(GL_PREFIX(ColorMask)) +GL_PREFIX(ColorMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2iv)) - JMP(GL_OFFSET(_gloffset_RasterPos2iv)) + JZ(GLNAME(_glapi_fallback_ColorMask)) + JMP(GL_OFFSET(_gloffset_ColorMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos2sv)) -GL_PREFIX(RasterPos2sv): +GLOBL_FN(GL_PREFIX(DepthMask)) +GL_PREFIX(DepthMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos2sv)) - JMP(GL_OFFSET(_gloffset_RasterPos2sv)) + JZ(GLNAME(_glapi_fallback_DepthMask)) + JMP(GL_OFFSET(_gloffset_DepthMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3dv)) -GL_PREFIX(RasterPos3dv): +GLOBL_FN(GL_PREFIX(IndexMask)) +GL_PREFIX(IndexMask): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3dv)) - JMP(GL_OFFSET(_gloffset_RasterPos3dv)) + JZ(GLNAME(_glapi_fallback_IndexMask)) + JMP(GL_OFFSET(_gloffset_IndexMask)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3fv)) -GL_PREFIX(RasterPos3fv): +GLOBL_FN(GL_PREFIX(Accum)) +GL_PREFIX(Accum): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3fv)) - JMP(GL_OFFSET(_gloffset_RasterPos3fv)) + JZ(GLNAME(_glapi_fallback_Accum)) + JMP(GL_OFFSET(_gloffset_Accum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3iv)) -GL_PREFIX(RasterPos3iv): +GLOBL_FN(GL_PREFIX(Disable)) +GL_PREFIX(Disable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3iv)) - JMP(GL_OFFSET(_gloffset_RasterPos3iv)) + JZ(GLNAME(_glapi_fallback_Disable)) + JMP(GL_OFFSET(_gloffset_Disable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos3sv)) -GL_PREFIX(RasterPos3sv): +GLOBL_FN(GL_PREFIX(Enable)) +GL_PREFIX(Enable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos3sv)) - JMP(GL_OFFSET(_gloffset_RasterPos3sv)) + JZ(GLNAME(_glapi_fallback_Enable)) + JMP(GL_OFFSET(_gloffset_Enable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4dv)) -GL_PREFIX(RasterPos4dv): +GLOBL_FN(GL_PREFIX(Finish)) +GL_PREFIX(Finish): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4dv)) - JMP(GL_OFFSET(_gloffset_RasterPos4dv)) + JZ(GLNAME(_glapi_fallback_Finish)) + JMP(GL_OFFSET(_gloffset_Finish)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4fv)) -GL_PREFIX(RasterPos4fv): +GLOBL_FN(GL_PREFIX(Flush)) +GL_PREFIX(Flush): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4fv)) - JMP(GL_OFFSET(_gloffset_RasterPos4fv)) + JZ(GLNAME(_glapi_fallback_Flush)) + JMP(GL_OFFSET(_gloffset_Flush)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4iv)) -GL_PREFIX(RasterPos4iv): +GLOBL_FN(GL_PREFIX(PopAttrib)) +GL_PREFIX(PopAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4iv)) - JMP(GL_OFFSET(_gloffset_RasterPos4iv)) + JZ(GLNAME(_glapi_fallback_PopAttrib)) + JMP(GL_OFFSET(_gloffset_PopAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RasterPos4sv)) -GL_PREFIX(RasterPos4sv): +GLOBL_FN(GL_PREFIX(PushAttrib)) +GL_PREFIX(PushAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RasterPos4sv)) - JMP(GL_OFFSET(_gloffset_RasterPos4sv)) + JZ(GLNAME(_glapi_fallback_PushAttrib)) + JMP(GL_OFFSET(_gloffset_PushAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ReadBuffer)) -GL_PREFIX(ReadBuffer): +GLOBL_FN(GL_PREFIX(Map1d)) +GL_PREFIX(Map1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ReadBuffer)) - JMP(GL_OFFSET(_gloffset_ReadBuffer)) + JZ(GLNAME(_glapi_fallback_Map1d)) + JMP(GL_OFFSET(_gloffset_Map1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ReadPixels)) -GL_PREFIX(ReadPixels): +GLOBL_FN(GL_PREFIX(Map1f)) +GL_PREFIX(Map1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ReadPixels)) - JMP(GL_OFFSET(_gloffset_ReadPixels)) + JZ(GLNAME(_glapi_fallback_Map1f)) + JMP(GL_OFFSET(_gloffset_Map1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectd)) -GL_PREFIX(Rectd): +GLOBL_FN(GL_PREFIX(Map2d)) +GL_PREFIX(Map2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectd)) - JMP(GL_OFFSET(_gloffset_Rectd)) + JZ(GLNAME(_glapi_fallback_Map2d)) + JMP(GL_OFFSET(_gloffset_Map2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectdv)) -GL_PREFIX(Rectdv): +GLOBL_FN(GL_PREFIX(Map2f)) +GL_PREFIX(Map2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectdv)) - JMP(GL_OFFSET(_gloffset_Rectdv)) + JZ(GLNAME(_glapi_fallback_Map2f)) + JMP(GL_OFFSET(_gloffset_Map2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectf)) -GL_PREFIX(Rectf): +GLOBL_FN(GL_PREFIX(MapGrid1d)) +GL_PREFIX(MapGrid1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectf)) - JMP(GL_OFFSET(_gloffset_Rectf)) + JZ(GLNAME(_glapi_fallback_MapGrid1d)) + JMP(GL_OFFSET(_gloffset_MapGrid1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectfv)) -GL_PREFIX(Rectfv): +GLOBL_FN(GL_PREFIX(MapGrid1f)) +GL_PREFIX(MapGrid1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectfv)) - JMP(GL_OFFSET(_gloffset_Rectfv)) + JZ(GLNAME(_glapi_fallback_MapGrid1f)) + JMP(GL_OFFSET(_gloffset_MapGrid1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Recti)) -GL_PREFIX(Recti): +GLOBL_FN(GL_PREFIX(MapGrid2d)) +GL_PREFIX(MapGrid2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Recti)) - JMP(GL_OFFSET(_gloffset_Recti)) + JZ(GLNAME(_glapi_fallback_MapGrid2d)) + JMP(GL_OFFSET(_gloffset_MapGrid2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectiv)) -GL_PREFIX(Rectiv): +GLOBL_FN(GL_PREFIX(MapGrid2f)) +GL_PREFIX(MapGrid2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectiv)) - JMP(GL_OFFSET(_gloffset_Rectiv)) + JZ(GLNAME(_glapi_fallback_MapGrid2f)) + JMP(GL_OFFSET(_gloffset_MapGrid2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rects)) -GL_PREFIX(Rects): +GLOBL_FN(GL_PREFIX(EvalCoord1d)) +GL_PREFIX(EvalCoord1d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rects)) - JMP(GL_OFFSET(_gloffset_Rects)) + JZ(GLNAME(_glapi_fallback_EvalCoord1d)) + JMP(GL_OFFSET(_gloffset_EvalCoord1d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rectsv)) -GL_PREFIX(Rectsv): +GLOBL_FN(GL_PREFIX(EvalCoord1dv)) +GL_PREFIX(EvalCoord1dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rectsv)) - JMP(GL_OFFSET(_gloffset_Rectsv)) + JZ(GLNAME(_glapi_fallback_EvalCoord1dv)) + JMP(GL_OFFSET(_gloffset_EvalCoord1dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(RenderMode)) -GL_PREFIX(RenderMode): +GLOBL_FN(GL_PREFIX(EvalCoord1f)) +GL_PREFIX(EvalCoord1f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_RenderMode)) - JMP(GL_OFFSET(_gloffset_RenderMode)) + JZ(GLNAME(_glapi_fallback_EvalCoord1f)) + JMP(GL_OFFSET(_gloffset_EvalCoord1f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rotated)) -GL_PREFIX(Rotated): +GLOBL_FN(GL_PREFIX(EvalCoord1fv)) +GL_PREFIX(EvalCoord1fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rotated)) - JMP(GL_OFFSET(_gloffset_Rotated)) + JZ(GLNAME(_glapi_fallback_EvalCoord1fv)) + JMP(GL_OFFSET(_gloffset_EvalCoord1fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Rotatef)) -GL_PREFIX(Rotatef): +GLOBL_FN(GL_PREFIX(EvalCoord2d)) +GL_PREFIX(EvalCoord2d): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Rotatef)) - JMP(GL_OFFSET(_gloffset_Rotatef)) + JZ(GLNAME(_glapi_fallback_EvalCoord2d)) + JMP(GL_OFFSET(_gloffset_EvalCoord2d)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SelectBuffer)) -GL_PREFIX(SelectBuffer): +GLOBL_FN(GL_PREFIX(EvalCoord2dv)) +GL_PREFIX(EvalCoord2dv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SelectBuffer)) - JMP(GL_OFFSET(_gloffset_SelectBuffer)) + JZ(GLNAME(_glapi_fallback_EvalCoord2dv)) + JMP(GL_OFFSET(_gloffset_EvalCoord2dv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Scaled)) -GL_PREFIX(Scaled): +GLOBL_FN(GL_PREFIX(EvalCoord2f)) +GL_PREFIX(EvalCoord2f): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Scaled)) - JMP(GL_OFFSET(_gloffset_Scaled)) + JZ(GLNAME(_glapi_fallback_EvalCoord2f)) + JMP(GL_OFFSET(_gloffset_EvalCoord2f)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Scalef)) -GL_PREFIX(Scalef): +GLOBL_FN(GL_PREFIX(EvalCoord2fv)) +GL_PREFIX(EvalCoord2fv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Scalef)) - JMP(GL_OFFSET(_gloffset_Scalef)) + JZ(GLNAME(_glapi_fallback_EvalCoord2fv)) + JMP(GL_OFFSET(_gloffset_EvalCoord2fv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Scissor)) -GL_PREFIX(Scissor): +GLOBL_FN(GL_PREFIX(EvalMesh1)) +GL_PREFIX(EvalMesh1): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Scissor)) - JMP(GL_OFFSET(_gloffset_Scissor)) + JZ(GLNAME(_glapi_fallback_EvalMesh1)) + JMP(GL_OFFSET(_gloffset_EvalMesh1)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ShadeModel)) -GL_PREFIX(ShadeModel): +GLOBL_FN(GL_PREFIX(EvalPoint1)) +GL_PREFIX(EvalPoint1): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ShadeModel)) - JMP(GL_OFFSET(_gloffset_ShadeModel)) + JZ(GLNAME(_glapi_fallback_EvalPoint1)) + JMP(GL_OFFSET(_gloffset_EvalPoint1)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StencilFunc)) -GL_PREFIX(StencilFunc): +GLOBL_FN(GL_PREFIX(EvalMesh2)) +GL_PREFIX(EvalMesh2): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StencilFunc)) - JMP(GL_OFFSET(_gloffset_StencilFunc)) + JZ(GLNAME(_glapi_fallback_EvalMesh2)) + JMP(GL_OFFSET(_gloffset_EvalMesh2)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StencilMask)) -GL_PREFIX(StencilMask): +GLOBL_FN(GL_PREFIX(EvalPoint2)) +GL_PREFIX(EvalPoint2): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StencilMask)) - JMP(GL_OFFSET(_gloffset_StencilMask)) + JZ(GLNAME(_glapi_fallback_EvalPoint2)) + JMP(GL_OFFSET(_gloffset_EvalPoint2)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StencilOp)) -GL_PREFIX(StencilOp): +GLOBL_FN(GL_PREFIX(AlphaFunc)) +GL_PREFIX(AlphaFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StencilOp)) - JMP(GL_OFFSET(_gloffset_StencilOp)) + JZ(GLNAME(_glapi_fallback_AlphaFunc)) + JMP(GL_OFFSET(_gloffset_AlphaFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1d)) -GL_PREFIX(TexCoord1d): +GLOBL_FN(GL_PREFIX(BlendFunc)) +GL_PREFIX(BlendFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1d)) - JMP(GL_OFFSET(_gloffset_TexCoord1d)) + JZ(GLNAME(_glapi_fallback_BlendFunc)) + JMP(GL_OFFSET(_gloffset_BlendFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1f)) -GL_PREFIX(TexCoord1f): +GLOBL_FN(GL_PREFIX(LogicOp)) +GL_PREFIX(LogicOp): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1f)) - JMP(GL_OFFSET(_gloffset_TexCoord1f)) + JZ(GLNAME(_glapi_fallback_LogicOp)) + JMP(GL_OFFSET(_gloffset_LogicOp)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1i)) -GL_PREFIX(TexCoord1i): +GLOBL_FN(GL_PREFIX(StencilFunc)) +GL_PREFIX(StencilFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1i)) - JMP(GL_OFFSET(_gloffset_TexCoord1i)) + JZ(GLNAME(_glapi_fallback_StencilFunc)) + JMP(GL_OFFSET(_gloffset_StencilFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1s)) -GL_PREFIX(TexCoord1s): +GLOBL_FN(GL_PREFIX(StencilOp)) +GL_PREFIX(StencilOp): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1s)) - JMP(GL_OFFSET(_gloffset_TexCoord1s)) + JZ(GLNAME(_glapi_fallback_StencilOp)) + JMP(GL_OFFSET(_gloffset_StencilOp)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2d)) -GL_PREFIX(TexCoord2d): +GLOBL_FN(GL_PREFIX(DepthFunc)) +GL_PREFIX(DepthFunc): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2d)) - JMP(GL_OFFSET(_gloffset_TexCoord2d)) + JZ(GLNAME(_glapi_fallback_DepthFunc)) + JMP(GL_OFFSET(_gloffset_DepthFunc)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2f)) -GL_PREFIX(TexCoord2f): +GLOBL_FN(GL_PREFIX(PixelZoom)) +GL_PREFIX(PixelZoom): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2f)) - JMP(GL_OFFSET(_gloffset_TexCoord2f)) + JZ(GLNAME(_glapi_fallback_PixelZoom)) + JMP(GL_OFFSET(_gloffset_PixelZoom)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2s)) -GL_PREFIX(TexCoord2s): +GLOBL_FN(GL_PREFIX(PixelTransferf)) +GL_PREFIX(PixelTransferf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2s)) - JMP(GL_OFFSET(_gloffset_TexCoord2s)) + JZ(GLNAME(_glapi_fallback_PixelTransferf)) + JMP(GL_OFFSET(_gloffset_PixelTransferf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2i)) -GL_PREFIX(TexCoord2i): +GLOBL_FN(GL_PREFIX(PixelTransferi)) +GL_PREFIX(PixelTransferi): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2i)) - JMP(GL_OFFSET(_gloffset_TexCoord2i)) + JZ(GLNAME(_glapi_fallback_PixelTransferi)) + JMP(GL_OFFSET(_gloffset_PixelTransferi)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3d)) -GL_PREFIX(TexCoord3d): +GLOBL_FN(GL_PREFIX(PixelStoref)) +GL_PREFIX(PixelStoref): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3d)) - JMP(GL_OFFSET(_gloffset_TexCoord3d)) + JZ(GLNAME(_glapi_fallback_PixelStoref)) + JMP(GL_OFFSET(_gloffset_PixelStoref)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3f)) -GL_PREFIX(TexCoord3f): +GLOBL_FN(GL_PREFIX(PixelStorei)) +GL_PREFIX(PixelStorei): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3f)) - JMP(GL_OFFSET(_gloffset_TexCoord3f)) + JZ(GLNAME(_glapi_fallback_PixelStorei)) + JMP(GL_OFFSET(_gloffset_PixelStorei)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3i)) -GL_PREFIX(TexCoord3i): +GLOBL_FN(GL_PREFIX(PixelMapfv)) +GL_PREFIX(PixelMapfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3i)) - JMP(GL_OFFSET(_gloffset_TexCoord3i)) + JZ(GLNAME(_glapi_fallback_PixelMapfv)) + JMP(GL_OFFSET(_gloffset_PixelMapfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3s)) -GL_PREFIX(TexCoord3s): +GLOBL_FN(GL_PREFIX(PixelMapuiv)) +GL_PREFIX(PixelMapuiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3s)) - JMP(GL_OFFSET(_gloffset_TexCoord3s)) + JZ(GLNAME(_glapi_fallback_PixelMapuiv)) + JMP(GL_OFFSET(_gloffset_PixelMapuiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4d)) -GL_PREFIX(TexCoord4d): +GLOBL_FN(GL_PREFIX(PixelMapusv)) +GL_PREFIX(PixelMapusv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4d)) - JMP(GL_OFFSET(_gloffset_TexCoord4d)) + JZ(GLNAME(_glapi_fallback_PixelMapusv)) + JMP(GL_OFFSET(_gloffset_PixelMapusv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4f)) -GL_PREFIX(TexCoord4f): +GLOBL_FN(GL_PREFIX(ReadBuffer)) +GL_PREFIX(ReadBuffer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4f)) - JMP(GL_OFFSET(_gloffset_TexCoord4f)) + JZ(GLNAME(_glapi_fallback_ReadBuffer)) + JMP(GL_OFFSET(_gloffset_ReadBuffer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4i)) -GL_PREFIX(TexCoord4i): +GLOBL_FN(GL_PREFIX(CopyPixels)) +GL_PREFIX(CopyPixels): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4i)) - JMP(GL_OFFSET(_gloffset_TexCoord4i)) + JZ(GLNAME(_glapi_fallback_CopyPixels)) + JMP(GL_OFFSET(_gloffset_CopyPixels)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4s)) -GL_PREFIX(TexCoord4s): +GLOBL_FN(GL_PREFIX(ReadPixels)) +GL_PREFIX(ReadPixels): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4s)) - JMP(GL_OFFSET(_gloffset_TexCoord4s)) + JZ(GLNAME(_glapi_fallback_ReadPixels)) + JMP(GL_OFFSET(_gloffset_ReadPixels)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1dv)) -GL_PREFIX(TexCoord1dv): +GLOBL_FN(GL_PREFIX(DrawPixels)) +GL_PREFIX(DrawPixels): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1dv)) - JMP(GL_OFFSET(_gloffset_TexCoord1dv)) + JZ(GLNAME(_glapi_fallback_DrawPixels)) + JMP(GL_OFFSET(_gloffset_DrawPixels)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1fv)) -GL_PREFIX(TexCoord1fv): +GLOBL_FN(GL_PREFIX(GetBooleanv)) +GL_PREFIX(GetBooleanv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1fv)) - JMP(GL_OFFSET(_gloffset_TexCoord1fv)) + JZ(GLNAME(_glapi_fallback_GetBooleanv)) + JMP(GL_OFFSET(_gloffset_GetBooleanv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1iv)) -GL_PREFIX(TexCoord1iv): +GLOBL_FN(GL_PREFIX(GetClipPlane)) +GL_PREFIX(GetClipPlane): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1iv)) - JMP(GL_OFFSET(_gloffset_TexCoord1iv)) + JZ(GLNAME(_glapi_fallback_GetClipPlane)) + JMP(GL_OFFSET(_gloffset_GetClipPlane)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord1sv)) -GL_PREFIX(TexCoord1sv): +GLOBL_FN(GL_PREFIX(GetDoublev)) +GL_PREFIX(GetDoublev): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord1sv)) - JMP(GL_OFFSET(_gloffset_TexCoord1sv)) + JZ(GLNAME(_glapi_fallback_GetDoublev)) + JMP(GL_OFFSET(_gloffset_GetDoublev)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2dv)) -GL_PREFIX(TexCoord2dv): +GLOBL_FN(GL_PREFIX(GetError)) +GL_PREFIX(GetError): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2dv)) - JMP(GL_OFFSET(_gloffset_TexCoord2dv)) + JZ(GLNAME(_glapi_fallback_GetError)) + JMP(GL_OFFSET(_gloffset_GetError)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2fv)) -GL_PREFIX(TexCoord2fv): +GLOBL_FN(GL_PREFIX(GetFloatv)) +GL_PREFIX(GetFloatv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2fv)) - JMP(GL_OFFSET(_gloffset_TexCoord2fv)) + JZ(GLNAME(_glapi_fallback_GetFloatv)) + JMP(GL_OFFSET(_gloffset_GetFloatv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2iv)) -GL_PREFIX(TexCoord2iv): +GLOBL_FN(GL_PREFIX(GetIntegerv)) +GL_PREFIX(GetIntegerv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2iv)) - JMP(GL_OFFSET(_gloffset_TexCoord2iv)) + JZ(GLNAME(_glapi_fallback_GetIntegerv)) + JMP(GL_OFFSET(_gloffset_GetIntegerv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord2sv)) -GL_PREFIX(TexCoord2sv): +GLOBL_FN(GL_PREFIX(GetLightfv)) +GL_PREFIX(GetLightfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord2sv)) - JMP(GL_OFFSET(_gloffset_TexCoord2sv)) + JZ(GLNAME(_glapi_fallback_GetLightfv)) + JMP(GL_OFFSET(_gloffset_GetLightfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3dv)) -GL_PREFIX(TexCoord3dv): +GLOBL_FN(GL_PREFIX(GetLightiv)) +GL_PREFIX(GetLightiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3dv)) - JMP(GL_OFFSET(_gloffset_TexCoord3dv)) + JZ(GLNAME(_glapi_fallback_GetLightiv)) + JMP(GL_OFFSET(_gloffset_GetLightiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3fv)) -GL_PREFIX(TexCoord3fv): +GLOBL_FN(GL_PREFIX(GetMapdv)) +GL_PREFIX(GetMapdv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3fv)) - JMP(GL_OFFSET(_gloffset_TexCoord3fv)) + JZ(GLNAME(_glapi_fallback_GetMapdv)) + JMP(GL_OFFSET(_gloffset_GetMapdv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3iv)) -GL_PREFIX(TexCoord3iv): +GLOBL_FN(GL_PREFIX(GetMapfv)) +GL_PREFIX(GetMapfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3iv)) - JMP(GL_OFFSET(_gloffset_TexCoord3iv)) + JZ(GLNAME(_glapi_fallback_GetMapfv)) + JMP(GL_OFFSET(_gloffset_GetMapfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord3sv)) -GL_PREFIX(TexCoord3sv): +GLOBL_FN(GL_PREFIX(GetMapiv)) +GL_PREFIX(GetMapiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord3sv)) - JMP(GL_OFFSET(_gloffset_TexCoord3sv)) + JZ(GLNAME(_glapi_fallback_GetMapiv)) + JMP(GL_OFFSET(_gloffset_GetMapiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4dv)) -GL_PREFIX(TexCoord4dv): +GLOBL_FN(GL_PREFIX(GetMaterialfv)) +GL_PREFIX(GetMaterialfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4dv)) - JMP(GL_OFFSET(_gloffset_TexCoord4dv)) + JZ(GLNAME(_glapi_fallback_GetMaterialfv)) + JMP(GL_OFFSET(_gloffset_GetMaterialfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4fv)) -GL_PREFIX(TexCoord4fv): +GLOBL_FN(GL_PREFIX(GetMaterialiv)) +GL_PREFIX(GetMaterialiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4fv)) - JMP(GL_OFFSET(_gloffset_TexCoord4fv)) + JZ(GLNAME(_glapi_fallback_GetMaterialiv)) + JMP(GL_OFFSET(_gloffset_GetMaterialiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4iv)) -GL_PREFIX(TexCoord4iv): +GLOBL_FN(GL_PREFIX(GetPixelMapfv)) +GL_PREFIX(GetPixelMapfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4iv)) - JMP(GL_OFFSET(_gloffset_TexCoord4iv)) + JZ(GLNAME(_glapi_fallback_GetPixelMapfv)) + JMP(GL_OFFSET(_gloffset_GetPixelMapfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoord4sv)) -GL_PREFIX(TexCoord4sv): +GLOBL_FN(GL_PREFIX(GetPixelMapuiv)) +GL_PREFIX(GetPixelMapuiv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoord4sv)) - JMP(GL_OFFSET(_gloffset_TexCoord4sv)) + JZ(GLNAME(_glapi_fallback_GetPixelMapuiv)) + JMP(GL_OFFSET(_gloffset_GetPixelMapuiv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGend)) -GL_PREFIX(TexGend): +GLOBL_FN(GL_PREFIX(GetPixelMapusv)) +GL_PREFIX(GetPixelMapusv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGend)) - JMP(GL_OFFSET(_gloffset_TexGend)) + JZ(GLNAME(_glapi_fallback_GetPixelMapusv)) + JMP(GL_OFFSET(_gloffset_GetPixelMapusv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGendv)) -GL_PREFIX(TexGendv): +GLOBL_FN(GL_PREFIX(GetPolygonStipple)) +GL_PREFIX(GetPolygonStipple): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGendv)) - JMP(GL_OFFSET(_gloffset_TexGendv)) + JZ(GLNAME(_glapi_fallback_GetPolygonStipple)) + JMP(GL_OFFSET(_gloffset_GetPolygonStipple)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGenf)) -GL_PREFIX(TexGenf): +GLOBL_FN(GL_PREFIX(GetString)) +GL_PREFIX(GetString): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGenf)) - JMP(GL_OFFSET(_gloffset_TexGenf)) + JZ(GLNAME(_glapi_fallback_GetString)) + JMP(GL_OFFSET(_gloffset_GetString)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGenfv)) -GL_PREFIX(TexGenfv): +GLOBL_FN(GL_PREFIX(GetTexEnvfv)) +GL_PREFIX(GetTexEnvfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGenfv)) - JMP(GL_OFFSET(_gloffset_TexGenfv)) + JZ(GLNAME(_glapi_fallback_GetTexEnvfv)) + JMP(GL_OFFSET(_gloffset_GetTexEnvfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGeni)) -GL_PREFIX(TexGeni): +GLOBL_FN(GL_PREFIX(GetTexEnviv)) +GL_PREFIX(GetTexEnviv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGeni)) - JMP(GL_OFFSET(_gloffset_TexGeni)) + JZ(GLNAME(_glapi_fallback_GetTexEnviv)) + JMP(GL_OFFSET(_gloffset_GetTexEnviv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexGeniv)) -GL_PREFIX(TexGeniv): +GLOBL_FN(GL_PREFIX(GetTexGendv)) +GL_PREFIX(GetTexGendv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexGeniv)) - JMP(GL_OFFSET(_gloffset_TexGeniv)) + JZ(GLNAME(_glapi_fallback_GetTexGendv)) + JMP(GL_OFFSET(_gloffset_GetTexGendv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnvf)) -GL_PREFIX(TexEnvf): +GLOBL_FN(GL_PREFIX(GetTexGenfv)) +GL_PREFIX(GetTexGenfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnvf)) - JMP(GL_OFFSET(_gloffset_TexEnvf)) + JZ(GLNAME(_glapi_fallback_GetTexGenfv)) + JMP(GL_OFFSET(_gloffset_GetTexGenfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnvfv)) -GL_PREFIX(TexEnvfv): +GLOBL_FN(GL_PREFIX(GetTexGeniv)) +GL_PREFIX(GetTexGeniv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnvfv)) - JMP(GL_OFFSET(_gloffset_TexEnvfv)) + JZ(GLNAME(_glapi_fallback_GetTexGeniv)) + JMP(GL_OFFSET(_gloffset_GetTexGeniv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnvi)) -GL_PREFIX(TexEnvi): +GLOBL_FN(GL_PREFIX(GetTexImage)) +GL_PREFIX(GetTexImage): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnvi)) - JMP(GL_OFFSET(_gloffset_TexEnvi)) + JZ(GLNAME(_glapi_fallback_GetTexImage)) + JMP(GL_OFFSET(_gloffset_GetTexImage)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexEnviv)) -GL_PREFIX(TexEnviv): +GLOBL_FN(GL_PREFIX(GetTexParameterfv)) +GL_PREFIX(GetTexParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexEnviv)) - JMP(GL_OFFSET(_gloffset_TexEnviv)) + JZ(GLNAME(_glapi_fallback_GetTexParameterfv)) + JMP(GL_OFFSET(_gloffset_GetTexParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage1D)) -GL_PREFIX(TexImage1D): +GLOBL_FN(GL_PREFIX(GetTexParameteriv)) +GL_PREFIX(GetTexParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage1D)) - JMP(GL_OFFSET(_gloffset_TexImage1D)) + JZ(GLNAME(_glapi_fallback_GetTexParameteriv)) + JMP(GL_OFFSET(_gloffset_GetTexParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage2D)) -GL_PREFIX(TexImage2D): +GLOBL_FN(GL_PREFIX(GetTexLevelParameterfv)) +GL_PREFIX(GetTexLevelParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage2D)) - JMP(GL_OFFSET(_gloffset_TexImage2D)) + JZ(GLNAME(_glapi_fallback_GetTexLevelParameterfv)) + JMP(GL_OFFSET(_gloffset_GetTexLevelParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameterf)) -GL_PREFIX(TexParameterf): +GLOBL_FN(GL_PREFIX(GetTexLevelParameteriv)) +GL_PREFIX(GetTexLevelParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameterf)) - JMP(GL_OFFSET(_gloffset_TexParameterf)) + JZ(GLNAME(_glapi_fallback_GetTexLevelParameteriv)) + JMP(GL_OFFSET(_gloffset_GetTexLevelParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameterfv)) -GL_PREFIX(TexParameterfv): +GLOBL_FN(GL_PREFIX(IsEnabled)) +GL_PREFIX(IsEnabled): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameterfv)) - JMP(GL_OFFSET(_gloffset_TexParameterfv)) + JZ(GLNAME(_glapi_fallback_IsEnabled)) + JMP(GL_OFFSET(_gloffset_IsEnabled)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameteri)) -GL_PREFIX(TexParameteri): +GLOBL_FN(GL_PREFIX(IsList)) +GL_PREFIX(IsList): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameteri)) - JMP(GL_OFFSET(_gloffset_TexParameteri)) + JZ(GLNAME(_glapi_fallback_IsList)) + JMP(GL_OFFSET(_gloffset_IsList)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexParameteriv)) -GL_PREFIX(TexParameteriv): +GLOBL_FN(GL_PREFIX(DepthRange)) +GL_PREFIX(DepthRange): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexParameteriv)) - JMP(GL_OFFSET(_gloffset_TexParameteriv)) + JZ(GLNAME(_glapi_fallback_DepthRange)) + JMP(GL_OFFSET(_gloffset_DepthRange)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Translated)) -GL_PREFIX(Translated): +GLOBL_FN(GL_PREFIX(Frustum)) +GL_PREFIX(Frustum): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Translated)) - JMP(GL_OFFSET(_gloffset_Translated)) + JZ(GLNAME(_glapi_fallback_Frustum)) + JMP(GL_OFFSET(_gloffset_Frustum)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Translatef)) -GL_PREFIX(Translatef): +GLOBL_FN(GL_PREFIX(LoadIdentity)) +GL_PREFIX(LoadIdentity): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Translatef)) - JMP(GL_OFFSET(_gloffset_Translatef)) + JZ(GLNAME(_glapi_fallback_LoadIdentity)) + JMP(GL_OFFSET(_gloffset_LoadIdentity)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2d)) -GL_PREFIX(Vertex2d): +GLOBL_FN(GL_PREFIX(LoadMatrixf)) +GL_PREFIX(LoadMatrixf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2d)) - JMP(GL_OFFSET(_gloffset_Vertex2d)) + JZ(GLNAME(_glapi_fallback_LoadMatrixf)) + JMP(GL_OFFSET(_gloffset_LoadMatrixf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2dv)) -GL_PREFIX(Vertex2dv): +GLOBL_FN(GL_PREFIX(LoadMatrixd)) +GL_PREFIX(LoadMatrixd): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2dv)) - JMP(GL_OFFSET(_gloffset_Vertex2dv)) + JZ(GLNAME(_glapi_fallback_LoadMatrixd)) + JMP(GL_OFFSET(_gloffset_LoadMatrixd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2f)) -GL_PREFIX(Vertex2f): +GLOBL_FN(GL_PREFIX(MatrixMode)) +GL_PREFIX(MatrixMode): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2f)) - JMP(GL_OFFSET(_gloffset_Vertex2f)) + JZ(GLNAME(_glapi_fallback_MatrixMode)) + JMP(GL_OFFSET(_gloffset_MatrixMode)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2fv)) -GL_PREFIX(Vertex2fv): +GLOBL_FN(GL_PREFIX(MultMatrixf)) +GL_PREFIX(MultMatrixf): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2fv)) - JMP(GL_OFFSET(_gloffset_Vertex2fv)) + JZ(GLNAME(_glapi_fallback_MultMatrixf)) + JMP(GL_OFFSET(_gloffset_MultMatrixf)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2i)) -GL_PREFIX(Vertex2i): +GLOBL_FN(GL_PREFIX(MultMatrixd)) +GL_PREFIX(MultMatrixd): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2i)) - JMP(GL_OFFSET(_gloffset_Vertex2i)) + JZ(GLNAME(_glapi_fallback_MultMatrixd)) + JMP(GL_OFFSET(_gloffset_MultMatrixd)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2iv)) -GL_PREFIX(Vertex2iv): +GLOBL_FN(GL_PREFIX(Ortho)) +GL_PREFIX(Ortho): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2iv)) - JMP(GL_OFFSET(_gloffset_Vertex2iv)) + JZ(GLNAME(_glapi_fallback_Ortho)) + JMP(GL_OFFSET(_gloffset_Ortho)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2s)) -GL_PREFIX(Vertex2s): +GLOBL_FN(GL_PREFIX(PopMatrix)) +GL_PREFIX(PopMatrix): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2s)) - JMP(GL_OFFSET(_gloffset_Vertex2s)) + JZ(GLNAME(_glapi_fallback_PopMatrix)) + JMP(GL_OFFSET(_gloffset_PopMatrix)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex2sv)) -GL_PREFIX(Vertex2sv): +GLOBL_FN(GL_PREFIX(PushMatrix)) +GL_PREFIX(PushMatrix): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex2sv)) - JMP(GL_OFFSET(_gloffset_Vertex2sv)) + JZ(GLNAME(_glapi_fallback_PushMatrix)) + JMP(GL_OFFSET(_gloffset_PushMatrix)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3d)) -GL_PREFIX(Vertex3d): +GLOBL_FN(GL_PREFIX(Rotated)) +GL_PREFIX(Rotated): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3d)) - JMP(GL_OFFSET(_gloffset_Vertex3d)) + JZ(GLNAME(_glapi_fallback_Rotated)) + JMP(GL_OFFSET(_gloffset_Rotated)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3dv)) -GL_PREFIX(Vertex3dv): +GLOBL_FN(GL_PREFIX(Rotatef)) +GL_PREFIX(Rotatef): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3dv)) - JMP(GL_OFFSET(_gloffset_Vertex3dv)) + JZ(GLNAME(_glapi_fallback_Rotatef)) + JMP(GL_OFFSET(_gloffset_Rotatef)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3f)) -GL_PREFIX(Vertex3f): +GLOBL_FN(GL_PREFIX(Scaled)) +GL_PREFIX(Scaled): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3f)) - JMP(GL_OFFSET(_gloffset_Vertex3f)) + JZ(GLNAME(_glapi_fallback_Scaled)) + JMP(GL_OFFSET(_gloffset_Scaled)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3fv)) -GL_PREFIX(Vertex3fv): +GLOBL_FN(GL_PREFIX(Scalef)) +GL_PREFIX(Scalef): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3fv)) - JMP(GL_OFFSET(_gloffset_Vertex3fv)) + JZ(GLNAME(_glapi_fallback_Scalef)) + JMP(GL_OFFSET(_gloffset_Scalef)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3i)) -GL_PREFIX(Vertex3i): +GLOBL_FN(GL_PREFIX(Translated)) +GL_PREFIX(Translated): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3i)) - JMP(GL_OFFSET(_gloffset_Vertex3i)) + JZ(GLNAME(_glapi_fallback_Translated)) + JMP(GL_OFFSET(_gloffset_Translated)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3iv)) -GL_PREFIX(Vertex3iv): +GLOBL_FN(GL_PREFIX(Translatef)) +GL_PREFIX(Translatef): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3iv)) - JMP(GL_OFFSET(_gloffset_Vertex3iv)) + JZ(GLNAME(_glapi_fallback_Translatef)) + JMP(GL_OFFSET(_gloffset_Translatef)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3s)) -GL_PREFIX(Vertex3s): +GLOBL_FN(GL_PREFIX(Viewport)) +GL_PREFIX(Viewport): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3s)) - JMP(GL_OFFSET(_gloffset_Vertex3s)) + JZ(GLNAME(_glapi_fallback_Viewport)) + JMP(GL_OFFSET(_gloffset_Viewport)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex3sv)) -GL_PREFIX(Vertex3sv): +GLOBL_FN(GL_PREFIX(ArrayElement)) +GL_PREFIX(ArrayElement): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex3sv)) - JMP(GL_OFFSET(_gloffset_Vertex3sv)) + JZ(GLNAME(_glapi_fallback_ArrayElement)) + JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4d)) -GL_PREFIX(Vertex4d): +GLOBL_FN(GL_PREFIX(ColorPointer)) +GL_PREFIX(ColorPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4d)) - JMP(GL_OFFSET(_gloffset_Vertex4d)) + JZ(GLNAME(_glapi_fallback_ColorPointer)) + JMP(GL_OFFSET(_gloffset_ColorPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4dv)) -GL_PREFIX(Vertex4dv): +GLOBL_FN(GL_PREFIX(DisableClientState)) +GL_PREFIX(DisableClientState): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4dv)) - JMP(GL_OFFSET(_gloffset_Vertex4dv)) + JZ(GLNAME(_glapi_fallback_DisableClientState)) + JMP(GL_OFFSET(_gloffset_DisableClientState)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4f)) -GL_PREFIX(Vertex4f): +GLOBL_FN(GL_PREFIX(DrawArrays)) +GL_PREFIX(DrawArrays): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4f)) - JMP(GL_OFFSET(_gloffset_Vertex4f)) + JZ(GLNAME(_glapi_fallback_DrawArrays)) + JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4fv)) -GL_PREFIX(Vertex4fv): +GLOBL_FN(GL_PREFIX(DrawElements)) +GL_PREFIX(DrawElements): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4fv)) - JMP(GL_OFFSET(_gloffset_Vertex4fv)) + JZ(GLNAME(_glapi_fallback_DrawElements)) + JMP(GL_OFFSET(_gloffset_DrawElements)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4i)) -GL_PREFIX(Vertex4i): +GLOBL_FN(GL_PREFIX(EdgeFlagPointer)) +GL_PREFIX(EdgeFlagPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4i)) - JMP(GL_OFFSET(_gloffset_Vertex4i)) + JZ(GLNAME(_glapi_fallback_EdgeFlagPointer)) + JMP(GL_OFFSET(_gloffset_EdgeFlagPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4iv)) -GL_PREFIX(Vertex4iv): +GLOBL_FN(GL_PREFIX(EnableClientState)) +GL_PREFIX(EnableClientState): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4iv)) - JMP(GL_OFFSET(_gloffset_Vertex4iv)) + JZ(GLNAME(_glapi_fallback_EnableClientState)) + JMP(GL_OFFSET(_gloffset_EnableClientState)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4s)) -GL_PREFIX(Vertex4s): +GLOBL_FN(GL_PREFIX(GetPointerv)) +GL_PREFIX(GetPointerv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4s)) - JMP(GL_OFFSET(_gloffset_Vertex4s)) + JZ(GLNAME(_glapi_fallback_GetPointerv)) + JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Vertex4sv)) -GL_PREFIX(Vertex4sv): +GLOBL_FN(GL_PREFIX(IndexPointer)) +GL_PREFIX(IndexPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Vertex4sv)) - JMP(GL_OFFSET(_gloffset_Vertex4sv)) + JZ(GLNAME(_glapi_fallback_IndexPointer)) + JMP(GL_OFFSET(_gloffset_IndexPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(Viewport)) -GL_PREFIX(Viewport): +GLOBL_FN(GL_PREFIX(InterleavedArrays)) +GL_PREFIX(InterleavedArrays): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Viewport)) - JMP(GL_OFFSET(_gloffset_Viewport)) + JZ(GLNAME(_glapi_fallback_InterleavedArrays)) + JMP(GL_OFFSET(_gloffset_InterleavedArrays)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AreTexturesResident)) -GL_PREFIX(AreTexturesResident): +GLOBL_FN(GL_PREFIX(NormalPointer)) +GL_PREFIX(NormalPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_AreTexturesResident)) - JMP(GL_OFFSET(_gloffset_AreTexturesResident)) + JZ(GLNAME(_glapi_fallback_NormalPointer)) + JMP(GL_OFFSET(_gloffset_NormalPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ArrayElement)) -GL_PREFIX(ArrayElement): +GLOBL_FN(GL_PREFIX(TexCoordPointer)) +GL_PREFIX(TexCoordPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ArrayElement)) - JMP(GL_OFFSET(_gloffset_ArrayElement)) + JZ(GLNAME(_glapi_fallback_TexCoordPointer)) + JMP(GL_OFFSET(_gloffset_TexCoordPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BindTexture)) -GL_PREFIX(BindTexture): +GLOBL_FN(GL_PREFIX(VertexPointer)) +GL_PREFIX(VertexPointer): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BindTexture)) - JMP(GL_OFFSET(_gloffset_BindTexture)) + JZ(GLNAME(_glapi_fallback_VertexPointer)) + JMP(GL_OFFSET(_gloffset_VertexPointer)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorPointer)) -GL_PREFIX(ColorPointer): +GLOBL_FN(GL_PREFIX(PolygonOffset)) +GL_PREFIX(PolygonOffset): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorPointer)) - JMP(GL_OFFSET(_gloffset_ColorPointer)) + JZ(GLNAME(_glapi_fallback_PolygonOffset)) + JMP(GL_OFFSET(_gloffset_PolygonOffset)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexImage1D)) @@ -2572,44 +2612,44 @@ GL_PREFIX(CopyTexSubImage2D): JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteTextures)) -GL_PREFIX(DeleteTextures): +GLOBL_FN(GL_PREFIX(TexSubImage1D)) +GL_PREFIX(TexSubImage1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DeleteTextures)) - JMP(GL_OFFSET(_gloffset_DeleteTextures)) + JZ(GLNAME(_glapi_fallback_TexSubImage1D)) + JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DisableClientState)) -GL_PREFIX(DisableClientState): +GLOBL_FN(GL_PREFIX(TexSubImage2D)) +GL_PREFIX(TexSubImage2D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DisableClientState)) - JMP(GL_OFFSET(_gloffset_DisableClientState)) + JZ(GLNAME(_glapi_fallback_TexSubImage2D)) + JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawArrays)) -GL_PREFIX(DrawArrays): +GLOBL_FN(GL_PREFIX(AreTexturesResident)) +GL_PREFIX(AreTexturesResident): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawArrays)) - JMP(GL_OFFSET(_gloffset_DrawArrays)) + JZ(GLNAME(_glapi_fallback_AreTexturesResident)) + JMP(GL_OFFSET(_gloffset_AreTexturesResident)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlagPointer)) -GL_PREFIX(EdgeFlagPointer): +GLOBL_FN(GL_PREFIX(BindTexture)) +GL_PREFIX(BindTexture): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EdgeFlagPointer)) - JMP(GL_OFFSET(_gloffset_EdgeFlagPointer)) + JZ(GLNAME(_glapi_fallback_BindTexture)) + JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EnableClientState)) -GL_PREFIX(EnableClientState): +GLOBL_FN(GL_PREFIX(DeleteTextures)) +GL_PREFIX(DeleteTextures): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_EnableClientState)) - JMP(GL_OFFSET(_gloffset_EnableClientState)) + JZ(GLNAME(_glapi_fallback_DeleteTextures)) + JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GenTextures)) @@ -2620,20 +2660,20 @@ GL_PREFIX(GenTextures): JMP(GL_OFFSET(_gloffset_GenTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPointerv)) -GL_PREFIX(GetPointerv): +GLOBL_FN(GL_PREFIX(IsTexture)) +GL_PREFIX(IsTexture): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPointerv)) - JMP(GL_OFFSET(_gloffset_GetPointerv)) + JZ(GLNAME(_glapi_fallback_IsTexture)) + JMP(GL_OFFSET(_gloffset_IsTexture)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexPointer)) -GL_PREFIX(IndexPointer): +GLOBL_FN(GL_PREFIX(PrioritizeTextures)) +GL_PREFIX(PrioritizeTextures): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IndexPointer)) - JMP(GL_OFFSET(_gloffset_IndexPointer)) + JZ(GLNAME(_glapi_fallback_PrioritizeTextures)) + JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Indexub)) @@ -2652,38 +2692,6 @@ GL_PREFIX(Indexubv): JMP(GL_OFFSET(_gloffset_Indexubv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(InterleavedArrays)) -GL_PREFIX(InterleavedArrays): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_InterleavedArrays)) - JMP(GL_OFFSET(_gloffset_InterleavedArrays)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsTexture)) -GL_PREFIX(IsTexture): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsTexture)) - JMP(GL_OFFSET(_gloffset_IsTexture)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(NormalPointer)) -GL_PREFIX(NormalPointer): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_NormalPointer)) - JMP(GL_OFFSET(_gloffset_NormalPointer)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PolygonOffset)) -GL_PREFIX(PolygonOffset): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PolygonOffset)) - JMP(GL_OFFSET(_gloffset_PolygonOffset)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PopClientAttrib)) GL_PREFIX(PopClientAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2692,14 +2700,6 @@ GL_PREFIX(PopClientAttrib): JMP(GL_OFFSET(_gloffset_PopClientAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PrioritizeTextures)) -GL_PREFIX(PrioritizeTextures): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PrioritizeTextures)) - JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(PushClientAttrib)) GL_PREFIX(PushClientAttrib): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2708,84 +2708,84 @@ GL_PREFIX(PushClientAttrib): JMP(GL_OFFSET(_gloffset_PushClientAttrib)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoordPointer)) -GL_PREFIX(TexCoordPointer): +GLOBL_FN(GL_PREFIX(BlendColor)) +GL_PREFIX(BlendColor): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexCoordPointer)) - JMP(GL_OFFSET(_gloffset_TexCoordPointer)) + JZ(GLNAME(_glapi_fallback_BlendColor)) + JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage1D)) -GL_PREFIX(TexSubImage1D): +GLOBL_FN(GL_PREFIX(BlendEquation)) +GL_PREFIX(BlendEquation): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage1D)) - JMP(GL_OFFSET(_gloffset_TexSubImage1D)) + JZ(GLNAME(_glapi_fallback_BlendEquation)) + JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage2D)) -GL_PREFIX(TexSubImage2D): +GLOBL_FN(GL_PREFIX(DrawRangeElements)) +GL_PREFIX(DrawRangeElements): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage2D)) - JMP(GL_OFFSET(_gloffset_TexSubImage2D)) + JZ(GLNAME(_glapi_fallback_DrawRangeElements)) + JMP(GL_OFFSET(_gloffset_DrawRangeElements)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexPointer)) -GL_PREFIX(VertexPointer): +GLOBL_FN(GL_PREFIX(ColorTable)) +GL_PREFIX(ColorTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexPointer)) - JMP(GL_OFFSET(_gloffset_VertexPointer)) + JZ(GLNAME(_glapi_fallback_ColorTable)) + JMP(GL_OFFSET(_gloffset_ColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage3D)) -GL_PREFIX(CopyTexSubImage3D): +GLOBL_FN(GL_PREFIX(ColorTableParameterfv)) +GL_PREFIX(ColorTableParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage3D)) - JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) + JZ(GLNAME(_glapi_fallback_ColorTableParameterfv)) + JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawRangeElements)) -GL_PREFIX(DrawRangeElements): +GLOBL_FN(GL_PREFIX(ColorTableParameteriv)) +GL_PREFIX(ColorTableParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawRangeElements)) - JMP(GL_OFFSET(_gloffset_DrawRangeElements)) + JZ(GLNAME(_glapi_fallback_ColorTableParameteriv)) + JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage3D)) -GL_PREFIX(TexImage3D): +GLOBL_FN(GL_PREFIX(CopyColorTable)) +GL_PREFIX(CopyColorTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage3D)) - JMP(GL_OFFSET(_gloffset_TexImage3D)) + JZ(GLNAME(_glapi_fallback_CopyColorTable)) + JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage3D)) -GL_PREFIX(TexSubImage3D): +GLOBL_FN(GL_PREFIX(GetColorTable)) +GL_PREFIX(GetColorTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage3D)) - JMP(GL_OFFSET(_gloffset_TexSubImage3D)) + JZ(GLNAME(_glapi_fallback_GetColorTable)) + JMP(GL_OFFSET(_gloffset_GetColorTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendColor)) -GL_PREFIX(BlendColor): +GLOBL_FN(GL_PREFIX(GetColorTableParameterfv)) +GL_PREFIX(GetColorTableParameterfv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendColor)) - JMP(GL_OFFSET(_gloffset_BlendColor)) + JZ(GLNAME(_glapi_fallback_GetColorTableParameterfv)) + JMP(GL_OFFSET(_gloffset_GetColorTableParameterfv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendEquation)) -GL_PREFIX(BlendEquation): +GLOBL_FN(GL_PREFIX(GetColorTableParameteriv)) +GL_PREFIX(GetColorTableParameteriv): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendEquation)) - JMP(GL_OFFSET(_gloffset_BlendEquation)) + JZ(GLNAME(_glapi_fallback_GetColorTableParameteriv)) + JMP(GL_OFFSET(_gloffset_GetColorTableParameteriv)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorSubTable)) @@ -2796,28 +2796,12 @@ GL_PREFIX(ColorSubTable): JMP(GL_OFFSET(_gloffset_ColorSubTable)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTable)) -GL_PREFIX(ColorTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTable)) - JMP(GL_OFFSET(_gloffset_ColorTable)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableParameterfv)) -GL_PREFIX(ColorTableParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameterfv)) - JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableParameteriv)) -GL_PREFIX(ColorTableParameteriv): +GLOBL_FN(GL_PREFIX(CopyColorSubTable)) +GL_PREFIX(CopyColorSubTable): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameteriv)) - JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) + JZ(GLNAME(_glapi_fallback_CopyColorSubTable)) + JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ConvolutionFilter1D)) @@ -2868,22 +2852,6 @@ GL_PREFIX(ConvolutionParameteriv): JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyColorSubTable)) -GL_PREFIX(CopyColorSubTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorSubTable)) - JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyColorTable)) -GL_PREFIX(CopyColorTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorTable)) - JMP(GL_OFFSET(_gloffset_CopyColorTable)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1D)) GL_PREFIX(CopyConvolutionFilter1D): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2900,30 +2868,6 @@ GL_PREFIX(CopyConvolutionFilter2D): JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTable)) -GL_PREFIX(GetColorTable): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTable)) - JMP(GL_OFFSET(_gloffset_GetColorTable)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterfv)) -GL_PREFIX(GetColorTableParameterfv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterfv)) - JMP(GL_OFFSET(_gloffset_GetColorTableParameterfv)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameteriv)) -GL_PREFIX(GetColorTableParameteriv): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameteriv)) - JMP(GL_OFFSET(_gloffset_GetColorTableParameteriv)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetConvolutionFilter)) GL_PREFIX(GetConvolutionFilter): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2948,6 +2892,22 @@ GL_PREFIX(GetConvolutionParameteriv): JMP(GL_OFFSET(_gloffset_GetConvolutionParameteriv)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetSeparableFilter)) +GL_PREFIX(GetSeparableFilter): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetSeparableFilter)) + JMP(GL_OFFSET(_gloffset_GetSeparableFilter)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SeparableFilter2D)) +GL_PREFIX(SeparableFilter2D): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SeparableFilter2D)) + JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogram)) GL_PREFIX(GetHistogram): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -2996,14 +2956,6 @@ GL_PREFIX(GetMinmaxParameteriv): JMP(GL_OFFSET(_gloffset_GetMinmaxParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetSeparableFilter)) -GL_PREFIX(GetSeparableFilter): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetSeparableFilter)) - JMP(GL_OFFSET(_gloffset_GetSeparableFilter)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(Histogram)) GL_PREFIX(Histogram): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -3020,6 +2972,14 @@ GL_PREFIX(Minmax): JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ResetHistogram)) +GL_PREFIX(ResetHistogram): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ResetHistogram)) + JMP(GL_OFFSET(_gloffset_ResetHistogram)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ResetMinmax)) GL_PREFIX(ResetMinmax): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -3028,20 +2988,28 @@ GL_PREFIX(ResetMinmax): JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ResetHistogram)) -GL_PREFIX(ResetHistogram): +GLOBL_FN(GL_PREFIX(TexImage3D)) +GL_PREFIX(TexImage3D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetHistogram)) - JMP(GL_OFFSET(_gloffset_ResetHistogram)) + JZ(GLNAME(_glapi_fallback_TexImage3D)) + JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SeparableFilter2D)) -GL_PREFIX(SeparableFilter2D): +GLOBL_FN(GL_PREFIX(TexSubImage3D)) +GL_PREFIX(TexSubImage3D): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SeparableFilter2D)) - JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) + JZ(GLNAME(_glapi_fallback_TexSubImage3D)) + JMP(GL_OFFSET(_gloffset_TexSubImage3D)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CopyTexSubImage3D)) +GL_PREFIX(CopyTexSubImage3D): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CopyTexSubImage3D)) + JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ActiveTextureARB)) @@ -3316,11 +3284,115 @@ GL_PREFIX(MultiTexCoord4svARB): JMP(GL_OFFSET(_gloffset_MultiTexCoord4svARB)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixfARB)) +GL_PREFIX(LoadTransposeMatrixfARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixfARB)) + JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(LoadTransposeMatrixdARB)) +GL_PREFIX(LoadTransposeMatrixdARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixdARB)) + JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultTransposeMatrixfARB)) +GL_PREFIX(MultTransposeMatrixfARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_MultTransposeMatrixfARB)) + JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(MultTransposeMatrixdARB)) +GL_PREFIX(MultTransposeMatrixdARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_MultTransposeMatrixdARB)) + JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SampleCoverageARB)) +GL_PREFIX(SampleCoverageARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SampleCoverageARB)) + JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SamplePassARB)) +GL_PREFIX(SamplePassARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SamplePassARB)) + JMP(GL_OFFSET(_gloffset_SamplePassARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexImage3DARB)) +GL_PREFIX(CompressedTexImage3DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexImage3DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexImage3DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexImage2DARB)) +GL_PREFIX(CompressedTexImage2DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexImage2DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexImage2DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexImage1DARB)) +GL_PREFIX(CompressedTexImage1DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexImage1DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexImage1DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexSubImage3DARB)) +GL_PREFIX(CompressedTexSubImage3DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexSubImage3DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexSubImage3DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexSubImage2DARB)) +GL_PREFIX(CompressedTexSubImage2DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexSubImage2DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexSubImage2DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CompressedTexSubImage1DARB)) +GL_PREFIX(CompressedTexSubImage1DARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CompressedTexSubImage1DARB)) + JMP(GL_OFFSET(_gloffset_CompressedTexSubImage1DARB)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetCompressedTexImageARB)) +GL_PREFIX(GetCompressedTexImageARB): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetCompressedTexImageARB)) + JMP(GL_OFFSET(_gloffset_GetCompressedTexImageARB)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(BlendColorEXT)) GL_PREFIX(BlendColorEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendColor)) + JZ(GLNAME(_glapi_fallback_BlendColorEXT)) JMP(GL_OFFSET(_gloffset_BlendColor)) ALIGNTEXT16 @@ -3336,7 +3408,7 @@ GLOBL_FN(GL_PREFIX(TexImage3DEXT)) GL_PREFIX(TexImage3DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage3D)) + JZ(GLNAME(_glapi_fallback_TexImage3DEXT)) JMP(GL_OFFSET(_gloffset_TexImage3D)) ALIGNTEXT16 @@ -3344,18 +3416,10 @@ GLOBL_FN(GL_PREFIX(TexSubImage3DEXT)) GL_PREFIX(TexSubImage3DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage3D)) + JZ(GLNAME(_glapi_fallback_TexSubImage3DEXT)) JMP(GL_OFFSET(_gloffset_TexSubImage3D)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage3DEXT)) -GL_PREFIX(CopyTexSubImage3DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage3D)) - JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetTexFilterFuncSGIS)) GL_PREFIX(GetTexFilterFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -3372,19 +3436,11 @@ GL_PREFIX(TexFilterFuncSGIS): JMP(GL_OFFSET(_gloffset_TexFilterFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CopyTexSubImage1DEXT)) -GL_PREFIX(CopyTexSubImage1DEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage1D)) - JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(TexSubImage1DEXT)) GL_PREFIX(TexSubImage1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage1D)) + JZ(GLNAME(_glapi_fallback_TexSubImage1DEXT)) JMP(GL_OFFSET(_gloffset_TexSubImage1D)) ALIGNTEXT16 @@ -3392,7 +3448,7 @@ GLOBL_FN(GL_PREFIX(TexSubImage2DEXT)) GL_PREFIX(TexSubImage2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage2D)) + JZ(GLNAME(_glapi_fallback_TexSubImage2DEXT)) JMP(GL_OFFSET(_gloffset_TexSubImage2D)) ALIGNTEXT16 @@ -3400,7 +3456,7 @@ GLOBL_FN(GL_PREFIX(CopyTexImage1DEXT)) GL_PREFIX(CopyTexImage1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexImage1D)) + JZ(GLNAME(_glapi_fallback_CopyTexImage1DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexImage1D)) ALIGNTEXT16 @@ -3408,18 +3464,34 @@ GLOBL_FN(GL_PREFIX(CopyTexImage2DEXT)) GL_PREFIX(CopyTexImage2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexImage2D)) + JZ(GLNAME(_glapi_fallback_CopyTexImage2DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexImage2D)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CopyTexSubImage1DEXT)) +GL_PREFIX(CopyTexSubImage1DEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CopyTexSubImage1DEXT)) + JMP(GL_OFFSET(_gloffset_CopyTexSubImage1D)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyTexSubImage2DEXT)) GL_PREFIX(CopyTexSubImage2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyTexSubImage2D)) + JZ(GLNAME(_glapi_fallback_CopyTexSubImage2DEXT)) JMP(GL_OFFSET(_gloffset_CopyTexSubImage2D)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(CopyTexSubImage3DEXT)) +GL_PREFIX(CopyTexSubImage3DEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_CopyTexSubImage3DEXT)) + JMP(GL_OFFSET(_gloffset_CopyTexSubImage3D)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetHistogramEXT)) GL_PREFIX(GetHistogramEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -3472,7 +3544,7 @@ GLOBL_FN(GL_PREFIX(HistogramEXT)) GL_PREFIX(HistogramEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Histogram)) + JZ(GLNAME(_glapi_fallback_HistogramEXT)) JMP(GL_OFFSET(_gloffset_Histogram)) ALIGNTEXT16 @@ -3480,7 +3552,7 @@ GLOBL_FN(GL_PREFIX(MinmaxEXT)) GL_PREFIX(MinmaxEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_Minmax)) + JZ(GLNAME(_glapi_fallback_MinmaxEXT)) JMP(GL_OFFSET(_gloffset_Minmax)) ALIGNTEXT16 @@ -3488,7 +3560,7 @@ GLOBL_FN(GL_PREFIX(ResetHistogramEXT)) GL_PREFIX(ResetHistogramEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetHistogram)) + JZ(GLNAME(_glapi_fallback_ResetHistogramEXT)) JMP(GL_OFFSET(_gloffset_ResetHistogram)) ALIGNTEXT16 @@ -3496,7 +3568,7 @@ GLOBL_FN(GL_PREFIX(ResetMinmaxEXT)) GL_PREFIX(ResetMinmaxEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResetMinmax)) + JZ(GLNAME(_glapi_fallback_ResetMinmaxEXT)) JMP(GL_OFFSET(_gloffset_ResetMinmax)) ALIGNTEXT16 @@ -3504,7 +3576,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionFilter1DEXT)) GL_PREFIX(ConvolutionFilter1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionFilter1D)) + JZ(GLNAME(_glapi_fallback_ConvolutionFilter1DEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionFilter1D)) ALIGNTEXT16 @@ -3512,7 +3584,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionFilter2DEXT)) GL_PREFIX(ConvolutionFilter2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionFilter2D)) + JZ(GLNAME(_glapi_fallback_ConvolutionFilter2DEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionFilter2D)) ALIGNTEXT16 @@ -3520,7 +3592,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionParameterfEXT)) GL_PREFIX(ConvolutionParameterfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameterf)) + JZ(GLNAME(_glapi_fallback_ConvolutionParameterfEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameterf)) ALIGNTEXT16 @@ -3528,7 +3600,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionParameterfvEXT)) GL_PREFIX(ConvolutionParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameterfv)) + JZ(GLNAME(_glapi_fallback_ConvolutionParameterfvEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameterfv)) ALIGNTEXT16 @@ -3536,7 +3608,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionParameteriEXT)) GL_PREFIX(ConvolutionParameteriEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameteri)) + JZ(GLNAME(_glapi_fallback_ConvolutionParameteriEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameteri)) ALIGNTEXT16 @@ -3544,7 +3616,7 @@ GLOBL_FN(GL_PREFIX(ConvolutionParameterivEXT)) GL_PREFIX(ConvolutionParameterivEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ConvolutionParameteriv)) + JZ(GLNAME(_glapi_fallback_ConvolutionParameterivEXT)) JMP(GL_OFFSET(_gloffset_ConvolutionParameteriv)) ALIGNTEXT16 @@ -3552,7 +3624,7 @@ GLOBL_FN(GL_PREFIX(CopyConvolutionFilter1DEXT)) GL_PREFIX(CopyConvolutionFilter1DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter1D)) + JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter1DEXT)) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter1D)) ALIGNTEXT16 @@ -3560,7 +3632,7 @@ GLOBL_FN(GL_PREFIX(CopyConvolutionFilter2DEXT)) GL_PREFIX(CopyConvolutionFilter2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter2D)) + JZ(GLNAME(_glapi_fallback_CopyConvolutionFilter2DEXT)) JMP(GL_OFFSET(_gloffset_CopyConvolutionFilter2D)) ALIGNTEXT16 @@ -3600,15 +3672,23 @@ GLOBL_FN(GL_PREFIX(SeparableFilter2DEXT)) GL_PREFIX(SeparableFilter2DEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SeparableFilter2D)) + JZ(GLNAME(_glapi_fallback_SeparableFilter2DEXT)) JMP(GL_OFFSET(_gloffset_SeparableFilter2D)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ColorTableSGI)) +GL_PREFIX(ColorTableSGI): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ColorTableSGI)) + JMP(GL_OFFSET(_gloffset_ColorTable)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ColorTableParameterfvSGI)) GL_PREFIX(ColorTableParameterfvSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameterfv)) + JZ(GLNAME(_glapi_fallback_ColorTableParameterfvSGI)) JMP(GL_OFFSET(_gloffset_ColorTableParameterfv)) ALIGNTEXT16 @@ -3616,23 +3696,15 @@ GLOBL_FN(GL_PREFIX(ColorTableParameterivSGI)) GL_PREFIX(ColorTableParameterivSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTableParameteriv)) + JZ(GLNAME(_glapi_fallback_ColorTableParameterivSGI)) JMP(GL_OFFSET(_gloffset_ColorTableParameteriv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableSGI)) -GL_PREFIX(ColorTableSGI): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTable)) - JMP(GL_OFFSET(_gloffset_ColorTable)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorTableSGI)) GL_PREFIX(CopyColorTableSGI): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorTable)) + JZ(GLNAME(_glapi_fallback_CopyColorTableSGI)) JMP(GL_OFFSET(_gloffset_CopyColorTable)) ALIGNTEXT16 @@ -3660,493 +3732,324 @@ GL_PREFIX(GetColorTableParameterivSGI): JMP(GL_OFFSET(_gloffset_GetColorTableParameterivSGI)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GenTexturesEXT)) -GL_PREFIX(GenTexturesEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenSGIX)) +GL_PREFIX(PixelTexGenSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GenTexturesEXT)) - JMP(GL_OFFSET(_gloffset_GenTexturesEXT)) + JZ(GLNAME(_glapi_fallback_PixelTexGenSGIX)) + JMP(GL_OFFSET(_gloffset_PixelTexGenSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DeleteTexturesEXT)) -GL_PREFIX(DeleteTexturesEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DeleteTextures)) - JMP(GL_OFFSET(_gloffset_DeleteTextures)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BindTextureEXT)) -GL_PREFIX(BindTextureEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BindTexture)) - JMP(GL_OFFSET(_gloffset_BindTexture)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PrioritizeTexturesEXT)) -GL_PREFIX(PrioritizeTexturesEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PrioritizeTextures)) - JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(AreTexturesResidentEXT)) -GL_PREFIX(AreTexturesResidentEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenParameteriSGIS)) +GL_PREFIX(PixelTexGenParameteriSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_AreTexturesResidentEXT)) - JMP(GL_OFFSET(_gloffset_AreTexturesResidentEXT)) + JZ(GLNAME(_glapi_fallback_PixelTexGenParameteriSGIS)) + JMP(GL_OFFSET(_gloffset_PixelTexGenParameteriSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IsTextureEXT)) -GL_PREFIX(IsTextureEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenParameterivSGIS)) +GL_PREFIX(PixelTexGenParameterivSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_IsTextureEXT)) - JMP(GL_OFFSET(_gloffset_IsTextureEXT)) + JZ(GLNAME(_glapi_fallback_PixelTexGenParameterivSGIS)) + JMP(GL_OFFSET(_gloffset_PixelTexGenParameterivSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendEquationEXT)) -GL_PREFIX(BlendEquationEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenParameterfSGIS)) +GL_PREFIX(PixelTexGenParameterfSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendEquation)) - JMP(GL_OFFSET(_gloffset_BlendEquation)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexPointerEXT)) -GL_PREFIX(VertexPointerEXT): - JMP(GLNAME(_glapi_fallback_VertexPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(NormalPointerEXT)) -GL_PREFIX(NormalPointerEXT): - JMP(GLNAME(_glapi_fallback_NormalPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorPointerEXT)) -GL_PREFIX(ColorPointerEXT): - JMP(GLNAME(_glapi_fallback_ColorPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(IndexPointerEXT)) -GL_PREFIX(IndexPointerEXT): - JMP(GLNAME(_glapi_fallback_IndexPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexCoordPointerEXT)) -GL_PREFIX(TexCoordPointerEXT): - JMP(GLNAME(_glapi_fallback_TexCoordPointerEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(EdgeFlagPointerEXT)) -GL_PREFIX(EdgeFlagPointerEXT): - JMP(GLNAME(_glapi_fallback_EdgeFlagPointerEXT)) + JZ(GLNAME(_glapi_fallback_PixelTexGenParameterfSGIS)) + JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPointervEXT)) -GL_PREFIX(GetPointervEXT): +GLOBL_FN(GL_PREFIX(PixelTexGenParameterfvSGIS)) +GL_PREFIX(PixelTexGenParameterfvSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPointerv)) - JMP(GL_OFFSET(_gloffset_GetPointerv)) + JZ(GLNAME(_glapi_fallback_PixelTexGenParameterfvSGIS)) + JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfvSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ArrayElementEXT)) -GL_PREFIX(ArrayElementEXT): +GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterivSGIS)) +GL_PREFIX(GetPixelTexGenParameterivSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ArrayElement)) - JMP(GL_OFFSET(_gloffset_ArrayElement)) + JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterivSGIS)) + JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterivSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DrawArraysEXT)) -GL_PREFIX(DrawArraysEXT): +GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterfvSGIS)) +GL_PREFIX(GetPixelTexGenParameterfvSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DrawArrays)) - JMP(GL_OFFSET(_gloffset_DrawArrays)) + JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterfvSGIS)) + JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterfvSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfEXT)) -GL_PREFIX(PointParameterfEXT): +GLOBL_FN(GL_PREFIX(TexImage4DSGIS)) +GL_PREFIX(TexImage4DSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointParameterfEXT)) - JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) + JZ(GLNAME(_glapi_fallback_TexImage4DSGIS)) + JMP(GL_OFFSET(_gloffset_TexImage4DSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PointParameterfvEXT)) -GL_PREFIX(PointParameterfvEXT): +GLOBL_FN(GL_PREFIX(TexSubImage4DSGIS)) +GL_PREFIX(TexSubImage4DSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PointParameterfvEXT)) - JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) + JZ(GLNAME(_glapi_fallback_TexSubImage4DSGIS)) + JMP(GL_OFFSET(_gloffset_TexSubImage4DSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(HintPGI)) -GL_PREFIX(HintPGI): +GLOBL_FN(GL_PREFIX(AreTexturesResidentEXT)) +GL_PREFIX(AreTexturesResidentEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_HintPGI)) - JMP(GL_OFFSET(_gloffset_HintPGI)) + JZ(GLNAME(_glapi_fallback_AreTexturesResidentEXT)) + JMP(GL_OFFSET(_gloffset_AreTexturesResidentEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorTableEXT)) -GL_PREFIX(ColorTableEXT): +GLOBL_FN(GL_PREFIX(BindTextureEXT)) +GL_PREFIX(BindTextureEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorTable)) - JMP(GL_OFFSET(_gloffset_ColorTable)) + JZ(GLNAME(_glapi_fallback_BindTextureEXT)) + JMP(GL_OFFSET(_gloffset_BindTexture)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ColorSubTableEXT)) -GL_PREFIX(ColorSubTableEXT): +GLOBL_FN(GL_PREFIX(DeleteTexturesEXT)) +GL_PREFIX(DeleteTexturesEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ColorSubTable)) - JMP(GL_OFFSET(_gloffset_ColorSubTable)) + JZ(GLNAME(_glapi_fallback_DeleteTexturesEXT)) + JMP(GL_OFFSET(_gloffset_DeleteTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableEXT)) -GL_PREFIX(GetColorTableEXT): +GLOBL_FN(GL_PREFIX(GenTexturesEXT)) +GL_PREFIX(GenTexturesEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableEXT)) - JMP(GL_OFFSET(_gloffset_GetColorTableEXT)) + JZ(GLNAME(_glapi_fallback_GenTexturesEXT)) + JMP(GL_OFFSET(_gloffset_GenTexturesEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterfvEXT)) -GL_PREFIX(GetColorTableParameterfvEXT): +GLOBL_FN(GL_PREFIX(IsTextureEXT)) +GL_PREFIX(IsTextureEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterfvEXT)) - JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvEXT)) + JZ(GLNAME(_glapi_fallback_IsTextureEXT)) + JMP(GL_OFFSET(_gloffset_IsTextureEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetColorTableParameterivEXT)) -GL_PREFIX(GetColorTableParameterivEXT): +GLOBL_FN(GL_PREFIX(PrioritizeTexturesEXT)) +GL_PREFIX(PrioritizeTexturesEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetColorTableParameterivEXT)) - JMP(GL_OFFSET(_gloffset_GetColorTableParameterivEXT)) + JZ(GLNAME(_glapi_fallback_PrioritizeTexturesEXT)) + JMP(GL_OFFSET(_gloffset_PrioritizeTextures)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LockArraysEXT)) -GL_PREFIX(LockArraysEXT): +GLOBL_FN(GL_PREFIX(DetailTexFuncSGIS)) +GL_PREFIX(DetailTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LockArraysEXT)) - JMP(GL_OFFSET(_gloffset_LockArraysEXT)) + JZ(GLNAME(_glapi_fallback_DetailTexFuncSGIS)) + JMP(GL_OFFSET(_gloffset_DetailTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(UnlockArraysEXT)) -GL_PREFIX(UnlockArraysEXT): +GLOBL_FN(GL_PREFIX(GetDetailTexFuncSGIS)) +GL_PREFIX(GetDetailTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_UnlockArraysEXT)) - JMP(GL_OFFSET(_gloffset_UnlockArraysEXT)) + JZ(GLNAME(_glapi_fallback_GetDetailTexFuncSGIS)) + JMP(GL_OFFSET(_gloffset_GetDetailTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(BlendFuncSeparateINGR)) -GL_PREFIX(BlendFuncSeparateINGR): +GLOBL_FN(GL_PREFIX(SharpenTexFuncSGIS)) +GL_PREFIX(SharpenTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_BlendFuncSeparateEXT)) - JMP(GL_OFFSET(_gloffset_BlendFuncSeparateEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2iMESA)) -GL_PREFIX(WindowPos2iMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2iMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2sMESA)) -GL_PREFIX(WindowPos2sMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2sMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2fMESA)) -GL_PREFIX(WindowPos2fMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2fMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2dMESA)) -GL_PREFIX(WindowPos2dMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2dMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2ivMESA)) -GL_PREFIX(WindowPos2ivMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2ivMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2svMESA)) -GL_PREFIX(WindowPos2svMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2svMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2fvMESA)) -GL_PREFIX(WindowPos2fvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2fvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos2dvMESA)) -GL_PREFIX(WindowPos2dvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos2dvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3iMESA)) -GL_PREFIX(WindowPos3iMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3iMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3sMESA)) -GL_PREFIX(WindowPos3sMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3sMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3fMESA)) -GL_PREFIX(WindowPos3fMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3fMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3dMESA)) -GL_PREFIX(WindowPos3dMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3dMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3ivMESA)) -GL_PREFIX(WindowPos3ivMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3ivMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3svMESA)) -GL_PREFIX(WindowPos3svMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3svMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3fvMESA)) -GL_PREFIX(WindowPos3fvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3fvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos3dvMESA)) -GL_PREFIX(WindowPos3dvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos3dvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4iMESA)) -GL_PREFIX(WindowPos4iMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4iMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4sMESA)) -GL_PREFIX(WindowPos4sMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4sMESA)) + JZ(GLNAME(_glapi_fallback_SharpenTexFuncSGIS)) + JMP(GL_OFFSET(_gloffset_SharpenTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4fMESA)) -GL_PREFIX(WindowPos4fMESA): +GLOBL_FN(GL_PREFIX(GetSharpenTexFuncSGIS)) +GL_PREFIX(GetSharpenTexFuncSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_WindowPos4fMESA)) - JMP(GL_OFFSET(_gloffset_WindowPos4fMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4dMESA)) -GL_PREFIX(WindowPos4dMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4dMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4ivMESA)) -GL_PREFIX(WindowPos4ivMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4ivMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4svMESA)) -GL_PREFIX(WindowPos4svMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4svMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4fvMESA)) -GL_PREFIX(WindowPos4fvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4fvMESA)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(WindowPos4dvMESA)) -GL_PREFIX(WindowPos4dvMESA): - JMP(GLNAME(_glapi_fallback_WindowPos4dvMESA)) + JZ(GLNAME(_glapi_fallback_GetSharpenTexFuncSGIS)) + JMP(GL_OFFSET(_gloffset_GetSharpenTexFuncSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(ResizeBuffersMESA)) -GL_PREFIX(ResizeBuffersMESA): +GLOBL_FN(GL_PREFIX(SampleMaskSGIS)) +GL_PREFIX(SampleMaskSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_ResizeBuffersMESA)) - JMP(GL_OFFSET(_gloffset_ResizeBuffersMESA)) + JZ(GLNAME(_glapi_fallback_SampleMaskSGIS)) + JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixdARB)) -GL_PREFIX(LoadTransposeMatrixdARB): +GLOBL_FN(GL_PREFIX(SamplePatternSGIS)) +GL_PREFIX(SamplePatternSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixdARB)) - JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixdARB)) + JZ(GLNAME(_glapi_fallback_SamplePatternSGIS)) + JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(LoadTransposeMatrixfARB)) -GL_PREFIX(LoadTransposeMatrixfARB): +GLOBL_FN(GL_PREFIX(ArrayElementEXT)) +GL_PREFIX(ArrayElementEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_LoadTransposeMatrixfARB)) - JMP(GL_OFFSET(_gloffset_LoadTransposeMatrixfARB)) + JZ(GLNAME(_glapi_fallback_ArrayElementEXT)) + JMP(GL_OFFSET(_gloffset_ArrayElement)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixdARB)) -GL_PREFIX(MultTransposeMatrixdARB): +GLOBL_FN(GL_PREFIX(ColorPointerEXT)) +GL_PREFIX(ColorPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultTransposeMatrixdARB)) - JMP(GL_OFFSET(_gloffset_MultTransposeMatrixdARB)) + JZ(GLNAME(_glapi_fallback_ColorPointerEXT)) + JMP(GL_OFFSET(_gloffset_ColorPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(MultTransposeMatrixfARB)) -GL_PREFIX(MultTransposeMatrixfARB): +GLOBL_FN(GL_PREFIX(DrawArraysEXT)) +GL_PREFIX(DrawArraysEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_MultTransposeMatrixfARB)) - JMP(GL_OFFSET(_gloffset_MultTransposeMatrixfARB)) + JZ(GLNAME(_glapi_fallback_DrawArraysEXT)) + JMP(GL_OFFSET(_gloffset_DrawArrays)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTexGenParameterfSGIS)) -GL_PREFIX(PixelTexGenParameterfSGIS): +GLOBL_FN(GL_PREFIX(EdgeFlagPointerEXT)) +GL_PREFIX(EdgeFlagPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTexGenParameterfSGIS)) - JMP(GL_OFFSET(_gloffset_PixelTexGenParameterfSGIS)) + JZ(GLNAME(_glapi_fallback_EdgeFlagPointerEXT)) + JMP(GL_OFFSET(_gloffset_EdgeFlagPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PixelTexGenParameteriSGIS)) -GL_PREFIX(PixelTexGenParameteriSGIS): +GLOBL_FN(GL_PREFIX(GetPointervEXT)) +GL_PREFIX(GetPointervEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PixelTexGenParameteriSGIS)) - JMP(GL_OFFSET(_gloffset_PixelTexGenParameteriSGIS)) + JZ(GLNAME(_glapi_fallback_GetPointervEXT)) + JMP(GL_OFFSET(_gloffset_GetPointerv)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterfvSGIS)) -GL_PREFIX(GetPixelTexGenParameterfvSGIS): +GLOBL_FN(GL_PREFIX(IndexPointerEXT)) +GL_PREFIX(IndexPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterfvSGIS)) - JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterfvSGIS)) + JZ(GLNAME(_glapi_fallback_IndexPointerEXT)) + JMP(GL_OFFSET(_gloffset_IndexPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetPixelTexGenParameterivSGIS)) -GL_PREFIX(GetPixelTexGenParameterivSGIS): +GLOBL_FN(GL_PREFIX(NormalPointerEXT)) +GL_PREFIX(NormalPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetPixelTexGenParameterivSGIS)) - JMP(GL_OFFSET(_gloffset_GetPixelTexGenParameterivSGIS)) + JZ(GLNAME(_glapi_fallback_NormalPointerEXT)) + JMP(GL_OFFSET(_gloffset_NormalPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexImage4DSGIS)) -GL_PREFIX(TexImage4DSGIS): +GLOBL_FN(GL_PREFIX(TexCoordPointerEXT)) +GL_PREFIX(TexCoordPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexImage4DSGIS)) - JMP(GL_OFFSET(_gloffset_TexImage4DSGIS)) + JZ(GLNAME(_glapi_fallback_TexCoordPointerEXT)) + JMP(GL_OFFSET(_gloffset_TexCoordPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TexSubImage4DSGIS)) -GL_PREFIX(TexSubImage4DSGIS): +GLOBL_FN(GL_PREFIX(VertexPointerEXT)) +GL_PREFIX(VertexPointerEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TexSubImage4DSGIS)) - JMP(GL_OFFSET(_gloffset_TexSubImage4DSGIS)) + JZ(GLNAME(_glapi_fallback_VertexPointerEXT)) + JMP(GL_OFFSET(_gloffset_VertexPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(DetailTexFuncSGIS)) -GL_PREFIX(DetailTexFuncSGIS): +GLOBL_FN(GL_PREFIX(BlendEquationEXT)) +GL_PREFIX(BlendEquationEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_DetailTexFuncSGIS)) - JMP(GL_OFFSET(_gloffset_DetailTexFuncSGIS)) + JZ(GLNAME(_glapi_fallback_BlendEquationEXT)) + JMP(GL_OFFSET(_gloffset_BlendEquation)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetDetailTexFuncSGIS)) -GL_PREFIX(GetDetailTexFuncSGIS): +GLOBL_FN(GL_PREFIX(SpriteParameterfSGIX)) +GL_PREFIX(SpriteParameterfSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetDetailTexFuncSGIS)) - JMP(GL_OFFSET(_gloffset_GetDetailTexFuncSGIS)) + JZ(GLNAME(_glapi_fallback_SpriteParameterfSGIX)) + JMP(GL_OFFSET(_gloffset_SpriteParameterfSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetSharpenTexFuncSGIS)) -GL_PREFIX(GetSharpenTexFuncSGIS): +GLOBL_FN(GL_PREFIX(SpriteParameterfvSGIX)) +GL_PREFIX(SpriteParameterfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetSharpenTexFuncSGIS)) - JMP(GL_OFFSET(_gloffset_GetSharpenTexFuncSGIS)) + JZ(GLNAME(_glapi_fallback_SpriteParameterfvSGIX)) + JMP(GL_OFFSET(_gloffset_SpriteParameterfvSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SharpenTexFuncSGIS)) -GL_PREFIX(SharpenTexFuncSGIS): +GLOBL_FN(GL_PREFIX(SpriteParameteriSGIX)) +GL_PREFIX(SpriteParameteriSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SharpenTexFuncSGIS)) - JMP(GL_OFFSET(_gloffset_SharpenTexFuncSGIS)) + JZ(GLNAME(_glapi_fallback_SpriteParameteriSGIX)) + JMP(GL_OFFSET(_gloffset_SpriteParameteriSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SampleMaskSGIS)) -GL_PREFIX(SampleMaskSGIS): +GLOBL_FN(GL_PREFIX(SpriteParameterivSGIX)) +GL_PREFIX(SpriteParameterivSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SampleMaskSGIS)) - JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) + JZ(GLNAME(_glapi_fallback_SpriteParameterivSGIX)) + JMP(GL_OFFSET(_gloffset_SpriteParameterivSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SamplePatternSGIS)) -GL_PREFIX(SamplePatternSGIS): +GLOBL_FN(GL_PREFIX(PointParameterfEXT)) +GL_PREFIX(PointParameterfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SamplePatternSGIS)) - JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) + JZ(GLNAME(_glapi_fallback_PointParameterfEXT)) + JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameterfSGIX)) -GL_PREFIX(SpriteParameterfSGIX): +GLOBL_FN(GL_PREFIX(PointParameterfvEXT)) +GL_PREFIX(PointParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameterfSGIX)) - JMP(GL_OFFSET(_gloffset_SpriteParameterfSGIX)) + JZ(GLNAME(_glapi_fallback_PointParameterfvEXT)) + JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameteriSGIX)) -GL_PREFIX(SpriteParameteriSGIX): +GLOBL_FN(GL_PREFIX(PointParameterfSGIS)) +GL_PREFIX(PointParameterfSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameteriSGIX)) - JMP(GL_OFFSET(_gloffset_SpriteParameteriSGIX)) + JZ(GLNAME(_glapi_fallback_PointParameterfSGIS)) + JMP(GL_OFFSET(_gloffset_PointParameterfEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameterfvSGIX)) -GL_PREFIX(SpriteParameterfvSGIX): +GLOBL_FN(GL_PREFIX(PointParameterfvSGIS)) +GL_PREFIX(PointParameterfvSGIS): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameterfvSGIX)) - JMP(GL_OFFSET(_gloffset_SpriteParameterfvSGIX)) + JZ(GLNAME(_glapi_fallback_PointParameterfvSGIS)) + JMP(GL_OFFSET(_gloffset_PointParameterfvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SpriteParameterivSGIX)) -GL_PREFIX(SpriteParameterivSGIX): +GLOBL_FN(GL_PREFIX(GetInstrumentsSGIX)) +GL_PREFIX(GetInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SpriteParameterivSGIX)) - JMP(GL_OFFSET(_gloffset_SpriteParameterivSGIX)) + JZ(GLNAME(_glapi_fallback_GetInstrumentsSGIX)) + JMP(GL_OFFSET(_gloffset_GetInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(InstrumentsBufferSGIX)) @@ -4157,20 +4060,12 @@ GL_PREFIX(InstrumentsBufferSGIX): JMP(GL_OFFSET(_gloffset_InstrumentsBufferSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StartInstrumentsSGIX)) -GL_PREFIX(StartInstrumentsSGIX): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StartInstrumentsSGIX)) - JMP(GL_OFFSET(_gloffset_StartInstrumentsSGIX)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(StopInstrumentsSGIX)) -GL_PREFIX(StopInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(PollInstrumentsSGIX)) +GL_PREFIX(PollInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_StopInstrumentsSGIX)) - JMP(GL_OFFSET(_gloffset_StopInstrumentsSGIX)) + JZ(GLNAME(_glapi_fallback_PollInstrumentsSGIX)) + JMP(GL_OFFSET(_gloffset_PollInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReadInstrumentsSGIX)) @@ -4181,20 +4076,20 @@ GL_PREFIX(ReadInstrumentsSGIX): JMP(GL_OFFSET(_gloffset_ReadInstrumentsSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(PollInstrumentsSGIX)) -GL_PREFIX(PollInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(StartInstrumentsSGIX)) +GL_PREFIX(StartInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_PollInstrumentsSGIX)) - JMP(GL_OFFSET(_gloffset_PollInstrumentsSGIX)) + JZ(GLNAME(_glapi_fallback_StartInstrumentsSGIX)) + JMP(GL_OFFSET(_gloffset_StartInstrumentsSGIX)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(GetInstrumentsSGIX)) -GL_PREFIX(GetInstrumentsSGIX): +GLOBL_FN(GL_PREFIX(StopInstrumentsSGIX)) +GL_PREFIX(StopInstrumentsSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_GetInstrumentsSGIX)) - JMP(GL_OFFSET(_gloffset_GetInstrumentsSGIX)) + JZ(GLNAME(_glapi_fallback_StopInstrumentsSGIX)) + JMP(GL_OFFSET(_gloffset_StopInstrumentsSGIX)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FrameZoomSGIX)) @@ -4205,6 +4100,14 @@ GL_PREFIX(FrameZoomSGIX): JMP(GL_OFFSET(_gloffset_FrameZoomSGIX)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(TagSampleBufferSGIX)) +GL_PREFIX(TagSampleBufferSGIX): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_TagSampleBufferSGIX)) + JMP(GL_OFFSET(_gloffset_TagSampleBufferSGIX)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(ReferencePlaneSGIX)) GL_PREFIX(ReferencePlaneSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4221,14 +4124,62 @@ GL_PREFIX(FlushRasterSGIX): JMP(GL_OFFSET(_gloffset_FlushRasterSGIX)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ColorSubTableEXT)) +GL_PREFIX(ColorSubTableEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ColorSubTableEXT)) + JMP(GL_OFFSET(_gloffset_ColorSubTable)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CopyColorSubTableEXT)) GL_PREFIX(CopyColorSubTableEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CopyColorSubTable)) + JZ(GLNAME(_glapi_fallback_CopyColorSubTableEXT)) JMP(GL_OFFSET(_gloffset_CopyColorSubTable)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(HintPGI)) +GL_PREFIX(HintPGI): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_HintPGI)) + JMP(GL_OFFSET(_gloffset_HintPGI)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ColorTableEXT)) +GL_PREFIX(ColorTableEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ColorTableEXT)) + JMP(GL_OFFSET(_gloffset_ColorTable)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetColorTableEXT)) +GL_PREFIX(GetColorTableEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetColorTableEXT)) + JMP(GL_OFFSET(_gloffset_GetColorTableEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetColorTableParameterivEXT)) +GL_PREFIX(GetColorTableParameterivEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetColorTableParameterivEXT)) + JMP(GL_OFFSET(_gloffset_GetColorTableParameterivEXT)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(GetColorTableParameterfvEXT)) +GL_PREFIX(GetColorTableParameterfvEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_GetColorTableParameterfvEXT)) + JMP(GL_OFFSET(_gloffset_GetColorTableParameterfvEXT)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(GetListParameterfvSGIX)) GL_PREFIX(GetListParameterfvSGIX): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4293,44 +4244,36 @@ GL_PREFIX(IndexFuncEXT): JMP(GL_OFFSET(_gloffset_IndexFuncEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CullParameterdvEXT)) -GL_PREFIX(CullParameterdvEXT): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CullParameterdvEXT)) - JMP(GL_OFFSET(_gloffset_CullParameterdvEXT)) - -ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(CullParameterfvEXT)) -GL_PREFIX(CullParameterfvEXT): +GLOBL_FN(GL_PREFIX(LockArraysEXT)) +GL_PREFIX(LockArraysEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_CullParameterfvEXT)) - JMP(GL_OFFSET(_gloffset_CullParameterfvEXT)) + JZ(GLNAME(_glapi_fallback_LockArraysEXT)) + JMP(GL_OFFSET(_gloffset_LockArraysEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SampleCoverageARB)) -GL_PREFIX(SampleCoverageARB): +GLOBL_FN(GL_PREFIX(UnlockArraysEXT)) +GL_PREFIX(UnlockArraysEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SampleCoverageARB)) - JMP(GL_OFFSET(_gloffset_SampleCoverageARB)) + JZ(GLNAME(_glapi_fallback_UnlockArraysEXT)) + JMP(GL_OFFSET(_gloffset_UnlockArraysEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(SamplePassARB)) -GL_PREFIX(SamplePassARB): +GLOBL_FN(GL_PREFIX(CullParameterdvEXT)) +GL_PREFIX(CullParameterdvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_SamplePassARB)) - JMP(GL_OFFSET(_gloffset_SamplePassARB)) + JZ(GLNAME(_glapi_fallback_CullParameterdvEXT)) + JMP(GL_OFFSET(_gloffset_CullParameterdvEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(TagSampleBufferSGIX)) -GL_PREFIX(TagSampleBufferSGIX): +GLOBL_FN(GL_PREFIX(CullParameterfvEXT)) +GL_PREFIX(CullParameterfvEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_TagSampleBufferSGIX)) - JMP(GL_OFFSET(_gloffset_TagSampleBufferSGIX)) + JZ(GLNAME(_glapi_fallback_CullParameterfvEXT)) + JMP(GL_OFFSET(_gloffset_CullParameterfvEXT)) ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FragmentColorMaterialSGIX)) @@ -4477,6 +4420,14 @@ GL_PREFIX(LightEnviSGIX): JMP(GL_OFFSET(_gloffset_LightEnviSGIX)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(DrawRangeElementsEXT)) +GL_PREFIX(DrawRangeElementsEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_DrawRangeElementsEXT)) + JMP(GL_OFFSET(_gloffset_DrawRangeElements)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FogCoordfEXT)) GL_PREFIX(FogCoordfEXT): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4549,14 +4500,6 @@ GL_PREFIX(VertexWeightPointerEXT): JMP(GL_OFFSET(_gloffset_VertexWeightPointerEXT)) ALIGNTEXT16 -GLOBL_FN(GL_PREFIX(VertexArrayRangeNV)) -GL_PREFIX(VertexArrayRangeNV): - MOV_L(GLNAME(_glapi_Dispatch), EAX) - TEST_L(EAX, EAX) - JZ(GLNAME(_glapi_fallback_VertexArrayRangeNV)) - JMP(GL_OFFSET(_gloffset_VertexArrayRangeNV)) - -ALIGNTEXT16 GLOBL_FN(GL_PREFIX(FlushVertexArrayRangeNV)) GL_PREFIX(FlushVertexArrayRangeNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4565,6 +4508,14 @@ GL_PREFIX(FlushVertexArrayRangeNV): JMP(GL_OFFSET(_gloffset_FlushVertexArrayRangeNV)) ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(VertexArrayRangeNV)) +GL_PREFIX(VertexArrayRangeNV): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_VertexArrayRangeNV)) + JMP(GL_OFFSET(_gloffset_VertexArrayRangeNV)) + +ALIGNTEXT16 GLOBL_FN(GL_PREFIX(CombinerParameterfvNV)) GL_PREFIX(CombinerParameterfvNV): MOV_L(GLNAME(_glapi_Dispatch), EAX) @@ -4668,4 +4619,229 @@ GL_PREFIX(GetFinalCombinerInputParameterivNV): JZ(GLNAME(_glapi_fallback_GetFinalCombinerInputParameterivNV)) JMP(GL_OFFSET(_gloffset_GetFinalCombinerInputParameterivNV)) +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(ResizeBuffersMESA)) +GL_PREFIX(ResizeBuffersMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_ResizeBuffersMESA)) + JMP(GL_OFFSET(_gloffset_ResizeBuffersMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2dMESA)) +GL_PREFIX(WindowPos2dMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2dMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2dMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2dvMESA)) +GL_PREFIX(WindowPos2dvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2dvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2dvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2fMESA)) +GL_PREFIX(WindowPos2fMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2fMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2fMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2fvMESA)) +GL_PREFIX(WindowPos2fvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2fvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2fvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2iMESA)) +GL_PREFIX(WindowPos2iMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2iMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2iMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2ivMESA)) +GL_PREFIX(WindowPos2ivMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2ivMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2ivMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2sMESA)) +GL_PREFIX(WindowPos2sMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2sMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2sMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos2svMESA)) +GL_PREFIX(WindowPos2svMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos2svMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos2svMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3dMESA)) +GL_PREFIX(WindowPos3dMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3dMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3dMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3dvMESA)) +GL_PREFIX(WindowPos3dvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3dvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3dvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3fMESA)) +GL_PREFIX(WindowPos3fMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3fMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3fMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3fvMESA)) +GL_PREFIX(WindowPos3fvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3fvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3fvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3iMESA)) +GL_PREFIX(WindowPos3iMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3iMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3iMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3ivMESA)) +GL_PREFIX(WindowPos3ivMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3ivMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3ivMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3sMESA)) +GL_PREFIX(WindowPos3sMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3sMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3sMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos3svMESA)) +GL_PREFIX(WindowPos3svMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos3svMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos3svMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4dMESA)) +GL_PREFIX(WindowPos4dMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4dMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4dMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4dvMESA)) +GL_PREFIX(WindowPos4dvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4dvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4dvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4fMESA)) +GL_PREFIX(WindowPos4fMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4fMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4fMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4fvMESA)) +GL_PREFIX(WindowPos4fvMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4fvMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4fvMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4iMESA)) +GL_PREFIX(WindowPos4iMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4iMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4iMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4ivMESA)) +GL_PREFIX(WindowPos4ivMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4ivMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4ivMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4sMESA)) +GL_PREFIX(WindowPos4sMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4sMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4sMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(WindowPos4svMESA)) +GL_PREFIX(WindowPos4svMESA): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_WindowPos4svMESA)) + JMP(GL_OFFSET(_gloffset_WindowPos4svMESA)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(TbufferMask3DFX)) +GL_PREFIX(TbufferMask3DFX): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_TbufferMask3DFX)) + JMP(GL_OFFSET(_gloffset_TbufferMask3DFX)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SampleMaskEXT)) +GL_PREFIX(SampleMaskEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SampleMaskEXT)) + JMP(GL_OFFSET(_gloffset_SampleMaskSGIS)) + +ALIGNTEXT16 +GLOBL_FN(GL_PREFIX(SamplePatternEXT)) +GL_PREFIX(SamplePatternEXT): + MOV_L(GLNAME(_glapi_Dispatch), EAX) + TEST_L(EAX, EAX) + JZ(GLNAME(_glapi_fallback_SamplePatternEXT)) + JMP(GL_OFFSET(_gloffset_SamplePatternSGIS)) + + #endif /* __WIN32__ */ diff --git a/xc/extras/Mesa/src/X86/vertex_3dnow.S b/xc/extras/Mesa/src/X86/vertex_3dnow.S index e58583195..2c0060362 100644 --- a/xc/extras/Mesa/src/X86/vertex_3dnow.S +++ b/xc/extras/Mesa/src/X86/vertex_3dnow.S @@ -11,7 +11,7 @@ -/*#define MAT_SX 0 accessed by REGIND !! */ +/*#define MAT_SX 0 accessed by REGIND !! */ #define MAT_SY 20 #define MAT_SZ 40 #define MAT_TX 48 diff --git a/xc/extras/Mesa/src/X86/x86.c b/xc/extras/Mesa/src/X86/x86.c index 223cf61c8..1b24811d4 100644 --- a/xc/extras/Mesa/src/X86/x86.c +++ b/xc/extras/Mesa/src/X86/x86.c @@ -28,17 +28,14 @@ */ -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> - +#include "glheader.h" #include "context.h" #include "types.h" #include "vertices.h" #include "xform.h" #include "x86.h" +#ifdef USE_X86_ASM extern void _ASMAPI gl_v16_x86_cliptest_points4(GLfloat *first_vert, GLfloat *last_vert, GLubyte *or_mask, @@ -51,7 +48,7 @@ extern void _ASMAPI gl_v16_x86_general_xform(GLfloat *dest, const GLfloat *src, GLuint src_stride, GLuint count); - +#endif #define XFORM_ARGS GLvector4f *to_vec, \ @@ -85,8 +82,7 @@ extern void _ASMAPI gl_v16_x86_general_xform(GLfloat *dest, gl_transform_tab[cma][vsize][MATRIX_3D] \ = gl_##pfx##_transform_points##vsize##_3d_##masked; -void gl_init_x86_asm_transforms( void ) -{ + #ifdef USE_X86_ASM DECLARE_XFORM_GROUP( x86, 2, raw ) DECLARE_XFORM_GROUP( x86, 3, raw ) @@ -100,8 +96,12 @@ void gl_init_x86_asm_transforms( void ) GLubyte clipMask[], GLubyte *orMask, GLubyte *andMask ); +#endif + - +void gl_init_x86_asm_transforms( void ) +{ +#ifdef USE_X86_ASM ASSIGN_XFORM_GROUP( x86, 0, 2, raw ) ASSIGN_XFORM_GROUP( x86, 0, 3, raw ) ASSIGN_XFORM_GROUP( x86, 0, 4, raw ) @@ -110,6 +110,7 @@ void gl_init_x86_asm_transforms( void ) ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 3, masked ) ASSIGN_XFORM_GROUP( x86, CULL_MASK_ACTIVE, 4, masked ) + /* XXX this function has been found to cause FP overflow exceptions */ gl_clip_tab[4] = gl_x86_cliptest_points4; #ifdef DEBUG diff --git a/xc/extras/Mesa/src/alphabuf.c b/xc/extras/Mesa/src/alphabuf.c index 7bba72b47..6f2332407 100644 --- a/xc/extras/Mesa/src/alphabuf.c +++ b/xc/extras/Mesa/src/alphabuf.c @@ -60,7 +60,7 @@ alloc_alpha_buffers( GLcontext *ctx, GLframebuffer *buf ) { GLint bytes = buf->Width * buf->Height * sizeof(GLubyte); - ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffer); + ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers); if (buf->FrontLeftAlpha) { FREE( buf->FrontLeftAlpha ); @@ -141,7 +141,7 @@ _mesa_clear_alpha_buffers( GLcontext *ctx ) const GLubyte aclear = (GLint) (ctx->Color.ClearColor[3] * 255.0F); GLuint bufferBit; - ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffer); + ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers); ASSERT(ctx->Color.ColorMask[ACOMP]); /* loop over four possible alpha buffers */ diff --git a/xc/extras/Mesa/src/attrib.c b/xc/extras/Mesa/src/attrib.c index 53f59765d..2e750ffdb 100644 --- a/xc/extras/Mesa/src/attrib.c +++ b/xc/extras/Mesa/src/attrib.c @@ -103,7 +103,7 @@ _mesa_PushAttrib(GLbitfield mask) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glPushAttrib"); if (MESA_VERBOSE&VERBOSE_API) - fprintf(stderr, "glPushAttrib %x\n", mask); + fprintf(stderr, "glPushAttrib %x\n", (int)mask); if (ctx->AttribStackDepth>=MAX_ATTRIB_STACK_DEPTH) { gl_error( ctx, GL_STACK_OVERFLOW, "glPushAttrib" ); @@ -166,6 +166,9 @@ _mesa_PushAttrib(GLbitfield mask) attr->ClipPlane[i] = ctx->Transform.ClipEnabled[i]; } attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; + attr->Convolution1D = ctx->Pixel.Convolution1DEnabled; + attr->Convolution2D = ctx->Pixel.Convolution2DEnabled; + attr->Separable2D = ctx->Pixel.Separable2DEnabled; attr->CullFace = ctx->Polygon.CullFlag; attr->DepthTest = ctx->Depth.Test; attr->Dither = ctx->Color.DitherFlag; @@ -176,6 +179,8 @@ _mesa_PushAttrib(GLbitfield mask) attr->Lighting = ctx->Light.Enabled; attr->LineSmooth = ctx->Line.SmoothFlag; attr->LineStipple = ctx->Line.StippleFlag; + attr->Histogram = ctx->Pixel.HistogramEnabled; + attr->MinMax = ctx->Pixel.MinMaxEnabled; attr->IndexLogicOp = ctx->Color.IndexLogicOpEnabled; attr->ColorLogicOp = ctx->Color.ColorLogicOpEnabled; attr->Map1Color4 = ctx->Eval.Map1Color4; @@ -197,6 +202,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->Map2Vertex3 = ctx->Eval.Map2Vertex3; attr->Map2Vertex4 = ctx->Eval.Map2Vertex4; attr->Normalize = ctx->Transform.Normalize; + attr->PixelTexture = ctx->Pixel.PixelTextureEnabled; attr->PointSmooth = ctx->Point.SmoothFlag; attr->PolygonOffsetPoint = ctx->Polygon.OffsetPoint; attr->PolygonOffsetLine = ctx->Polygon.OffsetLine; @@ -422,21 +428,43 @@ _mesa_PopAttrib(void) GLubyte oldAlphaRef = ctx->Color.AlphaRef; GLenum oldBlendSrc = ctx->Color.BlendSrcRGB; GLenum oldBlendDst = ctx->Color.BlendDstRGB; + GLenum oldLogicOp = ctx->Color.LogicOp; MEMCPY( &ctx->Color, attr->data, sizeof(struct gl_colorbuffer_attrib) ); if (ctx->Color.DrawBuffer != oldDrawBuffer) { _mesa_DrawBuffer( ctx->Color.DrawBuffer); } - if ((ctx->Color.AlphaFunc != oldAlphaFunc || - ctx->Color.AlphaRef != oldAlphaRef) && - ctx->Driver.AlphaFunc) - (*ctx->Driver.AlphaFunc)( ctx, ctx->Color.AlphaFunc, - ctx->Color.AlphaRef / 255.0F); if ((ctx->Color.BlendSrcRGB != oldBlendSrc || - ctx->Color.BlendSrcRGB != oldBlendDst) && + ctx->Color.BlendDstRGB != oldBlendDst) && ctx->Driver.BlendFunc) (*ctx->Driver.BlendFunc)( ctx, ctx->Color.BlendSrcRGB, ctx->Color.BlendDstRGB); + if (ctx->Color.LogicOp != oldLogicOp && + ctx->Driver.LogicOpcode) { + ctx->Driver.LogicOpcode( ctx, ctx->Color.LogicOp ); + } + if (ctx->Visual->RGBAflag) { + GLubyte r = (GLint) (ctx->Color.ClearColor[0] * 255.0F); + GLubyte g = (GLint) (ctx->Color.ClearColor[1] * 255.0F); + GLubyte b = (GLint) (ctx->Color.ClearColor[2] * 255.0F); + GLubyte a = (GLint) (ctx->Color.ClearColor[3] * 255.0F); + (*ctx->Driver.ClearColor)( ctx, r, g, b, a ); + if ((ctx->Color.AlphaFunc != oldAlphaFunc || + ctx->Color.AlphaRef != oldAlphaRef) && + ctx->Driver.AlphaFunc) + (*ctx->Driver.AlphaFunc)( ctx, ctx->Color.AlphaFunc, + ctx->Color.AlphaRef / 255.0F); + if (ctx->Driver.ColorMask) { + (*ctx->Driver.ColorMask)(ctx, + ctx->Color.ColorMask[0], + ctx->Color.ColorMask[1], + ctx->Color.ColorMask[2], + ctx->Color.ColorMask[3]); + } + } + else { + (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex); + } } break; case GL_CURRENT_BIT: @@ -482,6 +510,9 @@ _mesa_PopAttrib(void) TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE); TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST); TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER); + TEST_AND_UPDATE(ctx->Pixel.Convolution1DEnabled, enable->Convolution1D, GL_CONVOLUTION_1D); + TEST_AND_UPDATE(ctx->Pixel.Convolution2DEnabled, enable->Convolution2D, GL_CONVOLUTION_2D); + TEST_AND_UPDATE(ctx->Pixel.Separable2DEnabled, enable->Separable2D, GL_SEPARABLE_2D); TEST_AND_UPDATE(ctx->Fog.Enabled, enable->Fog, GL_FOG); TEST_AND_UPDATE(ctx->Light.Enabled, enable->Lighting, GL_LIGHTING); TEST_AND_UPDATE(ctx->Line.SmoothFlag, enable->LineSmooth, GL_LINE_SMOOTH); @@ -508,6 +539,7 @@ _mesa_PopAttrib(void) TEST_AND_UPDATE(ctx->Eval.Map2Vertex4, enable->Map2Vertex4, GL_MAP2_VERTEX_4); TEST_AND_UPDATE(ctx->Transform.Normalize, enable->Normalize, GL_NORMALIZE); TEST_AND_UPDATE(ctx->Transform.RescaleNormals, enable->RescaleNormals, GL_RESCALE_NORMAL_EXT); + TEST_AND_UPDATE(ctx->Pixel.PixelTextureEnabled, enable->PixelTexture, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth, GL_POINT_SMOOTH); TEST_AND_UPDATE(ctx->Polygon.OffsetPoint, enable->PolygonOffsetPoint, GL_POLYGON_OFFSET_POINT); TEST_AND_UPDATE(ctx->Polygon.OffsetLine, enable->PolygonOffsetLine, GL_POLYGON_OFFSET_LINE); @@ -634,6 +666,11 @@ _mesa_PopAttrib(void) (*ctx->Driver.Enable)( ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag ); (*ctx->Driver.Enable)( ctx, GL_LINE_STIPPLE, ctx->Line.StippleFlag ); } + if (ctx->Driver.LineStipple) + (*ctx->Driver.LineStipple)(ctx, ctx->Line.StippleFactor, + ctx->Line.StipplePattern); + if (ctx->Driver.LineWidth) + (*ctx->Driver.LineWidth)(ctx, ctx->Line.Width); break; case GL_LIST_BIT: MEMCPY( &ctx->List, attr->data, sizeof(struct gl_list_attrib) ); @@ -670,6 +707,8 @@ _mesa_PopAttrib(void) break; case GL_POLYGON_STIPPLE_BIT: MEMCPY( ctx->PolygonStipple, attr->data, 32*sizeof(GLuint) ); + if (ctx->Driver.PolygonStipple) + ctx->Driver.PolygonStipple( ctx, (const GLubyte *) attr->data ); break; case GL_SCISSOR_BIT: MEMCPY( &ctx->Scissor, attr->data, diff --git a/xc/extras/Mesa/src/bitmap.c b/xc/extras/Mesa/src/bitmap.c index 563dff9af..eefee932f 100644 --- a/xc/extras/Mesa/src/bitmap.c +++ b/xc/extras/Mesa/src/bitmap.c @@ -53,7 +53,7 @@ render_bitmap( GLcontext *ctx, GLint px, GLint py, { struct pixel_buffer *PB = ctx->PB; GLint row, col; - GLint pz; + GLdepth fragZ; ASSERT(ctx->RenderMode == GL_RENDER); @@ -68,16 +68,16 @@ render_bitmap( GLcontext *ctx, GLint px, GLint py, g = (GLint) (ctx->Current.RasterColor[1] * 255.0F); b = (GLint) (ctx->Current.RasterColor[2] * 255.0F); a = (GLint) (ctx->Current.RasterColor[3] * 255.0F); - PB_SET_COLOR( ctx, PB, r, g, b, a ); + PB_SET_COLOR( PB, r, g, b, a ); } else { - PB_SET_INDEX( ctx, PB, ctx->Current.RasterIndex ); + PB_SET_INDEX( PB, ctx->Current.RasterIndex ); } - pz = (GLint) ( ctx->Current.RasterPos[2] * DEPTH_SCALE ); + fragZ = (GLdepth) ( ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); for (row=0; row<height; row++) { - const GLubyte *src = (const GLubyte *) gl_pixel_addr_in_image( unpack, + const GLubyte *src = (const GLubyte *) _mesa_image_address( unpack, bitmap, width, height, GL_COLOR_INDEX, GL_BITMAP, 0, row, 0 ); if (unpack->LsbFirst) { @@ -85,7 +85,7 @@ render_bitmap( GLcontext *ctx, GLint px, GLint py, GLubyte mask = 1U << (unpack->SkipPixels & 0x7); for (col=0; col<width; col++) { if (*src & mask) { - PB_WRITE_PIXEL( PB, px+col, py+row, pz ); + PB_WRITE_PIXEL( PB, px+col, py+row, fragZ ); } if (mask == 128U) { src++; @@ -107,7 +107,7 @@ render_bitmap( GLcontext *ctx, GLint px, GLint py, GLubyte mask = 128U >> (unpack->SkipPixels & 0x7); for (col=0; col<width; col++) { if (*src & mask) { - PB_WRITE_PIXEL( PB, px+col, py+row, pz ); + PB_WRITE_PIXEL( PB, px+col, py+row, fragZ ); } if (mask == 1U) { src++; @@ -167,6 +167,8 @@ _mesa_Bitmap( GLsizei width, GLsizei height, gl_reduced_prim_change( ctx, GL_BITMAP ); } + ctx->OcclusionResult = GL_TRUE; + if (ctx->Driver.Bitmap) { /* let device driver try to render the bitmap */ completed = (*ctx->Driver.Bitmap)( ctx, x, y, width, height, diff --git a/xc/extras/Mesa/src/colortab.c b/xc/extras/Mesa/src/colortab.c index 63b93435a..e15014dfe 100644 --- a/xc/extras/Mesa/src/colortab.c +++ b/xc/extras/Mesa/src/colortab.c @@ -32,28 +32,20 @@ #include "context.h" #include "image.h" #include "macros.h" +#include "mem.h" +#include "mmath.h" +#include "span.h" #endif /* - * Return GL_TRUE if k is a power of two, else return GL_FALSE. + * Given an internalFormat token passed to glColorTable, + * return the corresponding base format. + * Return -1 if invalid token. */ -static GLboolean -power_of_two( GLint k ) -{ - GLint i, m = 1; - for (i=0; i<32; i++) { - if (k == m) - return GL_TRUE; - m = m << 1; - } - return GL_FALSE; -} - - static GLint -decode_internal_format( GLint format ) +base_colortab_format( GLenum format ) { switch (format) { case GL_ALPHA: @@ -62,14 +54,12 @@ decode_internal_format( GLint format ) case GL_ALPHA12: case GL_ALPHA16: return GL_ALPHA; - case 1: case GL_LUMINANCE: case GL_LUMINANCE4: case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: return GL_LUMINANCE; - case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: @@ -84,7 +74,6 @@ decode_internal_format( GLint format ) case GL_INTENSITY12: case GL_INTENSITY16: return GL_INTENSITY; - case 3: case GL_RGB: case GL_R3_G3_B2: case GL_RGB4: @@ -94,7 +83,6 @@ decode_internal_format( GLint format ) case GL_RGB12: case GL_RGB16: return GL_RGB; - case 4: case GL_RGBA: case GL_RGBA2: case GL_RGBA4: @@ -110,97 +98,333 @@ decode_internal_format( GLint format ) } +void +_mesa_init_colortable( struct gl_color_table *p ) +{ + p->TableType = GL_UNSIGNED_BYTE; + /* allocate a width=1 table by default */ + p->Table = CALLOC(4 * sizeof(GLubyte)); + if (p->Table) { + GLubyte *t = (GLubyte *) p->Table; + t[0] = 255; + t[1] = 255; + t[2] = 255; + t[3] = 255; + } + p->Size = 1; + p->IntFormat = GL_RGBA; + p->Format = GL_RGBA; + p->RedSize = 8; + p->GreenSize = 8; + p->BlueSize = 8; + p->AlphaSize = 8; + p->IntensitySize = 0; + p->LuminanceSize = 0; +} + + + +void +_mesa_free_colortable_data( struct gl_color_table *p ) +{ + if (p->Table) { + FREE(p->Table); + p->Table = NULL; + } +} + + +/* + * Examine table's format and set the component sizes accordingly. + */ +static void +set_component_sizes( struct gl_color_table *table ) +{ + switch (table->Format) { + case GL_ALPHA: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 8; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; + case GL_LUMINANCE: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 0; + table->IntensitySize = 0; + table->LuminanceSize = 8; + break; + case GL_LUMINANCE_ALPHA: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 8; + table->IntensitySize = 0; + table->LuminanceSize = 8; + break; + case GL_INTENSITY: + table->RedSize = 0; + table->GreenSize = 0; + table->BlueSize = 0; + table->AlphaSize = 0; + table->IntensitySize = 8; + table->LuminanceSize = 0; + break; + case GL_RGB: + table->RedSize = 8; + table->GreenSize = 8; + table->BlueSize = 8; + table->AlphaSize = 0; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; + case GL_RGBA: + table->RedSize = 8; + table->GreenSize = 8; + table->BlueSize = 8; + table->AlphaSize = 8; + table->IntensitySize = 0; + table->LuminanceSize = 0; + break; + default: + gl_problem(NULL, "unexpected format in set_component_sizes"); + } +} + + + void _mesa_ColorTable( GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, - const GLvoid *table ) + const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_object *texObj; - struct gl_color_table *palette; + struct gl_texture_object *texObj = NULL; + struct gl_color_table *table = NULL; GLboolean proxy = GL_FALSE; + GLint baseFormat; + GLfloat rScale = 1.0, gScale = 1.0, bScale = 1.0, aScale = 1.0; + GLfloat rBias = 0.0, gBias = 0.0, bBias = 0.0, aBias = 0.0; + GLboolean floatTable = GL_FALSE; + GLint comps; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorTable"); switch (target) { case GL_TEXTURE_1D: texObj = texUnit->CurrentD[1]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_2D: texObj = texUnit->CurrentD[2]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_3D: texObj = texUnit->CurrentD[3]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_PROXY_TEXTURE_1D: texObj = ctx->Texture.Proxy1D; - palette = &texObj->Palette; + table = &texObj->Palette; proxy = GL_TRUE; break; case GL_PROXY_TEXTURE_2D: texObj = ctx->Texture.Proxy2D; - palette = &texObj->Palette; + table = &texObj->Palette; proxy = GL_TRUE; break; case GL_PROXY_TEXTURE_3D: texObj = ctx->Texture.Proxy3D; - palette = &texObj->Palette; + table = &texObj->Palette; proxy = GL_TRUE; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - texObj = NULL; - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + floatTable = GL_TRUE; + rScale = ctx->Pixel.ColorTableScale[0]; + gScale = ctx->Pixel.ColorTableScale[1]; + bScale = ctx->Pixel.ColorTableScale[2]; + aScale = ctx->Pixel.ColorTableScale[3]; + rBias = ctx->Pixel.ColorTableBias[0]; + gBias = ctx->Pixel.ColorTableBias[1]; + bBias = ctx->Pixel.ColorTableBias[2]; + aBias = ctx->Pixel.ColorTableBias[3]; + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + proxy = GL_TRUE; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + floatTable = GL_TRUE; + rScale = ctx->Pixel.PCCTscale[0]; + gScale = ctx->Pixel.PCCTscale[1]; + bScale = ctx->Pixel.PCCTscale[2]; + aScale = ctx->Pixel.PCCTscale[3]; + rBias = ctx->Pixel.PCCTbias[0]; + gBias = ctx->Pixel.PCCTbias[1]; + bBias = ctx->Pixel.PCCTbias[2]; + aBias = ctx->Pixel.PCCTbias[3]; + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + proxy = GL_TRUE; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + floatTable = GL_TRUE; + rScale = ctx->Pixel.PCMCTscale[0]; + gScale = ctx->Pixel.PCMCTscale[1]; + bScale = ctx->Pixel.PCMCTscale[2]; + aScale = ctx->Pixel.PCMCTscale[3]; + rBias = ctx->Pixel.PCMCTbias[0]; + gBias = ctx->Pixel.PCMCTbias[1]; + bBias = ctx->Pixel.PCMCTbias[2]; + aBias = ctx->Pixel.PCMCTbias[3]; + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; + proxy = GL_TRUE; break; default: gl_error(ctx, GL_INVALID_ENUM, "glColorTable(target)"); return; } - assert(palette); + assert(table); - if (!gl_is_legal_format_and_type(format, type)) { + if (!_mesa_is_legal_format_and_type(format, type)) { gl_error(ctx, GL_INVALID_ENUM, "glColorTable(format or type)"); return; } - if (decode_internal_format(internalFormat) < 0) { - gl_error( ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)" ); + baseFormat = base_colortab_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)"); return; } - if (width < 1 || width > MAX_TEXTURE_PALETTE_SIZE || !power_of_two(width)) { - gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)"); + if (width < 1 || width > ctx->Const.MaxColorTableSize + || _mesa_bitcount(width) != 1) { + if (width > ctx->Const.MaxColorTableSize) + gl_error(ctx, GL_TABLE_TOO_LARGE, "glColorTable(width)"); + else + gl_error(ctx, GL_INVALID_VALUE, "glColorTable(width)"); if (proxy) { - palette->Size = 0; - palette->IntFormat = (GLenum) 0; - palette->Format = (GLenum) 0; + table->Size = 0; + table->IntFormat = (GLenum) 0; + table->Format = (GLenum) 0; } return; } - palette->Size = width; - palette->IntFormat = internalFormat; - palette->Format = (GLenum) decode_internal_format(internalFormat); + table->Size = width; + table->IntFormat = internalFormat; + table->Format = (GLenum) baseFormat; + set_component_sizes(table); + + comps = _mesa_components_in_format(table->Format); + assert(comps > 0); /* error should have been caught sooner */ + if (!proxy) { - _mesa_unpack_ubyte_color_span(ctx, width, palette->Format, - palette->Table, /* dest */ - format, type, table, - &ctx->Unpack, GL_FALSE); - } - if (texObj) { - /* per-texture object palette */ - if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); + /* free old table, if any */ + if (table->Table) { + FREE(table->Table); } - } - else { - /* shared texture palette */ + if (floatTable) { + GLubyte tableUB[MAX_COLOR_TABLE_SIZE * 4]; + GLfloat *tableF; + GLuint i; + + _mesa_unpack_ubyte_color_span(ctx, width, table->Format, + tableUB, /* dest */ + format, type, data, + &ctx->Unpack, GL_TRUE); + + table->TableType = GL_FLOAT; + table->Table = MALLOC(comps * width * sizeof(GLfloat)); + if (!table->Table) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); + return; + } + + /* Apply scale and bias and convert GLubyte values to GLfloats + * in [0, 1]. Store results in the tableF[]. + */ + rScale /= 255.0; + gScale /= 255.0; + bScale /= 255.0; + aScale /= 255.0; + tableF = (GLfloat *) table->Table; + + switch (table->Format) { + case GL_INTENSITY: + for (i = 0; i < width; i++) { + tableF[i] = tableUB[i] * rScale + rBias; + } + break; + case GL_LUMINANCE: + for (i = 0; i < width; i++) { + tableF[i] = tableUB[i] * rScale + rBias; + } + break; + case GL_ALPHA: + for (i = 0; i < width; i++) { + tableF[i] = tableUB[i] * aScale + aBias; + } + break; + case GL_LUMINANCE_ALPHA: + for (i = 0; i < width; i++) { + tableF[i*2+0] = tableUB[i*2+0] * rScale + rBias; + tableF[i*2+1] = tableUB[i*2+1] * aScale + aBias; + } + break; + case GL_RGB: + for (i = 0; i < width; i++) { + tableF[i*3+0] = tableUB[i*3+0] * rScale + rBias; + tableF[i*3+1] = tableUB[i*3+1] * gScale + gBias; + tableF[i*3+2] = tableUB[i*3+2] * bScale + bBias; + } + break; + case GL_RGBA: + for (i = 0; i < width; i++) { + tableF[i*4+0] = tableUB[i*4+0] * rScale + rBias; + tableF[i*4+1] = tableUB[i*4+1] * gScale + gBias; + tableF[i*4+2] = tableUB[i*4+2] * bScale + bBias; + tableF[i*4+3] = tableUB[i*4+3] * aScale + aBias; + } + break; + default: + gl_problem(ctx, "Bad format in _mesa_ColorTable"); + return; + } + } + else { + /* store GLubyte table */ + table->TableType = GL_UNSIGNED_BYTE; + table->Table = MALLOC(comps * width * sizeof(GLubyte)); + if (!table->Table) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); + return; + } + _mesa_unpack_ubyte_color_span(ctx, width, table->Format, + table->Table, /* dest */ + format, type, data, + &ctx->Unpack, GL_TRUE); + } /* floatTable */ + } /* proxy */ + + if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { + /* texture object palette, texObj==NULL means the shared palette */ if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, NULL ); + (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } } @@ -210,42 +434,49 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, void _mesa_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, - const GLvoid *table ) + const GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_object *texObj; - struct gl_color_table *palette; + struct gl_texture_object *texObj = NULL; + struct gl_color_table *table = NULL; GLint comps; - GLubyte *dest; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorSubTable"); switch (target) { case GL_TEXTURE_1D: texObj = texUnit->CurrentD[1]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_2D: texObj = texUnit->CurrentD[2]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_TEXTURE_3D: texObj = texUnit->CurrentD[3]; - palette = &texObj->Palette; + table = &texObj->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - texObj = NULL; - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; break; default: gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(target)"); return; } - assert(palette); + assert(table); - if (!gl_is_legal_format_and_type(format, type)) { + if (!_mesa_is_legal_format_and_type(format, type)) { gl_error(ctx, GL_INVALID_ENUM, "glColorSubTable(format or type)"); return; } @@ -255,196 +486,619 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, return; } - comps = gl_components_in_format(format); - assert(comps > 0); /* error should be caught sooner */ + comps = _mesa_components_in_format(table->Format); + assert(comps > 0); /* error should have been caught sooner */ - if (start + count > palette->Size) { + if (start + count > table->Size) { gl_error(ctx, GL_INVALID_VALUE, "glColorSubTable(count)"); return; } - dest = palette->Table + start * comps * sizeof(GLubyte); - _mesa_unpack_ubyte_color_span(ctx, count, palette->Format, dest, - format, type, table, - &ctx->Unpack, GL_FALSE); - if (texObj) { - /* per-texture object palette */ - if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); - } + if (!table->Table) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glColorSubTable"); + return; + } + + if (table->TableType == GL_UNSIGNED_BYTE) { + GLubyte *dest = (GLubyte *) table->Table + start * comps * sizeof(GLubyte); + _mesa_unpack_ubyte_color_span(ctx, count, table->Format, dest, + format, type, data, &ctx->Unpack, GL_TRUE); } else { - /* shared texture palette */ + GLfloat *dest = (GLfloat *) table->Table + start * comps * sizeof(GLfloat); + ASSERT(table->TableType == GL_FLOAT); + _mesa_unpack_float_color_span(ctx, count, table->Format, dest, + format, type, data, &ctx->Unpack, + GL_FALSE, GL_TRUE); + } + + if (texObj || target == GL_SHARED_TEXTURE_PALETTE_EXT) { + /* per-texture object palette */ if (ctx->Driver.UpdateTexturePalette) { - (*ctx->Driver.UpdateTexturePalette)( ctx, NULL ); + (*ctx->Driver.UpdateTexturePalette)( ctx, texObj ); } } } +/* XXX not tested */ +void +_mesa_CopyColorTable(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width) +{ + GLubyte data[MAX_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorTable"); + + /* Select buffer to read from */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, + ctx->Pixel.DriverReadBuffer ); + + if (width > MAX_WIDTH) + width = MAX_WIDTH; + + /* read the data from framebuffer */ + gl_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); + + /* Restore reading from draw buffer (the default) */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, + ctx->Color.DriverDrawBuffer ); + + _mesa_ColorTable(target, internalformat, width, + GL_RGBA, GL_UNSIGNED_BYTE, data); +} + + + +/* XXX not tested */ +void +_mesa_CopyColorSubTable(GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width) +{ + GLubyte data[MAX_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyColorSubTable"); + + /* Select buffer to read from */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->ReadBuffer, + ctx->Pixel.DriverReadBuffer ); + + if (width > MAX_WIDTH) + width = MAX_WIDTH; + + /* read the data from framebuffer */ + gl_read_rgba_span( ctx, ctx->ReadBuffer, width, x, y, data ); + + /* Restore reading from draw buffer (the default) */ + (*ctx->Driver.SetReadBuffer)( ctx, ctx->DrawBuffer, + ctx->Color.DriverDrawBuffer ); + + _mesa_ColorSubTable(target, start, width, GL_RGBA, GL_UNSIGNED_BYTE, data); +} + + + void _mesa_GetColorTable( GLenum target, GLenum format, - GLenum type, GLvoid *table ) + GLenum type, GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_color_table *palette; - GLubyte rgba[MAX_TEXTURE_PALETTE_SIZE][4]; + struct gl_color_table *table = NULL; + GLubyte rgba[MAX_COLOR_TABLE_SIZE][4]; GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTable"); switch (target) { case GL_TEXTURE_1D: - palette = &texUnit->CurrentD[1]->Palette; + table = &texUnit->CurrentD[1]->Palette; break; case GL_TEXTURE_2D: - palette = &texUnit->CurrentD[2]->Palette; + table = &texUnit->CurrentD[2]->Palette; break; case GL_TEXTURE_3D: - palette = &texUnit->CurrentD[3]->Palette; + table = &texUnit->CurrentD[3]->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; break; default: gl_error(ctx, GL_INVALID_ENUM, "glGetColorTable(target)"); return; } - assert(palette); + assert(table); - switch (palette->Format) { + switch (table->Format) { case GL_ALPHA: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = 0; - rgba[i][GCOMP] = 0; - rgba[i][BCOMP] = 0; - rgba[i][ACOMP] = palette->Table[i]; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = 0; + rgba[i][GCOMP] = 0; + rgba[i][BCOMP] = 0; + rgba[i][ACOMP] = tableUB[i]; + } } break; case GL_LUMINANCE: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i]; - rgba[i][GCOMP] = palette->Table[i]; - rgba[i][BCOMP] = palette->Table[i]; - rgba[i][ACOMP] = 255; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][ACOMP] = 255; + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i]; + rgba[i][GCOMP] = tableUB[i]; + rgba[i][BCOMP] = tableUB[i]; + rgba[i][ACOMP] = 255; + } } break; case GL_LUMINANCE_ALPHA: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i*2+0]; - rgba[i][GCOMP] = palette->Table[i*2+0]; - rgba[i][BCOMP] = palette->Table[i*2+0]; - rgba[i][ACOMP] = palette->Table[i*2+1]; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i*2+0] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i*2+0] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i*2+0] * 255.0F); + rgba[i][ACOMP] = (GLint) (tableF[i*2+1] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*2+0]; + rgba[i][GCOMP] = tableUB[i*2+0]; + rgba[i][BCOMP] = tableUB[i*2+0]; + rgba[i][ACOMP] = tableUB[i*2+1]; + } } break; case GL_INTENSITY: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i]; - rgba[i][GCOMP] = palette->Table[i]; - rgba[i][BCOMP] = palette->Table[i]; - rgba[i][ACOMP] = 255; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i] * 255.0F); + rgba[i][ACOMP] = (GLint) (tableF[i] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i]; + rgba[i][GCOMP] = tableUB[i]; + rgba[i][BCOMP] = tableUB[i]; + rgba[i][ACOMP] = tableUB[i]; + } } break; case GL_RGB: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i*3+0]; - rgba[i][GCOMP] = palette->Table[i*3+1]; - rgba[i][BCOMP] = palette->Table[i*3+2]; - rgba[i][ACOMP] = 255; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i*3+0] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i*3+1] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i*3+2] * 255.0F); + rgba[i][ACOMP] = 255; + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*3+0]; + rgba[i][GCOMP] = tableUB[i*3+1]; + rgba[i][BCOMP] = tableUB[i*3+2]; + rgba[i][ACOMP] = 255; + } } break; case GL_RGBA: - for (i = 0; i < palette->Size; i++) { - rgba[i][RCOMP] = palette->Table[i*4+0]; - rgba[i][GCOMP] = palette->Table[i*4+1]; - rgba[i][BCOMP] = palette->Table[i*4+2]; - rgba[i][ACOMP] = palette->Table[i*4+3]; + if (table->TableType == GL_FLOAT) { + const GLfloat *tableF = (const GLfloat *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = (GLint) (tableF[i*4+0] * 255.0F); + rgba[i][GCOMP] = (GLint) (tableF[i*4+1] * 255.0F); + rgba[i][BCOMP] = (GLint) (tableF[i*4+2] * 255.0F); + rgba[i][ACOMP] = (GLint) (tableF[i*4+3] * 255.0F); + } + } + else { + const GLubyte *tableUB = (const GLubyte *) table->Table; + for (i = 0; i < table->Size; i++) { + rgba[i][RCOMP] = tableUB[i*4+0]; + rgba[i][GCOMP] = tableUB[i*4+1]; + rgba[i][BCOMP] = tableUB[i*4+2]; + rgba[i][ACOMP] = tableUB[i*4+3]; + } } break; default: - gl_problem(ctx, "bad palette format in glGetColorTable"); + gl_problem(ctx, "bad table format in glGetColorTable"); return; } - gl_pack_rgba_span(ctx, palette->Size, (const GLubyte (*)[]) rgba, - format, type, table, &ctx->Pack, GL_FALSE); + _mesa_pack_rgba_span(ctx, table->Size, (const GLubyte (*)[]) rgba, + format, type, data, &ctx->Pack, GL_FALSE); +} + + + +void +_mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); - (void) format; - (void) type; - (void) table; + switch (target) { + case GL_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.ColorTableScale[0] = params[0]; + ctx->Pixel.ColorTableScale[1] = params[1]; + ctx->Pixel.ColorTableScale[2] = params[2]; + ctx->Pixel.ColorTableScale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.ColorTableBias[0] = params[0]; + ctx->Pixel.ColorTableBias[1] = params[1]; + ctx->Pixel.ColorTableBias[2] = params[2]; + ctx->Pixel.ColorTableBias[3] = params[3]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.PCCTscale[0] = params[0]; + ctx->Pixel.PCCTscale[1] = params[1]; + ctx->Pixel.PCCTscale[2] = params[2]; + ctx->Pixel.PCCTscale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.PCCTbias[0] = params[0]; + ctx->Pixel.PCCTbias[1] = params[1]; + ctx->Pixel.PCCTbias[2] = params[2]; + ctx->Pixel.PCCTbias[3] = params[3]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + ctx->Pixel.PCMCTscale[0] = params[0]; + ctx->Pixel.PCMCTscale[1] = params[1]; + ctx->Pixel.PCMCTscale[2] = params[2]; + ctx->Pixel.PCMCTscale[3] = params[3]; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + ctx->Pixel.PCMCTbias[0] = params[0]; + ctx->Pixel.PCMCTbias[1] = params[1]; + ctx->Pixel.PCMCTbias[2] = params[2]; + ctx->Pixel.PCMCTbias[3] = params[3]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameterfv(pname)"); + return; + } + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glColorTableParameter(target)"); + return; + } } void -_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) +_mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { - GLint iparams[10]; - _mesa_GetColorTableParameteriv( target, pname, iparams ); - *params = (GLfloat) iparams[0]; + GLfloat fparams[4]; + if (pname == GL_COLOR_TABLE_SGI || + pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || + pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { + /* four values */ + fparams[0] = (GLfloat) params[0]; + fparams[1] = (GLfloat) params[1]; + fparams[2] = (GLfloat) params[2]; + fparams[3] = (GLfloat) params[3]; + } + else { + /* one values */ + fparams[0] = (GLfloat) params[0]; + } + _mesa_ColorTableParameterfv(target, pname, fparams); } void -_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) +_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_color_table *palette; + struct gl_color_table *table = NULL; - ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameter"); + ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameterfv"); switch (target) { case GL_TEXTURE_1D: - palette = &texUnit->CurrentD[1]->Palette; + table = &texUnit->CurrentD[1]->Palette; break; case GL_TEXTURE_2D: - palette = &texUnit->CurrentD[2]->Palette; + table = &texUnit->CurrentD[2]->Palette; break; case GL_TEXTURE_3D: - palette = &texUnit->CurrentD[3]->Palette; + table = &texUnit->CurrentD[3]->Palette; + break; + case GL_PROXY_TEXTURE_1D: + table = &ctx->Texture.Proxy1D->Palette; + break; + case GL_PROXY_TEXTURE_2D: + table = &ctx->Texture.Proxy2D->Palette; + break; + case GL_PROXY_TEXTURE_3D: + table = &ctx->Texture.Proxy3D->Palette; break; case GL_SHARED_TEXTURE_PALETTE_EXT: - palette = &ctx->Texture.Palette; + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.ColorTableScale[0]; + params[1] = ctx->Pixel.ColorTableScale[1]; + params[2] = ctx->Pixel.ColorTableScale[2]; + params[3] = ctx->Pixel.ColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.ColorTableBias[0]; + params[1] = ctx->Pixel.ColorTableBias[1]; + params[2] = ctx->Pixel.ColorTableBias[2]; + params[3] = ctx->Pixel.ColorTableBias[3]; + return; + } + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.PCCTscale[0]; + params[1] = ctx->Pixel.PCCTscale[1]; + params[2] = ctx->Pixel.PCCTscale[2]; + params[3] = ctx->Pixel.PCCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.PCCTbias[0]; + params[1] = ctx->Pixel.PCCTbias[1]; + params[2] = ctx->Pixel.PCCTbias[2]; + params[3] = ctx->Pixel.PCCTbias[3]; + return; + } + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = ctx->Pixel.PCMCTscale[0]; + params[1] = ctx->Pixel.PCMCTscale[1]; + params[2] = ctx->Pixel.PCMCTscale[2]; + params[3] = ctx->Pixel.PCMCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = ctx->Pixel.PCMCTbias[0]; + params[1] = ctx->Pixel.PCMCTbias[1]; + params[2] = ctx->Pixel.PCMCTbias[2]; + params[3] = ctx->Pixel.PCMCTbias[3]; + return; + } + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; break; default: - gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter(target)"); + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(target)"); return; } + assert(table); + switch (pname) { case GL_COLOR_TABLE_FORMAT: - *params = palette->IntFormat; + *params = table->IntFormat; break; case GL_COLOR_TABLE_WIDTH: - *params = palette->Size; + *params = table->Size; break; case GL_COLOR_TABLE_RED_SIZE: - *params = 8; + *params = table->RedSize; break; case GL_COLOR_TABLE_GREEN_SIZE: - *params = 8; + *params = table->GreenSize; break; case GL_COLOR_TABLE_BLUE_SIZE: - *params = 8; + *params = table->BlueSize; break; case GL_COLOR_TABLE_ALPHA_SIZE: - *params = 8; + *params = table->AlphaSize; break; case GL_COLOR_TABLE_LUMINANCE_SIZE: - *params = 8; + *params = table->LuminanceSize; break; case GL_COLOR_TABLE_INTENSITY_SIZE: - *params = 8; + *params = table->IntensitySize; break; default: - gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameter" ); + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameterfv(pname)" ); return; } } + +void +_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_color_table *table = NULL; + + ASSERT_OUTSIDE_BEGIN_END(ctx, "glGetColorTableParameteriv"); + + switch (target) { + case GL_TEXTURE_1D: + table = &texUnit->CurrentD[1]->Palette; + break; + case GL_TEXTURE_2D: + table = &texUnit->CurrentD[2]->Palette; + break; + case GL_TEXTURE_3D: + table = &texUnit->CurrentD[3]->Palette; + break; + case GL_PROXY_TEXTURE_1D: + table = &ctx->Texture.Proxy1D->Palette; + break; + case GL_PROXY_TEXTURE_2D: + table = &ctx->Texture.Proxy2D->Palette; + break; + case GL_PROXY_TEXTURE_3D: + table = &ctx->Texture.Proxy3D->Palette; + break; + case GL_SHARED_TEXTURE_PALETTE_EXT: + table = &ctx->Texture.Palette; + break; + case GL_COLOR_TABLE: + table = &ctx->ColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.ColorTableScale[0]; + params[1] = (GLint) ctx->Pixel.ColorTableScale[1]; + params[2] = (GLint) ctx->Pixel.ColorTableScale[2]; + params[3] = (GLint) ctx->Pixel.ColorTableScale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.ColorTableBias[0]; + params[1] = (GLint) ctx->Pixel.ColorTableBias[1]; + params[2] = (GLint) ctx->Pixel.ColorTableBias[2]; + params[3] = (GLint) ctx->Pixel.ColorTableBias[3]; + return; + } + break; + case GL_PROXY_COLOR_TABLE: + table = &ctx->ProxyColorTable; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->PostConvolutionColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.PCCTscale[0]; + params[1] = (GLint) ctx->Pixel.PCCTscale[1]; + params[2] = (GLint) ctx->Pixel.PCCTscale[2]; + params[3] = (GLint) ctx->Pixel.PCCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.PCCTbias[0]; + params[1] = (GLint) ctx->Pixel.PCCTbias[1]; + params[2] = (GLint) ctx->Pixel.PCCTbias[2]; + params[3] = (GLint) ctx->Pixel.PCCTbias[3]; + return; + } + break; + case GL_PROXY_POST_CONVOLUTION_COLOR_TABLE: + table = &ctx->ProxyPostConvolutionColorTable; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->PostColorMatrixColorTable; + if (pname == GL_COLOR_TABLE_SCALE_SGI) { + params[0] = (GLint) ctx->Pixel.PCMCTscale[0]; + params[1] = (GLint) ctx->Pixel.PCMCTscale[1]; + params[2] = (GLint) ctx->Pixel.PCMCTscale[2]; + params[3] = (GLint) ctx->Pixel.PCMCTscale[3]; + return; + } + else if (pname == GL_COLOR_TABLE_BIAS_SGI) { + params[0] = (GLint) ctx->Pixel.PCMCTbias[0]; + params[1] = (GLint) ctx->Pixel.PCMCTbias[1]; + params[2] = (GLint) ctx->Pixel.PCMCTbias[2]; + params[3] = (GLint) ctx->Pixel.PCMCTbias[3]; + return; + } + break; + case GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE: + table = &ctx->ProxyPostColorMatrixColorTable; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(target)"); + return; + } + + assert(table); + + switch (pname) { + case GL_COLOR_TABLE_FORMAT: + *params = table->IntFormat; + break; + case GL_COLOR_TABLE_WIDTH: + *params = table->Size; + break; + case GL_COLOR_TABLE_RED_SIZE: + *params = table->RedSize; + break; + case GL_COLOR_TABLE_GREEN_SIZE: + *params = table->GreenSize; + break; + case GL_COLOR_TABLE_BLUE_SIZE: + *params = table->BlueSize; + break; + case GL_COLOR_TABLE_ALPHA_SIZE: + *params = table->AlphaSize; + break; + case GL_COLOR_TABLE_LUMINANCE_SIZE: + *params = table->LuminanceSize; + break; + case GL_COLOR_TABLE_INTENSITY_SIZE: + *params = table->IntensitySize; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetColorTableParameteriv(pname)" ); + return; + } +} diff --git a/xc/extras/Mesa/src/config.h b/xc/extras/Mesa/src/config.h index 595f02830..3ff5e5f78 100644 --- a/xc/extras/Mesa/src/config.h +++ b/xc/extras/Mesa/src/config.h @@ -51,6 +51,9 @@ /* Maximum texture matrix stack depth: */ #define MAX_TEXTURE_STACK_DEPTH 10 +/* Maximum color matrix stack depth: */ +#define MAX_COLOR_STACK_DEPTH 4 + /* Maximum attribute stack depth: */ #define MAX_ATTRIB_STACK_DEPTH 16 @@ -92,8 +95,8 @@ #define MAX_LINE_WIDTH 10.0 #define LINE_WIDTH_GRANULARITY 0.1 -/* Max texture palette size */ -#define MAX_TEXTURE_PALETTE_SIZE 256 +/* Max texture palette / color table size */ +#define MAX_COLOR_TABLE_SIZE 256 /* Number of texture levels */ #define MAX_TEXTURE_LEVELS 12 @@ -111,6 +114,16 @@ /* Subpixel precision for antialiasing, window coordinate snapping */ #define SUB_PIXEL_BITS 4 +/* Size of histogram tables */ +#define HISTOGRAM_TABLE_SIZE 256 + +/* Max convolution filter sizes */ +#define MAX_CONVOLUTION_WIDTH 5 +#define MAX_CONVOLUTION_HEIGHT 5 + +/* GL_ARB_texture_compression */ +#define MAX_COMPRESSED_TEXTURE_FORMATS 25 + /* @@ -125,26 +138,12 @@ /* - * Bits per depth buffer value: 16 or 32 + * Bits per depth buffer value: 16 or 32 (GLushort or GLuint) + * gl_create_visual() can select any depth in [0, 32]. */ -#ifdef MESAD3D - /* Mesa / Direct3D driver only */ - extern float g_DepthScale, g_MaxDepth; -# define DEPTH_BITS 32 -# define DEPTH_SCALE g_DepthScale -# define MAX_DEPTH g_MaxDepth -#else -# define DEPTH_BITS 16 -# if DEPTH_BITS==16 -# define MAX_DEPTH 0xffff -# define DEPTH_SCALE 65535.0F -# elif DEPTH_BITS==32 -# define MAX_DEPTH 0x3fffffff -# define DEPTH_SCALE ((GLfloat) MAX_DEPTH) -# else -# error "illegal number of depth bits" -# endif -#endif +#define DEFAULT_SOFTWARE_DEPTH_BITS 16 +#define DEFAULT_SOFTWARE_DEPTH_TYPE GLushort + /* @@ -190,7 +189,7 @@ * VB_MAX vertices. (This only happens when mixed primitives are * sharing the vb). */ -#define VB_MAX_CLIPPED_VERTS (2 * (6 + MAX_CLIP_PLANES)) +#define VB_MAX_CLIPPED_VERTS ((2 * (6 + MAX_CLIP_PLANES))+1) #define VB_SIZE (VB_MAX + VB_MAX_CLIPPED_VERTS) diff --git a/xc/extras/Mesa/src/context.c b/xc/extras/Mesa/src/context.c index 04c3e1c05..0138ae6b3 100644 --- a/xc/extras/Mesa/src/context.c +++ b/xc/extras/Mesa/src/context.c @@ -86,164 +86,6 @@ struct immediate *_mesa_CurrentInput = NULL; #endif - - -/**********************************************************************/ -/***** Profiling functions *****/ -/**********************************************************************/ - -#ifdef PROFILE - -#include <sys/times.h> -#include <sys/param.h> - - -/* - * Return system time in seconds. - * NOTE: this implementation may not be very portable! - */ -GLdouble gl_time( void ) -{ - static GLdouble prev_time = 0.0; - static GLdouble time; - struct tms tm; - clock_t clk; - - clk = times(&tm); - -#ifdef CLK_TCK - time = (double)clk / (double)CLK_TCK; -#else - time = (double)clk / (double)HZ; -#endif - - if (time>prev_time) { - prev_time = time; - return time; - } - else { - return prev_time; - } -} - -/* - * Reset the timing/profiling counters - */ -static void init_timings( GLcontext *ctx ) -{ - ctx->BeginEndCount = 0; - ctx->BeginEndTime = 0.0; - ctx->VertexCount = 0; - ctx->VertexTime = 0.0; - ctx->PointCount = 0; - ctx->PointTime = 0.0; - ctx->LineCount = 0; - ctx->LineTime = 0.0; - ctx->PolygonCount = 0; - ctx->PolygonTime = 0.0; - ctx->ClearCount = 0; - ctx->ClearTime = 0.0; - ctx->SwapCount = 0; - ctx->SwapTime = 0.0; -} - - -/* - * Print the accumulated timing/profiling data. - */ -static void print_timings( GLcontext *ctx ) -{ - GLdouble beginendrate; - GLdouble vertexrate; - GLdouble pointrate; - GLdouble linerate; - GLdouble polygonrate; - GLdouble overhead; - GLdouble clearrate; - GLdouble swaprate; - GLdouble avgvertices; - - if (ctx->BeginEndTime>0.0) { - beginendrate = ctx->BeginEndCount / ctx->BeginEndTime; - } - else { - beginendrate = 0.0; - } - if (ctx->VertexTime>0.0) { - vertexrate = ctx->VertexCount / ctx->VertexTime; - } - else { - vertexrate = 0.0; - } - if (ctx->PointTime>0.0) { - pointrate = ctx->PointCount / ctx->PointTime; - } - else { - pointrate = 0.0; - } - if (ctx->LineTime>0.0) { - linerate = ctx->LineCount / ctx->LineTime; - } - else { - linerate = 0.0; - } - if (ctx->PolygonTime>0.0) { - polygonrate = ctx->PolygonCount / ctx->PolygonTime; - } - else { - polygonrate = 0.0; - } - if (ctx->ClearTime>0.0) { - clearrate = ctx->ClearCount / ctx->ClearTime; - } - else { - clearrate = 0.0; - } - if (ctx->SwapTime>0.0) { - swaprate = ctx->SwapCount / ctx->SwapTime; - } - else { - swaprate = 0.0; - } - - if (ctx->BeginEndCount>0) { - avgvertices = (GLdouble) ctx->VertexCount / (GLdouble) ctx->BeginEndCount; - } - else { - avgvertices = 0.0; - } - - overhead = ctx->BeginEndTime - ctx->VertexTime - ctx->PointTime - - ctx->LineTime - ctx->PolygonTime; - - - printf(" Count Time (s) Rate (/s) \n"); - printf("--------------------------------------------------------\n"); - printf("glBegin/glEnd %7d %8.3f %10.3f\n", - ctx->BeginEndCount, ctx->BeginEndTime, beginendrate); - printf(" vertexes transformed %7d %8.3f %10.3f\n", - ctx->VertexCount, ctx->VertexTime, vertexrate ); - printf(" points rasterized %7d %8.3f %10.3f\n", - ctx->PointCount, ctx->PointTime, pointrate ); - printf(" lines rasterized %7d %8.3f %10.3f\n", - ctx->LineCount, ctx->LineTime, linerate ); - printf(" polygons rasterized %7d %8.3f %10.3f\n", - ctx->PolygonCount, ctx->PolygonTime, polygonrate ); - printf(" overhead %8.3f\n", overhead ); - printf("glClear %7d %8.3f %10.3f\n", - ctx->ClearCount, ctx->ClearTime, clearrate ); - printf("SwapBuffers %7d %8.3f %10.3f\n", - ctx->SwapCount, ctx->SwapTime, swaprate ); - printf("\n"); - - printf("Average number of vertices per begin/end: %8.3f\n", avgvertices ); -} -#endif - - - - - /**********************************************************************/ /***** GL Visual allocation/destruction *****/ /**********************************************************************/ @@ -283,7 +125,47 @@ _mesa_create_visual( GLboolean rgbFlag, GLint accumAlphaBits, GLint numSamples ) { - GLvisual *vis; + GLvisual *vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); + if (vis) { + if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag, + redBits, greenBits, blueBits, alphaBits, + indexBits, depthBits, stencilBits, + accumRedBits, accumGreenBits, + accumBlueBits, accumAlphaBits, + numSamples )) { + FREE(vis); + return NULL; + } + } + return vis; +} + + +/* + * Initialize the fields of the given GLvisual. + * Input: see _mesa_create_visual() above. + * Return: GL_TRUE = success + * GL_FALSE = failure. + */ +GLboolean +_mesa_initialize_visual( GLvisual *vis, + GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ) +{ + assert(vis); /* This is to catch bad values from device drivers not updated for * Mesa 3.3. Some device drivers just passed 1. That's a REALLY @@ -292,27 +174,22 @@ _mesa_create_visual( GLboolean rgbFlag, assert(depthBits == 0 || depthBits > 1); if (depthBits < 0 || depthBits > 32) { - return NULL; + return GL_FALSE; } if (stencilBits < 0 || stencilBits > (GLint) (8 * sizeof(GLstencil))) { - return NULL; + return GL_FALSE; } if (accumRedBits < 0 || accumRedBits > (GLint) (8 * sizeof(GLaccum))) { - return NULL; + return GL_FALSE; } if (accumGreenBits < 0 || accumGreenBits > (GLint) (8 * sizeof(GLaccum))) { - return NULL; + return GL_FALSE; } if (accumBlueBits < 0 || accumBlueBits > (GLint) (8 * sizeof(GLaccum))) { - return NULL; + return GL_FALSE; } if (accumAlphaBits < 0 || accumAlphaBits > (GLint) (8 * sizeof(GLaccum))) { - return NULL; - } - - vis = (GLvisual *) CALLOC( sizeof(GLvisual) ); - if (!vis) { - return NULL; + return GL_FALSE; } vis->RGBAflag = rgbFlag; @@ -343,32 +220,34 @@ _mesa_create_visual( GLboolean rgbFlag, vis->DepthMaxF = (GLfloat) vis->DepthMax; } else { - /* Special case since shift values greater than or equal to the - * number of bits in the left hand expression's type are - * undefined. - */ + /* Special case since shift values greater than or equal to the + * number of bits in the left hand expression's type are + * undefined. + */ vis->DepthMax = 0xffffffff; vis->DepthMaxF = (GLfloat) vis->DepthMax; } - return vis; + return GL_TRUE; } /* This function should no longer be used. Use _mesa_create_visual() instead */ -GLvisual *gl_create_visual( GLboolean rgbFlag, - GLboolean alphaFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint depthBits, - GLint stencilBits, - GLint accumBits, - GLint indexBits, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits ) +GLvisual * +gl_create_visual( GLboolean rgbFlag, + GLboolean alphaFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint depthBits, + GLint stencilBits, + GLint accumBits, + GLint indexBits, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits ) { + (void) alphaFlag; return _mesa_create_visual(rgbFlag, dbFlag, stereoFlag, redBits, greenBits, blueBits, alphaBits, indexBits, depthBits, stencilBits, @@ -384,7 +263,8 @@ _mesa_destroy_visual( GLvisual *vis ) /* obsolete */ -void gl_destroy_visual( GLvisual *vis ) +void +gl_destroy_visual( GLvisual *vis ) { _mesa_destroy_visual(vis); } @@ -408,18 +288,38 @@ void gl_destroy_visual( GLvisual *vis ) * Return: pointer to new GLframebuffer struct or NULL if error. */ -GLframebuffer *gl_create_framebuffer( GLvisual *visual, - GLboolean softwareDepth, - GLboolean softwareStencil, - GLboolean softwareAccum, - GLboolean softwareAlpha ) +GLframebuffer * +gl_create_framebuffer( GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ) { - GLframebuffer *buffer; - - buffer = CALLOC_STRUCT(gl_frame_buffer); - if (!buffer) { - return NULL; + GLframebuffer *buffer = CALLOC_STRUCT(gl_frame_buffer); + assert(visual); + if (buffer) { + _mesa_initialize_framebuffer(buffer, visual, + softwareDepth, softwareStencil, + softwareAccum, softwareAlpha ); } + return buffer; +} + + +/* + * Initialize a GLframebuffer object. + * Input: See gl_create_framebuffer() above. + */ +void +_mesa_initialize_framebuffer( GLframebuffer *buffer, + GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ) +{ + assert(buffer); + assert(visual); /* sanity checks */ if (softwareDepth ) { @@ -444,16 +344,14 @@ GLframebuffer *gl_create_framebuffer( GLvisual *visual, buffer->UseSoftwareStencilBuffer = softwareStencil; buffer->UseSoftwareAccumBuffer = softwareAccum; buffer->UseSoftwareAlphaBuffers = softwareAlpha; - - return buffer; } - /* * Free a framebuffer struct and its buffers. */ -void gl_destroy_framebuffer( GLframebuffer *buffer ) +void +gl_destroy_framebuffer( GLframebuffer *buffer ) { if (buffer) { if (buffer->DepthBuffer) { @@ -494,7 +392,8 @@ _glthread_DECLARE_STATIC_MUTEX(OneTimeLock); /* * This function just calls all the various one-time-init functions in Mesa. */ -static void one_time_init( void ) +static void +one_time_init( void ) { static GLboolean alreadyCalled = GL_FALSE; _glthread_LOCK_MUTEX(OneTimeLock); @@ -541,7 +440,8 @@ static void one_time_init( void ) /* * Allocate and initialize a shared context state structure. */ -static struct gl_shared_state *alloc_shared_state( void ) +static struct gl_shared_state * +alloc_shared_state( void ) { GLuint d; struct gl_shared_state *ss; @@ -566,6 +466,14 @@ static struct gl_shared_state *alloc_shared_state( void ) ss->DefaultD[d]->RefCount++; /* don't free if not in use */ } + ss->DefaultCubeMap = gl_alloc_texture_object(ss, 0, 6); + if (!ss->DefaultCubeMap) { + outOfMemory = GL_TRUE; + } + else { + ss->DefaultCubeMap->RefCount++; + } + if (!ss->DisplayList || !ss->TexObjects || outOfMemory) { /* Ran out of memory at some point. Free everything and return NULL */ if (ss->DisplayList) @@ -578,6 +486,8 @@ static struct gl_shared_state *alloc_shared_state( void ) gl_free_texture_object(ss, ss->DefaultD[2]); if (ss->DefaultD[3]) gl_free_texture_object(ss, ss->DefaultD[3]); + if (ss->DefaultCubeMap) + gl_free_texture_object(ss, ss->DefaultCubeMap); FREE(ss); return NULL; } @@ -590,7 +500,8 @@ static struct gl_shared_state *alloc_shared_state( void ) /* * Deallocate a shared state context and all children structures. */ -static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) +static void +free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) { /* Free display lists */ while (1) { @@ -623,7 +534,8 @@ static void free_shared_state( GLcontext *ctx, struct gl_shared_state *ss ) * Initialize the nth light. Note that the defaults for light 0 are * different than the other lights. */ -static void init_light( struct gl_light *l, GLuint n ) +static void +init_light( struct gl_light *l, GLuint n ) { make_empty_list( l ); @@ -650,7 +562,8 @@ static void init_light( struct gl_light *l, GLuint n ) -static void init_lightmodel( struct gl_lightmodel *lm ) +static void +init_lightmodel( struct gl_lightmodel *lm ) { ASSIGN_4V( lm->Ambient, 0.2, 0.2, 0.2, 1.0 ); lm->LocalViewer = GL_FALSE; @@ -659,7 +572,8 @@ static void init_lightmodel( struct gl_lightmodel *lm ) } -static void init_material( struct gl_material *m ) +static void +init_material( struct gl_material *m ) { ASSIGN_4V( m->Ambient, 0.2, 0.2, 0.2, 1.0 ); ASSIGN_4V( m->Diffuse, 0.8, 0.8, 0.8, 1.0 ); @@ -673,7 +587,8 @@ static void init_material( struct gl_material *m ) -static void init_texture_unit( GLcontext *ctx, GLuint unit ) +static void +init_texture_unit( GLcontext *ctx, GLuint unit ) { struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; @@ -697,10 +612,12 @@ static void init_texture_unit( GLcontext *ctx, GLuint unit ) texUnit->CurrentD[1] = ctx->Shared->DefaultD[1]; texUnit->CurrentD[2] = ctx->Shared->DefaultD[2]; texUnit->CurrentD[3] = ctx->Shared->DefaultD[3]; + texUnit->CurrentCubeMap = ctx->Shared->DefaultCubeMap; } -static void init_fallback_arrays( GLcontext *ctx ) +static void +init_fallback_arrays( GLcontext *ctx ) { struct gl_client_array *cl; GLuint i; @@ -750,7 +667,8 @@ static void init_fallback_arrays( GLcontext *ctx ) /* Initialize a 1-D evaluator map */ -static void init_1d_map( struct gl_1d_map *map, int n, const float *initial ) +static void +init_1d_map( struct gl_1d_map *map, int n, const float *initial ) { map->Order = 1; map->u1 = 0.0; @@ -765,7 +683,8 @@ static void init_1d_map( struct gl_1d_map *map, int n, const float *initial ) /* Initialize a 2-D evaluator map */ -static void init_2d_map( struct gl_2d_map *map, int n, const float *initial ) +static void +init_2d_map( struct gl_2d_map *map, int n, const float *initial ) { map->Uorder = 1; map->Vorder = 1; @@ -785,7 +704,8 @@ static void init_2d_map( struct gl_2d_map *map, int n, const float *initial ) /* * Initialize the attribute groups in a GLcontext. */ -static void init_attrib_groups( GLcontext *ctx ) +static void +init_attrib_groups( GLcontext *ctx ) { GLuint i, j; @@ -794,6 +714,7 @@ static void init_attrib_groups( GLcontext *ctx ) /* Constants, may be overriden by device drivers */ ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS; ctx->Const.MaxTextureSize = 1 << (MAX_TEXTURE_LEVELS - 1); + ctx->Const.MaxCubeTextureSize = ctx->Const.MaxTextureSize; ctx->Const.MaxTextureUnits = MAX_TEXTURE_UNITS; ctx->Const.MaxArrayLockSize = MAX_ARRAY_LOCK_SIZE; ctx->Const.SubPixelBits = SUB_PIXEL_BITS; @@ -809,6 +730,9 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Const.LineWidthGranularity = LINE_WIDTH_GRANULARITY; ctx->Const.NumAuxBuffers = NUM_AUX_BUFFERS; ctx->Const.MaxColorTableSize = MAX_COLOR_TABLE_SIZE; + ctx->Const.MaxConvolutionWidth = MAX_CONVOLUTION_WIDTH; + ctx->Const.MaxConvolutionHeight = MAX_CONVOLUTION_HEIGHT; + ctx->Const.NumCompressedTextureFormats = 0; /* Modelview matrix */ gl_matrix_ctr( &ctx->ModelView ); @@ -987,11 +911,12 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Hint.LineSmooth = GL_DONT_CARE; ctx->Hint.PolygonSmooth = GL_DONT_CARE; ctx->Hint.Fog = GL_DONT_CARE; - ctx->Hint.AllowDrawWin = GL_TRUE; ctx->Hint.AllowDrawFrg = GL_TRUE; ctx->Hint.AllowDrawMem = GL_TRUE; ctx->Hint.StrictLighting = GL_TRUE; + ctx->Hint.ClipVolumeClipping = GL_DONT_CARE; + ctx->Hint.TextureCompression = GL_DONT_CARE; /* Histogram group */ ctx->Histogram.Width = 0; @@ -1120,25 +1045,24 @@ static void init_attrib_groups( GLcontext *ctx ) ctx->Pixel.PixelTextureEnabled = GL_FALSE; ctx->Pixel.FragmentRgbSource = GL_PIXEL_GROUP_COLOR_SGIS; ctx->Pixel.FragmentAlphaSource = GL_PIXEL_GROUP_COLOR_SGIS; - ctx->Pixel.PostColorMatrixRedBias = 0.0; - ctx->Pixel.PostColorMatrixRedScale = 1.0; - ctx->Pixel.PostColorMatrixGreenBias = 0.0; - ctx->Pixel.PostColorMatrixGreenScale = 1.0; - ctx->Pixel.PostColorMatrixBlueBias = 0.0; - ctx->Pixel.PostColorMatrixBlueScale = 1.0; - ctx->Pixel.PostColorMatrixAlphaBias = 0.0; - ctx->Pixel.PostColorMatrixAlphaScale = 1.0; - ctx->Pixel.ColorTableScale[0] = 1.0F; - ctx->Pixel.ColorTableScale[1] = 1.0F; - ctx->Pixel.ColorTableScale[2] = 1.0F; - ctx->Pixel.ColorTableScale[3] = 1.0F; - ctx->Pixel.ColorTableBias[0] = 0.0F; - ctx->Pixel.ColorTableBias[1] = 0.0F; - ctx->Pixel.ColorTableBias[2] = 0.0F; - ctx->Pixel.ColorTableBias[3] = 0.0F; + ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.PostColorMatrixBias, 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(ctx->Pixel.ColorTableScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.ColorTableBias, 0.0, 0.0, 0.0, 0.0); ctx->Pixel.ColorTableEnabled = GL_FALSE; ctx->Pixel.PostConvolutionColorTableEnabled = GL_FALSE; ctx->Pixel.PostColorMatrixColorTableEnabled = GL_FALSE; + ctx->Pixel.Convolution1DEnabled = GL_FALSE; + ctx->Pixel.Convolution2DEnabled = GL_FALSE; + ctx->Pixel.Separable2DEnabled = GL_FALSE; + for (i = 0; i < 3; i++) { + ASSIGN_4V(ctx->Pixel.ConvolutionBorderColor[i], 0.0, 0.0, 0.0, 0.0); + ctx->Pixel.ConvolutionBorderMode[i] = GL_REDUCE; + ASSIGN_4V(ctx->Pixel.ConvolutionFilterScale[i], 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.ConvolutionFilterBias[i], 0.0, 0.0, 0.0, 0.0); + } + ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0); /* Point group */ ctx->Point.SmoothFlag = GL_FALSE; @@ -1358,7 +1282,8 @@ static void init_attrib_groups( GLcontext *ctx ) * the allocations clean up and return GL_FALSE. * Return: GL_TRUE=success, GL_FALSE=failure */ -static GLboolean alloc_proxy_textures( GLcontext *ctx ) +static GLboolean +alloc_proxy_textures( GLcontext *ctx ) { GLboolean out_of_memory; GLint i; @@ -1419,12 +1344,15 @@ static GLboolean alloc_proxy_textures( GLcontext *ctx ) /* * Initialize a GLcontext struct. */ -GLboolean gl_initialize_context_data( GLcontext *ctx, - GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct ) +GLboolean +_mesa_initialize_context( GLcontext *ctx, + GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct ) { + GLuint dispatchSize; + (void) direct; /* not used */ /* misc one-time initializations */ @@ -1487,10 +1415,6 @@ GLboolean gl_initialize_context_data( GLcontext *ctx, ctx->Pixel.DriverReadBuffer = GL_FRONT_LEFT; } -#ifdef PROFILE - init_timings( ctx ); -#endif - if (!alloc_proxy_textures(ctx)) { free_shared_state(ctx, ctx->Shared); FREE(ctx->VB); @@ -1499,9 +1423,27 @@ GLboolean gl_initialize_context_data( GLcontext *ctx, return GL_FALSE; } + /* register the most recent extension functions with libGL */ + _glapi_add_entrypoint("glTbufferMask3DFX", 553); + _glapi_add_entrypoint("glCompressedTexImage3DARB", 554); + _glapi_add_entrypoint("glCompressedTexImage2DARB", 555); + _glapi_add_entrypoint("glCompressedTexImage1DARB", 556); + _glapi_add_entrypoint("glCompressedTexSubImage3DARB", 557); + _glapi_add_entrypoint("glCompressedTexSubImage2DARB", 558); + _glapi_add_entrypoint("glCompressedTexSubImage1DARB", 559); + _glapi_add_entrypoint("glGetCompressedTexImageARB", 560); + + /* Find the larger of Mesa's dispatch table and libGL's dispatch table. + * In practice, this'll be the same for stand-alone Mesa. But for DRI + * Mesa we do this to accomodate different versions of libGL and various + * DRI drivers. + */ + dispatchSize = MAX2(_glapi_get_dispatch_table_size(), + sizeof(struct _glapi_table) / sizeof(void *)); + /* setup API dispatch tables */ - ctx->Exec = (struct _glapi_table *) CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *)); - ctx->Save = (struct _glapi_table *) CALLOC(_glapi_get_dispatch_table_size() * sizeof(void *)); + ctx->Exec = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*)); + ctx->Save = (struct _glapi_table *) CALLOC(dispatchSize * sizeof(void*)); if (!ctx->Exec || !ctx->Save) { free_shared_state(ctx, ctx->Shared); FREE(ctx->VB); @@ -1510,8 +1452,8 @@ GLboolean gl_initialize_context_data( GLcontext *ctx, FREE(ctx->Exec); FREE(ctx); } - _mesa_init_exec_table( ctx->Exec ); - _mesa_init_dlist_table( ctx->Save ); + _mesa_init_exec_table(ctx->Exec, dispatchSize); + _mesa_init_dlist_table(ctx->Save, dispatchSize); ctx->CurrentDispatch = ctx->Exec; return GL_TRUE; @@ -1526,18 +1468,18 @@ GLboolean gl_initialize_context_data( GLcontext *ctx, * driver_ctx - pointer to device driver's context state struct * Return: pointer to a new gl_context struct or NULL if error. */ -GLcontext *gl_create_context( GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct ) +GLcontext * +gl_create_context( GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct ) { GLcontext *ctx = (GLcontext *) CALLOC( sizeof(GLcontext) ); if (!ctx) { return NULL; } - if (gl_initialize_context_data(ctx, visual, share_list, - driver_ctx, direct)) { + if (_mesa_initialize_context(ctx, visual, share_list, driver_ctx, direct)) { return ctx; } else { @@ -1552,7 +1494,8 @@ GLcontext *gl_create_context( GLvisual *visual, * Free the data associated with the given context. * But don't free() the GLcontext struct itself! */ -void gl_free_context_data( GLcontext *ctx ) +void +gl_free_context_data( GLcontext *ctx ) { struct gl_shine_tab *s, *tmps; GLuint i, j; @@ -1562,12 +1505,6 @@ void gl_free_context_data( GLcontext *ctx ) gl_make_current(NULL, NULL); } -#ifdef PROFILE - if (getenv("MESA_PROFILE")) { - print_timings( ctx ); - } -#endif - gl_matrix_dtr( &ctx->ModelView ); for (i = 0; i < MAX_MODELVIEW_STACK_DEPTH - 1; i++) { gl_matrix_dtr( &ctx->ModelViewStack[i] ); @@ -1670,7 +1607,8 @@ void gl_free_context_data( GLcontext *ctx ) /* * Destroy a GLcontext structure. */ -void gl_destroy_context( GLcontext *ctx ) +void +gl_destroy_context( GLcontext *ctx ) { if (ctx) { gl_free_context_data(ctx); @@ -1684,7 +1622,8 @@ void gl_destroy_context( GLcontext *ctx ) * Called by the driver after both the context and driver are fully * initialized. Currently just reads the config file. */ -void gl_context_initialize( GLcontext *ctx ) +void +gl_context_initialize( GLcontext *ctx ) { gl_read_config_file( ctx ); } @@ -1697,7 +1636,8 @@ void gl_context_initialize( GLcontext *ctx ) * dst - destination context * mask - bitwise OR of GL_*_BIT flags */ -void gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) +void +gl_copy_context( const GLcontext *src, GLcontext *dst, GLuint mask ) { if (mask & GL_ACCUM_BUFFER_BIT) { MEMCPY( &dst->Accum, &src->Accum, sizeof(struct gl_accum_attrib) ); @@ -1905,7 +1845,7 @@ _mesa_get_dispatch(GLcontext *ctx) void gl_problem( const GLcontext *ctx, const char *s ) { fprintf( stderr, "Mesa implementation error: %s\n", s ); - fprintf( stderr, "Report to mesa-bugs@mesa3d.org\n" ); + fprintf( stderr, "Report to Mesa bug database at www.mesa3d.org\n" ); (void) ctx; } diff --git a/xc/extras/Mesa/src/context.h b/xc/extras/Mesa/src/context.h index b280fdae9..3797928ea 100644 --- a/xc/extras/Mesa/src/context.h +++ b/xc/extras/Mesa/src/context.h @@ -73,19 +73,38 @@ _mesa_create_visual( GLboolean rgbFlag, GLint accumAlphaBits, GLint numSamples ); +extern GLboolean +_mesa_initialize_visual( GLvisual *v, + GLboolean rgbFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits, + GLint indexBits, + GLint depthBits, + GLint stencilBits, + GLint accumRedBits, + GLint accumGreenBits, + GLint accumBlueBits, + GLint accumAlphaBits, + GLint numSamples ); + /* this function is obsolete */ -extern GLvisual *gl_create_visual( GLboolean rgbFlag, - GLboolean alphaFlag, - GLboolean dbFlag, - GLboolean stereoFlag, - GLint depthBits, - GLint stencilBits, - GLint accumBits, - GLint indexBits, - GLint redBits, - GLint greenBits, - GLint blueBits, - GLint alphaBits ); +extern GLvisual * +gl_create_visual( GLboolean rgbFlag, + GLboolean alphaFlag, + GLboolean dbFlag, + GLboolean stereoFlag, + GLint depthBits, + GLint stencilBits, + GLint accumBits, + GLint indexBits, + GLint redBits, + GLint greenBits, + GLint blueBits, + GLint alphaBits ); extern void @@ -94,18 +113,29 @@ _mesa_destroy_visual( GLvisual *vis ); /*obsolete */ extern void gl_destroy_visual( GLvisual *vis ); + /* * Create/destroy a GLframebuffer. A GLframebuffer is like a GLX drawable. * It bundles up the depth buffer, stencil buffer and accum buffers into a * single entity. */ -extern GLframebuffer *gl_create_framebuffer( GLvisual *visual, - GLboolean softwareDepth, - GLboolean softwareStencil, - GLboolean softwareAccum, - GLboolean softwareAlpha ); +extern GLframebuffer * +gl_create_framebuffer( GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ); -extern void gl_destroy_framebuffer( GLframebuffer *buffer ); +extern void +_mesa_initialize_framebuffer( GLframebuffer *fb, + GLvisual *visual, + GLboolean softwareDepth, + GLboolean softwareStencil, + GLboolean softwareAccum, + GLboolean softwareAlpha ); + +extern void +gl_destroy_framebuffer( GLframebuffer *buffer ); @@ -113,36 +143,46 @@ extern void gl_destroy_framebuffer( GLframebuffer *buffer ); * Create/destroy a GLcontext. A GLcontext is like a GLX context. It * contains the rendering state. */ -extern GLcontext *gl_create_context( GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct); +extern GLcontext * +gl_create_context( GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct); + +extern GLboolean +_mesa_initialize_context( GLcontext *ctx, + GLvisual *visual, + GLcontext *share_list, + void *driver_ctx, + GLboolean direct ); -extern GLboolean gl_initialize_context_data( GLcontext *ctx, - GLvisual *visual, - GLcontext *share_list, - void *driver_ctx, - GLboolean direct ); +extern void +gl_free_context_data( GLcontext *ctx ); -extern void gl_free_context_data( GLcontext *ctx ); +extern void +gl_destroy_context( GLcontext *ctx ); -extern void gl_destroy_context( GLcontext *ctx ); +extern void +gl_context_initialize( GLcontext *ctx ); -extern void gl_context_initialize( GLcontext *ctx ); +extern void +gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); -extern void gl_copy_context(const GLcontext *src, GLcontext *dst, GLuint mask); +extern void +gl_make_current( GLcontext *ctx, GLframebuffer *buffer ); -extern void gl_make_current( GLcontext *ctx, GLframebuffer *buffer ); +extern void +gl_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer, + GLframebuffer *readBuffer ); -extern void gl_make_current2( GLcontext *ctx, GLframebuffer *drawBuffer, - GLframebuffer *readBuffer ); +extern GLcontext * +gl_get_current_context(void); -extern GLcontext *gl_get_current_context(void); /* @@ -190,35 +230,26 @@ _mesa_get_dispatch(GLcontext *ctx); * Miscellaneous */ -extern void gl_problem( const GLcontext *ctx, const char *s ); - -extern void gl_warning( const GLcontext *ctx, const char *s ); - -extern void gl_error( GLcontext *ctx, GLenum error, const char *s ); - -extern void gl_compile_error( GLcontext *ctx, GLenum error, const char *s ); - +void +gl_problem( const GLcontext *ctx, const char *s ); +extern void +gl_warning( const GLcontext *ctx, const char *s ); extern void -_mesa_Finish( void ); +gl_error( GLcontext *ctx, GLenum error, const char *s ); extern void -_mesa_Flush( void ); +gl_compile_error( GLcontext *ctx, GLenum error, const char *s ); extern void -_mesa_init_no_op_table(struct _glapi_table *exec); +_mesa_Finish( void ); extern void -_mesa_init_exec_table(struct _glapi_table *exec); - - +_mesa_Flush( void ); -#ifdef PROFILE -extern GLdouble gl_time( void ); -#endif #endif diff --git a/xc/extras/Mesa/src/copypix.c b/xc/extras/Mesa/src/copypix.c index a77086ccf..e76c170f6 100644 --- a/xc/extras/Mesa/src/copypix.c +++ b/xc/extras/Mesa/src/copypix.c @@ -32,13 +32,16 @@ #include "copypix.h" #include "depth.h" #include "feedback.h" +#include "imaging.h" #include "macros.h" #include "mem.h" #include "mmath.h" #include "pixel.h" +#include "pixeltex.h" #include "span.h" #include "state.h" #include "stencil.h" +#include "texture.h" #include "types.h" #include "zoom.h" #endif @@ -83,6 +86,7 @@ static void copy_rgba_pixels( GLcontext *ctx, GLubyte *saveReadAlpha; const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; + GLboolean applyTransferOps; /* Determine if copy should be done bottom-to-top or top-to-bottom */ if (srcy < desty) { @@ -103,7 +107,7 @@ static void copy_rgba_pixels( GLcontext *ctx, if (ctx->Depth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ - GLint z = (GLint) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMax); for (i=0;i<width;i++) { zspan[i] = z; } @@ -156,6 +160,15 @@ static void copy_rgba_pixels( GLcontext *ctx, p = NULL; } + applyTransferOps = ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled; + for (j = 0; j < height; j++, sy += stepy, dy += stepy) { if (overlapping) { MEMCPY(rgba, p, width * sizeof(GLubyte) * 4); @@ -188,12 +201,70 @@ static void copy_rgba_pixels( GLcontext *ctx, ctx->ReadBuffer->Alpha = saveReadAlpha; } - if (ctx->Pixel.ScaleOrBiasRGBA) { - gl_scale_and_bias_rgba( ctx, width, rgba ); + if (applyTransferOps) { + const GLfloat scale = (1.0F / 255.0F); + GLfloat rgbaFloat[MAX_WIDTH][4]; + GLuint k; + /* convert ubyte to float */ + for (k = 0; k < width; k++) { + rgbaFloat[k][RCOMP] = (GLfloat) rgba[k][RCOMP] * scale; + rgbaFloat[k][GCOMP] = (GLfloat) rgba[k][GCOMP] * scale; + rgbaFloat[k][BCOMP] = (GLfloat) rgba[k][BCOMP] * scale; + rgbaFloat[k][ACOMP] = (GLfloat) rgba[k][ACOMP] * scale; + } + /* scale & bias */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba(ctx, width, rgbaFloat); + } + /* color map lookup */ + if (ctx->Pixel.MapColorFlag) { + _mesa_map_rgba(ctx, width, rgbaFloat); + } + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, width, rgbaFloat); + } + /* color matrix */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, width, rgbaFloat); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, width, rgbaFloat); + } + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, width, (CONST GLfloat (*)[4]) rgbaFloat); + } + /* update min/max */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, width, (CONST GLfloat (*)[4]) rgbaFloat); + } + /* clamp to [0,1] and convert float back to ubyte */ + for (k = 0; k < width; k++) { + GLint r = (GLint) (rgbaFloat[k][RCOMP] * 255.0F); + GLint g = (GLint) (rgbaFloat[k][GCOMP] * 255.0F); + GLint b = (GLint) (rgbaFloat[k][BCOMP] * 255.0F); + GLint a = (GLint) (rgbaFloat[k][ACOMP] * 255.0F); + rgba[k][RCOMP] = (GLubyte) CLAMP(r, 0, 255); + rgba[k][GCOMP] = (GLubyte) CLAMP(g, 0, 255); + rgba[k][BCOMP] = (GLubyte) CLAMP(b, 0, 255); + rgba[k][ACOMP] = (GLubyte) CLAMP(a, 0, 255); + } } - if (ctx->Pixel.MapColorFlag) { - gl_map_rgba( ctx, width, rgba ); + + if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { + GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; + GLuint unit; + /* XXX not sure how multitexture is supposed to work here */ + for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) { + _mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba, + s, t, r, q); + gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba); + } } + if (quick_draw && dy >= 0 && dy < ctx->DrawBuffer->Height) { (*ctx->Driver.WriteRGBASpan)( ctx, width, destx, dy, (const GLubyte (*)[4])rgba, NULL ); @@ -244,7 +315,7 @@ static void copy_ci_pixels( GLcontext *ctx, if (ctx->Depth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ - GLint z = (GLint) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMax); for (i=0;i<width;i++) { zspan[i] = z; } @@ -298,10 +369,10 @@ static void copy_ci_pixels( GLcontext *ctx, } if (shift_or_offset) { - gl_shift_and_offset_ci( ctx, width, indexes ); + _mesa_shift_and_offset_ci( ctx, width, indexes ); } if (ctx->Pixel.MapColorFlag) { - gl_map_ci( ctx, width, indexes ); + _mesa_map_ci( ctx, width, indexes ); } if (zoom) { @@ -335,7 +406,7 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F; GLint overlapping; - if (!ctx->ReadBuffer->Depth || !ctx->DrawBuffer->Depth) { + if (!ctx->ReadBuffer->DepthBuffer || !ctx->DrawBuffer->DepthBuffer) { gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" ); return; } @@ -401,7 +472,7 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, for (i = 0; i < width; i++) { GLfloat d = depth[i] * ctx->Pixel.DepthScale + ctx->Pixel.DepthBias; - zspan[i] = (GLint) (CLAMP( d, 0.0F, 1.0F ) * DEPTH_SCALE); + zspan[i] = (GLdepth) (CLAMP(d, 0.0F, 1.0F) * ctx->Visual->DepthMax); } if (ctx->Visual->RGBAflag) { @@ -473,7 +544,7 @@ static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, } p = psten; for (j = 0; j < height; j++, ssy += stepy) { - gl_read_stencil_span( ctx, width, srcx, ssy, p ); + _mesa_read_stencil_span( ctx, width, srcx, ssy, p ); p += width; } p = psten; @@ -491,21 +562,21 @@ static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, p += width; } else { - gl_read_stencil_span( ctx, width, srcx, sy, stencil ); + _mesa_read_stencil_span( ctx, width, srcx, sy, stencil ); } if (shift_or_offset) { - gl_shift_and_offset_stencil( ctx, width, stencil ); + _mesa_shift_and_offset_stencil( ctx, width, stencil ); } if (ctx->Pixel.MapStencilFlag) { - gl_map_stencil( ctx, width, stencil ); + _mesa_map_stencil( ctx, width, stencil ); } if (zoom) { gl_write_zoomed_stencil_span( ctx, width, destx, dy, stencil, desty ); } else { - gl_write_stencil_span( ctx, width, destx, dy, stencil ); + _mesa_write_stencil_span( ctx, width, destx, dy, stencil ); } } @@ -542,6 +613,14 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, destx = (GLint) (ctx->Current.RasterPos[0] + 0.5F); desty = (GLint) (ctx->Current.RasterPos[1] + 0.5F); + ctx->OcclusionResult = GL_TRUE; + + if (ctx->Driver.CopyPixels && + (*ctx->Driver.CopyPixels)( ctx, srcx, srcy, width, height, + destx, desty, type )) { + return; + } + if (type == GL_COLOR && ctx->Visual->RGBAflag) { copy_rgba_pixels( ctx, srcx, srcy, width, height, destx, desty ); } diff --git a/xc/extras/Mesa/src/dd.h b/xc/extras/Mesa/src/dd.h index 25a82a546..ad389df4a 100644 --- a/xc/extras/Mesa/src/dd.h +++ b/xc/extras/Mesa/src/dd.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -390,6 +390,8 @@ struct dd_function_table { /*** *** For supporting hardware Z buffers: *** Either ALL or NONE of these functions must be implemented! + *** NOTE that Each depth value is a 32-bit GLuint. If the depth + *** buffer is less than 32 bits deep then the extra upperbits are zero. ***/ void (*WriteDepthSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, @@ -431,13 +433,11 @@ struct dd_function_table { * Else, only write stencil[i] if mask[i] is non-zero. */ - void (*ReadStencilSpan)( GLcontext *ctx, GLuint n, GLint x, GLint y, GLstencil stencil[] ); /* Read a horizontal span of stencil values from the stencil buffer. */ - void (*WriteStencilPixels)( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLstencil stencil[], @@ -454,18 +454,10 @@ struct dd_function_table { */ - /*** - *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions: + *** glDraw/Read/CopyPixels and glBitmap functions: ***/ - points_func PointsFunc; - line_func LineFunc; - triangle_func TriangleFunc; - quad_func QuadFunc; - rect_func RectFunc; - - GLboolean (*DrawPixels)( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, @@ -477,6 +469,25 @@ struct dd_function_table { * must do the job. */ + GLboolean (*ReadPixels)( GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + GLvoid *dest ); + /* Called by glReadPixels. + * Return GL_TRUE if operation completed, else return GL_FALSE. + * This function must respect all glPixelTransfer settings. + */ + + GLboolean (*CopyPixels)( GLcontext *ctx, + GLint srcx, GLint srcy, + GLsizei width, GLsizei height, + GLint dstx, GLint dsty, GLenum type ); + /* Do a glCopyPixels. Return GL_TRUE if operation completed, else + * return GL_FALSE. This function must respect all rasterization + * state, glPixelTransfer, glPixelZoom, etc. + */ + GLboolean (*Bitmap)( GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, @@ -484,78 +495,17 @@ struct dd_function_table { /* This is called by glBitmap. Works the same as DrawPixels, above. */ - void (*RenderStart)( GLcontext *ctx ); - void (*RenderFinish)( GLcontext *ctx ); - /* KW: These replace Begin and End, and have more relaxed semantics. - * They are called prior-to and after one or more vb flush, and are - * thus decoupled from the gl_begin/gl_end pairs, which are possibly - * more frequent. If a begin/end pair covers >1 vertex buffer, these - * are called at most once for the pair. (a bit broken at present) - */ - - void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end ); - /* This function, if not NULL, is called whenever new window coordinates - * are put in the vertex buffer. The vertices in question are those n - * such that start <= n < end. - * The device driver can convert the window coords to its own specialized - * format. The 3Dfx driver uses this. - * - * Note: Deprecated in favour of RegisterPipelineStages, below. - */ - - - render_func *RenderVBClippedTab; - render_func *RenderVBCulledTab; - render_func *RenderVBRawTab; - /* These function tables allow the device driver to rasterize an - * entire begin/end group of primitives at once. See the - * gl_render_vb() function in vbrender.c for more details. - */ - - - void (*ReducedPrimitiveChange)( GLcontext *ctx, GLenum primitive ); - /* If registered, this will be called when rendering transitions between - * points, lines and triangles. It is not called on transitions between - * primtives such as GL_TRIANGLES and GL_TRIANGLE_STRIPS, or between - * triangles and quads or triangles and polygons. - */ - - GLuint TriangleCaps; - /* Holds a list of the reasons why we might normally want to call - * render_triangle, but which are in fact implemented by the - * driver. The FX driver sets this to DD_TRI_CULL, and will soon - * implement DD_TRI_OFFSET. - */ - - - GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno ); - /* Driver may request additional render passes by returning GL_TRUE - * when this function is called. This function will be called - * after the first pass, and passes will be made until the function - * returns GL_FALSE. If no function is registered, only one pass - * is made. - * - * This function will be first invoked with passno == 1. - */ /*** *** Texture mapping functions: ***/ - void (*TexEnv)( GLcontext *ctx, GLenum pname, const GLfloat *param ); - /* - * Called whenever glTexEnv*() is called. - * Pname will be one of GL_TEXTURE_ENV_MODE or GL_TEXTURE_ENV_COLOR. - * If pname is GL_TEXTURE_ENV_MODE then param will be one - * of GL_MODULATE, GL_BLEND, GL_DECAL, or GL_REPLACE. - */ - void (*TexImage)( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj, GLint level, GLint internalFormat, const struct gl_texture_image *image ); - /* - * Called whenever a texture object's image is changed. + /* XXX this function is obsolete */ + /* Called whenever a texture object's image is changed. * texObject is the number of the texture object being changed. * level indicates the mipmap level. * internalFormat is the format in which the texture is to be stored. @@ -569,70 +519,310 @@ struct dd_function_table { GLsizei width, GLsizei height, GLint internalFormat, const struct gl_texture_image *image ); - /* - * Called from glTexSubImage() to define a sub-region of a texture. + /* XXX this function is obsolete */ + /* Called from glTexSubImage() to define a sub-region of a texture. + */ + + + GLboolean (*TexImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ); + GLboolean (*TexImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ); + GLboolean (*TexImage3D)( GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy ); + /* Called by glTexImage1/2/3D. + * Will not be called if any glPixelTransfer operations are enabled. + * Arguments: + * <target>, <level>, <format>, <type> and <pixels> are user specified. + * <packing> indicates the image packing of pixels. + * <texObj> is the target texture object. + * <texImage> is the target texture image. It will have the texture + * width, height, depth, border and internalFormat information. + * <retainInternalCopy> is returned by this function and indicates whether + * core Mesa should keep an internal copy of the texture image. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. If GL_FALSE is returned, this function will be + * called a second time after the texture image has been unpacked into + * GLubytes. It may be easier for the driver to handle then. + */ + + GLboolean (*TexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLsizei width, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + GLboolean (*TexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + GLboolean (*TexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, + const GLvoid *pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /* Called by glTexSubImage1/2/3D. + * Will not be called if any glPixelTransfer operations are enabled. + * Arguments: + * <target>, <level>, <xoffset>, <yoffset>, <zoffset>, <width>, <height>, + * <depth>, <format>, <type> and <pixels> are user specified. + * <packing> indicates the image packing of pixels. + * <texObj> is the target texture object. + * <texImage> is the target texture image. It will have the texture + * width, height, border and internalFormat information. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. If GL_FALSE is returned, then TexImage1/2/3D will + * be called with the complete texture image. + */ + + GLboolean (*CopyTexImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLint border ); + GLboolean (*CopyTexImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLsizei height, GLint border ); + /* Called by glCopyTexImage1D and glCopyTexImage2D. + * Will not be called if any glPixelTransfer operations are enabled. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. + */ + + GLboolean (*CopyTexSubImage1D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, + GLint x, GLint y, GLsizei width ); + GLboolean (*CopyTexSubImage2D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + GLboolean (*CopyTexSubImage3D)( GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + /* Called by glCopyTexSubImage1/2/3D. + * Will not be called if any glPixelTransfer operations are enabled. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. + */ + + GLvoid *(*GetTexImage)( GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj, + GLenum *formatOut, GLenum *typeOut, + GLboolean *freeImageOut ); + /* Called by glGetTexImage or by core Mesa when a texture image + * is needed for software fallback rendering. + * Return the address of the texture image or NULL if failure. + * The image must be tightly packed (i.e. row stride = image width) + * Return the image's format and type in formatOut and typeOut. + * The format and type must be values which are accepted by glTexImage. + * Set the freeImageOut flag if the returned image should be deallocated + * with FREE() when finished. + * The size of the image can be deduced from the target and level. + * Core Mesa will perform any image format/type conversions that are needed. + */ + + GLboolean (*CompressedTexImage1D)( GLcontext *ctx, GLenum target, + GLint level, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy); + GLboolean (*CompressedTexImage2D)( GLcontext *ctx, GLenum target, + GLint level, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy); + GLboolean (*CompressedTexImage3D)( GLcontext *ctx, GLenum target, + GLint level, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + GLboolean *retainInternalCopy); + /* Called by glCompressedTexImage1/2/3D. + * Arguments: + * <target>, <level>, <internalFormat>, <data> are user specified. + * <texObj> is the target texture object. + * <texImage> is the target texture image. It will have the texture + * width, height, depth, border and internalFormat information. + * <retainInternalCopy> is returned by this function and indicates whether + * core Mesa should keep an internal copy of the texture image. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. + */ + + GLboolean (*CompressedTexSubImage1D)( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + GLboolean (*CompressedTexSubImage2D)( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLsizei width, + GLint height, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + GLboolean (*CompressedTexSubImage3D)( GLcontext *ctx, GLenum target, + GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, + GLsizei width, GLint height, + GLint depth, GLenum format, + GLsizei imageSize, const GLvoid *data, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /* Called by glCompressedTexSubImage1/2/3D. + * Arguments: + * <target>, <level>, <x/z/zoffset>, <width>, <height>, <depth>, + * <imageSize>, and <data> are user specified. + * <texObj> is the target texture object. + * <texImage> is the target texture image. It will have the texture + * width, height, depth, border and internalFormat information. + * Return GL_TRUE if operation completed, return GL_FALSE if core Mesa + * should do the job. + */ + + void (*GetCompressedTexImage)( GLcontext *ctx, GLenum target, + GLint lod, void *image, + const struct gl_texture_object *texObj, + struct gl_texture_image *texImage ); + /* Called by glGetCompressedTexImageARB. + * <target>, <lod>, <image> are specified by user. + * <texObj> is the source texture object. + * <texImage> is the source texture image. + */ + + void (*TexEnv)( GLcontext *ctx, GLenum target, GLenum pname, + const GLfloat *param ); + /* Called by glTexEnv*(). */ void (*TexParameter)( GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, + struct gl_texture_object *texObj, GLenum pname, const GLfloat *params ); - /* - * Called whenever glTexParameter*() is called. - * target is GL_TEXTURE_1D or GL_TEXTURE_2D - * texObject is the texture object to modify - * pname is one of GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, - * GL_TEXTURE_WRAP_S, GL_TEXTURE_WRAP_T, or GL_TEXTURE_BORDER_COLOR. - * params is dependant on pname. See man glTexParameter. + /* Called by glTexParameter*(). + * <target> is user specified + * <texObj> the texture object to modify + * <pname> is one of GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MAG_FILTER, + * GL_TEXTURE_WRAP_[STR], or GL_TEXTURE_BORDER_COLOR. + * <params> is user specified. */ void (*BindTexture)( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ); - /* - * Called whenever glBindTexture() is called. This specifies which - * texture is to be the current one. No dirty flags will be set. + /* Called by glBindTexture(). */ void (*DeleteTexture)( GLcontext *ctx, struct gl_texture_object *tObj ); - /* - * Called when a texture object is about to be deallocated. Driver + /* Called when a texture object is about to be deallocated. Driver * should free anything attached to the DriverData pointers. */ - void (*UpdateTexturePalette)( GLcontext *ctx, - struct gl_texture_object *tObj ); - /* - * Called when the texture's color lookup table is changed. - * If tObj is NULL then the shared texture palette ctx->Texture.Palette - * was changed. + GLboolean (*IsTextureResident)( GLcontext *ctx, + struct gl_texture_object *t ); + /* Called by glAreTextureResident(). */ - void (*UseGlobalTexturePalette)( GLcontext *ctx, GLboolean state ); - /* - * Called via glEnable/Disable(GL_SHARED_TEXTURE_PALETTE_EXT) + void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t, + GLclampf priority ); + /* Called by glPrioritizeTextures(). */ void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber ); - /* - * Called by glActiveTextureARB to set current texture unit. + /* Called by glActiveTextureARB to set current texture unit. */ + void (*UpdateTexturePalette)( GLcontext *ctx, + struct gl_texture_object *tObj ); + /* Called when the texture's color lookup table is changed. + * If tObj is NULL then the shared texture palette ctx->Texture.Palette + * is to be updated. + */ - GLboolean (*IsTextureResident)( GLcontext *ctx, - struct gl_texture_object *t ); - /* - * Allows the driver to implement the AreTexturesResident tests without - * knowing about Mesa's internal hash tables for textures. + + + /*** + *** Accelerated point, line, polygon, glDrawPixels and glBitmap functions: + ***/ + + points_func PointsFunc; + line_func LineFunc; + triangle_func TriangleFunc; + quad_func QuadFunc; + rect_func RectFunc; + + + /*** + *** Transformation/Rendering functions + ***/ + + void (*RenderStart)( GLcontext *ctx ); + void (*RenderFinish)( GLcontext *ctx ); + /* KW: These replace Begin and End, and have more relaxed semantics. + * They are called prior-to and after one or more vb flush, and are + * thus decoupled from the gl_begin/gl_end pairs, which are possibly + * more frequent. If a begin/end pair covers >1 vertex buffer, these + * are called at most once for the pair. (a bit broken at present) + */ + + void (*RasterSetup)( struct vertex_buffer *VB, GLuint start, GLuint end ); + /* This function, if not NULL, is called whenever new window coordinates + * are put in the vertex buffer. The vertices in question are those n + * such that start <= n < end. + * The device driver can convert the window coords to its own specialized + * format. The 3Dfx driver uses this. + * + * Note: Deprecated in favour of RegisterPipelineStages, below. */ - void (*PrioritizeTexture)( GLcontext *ctx, - struct gl_texture_object *t, - GLclampf priority ); - /* - * Notify driver of priority change for a texture. + render_func *RenderVBClippedTab; + render_func *RenderVBCulledTab; + render_func *RenderVBRawTab; + /* These function tables allow the device driver to rasterize an + * entire begin/end group of primitives at once. See the + * gl_render_vb() function in vbrender.c for more details. */ + void (*ReducedPrimitiveChange)( GLcontext *ctx, GLenum primitive ); + /* If registered, this will be called when rendering transitions between + * points, lines and triangles. It is not called on transitions between + * primtives such as GL_TRIANGLES and GL_TRIANGLE_STRIPS, or between + * triangles and quads or triangles and polygons. + */ + GLuint TriangleCaps; + /* Holds a list of the reasons why we might normally want to call + * render_triangle, but which are in fact implemented by the + * driver. The FX driver sets this to DD_TRI_CULL, and will soon + * implement DD_TRI_OFFSET. + */ + GLboolean (*MultipassFunc)( struct vertex_buffer *VB, GLuint passno ); + /* Driver may request additional render passes by returning GL_TRUE + * when this function is called. This function will be called + * after the first pass, and passes will be made until the function + * returns GL_FALSE. If no function is registered, only one pass + * is made. + * + * This function will be first invoked with passno == 1. + */ /*** *** NEW in Mesa 3.x @@ -704,7 +894,11 @@ struct dd_function_table { void (*Lightfv)(GLcontext *ctx, GLenum light, GLenum pname, const GLfloat *params, GLint nparams ); void (*LightModelfv)(GLcontext *ctx, GLenum pname, const GLfloat *params); + void (*LineStipple)(GLcontext *ctx, GLint factor, GLushort pattern ); + void (*LineWidth)(GLcontext *ctx, GLfloat width); + void (*LogicOpcode)(GLcontext *ctx, GLenum opcode); void (*PolygonMode)(GLcontext *ctx, GLenum face, GLenum mode); + void (*PolygonStipple)(GLcontext *ctx, const GLubyte *mask ); void (*Scissor)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); void (*ShadeModel)(GLcontext *ctx, GLenum mode); void (*ClearStencil)(GLcontext *ctx, GLint s); diff --git a/xc/extras/Mesa/src/ddsample.c b/xc/extras/Mesa/src/ddsample.c index 364b091eb..31e4811b1 100644 --- a/xc/extras/Mesa/src/ddsample.c +++ b/xc/extras/Mesa/src/ddsample.c @@ -51,6 +51,13 @@ * the core Mesa library. */ +/* + * XXX XXX + * THIS FILE IS VERY OUT OF DATE! LOOK AT OSmesa/osmesa.c FOR A BETTER + * EXAMPLE DRIVER! + */ + + #ifdef PC_HEADER #include "all.h" @@ -240,10 +247,20 @@ static void dither( GLcontext *ctx, GLboolean enable ) /* - * Set the current drawing/reading buffer, return GL_TRUE or GL_FALSE - * for success/failure. + * Set the current reading buffer. + */ +static void set_read_buffer( GLcontext *ctx, GLframebuffer *bufer, + GLenum mode ) +{ + struct foo_mesa_context *foo = (struct foo_mesa_context *) ctx->DriverCtx; + setup_DD_pointers( ctx ); +} + + +/* + * Set the destination/draw buffer. */ -static GLboolean set_buffer( GLcontext *ctx, GLenum mode ) +static GLboolean set_draw_buffer( GLcontext *ctx, GLenum mode ) { struct foo_mesa_context *foo = (struct foo_mesa_context *) ctx->DriverCtx; setup_DD_pointers( ctx ); @@ -311,8 +328,8 @@ static void fast_points_function( GLcontext *ctx, GLuint first, GLuint last ) for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { int x, y; - x = (GLint) VB->Win[i][0]; - y = FLIP( (GLint) VB->Win[i][1] ); + x = (GLint) VB->Win.data[i][0]; + y = FLIP( (GLint) VB->Win.data[i][1] ); WriteRGBAPixel( x, y, VB->ColorPtr->data[i] ); } } @@ -332,10 +349,10 @@ static void fast_line_function( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv pixel = VB->ColorPtr->data[pv]; - x0 = (int) VB->Win[v0][0]; - y0 = FLIP( (int) VB->Win[v0][1] ); - x1 = (int) VB->Win[v1][0]; - y1 = FLIP( (int) VB->Win[v1][1] ); + x0 = (int) VB->Win.data[v0][0]; + y0 = FLIP( (int) VB->Win.data[v0][1] ); + x1 = (int) VB->Win.data[v1][0]; + y1 = FLIP( (int) VB->Win.data[v1][1] ); /* Draw line from (x0,y0) to (x1,y1) with current pixel color/index */ } @@ -615,7 +632,8 @@ static void setup_DD_pointers( GLcontext *ctx ) ctx->Driver.Index = set_index; ctx->Driver.Color = set_color; - ctx->Driver.SetBuffer = set_buffer; + ctx->Driver.SetDrawBuffer = set_draw_buffer; + ctx->Driver.SetReadBuffer = set_read_buffer; ctx->Driver.GetBufferSize = get_buffer_size; ctx->Driver.PointsFunc = fast_points_function; @@ -730,7 +748,11 @@ FooMesaBuffer FooMesaCreateBuffer( FooMesaVisual visual, return NULL; } - b->gl_buffer = gl_create_framebuffer( visual->gl_visual ); + b->gl_buffer = gl_create_framebuffer( visual->gl_visual, + visual->gl_visual->DepthBits > 0, + visual->gl_visual->StencilBits > 0, + visual->gl_visual->AccumBits > 0, + visual->gl_visual->AlphaBits > 0 ); b->the_window = your_window_id; /* other stuff */ @@ -769,7 +791,7 @@ FooMesaContext FooMesaCreateContext( FooMesaVisual visual, /* and then, finally let the context examine your initializations */ - gl_context_initialize( c->gl_ctx ); + _mesa_initialize_context( c->gl_ctx ); return c; diff --git a/xc/extras/Mesa/src/dlist.c b/xc/extras/Mesa/src/dlist.c index d491db47c..a48b7fe6a 100644 --- a/xc/extras/Mesa/src/dlist.c +++ b/xc/extras/Mesa/src/dlist.c @@ -1,3 +1,4 @@ +/* $Id: dlist.c,v 1.10.2.1 2000/06/09 02:29:34 daryll Exp $ */ /* * Mesa 3-D graphics library @@ -58,6 +59,7 @@ #include "mem.h" #include "pipeline.h" #include "pixel.h" +#include "pixeltex.h" #include "points.h" #include "polygon.h" #include "readpix.h" @@ -140,7 +142,17 @@ typedef enum { OPCODE_COLOR_MASK, OPCODE_COLOR_MATERIAL, OPCODE_COLOR_TABLE, + OPCODE_COLOR_TABLE_PARAMETER_FV, + OPCODE_COLOR_TABLE_PARAMETER_IV, OPCODE_COLOR_SUB_TABLE, + OPCODE_CONVOLUTION_FILTER_1D, + OPCODE_CONVOLUTION_FILTER_2D, + OPCODE_CONVOLUTION_PARAMETER_I, + OPCODE_CONVOLUTION_PARAMETER_IV, + OPCODE_CONVOLUTION_PARAMETER_F, + OPCODE_CONVOLUTION_PARAMETER_FV, + OPCODE_COPY_COLOR_SUB_TABLE, + OPCODE_COPY_COLOR_TABLE, OPCODE_COPY_PIXELS, OPCODE_COPY_TEX_IMAGE1D, OPCODE_COPY_TEX_IMAGE2D, @@ -166,6 +178,7 @@ typedef enum { OPCODE_FRUSTUM, OPCODE_HINT, OPCODE_HINT_PGI, + OPCODE_HISTOGRAM, OPCODE_INDEX_MASK, OPCODE_INIT_NAMES, OPCODE_LIGHT, @@ -182,6 +195,7 @@ typedef enum { OPCODE_MAPGRID1, OPCODE_MAPGRID2, OPCODE_MATRIX_MODE, + OPCODE_MIN_MAX, OPCODE_MULT_MATRIX, OPCODE_ORTHO, OPCODE_PASSTHROUGH, @@ -203,6 +217,8 @@ typedef enum { OPCODE_RASTER_POS, OPCODE_RECTF, OPCODE_READ_BUFFER, + OPCODE_RESET_HISTOGRAM, + OPCODE_RESET_MIN_MAX, OPCODE_SCALE, OPCODE_SCISSOR, OPCODE_SELECT_TEXTURE_SGIS, @@ -226,6 +242,16 @@ typedef enum { /* GL_ARB_multitexture */ OPCODE_ACTIVE_TEXTURE, OPCODE_CLIENT_ACTIVE_TEXTURE, + /* GL_SGIX/SGIS_pixel_texture */ + OPCODE_PIXEL_TEXGEN_SGIX, + OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, + /* GL_ARB_texture_compression */ + OPCODE_COMPRESSED_TEX_IMAGE_1D, + OPCODE_COMPRESSED_TEX_IMAGE_2D, + OPCODE_COMPRESSED_TEX_IMAGE_3D, + OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, + OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, + OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, /* The following three are meta instructions */ OPCODE_ERROR, /* raise compiled-in error */ OPCODE_VERTEX_CASSETTE, /* render prebuilt vertex buffer */ @@ -365,6 +391,14 @@ void gl_destroy_list( GLcontext *ctx, GLuint list ) FREE( n[6].data ); n += InstSize[n[0].opcode]; break; + case OPCODE_CONVOLUTION_FILTER_1D: + FREE( n[6].data ); + n += InstSize[n[0].opcode]; + break; + case OPCODE_CONVOLUTION_FILTER_2D: + FREE( n[7].data ); + n += InstSize[n[0].opcode]; + break; case OPCODE_POLYGON_STIPPLE: FREE( n[1].data ); n += InstSize[n[0].opcode]; @@ -393,6 +427,30 @@ void gl_destroy_list( GLcontext *ctx, GLuint list ) FREE(n[11].data); n += InstSize[n[0].opcode]; break; + case OPCODE_COMPRESSED_TEX_IMAGE_1D: + FREE(n[7].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_IMAGE_2D: + FREE(n[8].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_IMAGE_3D: + FREE(n[9].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: + FREE(n[7].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: + FREE(n[9].data); + n += InstSize[n[0].opcode]; + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: + FREE(n[11].data); + n += InstSize[n[0].opcode]; + break; case OPCODE_CONTINUE: n = (Node *) n[1].next; FREE( block ); @@ -500,8 +558,18 @@ void gl_init_lists( void ) InstSize[OPCODE_COLOR_MASK] = 5; InstSize[OPCODE_COLOR_MATERIAL] = 3; InstSize[OPCODE_COLOR_TABLE] = 7; + InstSize[OPCODE_COLOR_TABLE_PARAMETER_FV] = 7; + InstSize[OPCODE_COLOR_TABLE_PARAMETER_IV] = 7; InstSize[OPCODE_COLOR_SUB_TABLE] = 7; + InstSize[OPCODE_CONVOLUTION_FILTER_1D] = 7; + InstSize[OPCODE_CONVOLUTION_FILTER_2D] = 8; + InstSize[OPCODE_CONVOLUTION_PARAMETER_I] = 4; + InstSize[OPCODE_CONVOLUTION_PARAMETER_IV] = 7; + InstSize[OPCODE_CONVOLUTION_PARAMETER_F] = 4; + InstSize[OPCODE_CONVOLUTION_PARAMETER_FV] = 7; InstSize[OPCODE_COPY_PIXELS] = 6; + InstSize[OPCODE_COPY_COLOR_SUB_TABLE] = 6; + InstSize[OPCODE_COPY_COLOR_TABLE] = 6; InstSize[OPCODE_COPY_TEX_IMAGE1D] = 8; InstSize[OPCODE_COPY_TEX_IMAGE2D] = 9; InstSize[OPCODE_COPY_TEX_SUB_IMAGE1D] = 7; @@ -526,6 +594,7 @@ void gl_init_lists( void ) InstSize[OPCODE_FRUSTUM] = 7; InstSize[OPCODE_HINT] = 3; InstSize[OPCODE_HINT_PGI] = 3; + InstSize[OPCODE_HISTOGRAM] = 5; InstSize[OPCODE_INDEX_MASK] = 2; InstSize[OPCODE_INIT_NAMES] = 1; InstSize[OPCODE_LIGHT] = 7; @@ -542,6 +611,7 @@ void gl_init_lists( void ) InstSize[OPCODE_MAPGRID1] = 4; InstSize[OPCODE_MAPGRID2] = 7; InstSize[OPCODE_MATRIX_MODE] = 2; + InstSize[OPCODE_MIN_MAX] = 4; InstSize[OPCODE_MULT_MATRIX] = 17; InstSize[OPCODE_ORTHO] = 7; InstSize[OPCODE_PASSTHROUGH] = 2; @@ -563,6 +633,8 @@ void gl_init_lists( void ) InstSize[OPCODE_RASTER_POS] = 5; InstSize[OPCODE_RECTF] = 5; InstSize[OPCODE_READ_BUFFER] = 2; + InstSize[OPCODE_RESET_HISTOGRAM] = 2; + InstSize[OPCODE_RESET_MIN_MAX] = 2; InstSize[OPCODE_SCALE] = 4; InstSize[OPCODE_SCISSOR] = 5; InstSize[OPCODE_STENCIL_FUNC] = 4; @@ -585,6 +657,16 @@ void gl_init_lists( void ) InstSize[OPCODE_ERROR] = 3; InstSize[OPCODE_VERTEX_CASSETTE] = 9; InstSize[OPCODE_END_OF_LIST] = 1; + /* GL_SGIX/SGIS_pixel_texture */ + InstSize[OPCODE_PIXEL_TEXGEN_SGIX] = 2; + InstSize[OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS] = 3; + /* GL_ARB_texture_compression */ + InstSize[OPCODE_COMPRESSED_TEX_IMAGE_1D] = 8; + InstSize[OPCODE_COMPRESSED_TEX_IMAGE_2D] = 9; + InstSize[OPCODE_COMPRESSED_TEX_IMAGE_3D] = 10; + InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D] = 8; + InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D] = 10; + InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D] = 12; /* GL_ARB_multitexture */ InstSize[OPCODE_ACTIVE_TEXTURE] = 2; InstSize[OPCODE_CLIENT_ACTIVE_TEXTURE] = 2; @@ -976,6 +1058,66 @@ static void save_ColorTable( GLenum target, GLenum internalFormat, } + +static void +save_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); + FLUSH_VB(ctx, "dlist"); + + n = alloc_instruction( ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].f = params[0]; + if (pname == GL_COLOR_TABLE_SGI || + pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || + pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { + n[4].f = params[1]; + n[5].f = params[2]; + n[6].f = params[3]; + } + } + + if (ctx->ExecuteFlag) { + (*ctx->Exec->ColorTableParameterfv)( target, pname, params ); + } +} + + +static void +save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + ASSERT_OUTSIDE_BEGIN_END(ctx, "glColorTableParameterfv"); + FLUSH_VB(ctx, "dlist"); + + n = alloc_instruction( ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].i = params[0]; + if (pname == GL_COLOR_TABLE_SGI || + pname == GL_POST_CONVOLUTION_COLOR_TABLE_SGI || + pname == GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI) { + n[4].i = params[1]; + n[5].i = params[2]; + n[6].i = params[3]; + } + } + + if (ctx->ExecuteFlag) { + (*ctx->Exec->ColorTableParameteriv)( target, pname, params ); + } +} + + + static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table) @@ -1003,6 +1145,199 @@ static void save_ColorSubTable( GLenum target, GLsizei start, GLsizei count, } +static void +save_CopyColorSubTable(GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_COPY_COLOR_SUB_TABLE, 6 ); + if (n) { + n[1].e = target; + n[2].i = start; + n[3].i = x; + n[4].i = y; + n[5].i = width; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CopyColorSubTable)(target, start, x, y, width); + } +} + + +static void +save_CopyColorTable(GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_COPY_COLOR_TABLE, 6 ); + if (n) { + n[1].e = target; + n[2].e = internalformat; + n[3].i = x; + n[4].i = y; + n[5].i = width; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CopyColorTable)(target, internalformat, x, y, width); + } +} + + +static void +save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, + GLenum format, GLenum type, const GLvoid *filter) +{ + GET_CURRENT_CONTEXT(ctx); + GLvoid *image = _mesa_unpack_image(width, 1, 1, format, type, filter, + &ctx->Unpack); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_FILTER_1D, 6 ); + if (n) { + n[1].e = target; + n[2].e = internalFormat; + n[3].i = width; + n[4].e = format; + n[5].e = type; + n[6].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionFilter1D)( target, internalFormat, width, + format, type, filter ); + } +} + + +static void +save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, + GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *filter) +{ + GET_CURRENT_CONTEXT(ctx); + GLvoid *image = _mesa_unpack_image(width, height, 1, format, type, filter, + &ctx->Unpack); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_FILTER_2D, 7 ); + if (n) { + n[1].e = target; + n[2].e = internalFormat; + n[3].i = width; + n[4].i = height; + n[5].e = format; + n[6].e = type; + n[7].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionFilter2D)( target, internalFormat, width, height, + format, type, filter ); + } +} + + +static void +save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].i = param; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionParameteri)( target, pname, param ); + } +} + + +static void +save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].i = params[0]; + if (pname == GL_CONVOLUTION_BORDER_COLOR || + pname == GL_CONVOLUTION_FILTER_SCALE || + pname == GL_CONVOLUTION_FILTER_BIAS) { + n[4].i = params[1]; + n[5].i = params[2]; + n[6].i = params[3]; + } + else { + n[4].i = n[5].i = n[6].i = 0; + } + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionParameteriv)( target, pname, params ); + } +} + + +static void +save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].f = param; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionParameterf)( target, pname, param ); + } +} + + +static void +save_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6 ); + if (n) { + n[1].e = target; + n[2].e = pname; + n[3].f = params[0]; + if (pname == GL_CONVOLUTION_BORDER_COLOR || + pname == GL_CONVOLUTION_FILTER_SCALE || + pname == GL_CONVOLUTION_FILTER_BIAS) { + n[4].f = params[1]; + n[5].f = params[2]; + n[6].f = params[3]; + } + else { + n[4].f = n[5].f = n[6].f = 0.0F; + } + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ConvolutionParameterfv)( target, pname, params ); + } +} + static void save_CopyPixels( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ) @@ -1455,6 +1790,26 @@ static void save_HintPGI( GLenum target, GLint mode ) } +static void +save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_HISTOGRAM, 4 ); + if (n) { + n[1].e = target; + n[2].i = width; + n[3].e = internalFormat; + n[4].b = sink; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->Histogram)( target, width, internalFormat, sink ); + } +} + + static void save_IndexMask( GLuint mask ) { GET_CURRENT_CONTEXT(ctx); @@ -1928,6 +2283,25 @@ static void save_MatrixMode( GLenum mode ) } +static void +save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_MIN_MAX, 3 ); + if (n) { + n[1].e = target; + n[2].e = internalFormat; + n[3].b = sink; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->Minmax)( target, internalFormat, sink ); + } +} + + static void save_MultMatrixf( const GLfloat *m ) { GET_CURRENT_CONTEXT(ctx); @@ -2176,7 +2550,8 @@ static void save_PolygonOffset( GLfloat factor, GLfloat units ) static void save_PolygonOffsetEXT( GLfloat factor, GLfloat bias ) { - save_PolygonOffset(factor, DEPTH_SCALE * bias); + GET_CURRENT_CONTEXT(ctx); + save_PolygonOffset(factor, ctx->Visual->DepthMaxF * bias); } @@ -2491,6 +2866,38 @@ static void save_Rectsv(const GLshort *v1, const GLshort *v2) } +static void +save_ResetHistogram(GLenum target) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_RESET_HISTOGRAM, 1 ); + if (n) { + n[1].e = target; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ResetHistogram)( target ); + } +} + + +static void +save_ResetMinmax(GLenum target) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_RESET_MIN_MAX, 1 ); + if (n) { + n[1].e = target; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->ResetMinmax)( target ); + } +} + + static void save_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ) { GLfloat m[16]; @@ -2842,7 +3249,7 @@ static void save_TexImage2D( GLenum target, static void save_TexImage3D( GLenum target, - GLint level, GLint components, + GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, @@ -2851,7 +3258,7 @@ static void save_TexImage3D( GLenum target, GET_CURRENT_CONTEXT(ctx); if (target == GL_PROXY_TEXTURE_3D) { /* don't compile, execute immediately */ - (*ctx->Exec->TexImage3D)( target, level, components, width, + (*ctx->Exec->TexImage3D)( target, level, internalFormat, width, height, depth, border, format, type, pixels ); } else { @@ -2863,7 +3270,7 @@ static void save_TexImage3D( GLenum target, if (n) { n[1].e = target; n[2].i = level; - n[3].i = components; + n[3].i = internalFormat; n[4].i = (GLint) width; n[5].i = (GLint) height; n[6].i = (GLint) depth; @@ -2876,7 +3283,7 @@ static void save_TexImage3D( GLenum target, FREE(image); } if (ctx->ExecuteFlag) { - (*ctx->Exec->TexImage3D)( target, level, components, width, + (*ctx->Exec->TexImage3D)( target, level, internalFormat, width, height, depth, border, format, type, pixels ); } } @@ -3190,6 +3597,8 @@ static void save_ClientActiveTextureARB( GLenum target ) +/* GL_ARB_transpose_matrix */ + static void save_LoadTransposeMatrixdARB( const GLdouble m[16] ) { GLdouble tm[16]; @@ -3222,6 +3631,313 @@ static void save_MultTransposeMatrixfARB( const GLfloat m[16] ) } +static void save_PixelTexGenSGIX(GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_PIXEL_TEXGEN_SGIX, 1 ); + if (n) { + n[1].e = mode; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->PixelTexGenSGIX)( mode ); + } +} + + +/* GL_ARB_texture_compression */ +static void +save_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_PROXY_TEXTURE_1D) { + /* don't compile, execute immediately */ + (*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat, + width, border, imageSize, data); + } + else { + Node *n; + GLvoid *image; + FLUSH_VB(ctx, "dlist"); + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 8 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].e = internalFormat; + n[4].i = (GLint) width; + n[5].i = border; + n[6].i = imageSize; + n[7].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexImage1DARB)(target, level, internalFormat, + width, border, imageSize, data); + } + } +} + + +static void +save_CompressedTexImage2DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_PROXY_TEXTURE_2D) { + /* don't compile, execute immediately */ + (*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat, + width, height, border, imageSize, data); + } + else { + Node *n; + GLvoid *image; + FLUSH_VB(ctx, "dlist"); + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 9 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].e = internalFormat; + n[4].i = (GLint) width; + n[5].i = (GLint) height; + n[6].i = border; + n[7].i = imageSize; + n[8].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexImage2DARB)(target, level, internalFormat, + width, height, border, imageSize, data); + } + } +} + + +static void +save_CompressedTexImage3DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + if (target == GL_PROXY_TEXTURE_3D) { + /* don't compile, execute immediately */ + (*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat, + width, height, depth, border, imageSize, data); + } + else { + Node *n; + GLvoid *image; + FLUSH_VB(ctx, "dlist"); + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 10 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].e = internalFormat; + n[4].i = (GLint) width; + n[5].i = (GLint) height; + n[6].i = (GLint) depth; + n[7].i = border; + n[8].i = imageSize; + n[9].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexImage3DARB)(target, level, internalFormat, + width, height, depth, border, imageSize, data); + } + } +} + + +static void +save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + Node *n; + GLvoid *image; + + GET_CURRENT_CONTEXT(ctx); + FLUSH_VB(ctx, "dlist"); + + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 8 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].i = xoffset; + n[4].i = (GLint) width; + n[5].e = format; + n[6].i = imageSize; + n[7].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexSubImage1DARB)(target, level, xoffset, + width, format, imageSize, data); + } +} + + +static void +save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data) +{ + Node *n; + GLvoid *image; + + GET_CURRENT_CONTEXT(ctx); + FLUSH_VB(ctx, "dlist"); + + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 10 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].i = xoffset; + n[4].i = yoffset; + n[5].i = (GLint) width; + n[6].i = (GLint) height; + n[7].e = format; + n[8].i = imageSize; + n[9].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexSubImage2DARB)(target, level, xoffset, yoffset, + width, height, format, imageSize, data); + } +} + + +static void +save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + Node *n; + GLvoid *image; + + GET_CURRENT_CONTEXT(ctx); + FLUSH_VB(ctx, "dlist"); + + /* make copy of image */ + image = MALLOC(imageSize); + if (!image) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB"); + return; + } + MEMCPY(image, data, imageSize); + n = alloc_instruction( ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 12 ); + if (n) { + n[1].e = target; + n[2].i = level; + n[3].i = xoffset; + n[4].i = yoffset; + n[5].i = zoffset; + n[6].i = (GLint) width; + n[7].i = (GLint) height; + n[8].i = (GLint) depth; + n[9].e = format; + n[10].i = imageSize; + n[11].data = image; + } + else if (image) { + FREE(image); + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->CompressedTexSubImage3DARB)(target, level, xoffset, yoffset, + zoffset, width, height, depth, format, imageSize, data); + } +} + + +/* GL_SGIS_pixel_texture */ + +static void save_PixelTexGenParameteriSGIS(GLenum target, GLint value) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + FLUSH_VB(ctx, "dlist"); + n = alloc_instruction( ctx, OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS, 2 ); + if (n) { + n[1].e = target; + n[2].i = value; + } + if (ctx->ExecuteFlag) { + (*ctx->Exec->PixelTexGenParameteriSGIS)( target, value ); + } +} + + +static void save_PixelTexGenParameterfSGIS(GLenum target, GLfloat value) +{ + save_PixelTexGenParameteriSGIS(target, (GLint) value); +} + + +static void save_PixelTexGenParameterivSGIS(GLenum target, const GLint *value) +{ + save_PixelTexGenParameteriSGIS(target, *value); +} + + +static void save_PixelTexGenParameterfvSGIS(GLenum target, const GLfloat *value) +{ + save_PixelTexGenParameteriSGIS(target, (GLint) *value); +} void gl_compile_cassette( GLcontext *ctx ) { @@ -3364,10 +4080,12 @@ static void execute_list( GLcontext *ctx, GLuint list ) (MESA_VERBOSE & VERBOSE_IMMEDIATE)) gl_print_cassette( (struct immediate *) n[1].data ); - if (0) - fprintf(stderr, "Run cassette %d, rows %d..%d, beginstate %x\n", + if (MESA_VERBOSE & VERBOSE_DISPLAY_LIST) { + fprintf(stderr, "Run cassette %d, rows %d..%d, beginstate %x ", IM->id, IM->Start, IM->Count, IM->BeginState); + gl_print_vert_flags("orflag", IM->OrFlag); + } gl_fixup_cassette( ctx, (struct immediate *) n[1].data ); gl_execute_cassette( ctx, (struct immediate *) n[1].data ); @@ -3387,7 +4105,7 @@ static void execute_list( GLcontext *ctx, GLuint list ) struct gl_pixelstore_attrib save = ctx->Unpack; ctx->Unpack = _mesa_native_packing; (*ctx->Exec->Bitmap)( (GLsizei) n[1].i, (GLsizei) n[2].i, - n[3].f, n[4].f, n[5].f, n[6].f, n[7].data ); + n[3].f, n[4].f, n[5].f, n[6].f, (const GLubyte *) n[7].data ); ctx->Unpack = save; /* restore */ } break; @@ -3458,6 +4176,26 @@ static void execute_list( GLcontext *ctx, GLuint list ) ctx->Unpack = save; /* restore */ } break; + case OPCODE_COLOR_TABLE_PARAMETER_FV: + { + GLfloat params[4]; + params[0] = n[3].f; + params[1] = n[4].f; + params[2] = n[5].f; + params[3] = n[6].f; + (*ctx->Exec->ColorTableParameterfv)( n[1].e, n[2].e, params ); + } + break; + case OPCODE_COLOR_TABLE_PARAMETER_IV: + { + GLint params[4]; + params[0] = n[3].i; + params[1] = n[4].i; + params[2] = n[5].i; + params[3] = n[6].i; + (*ctx->Exec->ColorTableParameteriv)( n[1].e, n[2].e, params ); + } + break; case OPCODE_COLOR_SUB_TABLE: { struct gl_pixelstore_attrib save = ctx->Unpack; @@ -3467,6 +4205,58 @@ static void execute_list( GLcontext *ctx, GLuint list ) ctx->Unpack = save; /* restore */ } break; + case OPCODE_CONVOLUTION_FILTER_1D: + { + struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = _mesa_native_packing; + (*ctx->Exec->ConvolutionFilter1D)( n[1].e, n[2].i, n[3].i, + n[4].e, n[5].e, n[6].data ); + ctx->Unpack = save; /* restore */ + } + break; + case OPCODE_CONVOLUTION_FILTER_2D: + { + struct gl_pixelstore_attrib save = ctx->Unpack; + ctx->Unpack = _mesa_native_packing; + (*ctx->Exec->ConvolutionFilter2D)( n[1].e, n[2].i, n[3].i, + n[4].i, n[5].e, n[6].e, n[7].data ); + ctx->Unpack = save; /* restore */ + } + break; + case OPCODE_CONVOLUTION_PARAMETER_I: + (*ctx->Exec->ConvolutionParameteri)( n[1].e, n[2].e, n[3].i ); + break; + case OPCODE_CONVOLUTION_PARAMETER_IV: + { + GLint params[4]; + params[0] = n[3].i; + params[1] = n[4].i; + params[2] = n[5].i; + params[3] = n[6].i; + (*ctx->Exec->ConvolutionParameteriv)( n[1].e, n[2].e, params ); + } + break; + case OPCODE_CONVOLUTION_PARAMETER_F: + (*ctx->Exec->ConvolutionParameterf)( n[1].e, n[2].e, n[3].f ); + break; + case OPCODE_CONVOLUTION_PARAMETER_FV: + { + GLfloat params[4]; + params[0] = n[3].f; + params[1] = n[4].f; + params[2] = n[5].f; + params[3] = n[6].f; + (*ctx->Exec->ConvolutionParameterfv)( n[1].e, n[2].e, params ); + } + break; + case OPCODE_COPY_COLOR_SUB_TABLE: + (*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i, + n[3].i, n[4].i, n[5].i ); + break; + case OPCODE_COPY_COLOR_TABLE: + (*ctx->Exec->CopyColorSubTable)( n[1].e, n[2].i, + n[3].i, n[4].i, n[5].i ); + break; case OPCODE_COPY_PIXELS: (*ctx->Exec->CopyPixels)( n[1].i, n[2].i, (GLsizei) n[3].i, (GLsizei) n[4].i, n[5].e ); @@ -3549,6 +4339,9 @@ static void execute_list( GLcontext *ctx, GLuint list ) case OPCODE_HINT_PGI: (*ctx->Exec->HintPGI)( n[1].e, n[2].i ); break; + case OPCODE_HISTOGRAM: + (*ctx->Exec->Histogram)( n[1].e, n[2].i, n[3].e, n[4].b ); + break; case OPCODE_INDEX_MASK: (*ctx->Exec->IndexMask)( n[1].ui ); break; @@ -3642,6 +4435,9 @@ static void execute_list( GLcontext *ctx, GLuint list ) case OPCODE_MATRIX_MODE: (*ctx->Exec->MatrixMode)( n[1].e ); break; + case OPCODE_MIN_MAX: + (*ctx->Exec->Minmax)(n[1].e, n[2].e, n[3].b); + break; case OPCODE_MULT_MATRIX: if (sizeof(Node)==sizeof(GLfloat)) { (*ctx->Exec->MultMatrixf)( &n[1].f ); @@ -3721,6 +4517,12 @@ static void execute_list( GLcontext *ctx, GLuint list ) case OPCODE_RECTF: (*ctx->Exec->Rectf)( n[1].f, n[2].f, n[3].f, n[4].f ); break; + case OPCODE_RESET_HISTOGRAM: + (*ctx->Exec->ResetHistogram)( n[1].e ); + break; + case OPCODE_RESET_MIN_MAX: + (*ctx->Exec->ResetMinmax)( n[1].e ); + break; case OPCODE_SCALE: (*ctx->Exec->Scalef)( n[1].f, n[2].f, n[3].f ); break; @@ -3867,6 +4669,37 @@ static void execute_list( GLcontext *ctx, GLuint list ) case OPCODE_CLIENT_ACTIVE_TEXTURE: /* GL_ARB_multitexture */ (*ctx->Exec->ClientActiveTextureARB)( n[1].e ); break; + case OPCODE_PIXEL_TEXGEN_SGIX: /* GL_SGIX_pixel_texture */ + (*ctx->Exec->PixelTexGenSGIX)( n[1].e ); + break; + case OPCODE_PIXEL_TEXGEN_PARAMETER_SGIS: /* GL_SGIS_pixel_texture */ + (*ctx->Exec->PixelTexGenParameteriSGIS)( n[1].e, n[2].i ); + break; + case OPCODE_COMPRESSED_TEX_IMAGE_1D: /* GL_ARB_texture_compression */ + (*ctx->Exec->CompressedTexImage1DARB)(n[1].e, n[2].i, n[3].e, + n[4].i, n[5].i, n[6].i, n[7].data); + break; + case OPCODE_COMPRESSED_TEX_IMAGE_2D: /* GL_ARB_texture_compression */ + (*ctx->Exec->CompressedTexImage2DARB)(n[1].e, n[2].i, n[3].e, + n[4].i, n[5].i, n[6].i, n[7].i, n[8].data); + break; + case OPCODE_COMPRESSED_TEX_IMAGE_3D: /* GL_ARB_texture_compression */ + (*ctx->Exec->CompressedTexImage3DARB)(n[1].e, n[2].i, n[3].e, + n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, n[9].data); + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D: /* GL_ARB_texture_compress */ + (*ctx->Exec->CompressedTexSubImage1DARB)(n[1].e, n[2].i, n[3].i, + n[4].i, n[5].e, n[6].i, n[7].data); + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D: /* GL_ARB_texture_compress */ + (*ctx->Exec->CompressedTexSubImage2DARB)(n[1].e, n[2].i, n[3].i, + n[4].i, n[5].i, n[6].i, n[7].e, n[8].i, n[9].data); + break; + case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D: /* GL_ARB_texture_compress */ + (*ctx->Exec->CompressedTexSubImage3DARB)(n[1].e, n[2].i, n[3].i, + n[4].i, n[5].i, n[6].i, n[7].i, n[8].i, + n[9].e, n[10].i, n[11].data); + break; case OPCODE_CONTINUE: n = (Node *) n[1].next; break; @@ -3953,6 +4786,11 @@ _mesa_GenLists(GLsizei range ) return 0; } + /* + * Make this an atomic operation + */ + _glthread_LOCK_MUTEX(ctx->Shared->Mutex); + base = _mesa_HashFindFreeKeyBlock(ctx->Shared->DisplayList, range); if (base) { /* reserve the list IDs by with empty/dummy lists */ @@ -3961,6 +4799,9 @@ _mesa_GenLists(GLsizei range ) _mesa_HashInsert(ctx->Shared->DisplayList, base+i, make_empty_list()); } } + + _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex); + return base; } @@ -4149,13 +4990,13 @@ _mesa_ListBase( GLuint base ) /* - * Assign all the pointers in 'table' to point to Mesa's display list + * Assign all the pointers in <table> to point to Mesa's display list * building functions. */ void -_mesa_init_dlist_table( struct _glapi_table *table ) +_mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ) { - _mesa_init_no_op_table(table); + _mesa_init_no_op_table(table, tableSize); /* GL 1.0 */ table->Accum = save_Accum; @@ -4507,18 +5348,18 @@ _mesa_init_dlist_table( struct _glapi_table *table ) /* Not all are supported */ table->BlendColor = save_BlendColor; table->BlendEquation = save_BlendEquation; - table->ColorSubTable = _mesa_ColorSubTable; - table->ColorTable = _mesa_ColorTable; - table->ColorTableParameterfv = _mesa_ColorTableParameterfv; - table->ColorTableParameteriv = _mesa_ColorTableParameteriv; - table->ConvolutionFilter1D = _mesa_ConvolutionFilter1D; - table->ConvolutionFilter2D = _mesa_ConvolutionFilter2D; - table->ConvolutionParameterf = _mesa_ConvolutionParameterf; - table->ConvolutionParameterfv = _mesa_ConvolutionParameterfv; - table->ConvolutionParameteri = _mesa_ConvolutionParameteri; - table->ConvolutionParameteriv = _mesa_ConvolutionParameteriv; - table->CopyColorSubTable = _mesa_CopyColorSubTable; - table->CopyColorTable = _mesa_CopyColorTable; + table->ColorSubTable = save_ColorSubTable; + table->ColorTable = save_ColorTable; + table->ColorTableParameterfv = save_ColorTableParameterfv; + table->ColorTableParameteriv = save_ColorTableParameteriv; + table->ConvolutionFilter1D = save_ConvolutionFilter1D; + table->ConvolutionFilter2D = save_ConvolutionFilter2D; + table->ConvolutionParameterf = save_ConvolutionParameterf; + table->ConvolutionParameterfv = save_ConvolutionParameterfv; + table->ConvolutionParameteri = save_ConvolutionParameteri; + table->ConvolutionParameteriv = save_ConvolutionParameteriv; + table->CopyColorSubTable = save_CopyColorSubTable; + table->CopyColorTable = save_CopyColorTable; table->CopyConvolutionFilter1D = _mesa_CopyConvolutionFilter1D; table->CopyConvolutionFilter2D = _mesa_CopyConvolutionFilter2D; table->GetColorTable = _mesa_GetColorTable; @@ -4534,10 +5375,10 @@ _mesa_init_dlist_table( struct _glapi_table *table ) table->GetMinmaxParameterfv = _mesa_GetMinmaxParameterfv; table->GetMinmaxParameteriv = _mesa_GetMinmaxParameteriv; table->GetSeparableFilter = _mesa_GetSeparableFilter; - table->Histogram = _mesa_Histogram; - table->Minmax = _mesa_Minmax; - table->ResetHistogram = _mesa_ResetHistogram; - table->ResetMinmax = _mesa_ResetMinmax; + table->Histogram = save_Histogram; + table->Minmax = save_Minmax; + table->ResetHistogram = save_ResetHistogram; + table->ResetMinmax = save_ResetMinmax; table->SeparableFilter2D = _mesa_SeparableFilter2D; /* GL_EXT_texture3d */ @@ -4556,6 +5397,17 @@ _mesa_init_dlist_table( struct _glapi_table *table ) table->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; table->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; + /* 15. GL_SGIX_pixel_texture */ + table->PixelTexGenSGIX = save_PixelTexGenSGIX; + + /* 15. GL_SGIS_pixel_texture */ + table->PixelTexGenParameteriSGIS = save_PixelTexGenParameteriSGIS; + table->PixelTexGenParameterfSGIS = save_PixelTexGenParameterfSGIS; + table->PixelTexGenParameterivSGIS = save_PixelTexGenParameterivSGIS; + table->PixelTexGenParameterfvSGIS = save_PixelTexGenParameterfvSGIS; + table->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; + table->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; + /* GL_EXT_compiled_vertex_array */ table->LockArraysEXT = _mesa_LockArraysEXT; table->UnlockArraysEXT = _mesa_UnlockArraysEXT; @@ -4654,6 +5506,14 @@ _mesa_init_dlist_table( struct _glapi_table *table ) table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB; table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB; + /* ARB 12. GL_ARB_texture_compression */ + table->CompressedTexImage3DARB = save_CompressedTexImage3DARB; + table->CompressedTexImage2DARB = save_CompressedTexImage2DARB; + table->CompressedTexImage1DARB = save_CompressedTexImage1DARB; + table->CompressedTexSubImage3DARB = save_CompressedTexSubImage3DARB; + table->CompressedTexSubImage2DARB = save_CompressedTexSubImage2DARB; + table->CompressedTexSubImage1DARB = save_CompressedTexSubImage1DARB; + table->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB; } @@ -4705,6 +5565,16 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list ) fprintf(f,"CallList %d + offset %u = %u\n", (int) n[1].ui, ctx->List.ListBase, ctx->List.ListBase + n[1].ui ); break; + case OPCODE_COLOR_TABLE_PARAMETER_FV: + fprintf(f,"ColorTableParameterfv %s %s %f %f %f %f\n", + enum_string(n[1].e), enum_string(n[2].e), + n[3].f, n[4].f, n[5].f, n[6].f); + break; + case OPCODE_COLOR_TABLE_PARAMETER_IV: + fprintf(f,"ColorTableParameteriv %s %s %d %d %d %d\n", + enum_string(n[1].e), enum_string(n[2].e), + n[3].i, n[4].i, n[5].i, n[6].i); + break; case OPCODE_DISABLE: fprintf(f,"Disable %s\n", enum_string(n[1].e)); break; @@ -4788,6 +5658,7 @@ static void print_list( GLcontext *ctx, FILE *f, GLuint list ) ((struct immediate *) n[1].data)->id, n[2].ui, n[3].ui); + gl_print_cassette( (struct immediate *) n[1].data ); break; case OPCODE_CONTINUE: fprintf(f,"DISPLAY-LIST-CONTINUE\n"); diff --git a/xc/extras/Mesa/src/dlist.h b/xc/extras/Mesa/src/dlist.h index a5233e50c..b2aaa64c7 100644 --- a/xc/extras/Mesa/src/dlist.h +++ b/xc/extras/Mesa/src/dlist.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -24,15 +24,13 @@ */ - - - #ifndef DLIST_H #define DLIST_H #include "types.h" + struct display_list { union node *nodes; GLuint OrFlag; @@ -66,8 +64,7 @@ extern void _mesa_ListBase( GLuint base ); extern void _mesa_NewList( GLuint list, GLenum mode ); -extern void _mesa_init_dlist_table( struct _glapi_table *table ); - +extern void _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize ); extern void gl_compile_cassette( GLcontext *ctx ); diff --git a/xc/extras/Mesa/src/drawpix.c b/xc/extras/Mesa/src/drawpix.c index f89d80a70..7fb93abcc 100644 --- a/xc/extras/Mesa/src/drawpix.c +++ b/xc/extras/Mesa/src/drawpix.c @@ -33,11 +33,14 @@ #include "feedback.h" #include "image.h" #include "macros.h" +#include "mem.h" #include "mmath.h" #include "pixel.h" +#include "pixeltex.h" #include "span.h" #include "state.h" #include "stencil.h" +#include "texture.h" #include "types.h" #include "zoom.h" #endif @@ -112,24 +115,17 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, return GL_TRUE; } - if (ctx->NewState) { - gl_update_state(ctx); - } - - /* see if device driver can do the drawpix */ - if (ctx->Driver.DrawPixels - && (*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type, - unpack, pixels)) { - return GL_TRUE; - } - if ((ctx->RasterMask&(~(SCISSOR_BIT|WINCLIP_BIT)))==0 - && ctx->Pixel.RedBias==0.0 && ctx->Pixel.RedScale==1.0 - && ctx->Pixel.GreenBias==0.0 && ctx->Pixel.GreenScale==1.0 - && ctx->Pixel.BlueBias==0.0 && ctx->Pixel.BlueScale==1.0 - && ctx->Pixel.AlphaBias==0.0 && ctx->Pixel.AlphaScale==1.0 + && !ctx->Pixel.ScaleOrBiasRGBA + && !ctx->Pixel.ScaleOrBiasRGBApcm + && ctx->ColorMatrix.type == MATRIX_IDENTITY + && !ctx->Pixel.ColorTableEnabled + && !ctx->Pixel.PostColorMatrixColorTableEnabled + && !ctx->Pixel.MinMaxEnabled + && !ctx->Pixel.HistogramEnabled && ctx->Pixel.IndexShift==0 && ctx->Pixel.IndexOffset==0 && ctx->Pixel.MapColorFlag==0 + && ctx->Texture.ReallyEnabled == 0 && unpack->Alignment==1 && !unpack->SwapBytes && !unpack->LsbFirst) { @@ -180,7 +176,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, } else { /* setup array of fragment Z value to pass to zoom function */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); GLint i; assert(drawWidth < MAX_WIDTH); for (i=0; i<drawWidth; i++) @@ -347,7 +343,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { assert(drawWidth < MAX_WIDTH); - gl_map_ci8_to_rgba(ctx, drawWidth, src, rgba); + _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); (*ctx->Driver.WriteRGBASpan)(ctx, drawWidth, destX, destY, (const GLubyte (*)[4])rgba, NULL); @@ -361,7 +357,7 @@ simple_DrawPixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row=0; row<drawHeight; row++) { assert(drawWidth < MAX_WIDTH); - gl_map_ci8_to_rgba(ctx, drawWidth, src, rgba); + _mesa_map_ci8_to_rgba(ctx, drawWidth, src, rgba); gl_write_zoomed_rgba_span(ctx, drawWidth, destX, destY, zSpan, (void *) rgba, zoomY0); src += rowLength; @@ -418,7 +414,7 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, /* Fragment depth values */ if (ctx->Depth.Test || ctx->Fog.Enabled) { - GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth zval = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); GLint i; for (i = 0; i < drawWidth; i++) { zspan[i] = zval; @@ -430,7 +426,7 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y, */ for (row = 0; row < height; row++, y++) { GLuint indexes[MAX_WIDTH]; - const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack, + const GLvoid *source = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); _mesa_unpack_index_span(ctx, drawWidth, GL_UNSIGNED_INT, indexes, type, source, &ctx->Unpack, GL_TRUE); @@ -455,6 +451,7 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, GLenum type, const GLvoid *pixels ) { const GLboolean zoom = ctx->Pixel.ZoomX!=1.0 || ctx->Pixel.ZoomY!=1.0; + const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset; const GLint desty = y; GLint row, drawWidth; @@ -476,17 +473,23 @@ draw_stencil_pixels( GLcontext *ctx, GLint x, GLint y, GLstencil values[MAX_WIDTH]; GLenum destType = (sizeof(GLstencil) == sizeof(GLubyte)) ? GL_UNSIGNED_BYTE : GL_UNSIGNED_SHORT; - const GLvoid *source = gl_pixel_addr_in_image(&ctx->Unpack, + const GLvoid *source = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_COLOR_INDEX, type, 0, row, 0); _mesa_unpack_index_span(ctx, drawWidth, destType, values, - type, source, &ctx->Unpack, GL_TRUE); + type, source, &ctx->Unpack, GL_FALSE); + if (shift_or_offset) { + _mesa_shift_and_offset_stencil( ctx, drawWidth, values ); + } + if (ctx->Pixel.MapStencilFlag) { + _mesa_map_stencil( ctx, drawWidth, values ); + } if (zoom) { gl_write_zoomed_stencil_span( ctx, (GLuint) drawWidth, x, y, values, desty ); } else { - gl_write_stencil_span( ctx, (GLuint) drawWidth, x, y, values ); + _mesa_write_stencil_span( ctx, (GLuint) drawWidth, x, y, values ); } } } @@ -545,30 +548,23 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, /* Special case: directly write 16-bit depth values */ GLint row; for (row = 0; row < height; row++, y++) { - const GLdepth *zptr = gl_pixel_addr_in_image(&ctx->Unpack, + GLdepth zspan[MAX_WIDTH]; + const GLushort *zptr = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); - gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP ); + GLint i; + for (i = 0; i < width; i++) + zspan[i] = zptr[i]; + gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP ); } } - else if (type==GL_UNSIGNED_INT && sizeof(GLdepth)==sizeof(GLuint) + else if (type==GL_UNSIGNED_INT && ctx->Visual->DepthBits == 32 && !bias_or_scale && !zoom && ctx->Visual->RGBAflag) { /* Special case: directly write 32-bit depth values */ - GLint i, row; - /* Compute shift value to scale 32-bit uints down to depth values. */ - GLuint shift = 0; - GLuint max = MAX_DEPTH; - while ((max & 0x80000000) == 0) { - max = max << 1; - shift++; - } + GLint row; for (row = 0; row < height; row++, y++) { - GLdepth zspan[MAX_WIDTH]; - const GLdepth *zptr = gl_pixel_addr_in_image(&ctx->Unpack, + const GLuint *zptr = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); - for (i=0;i<width;i++) { - zspan[i] = zptr[i] >> shift; - } - gl_write_rgba_span( ctx, width, x, y, zspan, rgba, GL_BITMAP ); + gl_write_rgba_span( ctx, width, x, y, zptr, rgba, GL_BITMAP ); } } else { @@ -576,7 +572,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y, GLint row; for (row = 0; row < height; row++, y++) { GLdepth zspan[MAX_WIDTH]; - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, + const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels, width, height, GL_DEPTH_COMPONENT, type, 0, row, 0); _mesa_unpack_depth_span( ctx, drawWidth, zspan, type, src, &ctx->Unpack, GL_TRUE ); @@ -625,7 +621,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, /* Fragment depth values */ if (ctx->Depth.Test || ctx->Fog.Enabled) { /* fill in array of z values */ - GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * DEPTH_SCALE); + GLdepth z = (GLdepth) (ctx->Current.RasterPos[2] * ctx->Visual->DepthMaxF); GLint i; for (i=0;i<width;i++) { zspan[i] = z; @@ -652,10 +648,23 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, if (width > MAX_WIDTH) width = MAX_WIDTH; for (row = 0; row < height; row++, y++) { - const GLvoid *source = gl_pixel_addr_in_image(unpack, + const GLvoid *source = _mesa_image_address(unpack, pixels, width, height, format, type, 0, row, 0); _mesa_unpack_ubyte_color_span(ctx, width, GL_RGBA, (void*) rgba, format, type, source, unpack, GL_TRUE); + if (ctx->Pixel.MinMaxEnabled && ctx->MinMax.Sink) + continue; + + if (ctx->Texture.ReallyEnabled && ctx->Pixel.PixelTextureEnabled) { + GLfloat s[MAX_WIDTH], t[MAX_WIDTH], r[MAX_WIDTH], q[MAX_WIDTH]; + GLuint unit; + /* XXX not sure how multitexture is supposed to work here */ + for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) { + _mesa_pixeltexgen(ctx, width, (const GLubyte (*)[4]) rgba, + s, t, r, q); + gl_texture_pixels(ctx, unit, width, s, t, r, NULL, rgba); + } + } if (quickDraw) { (*ctx->Driver.WriteRGBASpan)( ctx, width, x, y, @@ -690,9 +699,22 @@ _mesa_DrawPixels( GLsizei width, GLsizei height, return; } + if (ctx->NewState) { + gl_update_state(ctx); + } + x = (GLint) (ctx->Current.RasterPos[0] + 0.5F); y = (GLint) (ctx->Current.RasterPos[1] + 0.5F); + ctx->OcclusionResult = GL_TRUE; + + /* see if device driver can do the drawpix */ + if (ctx->Driver.DrawPixels + && (*ctx->Driver.DrawPixels)(ctx, x, y, width, height, format, type, + &ctx->Unpack, pixels)) { + return; + } + switch (format) { case GL_STENCIL_INDEX: draw_stencil_pixels( ctx, x, y, width, height, type, pixels ); diff --git a/xc/extras/Mesa/src/enable.c b/xc/extras/Mesa/src/enable.c index 6c2220044..97554430e 100644 --- a/xc/extras/Mesa/src/enable.c +++ b/xc/extras/Mesa/src/enable.c @@ -494,6 +494,44 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state ) ctx->Pixel.PostColorMatrixColorTableEnabled = state; break; + /* GL_EXT_convolution */ + case GL_CONVOLUTION_1D: + ctx->Pixel.Convolution1DEnabled = state; + break; + case GL_CONVOLUTION_2D: + ctx->Pixel.Convolution2DEnabled = state; + break; + case GL_SEPARABLE_2D: + ctx->Pixel.Separable2DEnabled = state; + break; + + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) { + if (ctx->Visual->RGBAflag) { + const GLuint curr = ctx->Texture.CurrentUnit; + const GLuint flag = TEXTURE0_CUBE << (curr * 4); + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + ctx->NewState |= NEW_TEXTURE_ENABLE; + if (state) { + texUnit->Enabled |= TEXTURE0_CUBE; + ctx->Enabled |= flag; + } + else { + texUnit->Enabled &= ~TEXTURE0_CUBE; + ctx->Enabled &= ~flag; + } + } + } + else { + if (state) + gl_error(ctx, GL_INVALID_ENUM, "glEnable"); + else + gl_error(ctx, GL_INVALID_ENUM, "glDisable"); + return; + } + break; + default: if (state) { gl_error( ctx, GL_INVALID_ENUM, "glEnable" ); @@ -718,6 +756,25 @@ _mesa_IsEnabled( GLenum cap ) case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: return ctx->Pixel.PostColorMatrixColorTableEnabled; + /* GL_EXT_convolution */ + case GL_CONVOLUTION_1D: + return ctx->Pixel.Convolution1DEnabled; + case GL_CONVOLUTION_2D: + return ctx->Pixel.Convolution2DEnabled; + case GL_SEPARABLE_2D: + return ctx->Pixel.Separable2DEnabled; + + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) { + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled"); + return GL_FALSE; + } + default: gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" ); return GL_FALSE; diff --git a/xc/extras/Mesa/src/extensions.c b/xc/extras/Mesa/src/extensions.c index 82ad25208..18ff0c0cf 100644 --- a/xc/extras/Mesa/src/extensions.c +++ b/xc/extras/Mesa/src/extensions.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -40,7 +40,7 @@ struct extension { struct extension *next, *prev; - int enabled; + GLint enabled; char name[MAX_EXT_NAMELEN+1]; void (*notify)( GLcontext *, GLboolean ); }; @@ -48,36 +48,68 @@ struct extension { static struct { int enabled; const char *name; } default_extensions[] = { + { DEFAULT_OFF, "GL_ARB_imaging" }, /* in progress */ + { DEFAULT_ON, "GL_ARB_multitexture" }, + { DEFAULT_OFF, "GL_ARB_texture_compression" }, /* in progress */ + { DEFAULT_OFF, "GL_ARB_texture_cube_map" }, /* in progress */ + { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" }, + { ALWAYS_ENABLED, "GL_EXT_abgr" }, { DEFAULT_ON, "GL_EXT_blend_color" }, - { DEFAULT_OFF, "ARB_imaging" }, - { DEFAULT_ON, "GL_EXT_blend_minmax" }, + { DEFAULT_ON, "GL_EXT_blend_func_separate" }, { DEFAULT_ON, "GL_EXT_blend_logic_op" }, + { DEFAULT_ON, "GL_EXT_blend_minmax" }, { DEFAULT_ON, "GL_EXT_blend_subtract" }, + { DEFAULT_ON, "GL_EXT_clip_volume_hint" }, + { DEFAULT_OFF, "GL_EXT_convolution" }, /* in progress */ + { DEFAULT_ON, "GL_EXT_compiled_vertex_array" }, + { DEFAULT_ON, "GL_EXT_histogram" }, { DEFAULT_ON, "GL_EXT_paletted_texture" }, { DEFAULT_ON, "GL_EXT_point_parameters" }, { ALWAYS_ENABLED, "GL_EXT_polygon_offset" }, - { ALWAYS_ENABLED, "GL_EXT_vertex_array" }, - { ALWAYS_ENABLED, "GL_EXT_texture_object" }, - { DEFAULT_ON, "GL_EXT_texture3D" }, - { ALWAYS_ENABLED, "GL_MESA_window_pos" }, - { ALWAYS_ENABLED, "GL_MESA_resize_buffers" }, - { ALWAYS_ENABLED, "GL_EXT_shared_texture_palette" }, { ALWAYS_ENABLED, "GL_EXT_rescale_normal" }, - { ALWAYS_ENABLED, "GL_EXT_abgr" }, - { ALWAYS_ENABLED, "GL_SGIS_texture_edge_clamp" }, + { DEFAULT_ON, "GL_EXT_shared_texture_palette" }, { ALWAYS_ENABLED, "GL_EXT_stencil_wrap" }, + { DEFAULT_ON, "GL_EXT_texture3D" }, + { DEFAULT_OFF, "GL_EXT_texture_compression_s3tc" }, + { DEFAULT_OFF, "GL_EXT_texture_env" }, + { DEFAULT_ON, "GL_EXT_texture_env_add" }, + { ALWAYS_ENABLED, "GL_EXT_texture_object" }, + { DEFAULT_ON, "GL_EXT_texture_lod_bias" }, + { ALWAYS_ENABLED, "GL_EXT_vertex_array" }, + { DEFAULT_OFF, "GL_EXT_vertex_array_set" }, + { DEFAULT_OFF, "GL_HP_occlusion_test" }, { DEFAULT_ON, "GL_INGR_blend_func_separate" }, - { DEFAULT_ON, "GL_ARB_multitexture" }, + { ALWAYS_ENABLED, "GL_MESA_window_pos" }, + { ALWAYS_ENABLED, "GL_MESA_resize_buffers" }, { ALWAYS_ENABLED, "GL_NV_texgen_reflection" }, { DEFAULT_ON, "GL_PGI_misc_hints" }, - { DEFAULT_ON, "GL_EXT_compiled_vertex_array" }, - { DEFAULT_OFF, "GL_EXT_vertex_array_set" }, - { DEFAULT_ON, "GL_EXT_clip_volume_hint" }, - { DEFAULT_ON, "GL_EXT_texture_env_add" }, - { ALWAYS_ENABLED, "GL_ARB_tranpose_matrix" }, + { DEFAULT_ON, "GL_SGI_color_matrix" }, + { DEFAULT_ON, "GL_SGI_color_table" }, + { DEFAULT_ON, "GL_SGIS_pixel_texture" }, + { DEFAULT_ON, "GL_SGIS_texture_edge_clamp" }, + { DEFAULT_ON, "GL_SGIX_pixel_texture" }, + { DEFAULT_OFF, "GL_3DFX_texture_compression_FXT1" } }; +/* + * Update the boolean convenience flags in the Extensions struct. + */ +static void +update_extension_flags( GLcontext *ctx ) +{ + /* Update flags */ + ctx->Extensions.HaveTextureEnvAdd = gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add"); + ctx->Extensions.HaveTextureLodBias = gl_extension_is_enabled(ctx, "GL_EXT_texture_lod_bias"); + ctx->Extensions.HaveHpOcclusionTest = gl_extension_is_enabled(ctx, "GL_HP_occlusion_test"); + ctx->Extensions.HaveTextureCubeMap = gl_extension_is_enabled(ctx, "GL_ARB_texture_cube_map"); + ctx->Extensions.HaveTextureCompression = gl_extension_is_enabled(ctx, "GL_ARB_texture_compression"); + ctx->Extensions.HaveTextureCompressionS3TC = gl_extension_is_enabled(ctx, "GL_EXT_texture_compression_s3tc"); + ctx->Extensions.HaveTextureCompressionFXT1 = gl_extension_is_enabled(ctx, "GL_3DFX_texture_compression_FXT1"); +} + + + int gl_extensions_add( GLcontext *ctx, int state, const char *name, @@ -99,21 +131,26 @@ int gl_extensions_add( GLcontext *ctx, } -static int set_extension( GLcontext *ctx, const char *name, GLuint state ) +/* + * Either enable or disable the named extension. + */ +static int set_extension( GLcontext *ctx, const char *name, GLint state ) { struct extension *i; foreach( i, ctx->Extensions.ext_list ) if (strncmp(i->name, name, MAX_EXT_NAMELEN) == 0) break; - if (i == ctx->Extensions.ext_list) return 1; + if (i == ctx->Extensions.ext_list) + return 1; - if (i->enabled && !(i->enabled & ALWAYS_ENABLED)) - { + if (!(i->enabled & ALWAYS_ENABLED)) { if (i->notify) i->notify( ctx, state ); i->enabled = state; } + update_extension_flags(ctx); + return 0; } @@ -187,6 +224,7 @@ void gl_extensions_ctr( GLcontext *ctx ) default_extensions[i].name, 0 ); } + update_extension_flags(ctx); } diff --git a/xc/extras/Mesa/src/feedback.c b/xc/extras/Mesa/src/feedback.c index 12565b105..5d14e892e 100644 --- a/xc/extras/Mesa/src/feedback.c +++ b/xc/extras/Mesa/src/feedback.c @@ -167,7 +167,7 @@ static void feedback_vertex( GLcontext *ctx, GLuint v, GLuint pv ) win[0] = VB->Win.data[v][0]; win[1] = VB->Win.data[v][1]; - win[2] = VB->Win.data[v][2] / DEPTH_SCALE; + win[2] = VB->Win.data[v][2] / ctx->Visual->DepthMaxF; win[3] = 1.0 / VB->Win.data[v][3]; if (ctx->Light.ShadeModel == GL_SMOOTH) @@ -298,12 +298,13 @@ void gl_update_hitflag( GLcontext *ctx, GLfloat z ) void gl_select_triangle( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv ) { - struct vertex_buffer *VB = ctx->VB; + const struct vertex_buffer *VB = ctx->VB; if (gl_cull_triangle( ctx, v0, v1, v2, 0 )) { - gl_update_hitflag( ctx, VB->Win.data[v0][2] / DEPTH_SCALE ); - gl_update_hitflag( ctx, VB->Win.data[v1][2] / DEPTH_SCALE ); - gl_update_hitflag( ctx, VB->Win.data[v2][2] / DEPTH_SCALE ); + const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF; + gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); + gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); + gl_update_hitflag( ctx, VB->Win.data[v2][2] * zs ); } } @@ -311,21 +312,22 @@ void gl_select_triangle( GLcontext *ctx, void gl_select_line( GLcontext *ctx, GLuint v0, GLuint v1, GLuint pv ) { - struct vertex_buffer *VB = ctx->VB; - - gl_update_hitflag( ctx, VB->Win.data[v0][2] / DEPTH_SCALE ); - gl_update_hitflag( ctx, VB->Win.data[v1][2] / DEPTH_SCALE ); + const struct vertex_buffer *VB = ctx->VB; + const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF; + gl_update_hitflag( ctx, VB->Win.data[v0][2] * zs ); + gl_update_hitflag( ctx, VB->Win.data[v1][2] * zs ); } void gl_select_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; + const GLfloat zs = 1.0F / ctx->Visual->DepthMaxF; GLuint i; for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { - gl_update_hitflag( ctx, VB->Win.data[i][2] / DEPTH_SCALE); + gl_update_hitflag( ctx, VB->Win.data[i][2] * zs ); } } } diff --git a/xc/extras/Mesa/src/fog.c b/xc/extras/Mesa/src/fog.c index 1aff751c4..d21711805 100644 --- a/xc/extras/Mesa/src/fog.c +++ b/xc/extras/Mesa/src/fog.c @@ -33,6 +33,7 @@ #include "macros.h" #include "mmath.h" #include "types.h" +#include "xform.h" #endif @@ -84,6 +85,8 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) GET_CURRENT_CONTEXT(ctx); GLenum m; + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glFog"); + switch (pname) { case GL_FOG_MODE: m = (GLenum) (GLint) *params; @@ -105,23 +108,9 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) } break; case GL_FOG_START: -#if 0 - /* Prior to OpenGL 1.1, this was an error */ - if (*params<0.0F) { - gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_START)" ); - return; - } -#endif ctx->Fog.Start = *params; break; case GL_FOG_END: -#if 0 - /* Prior to OpenGL 1.1, this was an error */ - if (*params<0.0F) { - gl_error( ctx, GL_INVALID_VALUE, "glFog(GL_FOG_END)" ); - return; - } -#endif ctx->Fog.End = *params; break; case GL_FOG_INDEX: @@ -149,9 +138,13 @@ _mesa_Fogfv( GLenum pname, const GLfloat *params ) typedef void (*fog_func)( struct vertex_buffer *VB, GLuint side, GLubyte flag ); +typedef void (*fog_coord_func)( struct vertex_buffer *VB, + const GLvector4f *from, + GLubyte flag ); static fog_func fog_ci_tab[2]; static fog_func fog_rgba_tab[2]; +static fog_coord_func make_fog_coord_tab[2]; /* * Compute the fogged color for an array of vertices. @@ -209,6 +202,71 @@ _mesa_fog_vertices( struct vertex_buffer *VB ) } } + +static void check_fog_coords( GLcontext *ctx, struct gl_pipeline_stage *d ) +{ + d->type = 0; + + if (ctx->FogMode==FOG_FRAGMENT) + { + d->type = PIPE_IMMEDIATE|PIPE_PRECALC; + d->inputs = VERT_OBJ_ANY; + d->outputs = VERT_FOG_COORD; + } +} + + +static void gl_make_fog_coords( struct vertex_buffer *VB ) +{ + GLcontext *ctx = VB->ctx; + + /* If full eye coords weren't required, just calculate the eye Z + * values. + */ + if (!ctx->NeedEyeCoords) { + GLfloat *m = ctx->ModelView.m; + GLfloat plane[4]; + + plane[0] = m[2]; + plane[1] = m[6]; + plane[2] = m[10]; + plane[3] = m[14]; + + gl_dotprod_tab[0][VB->ObjPtr->size](&VB->Eye, + 2, /* fill z coordinates */ + VB->ObjPtr, + plane, + 0 ); + + make_fog_coord_tab[0]( VB, &VB->Eye, 0 ); + } + else + { + make_fog_coord_tab[0]( VB, VB->EyePtr, 0 ); + } +} + + +/* Drivers that want fog coordinates in VB->Spec[0] alpha, can substitute this + * stage for the default PIPE_OP_FOG pipeline stage. + */ +struct gl_pipeline_stage gl_fog_coord_stage = { + "build fog coordinates", + PIPE_OP_FOG, + PIPE_PRECALC|PIPE_IMMEDIATE, + 0, + NEW_FOG, + NEW_LIGHTING|NEW_RASTER_OPS|NEW_FOG|NEW_MODELVIEW, + 0, 0, + 0, 0, 0, + check_fog_coords, + gl_make_fog_coords +}; + + + + + /* * Apply fog to an array of RGBA pixels. * Input: n - number of pixels diff --git a/xc/extras/Mesa/src/get.c b/xc/extras/Mesa/src/get.c index 6c5f3ef9f..21b5b639a 100644 --- a/xc/extras/Mesa/src/get.c +++ b/xc/extras/Mesa/src/get.c @@ -57,6 +57,28 @@ #endif +static GLenum +pixel_texgen_mode(const GLcontext *ctx) +{ + if (ctx->Pixel.FragmentRgbSource == GL_CURRENT_RASTER_POSITION) { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_RGBA; + } + else { + return GL_RGB; + } + } + else { + if (ctx->Pixel.FragmentAlphaSource == GL_CURRENT_RASTER_POSITION) { + return GL_ALPHA; + } + else { + return GL_NONE; + } + } +} + + void _mesa_GetBooleanv( GLenum pname, GLboolean *params ) @@ -74,10 +96,16 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = INT_TO_BOOL(ctx->Visual->AccumRedBits); + break; case GL_ACCUM_GREEN_BITS: + *params = INT_TO_BOOL(ctx->Visual->AccumGreenBits); + break; case GL_ACCUM_BLUE_BITS: + *params = INT_TO_BOOL(ctx->Visual->AccumBlueBits); + break; case GL_ACCUM_ALPHA_BITS: - *params = INT_TO_BOOL(ctx->Visual->AccumBits); + *params = INT_TO_BOOL(ctx->Visual->AccumAlphaBits); break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_BOOL(ctx->Accum.ClearColor[0]); @@ -318,6 +346,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_GREEN_SCALE: *params = FLOAT_TO_BOOL(ctx->Pixel.GreenScale); break; + case GL_HISTOGRAM: + *params = ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = INT_TO_BOOL( ctx->Visual->IndexBits ); break; @@ -539,6 +570,9 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) params[0] = INT_TO_BOOL(MAX_WIDTH); params[1] = INT_TO_BOOL(MAX_HEIGHT); break; + case GL_MINMAX: + *params = ctx->Pixel.MinMaxEnabled; + break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = FLOAT_TO_BOOL(ctx->ModelView.m[i]); @@ -611,7 +645,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Pixel.MapStoSsize); break; case GL_POINT_SIZE: - *params = FLOAT_TO_BOOL(ctx->Point.Size ); + *params = FLOAT_TO_BOOL(ctx->Point.UserSize); break; case GL_POINT_SIZE_GRANULARITY: *params = FLOAT_TO_BOOL(ctx->Const.PointSizeGranularity ); @@ -747,13 +781,13 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Const.SubPixelBits); break; case GL_TEXTURE_1D: - *params = _mesa_IsEnabled(GL_TEXTURE_1D ); + *params = _mesa_IsEnabled(GL_TEXTURE_1D); break; case GL_TEXTURE_2D: - *params = _mesa_IsEnabled(GL_TEXTURE_2D ); + *params = _mesa_IsEnabled(GL_TEXTURE_2D); break; case GL_TEXTURE_3D: - *params = _mesa_IsEnabled(GL_TEXTURE_3D ); + *params = _mesa_IsEnabled(GL_TEXTURE_3D); break; case GL_TEXTURE_BINDING_1D: *params = INT_TO_BOOL(textureUnit->CurrentD[1]->Name); @@ -763,7 +797,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_TEXTURE_BINDING_3D: *params = INT_TO_BOOL(textureUnit->CurrentD[3]->Name); - break; + break; case GL_TEXTURE_ENV_COLOR: { params[0] = FLOAT_TO_BOOL(textureUnit->EnvColor[0]); @@ -908,6 +942,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(ctx->Array.EdgeFlag.Stride); break; + /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: *params = ctx->Const.MaxTextureUnits; break; @@ -918,6 +953,51 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) *params = INT_TO_BOOL(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + return; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = INT_TO_BOOL(textureUnit->CurrentCubeMap->Name); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + return; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = INT_TO_BOOL(ctx->Const.MaxCubeTextureSize); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = INT_TO_BOOL(ctx->Hint.TextureCompression); + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = INT_TO_BOOL(ctx->Const.NumCompressedTextureFormats); + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = INT_TO_BOOL(ctx->Const.CompressedTextureFormats[i]); + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetBooleanv"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = ENUM_TO_BOOL(GL_NICEST); @@ -934,12 +1014,12 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (GLboolean) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (GLboolean) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -948,8 +1028,8 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = (GLboolean) ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = (GLboolean) ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = (GLboolean) ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = (GLboolean) ctx->Hint.AllowDrawMem; @@ -978,7 +1058,14 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - /* don't have a color matrix */ + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ColorMatrix.m); + for (i=0;i<16;i++) { + params[i] = FLOAT_TO_BOOL(tm[i]); + } + } break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: { @@ -1011,8 +1098,124 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) } break; + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + *params = ctx->Depth.OcclusionTest; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); + } + return; + case GL_OCCLUSION_TEST_RESULT_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Depth.OcclusionTest) + *params = ctx->OcclusionResult; + else + *params = ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); + } + return; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLboolean) pixel_texgen_mode(ctx); + break; + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + case GL_COLOR_MATRIX_SGI: + for (i=0;i<16;i++) { + params[i] = FLOAT_TO_BOOL(ctx->ColorMatrix.m[i]); + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = INT_TO_BOOL(ctx->ColorStackDepth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = FLOAT_TO_BOOL(MAX_COLOR_STACK_DEPTH); + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[0]); + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[1]); + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[2]); + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixScale[3]); + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[0]); + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[1]); + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[2]); + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostColorMatrixBias[3]); + break; + + /* GL_EXT_convolution (also in 1.2 imaging) */ + 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; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[1]); + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[2]); + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionScale[3]); + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[0]); + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[1]); + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + *params = FLOAT_TO_BOOL(ctx->Pixel.PostConvolutionBias[2]); + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: - printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetBooleanv" ); } } @@ -1036,10 +1239,16 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = (GLdouble) ctx->Visual->AccumRedBits; + break; case GL_ACCUM_GREEN_BITS: + *params = (GLdouble) ctx->Visual->AccumGreenBits; + break; case GL_ACCUM_BLUE_BITS: + *params = (GLdouble) ctx->Visual->AccumBlueBits; + break; case GL_ACCUM_ALPHA_BITS: - *params = (GLdouble) ctx->Visual->AccumBits; + *params = (GLdouble) ctx->Visual->AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = (GLdouble) ctx->Accum.ClearColor[0]; @@ -1280,6 +1489,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_GREEN_SCALE: *params = (GLdouble) ctx->Pixel.GreenScale; break; + case GL_HISTOGRAM: + *params = (GLdouble) ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = (GLdouble) ctx->Visual->IndexBits; break; @@ -1501,6 +1713,9 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) params[0] = (GLdouble) MAX_WIDTH; params[1] = (GLdouble) MAX_HEIGHT; break; + case GL_MINMAX: + *params = (GLdouble) ctx->Pixel.MinMaxEnabled; + break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = (GLdouble) ctx->ModelView.m[i]; @@ -1573,7 +1788,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) ctx->Pixel.MapStoSsize; break; case GL_POINT_SIZE: - *params = (GLdouble) ctx->Point.Size; + *params = (GLdouble) ctx->Point.UserSize; break; case GL_POINT_SIZE_GRANULARITY: *params = (GLdouble) ctx->Const.PointSizeGranularity; @@ -1870,6 +2085,7 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = 0.0; break; + /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: *params = (GLdouble) ctx->Const.MaxTextureUnits; break; @@ -1880,6 +2096,50 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) *params = (GLdouble) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLdouble) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + return; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLdouble) textureUnit->CurrentCubeMap->Name; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + return; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLdouble) ctx->Const.MaxCubeTextureSize; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLdouble) ctx->Hint.TextureCompression; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLdouble) ctx->Const.NumCompressedTextureFormats; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = (GLdouble) ctx->Const.CompressedTextureFormats[i]; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetDoublev"); + break; /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: @@ -1897,12 +2157,12 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (GLdouble) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (GLdouble) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -1911,8 +2171,8 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = (GLdouble) ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = (GLdouble) ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = (GLdouble) ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = (GLdouble) ctx->Hint.AllowDrawMem; @@ -1941,7 +2201,14 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - /* don't have a color matrix */ + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ColorMatrix.m); + for (i=0;i<16;i++) { + params[i] = (GLdouble) tm[i]; + } + } break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: { @@ -1974,8 +2241,124 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params ) } break; + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + *params = (GLdouble) ctx->Depth.OcclusionTest; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); + } + return; + case GL_OCCLUSION_TEST_RESULT_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Depth.OcclusionTest) + *params = (GLdouble) ctx->OcclusionResult; + else + *params = (GLdouble) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); + } + return; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLdouble) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLdouble) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLdouble) pixel_texgen_mode(ctx); + break; + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + case GL_COLOR_MATRIX_SGI: + for (i=0;i<16;i++) { + params[i] = (GLdouble) ctx->ColorMatrix.m[i]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLdouble) (ctx->ColorStackDepth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLdouble) MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixScale[3]; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixBias[3]; + break; + + /* GL_EXT_convolution (also in 1.2 imaging) */ + 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; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionScale[1]; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionScale[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionScale[3]; + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionBias[0]; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionBias[1]; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + *params = (GLdouble) ctx->Pixel.PostConvolutionBias[2]; + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = (GLdouble) ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = (GLdouble) ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = (GLdouble) ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: - printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetDoublev" ); } } @@ -1999,10 +2382,16 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = (GLfloat) ctx->Visual->AccumRedBits; + break; case GL_ACCUM_GREEN_BITS: + *params = (GLfloat) ctx->Visual->AccumGreenBits; + break; case GL_ACCUM_BLUE_BITS: + *params = (GLfloat) ctx->Visual->AccumBlueBits; + break; case GL_ACCUM_ALPHA_BITS: - *params = (GLfloat) ctx->Visual->AccumBits; + *params = (GLfloat) ctx->Visual->AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = ctx->Accum.ClearColor[0]; @@ -2240,6 +2629,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_GREEN_SCALE: *params = (GLfloat) ctx->Pixel.GreenScale; break; + case GL_HISTOGRAM: + *params = (GLfloat) ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = (GLfloat) ctx->Visual->IndexBits; break; @@ -2461,6 +2853,9 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) params[0] = (GLfloat) MAX_WIDTH; params[1] = (GLfloat) MAX_HEIGHT; break; + case GL_MINMAX: + *params = (GLfloat) ctx->Pixel.MinMaxEnabled; + break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = ctx->ModelView.m[i]; @@ -2533,7 +2928,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) ctx->Pixel.MapStoSsize; break; case GL_POINT_SIZE: - *params = (GLfloat) ctx->Point.Size; + *params = (GLfloat) ctx->Point.UserSize; break; case GL_POINT_SIZE_GRANULARITY: *params = (GLfloat) ctx->Const.PointSizeGranularity; @@ -2832,6 +3227,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = 0.0; break; + /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: *params = (GLfloat) ctx->Const.MaxTextureUnits; break; @@ -2842,6 +3238,51 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) *params = (GLfloat) (GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLfloat) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + return; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLfloat) textureUnit->CurrentCubeMap->Name; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + return; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLfloat) ctx->Const.MaxCubeTextureSize; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLfloat) ctx->Hint.TextureCompression; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLfloat) ctx->Const.NumCompressedTextureFormats; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = (GLfloat) ctx->Const.CompressedTextureFormats[i]; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetFloatv"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = ENUM_TO_FLOAT(GL_NICEST); @@ -2858,12 +3299,12 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_ALWAYS_FAST_HINT_PGI: *params = (GLfloat) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (GLfloat) (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -2872,8 +3313,8 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = (GLfloat) ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = (GLfloat) ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = (GLfloat) ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = (GLfloat) ctx->Hint.AllowDrawMem; @@ -2902,7 +3343,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - /* don't have a color matrix */ + gl_matrix_transposef(params, ctx->ColorMatrix.m); break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: gl_matrix_transposef(params, ctx->ModelView.m); @@ -2914,8 +3355,124 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) gl_matrix_transposef(params, ctx->TextureMatrix[texTransformUnit].m); break; + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + *params = (GLfloat) ctx->Depth.OcclusionTest; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); + } + return; + case GL_OCCLUSION_TEST_RESULT_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Depth.OcclusionTest) + *params = (GLfloat) ctx->OcclusionResult; + else + *params = (GLfloat) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); + } + return; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLfloat) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLfloat) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLfloat) pixel_texgen_mode(ctx); + break; + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + case GL_COLOR_MATRIX_SGI: + for (i=0;i<16;i++) { + params[i] = ctx->ColorMatrix.m[i]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLfloat) (ctx->ColorStackDepth + 1); + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = (GLfloat) MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixScale[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixScale[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixScale[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = ctx->Pixel.PostColorMatrixScale[3]; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixBias[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixBias[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixBias[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = ctx->Pixel.PostColorMatrixBias[3]; + break; + + /* GL_EXT_convolution (also in 1.2 imaging) */ + 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; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + *params = ctx->Pixel.PostConvolutionScale[1]; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + *params = ctx->Pixel.PostConvolutionScale[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + *params = ctx->Pixel.PostConvolutionScale[3]; + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + *params = ctx->Pixel.PostConvolutionBias[0]; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + *params = ctx->Pixel.PostConvolutionBias[1]; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + *params = ctx->Pixel.PostConvolutionBias[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + *params = ctx->Pixel.PostConvolutionBias[2]; + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = (GLfloat) ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = (GLfloat) ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = (GLfloat) ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: - printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetFloatv" ); } } @@ -2939,10 +3496,16 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) switch (pname) { case GL_ACCUM_RED_BITS: + *params = (GLint) ctx->Visual->AccumRedBits; + break; case GL_ACCUM_GREEN_BITS: + *params = (GLint) ctx->Visual->AccumGreenBits; + break; case GL_ACCUM_BLUE_BITS: + *params = (GLint) ctx->Visual->AccumBlueBits; + break; case GL_ACCUM_ALPHA_BITS: - *params = (GLint) ctx->Visual->AccumBits; + *params = (GLint) ctx->Visual->AccumAlphaBits; break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_INT( ctx->Accum.ClearColor[0] ); @@ -3184,6 +3747,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_GREEN_SCALE: *params = (GLint) ctx->Pixel.GreenScale; break; + case GL_HISTOGRAM: + *params = (GLint) ctx->Pixel.HistogramEnabled; + break; case GL_INDEX_BITS: *params = (GLint) ctx->Visual->IndexBits; break; @@ -3405,6 +3971,9 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) params[0] = (GLint) MAX_WIDTH; params[1] = (GLint) MAX_HEIGHT; break; + case GL_MINMAX: + *params = (GLint) ctx->Pixel.MinMaxEnabled; + break; case GL_MODELVIEW_MATRIX: for (i=0;i<16;i++) { params[i] = (GLint) ctx->ModelView.m[i]; @@ -3477,7 +4046,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = ctx->Pixel.MapStoSsize; break; case GL_POINT_SIZE: - *params = (GLint) ctx->Point.Size; + *params = (GLint) ctx->Point.UserSize; break; case GL_POINT_SIZE_GRANULARITY: *params = (GLint) ctx->Const.PointSizeGranularity; @@ -3774,6 +4343,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = 0; break; + /* GL_ARB_multitexture */ case GL_MAX_TEXTURE_UNITS_ARB: *params = ctx->Const.MaxTextureUnits; break; @@ -3784,6 +4354,51 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; break; + /* GL_ARB_texture_cube_map */ + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = (GLint) _mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB); + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + return; + case GL_TEXTURE_BINDING_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = textureUnit->CurrentCubeMap->Name; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + return; + case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + *params = ctx->Const.MaxCubeTextureSize; + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLint) ctx->Hint.TextureCompression; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLint) ctx->Const.NumCompressedTextureFormats; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + break; + case GL_COMPRESSED_TEXTURE_FORMATS_ARB: + if (ctx->Extensions.HaveTextureCompression) { + GLuint i; + for (i = 0; i < ctx->Const.NumCompressedTextureFormats; i++) + params[i] = (GLint) ctx->Const.CompressedTextureFormats[i]; + } + else + gl_error(ctx, GL_INVALID_ENUM, "glGetIntegerv"); + break; + /* GL_PGI_misc_hints */ case GL_STRICT_DEPTHFUNC_HINT_PGI: *params = (GL_NICEST); @@ -3793,19 +4408,19 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_STRICT_SCISSOR_HINT_PGI: case GL_FULL_STIPPLE_HINT_PGI: - *params = (GL_TRUE); + *params = GL_TRUE; break; case GL_CONSERVE_MEMORY_HINT_PGI: - *params = (GL_FALSE); + *params = GL_FALSE; break; case GL_ALWAYS_FAST_HINT_PGI: *params = (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_FALSE && + ctx->Hint.AllowDrawFrg == GL_FALSE && ctx->Hint.AllowDrawMem == GL_FALSE); break; case GL_ALWAYS_SOFT_HINT_PGI: *params = (ctx->Hint.AllowDrawWin == GL_TRUE && - ctx->Hint.AllowDrawSpn == GL_TRUE && + ctx->Hint.AllowDrawFrg == GL_TRUE && ctx->Hint.AllowDrawMem == GL_TRUE); break; case GL_ALLOW_DRAW_OBJ_HINT_PGI: @@ -3814,8 +4429,8 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) case GL_ALLOW_DRAW_WIN_HINT_PGI: *params = ctx->Hint.AllowDrawWin; break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - *params = ctx->Hint.AllowDrawSpn; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + *params = ctx->Hint.AllowDrawFrg; break; case GL_ALLOW_DRAW_MEM_HINT_PGI: *params = ctx->Hint.AllowDrawMem; @@ -3828,7 +4443,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) *params = GL_DONT_CARE; break; case GL_BACK_NORMALS_HINT_PGI: - *params = (GL_TRUE); + *params = GL_TRUE; break; case GL_NATIVE_GRAPHICS_HANDLE_PGI: *params = 0; @@ -3844,7 +4459,14 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) /* GL_ARB_transpose_matrix */ case GL_TRANSPOSE_COLOR_MATRIX_ARB: - /* don't have a color matrix */ + { + GLfloat tm[16]; + GLuint i; + gl_matrix_transposef(tm, ctx->ColorMatrix.m); + for (i=0;i<16;i++) { + params[i] = (GLint) tm[i]; + } + } break; case GL_TRANSPOSE_MODELVIEW_MATRIX_ARB: { @@ -3877,8 +4499,124 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) } break; + /* GL_HP_occlusion_test */ + case GL_OCCLUSION_TEST_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + *params = (GLint) ctx->Depth.OcclusionTest; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); + } + return; + case GL_OCCLUSION_TEST_RESULT_HP: + if (ctx->Extensions.HaveHpOcclusionTest) { + if (ctx->Depth.OcclusionTest) + *params = (GLint) ctx->OcclusionResult; + else + *params = (GLint) ctx->OcclusionResultSaved; + /* reset flag now */ + ctx->OcclusionResult = GL_FALSE; + ctx->OcclusionResultSaved = GL_FALSE; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); + } + return; + + /* GL_SGIS_pixel_texture */ + case GL_PIXEL_TEXTURE_SGIS: + *params = (GLint) ctx->Pixel.PixelTextureEnabled; + break; + + /* GL_SGIX_pixel_texture */ + case GL_PIXEL_TEX_GEN_SGIX: + *params = (GLint) ctx->Pixel.PixelTextureEnabled; + break; + case GL_PIXEL_TEX_GEN_MODE_SGIX: + *params = (GLint) pixel_texgen_mode(ctx); + break; + + /* GL_SGI_color_matrix (also in 1.2 imaging) */ + case GL_COLOR_MATRIX_SGI: + for (i=0;i<16;i++) { + params[i] = (GLint) ctx->ColorMatrix.m[i]; + } + break; + case GL_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = ctx->ColorStackDepth + 1; + break; + case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: + *params = MAX_COLOR_STACK_DEPTH; + break; + case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixScale[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixScale[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixScale[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixScale[3]; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBias[0]; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBias[1]; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBias[2]; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixBias[3]; + break; + + /* GL_EXT_convolution (also in 1.2 imaging) */ + 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; + case GL_POST_CONVOLUTION_GREEN_SCALE_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionScale[1]; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionScale[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionScale[3]; + break; + case GL_POST_CONVOLUTION_RED_BIAS_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionBias[0]; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionBias[1]; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionBias[2]; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS_EXT: + *params = (GLint) ctx->Pixel.PostConvolutionBias[2]; + break; + + /* GL_SGI_color_table (also in 1.2 imaging */ + case GL_COLOR_TABLE_SGI: + *params = (GLint) ctx->Pixel.ColorTableEnabled; + break; + case GL_POST_CONVOLUTION_COLOR_TABLE_SGI: + *params = (GLint) ctx->Pixel.PostConvolutionColorTableEnabled; + break; + case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI: + *params = (GLint) ctx->Pixel.PostColorMatrixColorTableEnabled; + break; + default: - printf("invalid enum: %x\n", pname); gl_error( ctx, GL_INVALID_ENUM, "glGetIntegerv" ); } } diff --git a/xc/extras/Mesa/src/glapi.c b/xc/extras/Mesa/src/glapi.c index 5f5fc6de1..c3ac458cb 100644 --- a/xc/extras/Mesa/src/glapi.c +++ b/xc/extras/Mesa/src/glapi.c @@ -72,6 +72,18 @@ static _glthread_TSD ContextTSD; static GLuint MaxDispatchOffset = sizeof(struct _glapi_table) / sizeof(void *) - 1; static GLboolean GetSizeCalled = GL_FALSE; +/* strdup is actually not a standard ANSI C or POSIX routine + Irix will not define it if ANSI mode is in effect. */ +static char *str_dup(const char *str) +{ + char *copy; + copy = (char*) malloc(strlen(str) + 1); + if (!copy) + return NULL; + strcpy(copy, str); + return copy; +} + /* @@ -222,354 +234,6 @@ _glapi_get_version(void) } -struct name_address_offset { - const char *Name; - GLvoid *Address; - GLuint Offset; -}; - -static struct name_address_offset static_functions[1000]; - - - -/* - * Return dispatch table offset of the named static (built-in) function. - * Return -1 if function not found. - */ -static GLint -get_static_proc_offset(const char *funcName) -{ - GLuint i; - for (i = 0; static_functions[i].Name; i++) { - if (strcmp(static_functions[i].Name, funcName) == 0) { - return static_functions[i].Offset; - } - } - return -1; -} - - -/* - * Return dispatch function address the named static (built-in) function. - * Return NULL if function not found. - */ -static GLvoid * -get_static_proc_address(const char *funcName) -{ - GLint i = get_static_proc_offset(funcName); - if (i >= 0) - return static_functions[i].Address; - else - return NULL; -} - - - -/********************************************************************** - * Extension function management. - */ - - -#define MAX_EXTENSION_FUNCS 1000 - -static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS]; -static GLuint NumExtEntryPoints = 0; - - - -/* - * Generate a dispatch function (entrypoint) which jumps through - * the given slot number (offset) in the current dispatch table. - * We need assembly language in order to accomplish this. - */ -static void * -generate_entrypoint(GLuint functionOffset) -{ -#if defined(USE_X86_ASM) - /* - * This x86 code contributed by Josh Vanderhoof. - * - * 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax - * 00 01 02 03 04 - * 5: 85 c0 testl %eax,%eax - * 05 06 - * 7: 74 06 je f <entrypoint+0xf> - * 07 08 - * 9: ff a0 10 32 54 76 jmp *0x76543210(%eax) - * 09 0a 0b 0c 0d 0e - * f: e8 fc ff ff ff call __glapi_get_dispatch - * 0f 10 11 12 13 - * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax) - * 14 15 16 17 18 19 - */ - static const unsigned char temp[] = { - 0xa1, 0x00, 0x00, 0x00, 0x00, - 0x85, 0xc0, - 0x74, 0x06, - 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00, - 0xe8, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00 - }; - unsigned char *code = malloc(sizeof(temp)); - unsigned int next_insn; - if (code) { - memcpy(code, temp, sizeof(temp)); - - *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch; - *(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4; - next_insn = (unsigned int)(code + 0x14); - *(unsigned int *)(code + 0x10) = (unsigned int)_glapi_get_dispatch - next_insn; - *(unsigned int *)(code + 0x16) = (unsigned int)functionOffset * 4; - } - return code; -#else - return NULL; -#endif -} - - - -/* - * Add a new extension function entrypoint. - * Return: GL_TRUE = success or GL_FALSE = failure - */ -GLboolean -_glapi_add_entrypoint(const char *funcName, GLuint offset) -{ - /* Make sure we don't try to add a new entrypoint after someone - * has already called _glapi_get_dispatch_table_size()! If that's - * happened the caller's information will now be out of date. - */ - assert(!GetSizeCalled); - - /* first check if the named function is already statically present */ - { - GLint index = get_static_proc_offset(funcName); - if (index >= 0) { - return (GLboolean) (index == offset); /* bad offset! */ - } - } - - { - /* make sure this offset/name pair is legal */ - const char *name = _glapi_get_proc_name(offset); - if (name && strcmp(name, funcName) != 0) - return GL_FALSE; /* bad name! */ - } - - { - /* be sure index and name match known data */ - GLuint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { - /* function already registered with api */ - if (ExtEntryTable[i].Offset == offset) { - return GL_TRUE; /* offsets match */ - } - else { - return GL_FALSE; /* bad offset! */ - } - } - } - - /* make sure we have space */ - if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS) { - return GL_FALSE; - } - else { - void *entrypoint = generate_entrypoint(offset); - if (!entrypoint) - return GL_FALSE; - - ExtEntryTable[NumExtEntryPoints].Name = strdup(funcName); - ExtEntryTable[NumExtEntryPoints].Offset = offset; - ExtEntryTable[NumExtEntryPoints].Address = entrypoint; - NumExtEntryPoints++; - - if (offset > MaxDispatchOffset) - MaxDispatchOffset = offset; - - return GL_TRUE; /* success */ - } - } - - /* should never get here, but play it safe */ - return GL_FALSE; -} - - - -#if 0000 /* prototype code for dynamic extension slot allocation */ - -static int NextFreeOffset = 409; /*XXX*/ -#define MAX_DISPATCH_TABLE_SIZE 1000 - -/* - * Dynamically allocate a dispatch slot for an extension entrypoint - * and generate the assembly language dispatch stub. - * Return the dispatch offset for the function or -1 if no room or error. - */ -GLint -_glapi_add_entrypoint2(const char *funcName) -{ - int offset; - - /* first see if extension func is already known */ - offset = _glapi_get_proc_offset(funcName); - if (offset >= 0) - return offset; - - if (NumExtEntryPoints < MAX_EXTENSION_FUNCS - && NextFreeOffset < MAX_DISPATCH_TABLE_SIZE) { - void *entryPoint; - offset = NextFreeOffset; - entryPoint = generate_entrypoint(offset); - if (entryPoint) { - NextFreeOffset++; - ExtEntryTable[NumExtEntryPoints].Name = strdup(funcName); - ExtEntryTable[NumExtEntryPoints].Offset = offset; - ExtEntryTable[NumExtEntryPoints].Address = entryPoint; - NumExtEntryPoints++; - return offset; - } - } - return -1; -} - -#endif - - - -/* - * Return offset of entrypoint for named function within dispatch table. - */ -GLint -_glapi_get_proc_offset(const char *funcName) -{ - /* search extension functions first */ - GLint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { - return ExtEntryTable[i].Offset; - } - } - - /* search static functions */ - return get_static_proc_offset(funcName); -} - - - -/* - * Return entrypoint for named function. - */ -const GLvoid * -_glapi_get_proc_address(const char *funcName) -{ - /* search extension functions first */ - GLint i; - for (i = 0; i < NumExtEntryPoints; i++) { - if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { - return ExtEntryTable[i].Address; - } - } - - /* search static functions */ - return get_static_proc_address(funcName); -} - - - - -/* - * Return the name of the function at the given dispatch offset. - * This is only intended for debugging. - */ -const char * -_glapi_get_proc_name(GLuint offset) -{ - const GLuint n = sizeof(static_functions) / sizeof(struct name_address_offset); - GLuint i; - for (i = 0; i < n; i++) { - if (static_functions[i].Offset == offset) - return static_functions[i].Name; - } - - /* search added extension functions */ - for (i = 0; i < NumExtEntryPoints; i++) { - if (ExtEntryTable[i].Offset == offset) { - return ExtEntryTable[i].Name; - } - } - return NULL; -} - - - -/* - * Make sure there are no NULL pointers in the given dispatch table. - * Intented for debugging purposes. - */ -void -_glapi_check_table(const struct _glapi_table *table) -{ - const GLuint entries = _glapi_get_dispatch_table_size(); - const void **tab = (const void **) table; - GLuint i; - for (i = 1; i < entries; i++) { - assert(tab[i]); - } - -#ifdef DEBUG - /* Do some spot checks to be sure that the dispatch table - * slots are assigned correctly. - */ - { - GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); - char *BeginFunc = (char*) &table->Begin; - GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); - assert(BeginOffset == _gloffset_Begin); - assert(BeginOffset == offset); - } - { - GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); - char *viewportFunc = (char*) &table->Viewport; - GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); - assert(viewportOffset == _gloffset_Viewport); - assert(viewportOffset == offset); - } - { - GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); - char *VertexPointerFunc = (char*) &table->VertexPointer; - GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); - assert(VertexPointerOffset == _gloffset_VertexPointer); - assert(VertexPointerOffset == offset); - } - { - GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); - char *ResetMinMaxFunc = (char*) &table->ResetMinmax; - GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); - assert(ResetMinMaxOffset == _gloffset_ResetMinmax); - assert(ResetMinMaxOffset == offset); - } - { - GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); - char *blendColorFunc = (char*) &table->BlendColor; - GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); - assert(blendColorOffset == _gloffset_BlendColor); - assert(blendColorOffset == offset); - } - { - GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT"); - char *istextureFunc = (char*) &table->IsTextureEXT; - GLuint offset = (istextureFunc - (char *) table) / sizeof(void *); - assert(istextureOffset == _gloffset_IsTextureEXT); - assert(istextureOffset == offset); - } -#endif -} - - /* * For each entry in static_functions[] which use this function * we should implement a dispatch function in glapitemp.h and @@ -581,6 +245,12 @@ static int NotImplemented(void) } +struct name_address_offset { + const char *Name; + GLvoid *Address; + GLuint Offset; +}; + static struct name_address_offset static_functions[] = { /* GL 1.1 */ @@ -923,7 +593,7 @@ static struct name_address_offset static_functions[] = { { "glPushClientAttrib", (GLvoid *) glPushClientAttrib, _gloffset_PushClientAttrib }, /* 1.2 */ #ifdef GL_VERSION_1_2 -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else #define NAME(X) NotImplemented #endif @@ -967,9 +637,9 @@ static struct name_address_offset static_functions[] = { { "glCopyTexSubImage3D", (GLvoid *) NAME(glCopyTexSubImage3D), _gloffset_CopyTexSubImage3D }, #undef NAME - /* GL_ARB_multitexture */ + /* ARB 1. GL_ARB_multitexture */ #ifdef GL_ARB_multitexture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else #define NAME(X) NotImplemented #endif @@ -1009,9 +679,9 @@ static struct name_address_offset static_functions[] = { { "glMultiTexCoord4svARB", (GLvoid *) NAME(glMultiTexCoord4svARB), _gloffset_MultiTexCoord4svARB }, #undef NAME - /* GL_ARB_transpose_matrix */ + /* ARB 3. GL_ARB_transpose_matrix */ #ifdef GL_ARB_transpose_matrix -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else #define NAME(X) NotImplemented #endif @@ -1021,504 +691,1107 @@ static struct name_address_offset static_functions[] = { { "glMultTransposeMatrixfARB", (GLvoid *) NAME(glMultTransposeMatrixfARB), _gloffset_MultTransposeMatrixfARB }, #undef NAME - /* GL_ARB_multisample */ + /* ARB 5. GL_ARB_multisample */ #ifdef GL_ARB_multisample -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glSampleCoverageARB", (GLvoid *) NAME(glSampleCoverageARB), _gloffset_SampleCoverageARB }, - { "glSamplePassARB", (GLvoid *) NAME(glSamplePassARB), _gloffset_SamplePassARB }, + { "glSamplePassARB", NAME(glSamplePassARB), _gloffset_SamplePassARB }, + { "glSampleCoverageARB", NAME(glSampleCoverageARB), _gloffset_SampleCoverageARB }, #undef NAME + /* ARB 12. GL_ARB_texture_compression */ +#if 000 +#if defined(GL_ARB_texture_compression) && defined(_gloffset_CompressedTexImage3DARB) +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glCompressedTexImage3DARB", NAME(glCompressedTexImage3DARB), _gloffset_CompressedTexImage3DARB }, + { "glCompressedTexImage2DARB", NAME(glCompressedTexImage2DARB), _gloffset_CompressedTexImage2DARB }, + { "glCompressedTexImage1DARB", NAME(glCompressedTexImage1DARB), _gloffset_CompressedTexImage1DARB }, + { "glCompressedTexSubImage3DARB", NAME(glCompressedTexSubImage3DARB), _gloffset_CompressedTexSubImage3DARB }, + { "glCompressedTexSubImage2DARB", NAME(glCompressedTexSubImage2DARB), _gloffset_CompressedTexSubImage2DARB }, + { "glCompressedTexSubImage1DARB", NAME(glCompressedTexSubImage1DARB), _gloffset_CompressedTexSubImage1DARB }, + { "glGetCompressedTexImageARB", NAME(glGetCompressedTexImageARB), _gloffset_GetCompressedTexImageARB }, +#undef NAME +#endif + /* 2. GL_EXT_blend_color */ #ifdef GL_EXT_blend_color -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glBlendColorEXT", (GLvoid *) NAME(glBlendColorEXT), _gloffset_BlendColor }, + { "glBlendColorEXT", NAME(glBlendColorEXT), _gloffset_BlendColor }, #undef NAME /* 3. GL_EXT_polygon_offset */ #ifdef GL_EXT_polygon_offset -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glPolygonOffsetEXT", (GLvoid *) NAME(glPolygonOffsetEXT), _gloffset_PolygonOffsetEXT }, + { "glPolygonOffsetEXT", NAME(glPolygonOffsetEXT), _gloffset_PolygonOffsetEXT }, #undef NAME /* 6. GL_EXT_texture3D */ #ifdef GL_EXT_texture3D -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glCopyTexSubImage3DEXT", (GLvoid *) NAME(glCopyTexSubImage3DEXT), _gloffset_CopyTexSubImage3D }, - { "glTexImage3DEXT", (GLvoid *) NAME(glTexImage3DEXT), _gloffset_TexImage3D }, - { "glTexSubImage3DEXT", (GLvoid *) NAME(glTexSubImage3DEXT), _gloffset_TexSubImage3D }, + { "glCopyTexSubImage3DEXT", NAME(glCopyTexSubImage3DEXT), _gloffset_CopyTexSubImage3D }, + { "glTexImage3DEXT", NAME(glTexImage3DEXT), _gloffset_TexImage3D }, + { "glTexSubImage3DEXT", NAME(glTexSubImage3DEXT), _gloffset_TexSubImage3D }, #undef NAME /* 7. GL_SGI_texture_filter4 */ #ifdef GL_SGI_texture_filter4 -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetTexFilterFuncSGIS", (GLvoid *) NAME(glGetTexFilterFuncSGIS), _gloffset_GetTexFilterFuncSGIS }, - { "glTexFilterFuncSGIS", (GLvoid *) NAME(glTexFilterFuncSGIS), _gloffset_TexFilterFuncSGIS }, + { "glGetTexFilterFuncSGIS", NAME(glGetTexFilterFuncSGIS), _gloffset_GetTexFilterFuncSGIS }, + { "glTexFilterFuncSGIS", NAME(glTexFilterFuncSGIS), _gloffset_TexFilterFuncSGIS }, #undef NAME /* 9. GL_EXT_subtexture */ #ifdef GL_EXT_subtexture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glTexSubImage1DEXT", (GLvoid *) NAME(glTexSubImage1DEXT), _gloffset_TexSubImage1D }, - { "glTexSubImage2DEXT", (GLvoid *) NAME(glTexSubImage2DEXT), _gloffset_TexSubImage2D }, + { "glTexSubImage1DEXT", NAME(glTexSubImage1DEXT), _gloffset_TexSubImage1D }, + { "glTexSubImage2DEXT", NAME(glTexSubImage2DEXT), _gloffset_TexSubImage2D }, #undef NAME /* 10. GL_EXT_copy_texture */ #ifdef GL_EXT_copy_texture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glCopyTexImage1DEXT", (GLvoid *) NAME(glCopyTexImage1DEXT), _gloffset_CopyTexImage1D }, - { "glCopyTexImage2DEXT", (GLvoid *) NAME(glCopyTexImage2DEXT), _gloffset_CopyTexImage2D }, - { "glCopyTexSubImage1DEXT", (GLvoid *) NAME(glCopyTexSubImage1DEXT), _gloffset_CopyTexSubImage1D }, - { "glCopyTexSubImage2DEXT", (GLvoid *) NAME(glCopyTexSubImage2DEXT), _gloffset_CopyTexSubImage2D }, + { "glCopyTexImage1DEXT", NAME(glCopyTexImage1DEXT), _gloffset_CopyTexImage1D }, + { "glCopyTexImage2DEXT", NAME(glCopyTexImage2DEXT), _gloffset_CopyTexImage2D }, + { "glCopyTexSubImage1DEXT", NAME(glCopyTexSubImage1DEXT), _gloffset_CopyTexSubImage1D }, + { "glCopyTexSubImage2DEXT", NAME(glCopyTexSubImage2DEXT), _gloffset_CopyTexSubImage2D }, #undef NAME /* 11. GL_EXT_histogram */ #ifdef GL_EXT_histogram -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetHistogramEXT", (GLvoid *) NAME(glGetHistogramEXT), _gloffset_GetHistogramEXT }, - { "glGetHistogramParameterfvEXT", (GLvoid *) NAME(glGetHistogramParameterfvEXT), _gloffset_GetHistogramParameterfvEXT }, - { "glGetHistogramParameterivEXT", (GLvoid *) NAME(glGetHistogramParameterivEXT), _gloffset_GetHistogramParameterivEXT }, - { "glGetMinmaxEXT", (GLvoid *) NAME(glGetMinmaxEXT), _gloffset_GetMinmaxEXT }, - { "glGetMinmaxParameterfvEXT", (GLvoid *) NAME(glGetMinmaxParameterfvEXT), _gloffset_GetMinmaxParameterfvEXT }, - { "glGetMinmaxParameterivEXT", (GLvoid *) NAME(glGetMinmaxParameterivEXT), _gloffset_GetMinmaxParameterivEXT }, - { "glHistogramEXT", (GLvoid *) NAME(glHistogramEXT), _gloffset_Histogram }, - { "glMinmaxEXT", (GLvoid *) NAME(glMinmaxEXT), _gloffset_Minmax }, - { "glResetHistogramEXT", (GLvoid *) NAME(glResetHistogramEXT), _gloffset_ResetHistogram }, - { "glResetMinmaxEXT", (GLvoid *) NAME(glResetMinmaxEXT), _gloffset_ResetMinmax }, + { "glGetHistogramEXT", NAME(glGetHistogramEXT), _gloffset_GetHistogramEXT }, + { "glGetHistogramParameterfvEXT", NAME(glGetHistogramParameterfvEXT), _gloffset_GetHistogramParameterfvEXT }, + { "glGetHistogramParameterivEXT", NAME(glGetHistogramParameterivEXT), _gloffset_GetHistogramParameterivEXT }, + { "glGetMinmaxEXT", NAME(glGetMinmaxEXT), _gloffset_GetMinmaxEXT }, + { "glGetMinmaxParameterfvEXT", NAME(glGetMinmaxParameterfvEXT), _gloffset_GetMinmaxParameterfvEXT }, + { "glGetMinmaxParameterivEXT", NAME(glGetMinmaxParameterivEXT), _gloffset_GetMinmaxParameterivEXT }, + { "glHistogramEXT", NAME(glHistogramEXT), _gloffset_Histogram }, + { "glMinmaxEXT", NAME(glMinmaxEXT), _gloffset_Minmax }, + { "glResetHistogramEXT", NAME(glResetHistogramEXT), _gloffset_ResetHistogram }, + { "glResetMinmaxEXT", NAME(glResetMinmaxEXT), _gloffset_ResetMinmax }, #undef NAME /* 12. GL_EXT_convolution */ #ifdef GL_EXT_convolution -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glConvolutionFilter1DEXT", (GLvoid *) NAME(glConvolutionFilter1DEXT), _gloffset_ConvolutionFilter1D }, - { "glConvolutionFilter2DEXT", (GLvoid *) NAME(glConvolutionFilter2DEXT), _gloffset_ConvolutionFilter2D }, - { "glConvolutionParameterfEXT", (GLvoid *) NAME(glConvolutionParameterfEXT), _gloffset_ConvolutionParameterf }, - { "glConvolutionParameterfvEXT", (GLvoid *) NAME(glConvolutionParameterfvEXT), _gloffset_ConvolutionParameterfv }, - { "glConvolutionParameteriEXT", (GLvoid *) NAME(glConvolutionParameteriEXT), _gloffset_ConvolutionParameteri }, - { "glConvolutionParameterivEXT", (GLvoid *) NAME(glConvolutionParameterivEXT), _gloffset_ConvolutionParameteriv }, - { "glCopyConvolutionFilter1DEXT", (GLvoid *) NAME(glCopyConvolutionFilter1DEXT), _gloffset_CopyConvolutionFilter1D }, - { "glCopyConvolutionFilter2DEXT", (GLvoid *) NAME(glCopyConvolutionFilter2DEXT), _gloffset_CopyConvolutionFilter2D }, - { "glGetConvolutionFilterEXT", (GLvoid *) NAME(glGetConvolutionFilterEXT), _gloffset_GetConvolutionFilterEXT }, - { "glGetConvolutionParameterivEXT", (GLvoid *) NAME(glGetConvolutionParameterivEXT), _gloffset_GetConvolutionParameterivEXT }, - { "glGetConvolutionParameterfvEXT", (GLvoid *) NAME(glGetConvolutionParameterfvEXT), _gloffset_GetConvolutionParameterfvEXT }, - { "glGetSeparableFilterEXT", (GLvoid *) NAME(glGetSeparableFilterEXT), _gloffset_GetSeparableFilterEXT }, - { "glSeparableFilter2DEXT", (GLvoid *) NAME(glSeparableFilter2DEXT), _gloffset_SeparableFilter2D }, + { "glConvolutionFilter1DEXT", NAME(glConvolutionFilter1DEXT), _gloffset_ConvolutionFilter1D }, + { "glConvolutionFilter2DEXT", NAME(glConvolutionFilter2DEXT), _gloffset_ConvolutionFilter2D }, + { "glConvolutionParameterfEXT", NAME(glConvolutionParameterfEXT), _gloffset_ConvolutionParameterf }, + { "glConvolutionParameterfvEXT", NAME(glConvolutionParameterfvEXT), _gloffset_ConvolutionParameterfv }, + { "glConvolutionParameteriEXT", NAME(glConvolutionParameteriEXT), _gloffset_ConvolutionParameteri }, + { "glConvolutionParameterivEXT", NAME(glConvolutionParameterivEXT), _gloffset_ConvolutionParameteriv }, + { "glCopyConvolutionFilter1DEXT", NAME(glCopyConvolutionFilter1DEXT), _gloffset_CopyConvolutionFilter1D }, + { "glCopyConvolutionFilter2DEXT", NAME(glCopyConvolutionFilter2DEXT), _gloffset_CopyConvolutionFilter2D }, + { "glGetConvolutionFilterEXT", NAME(glGetConvolutionFilterEXT), _gloffset_GetConvolutionFilterEXT }, + { "glGetConvolutionParameterivEXT", NAME(glGetConvolutionParameterivEXT), _gloffset_GetConvolutionParameterivEXT }, + { "glGetConvolutionParameterfvEXT", NAME(glGetConvolutionParameterfvEXT), _gloffset_GetConvolutionParameterfvEXT }, + { "glGetSeparableFilterEXT", NAME(glGetSeparableFilterEXT), _gloffset_GetSeparableFilterEXT }, + { "glSeparableFilter2DEXT", NAME(glSeparableFilter2DEXT), _gloffset_SeparableFilter2D }, #undef NAME /* 14. GL_SGI_color_table */ #ifdef GL_SGI_color_table -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glColorTableSGI", (GLvoid *) NAME(glColorTableSGI), _gloffset_ColorTable }, - { "glColorTableParameterfvSGI", (GLvoid *) NAME(glColorTableParameterfvSGI), _gloffset_ColorTableParameterfv }, - { "glColorTableParameterivSGI", (GLvoid *) NAME(glColorTableParameterivSGI), _gloffset_ColorTableParameteriv }, - { "glCopyColorTableSGI", (GLvoid *) NAME(glCopyColorTableSGI), _gloffset_CopyColorTable }, - { "glGetColorTableSGI", (GLvoid *) NAME(glGetColorTableSGI), _gloffset_GetColorTableSGI }, - { "glGetColorTableParameterfvSGI", (GLvoid *) NAME(glGetColorTableParameterfvSGI), _gloffset_GetColorTableParameterfvSGI }, - { "glGetColorTableParameterivSGI", (GLvoid *) NAME(glGetColorTableParameterivSGI), _gloffset_GetColorTableParameterivSGI }, + { "glColorTableSGI", NAME(glColorTableSGI), _gloffset_ColorTable }, + { "glColorTableParameterfvSGI", NAME(glColorTableParameterfvSGI), _gloffset_ColorTableParameterfv }, + { "glColorTableParameterivSGI", NAME(glColorTableParameterivSGI), _gloffset_ColorTableParameteriv }, + { "glCopyColorTableSGI", NAME(glCopyColorTableSGI), _gloffset_CopyColorTable }, + { "glGetColorTableSGI", NAME(glGetColorTableSGI), _gloffset_GetColorTableSGI }, + { "glGetColorTableParameterfvSGI", NAME(glGetColorTableParameterfvSGI), _gloffset_GetColorTableParameterfvSGI }, + { "glGetColorTableParameterivSGI", NAME(glGetColorTableParameterivSGI), _gloffset_GetColorTableParameterivSGI }, #undef NAME /* 15. GL_SGIS_pixel_texture */ #ifdef GL_SGIS_pixel_texture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glPixelTexGenParameterfSGIS", (GLvoid *) NAME(glPixelTexGenParameterfSGIS), _gloffset_PixelTexGenParameterfSGIS }, - { "glPixelTexGenParameteriSGIS", (GLvoid *) NAME(glPixelTexGenParameteriSGIS), _gloffset_PixelTexGenParameteriSGIS }, - { "glGetPixelTexGenParameterfvSGIS", (GLvoid *) NAME(glGetPixelTexGenParameterfvSGIS), _gloffset_GetPixelTexGenParameterfvSGIS }, - { "glGetPixelTexGenParameterivSGIS", (GLvoid *) NAME(glGetPixelTexGenParameterivSGIS), _gloffset_GetPixelTexGenParameterivSGIS }, + { "glPixelTexGenParameterfSGIS", NAME(glPixelTexGenParameterfSGIS), _gloffset_PixelTexGenParameterfSGIS }, + { "glPixelTexGenParameteriSGIS", NAME(glPixelTexGenParameteriSGIS), _gloffset_PixelTexGenParameteriSGIS }, + { "glGetPixelTexGenParameterfvSGIS", NAME(glGetPixelTexGenParameterfvSGIS), _gloffset_GetPixelTexGenParameterfvSGIS }, + { "glGetPixelTexGenParameterivSGIS", NAME(glGetPixelTexGenParameterivSGIS), _gloffset_GetPixelTexGenParameterivSGIS }, #undef NAME /* 16. GL_SGIS_texture4D */ #ifdef GL_SGIS_texture4D -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glTexImage4DSGIS", (GLvoid *) NAME(glTexImage4DSGIS), _gloffset_TexImage4DSGIS }, - { "glTexSubImage4DSGIS", (GLvoid *) NAME(glTexSubImage4DSGIS), _gloffset_TexSubImage4DSGIS }, + { "glTexImage4DSGIS", NAME(glTexImage4DSGIS), _gloffset_TexImage4DSGIS }, + { "glTexSubImage4DSGIS", NAME(glTexSubImage4DSGIS), _gloffset_TexSubImage4DSGIS }, #undef NAME /* 20. GL_EXT_texture_object */ #ifdef GL_EXT_texture_object -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glAreTexturesResidentEXT", (GLvoid *) NAME(glAreTexturesResidentEXT), _gloffset_AreTexturesResidentEXT }, - { "glBindTextureEXT", (GLvoid *) NAME(glBindTextureEXT), _gloffset_BindTexture }, - { "glDeleteTexturesEXT", (GLvoid *) NAME(glDeleteTexturesEXT), _gloffset_DeleteTextures }, - { "glGenTexturesEXT", (GLvoid *) NAME(glGenTexturesEXT), _gloffset_GenTexturesEXT }, - { "glIsTextureEXT", (GLvoid *) NAME(glIsTextureEXT), _gloffset_IsTextureEXT }, - { "glPrioritizeTexturesEXT", (GLvoid *) NAME(glPrioritizeTexturesEXT), _gloffset_PrioritizeTextures }, + { "glAreTexturesResidentEXT", NAME(glAreTexturesResidentEXT), _gloffset_AreTexturesResidentEXT }, + { "glBindTextureEXT", NAME(glBindTextureEXT), _gloffset_BindTexture }, + { "glDeleteTexturesEXT", NAME(glDeleteTexturesEXT), _gloffset_DeleteTextures }, + { "glGenTexturesEXT", NAME(glGenTexturesEXT), _gloffset_GenTexturesEXT }, + { "glIsTextureEXT", NAME(glIsTextureEXT), _gloffset_IsTextureEXT }, + { "glPrioritizeTexturesEXT", NAME(glPrioritizeTexturesEXT), _gloffset_PrioritizeTextures }, #undef NAME /* 21. GL_SGIS_detail_texture */ #ifdef GL_SGIS_detail_texture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glDetailTexFuncSGIS", (GLvoid *) NAME(glDetailTexFuncSGIS), _gloffset_DetailTexFuncSGIS }, - { "glGetDetailTexFuncSGIS", (GLvoid *) NAME(glGetDetailTexFuncSGIS), _gloffset_GetDetailTexFuncSGIS }, + { "glDetailTexFuncSGIS", NAME(glDetailTexFuncSGIS), _gloffset_DetailTexFuncSGIS }, + { "glGetDetailTexFuncSGIS", NAME(glGetDetailTexFuncSGIS), _gloffset_GetDetailTexFuncSGIS }, #undef NAME /* 22. GL_SGIS_sharpen_texture */ #ifdef GL_SGIS_sharpen_texture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetSharpenTexFuncSGIS", (GLvoid *) NAME(glGetSharpenTexFuncSGIS), _gloffset_GetSharpenTexFuncSGIS }, - { "glSharpenTexFuncSGIS", (GLvoid *) NAME(glSharpenTexFuncSGIS), _gloffset_SharpenTexFuncSGIS }, + { "glGetSharpenTexFuncSGIS", NAME(glGetSharpenTexFuncSGIS), _gloffset_GetSharpenTexFuncSGIS }, + { "glSharpenTexFuncSGIS", NAME(glSharpenTexFuncSGIS), _gloffset_SharpenTexFuncSGIS }, #undef NAME /* 25. GL_SGIS_multisample */ #ifdef GL_SGIS_multisample -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glSampleMaskSGIS", (GLvoid *) NAME(glSampleMaskSGIS), _gloffset_SampleMaskSGIS }, - { "glSamplePatternSGIS", (GLvoid *) NAME(glSamplePatternSGIS), _gloffset_SamplePatternSGIS }, + { "glSampleMaskSGIS", NAME(glSampleMaskSGIS), _gloffset_SampleMaskSGIS }, + { "glSamplePatternSGIS", NAME(glSamplePatternSGIS), _gloffset_SamplePatternSGIS }, #undef NAME /* 30. GL_EXT_vertex_array */ #ifdef GL_EXT_vertex_array -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glArrayElementEXT", (GLvoid *) NAME(glArrayElementEXT), _gloffset_ArrayElement }, - { "glColorPointerEXT", (GLvoid *) NAME(glColorPointerEXT), _gloffset_ColorPointerEXT }, - { "glDrawArraysEXT", (GLvoid *) NAME(glDrawArraysEXT), _gloffset_DrawArrays }, - { "glEdgeFlagPointerEXT", (GLvoid *) NAME(glEdgeFlagPointerEXT), _gloffset_EdgeFlagPointerEXT }, - { "glGetPointervEXT", (GLvoid *) NAME(glGetPointervEXT), _gloffset_GetPointerv }, - { "glIndexPointerEXT", (GLvoid *) NAME(glIndexPointerEXT), _gloffset_IndexPointerEXT }, - { "glNormalPointerEXT", (GLvoid *) NAME(glNormalPointerEXT), _gloffset_NormalPointerEXT }, - { "glTexCoordPointerEXT", (GLvoid *) NAME(glTexCoordPointerEXT), _gloffset_TexCoordPointerEXT }, - { "glVertexPointerEXT", (GLvoid *) NAME(glVertexPointerEXT), _gloffset_VertexPointerEXT }, + { "glArrayElementEXT", NAME(glArrayElementEXT), _gloffset_ArrayElement }, + { "glColorPointerEXT", NAME(glColorPointerEXT), _gloffset_ColorPointerEXT }, + { "glDrawArraysEXT", NAME(glDrawArraysEXT), _gloffset_DrawArrays }, + { "glEdgeFlagPointerEXT", NAME(glEdgeFlagPointerEXT), _gloffset_EdgeFlagPointerEXT }, + { "glGetPointervEXT", NAME(glGetPointervEXT), _gloffset_GetPointerv }, + { "glIndexPointerEXT", NAME(glIndexPointerEXT), _gloffset_IndexPointerEXT }, + { "glNormalPointerEXT", NAME(glNormalPointerEXT), _gloffset_NormalPointerEXT }, + { "glTexCoordPointerEXT", NAME(glTexCoordPointerEXT), _gloffset_TexCoordPointerEXT }, + { "glVertexPointerEXT", NAME(glVertexPointerEXT), _gloffset_VertexPointerEXT }, #undef NAME /* 37. GL_EXT_blend_minmax */ #ifdef GL_EXT_blend_minmax -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glBlendEquationEXT", (GLvoid *) NAME(glBlendEquationEXT), _gloffset_BlendEquation }, + { "glBlendEquationEXT", NAME(glBlendEquationEXT), _gloffset_BlendEquation }, #undef NAME /* 52. GL_SGIX_sprite */ #ifdef GL_SGIX_sprite -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glSpriteParameterfSGIX", (GLvoid *) NAME(glSpriteParameterfSGIX), _gloffset_SpriteParameterfSGIX }, - { "glSpriteParameterfvSGIX", (GLvoid *) NAME(glSpriteParameterfvSGIX), _gloffset_SpriteParameterfvSGIX }, - { "glSpriteParameteriSGIX", (GLvoid *) NAME(glSpriteParameteriSGIX), _gloffset_SpriteParameteriSGIX }, - { "glSpriteParameterivSGIX", (GLvoid *) NAME(glSpriteParameterivSGIX), _gloffset_SpriteParameterivSGIX }, + { "glSpriteParameterfSGIX", NAME(glSpriteParameterfSGIX), _gloffset_SpriteParameterfSGIX }, + { "glSpriteParameterfvSGIX", NAME(glSpriteParameterfvSGIX), _gloffset_SpriteParameterfvSGIX }, + { "glSpriteParameteriSGIX", NAME(glSpriteParameteriSGIX), _gloffset_SpriteParameteriSGIX }, + { "glSpriteParameterivSGIX", NAME(glSpriteParameterivSGIX), _gloffset_SpriteParameterivSGIX }, #undef NAME /* 54. GL_EXT_point_parameters */ #ifdef GL_EXT_point_parameters -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glPointParameterfEXT", (GLvoid *) NAME(glPointParameterfEXT), _gloffset_PointParameterfEXT }, - { "glPointParameterfvEXT", (GLvoid *) NAME(glPointParameterfvEXT), _gloffset_PointParameterfvEXT }, + { "glPointParameterfEXT", NAME(glPointParameterfEXT), _gloffset_PointParameterfEXT }, + { "glPointParameterfvEXT", NAME(glPointParameterfvEXT), _gloffset_PointParameterfvEXT }, + { "glPointParameterfSGIS", NAME(glPointParameterfSGIS), _gloffset_PointParameterfEXT }, + { "glPointParameterfvSGIS", NAME(glPointParameterfvSGIS), _gloffset_PointParameterfvEXT }, #undef NAME /* 55. GL_SGIX_instruments */ #ifdef GL_SGIX_instruments -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glInstrumentsBufferSGIX", (GLvoid *) NAME(glInstrumentsBufferSGIX), _gloffset_InstrumentsBufferSGIX }, - { "glStartInstrumentsSGIX", (GLvoid *) NAME(glStartInstrumentsSGIX), _gloffset_StartInstrumentsSGIX }, - { "glStopInstrumentsSGIX", (GLvoid *) NAME(glStopInstrumentsSGIX), _gloffset_StopInstrumentsSGIX }, - { "glReadInstrumentsSGIX", (GLvoid *) NAME(glReadInstrumentsSGIX), _gloffset_ReadInstrumentsSGIX }, - { "glPollInstrumentsSGIX", (GLvoid *) NAME(glPollInstrumentsSGIX), _gloffset_PollInstrumentsSGIX }, - { "glGetInstrumentsSGIX", (GLvoid *) NAME(glGetInstrumentsSGIX), _gloffset_GetInstrumentsSGIX }, + { "glInstrumentsBufferSGIX", NAME(glInstrumentsBufferSGIX), _gloffset_InstrumentsBufferSGIX }, + { "glStartInstrumentsSGIX", NAME(glStartInstrumentsSGIX), _gloffset_StartInstrumentsSGIX }, + { "glStopInstrumentsSGIX", NAME(glStopInstrumentsSGIX), _gloffset_StopInstrumentsSGIX }, + { "glReadInstrumentsSGIX", NAME(glReadInstrumentsSGIX), _gloffset_ReadInstrumentsSGIX }, + { "glPollInstrumentsSGIX", NAME(glPollInstrumentsSGIX), _gloffset_PollInstrumentsSGIX }, + { "glGetInstrumentsSGIX", NAME(glGetInstrumentsSGIX), _gloffset_GetInstrumentsSGIX }, #undef NAME /* 57. GL_SGIX_framezoom */ #ifdef GL_SGIX_framezoom -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFrameZoomSGIX", (GLvoid *) NAME(glFrameZoomSGIX), _gloffset_FrameZoomSGIX }, + { "glFrameZoomSGIX", NAME(glFrameZoomSGIX), _gloffset_FrameZoomSGIX }, #undef NAME /* 58. GL_SGIX_tag_sample_buffer */ #ifdef GL_SGIX_tag_sample_buffer -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glTagSampleBufferSGIX", (GLvoid *) NAME(glTagSampleBufferSGIX), _gloffset_TagSampleBufferSGIX }, + { "glTagSampleBufferSGIX", NAME(glTagSampleBufferSGIX), _gloffset_TagSampleBufferSGIX }, #undef NAME /* 60. GL_SGIX_reference_plane */ #ifdef GL_SGIX_reference_plane -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glReferencePlaneSGIX", (GLvoid *) NAME(glReferencePlaneSGIX), _gloffset_ReferencePlaneSGIX }, + { "glReferencePlaneSGIX", NAME(glReferencePlaneSGIX), _gloffset_ReferencePlaneSGIX }, #undef NAME /* 61. GL_SGIX_flush_raster */ #ifdef GL_SGIX_flush_raster -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFlushRasterSGIX", (GLvoid *) NAME(glFlushRasterSGIX), _gloffset_FlushRasterSGIX }, + { "glFlushRasterSGIX", NAME(glFlushRasterSGIX), _gloffset_FlushRasterSGIX }, #undef NAME /* 66. GL_HP_image_transform */ #if 0 #ifdef GL_HP_image_transform -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetImageTransformParameterfvHP", (GLvoid *) NAME(glGetImageTransformParameterfvHP), _gloffset_GetImageTransformParameterfvHP }, - { "glGetImageTransformParameterivHP", (GLvoid *) NAME(glGetImageTransformParameterivHP), _gloffset_GetImageTransformParameterivHP }, - { "glImageTransformParameterfHP", (GLvoid *) NAME(glImageTransformParameterfHP), _gloffset_ImageTransformParameterfHP }, - { "glImageTransformParameterfvHP", (GLvoid *) NAME(glImageTransformParameterfvHP), _gloffset_ImageTransformParameterfvHP }, - { "glImageTransformParameteriHP", (GLvoid *) NAME(glImageTransformParameteriHP), _gloffset_ImageTransformParameteriHP }, - { "glImageTransformParameterivHP", (GLvoid *) NAME(glImageTransformParameterivHP), _gloffset_ImageTransformParameterivHP }, + { "glGetImageTransformParameterfvHP", NAME(glGetImageTransformParameterfvHP), _gloffset_GetImageTransformParameterfvHP }, + { "glGetImageTransformParameterivHP", NAME(glGetImageTransformParameterivHP), _gloffset_GetImageTransformParameterivHP }, + { "glImageTransformParameterfHP", NAME(glImageTransformParameterfHP), _gloffset_ImageTransformParameterfHP }, + { "glImageTransformParameterfvHP", NAME(glImageTransformParameterfvHP), _gloffset_ImageTransformParameterfvHP }, + { "glImageTransformParameteriHP", NAME(glImageTransformParameteriHP), _gloffset_ImageTransformParameteriHP }, + { "glImageTransformParameterivHP", NAME(glImageTransformParameterivHP), _gloffset_ImageTransformParameterivHP }, #undef NAME #endif /* 74. GL_EXT_color_subtable */ #ifdef GL_EXT_color_subtable -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glColorSubTableEXT", (GLvoid *) NAME(glColorSubTableEXT), _gloffset_ColorSubTable }, - { "glCopyColorSubTableEXT", (GLvoid *) NAME(glCopyColorSubTableEXT), _gloffset_CopyColorSubTable }, + { "glColorSubTableEXT", NAME(glColorSubTableEXT), _gloffset_ColorSubTable }, + { "glCopyColorSubTableEXT", NAME(glCopyColorSubTableEXT), _gloffset_CopyColorSubTable }, #undef NAME /* 77. GL_PGI_misc_hints */ #ifdef GL_PGI_misc_hints -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glHintPGI", (GLvoid *) NAME(glHintPGI), _gloffset_HintPGI }, + { "glHintPGI", NAME(glHintPGI), _gloffset_HintPGI }, #undef NAME /* 78. GL_EXT_paletted_texture */ #ifdef GL_EXT_paletted_texture -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glColorTableEXT", (GLvoid *) NAME(glColorTableEXT), _gloffset_ColorTable }, - { "glGetColorTableEXT", (GLvoid *) NAME(glGetColorTableEXT), _gloffset_GetColorTable }, - { "glGetColorTableParameterfvEXT", (GLvoid *) NAME(glGetColorTableParameterfvEXT), _gloffset_GetColorTableParameterfv }, - { "glGetColorTableParameterivEXT", (GLvoid *) NAME(glGetColorTableParameterivEXT), _gloffset_GetColorTableParameteriv }, + { "glColorTableEXT", NAME(glColorTableEXT), _gloffset_ColorTable }, + { "glGetColorTableEXT", NAME(glGetColorTableEXT), _gloffset_GetColorTable }, + { "glGetColorTableParameterfvEXT", NAME(glGetColorTableParameterfvEXT), _gloffset_GetColorTableParameterfv }, + { "glGetColorTableParameterivEXT", NAME(glGetColorTableParameterivEXT), _gloffset_GetColorTableParameteriv }, #undef NAME /* 80. GL_SGIX_list_priority */ #ifdef GL_SGIX_list_priority -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glGetListParameterfvSGIX", (GLvoid *) NAME(glGetListParameterfvSGIX), _gloffset_GetListParameterfvSGIX }, - { "glGetListParameterivSGIX", (GLvoid *) NAME(glGetListParameterivSGIX), _gloffset_GetListParameterivSGIX }, - { "glListParameterfSGIX", (GLvoid *) NAME(glListParameterfSGIX), _gloffset_ListParameterfSGIX }, - { "glListParameterfvSGIX", (GLvoid *) NAME(glListParameterfvSGIX), _gloffset_ListParameterfvSGIX }, - { "glListParameteriSGIX", (GLvoid *) NAME(glListParameteriSGIX), _gloffset_ListParameteriSGIX }, - { "glListParameterivSGIX", (GLvoid *) NAME(glListParameterivSGIX), _gloffset_ListParameterivSGIX }, + { "glGetListParameterfvSGIX", NAME(glGetListParameterfvSGIX), _gloffset_GetListParameterfvSGIX }, + { "glGetListParameterivSGIX", NAME(glGetListParameterivSGIX), _gloffset_GetListParameterivSGIX }, + { "glListParameterfSGIX", NAME(glListParameterfSGIX), _gloffset_ListParameterfSGIX }, + { "glListParameterfvSGIX", NAME(glListParameterfvSGIX), _gloffset_ListParameterfvSGIX }, + { "glListParameteriSGIX", NAME(glListParameteriSGIX), _gloffset_ListParameteriSGIX }, + { "glListParameterivSGIX", NAME(glListParameterivSGIX), _gloffset_ListParameterivSGIX }, #undef NAME /* 94. GL_EXT_index_material */ #ifdef GL_EXT_index_material -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glIndexMaterialEXT", (GLvoid *) NAME(glIndexMaterialEXT), _gloffset_IndexMaterialEXT }, + { "glIndexMaterialEXT", NAME(glIndexMaterialEXT), _gloffset_IndexMaterialEXT }, #undef NAME /* 95. GL_EXT_index_func */ #ifdef GL_EXT_index_func -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glIndexFuncEXT", (GLvoid *) NAME(glIndexFuncEXT), _gloffset_IndexFuncEXT }, + { "glIndexFuncEXT", NAME(glIndexFuncEXT), _gloffset_IndexFuncEXT }, #undef NAME /* 97. GL_EXT_compiled_vertex_array */ #ifdef GL_EXT_compiled_vertex_array -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glLockArraysEXT", (GLvoid *) NAME(glLockArraysEXT), _gloffset_LockArraysEXT }, - { "glUnlockArraysEXT", (GLvoid *) NAME(glUnlockArraysEXT), _gloffset_UnlockArraysEXT }, + { "glLockArraysEXT", NAME(glLockArraysEXT), _gloffset_LockArraysEXT }, + { "glUnlockArraysEXT", NAME(glUnlockArraysEXT), _gloffset_UnlockArraysEXT }, #undef NAME /* 98. GL_EXT_cull_vertex */ #ifdef GL_EXT_cull_vertex -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glCullParameterfvEXT", (GLvoid *) NAME(glCullParameterfvEXT), _gloffset_CullParameterfvEXT }, - { "glCullParameterdvEXT", (GLvoid *) NAME(glCullParameterdvEXT), _gloffset_CullParameterdvEXT }, + { "glCullParameterfvEXT", NAME(glCullParameterfvEXT), _gloffset_CullParameterfvEXT }, + { "glCullParameterdvEXT", NAME(glCullParameterdvEXT), _gloffset_CullParameterdvEXT }, #undef NAME /* 102. GL_SGIX_fragment_lighting */ #ifdef GL_SGIX_fragment_lighting -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFragmentColorMaterialSGIX", (GLvoid *) NAME(glFragmentColorMaterialSGIX), _gloffset_FragmentColorMaterialSGIX }, - { "glFragmentLightfSGIX", (GLvoid *) NAME(glFragmentLightfSGIX), _gloffset_FragmentLightfSGIX }, - { "glFragmentLightfvSGIX", (GLvoid *) NAME(glFragmentLightfvSGIX), _gloffset_FragmentLightfvSGIX }, - { "glFragmentLightiSGIX", (GLvoid *) NAME(glFragmentLightiSGIX), _gloffset_FragmentLightiSGIX }, - { "glFragmentLightivSGIX", (GLvoid *) NAME(glFragmentLightivSGIX), _gloffset_FragmentLightivSGIX }, - { "glFragmentLightModelfSGIX", (GLvoid *) NAME(glFragmentLightModelfSGIX), _gloffset_FragmentLightModelfSGIX }, - { "glFragmentLightModelfvSGIX", (GLvoid *) NAME(glFragmentLightModelfvSGIX), _gloffset_FragmentLightModelfvSGIX }, - { "glFragmentLightModeliSGIX", (GLvoid *) NAME(glFragmentLightModeliSGIX), _gloffset_FragmentLightModeliSGIX }, - { "glFragmentLightModelivSGIX", (GLvoid *) NAME(glFragmentLightModelivSGIX), _gloffset_FragmentLightModelivSGIX }, - { "glFragmentMaterialfSGIX", (GLvoid *) NAME(glFragmentMaterialfSGIX), _gloffset_FragmentMaterialfSGIX }, - { "glFragmentMaterialfvSGIX", (GLvoid *) NAME(glFragmentMaterialfvSGIX), _gloffset_FragmentMaterialfvSGIX }, - { "glFragmentMaterialiSGIX", (GLvoid *) NAME(glFragmentMaterialiSGIX), _gloffset_FragmentMaterialiSGIX }, - { "glFragmentMaterialivSGIX", (GLvoid *) NAME(glFragmentMaterialivSGIX), _gloffset_FragmentMaterialivSGIX }, - { "glGetFragmentLightfvSGIX", (GLvoid *) NAME(glGetFragmentLightfvSGIX), _gloffset_GetFragmentLightfvSGIX }, - { "glGetFragmentLightivSGIX", (GLvoid *) NAME(glGetFragmentLightivSGIX), _gloffset_GetFragmentLightivSGIX }, - { "glGetFragmentMaterialfvSGIX", (GLvoid *) NAME(glGetFragmentMaterialfvSGIX), _gloffset_GetFragmentMaterialfvSGIX }, - { "glGetFragmentMaterialivSGIX", (GLvoid *) NAME(glGetFragmentMaterialivSGIX), _gloffset_GetFragmentMaterialivSGIX }, - { "glLightEnviSGIX", (GLvoid *) NAME(glLightEnviSGIX), _gloffset_LightEnviSGIX }, + { "glFragmentColorMaterialSGIX", NAME(glFragmentColorMaterialSGIX), _gloffset_FragmentColorMaterialSGIX }, + { "glFragmentLightfSGIX", NAME(glFragmentLightfSGIX), _gloffset_FragmentLightfSGIX }, + { "glFragmentLightfvSGIX", NAME(glFragmentLightfvSGIX), _gloffset_FragmentLightfvSGIX }, + { "glFragmentLightiSGIX", NAME(glFragmentLightiSGIX), _gloffset_FragmentLightiSGIX }, + { "glFragmentLightivSGIX", NAME(glFragmentLightivSGIX), _gloffset_FragmentLightivSGIX }, + { "glFragmentLightModelfSGIX", NAME(glFragmentLightModelfSGIX), _gloffset_FragmentLightModelfSGIX }, + { "glFragmentLightModelfvSGIX", NAME(glFragmentLightModelfvSGIX), _gloffset_FragmentLightModelfvSGIX }, + { "glFragmentLightModeliSGIX", NAME(glFragmentLightModeliSGIX), _gloffset_FragmentLightModeliSGIX }, + { "glFragmentLightModelivSGIX", NAME(glFragmentLightModelivSGIX), _gloffset_FragmentLightModelivSGIX }, + { "glFragmentMaterialfSGIX", NAME(glFragmentMaterialfSGIX), _gloffset_FragmentMaterialfSGIX }, + { "glFragmentMaterialfvSGIX", NAME(glFragmentMaterialfvSGIX), _gloffset_FragmentMaterialfvSGIX }, + { "glFragmentMaterialiSGIX", NAME(glFragmentMaterialiSGIX), _gloffset_FragmentMaterialiSGIX }, + { "glFragmentMaterialivSGIX", NAME(glFragmentMaterialivSGIX), _gloffset_FragmentMaterialivSGIX }, + { "glGetFragmentLightfvSGIX", NAME(glGetFragmentLightfvSGIX), _gloffset_GetFragmentLightfvSGIX }, + { "glGetFragmentLightivSGIX", NAME(glGetFragmentLightivSGIX), _gloffset_GetFragmentLightivSGIX }, + { "glGetFragmentMaterialfvSGIX", NAME(glGetFragmentMaterialfvSGIX), _gloffset_GetFragmentMaterialfvSGIX }, + { "glGetFragmentMaterialivSGIX", NAME(glGetFragmentMaterialivSGIX), _gloffset_GetFragmentMaterialivSGIX }, + { "glLightEnviSGIX", NAME(glLightEnviSGIX), _gloffset_LightEnviSGIX }, #undef NAME + /* 112. GL_EXT_draw_range_elements */ +#if 000 +#ifdef GL_EXT_draw_range_elements +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glDrawRangeElementsEXT", NAME(glDrawRangeElementsEXT), _gloffset_DrawRangeElementsEXT }, +#undef NAME +#endif + + /* 117. GL_EXT_light_texture */ +#if 000 +#ifdef GL_EXT_light_texture +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glApplyTextureEXT", NAME(glApplyTextureEXT), _gloffset_ApplyTextureEXT }, + { "glTextureLightEXT", NAME(glTextureLightEXT), _gloffset_TextureLightEXT }, + { "glTextureMaterialEXT", NAME(glTextureMaterialEXT), _gloffset_TextureMaterialEXT }, +#undef NAME + + /* 135. GL_INTEL_texture_scissor */ +#ifdef GL_INTEL_texture_scissor +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glTexScissorINTEL", NAME(glTexScissorINTEL), _gloffset_TexScissorINTEL }, + { "glTexScissorFuncINTEL", NAME(glTexScissorFuncINTEL), _gloffset_glTexScissorFuncINTEL }, +#undef NAME + + /* 136. GL_INTEL_parallel_arrays */ +#ifdef GL_INTEL_parallel_arrays +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glVertexPointervINTEL", NAME(glVertexPointervINTEL), _gloffset_VertexPointervINTEL }, + { "glNormalPointervINTEL", NAME(glNormalPointervINTEL), _gloffset_NormalPointervINTEL }, + { "glColorPointervINTEL", NAME(glColorPointervINTEL), _gloffset_ColorPointervINTEL }, + { "glTexCoordPointervINTEL", NAME(glTexCoordPointervINTEL), _gloffset_glxCoordPointervINTEL }, +#undef NAME +#endif + + /* 138. GL_EXT_pixel_transform */ +#if 000 +#ifdef GL_EXT_pixel_transform +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glPixelTransformParameteriEXT", NAME(glPixelTransformParameteriEXT), _gloffset_PixelTransformParameteriEXT }, + { "glPixelTransformParameterfEXT", NAME(glPixelTransformParameterfEXT), _gloffset_PixelTransformParameterfEXT }, + { "glPixelTransformParameterivEXT", NAME(glPixelTransformParameterivEXT), _gloffset_PixelTransformParameterivEXT }, + { "glPixelTransformParameterfvEXT", NAME(glPixelTransformParameterfvEXT), _gloffset_PixelTransformParameterfvEXT }, + { "glGetPixelTransformParameterivEXT", NAME(glGetPixelTransformParameterivEXT), _gloffset_GetPixelTransformParameterivEXT }, + { "glGetPixelTransformParameterfvEXT", NAME(glGetPixelTransformParameterfvEXT), _gloffset_GetPixelTransformParameterfvEXT }, +#undef NAME + + /* 145. GL_EXT_secondary_color */ +#ifdef GL_EXT_secondary_color +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glSecondaryColor3bEXT", NAME(glSecondaryColor3bEXT), _gloffset_SecondaryColor3bEXT }, + { "glSecondaryColor3dEXT", NAME(glSecondaryColor3dEXT), _gloffset_SecondaryColor3dEXT }, + { "glSecondaryColor3fEXT", NAME(glSecondaryColor3fEXT), _gloffset_SecondaryColor3fEXT }, + { "glSecondaryColor3iEXT", NAME(glSecondaryColor3iEXT), _gloffset_SecondaryColor3iEXT }, + { "glSecondaryColor3sEXT", NAME(glSecondaryColor3sEXT), _gloffset_SecondaryColor3sEXT }, + { "glSecondaryColor3ubEXT", NAME(glSecondaryColor3ubEXT), _gloffset_SecondaryColor3ubEXT }, + { "glSecondaryColor3uiEXT", NAME(glSecondaryColor3uiEXT), _gloffset_SecondaryColor3uiEXT }, + { "glSecondaryColor3usEXT", NAME(glSecondaryColor3usEXT), _gloffset_SecondaryColor3usEXT }, + { "glSecondaryColor4bEXT", NAME(glSecondaryColor4bEXT), _gloffset_SecondaryColor4bEXT }, + { "glSecondaryColor4dEXT", NAME(glSecondaryColor4dEXT), _gloffset_SecondaryColor4dEXT }, + { "glSecondaryColor4fEXT", NAME(glSecondaryColor4fEXT), _gloffset_SecondaryColor4fEXT }, + { "glSecondaryColor4iEXT", NAME(glSecondaryColor4iEXT), _gloffset_SecondaryColor4iEXT }, + { "glSecondaryColor4sEXT", NAME(glSecondaryColor4sEXT), _gloffset_SecondaryColor4sEXT }, + { "glSecondaryColor4ubEXT", NAME(glSecondaryColor4ubEXT), _gloffset_SecondaryColor4ubEXT }, + { "glSecondaryColor4uiEXT", NAME(glSecondaryColor4uiEXT), _gloffset_SecondaryColor4uiEXT }, + { "glSecondaryColor4usEXT", NAME(glSecondaryColor4usEXT), _gloffset_SecondaryColor4usEXT }, + { "glSecondaryColor3bvEXT", NAME(glSecondaryColor3bvEXT), _gloffset_SecondaryColor3bvEXT }, + { "glSecondaryColor3dvEXT", NAME(glSecondaryColor3dvEXT), _gloffset_SecondaryColor3dvEXT }, + { "glSecondaryColor3fvEXT", NAME(glSecondaryColor3fvEXT), _gloffset_SecondaryColor3fvEXT }, + { "glSecondaryColor3ivEXT", NAME(glSecondaryColor3ivEXT), _gloffset_SecondaryColor3ivEXT }, + { "glSecondaryColor3svEXT", NAME(glSecondaryColor3svEXT), _gloffset_SecondaryColor3svEXT }, + { "glSecondaryColor3ubvEXT", NAME(glSecondaryColor3ubvEXT), _gloffset_SecondaryColor3ubvEXT }, + { "glSecondaryColor3uivEXT", NAME(glSecondaryColor3uivEXT), _gloffset_SecondaryColor3uivEXT }, + { "glSecondaryColor3usvEXT", NAME(glSecondaryColor3usvEXT), _gloffset_SecondaryColor3usvEXT }, + { "glSecondaryColor4bvEXT", NAME(glSecondaryColor4bvEXT), _gloffset_SecondaryColor4bvEXT }, + { "glSecondaryColor4dvEXT", NAME(glSecondaryColor4dvEXT), _gloffset_SecondaryColor4dvEXT }, + { "glSecondaryColor4fvEXT", NAME(glSecondaryColor4fvEXT), _gloffset_SecondaryColor4fvEXT }, + { "glSecondaryColor4ivEXT", NAME(glSecondaryColor4ivEXT), _gloffset_SecondaryColor4ivEXT }, + { "glSecondaryColor4svEXT", NAME(glSecondaryColor4svEXT), _gloffset_SecondaryColor4svEXT }, + { "glSecondaryColor4ubvEXT", NAME(glSecondaryColor4ubvEXT), _gloffset_SecondaryColor4ubvEXT }, + { "glSecondaryColor4uivEXT", NAME(glSecondaryColor4uivEXT), _gloffset_SecondaryColor4uivEXT }, + { "glSecondaryColor4usvEXT", NAME(glSecondaryColor4usvEXT), _gloffset_SecondaryColor4usvEXT }, + { "glSecondaryColorPointerEXT", NAME(glSecondaryColorPointerEXT), _gloffset_SecondaryColorPointerEXT }, +#undef NAME + + /* 147. GL_EXT_texture_perturb_normal */ +#ifdef GL_EXT_texture_perturb_normal +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glTextureNormalEXT", NAME(glTextureNormalEXT), _gloffset_TextureNormalEXT }, +#undef NAME + + /* 148. GL_EXT_multi_draw_arrays */ +#ifdef GL_EXT_multi_draw_arrays +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glMultiDrawArraysEXT", NAME(glMultiDrawArraysEXT), _gloffset_MultiDrawArraysEXT }, +#undef NAME +#endif + /* 149. GL_EXT_fog_coord */ #ifdef GL_EXT_fog_coord -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFogCoordfEXT", (GLvoid *) NAME(glFogCoordfEXT), _gloffset_FogCoordfEXT }, - { "glFogCoordfvEXT", (GLvoid *) NAME(glFogCoordfvEXT), _gloffset_FogCoordfvEXT }, - { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, - { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, - { "glFogCoordPointerEXT", (GLvoid *) NAME(glFogCoordPointerEXT), _gloffset_FogCoordPointerEXT }, + { "glFogCoordfEXT", NAME(glFogCoordfEXT), _gloffset_FogCoordfEXT }, + { "glFogCoordfvEXT", NAME(glFogCoordfvEXT), _gloffset_FogCoordfvEXT }, + { "glFogCoorddEXT", NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, + { "glFogCoorddEXT", NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT }, + { "glFogCoordPointerEXT", NAME(glFogCoordPointerEXT), _gloffset_FogCoordPointerEXT }, #undef NAME +#if 000 + /* 156. GL_EXT_coordinate_frame */ +#ifdef GL_EXT_coordinate_frame +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glTangent3bEXT", NAME(glTangent3bEXT), _gloffset_Tangent3bEXT }, + { "glTangent3dEXT", NAME(glTangent3dEXT), _gloffset_Tangent3dEXT }, + { "glTangent3fEXT", NAME(glTangent3fEXT), _gloffset_Tangent3fEXT }, + { "glTangent3iEXT", NAME(glTangent3iEXT), _gloffset_Tangent3iEXT }, + { "glTangent3sEXT", NAME(glTangent3sEXT), _gloffset_Tangent3sEXT }, + { "glTangent3bvEXT", NAME(glTangent3bvEXT), _gloffset_Tangent3bvEXT }, + { "glTangent3dvEXT", NAME(glTangent3dvEXT), _gloffset_Tangent3dvEXT }, + { "glTangent3fvEXT", NAME(glTangent3fvEXT), _gloffset_Tangent3fvEXT }, + { "glTangent3ivEXT", NAME(glTangent3ivEXT), _gloffset_Tangent3ivEXT }, + { "glTangent3svEXT", NAME(glTangent3svEXT), _gloffset_Tangent3svEXT }, + { "glBinormal3bEXT", NAME(glBinormal3bEXT), _gloffset_Binormal3bEXT }, + { "glBinormal3dEXT", NAME(glBinormal3dEXT), _gloffset_Binormal3dEXT }, + { "glBinormal3fEXT", NAME(glBinormal3fEXT), _gloffset_Binormal3fEXT }, + { "glBinormal3iEXT", NAME(glBinormal3iEXT), _gloffset_Binormal3iEXT }, + { "glBinormal3sEXT", NAME(glBinormal3sEXT), _gloffset_Binormal3sEXT }, + { "glBinormal3bvEXT", NAME(glBinormal3bvEXT), _gloffset_Binormal3bvEXT }, + { "glBinormal3dvEXT", NAME(glBinormal3dvEXT), _gloffset_Binormal3dvEXT }, + { "glBinormal3fvEXT", NAME(glBinormal3fvEXT), _gloffset_Binormal3fvEXT }, + { "glBinormal3ivEXT", NAME(glBinormal3ivEXT), _gloffset_Binormal3ivEXT }, + { "glBinormal3svEXT", NAME(glBinormal3svEXT), _gloffset_Binormal3svEXT }, + { "glTangentPointerEXT", NAME(glTangentPointerEXT), _gloffset_TangentPointerEXT }, + { "glBinormalPointerEXT", NAME(glBinormalPointerEXT), _gloffset_BinormalPointerEXT }, +#undef NAME + + /* 164. GL_SUN_global_alpha */ +#ifdef GL_SUN_global_alpha +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glGlobalAlphaFactorbSUN", NAME(glGlobalAlphaFactorbSUN), _gloffset_GlobalAlphaFactorbSUN }, + { "glGlobalAlphaFactorsSUN", NAME(glGlobalAlphaFactorsSUN), _gloffset_GlobalAlphaFactorsSUN }, + { "glGlobalAlphaFactoriSUN", NAME(glGlobalAlphaFactoriSUN), _gloffset_GlobalAlphaFactoriSUN }, + { "glGlobalAlphaFactorfSUN", NAME(glGlobalAlphaFactorfSUN), _gloffset_GlobalAlphaFactorfSUN }, + { "glGlobalAlphaFactordSUN", NAME(glGlobalAlphaFactordSUN), _gloffset_GlobalAlphaFactordSUN }, + { "glGlobalAlphaFactorubSUN", NAME(glGlobalAlphaFactorubSUN), _gloffset_GlobalAlphaFactorubSUN }, + { "glGlobalAlphaFactorusSUN", NAME(glGlobalAlphaFactorusSUN), _gloffset_GlobalAlphaFactorusSUN }, + { "glGlobalAlphaFactoruiSUN", NAME(glGlobalAlphaFactoruiSUN), _gloffset_GlobalAlphaFactoruiSUN }, +#undef NAME + + /* 165. GL_SUN_triangle_list */ +#ifdef GL_SUN_triangle_list +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glReplacementCodeuiSUN", NAME(glReplacementCodeuiSUN), _gloffset_ReplacementCodeuiSUN }, + { "glReplacementCodeusSUN", NAME(glReplacementCodeusSUN), _gloffset_ReplacementCodeusSUN }, + { "glReplacementCodeubSUN", NAME(glReplacementCodeubSUN), _gloffset_ReplacementCodeubSUN }, + { "glReplacementCodeuivSUN", NAME(glReplacementCodeuivSUN), _gloffset_ReplacementCodeuivSUN }, + { "glReplacementCodeusvSUN", NAME(glReplacementCodeusvSUN), _gloffset_ReplacementCodeusvSUN }, + { "glReplacementCodeubvSUN", NAME(glReplacementCodeubvSUN), _gloffset_ReplacementCodeubvSUN }, + { "glReplacementCodePointerSUN", NAME(glReplacementCodePointerSUN), _gloffset_ReplacementCodePointerSUN }, +#undef NAME + + /* 166. GL_SUN_vertex */ +#ifdef GL_SUN_vertex +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glColor4ubVertex2fSUN", NAME(glColor4ubVertex2fSUN), _gloffset_Color4ubVertex2fSUN }, + { "glColor4ubVertex2fvSUN", NAME(glColor4ubVertex2fvSUN), _gloffset_Color4ubVertex2fvSUN }, + { "glColor4ubVertex3fSUN", NAME(glColor4ubVertex3fSUN), _gloffset_Color4ubVertex3fSUN }, + { "glColor4ubVertex3fvSUN", NAME(glColor4ubVertex3fvSUN), _gloffset_Color4ubVertex3fvSUN }, + { "glColor3fVertex3fSUN", NAME(glColor3fVertex3fSUN), _gloffset_Color3fVertex3fSUN }, + { "glColor3fVertex3fvSUN", NAME(glColor3fVertex3fvSUN), _gloffset_Color3fVertex3fvSUN }, + { "glNormal3fVertex3fSUN", NAME(glNormal3fVertex3fSUN), _gloffset_Normal3fVertex3fSUN }, + { "glNormal3fVertex3fvSUN", NAME(glNormal3fVertex3fvSUN), _gloffset_Normal3fVertex3fvSUN }, + { "glColor4fNormal3fVertex3fSUN", NAME(glColor4fNormal3fVertex3fSUN), _gloffset_Color4fNormal3fVertex3fSUN }, + { "glColor4fNormal3fVertex3fvSUN", NAME(glColor4fNormal3fVertex3fvSUN), _gloffset_Color4fNormal3fVertex3fvSUN }, + { "glTexCoord2fVertex3fSUN", NAME(glTexCoord2fVertex3fSUN), _gloffset_TexCoord2fVertex3fSUN }, + { "glTexCoord2fVertex3fvSUN", NAME(glTexCoord2fVertex3fvSUN), _gloffset_TexCoord2fVertex3fvSUN }, + { "glTexCoord4fVertex4fSUN", NAME(glTexCoord4fVertex4fSUN), _gloffset_TexCoord4fVertex4fSUN }, + { "glTexCoord4fVertex4fvSUN", NAME(glTexCoord4fVertex4fvSUN), _gloffset_TexCoord4fVertex4fvSUN }, + { "glTexCoord2fColor4ubVertex3fSUN", NAME(glTexCoord2fColor4ubVertex3fSUN), _gloffset_TexCoord2fColor4ubVertex3fSUN }, + { "glTexCoord2fColor4ubVertex3fvSUN", NAME(glTexCoord2fColor4ubVertex3fvSUN), _gloffset_TexCoord2fColor4ubVertex3fvSUN }, + { "glTexCoord2fColor3fVertex3fSUN", NAME(glTexCoord2fColor3fVertex3fSUN), _gloffset_TexCoord2fColor3fVertex3fSUN }, + { "glTexCoord2fColor3fVertex3fvSUN", NAME(glTexCoord2fColor3fVertex3fvSUN), _gloffset_TexCoord2fColor3fVertex3fvSUN }, + { "glTexCoord2fNormal3fVertex3fSUN", NAME(glTexCoord2fNormal3fVertex3fSUN), _gloffset_TexCoord2fNormal3fVertex3fSUN }, + { "glTexCoord2fNormal3fVertex3fvSUN", NAME(glTexCoord2fNormal3fVertex3fvSUN), _gloffset_TexCoord2fNormal3fVertex3fvSUN }, + { "glTexCoord2fColor4fNormal3fVertex3fSUN", NAME(glTexCoord2fColor4fNormal3fVertex3fSUN), _gloffset_TexCoord2fColor4fNormal3fVertex3fSUN }, + { "glTexCoord2fColor4fNormal3fVertex3fvSUN", NAME(glTexCoord2fColor4fNormal3fVertex3fvSUN), _gloffset_TexCoord2fColor4fNormal3fVertex3fvSUN }, + { "glTexCoord4fColor4fNormal3fVertex4fSUN", NAME(glTexCoord4fColor4fNormal3fVertex4fSUN), _gloffset_TexCoord4fColor4fNormal3fVertex4fSUN }, + { "glTexCoord4fColor4fNormal3fVertex4fvSUN", NAME(glTexCoord4fColor4fNormal3fVertex4fvSUN), _gloffset_TexCoord4fColor4fNormal3fVertex4fvSUN }, + { "glReplacementCodeuiVertex3fSUN", NAME(glReplacementCodeuiVertex3fSUN), _gloffset_ReplacementCodeuiVertex3fSUN }, + { "glReplacementCodeuiVertex3fvSUN", NAME(glReplacementCodeuiVertex3fvSUN), _gloffset_ReplacementCodeuiVertex3fvSUN }, + { "glReplacementCodeuiColor4ubVertex3fSUN", NAME(glReplacementCodeuiColor4ubVertex3fSUN), _gloffset_ReplacementCodeuiColor4ubVertex3fSUN }, + { "glReplacementCodeuiColor4ubVertex3fvSUN", NAME(glReplacementCodeuiColor4ubVertex3fvSUN), _gloffset_ReplacementCodeuiColor4ubVertex3fvSUN }, + { "glReplacementCodeuiColor3fVertex3fSUN", NAME(glReplacementCodeuiColor3fVertex3fSUN), _gloffset_ReplacementCodeuiColor3fVertex3fSUN }, + { "glReplacementCodeuiColor3fVertex3fvSUN", NAME(glReplacementCodeuiColor3fVertex3fvSUN), _gloffset_ReplacementCodeuiColor3fVertex3fvSUN }, + { "glReplacementCodeuiNormal3fVertex3fSUN", NAME(glReplacementCodeuiNormal3fVertex3fSUN), _gloffset_ReplacementCodeuiNormal3fVertex3fSUN }, + { "glReplacementCodeuiNormal3fVertex3fvSUN", NAME(glReplacementCodeuiNormal3fVertex3fvSUN), _gloffset_ReplacementCodeuiNormal3fVertex3fvSUN }, + { "glReplacementCodeuiColor4fNormal3fVertex3fSUN", NAME(glReplacementCodeuiColor4fNormal3fVertex3fSUN), _gloffset_ReplacementCodeuiColor4fNormal3fVertex3fSUN }, + { "glReplacementCodeuiColor4fNormal3fVertex3fvSUN", NAME(glReplacementCodeuiColor4fNormal3fVertex3fvSUN), _gloffset_ReplacementCodeuiColor4fNormal3fVertex3fvSUN }, + { "glReplacementCodeuiTexCoord2fVertex3fSUN", NAME(glReplacementCodeuiTexCoord2fVertex3fSUN), _gloffset_ReplacementCodeuiTexCoord2fVertex3fSUN }, + { "glReplacementCodeuiTexCoord2fVertex3fvSUN", NAME(glReplacementCodeuiTexCoord2fVertex3fvSUN), _gloffset_ReplacementCodeuiTexCoord2fVertex3fvSUN }, + { "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN", NAME(glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN), _gloffset_ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN }, + { "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN", NAME(glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN), _gloffset_ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN }, + { "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN", NAME(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN), _gloffset_ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN }, + { "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN", NAME(glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN), _gloffset_ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN }, +#undef NAME +#endif + /* 173. GL_EXT/INGR_blend_func_separate */ #ifdef GL_EXT_blend_func_separate -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glBlendFuncSeparateEXT", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, - { "glBlendFuncSeparateINGR", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, + { "glBlendFuncSeparateEXT", NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, + { "glBlendFuncSeparateINGR", NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT }, #undef NAME /* 188. GL_EXT_vertex_weighting */ #ifdef GL_EXT_vertex_weighting -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glVertexWeightfEXT", (GLvoid *) NAME(glVertexWeightfEXT), _gloffset_VertexWeightfEXT }, - { "glVertexWeightfvEXT", (GLvoid *) NAME(glVertexWeightfvEXT), _gloffset_VertexWeightfvEXT }, - { "glVertexWeightPointerEXT", (GLvoid *) NAME(glVertexWeightPointerEXT), _gloffset_VertexWeightPointerEXT }, + { "glVertexWeightfEXT", NAME(glVertexWeightfEXT), _gloffset_VertexWeightfEXT }, + { "glVertexWeightfvEXT", NAME(glVertexWeightfvEXT), _gloffset_VertexWeightfvEXT }, + { "glVertexWeightPointerEXT", NAME(glVertexWeightPointerEXT), _gloffset_VertexWeightPointerEXT }, #undef NAME /* 190. GL_NV_vertex_array_range */ #ifdef GL_NV_vertex_array_range -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glFlushVertexArrayRangeNV", (GLvoid *) NAME(glFlushVertexArrayRangeNV), _gloffset_FlushVertexArrayRangeNV }, - { "glVertexArrayRangeNV", (GLvoid *) NAME(glVertexArrayRangeNV), _gloffset_VertexArrayRangeNV }, + { "glFlushVertexArrayRangeNV", NAME(glFlushVertexArrayRangeNV), _gloffset_FlushVertexArrayRangeNV }, + { "glVertexArrayRangeNV", NAME(glVertexArrayRangeNV), _gloffset_VertexArrayRangeNV }, #undef NAME /* 191. GL_NV_register_combiners */ #ifdef GL_NV_register_combiners -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glCombinerParameterfvNV", (GLvoid *) NAME(glCombinerParameterfvNV), _gloffset_CombinerParameterfvNV }, - { "glCombinerParameterfNV", (GLvoid *) NAME(glCombinerParameterfNV), _gloffset_CombinerParameterfNV }, - { "glCombinerParameterivNV", (GLvoid *) NAME(glCombinerParameterivNV), _gloffset_CombinerParameterivNV }, - { "glCombinerParameteriNV", (GLvoid *) NAME(glCombinerParameteriNV), _gloffset_CombinerParameteriNV }, - { "glCombinerInputNV", (GLvoid *) NAME(glCombinerInputNV), _gloffset_CombinerInputNV }, - { "glCombinerOutputNV", (GLvoid *) NAME(glCombinerOutputNV), _gloffset_CombinerOutputNV }, - { "glFinalCombinerInputNV", (GLvoid *) NAME(glFinalCombinerInputNV), _gloffset_FinalCombinerInputNV }, - { "glGetCombinerInputParameterfvNV", (GLvoid *) NAME(glGetCombinerInputParameterfvNV), _gloffset_GetCombinerInputParameterfvNV }, - { "glGetCombinerInputParameterivNV", (GLvoid *) NAME(glGetCombinerInputParameterivNV), _gloffset_GetCombinerInputParameterivNV }, - { "glGetCombinerOutputParameterfvNV", (GLvoid *) NAME(glGetCombinerOutputParameterfvNV), _gloffset_GetCombinerOutputParameterfvNV }, - { "glGetCombinerOutputParameterivNV", (GLvoid *) NAME(glGetCombinerOutputParameterivNV), _gloffset_GetCombinerOutputParameterivNV }, - { "glGetFinalCombinerInputParameterfvNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterfvNV), _gloffset_GetFinalCombinerInputParameterfvNV }, - { "glGetFinalCombinerInputParameterivNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterivNV), _gloffset_GetFinalCombinerInputParameterivNV }, + { "glCombinerParameterfvNV", NAME(glCombinerParameterfvNV), _gloffset_CombinerParameterfvNV }, + { "glCombinerParameterfNV", NAME(glCombinerParameterfNV), _gloffset_CombinerParameterfNV }, + { "glCombinerParameterivNV", NAME(glCombinerParameterivNV), _gloffset_CombinerParameterivNV }, + { "glCombinerParameteriNV", NAME(glCombinerParameteriNV), _gloffset_CombinerParameteriNV }, + { "glCombinerInputNV", NAME(glCombinerInputNV), _gloffset_CombinerInputNV }, + { "glCombinerOutputNV", NAME(glCombinerOutputNV), _gloffset_CombinerOutputNV }, + { "glFinalCombinerInputNV", NAME(glFinalCombinerInputNV), _gloffset_FinalCombinerInputNV }, + { "glGetCombinerInputParameterfvNV", NAME(glGetCombinerInputParameterfvNV), _gloffset_GetCombinerInputParameterfvNV }, + { "glGetCombinerInputParameterivNV", NAME(glGetCombinerInputParameterivNV), _gloffset_GetCombinerInputParameterivNV }, + { "glGetCombinerOutputParameterfvNV", NAME(glGetCombinerOutputParameterfvNV), _gloffset_GetCombinerOutputParameterfvNV }, + { "glGetCombinerOutputParameterivNV", NAME(glGetCombinerOutputParameterivNV), _gloffset_GetCombinerOutputParameterivNV }, + { "glGetFinalCombinerInputParameterfvNV", NAME(glGetFinalCombinerInputParameterfvNV), _gloffset_GetFinalCombinerInputParameterfvNV }, + { "glGetFinalCombinerInputParameterivNV", NAME(glGetFinalCombinerInputParameterivNV), _gloffset_GetFinalCombinerInputParameterivNV }, #undef NAME /* 196. GL_MESA_resize_buffers */ #ifdef MESA_resize_buffers -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glResizeBuffersMESA", (GLvoid *) NAME(glResizeBuffersMESA), _gloffset_ResizeBuffersMESA }, + { "glResizeBuffersMESA", NAME(glResizeBuffersMESA), _gloffset_ResizeBuffersMESA }, #undef NAME /* 197. GL_MESA_window_pos */ #ifdef MESA_window_pos -#define NAME(X) X +#define NAME(X) (GLvoid *) X #else -#define NAME(X) NotImplemented +#define NAME(X) (GLvoid *) NotImplemented #endif - { "glWindowPos4fMESA", (GLvoid *) NAME(glWindowPos4fMESA), _gloffset_WindowPos4fMESA }, + { "glWindowPos4fMESA", NAME(glWindowPos4fMESA), _gloffset_WindowPos4fMESA }, #undef NAME + /* 209. WGL_EXT_multisample */ +#ifdef WGL_EXT_multisample +#define NAME(X) (GLvoid *) X +#else +#define NAME(X) (GLvoid *) NotImplemented +#endif + { "glSampleMaskEXT", NAME(glSampleMaskEXT), _gloffset_SampleMaskSGIS }, + { "glSamplePatternEXT", NAME(glSamplePatternEXT), _gloffset_SamplePatternSGIS }, +#undef NAME { NULL, NULL } /* end of list marker */ }; + + +/* + * Return dispatch table offset of the named static (built-in) function. + * Return -1 if function not found. + */ +static GLint +get_static_proc_offset(const char *funcName) +{ + GLuint i; + for (i = 0; static_functions[i].Name; i++) { + if (strcmp(static_functions[i].Name, funcName) == 0) { + return static_functions[i].Offset; + } + } + return -1; +} + + +/* + * Return dispatch function address the named static (built-in) function. + * Return NULL if function not found. + */ +static GLvoid * +get_static_proc_address(const char *funcName) +{ + GLint i = get_static_proc_offset(funcName); + if (i >= 0) + return static_functions[i].Address; + else + return NULL; +} + + + +/********************************************************************** + * Extension function management. + */ + + +#define MAX_EXTENSION_FUNCS 1000 + +static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS]; +static GLuint NumExtEntryPoints = 0; + + + +/* + * Generate a dispatch function (entrypoint) which jumps through + * the given slot number (offset) in the current dispatch table. + * We need assembly language in order to accomplish this. + */ +static void * +generate_entrypoint(GLuint functionOffset) +{ +#if defined(USE_X86_ASM) + /* + * This x86 code contributed by Josh Vanderhoof. + * + * 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax + * 00 01 02 03 04 + * 5: 85 c0 testl %eax,%eax + * 05 06 + * 7: 74 06 je f <entrypoint+0xf> + * 07 08 + * 9: ff a0 10 32 54 76 jmp *0x76543210(%eax) + * 09 0a 0b 0c 0d 0e + * f: e8 fc ff ff ff call __glapi_get_dispatch + * 0f 10 11 12 13 + * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax) + * 14 15 16 17 18 19 + */ + static const unsigned char temp[] = { + 0xa1, 0x00, 0x00, 0x00, 0x00, + 0x85, 0xc0, + 0x74, 0x06, + 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00, + 0xe8, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00 + }; + unsigned char *code = malloc(sizeof(temp)); + unsigned int next_insn; + if (code) { + memcpy(code, temp, sizeof(temp)); + + *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch; + *(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4; + next_insn = (unsigned int)(code + 0x14); + *(unsigned int *)(code + 0x10) = (unsigned int)_glapi_get_dispatch - next_insn; + *(unsigned int *)(code + 0x16) = (unsigned int)functionOffset * 4; + } + return code; +#else + return NULL; +#endif +} + + + +/* + * Add a new extension function entrypoint. + * Return: GL_TRUE = success or GL_FALSE = failure + */ +GLboolean +_glapi_add_entrypoint(const char *funcName, GLuint offset) +{ + /* first check if the named function is already statically present */ + { + GLint index = get_static_proc_offset(funcName); + if (index >= 0) { + return (GLboolean) (index == offset); /* bad offset! */ + } + } + + { + /* make sure this offset/name pair is legal */ + const char *name = _glapi_get_proc_name(offset); + if (name && strcmp(name, funcName) != 0) + return GL_FALSE; /* bad name! */ + } + + { + /* be sure index and name match known data */ + GLuint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { + /* function already registered with api */ + if (ExtEntryTable[i].Offset == offset) { + return GL_TRUE; /* offsets match */ + } + else { + return GL_FALSE; /* bad offset! */ + } + } + } + + /* Make sure we don't try to add a new entrypoint after someone + * has already called _glapi_get_dispatch_table_size()! If that's + * happened the caller's information would become out of date. + */ + if (GetSizeCalled) + return GL_FALSE; + + /* make sure we have space */ + if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS) { + return GL_FALSE; + } + else { + void *entrypoint = generate_entrypoint(offset); + if (!entrypoint) + return GL_FALSE; + + ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); + ExtEntryTable[NumExtEntryPoints].Offset = offset; + ExtEntryTable[NumExtEntryPoints].Address = entrypoint; + NumExtEntryPoints++; + + if (offset > MaxDispatchOffset) + MaxDispatchOffset = offset; + + return GL_TRUE; /* success */ + } + } + + /* should never get here, but play it safe */ + return GL_FALSE; +} + + + +#if 0000 /* prototype code for dynamic extension slot allocation */ + +static int NextFreeOffset = 409; /*XXX*/ +#define MAX_DISPATCH_TABLE_SIZE 1000 + +/* + * Dynamically allocate a dispatch slot for an extension entrypoint + * and generate the assembly language dispatch stub. + * Return the dispatch offset for the function or -1 if no room or error. + */ +GLint +_glapi_add_entrypoint2(const char *funcName) +{ + int offset; + + /* first see if extension func is already known */ + offset = _glapi_get_proc_offset(funcName); + if (offset >= 0) + return offset; + + if (NumExtEntryPoints < MAX_EXTENSION_FUNCS + && NextFreeOffset < MAX_DISPATCH_TABLE_SIZE) { + void *entryPoint; + offset = NextFreeOffset; + entryPoint = generate_entrypoint(offset); + if (entryPoint) { + NextFreeOffset++; + ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName); + ExtEntryTable[NumExtEntryPoints].Offset = offset; + ExtEntryTable[NumExtEntryPoints].Address = entryPoint; + NumExtEntryPoints++; + return offset; + } + } + return -1; +} + +#endif + + + +/* + * Return offset of entrypoint for named function within dispatch table. + */ +GLint +_glapi_get_proc_offset(const char *funcName) +{ + /* search extension functions first */ + GLint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { + return ExtEntryTable[i].Offset; + } + } + + /* search static functions */ + return get_static_proc_offset(funcName); +} + + + +/* + * Return entrypoint for named function. + */ +const GLvoid * +_glapi_get_proc_address(const char *funcName) +{ + /* search extension functions first */ + GLint i; + for (i = 0; i < NumExtEntryPoints; i++) { + if (strcmp(ExtEntryTable[i].Name, funcName) == 0) { + return ExtEntryTable[i].Address; + } + } + + /* search static functions */ + return get_static_proc_address(funcName); +} + + + + +/* + * Return the name of the function at the given dispatch offset. + * This is only intended for debugging. + */ +const char * +_glapi_get_proc_name(GLuint offset) +{ + const GLuint n = sizeof(static_functions) / sizeof(struct name_address_offset); + GLuint i; + for (i = 0; i < n; i++) { + if (static_functions[i].Offset == offset) + return static_functions[i].Name; + } + + /* search added extension functions */ + for (i = 0; i < NumExtEntryPoints; i++) { + if (ExtEntryTable[i].Offset == offset) { + return ExtEntryTable[i].Name; + } + } + return NULL; +} + + + +/* + * Make sure there are no NULL pointers in the given dispatch table. + * Intented for debugging purposes. + */ +void +_glapi_check_table(const struct _glapi_table *table) +{ + const GLuint entries = _glapi_get_dispatch_table_size(); + const void **tab = (const void **) table; + GLuint i; + for (i = 1; i < entries; i++) { + assert(tab[i]); + } + +#ifdef DEBUG + /* Do some spot checks to be sure that the dispatch table + * slots are assigned correctly. + */ + { + GLuint BeginOffset = _glapi_get_proc_offset("glBegin"); + char *BeginFunc = (char*) &table->Begin; + GLuint offset = (BeginFunc - (char *) table) / sizeof(void *); + assert(BeginOffset == _gloffset_Begin); + assert(BeginOffset == offset); + } + { + GLuint viewportOffset = _glapi_get_proc_offset("glViewport"); + char *viewportFunc = (char*) &table->Viewport; + GLuint offset = (viewportFunc - (char *) table) / sizeof(void *); + assert(viewportOffset == _gloffset_Viewport); + assert(viewportOffset == offset); + } + { + GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer"); + char *VertexPointerFunc = (char*) &table->VertexPointer; + GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *); + assert(VertexPointerOffset == _gloffset_VertexPointer); + assert(VertexPointerOffset == offset); + } + { + GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax"); + char *ResetMinMaxFunc = (char*) &table->ResetMinmax; + GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *); + assert(ResetMinMaxOffset == _gloffset_ResetMinmax); + assert(ResetMinMaxOffset == offset); + } + { + GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor"); + char *blendColorFunc = (char*) &table->BlendColor; + GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *); + assert(blendColorOffset == _gloffset_BlendColor); + assert(blendColorOffset == offset); + } + { + GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT"); + char *istextureFunc = (char*) &table->IsTextureEXT; + GLuint offset = (istextureFunc - (char *) table) / sizeof(void *); + assert(istextureOffset == _gloffset_IsTextureEXT); + assert(istextureOffset == offset); + } +#endif +} + + + + diff --git a/xc/extras/Mesa/src/glapioffsets.h b/xc/extras/Mesa/src/glapioffsets.h index 67481c8e0..b05d49e6f 100644 --- a/xc/extras/Mesa/src/glapioffsets.h +++ b/xc/extras/Mesa/src/glapioffsets.h @@ -1,4 +1,4 @@ -/* DO NOT EDIT - This file generated automatically */ +/* DO NOT EDIT - This file generated automatically by gloffsets.py script */ #ifndef _GLAPI_OFFSETS_H_ #define _GLAPI_OFFSETS_H_ @@ -555,5 +555,13 @@ #define _gloffset_GetColorTableEXT 550 #define _gloffset_GetColorTableParameterivEXT 551 #define _gloffset_GetColorTableParameterfvEXT 552 +#define _gloffset_TbufferMask3DFX 553 +#define _gloffset_CompressedTexImage3DARB 554 +#define _gloffset_CompressedTexImage2DARB 555 +#define _gloffset_CompressedTexImage1DARB 556 +#define _gloffset_CompressedTexSubImage3DARB 557 +#define _gloffset_CompressedTexSubImage2DARB 558 +#define _gloffset_CompressedTexSubImage1DARB 559 +#define _gloffset_GetCompressedTexImageARB 560 #endif diff --git a/xc/extras/Mesa/src/glapitable.h b/xc/extras/Mesa/src/glapitable.h index 9e5d121dd..94690afb2 100644 --- a/xc/extras/Mesa/src/glapitable.h +++ b/xc/extras/Mesa/src/glapitable.h @@ -1,4 +1,4 @@ -/* DO NOT EDIT - This file generated automatically */ +/* DO NOT EDIT - This file generated automatically with gltable.py script */ #ifndef _GLAPI_TABLE_H_ #define _GLAPI_TABLE_H_ @@ -443,7 +443,7 @@ struct _glapi_table void (*PixelTexGenParameterfvSGIS)(GLenum pname, const GLfloat * params); /* 434 */ void (*GetPixelTexGenParameterivSGIS)(GLenum pname, GLint * params); /* 435 */ void (*GetPixelTexGenParameterfvSGIS)(GLenum pname, GLfloat * params); /* 436 */ - void (*TexImage4DSGIS)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */ + void (*TexImage4DSGIS)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid * pixels); /* 437 */ void (*TexSubImage4DSGIS)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid * pixels); /* 438 */ GLboolean (*AreTexturesResidentEXT)(GLsizei n, const GLenum * textures, GLboolean * residences); /* 439 */ void (*GenTexturesEXT)(GLsizei n, GLenum * textures); /* 440 */ @@ -559,6 +559,14 @@ struct _glapi_table void (*GetColorTableEXT)(GLenum target, GLenum format, GLenum type, GLvoid * data); /* 550 */ void (*GetColorTableParameterivEXT)(GLenum target, GLenum pname, GLint * params); /* 551 */ void (*GetColorTableParameterfvEXT)(GLenum target, GLenum pname, GLfloat * params); /* 552 */ + void (*TbufferMask3DFX)(GLuint mask); /* 553 */ + void (*CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid * data); /* 554 */ + void (*CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid * data); /* 555 */ + void (*CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid * data); /* 556 */ + void (*CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid * data); /* 557 */ + void (*CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid * data); /* 558 */ + void (*CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid * data); /* 559 */ + void (*GetCompressedTexImageARB)(GLenum target, GLint level, void * img); /* 560 */ }; #endif diff --git a/xc/extras/Mesa/src/glapitemp.h b/xc/extras/Mesa/src/glapitemp.h index 7b940def6..b1b443e44 100644 --- a/xc/extras/Mesa/src/glapitemp.h +++ b/xc/extras/Mesa/src/glapitemp.h @@ -1978,180 +1978,6 @@ KEYWORD1 void KEYWORD2 NAME(SeparableFilter2D)(GLenum target, GLenum internalfor -/* ARB 0. GL_ARB_multitexture */ - -KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) -{ - DISPATCH(ActiveTextureARB, (texture), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) -{ - DISPATCH(ClientActiveTextureARB, (texture), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) -{ - DISPATCH(MultiTexCoord1dARB, (target, s), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble *v) -{ - DISPATCH(MultiTexCoord1dvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s) -{ - DISPATCH(MultiTexCoord1fARB, (target, s), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat *v) -{ - DISPATCH(MultiTexCoord1fvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s) -{ - DISPATCH(MultiTexCoord1iARB, (target, s), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint *v) -{ - DISPATCH(MultiTexCoord1ivARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s) -{ - DISPATCH(MultiTexCoord1sARB, (target, s), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort *v) -{ - DISPATCH(MultiTexCoord1svARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) -{ - DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble *v) -{ - DISPATCH(MultiTexCoord2dvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) -{ - DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat *v) -{ - DISPATCH(MultiTexCoord2fvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) -{ - DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint *v) -{ - DISPATCH(MultiTexCoord2ivARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) -{ - DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort *v) -{ - DISPATCH(MultiTexCoord2svARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) -{ - DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble *v) -{ - DISPATCH(MultiTexCoord3dvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) -{ - DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat *v) -{ - DISPATCH(MultiTexCoord3fvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) -{ - DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint *v) -{ - DISPATCH(MultiTexCoord3ivARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) -{ - DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort *v) -{ - DISPATCH(MultiTexCoord3svARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) -{ - DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble *v) -{ - DISPATCH(MultiTexCoord4dvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) -{ - DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat *v) -{ - DISPATCH(MultiTexCoord4fvARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) -{ - DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint *v) -{ - DISPATCH(MultiTexCoord4ivARB, (target, v), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) -{ - DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, ";")); -} - -KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort *v) -{ - DISPATCH(MultiTexCoord4svARB, (target, v), (F, ";")); -} - - - /*** *** Extension functions ***/ @@ -2448,7 +2274,7 @@ KEYWORD1 void KEYWORD2 NAME(GetPixelTexGenParameterivSGIS)(GLenum target, GLint /* 16. GL_SGIS_texture4D */ -KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels) +KEYWORD1 void KEYWORD2 NAME(TexImage4DSGIS)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei extent, GLint border, GLenum format, GLenum type, const void *pixels) { DISPATCH(TexImage4DSGIS, (target, level, internalFormat, width, height, depth, extent, border, format, type, pixels), (F, ";")); } @@ -2624,6 +2450,16 @@ KEYWORD1 void KEYWORD2 NAME(PointParameterfvEXT)(GLenum target, const GLfloat *p DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); } +KEYWORD1 void KEYWORD2 NAME(PointParameterfSGIS)(GLenum target, GLfloat param) +{ + DISPATCH(PointParameterfEXT, (target, param), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(PointParameterfvSGIS)(GLenum target, const GLfloat *param) +{ + DISPATCH(PointParameterfvEXT, (target, param), (F, ";")); +} + /* 55. GL_SGIX_instruments */ @@ -2816,7 +2652,6 @@ KEYWORD1 void KEYWORD2 NAME(IndexFuncEXT)(GLenum func, GLfloat ref) /* 97. GL_EXT_compiled_vertex_array */ - KEYWORD1 void KEYWORD2 NAME(LockArraysEXT)(GLint first, GLsizei count) { DISPATCH(LockArraysEXT, (first, count), (F, ";")); @@ -2933,6 +2768,112 @@ KEYWORD1 void KEYWORD2 NAME(LightEnviSGIX)(GLenum pname, GLint param) } +/* 112. GL_EXT_draw_range_elements */ +KEYWORD1 void KEYWORD2 NAME(DrawRangeElementsEXT)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) +{ + DISPATCH(DrawRangeElements, (mode, start, end, count, type, indices), (F, "glDrawRangeElementsEXT(0x%x, %u %u %d 0x%x %p);", mode, start, end, count, type, indices)); +} + + +/* 117. GL_EXT_light_texture */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(ApplyTextureEXT)(GLenum mode) +{ + DISPATCH(ApplyTextureEXT, (mode), (F, "glApplyTextureEXT(0x%x);", mode)); +} + +KEYWORD1 void KEYWORD2 NAME(TextureLightEXT)(GLenum pname) +{ + DISPATCH(TextureLightEXT, (pname), (F, "glTextureLightEXT(0x%x);", pname)); +} + +KEYWORD1 void KEYWORD2 NAME(TextureMaterialEXT)(GLenum face, GLenum mode) +{ + DISPATCH(TextureMaterialEXT, (face, mode), (F, "glTextureMaterialEXT(0x%x, 0x%x);", face, mode)); +} +#endif + + + +/* 135. GL_INTEL_texture_scissor */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(TexScissorINTEL)(GLenum target, GLclampf tlow, GLclampf thigh) +{ + DISPATCH(TexScissorINTEL, (target, tlow, thigh), (F, "glTexScissorINTEL(0x%x %g %g);", target, tlow, thigh)); +} + +KEYWORD1 void KEYWORD2 NAME(TexScissorFuncINTEL)(GLenum target, GLenum lfunc, GLenum hfunc) +{ + DISPATCH(TexScissorFuncINTEL, (target, lfunc, hfunc), (F, "glTexScissorFuncINTEL(0x%x 0x%x 0x%x);", target, tlow, thigh)); +} +#endif + + + +/* 136. GL_INTEL_parallel_arrays */ +#if 00 +KEYWORD1 void KEYWORD2 NAME(VertexPointervINTEL)(GLint size, GLenum type, const void ** pointer) +{ + DISPATCH(VertexPointervINTEL, (size, type, pointer), (F, "glVertexPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(NormalPointervINTEL)(GLenum type, const void** pointer) +{ + DISPATCH(NormalPointervINTEL, (size, pointer), (F, "glNormalPointervINTEL(%d, %p);", size, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(ColorPointervINTEL)(GLint size, GLenum type, const void** pointer) +{ + DISPATCH(ColorPointervINTEL, (size, type, pointer), (F, "glColorPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} + +KEYWORD1 void KEYWORD2 NAME(TexCoordPointervINTEL)(GLint size, GLenum type, const void** pointer) +{ + DISPATCH(TexCoordPointervINTEL, (size, type, pointer), (F, "glTexCoordPointervINTEL(%d, 0x%x, %p);", size, type, pointer)); +} +#endif + + +/* 138. GL_EXT_pixel_transform */ +#if 0 +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameteriEXT)(GLenum target, GLenum pname, const GLint param) +{ + DISPATCH(PixelTransformParameteriEXT, (target, pname, param), (F, "glPixelTransformParameteriEXT(0x%x, 0x%x, %d);", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfEXT)(GLenum target, GLenum pname, const GLfloat param) +{ + DISPATCH(PixelTransformParameterfEXT, (target, pname, param), (F, "glPixelTransformParameterfEXT(0x%x, 0x%x, %f);", target, pname, param)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +{ + DISPATCH(PixelTransformParameterivEXT, (target, pname, params), (F, "glPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(PixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +{ + DISPATCH(PixelTransformParameterfvEXT, (target, pname, params), (F, "glPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterivEXT)(GLenum target, GLenum pname, const GLint *params) +{ + DISPATCH(GetPixelTransformParameterivEXT, (target, pname, params), (F, "glGetPixelTransformParameterivEXT(0x%x, 0x%x, %p);", target, pname, params)); +} + +KEYWORD1 void KEYWORD2 NAME(GetPixelTransformParameterfvEXT)(GLenum target, GLenum pname, const GLfloat *params) +{ + DISPATCH(GetPixelTransformParameterfvEXT, (target, pname, params), (F, "glGetPixelTransformParameterfvEXT(0x%x, 0x%x, %p);", target, pname, params)); +} +#endif + + + +/* 145. GL_EXT_secondary_color */ +/* XXX todo */ + + + /* 149. GL_EXT_fog_coord */ KEYWORD1 void KEYWORD2 NAME(FogCoordfEXT)(GLfloat coord) { @@ -3080,7 +3021,6 @@ KEYWORD1 void KEYWORD2 NAME(ResizeBuffersMESA)(void) /* 197. GL_MESA_window_pos */ - KEYWORD1 void KEYWORD2 NAME(WindowPos2iMESA)(GLint x, GLint y) { DISPATCH(WindowPos2iMESA, (x, y), (F, ";")); @@ -3202,8 +3142,201 @@ KEYWORD1 void KEYWORD2 NAME(WindowPos4dvMESA)(const GLdouble *p) } +/* 208. GL_3DFX_tbuffer */ +KEYWORD1 void KEYWORD2 NAME(TbufferMask3DFX)(GLuint mask) +{ + DISPATCH(TbufferMask3DFX, (mask), (F, "glTbufferMask3DFX(0x%x);", mask)); +} + + +/* 209. WGL_EXT_multisample */ + +KEYWORD1 void KEYWORD2 NAME(SampleMaskEXT)(GLclampf value, GLboolean invert) +{ + DISPATCH(SampleMaskSGIS, (value, invert), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(SamplePatternEXT)(GLenum pattern) +{ + DISPATCH(SamplePatternSGIS, (pattern), (F, ";")); +} + + +/* ARB 1. GL_ARB_multitexture */ + +KEYWORD1 void KEYWORD2 NAME(ActiveTextureARB)(GLenum texture) +{ + DISPATCH(ActiveTextureARB, (texture), (F, ";")); +} -/* ARB 2. GL_ARB_transpose_matrix */ +KEYWORD1 void KEYWORD2 NAME(ClientActiveTextureARB)(GLenum texture) +{ + DISPATCH(ClientActiveTextureARB, (texture), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dARB)(GLenum target, GLdouble s) +{ + DISPATCH(MultiTexCoord1dARB, (target, s), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1dvARB)(GLenum target, const GLdouble *v) +{ + DISPATCH(MultiTexCoord1dvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fARB)(GLenum target, GLfloat s) +{ + DISPATCH(MultiTexCoord1fARB, (target, s), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1fvARB)(GLenum target, const GLfloat *v) +{ + DISPATCH(MultiTexCoord1fvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1iARB)(GLenum target, GLint s) +{ + DISPATCH(MultiTexCoord1iARB, (target, s), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1ivARB)(GLenum target, const GLint *v) +{ + DISPATCH(MultiTexCoord1ivARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1sARB)(GLenum target, GLshort s) +{ + DISPATCH(MultiTexCoord1sARB, (target, s), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord1svARB)(GLenum target, const GLshort *v) +{ + DISPATCH(MultiTexCoord1svARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dARB)(GLenum target, GLdouble s, GLdouble t) +{ + DISPATCH(MultiTexCoord2dARB, (target, s, t), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2dvARB)(GLenum target, const GLdouble *v) +{ + DISPATCH(MultiTexCoord2dvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fARB)(GLenum target, GLfloat s, GLfloat t) +{ + DISPATCH(MultiTexCoord2fARB, (target, s, t), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2fvARB)(GLenum target, const GLfloat *v) +{ + DISPATCH(MultiTexCoord2fvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2iARB)(GLenum target, GLint s, GLint t) +{ + DISPATCH(MultiTexCoord2iARB, (target, s, t), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2ivARB)(GLenum target, const GLint *v) +{ + DISPATCH(MultiTexCoord2ivARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2sARB)(GLenum target, GLshort s, GLshort t) +{ + DISPATCH(MultiTexCoord2sARB, (target, s, t), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord2svARB)(GLenum target, const GLshort *v) +{ + DISPATCH(MultiTexCoord2svARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r) +{ + DISPATCH(MultiTexCoord3dARB, (target, s, t, r), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3dvARB)(GLenum target, const GLdouble *v) +{ + DISPATCH(MultiTexCoord3dvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r) +{ + DISPATCH(MultiTexCoord3fARB, (target, s, t, r), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3fvARB)(GLenum target, const GLfloat *v) +{ + DISPATCH(MultiTexCoord3fvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3iARB)(GLenum target, GLint s, GLint t, GLint r) +{ + DISPATCH(MultiTexCoord3iARB, (target, s, t, r), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3ivARB)(GLenum target, const GLint *v) +{ + DISPATCH(MultiTexCoord3ivARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3sARB)(GLenum target, GLshort s, GLshort t, GLshort r) +{ + DISPATCH(MultiTexCoord3sARB, (target, s, t, r), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord3svARB)(GLenum target, const GLshort *v) +{ + DISPATCH(MultiTexCoord3svARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dARB)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q) +{ + DISPATCH(MultiTexCoord4dARB, (target, s, t, r, q), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4dvARB)(GLenum target, const GLdouble *v) +{ + DISPATCH(MultiTexCoord4dvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fARB)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + DISPATCH(MultiTexCoord4fARB, (target, s, t, r, q), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4fvARB)(GLenum target, const GLfloat *v) +{ + DISPATCH(MultiTexCoord4fvARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4iARB)(GLenum target, GLint s, GLint t, GLint r, GLint q) +{ + DISPATCH(MultiTexCoord4iARB, (target, s, t, r, q), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4ivARB)(GLenum target, const GLint *v) +{ + DISPATCH(MultiTexCoord4ivARB, (target, v), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4sARB)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q) +{ + DISPATCH(MultiTexCoord4sARB, (target, s, t, r, q), (F, ";")); +} + +KEYWORD1 void KEYWORD2 NAME(MultiTexCoord4svARB)(GLenum target, const GLshort *v) +{ + DISPATCH(MultiTexCoord4svARB, (target, v), (F, ";")); +} + + + +/* ARB 3. GL_ARB_transpose_matrix */ KEYWORD1 void KEYWORD2 NAME(LoadTransposeMatrixdARB)(const GLdouble m[16]) { DISPATCH(LoadTransposeMatrixdARB, (m), (F, "glLoadTransposeMatrixARB(%p);", m)); @@ -3225,13 +3358,13 @@ KEYWORD1 void KEYWORD2 NAME(MultTransposeMatrixfARB)(const GLfloat m[16]) } -/* ARB 4. GL_ARB_multisample */ + +/* ARB 5. GL_ARB_multisample */ KEYWORD1 void KEYWORD2 NAME(SampleCoverageARB)(GLclampf value, GLboolean invert) { DISPATCH(SampleCoverageARB, (value, invert), (F, "glSampleCoverageARB(%f, %d);", value, invert)); } - KEYWORD1 void KEYWORD2 NAME(SamplePassARB)(GLenum pass) { DISPATCH(SamplePassARB, (pass), (F, "glSamplePassARB(0x%x);", pass)); @@ -3239,6 +3372,44 @@ KEYWORD1 void KEYWORD2 NAME(SamplePassARB)(GLenum pass) +/* ARB 12. GL_ARB_texture_compression */ +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage3DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexImage3DARB, (target, level, internalformat, width, height, depth, border, imageSize, data), (F, "glCompressedTexImage3DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage2DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexImage2DARB, (target, level, internalformat, width, height, border, imageSize, data), (F, "glCompressedTexImage2DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexImage1DARB)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexImage1DARB, (target, level, internalformat, width, border, imageSize, data), (F, "glCompressedTexImage1DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage3DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexSubImage3DARB, (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), (F, "glCompressedTexSubImage3DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage2DARB)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexSubImage2DARB, (target, level, xoffset, yoffset, width, height, format, imageSize, data), (F, "glCompressedTexSubImage2DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(CompressedTexSubImage1DARB)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) +{ + DISPATCH(CompressedTexSubImage1DARB, (target, level, xoffset, width, format, imageSize, data), (F, "glCompressedTexSubImage1DARB();")); +} + +KEYWORD1 void KEYWORD2 NAME(GetCompressedTexImageARB)(GLenum target, GLint lod, GLvoid *img) +{ + DISPATCH(GetCompressedTexImageARB, (target, lod, img), (F, "glGetCompressedTexImageARB();")); +} + + + #undef KEYWORD1 #undef KEYWORD2 #undef NAME diff --git a/xc/extras/Mesa/src/glheader.h b/xc/extras/Mesa/src/glheader.h index 4789ec7a3..00748699d 100644 --- a/xc/extras/Mesa/src/glheader.h +++ b/xc/extras/Mesa/src/glheader.h @@ -51,6 +51,9 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#if defined(__linux__) && defined(__i386__) +#include <fpu_control.h> +#endif #endif #include <float.h> @@ -59,16 +62,104 @@ #include "conf.h" #endif +/* Make sure we include glext.h */ #include "GL/gl.h" #include "GL/glext.h" + /* * Put compiler/OS/assembly pragmas and macros here to avoid * cluttering other source files. */ + +/* + * XXX move as many of these pragma's and MS Windows-isms into + * the new src/glheader.h file. + */ + +#if defined(_WIN32) && !defined(__WIN32__) +# define __WIN32__ +#endif + +#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) +# pragma warning( disable : 4068 ) /* unknown pragma */ +# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ +# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ +# pragma warning( disable : 4127 ) /* conditional expression is constant */ +# if defined(MESA_MINWARN) +# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ +# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ +# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ +# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ +# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ +# endif +# if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ +# define GLAPI __declspec(dllexport) +# define WGLAPI __declspec(dllexport) +# elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define GLAPI __declspec(dllimport) +# define WGLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +# define WGLAPI __declspec(dllimport) +# endif /* _STATIC_MESA support */ +# define GLAPIENTRY __stdcall +# define GLAPIENTRYP __stdcall * +# define GLCALLBACK __stdcall +# define GLCALLBACKP __stdcall * +# if defined(__CYGWIN__) +# define GLCALLBACKPCAST * +# else +# define GLCALLBACKPCAST __stdcall * +# endif +# define GLWINAPI __stdcall +# define GLWINAPIV __cdecl +#else +/* non-Windows compilation */ +# define GLAPI extern +# define GLAPIENTRY +# define GLAPIENTRYP * +# define GLCALLBACK +# define GLCALLBACKP * +# define GLCALLBACKPCAST * +# define GLWINAPI +# define GLWINAPIV +#endif /* WIN32 / CYGWIN bracket */ + +/* compatability guard so we don't need to change client code */ + +#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) +# define CALLBACK GLCALLBACK +typedef int (GLAPIENTRY *PROC)(); +typedef void *HGLRC; +typedef void *HDC; +typedef unsigned long COLORREF; +#endif + +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) +# define WGL_FONT_LINES 0 +# define WGL_FONT_POLYGONS 1 +#ifndef _GNU_H_WINDOWS32_FUNCTIONS +# ifdef UNICODE +# define wglUseFontBitmaps wglUseFontBitmapsW +# define wglUseFontOutlines wglUseFontOutlinesW +# else +# define wglUseFontBitmaps wglUseFontBitmapsA +# define wglUseFontOutlines wglUseFontOutlinesA +# endif /* !UNICODE */ +#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ +typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; +typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; +typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; +#include <gl/mesa_wgl.h> +#endif + + + + /* Disable unreachable code warnings for Watcom C++ */ #ifdef __WATCOMC__ #pragma disable_message(201) diff --git a/xc/extras/Mesa/src/hint.c b/xc/extras/Mesa/src/hint.c index 210138d2b..6537bd004 100644 --- a/xc/extras/Mesa/src/hint.c +++ b/xc/extras/Mesa/src/hint.c @@ -52,78 +52,94 @@ _mesa_try_Hint( GLcontext *ctx, GLenum target, GLenum mode ) if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glHint %s %d\n", gl_lookup_enum_by_nr(target), mode); + if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) { + gl_error(ctx, GL_INVALID_ENUM, "glHint(mode)"); + return GL_FALSE; + } + switch (target) { - case GL_FOG_HINT: - ctx->Hint.Fog = mode; - break; - case GL_LINE_SMOOTH_HINT: - ctx->Hint.LineSmooth = mode; - break; - case GL_PERSPECTIVE_CORRECTION_HINT: - ctx->Hint.PerspectiveCorrection = mode; - break; - case GL_POINT_SMOOTH_HINT: - ctx->Hint.PointSmooth = mode; - break; - case GL_POLYGON_SMOOTH_HINT: - ctx->Hint.PolygonSmooth = mode; - break; - case GL_PREFER_DOUBLEBUFFER_HINT_PGI: - case GL_STRICT_DEPTHFUNC_HINT_PGI: - break; - case GL_STRICT_LIGHTING_HINT_PGI: - ctx->Hint.StrictLighting = mode; - break; - case GL_STRICT_SCISSOR_HINT_PGI: - case GL_FULL_STIPPLE_HINT_PGI: - case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI: - case GL_NATIVE_GRAPHICS_END_HINT_PGI: - case GL_CONSERVE_MEMORY_HINT_PGI: - case GL_RECLAIM_MEMORY_HINT_PGI: - break; - case GL_ALWAYS_FAST_HINT_PGI: - if (mode) { - ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_FALSE; - ctx->Hint.AllowDrawMem = GL_FALSE; - } else { - ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_TRUE; - ctx->Hint.AllowDrawMem = GL_TRUE; - } - break; - case GL_ALWAYS_SOFT_HINT_PGI: - ctx->Hint.AllowDrawWin = GL_TRUE; - ctx->Hint.AllowDrawSpn = GL_TRUE; - ctx->Hint.AllowDrawMem = GL_TRUE; - break; - case GL_ALLOW_DRAW_OBJ_HINT_PGI: - break; - case GL_ALLOW_DRAW_WIN_HINT_PGI: - ctx->Hint.AllowDrawWin = mode; - break; - case GL_ALLOW_DRAW_SPN_HINT_PGI: - ctx->Hint.AllowDrawSpn = mode; - break; - case GL_ALLOW_DRAW_MEM_HINT_PGI: - ctx->Hint.AllowDrawMem = mode; - break; - case GL_CLIP_NEAR_HINT_PGI: - case GL_CLIP_FAR_HINT_PGI: - case GL_WIDE_LINE_HINT_PGI: - case GL_BACK_NORMALS_HINT_PGI: - case GL_NATIVE_GRAPHICS_HANDLE_PGI: - break; + case GL_FOG_HINT: + ctx->Hint.Fog = mode; + break; + case GL_LINE_SMOOTH_HINT: + ctx->Hint.LineSmooth = mode; + break; + case GL_PERSPECTIVE_CORRECTION_HINT: + ctx->Hint.PerspectiveCorrection = mode; + break; + case GL_POINT_SMOOTH_HINT: + ctx->Hint.PointSmooth = mode; + break; + case GL_POLYGON_SMOOTH_HINT: + ctx->Hint.PolygonSmooth = mode; + break; + case GL_PREFER_DOUBLEBUFFER_HINT_PGI: + case GL_STRICT_DEPTHFUNC_HINT_PGI: + break; + case GL_STRICT_LIGHTING_HINT_PGI: + ctx->Hint.StrictLighting = mode; + break; + case GL_STRICT_SCISSOR_HINT_PGI: + case GL_FULL_STIPPLE_HINT_PGI: + case GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI: + case GL_NATIVE_GRAPHICS_END_HINT_PGI: + case GL_CONSERVE_MEMORY_HINT_PGI: + case GL_RECLAIM_MEMORY_HINT_PGI: + break; + case GL_ALWAYS_FAST_HINT_PGI: + if (mode) { + ctx->Hint.AllowDrawWin = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_FALSE; + ctx->Hint.AllowDrawMem = GL_FALSE; + } else { + ctx->Hint.AllowDrawWin = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_TRUE; + ctx->Hint.AllowDrawMem = GL_TRUE; + } + break; + case GL_ALWAYS_SOFT_HINT_PGI: + ctx->Hint.AllowDrawWin = GL_TRUE; + ctx->Hint.AllowDrawFrg = GL_TRUE; + ctx->Hint.AllowDrawMem = GL_TRUE; + break; + case GL_ALLOW_DRAW_OBJ_HINT_PGI: + break; + case GL_ALLOW_DRAW_WIN_HINT_PGI: + ctx->Hint.AllowDrawWin = mode; + break; + case GL_ALLOW_DRAW_FRG_HINT_PGI: + ctx->Hint.AllowDrawFrg = mode; + break; + case GL_ALLOW_DRAW_MEM_HINT_PGI: + ctx->Hint.AllowDrawMem = mode; + break; + case GL_CLIP_NEAR_HINT_PGI: + case GL_CLIP_FAR_HINT_PGI: + case GL_WIDE_LINE_HINT_PGI: + case GL_BACK_NORMALS_HINT_PGI: + case GL_NATIVE_GRAPHICS_HANDLE_PGI: + break; /* GL_EXT_clip_volume_hint */ - case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: - ctx->Hint.ClipVolumeClipping = mode; - break; + case GL_CLIP_VOLUME_CLIPPING_HINT_EXT: + ctx->Hint.ClipVolumeClipping = mode; + break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glHint(target)" ); - return GL_FALSE; + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSION_HINT_ARB: + if (ctx->Extensions.HaveTextureCompression) { + ctx->Hint.TextureCompression = mode; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + } + break; + + default: + gl_error(ctx, GL_INVALID_ENUM, "glHint(target)"); + return GL_FALSE; } + ctx->NewState |= NEW_ALL; /* just to be safe */ if (ctx->Driver.Hint) { @@ -143,6 +159,11 @@ _mesa_HintPGI( GLenum target, GLint mode ) if (MESA_VERBOSE & VERBOSE_API) fprintf(stderr, "glHintPGI %s %d\n", gl_lookup_enum_by_nr(target), mode); + if (mode != GL_NICEST && mode != GL_FASTEST && mode != GL_DONT_CARE) { + gl_error(ctx, GL_INVALID_ENUM, "glHintPGI(mode)"); + return; + } + switch (target) { case GL_PREFER_DOUBLEBUFFER_HINT_PGI: case GL_STRICT_DEPTHFUNC_HINT_PGI: @@ -157,7 +178,7 @@ _mesa_HintPGI( GLenum target, GLint mode ) case GL_ALWAYS_SOFT_HINT_PGI: case GL_ALLOW_DRAW_OBJ_HINT_PGI: case GL_ALLOW_DRAW_WIN_HINT_PGI: - case GL_ALLOW_DRAW_SPN_HINT_PGI: + case GL_ALLOW_DRAW_FRG_HINT_PGI: case GL_ALLOW_DRAW_MEM_HINT_PGI: case GL_CLIP_NEAR_HINT_PGI: case GL_CLIP_FAR_HINT_PGI: diff --git a/xc/extras/Mesa/src/image.c b/xc/extras/Mesa/src/image.c index 16c8d4921..825ce7ed5 100644 --- a/xc/extras/Mesa/src/image.c +++ b/xc/extras/Mesa/src/image.c @@ -30,6 +30,7 @@ #include "glheader.h" #include "context.h" #include "image.h" +#include "imaging.h" #include "macros.h" #include "mem.h" #include "mmath.h" @@ -46,7 +47,7 @@ * from within display lists we have to be sure to set the current * unpacking params to these values! */ -struct gl_pixelstore_attrib _mesa_native_packing = { +const struct gl_pixelstore_attrib _mesa_native_packing = { 1, /* Alignment */ 0, /* RowLength */ 0, /* SkipPixels */ @@ -62,7 +63,8 @@ struct gl_pixelstore_attrib _mesa_native_packing = { /* * Flip the 8 bits in each byte of the given array. */ -void gl_flip_bytes( GLubyte *p, GLuint n ) +static void +flip_bytes( GLubyte *p, GLuint n ) { register GLuint i, a, b; @@ -84,7 +86,8 @@ void gl_flip_bytes( GLubyte *p, GLuint n ) /* * Flip the order of the 2 bytes in each word in the given array. */ -void gl_swap2( GLushort *p, GLuint n ) +void +_mesa_swap2( GLushort *p, GLuint n ) { register GLuint i; @@ -98,7 +101,8 @@ void gl_swap2( GLushort *p, GLuint n ) /* * Flip the order of the 4 bytes in each word in the given array. */ -void gl_swap4( GLuint *p, GLuint n ) +void +_mesa_swap4( GLuint *p, GLuint n ) { register GLuint i, a, b; @@ -120,7 +124,7 @@ void gl_swap4( GLuint *p, GLuint n ) * Return 0 if GL_BITMAP. * Return -1 if invalid type enum. */ -GLint gl_sizeof_type( GLenum type ) +GLint _mesa_sizeof_type( GLenum type ) { switch (type) { case GL_BITMAP: @@ -146,10 +150,10 @@ GLint gl_sizeof_type( GLenum type ) /* - * Same as gl_sizeof_packed_type() but we also accept the + * Same as _mesa_sizeof_packed_type() but we also accept the * packed pixel format datatypes. */ -GLint gl_sizeof_packed_type( GLenum type ) +GLint _mesa_sizeof_packed_type( GLenum type ) { switch (type) { case GL_BITMAP: @@ -203,7 +207,7 @@ GLint gl_sizeof_packed_type( GLenum type ) * Return the number of components in a GL enum pixel type. * Return -1 if bad format. */ -GLint gl_components_in_format( GLenum format ) +GLint _mesa_components_in_format( GLenum format ) { switch (format) { case GL_COLOR_INDEX: @@ -220,6 +224,7 @@ GLint gl_components_in_format( GLenum format ) case GL_BLUE: case GL_ALPHA: case GL_LUMINANCE: + case GL_INTENSITY: return 1; case GL_LUMINANCE_ALPHA: return 2; @@ -243,9 +248,9 @@ GLint gl_components_in_format( GLenum format ) * Return bytes per pixel for given format and type * Return -1 if bad format or type. */ -GLint gl_bytes_per_pixel( GLenum format, GLenum type ) +GLint _mesa_bytes_per_pixel( GLenum format, GLenum type ) { - GLint comps = gl_components_in_format( format ); + GLint comps = _mesa_components_in_format( format ); if (comps < 0) return -1; @@ -301,7 +306,8 @@ GLint gl_bytes_per_pixel( GLenum format, GLenum type ) * Test if the given pixel format and type are legal. * Return GL_TRUE for legal, GL_FALSE for illegal. */ -GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type ) +GLboolean +_mesa_is_legal_format_and_type( GLenum format, GLenum type ) { switch (format) { case GL_COLOR_INDEX: @@ -399,10 +405,11 @@ GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type ) * row, column - location of pixel in the image * Return: address of pixel at (image,row,column) in image or NULL if error. */ -GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, - const GLvoid *image, GLsizei width, - GLsizei height, GLenum format, GLenum type, - GLint img, GLint row, GLint column ) +GLvoid * +_mesa_image_address( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, GLsizei width, + GLsizei height, GLenum format, GLenum type, + GLint img, GLint row, GLint column ) { GLint alignment; /* 1, 2 or 4 */ GLint pixels_per_row; @@ -437,13 +444,13 @@ GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, GLint bytes_per_image; /* Compute bytes per component */ - bytes_per_comp = gl_sizeof_packed_type( type ); + bytes_per_comp = _mesa_sizeof_packed_type( type ); if (bytes_per_comp<0) { return NULL; } /* Compute number of components per pixel */ - comp_per_pixel = gl_components_in_format( format ); + comp_per_pixel = _mesa_components_in_format( format ); if (comp_per_pixel<0 && type != GL_BITMAP) { return NULL; } @@ -462,7 +469,7 @@ GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, /* Non-BITMAP data */ GLint bytes_per_pixel, bytes_per_row, remainder, bytes_per_image; - bytes_per_pixel = gl_bytes_per_pixel( format, type ); + bytes_per_pixel = _mesa_bytes_per_pixel( format, type ); /* The pixel type and format should have been error checked earlier */ assert(bytes_per_pixel > 0); @@ -489,25 +496,69 @@ GLvoid *gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, /* - * Unpack a 32x32 pixel polygon stipple from user memory using the - * current pixel unpack settings. + * Compute the stride between image rows (in bytes) for the given + * pixel packing parameters and image width, format and type. */ -void gl_unpack_polygon_stipple( const GLcontext *ctx, - const GLubyte *pattern, GLuint dest[32] ) +GLint +_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLenum format, GLenum type ) { - GLint i; - for (i = 0; i < 32; i++) { - GLubyte *src = (GLubyte *) gl_pixel_addr_in_image( &ctx->Unpack, pattern, - 32, 32, GL_COLOR_INDEX, GL_BITMAP, 0, i, 0 ); - dest[i] = (src[0] << 24) - | (src[1] << 16) - | (src[2] << 8) - | (src[3] ); + ASSERT(packing); + if (type == GL_BITMAP) { + /* BITMAP data */ + if (packing->RowLength == 0) { + GLint bytes = (width + 7) / 8; + return bytes; + } + else { + GLint bytes = (packing->RowLength + 7) / 8; + return bytes; + } } + else { + /* Non-BITMAP data */ + const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); + GLint bytesPerRow, remainder; + if (bytesPerPixel <= 0) + return -1; /* error */ + if (packing->RowLength == 0) { + bytesPerRow = bytesPerPixel * width; + } + else { + bytesPerRow = bytesPerPixel * packing->RowLength; + } + remainder = bytesPerRow % packing->Alignment; + if (remainder > 0) + bytesPerRow += (packing->Alignment - remainder); + return bytesPerRow; + } +} + + - /* Bit flipping within each byte */ - if (ctx->Unpack.LsbFirst) { - gl_flip_bytes( (GLubyte *) dest, 32 * 4 ); +/* + * Unpack a 32x32 pixel polygon stipple from user memory using the + * current pixel unpack settings. + */ +void +_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], + const struct gl_pixelstore_attrib *unpacking ) +{ + GLubyte *ptrn = (GLubyte *) _mesa_unpack_bitmap( 32, 32, pattern, unpacking ); + if (ptrn) { + /* Convert pattern from GLubytes to GLuints and handle big/little + * endian differences + */ + GLubyte *p = ptrn; + GLint i; + for (i = 0; i < 32; i++) { + dest[i] = (p[0] << 24) + | (p[1] << 16) + | (p[2] << 8) + | (p[3] ); + p += 4; + } + FREE(ptrn); } } @@ -517,24 +568,23 @@ void gl_unpack_polygon_stipple( const GLcontext *ctx, * Pack polygon stipple into user memory given current pixel packing * settings. */ -void gl_pack_polygon_stipple( const GLcontext *ctx, - const GLuint pattern[32], - GLubyte *dest ) +void +_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, + const struct gl_pixelstore_attrib *packing ) { + /* Convert pattern from GLuints to GLubytes to handle big/little + * endian differences. + */ + GLubyte ptrn[32*4]; GLint i; for (i = 0; i < 32; i++) { - GLubyte *dst = (GLubyte *) gl_pixel_addr_in_image( &ctx->Pack, dest, - 32, 32, GL_COLOR_INDEX, GL_BITMAP, 0, i, 0 ); - dst[0] = (pattern[i] >> 24) & 0xff; - dst[1] = (pattern[i] >> 16) & 0xff; - dst[2] = (pattern[i] >> 8) & 0xff; - dst[3] = (pattern[i] ) & 0xff; - - /* Bit flipping within each byte */ - if (ctx->Pack.LsbFirst) { - gl_flip_bytes( (GLubyte *) dst, 4 ); - } + ptrn[i * 4 + 0] = (GLubyte) ((pattern[i] >> 24) & 0xff); + ptrn[i * 4 + 1] = (GLubyte) ((pattern[i] >> 16) & 0xff); + ptrn[i * 4 + 2] = (GLubyte) ((pattern[i] >> 8 ) & 0xff); + ptrn[i * 4 + 3] = (GLubyte) ((pattern[i] ) & 0xff); } + + _mesa_pack_bitmap(32, 32, ptrn, dest, packing); } @@ -554,66 +604,100 @@ void gl_pack_polygon_stipple( const GLcontext *ctx, * packing - pixel packing parameters * applyTransferOps - apply scale/bias/lookup-table ops? */ -void gl_pack_rgba_span( const GLcontext *ctx, - GLuint n, CONST GLubyte rgba[][4], - GLenum format, GLenum type, GLvoid *destination, - const struct gl_pixelstore_attrib *packing, - GLboolean applyTransferOps ) +void +_mesa_pack_rgba_span( GLcontext *ctx, + GLuint n, CONST GLubyte srcRgba[][4], + GLenum format, GLenum type, GLvoid *destination, + const struct gl_pixelstore_attrib *packing, + GLboolean applyTransferOps ) { - applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag); + applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled); /* Test for optimized case first */ if (!applyTransferOps && format == GL_RGBA && type == GL_UNSIGNED_BYTE) { /* common simple case */ - MEMCPY( destination, rgba, n * 4 * sizeof(GLubyte) ); + MEMCPY( destination, srcRgba, n * 4 * sizeof(GLubyte) ); } else if (!applyTransferOps && format == GL_RGB && type == GL_UNSIGNED_BYTE) { /* common simple case */ GLint i; GLubyte *dest = (GLubyte *) destination; for (i = 0; i < n; i++) { - dest[0] = rgba[i][RCOMP]; - dest[1] = rgba[i][GCOMP]; - dest[2] = rgba[i][BCOMP]; + dest[0] = srcRgba[i][RCOMP]; + dest[1] = srcRgba[i][GCOMP]; + dest[2] = srcRgba[i][BCOMP]; dest += 3; } } else { /* general solution */ - GLfloat red[MAX_WIDTH], green[MAX_WIDTH], blue[MAX_WIDTH]; - GLfloat alpha[MAX_WIDTH], luminance[MAX_WIDTH]; + GLfloat rgba[MAX_WIDTH][4], luminance[MAX_WIDTH]; const GLfloat rscale = 1.0F / 255.0F; const GLfloat gscale = 1.0F / 255.0F; const GLfloat bscale = 1.0F / 255.0F; const GLfloat ascale = 1.0F / 255.0F; - const GLint comps = gl_components_in_format(format); + const GLint comps = _mesa_components_in_format(format); GLuint i; assert(n <= MAX_WIDTH); /* convert color components to floating point */ for (i=0;i<n;i++) { - red[i] = rgba[i][RCOMP] * rscale; - green[i] = rgba[i][GCOMP] * gscale; - blue[i] = rgba[i][BCOMP] * bscale; - alpha[i] = rgba[i][ACOMP] * ascale; + rgba[i][RCOMP] = srcRgba[i][RCOMP] * rscale; + rgba[i][GCOMP] = srcRgba[i][GCOMP] * gscale; + rgba[i][BCOMP] = srcRgba[i][BCOMP] * bscale; + rgba[i][ACOMP] = srcRgba[i][ACOMP] * ascale; } /* * Apply scale, bias and lookup-tables if enabled. */ if (applyTransferOps) { + /* scale & bias */ if (ctx->Pixel.ScaleOrBiasRGBA) { - gl_scale_and_bias_color( ctx, n, red, green, blue, alpha ); + _mesa_scale_and_bias_rgba( ctx, n, rgba ); } + /* color map lookup */ if (ctx->Pixel.MapColorFlag) { - gl_map_color( ctx, n, red, green, blue, alpha ); + _mesa_map_rgba( ctx, n, rgba ); + } + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* XXX post-convolution color table look-up here */ + /* color matrix */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); + if (ctx->MinMax.Sink) + return; } } if (format==GL_LUMINANCE || format==GL_LUMINANCE_ALPHA) { for (i=0;i<n;i++) { - GLfloat sum = red[i] + green[i] + blue[i]; + GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; luminance[i] = CLAMP( sum, 0.0F, 1.0F ); } } @@ -628,19 +712,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(red[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(green[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(blue[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UBYTE(alpha[i]); + dst[i] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -649,49 +733,49 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_UBYTE(luminance[i]); - dst[i*2+1] = FLOAT_TO_UBYTE(alpha[i]); + dst[i*2+1] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UBYTE(red[i]); - dst[i*3+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*3+2] = FLOAT_TO_UBYTE(blue[i]); + dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(red[i]); - dst[i*4+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*4+2] = FLOAT_TO_UBYTE(blue[i]); - dst[i*4+3] = FLOAT_TO_UBYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UBYTE(blue[i]); - dst[i*3+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*3+2] = FLOAT_TO_UBYTE(red[i]); + dst[i*3+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(blue[i]); - dst[i*4+1] = FLOAT_TO_UBYTE(green[i]); - dst[i*4+2] = FLOAT_TO_UBYTE(red[i]); - dst[i*4+3] = FLOAT_TO_UBYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UBYTE(alpha[i]); - dst[i*4+1] = FLOAT_TO_UBYTE(blue[i]); - dst[i*4+2] = FLOAT_TO_UBYTE(green[i]); - dst[i*4+3] = FLOAT_TO_UBYTE(red[i]); + dst[i*4+0] = FLOAT_TO_UBYTE(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_UBYTE(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_UBYTE(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_UBYTE(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } } break; @@ -701,19 +785,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(red[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(green[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(blue[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_BYTE(alpha[i]); + dst[i] = FLOAT_TO_BYTE(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -722,48 +806,48 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_BYTE(luminance[i]); - dst[i*2+1] = FLOAT_TO_BYTE(alpha[i]); + dst[i*2+1] = FLOAT_TO_BYTE(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(red[i]); - dst[i*3+1] = FLOAT_TO_BYTE(green[i]); - dst[i*3+2] = FLOAT_TO_BYTE(blue[i]); + dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(red[i]); - dst[i*4+1] = FLOAT_TO_BYTE(green[i]); - dst[i*4+2] = FLOAT_TO_BYTE(blue[i]); - dst[i*4+3] = FLOAT_TO_BYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_BYTE(blue[i]); - dst[i*3+1] = FLOAT_TO_BYTE(green[i]); - dst[i*3+2] = FLOAT_TO_BYTE(red[i]); + dst[i*3+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(blue[i]); - dst[i*4+1] = FLOAT_TO_BYTE(green[i]); - dst[i*4+2] = FLOAT_TO_BYTE(red[i]); - dst[i*4+3] = FLOAT_TO_BYTE(alpha[i]); + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][ACOMP]); } case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_BYTE(alpha[i]); - dst[i*4+1] = FLOAT_TO_BYTE(blue[i]); - dst[i*4+2] = FLOAT_TO_BYTE(green[i]); - dst[i*4+3] = FLOAT_TO_BYTE(red[i]); + dst[i*4+0] = FLOAT_TO_BYTE(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_BYTE(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_BYTE(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_BYTE(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } } break; @@ -773,19 +857,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(red[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(green[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(blue[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_USHORT(alpha[i]); + dst[i] = FLOAT_TO_USHORT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -794,52 +878,52 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_USHORT(luminance[i]); - dst[i*2+1] = FLOAT_TO_USHORT(alpha[i]); + dst[i*2+1] = FLOAT_TO_USHORT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_USHORT(red[i]); - dst[i*3+1] = FLOAT_TO_USHORT(green[i]); - dst[i*3+2] = FLOAT_TO_USHORT(blue[i]); + dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(red[i]); - dst[i*4+1] = FLOAT_TO_USHORT(green[i]); - dst[i*4+2] = FLOAT_TO_USHORT(blue[i]); - dst[i*4+3] = FLOAT_TO_USHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_USHORT(blue[i]); - dst[i*3+1] = FLOAT_TO_USHORT(green[i]); - dst[i*3+2] = FLOAT_TO_USHORT(red[i]); + dst[i*3+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(blue[i]); - dst[i*4+1] = FLOAT_TO_USHORT(green[i]); - dst[i*4+2] = FLOAT_TO_USHORT(red[i]); - dst[i*4+3] = FLOAT_TO_USHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_USHORT(alpha[i]); - dst[i*4+1] = FLOAT_TO_USHORT(blue[i]); - dst[i*4+2] = FLOAT_TO_USHORT(green[i]); - dst[i*4+3] = FLOAT_TO_USHORT(red[i]); + dst[i*4+0] = FLOAT_TO_USHORT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_USHORT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_USHORT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_USHORT(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, n * comps); + _mesa_swap2( (GLushort *) dst, n * comps); } } break; @@ -849,19 +933,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(red[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(green[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(blue[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_SHORT(alpha[i]); + dst[i] = FLOAT_TO_SHORT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -870,51 +954,51 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_SHORT(luminance[i]); - dst[i*2+1] = FLOAT_TO_SHORT(alpha[i]); + dst[i*2+1] = FLOAT_TO_SHORT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(red[i]); - dst[i*3+1] = FLOAT_TO_SHORT(green[i]); - dst[i*3+2] = FLOAT_TO_SHORT(blue[i]); + dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(red[i]); - dst[i*4+1] = FLOAT_TO_SHORT(green[i]); - dst[i*4+2] = FLOAT_TO_SHORT(blue[i]); - dst[i*4+3] = FLOAT_TO_SHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_SHORT(blue[i]); - dst[i*3+1] = FLOAT_TO_SHORT(green[i]); - dst[i*3+2] = FLOAT_TO_SHORT(red[i]); + dst[i*3+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(blue[i]); - dst[i*4+1] = FLOAT_TO_SHORT(green[i]); - dst[i*4+2] = FLOAT_TO_SHORT(red[i]); - dst[i*4+3] = FLOAT_TO_SHORT(alpha[i]); + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][ACOMP]); } case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_SHORT(alpha[i]); - dst[i*4+1] = FLOAT_TO_SHORT(blue[i]); - dst[i*4+2] = FLOAT_TO_SHORT(green[i]); - dst[i*4+3] = FLOAT_TO_SHORT(red[i]); + dst[i*4+0] = FLOAT_TO_SHORT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_SHORT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_SHORT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_SHORT(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap2( (GLushort *) dst, n * comps ); + _mesa_swap2( (GLushort *) dst, n * comps ); } } break; @@ -924,19 +1008,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(red[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(green[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(blue[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_UINT(alpha[i]); + dst[i] = FLOAT_TO_UINT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -945,52 +1029,52 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_UINT(luminance[i]); - dst[i*2+1] = FLOAT_TO_UINT(alpha[i]); + dst[i*2+1] = FLOAT_TO_UINT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UINT(red[i]); - dst[i*3+1] = FLOAT_TO_UINT(green[i]); - dst[i*3+2] = FLOAT_TO_UINT(blue[i]); + dst[i*3+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(red[i]); - dst[i*4+1] = FLOAT_TO_UINT(green[i]); - dst[i*4+2] = FLOAT_TO_UINT(blue[i]); - dst[i*4+3] = FLOAT_TO_UINT(alpha[i]); + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_UINT(blue[i]); - dst[i*3+1] = FLOAT_TO_UINT(green[i]); - dst[i*3+2] = FLOAT_TO_UINT(red[i]); + dst[i*3+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(blue[i]); - dst[i*4+1] = FLOAT_TO_UINT(green[i]); - dst[i*4+2] = FLOAT_TO_UINT(red[i]); - dst[i*4+3] = FLOAT_TO_UINT(alpha[i]); + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_UINT(alpha[i]); - dst[i*4+1] = FLOAT_TO_UINT(blue[i]); - dst[i*4+2] = FLOAT_TO_UINT(green[i]); - dst[i*4+3] = FLOAT_TO_UINT(red[i]); + dst[i*4+0] = FLOAT_TO_UINT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_UINT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_UINT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_UINT(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, n * comps ); + _mesa_swap4( (GLuint *) dst, n * comps ); } } break; @@ -1000,19 +1084,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(red[i]); + dst[i] = FLOAT_TO_INT(rgba[i][RCOMP]); break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(green[i]); + dst[i] = FLOAT_TO_INT(rgba[i][GCOMP]); break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(blue[i]); + dst[i] = FLOAT_TO_INT(rgba[i][BCOMP]); break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = FLOAT_TO_INT(alpha[i]); + dst[i] = FLOAT_TO_INT(rgba[i][ACOMP]); break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -1021,52 +1105,52 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = FLOAT_TO_INT(luminance[i]); - dst[i*2+1] = FLOAT_TO_INT(alpha[i]); + dst[i*2+1] = FLOAT_TO_INT(rgba[i][ACOMP]); } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_INT(red[i]); - dst[i*3+1] = FLOAT_TO_INT(green[i]); - dst[i*3+2] = FLOAT_TO_INT(blue[i]); + dst[i*3+0] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_INT(rgba[i][BCOMP]); } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(red[i]); - dst[i*4+1] = FLOAT_TO_INT(green[i]); - dst[i*4+2] = FLOAT_TO_INT(blue[i]); - dst[i*4+3] = FLOAT_TO_INT(alpha[i]); + dst[i*4+0] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = FLOAT_TO_INT(blue[i]); - dst[i*3+1] = FLOAT_TO_INT(green[i]); - dst[i*3+2] = FLOAT_TO_INT(red[i]); + dst[i*3+0] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*3+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*3+2] = FLOAT_TO_INT(rgba[i][RCOMP]); } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(blue[i]); - dst[i*4+1] = FLOAT_TO_INT(green[i]); - dst[i*4+2] = FLOAT_TO_INT(red[i]); - dst[i*4+3] = FLOAT_TO_INT(alpha[i]); + dst[i*4+0] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][RCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][ACOMP]); } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = FLOAT_TO_INT(alpha[i]); - dst[i*4+1] = FLOAT_TO_INT(blue[i]); - dst[i*4+2] = FLOAT_TO_INT(green[i]); - dst[i*4+3] = FLOAT_TO_INT(red[i]); + dst[i*4+0] = FLOAT_TO_INT(rgba[i][ACOMP]); + dst[i*4+1] = FLOAT_TO_INT(rgba[i][BCOMP]); + dst[i*4+2] = FLOAT_TO_INT(rgba[i][GCOMP]); + dst[i*4+3] = FLOAT_TO_INT(rgba[i][RCOMP]); } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, n * comps ); + _mesa_swap4( (GLuint *) dst, n * comps ); } } break; @@ -1076,19 +1160,19 @@ void gl_pack_rgba_span( const GLcontext *ctx, switch (format) { case GL_RED: for (i=0;i<n;i++) - dst[i] = red[i]; + dst[i] = rgba[i][RCOMP]; break; case GL_GREEN: for (i=0;i<n;i++) - dst[i] = green[i]; + dst[i] = rgba[i][GCOMP]; break; case GL_BLUE: for (i=0;i<n;i++) - dst[i] = blue[i]; + dst[i] = rgba[i][BCOMP]; break; case GL_ALPHA: for (i=0;i<n;i++) - dst[i] = alpha[i]; + dst[i] = rgba[i][ACOMP]; break; case GL_LUMINANCE: for (i=0;i<n;i++) @@ -1097,52 +1181,52 @@ void gl_pack_rgba_span( const GLcontext *ctx, case GL_LUMINANCE_ALPHA: for (i=0;i<n;i++) { dst[i*2+0] = luminance[i]; - dst[i*2+1] = alpha[i]; + dst[i*2+1] = rgba[i][ACOMP]; } break; case GL_RGB: for (i=0;i<n;i++) { - dst[i*3+0] = red[i]; - dst[i*3+1] = green[i]; - dst[i*3+2] = blue[i]; + dst[i*3+0] = rgba[i][RCOMP]; + dst[i*3+1] = rgba[i][GCOMP]; + dst[i*3+2] = rgba[i][BCOMP]; } break; case GL_RGBA: for (i=0;i<n;i++) { - dst[i*4+0] = red[i]; - dst[i*4+1] = green[i]; - dst[i*4+2] = blue[i]; - dst[i*4+3] = alpha[i]; + dst[i*4+0] = rgba[i][RCOMP]; + dst[i*4+1] = rgba[i][GCOMP]; + dst[i*4+2] = rgba[i][BCOMP]; + dst[i*4+3] = rgba[i][ACOMP]; } break; case GL_BGR: for (i=0;i<n;i++) { - dst[i*3+0] = blue[i]; - dst[i*3+1] = green[i]; - dst[i*3+2] = red[i]; + dst[i*3+0] = rgba[i][BCOMP]; + dst[i*3+1] = rgba[i][GCOMP]; + dst[i*3+2] = rgba[i][RCOMP]; } break; case GL_BGRA: for (i=0;i<n;i++) { - dst[i*4+0] = blue[i]; - dst[i*4+1] = green[i]; - dst[i*4+2] = red[i]; - dst[i*4+3] = alpha[i]; + dst[i*4+0] = rgba[i][BCOMP]; + dst[i*4+1] = rgba[i][GCOMP]; + dst[i*4+2] = rgba[i][RCOMP]; + dst[i*4+3] = rgba[i][ACOMP]; } break; case GL_ABGR_EXT: for (i=0;i<n;i++) { - dst[i*4+0] = alpha[i]; - dst[i*4+1] = blue[i]; - dst[i*4+2] = green[i]; - dst[i*4+3] = red[i]; + dst[i*4+0] = rgba[i][ACOMP]; + dst[i*4+1] = rgba[i][BCOMP]; + dst[i*4+2] = rgba[i][GCOMP]; + dst[i*4+3] = rgba[i][RCOMP]; } break; default: - gl_problem(ctx, "bad format in gl_pack_rgba_span\n"); + gl_problem(ctx, "bad format in _mesa_pack_rgba_span\n"); } if (packing->SwapBytes) { - gl_swap4( (GLuint *) dst, n * comps ); + _mesa_swap4( (GLuint *) dst, n * comps ); } } break; @@ -1150,9 +1234,9 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLubyte *dst = (GLubyte *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 7.0F)) << 5) - | (((GLint) (green[i] * 7.0F)) << 2) - | (((GLint) (blue[i] * 3.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) << 5) + | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 2) + | (((GLint) (rgba[i][BCOMP] * 3.0F)) ); } } break; @@ -1160,9 +1244,9 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLubyte *dst = (GLubyte *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 7.0F)) ) - | (((GLint) (green[i] * 7.0F)) << 3) - | (((GLint) (blue[i] * 3.0F)) << 5); + dst[i] = (((GLint) (rgba[i][RCOMP] * 7.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 7.0F)) << 3) + | (((GLint) (rgba[i][BCOMP] * 3.0F)) << 5); } } break; @@ -1170,9 +1254,9 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) << 11) - | (((GLint) (green[i] * 63.0F)) << 5) - | (((GLint) (blue[i] * 31.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) ); } } break; @@ -1180,9 +1264,9 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) ) - | (((GLint) (green[i] * 63.0F)) << 5) - | (((GLint) (blue[i] * 31.0F)) << 11); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 63.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 11); } } break; @@ -1190,10 +1274,10 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 15.0F)) << 12) - | (((GLint) (green[i] * 15.0F)) << 8) - | (((GLint) (blue[i] * 15.0F)) << 4) - | (((GLint) (alpha[i] * 15.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) << 12) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) ); } } break; @@ -1201,10 +1285,10 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 15.0F)) ) - | (((GLint) (green[i] * 15.0F)) << 4) - | (((GLint) (blue[i] * 15.0F)) << 8) - | (((GLint) (alpha[i] * 15.0F)) << 12); + dst[i] = (((GLint) (rgba[i][RCOMP] * 15.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 15.0F)) << 4) + | (((GLint) (rgba[i][BCOMP] * 15.0F)) << 8) + | (((GLint) (rgba[i][ACOMP] * 15.0F)) << 12); } } break; @@ -1212,10 +1296,10 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) << 11) - | (((GLint) (green[i] * 31.0F)) << 6) - | (((GLint) (blue[i] * 31.0F)) << 1) - | (((GLint) (alpha[i] * 1.0F)) ); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) << 11) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 6) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 1) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) ); } } break; @@ -1223,10 +1307,10 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGB) { GLushort *dst = (GLushort *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLint) (red[i] * 31.0F)) ) - | (((GLint) (green[i] * 31.0F)) << 5) - | (((GLint) (blue[i] * 31.0F)) << 10) - | (((GLint) (alpha[i] * 1.0F)) << 15); + dst[i] = (((GLint) (rgba[i][RCOMP] * 31.0F)) ) + | (((GLint) (rgba[i][GCOMP] * 31.0F)) << 5) + | (((GLint) (rgba[i][BCOMP] * 31.0F)) << 10) + | (((GLint) (rgba[i][ACOMP] * 1.0F)) << 15); } } break; @@ -1234,28 +1318,28 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 255.0F)) << 24) - | (((GLuint) (green[i] * 255.0F)) << 16) - | (((GLuint) (blue[i] * 255.0F)) << 8) - | (((GLuint) (alpha[i] * 255.0F)) ); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 255.0F)) << 24) - | (((GLuint) (green[i] * 255.0F)) << 16) - | (((GLuint) (red[i] * 255.0F)) << 8) - | (((GLuint) (alpha[i] * 255.0F)) ); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) ); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 255.0F)) << 24) - | (((GLuint) (blue[i] * 255.0F)) << 16) - | (((GLuint) (green[i] * 255.0F)) << 8) - | (((GLuint) (red[i] * 255.0F)) ); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) ); } } break; @@ -1263,28 +1347,28 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 255.0F)) ) - | (((GLuint) (green[i] * 255.0F)) << 8) - | (((GLuint) (blue[i] * 255.0F)) << 16) - | (((GLuint) (alpha[i] * 255.0F)) << 24); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 255.0F)) ) - | (((GLuint) (green[i] * 255.0F)) << 8) - | (((GLuint) (red[i] * 255.0F)) << 16) - | (((GLuint) (alpha[i] * 255.0F)) << 24); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][ACOMP] * 255.0F)) << 24); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 255.0F)) ) - | (((GLuint) (blue[i] * 255.0F)) << 8) - | (((GLuint) (green[i] * 255.0F)) << 16) - | (((GLuint) (red[i] * 255.0F)) << 24); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 255.0F)) ) + | (((GLuint) (rgba[i][BCOMP] * 255.0F)) << 8) + | (((GLuint) (rgba[i][GCOMP] * 255.0F)) << 16) + | (((GLuint) (rgba[i][RCOMP] * 255.0F)) << 24); } } break; @@ -1292,28 +1376,28 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 1023.0F)) << 22) - | (((GLuint) (green[i] * 1023.0F)) << 12) - | (((GLuint) (blue[i] * 1023.0F)) << 2) - | (((GLuint) (alpha[i] * 3.0F)) ); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 1023.0F)) << 22) - | (((GLuint) (green[i] * 1023.0F)) << 12) - | (((GLuint) (red[i] * 1023.0F)) << 2) - | (((GLuint) (alpha[i] * 3.0F)) ); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) ); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 1023.0F)) << 22) - | (((GLuint) (blue[i] * 1023.0F)) << 12) - | (((GLuint) (green[i] * 1023.0F)) << 2) - | (((GLuint) (red[i] * 3.0F)) ); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) << 22) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 12) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 2) + | (((GLuint) (rgba[i][RCOMP] * 3.0F)) ); } } break; @@ -1321,38 +1405,39 @@ void gl_pack_rgba_span( const GLcontext *ctx, if (format == GL_RGBA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (red[i] * 1023.0F)) ) - | (((GLuint) (green[i] * 1023.0F)) << 10) - | (((GLuint) (blue[i] * 1023.0F)) << 20) - | (((GLuint) (alpha[i] * 3.0F)) << 30); + dst[i] = (((GLuint) (rgba[i][RCOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); } } else if (format == GL_BGRA) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (blue[i] * 1023.0F)) ) - | (((GLuint) (green[i] * 1023.0F)) << 10) - | (((GLuint) (red[i] * 1023.0F)) << 20) - | (((GLuint) (alpha[i] * 3.0F)) << 30); + dst[i] = (((GLuint) (rgba[i][BCOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][RCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][ACOMP] * 3.0F)) << 30); } } else if (format == GL_ABGR_EXT) { GLuint *dst = (GLuint *) destination; for (i=0;i<n;i++) { - dst[i] = (((GLuint) (alpha[i] * 1023.0F)) ) - | (((GLuint) (blue[i] * 1023.0F)) << 10) - | (((GLuint) (green[i] * 1023.0F)) << 20) - | (((GLuint) (red[i] * 3.0F)) << 30); + dst[i] = (((GLuint) (rgba[i][ACOMP] * 1023.0F)) ) + | (((GLuint) (rgba[i][BCOMP] * 1023.0F)) << 10) + | (((GLuint) (rgba[i][GCOMP] * 1023.0F)) << 20) + | (((GLuint) (rgba[i][RCOMP] * 3.0F)) << 30); } } break; default: - gl_problem( ctx, "bad type in gl_pack_rgba_span" ); + gl_problem( ctx, "bad type in _mesa_pack_rgba_span" ); } } } + #define SWAP2BYTE(VALUE) \ { \ GLubyte *bytes = (GLubyte *) &(VALUE); \ @@ -1515,12 +1600,12 @@ extract_uint_indexes(GLuint n, GLuint indexes[], for (i = 0; i < n; i++) { GLfloat value = s[i]; SWAP4BYTE(value); - indexes[i] = value; + indexes[i] = (GLuint) value; } } else { for (i = 0; i < n; i++) - indexes[i] = s[i]; + indexes[i] = (GLuint) s[i]; } } break; @@ -2056,7 +2141,7 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4], * XXX perhaps expand this to process whole images someday. */ void -_mesa_unpack_ubyte_color_span( const GLcontext *ctx, +_mesa_unpack_ubyte_color_span( GLcontext *ctx, GLuint n, GLenum dstFormat, GLubyte dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -2106,12 +2191,17 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, srcType == GL_UNSIGNED_INT_10_10_10_2 || srcType == GL_UNSIGNED_INT_2_10_10_10_REV); - /* this is intended for RGBA mode */ + /* this is intended for RGBA mode only */ assert(ctx->Visual->RGBAflag); applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || ctx->Pixel.MapColorFlag || - ctx->Pixel.MapColorFlag); + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled); /* Try simple cases first */ if (!applyTransferOps && srcType == GL_UNSIGNED_BYTE) { @@ -2155,7 +2245,7 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } } else if (dstFormat == srcFormat) { - GLint comps = gl_components_in_format(srcFormat); + GLint comps = _mesa_components_in_format(srcFormat); assert(comps > 0); MEMCPY( dest, source, n * comps * sizeof(GLubyte) ); return; @@ -2163,14 +2253,14 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } + /* general solution begins here */ { - /* general solution */ GLfloat rgba[MAX_WIDTH][4]; GLint dstComponents; GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; GLint dstLuminanceIndex, dstIntensityIndex; - dstComponents = gl_components_in_format( dstFormat ); + dstComponents = _mesa_components_in_format( dstFormat ); /* source & dest image formats should have been error checked by now */ assert(dstComponents > 0); @@ -2183,32 +2273,26 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, extract_uint_indexes(n, indexes, srcFormat, srcType, source, unpacking); - /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); - - if (dstFormat == GL_COLOR_INDEX) { - if (applyTransferOps) { - if (ctx->Pixel.MapColorFlag) { - /* Apply lookup table */ - gl_map_ci(ctx, n, indexes); - } - - if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { - - } + if (applyTransferOps) { + if (ctx->Pixel.MapColorFlag) { + _mesa_map_ci(ctx, n, indexes); + } + if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { + _mesa_shift_and_offset_ci(ctx, n, indexes); } + } + if (dstFormat == GL_COLOR_INDEX) { /* convert to GLubyte and return */ - { - GLuint i; - for (i = 0; i < n; i++) { - dest[i] = (GLubyte) (indexes[i] & 0xff); - } + GLuint i; + for (i = 0; i < n; i++) { + dest[i] = (GLubyte) (indexes[i] & 0xff); } + return; } else { /* Convert indexes to RGBA */ - gl_map_ci_to_rgba_float(ctx, n, indexes, rgba); + _mesa_map_ci_to_rgba(ctx, n, indexes, rgba); } } else { @@ -2217,23 +2301,41 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, if (applyTransferOps) { /* scale and bias colors */ - gl_scale_and_bias_rgba_float(ctx, n, rgba); - - /* color table lookup */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba(ctx, n, rgba); + } + /* color map lookup */ if (ctx->Pixel.MapColorFlag) { - gl_map_rgba_float(ctx, n, rgba); + _mesa_map_rgba(ctx, n, rgba); } } } - - /* - * XXX This is where more color table lookups, convolution, - * histograms, minmax, color matrix, etc would take place if - * implemented. - * See figure 3.7 in the OpenGL 1.2 specification for more info. - */ - + if (applyTransferOps) { + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* XXX post-convolution color table look-up here */ + /* color matrix transform */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + } /* clamp to [0,1] */ { @@ -2353,6 +2455,270 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, } +void +_mesa_unpack_float_color_span( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLfloat dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *unpacking, + GLboolean applyTransferOps, GLboolean clamp ) +{ + ASSERT(dstFormat == GL_ALPHA || + dstFormat == GL_LUMINANCE || + dstFormat == GL_LUMINANCE_ALPHA || + dstFormat == GL_INTENSITY || + dstFormat == GL_RGB || + dstFormat == GL_RGBA || + dstFormat == GL_COLOR_INDEX); + + ASSERT(srcFormat == GL_RED || + srcFormat == GL_GREEN || + srcFormat == GL_BLUE || + srcFormat == GL_ALPHA || + srcFormat == GL_LUMINANCE || + srcFormat == GL_LUMINANCE_ALPHA || + srcFormat == GL_INTENSITY || + srcFormat == GL_RGB || + srcFormat == GL_BGR || + srcFormat == GL_RGBA || + srcFormat == GL_BGRA || + srcFormat == GL_ABGR_EXT || + srcFormat == GL_COLOR_INDEX); + + ASSERT(srcType == GL_BITMAP || + srcType == GL_UNSIGNED_BYTE || + srcType == GL_BYTE || + srcType == GL_UNSIGNED_SHORT || + srcType == GL_SHORT || + srcType == GL_UNSIGNED_INT || + srcType == GL_INT || + srcType == GL_FLOAT || + srcType == GL_UNSIGNED_BYTE_3_3_2 || + srcType == GL_UNSIGNED_BYTE_2_3_3_REV || + srcType == GL_UNSIGNED_SHORT_5_6_5 || + srcType == GL_UNSIGNED_SHORT_5_6_5_REV || + srcType == GL_UNSIGNED_SHORT_4_4_4_4 || + srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV || + srcType == GL_UNSIGNED_SHORT_5_5_5_1 || + srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV || + srcType == GL_UNSIGNED_INT_8_8_8_8 || + srcType == GL_UNSIGNED_INT_8_8_8_8_REV || + srcType == GL_UNSIGNED_INT_10_10_10_2 || + srcType == GL_UNSIGNED_INT_2_10_10_10_REV); + + /* this is intended for RGBA mode only */ + assert(ctx->Visual->RGBAflag); + + applyTransferOps &= (ctx->Pixel.ScaleOrBiasRGBA || + ctx->Pixel.MapColorFlag || + ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm || + ctx->Pixel.ColorTableEnabled || + ctx->Pixel.PostColorMatrixColorTableEnabled || + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled); + + /* general solution, no special cases, yet */ + { + GLfloat rgba[MAX_WIDTH][4]; + GLint dstComponents; + GLint dstRedIndex, dstGreenIndex, dstBlueIndex, dstAlphaIndex; + GLint dstLuminanceIndex, dstIntensityIndex; + + dstComponents = _mesa_components_in_format( dstFormat ); + /* source & dest image formats should have been error checked by now */ + assert(dstComponents > 0); + + /* + * Extract image data and convert to RGBA floats + */ + assert(n <= MAX_WIDTH); + if (srcFormat == GL_COLOR_INDEX) { + GLuint indexes[MAX_WIDTH]; + extract_uint_indexes(n, indexes, srcFormat, srcType, source, + unpacking); + + if (applyTransferOps) { + if (ctx->Pixel.MapColorFlag) { + _mesa_map_ci(ctx, n, indexes); + } + if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { + _mesa_shift_and_offset_ci(ctx, n, indexes); + } + } + + if (dstFormat == GL_COLOR_INDEX) { + /* convert to GLubyte and return */ + GLuint i; + for (i = 0; i < n; i++) { + dest[i] = (GLubyte) (indexes[i] & 0xff); + } + return; + } + else { + /* Convert indexes to RGBA */ + _mesa_map_ci_to_rgba(ctx, n, indexes, rgba); + } + } + else { + extract_float_rgba(n, rgba, srcFormat, srcType, source, + unpacking->SwapBytes); + + if (applyTransferOps) { + /* scale and bias colors */ + if (ctx->Pixel.ScaleOrBiasRGBA) { + _mesa_scale_and_bias_rgba(ctx, n, rgba); + } + /* color map lookup */ + if (ctx->Pixel.MapColorFlag) { + _mesa_map_rgba(ctx, n, rgba); + } + } + } + + if (applyTransferOps) { + /* GL_COLOR_TABLE lookup */ + if (ctx->Pixel.ColorTableEnabled) { + _mesa_lookup_rgba(&ctx->ColorTable, n, rgba); + } + /* XXX convolution here */ + /* XXX post-convolution color table look-up here */ + /* color matrix transform */ + if (ctx->ColorMatrix.type != MATRIX_IDENTITY || + ctx->Pixel.ScaleOrBiasRGBApcm) { + _mesa_transform_rgba(ctx, n, rgba); + } + /* GL_POST_COLOR_MATRIX_COLOR_TABLE lookup */ + if (ctx->Pixel.PostColorMatrixColorTableEnabled) { + _mesa_lookup_rgba(&ctx->PostColorMatrixColorTable, n, rgba); + } + /* update histogram count */ + if (ctx->Pixel.HistogramEnabled) { + _mesa_update_histogram(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + /* XXX min/max here */ + if (ctx->Pixel.MinMaxEnabled) { + _mesa_update_minmax(ctx, n, (CONST GLfloat (*)[4]) rgba); + } + } + + /* clamp to [0,1] */ + if (clamp) { + GLuint i; + for (i = 0; i < n; i++) { + rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); + rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); + rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); + rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); + } + } + + /* Now determine which color channels we need to produce. + * And determine the dest index (offset) within each color tuple. + */ + switch (dstFormat) { + case GL_ALPHA: + dstAlphaIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_LUMINANCE: + dstLuminanceIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstIntensityIndex = -1; + break; + case GL_LUMINANCE_ALPHA: + dstLuminanceIndex = 0; + dstAlphaIndex = 1; + dstRedIndex = dstGreenIndex = dstBlueIndex = -1; + dstIntensityIndex = -1; + break; + case GL_INTENSITY: + dstIntensityIndex = 0; + dstRedIndex = dstGreenIndex = dstBlueIndex = dstAlphaIndex = -1; + dstLuminanceIndex = -1; + break; + case GL_RGB: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = dstLuminanceIndex = dstIntensityIndex = -1; + break; + case GL_RGBA: + dstRedIndex = 0; + dstGreenIndex = 1; + dstBlueIndex = 2; + dstAlphaIndex = 3; + dstLuminanceIndex = dstIntensityIndex = -1; + break; + default: + gl_problem(ctx, "bad dstFormat in _mesa_unpack_float_span()"); + return; + } + + /* Now pack results in teh requested dstFormat */ + if (dstRedIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstRedIndex] = rgba[i][RCOMP]; + dst += dstComponents; + } + } + + if (dstGreenIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstGreenIndex] = rgba[i][GCOMP]; + dst += dstComponents; + } + } + + if (dstBlueIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstBlueIndex] = rgba[i][BCOMP]; + dst += dstComponents; + } + } + + if (dstAlphaIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + for (i = 0; i < n; i++) { + dst[dstAlphaIndex] = rgba[i][ACOMP]; + dst += dstComponents; + } + } + + if (dstIntensityIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + assert(dstIntensityIndex == 0); + assert(dstComponents == 1); + for (i = 0; i < n; i++) { + /* Intensity comes from red channel */ + dst[i] = rgba[i][RCOMP]; + } + } + + if (dstLuminanceIndex >= 0) { + GLfloat *dst = dest; + GLuint i; + assert(dstLuminanceIndex == 0); + for (i = 0; i < n; i++) { + /* Luminance comes from red channel */ + dst[0] = rgba[i][RCOMP]; + dst += dstComponents; + } + } + } +} + + + /* * Unpack a row of color index data from a client buffer according to @@ -2415,12 +2781,11 @@ _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, if (applyTransferOps) { if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); + _mesa_shift_and_offset_ci(ctx, n, indexes); } - if (ctx->Pixel.MapColorFlag) { /* Apply lookup table */ - gl_map_ci(ctx, n, indexes); + _mesa_map_ci(ctx, n, indexes); } } @@ -2515,7 +2880,7 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n, if (applyTransferOps) { if (ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset) { /* shift and offset indexes */ - gl_shift_and_offset_ci(ctx, n, indexes); + _mesa_shift_and_offset_ci(ctx, n, indexes); } if (ctx->Pixel.MapStencilFlag) { @@ -2643,9 +3008,10 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n, GLdepth *dest, /* clamp depth values to [0,1] and convert from floats to integers */ { + const GLfloat zs = ctx->Visual->DepthMaxF; GLuint i; for (i = 0; i < n; i++) { - dest[i] = (GLdepth) (CLAMP(depth[i], 0.0F, 1.0F) * DEPTH_SCALE); + dest[i] = (GLdepth) (CLAMP(depth[i], 0.0F, 1.0F) * zs); } } @@ -2679,8 +3045,8 @@ _mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth, compsPerRow = 0; } else { - const GLint bytesPerPixel = gl_bytes_per_pixel(format, type); - const GLint components = gl_components_in_format(format); + const GLint bytesPerPixel = _mesa_bytes_per_pixel(format, type); + const GLint components = _mesa_components_in_format(format); GLint bytesPerComp; if (bytesPerPixel <= 0 || components <= 0) return NULL; /* bad format or type. generate error later */ @@ -2703,18 +3069,18 @@ _mesa_unpack_image( GLsizei width, GLsizei height, GLsizei depth, dst = destBuffer; for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(unpack, pixels, + const GLvoid *src = _mesa_image_address(unpack, pixels, width, height, format, type, img, row, 0); MEMCPY(dst, src, bytesPerRow); /* byte flipping/swapping */ if (flipBytes) { - gl_flip_bytes((GLubyte *) dst, bytesPerRow); + flip_bytes((GLubyte *) dst, bytesPerRow); } else if (swap2) { - gl_swap2((GLushort*) dst, compsPerRow); + _mesa_swap2((GLushort*) dst, compsPerRow); } else if (swap4) { - gl_swap4((GLuint*) dst, compsPerRow); + _mesa_swap4((GLuint*) dst, compsPerRow); } dst += bytesPerRow; } @@ -2748,9 +3114,9 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, width_in_bytes = CEILING( width, 8 ); dst = buffer; for (row = 0; row < height; row++) { - GLubyte *src = gl_pixel_addr_in_image( packing, pixels, width, height, - GL_COLOR_INDEX, GL_BITMAP, - 0, row, 0 ); + GLubyte *src = _mesa_image_address( packing, pixels, width, height, + GL_COLOR_INDEX, GL_BITMAP, + 0, row, 0 ); if (!src) { FREE(buffer); return NULL; @@ -2759,7 +3125,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, if (packing->SkipPixels == 0) { MEMCPY( dst, src, width_in_bytes ); if (packing->LsbFirst) { - gl_flip_bytes( dst, width_in_bytes ); + flip_bytes( dst, width_in_bytes ); } } else { @@ -2825,3 +3191,94 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, return buffer; } + + +/* + * Pack bitmap data. + */ +void +_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, + GLubyte *dest, const struct gl_pixelstore_attrib *packing ) +{ + GLint row, width_in_bytes; + const GLubyte *src; + + if (!source) + return; + + width_in_bytes = CEILING( width, 8 ); + src = source; + for (row = 0; row < height; row++) { + GLubyte *dst = _mesa_image_address( packing, dest, width, height, + GL_COLOR_INDEX, GL_BITMAP, + 0, row, 0 ); + if (!dst) + return; + + if (packing->SkipPixels == 0) { + MEMCPY( dst, src, width_in_bytes ); + if (packing->LsbFirst) { + flip_bytes( dst, width_in_bytes ); + } + } + else { + /* handling SkipPixels is a bit tricky (no pun intended!) */ + GLint i; + if (packing->LsbFirst) { + GLubyte srcMask = 1 << (packing->SkipPixels & 0x7); + GLubyte dstMask = 128; + const GLubyte *s = src; + GLubyte *d = dst; + *d = 0; + for (i = 0; i < width; i++) { + if (*s & srcMask) { + *d |= dstMask; + } + if (srcMask == 128) { + srcMask = 1; + s++; + } + else { + srcMask = srcMask << 1; + } + if (dstMask == 1) { + dstMask = 128; + d++; + *d = 0; + } + else { + dstMask = dstMask >> 1; + } + } + } + else { + GLubyte srcMask = 128 >> (packing->SkipPixels & 0x7); + GLubyte dstMask = 128; + const GLubyte *s = src; + GLubyte *d = dst; + *d = 0; + for (i = 0; i < width; i++) { + if (*s & srcMask) { + *d |= dstMask; + } + if (srcMask == 1) { + srcMask = 128; + s++; + } + else { + srcMask = srcMask >> 1; + } + if (dstMask == 1) { + dstMask = 128; + d++; + *d = 0; + } + else { + dstMask = dstMask >> 1; + } + } + } + } + src += width_in_bytes; + } +} diff --git a/xc/extras/Mesa/src/image.h b/xc/extras/Mesa/src/image.h index 84f104422..65c12c53c 100644 --- a/xc/extras/Mesa/src/image.h +++ b/xc/extras/Mesa/src/image.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -31,57 +31,63 @@ #include "types.h" -extern struct gl_pixelstore_attrib _mesa_native_packing; +extern const struct gl_pixelstore_attrib _mesa_native_packing; -extern void gl_flip_bytes( GLubyte *p, GLuint n ); +extern void +_mesa_swap2( GLushort *p, GLuint n ); +extern void +_mesa_swap4( GLuint *p, GLuint n ); -extern void gl_swap2( GLushort *p, GLuint n ); +extern GLint +_mesa_sizeof_type( GLenum type ); -extern void gl_swap4( GLuint *p, GLuint n ); +extern GLint +_mesa_sizeof_packed_type( GLenum type ); +extern GLint +_mesa_components_in_format( GLenum format ); -extern GLint gl_sizeof_type( GLenum type ); +extern GLint +_mesa_bytes_per_pixel( GLenum format, GLenum type ); -extern GLint gl_sizeof_packed_type( GLenum type ); +extern GLboolean +_mesa_is_legal_format_and_type( GLenum format, GLenum type ); -extern GLint gl_components_in_format( GLenum format ); -extern GLint gl_bytes_per_pixel( GLenum format, GLenum type ); +extern GLvoid * +_mesa_image_address( const struct gl_pixelstore_attrib *packing, + const GLvoid *image, GLsizei width, + GLsizei height, GLenum format, GLenum type, + GLint img, GLint row, GLint column ); -extern GLboolean gl_is_legal_format_and_type( GLenum format, GLenum type ); - -extern GLvoid * -gl_pixel_addr_in_image( const struct gl_pixelstore_attrib *packing, - const GLvoid *image, GLsizei width, - GLsizei height, GLenum format, GLenum type, - GLint img, GLint row, GLint column ); +extern GLint +_mesa_image_row_stride( const struct gl_pixelstore_attrib *packing, + GLint width, GLenum format, GLenum type ); extern void -gl_unpack_polygon_stipple( const GLcontext *ctx, - const GLubyte *pattern, - GLuint dest[32] ); +_mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32], + const struct gl_pixelstore_attrib *unpacking ); extern void -gl_pack_polygon_stipple( const GLcontext *ctx, - const GLuint pattern[32], - GLubyte *dest ); +_mesa_pack_polygon_stipple( const GLuint pattern[32], GLubyte *dest, + const struct gl_pixelstore_attrib *packing ); extern void -gl_pack_rgba_span( const GLcontext *ctx, - GLuint n, CONST GLubyte rgba[][4], - GLenum format, GLenum type, GLvoid *dest, - const struct gl_pixelstore_attrib *packing, - GLboolean applyTransferOps ); +_mesa_pack_rgba_span( GLcontext *ctx, + GLuint n, CONST GLubyte rgba[][4], + GLenum format, GLenum type, GLvoid *dest, + const struct gl_pixelstore_attrib *packing, + GLboolean applyTransferOps ); extern void -_mesa_unpack_ubyte_color_span( const GLcontext *ctx, +_mesa_unpack_ubyte_color_span( GLcontext *ctx, GLuint n, GLenum dstFormat, GLubyte dest[], GLenum srcFormat, GLenum srcType, const GLvoid *source, @@ -90,6 +96,15 @@ _mesa_unpack_ubyte_color_span( const GLcontext *ctx, extern void +_mesa_unpack_float_color_span( GLcontext *ctx, + GLuint n, GLenum dstFormat, GLfloat dest[], + GLenum srcFormat, GLenum srcType, + const GLvoid *source, + const struct gl_pixelstore_attrib *unpacking, + GLboolean applyTransferOps, GLboolean clamp ); + + +extern void _mesa_unpack_index_span( const GLcontext *ctx, GLuint n, GLenum dstType, GLvoid *dest, GLenum srcType, const GLvoid *source, @@ -122,5 +137,9 @@ extern GLvoid * _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels, const struct gl_pixelstore_attrib *packing ); +extern void +_mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source, + GLubyte *dest, const struct gl_pixelstore_attrib *packing ); + #endif diff --git a/xc/extras/Mesa/src/imaging.c b/xc/extras/Mesa/src/imaging.c index f1d912b6d..1dd37112d 100644 --- a/xc/extras/Mesa/src/imaging.c +++ b/xc/extras/Mesa/src/imaging.c @@ -24,327 +24,1594 @@ */ -/* Stub functions for GL_ARB_imaging subset */ +/* + * Histogram, Min/max and convolution for GL_ARB_imaging subset + * + */ #ifdef PC_HEADER #include "all.h" #else #include "glheader.h" +#include "context.h" +#include "image.h" #include "imaging.h" +#include "mmath.h" +#include "span.h" #endif -#define WARNING(MSG) fprintf(stderr,"Mesa warning: GL_ARB_imaging functions not implemented\n") +/**********************************************************************/ +/**** Histogram and Min/max *****/ +/**********************************************************************/ - -#if 0 -void _mesa_BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) +static void +pack_histogram( GLcontext *ctx, + GLuint n, CONST GLuint rgba[][4], + GLenum format, GLenum type, GLvoid *destination, + const struct gl_pixelstore_attrib *packing ) { - (void) r; - (void) g; - (void) b; - (void) a; - WARNING("glBlendColor"); -} + const GLint comps = _mesa_components_in_format(format); + GLuint luminance[MAX_WIDTH]; -void _mesa_BlendEquation(GLenum eq) -{ - (void) eq; - WARNING("glBlendEquation"); + if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) { + GLuint i; + for (i = 0; i < n; i++) { + luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; + } + } + +#define PACK_MACRO(TYPE) \ + { \ + GLuint i; \ + switch (format) { \ + case GL_RED: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) rgba[i][RCOMP]; \ + break; \ + case GL_GREEN: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) rgba[i][GCOMP]; \ + break; \ + case GL_BLUE: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) rgba[i][BCOMP]; \ + break; \ + case GL_ALPHA: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) rgba[i][ACOMP]; \ + break; \ + case GL_LUMINANCE: \ + for (i=0;i<n;i++) \ + dst[i] = (TYPE) luminance[i]; \ + break; \ + case GL_LUMINANCE_ALPHA: \ + for (i=0;i<n;i++) { \ + dst[i*2+0] = (TYPE) luminance[i]; \ + dst[i*2+1] = (TYPE) rgba[i][ACOMP]; \ + } \ + break; \ + case GL_RGB: \ + for (i=0;i<n;i++) { \ + dst[i*3+0] = (TYPE) rgba[i][RCOMP]; \ + dst[i*3+1] = (TYPE) rgba[i][GCOMP]; \ + dst[i*3+2] = (TYPE) rgba[i][BCOMP]; \ + } \ + break; \ + case GL_RGBA: \ + for (i=0;i<n;i++) { \ + dst[i*4+0] = (TYPE) rgba[i][RCOMP]; \ + dst[i*4+1] = (TYPE) rgba[i][GCOMP]; \ + dst[i*4+2] = (TYPE) rgba[i][BCOMP]; \ + dst[i*4+3] = (TYPE) rgba[i][ACOMP]; \ + } \ + break; \ + case GL_BGR: \ + for (i=0;i<n;i++) { \ + dst[i*3+0] = (TYPE) rgba[i][BCOMP]; \ + dst[i*3+1] = (TYPE) rgba[i][GCOMP]; \ + dst[i*3+2] = (TYPE) rgba[i][RCOMP]; \ + } \ + break; \ + case GL_BGRA: \ + for (i=0;i<n;i++) { \ + dst[i*4+0] = (TYPE) rgba[i][BCOMP]; \ + dst[i*4+1] = (TYPE) rgba[i][GCOMP]; \ + dst[i*4+2] = (TYPE) rgba[i][RCOMP]; \ + dst[i*4+3] = (TYPE) rgba[i][ACOMP]; \ + } \ + break; \ + case GL_ABGR_EXT: \ + for (i=0;i<n;i++) { \ + dst[i*4+0] = (TYPE) rgba[i][ACOMP]; \ + dst[i*4+1] = (TYPE) rgba[i][BCOMP]; \ + dst[i*4+2] = (TYPE) rgba[i][GCOMP]; \ + dst[i*4+3] = (TYPE) rgba[i][RCOMP]; \ + } \ + break; \ + default: \ + gl_problem(ctx, "bad format in pack_histogram"); \ + } \ + } + + switch (type) { + case GL_UNSIGNED_BYTE: + { + GLubyte *dst = (GLubyte *) destination; + PACK_MACRO(GLubyte); + } + break; + case GL_BYTE: + { + GLbyte *dst = (GLbyte *) destination; + PACK_MACRO(GLbyte); + } + break; + case GL_UNSIGNED_SHORT: + { + GLushort *dst = (GLushort *) destination; + PACK_MACRO(GLushort); + if (packing->SwapBytes) { + _mesa_swap2(dst, n * comps); + } + } + break; + case GL_SHORT: + { + GLshort *dst = (GLshort *) destination; + PACK_MACRO(GLshort); + if (packing->SwapBytes) { + _mesa_swap2((GLushort *) dst, n * comps); + } + } + break; + case GL_UNSIGNED_INT: + { + GLuint *dst = (GLuint *) destination; + PACK_MACRO(GLuint); + if (packing->SwapBytes) { + _mesa_swap4(dst, n * comps); + } + } + break; + case GL_INT: + { + GLint *dst = (GLint *) destination; + PACK_MACRO(GLint); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, n * comps); + } + } + break; + case GL_FLOAT: + { + GLfloat *dst = (GLfloat *) destination; + PACK_MACRO(GLfloat); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, n * comps); + } + } + break; + default: + gl_problem(ctx, "Bad type in pack_histogram"); + } + +#undef PACK_MACRO } -void _mesa_ColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data) + + +static void +pack_minmax( GLcontext *ctx, CONST GLfloat minmax[2][4], + GLenum format, GLenum type, GLvoid *destination, + const struct gl_pixelstore_attrib *packing ) { - (void) target; - (void) start; - (void) count; - (void) format; - (void) type; - (void) data; - WARNING("glColorSubTable"); + const GLint comps = _mesa_components_in_format(format); + GLuint luminance[2]; + + if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) { + luminance[0] = minmax[0][RCOMP] + minmax[0][GCOMP] + minmax[0][BCOMP]; + luminance[1] = minmax[1][RCOMP] + minmax[1][GCOMP] + minmax[1][BCOMP]; + } + +#define PACK_MACRO(TYPE, CONVERSION) \ + { \ + GLuint i; \ + switch (format) { \ + case GL_RED: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (minmax[i][RCOMP]); \ + break; \ + case GL_GREEN: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (minmax[i][GCOMP]); \ + break; \ + case GL_BLUE: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (minmax[i][BCOMP]); \ + break; \ + case GL_ALPHA: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (minmax[i][ACOMP]); \ + break; \ + case GL_LUMINANCE: \ + for (i=0;i<2;i++) \ + dst[i] = CONVERSION (luminance[i]); \ + break; \ + case GL_LUMINANCE_ALPHA: \ + for (i=0;i<2;i++) { \ + dst[i*2+0] = CONVERSION (luminance[i]); \ + dst[i*2+1] = CONVERSION (minmax[i][ACOMP]); \ + } \ + break; \ + case GL_RGB: \ + for (i=0;i<2;i++) { \ + dst[i*3+0] = CONVERSION (minmax[i][RCOMP]); \ + dst[i*3+1] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*3+2] = CONVERSION (minmax[i][BCOMP]); \ + } \ + break; \ + case GL_RGBA: \ + for (i=0;i<2;i++) { \ + dst[i*4+0] = CONVERSION (minmax[i][RCOMP]); \ + dst[i*4+1] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*4+2] = CONVERSION (minmax[i][BCOMP]); \ + dst[i*4+3] = CONVERSION (minmax[i][ACOMP]); \ + } \ + break; \ + case GL_BGR: \ + for (i=0;i<2;i++) { \ + dst[i*3+0] = CONVERSION (minmax[i][BCOMP]); \ + dst[i*3+1] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*3+2] = CONVERSION (minmax[i][RCOMP]); \ + } \ + break; \ + case GL_BGRA: \ + for (i=0;i<2;i++) { \ + dst[i*4+0] = CONVERSION (minmax[i][BCOMP]); \ + dst[i*4+1] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*4+2] = CONVERSION (minmax[i][RCOMP]); \ + dst[i*4+3] = CONVERSION (minmax[i][ACOMP]); \ + } \ + break; \ + case GL_ABGR_EXT: \ + for (i=0;i<2;i++) { \ + dst[i*4+0] = CONVERSION (minmax[i][ACOMP]); \ + dst[i*4+1] = CONVERSION (minmax[i][BCOMP]); \ + dst[i*4+2] = CONVERSION (minmax[i][GCOMP]); \ + dst[i*4+3] = CONVERSION (minmax[i][RCOMP]); \ + } \ + break; \ + default: \ + gl_problem(ctx, "bad format in pack_minmax"); \ + } \ + } + + switch (type) { + case GL_UNSIGNED_BYTE: + { + GLubyte *dst = (GLubyte *) destination; + PACK_MACRO(GLubyte, FLOAT_TO_UBYTE); + } + break; + case GL_BYTE: + { + GLbyte *dst = (GLbyte *) destination; + PACK_MACRO(GLbyte, FLOAT_TO_BYTE); + } + break; + case GL_UNSIGNED_SHORT: + { + GLushort *dst = (GLushort *) destination; + PACK_MACRO(GLushort, FLOAT_TO_USHORT); + if (packing->SwapBytes) { + _mesa_swap2(dst, 2 * comps); + } + } + break; + case GL_SHORT: + { + GLshort *dst = (GLshort *) destination; + PACK_MACRO(GLshort, FLOAT_TO_SHORT); + if (packing->SwapBytes) { + _mesa_swap2((GLushort *) dst, 2 * comps); + } + } + break; + case GL_UNSIGNED_INT: + { + GLuint *dst = (GLuint *) destination; + PACK_MACRO(GLuint, FLOAT_TO_UINT); + if (packing->SwapBytes) { + _mesa_swap4(dst, 2 * comps); + } + } + break; + case GL_INT: + { + GLint *dst = (GLint *) destination; + PACK_MACRO(GLint, FLOAT_TO_INT); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, 2 * comps); + } + } + break; + case GL_FLOAT: + { + GLfloat *dst = (GLfloat *) destination; + PACK_MACRO(GLfloat, (GLfloat)); + if (packing->SwapBytes) { + _mesa_swap4((GLuint *) dst, 2 * comps); + } + } + break; + default: + gl_problem(ctx, "Bad type in pack_minmax"); + } + +#undef PACK_MACRO } -void _mesa_ColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table) + +/* + * Given an internalFormat token passed to glHistogram or glMinMax, + * return the corresponding base format. + * Return -1 if invalid token. + */ +static GLint +base_histogram_format( GLenum format ) { - (void) target; - (void) internalformat; - (void) width; - (void) format; - (void) type; - (void) table; - WARNING("glColorTable"); + switch (format) { + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return GL_ALPHA; + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return GL_LUMINANCE; + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + return GL_LUMINANCE_ALPHA; + case GL_RGB: + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + return GL_RGB; + case GL_RGBA: + case GL_RGBA2: + case GL_RGBA4: + case GL_RGB5_A1: + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + return GL_RGBA; + default: + return -1; /* error */ + } } -#endif -void _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) + +/* + * Given an internalFormat token passed to glConvolutionFilter + * or glSeparableFilter, return the corresponding base format. + * Return -1 if invalid token. + */ +static GLint +base_filter_format( GLenum format ) { - (void) target; - (void) pname; - (void) params; - WARNING("glColorTableParameterfv"); + switch (format) { + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return GL_ALPHA; + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return GL_LUMINANCE; + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + return GL_LUMINANCE_ALPHA; + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + return GL_INTENSITY; + case GL_RGB: + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + return GL_RGB; + case 4: + case GL_RGBA: + case GL_RGBA2: + case GL_RGBA4: + case GL_RGB5_A1: + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + return GL_RGBA; + default: + return -1; /* error */ + } } -void _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) + +void +_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { - (void) target; - (void) pname; - (void) params; - WARNING("glColorTableParameteriv"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogram"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(target)"); + return; + } + + if (format != GL_RED && + format != GL_GREEN && + format != GL_BLUE && + format != GL_ALPHA && + format != GL_RGB && + format != GL_RGBA && + format != GL_ABGR_EXT && + format != GL_LUMINANCE && + format != GL_LUMINANCE_ALPHA) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(format)"); + return; + } + + if (type != GL_UNSIGNED_BYTE && + type != GL_BYTE && + type != GL_UNSIGNED_SHORT && + type != GL_SHORT && + type != GL_UNSIGNED_INT && + type != GL_INT && + type != GL_FLOAT) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmax(type)"); + return; + } + + if (!values) + return; + + { + GLfloat minmax[2][4]; + minmax[0][RCOMP] = CLAMP(ctx->MinMax.Min[RCOMP], 0.0F, 1.0F); + minmax[0][GCOMP] = CLAMP(ctx->MinMax.Min[GCOMP], 0.0F, 1.0F); + minmax[0][BCOMP] = CLAMP(ctx->MinMax.Min[BCOMP], 0.0F, 1.0F); + minmax[0][ACOMP] = CLAMP(ctx->MinMax.Min[ACOMP], 0.0F, 1.0F); + minmax[1][RCOMP] = CLAMP(ctx->MinMax.Max[RCOMP], 0.0F, 1.0F); + minmax[1][GCOMP] = CLAMP(ctx->MinMax.Max[GCOMP], 0.0F, 1.0F); + minmax[1][BCOMP] = CLAMP(ctx->MinMax.Max[BCOMP], 0.0F, 1.0F); + minmax[1][ACOMP] = CLAMP(ctx->MinMax.Max[ACOMP], 0.0F, 1.0F); + pack_minmax(ctx, (CONST GLfloat (*)[4]) minmax, + format, type, values, &ctx->Pack); + } + + if (reset) { + _mesa_ResetMinmax(GL_MINMAX); + } } -void _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) +void +_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { - (void) target; - (void) internalformat; - (void) width; - (void) format; - (void) type; - (void) image; - WARNING("glConvolutionFilter1D"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogram"); + + if (target != GL_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(target)"); + return; + } + + if (format != GL_RED && + format != GL_GREEN && + format != GL_BLUE && + format != GL_ALPHA && + format != GL_RGB && + format != GL_RGBA && + format != GL_ABGR_EXT && + format != GL_LUMINANCE && + format != GL_LUMINANCE_ALPHA) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(format)"); + return; + } + + if (type != GL_UNSIGNED_BYTE && + type != GL_BYTE && + type != GL_UNSIGNED_SHORT && + type != GL_SHORT && + type != GL_UNSIGNED_INT && + type != GL_INT && + type != GL_FLOAT) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogram(type)"); + return; + } + + if (!values) + return; + + pack_histogram(ctx, ctx->Histogram.Width, + (CONST GLuint (*)[4]) ctx->Histogram.Count, + format, type, values, &ctx->Pack); + + if (reset) { + GLuint i; + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + } } -void _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) + +void +_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) { - (void) target; - (void) internalformat; - (void) width; - (void) height; - (void) format; - (void) type; - (void) image; - WARNING("glConvolutionFilter2D"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameterfv"); + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(target)"); + return; + } + + switch (pname) { + case GL_HISTOGRAM_WIDTH: + *params = (GLfloat) ctx->Histogram.Width; + break; + case GL_HISTOGRAM_FORMAT: + *params = (GLfloat) ctx->Histogram.Format; + break; + case GL_HISTOGRAM_RED_SIZE: + *params = (GLfloat) ctx->Histogram.RedSize; + break; + case GL_HISTOGRAM_GREEN_SIZE: + *params = (GLfloat) ctx->Histogram.GreenSize; + break; + case GL_HISTOGRAM_BLUE_SIZE: + *params = (GLfloat) ctx->Histogram.BlueSize; + break; + case GL_HISTOGRAM_ALPHA_SIZE: + *params = (GLfloat) ctx->Histogram.AlphaSize; + break; + case GL_HISTOGRAM_LUMINANCE_SIZE: + *params = (GLfloat) ctx->Histogram.LuminanceSize; + break; + case GL_HISTOGRAM_SINK: + *params = (GLfloat) ctx->Histogram.Sink; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameterfv(pname)"); + } } -void _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params) + +void +_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glConvolutionParameterf"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetHistogramParameteriv"); + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(target)"); + return; + } + + switch (pname) { + case GL_HISTOGRAM_WIDTH: + *params = (GLint) ctx->Histogram.Width; + break; + case GL_HISTOGRAM_FORMAT: + *params = (GLint) ctx->Histogram.Format; + break; + case GL_HISTOGRAM_RED_SIZE: + *params = (GLint) ctx->Histogram.RedSize; + break; + case GL_HISTOGRAM_GREEN_SIZE: + *params = (GLint) ctx->Histogram.GreenSize; + break; + case GL_HISTOGRAM_BLUE_SIZE: + *params = (GLint) ctx->Histogram.BlueSize; + break; + case GL_HISTOGRAM_ALPHA_SIZE: + *params = (GLint) ctx->Histogram.AlphaSize; + break; + case GL_HISTOGRAM_LUMINANCE_SIZE: + *params = (GLint) ctx->Histogram.LuminanceSize; + break; + case GL_HISTOGRAM_SINK: + *params = (GLint) ctx->Histogram.Sink; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetHistogramParameteriv(pname)"); + } } -void _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) + +void +_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glConvolutionParameterfv"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameterfv"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameterfv(target)"); + return; + } + if (pname == GL_MINMAX_FORMAT) { + *params = (GLfloat) ctx->MinMax.Format; + } + else if (pname == GL_MINMAX_SINK) { + *params = (GLfloat) ctx->MinMax.Sink; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameterfv(pname)"); + } } -void _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params) + +void +_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glConvolutionParameteri"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetMinmaxParameteriv"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinmaxParameteriv(target)"); + return; + } + if (pname == GL_MINMAX_FORMAT) { + *params = (GLint) ctx->MinMax.Format; + } + else if (pname == GL_MINMAX_SINK) { + *params = (GLint) ctx->MinMax.Sink; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetMinMaxParameteriv(pname)"); + } } -void _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) + +void +_mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) { - (void) target; - (void) pname; - (void) params; - WARNING("glConvolutionParameteriv"); + GLuint i; + GLboolean error = GL_FALSE; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glHistogram"); + + if (target != GL_HISTOGRAM && target != GL_PROXY_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glHistogram(target)"); + return; + } + + if (width < 0 || width > HISTOGRAM_TABLE_SIZE) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + if (width < 0) + gl_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); + else + gl_error(ctx, GL_TABLE_TOO_LARGE, "glHistogram(width)"); + return; + } + } + + if (width != 0 && _mesa_bitcount(width) != 1) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + gl_error(ctx, GL_INVALID_VALUE, "glHistogram(width)"); + return; + } + } + + if (base_histogram_format(internalFormat) < 0) { + if (target == GL_PROXY_HISTOGRAM) { + error = GL_TRUE; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glHistogram(internalFormat)"); + return; + } + } + + /* reset histograms */ + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } + + if (error) { + ctx->Histogram.Width = 0; + ctx->Histogram.Format = 0; + ctx->Histogram.RedSize = 0; + ctx->Histogram.GreenSize = 0; + ctx->Histogram.BlueSize = 0; + ctx->Histogram.AlphaSize = 0; + ctx->Histogram.LuminanceSize = 0; + } + else { + ctx->Histogram.Width = width; + ctx->Histogram.Format = internalFormat; + ctx->Histogram.Sink = sink; + ctx->Histogram.RedSize = 0xffffffff; + ctx->Histogram.GreenSize = 0xffffffff; + ctx->Histogram.BlueSize = 0xffffffff; + ctx->Histogram.AlphaSize = 0xffffffff; + ctx->Histogram.LuminanceSize = 0xffffffff; + } } -void _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) + +void +_mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) { - (void) target; - (void) start; - (void) x; - (void) y; - (void) width; - WARNING("glCopyColorSubTable"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glMinmax"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glMinMax(target)"); + return; + } + + if (base_histogram_format(internalFormat) < 0) { + gl_error(ctx, GL_INVALID_ENUM, "glMinMax(internalFormat)"); + return; + } + + ctx->MinMax.Sink = sink; } -void _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) + +void +_mesa_ResetHistogram(GLenum target) { - (void) target; - (void) internalformat; - (void) x; - (void) y; - (void) width; - WARNING("glCopyColorTable"); + GLuint i; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetHistogram"); + + if (target != GL_HISTOGRAM) { + gl_error(ctx, GL_INVALID_ENUM, "glResetHistogram(target)"); + return; + } + + for (i = 0; i < HISTOGRAM_TABLE_SIZE; i++) { + ctx->Histogram.Count[i][0] = 0; + ctx->Histogram.Count[i][1] = 0; + ctx->Histogram.Count[i][2] = 0; + ctx->Histogram.Count[i][3] = 0; + } } -void _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) + +void +_mesa_ResetMinmax(GLenum target) { - (void) target; - (void) internalformat; - (void) x; - (void) y; - (void) width; - WARNING("glCopyConvolutionFilter1D"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glResetMinmax"); + + if (target != GL_MINMAX) { + gl_error(ctx, GL_INVALID_ENUM, "glResetMinMax(target)"); + return; + } + + ctx->MinMax.Min[RCOMP] = 1000; ctx->MinMax.Max[RCOMP] = -1000; + ctx->MinMax.Min[GCOMP] = 1000; ctx->MinMax.Max[GCOMP] = -1000; + ctx->MinMax.Min[BCOMP] = 1000; ctx->MinMax.Max[BCOMP] = -1000; + ctx->MinMax.Min[ACOMP] = 1000; ctx->MinMax.Max[ACOMP] = -1000; } -void _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height) + + +/* + * Update the min/max values from an array of fragment colors. + */ +void +_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) { - (void) target; - (void) internalformat; - (void) x; - (void) y; - (void) width; - (void) height; - WARNING("glCopyConvolutionFilter2D"); + GLuint i; + for (i = 0; i < n; i++) { + /* update mins */ + if (rgba[i][RCOMP] < ctx->MinMax.Min[RCOMP]) + ctx->MinMax.Min[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] < ctx->MinMax.Min[GCOMP]) + ctx->MinMax.Min[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] < ctx->MinMax.Min[BCOMP]) + ctx->MinMax.Min[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] < ctx->MinMax.Min[ACOMP]) + ctx->MinMax.Min[ACOMP] = rgba[i][ACOMP]; + + /* update maxs */ + if (rgba[i][RCOMP] > ctx->MinMax.Max[RCOMP]) + ctx->MinMax.Max[RCOMP] = rgba[i][RCOMP]; + if (rgba[i][GCOMP] > ctx->MinMax.Max[GCOMP]) + ctx->MinMax.Max[GCOMP] = rgba[i][GCOMP]; + if (rgba[i][BCOMP] > ctx->MinMax.Max[BCOMP]) + ctx->MinMax.Max[BCOMP] = rgba[i][BCOMP]; + if (rgba[i][ACOMP] > ctx->MinMax.Max[ACOMP]) + ctx->MinMax.Max[ACOMP] = rgba[i][ACOMP]; + } } -#if 0 -void _mesa_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table) + +/* + * Update the histogram values from an array of fragment colors. + */ +void +_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]) { - (void) target; - (void) format; - (void) type; - (void) table; - WARNING("glGetColorTable"); + const GLint max = ctx->Histogram.Width - 1; + GLfloat w = (GLfloat) max; + GLuint i; + + if (ctx->Histogram.Width == 0) + return; + + for (i = 0; i < n; i++) { + GLint ri = (GLint) (rgba[i][RCOMP] * w + 0.5F); + GLint gi = (GLint) (rgba[i][GCOMP] * w + 0.5F); + GLint bi = (GLint) (rgba[i][BCOMP] * w + 0.5F); + GLint ai = (GLint) (rgba[i][ACOMP] * w + 0.5F); + ri = CLAMP(ri, 0, max); + gi = CLAMP(gi, 0, max); + bi = CLAMP(bi, 0, max); + ai = CLAMP(ai, 0, max); + ctx->Histogram.Count[ri][RCOMP]++; + ctx->Histogram.Count[gi][GCOMP]++; + ctx->Histogram.Count[bi][BCOMP]++; + ctx->Histogram.Count[ai][ACOMP]++; + } } -void _mesa_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params) + + +/**********************************************************************/ +/**** Convolution *****/ +/**********************************************************************/ + +void +_mesa_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *image) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetColorTableParameterfv"); + GLenum baseFormat; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter1D"); + + if (target != GL_CONVOLUTION_1D) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter1D(width)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter1D(format or type)"); + return; + } + + ctx->Convolution1D.Format = format; + ctx->Convolution1D.InternalFormat = internalFormat; + ctx->Convolution1D.Width = width; + ctx->Convolution1D.Height = 1; + + /* unpack filter image and apply scale and bias */ + _mesa_unpack_float_color_span(ctx, width, GL_RGBA, + ctx->Convolution1D.Filter, + format, type, image, &ctx->Unpack, + GL_FALSE, GL_FALSE); + { + const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[0]; + const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[0]; + GLint i; + for (i = 0; i < width; i++) { + GLfloat r = ctx->Convolution1D.Filter[i * 4 + 0]; + GLfloat g = ctx->Convolution1D.Filter[i * 4 + 1]; + GLfloat b = ctx->Convolution1D.Filter[i * 4 + 2]; + GLfloat a = ctx->Convolution1D.Filter[i * 4 + 3]; + r = r * scale[0] + bias[0]; + g = g * scale[1] + bias[1]; + b = b * scale[2] + bias[2]; + a = a * scale[3] + bias[3]; + ctx->Convolution1D.Filter[i * 4 + 0] = r; + ctx->Convolution1D.Filter[i * 4 + 1] = g; + ctx->Convolution1D.Filter[i * 4 + 2] = b; + ctx->Convolution1D.Filter[i * 4 + 3] = a; + } + } } -void _mesa_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params) + +void +_mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetColorTableParameteriv"); + GLenum baseFormat; + GLint i, components; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionFilter2D"); + + if (target != GL_CONVOLUTION_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(width)"); + return; + } + if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { + gl_error(ctx, GL_INVALID_VALUE, "glConvolutionFilter2D(height)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionFilter2D(format or type)"); + return; + } + + components = _mesa_components_in_format(format); + assert(components > 0); /* this should have been caught earlier */ + + ctx->Convolution2D.Format = format; + ctx->Convolution2D.InternalFormat = internalFormat; + ctx->Convolution2D.Width = width; + ctx->Convolution2D.Height = height; + + /* unpack filter image and apply scale and bias */ + for (i = 0; i < height; i++) { + const GLvoid *src = _mesa_image_address(&ctx->Unpack, image, width, + height, format, type, 0, i, 0); + GLfloat *dst = ctx->Convolution2D.Filter + i * width * components; + _mesa_unpack_float_color_span(ctx, width, GL_RGBA, dst, + format, type, src, &ctx->Unpack, + GL_FALSE, GL_FALSE); + } + + { + const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[1]; + const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[1]; + for (i = 0; i < width * height * 4; i++) { + GLfloat r = ctx->Convolution2D.Filter[i * 4 + 0]; + GLfloat g = ctx->Convolution2D.Filter[i * 4 + 1]; + GLfloat b = ctx->Convolution2D.Filter[i * 4 + 2]; + GLfloat a = ctx->Convolution2D.Filter[i * 4 + 3]; + r = r * scale[0] + bias[0]; + g = g * scale[1] + bias[1]; + b = b * scale[2] + bias[2]; + a = a * scale[3] + bias[3]; + ctx->Convolution2D.Filter[i * 4 + 0] = r; + ctx->Convolution2D.Filter[i * 4 + 1] = g; + ctx->Convolution2D.Filter[i * 4 + 2] = b; + ctx->Convolution2D.Filter[i * 4 + 3] = a; + } + } } -#endif -void _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) + +void +_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { - (void) target; - (void) format; - (void) type; - (void) image; - WARNING("glGetConvolutionFilter"); + GET_CURRENT_CONTEXT(ctx); + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameterf"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + break; + case GL_CONVOLUTION_2D: + c = 1; + break; + case GL_SEPARABLE_2D: + c = 2; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_MODE: + if (param == (GLfloat) GL_REDUCE || + param == (GLfloat) GL_CONSTANT_BORDER || + param == (GLfloat) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(params)"); + return; + } + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterf(pname)"); + return; + } } -void _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) + +void +_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetConvolutionParameterfv"); + GET_CURRENT_CONTEXT(ctx); + struct gl_convolution_attrib *conv; + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameterfv"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + COPY_4V(ctx->Pixel.ConvolutionBorderColor[c], params); + break; + case GL_CONVOLUTION_BORDER_MODE: + if (params[0] == (GLfloat) GL_REDUCE || + params[0] == (GLfloat) GL_CONSTANT_BORDER || + params[0] == (GLfloat) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(params)"); + return; + } + break; + case GL_CONVOLUTION_FILTER_SCALE: + COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); + break; + case GL_CONVOLUTION_FILTER_BIAS: + COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameterfv(pname)"); + return; + } } -void _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) + +void +_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetConvolutionParameteriv"); + GET_CURRENT_CONTEXT(ctx); + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameteri"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + break; + case GL_CONVOLUTION_2D: + c = 1; + break; + case GL_SEPARABLE_2D: + c = 2; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_MODE: + if (param == (GLint) GL_REDUCE || + param == (GLint) GL_CONSTANT_BORDER || + param == (GLint) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) param; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(params)"); + return; + } + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteri(pname)"); + return; + } } -void _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values) + +void +_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { - (void) target; - (void) reset; - (void) format; - (void) types; - (void) values; - WARNING("glGetMinmax"); + GET_CURRENT_CONTEXT(ctx); + struct gl_convolution_attrib *conv; + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glConvolutionParameteriv"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + ctx->Pixel.ConvolutionBorderColor[c][0] = INT_TO_FLOAT(params[0]); + ctx->Pixel.ConvolutionBorderColor[c][1] = INT_TO_FLOAT(params[1]); + ctx->Pixel.ConvolutionBorderColor[c][2] = INT_TO_FLOAT(params[2]); + ctx->Pixel.ConvolutionBorderColor[c][3] = INT_TO_FLOAT(params[3]); + break; + case GL_CONVOLUTION_BORDER_MODE: + if (params[0] == (GLint) GL_REDUCE || + params[0] == (GLint) GL_CONSTANT_BORDER || + params[0] == (GLint) GL_REPLICATE_BORDER) { + ctx->Pixel.ConvolutionBorderMode[c] = (GLenum) params[0]; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(params)"); + return; + } + break; + case GL_CONVOLUTION_FILTER_SCALE: + COPY_4V(ctx->Pixel.ConvolutionFilterScale[c], params); + break; + case GL_CONVOLUTION_FILTER_BIAS: + COPY_4V(ctx->Pixel.ConvolutionFilterBias[c], params); + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glConvolutionParameteriv(pname)"); + return; + } } -void _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) + +void +_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { - (void) target; - (void) reset; - (void) format; - (void) type; - (void) values; - WARNING("glGetHistogram"); + GLenum baseFormat; + GLfloat rgba[MAX_CONVOLUTION_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter1D"); + + if (target != GL_CONVOLUTION_1D) { + gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter1D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter1D(width)"); + return; + } + + /* read pixels from framebuffer */ + gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y, (GLubyte (*)[4]) rgba); + + /* store as convolution filter */ + _mesa_ConvolutionFilter1D(target, internalFormat, width, + GL_RGBA, GL_UNSIGNED_BYTE, rgba); } -void _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) + +void +_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetHistogramParameterfv"); + GLenum baseFormat; + GLint i; + struct gl_pixelstore_attrib packSave; + GLfloat rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyConvolutionFilter2D"); + + if (target != GL_CONVOLUTION_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(target)"); + return; + } + + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glCopyConvolutionFilter2D(internalFormat)"); + return; + } + + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(width)"); + return; + } + if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { + gl_error(ctx, GL_INVALID_VALUE, "glCopyConvolutionFilter2D(height)"); + return; + } + + /* read pixels from framebuffer */ + for (i = 0; i < height; i++) { + gl_read_rgba_span(ctx, ctx->ReadBuffer, width, x, y + i, + (GLubyte (*)[4]) rgba[i]); + } + + /* + * store as convolution filter + */ + packSave = ctx->Unpack; /* save pixel packing params */ + + ctx->Unpack.Alignment = 1; + ctx->Unpack.RowLength = MAX_CONVOLUTION_WIDTH; + ctx->Unpack.SkipPixels = 0; + ctx->Unpack.SkipRows = 0; + ctx->Unpack.ImageHeight = 0; + ctx->Unpack.SkipImages = 0; + ctx->Unpack.SwapBytes = GL_FALSE; + ctx->Unpack.LsbFirst = GL_FALSE; + + _mesa_ConvolutionFilter2D(target, internalFormat, width, height, + GL_RGBA, GL_UNSIGNED_BYTE, rgba); + + ctx->Unpack = packSave; /* restore pixel packing params */ } -void _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) + +void +_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetHistogramParameteriv"); + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionFilter"); + + if (target != GL_CONVOLUTION_1D && target != GL_CONVOLUTION_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(target)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); + return; + } + + (void) image; + /* XXX store image */ } -void _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) + +void +_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetMinmaxParameterfv"); + GET_CURRENT_CONTEXT(ctx); + const struct gl_convolution_attrib *conv; + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameterfv"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + COPY_4V(params, ctx->Pixel.ConvolutionBorderColor[c]); + break; + case GL_CONVOLUTION_BORDER_MODE: + *params = (GLfloat) ctx->Pixel.ConvolutionBorderMode[c]; + break; + case GL_CONVOLUTION_FILTER_SCALE: + COPY_4V(params, ctx->Pixel.ConvolutionFilterScale[c]); + break; + case GL_CONVOLUTION_FILTER_BIAS: + COPY_4V(params, ctx->Pixel.ConvolutionFilterBias[c]); + break; + case GL_CONVOLUTION_FORMAT: + *params = (GLfloat) conv->Format; + break; + case GL_CONVOLUTION_WIDTH: + *params = (GLfloat) conv->Width; + break; + case GL_CONVOLUTION_HEIGHT: + *params = (GLfloat) conv->Height; + break; + case GL_MAX_CONVOLUTION_WIDTH: + *params = (GLfloat) ctx->Const.MaxConvolutionWidth; + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = (GLfloat) ctx->Const.MaxConvolutionHeight; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameterfv(pname)"); + return; + } } -void _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) + +void +_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) { - (void) target; - (void) pname; - (void) params; - WARNING("glGetMinmaxParameteriv"); + GET_CURRENT_CONTEXT(ctx); + const struct gl_convolution_attrib *conv; + GLuint c; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetConvolutionParameteriv"); + + switch (target) { + case GL_CONVOLUTION_1D: + c = 0; + conv = &ctx->Convolution1D; + break; + case GL_CONVOLUTION_2D: + c = 1; + conv = &ctx->Convolution2D; + break; + case GL_SEPARABLE_2D: + c = 2; + conv = &ctx->Separable2D; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(target)"); + return; + } + + switch (pname) { + case GL_CONVOLUTION_BORDER_COLOR: + params[0] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][0]); + params[1] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][1]); + params[2] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][2]); + params[3] = FLOAT_TO_INT(ctx->Pixel.ConvolutionBorderColor[c][3]); + break; + case GL_CONVOLUTION_BORDER_MODE: + *params = (GLint) ctx->Pixel.ConvolutionBorderMode; + break; + case GL_CONVOLUTION_FILTER_SCALE: + params[0] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][0]; + params[1] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][1]; + params[2] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][2]; + params[3] = (GLint) ctx->Pixel.ConvolutionFilterScale[c][3]; + break; + case GL_CONVOLUTION_FILTER_BIAS: + params[0] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][0]; + params[1] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][1]; + params[2] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][2]; + params[3] = (GLint) ctx->Pixel.ConvolutionFilterBias[c][3]; + break; + case GL_CONVOLUTION_FORMAT: + *params = (GLint) conv->Format; + break; + case GL_CONVOLUTION_WIDTH: + *params = (GLint) conv->Width; + break; + case GL_CONVOLUTION_HEIGHT: + *params = (GLint) conv->Height; + break; + case GL_MAX_CONVOLUTION_WIDTH: + *params = (GLint) ctx->Const.MaxConvolutionWidth; + break; + case GL_MAX_CONVOLUTION_HEIGHT: + *params = (GLint) ctx->Const.MaxConvolutionHeight; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionParameteriv(pname)"); + return; + } } -void _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) + +void +_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { - (void) target; - (void) format; - (void) type; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetSeparableFilter"); + + if (target != GL_SEPARABLE_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glGetSeparableFilter(target)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glGetConvolutionFilter(format or type)"); + return; + } + (void) row; (void) column; (void) span; - WARNING("glGetSeperableFilter"); } -void _mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink) -{ - (void) target; - (void) width; - (void) internalformat; - (void) sink; - WARNING("glHistogram"); -} -void _mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink) +void +_mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { - (void) target; - (void) internalformat; - (void) sink; - WARNING("glMinmax"); -} + const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; + GLenum baseFormat; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glSeparableFilter2D"); -void _mesa_ResetHistogram(GLenum target) -{ - (void) target; - WARNING("glResetHistogram"); -} + if (target != GL_SEPARABLE_2D) { + gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(target)"); + return; + } -void _mesa_ResetMinmax(GLenum target) -{ - (void) target; - WARNING("glResetMinmax"); -} + baseFormat = base_filter_format(internalFormat); + if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { + gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(internalFormat)"); + return; + } -void _mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) -{ - (void) target; - (void) internalformat; - (void) width; - (void) height; - (void) format; - (void) type; - (void) row; - (void) column; - WARNING("glSeparableFilter2D"); + if (width < 0 || width > MAX_CONVOLUTION_WIDTH) { + gl_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(width)"); + return; + } + if (height < 0 || height > MAX_CONVOLUTION_HEIGHT) { + gl_error(ctx, GL_INVALID_VALUE, "glSeparableFilter2D(height)"); + return; + } + + if (!_mesa_is_legal_format_and_type(format, type) || + format == GL_COLOR_INDEX || + format == GL_STENCIL_INDEX || + format == GL_DEPTH_COMPONENT || + type == GL_BITMAP) { + gl_error(ctx, GL_INVALID_ENUM, "glSeparableFilter2D(format or type)"); + return; + } + + ctx->Separable2D.Format = format; + ctx->Separable2D.InternalFormat = internalFormat; + ctx->Separable2D.Width = width; + ctx->Separable2D.Height = height; + + /* unpack row filter */ + _mesa_unpack_float_color_span(ctx, width, GL_RGBA, + ctx->Separable2D.Filter, + format, type, row, &ctx->Unpack, + GL_FALSE, GL_FALSE); + { + const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[2]; + const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[2]; + GLint i; + for (i = 0; i < width; i++) { + GLfloat r = ctx->Separable2D.Filter[i * 4 + 0]; + GLfloat g = ctx->Separable2D.Filter[i * 4 + 1]; + GLfloat b = ctx->Separable2D.Filter[i * 4 + 2]; + GLfloat a = ctx->Separable2D.Filter[i * 4 + 3]; + r = r * scale[0] + bias[0]; + g = g * scale[1] + bias[1]; + b = b * scale[2] + bias[2]; + a = a * scale[3] + bias[3]; + ctx->Separable2D.Filter[i * 4 + 0] = r; + ctx->Separable2D.Filter[i * 4 + 1] = g; + ctx->Separable2D.Filter[i * 4 + 2] = b; + ctx->Separable2D.Filter[i * 4 + 3] = a; + } + } + + /* unpack column filter */ + _mesa_unpack_float_color_span(ctx, width, GL_RGBA, + &ctx->Separable2D.Filter[colStart], + format, type, column, &ctx->Unpack, + GL_FALSE, GL_FALSE); + { + const GLfloat *scale = ctx->Pixel.ConvolutionFilterScale[2]; + const GLfloat *bias = ctx->Pixel.ConvolutionFilterBias[2]; + GLint i; + for (i = 0; i < width; i++) { + GLfloat r = ctx->Separable2D.Filter[i * 4 + 0 + colStart]; + GLfloat g = ctx->Separable2D.Filter[i * 4 + 1 + colStart]; + GLfloat b = ctx->Separable2D.Filter[i * 4 + 2 + colStart]; + GLfloat a = ctx->Separable2D.Filter[i * 4 + 3 + colStart]; + r = r * scale[0] + bias[0]; + g = g * scale[1] + bias[1]; + b = b * scale[2] + bias[2]; + a = a * scale[3] + bias[3]; + ctx->Separable2D.Filter[i * 4 + 0 + colStart] = r; + ctx->Separable2D.Filter[i * 4 + 1 + colStart] = g; + ctx->Separable2D.Filter[i * 4 + 2 + colStart] = b; + ctx->Separable2D.Filter[i * 4 + 3 + colStart] = a; + } + } } + diff --git a/xc/extras/Mesa/src/imaging.h b/xc/extras/Mesa/src/imaging.h index f376be5f6..1a4b9ccc6 100644 --- a/xc/extras/Mesa/src/imaging.h +++ b/xc/extras/Mesa/src/imaging.h @@ -32,25 +32,11 @@ #include "all.h" #else #include "glheader.h" +#include "types.h" #endif -#if 0 -extern void _mesa_BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a); - -extern void _mesa_BlendEquation(GLenum eq); - -extern void _mesa_ColorSubTable(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); - -extern void _mesa_ColorTable(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); -#endif - -extern void _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params); - -extern void _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params); - - extern void _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); extern void _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); @@ -63,22 +49,10 @@ extern void _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param extern void _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); -extern void _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); - -extern void _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); - extern void _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); extern void _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); -#if 0 -extern void _mesa_GetColorTable(GLenum target, GLenum format, GLenum type, GLvoid *table); - -extern void _mesa_GetColorTableParameterfv(GLenum target, GLenum pname, GLfloat *params); - -extern void _mesa_GetColorTableParameteriv(GLenum target, GLenum pname, GLint *params); -#endif - extern void _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image); extern void _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); @@ -109,4 +83,12 @@ extern void _mesa_ResetMinmax(GLenum target); extern void _mesa_SeparableFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); + +extern void +_mesa_update_minmax(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); + +extern void +_mesa_update_histogram(GLcontext *ctx, GLuint n, const GLfloat rgba[][4]); + + #endif diff --git a/xc/extras/Mesa/src/lines.c b/xc/extras/Mesa/src/lines.c index 1b075e25f..dd0649ba0 100644 --- a/xc/extras/Mesa/src/lines.c +++ b/xc/extras/Mesa/src/lines.c @@ -57,6 +57,8 @@ _mesa_LineWidth( GLfloat width ) ctx->TriangleCaps &= ~DD_LINE_WIDTH; if (width != 1.0) ctx->TriangleCaps |= DD_LINE_WIDTH; ctx->NewState |= NEW_RASTER_OPS; + if (ctx->Driver.LineWidth) + (*ctx->Driver.LineWidth)(ctx, width); } } @@ -70,6 +72,9 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) ctx->Line.StippleFactor = CLAMP( factor, 1, 256 ); ctx->Line.StipplePattern = pattern; ctx->NewState |= NEW_RASTER_OPS; + + if (ctx->Driver.LineStipple) + ctx->Driver.LineStipple( ctx, factor, pattern ); } @@ -110,22 +115,13 @@ _mesa_LineStipple( GLint factor, GLushort pattern ) static void flat_ci_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); - count = ctx->PB->count; + PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); #define INTERP_XY 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -135,25 +131,14 @@ static void flat_ci_line( GLcontext *ctx, static void flat_ci_z_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - GLdepth *pbz = ctx->PB->z; - PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); - count = ctx->PB->count; + PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); #define INTERP_XY 1 #define INTERP_Z 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -163,23 +148,14 @@ static void flat_ci_z_line( GLcontext *ctx, static void flat_rgba_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - GLubyte *color = ctx->VB->ColorPtr->data[pvert]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); - count = ctx->PB->count; + const GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); #define INTERP_XY 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, 0); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -189,26 +165,15 @@ static void flat_rgba_line( GLcontext *ctx, static void flat_rgba_z_line( GLcontext *ctx, GLuint vert0, GLuint vert1, GLuint pvert ) { - GLint count; - GLint *pbx = ctx->PB->x; - GLint *pby = ctx->PB->y; - GLdepth *pbz = ctx->PB->z; - GLubyte *color = ctx->VB->ColorPtr->data[pvert]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); - count = ctx->PB->count; + const GLubyte *color = ctx->VB->ColorPtr->data[pvert]; + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); #define INTERP_XY 1 #define INTERP_Z 1 - -#define PLOT(X,Y) \ - pbx[count] = X; \ - pby[count] = Y; \ - pbz[count] = Z; \ - count++; +#define PLOT(X,Y) PB_WRITE_PIXEL(ctx->PB, X, Y, Z); #include "linetemp.h" - ctx->PB->count = count; gl_flush_pb(ctx); } @@ -221,9 +186,11 @@ static void smooth_ci_line( GLcontext *ctx, GLint count = ctx->PB->count; GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; - GLuint *pbi = ctx->PB->i; + GLuint *pbi = ctx->PB->index; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_INDEX 1 @@ -249,9 +216,11 @@ static void smooth_ci_z_line( GLcontext *ctx, GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; - GLuint *pbi = ctx->PB->i; + GLuint *pbi = ctx->PB->index; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_INDEX 1 @@ -281,6 +250,8 @@ static void smooth_rgba_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_RGB 1 #define INTERP_ALPHA 1 @@ -313,6 +284,8 @@ static void smooth_rgba_z_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + #define INTERP_XY 1 #define INTERP_Z 1 #define INTERP_RGB 1 @@ -352,9 +325,11 @@ static void general_smooth_ci_line( GLcontext *ctx, GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; - GLuint *pbi = ctx->PB->i; + GLuint *pbi = ctx->PB->index; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -424,7 +399,7 @@ static void general_flat_ci_line( GLcontext *ctx, GLint *pbx = ctx->PB->x; GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; - PB_SET_INDEX( ctx, ctx->PB, ctx->VB->IndexPtr->data[pvert] ); + PB_SET_INDEX( ctx->PB, ctx->VB->IndexPtr->data[pvert] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { @@ -492,6 +467,8 @@ static void general_smooth_rgba_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -584,7 +561,7 @@ static void general_flat_rgba_line( GLcontext *ctx, GLint *pby = ctx->PB->y; GLdepth *pbz = ctx->PB->z; GLubyte *color = ctx->VB->ColorPtr->data[pvert]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { @@ -653,7 +630,7 @@ static void flat_textured_line( GLcontext *ctx, GLfloat *pbt = ctx->PB->t[0]; GLfloat *pbu = ctx->PB->u[0]; GLubyte *color = ctx->VB->ColorPtr->data[pv]; - PB_SET_COLOR( ctx, ctx->PB, color[0], color[1], color[2], color[3] ); + PB_SET_COLOR( ctx->PB, color[0], color[1], color[2], color[3] ); count = ctx->PB->count; if (ctx->Line.StippleFlag) { @@ -716,6 +693,8 @@ static void smooth_textured_line( GLcontext *ctx, GLubyte (*pbrgba)[4] = ctx->PB->rgba; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -793,6 +772,8 @@ static void smooth_multitextured_line( GLcontext *ctx, GLubyte (*pbspec)[3] = ctx->PB->spec; (void) pvert; + ctx->PB->mono = GL_FALSE; + if (ctx->Line.StippleFlag) { /* stippled */ #define INTERP_XY 1 @@ -1023,8 +1004,7 @@ void gl_set_line_function( GLcontext *ctx ) else { if (ctx->Light.ShadeModel==GL_SMOOTH) { /* Width==1, non-stippled, smooth-shaded */ - if (ctx->Depth.Test - || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) { + if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) { if (rgbmode) ctx->Driver.LineFunc = smooth_rgba_z_line; else @@ -1039,8 +1019,7 @@ void gl_set_line_function( GLcontext *ctx ) } else { /* Width==1, non-stippled, flat-shaded */ - if (ctx->Depth.Test - || (ctx->Fog.Enabled && ctx->Hint.Fog==GL_NICEST)) { + if (ctx->Depth.Test || ctx->FogMode == FOG_FRAGMENT) { if (rgbmode) ctx->Driver.LineFunc = flat_rgba_z_line; else diff --git a/xc/extras/Mesa/src/lnaatemp.h b/xc/extras/Mesa/src/lnaatemp.h index 43923e851..926ee49c3 100644 --- a/xc/extras/Mesa/src/lnaatemp.h +++ b/xc/extras/Mesa/src/lnaatemp.h @@ -22,7 +22,7 @@ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/extras/Mesa/src/lnaatemp.h,v 1.7 2000/02/18 12:18:45 tsi Exp $ */ + /* * Antialiased Line Rasterizer Template @@ -61,22 +61,25 @@ GLint dy = y1 - y0; GLint xStep, yStep; GLint z0, z1; -#ifdef INTERP_RGBA + const GLint depthBits = ctx->Visual->DepthBits; + const GLint fixedToDepthShift = depthBits <= 16 ? FIXED_SHIFT : 0; +#define FixedToDepth(F) ((F) >> fixedToDepthShift) +#if INTERP_RGBA GLfixed fr, fg, fb, fa; /* fixed-pt RGBA */ GLfixed dfr, dfg, dfb, dfa; /* fixed-pt RGBA deltas */ #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC GLfixed fsr, fsg, fsb; /* fixed-pt specular RGBA */ GLfixed dfsr, dfsg, dfsb; /* fixed-pt specular RGBA deltas */ #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX GLfixed fi, dfi; #endif -#if defined(INTERP_STUV0) || defined(INTERP_STUV1) +#if INTERP_STUV0 || INTERP_STUV1 GLfloat invw0 = VB->Win.data[vert0][3]; GLfloat invw1 = VB->Win.data[vert1][3]; #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 /* h denotes hyperbolic */ GLfloat hs0 = invw0 * VB->TexCoordPtr[0]->data[vert0][0]; GLfloat dhs = invw1 * VB->TexCoordPtr[0]->data[vert1][0] - hs0; @@ -85,7 +88,7 @@ GLfloat hu0 = 0, dhu = 0; GLfloat hv0 = invw0, dhv = invw1 - invw0; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 GLfloat hs01 = invw0 * VB->TexCoordPtr[1]->data[vert0][0]; GLfloat dhs1 = invw1 * VB->TexCoordPtr[1]->data[vert1][0] - hs01; GLfloat ht01 = invw0 * VB->TexCoordPtr[1]->data[vert0][1]; @@ -97,15 +100,18 @@ if (dx == 0 && dy == 0) return; -#if DEPTH_BITS==16 - z0 = FloatToFixed(VB->Win.data[vert0][2]); - z1 = FloatToFixed(VB->Win.data[vert1][2]); -#else - z0 = (int) VB->Win.data[vert0][2]; - z1 = (int) VB->Win.data[vert1][2]; -#endif + ctx->PB->mono = GL_FALSE; + + if (depthBits <= 16) { + z0 = FloatToFixed(VB->Win.data[vert0][2]); + z1 = FloatToFixed(VB->Win.data[vert1][2]); + } + else { + z0 = (int) VB->Win.data[vert0][2]; + z1 = (int) VB->Win.data[vert1][2]; + } -#ifdef INTERP_STUV0 +#if INTERP_STUV0 if (VB->TexCoordPtr[0]->size > 2) { hu0 = invw0 * VB->TexCoordPtr[0]->data[vert0][2]; dhu = invw1 * VB->TexCoordPtr[0]->data[vert1][2] - hu0; @@ -116,7 +122,7 @@ } #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 if (VB->TexCoordPtr[1]->size > 2) { hu01 = invw0 * VB->TexCoordPtr[1]->data[vert0][2]; dhu1 = invw1 * VB->TexCoordPtr[1]->data[vert1][2] - hu01; @@ -127,7 +133,7 @@ } #endif -#ifdef INTERP_RGBA +#if INTERP_RGBA if (ctx->Light.ShadeModel == GL_SMOOTH) { fr = IntToFixed(VB->ColorPtr->data[vert0][0]); fg = IntToFixed(VB->ColorPtr->data[vert0][1]); @@ -142,7 +148,7 @@ dfr = dfg = dfb = dfa = 0; } #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { fsr = IntToFixed(VB->Specular[vert0][0]); fsg = IntToFixed(VB->Specular[vert0][1]); @@ -155,7 +161,7 @@ dfsr = dfsg = dfsb = 0; } #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { fi = IntToFixed(VB->IndexPtr->data[vert0]); } @@ -193,11 +199,10 @@ GLint i; GLint x = x0; GLfloat y = VB->Win.data[vert0][1]; - GLfloat yStep = (VB->Win.data[vert1][1] - y) / (GLfloat) dx; - GLint dz = (z1 - z0) / dx; - GLfloat invDx = 1.0F / dx; - (void) invDx; -#ifdef INTERP_RGBA + const GLfloat invDx = 1.0F / dx; + GLfloat yStep = (VB->Win.data[vert1][1] - y) * invDx; + GLint dz = (GLint) ((z1 - z0) * invDx); +#if INTERP_RGBA if (ctx->Light.ShadeModel == GL_SMOOTH) { dfr = (IntToFixed(VB->ColorPtr->data[vert1][0]) - fr) * invDx; dfg = (IntToFixed(VB->ColorPtr->data[vert1][1]) - fg) * invDx; @@ -205,25 +210,31 @@ dfa = (IntToFixed(VB->ColorPtr->data[vert1][3]) - fa) * invDx; } #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { dfsr = (IntToFixed(VB->Specular[vert1][0]) - fsr) * invDx; dfsg = (IntToFixed(VB->Specular[vert1][1]) - fsg) * invDx; dfsb = (IntToFixed(VB->Specular[vert1][2]) - fsb) * invDx; } #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 dhs *= invDx; dht *= invDx; dhu *= invDx; dhv *= invDx; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 dhs1 *= invDx; dht1 *= invDx; dhu1 *= invDx; dhv1 *= invDx; #endif +#if INTERP_INDEX + if (ctx->Light.ShadeModel == GL_SMOOTH) { + dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) * invDx; + } +#endif + for (i = 0; i < dx; i++) { if (solid || (ctx->Line.StipplePattern & (1 << ((ctx->StippleCounter/ctx->Line.StippleFactor) & 0xf)))) { @@ -232,37 +243,33 @@ GLint yTopi = (GLint) yTop; GLint yBoti = (GLint) yBot; GLint iy; -#ifdef INTERP_RGBA +#if INTERP_RGBA GLubyte red = FixedToInt(fr); GLubyte green = FixedToInt(fg); GLubyte blue = FixedToInt(fb); GLubyte alpha = FixedToInt(fa); GLint coverage; #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC GLubyte specRed = FixedToInt(fsr); GLubyte specGreen = FixedToInt(fsg); GLubyte specBlue = FixedToInt(fsb); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX GLuint index = FixedToInt(fi) & 0xfffffff0; GLuint coverage; #endif -#if DEPTH_BITS==16 - GLdepth z = FixedToInt(z0); -#else - GLdepth z = z0; -#endif + GLdepth z = FixedToDepth(z0); ASSERT(yBoti <= yTopi); { -#ifdef INTERP_STUV0 +#if INTERP_STUV0 GLfloat invQ = 1.0F / hv0; GLfloat s = hs0 * invQ; GLfloat t = ht0 * invQ; GLfloat u = hu0 * invQ; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 GLfloat invQ1 = 1.0F / hv01; GLfloat s1 = hs01 * invQ1; GLfloat t1 = ht01 * invQ1; @@ -270,30 +277,30 @@ #endif /* bottom pixel of swipe */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = (GLint) (alpha * (1.0F - (yBot - yBoti))); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = (GLuint) (15.0F * (1.0F - (yBot - yBoti))); #endif PLOT(x, yBoti); yBoti++; /* top pixel of swipe */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = (GLint) (alpha * (yTop - yTopi)); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = (GLuint) (15.0F * (yTop - yTopi)); #endif PLOT(x, yTopi); yTopi--; /* pixels between top and bottom with 100% coverage */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = alpha; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = 15; #endif for (iy = yBoti; iy <= yTopi; iy++) { @@ -307,30 +314,30 @@ x += xStep; y += yStep; z0 += dz; -#ifdef INTERP_RGBA +#if INTERP_RGBA fr += dfr; fg += dfg; fb += dfb; fa += dfa; #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC fsr += dfsr; fsg += dfsg; fsb += dfsb; #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 hs0 += dhs; ht0 += dht; hu0 += dhu; hv0 += dhv; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 hs01 += dhs1; ht01 += dht1; hu01 += dhu1; hv01 += dhv1; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX fi += dfi; #endif @@ -343,11 +350,10 @@ GLint i; GLint y = y0; GLfloat x = VB->Win.data[vert0][0]; - GLfloat xStep = (VB->Win.data[vert1][0] - x) / (GLfloat) dy; - GLint dz = (z1 - z0) / dy; - GLfloat invDy = 1.0F / dy; - (void) invDy; -#ifdef INTERP_RGBA + const GLfloat invDy = 1.0F / dy; + GLfloat xStep = (VB->Win.data[vert1][0] - x) * invDy; + GLint dz = (GLint) ((z1 - z0) * invDy); +#if INTERP_RGBA if (ctx->Light.ShadeModel == GL_SMOOTH) { dfr = (IntToFixed(VB->ColorPtr->data[vert1][0]) - fr) * invDy; dfg = (IntToFixed(VB->ColorPtr->data[vert1][1]) - fg) * invDy; @@ -355,28 +361,28 @@ dfa = (IntToFixed(VB->ColorPtr->data[vert1][3]) - fa) * invDy; } #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC if (ctx->Light.ShadeModel == GL_SMOOTH) { dfsr = (IntToFixed(VB->Specular[vert1][0]) - fsr) * invDy; dfsg = (IntToFixed(VB->Specular[vert1][1]) - fsg) * invDy; dfsb = (IntToFixed(VB->Specular[vert1][2]) - fsb) * invDy; } #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 dhs *= invDy; dht *= invDy; dhu *= invDy; dhv *= invDy; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 dhs1 *= invDy; dht1 *= invDy; dhu1 *= invDy; dhv1 *= invDy; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX if (ctx->Light.ShadeModel == GL_SMOOTH) { - dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) / dy; + dfi = (IntToFixed(VB->IndexPtr->data[vert1]) - fi) * invDy; } #endif for (i = 0; i < dy; i++) { @@ -386,38 +392,34 @@ GLint xRighti = (GLint) xRight; GLint xLefti = (GLint) xLeft; GLint ix; -#ifdef INTERP_RGBA +#if INTERP_RGBA GLubyte red = FixedToInt(fr); GLubyte green = FixedToInt(fg); GLubyte blue = FixedToInt(fb); GLubyte alpha = FixedToInt(fa); GLint coverage; #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC GLubyte specRed = FixedToInt(fsr); GLubyte specGreen = FixedToInt(fsg); GLubyte specBlue = FixedToInt(fsb); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX GLuint index = FixedToInt(fi) & 0xfffffff0; GLuint coverage; #endif -#if DEPTH_BITS==16 - GLdepth z = FixedToInt(z0); -#else - GLdepth z = z0; -#endif + GLdepth z = FixedToDepth(z0); ASSERT(xLefti < xRight); { -#ifdef INTERP_STUV0 +#if INTERP_STUV0 GLfloat invQ = 1.0F / hv0; GLfloat s = hs0 * invQ; GLfloat t = ht0 * invQ; GLfloat u = hu0 * invQ; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 GLfloat invQ1 = 1.0F / hv01; GLfloat s1 = hs01 * invQ1; GLfloat t1 = ht01 * invQ1; @@ -425,30 +427,30 @@ #endif /* left pixel of swipe */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = (GLint) (alpha * (1.0F - (xLeft - xLefti))); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = (GLuint) (15.0F * (1.0F - (xLeft - xLefti))); #endif PLOT(xLefti, y); xLefti++; /* right pixel of swipe */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = (GLint) (alpha * (xRight - xRighti)); #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = (GLuint) (15.0F * (xRight - xRighti)); #endif PLOT(xRighti, y) xRighti--; /* pixels between top and bottom with 100% coverage */ -#ifdef INTERP_RGBA +#if INTERP_RGBA coverage = alpha; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX coverage = 15; #endif for (ix = xLefti; ix <= xRighti; ix++) { @@ -461,30 +463,30 @@ x += xStep; y += yStep; z0 += dz; -#ifdef INTERP_RGBA +#if INTERP_RGBA fr += dfr; fg += dfg; fb += dfb; fa += dfa; #endif -#ifdef INTERP_SPEC +#if INTERP_SPEC fsr += dfsr; fsg += dfsg; fsb += dfsb; #endif -#ifdef INTERP_STUV0 +#if INTERP_STUV0 hs0 += dhs; ht0 += dht; hu0 += dhu; hv0 += dhv; #endif -#ifdef INTERP_STUV1 +#if INTERP_STUV1 hs01 += dhs1; ht01 += dht1; hu01 += dhu1; hv01 += dhv1; #endif -#ifdef INTERP_INDEX +#if INTERP_INDEX fi += dfi; #endif if (!solid) diff --git a/xc/extras/Mesa/src/mem.h b/xc/extras/Mesa/src/mem.h index c0203c7c4..794aa13ef 100644 --- a/xc/extras/Mesa/src/mem.h +++ b/xc/extras/Mesa/src/mem.h @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -34,12 +34,14 @@ /* * Memory allocation */ -#ifdef DEBUG - -/* call Mesa memory functions */ extern void *_mesa_malloc(size_t bytes); extern void *_mesa_calloc(size_t bytes); extern void _mesa_free(void *ptr); + + +#ifdef DEBUG + +/* call Mesa memory functions */ #define MALLOC(BYTES) _mesa_malloc(BYTES) #define CALLOC(BYTES) _mesa_calloc(BYTES) #define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T)) @@ -78,6 +80,15 @@ extern void _mesa_free(void *ptr); #endif +/* On some systems we might want to use bzero() (but is bzero portable?) */ +#if defined(__FreeBSD__) +#define BZERO( ADDR, N ) \ + bzero( (void *) (ADDR), (size_t) (N) ) +#else +#define BZERO( ADDR, N ) \ + memset( (void *) (ADDR), 0, (size_t) (N) ) +#endif + /* MACs and BeOS don't support static larger than 32kb, so... */ #if defined(macintosh) && !defined(__MRC__) diff --git a/xc/extras/Mesa/src/pb.c b/xc/extras/Mesa/src/pb.c index 1e5ac03e2..78ff5d07e 100644 --- a/xc/extras/Mesa/src/pb.c +++ b/xc/extras/Mesa/src/pb.c @@ -69,10 +69,11 @@ struct pixel_buffer *gl_alloc_pb(void) int i, j; /* set non-zero fields */ pb->primitive = GL_BITMAP; + pb->mono = GL_TRUE; + /* Set all lambda values to 0.0 since we don't do mipmapping for * points or lines and want to use the level 0 texture image. */ - for (j=0;j<MAX_TEXTURE_UNITS;j++) { for (i=0; i<PB_SIZE; i++) { pb->lambda[j][i] = 0.0; @@ -115,10 +116,10 @@ static void multi_write_index_pixels( GLcontext *ctx, GLuint n, /* make copy of incoming indexes */ MEMCPY( indexTmp, indexes, n * sizeof(GLuint) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_pixels( ctx, n, x, y, indexTmp, mask ); + _mesa_logicop_ci_pixels( ctx, n, x, y, indexTmp, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_pixels( ctx, n, x, y, indexTmp, mask ); + _mesa_mask_index_pixels( ctx, n, x, y, indexTmp, mask ); } (*ctx->Driver.WriteCI32Pixels)( ctx, n, x, y, indexTmp, mask ); } @@ -170,20 +171,20 @@ static void multi_write_rgba_pixels( GLcontext *ctx, GLuint n, MEMCPY( rgbaTmp, rgba, 4 * n * sizeof(GLubyte) ); if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); + _mesa_logicop_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); } else if (ctx->Color.BlendEnabled) { _mesa_blend_pixels( ctx, n, x, y, rgbaTmp, mask ); } if (ctx->Color.SWmasking) { - gl_mask_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); + _mesa_mask_rgba_pixels( ctx, n, x, y, rgbaTmp, mask ); } (*ctx->Driver.WriteRGBAPixels)( ctx, n, x, y, (const GLubyte (*)[4])rgbaTmp, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_pixels( ctx, n, x, y, - (const GLubyte (*)[4])rgbaTmp, mask ); + _mesa_write_alpha_pixels( ctx, n, x, y, + (const GLubyte (*)[4])rgbaTmp, mask ); } } } @@ -221,10 +222,13 @@ static void add_colors( GLuint n, GLubyte rgba[][4], CONST GLubyte spec[][3] ) */ void gl_flush_pb( GLcontext *ctx ) { - struct pixel_buffer* PB = ctx->PB; + /* Pixel colors may be changed if any of these raster ops enabled */ + const GLuint modBits = FOG_BIT | TEXTURE_BIT | BLEND_BIT | + MASKING_BIT | LOGIC_OP_BIT; + struct pixel_buffer *PB = ctx->PB; GLubyte mask[PB_SIZE]; - if (PB->count==0) + if (PB->count == 0) goto CleanUp; /* initialize mask array and clip pixels simultaneously */ @@ -245,19 +249,9 @@ void gl_flush_pb( GLcontext *ctx ) /* * RGBA COLOR PIXELS */ - if (PB->mono && ctx->MutablePixels) { - /* Copy mono color to all pixels */ - GLuint i; - for (i=0; i<PB->count; i++) { - PB->rgba[i][RCOMP] = PB->color[RCOMP]; - PB->rgba[i][GCOMP] = PB->color[GCOMP]; - PB->rgba[i][BCOMP] = PB->color[BCOMP]; - PB->rgba[i][ACOMP] = PB->color[ACOMP]; - } - } /* If each pixel can be of a different color... */ - if (ctx->MutablePixels || !PB->mono) { + if ((ctx->RasterMask & modBits) || !PB->mono) { if (ctx->Texture.ReallyEnabled) { int texUnit; @@ -292,7 +286,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -311,21 +305,21 @@ void gl_flush_pb( GLcontext *ctx ) /* normal case: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_rgba_pixels( ctx, PB->count, PB->x, PB->y, - PB->rgba, mask); + _mesa_logicop_rgba_pixels( ctx, PB->count, PB->x, PB->y, + PB->rgba, mask); } else if (ctx->Color.BlendEnabled) { _mesa_blend_pixels( ctx, PB->count, PB->x, PB->y, PB->rgba, mask); } if (ctx->Color.SWmasking) { - gl_mask_rgba_pixels(ctx, PB->count, PB->x, PB->y, PB->rgba, mask); + _mesa_mask_rgba_pixels(ctx, PB->count, PB->x, PB->y, PB->rgba, mask); } (*ctx->Driver.WriteRGBAPixels)( ctx, PB->count, PB->x, PB->y, (const GLubyte (*)[4]) PB->rgba, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_alpha_pixels( ctx, PB->count, PB->x, PB->y, + _mesa_write_alpha_pixels( ctx, PB->count, PB->x, PB->y, (const GLubyte (*)[4]) PB->rgba, mask ); } } @@ -344,7 +338,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -360,30 +354,21 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->RasterMask & MULTI_DRAW_BIT) { /* Copy mono color to all pixels */ - GLuint i; - for (i=0; i<PB->count; i++) { - PB->rgba[i][RCOMP] = PB->color[RCOMP]; - PB->rgba[i][GCOMP] = PB->color[GCOMP]; - PB->rgba[i][BCOMP] = PB->color[BCOMP]; - PB->rgba[i][ACOMP] = PB->color[ACOMP]; - } multi_write_rgba_pixels( ctx, PB->count, PB->x, PB->y, (const GLubyte (*)[4]) PB->rgba, mask ); } else { /* normal case: write to exactly one buffer */ - - GLubyte red, green, blue, alpha; - red = PB->color[RCOMP]; - green = PB->color[GCOMP]; - blue = PB->color[BCOMP]; - alpha = PB->color[ACOMP]; + GLubyte red = PB->currentColor[RCOMP]; + GLubyte green = PB->currentColor[GCOMP]; + GLubyte blue = PB->currentColor[BCOMP]; + GLubyte alpha = PB->currentColor[ACOMP]; (*ctx->Driver.Color)( ctx, red, green, blue, alpha ); (*ctx->Driver.WriteMonoRGBAPixels)( ctx, PB->count, PB->x, PB->y, mask ); if (ctx->RasterMask & ALPHABUF_BIT) { - gl_write_mono_alpha_pixels( ctx, PB->count, PB->x, PB->y, - PB->color[ACOMP], mask ); + _mesa_write_mono_alpha_pixels( ctx, PB->count, PB->x, PB->y, + PB->currentColor[ACOMP], mask ); } } /*** ALL DONE ***/ @@ -395,28 +380,18 @@ void gl_flush_pb( GLcontext *ctx ) */ /* If we may be writting pixels with different indexes... */ - if (PB->mono && ctx->MutablePixels) { - /* copy index to all pixels */ - GLuint n = PB->count, indx = PB->index; - GLuint *pbindex = PB->i; - do { - *pbindex++ = indx; - n--; - } while (n); - } - - if (ctx->MutablePixels || !PB->mono) { + if ((ctx->RasterMask & modBits) || !PB->mono) { if (ctx->Fog.Enabled && (ctx->Hint.Fog==GL_NICEST || PB->primitive==GL_BITMAP)) { - _mesa_fog_ci_pixels( ctx, PB->count, PB->z, PB->i ); + _mesa_fog_ci_pixels( ctx, PB->count, PB->z, PB->index ); } /* Scissoring already done above */ if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -427,20 +402,20 @@ void gl_flush_pb( GLcontext *ctx ) } if (ctx->RasterMask & MULTI_DRAW_BIT) { - multi_write_index_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + multi_write_index_pixels( ctx, PB->count, PB->x, PB->y, PB->index, mask ); } else { /* normal case: write to exactly one buffer */ if (ctx->Color.SWLogicOpEnabled) { - gl_logicop_ci_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + _mesa_logicop_ci_pixels( ctx, PB->count, PB->x, PB->y, PB->index, mask ); } if (ctx->Color.SWmasking) { - gl_mask_index_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + _mesa_mask_index_pixels( ctx, PB->count, PB->x, PB->y, PB->index, mask ); } (*ctx->Driver.WriteCI32Pixels)( ctx, PB->count, PB->x, PB->y, - PB->i, mask ); + PB->index, mask ); } /*** ALL DONE ***/ @@ -452,7 +427,7 @@ void gl_flush_pb( GLcontext *ctx ) if (ctx->Stencil.Enabled) { /* first stencil test */ - if (gl_stencil_and_depth_test_pixels(ctx, PB->count, + if (_mesa_stencil_and_ztest_pixels(ctx, PB->count, PB->x, PB->y, PB->z, mask) == 0) { goto CleanUp; } @@ -463,19 +438,12 @@ void gl_flush_pb( GLcontext *ctx ) } if (ctx->RasterMask & MULTI_DRAW_BIT) { - GLuint n = PB->count, indx = PB->index; - GLuint *pbindex = PB->i; - do { - *pbindex++ = indx; - n--; - } while (n); - - multi_write_index_pixels( ctx, PB->count, PB->x, PB->y, PB->i, mask ); + multi_write_index_pixels( ctx, PB->count, PB->x, PB->y, PB->index, mask ); } else { /* normal case: write to exactly one buffer */ - (*ctx->Driver.Index)( ctx, PB->index ); + (*ctx->Driver.Index)( ctx, PB->currentIndex ); (*ctx->Driver.WriteMonoCIPixels)( ctx, PB->count, PB->x, PB->y, mask ); } } @@ -483,6 +451,7 @@ void gl_flush_pb( GLcontext *ctx ) CleanUp: PB->count = 0; + PB->mono = GL_TRUE; } diff --git a/xc/extras/Mesa/src/pb.h b/xc/extras/Mesa/src/pb.h index 54fad8388..cf5fecc4b 100644 --- a/xc/extras/Mesa/src/pb.h +++ b/xc/extras/Mesa/src/pb.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 3.1 + * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -24,9 +24,6 @@ */ - - - #ifndef PB_H #define PB_H @@ -34,7 +31,6 @@ #include "types.h" - /* * Pixel buffer size, must be larger than MAX_WIDTH. */ @@ -42,160 +38,197 @@ struct pixel_buffer { - GLint x[PB_SIZE]; /* X window coord in [0,MAX_WIDTH) */ - GLint y[PB_SIZE]; /* Y window coord in [0,MAX_HEIGHT) */ - GLdepth z[PB_SIZE]; /* Z window coord in [0,MAX_DEPTH] */ - GLubyte rgba[PB_SIZE][4]; /* Colors */ - GLubyte spec[PB_SIZE][3]; /* Separate specular colors */ - GLuint i[PB_SIZE]; /* Index */ - GLfloat s[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture S coordinates */ - GLfloat t[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture T coordinates */ - GLfloat u[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture R coordinates */ - GLfloat lambda[MAX_TEXTURE_UNITS][PB_SIZE];/* Texture lambda values */ - GLint color[4]; /* Mono color, integers! */ - GLuint index; /* Mono index */ - GLuint count; /* Number of pixels in buffer */ - GLboolean mono; /* Same color or index for all pixels? */ - GLenum primitive; /* GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP*/ + GLenum primitive; /* GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP */ + GLubyte currentColor[4]; /* Current color, for subsequent pixels */ + GLuint currentIndex; /* Current index, for subsequent pixels */ + GLuint count; /* Number of pixels in buffer */ + GLboolean mono; /* Same color or index for all pixels? */ + + GLint x[PB_SIZE]; /* X window coord in [0,MAX_WIDTH) */ + GLint y[PB_SIZE]; /* Y window coord in [0,MAX_HEIGHT) */ + GLdepth z[PB_SIZE]; /* Z window coord in [0,Visual.MaxDepth] */ + GLubyte rgba[PB_SIZE][4]; /* Colors */ + GLubyte spec[PB_SIZE][3]; /* Separate specular colors */ + GLuint index[PB_SIZE]; /* Color indexes */ + GLfloat s[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture S coordinates */ + GLfloat t[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture T coordinates */ + GLfloat u[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture R coordinates */ + GLfloat lambda[MAX_TEXTURE_UNITS][PB_SIZE]; /* Texture lambda values */ }; - - /* * Set the color used for all subsequent pixels in the buffer. */ -#define PB_SET_COLOR( CTX, PB, R, G, B, A ) \ - if ((PB)->color[RCOMP]!=(R) || (PB)->color[GCOMP]!=(G) \ - || (PB)->color[BCOMP]!=(B) || (PB)->color[ACOMP]!=(A) \ - || !(PB)->mono) { \ - gl_flush_pb( ctx ); \ - } \ - (PB)->color[RCOMP] = R; \ - (PB)->color[GCOMP] = G; \ - (PB)->color[BCOMP] = B; \ - (PB)->color[ACOMP] = A; \ - (PB)->mono = GL_TRUE; +#define PB_SET_COLOR( PB, R, G, B, A ) \ +do { \ + if ((PB)->count > 0) \ + (PB)->mono = GL_FALSE; \ + (PB)->currentColor[RCOMP] = (R); \ + (PB)->currentColor[GCOMP] = (G); \ + (PB)->currentColor[BCOMP] = (B); \ + (PB)->currentColor[ACOMP] = (A); \ +} while (0) /* * Set the color index used for all subsequent pixels in the buffer. */ -#define PB_SET_INDEX( CTX, PB, I ) \ - if ((PB)->index!=(I) || !(PB)->mono) { \ - gl_flush_pb( CTX ); \ - } \ - (PB)->index = I; \ - (PB)->mono = GL_TRUE; +#define PB_SET_INDEX( PB, I ) \ +do { \ + if ((PB)->count > 0) \ + (PB)->mono = GL_FALSE; \ + (PB)->currentIndex = (I); \ +} while (0) /* * "write" a pixel using current color or index */ -#define PB_WRITE_PIXEL( PB, X, Y, Z ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->count++; +#define PB_WRITE_PIXEL( PB, X, Y, Z ) \ +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + COPY_4UBV((PB)->rgba[count], (PB)->currentColor); \ + (PB)->index[count] = (PB)->currentIndex; \ + (PB)->count++; \ +} while (0) + + +/* + (PB)->rgba[count][0] = (PB)->currentColor[0]; \ + (PB)->rgba[count][1] = (PB)->currentColor[1]; \ + (PB)->rgba[count][2] = (PB)->currentColor[2]; \ + (PB)->rgba[count][3] = (PB)->currentColor[3]; \ + +*/ /* * "write" an RGBA pixel */ #define PB_WRITE_RGBA_PIXEL( PB, X, Y, Z, R, G, B, A ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->rgba[(PB)->count][RCOMP] = R; \ - (PB)->rgba[(PB)->count][GCOMP] = G; \ - (PB)->rgba[(PB)->count][BCOMP] = B; \ - (PB)->rgba[(PB)->count][ACOMP] = A; \ - (PB)->count++; +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (PB)->rgba[count][RCOMP] = R; \ + (PB)->rgba[count][GCOMP] = G; \ + (PB)->rgba[count][BCOMP] = B; \ + (PB)->rgba[count][ACOMP] = A; \ + (PB)->mono = GL_FALSE; \ + (PB)->count++; \ +} while (0) + /* * "write" a color-index pixel */ #define PB_WRITE_CI_PIXEL( PB, X, Y, Z, I ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->i[(PB)->count] = I; \ - (PB)->count++; +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (PB)->index[count] = I; \ + (PB)->mono = GL_FALSE; \ + (PB)->count++; \ +} while (0) + /* * "write" an RGBA pixel with texture coordinates */ #define PB_WRITE_TEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->rgba[(PB)->count][RCOMP] = R; \ - (PB)->rgba[(PB)->count][GCOMP] = G; \ - (PB)->rgba[(PB)->count][BCOMP] = B; \ - (PB)->rgba[(PB)->count][ACOMP] = A; \ - (PB)->s[0][(PB)->count] = S; \ - (PB)->t[0][(PB)->count] = T; \ - (PB)->u[0][(PB)->count] = U; \ - (PB)->count++; +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (PB)->rgba[count][RCOMP] = R; \ + (PB)->rgba[count][GCOMP] = G; \ + (PB)->rgba[count][BCOMP] = B; \ + (PB)->rgba[count][ACOMP] = A; \ + (PB)->s[0][count] = S; \ + (PB)->t[0][count] = T; \ + (PB)->u[0][count] = U; \ + (PB)->mono = GL_FALSE; \ + (PB)->count++; \ +} while (0) + /* * "write" an RGBA pixel with multiple texture coordinates */ -#define PB_WRITE_MULTITEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U, S1, T1, U1 ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->rgba[(PB)->count][RCOMP] = R; \ - (PB)->rgba[(PB)->count][GCOMP] = G; \ - (PB)->rgba[(PB)->count][BCOMP] = B; \ - (PB)->rgba[(PB)->count][ACOMP] = A; \ - (PB)->s[0][(PB)->count] = S; \ - (PB)->t[0][(PB)->count] = T; \ - (PB)->u[0][(PB)->count] = U; \ - (PB)->s[1][(PB)->count] = S1; \ - (PB)->t[1][(PB)->count] = T1; \ - (PB)->u[1][(PB)->count] = U1; \ - (PB)->count++; +#define PB_WRITE_MULTITEX_PIXEL( PB, X, Y, Z, R, G, B, A, S0, T0, U0, S1, T1, U1 ) \ +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (PB)->rgba[count][RCOMP] = R; \ + (PB)->rgba[count][GCOMP] = G; \ + (PB)->rgba[count][BCOMP] = B; \ + (PB)->rgba[count][ACOMP] = A; \ + (PB)->s[0][count] = S0; \ + (PB)->t[0][count] = T0; \ + (PB)->u[0][count] = U0; \ + (PB)->s[1][count] = S1; \ + (PB)->t[1][count] = T1; \ + (PB)->u[1][count] = U1; \ + (PB)->mono = GL_FALSE; \ + (PB)->count++; \ +} while (0) + /* * "write" an RGBA pixel with multiple texture coordinates and specular color */ #define PB_WRITE_MULTITEX_SPEC_PIXEL( PB, X, Y, Z, R, G, B, A, \ - SR, SG, SB, S, T, U, S1, T1, U1 ) \ - (PB)->x[(PB)->count] = X; \ - (PB)->y[(PB)->count] = Y; \ - (PB)->z[(PB)->count] = Z; \ - (PB)->rgba[(PB)->count][RCOMP] = R; \ - (PB)->rgba[(PB)->count][GCOMP] = G; \ - (PB)->rgba[(PB)->count][BCOMP] = B; \ - (PB)->rgba[(PB)->count][ACOMP] = A; \ - (PB)->spec[(PB)->count][RCOMP] = SR; \ - (PB)->spec[(PB)->count][GCOMP] = SG; \ - (PB)->spec[(PB)->count][BCOMP] = SB; \ - (PB)->s[0][(PB)->count] = S; \ - (PB)->t[0][(PB)->count] = T; \ - (PB)->u[0][(PB)->count] = U; \ - (PB)->s[1][(PB)->count] = S1; \ - (PB)->t[1][(PB)->count] = T1; \ - (PB)->u[1][(PB)->count] = U1; \ - (PB)->count++; + SR, SG, SB, S0, T0, U0, S1, T1, U1 ) \ +do { \ + GLuint count = (PB)->count; \ + (PB)->x[count] = X; \ + (PB)->y[count] = Y; \ + (PB)->z[count] = Z; \ + (PB)->rgba[count][RCOMP] = R; \ + (PB)->rgba[count][GCOMP] = G; \ + (PB)->rgba[count][BCOMP] = B; \ + (PB)->rgba[count][ACOMP] = A; \ + (PB)->spec[count][RCOMP] = SR; \ + (PB)->spec[count][GCOMP] = SG; \ + (PB)->spec[count][BCOMP] = SB; \ + (PB)->s[0][count] = S0; \ + (PB)->t[0][count] = T0; \ + (PB)->u[0][count] = U0; \ + (PB)->s[1][count] = S1; \ + (PB)->t[1][count] = T1; \ + (PB)->u[1][count] = U1; \ + (PB)->mono = GL_FALSE; \ + (PB)->count++; \ +} while (0) /* * Call this function at least every MAX_WIDTH pixels: */ -#define PB_CHECK_FLUSH( CTX, PB ) \ -do { \ - if ((PB)->count>=PB_SIZE-MAX_WIDTH) { \ - gl_flush_pb( CTX ); \ - } \ +#define PB_CHECK_FLUSH( CTX, PB ) \ +do { \ + if ((PB)->count >= PB_SIZE - MAX_WIDTH) { \ + gl_flush_pb( CTX ); \ + } \ } while(0) + extern struct pixel_buffer *gl_alloc_pb(void); extern void gl_flush_pb( GLcontext *ctx ); + #endif diff --git a/xc/extras/Mesa/src/pixel.c b/xc/extras/Mesa/src/pixel.c index fd42ba3a9..17c6eb6bb 100644 --- a/xc/extras/Mesa/src/pixel.c +++ b/xc/extras/Mesa/src/pixel.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -24,11 +24,6 @@ */ -/* - * glPixelStore, glPixelTransfer, glPixelMap, glPixelZoom, etc. - */ - - #ifdef PC_HEADER #include "all.h" #else @@ -561,6 +556,54 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) case GL_DEPTH_BIAS: ctx->Pixel.DepthBias = param; break; + case GL_POST_COLOR_MATRIX_RED_SCALE: + ctx->Pixel.PostColorMatrixScale[0] = param; + break; + case GL_POST_COLOR_MATRIX_RED_BIAS: + ctx->Pixel.PostColorMatrixBias[0] = param; + break; + case GL_POST_COLOR_MATRIX_GREEN_SCALE: + ctx->Pixel.PostColorMatrixScale[1] = param; + break; + case GL_POST_COLOR_MATRIX_GREEN_BIAS: + ctx->Pixel.PostColorMatrixBias[1] = param; + break; + case GL_POST_COLOR_MATRIX_BLUE_SCALE: + ctx->Pixel.PostColorMatrixScale[2] = param; + break; + case GL_POST_COLOR_MATRIX_BLUE_BIAS: + ctx->Pixel.PostColorMatrixBias[2] = param; + break; + case GL_POST_COLOR_MATRIX_ALPHA_SCALE: + ctx->Pixel.PostColorMatrixScale[3] = param; + break; + case GL_POST_COLOR_MATRIX_ALPHA_BIAS: + ctx->Pixel.PostColorMatrixBias[3] = param; + break; + case GL_POST_CONVOLUTION_RED_SCALE: + ctx->Pixel.PostConvolutionScale[0] = param; + break; + case GL_POST_CONVOLUTION_RED_BIAS: + ctx->Pixel.PostConvolutionBias[0] = param; + break; + case GL_POST_CONVOLUTION_GREEN_SCALE: + ctx->Pixel.PostConvolutionScale[1] = param; + break; + case GL_POST_CONVOLUTION_GREEN_BIAS: + ctx->Pixel.PostConvolutionBias[1] = param; + break; + case GL_POST_CONVOLUTION_BLUE_SCALE: + ctx->Pixel.PostConvolutionScale[2] = param; + break; + case GL_POST_CONVOLUTION_BLUE_BIAS: + ctx->Pixel.PostConvolutionBias[2] = param; + break; + case GL_POST_CONVOLUTION_ALPHA_SCALE: + ctx->Pixel.PostConvolutionScale[2] = param; + break; + case GL_POST_CONVOLUTION_ALPHA_BIAS: + ctx->Pixel.PostConvolutionBias[2] = param; + break; default: gl_error( ctx, GL_INVALID_ENUM, "glPixelTransfer(pname)" ); return; @@ -575,6 +618,20 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) else { ctx->Pixel.ScaleOrBiasRGBA = GL_FALSE; } + + if (ctx->Pixel.PostColorMatrixScale[0] != 1.0F || + ctx->Pixel.PostColorMatrixBias[0] != 0.0F || + ctx->Pixel.PostColorMatrixScale[1] != 1.0F || + ctx->Pixel.PostColorMatrixBias[1] != 0.0F || + ctx->Pixel.PostColorMatrixScale[2] != 1.0F || + ctx->Pixel.PostColorMatrixBias[2] != 0.0F || + ctx->Pixel.PostColorMatrixScale[3] != 1.0F || + ctx->Pixel.PostColorMatrixBias[3] != 0.0F) { + ctx->Pixel.ScaleOrBiasRGBApcm = GL_TRUE; + } + else { + ctx->Pixel.ScaleOrBiasRGBApcm = GL_FALSE; + } } @@ -586,60 +643,16 @@ _mesa_PixelTransferi( GLenum pname, GLint param ) - -/* - * Pixel processing functions - */ - - -/* - * Apply scale and bias factors to an array of RGBA pixels. - */ -void gl_scale_and_bias_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ) -{ - GLuint i; - for (i=0;i<n;i++) { - GLfloat r = red[i] * ctx->Pixel.RedScale + ctx->Pixel.RedBias; - GLfloat g = green[i] * ctx->Pixel.GreenScale + ctx->Pixel.GreenBias; - GLfloat b = blue[i] * ctx->Pixel.BlueScale + ctx->Pixel.BlueBias; - GLfloat a = alpha[i] * ctx->Pixel.AlphaScale + ctx->Pixel.AlphaBias; - red[i] = CLAMP( r, 0.0F, 1.0F ); - green[i] = CLAMP( g, 0.0F, 1.0F ); - blue[i] = CLAMP( b, 0.0F, 1.0F ); - alpha[i] = CLAMP( a, 0.0F, 1.0F ); - } -} - - -/* - * Apply scale and bias factors to an array of RGBA pixels. - */ -void gl_scale_and_bias_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ) -{ - GLfloat rbias = ctx->Pixel.RedBias * 255.0F; - GLfloat gbias = ctx->Pixel.GreenBias * 255.0F; - GLfloat bbias = ctx->Pixel.BlueBias * 255.0F; - GLfloat abias = ctx->Pixel.AlphaBias * 255.0F; - GLuint i; - for (i=0;i<n;i++) { - GLint r = (GLint) (rgba[i][RCOMP] * ctx->Pixel.RedScale + rbias); - GLint g = (GLint) (rgba[i][GCOMP] * ctx->Pixel.GreenScale + gbias); - GLint b = (GLint) (rgba[i][BCOMP] * ctx->Pixel.BlueScale + bbias); - GLint a = (GLint) (rgba[i][ACOMP] * ctx->Pixel.AlphaScale + abias); - rgba[i][RCOMP] = CLAMP( r, 0, 255 ); - rgba[i][GCOMP] = CLAMP( g, 0, 255 ); - rgba[i][BCOMP] = CLAMP( b, 0, 255 ); - rgba[i][ACOMP] = CLAMP( a, 0, 255 ); - } -} +/**********************************************************************/ +/***** Pixel processing functions ******/ +/**********************************************************************/ /* * Apply scale and bias factors to an array of RGBA pixels. */ -void gl_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +void +_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) { if (ctx->Pixel.RedScale != 1.0 || ctx->Pixel.RedBias != 0.0) { const GLfloat scale = ctx->Pixel.RedScale; @@ -677,32 +690,10 @@ void gl_scale_and_bias_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[ /* - * Apply pixel mapping to an array of RGBA pixels. - */ -void gl_map_rgba( const GLcontext *ctx, GLuint n, GLubyte rgba[][4] ) -{ - GLfloat rscale = (ctx->Pixel.MapRtoRsize - 1) / 255.0F; - GLfloat gscale = (ctx->Pixel.MapGtoGsize - 1) / 255.0F; - GLfloat bscale = (ctx->Pixel.MapBtoBsize - 1) / 255.0F; - GLfloat ascale = (ctx->Pixel.MapAtoAsize - 1) / 255.0F; - GLuint i; - for (i=0;i<n;i++) { - GLint ir = (GLint) (rgba[i][RCOMP] * rscale); - GLint ig = (GLint) (rgba[i][GCOMP] * gscale); - GLint ib = (GLint) (rgba[i][BCOMP] * bscale); - GLint ia = (GLint) (rgba[i][ACOMP] * ascale); - rgba[i][RCOMP] = (GLint) (ctx->Pixel.MapRtoR[ir] * 255.0F); - rgba[i][GCOMP] = (GLint) (ctx->Pixel.MapGtoG[ig] * 255.0F); - rgba[i][BCOMP] = (GLint) (ctx->Pixel.MapBtoB[ib] * 255.0F); - rgba[i][ACOMP] = (GLint) (ctx->Pixel.MapAtoA[ia] * 255.0F); - } -} - - -/* * Apply pixel mapping to an array of floating point RGBA pixels. */ -void gl_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) +void +_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) { const GLfloat rscale = ctx->Pixel.MapRtoRsize - 1; const GLfloat gscale = ctx->Pixel.MapGtoGsize - 1; @@ -723,22 +714,210 @@ void gl_map_rgba_float( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] ) /* - * Apply pixel mapping to an array of RGBA pixels. + * Apply the color matrix and post color matrix scaling and biasing. */ -void gl_map_color( const GLcontext *ctx, GLuint n, - GLfloat red[], GLfloat green[], - GLfloat blue[], GLfloat alpha[] ) +void +_mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]) { - GLfloat rscale = ctx->Pixel.MapRtoRsize - 1; - GLfloat gscale = ctx->Pixel.MapGtoGsize - 1; - GLfloat bscale = ctx->Pixel.MapBtoBsize - 1; - GLfloat ascale = ctx->Pixel.MapAtoAsize - 1; + const GLfloat rs = ctx->Pixel.PostColorMatrixScale[0]; + const GLfloat rb = ctx->Pixel.PostColorMatrixBias[0]; + const GLfloat gs = ctx->Pixel.PostColorMatrixScale[1]; + const GLfloat gb = ctx->Pixel.PostColorMatrixBias[1]; + const GLfloat bs = ctx->Pixel.PostColorMatrixScale[2]; + const GLfloat bb = ctx->Pixel.PostColorMatrixBias[2]; + const GLfloat as = ctx->Pixel.PostColorMatrixScale[3]; + const GLfloat ab = ctx->Pixel.PostColorMatrixBias[3]; + const GLfloat *m = ctx->ColorMatrix.m; GLuint i; - for (i=0;i<n;i++) { - red[i] = ctx->Pixel.MapRtoR[ (GLint) (red[i] * rscale + 0.5F) ]; - green[i] = ctx->Pixel.MapGtoG[ (GLint) (green[i] * gscale + 0.5F) ]; - blue[i] = ctx->Pixel.MapBtoB[ (GLint) (blue[i] * bscale + 0.5F) ]; - alpha[i] = ctx->Pixel.MapAtoA[ (GLint) (alpha[i] * ascale + 0.5F) ]; + for (i = 0; i < n; i++) { + const GLfloat r = rgba[i][RCOMP]; + const GLfloat g = rgba[i][GCOMP]; + const GLfloat b = rgba[i][BCOMP]; + const GLfloat a = rgba[i][ACOMP]; + rgba[i][RCOMP] = (m[0] * r + m[4] * g + m[ 8] * b + m[12] * a) * rs + rb; + rgba[i][GCOMP] = (m[1] * r + m[5] * g + m[ 9] * b + m[13] * a) * gs + gb; + rgba[i][BCOMP] = (m[2] * r + m[6] * g + m[10] * b + m[14] * a) * bs + bb; + rgba[i][ACOMP] = (m[3] * r + m[7] * g + m[11] * b + m[15] * a) * as + ab; + } +} + + +/* + * Apply a color table lookup to an array of colors. + */ +void +_mesa_lookup_rgba(const struct gl_color_table *table, + GLuint n, GLfloat rgba[][4]) +{ + ASSERT(table->TableType == GL_FLOAT); + if (!table->Table) + return; + + switch (table->Format) { + case GL_INTENSITY: + /* replace RGBA with I */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j] * (1.0F / 255.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = + rgba[i][BCOMP] = rgba[i][ACOMP] = c; + } + + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j]; + rgba[i][RCOMP] = rgba[i][GCOMP] = + rgba[i][BCOMP] = rgba[i][ACOMP] = c; + } + } + break; + case GL_LUMINANCE: + /* replace RGB with L */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j] * (1.0F / 255.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLfloat c = lut[j]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = c; + } + } + break; + case GL_ALPHA: + /* replace A with A */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][ACOMP] = lut[j] * (1.0F / 255.0F); + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint j = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][ACOMP] = lut[j]; + } + } + break; + case GL_LUMINANCE_ALPHA: + /* replace RGBA with LLLA */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jL = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + GLfloat luminance = lut[jL * 2 + 0] * (1.0F / 255.0F); + GLfloat alpha = lut[jA * 2 + 1] * (1.0F / 255.0F); + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jL = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + GLfloat luminance = lut[jL * 2 + 0]; + GLfloat alpha = lut[jA * 2 + 1]; + rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = luminance; + rgba[i][ACOMP] = alpha;; + } + } + break; + case GL_RGB: + /* replace RGB with RGB */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 3 + 0] * (1.0F / 255.0F); + rgba[i][GCOMP] = lut[jG * 3 + 1] * (1.0F / 255.0F); + rgba[i][BCOMP] = lut[jB * 3 + 2] * (1.0F / 255.0F); + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 3 + 0]; + rgba[i][GCOMP] = lut[jG * 3 + 1]; + rgba[i][BCOMP] = lut[jB * 3 + 2]; + } + } + break; + case GL_RGBA: + /* replace RGBA with RGBA */ + if (table->TableType == GL_UNSIGNED_BYTE) { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLubyte *lut = (const GLubyte *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 4 + 0] * (1.0F / 255.0F); + rgba[i][GCOMP] = lut[jG * 4 + 1] * (1.0F / 255.0F); + rgba[i][BCOMP] = lut[jB * 4 + 2] * (1.0F / 255.0F); + rgba[i][ACOMP] = lut[jA * 4 + 3] * (1.0F / 255.0F); + } + } + else { + const GLfloat scale = (GLfloat) (table->Size - 1); + const GLfloat *lut = (const GLfloat *) table->Table; + GLuint i; + for (i = 0; i < n; i++) { + GLint jR = (GLint) (rgba[i][RCOMP] * scale + 0.5F); + GLint jG = (GLint) (rgba[i][GCOMP] * scale + 0.5F); + GLint jB = (GLint) (rgba[i][BCOMP] * scale + 0.5F); + GLint jA = (GLint) (rgba[i][ACOMP] * scale + 0.5F); + rgba[i][RCOMP] = lut[jR * 4 + 0]; + rgba[i][GCOMP] = lut[jG * 4 + 1]; + rgba[i][BCOMP] = lut[jB * 4 + 2]; + rgba[i][ACOMP] = lut[jA * 4 + 3]; + } + } + break; + default: + gl_problem(NULL, "Bad format in _mesa_lookup_rgba"); + return; } } @@ -747,7 +926,8 @@ void gl_map_color( const GLcontext *ctx, GLuint n, /* * Apply color index shift and offset to an array of pixels. */ -void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) +void +_mesa_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) { GLint shift = ctx->Pixel.IndexShift; GLint offset = ctx->Pixel.IndexOffset; @@ -774,7 +954,8 @@ void gl_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] ) /* * Apply color index mapping to color indexes. */ -void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) +void +_mesa_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) { GLuint mask = ctx->Pixel.MapItoIsize - 1; GLuint i; @@ -787,8 +968,9 @@ void gl_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] ) /* * Map color indexes to rgba values. */ -void gl_map_ci_to_rgba( const GLcontext *ctx, GLuint n, const GLuint index[], - GLubyte rgba[][4] ) +void +_mesa_map_ci_to_rgba_ubyte( const GLcontext *ctx, GLuint n, + const GLuint index[], GLubyte rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -811,8 +993,9 @@ void gl_map_ci_to_rgba( const GLcontext *ctx, GLuint n, const GLuint index[], /* * Map color indexes to float rgba values. */ -void gl_map_ci_to_rgba_float( const GLcontext *ctx, GLuint n, const GLuint index[], - GLfloat rgba[][4] ) +void +_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n, + const GLuint index[], GLfloat rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -835,8 +1018,9 @@ void gl_map_ci_to_rgba_float( const GLcontext *ctx, GLuint n, const GLuint index /* * Map 8-bit color indexes to rgb values. */ -void gl_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], - GLubyte rgba[][4] ) +void +_mesa_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], + GLubyte rgba[][4] ) { GLuint rmask = ctx->Pixel.MapItoRsize - 1; GLuint gmask = ctx->Pixel.MapItoGsize - 1; @@ -856,27 +1040,9 @@ void gl_map_ci8_to_rgba( const GLcontext *ctx, GLuint n, const GLubyte index[], } -void gl_map_ci_to_color( const GLcontext *ctx, GLuint n, const GLuint index[], - GLfloat r[], GLfloat g[], - GLfloat b[], GLfloat a[] ) -{ - GLuint rmask = ctx->Pixel.MapItoRsize - 1; - GLuint gmask = ctx->Pixel.MapItoGsize - 1; - GLuint bmask = ctx->Pixel.MapItoBsize - 1; - GLuint amask = ctx->Pixel.MapItoAsize - 1; - GLuint i; - for (i=0;i<n;i++) { - r[i] = ctx->Pixel.MapItoR[index[i] & rmask]; - g[i] = ctx->Pixel.MapItoG[index[i] & gmask]; - b[i] = ctx->Pixel.MapItoB[index[i] & bmask]; - a[i] = ctx->Pixel.MapItoA[index[i] & amask]; - } -} - - - -void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, - GLstencil stencil[] ) +void +_mesa_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, + GLstencil stencil[] ) { GLuint i; GLint shift = ctx->Pixel.IndexShift; @@ -901,8 +1067,8 @@ void gl_shift_and_offset_stencil( const GLcontext *ctx, GLuint n, } - -void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) +void +_mesa_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) { GLuint mask = ctx->Pixel.MapStoSsize - 1; GLuint i; @@ -910,4 +1076,3 @@ void gl_map_stencil( const GLcontext *ctx, GLuint n, GLstencil stencil[] ) stencil[i] = ctx->Pixel.MapStoS[ stencil[i] & mask ]; } } - diff --git a/xc/extras/Mesa/src/points.c b/xc/extras/Mesa/src/points.c index 48866230f..77d1e0de0 100644 --- a/xc/extras/Mesa/src/points.c +++ b/xc/extras/Mesa/src/points.c @@ -3,7 +3,7 @@ * Mesa 3-D graphics library * Version: 3.3 * - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2000 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"), @@ -53,10 +53,12 @@ _mesa_PointSize( GLfloat size ) return; } - if (ctx->Point.Size != size) { - ctx->Point.Size = size; + if (ctx->Point.UserSize != size) { + ctx->Point.UserSize = size; + ctx->Point.Size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); ctx->TriangleCaps &= ~DD_POINT_SIZE; - if (size != 1.0) ctx->TriangleCaps |= DD_POINT_SIZE; + if (size != 1.0) + ctx->TriangleCaps |= DD_POINT_SIZE; ctx->NewState |= NEW_RASTER_OPS; } } @@ -145,20 +147,21 @@ _mesa_PointParameterfvEXT( GLenum pname, const GLfloat *params) /* * CI points with size == 1.0 */ -static void size1_ci_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +size1_ci_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLfloat *win; GLint *pbx = PB->x, *pby = PB->y; GLdepth *pbz = PB->z; - GLuint *pbi = PB->i; + GLuint *pbi = PB->index; GLuint pbcount = PB->count; GLuint i; win = &VB->Win.data[first][0]; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { pbx[pbcount] = (GLint) win[0]; pby[pbcount] = (GLint) win[1]; pbz[pbcount] = (GLint) (win[2] + ctx->PointZoffset); @@ -176,14 +179,15 @@ static void size1_ci_points( GLcontext *ctx, GLuint first, GLuint last ) /* * RGBA points with size == 1.0 */ -static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x, y, z; GLint red, green, blue, alpha; @@ -199,7 +203,7 @@ static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha ); } } - PB_CHECK_FLUSH(ctx,PB); + PB_CHECK_FLUSH(ctx, PB); } @@ -207,23 +211,23 @@ static void size1_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) /* * General CI points. */ -static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLint isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); + const GLint isize = (GLint) (ctx->Point.Size + 0.5F); GLint radius = isize >> 1; + GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x0, x1, y0, y1; GLint ix, iy; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); if (isize & 1) { /* odd size */ @@ -240,10 +244,10 @@ static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) y1 = y0 + isize - 1; } - PB_SET_INDEX( ctx, PB, VB->IndexPtr->data[i] ); + PB_SET_INDEX( PB, VB->IndexPtr->data[i] ); - for (iy=y0;iy<=y1;iy++) { - for (ix=x0;ix<=x1;ix++) { + for (iy = y0; iy <= y1; iy++) { + for (ix = x0; ix <= x1; ix++) { PB_WRITE_PIXEL( PB, ix, iy, z ); } } @@ -256,23 +260,23 @@ static void general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) /* * General RGBA points. */ -static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLint isize = (GLint) (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); + GLint isize = (GLint) (ctx->Point.Size + 0.5F); GLint radius = isize >> 1; + GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x0, x1, y0, y1; GLint ix, iy; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); if (isize & 1) { /* odd size */ @@ -289,14 +293,14 @@ static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) y1 = y0 + isize - 1; } - PB_SET_COLOR( ctx, PB, + PB_SET_COLOR( PB, VB->ColorPtr->data[i][0], VB->ColorPtr->data[i][1], VB->ColorPtr->data[i][2], VB->ColorPtr->data[i][3] ); - for (iy=y0;iy<=y1;iy++) { - for (ix=x0;ix<=x1;ix++) { + for (iy = y0; iy <= y1; iy++) { + for (ix = x0; ix <= x1; ix++) { PB_WRITE_PIXEL( PB, ix, iy, z ); } } @@ -311,28 +315,26 @@ static void general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) /* * Textured RGBA points. */ -static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x0, x1, y0, y1; - GLint ix, iy; - GLint isize, radius; + GLint ix, iy, radius; GLint red, green, blue, alpha; GLfloat s, t, u; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint isize = (GLint) (ctx->Point.Size + 0.5F); - isize = (GLint) - (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); - if (isize<1) { + if (isize < 1) { isize = 1; } radius = isize >> 1; @@ -388,12 +390,12 @@ static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) PB_SET_COLOR( red, green, blue, alpha ); */ - for (iy=y0;iy<=y1;iy++) { - for (ix=x0;ix<=x1;ix++) { + for (iy = y0; iy <= y1; iy++) { + for (ix = x0; ix <= x1; ix++) { PB_WRITE_TEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u ); } } - PB_CHECK_FLUSH(ctx,PB); + PB_CHECK_FLUSH(ctx, PB); } } } @@ -402,29 +404,28 @@ static void textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) /* * Multitextured RGBA points. */ -static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; GLuint i; - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { GLint x0, x1, y0, y1; GLint ix, iy; - GLint isize, radius; + GLint radius; GLint red, green, blue, alpha; GLfloat s, t, u; GLfloat s1, t1, u1; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint isize = (GLint) (ctx->Point.Size + 0.5F); - isize = (GLint) - (CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE) + 0.5F); - if (isize<1) { + if (isize < 1) { isize = 1; } radius = isize >> 1; @@ -505,10 +506,11 @@ static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last for (iy=y0;iy<=y1;iy++) { for (ix=x0;ix<=x1;ix++) { - PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, s, t, u, s1, t1, u1 ); + PB_WRITE_MULTITEX_PIXEL( PB, ix, iy, z, red, green, blue, alpha, + s, t, u, s1, t1, u1 ); } } - PB_CHECK_FLUSH(ctx,PB); + PB_CHECK_FLUSH(ctx, PB); } } } @@ -519,35 +521,32 @@ static void multitextured_rgba_points( GLcontext *ctx, GLuint first, GLuint last /* * Antialiased points with or without texture mapping. */ -static void antialiased_rgba_points( GLcontext *ctx, - GLuint first, GLuint last ) +static void +antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; + const GLfloat radius = ctx->Point.Size * 0.5F; + const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ + const GLfloat rmax = radius + 0.7071F; + const GLfloat rmin2 = rmin * rmin; + const GLfloat rmax2 = rmax * rmax; + const GLfloat cscale = 256.0F / (rmax2 - rmin2); GLuint i; - GLfloat radius, rmin, rmax, rmin2, rmax2, cscale; - - radius = CLAMP( ctx->Point.Size, MIN_POINT_SIZE, MAX_POINT_SIZE ) * 0.5F; - rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ - rmax = radius + 0.7071F; - rmin2 = rmin*rmin; - rmax2 = rmax*rmax; - cscale = 256.0F / (rmax2-rmin2); if (ctx->Texture.ReallyEnabled) { - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { - GLint xmin, ymin, xmax, ymax; - GLint x, y, z; + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { + GLint x, y; GLint red, green, blue, alpha; GLfloat s, t, u; GLfloat s1, t1, u1; - xmin = (GLint) (VB->Win.data[i][0] - radius); - xmax = (GLint) (VB->Win.data[i][0] + radius); - ymin = (GLint) (VB->Win.data[i][1] - radius); - ymax = (GLint) (VB->Win.data[i][1] + radius); - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint xmin = (GLint) (VB->Win.data[i][0] - radius); + GLint xmax = (GLint) (VB->Win.data[i][0] + radius); + GLint ymin = (GLint) (VB->Win.data[i][1] - radius); + GLint ymax = (GLint) (VB->Win.data[i][1] + radius); + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); red = VB->ColorPtr->data[i][0]; green = VB->ColorPtr->data[i][1]; @@ -690,7 +689,8 @@ static void antialiased_rgba_points( GLcontext *ctx, /* * Null rasterizer for measuring transformation speed. */ -static void null_points( GLcontext *ctx, GLuint first, GLuint last ) +static void +null_points( GLcontext *ctx, GLuint first, GLuint last ) { (void) ctx; (void) first; @@ -704,35 +704,36 @@ static void null_points( GLcontext *ctx, GLuint first, GLuint last ) /* Calculates the distance attenuation formula of a vector of points in * eye space coordinates */ -static void dist3(GLfloat *out, GLuint first, GLuint last, - const GLcontext *ctx, const GLvector4f *v) +static void +dist3(GLfloat *out, GLuint first, GLuint last, + const GLcontext *ctx, const GLvector4f *v) { GLuint stride = v->stride; - GLfloat *p = VEC_ELT(v, GLfloat, first); + const GLfloat *p = VEC_ELT(v, GLfloat, first); GLuint i; - for (i = first ; i <= last ; i++, STRIDE_F(p, stride) ) - { + for (i = first ; i <= last ; i++, STRIDE_F(p, stride) ) { GLfloat dist = GL_SQRT(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]); - out[i] = 1/(ctx->Point.Params[0]+ - dist * (ctx->Point.Params[1] + - dist * ctx->Point.Params[2])); + out[i] = 1.0F / (ctx->Point.Params[0] + + dist * (ctx->Point.Params[1] + + dist * ctx->Point.Params[2])); } } -static void dist2(GLfloat *out, GLuint first, GLuint last, - const GLcontext *ctx, const GLvector4f *v) + +static void +dist2(GLfloat *out, GLuint first, GLuint last, + const GLcontext *ctx, const GLvector4f *v) { GLuint stride = v->stride; - GLfloat *p = VEC_ELT(v, GLfloat, first); + const GLfloat *p = VEC_ELT(v, GLfloat, first); GLuint i; - for (i = first ; i <= last ; i++, STRIDE_F(p, stride) ) - { + for (i = first ; i <= last ; i++, STRIDE_F(p, stride) ) { GLfloat dist = GL_SQRT(p[0]*p[0]+p[1]*p[1]); - out[i] = 1/(ctx->Point.Params[0]+ - dist * (ctx->Point.Params[1] + - dist * ctx->Point.Params[2])); + out[i] = 1.0F / (ctx->Point.Params[0] + + dist * (ctx->Point.Params[1] + + dist * ctx->Point.Params[2])); } } @@ -750,8 +751,9 @@ static dist_func eye_dist_tab[5] = { }; -static void clip_dist(GLfloat *out, GLuint first, GLuint last, - const GLcontext *ctx, GLvector4f *clip) +static void +clip_dist(GLfloat *out, GLuint first, GLuint last, + const GLcontext *ctx, GLvector4f *clip) { /* this is never called */ gl_problem(NULL, "clip_dist() called - dead code!\n"); @@ -782,15 +784,14 @@ static void clip_dist(GLfloat *out, GLuint first, GLuint last, /* * Distance Attenuated General CI points. */ -static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first, - GLuint last ) +static void +dist_atten_general_ci_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLfloat psize,dsize; GLfloat dist[VB_SIZE]; - psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE); + const GLfloat psize = ctx->Point.Size; + GLuint i; if (ctx->NeedEyeCoords) (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); @@ -799,20 +800,19 @@ static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first, for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { - GLint x, y, z; GLint x0, x1, y0, y1; GLint ix, iy; GLint isize, radius; + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLfloat dsize = psize * dist[i]; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); - - dsize=psize*dist[i]; - if(dsize>=ctx->Point.Threshold) { - isize=(GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F); - } else { - isize=(GLint) (MAX2(ctx->Point.Threshold,ctx->Point.MinSize)+0.5F); + if (dsize >= ctx->Point.Threshold) { + isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F); + } + else { + isize = (GLint) (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) + 0.5F); } radius = isize >> 1; @@ -831,7 +831,7 @@ static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first, y1 = y0 + isize - 1; } - PB_SET_INDEX( ctx, PB, VB->IndexPtr->data[i] ); + PB_SET_INDEX( PB, VB->IndexPtr->data[i] ); for (iy=y0;iy<=y1;iy++) { for (ix=x0;ix<=x1;ix++) { @@ -846,16 +846,14 @@ static void dist_atten_general_ci_points( GLcontext *ctx, GLuint first, /* * Distance Attenuated General RGBA points. */ -static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, - GLuint last ) +static void +dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLubyte alpha; - GLfloat psize,dsize; GLfloat dist[VB_SIZE]; - psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE); + const GLfloat psize = ctx->Point.Size; + GLuint i; if (ctx->NeedEyeCoords) (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); @@ -864,15 +862,15 @@ static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { - GLint x, y, z; GLint x0, x1, y0, y1; GLint ix, iy; GLint isize, radius; + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLfloat dsize=psize*dist[i]; + GLubyte alpha; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); - dsize=psize*dist[i]; if (dsize >= ctx->Point.Threshold) { isize = (GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F); alpha = VB->ColorPtr->data[i][3]; @@ -899,7 +897,7 @@ static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, y1 = y0 + isize - 1; } - PB_SET_COLOR( ctx, PB, + PB_SET_COLOR( PB, VB->ColorPtr->data[i][0], VB->ColorPtr->data[i][1], VB->ColorPtr->data[i][2], @@ -918,15 +916,14 @@ static void dist_atten_general_rgba_points( GLcontext *ctx, GLuint first, /* * Distance Attenuated Textured RGBA points. */ -static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, - GLuint last ) +static void +dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLfloat psize,dsize; GLfloat dist[VB_SIZE]; - psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE); + const GLfloat psize = ctx->Point.Size; + GLuint i; if (ctx->NeedEyeCoords) (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); @@ -935,7 +932,6 @@ static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { - GLint x, y, z; GLint x0, x1, y0, y1; GLint ix, iy; GLint isize, radius; @@ -943,21 +939,22 @@ static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, GLfloat s, t, u; GLfloat s1, t1, u1; - x = (GLint) VB->Win.data[i][0]; - y = (GLint) VB->Win.data[i][1]; - z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); + GLint x = (GLint) VB->Win.data[i][0]; + GLint y = (GLint) VB->Win.data[i][1]; + GLint z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset); - dsize=psize*dist[i]; - if(dsize>=ctx->Point.Threshold) { - isize=(GLint) (MIN2(dsize,ctx->Point.MaxSize)+0.5F); - alpha=VB->ColorPtr->data[i][3]; - } else { - isize=(GLint) (MAX2(ctx->Point.Threshold,ctx->Point.MinSize)+0.5F); - dsize/=ctx->Point.Threshold; - alpha = (GLint) (VB->ColorPtr->data[i][3]* (dsize*dsize)); + GLfloat dsize = psize*dist[i]; + if(dsize >= ctx->Point.Threshold) { + isize = (GLint) (MIN2(dsize, ctx->Point.MaxSize) + 0.5F); + alpha = VB->ColorPtr->data[i][3]; + } + else { + isize = (GLint) (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) + 0.5F); + dsize /= ctx->Point.Threshold; + alpha = (GLint) (VB->ColorPtr->data[i][3] * (dsize * dsize)); } - if (isize<1) { + if (isize < 1) { isize = 1; } radius = isize >> 1; @@ -1066,16 +1063,14 @@ static void dist_atten_textured_rgba_points( GLcontext *ctx, GLuint first, /* * Distance Attenuated Antialiased points with or without texture mapping. */ -static void dist_atten_antialiased_rgba_points( GLcontext *ctx, - GLuint first, GLuint last ) +static void +dist_atten_antialiased_rgba_points( GLcontext *ctx, GLuint first, GLuint last ) { struct vertex_buffer *VB = ctx->VB; struct pixel_buffer *PB = ctx->PB; - GLuint i; - GLfloat radius, rmin, rmax, rmin2, rmax2, cscale; - GLfloat psize,dsize,alphaf; GLfloat dist[VB_SIZE]; - psize=CLAMP(ctx->Point.Size,MIN_POINT_SIZE,MAX_POINT_SIZE); + const GLfloat psize = ctx->Point.Size; + GLuint i; if (ctx->NeedEyeCoords) (eye_dist_tab[VB->EyePtr->size])( dist, first, last, ctx, VB->EyePtr ); @@ -1085,20 +1080,22 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, if (ctx->Texture.ReallyEnabled) { for (i=first;i<=last;i++) { if (VB->ClipMask[i]==0) { + GLfloat radius, rmin, rmax, rmin2, rmax2, cscale, alphaf; GLint xmin, ymin, xmax, ymax; GLint x, y, z; GLint red, green, blue, alpha; GLfloat s, t, u; GLfloat s1, t1, u1; + GLfloat dsize = psize * dist[i]; - dsize=psize*dist[i]; - if(dsize>=ctx->Point.Threshold) { - radius=(MIN2(dsize,ctx->Point.MaxSize)*0.5F); - alphaf=1.0; - } else { - radius=(MAX2(ctx->Point.Threshold,ctx->Point.MinSize)*0.5F); - dsize/=ctx->Point.Threshold; - alphaf=(dsize*dsize); + if (dsize >= ctx->Point.Threshold) { + radius = MIN2(dsize, ctx->Point.MaxSize) * 0.5F; + alphaf = 1.0F; + } + else { + radius = (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) * 0.5F); + dsize /= ctx->Point.Threshold; + alphaf = (dsize*dsize); } rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ rmax = radius + 0.7071F; @@ -1180,23 +1177,25 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, } } - for (y=ymin;y<=ymax;y++) { - for (x=xmin;x<=xmax;x++) { + for (y = ymin; y <= ymax; y++) { + for (x = xmin; x <= xmax; x++) { GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0]; GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1]; GLfloat dist2 = dx*dx + dy*dy; - if (dist2<rmax2) { + if (dist2 < rmax2) { alpha = VB->ColorPtr->data[i][3]; - if (dist2>=rmin2) { - GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale); + if (dist2 >= rmin2) { + GLint coverage = (GLint) (256.0F - (dist2 - rmin2) * cscale); /* coverage is in [0,256] */ alpha = (alpha * coverage) >> 8; } alpha = (GLint) (alpha * alphaf); if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) { - PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u, s1, t1, u1 ); + PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue, + alpha, s, t, u, s1, t1, u1 ); } else { - PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u ); + PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha, + s, t, u ); } } } @@ -1207,26 +1206,28 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, } else { /* Not texture mapped */ - for (i=first;i<=last;i++) { - if (VB->ClipMask[i]==0) { + for (i = first; i <= last; i++) { + if (VB->ClipMask[i] == 0) { + GLfloat radius, rmin, rmax, rmin2, rmax2, cscale, alphaf; GLint xmin, ymin, xmax, ymax; GLint x, y, z; GLint red, green, blue, alpha; + GLfloat dsize = psize * dist[i]; - dsize=psize*dist[i]; - if(dsize>=ctx->Point.Threshold) { - radius=(MIN2(dsize,ctx->Point.MaxSize)*0.5F); - alphaf=1.0; - } else { - radius=(MAX2(ctx->Point.Threshold,ctx->Point.MinSize)*0.5F); - dsize/=ctx->Point.Threshold; - alphaf=(dsize*dsize); + if (dsize >= ctx->Point.Threshold) { + radius = MIN2(dsize, ctx->Point.MaxSize) * 0.5F; + alphaf = 1.0F; + } + else { + radius = (MAX2(ctx->Point.Threshold, ctx->Point.MinSize) * 0.5F); + dsize /= ctx->Point.Threshold; + alphaf = dsize * dsize; } rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ rmax = radius + 0.7071F; - rmin2 = rmin*rmin; - rmax2 = rmax*rmax; - cscale = 256.0F / (rmax2-rmin2); + rmin2 = rmin * rmin; + rmax2 = rmax * rmax; + cscale = 256.0F / (rmax2 - rmin2); xmin = (GLint) (VB->Win.data[i][0] - radius); xmax = (GLint) (VB->Win.data[i][0] + radius); @@ -1238,21 +1239,20 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, green = VB->ColorPtr->data[i][1]; blue = VB->ColorPtr->data[i][2]; - for (y=ymin;y<=ymax;y++) { - for (x=xmin;x<=xmax;x++) { + for (y = ymin; y <= ymax; y++) { + for (x = xmin; x <= xmax; x++) { GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0]; GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1]; - GLfloat dist2 = dx*dx + dy*dy; - if (dist2<rmax2) { + GLfloat dist2 = dx * dx + dy * dy; + if (dist2 < rmax2) { alpha = VB->ColorPtr->data[i][3]; - if (dist2>=rmin2) { - GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale); + if (dist2 >= rmin2) { + GLint coverage = (GLint) (256.0F - (dist2 - rmin2) * cscale); /* coverage is in [0,256] */ alpha = (alpha * coverage) >> 8; } alpha = (GLint) (alpha * alphaf); - PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha ) - ; + PB_WRITE_RGBA_PIXEL(PB, x, y, z, red, green, blue, alpha); } } } @@ -1263,6 +1263,43 @@ static void dist_atten_antialiased_rgba_points( GLcontext *ctx, } +#ifdef DEBUG +void +_mesa_print_points_function(GLcontext *ctx) +{ + printf("Point Func == "); + if (ctx->Driver.PointsFunc == size1_ci_points) + printf("size1_ci_points\n"); + else if (ctx->Driver.PointsFunc == size1_rgba_points) + printf("size1_rgba_points\n"); + else if (ctx->Driver.PointsFunc == general_ci_points) + printf("general_ci_points\n"); + else if (ctx->Driver.PointsFunc == general_rgba_points) + printf("general_rgba_points\n"); + else if (ctx->Driver.PointsFunc == textured_rgba_points) + printf("textured_rgba_points\n"); + else if (ctx->Driver.PointsFunc == multitextured_rgba_points) + printf("multitextured_rgba_points\n"); + else if (ctx->Driver.PointsFunc == antialiased_rgba_points) + printf("antialiased_rgba_points\n"); + else if (ctx->Driver.PointsFunc == null_points) + printf("null_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_general_ci_points) + printf("dist_atten_general_ci_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_general_rgba_points) + printf("dist_atten_general_rgba_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_textured_rgba_points) + printf("dist_atten_textured_rgba_points\n"); + else if (ctx->Driver.PointsFunc == dist_atten_antialiased_rgba_points) + printf("dist_atten_antialiased_rgba_points\n"); + else if (!ctx->Driver.PointsFunc) + printf("NULL\n"); + else + printf("Driver func %p\n", ctx->Driver.PointsFunc); +} +#endif + + /* * Examine the current context to determine which point drawing function * should be used. @@ -1331,5 +1368,6 @@ void gl_set_point_function( GLcontext *ctx ) ctx->Driver.PointsFunc = gl_select_points; } + /*_mesa_print_points_function(ctx);*/ } diff --git a/xc/extras/Mesa/src/readpix.c b/xc/extras/Mesa/src/readpix.c index df5ca64ff..4f4ad90a3 100644 --- a/xc/extras/Mesa/src/readpix.c +++ b/xc/extras/Mesa/src/readpix.c @@ -508,7 +508,9 @@ read_fast_rgba_pixels( GLcontext *ctx, ctx->Pixel.ScaleOrBiasRGBApcm || ctx->Pixel.ColorTableEnabled || ctx->Pixel.PostColorMatrixColorTableEnabled || - ctx->Pixel.MinMaxEnabled; + ctx->Pixel.MinMaxEnabled || + ctx->Pixel.HistogramEnabled; + /* can't do scale, bias, mapping, etc */ if (applyTransferOps) return GL_FALSE; @@ -567,7 +569,7 @@ read_fast_rgba_pixels( GLcontext *ctx, for (row=0; row<readHeight; row++) { (*ctx->Driver.ReadRGBASpan)(ctx, readWidth, srcX, srcY, (GLubyte (*)[4]) dest); - if (ctx->ReadBuffer->UseSoftwareAlphaBuffers) { + if (ctx->DrawBuffer->UseSoftwareAlphaBuffers) { _mesa_read_alpha_span(ctx, readWidth, srcX, srcY, (GLubyte (*)[4]) dest); } diff --git a/xc/extras/Mesa/src/span.c b/xc/extras/Mesa/src/span.c index 653d0dc12..598834047 100644 --- a/xc/extras/Mesa/src/span.c +++ b/xc/extras/Mesa/src/span.c @@ -176,6 +176,7 @@ void gl_write_index_span( GLcontext *ctx, GLuint n, GLint x, GLint y, const GLdepth z[], GLuint indexIn[], GLenum primitive ) { + const GLuint modBits = FOG_BIT | BLEND_BIT | MASKING_BIT | LOGIC_OP_BIT; GLubyte mask[MAX_WIDTH]; GLuint indexBackup[MAX_WIDTH]; GLuint *index; /* points to indexIn or indexBackup */ @@ -189,7 +190,7 @@ void gl_write_index_span( GLcontext *ctx, } } - if ((primitive==GL_BITMAP && ctx->MutablePixels) + if ((primitive==GL_BITMAP && (ctx->RasterMask & modBits)) || (ctx->RasterMask & MULTI_DRAW_BIT)) { /* Make copy of color indexes */ MEMCPY( indexBackup, indexIn, n * sizeof(GLuint) ); @@ -421,6 +422,8 @@ void gl_write_rgba_span( GLcontext *ctx, GLubyte rgbaIn[][4], GLenum primitive ) { + const GLuint modBits = FOG_BIT | BLEND_BIT | MASKING_BIT | + LOGIC_OP_BIT | TEXTURE_BIT; GLubyte mask[MAX_WIDTH]; GLboolean write_all = GL_TRUE; GLubyte rgbaBackup[MAX_WIDTH][4]; @@ -437,7 +440,7 @@ void gl_write_rgba_span( GLcontext *ctx, write_all = GL_FALSE; } - if ((primitive==GL_BITMAP && ctx->MutablePixels) + if ((primitive==GL_BITMAP && (ctx->RasterMask & modBits)) || (ctx->RasterMask & MULTI_DRAW_BIT)) { /* must make a copy of the colors since they may be modified */ MEMCPY( rgbaBackup, rgbaIn, 4 * n * sizeof(GLubyte) ); diff --git a/xc/extras/Mesa/src/state.c b/xc/extras/Mesa/src/state.c index bb8452842..b678f1e91 100644 --- a/xc/extras/Mesa/src/state.c +++ b/xc/extras/Mesa/src/state.c @@ -98,20 +98,17 @@ generic_noop(void) } +/* + * Set all pointers in the given dispatch table to point to a + * generic no-op function. + */ void -_mesa_init_no_op_table(struct _glapi_table *table) +_mesa_init_no_op_table(struct _glapi_table *table, GLuint tableSize) { - /* Check to be sure the dispatcher's table is at least as big as Mesa's. */ - const GLuint size = sizeof(struct _glapi_table) / sizeof(void *); - assert(_glapi_get_dispatch_table_size() >= size); - - { - const GLuint n = _glapi_get_dispatch_table_size(); - GLuint i; - void **dispatch = (void **) table; - for (i = 0; i < n; i++) { - dispatch[i] = (void *) generic_noop; - } + GLuint i; + void **dispatch = (void **) table; + for (i = 0; i < tableSize; i++) { + dispatch[i] = (void *) generic_noop; } } @@ -121,10 +118,10 @@ _mesa_init_no_op_table(struct _glapi_table *table) * immediate-mode commands. */ void -_mesa_init_exec_table(struct _glapi_table *exec) +_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize) { /* first initialize all dispatch slots to no-op */ - _mesa_init_no_op_table(exec); + _mesa_init_no_op_table(exec, tableSize); /* load the dispatch slots we understand */ exec->Accum = _mesa_Accum; @@ -472,7 +469,6 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->TexImage3D = _mesa_TexImage3D; exec->TexSubImage3D = _mesa_TexSubImage3D; - /* OpenGL 1.2 GL_ARB_imaging */ exec->BlendColor = _mesa_BlendColor; exec->BlendEquation = _mesa_BlendEquation; @@ -509,26 +505,33 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->ResetMinmax = _mesa_ResetMinmax; exec->SeparableFilter2D = _mesa_SeparableFilter2D; - /* GL_EXT_texture3d */ + /* 2. GL_EXT_blend_color */ +#if 0 + exec->BlendColorEXT = _mesa_BlendColorEXT; +#endif + + /* 3. GL_EXT_polygon_offset */ + exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT; + + /* 6. GL_EXT_texture3d */ #if 0 exec->CopyTexSubImage3DEXT = _mesa_CopyTexSubImage3D; exec->TexImage3DEXT = _mesa_TexImage3DEXT; exec->TexSubImage3DEXT = _mesa_TexSubImage3D; #endif - /* GL_EXT_paletted_texture */ -#if 0 - exec->ColorTableEXT = _mesa_ColorTableEXT; - exec->ColorSubTableEXT = _mesa_ColorSubTableEXT; -#endif - exec->GetColorTableEXT = _mesa_GetColorTable; - exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; - exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; + /* 11. GL_EXT_histogram */ + exec->GetHistogramEXT = _mesa_GetHistogram; + exec->GetHistogramParameterfvEXT = _mesa_GetHistogramParameterfv; + exec->GetHistogramParameterivEXT = _mesa_GetHistogramParameteriv; + exec->GetMinmaxEXT = _mesa_GetMinmax; + exec->GetMinmaxParameterfvEXT = _mesa_GetMinmaxParameterfv; + exec->GetMinmaxParameterivEXT = _mesa_GetMinmaxParameteriv; - /* GL_SGIX_pixel_texture */ + /* ?. GL_SGIX_pixel_texture */ exec->PixelTexGenSGIX = _mesa_PixelTexGenSGIX; - /* GL_SGIS_pixel_texture */ + /* 15. GL_SGIS_pixel_texture */ exec->PixelTexGenParameteriSGIS = _mesa_PixelTexGenParameteriSGIS; exec->PixelTexGenParameterivSGIS = _mesa_PixelTexGenParameterivSGIS; exec->PixelTexGenParameterfSGIS = _mesa_PixelTexGenParameterfSGIS; @@ -536,31 +539,64 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->GetPixelTexGenParameterivSGIS = _mesa_GetPixelTexGenParameterivSGIS; exec->GetPixelTexGenParameterfvSGIS = _mesa_GetPixelTexGenParameterfvSGIS; - /* GL_EXT_compiled_vertex_array */ - exec->LockArraysEXT = _mesa_LockArraysEXT; - exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; + /* 37. GL_EXT_blend_minmax */ +#if 0 + exec->BlendEquationEXT = _mesa_BlendEquationEXT; +#endif - /* GL_EXT_point_parameters */ + /* 54. GL_EXT_point_parameters */ exec->PointParameterfEXT = _mesa_PointParameterfEXT; exec->PointParameterfvEXT = _mesa_PointParameterfvEXT; - /* GL_PGI_misc_hints */ + /* 77. GL_PGI_misc_hints */ exec->HintPGI = _mesa_HintPGI; - /* GL_EXT_polygon_offset */ - exec->PolygonOffsetEXT = _mesa_PolygonOffsetEXT; - - /* GL_EXT_blend_minmax */ + /* 78. GL_EXT_paletted_texture */ #if 0 - exec->BlendEquationEXT = _mesa_BlendEquationEXT; + exec->ColorTableEXT = _mesa_ColorTableEXT; + exec->ColorSubTableEXT = _mesa_ColorSubTableEXT; #endif + exec->GetColorTableEXT = _mesa_GetColorTable; + exec->GetColorTableParameterfvEXT = _mesa_GetColorTableParameterfv; + exec->GetColorTableParameterivEXT = _mesa_GetColorTableParameteriv; - /* GL_EXT_blend_color */ -#if 0 - exec->BlendColorEXT = _mesa_BlendColorEXT; -#endif + /* 97. GL_EXT_compiled_vertex_array */ + exec->LockArraysEXT = _mesa_LockArraysEXT; + exec->UnlockArraysEXT = _mesa_UnlockArraysEXT; + + /* 173. GL_INGR_blend_func_separate */ + exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT; + + /* 196. GL_MESA_resize_buffers */ + exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; + + /* 197. GL_MESA_window_pos */ + exec->WindowPos2dMESA = _mesa_WindowPos2dMESA; + exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA; + exec->WindowPos2fMESA = _mesa_WindowPos2fMESA; + exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA; + exec->WindowPos2iMESA = _mesa_WindowPos2iMESA; + exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA; + exec->WindowPos2sMESA = _mesa_WindowPos2sMESA; + exec->WindowPos2svMESA = _mesa_WindowPos2svMESA; + exec->WindowPos3dMESA = _mesa_WindowPos3dMESA; + exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA; + exec->WindowPos3fMESA = _mesa_WindowPos3fMESA; + exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA; + exec->WindowPos3iMESA = _mesa_WindowPos3iMESA; + exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA; + exec->WindowPos3sMESA = _mesa_WindowPos3sMESA; + exec->WindowPos3svMESA = _mesa_WindowPos3svMESA; + exec->WindowPos4dMESA = _mesa_WindowPos4dMESA; + exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA; + exec->WindowPos4fMESA = _mesa_WindowPos4fMESA; + exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA; + exec->WindowPos4iMESA = _mesa_WindowPos4iMESA; + exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA; + exec->WindowPos4sMESA = _mesa_WindowPos4sMESA; + exec->WindowPos4svMESA = _mesa_WindowPos4svMESA; - /* GL_ARB_multitexture */ + /* ARB 1. GL_ARB_multitexture */ exec->ActiveTextureARB = _mesa_ActiveTextureARB; exec->ClientActiveTextureARB = _mesa_ClientActiveTextureARB; exec->MultiTexCoord1dARB = _mesa_MultiTexCoord1dARB; @@ -596,46 +632,25 @@ _mesa_init_exec_table(struct _glapi_table *exec) exec->MultiTexCoord4sARB = _mesa_MultiTexCoord4sARB; exec->MultiTexCoord4svARB = _mesa_MultiTexCoord4svARB; - /* GL_INGR_blend_func_separate */ - exec->BlendFuncSeparateEXT = _mesa_BlendFuncSeparateEXT; - - /* GL_MESA_window_pos */ - exec->WindowPos2dMESA = _mesa_WindowPos2dMESA; - exec->WindowPos2dvMESA = _mesa_WindowPos2dvMESA; - exec->WindowPos2fMESA = _mesa_WindowPos2fMESA; - exec->WindowPos2fvMESA = _mesa_WindowPos2fvMESA; - exec->WindowPos2iMESA = _mesa_WindowPos2iMESA; - exec->WindowPos2ivMESA = _mesa_WindowPos2ivMESA; - exec->WindowPos2sMESA = _mesa_WindowPos2sMESA; - exec->WindowPos2svMESA = _mesa_WindowPos2svMESA; - exec->WindowPos3dMESA = _mesa_WindowPos3dMESA; - exec->WindowPos3dvMESA = _mesa_WindowPos3dvMESA; - exec->WindowPos3fMESA = _mesa_WindowPos3fMESA; - exec->WindowPos3fvMESA = _mesa_WindowPos3fvMESA; - exec->WindowPos3iMESA = _mesa_WindowPos3iMESA; - exec->WindowPos3ivMESA = _mesa_WindowPos3ivMESA; - exec->WindowPos3sMESA = _mesa_WindowPos3sMESA; - exec->WindowPos3svMESA = _mesa_WindowPos3svMESA; - exec->WindowPos4dMESA = _mesa_WindowPos4dMESA; - exec->WindowPos4dvMESA = _mesa_WindowPos4dvMESA; - exec->WindowPos4fMESA = _mesa_WindowPos4fMESA; - exec->WindowPos4fvMESA = _mesa_WindowPos4fvMESA; - exec->WindowPos4iMESA = _mesa_WindowPos4iMESA; - exec->WindowPos4ivMESA = _mesa_WindowPos4ivMESA; - exec->WindowPos4sMESA = _mesa_WindowPos4sMESA; - exec->WindowPos4svMESA = _mesa_WindowPos4svMESA; - - /* GL_MESA_resize_buffers */ - exec->ResizeBuffersMESA = _mesa_ResizeBuffersMESA; - - /* GL_ARB_transpose_matrix */ + /* ARB 3. GL_ARB_transpose_matrix */ exec->LoadTransposeMatrixdARB = _mesa_LoadTransposeMatrixdARB; exec->LoadTransposeMatrixfARB = _mesa_LoadTransposeMatrixfARB; exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB; exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB; + + /* ARB 12. GL_ARB_texture_compression */ + exec->CompressedTexImage3DARB = _mesa_CompressedTexImage3DARB; + exec->CompressedTexImage2DARB = _mesa_CompressedTexImage2DARB; + exec->CompressedTexImage1DARB = _mesa_CompressedTexImage1DARB; + exec->CompressedTexSubImage3DARB = _mesa_CompressedTexSubImage3DARB; + exec->CompressedTexSubImage2DARB = _mesa_CompressedTexSubImage2DARB; + exec->CompressedTexSubImage1DARB = _mesa_CompressedTexSubImage1DARB; + exec->GetCompressedTexImageARB = _mesa_GetCompressedTexImageARB; + } + /**********************************************************************/ /***** State update logic *****/ /**********************************************************************/ @@ -790,6 +805,7 @@ static void update_rasterflags( GLcontext *ctx ) if (ctx->Scissor.Enabled) ctx->RasterMask |= SCISSOR_BIT; if (ctx->Stencil.Enabled) ctx->RasterMask |= STENCIL_BIT; if (ctx->Color.SWmasking) ctx->RasterMask |= MASKING_BIT; + if (ctx->Texture.ReallyEnabled) ctx->RasterMask |= TEXTURE_BIT; if (ctx->DrawBuffer->UseSoftwareAlphaBuffers && ctx->Color.ColorMask[ACOMP] @@ -914,8 +930,7 @@ void gl_update_state( GLcontext *ctx ) ctx->Enabled &= ~(ENABLE_TEXMAT0|ENABLE_TEXMAT1); for (i=0; i < MAX_TEXTURE_UNITS; i++) { - if (ctx->TextureMatrix[i].flags & MAT_DIRTY_ALL_OVER) - { + if (ctx->TextureMatrix[i].flags & MAT_DIRTY_ALL_OVER) { gl_matrix_analyze( &ctx->TextureMatrix[i] ); ctx->TextureMatrix[i].flags &= ~MAT_DIRTY_DEPENDENTS; @@ -929,7 +944,7 @@ void gl_update_state( GLcontext *ctx ) if (ctx->NewState & (NEW_TEXTURING | NEW_TEXTURE_ENABLE)) { ctx->Texture.NeedNormals = GL_FALSE; gl_update_dirty_texobjs(ctx); - ctx->Enabled &= ~(ENABLE_TEXGEN0|ENABLE_TEXGEN1); + ctx->Enabled &= ~(ENABLE_TEXGEN0 | ENABLE_TEXGEN1); ctx->Texture.ReallyEnabled = 0; for (i=0; i < MAX_TEXTURE_UNITS; i++) { @@ -937,19 +952,17 @@ void gl_update_state( GLcontext *ctx ) gl_update_texture_unit( ctx, &ctx->Texture.Unit[i] ); ctx->Texture.ReallyEnabled |= - ctx->Texture.Unit[i].ReallyEnabled<<(i*4); + ctx->Texture.Unit[i].ReallyEnabled << (i * 4); if (ctx->Texture.Unit[i].GenFlags != 0) { ctx->Enabled |= ENABLE_TEXGEN0 << i; - if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_NORMALS) - { + if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_NORMALS) { ctx->Texture.NeedNormals = GL_TRUE; ctx->Texture.NeedEyeCoords = GL_TRUE; } - if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_EYE_COORD) - { + if (ctx->Texture.Unit[i].GenFlags & TEXGEN_NEED_EYE_COORD) { ctx->Texture.NeedEyeCoords = GL_TRUE; } } @@ -960,10 +973,9 @@ void gl_update_state( GLcontext *ctx ) ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals); } - if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING | NEW_FOG)) { + if (ctx->NewState & (NEW_RASTER_OPS | NEW_LIGHTING | NEW_FOG | NEW_TEXTURE_ENABLE)) { - - if (ctx->NewState & NEW_RASTER_OPS) { + if (ctx->NewState & (NEW_RASTER_OPS | NEW_TEXTURE_ENABLE)) { update_pixel_logic(ctx); update_pixel_masking(ctx); update_fog_mode(ctx); @@ -972,20 +984,7 @@ void gl_update_state( GLcontext *ctx ) (*ctx->Driver.Dither)( ctx, ctx->Color.DitherFlag ); } - /* Check if incoming colors can be modified during rasterization */ - if (ctx->Fog.Enabled || - ctx->Texture.Enabled || - ctx->Color.BlendEnabled || - ctx->Color.SWmasking || - ctx->Color.SWLogicOpEnabled) { - ctx->MutablePixels = GL_TRUE; - } - else { - ctx->MutablePixels = GL_FALSE; - } - /* update scissor region */ - ctx->DrawBuffer->Xmin = 0; ctx->DrawBuffer->Ymin = 0; ctx->DrawBuffer->Xmax = ctx->DrawBuffer->Width-1; diff --git a/xc/extras/Mesa/src/state.h b/xc/extras/Mesa/src/state.h index 1c1c29a6f..3b12f5dcc 100644 --- a/xc/extras/Mesa/src/state.h +++ b/xc/extras/Mesa/src/state.h @@ -30,6 +30,13 @@ #include "types.h" +extern void +_mesa_init_no_op_table(struct _glapi_table *exec, GLuint tableSize); + +extern void +_mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize); + + extern void gl_update_state( GLcontext *ctx ); diff --git a/xc/extras/Mesa/src/teximage.c b/xc/extras/Mesa/src/teximage.c index 7248cbad9..0d25df6d8 100644 --- a/xc/extras/Mesa/src/teximage.c +++ b/xc/extras/Mesa/src/teximage.c @@ -49,6 +49,57 @@ */ +#ifdef DEBUG +static void PrintTexture(const struct gl_texture_image *img) +{ + int i, j, c; + GLubyte *data = img->Data; + + if (!data) { + printf("No texture data\n"); + return; + } + + switch (img->Format) { + case GL_ALPHA: + case GL_LUMINANCE: + case GL_INTENSITY: + case GL_COLOR_INDEX: + c = 1; + break; + case GL_LUMINANCE_ALPHA: + c = 2; + break; + case GL_RGB: + c = 3; + break; + case GL_RGBA: + c = 4; + break; + default: + gl_problem(NULL, "error in PrintTexture\n"); + return; + } + + + for (i = 0; i < img->Height; i++) { + for (j = 0; j < img->Width; j++) { + if (c==1) + printf("%02x ", data[0]); + else if (c==2) + printf("%02x%02x ", data[0], data[1]); + else if (c==3) + printf("%02x%02x%02x ", data[0], data[1], data[2]); + else if (c==4) + printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); + data += c; + } + printf("\n"); + } +} +#endif + + /* * Compute log base 2 of n. @@ -85,16 +136,24 @@ logbase2( int n ) * GL_LUMANCE_ALPHA, GL_INTENSITY, GL_RGB, or GL_RGBA. * Return -1 if invalid enum. */ -static GLint -decode_internal_format( GLint format ) +GLint +_mesa_base_tex_format( GLcontext *ctx, GLint format ) { switch (format) { + case GL_COMPRESSED_ALPHA_ARB: + if (ctx && !ctx->Extensions.HaveTextureCompression) + return -1; + /* fall-through */ case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: return GL_ALPHA; + case GL_COMPRESSED_LUMINANCE_ARB: + if (ctx && !ctx->Extensions.HaveTextureCompression) + return -1; + /* fall-through */ case 1: case GL_LUMINANCE: case GL_LUMINANCE4: @@ -102,6 +161,10 @@ decode_internal_format( GLint format ) case GL_LUMINANCE12: case GL_LUMINANCE16: return GL_LUMINANCE; + case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: + if (ctx && !ctx->Extensions.HaveTextureCompression) + return -1; + /* fall-through */ case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: @@ -111,12 +174,31 @@ decode_internal_format( GLint format ) case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: return GL_LUMINANCE_ALPHA; + case GL_COMPRESSED_INTENSITY_ARB: + if (ctx && !ctx->Extensions.HaveTextureCompression) + return -1; + /* fall-through */ case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: return GL_INTENSITY; + case GL_COMPRESSED_RGB_ARB: + if (ctx && ctx->Extensions.HaveTextureCompression) + return GL_RGB; + else + return -1; + case GL_COMPRESSED_RGB_FXT1_3DFX: + if (ctx && ctx->Extensions.HaveTextureCompressionFXT1) + return GL_RGB; + else + return -1; + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + if (ctx && ctx->Extensions.HaveTextureCompressionS3TC) + return GL_RGB; + else + return -1; case 3: case GL_RGB: case GL_R3_G3_B2: @@ -127,6 +209,23 @@ decode_internal_format( GLint format ) case GL_RGB12: case GL_RGB16: return GL_RGB; + case GL_COMPRESSED_RGBA_ARB: + if (ctx && ctx->Extensions.HaveTextureCompression) + return GL_RGBA; + else + return -1; + case GL_COMPRESSED_RGBA_FXT1_3DFX: + if (ctx && ctx->Extensions.HaveTextureCompressionFXT1) + return GL_RGBA; + else + return -1; + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + if (ctx && ctx->Extensions.HaveTextureCompressionS3TC) + return GL_RGBA; + else + return -1; case 4: case GL_RGBA: case GL_RGBA2: @@ -224,23 +323,30 @@ components_in_intformat( GLint format ) } - -struct gl_texture_image * -gl_alloc_texture_image( void ) -{ - return CALLOC_STRUCT(gl_texture_image); -} - - - -void -gl_free_texture_image( struct gl_texture_image *teximage ) +/* + * Return GL_TRUE if internalFormat is a compressed format, return GL_FALSE + * otherwise. + */ +static GLboolean +is_compressed_format(GLenum internalFormat) { - if (teximage->Data) { - FREE( teximage->Data ); - teximage->Data = NULL; + switch (internalFormat) { + case GL_COMPRESSED_ALPHA_ARB: + case GL_COMPRESSED_LUMINANCE_ARB: + case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: + case GL_COMPRESSED_INTENSITY_ARB: + case GL_COMPRESSED_RGB_ARB: + case GL_COMPRESSED_RGBA_ARB: + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + case GL_COMPRESSED_RGB_FXT1_3DFX: + case GL_COMPRESSED_RGBA_FXT1_3DFX: + return GL_TRUE; + default: + return GL_FALSE; } - FREE( teximage ); } @@ -354,6 +460,217 @@ set_teximage_component_sizes( struct gl_texture_image *texImage ) } +static void +set_tex_image(struct gl_texture_object *tObj, + GLenum target, GLint level, + struct gl_texture_image *texImage) +{ + ASSERT(tObj); + ASSERT(texImage); + switch (target) { + case GL_TEXTURE_2D: + tObj->Image[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + tObj->Image[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + tObj->NegX[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + tObj->PosY[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + tObj->NegY[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + tObj->PosZ[level] = texImage; + return; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + tObj->NegZ[level] = texImage; + return; + default: + gl_problem(NULL, "bad target in set_tex_image()"); + return; + } +} + + +/* + * Return new gl_texture_image struct with all fields initialized to zero. + */ +struct gl_texture_image * +_mesa_alloc_texture_image( void ) +{ + return CALLOC_STRUCT(gl_texture_image); +} + + + +/* + * Initialize most fields of a gl_texture_image struct. + */ +static void +init_texture_image( struct gl_texture_image *img, + GLsizei width, GLsizei height, GLsizei depth, + GLint border, GLenum internalFormat ) +{ + ASSERT(img); + ASSERT(!img->Data); + img->Format = (GLenum) _mesa_base_tex_format(NULL, internalFormat); + set_teximage_component_sizes( img ); + img->IntFormat = (GLenum) internalFormat; + img->Border = border; + img->Width = width; + img->Height = height; + img->Depth = depth; + img->WidthLog2 = logbase2(width - 2 * border); + if (height == 1) /* 1-D texture */ + img->HeightLog2 = 0; + else + img->HeightLog2 = logbase2(height - 2 * border); + if (depth == 1) /* 2-D texture */ + img->DepthLog2 = 0; + else + img->DepthLog2 = logbase2(depth - 2 * border); + img->Width2 = 1 << img->WidthLog2; + img->Height2 = 1 << img->HeightLog2; + img->Depth2 = 1 << img->DepthLog2; + img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); + img->IsCompressed = is_compressed_format(internalFormat); +} + + + +void +_mesa_free_texture_image( struct gl_texture_image *teximage ) +{ + if (teximage->Data) { + FREE( teximage->Data ); + teximage->Data = NULL; + } + FREE( teximage ); +} + + + +/* + * Return number of bytes of storage needed to store a compressed texture + * image. + */ +GLuint +_mesa_compressed_image_size(GLenum internalFormat, + GLint width, GLint height, GLint depth) +{ + return 0; +} + + + +/* + * Given a texture unit and a texture target, return the corresponding + * texture object. + */ +struct gl_texture_object * +_mesa_select_tex_object(GLcontext *ctx, struct gl_texture_unit *texUnit, + GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + return texUnit->CurrentD[1]; + case GL_PROXY_TEXTURE_1D: + return ctx->Texture.Proxy1D; + case GL_TEXTURE_2D: + return texUnit->CurrentD[2]; + case GL_PROXY_TEXTURE_2D: + return ctx->Texture.Proxy2D; + case GL_TEXTURE_3D: + return texUnit->CurrentD[3]; + case GL_PROXY_TEXTURE_3D: + return ctx->Texture.Proxy3D; + 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: + return ctx->Extensions.HaveTextureCubeMap + ? texUnit->CurrentCubeMap : NULL; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + return ctx->Extensions.HaveTextureCubeMap + ? ctx->Texture.ProxyCubeMap : NULL; + default: + gl_problem(NULL, "bad target in _mesa_select_tex_object()"); + return NULL; + } +} + + +/* + * Return the texture image struct which corresponds to target and level + * for the given texture unit. + */ +struct gl_texture_image * +_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target, GLint level) +{ + ASSERT(texUnit); + switch (target) { + case GL_TEXTURE_1D: + return texUnit->CurrentD[1]->Image[level]; + case GL_PROXY_TEXTURE_1D: + return ctx->Texture.Proxy1D->Image[level]; + case GL_TEXTURE_2D: + return texUnit->CurrentD[2]->Image[level]; + case GL_PROXY_TEXTURE_2D: + return ctx->Texture.Proxy2D->Image[level]; + case GL_TEXTURE_3D: + return texUnit->CurrentD[3]->Image[level]; + case GL_PROXY_TEXTURE_3D: + return ctx->Texture.Proxy3D->Image[level]; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->Image[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->NegX[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->PosY[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->NegY[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->PosZ[level]; + else + return NULL; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return texUnit->CurrentCubeMap->NegZ[level]; + else + return NULL; + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) + return ctx->Texture.ProxyCubeMap->Image[level]; + else + return NULL; + default: + gl_problem(ctx, "bad target in _mesa_select_tex_image()"); + return NULL; + } +} + + + /* Need this to prevent an out-of-bounds memory access when using * X86 optimized code. */ @@ -366,68 +683,45 @@ set_teximage_component_sizes( struct gl_texture_image *texImage ) /* - * This is called by glTexImage[123]D in order to build a gl_texture_image - * object given the client's parameters and image data. - * - * NOTES: Width, height and depth should include the border. - * All texture image parameters should have already been error checked. + * Called by glTexImage[123]D. Fill in a texture image with data given + * by the client. All pixel transfer and unpack modes are handled here. + * NOTE: All texture image parameters should have already been error checked. */ -static struct gl_texture_image * -make_texture_image( GLcontext *ctx, GLint internalFormat, - GLint width, GLint height, GLint depth, GLint border, +static void +make_texture_image( GLcontext *ctx, + struct gl_texture_image *texImage, GLenum srcFormat, GLenum srcType, const GLvoid *pixels, const struct gl_pixelstore_attrib *unpacking) { GLint components, numPixels; - struct gl_texture_image *texImage; - - assert(width > 0); - assert(height > 0); - assert(depth > 0); - assert(border == 0 || border == 1); - assert(pixels); - assert(unpacking); - - - /* - * Allocate and initialize the texture_image struct - */ - texImage = gl_alloc_texture_image(); - if (!texImage) - return NULL; - - texImage->Format = (GLenum) decode_internal_format(internalFormat); - set_teximage_component_sizes( texImage ); - texImage->IntFormat = (GLenum) internalFormat; - texImage->Border = border; - texImage->Width = width; - texImage->Height = height; - texImage->Depth = depth; - texImage->WidthLog2 = logbase2(width - 2 * border); - if (height == 1) /* 1-D texture */ - texImage->HeightLog2 = 0; - else - texImage->HeightLog2 = logbase2(height - 2 * border); - if (depth == 1) /* 2-D texture */ - texImage->DepthLog2 = 0; - else - texImage->DepthLog2 = logbase2(depth - 2 * border); - texImage->Width2 = 1 << texImage->WidthLog2; - texImage->Height2 = 1 << texImage->HeightLog2; - texImage->Depth2 = 1 << texImage->DepthLog2; - texImage->MaxLog2 = MAX2(texImage->WidthLog2, texImage->HeightLog2); - + GLint internalFormat, width, height, depth, border; + + ASSERT(ctx); + ASSERT(texImage); + ASSERT(!texImage->Data); + ASSERT(pixels); + ASSERT(unpacking); + + internalFormat = texImage->IntFormat; + width = texImage->Width; + height = texImage->Height; + depth = texImage->Depth; + border = texImage->Border; components = components_in_intformat(internalFormat); - numPixels = texImage->Width * texImage->Height * texImage->Depth; - texImage->Data = (GLubyte *) MALLOC(numPixels * components + EXTRA_BYTE); + ASSERT(width > 0); + ASSERT(height > 0); + ASSERT(depth > 0); + ASSERT(border == 0 || border == 1); + ASSERT(pixels); + ASSERT(unpacking); + ASSERT(components); - if (!texImage->Data) { - /* out of memory */ - gl_free_texture_image(texImage); - return NULL; - } + numPixels = width * height * depth; + texImage->Data = (GLubyte *) MALLOC(numPixels * components + EXTRA_BYTE); + if (!texImage->Data) + return; /* out of memory */ /* * OK, the texture image struct has been initialized and the texture @@ -441,15 +735,18 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, && !ctx->Pixel.IndexOffset && !ctx->Pixel.IndexShift && srcType == GL_UNSIGNED_BYTE && depth == 1) { - if (srcFormat == internalFormat) { + if (srcFormat == internalFormat || + (srcFormat == GL_LUMINANCE && internalFormat == 1) || + (srcFormat == GL_LUMINANCE_ALPHA && internalFormat == 2) || + (srcFormat == GL_RGB && internalFormat == 3) || + (srcFormat == GL_RGBA && internalFormat == 4)) { /* This will cover the common GL_RGB, GL_RGBA, GL_ALPHA, * GL_LUMINANCE_ALPHA, etc. texture formats. */ - const GLubyte *src = gl_pixel_addr_in_image(unpacking, - pixels, width, height, srcFormat, srcType, 0, 0, 0); - const GLubyte *src1 = gl_pixel_addr_in_image(unpacking, - pixels, width, height, srcFormat, srcType, 0, 1, 0); - const GLint srcStride = src1 - src; + const GLubyte *src = (const GLubyte *) _mesa_image_address( + unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0); + const GLint srcStride = _mesa_image_row_stride(unpacking, width, + srcFormat, srcType); GLubyte *dst = texImage->Data; GLint dstBytesPerRow = width * components * sizeof(GLubyte); if (srcStride == dstBytesPerRow) { @@ -463,15 +760,14 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, dst += dstBytesPerRow; } } - return texImage; /* all done */ + return; /* all done */ } else if (srcFormat == GL_RGBA && internalFormat == GL_RGB) { /* commonly used by Quake */ - const GLubyte *src = gl_pixel_addr_in_image(unpacking, - pixels, width, height, srcFormat, srcType, 0, 0, 0); - const GLubyte *src1 = gl_pixel_addr_in_image(unpacking, - pixels, width, height, srcFormat, srcType, 0, 1, 0); - const GLint srcStride = src1 - src; + const GLubyte *src = (const GLubyte *) _mesa_image_address( + unpacking, pixels, width, height, srcFormat, srcType, 0, 0, 0); + const GLint srcStride = _mesa_image_row_stride(unpacking, width, + srcFormat, srcType); GLubyte *dst = texImage->Data; GLint i, j; for (i = 0; i < height; i++) { @@ -484,7 +780,7 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, } src += srcStride; } - return texImage; /* all done */ + return; /* all done */ } } @@ -500,7 +796,7 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, GLint img, row; for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { - const GLvoid *source = gl_pixel_addr_in_image(unpacking, + const GLvoid *source = _mesa_image_address(unpacking, pixels, width, height, srcFormat, srcType, img, row, 0); _mesa_unpack_index_span(ctx, width, dstType, dest, srcType, source, unpacking, GL_TRUE); @@ -516,7 +812,7 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, GLint img, row; for (img = 0; img < depth; img++) { for (row = 0; row < height; row++) { - const GLvoid *source = gl_pixel_addr_in_image(unpacking, + const GLvoid *source = _mesa_image_address(unpacking, pixels, width, height, srcFormat, srcType, img, row, 0); _mesa_unpack_ubyte_color_span(ctx, width, dstFormat, dest, srcFormat, srcType, source, unpacking, GL_TRUE); @@ -524,8 +820,6 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, } } } - - return texImage; /* All done! */ } @@ -533,48 +827,19 @@ make_texture_image( GLcontext *ctx, GLint internalFormat, /* * glTexImage[123]D can accept a NULL image pointer. In this case we * create a texture image with unspecified image contents per the OpenGL - * spec. + * spec. This function creates an empty image for the given texture image. */ -static struct gl_texture_image * -make_null_texture( GLcontext *ctx, GLenum internalFormat, - GLsizei width, GLsizei height, GLsizei depth, GLint border ) +static void +make_null_texture( struct gl_texture_image *texImage ) { GLint components; - struct gl_texture_image *texImage; GLint numPixels; - (void) ctx; - - /*internalFormat = decode_internal_format(internalFormat);*/ - components = components_in_intformat(internalFormat); - numPixels = width * height * depth; - texImage = gl_alloc_texture_image(); - if (!texImage) - return NULL; - - texImage->Format = (GLenum) decode_internal_format(internalFormat); - set_teximage_component_sizes( texImage ); - texImage->IntFormat = internalFormat; - texImage->Border = border; - texImage->Width = width; - texImage->Height = height; - texImage->Depth = depth; - texImage->WidthLog2 = logbase2(width - 2*border); - if (height==1) /* 1-D texture */ - texImage->HeightLog2 = 0; - else - texImage->HeightLog2 = logbase2(height - 2*border); - if (depth==1) /* 2-D texture */ - texImage->DepthLog2 = 0; - else - texImage->DepthLog2 = logbase2(depth - 2*border); - texImage->Width2 = 1 << texImage->WidthLog2; - texImage->Height2 = 1 << texImage->HeightLog2; - texImage->Depth2 = 1 << texImage->DepthLog2; - texImage->MaxLog2 = MAX2( texImage->WidthLog2, texImage->HeightLog2 ); + ASSERT(texImage); + ASSERT(!texImage->Data); - /* XXX should we really allocate memory for the image or let it be NULL? */ - /*texImage->Data = NULL;*/ + components = components_in_intformat(texImage->IntFormat); + numPixels = texImage->Width * texImage->Height * texImage->Depth; texImage->Data = (GLubyte *) MALLOC( numPixels * components + EXTRA_BYTE ); @@ -597,9 +862,9 @@ make_null_texture( GLcontext *ctx, GLenum internalFormat, GLubyte *imgPtr = texImage->Data; GLint i, j, k; - for (i=0;i<height;i++) { + for (i = 0; i < texImage->Height; i++) { GLint srcRow = 7 - i % 8; - for (j=0;j<width;j++) { + for (j = 0; j < texImage->Width; j++) { GLint srcCol = j % 32; GLint texel = (message[srcRow][srcCol]=='X') ? 255 : 70; for (k=0;k<components;k++) { @@ -608,8 +873,6 @@ make_null_texture( GLcontext *ctx, GLenum internalFormat, } } } - - return texImage; } @@ -640,7 +903,10 @@ texture_error_check( GLcontext *ctx, GLenum target, } else if (dimensions == 2) { isProxy = (GLboolean) (target == GL_PROXY_TEXTURE_2D); - if (target != GL_TEXTURE_2D && !isProxy) { + if (target != GL_TEXTURE_2D && !isProxy && + !(ctx->Extensions.HaveTextureCubeMap && + target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { gl_error( ctx, GL_INVALID_ENUM, "glTexImage2D(target)" ); return GL_TRUE; } @@ -658,7 +924,7 @@ texture_error_check( GLcontext *ctx, GLenum target, } /* Border */ - if (border!=0 && border!=1) { + if (border != 0 && border != 1) { if (!isProxy) { char message[100]; sprintf(message, "glTexImage%dD(border)", dimensions); @@ -691,6 +957,17 @@ texture_error_check( GLcontext *ctx, GLenum target, } } + /* For cube map, width must equal height */ + if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + if (width != height) { + if (!isProxy) { + gl_error(ctx, GL_INVALID_VALUE, "glTexImage2D(width != height)"); + } + return GL_TRUE; + } + } + /* Depth */ if (dimensions >= 3) { if (depth < 2 * border || depth > 2 + ctx->Const.MaxTextureSize @@ -703,7 +980,7 @@ texture_error_check( GLcontext *ctx, GLenum target, } /* Level */ - if (level<0 || level>=ctx->Const.MaxTextureLevels) { + if (level < 0 || level >= ctx->Const.MaxTextureLevels) { if (!isProxy) { char message[100]; sprintf(message, "glTexImage%dD(level)", dimensions); @@ -712,7 +989,7 @@ texture_error_check( GLcontext *ctx, GLenum target, return GL_TRUE; } - iformat = decode_internal_format( internalFormat ); + iformat = _mesa_base_tex_format( ctx, internalFormat ); if (iformat < 0) { if (!isProxy) { char message[100]; @@ -722,16 +999,18 @@ texture_error_check( GLcontext *ctx, GLenum target, return GL_TRUE; } - if (!gl_is_legal_format_and_type( format, type )) { - /* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there - * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4. - */ - if (!isProxy) { - char message[100]; - sprintf(message, "glTexImage%dD(format or type)", dimensions); - gl_error(ctx, GL_INVALID_OPERATION, message); + if (!is_compressed_format(internalFormat)) { + if (!_mesa_is_legal_format_and_type( format, type )) { + /* Yes, generate GL_INVALID_OPERATION, not GL_INVALID_ENUM, if there + * is a type/format mismatch. See 1.2 spec page 94, sec 3.6.4. + */ + if (!isProxy) { + char message[100]; + sprintf(message, "glTexImage%dD(format or type)", dimensions); + gl_error(ctx, GL_INVALID_OPERATION, message); + } + return GL_TRUE; } - return GL_TRUE; } /* if we get here, the parameters are OK */ @@ -763,7 +1042,15 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, } } else if (dimensions == 2) { - if (target != GL_TEXTURE_2D) { + if (ctx->Extensions.HaveTextureCubeMap) { + if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || + target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && + target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (target != GL_TEXTURE_2D) { gl_error( ctx, GL_INVALID_ENUM, "glTexSubImage2D(target)" ); return GL_TRUE; } @@ -838,11 +1125,13 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, } } - if (!gl_is_legal_format_and_type(format, type)) { - char message[100]; - sprintf(message, "glTexSubImage%dD(format or type)", dimensions); - gl_error(ctx, GL_INVALID_ENUM, message); - return GL_TRUE; + if (!is_compressed_format(destTex->IntFormat)) { + if (!_mesa_is_legal_format_and_type(format, type)) { + char message[100]; + sprintf(message, "glTexSubImage%dD(format or type)", dimensions); + gl_error(ctx, GL_INVALID_ENUM, message); + return GL_TRUE; + } } return GL_FALSE; @@ -861,18 +1150,25 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, { GLint iformat; - if (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1/2D(target)" ); - return GL_TRUE; - } - - if (dimensions == 1 && target != GL_TEXTURE_1D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1D(target)" ); - return GL_TRUE; + if (dimensions == 1) { + if (target != GL_TEXTURE_1D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage1D(target)" ); + return GL_TRUE; + } } - else if (dimensions == 2 && target != GL_TEXTURE_2D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); - return GL_TRUE; + else if (dimensions == 2) { + if (ctx->Extensions.HaveTextureCubeMap) { + if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || + target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && + target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); + return GL_TRUE; + } + } + else if (target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexImage2D(target)" ); + return GL_TRUE; + } } /* Border */ @@ -903,6 +1199,15 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, } } + /* For cube map, width must equal height */ + if (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) { + if (width != height) { + gl_error(ctx, GL_INVALID_VALUE, "glCopyTexImage2D(width != height)"); + return GL_TRUE; + } + } + /* Level */ if (level<0 || level>=ctx->Const.MaxTextureLevels) { char message[100]; @@ -911,7 +1216,7 @@ copytexture_error_check( GLcontext *ctx, GLuint dimensions, return GL_TRUE; } - iformat = decode_internal_format( internalFormat ); + iformat = _mesa_base_tex_format( ctx, internalFormat ); if (iformat < 0) { char message[100]; sprintf(message, "glCopyTexImage%dD(internalFormat)", dimensions); @@ -933,17 +1238,31 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; struct gl_texture_image *teximage; - if (dimensions == 1 && target != GL_TEXTURE_1D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage1D(target)" ); - return GL_TRUE; + if (dimensions == 1) { + if (target != GL_TEXTURE_1D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage1D(target)" ); + return GL_TRUE; + } } - else if (dimensions == 2 && target != GL_TEXTURE_2D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); - return GL_TRUE; + else if (dimensions == 2) { + if (ctx->Extensions.HaveTextureCubeMap) { + if ((target < GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB || + target > GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB) && + target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); + return GL_TRUE; + } + } + else if (target != GL_TEXTURE_2D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage2D(target)" ); + return GL_TRUE; + } } - else if (dimensions == 3 && target != GL_TEXTURE_3D) { - gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage3D(target)" ); - return GL_TRUE; + else if (dimensions == 3) { + if (target != GL_TEXTURE_3D) { + gl_error( ctx, GL_INVALID_ENUM, "glCopyTexSubImage3D(target)" ); + return GL_TRUE; + } } if (level < 0 || level >= ctx->Const.MaxTextureLevels) { @@ -1028,66 +1347,100 @@ copytexsubimage_error_check( GLcontext *ctx, GLuint dimensions, * Called from the API. Note that width includes the border. */ void -_mesa_TexImage1D( GLenum target, GLint level, GLint internalformat, +_mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage1D"); if (target==GL_TEXTURE_1D) { - struct gl_texture_image *teximage; - if (texture_error_check( ctx, target, level, internalformat, - format, type, 1, width, 1, 1, border )) { - /* error in texture image was detected */ - return; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 1, width, 1, 1, border)) { + return; /* error in texture image was detected */ } - /* free current texture image, if any */ - if (texUnit->CurrentD[1]->Image[level]) { - gl_free_texture_image( texUnit->CurrentD[1]->Image[level] ); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[1]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; } - /* make new texture from source image */ + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, 1, 1, border, internalFormat); + + /* process the texture image */ if (pixels) { - teximage = make_texture_image(ctx, internalformat, width, 1, 1, - border, format, type, pixels, &ctx->Unpack); + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexImage1D) { + /* let device driver try to use raw image */ + success = (*ctx->Driver.TexImage1D)( ctx, target, level, format, + type, pixels, &ctx->Unpack, + texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + make_texture_image(ctx, texImage, format, type, + pixels, &ctx->Unpack); + if (!success && ctx->Driver.TexImage1D) { + /* let device driver try to use unpacked image */ + (*ctx->Driver.TexImage1D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } } else { - teximage = make_null_texture(ctx, (GLenum) internalformat, - width, 1, 1, border); + make_null_texture(texImage); + if (ctx->Driver.TexImage1D) { + GLboolean retain; + (*ctx->Driver.TexImage1D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } } - /* install new texture image */ - texUnit->CurrentD[1]->Image[level] = teximage; - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[1] ); + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); ctx->NewState |= NEW_TEXTURING; - - /* tell driver about change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_1D, - texUnit->CurrentD[1], - level, internalformat, teximage ); - } } else if (target==GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check( ctx, target, level, internalformat, - format, type, 1, width, 1, 1, border )) { + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 1, width, 1, 1, border)) { + /* if error, clear all proxy texture image parameters */ if (level>=0 && level<ctx->Const.MaxTextureLevels) { MEMSET( ctx->Texture.Proxy1D->Image[level], 0, sizeof(struct gl_texture_image) ); } } else { - ctx->Texture.Proxy1D->Image[level]->Format = (GLenum) format; - set_teximage_component_sizes( ctx->Texture.Proxy1D->Image[level] ); - ctx->Texture.Proxy1D->Image[level]->IntFormat = (GLenum) internalformat; - ctx->Texture.Proxy1D->Image[level]->Border = border; - ctx->Texture.Proxy1D->Image[level]->Width = width; - ctx->Texture.Proxy1D->Image[level]->Height = 1; - ctx->Texture.Proxy1D->Image[level]->Depth = 1; + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy1D->Image[level], + width, 1, 1, border, internalFormat); } } else { @@ -1098,67 +1451,114 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalformat, void -_mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, +_mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage2D"); - if (target==GL_TEXTURE_2D) { - struct gl_texture_image *teximage; - if (texture_error_check( ctx, target, level, internalformat, - format, type, 2, width, height, 1, border )) { - /* error in texture image was detected */ - return; + if (target==GL_TEXTURE_2D || + (ctx->Extensions.HaveTextureCubeMap && + target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 2, width, height, 1, border)) { + return; /* error in texture image was detected */ } - /* free current texture image, if any */ - if (texUnit->CurrentD[2]->Image[level]) { - gl_free_texture_image( texUnit->CurrentD[2]->Image[level] ); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texUnit, target, level); + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + set_tex_image(texObj, target, level, texImage); + /*texObj->Image[level] = texImage;*/ + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; } - /* make new texture from source image */ + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, height, 1, border, internalFormat); + + /* process the texture image */ if (pixels) { - teximage = make_texture_image(ctx, internalformat, width, height, 1, - border, format, type, pixels, &ctx->Unpack); + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexImage2D) { + /* let device driver try to use raw image */ + success = (*ctx->Driver.TexImage2D)( ctx, target, level, format, + type, pixels, &ctx->Unpack, + texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + make_texture_image(ctx, texImage, format, type, + pixels, &ctx->Unpack); + if (!success && ctx->Driver.TexImage2D) { + /* let device driver try to use unpacked image */ + (*ctx->Driver.TexImage2D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } } else { - teximage = make_null_texture(ctx, (GLenum) internalformat, - width, height, 1, border); + make_null_texture(texImage); + if (ctx->Driver.TexImage2D) { + GLboolean retain; + (*ctx->Driver.TexImage2D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } } - /* install new texture image */ - texUnit->CurrentD[2]->Image[level] = teximage; - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[2] ); - ctx->NewState |= NEW_TEXTURING; - - /* tell driver about change */ +#define OLD_DD_TEXTURE +#ifdef OLD_DD_TEXTURE + /* XXX this will be removed in the future */ if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_2D, - texUnit->CurrentD[2], - level, internalformat, teximage ); + (*ctx->Driver.TexImage)( ctx, target, texObj, level, internalFormat, + texImage ); } +#endif + + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); + ctx->NewState |= NEW_TEXTURING; } else if (target==GL_PROXY_TEXTURE_2D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check( ctx, target, level, internalformat, - format, type, 2, width, height, 1, border )) { + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 2, width, height, 1, border)) { + /* if error, clear all proxy texture image parameters */ if (level>=0 && level<ctx->Const.MaxTextureLevels) { MEMSET( ctx->Texture.Proxy2D->Image[level], 0, sizeof(struct gl_texture_image) ); } } else { - ctx->Texture.Proxy2D->Image[level]->Format = (GLenum) format; - set_teximage_component_sizes( ctx->Texture.Proxy2D->Image[level] ); - ctx->Texture.Proxy2D->Image[level]->IntFormat = (GLenum) internalformat; - ctx->Texture.Proxy2D->Image[level]->Border = border; - ctx->Texture.Proxy2D->Image[level]->Width = width; - ctx->Texture.Proxy2D->Image[level]->Height = height; - ctx->Texture.Proxy2D->Image[level]->Depth = 1; + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy1D->Image[level], + width, height, 1, border, internalFormat); } } else { @@ -1174,69 +1574,101 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalformat, * Note that width and height include the border. */ void -_mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, +_mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage3DEXT"); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexImage3D"); if (target==GL_TEXTURE_3D_EXT) { - struct gl_texture_image *teximage; - if (texture_error_check( ctx, target, level, internalformat, - format, type, 3, width, height, depth, - border )) { - /* error in texture image was detected */ - return; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 3, width, height, depth, border)) { + return; /* error in texture image was detected */ } - /* free current texture image, if any */ - if (texUnit->CurrentD[3]->Image[level]) { - gl_free_texture_image( texUnit->CurrentD[3]->Image[level] ); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[3]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); + return; + } } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, height, depth, + border, internalFormat); - /* make new texture from source image */ + /* process the texture image */ if (pixels) { - teximage = make_texture_image(ctx, internalformat, width, height, - depth, border, format, type, pixels, &ctx->Unpack); + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexImage3D) { + /* let device driver try to use raw image */ + success = (*ctx->Driver.TexImage3D)( ctx, target, level, format, + type, pixels, &ctx->Unpack, + texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + make_texture_image(ctx, texImage, format, type, + pixels, &ctx->Unpack); + if (!success && ctx->Driver.TexImage3D) { + /* let device driver try to use unpacked image */ + (*ctx->Driver.TexImage3D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } } else { - teximage = make_null_texture(ctx, (GLenum) internalformat, - width, height, depth, border); + make_null_texture(texImage); + if (ctx->Driver.TexImage3D) { + GLboolean retain; + (*ctx->Driver.TexImage3D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, + texObj, texImage, &retain); + } } - /* install new texture image */ - texUnit->CurrentD[3]->Image[level] = teximage; - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[3] ); + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); ctx->NewState |= NEW_TEXTURING; - - /* tell driver about change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_3D_EXT, - texUnit->CurrentD[3], - level, internalformat, teximage ); - } } - else if (target==GL_PROXY_TEXTURE_3D_EXT) { + else if (target==GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check( ctx, target, level, internalformat, - format, type, 3, width, height, depth, - border )) { + if (texture_error_check(ctx, target, level, internalFormat, + format, type, 3, width, height, depth, border)) { + /* if error, clear all proxy texture image parameters */ if (level>=0 && level<ctx->Const.MaxTextureLevels) { MEMSET( ctx->Texture.Proxy3D->Image[level], 0, sizeof(struct gl_texture_image) ); } } else { - ctx->Texture.Proxy3D->Image[level]->Format = (GLenum) format; - set_teximage_component_sizes( ctx->Texture.Proxy3D->Image[level] ); - ctx->Texture.Proxy3D->Image[level]->IntFormat = (GLenum) internalformat; - ctx->Texture.Proxy3D->Image[level]->Border = border; - ctx->Texture.Proxy3D->Image[level]->Width = width; - ctx->Texture.Proxy3D->Image[level]->Height = height; - ctx->Texture.Proxy3D->Image[level]->Depth = depth; + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy1D->Image[level], + width, height, depth, border, internalFormat); } } else { @@ -1247,16 +1679,106 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalformat, void -_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalformat, +_mesa_TexImage3DEXT( GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) { - _mesa_TexImage3D(target, level, (GLint) internalformat, width, height, + _mesa_TexImage3D(target, level, (GLint) internalFormat, width, height, depth, border, format, type, pixels); } +/* + * Fetch a texture image from the device driver. + * Store the results in the given texture object at the given mipmap level. + */ +void +_mesa_get_teximage_from_driver( GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj ) +{ + GLvoid *image; + GLenum imgFormat, imgType; + GLboolean freeImage; + struct gl_texture_image *texImage; + GLint destComponents, numPixels, srcBytesPerTexel; + + if (!ctx->Driver.GetTexImage) + return; + + image = (*ctx->Driver.GetTexImage)( ctx, target, level, texObj, + &imgFormat, &imgType, &freeImage); + if (!image) + return; + + texImage = texObj->Image[level]; + ASSERT(texImage); + if (!texImage) + return; + + destComponents = components_in_intformat(texImage->Format); + assert(destComponents > 0); + numPixels = texImage->Width * texImage->Height * texImage->Depth; + assert(numPixels > 0); + srcBytesPerTexel = _mesa_bytes_per_pixel(imgFormat, imgType); + assert(srcBytesPerTexel > 0); + + if (!texImage->Data) { + /* Allocate memory for the texture image data */ + texImage->Data = (GLubyte *) MALLOC(numPixels * destComponents + EXTRA_BYTE); + } + + if (imgFormat == texImage->Format && imgType == GL_UNSIGNED_BYTE) { + /* We got lucky! The driver's format and type match Mesa's format. */ + if (texImage->Data) { + MEMCPY(texImage->Data, image, numPixels * destComponents); + } + } + else { + /* Convert the texture image from the driver's format to Mesa's + * internal format. + */ + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + const GLint destBytesPerRow = width * destComponents * sizeof(GLchan); + const GLint srcBytesPerRow = width * srcBytesPerTexel; + const GLenum dstType = GL_UNSIGNED_BYTE; + const GLenum dstFormat = texImage->Format; + const GLubyte *srcPtr = (const GLubyte *) image; + GLubyte *destPtr = texImage->Data; + + if (texImage->Format == GL_COLOR_INDEX) { + /* color index texture */ + GLint img, row; + assert(imgFormat == GL_COLOR_INDEX); + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + _mesa_unpack_index_span(ctx, width, dstType, destPtr, + imgType, srcPtr, &_mesa_native_packing, GL_FALSE); + destPtr += destBytesPerRow; + srcPtr += srcBytesPerRow; + } + } + } + else { + /* color texture */ + GLint img, row; + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + _mesa_unpack_ubyte_color_span(ctx, width, dstFormat, destPtr, + imgFormat, imgType, srcPtr, &_mesa_native_packing, GL_FALSE); + destPtr += destBytesPerRow; + srcPtr += srcBytesPerRow; + } + } + } + } + + if (freeImage) + FREE(image); +} + void _mesa_GetTexImage( GLenum target, GLint level, GLenum format, @@ -1264,6 +1786,8 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, { GET_CURRENT_CONTEXT(ctx); const struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean discardImage; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexImage"); @@ -1272,51 +1796,91 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } - if (gl_sizeof_type(type) <= 0) { + if (_mesa_sizeof_type(type) <= 0) { gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(type)" ); return; } - if (gl_components_in_format(format) <= 0) { + if (_mesa_components_in_format(format) <= 0) { gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(format)" ); return; } if (!pixels) - return; /* XXX generate an error??? */ + return; switch (target) { case GL_TEXTURE_1D: texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[1]; + texImage = texObj->Image[level]; break; case GL_TEXTURE_2D: texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[2]; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegX[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->PosY[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegY[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->PosZ[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegZ[level]; break; case GL_TEXTURE_3D: texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[3]; + texImage = texObj->Image[level]; break; default: gl_error( ctx, GL_INVALID_ENUM, "glGetTexImage(target)" ); return; } - if (texObj->Image[level] && texObj->Image[level]->Data) { - const struct gl_texture_image *texImage = texObj->Image[level]; + if (!texImage) { + /* invalid mipmap level */ + return; + } + + if (!texImage->Data) { + /* try to get the texture image from the device driver */ + _mesa_get_teximage_from_driver(ctx, target, level, texObj); + discardImage = GL_TRUE; + } + else { + discardImage = GL_FALSE; + } + + if (texImage->Data) { GLint width = texImage->Width; GLint height = texImage->Height; GLint row; for (row = 0; row < height; row++) { /* compute destination address in client memory */ - GLvoid *dest = gl_pixel_addr_in_image( &ctx->Unpack, pixels, + GLvoid *dest = _mesa_image_address( &ctx->Unpack, pixels, width, height, format, type, 0, row, 0); assert(dest); if (texImage->Format == GL_RGBA) { const GLubyte *src = texImage->Data + row * width * 4 * sizeof(GLubyte); - gl_pack_rgba_span( ctx, width, (void *) src, format, type, dest, - &ctx->Pack, GL_TRUE ); + _mesa_pack_rgba_span( ctx, width, (CONST GLubyte (*)[4]) src, + format, type, dest, &ctx->Pack, GL_TRUE ); } else { /* fetch RGBA row from texture image then pack it in client mem */ @@ -1379,10 +1943,16 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, default: gl_problem( ctx, "bad format in gl_GetTexImage" ); } - gl_pack_rgba_span( ctx, width, (const GLubyte (*)[4])rgba, - format, type, dest, &ctx->Pack, GL_TRUE ); + _mesa_pack_rgba_span( ctx, width, (const GLubyte (*)[4])rgba, + format, type, dest, &ctx->Pack, GL_TRUE ); } } + + /* if we got the teximage from the device driver we'll discard it now */ + if (discardImage) { + FREE(texImage->Data); + texImage->Data = NULL; + } } } @@ -1395,65 +1965,78 @@ _mesa_TexSubImage1D( GLenum target, GLint level, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_image *destTex; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, width, 1, 1, format, type)) { - /* error was detected */ - return; + return; /* error was detected */ } - destTex = texUnit->CurrentD[1]->Image[level]; - assert(destTex); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[1]; + texImage = texObj->Image[level]; + assert(texImage); if (width == 0 || !pixels) return; /* no-op, not an error */ - /* - * Replace the texture subimage - */ - { - const GLint texComponents = components_in_intformat(destTex->Format); - const GLenum texFormat = destTex->Format; - const GLint xoffsetb = xoffset + destTex->Border; - GLubyte *dst = destTex->Data + xoffsetb * texComponents; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexSubImage1D) { + success = (*ctx->Driver.TexSubImage1D)( ctx, target, level, xoffset, + width, format, type, pixels, + &ctx->Unpack, texObj, texImage ); + } + if (!success) { + /* XXX if Driver.TexSubImage1D, unpack image and try again? */ + + const GLint texComponents = components_in_intformat(texImage->Format); + const GLenum texFormat = texImage->Format; + const GLint xoffsetb = xoffset + texImage->Border; + GLboolean retain = GL_TRUE; + if (!texImage->Data) { + _mesa_get_teximage_from_driver( ctx, target, level, texObj ); + if (!texImage->Data) { + make_null_texture(texImage); + } + if (!texImage->Data) + return; /* we're really out of luck! */ + } + if (texFormat == GL_COLOR_INDEX) { /* color index texture */ - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, 1, format, type, 0, 0, 0); + GLubyte *dst = texImage->Data + xoffsetb * texComponents; + const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels, width, + 1, format, type, 0, 0, 0); _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, - type, src, &ctx->Unpack, GL_TRUE); + type, src, &ctx->Unpack, GL_TRUE); } else { /* color texture */ - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, 1, format, type, 0, 0, 0); - _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, - format, type, src, &ctx->Unpack, GL_TRUE); + GLubyte *dst = texImage->Data + xoffsetb * texComponents; + const GLvoid *src = _mesa_image_address(&ctx->Unpack, pixels, width, + 1, format, type, 0, 0, 0); + _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, format, + type, src, &ctx->Unpack, GL_TRUE); } - } - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[1] ); + if (ctx->Driver.TexImage1D) { + (*ctx->Driver.TexImage1D)( ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, texObj, texImage, + &retain ); + } - /* - * Inform device driver of texture image change. - */ - if (ctx->Driver.TexSubImage) { - (*ctx->Driver.TexSubImage)(ctx, GL_TEXTURE_1D, texUnit->CurrentD[1], - level, xoffset, 0, width, 1, - texUnit->CurrentD[1]->Image[level]->IntFormat, - destTex ); - } - else { - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_1D, texUnit->CurrentD[1], - level, - texUnit->CurrentD[1]->Image[level]->IntFormat, - destTex ); + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; } } + + /*gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[1] );*/ } @@ -1465,76 +2048,104 @@ _mesa_TexSubImage2D( GLenum target, GLint level, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_image *destTex; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, width, height, 1, format, type)) { - /* error was detected */ - return; + return; /* error was detected */ } - destTex = texUnit->CurrentD[2]->Image[level]; - assert(destTex); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = texObj->Image[level]; + assert(texImage); if (width == 0 || height == 0 || !pixels) return; /* no-op, not an error */ + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexSubImage2D) { + success = (*ctx->Driver.TexSubImage2D)( ctx, target, level, xoffset, + yoffset, width, height, format, type, + pixels, &ctx->Unpack, texObj, texImage ); + } + if (!success) { + /* XXX if Driver.TexSubImage2D, unpack image and try again? */ + + const GLint texComponents = components_in_intformat(texImage->Format); + const GLenum texFormat = texImage->Format; + const GLint xoffsetb = xoffset + texImage->Border; + const GLint yoffsetb = yoffset + texImage->Border; + const GLint srcStride = _mesa_image_row_stride(&ctx->Unpack, width, + format, type); + const GLint dstStride = texImage->Width * texComponents *sizeof(GLubyte); + GLboolean retain = GL_TRUE; + + if (!texImage->Data) { + _mesa_get_teximage_from_driver( ctx, target, level, texObj ); + if (!texImage->Data) { + make_null_texture(texImage); + } + if (!texImage->Data) + return; /* we're really out of luck! */ + } - /* - * Replace the texture subimage - */ - { - const GLint texComponents = components_in_intformat(destTex->Format); - const GLenum texFormat = destTex->Format; - const GLint xoffsetb = xoffset + destTex->Border; - const GLint yoffsetb = yoffset + destTex->Border; - GLubyte *dst = destTex->Data - + (yoffsetb * destTex->Width + xoffsetb) * texComponents; if (texFormat == GL_COLOR_INDEX) { /* color index texture */ - const GLint stride = destTex->Width * sizeof(GLubyte); + GLubyte *dst = texImage->Data + + (yoffsetb * texImage->Width + xoffsetb) * texComponents; + const GLubyte *src = _mesa_image_address(&ctx->Unpack, pixels, + width, height, format, type, 0, 0, 0); GLint row; for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, height, format, type, 0, row, 0); - _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, - type, src, &ctx->Unpack, GL_TRUE); - dst += stride; + _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, type, + (const GLvoid *) src, &ctx->Unpack, GL_TRUE); + src += srcStride; + dst += dstStride; } } else { /* color texture */ - const GLint stride = destTex->Width * texComponents * sizeof(GLubyte); + GLubyte *dst = texImage->Data + + (yoffsetb * texImage->Width + xoffsetb) * texComponents; + const GLubyte *src = _mesa_image_address(&ctx->Unpack, pixels, + width, height, format, type, 0, 0, 0); GLint row; for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, height, format, type, 0, row, 0); - _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, - format, type, src, &ctx->Unpack, GL_TRUE); - dst += stride; + _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, format, + type, (const GLvoid *) src, &ctx->Unpack, GL_TRUE); + src += srcStride; + dst += dstStride; } } - } - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[2] ); + if (ctx->Driver.TexImage2D) { + (*ctx->Driver.TexImage2D)(ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, texObj, texImage, + &retain); + } - /* - * Inform device driver of texture image change. - */ - if (ctx->Driver.TexSubImage) { - (*ctx->Driver.TexSubImage)(ctx, GL_TEXTURE_2D, texUnit->CurrentD[2], - level, xoffset, yoffset, width, height, - texUnit->CurrentD[2]->Image[level]->IntFormat, - destTex ); - } - else { - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_2D, texUnit->CurrentD[2], - level, - texUnit->CurrentD[2]->Image[level]->IntFormat, - destTex ); + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + +#ifdef OLD_DD_TEXTURE + /* XXX this will be removed in the future */ + if (ctx->Driver.TexSubImage) { + (*ctx->Driver.TexSubImage)(ctx, target, texObj, level, + xoffset, yoffset, width, height, + texImage->IntFormat, texImage); } + else if (ctx->Driver.TexImage) { + (*ctx->Driver.TexImage)(ctx, GL_TEXTURE_2D, texObj, + level, texImage->IntFormat, texImage ); + } +#endif } } @@ -1548,71 +2159,90 @@ _mesa_TexSubImage3D( GLenum target, GLint level, const GLvoid *pixels ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - struct gl_texture_image *destTex; + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type)) { - /* error was detected */ - return; + return; /* error was detected */ } - destTex = texUnit->CurrentD[3]->Image[level]; - assert(destTex); + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[3]; + texImage = texObj->Image[level]; + assert(texImage); if (width == 0 || height == 0 || height == 0 || !pixels) return; /* no-op, not an error */ - /* - * Replace the texture subimage - */ - { - const GLint texComponents = components_in_intformat(destTex->Format); - const GLenum texFormat = destTex->Format; - const GLint xoffsetb = xoffset + destTex->Border; - const GLint yoffsetb = yoffset + destTex->Border; - const GLint zoffsetb = zoffset + destTex->Border; - GLint dstRectArea = destTex->Width * destTex->Height; - GLubyte *dst = destTex->Data - + (zoffsetb * dstRectArea + yoffsetb * destTex->Width + xoffsetb) - * texComponents; + if (!ctx->Pixel.MapColorFlag && !ctx->Pixel.ScaleOrBiasRGBA + && ctx->Driver.TexSubImage3D) { + success = (*ctx->Driver.TexSubImage3D)( ctx, target, level, xoffset, + yoffset, zoffset, width, height, depth, format, + type, pixels, &ctx->Unpack, texObj, texImage ); + } + if (!success) { + /* XXX if Driver.TexSubImage3D, unpack image and try again? */ + + const GLint texComponents = components_in_intformat(texImage->Format); + const GLenum texFormat = texImage->Format; + const GLint xoffsetb = xoffset + texImage->Border; + const GLint yoffsetb = yoffset + texImage->Border; + const GLint zoffsetb = zoffset + texImage->Border; + const GLint texWidth = texImage->Width; + const GLint dstRectArea = texWidth * texImage->Height; + const GLint srcStride = _mesa_image_row_stride(&ctx->Unpack, + width, format, type); + const GLint dstStride = texWidth * texComponents * sizeof(GLubyte); + GLboolean retain = GL_TRUE; if (texFormat == GL_COLOR_INDEX) { /* color index texture */ - const GLint stride = destTex->Width * sizeof(GLubyte); GLint img, row; for (img = 0; img < depth; img++) { + const GLubyte *src = _mesa_image_address(&ctx->Unpack, pixels, + width, height, format, type, img, 0, 0); + GLubyte *dst = texImage->Data + ((zoffsetb + img) * dstRectArea + + yoffsetb * texWidth + xoffsetb) * texComponents; for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, height, format, type, img, row, 0); _mesa_unpack_index_span(ctx, width, GL_UNSIGNED_BYTE, dst, - type, src, &ctx->Unpack, GL_TRUE); - dst += stride; + type, (const GLvoid *) src, &ctx->Unpack, GL_TRUE); + src += srcStride; + dst += dstStride; } } } else { /* color texture */ - const GLint stride = destTex->Width * texComponents * sizeof(GLubyte); GLint img, row; for (img = 0; img < depth; img++) { + const GLubyte *src = _mesa_image_address(&ctx->Unpack, pixels, + width, height, format, type, img, 0, 0); + GLubyte *dst = texImage->Data + ((zoffsetb + img) * dstRectArea + + yoffsetb * texWidth + xoffsetb) * texComponents; for (row = 0; row < height; row++) { - const GLvoid *src = gl_pixel_addr_in_image(&ctx->Unpack, pixels, - width, height, format, type, img, row, 0); _mesa_unpack_ubyte_color_span(ctx, width, texFormat, dst, - format, type, src, &ctx->Unpack, GL_TRUE); - dst += stride; + format, type, (const GLvoid *) src, &ctx->Unpack, GL_TRUE); + src += srcStride; + dst += dstStride; } } } - } - gl_put_texobj_on_dirty_list( ctx, texUnit->CurrentD[1] ); + if (ctx->Driver.TexImage3D) { + (*ctx->Driver.TexImage3D)(ctx, target, level, texImage->Format, + GL_UNSIGNED_BYTE, texImage->Data, + &_mesa_native_packing, texObj, texImage, + &retain); + } - /* - * Inform device driver of texture image change. - */ - /* XXX todo */ + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + } } @@ -1632,7 +2262,7 @@ read_color_image( GLcontext *ctx, GLint x, GLint y, GLint stride, i; GLubyte *image, *dst; - image = MALLOC(width * height * 4 * sizeof(GLubyte)); + image = (GLubyte *) MALLOC(width * height * 4 * sizeof(GLubyte)); if (!image) return NULL; @@ -1666,15 +2296,22 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage1D"); - if (!copytexture_error_check(ctx, 1, target, level, internalFormat, - width, 1, border)) { + if (copytexture_error_check(ctx, 1, target, level, internalFormat, + width, 1, border)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexImage1D + || !(*ctx->Driver.CopyTexImage1D)(ctx, target, level, + internalFormat, x, y, width, border)) + { GLubyte *image = read_color_image( ctx, x, y, width, 1 ); if (!image) { gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D" ); return; } (*ctx->Exec->TexImage1D)( target, level, internalFormat, width, - border, GL_RGBA, GL_UNSIGNED_BYTE, image ); + border, GL_RGBA, GL_UNSIGNED_BYTE, image ); FREE(image); } } @@ -1689,15 +2326,22 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexImage2D"); - if (!copytexture_error_check(ctx, 2, target, level, internalFormat, - width, height, border)) { + if (copytexture_error_check(ctx, 2, target, level, internalFormat, + width, height, border)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexImage2D + || !(*ctx->Driver.CopyTexImage2D)(ctx, target, level, + internalFormat, x, y, width, height, border)) + { GLubyte *image = read_color_image( ctx, x, y, width, height ); if (!image) { gl_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D" ); return; } (ctx->Exec->TexImage2D)( target, level, internalFormat, width, - height, border, GL_RGBA, GL_UNSIGNED_BYTE, image ); + height, border, GL_RGBA, GL_UNSIGNED_BYTE, image ); FREE(image); } } @@ -1713,17 +2357,6 @@ copy_tex_sub_image( GLcontext *ctx, struct gl_texture_image *dest, GLint srcx, GLint srcy, GLint dstx, GLint dsty, GLint dstz ) { - static struct gl_pixelstore_attrib packing = { - 1, /* Alignment */ - 0, /* RowLength */ - 0, /* SkipPixels */ - 0, /* SkipRows */ - 0, /* ImageHeight */ - 0, /* SkipImages */ - GL_FALSE, /* SwapBytes */ - GL_FALSE /* LsbFirst */ - }; - GLint i; GLint format, components, rectarea; GLint texwidth, texheight, zoffset; @@ -1750,7 +2383,7 @@ copy_tex_sub_image( GLcontext *ctx, struct gl_texture_image *dest, dst = dest->Data + ( zoffset + (dsty+i) * texwidth + dstx) * components; _mesa_unpack_ubyte_color_span(ctx, width, format, dst, GL_RGBA, GL_UNSIGNED_BYTE, rgba, - &packing, GL_TRUE); + &_mesa_native_packing, GL_TRUE); } /* Read from draw buffer (the default) */ @@ -1768,8 +2401,14 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage1D"); - if (!copytexsubimage_error_check(ctx, 1, target, level, - xoffset, 0, 0, width, 1)) { + if (copytexsubimage_error_check(ctx, 1, target, level, + xoffset, 0, 0, width, 1)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexSubImage1D + || !(*ctx->Driver.CopyTexSubImage1D)(ctx, target, level, + xoffset, x, y, width)) { struct gl_texture_unit *texUnit; struct gl_texture_image *teximage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1777,12 +2416,13 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, assert(teximage); if (teximage->Data) { copy_tex_sub_image(ctx, teximage, width, 1, x, y, xoffset, 0, 0); - /* tell driver about the change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_1D, - texUnit->CurrentD[1], - level, teximage->IntFormat, teximage ); - } + /* tell driver about the change */ + /* XXX this is obsolete */ + if (ctx->Driver.TexImage) { + (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_1D, + texUnit->CurrentD[1], + level, teximage->IntFormat, teximage ); + } } } } @@ -1797,8 +2437,14 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage2D"); - if (!copytexsubimage_error_check(ctx, 2, target, level, - xoffset, yoffset, 0, width, height)) { + if (copytexsubimage_error_check(ctx, 2, target, level, + xoffset, yoffset, 0, width, height)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexSubImage2D + || !(*ctx->Driver.CopyTexSubImage2D)(ctx, target, level, + xoffset, yoffset, x, y, width, height )) { struct gl_texture_unit *texUnit; struct gl_texture_image *teximage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1807,11 +2453,12 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, if (teximage->Data) { copy_tex_sub_image(ctx, teximage, width, height, x, y, xoffset, yoffset, 0); - /* tell driver about the change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_2D, - texUnit->CurrentD[2], - level, teximage->IntFormat, teximage ); + /* tell driver about the change */ + /* XXX this is obsolete */ + if (ctx->Driver.TexImage) { + (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_2D, + texUnit->CurrentD[2], + level, teximage->IntFormat, teximage ); } } } @@ -1827,8 +2474,14 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCopyTexSubImage3D"); - if (!copytexsubimage_error_check(ctx, 3, target, level, - xoffset, yoffset, zoffset, width, height)) { + if (copytexsubimage_error_check(ctx, 3, target, level, + xoffset, yoffset, zoffset, width, height)) + return; + + if (ctx->Pixel.MapColorFlag || ctx->Pixel.ScaleOrBiasRGBA + || !ctx->Driver.CopyTexSubImage3D + || !(*ctx->Driver.CopyTexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, x, y, width, height )) { struct gl_texture_unit *texUnit; struct gl_texture_image *teximage; texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; @@ -1837,13 +2490,501 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, if (teximage->Data) { copy_tex_sub_image(ctx, teximage, width, height, x, y, xoffset, yoffset, zoffset); - /* tell driver about the change */ - if (ctx->Driver.TexImage) { - (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_3D, - texUnit->CurrentD[3], - level, teximage->IntFormat, teximage ); - } + /* tell driver about the change */ + /* XXX this is obsolete */ + if (ctx->Driver.TexImage) { + (*ctx->Driver.TexImage)( ctx, GL_TEXTURE_3D, + texUnit->CurrentD[3], + level, teximage->IntFormat, teximage ); + } + } + } +} + + + +void +_mesa_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage1DARB"); + + if (target == GL_TEXTURE_1D) { + 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, 1, 1, border)) { + return; /* error in texture image was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[1]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, 1, 1, border, internalFormat); + + /* process the texture image */ + if (data) { + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (ctx->Driver.CompressedTexImage1D) { + success = (*ctx->Driver.CompressedTexImage1D)( ctx, target, level, + data, texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + GLuint imageSize = _mesa_compressed_image_size(internalFormat, + width, 1, 1); + texImage->Data = MALLOC(imageSize); + if (texImage->Data) { + MEMCPY(texImage->Data, data, imageSize); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + } + else { + make_null_texture(texImage); + if (ctx->Driver.CompressedTexImage1D) { + GLboolean retain; + (*ctx->Driver.CompressedTexImage1D)( ctx, target, level, + texImage->Data, texObj, texImage, &retain); + } + } + + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); + ctx->NewState |= NEW_TEXTURING; + } + else if (target == GL_PROXY_TEXTURE_1D) { + /* Proxy texture: check for errors and update proxy state */ + if (texture_error_check(ctx, target, level, internalFormat, + GL_NONE, GL_NONE, 1, width, 1, 1, border)) { + /* if error, clear all proxy texture image parameters */ + if (level>=0 && level<ctx->Const.MaxTextureLevels) { + MEMSET( ctx->Texture.Proxy1D->Image[level], 0, + sizeof(struct gl_texture_image) ); + } + } + else { + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy1D->Image[level], + width, 1, 1, border, internalFormat); + } + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glCompressedTexImage1DARB(target)" ); + return; + } +} + + +void +_mesa_CompressedTexImage2DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage2DARB"); + + if (target==GL_TEXTURE_2D || + (ctx->Extensions.HaveTextureCubeMap && + target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && + target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { + 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)) { + return; /* error in texture image was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[2]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, height, 1, border, internalFormat); + + /* process the texture image */ + if (data) { + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (ctx->Driver.CompressedTexImage2D) { + success = (*ctx->Driver.CompressedTexImage2D)( ctx, target, level, + data, texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + GLuint imageSize = _mesa_compressed_image_size(internalFormat, + width, height, 1); + texImage->Data = MALLOC(imageSize); + if (texImage->Data) { + MEMCPY(texImage->Data, data, imageSize); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } } + else { + make_null_texture(texImage); + if (ctx->Driver.CompressedTexImage2D) { + GLboolean retain; + (*ctx->Driver.CompressedTexImage2D)( ctx, target, level, + texImage->Data, texObj, texImage, &retain); + } + } + + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); + ctx->NewState |= NEW_TEXTURING; + } + else if (target == GL_PROXY_TEXTURE_2D) { + /* Proxy texture: check for errors and update proxy state */ + if (texture_error_check(ctx, target, level, internalFormat, + GL_NONE, GL_NONE, 1, width, 1, 1, border)) { + /* if error, clear all proxy texture image parameters */ + if (level>=0 && level<ctx->Const.MaxTextureLevels) { + MEMSET( ctx->Texture.Proxy2D->Image[level], 0, + sizeof(struct gl_texture_image) ); + } + } + else { + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy2D->Image[level], + width, 1, 1, border, internalFormat); + } + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glCompressedTexImage2DARB(target)" ); + return; } } + +void +_mesa_CompressedTexImage3DARB(GLenum target, GLint level, + GLenum internalFormat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glCompressedTexImage3DARB"); + + if (target == GL_TEXTURE_3D) { + 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, depth, border)) { + return; /* error in texture image was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = texUnit->CurrentD[3]; + texImage = texObj->Image[level]; + + if (!texImage) { + texImage = _mesa_alloc_texture_image(); + texObj->Image[level] = texImage; + if (!texImage) { + gl_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB"); + return; + } + } + else if (texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + + /* setup the teximage struct's fields */ + init_texture_image(texImage, width, height, depth, border, internalFormat); + + /* process the texture image */ + if (data) { + GLboolean retain = GL_TRUE; + GLboolean success = GL_FALSE; + if (ctx->Driver.CompressedTexImage3D) { + success = (*ctx->Driver.CompressedTexImage3D)( ctx, target, level, + data, texObj, texImage, &retain); + } + if (retain || !success) { + /* make internal copy of the texture image */ + GLuint imageSize = _mesa_compressed_image_size(internalFormat, + width, height, depth); + texImage->Data = MALLOC(imageSize); + if (texImage->Data) { + MEMCPY(texImage->Data, data, imageSize); + } + } + if (!retain && texImage->Data) { + FREE(texImage->Data); + texImage->Data = NULL; + } + } + else { + make_null_texture(texImage); + if (ctx->Driver.CompressedTexImage3D) { + GLboolean retain; + (*ctx->Driver.CompressedTexImage3D)( ctx, target, level, + texImage->Data, texObj, texImage, &retain); + } + } + + /* state update */ + gl_put_texobj_on_dirty_list( ctx, texObj ); + ctx->NewState |= NEW_TEXTURING; + } + else if (target == GL_PROXY_TEXTURE_3D) { + /* Proxy texture: check for errors and update proxy state */ + if (texture_error_check(ctx, target, level, internalFormat, + GL_NONE, GL_NONE, 1, width, height, depth, border)) { + /* if error, clear all proxy texture image parameters */ + if (level>=0 && level<ctx->Const.MaxTextureLevels) { + MEMSET( ctx->Texture.Proxy3D->Image[level], 0, + sizeof(struct gl_texture_image) ); + } + } + else { + /* if no error, update proxy texture image parameters */ + init_texture_image(ctx->Texture.Proxy3D->Image[level], + width, 1, 1, border, internalFormat); + } + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glCompressedTexImage3DARB(target)" ); + return; + } +} + + +void +_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; + + if (subtexture_error_check(ctx, 1, target, level, xoffset, 0, 0, + width, 1, 1, format, GL_NONE)) { + return; /* error was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = texObj->Image[level]; + assert(texImage); + + if (width == 0 || !data) + return; /* no-op, not an error */ + + if (ctx->Driver.CompressedTexSubImage1D) { + success = (*ctx->Driver.CompressedTexSubImage1D)(ctx, target, level, + xoffset, width, format, imageSize, data, texObj, texImage); + } + if (!success) { + /* XXX what else can we do? */ + gl_problem(ctx, "glCompressedTexSubImage1DARB failed!"); + return; + } + +} + + +void +_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; + + if (subtexture_error_check(ctx, 2, target, level, xoffset, yoffset, 0, + width, height, 1, format, GL_NONE)) { + return; /* error was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = texObj->Image[level]; + assert(texImage); + + if (width == 0 || height == 0 || !data) + return; /* no-op, not an error */ + + if (ctx->Driver.CompressedTexSubImage2D) { + success = (*ctx->Driver.CompressedTexSubImage2D)(ctx, target, level, + xoffset, yoffset, width, height, format, + imageSize, data, texObj, texImage); + } + if (!success) { + /* XXX what else can we do? */ + gl_problem(ctx, "glCompressedTexSubImage2DARB failed!"); + return; + } +} + + +void +_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + GLboolean success = GL_FALSE; + + if (subtexture_error_check(ctx, 3, target, level, xoffset, yoffset, zoffset, + width, height, depth, format, GL_NONE)) { + return; /* error was detected */ + } + + texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = texObj->Image[level]; + assert(texImage); + + if (width == 0 || height == 0 || depth == 0 || !data) + return; /* no-op, not an error */ + + if (ctx->Driver.CompressedTexSubImage3D) { + success = (*ctx->Driver.CompressedTexSubImage3D)(ctx, target, level, + xoffset, yoffset, zoffset, width, height, depth, + format, imageSize, data, texObj, texImage); + } + if (!success) { + /* XXX what else can we do? */ + gl_problem(ctx, "glCompressedTexSubImage3DARB failed!"); + return; + } +} + + +void +_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) +{ + GET_CURRENT_CONTEXT(ctx); + const struct gl_texture_object *texObj; + struct gl_texture_image *texImage; + + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetCompressedTexImageARB"); + + if (level < 0 || level >= ctx->Const.MaxTextureLevels) { + gl_error( ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)" ); + return; + } + + switch (target) { + case GL_TEXTURE_1D: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[1]; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_2D: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[2]; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->Image[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegX[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->PosY[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegY[level]; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->PosZ[level]; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap; + texImage = texObj->NegZ[level]; + break; + case GL_TEXTURE_3D: + texObj = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentD[3]; + texImage = texObj->Image[level]; + break; + default: + gl_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)"); + return; + } + + if (!texImage) { + /* invalid mipmap level */ + gl_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); + return; + } + + if (!texImage->IsCompressed) { + gl_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImageARB"); + return; + } + + if (!img) + return; + + if (ctx->Driver.GetCompressedTexImage) { + (*ctx->Driver.GetCompressedTexImage)(ctx, target, level, img, texObj, + texImage); + } + else { + gl_problem(ctx, "Driver doesn't implement GetCompressedTexImage"); + } +} diff --git a/xc/extras/Mesa/src/teximage.h b/xc/extras/Mesa/src/teximage.h index 167708d26..606bac31c 100644 --- a/xc/extras/Mesa/src/teximage.h +++ b/xc/extras/Mesa/src/teximage.h @@ -34,14 +34,37 @@ /*** Internal functions ***/ +extern GLint +_mesa_base_tex_format( GLcontext *ctx, GLint format ); + + extern struct gl_texture_image * -gl_alloc_texture_image( void ); +_mesa_alloc_texture_image( void ); extern void -gl_free_texture_image( struct gl_texture_image *teximage ); +_mesa_free_texture_image( struct gl_texture_image *teximage ); + + +extern GLuint +_mesa_compressed_image_size(GLenum internalFormat, + GLint width, GLint height, GLint depth); +extern struct gl_texture_object * +_mesa_select_tex_object(GLcontext *ctx, struct gl_texture_unit *texUnit, + GLenum target); + + +extern struct gl_texture_image * +_mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit, + GLenum target, GLint level); + + +extern void +_mesa_get_teximage_from_driver( GLcontext *ctx, GLenum target, GLint level, + const struct gl_texture_object *texObj ); + /*** API entry point functions ***/ @@ -126,5 +149,47 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); + + +extern void +_mesa_CompressedTexImage1DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLint border, GLsizei imageSize, + const GLvoid *data); + +extern void +_mesa_CompressedTexImage2DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, + const GLvoid *data); + +extern void +_mesa_CompressedTexImage3DARB(GLenum target, GLint level, + GLenum internalformat, GLsizei width, + GLsizei height, GLsizei depth, GLint border, + GLsizei imageSize, const GLvoid *data); + + +extern void +_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data); + +extern void +_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data); + +extern void +_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, GLenum format, + GLsizei imageSize, const GLvoid *data); + +extern void +_mesa_GetCompressedTexImageARB(GLenum target, GLint lod, GLvoid *img); + + #endif diff --git a/xc/extras/Mesa/src/texobj.c b/xc/extras/Mesa/src/texobj.c index e30032376..91876bf5b 100644 --- a/xc/extras/Mesa/src/texobj.c +++ b/xc/extras/Mesa/src/texobj.c @@ -28,6 +28,7 @@ #include "all.h" #else #include "glheader.h" +#include "colortab.h" #include "context.h" #include "enums.h" #include "hash.h" @@ -46,7 +47,7 @@ * table. * Input: shared - the shared GL state structure to contain the texture object * name - integer name for the texture object - * dimensions - either 1, 2 or 3 + * dimensions - either 1, 2, 3 or 6 (cube map) * Return: pointer to new texture object */ struct gl_texture_object * @@ -55,7 +56,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, { struct gl_texture_object *obj; - ASSERT(dimensions <= 3); + ASSERT(dimensions <= 3 || dimensions == 6); obj = CALLOC_STRUCT(gl_texture_object); @@ -73,13 +74,7 @@ gl_alloc_texture_object( struct gl_shared_state *shared, GLuint name, obj->BaseLevel = 0; obj->MaxLevel = 1000; obj->MinMagThresh = 0.0F; - obj->Palette.Table[0] = 255; - obj->Palette.Table[1] = 255; - obj->Palette.Table[2] = 255; - obj->Palette.Table[3] = 255; - obj->Palette.Size = 1; - obj->Palette.IntFormat = GL_RGBA; - obj->Palette.Format = GL_RGBA; + _mesa_init_colortable(&obj->Palette); /* insert into linked list */ if (shared) { @@ -143,12 +138,14 @@ void gl_free_texture_object( struct gl_shared_state *shared, _mesa_HashRemove(shared->TexObjects, t->Name); } - /* free texture image */ + _mesa_free_colortable_data(&t->Palette); + + /* free texture images */ { GLuint i; for (i=0;i<MAX_TEXTURE_LEVELS;i++) { if (t->Image[i]) { - gl_free_texture_image( t->Image[i] ); + _mesa_free_texture_image( t->Image[i] ); } } } @@ -162,24 +159,26 @@ void gl_free_texture_object( struct gl_shared_state *shared, * Examine a texture object to determine if it is complete or not. * The t->Complete flag will be set to GL_TRUE or GL_FALSE accordingly. */ -void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_texture_object *t ) +void +_mesa_test_texobj_completeness( const GLcontext *ctx, + struct gl_texture_object *t ) { t->Complete = GL_TRUE; /* be optimistic */ /* Always need level zero image */ - if (!t->Image[0] || !t->Image[0]->Data) { + if (!t->Image[0]) { t->Complete = GL_FALSE; return; } /* Compute number of mipmap levels */ - if (t->Dimensions==1) { + if (t->Dimensions == 1) { t->P = t->Image[0]->WidthLog2; } - else if (t->Dimensions==2) { + else if (t->Dimensions == 2 || t->Dimensions == 6) { t->P = MAX2(t->Image[0]->WidthLog2, t->Image[0]->HeightLog2); } - else if (t->Dimensions==3) { + else if (t->Dimensions == 3) { GLint max = MAX2(t->Image[0]->WidthLog2, t->Image[0]->HeightLog2); max = MAX2(max, (GLint)(t->Image[0]->DepthLog2)); t->P = max; @@ -189,7 +188,21 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur t->M = (GLfloat) (MIN2(t->MaxLevel, t->P) - t->BaseLevel); - if (t->MinFilter!=GL_NEAREST && t->MinFilter!=GL_LINEAR) { + if (t->Dimensions == 6) { + /* make sure all six level 0 images are same size */ + const GLint w = t->Image[0]->Width2; + const GLint h = t->Image[0]->Height2; + if (!t->NegX[0] || t->NegX[0]->Width2 != w || t->NegX[0]->Height2 != h || + !t->PosY[0] || t->PosY[0]->Width2 != w || t->PosY[0]->Height2 != h || + !t->NegY[0] || t->NegY[0]->Width2 != w || t->NegY[0]->Height2 != h || + !t->PosZ[0] || t->PosZ[0]->Width2 != w || t->PosZ[0]->Height2 != h || + !t->NegZ[0] || t->NegZ[0]->Width2 != w || t->NegZ[0]->Height2 != h) { + t->Complete = GL_FALSE; + return; + } + } + + if (t->MinFilter != GL_NEAREST && t->MinFilter != GL_LINEAR) { /* * Mipmapping: determine if we have a complete set of mipmaps */ @@ -206,10 +219,6 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur /* Test dimension-independent attributes */ for (i = minLevel; i <= maxLevel; i++) { if (t->Image[i]) { - if (!t->Image[i]->Data) { - t->Complete = GL_FALSE; - return; - } if (t->Image[i]->Format != t->Image[0]->Format) { t->Complete = GL_FALSE; return; @@ -222,11 +231,11 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur } /* Test things which depend on number of texture image dimensions */ - if (t->Dimensions==1) { + if (t->Dimensions == 1) { /* Test 1-D mipmaps */ GLuint width = t->Image[0]->Width2; - for (i=1; i<ctx->Const.MaxTextureLevels; i++) { - if (width>1) { + for (i = 1; i < ctx->Const.MaxTextureLevels; i++) { + if (width > 1) { width /= 2; } if (i >= minLevel && i <= maxLevel) { @@ -234,29 +243,25 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur t->Complete = GL_FALSE; return; } - if (!t->Image[i]->Data) { - t->Complete = GL_FALSE; - return; - } if (t->Image[i]->Width2 != width ) { t->Complete = GL_FALSE; return; } } - if (width==1) { + if (width == 1) { return; /* found smallest needed mipmap, all done! */ } } } - else if (t->Dimensions==2) { + else if (t->Dimensions == 2) { /* Test 2-D mipmaps */ GLuint width = t->Image[0]->Width2; GLuint height = t->Image[0]->Height2; - for (i=1; i<ctx->Const.MaxTextureLevels; i++) { - if (width>1) { + for (i = 1; i < ctx->Const.MaxTextureLevels; i++) { + if (width > 1) { width /= 2; } - if (height>1) { + if (height > 1) { height /= 2; } if (i >= minLevel && i <= maxLevel) { @@ -278,19 +283,19 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur } } } - else if (t->Dimensions==3) { + else if (t->Dimensions == 3) { /* Test 3-D mipmaps */ GLuint width = t->Image[0]->Width2; GLuint height = t->Image[0]->Height2; GLuint depth = t->Image[0]->Depth2; - for (i=1; i<ctx->Const.MaxTextureLevels; i++) { - if (width>1) { + for (i = 1; i < ctx->Const.MaxTextureLevels; i++) { + if (width > 1) { width /= 2; } - if (height>1) { + if (height > 1) { height /= 2; } - if (depth>1) { + if (depth > 1) { depth /= 2; } if (i >= minLevel && i <= maxLevel) { @@ -311,7 +316,41 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur return; } } - if (width==1 && height==1 && depth==1) { + if (width == 1 && height == 1 && depth == 1) { + return; /* found smallest needed mipmap, all done! */ + } + } + } + else if (t->Dimensions == 6) { + /* make sure 6 cube faces are consistant */ + GLuint width = t->Image[0]->Width2; + GLuint height = t->Image[0]->Height2; + for (i = 1; i < ctx->Const.MaxTextureLevels; i++) { + if (width > 1) { + width /= 2; + } + if (height > 1) { + height /= 2; + } + if (i >= minLevel && i <= maxLevel) { + /* check that we have images defined */ + if (!t->Image[i] || !t->NegX[i] || + !t->PosY[i] || !t->NegY[i] || + !t->PosZ[i] || !t->NegZ[i]) { + t->Complete = GL_FALSE; + return; + } + /* check that all six images have same size */ + if (t->NegX[i]->Width2!=width || t->NegX[i]->Height2!=height || + t->PosY[i]->Width2!=width || t->PosY[i]->Height2!=height || + t->NegY[i]->Width2!=width || t->NegY[i]->Height2!=height || + t->PosZ[i]->Width2!=width || t->PosZ[i]->Height2!=height || + t->NegZ[i]->Width2!=width || t->NegZ[i]->Height2!=height) { + t->Complete = GL_FALSE; + return; + } + } + if (width == 1 && height == 1) { return; /* found smallest needed mipmap, all done! */ } } @@ -324,6 +363,8 @@ void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_textur } +_glthread_DECLARE_STATIC_MUTEX(GenTexturesLock); + /* * Execute glGenTextures @@ -341,6 +382,12 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) return; } + + /* + * This must be atomic (generation and allocation of texture IDs) + */ + _glthread_LOCK_MUTEX(GenTexturesLock); + first = _mesa_HashFindFreeKeyBlock(ctx->Shared->TexObjects, n); /* Return the texture names */ @@ -354,6 +401,8 @@ _mesa_GenTextures( GLsizei n, GLuint *texName ) GLuint dims = 0; (void) gl_alloc_texture_object(ctx->Shared, name, dims); } + + _glthread_UNLOCK_MUTEX(GenTexturesLock); } @@ -429,25 +478,37 @@ _mesa_BindTexture( GLenum target, GLuint texName ) switch (target) { case GL_TEXTURE_1D: dim = 1; + oldTexObj = texUnit->CurrentD[1]; break; case GL_TEXTURE_2D: dim = 2; + oldTexObj = texUnit->CurrentD[2]; break; case GL_TEXTURE_3D: dim = 3; + oldTexObj = texUnit->CurrentD[3]; break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) { + dim = 6; + oldTexObj = texUnit->CurrentCubeMap; + break; + } + /* fallthrough */ default: gl_error( ctx, GL_INVALID_ENUM, "glBindTexture(target)" ); return; } - oldTexObj = texUnit->CurrentD[dim]; - if (oldTexObj->Name == texName) return; - if (texName == 0) - newTexObj = ctx->Shared->DefaultD[dim]; + if (texName == 0) { + if (target == GL_TEXTURE_CUBE_MAP_ARB) + newTexObj = ctx->Shared->DefaultCubeMap; + else + newTexObj = ctx->Shared->DefaultD[dim]; + } else { struct _mesa_HashTable *hash = ctx->Shared->TexObjects; newTexObj = (struct gl_texture_object *) _mesa_HashLookup(hash, texName); @@ -467,7 +528,22 @@ _mesa_BindTexture( GLenum target, GLuint texName ) newTexObj->RefCount++; - texUnit->CurrentD[dim] = newTexObj; + switch (target) { + case GL_TEXTURE_1D: + texUnit->CurrentD[1] = newTexObj; + break; + case GL_TEXTURE_2D: + texUnit->CurrentD[2] = newTexObj; + break; + case GL_TEXTURE_3D: + texUnit->CurrentD[3] = newTexObj; + break; + case GL_TEXTURE_CUBE_MAP_ARB: + texUnit->CurrentCubeMap = newTexObj; + break; + default: + gl_problem(ctx, "bad target in BindTexture"); + } /* If we've changed the CurrentD[123] texture object then update the * ctx->Texture.Current pointer to point to the new texture object. diff --git a/xc/extras/Mesa/src/texobj.h b/xc/extras/Mesa/src/texobj.h index 5c578e9d0..c83c6144c 100644 --- a/xc/extras/Mesa/src/texobj.h +++ b/xc/extras/Mesa/src/texobj.h @@ -31,9 +31,6 @@ #include "types.h" -#ifdef VMS -#define gl_test_texture_object_completeness gl_test_texture_object_complete -#endif /* * Internal functions @@ -48,7 +45,9 @@ extern void gl_free_texture_object( struct gl_shared_state *shared, struct gl_texture_object *t ); -extern void gl_test_texture_object_completeness( const GLcontext *ctx, struct gl_texture_object *t ); +extern void +_mesa_test_texobj_completeness( const GLcontext *ctx, + struct gl_texture_object *t ); /* diff --git a/xc/extras/Mesa/src/texstate.c b/xc/extras/Mesa/src/texstate.c index 3b0a7f539..a51a7f873 100644 --- a/xc/extras/Mesa/src/texstate.c +++ b/xc/extras/Mesa/src/texstate.c @@ -34,6 +34,7 @@ #include "macros.h" #include "matrix.h" #include "texobj.h" +#include "teximage.h" #include "texstate.h" #include "texture.h" #include "types.h" @@ -68,35 +69,24 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glTexEnv"); - if (target!=GL_TEXTURE_ENV) { - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" ); - return; - } + if (target==GL_TEXTURE_ENV) { - if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) - fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n", - gl_lookup_enum_by_nr(target), - gl_lookup_enum_by_nr(pname), - *param, - gl_lookup_enum_by_nr((GLenum) (GLint) *param)); - - - if (pname==GL_TEXTURE_ENV_MODE) { - GLenum mode = (GLenum) (GLint) *param; - switch (mode) { - case GL_ADD: - if (!gl_extension_is_enabled(ctx, "GL_EXT_texture_env_add")) { - gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); - return; - } - /* FALL-THROUGH */ - case GL_MODULATE: - case GL_BLEND: - case GL_DECAL: - case GL_REPLACE: + if (pname==GL_TEXTURE_ENV_MODE) { + GLenum mode = (GLenum) (GLint) *param; + switch (mode) { + case GL_ADD: + if (!ctx->Extensions.HaveTextureEnvAdd) { + gl_error(ctx, GL_INVALID_ENUM, "glTexEnv(param)"); + return; + } + /* FALL-THROUGH */ + case GL_MODULATE: + case GL_BLEND: + case GL_DECAL: + case GL_REPLACE: /* A small optimization for drivers */ if (texUnit->EnvMode == mode) - return; + return; if (MESA_VERBOSE & (VERBOSE_STATE|VERBOSE_TEXTURE)) fprintf(stderr, "glTexEnv: old mode %s, new mode %s\n", @@ -109,23 +99,53 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) default: gl_error( ctx, GL_INVALID_VALUE, "glTexEnv(param)" ); return; + } } + else if (pname==GL_TEXTURE_ENV_COLOR) { + texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F ); + texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F ); + texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F ); + texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F ); + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); + return; + } + } - else if (pname==GL_TEXTURE_ENV_COLOR) { - texUnit->EnvColor[0] = CLAMP( param[0], 0.0F, 1.0F ); - texUnit->EnvColor[1] = CLAMP( param[1], 0.0F, 1.0F ); - texUnit->EnvColor[2] = CLAMP( param[2], 0.0F, 1.0F ); - texUnit->EnvColor[3] = CLAMP( param[3], 0.0F, 1.0F ); + else if (target==GL_TEXTURE_FILTER_CONTROL_EXT) { + + if (!ctx->Extensions.HaveTextureLodBias) { + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(param)" ); + return; + } + + if (pname==GL_TEXTURE_LOD_BIAS_EXT) { + texUnit->LodBias = param[0]; + } + else { + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); + return; + } + } else { - gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(pname)" ); + gl_error( ctx, GL_INVALID_ENUM, "glTexEnv(target)" ); return; } + if (MESA_VERBOSE&(VERBOSE_API|VERBOSE_TEXTURE)) + fprintf(stderr, "glTexEnv %s %s %.1f(%s) ...\n", + gl_lookup_enum_by_nr(target), + gl_lookup_enum_by_nr(pname), + *param, + gl_lookup_enum_by_nr((GLenum) (GLint) *param)); + /* Tell device driver about the new texture environment */ if (ctx->Driver.TexEnv) { - (*ctx->Driver.TexEnv)( ctx, pname, param ); + (*ctx->Driver.TexEnv)( ctx, target, pname, param ); } + } @@ -253,6 +273,12 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_3D_EXT: texObj = texUnit->CurrentD[3]; break; + case GL_TEXTURE_CUBE_MAP_ARB: + if (ctx->Extensions.HaveTextureCubeMap) { + texObj = texUnit->CurrentCubeMap; + break; + } + /* fallthrough */ default: gl_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); return; @@ -405,6 +431,28 @@ _mesa_GetTexLevelParameterfv( GLenum target, GLint level, } +static GLuint +tex_image_dimensions(GLcontext *ctx, GLenum target) +{ + switch (target) { + case GL_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D: + return 1; + case GL_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D: + return 2; + case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: + return 3; + case GL_TEXTURE_CUBE_MAP_ARB: + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: + return ctx->Extensions.HaveTextureCubeMap ? 2 : 0; + default: + gl_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); + return 0; + } +} + void _mesa_GetTexLevelParameteriv( GLenum target, GLint level, @@ -414,6 +462,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; const struct gl_texture_image *img = NULL; GLuint dimensions; + GLboolean isProxy; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexLevelParameter"); @@ -422,36 +471,13 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, return; } - switch (target) { - case GL_TEXTURE_1D: - img = texUnit->CurrentD[1]->Image[level]; - dimensions = 1; - break; - case GL_TEXTURE_2D: - img = texUnit->CurrentD[2]->Image[level]; - dimensions = 2; - break; - case GL_TEXTURE_3D: - img = texUnit->CurrentD[3]->Image[level]; - dimensions = 3; - break; - case GL_PROXY_TEXTURE_1D: - img = ctx->Texture.Proxy1D->Image[level]; - dimensions = 1; - break; - case GL_PROXY_TEXTURE_2D: - img = ctx->Texture.Proxy2D->Image[level]; - dimensions = 2; - break; - case GL_PROXY_TEXTURE_3D: - img = ctx->Texture.Proxy3D->Image[level]; - dimensions = 3; - break; - default: - gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); - return; + dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ + if (dimensions == 0) { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); + return; } + img = _mesa_select_tex_image(ctx, texUnit, target, level); if (!img) { if (pname == GL_TEXTURE_COMPONENTS) *params = 1; @@ -460,6 +486,11 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, return; } + isProxy = (target == GL_PROXY_TEXTURE_1D) || + (target == GL_PROXY_TEXTURE_2D) || + (target == GL_PROXY_TEXTURE_3D) || + (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB); + switch (pname) { case GL_TEXTURE_WIDTH: *params = img->Width; @@ -509,9 +540,31 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_TEXTURE_INDEX_SIZE_EXT: *params = img->IndexBits; return; + + /* GL_ARB_texture_compression */ + case GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB: + if (ctx->Extensions.HaveTextureCompression) { + if (img->IsCompressed && !isProxy) + *params = img->CompressedSize; + else + gl_error(ctx, GL_INVALID_OPERATION, + "glGetTexLevelParameter[if]v(pname)"); + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + } + return; + case GL_TEXTURE_COMPRESSED_ARB: + if (ctx->Extensions.HaveTextureCompression) { + *params = (GLint) img->IsCompressed; + } + else { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); + } + return; + default: - gl_error( ctx, GL_INVALID_ENUM, - "glGetTexLevelParameter[if]v(pname)" ); + gl_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); } } @@ -526,19 +579,10 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameterfv"); - switch (target) { - case GL_TEXTURE_1D: - obj = texUnit->CurrentD[1]; - break; - case GL_TEXTURE_2D: - obj = texUnit->CurrentD[2]; - break; - case GL_TEXTURE_3D_EXT: - obj = texUnit->CurrentD[3]; - break; - default: - gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); - return; + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameterfv(target)"); + return; } switch (pname) { @@ -596,19 +640,10 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexParameteriv"); - switch (target) { - case GL_TEXTURE_1D: - obj = texUnit->CurrentD[1]; - break; - case GL_TEXTURE_2D: - obj = texUnit->CurrentD[2]; - break; - case GL_TEXTURE_3D_EXT: - obj = texUnit->CurrentD[3]; - break; - default: - gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); - return; + obj = _mesa_select_tex_object(ctx, texUnit, target); + if (!obj) { + gl_error(ctx, GL_INVALID_ENUM, "glGetTexParameteriv(target)"); + return; } switch (pname) { @@ -737,30 +772,30 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) case GL_T: if (pname==GL_TEXTURE_GEN_MODE) { GLenum mode = (GLenum) (GLint) *params; - switch(mode) { - case GL_OBJECT_LINEAR: - texUnit->GenModeT = GL_OBJECT_LINEAR; - texUnit->GenBitT = TEXGEN_OBJ_LINEAR; - break; - case GL_EYE_LINEAR: - texUnit->GenModeT = GL_EYE_LINEAR; - texUnit->GenBitT = TEXGEN_EYE_LINEAR; - break; - case GL_REFLECTION_MAP_NV: - texUnit->GenModeT = GL_REFLECTION_MAP_NV; - texUnit->GenBitT = TEXGEN_REFLECTION_MAP_NV; - break; - case GL_NORMAL_MAP_NV: - texUnit->GenModeT = GL_NORMAL_MAP_NV; - texUnit->GenBitT = TEXGEN_NORMAL_MAP_NV; - break; - case GL_SPHERE_MAP: - texUnit->GenModeT = GL_SPHERE_MAP; - texUnit->GenBitT = TEXGEN_SPHERE_MAP; - break; - default: - gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); - return; + switch (mode) { + case GL_OBJECT_LINEAR: + texUnit->GenModeT = GL_OBJECT_LINEAR; + texUnit->GenBitT = TEXGEN_OBJ_LINEAR; + break; + case GL_EYE_LINEAR: + texUnit->GenModeT = GL_EYE_LINEAR; + texUnit->GenBitT = TEXGEN_EYE_LINEAR; + break; + case GL_REFLECTION_MAP_NV: + texUnit->GenModeT = GL_REFLECTION_MAP_NV; + texUnit->GenBitT = TEXGEN_REFLECTION_MAP_NV; + break; + case GL_NORMAL_MAP_NV: + texUnit->GenModeT = GL_NORMAL_MAP_NV; + texUnit->GenBitT = TEXGEN_NORMAL_MAP_NV; + break; + case GL_SPHERE_MAP: + texUnit->GenModeT = GL_SPHERE_MAP; + texUnit->GenBitT = TEXGEN_SPHERE_MAP; + break; + default: + gl_error( ctx, GL_INVALID_ENUM, "glTexGenfv(param)" ); + return; } } else if (pname==GL_OBJECT_PLANE) { @@ -927,7 +962,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGendv"); - switch( coord ) { + switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_DOUBLE(texUnit->GenModeS); @@ -1005,7 +1040,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGenfv"); - switch( coord ) { + switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = ENUM_TO_FLOAT(texUnit->GenModeS); @@ -1083,7 +1118,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glGetTexGeniv"); - switch( coord ) { + switch (coord) { case GL_S: if (pname==GL_TEXTURE_GEN_MODE) { params[0] = texUnit->GenModeS; @@ -1289,8 +1324,8 @@ void gl_update_dirty_texobjs( GLcontext *ctx ) struct gl_texture_object *t, *next; for (t = ctx->Shared->DirtyTexObjList; t; t = next) { next = t->NextDirty; - gl_test_texture_object_completeness(ctx, t); - gl_set_texture_sampler(t); + _mesa_test_texobj_completeness(ctx, t); + _mesa_set_texture_sampler(t); t->NextDirty = NULL; t->Dirty = GL_FALSE; } diff --git a/xc/extras/Mesa/src/texture.c b/xc/extras/Mesa/src/texture.c index c73171bd2..829b1bcb7 100644 --- a/xc/extras/Mesa/src/texture.c +++ b/xc/extras/Mesa/src/texture.c @@ -32,6 +32,7 @@ #include "macros.h" #include "mmath.h" #include "pb.h" +#include "teximage.h" #include "texture.h" #include "types.h" #include "xform.h" @@ -144,7 +145,12 @@ void gl_update_texture_unit( GLcontext *ctx, struct gl_texture_unit *texUnit ) { (void) ctx; - if ((texUnit->Enabled & TEXTURE0_3D) && texUnit->CurrentD[3]->Complete) { + if ((texUnit->Enabled & TEXTURE0_CUBE) && texUnit->CurrentCubeMap->Complete) { + texUnit->ReallyEnabled = TEXTURE0_CUBE; + texUnit->Current = texUnit->CurrentCubeMap; + texUnit->CurrentDimension = 6; + } + else if ((texUnit->Enabled & TEXTURE0_3D) && texUnit->CurrentD[3]->Complete) { texUnit->ReallyEnabled = TEXTURE0_3D; texUnit->Current = texUnit->CurrentD[3]; texUnit->CurrentDimension = 3; @@ -162,6 +168,10 @@ void gl_update_texture_unit( GLcontext *ctx, struct gl_texture_unit *texUnit ) else { if (MESA_VERBOSE & VERBOSE_TEXTURE) { switch (texUnit->Enabled) { + case TEXTURE0_CUBE: + fprintf(stderr, "Using incomplete cube texture %u\n", + texUnit->CurrentCubeMap->Name); + break; case TEXTURE0_3D: fprintf(stderr, "Using incomplete 3d texture %u\n", texUnit->CurrentD[3]->Name); @@ -245,11 +255,13 @@ static void palette_sample(const struct gl_texture_object *tObj, GLenum format; if (ctx->Texture.SharedPalette) { - palette = ctx->Texture.Palette.Table; + ASSERT(ctx->Texture.Palette.TableType == GL_UNSIGNED_BYTE); + palette = (const GLubyte *) ctx->Texture.Palette.Table; format = ctx->Texture.Palette.Format; } else { - palette = tObj->Palette.Table; + ASSERT(tObj->Palette.TableType == GL_UNSIGNED_BYTE); + palette = (const GLubyte *) tObj->Palette.Table; format = tObj->Palette.Format; } @@ -532,10 +544,10 @@ static void sample_1d_linear( const struct gl_texture_object *tObj, } { - GLfloat a = myFrac(u); + const GLfloat a = myFrac(u); /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ - GLint w0 = (GLint) ((1.0F-a) * WEIGHT_SCALE + 0.5F); - GLint w1 = (GLint) ( a * WEIGHT_SCALE + 0.5F); + const GLint w0 = (GLint) ((1.0F-a) * WEIGHT_SCALE + 0.5F); + const GLint w1 = (GLint) ( a * WEIGHT_SCALE + 0.5F); GLubyte t0[4], t1[4]; /* texels */ @@ -614,7 +626,7 @@ sample_1d_nearest_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_1d_nearest( tObj, tObj->Image[level ], s, t0 ); sample_1d_nearest( tObj, tObj->Image[level+1], s, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -643,7 +655,7 @@ sample_1d_linear_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_1d_linear( tObj, tObj->Image[level ], s, t0 ); sample_1d_linear( tObj, tObj->Image[level+1], s, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -906,13 +918,13 @@ static void sample_2d_linear( const struct gl_texture_object *tObj, } { - GLfloat a = myFrac(u); - GLfloat b = myFrac(v); + const GLfloat a = myFrac(u); + const GLfloat b = myFrac(v); /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ - GLint w00 = (GLint) ((1.0F-a)*(1.0F-b) * WEIGHT_SCALE + 0.5F); - GLint w10 = (GLint) ( a *(1.0F-b) * WEIGHT_SCALE + 0.5F); - GLint w01 = (GLint) ((1.0F-a)* b * WEIGHT_SCALE + 0.5F); - GLint w11 = (GLint) ( a * b * WEIGHT_SCALE + 0.5F); + const GLint w00 = (GLint) ((1.0F-a)*(1.0F-b) * WEIGHT_SCALE + 0.5F); + const GLint w10 = (GLint) ( a *(1.0F-b) * WEIGHT_SCALE + 0.5F); + const GLint w01 = (GLint) ((1.0F-a)* b * WEIGHT_SCALE + 0.5F); + const GLint w11 = (GLint) ( a * b * WEIGHT_SCALE + 0.5F); GLubyte t00[4]; GLubyte t10[4]; GLubyte t01[4]; @@ -1008,7 +1020,7 @@ sample_2d_nearest_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; /* texels */ - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_2d_nearest( tObj, tObj->Image[level ], s, t, t0 ); sample_2d_nearest( tObj, tObj->Image[level+1], s, t, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -1037,7 +1049,7 @@ sample_2d_linear_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; /* texels */ - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_2d_linear( tObj, tObj->Image[level ], s, t, t0 ); sample_2d_linear( tObj, tObj->Image[level+1], s, t, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -1385,9 +1397,9 @@ static void sample_3d_linear( const struct gl_texture_object *tObj, } { - GLfloat a = myFrac(u); - GLfloat b = myFrac(v); - GLfloat c = myFrac(w); + const GLfloat a = myFrac(u); + const GLfloat b = myFrac(v); + const GLfloat c = myFrac(w); /* compute sample weights in fixed point in [0,WEIGHT_SCALE] */ GLint w000 = (GLint) ((1.0F-a)*(1.0F-b)*(1.0F-c) * WEIGHT_SCALE + 0.5F); GLint w100 = (GLint) ( a *(1.0F-b)*(1.0F-c) * WEIGHT_SCALE + 0.5F); @@ -1525,7 +1537,7 @@ sample_3d_nearest_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; /* texels */ - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_3d_nearest( tObj, tObj->Image[level ], s, t, r, t0 ); sample_3d_nearest( tObj, tObj->Image[level+1], s, t, r, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -1553,7 +1565,7 @@ sample_3d_linear_mipmap_linear( const struct gl_texture_object *tObj, } else { GLubyte t0[4], t1[4]; /* texels */ - GLfloat f = myFrac(lambda); + const GLfloat f = myFrac(lambda); sample_3d_linear( tObj, tObj->Image[level ], s, t, r, t0 ); sample_3d_linear( tObj, tObj->Image[level+1], s, t, r, t1 ); rgba[RCOMP] = (GLubyte) (GLint) ((1.0F-f) * t0[RCOMP] + f * t1[RCOMP]); @@ -1648,6 +1660,187 @@ static void sample_lambda_3d( const struct gl_texture_object *tObj, GLuint n, } +/**********************************************************************/ +/* Texture Cube Map Sampling Functions */ +/**********************************************************************/ + +static struct gl_texture_image * +choose_cube_face(const struct gl_texture_object *texObj, + const GLfloat texcoord[4], + GLint level, + GLfloat *newS, GLfloat *newT) +{ +/* + major axis + direction target sc tc ma + ---------- ------------------------------- --- --- --- + +rx TEXTURE_CUBE_MAP_POSITIVE_X_EXT -rz -ry rx + -rx TEXTURE_CUBE_MAP_NEGATIVE_X_EXT +rz -ry rx + +ry TEXTURE_CUBE_MAP_POSITIVE_Y_EXT +rx +rz ry + -ry TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT +rx -rz ry + +rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz + -rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz +*/ + struct gl_texture_image *texImg; + const GLfloat rx = texcoord[0], ry = texcoord[1], rz = texcoord[2]; + const GLfloat arx = ABSF(rx), ary = ABSF(ry), arz = ABSF(rz); + GLfloat sc, tc, ma; + + if (arx > ary && arx > arz) { + if (rx >= 0.0F) { + texImg = texObj->Image[level]; + sc = -rz; + tc = -ry; + ma = arx; + } + else { + texImg = texObj->NegX[level]; + sc = rz; + tc = -ry; + ma = arx; + } + } + else if (ary > arx && ary > arz) { + if (ry >= 0.0F) { + texImg = texObj->PosY[level]; + sc = rx; + tc = rz; + ma = ary; + } + else { + texImg = texObj->NegY[level]; + sc = rx; + tc = -rz; + ma = ary; + } + } + else { + if (rz > 0.0F) { + texImg = texObj->PosZ[level]; + sc = rx; + tc = -ry; + ma = arz; + } + else { + texImg = texObj->NegZ[level]; + sc = -rx; + tc = -ry; + ma = arz; + } + } + + *newS = ( sc / ma + 1.0F ) * 0.5F; + *newT = ( tc / ma + 1.0F ) * 0.5F; + return texImg; +} + + +static void +sample_nearest_cube(const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLubyte rgba[][4]) +{ + GLuint i; + (void) lambda; + for (i = 0; i < n; i++) { + struct gl_texture_image *image; + GLfloat newS, newT; + GLfloat coord[4]; + coord[0] = s[i]; + coord[1] = t[i]; + coord[2] = u[i]; + image = choose_cube_face(tObj, coord, 0, &newS, &newT); + sample_2d_nearest( tObj, image, newS, newT, rgba[i] ); + } +} + +static void +sample_linear_cube(const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLubyte rgba[][4]) +{ + GLuint i; + (void) lambda; + for (i = 0; i < n; i++) { + struct gl_texture_image *image; + GLfloat newS, newT; + GLfloat coord[4]; + coord[0] = s[i]; + coord[1] = t[i]; + coord[2] = u[i]; + image = choose_cube_face(tObj, coord, 0, &newS, &newT); + sample_2d_linear( tObj, image, newS, newT, rgba[i] ); + } +} + +static void +sample_lambda_cube(const struct gl_texture_object *tObj, GLuint n, + const GLfloat s[], const GLfloat t[], + const GLfloat u[], const GLfloat lambda[], + GLubyte rgba[][4]) +{ + GLuint i; + + for (i = 0; i < n; i++) { + struct gl_texture_image *image; + GLfloat newS, newT; + GLfloat coord[4]; + coord[0] = s[i]; + coord[1] = t[i]; + coord[2] = u[i]; + image = choose_cube_face(tObj, coord, 0, &newS, &newT); + + if (lambda[i] > tObj->MinMagThresh) { + /* minification */ + switch (tObj->MinFilter) { + case GL_NEAREST: + sample_2d_nearest( tObj, image, newS, newT, rgba[i] ); + break; + case GL_LINEAR: + sample_2d_linear( tObj, image, newS, newT, rgba[i] ); + break; + case GL_NEAREST_MIPMAP_NEAREST: + /* + sample_3d_nearest_mipmap_nearest( tObj, s[i], t[i], u[i], lambda[i], rgba[i] ); + */ + break; + case GL_LINEAR_MIPMAP_NEAREST: + /* + sample_3d_linear_mipmap_nearest( tObj, s[i], t[i], u[i], lambda[i], rgba[i] ); + */ + break; + case GL_NEAREST_MIPMAP_LINEAR: + /* + sample_3d_nearest_mipmap_linear( tObj, s[i], t[i], u[i], lambda[i], rgba[i] ); + */ + break; + case GL_LINEAR_MIPMAP_LINEAR: + /* + sample_3d_linear_mipmap_linear( tObj, s[i], t[i], u[i], lambda[i], rgba[i] ); + */ + break; + default: + gl_problem(NULL, "Bad min filter in sample_lambda_cube"); + } + } + else { + /* magnification */ + switch (tObj->MagFilter) { + case GL_NEAREST: + sample_2d_nearest( tObj, image, newS, newT, rgba[i] ); + break; + case GL_LINEAR: + sample_2d_linear( tObj, image, newS, newT, rgba[i] ); + break; + default: + gl_problem(NULL, "Bad mag filter in sample_lambda_cube"); + } + } + } +} + /**********************************************************************/ /* Texture Sampling Setup */ @@ -1657,7 +1850,8 @@ static void sample_lambda_3d( const struct gl_texture_object *tObj, GLuint n, /* * Setup the texture sampling function for this texture object. */ -void gl_set_texture_sampler( struct gl_texture_object *t ) +void +_mesa_set_texture_sampler( struct gl_texture_object *t ) { if (!t->Complete) { t->SampleFunc = NULL; @@ -1723,8 +1917,20 @@ void gl_set_texture_sampler( struct gl_texture_object *t ) t->SampleFunc = sample_nearest_3d; } break; + case 6: /* cube map */ + if (needLambda) { + t->SampleFunc = sample_lambda_cube; + } + else if (t->MinFilter==GL_LINEAR) { + t->SampleFunc = sample_linear_cube; + } + else { + ASSERT(t->MinFilter==GL_NEAREST); + t->SampleFunc = sample_nearest_cube; + } + break; default: - gl_problem(NULL, "invalid dimensions in gl_set_texture_sampler"); + gl_problem(NULL, "invalid dimensions in _mesa_set_texture_sampler"); } } } @@ -2092,12 +2298,18 @@ void gl_texture_pixels( GLcontext *ctx, GLuint texUnit, GLuint n, const GLfloat r[], GLfloat lambda[], GLubyte rgba[][4] ) { - GLuint mask = (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D) << (texUnit * 4); + GLuint mask = (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D | TEXTURE0_CUBE) << (texUnit * 4); if (ctx->Texture.Enabled & mask) { const struct gl_texture_unit *textureUnit = &ctx->Texture.Unit[texUnit]; if (textureUnit->Current && textureUnit->Current->SampleFunc) { - GLubyte texel[PB_SIZE][4]; + if (textureUnit->LodBias != 0.0F) { + /* apply LOD bias, but don't clamp yet */ + GLuint i; + for (i=0;i<n;i++) { + lambda[i] += textureUnit->LodBias; + } + } if (textureUnit->Current->MinLod != -1000.0 || textureUnit->Current->MaxLod != 1000.0) { @@ -2111,6 +2323,45 @@ void gl_texture_pixels( GLcontext *ctx, GLuint texUnit, GLuint n, } } + /* fetch texture images from device driver, if needed */ + { + static const GLenum targets[] = { + GL_TEXTURE_1D, + GL_TEXTURE_2D, + GL_TEXTURE_3D, + GL_TEXTURE_CUBE_MAP_ARB, + GL_TEXTURE_CUBE_MAP_ARB, + GL_TEXTURE_CUBE_MAP_ARB + }; + struct gl_texture_object *texObj = textureUnit->Current; + GLboolean needLambda = (texObj->MinFilter != texObj->MagFilter); + GLenum target = targets[texObj->Dimensions - 1]; + if (needLambda) { + GLint level; + /* Get images for all mipmap levels. We might not need them + * all but this is easier. We're on a (slow) software path + * anyway. + */ + for (level = 0; level <= texObj->P; level++) { + struct gl_texture_image *texImg = texObj->Image[level]; + if (!texImg->Data) { + _mesa_get_teximage_from_driver(ctx, target, level, texObj); + if (!texImg->Data) + return; /* out of memory */ + } + } + } + else { + GLint level = texObj->BaseLevel; + struct gl_texture_image *texImg = texObj->Image[level]; + if (!texImg->Data) { + _mesa_get_teximage_from_driver(ctx, target, level, texObj); + if (!texImg->Data) + return; /* out of memory */ + } + } + } + /* Sample the texture. */ (*textureUnit->Current->SampleFunc)( textureUnit->Current, n, s, t, r, lambda, texel ); diff --git a/xc/extras/Mesa/src/texture.h b/xc/extras/Mesa/src/texture.h index d6631b786..58bc13136 100644 --- a/xc/extras/Mesa/src/texture.h +++ b/xc/extras/Mesa/src/texture.h @@ -34,7 +34,8 @@ #include "types.h" -extern void gl_set_texture_sampler( struct gl_texture_object *t ); +extern void +_mesa_set_texture_sampler( struct gl_texture_object *t ); extern void gl_init_texture( void ); diff --git a/xc/extras/Mesa/src/types.h b/xc/extras/Mesa/src/types.h index 00c4275e7..d85698a73 100644 --- a/xc/extras/Mesa/src/types.h +++ b/xc/extras/Mesa/src/types.h @@ -31,7 +31,6 @@ #include "glheader.h" #include "config.h" -#include "extensions.h" #include "fixed.h" #include "glapitable.h" #include "glthread.h" @@ -176,49 +175,52 @@ typedef void (*TextureSampleFunc)( const struct gl_texture_object *tObj, /* Texture image record */ struct gl_texture_image { - GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, + GLenum Format; /* GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, * GL_INTENSITY, GL_RGB, GL_RGBA, or * GL_COLOR_INDEX only */ - GLenum IntFormat; /* Internal format as given by the user */ - GLubyte RedBits; /* Bits per texel component */ - GLubyte GreenBits; /* These are initialized by Mesa but */ - GLubyte BlueBits; /* may be reassigned by the device */ - GLubyte AlphaBits; /* driver to indicate the true texture */ - GLubyte IntensityBits; /* color resolution. */ - GLubyte LuminanceBits; - GLubyte IndexBits; - GLuint Border; /* 0 or 1 */ - GLuint Width; /* = 2^WidthLog2 + 2*Border */ - GLuint Height; /* = 2^HeightLog2 + 2*Border */ - GLuint Depth; /* = 2^DepthLog2 + 2*Border */ - GLuint Width2; /* = Width - 2*Border */ - GLuint Height2; /* = Height - 2*Border */ - GLuint Depth2; /* = Depth - 2*Border */ - GLuint WidthLog2; /* = log2(Width2) */ - GLuint HeightLog2; /* = log2(Height2) */ - GLuint DepthLog2; /* = log2(Depth2) */ - GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */ - GLubyte *Data; /* Image data as unsigned bytes */ - - /* For device driver: */ - void *DriverData; /* Arbitrary device driver data */ + GLenum IntFormat; /* Internal format as given by the user */ + GLubyte RedBits; /* Bits per texel component */ + GLubyte GreenBits; /* These are initialized by Mesa but */ + GLubyte BlueBits; /* may be reassigned by the device */ + GLubyte AlphaBits; /* driver to indicate the true texture */ + GLubyte IntensityBits; /* color resolution. */ + GLubyte LuminanceBits; + GLubyte IndexBits; + GLuint Border; /* 0 or 1 */ + GLuint Width; /* = 2^WidthLog2 + 2*Border */ + GLuint Height; /* = 2^HeightLog2 + 2*Border */ + GLuint Depth; /* = 2^DepthLog2 + 2*Border */ + GLuint Width2; /* = Width - 2*Border */ + GLuint Height2; /* = Height - 2*Border */ + GLuint Depth2; /* = Depth - 2*Border */ + GLuint WidthLog2; /* = log2(Width2) */ + GLuint HeightLog2; /* = log2(Height2) */ + GLuint DepthLog2; /* = log2(Depth2) */ + GLuint MaxLog2; /* = MAX(WidthLog2, HeightLog2) */ + GLubyte *Data; /* Image data as unsigned bytes */ + + GLboolean IsCompressed; /* GL_ARB_texture_compression */ + GLuint CompressedSize; /* GL_ARB_texture_compression */ + + /* For device driver: */ + void *DriverData; /* Arbitrary device driver data */ }; /* Data structure for color tables */ struct gl_color_table { - GLvoid *Table; - GLenum TableType; /* GL_UNSIGNED_BYTE or GL_FLOAT */ - GLuint Size; /* number of entries (rows) in table */ - GLenum Format; - GLenum IntFormat; - GLint RedSize; - GLint GreenSize; - GLint BlueSize; - GLint AlphaSize; - GLint LuminanceSize; - GLint IntensitySize; + GLvoid *Table; + GLenum TableType; /* GL_UNSIGNED_BYTE or GL_FLOAT */ + GLuint Size; /* number of entries (rows) in table */ + GLenum Format; + GLenum IntFormat; + GLint RedSize; + GLint GreenSize; + GLint BlueSize; + GLint AlphaSize; + GLint LuminanceSize; + GLint IntensitySize; }; @@ -262,47 +264,47 @@ struct gl_color_table { #define SHINE_TABLE_SIZE 256 struct gl_light { - struct gl_light *next; /* double linked list with sentinel */ - struct gl_light *prev; - - GLfloat Ambient[4]; /* ambient color */ - GLfloat Diffuse[4]; /* diffuse color */ - GLfloat Specular[4]; /* specular color */ - GLfloat EyePosition[4]; /* position in eye coordinates */ - GLfloat EyeDirection[4]; /* spotlight dir in eye coordinates */ - GLfloat SpotExponent; - GLfloat SpotCutoff; /* in degress */ - GLfloat CosCutoff; /* = MAX(0, cos(SpotCutoff)) */ - GLfloat ConstantAttenuation; - GLfloat LinearAttenuation; - GLfloat QuadraticAttenuation; - GLboolean Enabled; /* On/off flag */ - - /* Derived fields */ - GLuint Flags; /* State */ - - GLfloat Position[4]; /* position in eye/obj coordinates */ - GLfloat VP_inf_norm[3]; /* Norm direction to infinite light */ - GLfloat h_inf_norm[3]; /* Norm( VP_inf_norm + <0,0,1> ) */ - GLfloat NormDirection[4]; /* normalized spotlight direction */ - GLfloat VP_inf_spot_attenuation; - - GLfloat SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */ - GLfloat MatAmbient[2][3]; /* material ambient * light ambient */ - GLfloat MatDiffuse[2][3]; /* material diffuse * light diffuse */ - GLfloat MatSpecular[2][3]; /* material spec * light specular */ - GLfloat dli; /* CI diffuse light intensity */ - GLfloat sli; /* CI specular light intensity */ - GLboolean IsMatSpecular[2]; + struct gl_light *next; /* double linked list with sentinel */ + struct gl_light *prev; + + GLfloat Ambient[4]; /* ambient color */ + GLfloat Diffuse[4]; /* diffuse color */ + GLfloat Specular[4]; /* specular color */ + GLfloat EyePosition[4]; /* position in eye coordinates */ + GLfloat EyeDirection[4]; /* spotlight dir in eye coordinates */ + GLfloat SpotExponent; + GLfloat SpotCutoff; /* in degress */ + GLfloat CosCutoff; /* = MAX(0, cos(SpotCutoff)) */ + GLfloat ConstantAttenuation; + GLfloat LinearAttenuation; + GLfloat QuadraticAttenuation; + GLboolean Enabled; /* On/off flag */ + + /* Derived fields */ + GLuint Flags; /* State */ + + GLfloat Position[4]; /* position in eye/obj coordinates */ + GLfloat VP_inf_norm[3]; /* Norm direction to infinite light */ + GLfloat h_inf_norm[3]; /* Norm( VP_inf_norm + <0,0,1> ) */ + GLfloat NormDirection[4]; /* normalized spotlight direction */ + GLfloat VP_inf_spot_attenuation; + + GLfloat SpotExpTable[EXP_TABLE_SIZE][2]; /* to replace a pow() call */ + GLfloat MatAmbient[2][3]; /* material ambient * light ambient */ + GLfloat MatDiffuse[2][3]; /* material diffuse * light diffuse */ + GLfloat MatSpecular[2][3]; /* material spec * light specular */ + GLfloat dli; /* CI diffuse light intensity */ + GLfloat sli; /* CI specular light intensity */ + GLboolean IsMatSpecular[2]; }; struct gl_lightmodel { - GLfloat Ambient[4]; /* ambient color */ - GLboolean LocalViewer; /* Local (or infinite) view point? */ - GLboolean TwoSide; /* Two (or one) sided lighting? */ - GLenum ColorControl; /* either GL_SINGLE_COLOR */ - /* or GL_SEPARATE_SPECULAR_COLOR */ + GLfloat Ambient[4]; /* ambient color */ + GLboolean LocalViewer; /* Local (or infinite) view point? */ + GLboolean TwoSide; /* Two (or one) sided lighting? */ + GLenum ColorControl; /* either GL_SINGLE_COLOR */ + /* or GL_SEPARATE_SPECULAR_COLOR */ }; @@ -314,7 +316,7 @@ struct gl_lightmodel { struct gl_accum_attrib { - GLfloat ClearColor[4]; /* Accumulation buffer clear color */ + GLfloat ClearColor[4]; /* Accumulation buffer clear color */ }; @@ -328,197 +330,203 @@ struct gl_accum_attrib { struct gl_colorbuffer_attrib { - GLuint ClearIndex; /* Index to use for glClear */ - GLfloat ClearColor[4]; /* Color to use for glClear */ - - GLuint IndexMask; /* Color index write mask */ - GLubyte ColorMask[4]; /* Each flag is 0xff or 0x0 */ - GLboolean SWmasking; /* Do color/CI masking in software? */ - - GLenum DrawBuffer; /* Which buffer to draw into */ - GLenum DriverDrawBuffer; /* Current device driver dest buffer */ - GLboolean MultiDrawBuffer; /* Drawing to mutliple buffers? */ - GLubyte DrawDestMask; /* bitwise-OR of bitflags above */ - - /* alpha testing */ - GLboolean AlphaEnabled; /* Alpha test enabled flag */ - GLenum AlphaFunc; /* Alpha test function */ - GLubyte AlphaRef; /* Alpha ref value in range [0,255] */ - - /* blending */ - GLboolean BlendEnabled; /* Blending enabled flag */ - GLenum BlendSrcRGB; /* Blending source operator */ - GLenum BlendDstRGB; /* Blending destination operator */ - GLenum BlendSrcA; /* GL_INGR_blend_func_separate */ - GLenum BlendDstA; /* GL_INGR_blend_func_separate */ - GLenum BlendEquation; - GLfloat BlendColor[4]; - blend_func BlendFunc; /* Points to C blending function */ - - /* logic op */ - GLenum LogicOp; /* Logic operator */ - GLboolean IndexLogicOpEnabled; /* Color index logic op enabled flag */ - GLboolean ColorLogicOpEnabled; /* RGBA logic op enabled flag */ - GLboolean SWLogicOpEnabled; /* Do logic ops in software? */ - - GLboolean DitherFlag; /* Dither enable flag */ + GLuint ClearIndex; /* Index to use for glClear */ + GLfloat ClearColor[4]; /* Color to use for glClear */ + + GLuint IndexMask; /* Color index write mask */ + GLubyte ColorMask[4]; /* Each flag is 0xff or 0x0 */ + GLboolean SWmasking; /* Do color/CI masking in software? */ + + GLenum DrawBuffer; /* Which buffer to draw into */ + GLenum DriverDrawBuffer; /* Current device driver dest buffer */ + GLboolean MultiDrawBuffer; /* Drawing to mutliple buffers? */ + GLubyte DrawDestMask; /* bitwise-OR of bitflags above */ + + /* alpha testing */ + GLboolean AlphaEnabled; /* Alpha test enabled flag */ + GLenum AlphaFunc; /* Alpha test function */ + GLubyte AlphaRef; /* Alpha ref value in range [0,255] */ + + /* blending */ + GLboolean BlendEnabled; /* Blending enabled flag */ + GLenum BlendSrcRGB; /* Blending source operator */ + GLenum BlendDstRGB; /* Blending destination operator */ + GLenum BlendSrcA; /* GL_INGR_blend_func_separate */ + GLenum BlendDstA; /* GL_INGR_blend_func_separate */ + GLenum BlendEquation; + GLfloat BlendColor[4]; + blend_func BlendFunc; /* Points to C blending function */ + + /* logic op */ + GLenum LogicOp; /* Logic operator */ + GLboolean IndexLogicOpEnabled; /* Color index logic op enabled flag */ + GLboolean ColorLogicOpEnabled; /* RGBA logic op enabled flag */ + GLboolean SWLogicOpEnabled; /* Do logic ops in software? */ + + GLboolean DitherFlag; /* Dither enable flag */ }; struct gl_current_attrib { - /* KW: These values valid only when the VB is flushed. - */ - GLuint Flag; /* Contains size information */ - GLfloat Normal[3]; - GLubyte ByteColor[4]; /* Current RGBA color */ - GLuint Index; /* Current color index */ - GLboolean EdgeFlag; /* Current edge flag */ - GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */ - GLenum Primitive; /* Prim or GL_POLYGON+1 */ + /* KW: These values valid only when the VB is flushed. + */ + GLuint Flag; /* Contains size information */ + GLfloat Normal[3]; + GLubyte ByteColor[4]; /* Current RGBA color */ + GLuint Index; /* Current color index */ + GLboolean EdgeFlag; /* Current edge flag */ + GLfloat Texcoord[MAX_TEXTURE_UNITS][4]; /* Current texture coords */ + GLenum Primitive; /* Prim or GL_POLYGON+1 */ - /* KW: No change to these values. - */ - GLfloat RasterPos[4]; /* Current raster position */ - GLfloat RasterDistance; /* Current raster distance */ - GLfloat RasterColor[4]; /* Current raster color */ - GLuint RasterIndex; /* Current raster index */ - GLfloat *RasterTexCoord; /* Current raster texcoord*/ - GLfloat RasterMultiTexCoord[MAX_TEXTURE_UNITS][4]; - GLboolean RasterPosValid; /* Raster po valid flag */ + /* KW: No change to these values. + */ + GLfloat RasterPos[4]; /* Current raster position */ + GLfloat RasterDistance; /* Current raster distance */ + GLfloat RasterColor[4]; /* Current raster color */ + GLuint RasterIndex; /* Current raster index */ + GLfloat *RasterTexCoord; /* Current raster texcoord*/ + GLfloat RasterMultiTexCoord[MAX_TEXTURE_UNITS][4]; + GLboolean RasterPosValid; /* Raster po valid flag */ }; struct gl_depthbuffer_attrib { - GLenum Func; /* Function for depth buffer compare */ - GLfloat Clear; /* Value to clear depth buffer to */ - GLboolean Test; /* Depth buffering enabled flag */ - GLboolean Mask; /* Depth buffer writable? */ - GLboolean OcclusionTest;/* XXX GL_HP_occlusion_test */ + GLenum Func; /* Function for depth buffer compare */ + GLfloat Clear; /* Value to clear depth buffer to */ + GLboolean Test; /* Depth buffering enabled flag */ + GLboolean Mask; /* Depth buffer writable? */ + GLboolean OcclusionTest; /* GL_HP_occlusion_test */ }; struct gl_enable_attrib { - GLboolean AlphaTest; - GLboolean AutoNormal; - GLboolean Blend; - GLboolean ClipPlane[MAX_CLIP_PLANES]; - GLboolean ColorMaterial; - GLboolean CullFace; - GLboolean DepthTest; - GLboolean Dither; - GLboolean Fog; - GLboolean Histogram; - GLboolean Light[MAX_LIGHTS]; - GLboolean Lighting; - GLboolean LineSmooth; - GLboolean LineStipple; - GLboolean IndexLogicOp; - GLboolean ColorLogicOp; - GLboolean Map1Color4; - GLboolean Map1Index; - GLboolean Map1Normal; - GLboolean Map1TextureCoord1; - GLboolean Map1TextureCoord2; - GLboolean Map1TextureCoord3; - GLboolean Map1TextureCoord4; - GLboolean Map1Vertex3; - GLboolean Map1Vertex4; - GLboolean Map2Color4; - GLboolean Map2Index; - GLboolean Map2Normal; - GLboolean Map2TextureCoord1; - GLboolean Map2TextureCoord2; - GLboolean Map2TextureCoord3; - GLboolean Map2TextureCoord4; - GLboolean Map2Vertex3; - GLboolean Map2Vertex4; - GLboolean MinMax; - GLboolean Normalize; - GLboolean PixelTexture; - GLboolean PointSmooth; - GLboolean PolygonOffsetPoint; - GLboolean PolygonOffsetLine; - GLboolean PolygonOffsetFill; - GLboolean PolygonSmooth; - GLboolean PolygonStipple; - GLboolean RescaleNormals; - GLboolean Scissor; - GLboolean Stencil; - GLuint Texture; - GLuint TexGen[MAX_TEXTURE_UNITS]; + GLboolean AlphaTest; + GLboolean AutoNormal; + GLboolean Blend; + GLboolean ClipPlane[MAX_CLIP_PLANES]; + GLboolean ColorMaterial; + GLboolean Convolution1D; + GLboolean Convolution2D; + GLboolean Separable2D; + GLboolean CullFace; + GLboolean DepthTest; + GLboolean Dither; + GLboolean Fog; + GLboolean Histogram; + GLboolean Light[MAX_LIGHTS]; + GLboolean Lighting; + GLboolean LineSmooth; + GLboolean LineStipple; + GLboolean IndexLogicOp; + GLboolean ColorLogicOp; + GLboolean Map1Color4; + GLboolean Map1Index; + GLboolean Map1Normal; + GLboolean Map1TextureCoord1; + GLboolean Map1TextureCoord2; + GLboolean Map1TextureCoord3; + GLboolean Map1TextureCoord4; + GLboolean Map1Vertex3; + GLboolean Map1Vertex4; + GLboolean Map2Color4; + GLboolean Map2Index; + GLboolean Map2Normal; + GLboolean Map2TextureCoord1; + GLboolean Map2TextureCoord2; + GLboolean Map2TextureCoord3; + GLboolean Map2TextureCoord4; + GLboolean Map2Vertex3; + GLboolean Map2Vertex4; + GLboolean MinMax; + GLboolean Normalize; + GLboolean PixelTexture; + GLboolean PointSmooth; + GLboolean PolygonOffsetPoint; + GLboolean PolygonOffsetLine; + GLboolean PolygonOffsetFill; + GLboolean PolygonSmooth; + GLboolean PolygonStipple; + GLboolean RescaleNormals; + GLboolean Scissor; + GLboolean Stencil; + GLuint Texture; + GLuint TexGen[MAX_TEXTURE_UNITS]; }; struct gl_eval_attrib { - /* Enable bits */ - GLboolean Map1Color4; - GLboolean Map1Index; - GLboolean Map1Normal; - GLboolean Map1TextureCoord1; - GLboolean Map1TextureCoord2; - GLboolean Map1TextureCoord3; - GLboolean Map1TextureCoord4; - GLboolean Map1Vertex3; - GLboolean Map1Vertex4; - GLboolean Map2Color4; - GLboolean Map2Index; - GLboolean Map2Normal; - GLboolean Map2TextureCoord1; - GLboolean Map2TextureCoord2; - GLboolean Map2TextureCoord3; - GLboolean Map2TextureCoord4; - GLboolean Map2Vertex3; - GLboolean Map2Vertex4; - GLboolean AutoNormal; - /* Map Grid endpoints and divisions and calculated du values */ - GLint MapGrid1un; - GLfloat MapGrid1u1, MapGrid1u2, MapGrid1du; - GLint MapGrid2un, MapGrid2vn; - GLfloat MapGrid2u1, MapGrid2u2, MapGrid2du; - GLfloat MapGrid2v1, MapGrid2v2, MapGrid2dv; + /* Enable bits */ + GLboolean Map1Color4; + GLboolean Map1Index; + GLboolean Map1Normal; + GLboolean Map1TextureCoord1; + GLboolean Map1TextureCoord2; + GLboolean Map1TextureCoord3; + GLboolean Map1TextureCoord4; + GLboolean Map1Vertex3; + GLboolean Map1Vertex4; + GLboolean Map2Color4; + GLboolean Map2Index; + GLboolean Map2Normal; + GLboolean Map2TextureCoord1; + GLboolean Map2TextureCoord2; + GLboolean Map2TextureCoord3; + GLboolean Map2TextureCoord4; + GLboolean Map2Vertex3; + GLboolean Map2Vertex4; + GLboolean AutoNormal; + /* Map Grid endpoints and divisions and calculated du values */ + GLint MapGrid1un; + GLfloat MapGrid1u1, MapGrid1u2, MapGrid1du; + GLint MapGrid2un, MapGrid2vn; + GLfloat MapGrid2u1, MapGrid2u2, MapGrid2du; + GLfloat MapGrid2v1, MapGrid2v2, MapGrid2dv; }; struct gl_fog_attrib { - GLboolean Enabled; /* Fog enabled flag */ - GLfloat Color[4]; /* Fog color */ - GLfloat Density; /* Density >= 0.0 */ - GLfloat Start; /* Start distance in eye coords */ - GLfloat End; /* End distance in eye coords */ - GLfloat Index; /* Fog index */ - GLenum Mode; /* Fog mode */ + GLboolean Enabled; /* Fog enabled flag */ + GLfloat Color[4]; /* Fog color */ + GLfloat Density; /* Density >= 0.0 */ + GLfloat Start; /* Start distance in eye coords */ + GLfloat End; /* End distance in eye coords */ + GLfloat Index; /* Fog index */ + GLenum Mode; /* Fog mode */ }; struct gl_hint_attrib { - /* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */ - GLenum PerspectiveCorrection; - GLenum PointSmooth; - GLenum LineSmooth; - GLenum PolygonSmooth; - GLenum Fog; - - /* GL_PGI_misc_hints */ - GLenum AllowDrawWin; - GLenum AllowDrawFrg; - GLenum AllowDrawMem; - GLenum StrictLighting; - - /* GL_EXT_clip_volume_hint */ - GLenum ClipVolumeClipping; + /* always one of GL_FASTEST, GL_NICEST, or GL_DONT_CARE */ + GLenum PerspectiveCorrection; + GLenum PointSmooth; + GLenum LineSmooth; + GLenum PolygonSmooth; + GLenum Fog; + + /* GL_PGI_misc_hints */ + GLenum AllowDrawWin; + GLenum AllowDrawFrg; + GLenum AllowDrawMem; + GLenum StrictLighting; + + /* GL_EXT_clip_volume_hint */ + GLenum ClipVolumeClipping; + + /* GL_ARB_texture_compression */ + GLenum TextureCompression; }; struct gl_histogram_attrib { - GLuint Width; - GLint Format; - GLboolean Sink; - GLuint RedSize; - GLuint GreenSize; - GLuint BlueSize; - GLuint AlphaSize; - GLuint LuminanceSize; - GLuint Count[HISTOGRAM_TABLE_SIZE][4]; + GLuint Width; + GLint Format; + GLboolean Sink; + GLuint RedSize; + GLuint GreenSize; + GLuint BlueSize; + GLuint AlphaSize; + GLuint LuminanceSize; + GLuint Count[HISTOGRAM_TABLE_SIZE][4]; }; @@ -529,6 +537,16 @@ struct gl_minmax_attrib { }; +struct gl_convolution_attrib { + /* XXX not done yet */ + GLenum Format; + GLenum InternalFormat; + GLuint Width; + GLuint Height; + GLfloat Filter[MAX_CONVOLUTION_WIDTH * MAX_CONVOLUTION_HEIGHT * 4]; +}; + + struct gl_light_attrib { struct gl_light Light[MAX_LIGHTS]; /* Array of lights */ struct gl_lightmodel Model; /* Lighting model */ @@ -559,135 +577,139 @@ struct gl_light_attrib { #define LIGHT_NEED_VERTICES (LIGHT_POSITIONAL|LIGHT_LOCAL_VIEWER) struct gl_line_attrib { - GLboolean SmoothFlag; /* GL_LINE_SMOOTH enabled? */ - GLboolean StippleFlag; /* GL_LINE_STIPPLE enabled? */ - GLushort StipplePattern; /* Stipple pattern */ - GLint StippleFactor; /* Stipple repeat factor */ - GLfloat Width; /* Line width */ + GLboolean SmoothFlag; /* GL_LINE_SMOOTH enabled? */ + GLboolean StippleFlag; /* GL_LINE_STIPPLE enabled? */ + GLushort StipplePattern; /* Stipple pattern */ + GLint StippleFactor; /* Stipple repeat factor */ + GLfloat Width; /* Line width */ }; struct gl_list_attrib { - GLuint ListBase; + GLuint ListBase; }; struct gl_pixel_attrib { - GLenum ReadBuffer; /* src buffer for glRead/CopyPixels */ - GLenum DriverReadBuffer; /* Driver's current source buffer */ - GLfloat RedBias, RedScale; - GLfloat GreenBias, GreenScale; - GLfloat BlueBias, BlueScale; - GLfloat AlphaBias, AlphaScale; - GLboolean ScaleOrBiasRGBA; - GLfloat DepthBias, DepthScale; - GLint IndexShift, IndexOffset; - GLboolean MapColorFlag; - GLboolean MapStencilFlag; - GLfloat ZoomX, ZoomY; - GLint MapStoSsize; /* Size of each pixel map */ - GLint MapItoIsize; - GLint MapItoRsize; - GLint MapItoGsize; - GLint MapItoBsize; - GLint MapItoAsize; - GLint MapRtoRsize; - GLint MapGtoGsize; - GLint MapBtoBsize; - GLint MapAtoAsize; - GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /* Pixel map tables */ - GLint MapItoI[MAX_PIXEL_MAP_TABLE]; - GLfloat MapItoR[MAX_PIXEL_MAP_TABLE]; - GLfloat MapItoG[MAX_PIXEL_MAP_TABLE]; - GLfloat MapItoB[MAX_PIXEL_MAP_TABLE]; - GLfloat MapItoA[MAX_PIXEL_MAP_TABLE]; - GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /* converted to 8-bit color */ - GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE]; - GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE]; - GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE]; - GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE]; - GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE]; - GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE]; - GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE]; - /* GL_EXT_histogram */ - GLboolean HistogramEnabled; - GLboolean MinMaxEnabled; - /* GL_SGIS_pixel_texture */ - GLboolean PixelTextureEnabled; - GLenum FragmentRgbSource; - GLenum FragmentAlphaSource; - /* GL_SGI_color_matrix */ - GLfloat PostColorMatrixRedScale; - GLfloat PostColorMatrixRedBias; - GLfloat PostColorMatrixGreenScale; - GLfloat PostColorMatrixGreenBias; - GLfloat PostColorMatrixBlueScale; - GLfloat PostColorMatrixBlueBias; - GLfloat PostColorMatrixAlphaScale; - GLfloat PostColorMatrixAlphaBias; - GLboolean ScaleOrBiasRGBApcm; - /* GL_SGI_color_table */ - GLfloat ColorTableScale[4]; - GLfloat ColorTableBias[4]; - GLboolean ColorTableEnabled; - GLfloat PCCTscale[4]; - GLfloat PCCTbias[4]; - GLboolean PostConvolutionColorTableEnabled; - GLfloat PCMCTscale[4]; - GLfloat PCMCTbias[4]; - GLboolean PostColorMatrixColorTableEnabled; + GLenum ReadBuffer; /* src buffer for glRead/CopyPixels */ + GLenum DriverReadBuffer; /* Driver's current source buffer */ + GLfloat RedBias, RedScale; + GLfloat GreenBias, GreenScale; + GLfloat BlueBias, BlueScale; + GLfloat AlphaBias, AlphaScale; + GLboolean ScaleOrBiasRGBA; + GLfloat DepthBias, DepthScale; + GLint IndexShift, IndexOffset; + GLboolean MapColorFlag; + GLboolean MapStencilFlag; + GLfloat ZoomX, ZoomY; + GLint MapStoSsize; /* Size of each pixel map */ + GLint MapItoIsize; + GLint MapItoRsize; + GLint MapItoGsize; + GLint MapItoBsize; + GLint MapItoAsize; + GLint MapRtoRsize; + GLint MapGtoGsize; + GLint MapBtoBsize; + GLint MapAtoAsize; + GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /* Pixel map tables */ + GLint MapItoI[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoR[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoG[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoB[MAX_PIXEL_MAP_TABLE]; + GLfloat MapItoA[MAX_PIXEL_MAP_TABLE]; + GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /* converted to 8-bit color */ + GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE]; + GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE]; + GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE]; + GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE]; + GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE]; + GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE]; + GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE]; + /* GL_EXT_histogram */ + GLboolean HistogramEnabled; + GLboolean MinMaxEnabled; + /* GL_SGIS_pixel_texture */ + GLboolean PixelTextureEnabled; + GLenum FragmentRgbSource; + GLenum FragmentAlphaSource; + /* GL_SGI_color_matrix */ + GLfloat PostColorMatrixScale[4]; /* RGBA */ + GLfloat PostColorMatrixBias[4]; /* RGBA */ + GLboolean ScaleOrBiasRGBApcm; + /* GL_SGI_color_table */ + GLfloat ColorTableScale[4]; + GLfloat ColorTableBias[4]; + GLboolean ColorTableEnabled; + GLfloat PCCTscale[4]; + GLfloat PCCTbias[4]; + GLboolean PostConvolutionColorTableEnabled; + GLfloat PCMCTscale[4]; + GLfloat PCMCTbias[4]; + GLboolean PostColorMatrixColorTableEnabled; + /* Convolution */ + GLboolean Convolution1DEnabled; + GLboolean Convolution2DEnabled; + GLboolean Separable2DEnabled; + GLfloat ConvolutionBorderColor[3][4]; + GLenum ConvolutionBorderMode[3]; + GLfloat ConvolutionFilterScale[3][4]; + GLfloat ConvolutionFilterBias[3][4]; + GLfloat PostConvolutionScale[4]; /* RGBA */ + GLfloat PostConvolutionBias[4]; /* RGBA */ }; struct gl_point_attrib { - GLboolean SmoothFlag; /* True if GL_POINT_SMOOTH is enabled */ - GLfloat Size; /* Point size */ - GLfloat Params[3]; /* Point Parameters EXT distance atenuation - factors by default = {1,0,0} */ - GLfloat MinSize; /* Default 0.0 always >=0 */ - GLfloat MaxSize; /* Default MAX_POINT_SIZE */ - GLfloat Threshold; /* Default 1.0 */ - GLboolean Attenuated; + GLboolean SmoothFlag;/* True if GL_POINT_SMOOTH is enabled */ + GLfloat UserSize; /* User-specified point size */ + GLfloat Size; /* Point size actually used */ + GLfloat Params[3]; /* Point Parameters EXT distance atenuation + factors by default = {1,0,0} */ + GLfloat MinSize; /* Default 0.0 always >=0 */ + GLfloat MaxSize; /* Default MAX_POINT_SIZE */ + GLfloat Threshold; /* Default 1.0 */ + GLboolean Attenuated; }; struct gl_polygon_attrib { - GLenum FrontFace; /* Either GL_CW or GL_CCW */ - GLenum FrontMode; /* Either GL_POINT, GL_LINE or GL_FILL */ - GLenum BackMode; /* Either GL_POINT, GL_LINE or GL_FILL */ - GLboolean FrontBit; /* */ - GLboolean Unfilled; /* True if back or front mode is not GL_FILL */ - GLboolean CullFlag; /* Culling on/off flag */ - GLubyte CullBits; /* Used for cull testing */ - GLboolean SmoothFlag; /* True if GL_POLYGON_SMOOTH is enabled */ - GLboolean StippleFlag; /* True if GL_POLYGON_STIPPLE is enabled */ - GLenum CullFaceMode; /* Culling mode GL_FRONT or GL_BACK */ - GLfloat OffsetFactor; /* Polygon offset factor */ - GLfloat OffsetUnits; /* Polygon offset units */ - GLboolean OffsetPoint; /* Offset in GL_POINT mode? */ - GLboolean OffsetLine; /* Offset in GL_LINE mode? */ - GLboolean OffsetFill; /* Offset in GL_FILL mode? */ - + GLenum FrontFace; /* Either GL_CW or GL_CCW */ + GLenum FrontMode; /* Either GL_POINT, GL_LINE or GL_FILL */ + GLenum BackMode; /* Either GL_POINT, GL_LINE or GL_FILL */ + GLboolean FrontBit; /* */ + GLboolean Unfilled; /* True if back or front mode is not GL_FILL */ + GLboolean CullFlag; /* Culling on/off flag */ + GLubyte CullBits; /* Used for cull testing */ + GLboolean SmoothFlag; /* True if GL_POLYGON_SMOOTH is enabled */ + GLboolean StippleFlag; /* True if GL_POLYGON_STIPPLE is enabled */ + GLenum CullFaceMode; /* Culling mode GL_FRONT or GL_BACK */ + GLfloat OffsetFactor; /* Polygon offset factor */ + GLfloat OffsetUnits; /* Polygon offset units */ + GLboolean OffsetPoint; /* Offset in GL_POINT mode? */ + GLboolean OffsetLine; /* Offset in GL_LINE mode? */ + GLboolean OffsetFill; /* Offset in GL_FILL mode? */ }; struct gl_scissor_attrib { - GLboolean Enabled; /* Scissor test enabled? */ - GLint X, Y; /* Lower left corner of box */ - GLsizei Width, Height; /* Size of box */ + GLboolean Enabled; /* Scissor test enabled? */ + GLint X, Y; /* Lower left corner of box */ + GLsizei Width, Height; /* Size of box */ }; struct gl_stencil_attrib { - GLboolean Enabled; /* Enabled flag */ - GLenum Function; /* Stencil function */ - GLenum FailFunc; /* Fail function */ - GLenum ZPassFunc; /* Depth buffer pass function */ - GLenum ZFailFunc; /* Depth buffer fail function */ - GLstencil Ref; /* Reference value */ - GLstencil ValueMask; /* Value mask */ - GLstencil Clear; /* Clear value */ - GLstencil WriteMask; /* Write mask */ + GLboolean Enabled; /* Enabled flag */ + GLenum Function; /* Stencil function */ + GLenum FailFunc; /* Fail function */ + GLenum ZPassFunc; /* Depth buffer pass function */ + GLenum ZFailFunc; /* Depth buffer fail function */ + GLstencil Ref; /* Reference value */ + GLstencil ValueMask; /* Value mask */ + GLstencil Clear; /* Clear value */ + GLstencil WriteMask; /* Write mask */ }; @@ -698,14 +720,16 @@ struct gl_stencil_attrib { #define Q_BIT 8 /* Texture Enabled flags */ -#define TEXTURE0_1D S_BIT /* Texture unit 0 (default) */ -#define TEXTURE0_2D T_BIT -#define TEXTURE0_3D R_BIT -#define TEXTURE0_ANY (TEXTURE0_1D | TEXTURE0_2D | TEXTURE0_3D) -#define TEXTURE1_1D (S_BIT<<4) /* Texture unit 1 */ -#define TEXTURE1_2D (T_BIT<<4) -#define TEXTURE1_3D (R_BIT<<4) -#define TEXTURE1_ANY (TEXTURE1_1D | TEXTURE1_2D | TEXTURE1_3D) +#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) /* Bitmap versions of the GL_ constants. */ @@ -757,37 +781,45 @@ typedef void (*texgen_func)( struct vertex_buffer *VB, /* Texture object record */ 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 */ - GLfloat Priority; /* in [0,1] */ - GLubyte BorderColor[4]; /* as integers in [0,255] */ - GLenum WrapS; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ - GLenum WrapT; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ - GLenum WrapR; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ - GLenum MinFilter; /* minification filter */ - GLenum MagFilter; /* magnification filter */ - GLfloat MinLod; /* OpenGL 1.2 */ - GLfloat MaxLod; /* OpenGL 1.2 */ - GLint BaseLevel; /* OpenGL 1.2 */ - GLint MaxLevel; /* OpenGL 1.2 */ - GLint P; /* Highest mipmap level */ - GLfloat M; /* = MIN(MaxLevel, P) - BaseLevel */ - GLfloat MinMagThresh; /* min/mag threshold */ - struct gl_texture_image *Image[MAX_TEXTURE_LEVELS]; - - /* GL_EXT_paletted_texture */ - struct gl_color_table Palette; - - /* For device driver: */ - GLboolean Dirty; /* Is this texture object in dirty list? */ - void *DriverData; /* Arbitrary device driver data */ - - GLboolean Complete; /* Complete set of images? */ - TextureSampleFunc SampleFunc; /* The texel sampling function */ - struct gl_texture_object *Next; /* Next in linked list */ - struct gl_texture_object *NextDirty; /* Next in dirty linked list */ + _glthread_Mutex Mutex; /* for thread safety */ + GLint RefCount; /* reference count */ + GLuint Name; /* an unsigned integer */ + GLuint Dimensions; /* 1 or 2 or 3 */ + GLfloat Priority; /* in [0,1] */ + GLubyte BorderColor[4]; /* as integers in [0,255] */ + GLenum WrapS; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ + GLenum WrapT; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ + GLenum WrapR; /* GL_CLAMP, REPEAT or CLAMP_TO_EDGE */ + GLenum MinFilter; /* minification filter */ + GLenum MagFilter; /* magnification filter */ + GLfloat MinLod; /* OpenGL 1.2 */ + GLfloat MaxLod; /* OpenGL 1.2 */ + GLint BaseLevel; /* OpenGL 1.2 */ + GLint MaxLevel; /* OpenGL 1.2 */ + GLint P; /* Highest mipmap level */ + GLfloat M; /* = MIN(MaxLevel, P) - BaseLevel */ + GLfloat MinMagThresh; /* min/mag threshold */ + struct gl_texture_image *Image[MAX_TEXTURE_LEVELS]; + + /* Texture cube faces */ + /* Image[] is alias for *PosX[MAX_TEXTURE_LEVELS]; */ + struct gl_texture_image *NegX[MAX_TEXTURE_LEVELS]; + struct gl_texture_image *PosY[MAX_TEXTURE_LEVELS]; + struct gl_texture_image *NegY[MAX_TEXTURE_LEVELS]; + struct gl_texture_image *PosZ[MAX_TEXTURE_LEVELS]; + struct gl_texture_image *NegZ[MAX_TEXTURE_LEVELS]; + + /* GL_EXT_paletted_texture */ + struct gl_color_table Palette; + + /* For device driver: */ + GLboolean Dirty; /* Is this texture object in dirty list? */ + void *DriverData; /* Arbitrary device driver data */ + + GLboolean Complete; /* Complete set of images? */ + TextureSampleFunc SampleFunc; /* The texel sampling function */ + struct gl_texture_object *Next; /* Next in linked list */ + struct gl_texture_object *NextDirty; /* Next in dirty linked list */ }; @@ -796,70 +828,73 @@ struct gl_texture_object { * Texture units are new with the multitexture extension. */ struct gl_texture_unit { - GLuint Enabled; - GLuint ReallyEnabled; - - GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND */ - GLenum LastEnvMode; - - GLfloat EnvColor[4]; - GLuint TexGenEnabled; /* Bitwise-OR of [STRQ]_BIT values */ - GLenum GenModeS; /* Tex coord generation mode, either */ - GLenum GenModeT; /* GL_OBJECT_LINEAR, or */ - GLenum GenModeR; /* GL_EYE_LINEAR, or */ - GLenum GenModeQ; /* GL_SPHERE_MAP */ - GLuint GenBitS; - GLuint GenBitT; - GLuint GenBitR; - GLuint GenBitQ; - GLuint GenFlags; /* bitwise or of GenBit[STRQ] */ - GLfloat ObjectPlaneS[4]; - GLfloat ObjectPlaneT[4]; - GLfloat ObjectPlaneR[4]; - GLfloat ObjectPlaneQ[4]; - GLfloat EyePlaneS[4]; - GLfloat EyePlaneT[4]; - GLfloat EyePlaneR[4]; - GLfloat EyePlaneQ[4]; - texgen_func *func; /* points to array of func pointers */ - GLubyte Holes; /* elements not generated by texgen */ - GLuint TexgenSize; /* size of element generated */ - GLboolean AnyTransform; /* texgen or non-identity matrix */ - GLfloat LodBias; /* for biasing mipmap levels */ - - struct gl_texture_object *CurrentD[4]; - struct gl_texture_object *Current; - GLuint CurrentDimension; - - struct gl_texture_object Saved1D; /* only used by glPush/PopAttrib */ - struct gl_texture_object Saved2D; - struct gl_texture_object Saved3D; + GLuint Enabled; + GLuint ReallyEnabled; + + GLenum EnvMode; /* GL_MODULATE, GL_DECAL, GL_BLEND */ + GLenum LastEnvMode; + + GLfloat EnvColor[4]; + GLuint TexGenEnabled; /* Bitwise-OR of [STRQ]_BIT values */ + GLenum GenModeS; /* Tex coord generation mode, either */ + GLenum GenModeT; /* GL_OBJECT_LINEAR, or */ + GLenum GenModeR; /* GL_EYE_LINEAR, or */ + GLenum GenModeQ; /* GL_SPHERE_MAP */ + GLuint GenBitS; + GLuint GenBitT; + GLuint GenBitR; + GLuint GenBitQ; + GLuint GenFlags; /* bitwise or of GenBit[STRQ] */ + GLfloat ObjectPlaneS[4]; + GLfloat ObjectPlaneT[4]; + GLfloat ObjectPlaneR[4]; + GLfloat ObjectPlaneQ[4]; + GLfloat EyePlaneS[4]; + GLfloat EyePlaneT[4]; + GLfloat EyePlaneR[4]; + GLfloat EyePlaneQ[4]; + texgen_func *func; /* points to array of func pointers */ + GLubyte Holes; /* elements not generated by texgen */ + GLuint TexgenSize; /* size of element generated */ + GLboolean AnyTransform; /* texgen or non-identity matrix */ + GLfloat LodBias; /* for biasing mipmap levels */ + + struct gl_texture_object *CurrentD[4]; + struct gl_texture_object *CurrentCubeMap; /* GL_ARB_texture_cube_map */ + + struct gl_texture_object *Current; + GLuint CurrentDimension; + + struct gl_texture_object Saved1D; /* only used by glPush/PopAttrib */ + struct gl_texture_object Saved2D; + struct gl_texture_object Saved3D; }; struct gl_texture_attrib { - /* multitexture */ - GLuint CurrentUnit; /* Current texture unit */ - GLuint CurrentTransformUnit; /* Current texture xform unit */ + /* multitexture */ + GLuint CurrentUnit; /* Current texture unit */ + GLuint CurrentTransformUnit; /* Current texture xform unit */ - /* Bitwise-OR of TEXTURE_XD values */ - GLuint Enabled; /* Enabled by the user */ - GLuint ReallyEnabled; /* Really enabled (w.r.t. completeness, etc) */ + /* Bitwise-OR of TEXTURE_XD values */ + GLuint Enabled; /* Enabled by the user */ + GLuint ReallyEnabled; /* Really enabled (w.r.t. completeness, etc) */ - GLuint LastEnabled; /* Decide whether enabled has really changed */ + GLuint LastEnabled; /* Decide whether enabled has really changed */ - GLboolean NeedNormals; - GLboolean NeedEyeCoords; + GLboolean NeedNormals; + GLboolean NeedEyeCoords; - struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; + struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; - struct gl_texture_object *Proxy1D; - struct gl_texture_object *Proxy2D; - struct gl_texture_object *Proxy3D; - - /* GL_EXT_shared_texture_palette */ - GLboolean SharedPalette; - struct gl_color_table Palette; + struct gl_texture_object *Proxy1D; + struct gl_texture_object *Proxy2D; + struct gl_texture_object *Proxy3D; + struct gl_texture_object *ProxyCubeMap; + + /* GL_EXT_shared_texture_palette */ + GLboolean SharedPalette; + struct gl_color_table Palette; }; @@ -867,29 +902,29 @@ struct gl_texture_attrib { /* KW: Renamed ClipEquation to avoid having 'ClipClipEquation' */ struct gl_transform_attrib { - GLenum MatrixMode; /* Matrix mode */ - GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; - GLfloat ClipUserPlane[MAX_CLIP_PLANES][4]; /* derived */ - GLboolean ClipEnabled[MAX_CLIP_PLANES]; - GLubyte AnyClip; /* How many ClipEnabled? */ - GLboolean Normalize; /* Normalize all normals? */ - GLboolean RescaleNormals; /* GL_EXT_rescale_normal */ + GLenum MatrixMode; /* Matrix mode */ + GLfloat EyeUserPlane[MAX_CLIP_PLANES][4]; + GLfloat ClipUserPlane[MAX_CLIP_PLANES][4]; /* derived */ + GLboolean ClipEnabled[MAX_CLIP_PLANES]; + GLubyte AnyClip; /* How many ClipEnabled? */ + GLboolean Normalize; /* Normalize all normals? */ + GLboolean RescaleNormals; /* GL_EXT_rescale_normal */ }; struct gl_viewport_attrib { - GLint X, Y; /* position */ - GLsizei Width, Height; /* size */ - GLfloat Near, Far; /* Depth buffer range */ - GLmatrix WindowMap; /* Mapping transformation as a matrix. */ + GLint X, Y; /* position */ + GLsizei Width, Height; /* size */ + GLfloat Near, Far; /* Depth buffer range */ + GLmatrix WindowMap; /* Mapping transformation as a matrix. */ }; /* For the attribute stack: */ struct gl_attrib_node { - GLbitfield kind; - void *data; - struct gl_attrib_node *next; + GLbitfield kind; + void *data; + struct gl_attrib_node *next; }; @@ -898,14 +933,14 @@ struct gl_attrib_node { * Client pixel packing/unpacking attributes */ struct gl_pixelstore_attrib { - GLint Alignment; - GLint RowLength; - GLint SkipPixels; - GLint SkipRows; - GLint ImageHeight; /* for GL_EXT_texture3D */ - GLint SkipImages; /* for GL_EXT_texture3D */ - GLboolean SwapBytes; - GLboolean LsbFirst; + GLint Alignment; + GLint RowLength; + GLint SkipPixels; + GLint SkipRows; + GLint ImageHeight; /* for GL_EXT_texture3D */ + GLint SkipImages; /* for GL_EXT_texture3D */ + GLboolean SwapBytes; + GLboolean LsbFirst; }; @@ -996,37 +1031,37 @@ typedef void (*trans_elt_3f_func)(GLfloat (*to)[3], struct gl_array_attrib { - struct gl_client_array Vertex; /* client data descriptors */ - struct gl_client_array Normal; - struct gl_client_array Color; - struct gl_client_array Index; - struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; - struct gl_client_array EdgeFlag; - - trans_4f_func VertexFunc; /* conversion functions */ - trans_3f_func NormalFunc; - trans_4ub_func ColorFunc; - trans_1ui_func IndexFunc; - trans_4f_func TexCoordFunc[MAX_TEXTURE_UNITS]; - trans_1ub_func EdgeFlagFunc; - - trans_elt_4f_func VertexEltFunc; /* array elt conversion functions */ - trans_elt_3f_func NormalEltFunc; - trans_elt_4ub_func ColorEltFunc; - trans_elt_1ui_func IndexEltFunc; - trans_elt_4f_func TexCoordEltFunc[MAX_TEXTURE_UNITS]; - trans_elt_1ub_func EdgeFlagEltFunc; - - GLint TexCoordInterleaveFactor; - GLint ActiveTexture; /* Client Active Texture */ - - GLuint LockFirst; - GLuint LockCount; + struct gl_client_array Vertex; /* client data descriptors */ + struct gl_client_array Normal; + struct gl_client_array Color; + struct gl_client_array Index; + struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; + struct gl_client_array EdgeFlag; + + trans_4f_func VertexFunc; /* conversion functions */ + trans_3f_func NormalFunc; + trans_4ub_func ColorFunc; + trans_1ui_func IndexFunc; + trans_4f_func TexCoordFunc[MAX_TEXTURE_UNITS]; + trans_1ub_func EdgeFlagFunc; + + trans_elt_4f_func VertexEltFunc; /* array elt conversion functions */ + trans_elt_3f_func NormalEltFunc; + trans_elt_4ub_func ColorEltFunc; + trans_elt_1ui_func IndexEltFunc; + trans_elt_4f_func TexCoordEltFunc[MAX_TEXTURE_UNITS]; + trans_elt_1ub_func EdgeFlagEltFunc; + + GLint TexCoordInterleaveFactor; + GLint ActiveTexture; /* Client Active Texture */ + + GLuint LockFirst; + GLuint LockCount; - GLuint Flag[VB_SIZE]; /* crock */ - GLuint Flags; - GLuint Summary; /* Like flags, but no size information */ - GLuint NewArrayState; /* Tracks which arrays have been changed. */ + GLuint Flag[VB_SIZE]; /* crock */ + GLuint Flags; + GLuint Summary; /* Like flags, but no size information */ + GLuint NewArrayState; /* Tracks which arrays have been changed. */ }; @@ -1034,11 +1069,11 @@ struct gl_array_attrib { * arrays (with zero StrideB). */ struct gl_fallback_arrays { - struct gl_client_array Normal; - struct gl_client_array Color; - struct gl_client_array Index; - struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; - struct gl_client_array EdgeFlag; + struct gl_client_array Normal; + struct gl_client_array Color; + struct gl_client_array Index; + struct gl_client_array TexCoord[MAX_TEXTURE_UNITS]; + struct gl_client_array EdgeFlag; }; #define MAX_PIPELINE_STAGES 30 @@ -1062,10 +1097,10 @@ struct gl_fallback_arrays { * point/line/tri primitives. */ struct gl_prim_state { - GLuint v0, v1; - GLboolean draw; - GLboolean finish_loop; /* not used... */ - struct gl_prim_state *next; + GLuint v0, v1; + GLboolean draw; + GLboolean finish_loop; /* not used... */ + struct gl_prim_state *next; }; @@ -1073,88 +1108,88 @@ typedef void (*vb_func)( struct vertex_buffer *VB ); typedef void (*ctx_func)( GLcontext * ); struct gl_pipeline_stage { - const char *name; - GLuint ops; /* PIPE_OP flags */ - GLuint type; /* PIPE flags */ - GLuint special; /* PIPE flags - force update_inputs() */ - GLuint state_change; /* state flags - trigger update_inputs() */ - GLuint cva_state_change; /* state flags - recalc cva buffer */ - GLuint elt_forbidden_inputs; /* VERT flags - force a pipeline recalc */ - GLuint pre_forbidden_inputs; /* VERT flags - force a pipeline recalc */ - GLuint active; /* PIPE flags */ - GLuint inputs; /* VERT flags */ - GLuint outputs; /* VERT flags */ - void (*check)( GLcontext *ctx, struct gl_pipeline_stage * ); - void (*run)( struct vertex_buffer *VB ); + const char *name; + GLuint ops; /* PIPE_OP flags */ + GLuint type; /* PIPE flags */ + GLuint special; /* PIPE flags - force update_inputs() */ + GLuint state_change; /* state flags - trigger update_inputs() */ + GLuint cva_state_change; /* state flags - recalc cva buffer */ + GLuint elt_forbidden_inputs; /* VERT flags - force a pipeline recalc */ + GLuint pre_forbidden_inputs; /* VERT flags - force a pipeline recalc */ + GLuint active; /* PIPE flags */ + GLuint inputs; /* VERT flags */ + GLuint outputs; /* VERT flags */ + void (*check)( GLcontext *ctx, struct gl_pipeline_stage * ); + void (*run)( struct vertex_buffer *VB ); }; struct gl_pipeline { - GLuint state_change; /* state changes which require recalc */ - GLuint cva_state_change; /* ... which require re-run */ - GLuint forbidden_inputs; /* inputs which require recalc */ - GLuint ops; /* what gets done in this pipe */ - GLuint changed_ops; - GLuint inputs; - GLuint outputs; - GLuint new_inputs; - GLuint new_outputs; - GLuint fallback; - GLuint type; - GLuint pipeline_valid:1; - GLuint data_valid:1; - GLuint copy_transformed_data:1; - GLuint replay_copied_vertices:1; - GLuint new_state; /* state changes since last recalc */ - struct gl_pipeline_stage *stages[MAX_PIPELINE_STAGES]; + GLuint state_change; /* state changes which require recalc */ + GLuint cva_state_change; /* ... which require re-run */ + GLuint forbidden_inputs; /* inputs which require recalc */ + GLuint ops; /* what gets done in this pipe */ + GLuint changed_ops; + GLuint inputs; + GLuint outputs; + GLuint new_inputs; + GLuint new_outputs; + GLuint fallback; + GLuint type; + GLuint pipeline_valid:1; + GLuint data_valid:1; + GLuint copy_transformed_data:1; + GLuint replay_copied_vertices:1; + GLuint new_state; /* state changes since last recalc */ + struct gl_pipeline_stage *stages[MAX_PIPELINE_STAGES]; }; struct gl_cva { - struct gl_pipeline pre; - struct gl_pipeline elt; + struct gl_pipeline pre; + struct gl_pipeline elt; - struct gl_client_array Elt; - trans_1ui_func EltFunc; + struct gl_client_array Elt; + trans_1ui_func EltFunc; - struct vertex_buffer *VB; - struct vertex_arrays v; - struct vertex_data store; + struct vertex_buffer *VB; + struct vertex_arrays v; + struct vertex_data store; - GLuint elt_count; - GLenum elt_mode; - GLuint elt_size; + GLuint elt_count; + GLenum elt_mode; + GLuint elt_size; - GLuint forbidden_inputs; - GLuint orflag; - GLuint merge; + GLuint forbidden_inputs; + GLuint orflag; + GLuint merge; - GLuint lock_changed; - GLuint last_orflag; - GLuint last_array_flags; - GLuint last_array_new_state; + GLuint lock_changed; + GLuint last_orflag; + GLuint last_array_flags; + GLuint last_array_new_state; }; struct gl_feedback { - GLenum Type; - GLuint Mask; - GLfloat *Buffer; - GLuint BufferSize; - GLuint Count; + GLenum Type; + GLuint Mask; + GLfloat *Buffer; + GLuint BufferSize; + GLuint Count; }; struct gl_selection { - GLuint *Buffer; - GLuint BufferSize; /* size of SelectBuffer */ - GLuint BufferCount; /* number of values in SelectBuffer */ - GLuint Hits; /* number of records in SelectBuffer */ - GLuint NameStackDepth; - GLuint NameStack[MAX_NAME_STACK_DEPTH]; - GLboolean HitFlag; - GLfloat HitMinZ, HitMaxZ; + GLuint *Buffer; + GLuint BufferSize; /* size of SelectBuffer */ + GLuint BufferCount; /* number of values in SelectBuffer */ + GLuint Hits; /* number of records in SelectBuffer */ + GLuint NameStackDepth; + GLuint NameStack[MAX_NAME_STACK_DEPTH]; + GLboolean HitFlag; + GLfloat HitMinZ, HitMaxZ; }; @@ -1163,9 +1198,9 @@ struct gl_selection { * 1-D Evaluator control points */ struct gl_1d_map { - GLuint Order; /* Number of control points */ - GLfloat u1, u2, du; /* u1, u2, 1.0/(u2-u1) */ - GLfloat *Points; /* Points to contiguous control points */ + GLuint Order; /* Number of control points */ + GLfloat u1, u2, du; /* u1, u2, 1.0/(u2-u1) */ + GLfloat *Points; /* Points to contiguous control points */ }; @@ -1173,11 +1208,11 @@ struct gl_1d_map { * 2-D Evaluator control points */ struct gl_2d_map { - GLuint Uorder; /* Number of control points in U dimension */ - GLuint Vorder; /* Number of control points in V dimension */ - GLfloat u1, u2, du; - GLfloat v1, v2, dv; - GLfloat *Points; /* Points to contiguous control points */ + GLuint Uorder; /* Number of control points in U dimension */ + GLuint Vorder; /* Number of control points in V dimension */ + GLfloat u1, u2, du; + GLfloat v1, v2, dv; + GLfloat *Points; /* Points to contiguous control points */ }; @@ -1185,27 +1220,27 @@ struct gl_2d_map { * All evalutator control points */ struct gl_evaluators { - /* 1-D maps */ - struct gl_1d_map Map1Vertex3; - struct gl_1d_map Map1Vertex4; - struct gl_1d_map Map1Index; - struct gl_1d_map Map1Color4; - struct gl_1d_map Map1Normal; - struct gl_1d_map Map1Texture1; - struct gl_1d_map Map1Texture2; - struct gl_1d_map Map1Texture3; - struct gl_1d_map Map1Texture4; - - /* 2-D maps */ - struct gl_2d_map Map2Vertex3; - struct gl_2d_map Map2Vertex4; - struct gl_2d_map Map2Index; - struct gl_2d_map Map2Color4; - struct gl_2d_map Map2Normal; - struct gl_2d_map Map2Texture1; - struct gl_2d_map Map2Texture2; - struct gl_2d_map Map2Texture3; - struct gl_2d_map Map2Texture4; + /* 1-D maps */ + struct gl_1d_map Map1Vertex3; + struct gl_1d_map Map1Vertex4; + struct gl_1d_map Map1Index; + struct gl_1d_map Map1Color4; + struct gl_1d_map Map1Normal; + struct gl_1d_map Map1Texture1; + struct gl_1d_map Map1Texture2; + struct gl_1d_map Map1Texture3; + struct gl_1d_map Map1Texture4; + + /* 2-D maps */ + struct gl_2d_map Map2Vertex3; + struct gl_2d_map Map2Vertex4; + struct gl_2d_map Map2Index; + struct gl_2d_map Map2Color4; + struct gl_2d_map Map2Normal; + struct gl_2d_map Map2Texture1; + struct gl_2d_map Map2Texture2; + struct gl_2d_map Map2Texture3; + struct gl_2d_map Map2Texture4; }; @@ -1223,6 +1258,7 @@ struct gl_shared_state { /* Default texture objects (shared by all multi-texture units) */ struct gl_texture_object *DefaultD[4]; + struct gl_texture_object *DefaultCubeMap; }; @@ -1300,6 +1336,7 @@ struct gl_frame_buffer { */ struct gl_constants { GLint MaxTextureSize; + GLint MaxCubeTextureSize; GLint MaxTextureLevels; GLuint MaxTextureUnits; GLuint MaxArrayLockSize; @@ -1312,6 +1349,10 @@ struct gl_constants { GLfloat LineWidthGranularity; GLuint NumAuxBuffers; GLuint MaxColorTableSize; + GLuint MaxConvolutionWidth; + GLuint MaxConvolutionHeight; + GLuint NumCompressedTextureFormats; /* GL_ARB_texture_compression */ + GLenum CompressedTextureFormats[MAX_COMPRESSED_TEXTURE_FORMATS]; }; @@ -1326,6 +1367,10 @@ struct gl_extensions { GLboolean HaveTextureEnvAdd; GLboolean HaveTextureLodBias; GLboolean HaveHpOcclusionTest; + GLboolean HaveTextureCubeMap; + GLboolean HaveTextureCompression; + GLboolean HaveTextureCompressionS3TC; + GLboolean HaveTextureCompressionFXT1; }; @@ -1345,6 +1390,7 @@ struct gl_extensions { #define MULTI_DRAW_BIT 0x400 /* Write to more than one color- */ /* buffer or no buffers. */ #define OCCLUSION_BIT 0x800 /* GL_HP_occlusion_test enabled */ +#define TEXTURE_BIT 0x1000 /* Texturing really enabled */ /* @@ -1695,249 +1741,232 @@ typedef GLuint (*clip_poly_func)( struct vertex_buffer *VB, */ struct gl_context { - /* State possibly shared with other contexts in the address space */ - struct gl_shared_state *Shared; + /* State possibly shared with other contexts in the address space */ + struct gl_shared_state *Shared; - /* API function pointer tables */ - struct _glapi_table *Save; /* Display list save funcs */ - struct _glapi_table *Exec; /* Execute funcs */ - struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */ + /* API function pointer tables */ + struct _glapi_table *Save; /* Display list save funcs */ + struct _glapi_table *Exec; /* Execute funcs */ + struct _glapi_table *CurrentDispatch; /* == Save or Exec !! */ - GLvisual *Visual; - GLframebuffer *DrawBuffer; /* buffer for writing */ - GLframebuffer *ReadBuffer; /* buffer for reading */ + GLvisual *Visual; + GLframebuffer *DrawBuffer; /* buffer for writing */ + GLframebuffer *ReadBuffer; /* buffer for reading */ - /* Driver function pointer table */ - struct dd_function_table Driver; + /* Driver function pointer table */ + struct dd_function_table Driver; - triangle_func TriangleFunc; /* driver or indirect triangle func */ - quad_func QuadFunc; - triangle_func ClippedTriangleFunc; - clip_poly_func *poly_clip_tab; - clip_line_func *line_clip_tab; - - void *DriverCtx; /* Points to device driver context/state */ - void *DriverMgrCtx; /* Points to device driver manager (optional)*/ - - /* Core/Driver constants */ - struct gl_constants Const; - - /* Modelview matrix and stack */ - GLmatrix ModelView; /* current matrix, not stored on stack */ - GLuint ModelViewStackDepth; - GLmatrix ModelViewStack[MAX_MODELVIEW_STACK_DEPTH - 1]; - - /* Projection matrix and stack */ - GLmatrix ProjectionMatrix; /* current matrix, not stored on stack */ - GLuint ProjectionStackDepth; - GLmatrix ProjectionStack[MAX_PROJECTION_STACK_DEPTH - 1]; - GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH - 1][2]; - - /* Combined modelview and projection matrix */ - GLmatrix ModelProjectMatrix; - - /* Combined modelview, projection and window matrix */ - GLmatrix ModelProjectWinMatrix; - GLboolean ModelProjectWinMatrixUptodate; - - /* Texture matrix and stack */ - GLmatrix TextureMatrix[MAX_TEXTURE_UNITS]; - GLuint TextureStackDepth[MAX_TEXTURE_UNITS]; - GLmatrix TextureStack[MAX_TEXTURE_UNITS][MAX_TEXTURE_STACK_DEPTH - 1]; - - /* Color matrix and stack */ - GLmatrix ColorMatrix; - GLuint ColorStackDepth; - GLmatrix ColorStack[MAX_COLOR_STACK_DEPTH - 1]; - - /* Display lists */ - GLuint CallDepth; /* Current recursion calling depth */ - GLboolean ExecuteFlag; /* Execute GL commands? */ - GLboolean CompileFlag; /* Compile GL commands into display list? */ - GLboolean CompileCVAFlag; - Node *CurrentListPtr; /* Head of list being compiled */ - GLuint CurrentListNum; /* Number of the list being compiled */ - Node *CurrentBlock; /* Pointer to current block of nodes */ - GLuint CurrentPos; /* Index into current block of nodes */ - - /* Extensions */ - struct gl_extensions Extensions; - - - /* Pipeline stages - shared between the two pipelines, - * which live in CVA. - */ - struct gl_pipeline_stage PipelineStage[MAX_PIPELINE_STAGES]; - GLuint NrPipelineStages; - - /* Cva */ - struct gl_cva CVA; - - /* Renderer attribute stack */ - GLuint AttribStackDepth; - struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH]; - - /* Renderer attribute groups */ - struct gl_accum_attrib Accum; - struct gl_colorbuffer_attrib Color; - struct gl_current_attrib Current; - struct gl_depthbuffer_attrib Depth; - struct gl_eval_attrib Eval; - struct gl_fog_attrib Fog; - struct gl_hint_attrib Hint; - struct gl_histogram_attrib Histogram; - struct gl_light_attrib Light; - struct gl_line_attrib Line; - struct gl_list_attrib List; - struct gl_minmax_attrib MinMax; - struct gl_pixel_attrib Pixel; - struct gl_point_attrib Point; - struct gl_polygon_attrib Polygon; - GLuint PolygonStipple[32]; - struct gl_scissor_attrib Scissor; - struct gl_stencil_attrib Stencil; - struct gl_texture_attrib Texture; - struct gl_transform_attrib Transform; - struct gl_viewport_attrib Viewport; - - /* Client attribute stack */ - GLuint ClientAttribStackDepth; - struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH]; - - /* Client attribute groups */ - struct gl_array_attrib Array; /* Vertex arrays */ - struct gl_pixelstore_attrib Pack; /* Pixel packing */ - struct gl_pixelstore_attrib Unpack; /* Pixel unpacking */ - - struct gl_evaluators EvalMap; /* All evaluators */ - struct gl_feedback Feedback; /* Feedback */ - struct gl_selection Select; /* Selection */ - - struct gl_color_table ColorTable; /* Pre-convolution */ - struct gl_color_table ProxyColorTable; /* Pre-convolution */ - struct gl_color_table PostConvolutionColorTable; - struct gl_color_table ProxyPostConvolutionColorTable; - struct gl_color_table PostColorMatrixColorTable; - struct gl_color_table ProxyPostColorMatrixColorTable; - - /* Optimized Accumulation buffer info */ - GLboolean IntegerAccumMode; /* Storing unscaled integers? */ - GLfloat IntegerAccumScaler; /* Implicit scale factor */ - - - struct gl_fallback_arrays Fallback; - - GLenum ErrorValue; /* Last error code */ - - /* Miscellaneous */ - GLuint NewState; /* bitwise OR of NEW_* flags */ - GLuint Enabled; /* bitwise or of ENABLE_* flags */ - GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */ - GLuint StippleCounter; /* Line stipple counter */ - GLuint RasterMask; /* OR of rasterization flags */ - GLuint TriangleCaps; /* OR of DD_* flags */ - GLuint IndirectTriangles; /* TriangleCaps not handled by the driver */ - GLfloat PolygonZoffset; /* Z offset for GL_FILL polygons */ - GLfloat LineZoffset; /* Z offset for GL_LINE polygons */ - GLfloat PointZoffset; /* Z offset for GL_POINT polygons */ - GLboolean NeedNormals; /* Are vertex normal vectors needed? */ - GLboolean MutablePixels;/* Can rasterization change pixel's color? */ - GLboolean MonoPixels; /* Are all pixels likely to be same color? */ - GLuint FogMode; /* FOG_OFF, FOG_VERTEX or FOG_FRAGMENT */ - - GLboolean DoViewportMapping; - - GLuint RenderFlags; /* Active inputs to render stage */ - - GLuint RequireWriteableFlags; /* What can the driver/clipping tolerate? */ - - /* Points to function which interpolates colors, etc when clipping */ - clip_interp_func ClipInterpFunc; - GLuint ClipTabMask; - - normal_func *NormalTransform; - - /* Current shading function */ - GLuint shade_func_flags; - - GLfloat EyeZDir[3]; - GLfloat rescale_factor; - - GLfloat vb_rescale_factor; - GLmatrix *vb_proj_matrix; - - GLubyte AllowVertexCull; /* To be set by the geometry driver */ - GLboolean NeedEyeCoords; - GLboolean NeedEyeNormals; - GLboolean NeedClipCoords; - - GLfloat backface_sign; - - GLboolean OcclusionResult; /* GL_HP_occlusion_test */ - GLboolean OcclusionResultSaved; /* GL_HP_occlusion_test */ - - /* Destination of immediate mode commands */ - struct immediate *input; - - - /* Cache of unused immediate structs - */ - struct immediate *freed_im_queue; - GLuint nr_im_queued; - - /* The vertex buffer being used by this context. - */ - struct vertex_buffer *VB; + triangle_func TriangleFunc; /* driver or indirect triangle func */ + quad_func QuadFunc; + triangle_func ClippedTriangleFunc; + clip_poly_func *poly_clip_tab; + clip_line_func *line_clip_tab; + + void *DriverCtx; /* Points to device driver context/state */ + void *DriverMgrCtx; /* Points to device driver manager (optional)*/ + + /* Core/Driver constants */ + struct gl_constants Const; + + /* Modelview matrix and stack */ + GLmatrix ModelView; /* current matrix, not stored on stack */ + GLuint ModelViewStackDepth; + GLmatrix ModelViewStack[MAX_MODELVIEW_STACK_DEPTH - 1]; + + /* Projection matrix and stack */ + GLmatrix ProjectionMatrix; /* current matrix, not stored on stack */ + GLuint ProjectionStackDepth; + GLmatrix ProjectionStack[MAX_PROJECTION_STACK_DEPTH - 1]; + GLfloat NearFarStack[MAX_PROJECTION_STACK_DEPTH - 1][2]; + + /* Combined modelview and projection matrix */ + GLmatrix ModelProjectMatrix; + + /* Combined modelview, projection and window matrix */ + GLmatrix ModelProjectWinMatrix; + GLboolean ModelProjectWinMatrixUptodate; + + /* Texture matrix and stack */ + GLmatrix TextureMatrix[MAX_TEXTURE_UNITS]; + GLuint TextureStackDepth[MAX_TEXTURE_UNITS]; + GLmatrix TextureStack[MAX_TEXTURE_UNITS][MAX_TEXTURE_STACK_DEPTH - 1]; + + /* Color matrix and stack */ + GLmatrix ColorMatrix; + GLuint ColorStackDepth; + GLmatrix ColorStack[MAX_COLOR_STACK_DEPTH - 1]; + + /* Display lists */ + GLuint CallDepth; /* Current recursion calling depth */ + GLboolean ExecuteFlag; /* Execute GL commands? */ + GLboolean CompileFlag; /* Compile GL commands into display list? */ + GLboolean CompileCVAFlag; + Node *CurrentListPtr; /* Head of list being compiled */ + GLuint CurrentListNum; /* Number of the list being compiled */ + Node *CurrentBlock; /* Pointer to current block of nodes */ + GLuint CurrentPos; /* Index into current block of nodes */ + + /* Extensions */ + struct gl_extensions Extensions; + + + /* Pipeline stages - shared between the two pipelines, + * which live in CVA. + */ + struct gl_pipeline_stage PipelineStage[MAX_PIPELINE_STAGES]; + GLuint NrPipelineStages; + + /* Cva */ + struct gl_cva CVA; + + /* Renderer attribute stack */ + GLuint AttribStackDepth; + struct gl_attrib_node *AttribStack[MAX_ATTRIB_STACK_DEPTH]; + + /* Renderer attribute groups */ + struct gl_accum_attrib Accum; + struct gl_colorbuffer_attrib Color; + struct gl_current_attrib Current; + struct gl_depthbuffer_attrib Depth; + struct gl_eval_attrib Eval; + struct gl_fog_attrib Fog; + struct gl_hint_attrib Hint; + struct gl_light_attrib Light; + struct gl_line_attrib Line; + struct gl_list_attrib List; + struct gl_pixel_attrib Pixel; + struct gl_point_attrib Point; + struct gl_polygon_attrib Polygon; + GLuint PolygonStipple[32]; + struct gl_scissor_attrib Scissor; + struct gl_stencil_attrib Stencil; + struct gl_texture_attrib Texture; + struct gl_transform_attrib Transform; + struct gl_viewport_attrib Viewport; + + /* Other attribute groups */ + struct gl_histogram_attrib Histogram; + struct gl_minmax_attrib MinMax; + struct gl_convolution_attrib Convolution1D; + struct gl_convolution_attrib Convolution2D; + struct gl_convolution_attrib Separable2D; + + /* Client attribute stack */ + GLuint ClientAttribStackDepth; + struct gl_attrib_node *ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH]; + + /* Client attribute groups */ + struct gl_array_attrib Array; /* Vertex arrays */ + struct gl_pixelstore_attrib Pack; /* Pixel packing */ + struct gl_pixelstore_attrib Unpack; /* Pixel unpacking */ + + struct gl_evaluators EvalMap; /* All evaluators */ + struct gl_feedback Feedback; /* Feedback */ + struct gl_selection Select; /* Selection */ + + struct gl_color_table ColorTable; /* Pre-convolution */ + struct gl_color_table ProxyColorTable; /* Pre-convolution */ + struct gl_color_table PostConvolutionColorTable; + struct gl_color_table ProxyPostConvolutionColorTable; + struct gl_color_table PostColorMatrixColorTable; + struct gl_color_table ProxyPostColorMatrixColorTable; + + /* Optimized Accumulation buffer info */ + GLboolean IntegerAccumMode; /* Storing unscaled integers? */ + GLfloat IntegerAccumScaler; /* Implicit scale factor */ + + struct gl_fallback_arrays Fallback; + + GLenum ErrorValue; /* Last error code */ + + /* Miscellaneous */ + GLuint NewState; /* bitwise OR of NEW_* flags */ + GLuint Enabled; /* bitwise or of ENABLE_* flags */ + GLenum RenderMode; /* either GL_RENDER, GL_SELECT, GL_FEEDBACK */ + GLuint StippleCounter; /* Line stipple counter */ + GLuint RasterMask; /* OR of rasterization flags */ + GLuint TriangleCaps; /* OR of DD_* flags */ + GLuint IndirectTriangles; /* TriangleCaps not handled by the driver */ + GLfloat PolygonZoffset; /* Z offset for GL_FILL polygons */ + GLfloat LineZoffset; /* Z offset for GL_LINE polygons */ + GLfloat PointZoffset; /* Z offset for GL_POINT polygons */ + GLboolean NeedNormals; /* Are vertex normal vectors needed? */ + GLuint FogMode; /* FOG_OFF, FOG_VERTEX or FOG_FRAGMENT */ + + GLboolean DoViewportMapping; + + GLuint RenderFlags; /* Active inputs to render stage */ + + GLuint RequireWriteableFlags; /* What can the driver/clipping tolerate? */ + + /* Points to function which interpolates colors, etc when clipping */ + clip_interp_func ClipInterpFunc; + GLuint ClipTabMask; + + normal_func *NormalTransform; + + /* Current shading function */ + GLuint shade_func_flags; + + GLfloat EyeZDir[3]; + GLfloat rescale_factor; + + GLfloat vb_rescale_factor; + GLmatrix *vb_proj_matrix; + + GLubyte AllowVertexCull; /* To be set by the geometry driver */ + GLboolean NeedEyeCoords; + GLboolean NeedEyeNormals; + GLboolean NeedClipCoords; + + GLfloat backface_sign; + + GLboolean OcclusionResult; /* GL_HP_occlusion_test */ + GLboolean OcclusionResultSaved; /* GL_HP_occlusion_test */ + + /* Destination of immediate mode commands */ + struct immediate *input; + + + /* Cache of unused immediate structs + */ + struct immediate *freed_im_queue; + GLuint nr_im_queued; + + /* The vertex buffer being used by this context. + */ + struct vertex_buffer *VB; - /* The pixel buffer being used by this context */ - struct pixel_buffer* PB; - - struct gl_shine_tab *ShineTable[4]; /* Active shine tables */ - struct gl_shine_tab *ShineTabList; /* Mru list of inactive shine tables */ - - -#ifdef PROFILE - /* Performance measurements */ - GLuint BeginEndCount; /* number of glBegin/glEnd pairs */ - GLdouble BeginEndTime; /* seconds spent between glBegin/glEnd */ - GLuint VertexCount; /* number of vertices processed */ - GLdouble VertexTime; /* total time in seconds */ - GLuint PointCount; /* number of points rendered */ - GLdouble PointTime; /* total time in seconds */ - GLuint LineCount; /* number of lines rendered */ - GLdouble LineTime; /* total time in seconds */ - GLuint PolygonCount; /* number of polygons rendered */ - GLdouble PolygonTime; /* total time in seconds */ - GLuint ClearCount; /* number of glClear calls */ - GLdouble ClearTime; /* seconds spent in glClear */ - GLuint SwapCount; /* number of swap-buffer calls */ - GLdouble SwapTime; /* seconds spent in swap-buffers */ -#endif + /* The pixel buffer being used by this context */ + struct pixel_buffer* PB; + struct gl_shine_tab *ShineTable[4]; /* Active shine tables */ + struct gl_shine_tab *ShineTabList; /* Mru list of inactive shine tables */ - /* Should 3Dfx Glide driver catch signals? */ - GLboolean CatchSignals; + /* Should 3Dfx Glide driver catch signals? */ + GLboolean CatchSignals; - /* For debugging/development only */ - GLboolean NoRaster; - GLboolean FirstTimeCurrent; + /* For debugging/development only */ + GLboolean NoRaster; + GLboolean FirstTimeCurrent; - /* Dither disable via MESA_NO_DITHER env var */ - GLboolean NoDither; + /* Dither disable via MESA_NO_DITHER env var */ + GLboolean NoDither; }; -#ifndef MESA_DEBUG +#ifdef MESA_DEBUG +extern int MESA_VERBOSE; +extern int MESA_DEBUG_FLAGS; +#else # define MESA_VERBOSE 0 # define MESA_DEBUG_FLAGS 0 # ifndef NDEBUG # define NDEBUG # endif -#else -extern int MESA_VERBOSE; -extern int MESA_DEBUG_FLAGS; #endif + enum _verbose { VERBOSE_VARRAY = 0x1, VERBOSE_TEXTURE = 0x2, diff --git a/xc/extras/Mesa/src/vb.c b/xc/extras/Mesa/src/vb.c index 1677806b6..7dcb64b10 100644 --- a/xc/extras/Mesa/src/vb.c +++ b/xc/extras/Mesa/src/vb.c @@ -271,7 +271,11 @@ struct immediate *gl_immediate_alloc( GLcontext *ctx ) IM->Start = VB_START; IM->Material = 0; IM->MaterialMask = 0; - +#ifdef VMS + for (j=0; j<VB_SIZE ; j++ ) + IM->Normal[j][0] = IM->Normal[j][1] = IM->Normal[j][2] = 0.0; +#endif + if (MESA_VERBOSE&VERBOSE_IMMEDIATE) fprintf(stderr, "alloc immediate %d\n", id); diff --git a/xc/extras/Mesa/src/vbrender.c b/xc/extras/Mesa/src/vbrender.c index ff493f5fc..9ee4fbb8c 100644 --- a/xc/extras/Mesa/src/vbrender.c +++ b/xc/extras/Mesa/src/vbrender.c @@ -164,7 +164,7 @@ static void unfilled_polygon( GLcontext *ctx, j1 = vlist[i+1]; if (edge_ptr[j0] & 0x1) { - edge_ptr[j0] &= ~1; + edge_ptr[j0] &= ~0x1; (*ctx->Driver.LineFunc)( ctx, j0, j1, pv ); } } @@ -174,7 +174,7 @@ static void unfilled_polygon( GLcontext *ctx, j1 = vlist[0]; if (edge_ptr[j0] & 0x2) { - edge_ptr[j0] &= ~2; + edge_ptr[j0] &= ~0x2; (*ctx->Driver.LineFunc)( ctx, j0, j1, pv ); } } @@ -219,7 +219,9 @@ static INLINE void gl_render_clipped_triangle2( GLcontext *ctx, GLuint pv ) { struct vertex_buffer *VB = ctx->VB; - GLubyte mask = (GLubyte) (VB->ClipMask[v1] | VB->ClipMask[v2] | VB->ClipMask[v3]); + GLubyte mask = (GLubyte) (VB->ClipMask[v1] | + VB->ClipMask[v2] | + VB->ClipMask[v3]); GLuint vlist[VB_MAX_CLIPPED_VERTS]; GLuint i, n; @@ -233,7 +235,38 @@ static INLINE void gl_render_clipped_triangle2( GLcontext *ctx, ASSIGN_3V(vlist, v1, v2, v3 ); n = (ctx->poly_clip_tab[VB->ClipPtr->size])( VB, 3, vlist, mask ); - + + for (i=2;i<n;i++) + ctx->TriangleFunc( ctx, *vlist, vlist[i-1], vlist[i], pv ); +} + + +static INLINE void gl_render_clipped_quad2( GLcontext *ctx, + GLuint v1, GLuint v2, GLuint v3, + GLuint v4, + GLuint pv ) +{ + struct vertex_buffer *VB = ctx->VB; + GLubyte mask = (GLubyte) (VB->ClipMask[v1] | + VB->ClipMask[v2] | + VB->ClipMask[v3] | + VB->ClipMask[v4]); + GLuint vlist[VB_MAX_CLIPPED_VERTS]; + GLuint i, n; + + if (!mask) { + ctx->QuadFunc( ctx, v1, v2, v3, v4, pv ); + return; + } + + if (CLIP_ALL_BITS & VB->ClipMask[v1] & + VB->ClipMask[v2] & VB->ClipMask[v3] & + VB->ClipMask[v4]) + return; + + ASSIGN_4V(vlist, v1, v2, v3, v4 ); + n = (ctx->poly_clip_tab[VB->ClipPtr->size])( VB, 4, vlist, mask ); + for (i=2;i<n;i++) ctx->TriangleFunc( ctx, *vlist, vlist[i-1], vlist[i], pv ); } @@ -309,16 +342,14 @@ static void render_quad( GLcontext *ctx, GLuint v0, GLuint v1, GLfloat fy = win[v3][1] - win[v1][1]; GLfloat c = ex*fy-ey*fx; GLuint facing; - GLuint tricaps; + GLuint tricaps = ctx->IndirectTriangles; if (c * ctx->backface_sign > 0) return; facing = (c<0.0F) ^ (ctx->Polygon.FrontFace==GL_CW); - tricaps = ctx->IndirectTriangles; - (void) tricaps; /* not needed? */ - if (ctx->IndirectTriangles & DD_TRI_OFFSET) { + if (tricaps & DD_TRI_OFFSET) { GLfloat ez = win[v2][2] - win[v0][2]; GLfloat fz = win[v3][2] - win[v1][2]; GLfloat a = ey*fz-ez*fy; @@ -327,7 +358,7 @@ static void render_quad( GLcontext *ctx, GLuint v0, GLuint v1, } - if (ctx->IndirectTriangles & DD_TRI_LIGHT_TWOSIDE) { + if (tricaps & DD_TRI_LIGHT_TWOSIDE) { VB->Specular = VB->Spec[facing]; VB->ColorPtr = VB->Color[facing]; VB->IndexPtr = VB->Index[facing]; @@ -335,7 +366,7 @@ static void render_quad( GLcontext *ctx, GLuint v0, GLuint v1, /* Render the quad! */ - if (ctx->IndirectTriangles & DD_TRI_UNFILLED) { + if (tricaps & DD_TRI_UNFILLED) { GLuint vlist[4]; vlist[0] = v0; vlist[1] = v1; @@ -373,9 +404,7 @@ extern const char *gl_prim_name[]; #define EDGEFLAG_TRI( i2, i1, i, pv, parity) \ do { \ - GLuint e1=i1, e0=i; \ - if (parity) { GLuint t=e1; e1=e0; e0=t; } \ - eflag[i2] = eflag[e1] = 1; eflag[e0] = 2; \ + eflag[i2] = eflag[i1] = 1; eflag[i] = 2; \ } while (0) #define EDGEFLAG_QUAD( i3, i2, i1, i, pv) \ @@ -384,6 +413,21 @@ do { \ } while (0) +#define EDGEFLAG_POLY_TRI_PRE( i2, i1, i, pv) \ +do { \ + eflag[i1] |= (eflag[i1] >> 2) & 1; \ + eflag[i] |= (eflag[i] >> 2) & 2; \ +} while (0) + +#define EDGEFLAG_POLY_TRI_POST( i2, i1, i, pv) \ +do { \ + eflag[i2] = 0; \ + eflag[i1] &= ~(4|1); \ + eflag[i] &= ~(8|2); \ +} while (0) + + + /* Culled and possibly clipped primitives. */ #define RENDER_POINTS( start, count ) \ @@ -455,10 +499,12 @@ do { \ const GLubyte *cullmask = VB->CullMask; \ GLuint vlist[VB_SIZE]; \ GLubyte *eflag = VB->EdgeFlagPtr->data; \ - (void) vlist; (void) eflag; + GLuint *stipplecounter = &VB->ctx->StippleCounter; \ + (void) vlist; (void) eflag; (void) stipplecounter; #define TAG(x) x##_cull #define INIT(x) FLUSH_PRIM(x) +#define RESET_STIPPLE *stipplecounter = 0 #include "render_tmp.h" @@ -492,9 +538,11 @@ do { \ #define LOCAL_VARS \ GLcontext *ctx = VB->ctx; \ GLubyte *eflag = VB->EdgeFlagPtr->data; \ - (void) eflag; + GLuint *stipplecounter = &VB->ctx->StippleCounter; \ + (void) eflag; (void) stipplecounter; #define INIT(x) FLUSH_PRIM(x); +#define RESET_STIPPLE *stipplecounter = 0 #include "render_tmp.h" @@ -510,24 +558,27 @@ do { \ #define RENDER_TRI( i2, i1, i, pv, parity) \ do { \ - GLuint e1=i1, e0=i; \ - if (parity) { GLuint t=e1; e1=e0; e0=t; } \ - gl_render_clipped_triangle2(ctx,i2,e1,e0,pv); \ + GLuint e2=i2, e1=i1; \ + if (parity) { GLuint t=e2; e2=e1; e1=t; } \ + gl_render_clipped_triangle2(ctx,e2,e1,i,pv); \ } while (0) #define RENDER_QUAD( i3, i2, i1, i, pv) \ do { \ - gl_render_clipped_triangle2(ctx,i3,i2,i1,pv); \ - gl_render_clipped_triangle2(ctx,i3,i1,i,pv); \ + gl_render_clipped_quad2(ctx,i3,i2,i1,i,pv); \ } while (0) #define LOCAL_VARS \ GLcontext *ctx = VB->ctx; \ GLubyte *eflag = VB->EdgeFlagPtr->data; \ - (void) eflag; + GLuint *stipplecounter = &VB->ctx->StippleCounter; \ + (void) eflag; (void) stipplecounter; + #define INIT(x) FLUSH_PRIM(x); #define TAG(x) x##_clipped +#define RESET_STIPPLE *stipplecounter = 0 + #include "render_tmp.h" /* Bits: @@ -566,24 +617,25 @@ setup_edgeflag( struct vertex_buffer *VB, switch (prim) { case GL_TRIANGLES: for (i = 0 ; i < n-2 ; i+=3) { - if (flag[i]) flag[i] = 0x5; - if (flag[i+1]) flag[i+1] = 0x5; - if (flag[i+2]) flag[i+2] = 0x6; + if (flag[i]) flag[i] = 0x1; + if (flag[i+1]) flag[i+1] = 0x1; + if (flag[i+2]) flag[i+2] = 0x3; } break; case GL_QUADS: for (i = 0 ; i < n-3 ; i+=4) { - if (flag[i]) flag[i] = 0x5; - if (flag[i+1]) flag[i+1] = 0x5; - if (flag[i+2]) flag[i+2] = 0x5; - if (flag[i+3]) flag[i+3] = 0x6; + if (flag[i]) flag[i] = 0x1; + if (flag[i+1]) flag[i+1] = 0x1; + if (flag[i+2]) flag[i+2] = 0x1; + if (flag[i+3]) flag[i+3] = 0x3; } break; case GL_POLYGON: - for (i = 0 ; i < n-1 ; i++) { - if (flag[i]) flag[i] = 0x5; + if (flag[0]) flag[0] = 0x1; + for (i = 1 ; i < n-1 ; i++) { + if (flag[i]) flag[i] = 0x1<<2; } - if (flag[i]) flag[i] = 0x6; + if (flag[i]) flag[i] = 0x3<<2; break; default: break; @@ -667,12 +719,12 @@ void gl_reduced_prim_change( GLcontext *ctx, GLenum prim ) if (ctx->PB->count > 0) gl_flush_pb(ctx); - ctx->PB->count = 0; - ctx->PB->mono = GL_FALSE; - ctx->PB->primitive = prim; + if (ctx->PB->primitive != prim) { + ctx->PB->primitive = prim; - if (ctx->Driver.ReducedPrimitiveChange) - ctx->Driver.ReducedPrimitiveChange( ctx, prim ); + if (ctx->Driver.ReducedPrimitiveChange) + ctx->Driver.ReducedPrimitiveChange( ctx, prim ); + } } diff --git a/xc/include/GL/Imakefile b/xc/include/GL/Imakefile index 2e18a43cb..2ac6c9e0e 100644 --- a/xc/include/GL/Imakefile +++ b/xc/include/GL/Imakefile @@ -3,9 +3,10 @@ XCOMM $XFree86: xc/include/GL/Imakefile,v 1.8 2000/03/02 16:07:29 martin Exp $ LinkSourceFile(gl.h, ../../extras/Mesa/include/GL) LinkSourceFile(glext.h, ../../extras/Mesa/include/GL) +LinkSourceFile(osmesa.h, ../../extras/Mesa/include/GL) #if BuildGLXLibrary -GLXHEADERS = gl.h glext.h glx.h glxint.h glxmd.h glxproto.h glxtokens.h +GLXHEADERS = gl.h glext.h glx.h glxint.h glxmd.h glxproto.h glxtokens.h osmesa.h #endif HEADERS = $(GLXHEADERS) diff --git a/xc/include/GL/gl.h b/xc/include/GL/gl.h index b5323f4b0..f7d1224cf 100644 --- a/xc/include/GL/gl.h +++ b/xc/include/GL/gl.h @@ -32,115 +32,57 @@ #endif +/********************************************************************** + * Begin system-specific stuff. + */ #if defined(__BEOS__) #include <stdlib.h> /* to get some BeOS-isms */ #endif - #if !defined(OPENSTEP) && (defined(NeXT) || defined(NeXT_PDO)) #define OPENSTEP #endif - -/* - * XXX move as many of these pragma's and MS Windows-isms into - * the new src/glheader.h file. - */ - #if defined(_WIN32) && !defined(__WIN32__) -# define __WIN32__ +#define __WIN32__ #endif -#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__)) -# pragma warning( disable : 4068 ) /* unknown pragma */ -# pragma warning( disable : 4710 ) /* function 'foo' not inlined */ -# pragma warning( disable : 4711 ) /* function 'foo' selected for automatic inline expansion */ -# pragma warning( disable : 4127 ) /* conditional expression is constant */ -# if defined(MESA_MINWARN) -# pragma warning( disable : 4244 ) /* '=' : conversion from 'const double ' to 'float ', possible loss of data */ -# pragma warning( disable : 4018 ) /* '<' : signed/unsigned mismatch */ -# pragma warning( disable : 4305 ) /* '=' : truncation from 'const double ' to 'float ' */ -# pragma warning( disable : 4550 ) /* 'function' undefined; assuming extern returning int */ -# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ -# endif +#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN__)) # if defined(_MSC_VER) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ # define GLAPI __declspec(dllexport) -# define WGLAPI __declspec(dllexport) # elif defined(_MSC_VER) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ # define GLAPI __declspec(dllimport) -# define WGLAPI __declspec(dllimport) # else /* for use with static link lib build of Win32 edition only */ # define GLAPI extern -# define WGLAPI __declspec(dllimport) # endif /* _STATIC_MESA support */ # define GLAPIENTRY __stdcall -# define GLAPIENTRYP __stdcall * -# define GLCALLBACK __stdcall -# define GLCALLBACKP __stdcall * -# if defined(__CYGWIN32__) -# define GLCALLBACKPCAST * -# else -# define GLCALLBACKPCAST __stdcall * -# endif -# define GLWINAPI __stdcall -# define GLWINAPIV __cdecl #else /* non-Windows compilation */ # define GLAPI extern # define GLAPIENTRY -# define GLAPIENTRYP * -# define GLCALLBACK -# define GLCALLBACKP * -# define GLCALLBACKPCAST * -# define GLWINAPI -# define GLWINAPIV -#endif /* WIN32 / CYGWIN32 bracket */ - -/* compatability guard so we don't need to change client code */ - -#if defined(_WIN32) && !defined(_WINDEF_) && !defined(_GNU_H_WINDOWS32_BASE) && !defined(OPENSTEP) -# define CALLBACK GLCALLBACK -typedef int (GLAPIENTRY *PROC)(); -typedef void *HGLRC; -typedef void *HDC; -typedef unsigned long COLORREF; -#endif +#endif /* WIN32 / CYGWIN bracket */ #if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) -# define WGL_FONT_LINES 0 -# define WGL_FONT_POLYGONS 1 -#ifndef _GNU_H_WINDOWS32_FUNCTIONS -# ifdef UNICODE -# define wglUseFontBitmaps wglUseFontBitmapsW -# define wglUseFontOutlines wglUseFontOutlinesW -# else -# define wglUseFontBitmaps wglUseFontBitmapsA -# define wglUseFontOutlines wglUseFontOutlinesA -# endif /* !UNICODE */ -#endif /* _GNU_H_WINDOWS32_FUNCTIONS */ -typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR; -typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT; -typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESCRIPTOR, *LPPIXELFORMATDESCRIPTOR; #include <gl/mesa_wgl.h> #endif -#ifdef __cplusplus -extern "C" { +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import on #endif +/* + * End system-specific stuff. + **********************************************************************/ + -#ifdef macintosh - #pragma enumsalwaysint on - #if PRAGMA_IMPORT_SUPPORTED - #pragma import on - #endif +#ifdef __cplusplus +extern "C" { #endif #define GL_VERSION_1_1 1 #define GL_VERSION_1_2 1 -#define GL_HAS_GLEXT 1 @@ -1780,14 +1722,93 @@ GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, - /* - * XXX these extensions may eventually be moved into glext.h + * GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1) */ +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 + +#define GL_TEXTURE0_ARB 0x84C0 +#define GL_TEXTURE1_ARB 0x84C1 +#define GL_TEXTURE2_ARB 0x84C2 +#define GL_TEXTURE3_ARB 0x84C3 +#define GL_TEXTURE4_ARB 0x84C4 +#define GL_TEXTURE5_ARB 0x84C5 +#define GL_TEXTURE6_ARB 0x84C6 +#define GL_TEXTURE7_ARB 0x84C7 +#define GL_TEXTURE8_ARB 0x84C8 +#define GL_TEXTURE9_ARB 0x84C9 +#define GL_TEXTURE10_ARB 0x84CA +#define GL_TEXTURE11_ARB 0x84CB +#define GL_TEXTURE12_ARB 0x84CC +#define GL_TEXTURE13_ARB 0x84CD +#define GL_TEXTURE14_ARB 0x84CE +#define GL_TEXTURE15_ARB 0x84CF +#define GL_TEXTURE16_ARB 0x84D0 +#define GL_TEXTURE17_ARB 0x84D1 +#define GL_TEXTURE18_ARB 0x84D2 +#define GL_TEXTURE19_ARB 0x84D3 +#define GL_TEXTURE20_ARB 0x84D4 +#define GL_TEXTURE21_ARB 0x84D5 +#define GL_TEXTURE22_ARB 0x84D6 +#define GL_TEXTURE23_ARB 0x84D7 +#define GL_TEXTURE24_ARB 0x84D8 +#define GL_TEXTURE25_ARB 0x84D9 +#define GL_TEXTURE26_ARB 0x84DA +#define GL_TEXTURE27_ARB 0x84DB +#define GL_TEXTURE28_ARB 0x84DC +#define GL_TEXTURE29_ARB 0x84DD +#define GL_TEXTURE30_ARB 0x84DE +#define GL_TEXTURE31_ARB 0x84DF +#define GL_ACTIVE_TEXTURE_ARB 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 +#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 + +GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); +GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); +GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); +GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); +GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); +GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); +GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); +GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); +GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); +GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); +GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); +GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); +GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); +GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); +GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); +GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); +GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); +GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); +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 */ + + + + +#if defined(GL_GLEXT_LEGACY) /* - * GL_EXT_abgr (number 1) + * 1. GL_EXT_abgr */ #ifndef GL_EXT_abgr #define GL_EXT_abgr 1 @@ -1799,7 +1820,7 @@ GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, /* - * GL_EXT_blend_color (number 2) + * 2. GL_EXT_blend_color */ #ifndef GL_EXT_blend_color #define GL_EXT_blend_color 1 @@ -1817,7 +1838,7 @@ GLAPI void GLAPIENTRY glBlendColorEXT( GLclampf red, GLclampf green, GLclampf bl /* - * GL_EXT_polygon_offset (number 3) + * 3. GL_EXT_polygon_offset */ #ifndef GL_EXT_polygon_offset #define GL_EXT_polygon_offset 1 @@ -1833,7 +1854,7 @@ GLAPI void GLAPIENTRY glPolygonOffsetEXT( GLfloat factor, GLfloat bias ); /* - * GL_EXT_texture3D (number 6) + * 6. GL_EXT_texture3D */ #ifndef GL_EXT_texture3D #define GL_EXT_texture3D 1 @@ -1860,7 +1881,7 @@ GLAPI void GLAPIENTRY glCopyTexSubImage3DEXT( GLenum target, GLint level, GLint /* - * GL_EXT_texture_object (number 20) + * 20. GL_EXT_texture_object */ #ifndef GL_EXT_texture_object #define GL_EXT_texture_object 1 @@ -1887,7 +1908,7 @@ GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture ); /* - * GL_EXT_rescale_normal (number 27) + * 27. GL_EXT_rescale_normal */ #ifndef GL_EXT_rescale_normal #define GL_EXT_rescale_normal 1 @@ -1899,7 +1920,7 @@ GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture ); /* - * GL_EXT_vertex_array (number 30) + * 30. GL_EXT_vertex_array */ #ifndef GL_EXT_vertex_array #define GL_EXT_vertex_array 1 @@ -1960,7 +1981,7 @@ GLAPI void GLAPIENTRY glDrawArraysEXT( GLenum mode, GLint first, GLsizei count ) /* - * GL_SGIS_texture_edge_clamp (number 35) + * 35. GL_SGIS_texture_edge_clamp */ #ifndef GL_SGIS_texture_edge_clamp #define GL_SGIS_texture_edge_clamp 1 @@ -1972,7 +1993,7 @@ GLAPI void GLAPIENTRY glDrawArraysEXT( GLenum mode, GLint first, GLsizei count ) /* - * GL_EXT_blend_minmax (number 37) + * 37. GL_EXT_blend_minmax */ #ifndef GL_EXT_blend_minmax #define GL_EXT_blend_minmax 1 @@ -1989,7 +2010,7 @@ GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); /* - * GL_EXT_blend_subtract (number 38) (requires GL_EXT_blend_max ) + * 38. GL_EXT_blend_subtract (requires GL_EXT_blend_max ) */ #ifndef GL_EXT_blend_subtract #define GL_EXT_blend_subtract 1 @@ -2002,7 +2023,7 @@ GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); /* - * GL_EXT_blend_logic_op (number 39) + * 39. GL_EXT_blend_logic_op */ #ifndef GL_EXT_blend_logic_op #define GL_EXT_blend_logic_op 1 @@ -2014,7 +2035,7 @@ GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); /* - * GL_EXT_point_parameters (number 54) + * 54. GL_EXT_point_parameters */ #ifndef GL_EXT_point_parameters #define GL_EXT_point_parameters 1 @@ -2026,13 +2047,15 @@ GLAPI void GLAPIENTRY glBlendEquationEXT( GLenum mode ); GLAPI void GLAPIENTRY glPointParameterfEXT( GLenum pname, GLfloat param ); GLAPI void GLAPIENTRY glPointParameterfvEXT( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glPointParameterfSGIS(GLenum pname, GLfloat param); +GLAPI void GLAPIENTRY glPointParameterfvSGIS(GLenum pname, const GLfloat *params); #endif /* GL_EXT_point_parameters */ /* - * GL_EXT_paletted_texture (number 78) + * 78. GL_EXT_paletted_texture */ #ifndef GL_EXT_paletted_texture #define GL_EXT_paletted_texture 1 @@ -2069,19 +2092,19 @@ GLAPI void GLAPIENTRY glGetColorTableParameterivEXT( GLenum target, GLenum pname /* - * GL_EXT_clip_volume_hint (number 79) + * 79. GL_EXT_clip_volume_hint */ #ifndef GL_EXT_clip_volume_hint #define GL_EXT_clip_volume_hint 1 -#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 #endif /* GL_EXT_clip_volume_hint */ /* - * GL_EXT_compiled_vertex_array (number 97) + * 97. GL_EXT_compiled_vertex_array */ #ifndef GL_EXT_compiled_vertex_array #define GL_EXT_compiled_vertex_array 1 @@ -2107,7 +2130,7 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); /* - * GL_EXT_shared_texture_palette (number 141) (req's GL_EXT_paletted_texture) + * 141. GL_EXT_shared_texture_palette (req's GL_EXT_paletted_texture) */ #ifndef GL_EXT_shared_texture_palette #define GL_EXT_shared_texture_palette 1 @@ -2119,7 +2142,7 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); /* - * GL_EXT_stencil_wrap (number 176) + * 176. GL_EXT_stencil_wrap */ #ifndef GL_EXT_stencil_wrap #define GL_EXT_stencil_wrap 1 @@ -2132,7 +2155,7 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); /* - * GL_NV_texgen_reflection (number 179) + * 179. GL_NV_texgen_reflection */ #ifndef GL_NV_texgen_reflection #define GL_NV_texgen_reflection 1 @@ -2145,7 +2168,7 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); /* - * GL_EXT_texture_env_add (number 185) + * 185. GL_EXT_texture_env_add */ #ifndef GL_EXT_texture_env_add #define GL_EXT_texture_env_add 1 @@ -2156,89 +2179,10 @@ GLAPI void GLAPIENTRY glUnlockArraysEXT( void ); -/* - * GL_ARB_multitexture (ARB 0) - */ -#ifndef GL_ARB_multitexture -#define GL_ARB_multitexture 1 - -#define GL_TEXTURE0_ARB 0x84C0 -#define GL_TEXTURE1_ARB 0x84C1 -#define GL_TEXTURE2_ARB 0x84C2 -#define GL_TEXTURE3_ARB 0x84C3 -#define GL_TEXTURE4_ARB 0x84C4 -#define GL_TEXTURE5_ARB 0x84C5 -#define GL_TEXTURE6_ARB 0x84C6 -#define GL_TEXTURE7_ARB 0x84C7 -#define GL_TEXTURE8_ARB 0x84C8 -#define GL_TEXTURE9_ARB 0x84C9 -#define GL_TEXTURE10_ARB 0x84CA -#define GL_TEXTURE11_ARB 0x84CB -#define GL_TEXTURE12_ARB 0x84CC -#define GL_TEXTURE13_ARB 0x84CD -#define GL_TEXTURE14_ARB 0x84CE -#define GL_TEXTURE15_ARB 0x84CF -#define GL_TEXTURE16_ARB 0x84D0 -#define GL_TEXTURE17_ARB 0x84D1 -#define GL_TEXTURE18_ARB 0x84D2 -#define GL_TEXTURE19_ARB 0x84D3 -#define GL_TEXTURE20_ARB 0x84D4 -#define GL_TEXTURE21_ARB 0x84D5 -#define GL_TEXTURE22_ARB 0x84D6 -#define GL_TEXTURE23_ARB 0x84D7 -#define GL_TEXTURE24_ARB 0x84D8 -#define GL_TEXTURE25_ARB 0x84D9 -#define GL_TEXTURE26_ARB 0x84DA -#define GL_TEXTURE27_ARB 0x84DB -#define GL_TEXTURE28_ARB 0x84DC -#define GL_TEXTURE29_ARB 0x84DD -#define GL_TEXTURE30_ARB 0x84DE -#define GL_TEXTURE31_ARB 0x84DF -#define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 - -GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture); -GLAPI void GLAPIENTRY glClientActiveTextureARB(GLenum texture); -GLAPI void GLAPIENTRY glMultiTexCoord1dARB(GLenum target, GLdouble s); -GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v); -GLAPI void GLAPIENTRY glMultiTexCoord1fARB(GLenum target, GLfloat s); -GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v); -GLAPI void GLAPIENTRY glMultiTexCoord1iARB(GLenum target, GLint s); -GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v); -GLAPI void GLAPIENTRY glMultiTexCoord1sARB(GLenum target, GLshort s); -GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v); -GLAPI void GLAPIENTRY glMultiTexCoord2dARB(GLenum target, GLdouble s, GLdouble t); -GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v); -GLAPI void GLAPIENTRY glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t); -GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v); -GLAPI void GLAPIENTRY glMultiTexCoord2iARB(GLenum target, GLint s, GLint t); -GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v); -GLAPI void GLAPIENTRY glMultiTexCoord2sARB(GLenum target, GLshort s, GLshort t); -GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v); -GLAPI void GLAPIENTRY glMultiTexCoord3dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r); -GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v); -GLAPI void GLAPIENTRY glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r); -GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v); -GLAPI void GLAPIENTRY glMultiTexCoord3iARB(GLenum target, GLint s, GLint t, GLint r); -GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v); -GLAPI void GLAPIENTRY glMultiTexCoord3sARB(GLenum target, GLshort s, GLshort t, GLshort r); -GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v); -GLAPI void GLAPIENTRY glMultiTexCoord4dARB(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v); -GLAPI void GLAPIENTRY glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v); -GLAPI void GLAPIENTRY glMultiTexCoord4iARB(GLenum target, GLint s, GLint t, GLint r, GLint q); -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 */ - /* - * GL_MESA_window_pos (197) + * 197. GL_MESA_window_pos */ #ifndef GL_MESA_window_pos #define GL_MESA_window_pos 1 @@ -2273,7 +2217,7 @@ GLAPI void GLAPIENTRY glWindowPos4dvMESA( const GLdouble *p ); /* - * GL_MESA_resize_bufffers (196) + * 196. GL_MESA_resize_bufffers */ #ifndef GL_MESA_resize_bufffers #define GL_MESA_resize_buffers 1 @@ -2283,18 +2227,27 @@ GLAPI void GLAPIENTRY glResizeBuffersMESA( void ); #endif /* GL_MESA_resize_bufffers */ +#else /* GL_GLEXT_LEGACY */ + +#include <GL/glext.h> + +#endif /* GL_GLEXT_LEGACY */ + + +/********************************************************************** + * Begin system-specific stuff + */ #if defined(__BEOS__) || defined(__QUICKDRAW__) #pragma export off #endif - -#ifdef macintosh - #pragma enumsalwaysint reset - #if PRAGMA_IMPORT_SUPPORTED - #pragma import off - #endif +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import off #endif +/* + * End system-specific stuff + **********************************************************************/ #ifdef __cplusplus diff --git a/xc/lib/GL/Imakefile b/xc/lib/GL/Imakefile index 79a9c4b7d..c882109e1 100644 --- a/xc/lib/GL/Imakefile +++ b/xc/lib/GL/Imakefile @@ -233,6 +233,13 @@ InstallLibrary($(LIBNAME),$(USRLIBDIR)) #if SharedLibGlx SharedDepLibraryTarget($(LIBNAME),$(SOREV),$(GLXSUBDIRS) $(DONES),$(OBJS) $(THREADOBJS),.,.) InstallSharedLibrary($(LIBNAME),$(SOREV),$(SHLIBDIR)) +#if LinkGLToUsrLib && AlternateUsrLibDir +install:: + $(RM) $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so + $(LN) $(SHLIBDIR)/lib$(LIBNAME).so $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so + $(RM) $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so.1 + $(LN) $(SHLIBDIR)/lib$(LIBNAME).so.1 $(DESTDIR)$(SYSTEMUSRLIBDIR)/lib$(LIBNAME).so.1 +#endif #endif #if DebugLibGlx DebuggedDepLibraryTarget($(LIBNAME),$(GLXSUBDIRS) $(DONES),$(DOBJS)) diff --git a/xc/lib/GL/dri/XF86dri.c b/xc/lib/GL/dri/XF86dri.c index 5c86222c6..dd0ee56ff 100644 --- a/xc/lib/GL/dri/XF86dri.c +++ b/xc/lib/GL/dri/XF86dri.c @@ -205,6 +205,7 @@ Bool XF86DRIAuthConnection(dpy, screen, magic) { XExtDisplayInfo *info = find_display (dpy); xXF86DRIAuthConnectionReq *req; + xXF86DRIAuthConnectionReply rep; XF86DRICheckExtension (dpy, info, False); @@ -214,6 +215,12 @@ Bool XF86DRIAuthConnection(dpy, screen, magic) req->driReqType = X_XF86DRIAuthConnection; req->screen = screen; req->magic = magic; + rep.authenticated = 0; + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse) || !rep.authenticated) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } UnlockDisplay(dpy); SyncHandle(); return True; diff --git a/xc/lib/GL/dri/dri_glx.c b/xc/lib/GL/dri/dri_glx.c index 48cdb8437..5b83792f7 100644 --- a/xc/lib/GL/dri/dri_glx.c +++ b/xc/lib/GL/dri/dri_glx.c @@ -75,6 +75,15 @@ static void ErrorMessage(const char *msg) } +static void InfoMessage(const char *msg) +{ + const char *env = getenv("LIBGL_DEBUG"); + if (env && strstr(env, "verbose")) { + fprintf(stderr, "libGL: %s\n", msg); + } +} + + /* * We'll save a pointer to this function when we couldn't find a * direct rendering driver for a given screen. @@ -91,6 +100,109 @@ static void *DummyCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, } + +/* + * Extract the ith directory path out of a colon-separated list of + * paths. + * Input: + * index - index of path to extract (starting at zero) + * paths - the colon-separated list of paths + * dirLen - max length of result to store in <dir> + * Output: + * dir - the extracted directory path, dir[0] will be zero when + * extraction fails. + */ +static void ExtractDir(int index, const char *paths, int dirLen, char *dir) +{ + int i, len; + const char *start, *end; + + /* find ith colon */ + start = paths; + i = 0; + while (i < index) { + if (*start == ':') { + i++; + start++; + } + else if (*start == 0) { + /* end of string and couldn't find ith colon */ + dir[0] = 0; + return; + } + else { + start++; + } + } + + while (*start == ':') + start++; + + /* find next colon, or end of string */ + end = start + 1; + while (*end != ':' && *end != 0) { + end++; + } + + /* copy string between <start> and <end> into result string */ + len = end - start; + if (len > dirLen - 1) + len = dirLen - 1; + strncpy(dir, start, len); + dir[len] = 0; +} + + + +/* + * Try to dlopen() the named driver. This function adds the + * "_dri.so" suffix to the driver name and searches the + * directories specified by the LIBGL_DRIVERS_PATH env var + * in order to find the driver. + * Input: + * driverName - a name like "tdfx", "i810", "mga", etc. + * Return: + * handle from dlopen, or NULL if driver file not found. + */ +static void *OpenDriver(const char *driverName) +{ + char *libPaths = NULL; + int i; + + if (geteuid() == getuid()) { + /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */ + libPaths = getenv("LIBGL_DRIVERS_PATH"); + if (!libPaths) + libPaths = getenv("LIBGL_DRIVERS_DIR"); /* deprecated */ + } + if (!libPaths) + libPaths = DEFAULT_DRIVER_DIR; + + for (i = 0; ; i++) { + char libDir[1000], info[1000], realDriverName[100]; + void *handle; + ExtractDir(i, libPaths, 1000, libDir); + if (!libDir[0]) + return NULL; + sprintf(realDriverName, "%s/%s_dri.so", libDir, driverName); + sprintf(info, "trying %s", realDriverName); + InfoMessage(info); + handle = dlopen(realDriverName, RTLD_NOW | RTLD_GLOBAL); + if (handle) { + return handle; + } + else { + char message[1000]; + snprintf(message, 1000, "dlopen failed: %s", dlerror()); + ErrorMessage(message); + } + } + + return NULL; +} + + + /* * Initialize two arrays: an array of createScreen function pointers * and an array of dlopen library handles. Arrays are indexed by @@ -112,15 +224,18 @@ static void Find_CreateScreenFuncs(Display *dpy, Bool b; int driverMajor, driverMinor, driverPatch; char *driverName = NULL; + void *handle; /* defaults */ createFuncs[scrn] = DummyCreateScreen; libraryHandles[scrn] = NULL; if (!XF86DRIQueryDirectRenderingCapable(dpy, scrn, &directCapable)) { + ErrorMessage("XF86DRIQueryDirectRenderingCapable failed"); continue; } if (!directCapable) { + ErrorMessage("XF86DRIQueryDirectRenderingCapable returned false"); continue; } @@ -138,46 +253,25 @@ static void Find_CreateScreenFuncs(Display *dpy, /* - * dlopen the driver module and save the pointer to its + * Open the driver module and save the pointer to its * __driCreateScreen function. */ - { - char realDriverName[100]; - void *handle; - CreateScreenFunc createScreenFunc; - char *libDir = NULL; - - if (geteuid() == getuid()) { - /* don't allow setuid apps to use LIBGL_DRIVERS_DIR */ - libDir = getenv("LIBGL_DRIVERS_DIR"); - } - if (!libDir) - libDir = DEFAULT_DRIVER_DIR; - - sprintf(realDriverName, "%s/%s_dri.so", libDir, driverName); - /*printf("OPEN %s\n", realDriverName);*/ - handle = dlopen(realDriverName, RTLD_LAZY); - if (!handle) { - char message[1000]; - snprintf(message, 1000, "dlopen failed: %s", dlerror()); - ErrorMessage(message); - continue; - } - - createScreenFunc = (CreateScreenFunc) dlsym(handle, "__driCreateScreen"); - if (createScreenFunc) { - /* success! */ - createFuncs[scrn] = createScreenFunc; - libraryHandles[scrn] = handle; - } - else { - char message[1000]; - snprintf(message, 1000, "driCreateScreen() not defined in %s", realDriverName); - ErrorMessage(message); - dlclose(handle); - } + handle = OpenDriver(driverName); + if (handle) { + CreateScreenFunc createScreenFunc; + createScreenFunc = (CreateScreenFunc) dlsym(handle, "__driCreateScreen"); + if (createScreenFunc) { + /* success! */ + createFuncs[scrn] = createScreenFunc; + libraryHandles[scrn] = handle; + break; /* onto the next screen */ + } + else { + ErrorMessage("driCreateScreen() not defined in driver!"); + dlclose(handle); + } } - } + } /* for scrn */ } #endif /* BUILT_IN_DRI_DRIVER */ @@ -220,9 +314,9 @@ void *driCreateDisplay(Display *dpy, __DRIdisplay *pdisp) return NULL; } - pdpyp->major = major; - pdpyp->minor = minor; - pdpyp->patch = patch; + pdpyp->driMajor = major; + pdpyp->driMinor = minor; + pdpyp->driPatch = patch; pdisp->destroyDisplay = driDestroyDisplay; @@ -269,6 +363,7 @@ register_extensions_on_screen(Display *dpy, int scrNum) int driMajor, driMinor, driPatch; int driverMajor, driverMinor, driverPatch; char *driverName = NULL; + void *handle; /* * Check if the DRI extension is available, check the DRI version, @@ -312,29 +407,16 @@ register_extensions_on_screen(Display *dpy, int scrNum) * dlopen() the driver library file, get a pointer to the driver's * __driRegisterExtensions() function, and call it if it exists. */ - { - char realDriverName[100]; - char *libDir = NULL; - void *handle; - - if (geteuid() == getuid()) { - /* don't allow setuid apps to use LIBGL_DRIVERS_DIR */ - libDir = getenv("LIBGL_DRIVERS_DIR"); - } - if (!libDir) - libDir = DEFAULT_DRIVER_DIR; - - sprintf(realDriverName, "%s/%s_dri.so", libDir, driverName); - /*printf("OPEN %s\n", realDriverName);*/ - handle = dlopen(realDriverName, RTLD_LAZY); - if (handle) { - typedef void *(*RegisterExtFunc)(void); - RegisterExtFunc registerExtFunc = (RegisterExtFunc) dlsym(handle, "__driRegisterExtensions"); - if (registerExtFunc) { - (*registerExtFunc)(); - } - dlclose(handle); + handle = OpenDriver(driverName); + if (handle) { + typedef void *(*RegisterExtFunc)(void); + RegisterExtFunc registerExtFunc = (RegisterExtFunc) dlsym(handle, + "__driRegisterExtensions"); + if (registerExtFunc) { + (*registerExtFunc)(); } + dlclose(handle); + return; } } #endif /* !BUILT_IN_DRI_DRIVER */ @@ -362,8 +444,12 @@ __glXRegisterExtensions(void) __driRegisterExtensions(); #else { - int displayNum; - for (displayNum = 0; ; displayNum++) { + int displayNum, maxDisplays; + if (getenv("LIBGL_MULTIHEAD")) + maxDisplays = 10; /* infinity, really */ + else + maxDisplays = 1; + for (displayNum = 0; displayNum < maxDisplays; displayNum++) { char displayName[200]; Display *dpy; snprintf(displayName, 199, ":%d.0", displayNum); @@ -381,13 +467,10 @@ __glXRegisterExtensions(void) } } } -#endif alreadyCalled = GL_TRUE; +#endif } #endif /* GLX_DIRECT_RENDERING */ - - - diff --git a/xc/lib/GL/dri/dri_glx.h b/xc/lib/GL/dri/dri_glx.h index 21fe733bc..75561685c 100644 --- a/xc/lib/GL/dri/dri_glx.h +++ b/xc/lib/GL/dri/dri_glx.h @@ -41,9 +41,9 @@ struct __DRIdisplayPrivateRec { /* ** XFree86-DRI version information */ - int major; - int minor; - int patch; + int driMajor; + int driMinor; + int driPatch; /* ** Array of library handles [indexed by screen number] diff --git a/xc/lib/GL/dri/xf86dristr.h b/xc/lib/GL/dri/xf86dristr.h index ea8bad041..42e5da785 100644 --- a/xc/lib/GL/dri/xf86dristr.h +++ b/xc/lib/GL/dri/xf86dristr.h @@ -40,7 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define XF86DRINAME "XFree86-DRI" -#define XF86DRI_MAJOR_VERSION 1 /* current version numbers */ +#define XF86DRI_MAJOR_VERSION 3 /* current version numbers */ #define XF86DRI_MINOR_VERSION 0 #define XF86DRI_PATCH_VERSION 0 @@ -122,6 +122,20 @@ typedef struct _XF86DRIAuthConnection { } xXF86DRIAuthConnectionReq; #define sz_xXF86DRIAuthConnectionReq 12 +typedef struct { + BYTE type; + BOOL pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; + CARD32 authenticated B32; + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; +} xXF86DRIAuthConnectionReply; +#define zx_xXF86DRIAuthConnectionReply 32 + typedef struct _XF86DRICloseConnection { CARD8 reqType; /* always DRIReqCode */ CARD8 driReqType; /* always X_DRICloseConnection */ @@ -238,9 +252,13 @@ typedef struct { INT16 drawableWidth B16; INT16 drawableHeight B16; CARD32 numClipRects B32; - CARD32 pad6 B32; + INT16 backX B16; + INT16 backY B16; + CARD32 numBackClipRects B32; } xXF86DRIGetDrawableInfoReply; -#define sz_xXF86DRIGetDrawableInfoReply 32 + +#define sz_xXF86DRIGetDrawableInfoReply 36 + typedef struct _XF86DRIGetDeviceInfo { CARD8 reqType; /* always DRIReqCode */ diff --git a/xc/lib/GL/glx/glxcmds.c b/xc/lib/GL/glx/glxcmds.c index 935f9b155..d7462eb2b 100644 --- a/xc/lib/GL/glx/glxcmds.c +++ b/xc/lib/GL/glx/glxcmds.c @@ -49,7 +49,8 @@ static const char GLXClientVersion[] = "1.2"; static const char GLXClientExtensions[] = "GLX_EXT_visual_info " "GLX_EXT_visual_rating " - "GLX_EXT_import_context "; + "GLX_EXT_import_context " + "GLX_ARB_get_proc_address "; /* ** Create a new context. @@ -1191,7 +1192,7 @@ static char *combine_strings( const char *cext_string, const char *sext_string ) s1 = (char *) malloc( slen + 2 ); strcpy( s1, sext_string ); s2 = cext_string; } else { - combo_string = (char *) malloc( clen + 2 ); + combo_string = (char *) Xmalloc( clen + 2 ); s1 = (char *) Xmalloc( clen + 2 ); strcpy( s1, cext_string); s2 = sext_string; } @@ -1498,7 +1499,7 @@ void glXFreeContextEXT(Display *dpy, GLXContext ctx) * GLX 1.3 functions - these are just stubs for now! */ -GLXFBConfig glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) +GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems) { (void) dpy; (void) screen; @@ -1575,6 +1576,15 @@ GLXDrawable glXGetCurrentReadDrawable(void) } +GLXFBConfig *glXGetFBConfigs(Display *dpy, int screen, int *nelements) +{ + (void) dpy; + (void) screen; + (void) nelements; + return 0; +} + + int glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value) { (void) dpy; @@ -1640,6 +1650,48 @@ void glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask) /* +** Mesa extension stubs. These will help reduce portability problems. +*/ + +void glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ) +{ + (void) dpy; + (void) d; + /* no-op stub */ +} + + +GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, + Pixmap pixmap, Colormap cmap ) +{ + (void) dpy; + (void) visual; + (void) pixmap; + (void) cmap; + return 0; +} + + +void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, + int x, int y, int width, int height ) +{ + (void) dpy; + (void) drawable; + (void) x; + (void) y; + (void) width; + (void) height; +} + + +GLboolean glXSet3DfxModeMESA( GLint mode ) +{ + (void) mode; + return GL_FALSE; +} + + +/* ** glXGetProcAddress support */ @@ -1683,6 +1735,7 @@ static struct name_address_pair GLX_functions[] = { { "glXDestroyWindow", (GLvoid *) glXDestroyWindow }, { "glXGetCurrentReadDrawable", (GLvoid *) glXGetCurrentReadDrawable }, { "glXGetFBConfigAttrib", (GLvoid *) glXGetFBConfigAttrib }, + { "glXGetFBConfigs", (GLvoid *) glXGetFBConfigs }, { "glXGetSelectedEvent", (GLvoid *) glXGetSelectedEvent }, { "glXGetVisualFromFBConfig", (GLvoid *) glXGetVisualFromFBConfig }, { "glXMakeContextCurrent", (GLvoid *) glXMakeContextCurrent }, @@ -1698,6 +1751,12 @@ static struct name_address_pair GLX_functions[] = { { "glXQueryContextInfoEXT", (GLvoid *) glXQueryContextInfoEXT }, { "glXGetProcAddressARB", (GLvoid *) glXGetProcAddressARB }, + /* Mesa extensions */ + { "glXReleaseBuffersMESA", (GLvoid *) glXReleaseBuffersMESA }, + { "glXCreateGLXPixmapMESA", (GLvoid *) glXCreateGLXPixmapMESA }, + { "glXCopySubBufferMESA", (GLvoid *) glXCopySubBufferMESA }, + { "glXSet3DfxModeMESA", (GLvoid *) glXSet3DfxModeMESA }, + { NULL, NULL } /* end of list */ }; diff --git a/xc/lib/GL/mesa/dri/dri_mesa.c b/xc/lib/GL/mesa/dri/dri_mesa.c index b679b41a4..e6435e218 100644 --- a/xc/lib/GL/mesa/dri/dri_mesa.c +++ b/xc/lib/GL/mesa/dri/dri_mesa.c @@ -71,6 +71,19 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, static void driMesaDestroyScreen(Display *dpy, int scrn, void *private); + +/* +** Print message to stderr if LIBGL_DEBUG env var is set. +*/ +void +__driMesaMessage(const char *msg) +{ + if (getenv("LIBGL_DEBUG")) { + fprintf(stderr, "libGL error: %s\n", msg); + } +} + + /*****************************************************************/ /* Maintain a list of drawables */ @@ -543,6 +556,7 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + psp->display = dpy; psp->myNum = scrn; if (!XF86DRIOpenConnection(dpy, scrn, &hSAREA, &BusID)) { @@ -558,7 +572,7 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, psp->drawLockID = 1; psp->fd = drmOpen(NULL,BusID); - if (!psp->fd) { + if (psp->fd < 0) { Xfree(BusID); Xfree(psp); (void)XF86DRICloseConnection(dpy, scrn); @@ -573,6 +587,21 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, return NULL; } + { + drmVersionPtr version = drmGetVersion(psp->fd); + if (version) { + psp->drmMajor = version->version_major; + psp->drmMinor = version->version_minor; + psp->drmPatch = version->version_patchlevel; + drmFreeVersion(version); + } + else { + psp->drmMajor = -1; + psp->drmMinor = -1; + psp->drmPatch = -1; + } + } + if (!XF86DRIAuthConnection(dpy, scrn, magic)) { (void)drmClose(psp->fd); Xfree(psp); @@ -581,9 +610,9 @@ static void *driMesaCreateScreen(Display *dpy, int scrn, __DRIscreen *psc, } if (!XF86DRIGetClientDriverName(dpy, scrn, - &psp->major, - &psp->minor, - &psp->patch, + &psp->ddxMajor, + &psp->ddxMinor, + &psp->ddxPatch, &driverName)) { (void)drmClose(psp->fd); Xfree(psp); diff --git a/xc/lib/GL/mesa/dri/dri_mesa.h b/xc/lib/GL/mesa/dri/dri_mesa.h index 4a6870801..42903bf1e 100644 --- a/xc/lib/GL/mesa/dri/dri_mesa.h +++ b/xc/lib/GL/mesa/dri/dri_mesa.h @@ -43,5 +43,8 @@ typedef struct __DRIvisualPrivateRec __DRIvisualPrivate; typedef struct __DRIcontextPrivateRec __DRIcontextPrivate; typedef struct __DRIdrawablePrivateRec __DRIdrawablePrivate; +extern void __driMesaMessage(const char *msg); + #endif + #endif /* _DRI_MESA_H_ */ diff --git a/xc/lib/GL/mesa/dri/dri_mesaint.h b/xc/lib/GL/mesa/dri/dri_mesaint.h index e8918724c..9c33dda17 100644 --- a/xc/lib/GL/mesa/dri/dri_mesaint.h +++ b/xc/lib/GL/mesa/dri/dri_mesaint.h @@ -176,6 +176,11 @@ struct __DRIvisualPrivateRec { struct __DRIscreenPrivateRec { /* + ** Display for this screen + */ + Display *display; + + /* ** Current screen's number */ int myNum; @@ -193,11 +198,18 @@ struct __DRIscreenPrivateRec { __MesaAPI MesaAPI; /* - ** Core rendering library's driver version information. + ** DDX / 2D driver version information. + */ + int ddxMajor; + int ddxMinor; + int ddxPatch; + + /* + ** DRM version information. */ - int major; - int minor; - int patch; + int drmMajor; + int drmMinor; + int drmPatch; /* ** ID used when the client sets the drawable lock. The X server diff --git a/xc/lib/GL/mesa/include/GL/Imakefile b/xc/lib/GL/mesa/include/GL/Imakefile index bc6730a85..da1b03d8d 100644 --- a/xc/lib/GL/mesa/include/GL/Imakefile +++ b/xc/lib/GL/mesa/include/GL/Imakefile @@ -11,3 +11,4 @@ LinkSourceFile(glx.h, ../../../../../extras/Mesa/include/GL) LinkSourceFile(xmesa.h, ../../../../../extras/Mesa/include/GL) LinkSourceFile(xmesa_x.h, ../../../../../extras/Mesa/include/GL) LinkSourceFile(xmesa_xf86.h, ../../../../../extras/Mesa/include/GL) +LinkSourceFile(osmesa.h, ../../../../../extras/Mesa/include/GL) diff --git a/xc/lib/GL/mesa/src/Imakefile b/xc/lib/GL/mesa/src/Imakefile index 4f5af973c..1d42b4950 100644 --- a/xc/lib/GL/mesa/src/Imakefile +++ b/xc/lib/GL/mesa/src/Imakefile @@ -382,7 +382,7 @@ NormalLintTarget($(SRCS)) #define IHaveSubdirs #define PassCDebugFlags -SUBDIRS = $(MESASUBDIRS) $(ASMSUBDIRS) drv +SUBDIRS = $(MESASUBDIRS) $(ASMSUBDIRS) drv OSmesa MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) diff --git a/xc/lib/GL/mesa/src/OSmesa/Imakefile b/xc/lib/GL/mesa/src/OSmesa/Imakefile new file mode 100644 index 000000000..e92b9e3a8 --- /dev/null +++ b/xc/lib/GL/mesa/src/OSmesa/Imakefile @@ -0,0 +1,249 @@ + +#include <Threads.tmpl> + +#define DoNormalLib NormalLibGlx +#define DoSharedLib SharedLibGlx +#define DoExtraLib SharedLibGlx +#define DoDebugLib DebugLibGlx +#define DoProfileLib ProfileLibGlx + +LinkSourceFile(osmesa.c, ../../../../../extras/Mesa/src/OSmesa) + + +#if Malloc0ReturnsNull +ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL +#endif + +MESA_INCLUDES = -I. -I.. -I../../include -I../../../../../include + + DEFINES = $(ALLOC_DEFINES) $(DRI_DEFINES) + INCLUDES = -I$(XLIBSRC) -I$(EXTINCSRC) $(MESA_INCLUDES) $(DRI_INCLUDES) + + MESASRCS = ../aatriangle.c \ + ../accum.c \ + ../alpha.c \ + ../alphabuf.c \ + ../attrib.c \ + ../bbox.c \ + ../bitmap.c \ + ../blend.c \ + ../buffers.c \ + ../clip.c \ + ../colortab.c \ + ../config.c \ + ../context.c \ + ../copypix.c \ + ../cva.c \ + ../debug_xform.c \ + ../depth.c \ + ../dlist.c \ + ../drawpix.c \ + ../enable.c \ + ../enums.c \ + ../eval.c \ + ../extensions.c \ + ../feedback.c \ + ../fog.c \ + ../get.c \ + ../glapi.c \ + ../glapinoop.c \ + ../glthread.c \ + ../hash.c \ + ../image.c \ + ../imaging.c \ + ../light.c \ + ../lines.c \ + ../logic.c \ + ../masking.c \ + ../matrix.c \ + ../mem.c \ + ../mmath.c \ + ../pb.c \ + ../pipeline.c \ + ../pixel.c \ + ../pixeltex.c \ + ../points.c \ + ../polygon.c \ + ../quads.c \ + ../rastpos.c \ + ../readpix.c \ + ../rect.c \ + ../scissor.c \ + ../shade.c \ + ../span.c \ + ../stages.c \ + ../state.c \ + ../stencil.c \ + ../teximage.c \ + ../texobj.c \ + ../texstate.c \ + ../texture.c \ + ../texutil.c \ + ../translate.c \ + ../triangle.c \ + ../varray.c \ + ../vb.c \ + ../vbcull.c \ + ../vbfill.c \ + ../vbindirect.c \ + ../vbrender.c \ + ../vbxform.c \ + ../vector.c \ + ../vertices.c \ + ../winpos.c \ + ../xform.c \ + ../zoom.c \ + ../X86/common_x86.c \ + osmesa.c + + MESAOBJS = ../aatriangle.o \ + ../accum.o \ + ../alpha.o \ + ../alphabuf.o \ + ../attrib.o \ + ../bbox.o \ + ../bitmap.o \ + ../blend.o \ + ../buffers.o \ + ../clip.o \ + ../colortab.o \ + ../config.o \ + ../context.o \ + ../copypix.o \ + ../cva.o \ + ../debug_xform.o \ + ../depth.o \ + ../dlist.o \ + ../drawpix.o \ + ../enable.o \ + ../enums.o \ + ../eval.o \ + ../extensions.o \ + ../feedback.o \ + ../fog.o \ + ../get.o \ + ../hash.o \ + ../hint.o \ + ../image.o \ + ../imaging.o \ + ../light.o \ + ../lines.o \ + ../logic.o \ + ../masking.o \ + ../matrix.o \ + ../mem.o \ + ../mmath.o \ + ../pb.o \ + ../pipeline.o \ + ../pixel.o \ + ../pixeltex.o \ + ../points.o \ + ../polygon.o \ + ../quads.o \ + ../rastpos.o \ + ../readpix.o \ + ../rect.o \ + ../scissor.o \ + ../shade.o \ + ../span.o \ + ../stages.o \ + ../state.o \ + ../stencil.o \ + ../teximage.o \ + ../texobj.o \ + ../texstate.o \ + ../texture.o \ + ../texutil.o \ + ../translate.o \ + ../triangle.o \ + ../varray.o \ + ../vb.o \ + ../vbcull.o \ + ../vbfill.o \ + ../vbindirect.o \ + ../vbrender.o \ + ../vbxform.o \ + ../vector.o \ + ../vertices.o \ + ../winpos.o \ + ../xform.o \ + ../zoom.o \ + osmesa.o + +#ifdef i386Architecture + X86_SRCS = ../X86/x86.c \ + ../X86/x86a.S \ + ../X86/common_x86.c \ + ../X86/common_x86asm.S \ + ../X86/vertex.S + + X86_OBJS = ../X86/x86.o \ + ../X86/x86a.o \ + ../X86/common_x86.o \ + ../X86/common_x86asm.o \ + ../X86/vertex.o + + MMX_SRCS = ../X86/mmx_blend.S + + MMX_OBJS = ../X86/mmx_blend.o + +XCOMM Disabling 3Dnow code for the time being. +#if 0 + 3DNOW_SRCS = ../X86/3dnow.c \ + ../X86/3dnow_norm_raw.S \ + ../X86/3dnow_xform_masked1.S \ + ../X86/3dnow_xform_masked2.S \ + ../X86/3dnow_xform_masked3.S \ + ../X86/3dnow_xform_masked4.S \ + ../X86/3dnow_xform_raw1.S \ + ../X86/3dnow_xform_raw2.S \ + ../X86/3dnow_xform_raw3.S \ + ../X86/3dnow_xform_raw4.S \ + ../X86/vertex_3dnow.S + + 3DNOW_OBJS = ../X86/3dnow.o \ + ../X86/3dnow_norm_raw.o \ + ../X86/3dnow_xform_masked1.o \ + ../X86/3dnow_xform_masked2.o \ + ../X86/3dnow_xform_masked3.o \ + ../X86/3dnow_xform_masked4.o \ + ../X86/3dnow_xform_raw1.o \ + ../X86/3dnow_xform_raw2.o \ + ../X86/3dnow_xform_raw3.o \ + ../X86/3dnow_xform_raw4.o \ + ../X86/vertex_3dnow.o +#endif + +#endif + + ASMSRCS = $(X86_SRCS) $(MMX_SRCS) $(3DNOW_SRCS) + ASMOBJS = $(X86_OBJS) $(MMX_OBJS) $(3DNOW_OBJS) + + SRCS = $(MESASRCS) $(ASMSRCS) + OBJS = $(MESAOBJS) $(ASMOBJS) + UOBJS = $(MESAOBJS) $(ASMOBJS) + DONES = DONE + +#if !GlxUseBuiltInDRIDriver + REQUIREDLIBS += -L../../.. -lGL +#endif + +#include <Library.tmpl> + +LibraryObjectRule() + +SubdirLibraryRule($(OBJS)) +NormalLintTarget($(SRCS)) + +LIBNAME = OSMesa +SOREV = 3.3 + + +/*NormalDepLibraryTarget($(LIBNAME), $(DONES), $(UOBJS))*/ +/*InstallLibrary($(LIBNAME),$(USRLIBDIR))*/ + +SharedDepLibraryTarget($(LIBNAME),$(SOREV), $(DONES), $(OBJS), ., .) +InstallSharedLibrary($(LIBNAME),$(SOREV),$(SHLIBDIR)) + + +DependTarget() diff --git a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c index 3c1fe64fc..b199bc073 100644 --- a/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/gamma/gamma_xmesa.c @@ -51,31 +51,65 @@ gammaContextPrivate *gCCPriv = NULL; static struct _glapi_table *Dispatch = NULL; -GLboolean XMesaInitDriver(__DRIscreenPrivate *driScrnPriv) +GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) { gammaScreenPrivate *gsp; + /* Check the DRI version */ + { + int major, minor, patch; + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, "gamma DRI driver expected DRI version 3.0.x but got version %d.%d.%d", major, minor, patch); + __driMesaMessage(msg); + return GL_FALSE; + } + } + } + + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, "gamma DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, "gamm DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + /* Allocate the private area */ gsp = (gammaScreenPrivate *)Xmalloc(sizeof(gammaScreenPrivate)); if (!gsp) { return GL_FALSE; } - gsp->driScrnPriv = driScrnPriv; + gsp->driScrnPriv = sPriv; - driScrnPriv->private = (void *)gsp; + sPriv->private = (void *)gsp; - if (!gammaMapAllRegions(driScrnPriv)) { - Xfree(driScrnPriv->private); + if (!gammaMapAllRegions(sPriv)) { + Xfree(sPriv->private); return GL_FALSE; } return GL_TRUE; } -void XMesaResetDriver(__DRIscreenPrivate *driScrnPriv) +void XMesaResetDriver(__DRIscreenPrivate *sPriv) { - gammaUnmapAllRegions(driScrnPriv); - Xfree(driScrnPriv->private); + gammaUnmapAllRegions(sPriv); + Xfree(sPriv->private); + sPriv->private = NULL; } GLvisual *XMesaCreateVisual(Display *dpy, diff --git a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c index 5edcf2620..e5d95583b 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810_xmesa.c @@ -104,7 +104,9 @@ static drmBufMapPtr i810_create_empty_buffers(void) return NULL; } memset(retval->list, 0, sizeof(drmBuf) * I810_DMA_BUF_NR); + /* fprintf(stderr, "retval : %p, retval->list : %p\n", retval, retval->list); + */ return retval; } @@ -113,9 +115,43 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) i810ScreenPrivate *i810Screen; I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv; + /* Check the DRI version */ + { + int major, minor, patch; + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, "i810 DRI driver expected DRI version 3.0.x but got version %d.%d.%d", major, minor, patch); + __driMesaMessage(msg); + return GL_FALSE; + } + } + } + + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, "i810 DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, "i810 DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + /* Allocate the private area */ i810Screen = (i810ScreenPrivate *)Xmalloc(sizeof(i810ScreenPrivate)); - if (!i810Screen) return GL_FALSE; + if (!i810Screen) + return GL_FALSE; i810Screen->driScrnPriv = sPriv; sPriv->private = (void *)i810Screen; @@ -141,7 +177,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) i810Screen->textureSize=gDRIPriv->textureSize; i810Screen->logTextureGranularity = gDRIPriv->logTextureGranularity; - if (1) + if (0) fprintf(stderr, "Tex heap size %x, granularity %x bytes\n", i810Screen->textureSize, 1<<(i810Screen->logTextureGranularity)); @@ -161,6 +197,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&i810Screen->back.map) != 0) { Xfree(i810Screen); + sPriv->private = NULL; return GL_FALSE; } @@ -173,6 +210,8 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&i810Screen->depth.map) != 0) { Xfree(i810Screen); + drmUnmap(i810Screen->back.map, i810Screen->back.size); + sPriv->private = NULL; return GL_FALSE; } @@ -185,6 +224,9 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&i810Screen->tex.map) != 0) { Xfree(i810Screen); + drmUnmap(i810Screen->back.map, i810Screen->back.size); + drmUnmap(i810Screen->depth.map, i810Screen->depth.size); + sPriv->private = NULL; return GL_FALSE; } @@ -204,9 +246,12 @@ void XMesaResetDriver(__DRIscreenPrivate *sPriv) /* Need to unmap all the bufs and maps here: */ - + drmUnmap(i810Screen->back.map, i810Screen->back.size); + drmUnmap(i810Screen->depth.map, i810Screen->depth.size); + drmUnmap(i810Screen->tex.map, i810Screen->tex.size); Xfree(i810Screen); + sPriv->private = NULL; } @@ -459,7 +504,7 @@ void i810XMesaSetBackClipRects( i810ContextPtr imesa ) static void i810XMesaWindowMoved( i810ContextPtr imesa ) { if (0) - fprintf(stderr, "i810XMesaWindowMoved\n\n"); + fprintf(stderr, "i810XMesaWindowMoved\n\n"); switch (imesa->glCtx->Color.DriverDrawBuffer) { case GL_FRONT_LEFT: @@ -469,7 +514,7 @@ static void i810XMesaWindowMoved( i810ContextPtr imesa ) i810XMesaSetBackClipRects( imesa ); break; default: - fprintf(stderr, "fallback buffer\n"); + /*fprintf(stderr, "fallback buffer\n");*/ break; } } diff --git a/xc/lib/GL/mesa/src/drv/i810/i810dd.c b/xc/lib/GL/mesa/src/drv/i810/i810dd.c index 7c04f6d56..583eb630c 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810dd.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810dd.c @@ -56,7 +56,7 @@ static const GLubyte *i810DDGetString( GLcontext *ctx, GLenum name ) case GL_VENDOR: return "Keith Whitwell, Precision Insight Inc."; case GL_RENDERER: - return "Mesa DRI I810 20000415"; + return "Mesa DRI I810 20000510"; default: return 0; } diff --git a/xc/lib/GL/mesa/src/drv/i810/i810tris.c b/xc/lib/GL/mesa/src/drv/i810/i810tris.c index df28991f1..c601ca492 100644 --- a/xc/lib/GL/mesa/src/drv/i810/i810tris.c +++ b/xc/lib/GL/mesa/src/drv/i810/i810tris.c @@ -114,6 +114,7 @@ void i810DDChooseRenderState( GLcontext *ctx ) if (flags & DD_MULTIDRAW) shared |= I810_FALLBACK_BIT; if (flags & DD_SELECT) shared |= I810_FALLBACK_BIT; if (flags & DD_FEEDBACK) shared |= I810_FALLBACK_BIT; + if (flags & DD_STENCIL) shared |= I810_FALLBACK_BIT; imesa->renderindex = shared; imesa->PointsFunc = points_tab[shared]; diff --git a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c index c6aadc144..a0d9cdf73 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c @@ -99,9 +99,43 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreenPrivate *mgaScreen; MGADRIPtr serverInfo = (MGADRIPtr)sPriv->pDevPriv; + /* Check the DRI version */ + { + int major, minor, patch; + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, "MGA DRI driver expected DRI version 3.0.x but got version %d.%d.%d", major, minor, patch); + __driMesaMessage(msg); + return GL_FALSE; + } + } + } + + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, "MGA DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, "MGA DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return GL_FALSE; + } + /* Allocate the private area */ mgaScreen = (mgaScreenPrivate *)Xmalloc(sizeof(mgaScreenPrivate)); - if (!mgaScreen) return GL_FALSE; + if (!mgaScreen) + return GL_FALSE; mgaScreen->sPriv = sPriv; sPriv->private = (void *)mgaScreen; @@ -111,8 +145,12 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) */ if (serverInfo->chipset != MGA_CARD_TYPE_G200 && - serverInfo->chipset != MGA_CARD_TYPE_G400) - return GL_FALSE; + serverInfo->chipset != MGA_CARD_TYPE_G400) { + XFree(mgaScreen); + sPriv->private = NULL; + return GL_FALSE; + } + mgaScreen->chipset = serverInfo->chipset; mgaScreen->width = serverInfo->width; @@ -136,6 +174,7 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) (drmAddress *)&mgaScreen->agp.map) != 0) { Xfree(mgaScreen); + sPriv->private = NULL; return GL_FALSE; } @@ -177,6 +216,12 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) mgaScreen->Attrib = MGA_PF_565; mgaScreen->bufs = drmMapBufs(sPriv->fd); + if (!mgaScreen->bufs) { + /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/ + XFree(mgaScreen); + sPriv->private = NULL; + return GL_FALSE; + } /* Other mgaglx stuff, too?? */ @@ -190,11 +235,15 @@ GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) return GL_TRUE; } + /* Accessed by dlsym from dri_mesa_init.c */ void XMesaResetDriver(__DRIscreenPrivate *sPriv) { - Xfree(sPriv->private); + mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *) sPriv->private; + /*drmUnmap(mgaScreen->agp_tex.map, mgaScreen->agp_tex.size);*/ + Xfree(mgaScreen); + sPriv->private = NULL; } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgadd.c b/xc/lib/GL/mesa/src/drv/mga/mgadd.c index ad56cbbc3..8eb717d5c 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgadd.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgadd.c @@ -61,11 +61,11 @@ static const GLubyte *mgaDDGetString( GLcontext *ctx, GLenum name ) mgaContextPtr mmesa = MGA_CONTEXT( ctx ); switch (name) { case GL_VENDOR: - return "Utah GLX"; + return "Precision Insight, Inc."; case GL_RENDERER: - if (MGA_IS_G200(mmesa)) return "GLX-MGA-G200"; - if (MGA_IS_G400(mmesa)) return "GLX-MGA-G400"; - return "GLX-MGA"; + if (MGA_IS_G200(mmesa)) return "Mesa DRI G200 20000510"; + if (MGA_IS_G400(mmesa)) return "Mesa DRI G400 20000510"; + return "Mesa DRI MGA 20000510"; default: return 0; } @@ -123,10 +123,13 @@ void mgaDDExtensionsInit( GLcontext *ctx ) * a few rogue fallbacks. */ gl_extensions_disable( ctx, "ARB_imaging" ); + gl_extensions_disable( ctx, "GL_EXT_blend_color" ); gl_extensions_disable( ctx, "GL_EXT_blend_minmax" ); gl_extensions_disable( ctx, "GL_EXT_blend_logic_op" ); gl_extensions_disable( ctx, "GL_EXT_blend_subtract" ); gl_extensions_disable( ctx, "GL_INGR_blend_func_separate" ); + gl_extensions_disable( ctx, "GL_EXT_texture_lod_bias" ); + gl_extensions_disable( ctx, "GL_MESA_resize_buffers" ); } diff --git a/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c index 76e0047f8..73a939b74 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgafastpath.c @@ -383,9 +383,9 @@ static void mga_project_vertices( struct vertex_buffer *VB ) REFRESH_DRAWABLE_INFO(mmesa); m[MAT_SX] = mat->m[MAT_SX]; - m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX + .5; + m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX + SUBPIXEL_X; m[MAT_SY] = (- mat->m[MAT_SY]); - m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY - .5; + m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY + SUBPIXEL_Y; m[MAT_SZ] = mat->m[MAT_SZ] * (1.0 / 0x10000); m[MAT_TZ] = mat->m[MAT_TZ] * (1.0 / 0x10000); @@ -406,9 +406,9 @@ static void mga_project_clipped_vertices( struct vertex_buffer *VB ) REFRESH_DRAWABLE_INFO(mmesa); m[MAT_SX] = mat->m[MAT_SX]; - m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX + .5; + m[MAT_TX] = mat->m[MAT_TX] + mmesa->drawX + SUBPIXEL_X; m[MAT_SY] = (- mat->m[MAT_SY]); - m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY - .5; + m[MAT_TY] = (- mat->m[MAT_TY]) + mmesa->driDrawable->h + mmesa->drawY - SUBPIXEL_Y; m[MAT_SZ] = mat->m[MAT_SZ] * (1.0 / 0x10000); m[MAT_TZ] = mat->m[MAT_TZ] * (1.0 / 0x10000); diff --git a/xc/lib/GL/mesa/src/drv/mga/mgalib.h b/xc/lib/GL/mesa/src/drv/mga/mgalib.h index 7d086ae28..e00525f7b 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgalib.h +++ b/xc/lib/GL/mesa/src/drv/mga/mgalib.h @@ -313,4 +313,12 @@ static __inline__ mgaUI32 mgaPackColor(mgaUI32 format, } } + +/* + * Subpixel offsets for window coordinates: + */ +#define SUBPIXEL_X (-0.5F) +#define SUBPIXEL_Y (-0.5F + 0.125) + + #endif diff --git a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c index 38e3cdde8..887e194d2 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgaspan.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgaspan.c @@ -5,71 +5,100 @@ #include "mgalog.h" #include "mgaspan.h" +#define DBG 0 + #define LOCAL_VARS \ - mgaContextPtr mmesa = MGA_CONTEXT( ctx ); \ __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \ - __DRIscreenPrivate *sPriv = mmesa->driScreen; \ mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ - GLuint pitch = mgaScreen->backPitch; \ + __DRIscreenPrivate *sPriv = mmesa->driScreen; \ + GLuint pitch = mgaScreen->frontPitch; \ GLuint height = dPriv->h; \ + char *read_buf = (char *)(sPriv->pFB + \ + mmesa->readOffset + \ + dPriv->x * 2 + \ + dPriv->y * pitch); \ char *buf = (char *)(sPriv->pFB + \ mmesa->drawOffset + \ dPriv->x * 2 + \ + dPriv->y * pitch); \ + GLushort p = MGA_CONTEXT( ctx )->MonoColor; \ + (void) read_buf; (void) buf; (void) p + + + +#define LOCAL_DEPTH_VARS \ + __DRIdrawablePrivate *dPriv = mmesa->driDrawable; \ + mgaScreenPrivate *mgaScreen = mmesa->mgaScreen; \ + __DRIscreenPrivate *sPriv = mmesa->driScreen; \ + GLuint pitch = mgaScreen->frontPitch; \ + GLuint height = dPriv->h; \ + char *buf = (char *)(sPriv->pFB + \ + mgaScreen->depthOffset + \ + dPriv->x * 2 + \ dPriv->y * pitch) -#define INIT_MONO_PIXEL(p) \ - GLushort p = MGA_CONTEXT( ctx )->MonoColor; +#define INIT_MONO_PIXEL(p) -#define CLIPPIXEL(_x,_y) (_x >= minx && _x <= maxx && \ - _y >= miny && _y <= maxy) +#define CLIPPIXEL(_x,_y) (_x >= minx && _x < maxx && \ + _y >= miny && _y < maxy) -#define CLIPSPAN(_x,_y,_n,_x1,_n1) \ +#define CLIPSPAN(_x,_y,_n,_x1,_n1,_i) \ if (_y < miny || _y >= maxy) _n1 = 0, _x1 = x; \ else { \ _n1 = _n; \ _x1 = _x; \ - if (_x1 < minx) _n1 -= (minx - _x1), _x1 = minx; \ - if (_x1 + _n1 > maxx) n1 -= (_x1 + n1 - maxx); \ + if (_x1 < minx) _i += (minx - _x1), _x1 = minx; \ + if (_x1 + _n1 >= maxx) n1 -= (_x1 + n1 - maxx) + 1; \ } - +#define HW_LOCK() \ + mgaContextPtr mmesa = MGA_CONTEXT(ctx); \ + LOCK_HARDWARE_QUIESCENT(mmesa); #define HW_CLIPLOOP() \ do { \ int _nc = mmesa->numClipRects; \ - LOCK_HARDWARE_QUIESCENT(mmesa); \ while (_nc--) { \ - int minx = mmesa->pClipRects[_nc].x1 - mmesa->drawX; \ - int miny = mmesa->pClipRects[_nc].y1 - mmesa->drawY; \ - int maxx = mmesa->pClipRects[_nc].x2 - mmesa->drawX; \ + int minx = mmesa->pClipRects[_nc].x1 - mmesa->drawX; \ + int miny = mmesa->pClipRects[_nc].y1 - mmesa->drawY; \ + int maxx = mmesa->pClipRects[_nc].x2 - mmesa->drawX; \ int maxy = mmesa->pClipRects[_nc].y2 - mmesa->drawY; - #define HW_ENDCLIPLOOP() \ } \ - UNLOCK_HARDWARE(mmesa); \ } while (0) +#define HW_UNLOCK() \ + UNLOCK_HARDWARE(mmesa); + + -#define Y_FLIP(_y) (height - _y) + + + + +/* 16 bit, 565 rgb color spanline and pixel functions + */ +#define Y_FLIP(_y) (height - _y - 1) #define WRITE_RGBA( _x, _y, r, g, b, a ) \ - *(GLushort *)(buf + _x*2 + _y*pitch) = ( ((r & 0x1f) << 11) | \ - ((g & 0x3f) << 5) | \ - ((b & 0x1f))) + *(GLushort *)(buf + _x*2 + _y*pitch) = ( (((int)r & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)b & 0xf8) >> 3)) + #define WRITE_PIXEL( _x, _y, p ) \ *(GLushort *)(buf + _x*2 + _y*pitch) = p -#define READ_RGBA( rgba, _x, _y ) \ -do { \ - GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 11) & 0x1f; \ - rgba[1] = (p >> 5) & 0x3f; \ - rgba[2] = (p >> 0) & 0x1f; \ - rgba[3] = 0; /* or 255? */ \ +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ + rgba[0] = (p >> 8) & 0xf8; \ + rgba[1] = (p >> 3) & 0xfc; \ + rgba[2] = (p << 3) & 0xf8; \ + rgba[3] = 255; \ } while(0) #define TAG(x) mga##x##_565 @@ -78,22 +107,22 @@ do { \ - -#define WRITE_RGBA( _x, _y, r, g, b, a ) \ - *(GLushort *)(buf + _x*2 + _y*pitch) = ( ((r & 0x1f) << 10) | \ - ((g & 0x1f) << 5) | \ - ((b & 0x1f))) - +/* 15 bit, 555 rgb color spanline and pixel functions + */ +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = (((r & 0xf8) << 7) | \ + ((g & 0xf8) << 3) | \ + ((b & 0xf8) >> 3)) #define WRITE_PIXEL( _x, _y, p ) \ *(GLushort *)(buf + _x*2 + _y*pitch) = p -#define READ_RGBA( rgba, _x, _y ) \ -do { \ - GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 10) & 0x1f; \ - rgba[1] = (p >> 5) & 0x1f; \ - rgba[2] = (p >> 0) & 0x1f; \ - rgba[3] = 0; /* or 255? */ \ +#define READ_RGBA( rgba, _x, _y ) \ +do { \ + GLushort p = *(GLushort *)(read_buf + _x*2 + _y*pitch); \ + rgba[0] = (p >> 7) & 0xf8; \ + rgba[1] = (p >> 3) & 0xf8; \ + rgba[2] = (p << 3) & 0xf8; \ + rgba[3] = 255; \ } while(0) #define TAG(x) mga##x##_555 @@ -101,27 +130,19 @@ do { \ -#if 0 -#define WRITE_RGBA( _x, _y, r, g, b, a ) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = ( ((r) << 16) | \ - ((g) << 8) | \ - ((b))) +/* 16 bit depthbuffer functions. + */ +#define WRITE_DEPTH( _x, _y, d ) \ + *(GLushort *)(buf + _x*2 + _y*pitch) = d; + +#define READ_DEPTH( d, _x, _y ) \ + d = *(GLushort *)(buf + _x*2 + _y*pitch); + +#define TAG(x) mga##x##_16 +#include "depthtmp.h" + -#define WRITE_PIXEL( _x, _y, p ) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = p - -#define READ_RGBA( rgba, _x, _y ) \ -do { \ - GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \ - rgba[0] = (p >> 16) & 0xff; \ - rgba[1] = (p >> 8) & 0xff; \ - rgba[2] = (p >> 0) & 0xff; \ - rgba[3] = 0; /* or 255? */ \ -} while(0) -#define TAG(x) mga##x##_888 -#include "spantmp.h" -#endif void mgaDDInitSpanFuncs( GLcontext *ctx ) { @@ -143,6 +164,11 @@ void mgaDDInitSpanFuncs( GLcontext *ctx ) ctx->Driver.ReadRGBAPixels = mgaReadRGBAPixels_555; } + ctx->Driver.ReadDepthSpan = mgaReadDepthSpan_16; + ctx->Driver.WriteDepthSpan = mgaWriteDepthSpan_16; + ctx->Driver.ReadDepthPixels = mgaReadDepthPixels_16; + ctx->Driver.WriteDepthPixels = mgaWriteDepthPixels_16; + ctx->Driver.WriteCI8Span =NULL; ctx->Driver.WriteCI32Span =NULL; ctx->Driver.WriteMonoCISpan =NULL; diff --git a/xc/lib/GL/mesa/src/drv/mga/mgavb.c b/xc/lib/GL/mesa/src/drv/mga/mgavb.c index 2d61f301d..3f246d9a7 100644 --- a/xc/lib/GL/mesa/src/drv/mga/mgavb.c +++ b/xc/lib/GL/mesa/src/drv/mga/mgavb.c @@ -100,8 +100,8 @@ static void name(struct vertex_buffer *VB, GLuint start, GLuint end) \ mgaVertexPtr v; \ GLfloat (*tc0)[4]; \ GLfloat (*tc1)[4]; \ - GLfloat xoffset = 0.5 + mmesa->drawX; \ - GLfloat yoffset = mmesa->driDrawable->h - 0.5 + mmesa->drawY; \ + GLfloat xoffset = mmesa->drawX + SUBPIXEL_X; \ + GLfloat yoffset = mmesa->driDrawable->h + mmesa->drawY + SUBPIXEL_Y; \ int i; \ (void) xoffset; (void) yoffset; \ if (0) fprintf(stderr, "V"); \ diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c index 0ed7ae471..f270cbe13 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_dd.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_dd.c @@ -100,7 +100,7 @@ static const GLubyte *r128DDGetString(GLcontext *ctx, GLenum name) case GL_VENDOR: return (GLubyte *)"Precision Insight, Inc."; case GL_RENDERER: - return (GLubyte *)"Mesa DRI Rage128 20000320"; + return (GLubyte *)"Mesa DRI Rage128 20000607"; default: return NULL; } diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c index b385271f4..64fa94ebd 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_screen.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_screen.c @@ -50,6 +50,46 @@ r128ScreenPtr r128CreateScreen(__DRIscreenPrivate *sPriv) { r128ScreenPtr r128Screen; R128DRIPtr r128DRIPriv = (R128DRIPtr)sPriv->pDevPriv; + int major, minor, patch; + + /* Check that the DRI version is compatible */ + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, + "r128 DRI driver expected DRI version 3.0.x " + "but got version %d.%d.%d", + major, minor, patch); + __driMesaMessage(msg); + return NULL; + } + } + + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 3 || + sPriv->ddxMinor != 1 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, + "r128 DRI driver expected DDX driver version 3.1.x " + "but got version %d.%d.%d", + sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return NULL; + } + + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, + "r128 DRI driver expected DRM driver version 1.0.x " + "but got version %d.%d.%d", + sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return NULL; + } /* Allocate the private area */ r128Screen = (r128ScreenPtr)Xmalloc(sizeof(*r128Screen)); diff --git a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c index 60d528813..ff4f9df63 100644 --- a/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/r128/r128_xmesa.c @@ -77,10 +77,7 @@ static r128ContextPtr r128Context = NULL; GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) { sPriv->private = (void *)r128CreateScreen(sPriv); - if (!sPriv->private) { - r128DestroyScreen(sPriv); - return GL_FALSE; - } + if (!sPriv->private) return GL_FALSE; return GL_TRUE; } diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c index 215d3903d..b40f0f054 100644 --- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c +++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_xmesa.c @@ -45,30 +45,66 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. __DRIcontextPrivate *gCC = 0; -GLboolean XMesaInitDriver(__DRIscreenPrivate *driScrnPriv) +GLboolean XMesaInitDriver(__DRIscreenPrivate *sPriv) { - tdfxScreenPrivate *gsp; + tdfxScreenPrivate *gsp; - /* Allocate the private area */ - gsp = (tdfxScreenPrivate *)Xmalloc(sizeof(tdfxScreenPrivate)); - if (!gsp) return GL_FALSE; + /* Check the DRI version */ + { + int major, minor, patch; + if (XF86DRIQueryVersion(sPriv->display, &major, &minor, &patch)) { + if (major != 3 || minor != 0 || patch < 0) { + char msg[1000]; + sprintf(msg, "3dfx DRI driver expected DRI version 3.0.x but got version %d.%d.%d", major, minor, patch); + __driMesaMessage(msg); + return GL_FALSE; + } + } + } - gsp->driScrnPriv = driScrnPriv; + /* Check that the DDX driver version is compatible */ + if (sPriv->ddxMajor != 1 || + sPriv->ddxMinor != 0 || + sPriv->ddxPatch < 0) { + char msg[1000]; + sprintf(msg, "3dfx DRI driver expected DDX driver version 1.0.x but got version %d.%d.%d", sPriv->ddxMajor, sPriv->ddxMinor, sPriv->ddxPatch); + __driMesaMessage(msg); + return GL_FALSE; + } - driScrnPriv->private = (void *)gsp; + /* Check that the DRM driver version is compatible */ + if (sPriv->drmMajor != 1 || + sPriv->drmMinor != 0 || + sPriv->drmPatch < 0) { + char msg[1000]; + sprintf(msg, "3dfx DRI driver expected DRM driver version 1.0.x but got version %d.%d.%d", sPriv->drmMajor, sPriv->drmMinor, sPriv->drmPatch); + __driMesaMessage(msg); + return GL_FALSE; + } - if (!tdfxMapAllRegions(driScrnPriv)) { - Xfree(driScrnPriv->private); - return GL_FALSE; - } + /* Allocate the private area */ + gsp = (tdfxScreenPrivate *)Xmalloc(sizeof(tdfxScreenPrivate)); + if (!gsp) + return GL_FALSE; - return GL_TRUE; + gsp->driScrnPriv = sPriv; + + sPriv->private = (void *) gsp; + + if (!tdfxMapAllRegions(sPriv)) { + Xfree(gsp); + sPriv->private = NULL; + return GL_FALSE; + } + + return GL_TRUE; } -void XMesaResetDriver(__DRIscreenPrivate *driScrnPriv) +void XMesaResetDriver(__DRIscreenPrivate *sPriv) { - tdfxUnmapAllRegions(driScrnPriv); - Xfree(driScrnPriv->private); + tdfxUnmapAllRegions(sPriv); + Xfree(sPriv->private); + sPriv->private = NULL; } GLvisual *XMesaCreateVisual(Display *dpy, @@ -146,11 +182,9 @@ GLboolean XMesaCreateContext(Display *dpy, GLvisual *mesaVis, void XMesaDestroyContext(__DRIcontextPrivate *driContextPriv) { - tdfxContextPrivate *cPriv; - - cPriv = (tdfxContextPrivate *) driContextPriv->driverPrivate; + tdfxContextPrivate *cPriv = (tdfxContextPrivate *) driContextPriv->driverPrivate; if (cPriv) { - /* XXX XFree the tdfxContextPrivate struct? */ + XFree(cPriv); driContextPriv->driverPrivate = NULL; } @@ -169,7 +203,7 @@ GLframebuffer *XMesaCreateWindowBuffer( Display *dpy, GL_FALSE, /* software depth buffer? */ mesaVis->StencilBits > 0, mesaVis->AccumRedBits > 0, - mesaVis->AlphaBits > 0 + GL_FALSE /* software alpha channel? */ ); } @@ -230,8 +264,8 @@ void XMesaSwapBuffers(__DRIdrawablePrivate *driDrawPriv) #endif FX_grDRIBufferSwap(gCCPriv->swapInterval); do { - result=FX_grGetInteger(FX_PENDING_BUFFERSWAPS); - } while (result>gCCPriv->maxPendingSwapBuffers); + result = FX_grGetInteger(FX_PENDING_BUFFERSWAPS); + } while (result > gCCPriv->maxPendingSwapBuffers); gCCPriv->stats.swapBuffer++; } } diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index 652ecb822..1d3eeee37 100644 --- a/xc/programs/Xserver/GL/dri/dri.c +++ b/xc/programs/Xserver/GL/dri/dri.c @@ -93,10 +93,7 @@ DRIDrvMsg(int scrnIndex, MessageType type, const char *format, ...) } Bool -DRIScreenInit( - ScreenPtr pScreen, - DRIInfoPtr pDRIInfo, - int* pDRMFD) +DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) { DRIScreenPrivPtr pDRIPriv; drmContextPtr reserved; @@ -446,8 +443,7 @@ DRIExtensionInit(void) } void -DRIReset( -) +DRIReset(void) { /* * This stub routine is called when the X Server recycles, resources @@ -459,10 +455,7 @@ DRIReset( } Bool -DRIQueryDirectRenderingCapable( - ScreenPtr pScreen, - Bool* isCapable -) +DRIQueryDirectRenderingCapable(ScreenPtr pScreen, Bool* isCapable) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -475,11 +468,7 @@ DRIQueryDirectRenderingCapable( } Bool -DRIOpenConnection( - ScreenPtr pScreen, - drmHandlePtr hSAREA, - char **busIdString -) +DRIOpenConnection(ScreenPtr pScreen, drmHandlePtr hSAREA, char **busIdString) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -490,10 +479,7 @@ DRIOpenConnection( } Bool -DRIAuthConnection( - ScreenPtr pScreen, - drmMagic magic -) +DRIAuthConnection(ScreenPtr pScreen, drmMagic magic) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -502,21 +488,17 @@ DRIAuthConnection( } Bool -DRICloseConnection( - ScreenPtr pScreen -) +DRICloseConnection(ScreenPtr pScreen) { return TRUE; } Bool -DRIGetClientDriverName( - ScreenPtr pScreen, - int* ddxDriverMajorVersion, - int* ddxDriverMinorVersion, - int* ddxDriverPatchVersion, - char** clientDriverName -) +DRIGetClientDriverName(ScreenPtr pScreen, + int *ddxDriverMajorVersion, + int *ddxDriverMinorVersion, + int *ddxDriverPatchVersion, + char **clientDriverName) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -628,11 +610,8 @@ DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv) } Bool -DRICreateContext( - ScreenPtr pScreen, - VisualPtr visual, - XID context, - drmContextPtr pHWContext +DRICreateContext(ScreenPtr pScreen, VisualPtr visual, + XID context, drmContextPtr pHWContext ) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -677,10 +656,7 @@ DRICreateContext( } Bool -DRIDestroyContext( - ScreenPtr pScreen, - XID context -) +DRIDestroyContext(ScreenPtr pScreen, XID context) { FreeResourceByType(context, DRIContextPrivResType, FALSE); @@ -689,9 +665,7 @@ DRIDestroyContext( /* DRIContextPrivDelete is called by the resource manager. */ Bool -DRIContextPrivDelete( - pointer pResource, - XID id) +DRIContextPrivDelete(pointer pResource, XID id) { DRIContextPrivPtr pDRIContextPriv = (DRIContextPrivPtr)pResource; DRIScreenPrivPtr pDRIPriv; @@ -715,7 +689,7 @@ DRIContextPrivDelete( * shared->private is sometimes missed if we don't do this. */ static void -DRIClipNotifyAllDrawables( ScreenPtr pScreen ) +DRIClipNotifyAllDrawables(ScreenPtr pScreen) { int i; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -727,7 +701,7 @@ DRIClipNotifyAllDrawables( ScreenPtr pScreen ) static void -DRITransitionToSharedBuffers( ScreenPtr pScreen ) +DRITransitionToSharedBuffers(ScreenPtr pScreen) { /* ErrorF("DRITransitionToSharedBuffers\n"); */ DRIClipNotifyAllDrawables( pScreen ); @@ -735,7 +709,7 @@ DRITransitionToSharedBuffers( ScreenPtr pScreen ) static void -DRITransitionToPrivateBuffers( ScreenPtr pScreen ) +DRITransitionToPrivateBuffers(ScreenPtr pScreen) { /* ErrorF("DRITransitionToPrivateBuffers\n"); */ DRIClipNotifyAllDrawables( pScreen ); @@ -743,7 +717,7 @@ DRITransitionToPrivateBuffers( ScreenPtr pScreen ) static void -DRITransitionTo3d( ScreenPtr pScreen ) +DRITransitionTo3d(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; @@ -755,7 +729,7 @@ DRITransitionTo3d( ScreenPtr pScreen ) } static void -DRITransitionTo2d( ScreenPtr pScreen ) +DRITransitionTo2d(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo; @@ -768,12 +742,8 @@ DRITransitionTo2d( ScreenPtr pScreen ) Bool -DRICreateDrawable( - ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable, - drmDrawablePtr hHWDrawable -) +DRICreateDrawable(ScreenPtr pScreen, Drawable id, + DrawablePtr pDrawable, drmDrawablePtr hHWDrawable) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv; @@ -830,11 +800,7 @@ DRICreateDrawable( } Bool -DRIDestroyDrawable( - ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable -) +DRIDestroyDrawable(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable) { DRIDrawablePrivPtr pDRIDrawablePriv; WindowPtr pWin; @@ -858,9 +824,7 @@ DRIDestroyDrawable( } Bool -DRIDrawablePrivDelete( - pointer pResource, - XID id) +DRIDrawablePrivDelete(pointer pResource, XID id) { DrawablePtr pDrawable = (DrawablePtr)pResource; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pDrawable->pScreen); @@ -903,28 +867,27 @@ DRIDrawablePrivDelete( } Bool -DRIGetDrawableInfo( - ScreenPtr pScreen, - DrawablePtr pDrawable, - unsigned int* index, - unsigned int* stamp, - int* X, - int* Y, - int* W, - int* H, - int* numClipRects, - XF86DRIClipRectPtr* pClipRects, - int* backX, - int* backY, - int* numBackClipRects, - XF86DRIClipRectPtr* pBackClipRects -) +DRIGetDrawableInfo(ScreenPtr pScreen, + DrawablePtr pDrawable, + unsigned int* index, + unsigned int* stamp, + int* X, + int* Y, + int* W, + int* H, + int* numClipRects, + XF86DRIClipRectPtr* pClipRects, + int* backX, + int* backY, + int* numBackClipRects, + XF86DRIClipRectPtr* pBackClipRects) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv, pOldDrawPriv; WindowPtr pWin, pOldWin; - int i, oldestIndex = 0; - unsigned int oldestStamp; + int i; + + printf("maxDrawableTableEntry = %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry); if (pDrawable->type == DRAWABLE_WINDOW) { pWin = (WindowPtr)pDrawable; @@ -948,7 +911,8 @@ DRIGetDrawableInfo( /* Search table for oldest entry */ if (i == pDRIPriv->pDriverInfo->maxDrawableTableEntry) { - oldestStamp = ~0; + unsigned int oldestStamp = ~0; + int oldestIndex = 0; i = pDRIPriv->pDriverInfo->maxDrawableTableEntry; while (i--) { if (pDRIPriv->pSAREA->drawableTable[i].stamp < @@ -966,10 +930,10 @@ DRIGetDrawableInfo( pOldDrawPriv->drawableIndex = -1; /* claim drawable table entry */ - pDRIPriv->DRIDrawables[i] = pDrawable; + pDRIPriv->DRIDrawables[oldestIndex] = pDrawable; /* validate SAREA entry */ - pDRIPriv->pSAREA->drawableTable[i].stamp = + pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = DRIDrawableValidationStamp++; /* check for stamp wrap around */ @@ -1050,15 +1014,13 @@ DRIGetDrawableInfo( } Bool -DRIGetDeviceInfo( - ScreenPtr pScreen, - drmHandlePtr hFrameBuffer, - int* fbOrigin, - int* fbSize, - int* fbStride, - int* devPrivateSize, - void** pDevPrivate -) +DRIGetDeviceInfo(ScreenPtr pScreen, + drmHandlePtr hFrameBuffer, + int* fbOrigin, + int* fbSize, + int* fbStride, + int* devPrivateSize, + void** pDevPrivate) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1106,10 +1068,7 @@ DRIDestroyInfoRec(DRIInfoPtr DRIInfo) void -DRIWakeupHandler( - pointer wakeupData, - int result, - pointer pReadmask) +DRIWakeupHandler(pointer wakeupData, int result, pointer pReadmask) { int i; @@ -1125,10 +1084,7 @@ DRIWakeupHandler( } void -DRIBlockHandler( - pointer blockData, - OSTimePtr pTimeout, - pointer pReadmask) +DRIBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) { int i; @@ -1144,11 +1100,8 @@ DRIBlockHandler( } void -DRIDoWakeupHandler( - int screenNum, - pointer wakeupData, - unsigned long result, - pointer pReadmask) +DRIDoWakeupHandler(int screenNum, pointer wakeupData, + unsigned long result, pointer pReadmask) { ScreenPtr pScreen = screenInfo.screens[screenNum]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1166,11 +1119,8 @@ DRIDoWakeupHandler( } void -DRIDoBlockHandler( - int screenNum, - pointer blockData, - pointer pTimeout, - pointer pReadmask) +DRIDoBlockHandler(int screenNum, pointer blockData, + pointer pTimeout, pointer pReadmask) { ScreenPtr pScreen = screenInfo.screens[screenNum]; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1188,11 +1138,7 @@ DRIDoBlockHandler( } void -DRISwapContext( - int drmFD, - void *oldctx, - void *newctx -) +DRISwapContext(int drmFD, void *oldctx, void *newctx) { DRIContextPrivPtr oldContext = (DRIContextPrivPtr)oldctx; DRIContextPrivPtr newContext = (DRIContextPrivPtr)newctx; @@ -1347,10 +1293,7 @@ DRIGetContextStore(DRIContextPrivPtr context) } void -DRIPaintWindow( - WindowPtr pWin, - RegionPtr prgn, - int what) +DRIPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1412,10 +1355,7 @@ DRIPaintWindow( } void -DRICopyWindow( - WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc) +DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1509,10 +1449,7 @@ DRISpinLockTimeout(drmLock *lock, int val, unsigned long timeout /* in mS */) } int -DRIValidateTree( - WindowPtr pParent, - WindowPtr pChild, - VTKind kind) +DRIValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) { ScreenPtr pScreen = pParent->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1567,10 +1504,7 @@ DRIValidateTree( } void -DRIPostValidateTree( - WindowPtr pParent, - WindowPtr pChild, - VTKind kind) +DRIPostValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind) { ScreenPtr pScreen; DRIScreenPrivPtr pDRIPriv; @@ -1601,10 +1535,7 @@ DRIPostValidateTree( } void -DRIClipNotify( - WindowPtr pWin, - int dx, - int dy) +DRIClipNotify(WindowPtr pWin, int dx, int dy) { DRIScreenPrivPtr pDRIPriv; DRIDrawablePrivPtr pDRIDrawablePriv; @@ -1617,8 +1548,7 @@ DRIClipNotify( } CARD32 -DRIGetDrawableIndex( - WindowPtr pWin) +DRIGetDrawableIndex(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1636,16 +1566,15 @@ DRIGetDrawableIndex( } unsigned int -DRIGetDrawableStamp( - ScreenPtr pScreen, - CARD32 drawable_index) +DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); return pDRIPriv->pSAREA->drawableTable[drawable_index].stamp; } -void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg) +void +DRIPrintDrawableLock(ScreenPtr pScreen, char *msg) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1678,14 +1607,16 @@ DRIUnlock(ScreenPtr pScreen) { DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext); } -void *DRIGetSAREAPrivate(ScreenPtr pScreen) +void * +DRIGetSAREAPrivate(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv) return 0; return (void *)(((char*)pDRIPriv->pSAREA)+sizeof(XF86DRISAREARec)); } -drmContext DRIGetContext(ScreenPtr pScreen) +drmContext +DRIGetContext(ScreenPtr pScreen) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); if (!pDRIPriv) return 0; @@ -1696,7 +1627,18 @@ drmContext DRIGetContext(ScreenPtr pScreen) * call the lowerlevel functions, and choose whether they will be * called at every level of recursion (eg in validatetree). */ -DRIWrappedFuncsRec *DRIGetWrappedFuncs( ScreenPtr pScreen ) +DRIWrappedFuncsRec * +DRIGetWrappedFuncs(ScreenPtr pScreen) { return &(DRI_SCREEN_PRIV(pScreen)->wrap); } + +void +DRIQueryVersion(int *majorVersion, + int *minorVersion, + int *patchVersion) +{ + *majorVersion = XF86DRI_MAJOR_VERSION; + *minorVersion = XF86DRI_MINOR_VERSION; + *patchVersion = XF86DRI_PATCH_VERSION; +} diff --git a/xc/programs/Xserver/GL/dri/dri.h b/xc/programs/Xserver/GL/dri/dri.h index d82ec5359..443ba5e30 100644 --- a/xc/programs/Xserver/GL/dri/dri.h +++ b/xc/programs/Xserver/GL/dri/dri.h @@ -69,6 +69,10 @@ typedef int DRIWindowRequests; #define DRI_3D_WINDOWS_ONLY 1 #define DRI_ALL_WINDOWS 2 + +typedef void (*ClipNotifyPtr)( WindowPtr, int, int ); + + /* * These functions can be wrapped by the DRI. Each of these have * generic default funcs (initialized in DRICreateInfoRec) and can be @@ -82,8 +86,12 @@ typedef struct { CopyWindowProcPtr CopyWindow; ValidateTreeProcPtr ValidateTree; PostValidateTreeProcPtr PostValidateTree; + ClipNotifyPtr ClipNotify; } DRIWrappedFuncsRec, *DRIWrappedFuncsPtr; + + + typedef struct { /* driver call back functions */ Bool (*CreateContext)(ScreenPtr pScreen, @@ -107,6 +115,8 @@ typedef struct { DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); + void (*TransitionTo3d)(ScreenPtr pScreen); + void (*TransitionTo2d)(ScreenPtr pScreen); /* wrapped functions */ DRIWrappedFuncsRec wrap; @@ -131,131 +141,158 @@ typedef struct { void* devPrivate; } DRIInfoRec, *DRIInfoPtr; -extern Bool DRIScreenInit( - ScreenPtr pScreen, - DRIInfoPtr pDRIInfo, - int* pDRMFD); -void DRICloseScreen(ScreenPtr pScreen); -Bool DRIExtensionInit(void); -void DRIReset(void); -Bool DRIQueryDirectRenderingCapable( ScreenPtr pScreen, Bool* isCapable); -Bool DRIOpenConnection( - ScreenPtr pScreen, - drmHandlePtr hSAREA, - char **busIdString -); -Bool DRIAuthConnection(ScreenPtr pScreen, drmMagic magic); -Bool DRICloseConnection( ScreenPtr pScreen); -Bool DRIGetClientDriverName( - ScreenPtr pScreen, - int* ddxDriverMajorVersion, - int* ddxDriverMinorVersion, - int* ddxDriverPatchVersion, - char** clientDriverName -); -Bool DRICreateContext( - ScreenPtr pScreen, - VisualPtr visual, - XID context, - drmContextPtr pHWContext -); -Bool DRIDestroyContext( ScreenPtr pScreen, XID context); -Bool DRIContextPrivDelete( - pointer pResource, - XID id); -Bool DRICreateDrawable( - ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable, - drmDrawablePtr hHWDrawable -); -Bool DRIDestroyDrawable( ScreenPtr pScreen, - Drawable id, - DrawablePtr pDrawable); -Bool DRIDrawablePrivDelete( - pointer pResource, - XID id); -Bool DRIGetDrawableInfo( - ScreenPtr pScreen, - DrawablePtr pDrawable, - unsigned int* index, - unsigned int* stamp, - int* X, - int* Y, - int* W, - int* H, - int* numClipRects, - XF86DRIClipRectPtr* pClipRects -); -Bool DRIGetDeviceInfo( - ScreenPtr pScreen, - drmHandlePtr hFrameBuffer, - int* fbOrigin, - int* fbSize, - int* fbStride, - int* devPrivateSize, - void** pDevPrivate -); -DRIInfoPtr DRICreateInfoRec(void); -void DRIDestroyInfoRec(DRIInfoPtr DRIInfo); -Bool DRIFinishScreenInit(ScreenPtr pScreen); -void DRIWakeupHandler( - pointer wakeupData, - int result, - pointer pReadmask); -void DRIBlockHandler( - pointer blockData, - OSTimePtr pTimeout, - pointer pReadmask); -void DRIDoWakeupHandler( - int screenNum, - pointer wakeupData, - unsigned long result, - pointer pReadmask); -void DRIDoBlockHandler( - int screenNum, - pointer blockData, - pointer pTimeout, - pointer pReadmask); -void DRISwapContext( - int drmFD, - void *oldctx, - void *newctx); -void* DRIGetContextStore(DRIContextPrivPtr context); -void DRIPaintWindow( - WindowPtr pWin, - RegionPtr prgn, - int what); -void DRICopyWindow( - WindowPtr pWin, - DDXPointRec ptOldOrg, - RegionPtr prgnSrc); -int DRIValidateTree( - WindowPtr pParent, - WindowPtr pChild, - VTKind kind); -void DRIPostValidateTree( - WindowPtr pParent, - WindowPtr pChild, - VTKind kind); -void DRIClipNotify( - WindowPtr pWin, - int dx, - int dy); -CARD32 DRIGetDrawableIndex( - WindowPtr pWin); -void DRILock(ScreenPtr pScreen, int flags); -void DRIUnlock(ScreenPtr pScreen); -void *DRIGetSAREAPrivate(ScreenPtr pScreen); -DRIContextPrivPtr -DRICreateContextPriv(ScreenPtr pScreen, - drmContextPtr pHWContext, - DRIContextFlags flags); -DRIContextPrivPtr -DRICreateContextPrivFromHandle(ScreenPtr pScreen, - drmContext hHWContext, - DRIContextFlags flags); -Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv); + +extern Bool DRIScreenInit(ScreenPtr pScreen, + DRIInfoPtr pDRIInfo, + int *pDRMFD); + +extern void DRICloseScreen(ScreenPtr pScreen); + +extern Bool DRIExtensionInit(void); + +extern void DRIReset(void); + +extern Bool DRIQueryDirectRenderingCapable(ScreenPtr pScreen, + Bool *isCapable); + +extern Bool DRIOpenConnection(ScreenPtr pScreen, + drmHandlePtr hSAREA, + char **busIdString); + +extern Bool DRIAuthConnection(ScreenPtr pScreen, drmMagic magic); + +extern Bool DRICloseConnection(ScreenPtr pScreen); + +extern Bool DRIGetClientDriverName(ScreenPtr pScreen, + int* ddxDriverMajorVersion, + int* ddxDriverMinorVersion, + int* ddxDriverPatchVersion, + char** clientDriverName); + +extern Bool DRICreateContext(ScreenPtr pScreen, + VisualPtr visual, + XID context, + drmContextPtr pHWContext); + +extern Bool DRIDestroyContext(ScreenPtr pScreen, XID context); + +extern Bool DRIContextPrivDelete(pointer pResource, XID id); + +extern Bool DRICreateDrawable(ScreenPtr pScreen, + Drawable id, + DrawablePtr pDrawable, + drmDrawablePtr hHWDrawable); + +extern Bool DRIDestroyDrawable(ScreenPtr pScreen, + Drawable id, + DrawablePtr pDrawable); + +extern Bool DRIDrawablePrivDelete(pointer pResource, + XID id); + +extern Bool DRIGetDrawableInfo(ScreenPtr pScreen, + DrawablePtr pDrawable, + unsigned int* index, + unsigned int* stamp, + int* X, + int* Y, + int* W, + int* H, + int* numClipRects, + XF86DRIClipRectPtr* pClipRects, + int* backX, + int* backY, + int* numBackClipRects, + XF86DRIClipRectPtr* pBackClipRects); + +extern Bool DRIGetDeviceInfo(ScreenPtr pScreen, + drmHandlePtr hFrameBuffer, + int* fbOrigin, + int* fbSize, + int* fbStride, + int* devPrivateSize, + void** pDevPrivate); + +extern DRIInfoPtr DRICreateInfoRec(void); + +extern void DRIDestroyInfoRec(DRIInfoPtr DRIInfo); + +extern Bool DRIFinishScreenInit(ScreenPtr pScreen); + +extern void DRIWakeupHandler(pointer wakeupData, + int result, + pointer pReadmask); + +extern void DRIBlockHandler(pointer blockData, + OSTimePtr pTimeout, + pointer pReadmask); + +extern void DRIDoWakeupHandler(int screenNum, + pointer wakeupData, + unsigned long result, + pointer pReadmask); + +extern void DRIDoBlockHandler(int screenNum, + pointer blockData, + pointer pTimeout, + pointer pReadmask); + +extern void DRISwapContext(int drmFD, + void *oldctx, + void *newctx); + +extern void *DRIGetContextStore(DRIContextPrivPtr context); + +extern void DRIPaintWindow(WindowPtr pWin, + RegionPtr prgn, + int what); + +extern void DRICopyWindow(WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +extern int DRIValidateTree(WindowPtr pParent, + WindowPtr pChild, + VTKind kind); + +extern void DRIPostValidateTree(WindowPtr pParent, + WindowPtr pChild, + VTKind kind); + +extern void DRIClipNotify(WindowPtr pWin, + int dx, + int dy); + +extern CARD32 DRIGetDrawableIndex(WindowPtr pWin); + +extern void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg); + +extern void DRILock(ScreenPtr pScreen, int flags); + +extern void DRIUnlock(ScreenPtr pScreen); + +extern DRIWrappedFuncsRec *DRIGetWrappedFuncs(ScreenPtr pScreen); + +extern void *DRIGetSAREAPrivate(ScreenPtr pScreen); + +extern unsigned int DRIGetDrawableStamp(ScreenPtr pScreen, + CARD32 drawable_index); + +extern DRIContextPrivPtr DRICreateContextPriv(ScreenPtr pScreen, + drmContextPtr pHWContext, + DRIContextFlags flags); + +extern DRIContextPrivPtr DRICreateContextPrivFromHandle(ScreenPtr pScreen, + drmContext hHWContext, + DRIContextFlags flags); + +extern Bool DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv); + +extern drmContext DRIGetContext(ScreenPtr pScreen); + +extern void DRIQueryVersion(int *majorVersion, + int *minorVersion, + int *patchVersion); #define _DRI_H_ diff --git a/xc/programs/Xserver/GL/dri/xf86dri.c b/xc/programs/Xserver/GL/dri/xf86dri.c index b39b57450..f6a637d7c 100644 --- a/xc/programs/Xserver/GL/dri/xf86dri.c +++ b/xc/programs/Xserver/GL/dri/xf86dri.c @@ -210,12 +210,21 @@ ProcXF86DRIAuthConnection( register ClientPtr client ) { + xXF86DRIAuthConnectionReply rep; + REQUEST(xXF86DRIAuthConnectionReq); REQUEST_SIZE_MATCH(xXF86DRIAuthConnectionReq); - if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) - ErrorF("Failed to authenticate %u\n", stuff->magic); + rep.type = X_Reply; + rep.length = 0; + rep.sequenceNumber = client->sequence; + rep.authenticated = 1; + if (!DRIAuthConnection( screenInfo.screens[stuff->screen], stuff->magic)) { + ErrorF("Failed to authenticate %u\n", stuff->magic); + rep.authenticated = 0; + } + WriteToClient(client, sizeof(xXF86DRIAuthConnectionReply), (char *)&rep); return (client->noClientException); } @@ -388,6 +397,8 @@ ProcXF86DRIGetDrawableInfo( DrawablePtr pDrawable; int X, Y, W, H; XF86DRIClipRectPtr pClipRects; + XF86DRIClipRectPtr pBackClipRects; + int backX, backY; REQUEST(xXF86DRIGetDrawableInfoReq); REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq); @@ -411,7 +422,11 @@ ProcXF86DRIGetDrawableInfo( (int*)&W, (int*)&H, (int*)&rep.numClipRects, - &pClipRects)) { + &pClipRects, + &backX, + &backY, + (int*)&rep.numBackClipRects, + &pBackClipRects)) { return BadValue; } @@ -419,18 +434,32 @@ ProcXF86DRIGetDrawableInfo( rep.drawableY = Y; rep.drawableWidth = W; rep.drawableHeight = H; + rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - + SIZEOF(xGenericReply)); + + rep.backX = backX; + rep.backY = backY; + + if (rep.numBackClipRects) + rep.length += sizeof(XF86DRIClipRectRec) * rep.numBackClipRects; + + if (rep.numClipRects) + rep.length += sizeof(XF86DRIClipRectRec) * rep.numClipRects; + + WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep); - rep.length = 0; if (rep.numClipRects) { - rep.length = (SIZEOF(xXF86DRIGetDrawableInfoReply) - - SIZEOF(xGenericReply) + - sizeof(XF86DRIClipRectRec) * rep.numClipRects); + WriteToClient(client, + sizeof(XF86DRIClipRectRec) * rep.numClipRects, + (char *)pClipRects); } - WriteToClient(client, sizeof(xXF86DRIGetDrawableInfoReply), (char *)&rep); - if (rep.length) { - WriteToClient(client, rep.length, (char *)pClipRects); + if (rep.numBackClipRects) { + WriteToClient(client, + sizeof(XF86DRIClipRectRec) * rep.numBackClipRects, + (char *)pBackClipRects); } + return (client->noClientException); } diff --git a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c index 7815d4b82..656c7af5a 100644 --- a/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c +++ b/xc/programs/Xserver/GL/mesa/src/X/xf86glx.c @@ -94,12 +94,12 @@ __GLXextensionInfo __glDDXExtensionInfo = { __MESA_setVisualConfigs }; -__MESA_screen MESAScreens[MAXSCREENS]; -__GLcontext *MESA_CC = NULL; +static __MESA_screen MESAScreens[MAXSCREENS]; +static __GLcontext *MESA_CC = NULL; -int numConfigs = 0; -__GLXvisualConfig *visualConfigs = NULL; -void **visualPrivates = NULL; +static int numConfigs = 0; +static __GLXvisualConfig *visualConfigs = NULL; +static void **visualPrivates = NULL; static int count_bits(unsigned int n) diff --git a/xc/programs/Xserver/Imakefile b/xc/programs/Xserver/Imakefile index 0305b16ce..cf9770537 100644 --- a/xc/programs/Xserver/Imakefile +++ b/xc/programs/Xserver/Imakefile @@ -634,7 +634,8 @@ XF86SERVERSYSLIBS = $(FONTLIBS) $(SYSLIBS) $(LIBDL) $(LIBREGEX) #endif XF86SERVEROBJS = $(XF86DRVOBJS) $(XF86IDRVOBJS) XF86SERVERLIBS = $(XF86DRVLIBS) $(XF86IDRVLIBS) $(XF86LIBS) $(XF86LOADERLIB) \ - $(XF86COMLIB) $(XF86MAINLIBS) $(XF86SCANLIB) $(XF86OSLIB) + $(XF86COMLIB) $(XF86MAINLIBS) $(XF86SCANLIB) $(XF86OSLIB) \ + $(XF86DDCLIB) #if HasParallelMake MakeMutex($(XF86SERVERSUBDIRS) $(XF86SERVERLIBS) $(XF86SERVERSYSLIBS)) #endif diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml index 636ad7aeb..70ea77a64 100644 --- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml +++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml @@ -1,7 +1,7 @@ <!doctype linuxdoc system> <!-- Created: Sun Mar 12 13:00:00 2000 by brian@precisioninsight.com --> <!-- Revised: Fri May 19 09:36:02 2000 by martin@valinux.com --> -<!-- $Id: DRIcomp.sgml,v 1.6.8.1 2000/06/08 06:43:11 daryll Exp $ --> +<!-- $Id: DRIcomp.sgml,v 1.6.8.2 2000/06/09 02:29:39 daryll Exp $ --> <article> diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h index 7890fdcde..9ef168854 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h @@ -45,6 +45,13 @@ #include "glint_dripriv.h" #endif +#define GLINT_VERSION 4000 +#define GLINT_NAME "GLINT" +#define GLINT_DRIVER_NAME "glint" +#define GLINT_MAJOR_VERSION 1 +#define GLINT_MINOR_VERSION 0 +#define GLINT_PATCHLEVEL 0 + #define GLINT_MAX_MX_DEVICES 2 #define GLINT_VGA_MMIO_OFF 0x6000 @@ -192,17 +199,20 @@ Bool Permedia2HWCursorInit(ScreenPtr pScreen); void PermediaRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void PermediaSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); Bool PermediaInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +void PermediaInitializeEngine(ScrnInfoPtr pScrn); Bool PermediaAccelInit(ScreenPtr pScreen); void Permedia2VRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void Permedia2VSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); Bool Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode); Bool Permedia2vHWCursorInit(ScreenPtr pScreen); +void TXInitializeEngine(ScrnInfoPtr pScrn); void TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void TXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); Bool TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode); Bool TXAccelInit(ScreenPtr pScreen); +void DualMXInitializeEngine(ScrnInfoPtr pScrn); void DualMXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void DualMXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); Bool DualMXInit(ScrnInfoPtr pScrn, DisplayModePtr mode); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c index c6c0d1e22..9aa55de42 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c @@ -346,6 +346,18 @@ GLINTDRIScreenInit(ScreenPtr pScreen) if (!LoaderSymbol("drmAvailable")) return FALSE; #endif + /* Check the DRI version */ + { + int major, minor, patch; + DRIQueryVersion(&major, &minor, &patch); + if (major != 3 || minor != 0 || patch < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "GLINTDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", + major, minor, patch); + return FALSE; + } + } + if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA) return FALSE; if (pGlint->numMXDevices > 2) return FALSE; @@ -364,9 +376,9 @@ GLINTDRIScreenInit(ScreenPtr pScreen) ((pciConfigPtr)pGlint->PciInfo->thisCard)->busnum, ((pciConfigPtr)pGlint->PciInfo->thisCard)->devnum, ((pciConfigPtr)pGlint->PciInfo->thisCard)->funcnum); - pDRIInfo->ddxDriverMajorVersion = 0; - pDRIInfo->ddxDriverMinorVersion = 1; - pDRIInfo->ddxDriverPatchVersion = 0; + pDRIInfo->ddxDriverMajorVersion = GLINT_MAJOR_VERSION; + pDRIInfo->ddxDriverMinorVersion = GLINT_MINOR_VERSION; + pDRIInfo->ddxDriverPatchVersion = GLINT_PATCHLEVEL; pDRIInfo->frameBufferPhysicalAddress = pGlint->FbAddress; pDRIInfo->frameBufferSize = pGlint->FbMapSize; pDRIInfo->frameBufferStride = @@ -418,6 +430,27 @@ GLINTDRIScreenInit(ScreenPtr pScreen) return FALSE; } + /* Check the MGA DRM version */ + { + drmVersionPtr version = drmGetVersion(pGlint->drmSubFD); + if (version) { + if (version->version_major != 1 || + version->version_minor != 0 || + version->version_patchlevel < 0) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "GLINTDRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + GLINTDRICloseScreen(pScreen); + drmFreeVersion(version); + return FALSE; + } + drmFreeVersion(version); + } + } + /* Tell the client driver how many MX's we have */ pGlintDRI->numMXDevices = pGlint->numMXDevices; /* Tell the client about our screen size setup */ @@ -713,9 +746,9 @@ GLINTDRISwapContext( ScreenPtr pScreen, DRISyncType syncType, DRIContextType readContextType, - void* readContextStore, + void *readContextStore, DRIContextType writeContextType, - void* writeContextStore) + void *writeContextStore) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; GLINTPtr pGlint = GLINTPTR(pScrn); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c index fabb44ef9..f0b316729 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c @@ -123,13 +123,6 @@ static Bool GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static int pix24bpp = 0; static Bool FBDevProbed = FALSE; -#define VERSION 4000 -#define GLINT_NAME "GLINT" -#define GLINT_DRIVER_NAME "glint" -#define GLINT_MAJOR_VERSION 1 -#define GLINT_MINOR_VERSION 0 -#define GLINT_PATCHLEVEL 0 - /* * This contains the functions needed by the server after loading the driver * module. It must be supplied, and gets passed back by the SetupProc @@ -139,7 +132,7 @@ static Bool FBDevProbed = FALSE; */ DriverRec GLINT = { - VERSION, + GLINT_VERSION, GLINT_DRIVER_NAME, #if 0 "accelerated driver for 3dlabs and derived chipsets", @@ -704,7 +697,7 @@ GLINTProbe(DriverPtr drv, int flags) NULL,NULL,NULL,NULL); } /* Fill in what we can of the ScrnInfoRec */ - pScrn->driverVersion = VERSION; + pScrn->driverVersion = GLINT_VERSION; pScrn->driverName = GLINT_DRIVER_NAME; pScrn->name = GLINT_NAME; pScrn->Probe = GLINTProbe; @@ -807,7 +800,7 @@ GLINTProbe(DriverPtr drv, int flags) } } /* Fill in what we can of the ScrnInfoRec */ - pScrn->driverVersion = VERSION; + pScrn->driverVersion = GLINT_VERSION; pScrn->driverName = GLINT_DRIVER_NAME; pScrn->name = GLINT_NAME; pScrn->Probe = GLINTProbe; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h index 58a17ad74..030b66a91 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h @@ -54,6 +54,14 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #endif +#define I810_VERSION 4000 +#define I810_NAME "I810" +#define I810_DRIVER_NAME "i810" +#define I810_MAJOR_VERSION 1 +#define I810_MINOR_VERSION 0 +#define I810_PATCHLEVEL 0 + + /* Globals */ typedef struct _I810Rec *I810Ptr; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c index 591207b65..7cedec7b5 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c @@ -64,7 +64,8 @@ Bool I810CleanupDma(ScrnInfoPtr pScrn) Bool ret_val; ret_val = drmI810CleanupDma(pI810->drmSubFD); - if(ret_val == FALSE) ErrorF("I810 Dma Cleanup Failed\n"); + if (ret_val == FALSE) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I810 Dma Cleanup Failed\n"); return ret_val; } @@ -104,6 +105,7 @@ I810InitVisualConfigs(ScreenPtr pScreen) __GLXvisualConfig *pConfigs = 0; I810ConfigPrivPtr pI810Configs = 0; I810ConfigPrivPtr *pI810ConfigPtrs = 0; + int accum, stencil, db, depth; int i; switch (pScrn->bitsPerPixel) { @@ -112,25 +114,20 @@ I810InitVisualConfigs(ScreenPtr pScreen) case 32: break; case 16: - numConfigs = 4; + numConfigs = 8; - if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), - numConfigs))) { + pConfigs = (__GLXvisualConfig *) xnfcalloc(sizeof(__GLXvisualConfig), numConfigs); + if (!pConfigs) return FALSE; - } - if (!(pI810Configs = - (I810ConfigPrivPtr)xnfcalloc(sizeof(I810ConfigPrivRec), - numConfigs))) - { + pI810Configs = (I810ConfigPrivPtr) xnfcalloc(sizeof(I810ConfigPrivRec), numConfigs); + if (!pI810Configs) { xfree(pConfigs); return FALSE; } - if (!(pI810ConfigPtrs = - (I810ConfigPrivPtr*)xnfcalloc(sizeof(I810ConfigPrivPtr), - numConfigs))) - { + pI810ConfigPtrs = (I810ConfigPrivPtr *) xnfcalloc(sizeof(I810ConfigPrivPtr), numConfigs); + if (!pI810ConfigPtrs) { xfree(pConfigs); xfree(pI810Configs); return FALSE; @@ -139,126 +136,61 @@ I810InitVisualConfigs(ScreenPtr pScreen) for (i=0; i<numConfigs; i++) pI810ConfigPtrs[i] = &pI810Configs[i]; - /* config 0: db=FALSE, depth=0 - config 1: db=FALSE, depth=16 - config 2: db=TRUE, depth=0; - config 3: db=TRUE, depth=16 - */ - pConfigs[0].vid = -1; - pConfigs[0].class = -1; - pConfigs[0].rgba = TRUE; - pConfigs[0].redSize = 5; - pConfigs[0].greenSize = 6; - pConfigs[0].blueSize = 5; - pConfigs[0].redMask = 0x0000F800; - pConfigs[0].greenMask = 0x000007E0; - pConfigs[0].blueMask = 0x0000001F; - pConfigs[0].alphaMask = 0; - pConfigs[0].accumRedSize = 0; - pConfigs[0].accumGreenSize = 0; - pConfigs[0].accumBlueSize = 0; - pConfigs[0].accumAlphaSize = 0; - pConfigs[0].doubleBuffer = FALSE; - pConfigs[0].stereo = FALSE; - pConfigs[0].bufferSize = 16; - pConfigs[0].depthSize = 16; - pConfigs[0].stencilSize = 0; - pConfigs[0].auxBuffers = 0; - pConfigs[0].level = 0; - pConfigs[0].visualRating = 0; - pConfigs[0].transparentPixel = 0; - pConfigs[0].transparentRed = 0; - pConfigs[0].transparentGreen = 0; - pConfigs[0].transparentBlue = 0; - pConfigs[0].transparentAlpha = 0; - pConfigs[0].transparentIndex = 0; - - pConfigs[1].vid = -1; - pConfigs[1].class = -1; - pConfigs[1].rgba = TRUE; - pConfigs[1].redSize = 5; - pConfigs[1].greenSize = 6; - pConfigs[1].blueSize = 5; - pConfigs[1].redMask = 0x0000F800; - pConfigs[1].greenMask = 0x000007E0; - pConfigs[1].blueMask = 0x0000001F; - pConfigs[1].alphaMask = 0; - pConfigs[1].accumRedSize = 0; - pConfigs[1].accumGreenSize = 0; - pConfigs[1].accumBlueSize = 0; - pConfigs[1].accumAlphaSize = 0; - pConfigs[1].doubleBuffer = FALSE; - pConfigs[1].stereo = FALSE; - pConfigs[1].bufferSize = 16; - pConfigs[1].depthSize = 16; - pConfigs[1].stencilSize = 0; - pConfigs[1].auxBuffers = 0; - pConfigs[1].level = 0; - pConfigs[1].visualRating = 0; - pConfigs[1].transparentPixel = 0; - pConfigs[1].transparentRed = 0; - pConfigs[1].transparentGreen = 0; - pConfigs[1].transparentBlue = 0; - pConfigs[1].transparentAlpha = 0; - pConfigs[1].transparentIndex = 0; - - pConfigs[2].vid = -1; - pConfigs[2].class = -1; - pConfigs[2].rgba = TRUE; - pConfigs[2].redSize = 5; - pConfigs[2].greenSize = 6; - pConfigs[2].blueSize = 5; - pConfigs[2].redMask = 0x0000F800; - pConfigs[2].greenMask = 0x000007E0; - pConfigs[2].blueMask = 0x0000001F; - pConfigs[2].alphaMask = 0; - pConfigs[2].accumRedSize = 0; - pConfigs[2].accumGreenSize = 0; - pConfigs[2].accumBlueSize = 0; - pConfigs[2].accumAlphaSize = 0; - pConfigs[2].doubleBuffer = TRUE; - pConfigs[2].stereo = FALSE; - pConfigs[2].bufferSize = 16; - pConfigs[2].depthSize = 16; - pConfigs[2].stencilSize = 0; - pConfigs[2].auxBuffers = 0; - pConfigs[2].level = 0; - pConfigs[2].visualRating = 0; - pConfigs[2].transparentPixel = 0; - pConfigs[2].transparentRed = 0; - pConfigs[2].transparentGreen = 0; - pConfigs[2].transparentBlue = 0; - pConfigs[2].transparentAlpha = 0; - pConfigs[2].transparentIndex = 0; - - pConfigs[3].vid = -1; - pConfigs[3].class = -1; - pConfigs[3].rgba = TRUE; - pConfigs[3].redSize = 5; - pConfigs[3].greenSize = 6; - pConfigs[3].blueSize = 5; - pConfigs[3].redMask = 0x0000F800; - pConfigs[3].greenMask = 0x000007E0; - pConfigs[3].blueMask = 0x0000001F; - pConfigs[3].alphaMask = 0; - pConfigs[3].accumRedSize = 0; - pConfigs[3].accumGreenSize = 0; - pConfigs[3].accumBlueSize = 0; - pConfigs[3].accumAlphaSize = 0; - pConfigs[3].doubleBuffer = TRUE; - pConfigs[3].stereo = FALSE; - pConfigs[3].bufferSize = 16; - pConfigs[3].depthSize = 16; - pConfigs[3].stencilSize = 0; - pConfigs[3].auxBuffers = 0; - pConfigs[3].level = 0; - pConfigs[3].visualRating = 0; - pConfigs[3].transparentPixel = 0; - pConfigs[3].transparentRed = 0; - pConfigs[3].transparentGreen = 0; - pConfigs[3].transparentBlue = 0; - pConfigs[3].transparentAlpha = 0; - pConfigs[3].transparentIndex = 0; + i = 0; + depth = 1; + for (accum = 0; accum <= 1; accum++) { + for (stencil = 0; stencil <= 1; stencil++) { + for (db = 0; db <= 1; db++) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 6; + pConfigs[i].blueSize = 5; + pConfigs[i].redMask = 0x0000F800; + pConfigs[i].greenMask = 0x000007E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0; + if (accum) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 16; + } + else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + pConfigs[i].doubleBuffer = db ? TRUE : FALSE; + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 16; + if (depth) + pConfigs[i].depthSize = 16; + else + pConfigs[i].depthSize = 0; + if (stencil) + pConfigs[i].stencilSize = 8; + else + pConfigs[i].stencilSize = 0; + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if (stencil) + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + else + pConfigs[i].visualRating = GLX_NONE_EXT; + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } + } + assert(i == numConfigs); break; } pI810->numVisualConfigs = numConfigs; @@ -301,9 +233,21 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) if (!LoaderSymbol("drmAvailable")) return FALSE; #endif + /* Check the DRI version */ + { + int major, minor, patch; + DRIQueryVersion(&major, &minor, &patch); + if (major != 3 || minor != 0 || patch < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "I810DRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", + major, minor, patch); + return FALSE; + } + } + pDRIInfo = DRICreateInfoRec(); if (!pDRIInfo) { - ErrorF("DRICreateInfoRec failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "DRICreateInfoRec failed\n"); return FALSE; } @@ -322,10 +266,9 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) ((pciConfigPtr)pI810->PciInfo->thisCard)->busnum, ((pciConfigPtr)pI810->PciInfo->thisCard)->devnum, ((pciConfigPtr)pI810->PciInfo->thisCard)->funcnum); - - pDRIInfo->ddxDriverMajorVersion = 0; - pDRIInfo->ddxDriverMinorVersion = 1; - pDRIInfo->ddxDriverPatchVersion = 0; + pDRIInfo->ddxDriverMajorVersion = I810_MAJOR_VERSION; + pDRIInfo->ddxDriverMinorVersion = I810_MINOR_VERSION; + pDRIInfo->ddxDriverPatchVersion = I810_PATCHLEVEL; pDRIInfo->frameBufferPhysicalAddress = pI810->LinearAddr; pDRIInfo->frameBufferSize = (((pScrn->displayWidth * pScrn->virtualY * pI810->cpp) + @@ -343,7 +286,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) * in the SAREA header */ if (sizeof(XF86DRISAREARec)+sizeof(I810SAREARec)>SAREA_MAX) { - ErrorF("Data does not fit in SAREA\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "Data does not fit in SAREA\n"); return FALSE; } pDRIInfo->SAREASize = SAREA_MAX; @@ -369,7 +312,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) * to allocate it. Scary stuff, hold on... */ if (!DRIScreenInit(pScreen, pDRIInfo, &pI810->drmSubFD)) { - ErrorF("DRIScreenInit failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed\n"); xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate=0; DRIDestroyInfoRec(pI810->pDRIInfo); @@ -377,10 +320,31 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) return FALSE; } + /* Check the i810 DRM version */ + { + drmVersionPtr version = drmGetVersion(pI810->drmSubFD); + if (version) { + if (version->version_major != 1 || + version->version_minor != 0 || + version->version_patchlevel < 0) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "I810DRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + I810DRICloseScreen(pScreen); + drmFreeVersion(version); + return FALSE; + } + drmFreeVersion(version); + } + } + pI810DRI->regsSize=I810_REG_SIZE; if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->MMIOAddr, pI810DRI->regsSize, DRM_REGISTERS, 0, &pI810DRI->regs)<0) { - ErrorF("drmAddMap(regs) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(regs) failed\n"); DRICloseScreen(pScreen); return FALSE; } @@ -397,14 +361,14 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) /* Agp Support - Need this just to get the framebuffer. */ if(drmAgpAcquire(pI810->drmSubFD) < 0) { - ErrorF("drmAgpAquire failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAgpAquire failed\n"); DRICloseScreen(pScreen); return FALSE; } pI810->agpAcquired = TRUE; if (drmAgpEnable(pI810->drmSubFD, 0) < 0) { - ErrorF("drmAgpEnable failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAgpEnable failed\n"); DRICloseScreen(pScreen); return FALSE; } @@ -432,22 +396,25 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) "Couldn't find depth/back buffer pitch"); DRICloseScreen(pScreen); return FALSE; - } else { + } + else { back_size = i810_pitches[pitch_idx] * (pScrn->virtualY + 4); back_size = ((back_size + 4096 - 1) / 4096) * 4096; } sysmem_size = pScrn->videoRam * 1024; - if(dcacheHandle != 0) { - if(back_size > 4*1024*1024) { - ErrorF("Backsize is larger then 4 meg\n"); + if (dcacheHandle != 0) { + if (back_size > 4*1024*1024) { + xf86DrvMsg(pScreen->myNum, X_INFO, "Backsize is larger then 4 meg\n"); sysmem_size = sysmem_size - 2*back_size; drmAgpFree(pI810->drmSubFD, dcacheHandle); pI810->dcacheHandle = dcacheHandle = 0; - } else { + } + else { sysmem_size = sysmem_size - back_size; } - } else { + } + else { sysmem_size = sysmem_size - 2*back_size; } @@ -499,7 +466,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle); pI810->backHandle = agpHandle; - if(agpHandle != 0) { + if (agpHandle != 0) { /* The backbuffer is always aligned to the 56 mb mark in the aperture */ if(drmAgpBind(pI810->drmSubFD, agpHandle, 56*1024*1024) == 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -552,15 +519,15 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) * regular framebuffer as well as texture memory. */ drmAgpAlloc(pI810->drmSubFD, sysmem_size, 0, NULL, &agpHandle); - if(agpHandle == 0) { - ErrorF("drmAgpAlloc failed\n"); + if (agpHandle == 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAgpAlloc failed\n"); DRICloseScreen(pScreen); return FALSE; } pI810->sysmemHandle = agpHandle; - if(drmAgpBind(pI810->drmSubFD, agpHandle, 0) != 0) { - ErrorF("drmAgpBind failed\n"); + if (drmAgpBind(pI810->drmSubFD, agpHandle, 0) != 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAgpBind failed\n"); DRICloseScreen(pScreen); return FALSE; } @@ -572,16 +539,18 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) if (agpHandle != 0) { tom = sysmem_size; - if(drmAgpBind(pI810->drmSubFD, agpHandle, tom) == 0) { + if (drmAgpBind(pI810->drmSubFD, agpHandle, tom) == 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: Allocated 4K for mouse cursor image\n"); pI810->CursorStart = tom; tom += 4096; - } else { + } + else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: cursor bind failed\n"); pI810->CursorPhysical = 0; } - } else { + } + else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: cursor alloc failed\n"); pI810->CursorPhysical = 0; } @@ -604,7 +573,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BackBuffer.Start, pI810->BackBuffer.Size, DRM_AGP, 0, &pI810DRI->backbuffer) < 0) { - ErrorF("drmAddMap(backbuffer) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(backbuffer) failed\n"); DRICloseScreen(pScreen); return FALSE; } @@ -613,7 +582,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->DepthBuffer.Start, pI810->DepthBuffer.Size, DRM_AGP, 0, &pI810DRI->depthbuffer) < 0) { - ErrorF("drmAddMap(depthbuffer) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(depthbuffer) failed\n"); DRICloseScreen(pScreen); return FALSE; } @@ -625,17 +594,21 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) I810AllocHigh( &(pI810->BufferMem), &(pI810->SysMem), I810_DMA_BUF_NR * I810_DMA_BUF_SZ); - if(pI810->BufferMem.Start == 0 || + xf86DrvMsg(pScreen->myNum, X_INFO, "Buffer map : %lx\n", + pI810->BufferMem.Start); + + if (pI810->BufferMem.Start == 0 || pI810->BufferMem.End - pI810->BufferMem.Start > I810_DMA_BUF_NR * I810_DMA_BUF_SZ) { - ErrorF("Not enough memory for dma buffers\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "Not enough memory for dma buffers\n"); DRICloseScreen(pScreen); return FALSE; } - if(drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BufferMem.Start, + if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BufferMem.Start, pI810->BufferMem.Size, DRM_AGP, 0, &pI810->buffer_map) < 0) { - ErrorF("drmAddMap(buffer_map) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(buffer_map) failed\n"); DRICloseScreen(pScreen); return FALSE; } @@ -646,7 +619,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->LpRing.mem.Start, pI810->LpRing.mem.Size, DRM_AGP, 0, &pI810->ring_map) < 0) { - ErrorF("drmAddMap(ring_map) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(ring_map) failed\n"); DRICloseScreen(pScreen); return FALSE; } @@ -674,7 +647,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->TexMem.Start, pI810->TexMem.Size, DRM_AGP, 0, &pI810DRI->textures) < 0) { - ErrorF("drmAddMap(textures) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(textures) failed\n"); DRICloseScreen(pScreen); return FALSE; } @@ -745,7 +718,7 @@ Bool I810DRIScreenInit(ScreenPtr pScreen) pI810DRI->auxPitchBits = pI810->auxPitchBits; if (!(I810InitVisualConfigs(pScreen))) { - ErrorF("I810InitVisualConfigs failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "I810InitVisualConfigs failed\n"); DRICloseScreen(pScreen); return FALSE; } diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c index 99369f50b..6d4c8aafb 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c @@ -95,15 +95,8 @@ static void I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, int flags); #endif -#define VERSION 4000 -#define I810_NAME "I810" -#define I810_DRIVER_NAME "i810" -#define I810_MAJOR_VERSION 1 -#define I810_MINOR_VERSION 0 -#define I810_PATCHLEVEL 0 - DriverRec I810 = { - VERSION, + I810_VERSION, "Accelerated driver for Intel i810 cards", I810Identify, I810Probe, @@ -407,7 +400,7 @@ I810Probe(DriverPtr drv, int flags) { /* Allocate new ScrnInfoRec and claim the slot */ pScrn = xf86AllocateScreen(drv, 0); - pScrn->driverVersion = VERSION; + pScrn->driverVersion = I810_VERSION; pScrn->driverName = I810_DRIVER_NAME; pScrn->name = I810_NAME; pScrn->Probe = I810Probe; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h index 2027171da..931e4a19d 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h @@ -14,9 +14,6 @@ #ifndef MGA_H #define MGA_H -/* Temporarily turn off building in DRI support */ -#undef XF86DRI - #include "compiler.h" #include "xaa.h" #include "xf86Cursor.h" @@ -33,9 +30,15 @@ #include "dri.h" #include "GL/glxint.h" #include "mga_dri.h" -#include "mga_dripriv.h" #endif +#define MGA_VERSION 4000 +#define MGA_NAME "MGA" +#define MGA_DRIVER_NAME "mga" +#define MGA_MAJOR_VERSION 1 +#define MGA_MINOR_VERSION 0 +#define MGA_PATCHLEVEL 0 + #if !defined(EXTRADEBUG) #define INREG8(addr) MMIO_IN8(pMga->IOBase, addr) #define INREG16(addr) MMIO_IN16(pMga->IOBase, addr) @@ -69,6 +72,7 @@ typedef struct { CARD32 Option3; } MGARegRec, *MGARegPtr; + typedef struct { Bool isHwCursor; int CursorMaxWidth; @@ -216,11 +220,20 @@ typedef struct { MGAConfigPrivPtr pVisualConfigsPriv; MGARegRec DRContextRegs; MGADRIServerPrivatePtr DRIServerInfo; + Bool have_quiescense; #endif XF86VideoAdaptorPtr adaptor; } MGARec, *MGAPtr; +#ifdef XF86DRI +extern void GlxSetVisualConfigs( + int nconfigs, + __GLXvisualConfig *configs, + void **configprivs +); +#endif + extern CARD32 MGAAtype[16]; extern CARD32 MGAAtypeNoBLK[16]; @@ -240,9 +253,9 @@ extern CARD32 MGAAtypeNoBLK[16]; #define TRANSPARENCY_KEY 255 #define KEY_COLOR 0 -#define MGA_FRONT 0 -#define MGA_BACK 1 -#define MGA_DEPTH 2 +#define MGA_FRONT 0x1 +#define MGA_BACK 0x2 +#define MGA_DEPTH 0x4 /* Prototypes */ @@ -271,13 +284,13 @@ Bool MGADRIScreenInit(ScreenPtr pScreen); void MGADRICloseScreen(ScreenPtr pScreen); Bool MGADRIFinishScreenInit(ScreenPtr pScreen); void MGASwapContext(ScreenPtr pScreen); -void MGALostContext(ScreenPtr pScreen); -void MGASelectBuffer(MGAPtr pMGA, int which); +void MGASelectBuffer(ScrnInfoPtr pScrn, int which); Bool mgaConfigureWarp(ScrnInfoPtr pScrn); unsigned int mgaInstallMicrocode(ScreenPtr pScreen, int agp_offset); unsigned int mgaGetMicrocodeSize(ScreenPtr pScreen); -Bool mgadrmCleanupDma(ScrnInfoPtr pScrn); -Bool mgadrmInitDma(ScrnInfoPtr pScrn, int prim_size); +Bool MgaCleanupDma(ScrnInfoPtr pScrn); +Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size); +Bool MgaLockUpdate(ScrnInfoPtr pScrn, drmLockFlags flags); void MGARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c index 0f4ba439a..7f91b6630 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c @@ -55,10 +55,11 @@ Bool MgaCleanupDma(ScrnInfoPtr pScrn) { MGAPtr pMGA = MGAPTR(pScrn); Bool ret_val; - + ret_val = drmMgaCleanupDma(pMGA->drmSubFD); - if(ret_val == FALSE) ErrorF("Mga Dma Cleanup Failed\n"); - + if (ret_val == FALSE) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mga Dma Cleanup Failed\n"); + return ret_val; } @@ -66,10 +67,11 @@ Bool MgaLockUpdate(ScrnInfoPtr pScrn, drmLockFlags flags) { MGAPtr pMGA = MGAPTR(pScrn); Bool ret_val; - + ret_val = drmMgaLockUpdate(pMGA->drmSubFD, flags); - if(ret_val == FALSE) ErrorF("LockUpdate failed\n"); - + if (ret_val == FALSE) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "LockUpdate failed\n"); + return ret_val; } @@ -98,7 +100,8 @@ Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size) break; case PCI_CHIP_MGAG200_PCI: default: - ErrorF("Direct rendering not supported on this card/chipset\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] Direct rendering not supported on this card/chipset\n"); return FALSE; } @@ -116,11 +119,13 @@ Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size) memcpy(&init.WarpIndex, &pMGADRIServer->WarpIndex, sizeof(drmMgaWarpIndex) * MGA_MAX_WARP_PIPES); - ErrorF("Mga Dma Initialization start\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Mga Dma Initialization start\n"); ret_val = drmMgaInitDma(pMGA->drmSubFD, &init); - if(ret_val == FALSE) ErrorF("Mga Dma Initialization Failed\n"); - else ErrorF("Mga Dma Initialization done\n"); + if (ret_val == FALSE) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Mga Dma Initialization Failed\n"); + else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Mga Dma Initialization done\n"); return ret_val; } @@ -217,8 +222,9 @@ MGAInitVisualConfigs(ScreenPtr pScreen) } } } - if (i!=numConfigs) { - ErrorF("Incorrect initialization of visuals\n"); + if (i != numConfigs) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] Incorrect initialization of visuals\n"); return FALSE; } break; @@ -242,93 +248,110 @@ static unsigned int mylog2(unsigned int n) Bool MGADRIScreenInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); - DRIInfoPtr pDRIInfo; - MGADRIPtr pMGADRI; - MGADRIServerPrivatePtr pMGADRIServer; - int bufs, size; - int prim_size; - int init_offset; - int i; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMGA = MGAPTR(pScrn); + DRIInfoPtr pDRIInfo; + MGADRIPtr pMGADRI; + MGADRIServerPrivatePtr pMGADRIServer; + int bufs, size; + int prim_size; + int init_offset; + int i; #if XFree86LOADER - /* Check that the GLX, DRI, and DRM modules have been loaded by testing - * for canonical symbols in each module. */ - if (!LoaderSymbol("GlxSetVisualConfigs")) return FALSE; - if (!LoaderSymbol("DRIScreenInit")) return FALSE; - if (!LoaderSymbol("drmAvailable")) return FALSE; + /* Check that the GLX, DRI, and DRM modules have been loaded by testing + * for canonical symbols in each module. */ + if (!LoaderSymbol("GlxSetVisualConfigs")) return FALSE; + if (!LoaderSymbol("DRIScreenInit")) return FALSE; + if (!LoaderSymbol("drmAvailable")) return FALSE; #endif - if((pScrn->bitsPerPixel / 8) != 2) { - ErrorF("Direct Rendering only supported in 16 bpp mode\n"); - return FALSE; - } + /* Check the DRI version */ + { + int major, minor, patch; + DRIQueryVersion(&major, &minor, &patch); + if (major != 3 || minor != 0 || patch < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] MGADRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", + major, minor, patch); + return FALSE; + } + } + + if ((pScrn->bitsPerPixel / 8) != 2) { + xf86DrvMsg(pScreen->myNum, X_INFO, + "[drm] Direct Rendering only supported in 16 bpp mode\n"); + return FALSE; + } - pDRIInfo = DRICreateInfoRec(); - if (!pDRIInfo) return FALSE; - pMGA->pDRIInfo = pDRIInfo; - - pDRIInfo->drmDriverName = MGAKernelDriverName; - pDRIInfo->clientDriverName = MGAClientDriverName; - pDRIInfo->busIdString = xalloc(64); - sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", - ((pciConfigPtr)pMGA->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pMGA->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pMGA->PciInfo->thisCard)->funcnum); - pDRIInfo->ddxDriverMajorVersion = 0; - pDRIInfo->ddxDriverMinorVersion = 1; - pDRIInfo->ddxDriverPatchVersion = 0; - pDRIInfo->frameBufferPhysicalAddress = pMGA->FbAddress; - pDRIInfo->frameBufferSize = pMGA->FbMapSize; - pDRIInfo->frameBufferStride = pScrn->displayWidth*(pScrn->bitsPerPixel/8); - pDRIInfo->ddxDrawableTableEntry = MGA_MAX_DRAWABLES; - - MGADRIWrapFunctions( pScreen, pDRIInfo ); - - if (SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES) - pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; - else - pDRIInfo->maxDrawableTableEntry = MGA_MAX_DRAWABLES; - - /* For now the mapping works by using a fixed size defined - * in the SAREA header - */ - if (sizeof(XF86DRISAREARec)+sizeof(MGASAREARec)>SAREA_MAX) { - ErrorF("Data does not fit in SAREA\n"); - return FALSE; - } + pDRIInfo = DRICreateInfoRec(); + if (!pDRIInfo) + return FALSE; + pMGA->pDRIInfo = pDRIInfo; + + pDRIInfo->drmDriverName = MGAKernelDriverName; + pDRIInfo->clientDriverName = MGAClientDriverName; + pDRIInfo->busIdString = xalloc(64); + sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", + ((pciConfigPtr)pMGA->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pMGA->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pMGA->PciInfo->thisCard)->funcnum); + pDRIInfo->ddxDriverMajorVersion = MGA_MAJOR_VERSION; + pDRIInfo->ddxDriverMinorVersion = MGA_MINOR_VERSION; + pDRIInfo->ddxDriverPatchVersion = MGA_PATCHLEVEL; + pDRIInfo->frameBufferPhysicalAddress = pMGA->FbAddress; + pDRIInfo->frameBufferSize = pMGA->FbMapSize; + pDRIInfo->frameBufferStride = pScrn->displayWidth*(pScrn->bitsPerPixel/8); + pDRIInfo->ddxDrawableTableEntry = MGA_MAX_DRAWABLES; + + MGADRIWrapFunctions( pScreen, pDRIInfo ); + + if (SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES) + pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; + else + pDRIInfo->maxDrawableTableEntry = MGA_MAX_DRAWABLES; + + /* For now the mapping works by using a fixed size defined + * in the SAREA header + */ + if (sizeof(XF86DRISAREARec)+sizeof(MGASAREARec)>SAREA_MAX) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Data does not fit in SAREA\n"); + return FALSE; + } - ErrorF("\n\n\nSarea %d+%d: %d\n", sizeof(XF86DRISAREARec), - sizeof(MGASAREARec), sizeof(XF86DRISAREARec) + sizeof(MGASAREARec)); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Sarea %d+%d: %d\n", + sizeof(XF86DRISAREARec), sizeof(MGASAREARec), + sizeof(XF86DRISAREARec) + sizeof(MGASAREARec)); - pDRIInfo->SAREASize = SAREA_MAX; + pDRIInfo->SAREASize = SAREA_MAX; - if (!(pMGADRI = (MGADRIPtr)xnfcalloc(sizeof(MGADRIRec),1))) { - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo=0; - ErrorF("Failed to allocate memory for private record \n"); - return FALSE; - } + if (!(pMGADRI = (MGADRIPtr)xnfcalloc(sizeof(MGADRIRec),1))) { + DRIDestroyInfoRec(pMGA->pDRIInfo); + pMGA->pDRIInfo=0; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] Failed to allocate memory for private record\n"); + return FALSE; + } if (!(pMGADRIServer = (MGADRIServerPrivatePtr) xnfcalloc(sizeof(MGADRIServerPrivateRec),1))) { - xfree(pMGADRI); - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo=0; - ErrorF("Failed to allocate memory for private record \n"); - return FALSE; - } + xfree(pMGADRI); + DRIDestroyInfoRec(pMGA->pDRIInfo); + pMGA->pDRIInfo=0; + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] Failed to allocate memory for private record\n"); + return FALSE; + } - pDRIInfo->devPrivate = pMGADRI; - pMGA->DRIServerInfo = pMGADRIServer; - pDRIInfo->devPrivateSize = sizeof(MGADRIRec); - pDRIInfo->contextSize = sizeof(MGADRIContextRec); + pDRIInfo->devPrivate = pMGADRI; + pMGA->DRIServerInfo = pMGADRIServer; + pDRIInfo->devPrivateSize = sizeof(MGADRIRec); + pDRIInfo->contextSize = sizeof(MGADRIContextRec); - pDRIInfo->CreateContext = MGACreateContext; - pDRIInfo->DestroyContext = MGADestroyContext; - pDRIInfo->SwapContext = MGADRISwapContext; + pDRIInfo->CreateContext = MGACreateContext; + pDRIInfo->DestroyContext = MGADestroyContext; + pDRIInfo->SwapContext = MGADRISwapContext; - switch( pScrn->bitsPerPixel ) { + switch( pScrn->bitsPerPixel ) { case 8: pDRIInfo->InitBuffers = Mga8DRIInitBuffers; pDRIInfo->MoveBuffers = Mga8DRIMoveBuffers; @@ -341,113 +364,138 @@ Bool MGADRIScreenInit(ScreenPtr pScreen) case 32: pDRIInfo->InitBuffers = Mga32DRIInitBuffers; pDRIInfo->MoveBuffers = Mga32DRIMoveBuffers; - } + } - pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + + if (!DRIScreenInit(pScreen, pDRIInfo, &pMGA->drmSubFD)) { + xfree(pMGADRIServer); + pMGA->DRIServerInfo = 0; + xfree(pDRIInfo->devPrivate); + pDRIInfo->devPrivate = 0; + DRIDestroyInfoRec(pMGA->pDRIInfo); + pMGA->pDRIInfo = 0; + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] DRIScreenInit Failed\n"); + return FALSE; + } - if (!DRIScreenInit(pScreen, pDRIInfo, &pMGA->drmSubFD)) { - xfree(pMGADRIServer); - pMGA->DRIServerInfo = 0; - xfree(pDRIInfo->devPrivate); - pDRIInfo->devPrivate = 0; - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo = 0; - ErrorF("DRIScreenInit Failed\n"); - return FALSE; - } + /* Check the MGA DRM version */ + { + drmVersionPtr version = drmGetVersion(pMGA->drmSubFD); + if (version) { + if (version->version_major != 1 || + version->version_minor != 0 || + version->version_patchlevel < 0) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] MGADRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + MGADRICloseScreen(pScreen); + drmFreeVersion(version); + return FALSE; + } + drmFreeVersion(version); + } + } - pMGADRIServer->regsSize = MGAIOMAPSIZE; - if (drmAddMap(pMGA->drmSubFD, (drmHandle)pMGA->IOAddress, - pMGADRIServer->regsSize, DRM_REGISTERS, 0, - &pMGADRIServer->regs)<0) { - DRICloseScreen(pScreen); - ErrorF("drmAddMap failed Register MMIO region\n"); - return FALSE; - } - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", - pMGADRIServer->regs); + pMGADRIServer->regsSize = MGAIOMAPSIZE; + if (drmAddMap(pMGA->drmSubFD, (drmHandle)pMGA->IOAddress, + pMGADRIServer->regsSize, DRM_REGISTERS, 0, + &pMGADRIServer->regs)<0) { + DRICloseScreen(pScreen); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap failed Register MMIO region\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", + pMGADRIServer->regs); - /* Agp Support */ - pMGADRIServer->agpAcquired = FALSE; - pMGADRIServer->agpHandle = 0; - pMGADRIServer->agpSizep = 0; - pMGADRIServer->agp_map = 0; + /* Agp Support */ + pMGADRIServer->agpAcquired = FALSE; + pMGADRIServer->agpHandle = 0; + pMGADRIServer->agpSizep = 0; + pMGADRIServer->agp_map = 0; - if(drmAgpAcquire(pMGA->drmSubFD) < 0) { - DRICloseScreen(pScreen); - ErrorF("drmAgpAcquire failed\n"); - return FALSE; - } - pMGADRIServer->agpAcquired = TRUE; + if (drmAgpAcquire(pMGA->drmSubFD) < 0) { + DRICloseScreen(pScreen); + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n"); + return FALSE; + } + pMGADRIServer->agpAcquired = TRUE; - pMGADRIServer->warp_ucode_size = mgaGetMicrocodeSize(pScreen); - if(pMGADRIServer->warp_ucode_size == 0) { - ErrorF("microcodeSize is zero\n"); + pMGADRIServer->warp_ucode_size = mgaGetMicrocodeSize(pScreen); + if (pMGADRIServer->warp_ucode_size == 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] microcodeSize is zero\n"); DRICloseScreen(pScreen); return FALSE; } - pMGADRIServer->agpMode = drmAgpGetMode(pMGA->drmSubFD); - /* Default to 1X agp mode */ - pMGADRIServer->agpMode &= ~0x00000002; - if (drmAgpEnable(pMGA->drmSubFD, pMGADRIServer->agpMode) < 0) { - ErrorF("drmAgpEnable failed\n"); - DRICloseScreen(pScreen); - return FALSE; - } - ErrorF("drmAgpEnabled succeeded\n"); + pMGADRIServer->agpMode = drmAgpGetMode(pMGA->drmSubFD); + /* Default to 1X agp mode */ + pMGADRIServer->agpMode &= ~0x00000002; + if (drmAgpEnable(pMGA->drmSubFD, pMGADRIServer->agpMode) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n"); + DRICloseScreen(pScreen); + return FALSE; + } + ErrorF("[drm] drmAgpEnabled succeeded\n"); - prim_size = 65536; - init_offset = ((prim_size + pMGADRIServer->warp_ucode_size + + prim_size = 65536; + init_offset = ((prim_size + pMGADRIServer->warp_ucode_size + 4096 - 1) / 4096) * 4096; - pMGADRIServer->agpSizep = init_offset; - pMGADRI->agpSize = (drmAgpSize(pMGA->drmSubFD)) - init_offset; - - pMGADRIServer->agpBase = (drmAddress) drmAgpBase(pMGA->drmSubFD); - if (drmAddMap(pMGA->drmSubFD, 0, - init_offset, DRM_AGP, 0, - &pMGADRIServer->agp_private) < 0) { - DRICloseScreen(pScreen); - ErrorF("drmAddMap failed on AGP aperture\n"); - return FALSE; - } + pMGADRIServer->agpSizep = init_offset; + pMGADRI->agpSize = (drmAgpSize(pMGA->drmSubFD)) - init_offset; + + pMGADRIServer->agpBase = (drmAddress) drmAgpBase(pMGA->drmSubFD); + if (drmAddMap(pMGA->drmSubFD, 0, + init_offset, DRM_AGP, 0, + &pMGADRIServer->agp_private) < 0) { + DRICloseScreen(pScreen); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap failed on AGP aperture\n"); + return FALSE; + } - if (drmMap(pMGA->drmSubFD, (drmHandle)pMGADRIServer->agp_private, - init_offset, - (drmAddressPtr)&pMGADRIServer->agp_map) < -1) { - DRICloseScreen(pScreen); - ErrorF("drmMap failed on AGP aperture\n"); - return FALSE; - } + if (drmMap(pMGA->drmSubFD, (drmHandle)pMGADRIServer->agp_private, + init_offset, + (drmAddressPtr)&pMGADRIServer->agp_map) < -1) { + DRICloseScreen(pScreen); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmMap failed on AGP aperture\n"); + return FALSE; + } - /* Now allocate and bind a default of 8 megs */ - - drmAgpAlloc(pMGA->drmSubFD, 0x00800000, 0, 0, - &pMGADRIServer->agpHandle); + /* Now allocate and bind a default of 8 megs */ + drmAgpAlloc(pMGA->drmSubFD, 0x00800000, 0, 0, + &pMGADRIServer->agpHandle); - if(pMGADRIServer->agpHandle == 0) { - ErrorF("drmAgpAlloc failed\n"); - DRICloseScreen(pScreen); - return FALSE; - } + if (pMGADRIServer->agpHandle == 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAgpAlloc failed\n"); + DRICloseScreen(pScreen); + return FALSE; + } - if(drmAgpBind(pMGA->drmSubFD, pMGADRIServer->agpHandle, 0) < 0) { - DRICloseScreen(pScreen); - ErrorF("drmAgpBind failed\n"); - return FALSE; - } - - mgaInstallMicrocode(pScreen, prim_size); + if (drmAgpBind(pMGA->drmSubFD, pMGADRIServer->agpHandle, 0) < 0) { + DRICloseScreen(pScreen); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAgpBind failed\n"); + return FALSE; + } - if(drmAddMap(pMGA->drmSubFD, (drmHandle)init_offset, - pMGADRI->agpSize, DRM_AGP, 0, - &pMGADRI->agp) < 0) { - ErrorF("Failed to map public agp area\n"); - DRICloseScreen(pScreen); - return FALSE; - } + mgaInstallMicrocode(pScreen, prim_size); + if (drmAddMap(pMGA->drmSubFD, (drmHandle)init_offset, + pMGADRI->agpSize, DRM_AGP, 0, + &pMGADRI->agp) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Failed to map public agp area\n"); + DRICloseScreen(pScreen); + return FALSE; + } switch(pMGA->Chipset) { case PCI_CHIP_MGAG400: @@ -458,126 +506,128 @@ Bool MGADRIScreenInit(ScreenPtr pScreen) break; case PCI_CHIP_MGAG200_PCI: default: - ErrorF("Direct rendering not supported on this card/chipset\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Direct rendering not supported on this card/chipset\n"); return FALSE; } + + pMGADRI->width = pScrn->virtualX; + pMGADRI->height = pScrn->virtualY; + pMGADRI->mem = pScrn->videoRam * 1024; + pMGADRI->cpp = pScrn->bitsPerPixel / 8; + pMGADRI->frontPitch = pScrn->displayWidth * (pScrn->bitsPerPixel / 8); - pMGADRI->width = pScrn->virtualX; - pMGADRI->height = pScrn->virtualY; - pMGADRI->mem = pScrn->videoRam * 1024; - pMGADRI->cpp = pScrn->bitsPerPixel / 8; - pMGADRI->frontPitch = pScrn->displayWidth * (pScrn->bitsPerPixel / 8); - - - pMGADRI->frontOffset = 0; /* pMGA->YDstOrg * (pScrn->bitsPerPixel / 8) */ - pMGADRI->backOffset = ((pScrn->virtualY+129) * pScrn->displayWidth * - (pScrn->bitsPerPixel / 8) + 4095) & ~0xFFF; + pMGADRI->frontOffset = 0; /* pMGA->YDstOrg * (pScrn->bitsPerPixel / 8) */ + pMGADRI->backOffset = ((pScrn->virtualY+129) * pScrn->displayWidth * + (pScrn->bitsPerPixel / 8) + 4095) & ~0xFFF; - fprintf(stderr, "calced backoffset: 0x%x\n", - pMGADRI->backOffset); + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] calced backoffset: 0x%x\n", + pMGADRI->backOffset); #if 0 - size = 2 * pScrn->virtualX * pScrn->virtualY; - pMGADRI->depthOffset = (pMGADRI->backOffset + size + 4095) & ~0xFFF; - pMGADRI->textureOffset = pMGADRI->depthOffset + size; - pMGADRI->textureSize = pMGA->FbUsableSize - pMGADRI->textureOffset; + size = 2 * pScrn->virtualX * pScrn->virtualY; + pMGADRI->depthOffset = (pMGADRI->backOffset + size + 4095) & ~0xFFF; + pMGADRI->textureOffset = pMGADRI->depthOffset + size; + pMGADRI->textureSize = pMGA->FbUsableSize - pMGADRI->textureOffset; #else - size = 2 * pScrn->virtualX * pScrn->virtualY; - size += 4095; - size &= ~4095; - pMGADRI->depthOffset = pMGA->FbUsableSize - size; - pMGADRI->depthOffset &= ~4095; - pMGADRI->textureOffset = pMGADRI->backOffset + size; - pMGADRI->textureSize = pMGADRI->depthOffset - pMGADRI->textureOffset; - - if (pMGADRI->depthOffset < pMGADRI->textureOffset + 512*1024) { - ErrorF("Insufficient memory for direct rendering\n"); - DRICloseScreen(pScreen); - return FALSE; - } + size = 2 * pScrn->virtualX * pScrn->virtualY; + size += 4095; + size &= ~4095; + pMGADRI->depthOffset = pMGA->FbUsableSize - size; + pMGADRI->depthOffset &= ~4095; + pMGADRI->textureOffset = pMGADRI->backOffset + size; + pMGADRI->textureSize = pMGADRI->depthOffset - pMGADRI->textureOffset; + + if (pMGADRI->depthOffset < pMGADRI->textureOffset + 512*1024) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Insufficient memory for direct rendering\n"); + DRICloseScreen(pScreen); + return FALSE; + } #endif - pMGADRI->mAccess = pMGA->MAccess; + pMGADRI->mAccess = pMGA->MAccess; - i = mylog2(pMGADRI->textureSize / MGA_NR_TEX_REGIONS); - if (i < MGA_LOG_MIN_TEX_REGION_SIZE) + i = mylog2(pMGADRI->textureSize / MGA_NR_TEX_REGIONS); + if (i < MGA_LOG_MIN_TEX_REGION_SIZE) i = MGA_LOG_MIN_TEX_REGION_SIZE; - pMGADRI->logTextureGranularity = i; - pMGADRI->textureSize = (pMGADRI->textureSize >> i) << i; /* truncate */ - - - /* Here is where we need to do initialization of the dma engine */ - if((bufs = drmAddBufs(pMGA->drmSubFD, - MGA_DMA_BUF_NR, - MGA_DMA_BUF_SZ, - DRM_AGP_BUFFER, - init_offset)) <= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] failure adding %d %d byte DMA buffers\n", - MGA_DMA_BUF_NR, - MGA_DMA_BUF_SZ); - DRICloseScreen(pScreen); - return FALSE; - } + pMGADRI->logTextureGranularity = i; + pMGADRI->textureSize = (pMGADRI->textureSize >> i) << i; /* truncate */ + + + /* Here is where we need to do initialization of the dma engine */ + if((bufs = drmAddBufs(pMGA->drmSubFD, + MGA_DMA_BUF_NR, + MGA_DMA_BUF_SZ, + DRM_AGP_BUFFER, + init_offset)) <= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] failure adding %d %d byte DMA buffers\n", + MGA_DMA_BUF_NR, + MGA_DMA_BUF_SZ); + DRICloseScreen(pScreen); + return FALSE; + } - pMGADRI->agpBufferOffset = init_offset + pMGADRIServer->agp_private; + pMGADRI->agpBufferOffset = init_offset + pMGADRIServer->agp_private; - /* Calculate texture constants for AGP texture space - */ - { - CARD32 agpTextureOffset = MGA_DMA_BUF_SZ * MGA_DMA_BUF_NR; - CARD32 agpTextureSize = pMGADRI->agpSize - agpTextureOffset; - - i = mylog2(agpTextureSize / MGA_NR_TEX_REGIONS); - if (i < MGA_LOG_MIN_TEX_REGION_SIZE) - i = MGA_LOG_MIN_TEX_REGION_SIZE; - - pMGADRI->logAgpTextureGranularity = i; - pMGADRI->agpTextureSize = (agpTextureSize >> i) << i; - pMGADRI->agpTextureOffset = agpTextureOffset; - } + /* Calculate texture constants for AGP texture space + */ + { + CARD32 agpTextureOffset = MGA_DMA_BUF_SZ * MGA_DMA_BUF_NR; + CARD32 agpTextureSize = pMGADRI->agpSize - agpTextureOffset; + + i = mylog2(agpTextureSize / MGA_NR_TEX_REGIONS); + if (i < MGA_LOG_MIN_TEX_REGION_SIZE) + i = MGA_LOG_MIN_TEX_REGION_SIZE; + + pMGADRI->logAgpTextureGranularity = i; + pMGADRI->agpTextureSize = (agpTextureSize >> i) << i; + pMGADRI->agpTextureOffset = agpTextureOffset; + } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] added %d %d byte DMA buffers\n", - bufs, MGA_DMA_BUF_SZ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] added %d %d byte DMA buffers\n", + bufs, MGA_DMA_BUF_SZ); - if((MgaInitDma(pScrn, prim_size)) != TRUE) { - ErrorF("Failed to initialize dma engine\n"); - DRICloseScreen(pScreen); - return FALSE; - } + if ((MgaInitDma(pScrn, prim_size)) != TRUE) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Failed to initialize dma engine\n"); + DRICloseScreen(pScreen); + return FALSE; + } - ErrorF("Initialized Dma Engine\n"); + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Initialized Dma Engine\n"); - if (!pMGADRIServer->irq) { - pMGADRIServer->irq = drmGetInterruptFromBusID(pMGA->drmSubFD, - ((pciConfigPtr)pMGA->PciInfo + if (!pMGADRIServer->irq) { + pMGADRIServer->irq = drmGetInterruptFromBusID(pMGA->drmSubFD, + ((pciConfigPtr)pMGA->PciInfo ->thisCard)->busnum, ((pciConfigPtr)pMGA->PciInfo ->thisCard)->devnum, ((pciConfigPtr)pMGA->PciInfo ->thisCard)->funcnum); - drmCtlInstHandler(pMGA->drmSubFD, pMGADRIServer->irq); - } + drmCtlInstHandler(pMGA->drmSubFD, pMGADRIServer->irq); + } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] dma control initialized, using IRQ %d\n", - pMGADRIServer->irq); - - - if (!(MGAInitVisualConfigs(pScreen))) { - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[drm] dma control initialized, using IRQ %d\n", + pMGADRIServer->irq); - return TRUE; + + if (!(MGAInitVisualConfigs(pScreen))) { + DRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); + + return TRUE; } void diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c index 6aabc62c3..b379022af 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c @@ -148,12 +148,7 @@ static void MGASave(ScrnInfoPtr pScrn); static void MGARestore(ScrnInfoPtr pScrn); static Bool MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); -#define VERSION 4000 -#define MGA_NAME "MGA" -#define MGA_DRIVER_NAME "mga" -#define MGA_MAJOR_VERSION 1 -#define MGA_MINOR_VERSION 0 -#define MGA_PATCHLEVEL 0 + /* * This contains the functions needed by the server after loading the @@ -164,7 +159,7 @@ static Bool MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); */ DriverRec MGA = { - VERSION, + MGA_VERSION, MGA_DRIVER_NAME, #if 0 "accelerated driver for Matrox Millennium and Mystique cards", @@ -298,31 +293,23 @@ static const char *ramdacSymbols[] = { #ifdef XF86DRI static const char *drmSymbols[] = { + "drmAvailable", "drmAddBufs", "drmAddMap", - "drmAvailable", - "drmCtlAddCommand", "drmCtlInstHandler", "drmGetInterruptFromBusID", - "drmMapBufs", - "drmMarkBufs", - "drmUnmapBufs", "drmAgpAcquire", "drmAgpRelease", "drmAgpEnable", "drmAgpAlloc", "drmAgpFree", "drmAgpBind", - "drmAgpUnbind", - "drmAgpVersionMajor", - "drmAgpVersionMinor", "drmAgpGetMode", "drmAgpBase", "drmAgpSize", - "drmAgpMemoryUsed", - "drmAgpMemoryAvail", - "drmAgpVendorId", - "drmAgpDeviceId", + "drmMgaCleanupDma", + "drmMgaLockUpdate", + "drmMgaInitDma", NULL }; @@ -601,7 +588,7 @@ MGAProbe(DriverPtr drv, int flags) pScrn = xf86AllocateScreen(drv, 0); /* Fill in what we can of the ScrnInfoRec */ - pScrn->driverVersion = VERSION; + pScrn->driverVersion = MGA_VERSION; pScrn->driverName = MGA_DRIVER_NAME; pScrn->name = MGA_NAME; pScrn->Probe = MGAProbe; @@ -794,7 +781,7 @@ static void MGASoftReset(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); - int i; +/* int i; */ pMga->FbMapSize = 8192 * 1024; MGAMapMem(pScrn); @@ -1065,7 +1052,7 @@ VgaIOEnable(void *arg) extern xf86MonPtr ConfiguredMonitor; -void +static void MGAProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; @@ -1261,7 +1248,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) if (pScrn->depth == 8) pScrn->rgbBits = 8; - /* * Set the Chipset and ChipRev, allowing config file entries to * override. @@ -1305,8 +1291,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) } xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); - - from = X_DEFAULT; pMga->HWCursor = TRUE; /* @@ -2142,13 +2126,14 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) #ifdef XF86DRI if (pMga->directRenderingEnabled) { - DRILock(screenInfo.screens[pScrn->scrnIndex]); - MGASwapContext(screenInfo.screens[pScrn->scrnIndex]); + DRILock(screenInfo.screens[pScrn->scrnIndex], 0); +/* MGADRISwapContext(screenInfo.screens[pScrn->scrnIndex]); */ } #endif (*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE); - + + MGAStormSync(pScrn); /* JEFF - Check */ MGAStormEngineInit(pScrn); vgaHWProtect(pScrn, FALSE); @@ -2322,10 +2307,10 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) * is called. cfbScreenInit will eventually call into the drivers * InitGLXVisuals call back. */ - - pMga->directRenderingEnabled = MGADRIScreenInit(pScreen); - /* Force the initialization of the context */ - MGALostContext(pScreen); + if (!pMga->NoAccel) + pMga->directRenderingEnabled = MGADRIScreenInit(pScreen); + else + pMga->directRenderingEnabled = FALSE; #endif @@ -2625,7 +2610,7 @@ MGALeaveVT(int scrnIndex, int flags) pMGA = MGAPTR(pScrn); if (pMGA->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; - DRILock(pScreen); + DRILock(pScreen, 0); } #endif diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c new file mode 100644 index 000000000..7a456258a --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c @@ -0,0 +1,198 @@ +/* $XFree86: xc/programs/Xserver/GL/dri/dri.c,v 1.4 1999/09/25 14:36:41 dawes Exp $ */ +/************************************************************************** + +Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sub license, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice (including the +next paragraph) shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. +IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR +ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +**************************************************************************/ + +/* + * Authors: + * Keith Whitwell <keithw@precisioninsight.com> + * + */ + + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Priv.h" + +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#define PSZ 8 +#include "cfb.h" +#undef PSZ +#include "cfb16.h" +#include "cfb32.h" + +#include "miline.h" + +#include "GL/glxtokens.h" + +#include "mga_bios.h" +#include "mga_reg.h" +#include "mga.h" +#include "mga_macros.h" +#include "mga_dri.h" +#include "mga_wrap.h" + + + +static void MGAWakeupHandler(int screenNum, + pointer wakeupData, + unsigned long result, + pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[screenNum]; + /*DRIWrappedFuncsRec *pDRIWrap = DRIGetWrappedFuncs(pScreen);*/ + + if (0) ErrorF("MGAWakeupHandler (in)\n"); + + /* Disabled: Check contention like the 3d clients do before trying + * to restore state. + */ + DRILock(pScreen, 0); + MGASwapContext( pScreen ); + +} + +static void MGABlockHandler(int screenNum, + pointer blockData, + pointer pTimeout, + pointer pReadmask) + +{ + ScreenPtr pScreen = screenInfo.screens[screenNum]; + /*DRIWrappedFuncsRec *pDRIWrap = DRIGetWrappedFuncs(pScreen);*/ + MGASAREAPtr sa = (MGASAREAPtr)DRIGetSAREAPrivate( pScreen ); + + if (0) ErrorF("MGABlockHandler (out)\n"); + + + /* Examine the cliprects for the most recently used 3d drawable. + * If they've changed, attempt to push the updated values into the + * sarea. + * + * This avoids the protocol round trip in all single-client + * frontbuffer rendering cases providing the cliprects fit into the + * sarea, and in all single-client backbuffer rendering with arbitary + * numbers of cliprects, for all operations except swapbuffers. + * + * Thus the number of round trips in the cases where comparison is + * possible is reduced to no more (and usually fewer) than the number + * Utah requires. + */ + + if (sa->req_drawable != sa->exported_drawable || + sa->exported_stamp != DRIGetDrawableStamp( pScreen, sa->exported_index )) + { + int i; + XF86DRIClipRectPtr frontboxes, backboxes; + XF86DRIClipRectPtr boxes = (XF86DRIClipRectPtr)sa->exported_boxes; + WindowPtr window = LookupIDByType( sa->req_drawable, RT_WINDOW ); + + if (0) + ErrorF("Trying to update req_drawable: %d (exp %d), stamp %d/%d\n", + sa->req_drawable, sa->exported_drawable); + + sa->exported_drawable = 0; + + if (!window) { + if (0) + ErrorF("Couldn't retreive window\n"); + sa->req_drawable = 0; + goto finished; + } + + if (!DRIGetDrawableInfo( pScreen, &(window->drawable), + &sa->exported_index, + &sa->exported_stamp, + &sa->exported_front_x, + &sa->exported_front_y, + &sa->exported_w, + &sa->exported_h, + &sa->exported_nfront, + &frontboxes, + &sa->exported_back_x, + &sa->exported_back_y, + &sa->exported_nback, + &backboxes )) + { + if (0) + ErrorF("Couldn't get DRI info\n"); + sa->req_drawable = 0; + goto finished; + } + + /* If we can't fit both sets of cliprects into the sarea, try to + * fit the current draw buffer. Otherwise return. + */ + + sa->exported_buffers = MGA_FRONT | MGA_BACK; + + if (sa->exported_nback + sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS) { + if (sa->req_draw_buffer == MGA_FRONT) { + sa->exported_buffers = MGA_FRONT; + if (sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS) + goto finished; + } else { + sa->exported_buffers = MGA_BACK; + if (sa->exported_nback >= MGA_NR_SAREA_CLIPRECTS) + goto finished; + } + } + + if (sa->exported_buffers & MGA_BACK) { + for (i = 0 ; i < sa->exported_nback ; i++) + *boxes++ = backboxes[i]; + } + + if (sa->exported_buffers & MGA_FRONT) { + for (i = 0 ; i < sa->exported_nfront ; i++) + *boxes++ = frontboxes[i]; + } + + sa->exported_drawable = sa->req_drawable; + } + + finished: + DRIUnlock(pScreen); +} + + + + +/* Just wrap validate tree for now to remove the quiescense hack. + * This is more of a win for the i810 than the mga, but should be useful + * here too. + */ +void MGADRIWrapFunctions(ScreenPtr pScreen, DRIInfoPtr pDRIInfo) +{ + pDRIInfo->wrap.BlockHandler = MGABlockHandler; + pDRIInfo->wrap.WakeupHandler = MGAWakeupHandler; +/* pDRIInfo->wrap.ValidateTree = NULL; */ +/* pDRIInfo->wrap.PostValidateTree = NULL; */ +} + + diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h index acb04f96e..29fa87a5b 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h @@ -45,8 +45,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. and the kernel-level DRM driver. */ #define R128_NAME "r128" #define R128_VERSION_MAJOR 3 -#define R128_VERSION_MINOR 0 -#define R128_VERSION_PATCH 0 +#define R128_VERSION_MINOR 1 +#define R128_VERSION_PATCH 1 #define R128_VERSION ((R128_VERSION_MAJOR << 16) \ | (R128_VERSION_MINOR << 8) \ | R128_VERSION_PATCH) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c index cb647d6b6..329100c43 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c @@ -970,11 +970,32 @@ static void R128DRICCEInit(ScrnInfoPtr pScrn) create the DRI data structures and initialize the DRI state. */ Bool R128DRIScreenInit(ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - R128InfoPtr pR128 = R128PTR(pScrn); - DRIInfoPtr pDRIInfo; - R128DRIPtr pR128DRI; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + R128InfoPtr pR128 = R128PTR(pScrn); + DRIInfoPtr pDRIInfo; + R128DRIPtr pR128DRI; + int major, minor, patch; + drmVersionPtr version; +#if XFree86LOADER + /* Check that the GLX, DRI, and DRM modules have been loaded by testing + * for known symbols in each module. */ + if (!LoaderSymbol("GlxSetVisualConfigs")) return FALSE; + if (!LoaderSymbol("DRIScreenInit")) return FALSE; + if (!LoaderSymbol("drmAvailable")) return FALSE; +#endif + + /* Check the DRI version */ + DRIQueryVersion(&major, &minor, &patch); + if (major != 3 || minor != 0 || patch < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "R128DRIScreenInit failed " + "(DRI version = %d.%d.%d, expected 3.0.x). " + "Disabling DRI.\n", + major, minor, patch); + return FALSE; + } + switch (pR128->pixel_code) { case 8: /* These modes are not supported (yet). */ @@ -1056,6 +1077,27 @@ Bool R128DRIScreenInit(ScreenPtr pScreen) return FALSE; } + /* Check the r128 DRM version */ + version = drmGetVersion(pR128->drmFD); + if (version) { + if (version->version_major != 1 || + version->version_minor != 0 || + version->version_patchlevel < 0) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "R128DRIScreenInit failed " + "(DRM version = %d.%d.%d, expected 1.0.x). " + "Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + drmFreeVersion(version); + R128DRICloseScreen(pScreen); + return FALSE; + } + drmFreeVersion(version); + } + /* Initialize AGP */ if (!pR128->IsPCI && !R128DRIAgpInit(pR128, pScreen)) { R128DRICloseScreen(pScreen); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h index b1d0fa4d6..23a1d454f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h @@ -25,6 +25,13 @@ #include "tdfx_dripriv.h" #endif +#define TDFX_VERSION 4000 +#define TDFX_NAME "TDFX" +#define TDFX_DRIVER_NAME "tdfx" +#define TDFX_MAJOR_VERSION 1 +#define TDFX_MINOR_VERSION 0 +#define TDFX_PATCHLEVEL 0 + struct _TDFXRec; typedef struct _TDFXRec *TDFXPtr; @@ -37,6 +44,7 @@ typedef struct _TDFXRec *TDFXPtr; extern Bool TDFXInitPrivate(ScreenPtr pScreen); extern void TDFXShutdownPrivate(ScreenPtr pScreen); extern void TDFXSwapContextPrivate(ScreenPtr pScreen); +extern void TDFXLostContext(ScreenPtr pScreen); #ifdef XF86DRI extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI); @@ -218,6 +226,7 @@ extern Bool TDFXDRIFinishScreenInit(ScreenPtr pScreen); extern Bool TDFXDGAInit(ScreenPtr pScreen); extern void TDFXCursorGrabMemory(ScreenPtr pScreen); extern void TDFXSetLFBConfig(TDFXPtr pTDFX); +extern void TDFXSendNOPPrivate(ScrnInfoPtr pScrn); extern Bool TDFXSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); extern void TDFXAdjustFrame(int scrnIndex, int x, int y, int flags); @@ -242,6 +251,9 @@ extern void TDFXSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, extern void TDFXSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h); +extern void TDFXSelectBuffer(TDFXPtr pTDFX, int which); + + #ifndef PROP_3DFX #define DECLARE(a) #define DECLARE_LAUNCH(size, x) diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c index 5cc212cb8..e6db51242 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c @@ -73,8 +73,6 @@ static void TDFXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int skipleft); static void TDFXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); -void TDFXSelectBuffer(TDFXPtr pTDFX, int which); - void TDFXNeedSync(ScrnInfoPtr pScrn) { TDFXPtr pTDFX = TDFXPTR(pScrn); diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c index 37b8152a1..2ef6a606f 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c @@ -4,7 +4,6 @@ #include "xf86_OSproc.h" #include "xf86_ansic.h" #include "xf86Priv.h" - #include "xf86PciInfo.h" #include "xf86Pci.h" #define PSZ 8 @@ -12,11 +11,8 @@ #undef PSZ #include "cfb16.h" #include "cfb32.h" - #include "miline.h" - #include "GL/glxtokens.h" - #include "tdfx.h" #include "tdfx_dri.h" #include "tdfx_dripriv.h" @@ -24,7 +20,6 @@ static char TDFXKernelDriverName[] = "tdfx"; static char TDFXClientDriverName[] = "tdfx"; -static Bool TDFXInitVisualConfigs(ScreenPtr pScreen); static Bool TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore); @@ -145,22 +140,24 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) case 32: numConfigs = 8; - if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), - numConfigs))) { + pConfigs = (__GLXvisualConfig*) xnfcalloc(sizeof(__GLXvisualConfig), numConfigs); + if (!pConfigs) return FALSE; - } - if (!(pTDFXConfigs = (TDFXConfigPrivPtr)xnfcalloc(sizeof(TDFXConfigPrivRec), - numConfigs))) { + + pTDFXConfigs = (TDFXConfigPrivPtr) xnfcalloc(sizeof(TDFXConfigPrivRec), numConfigs); + if (!pTDFXConfigs) { xfree(pConfigs); return FALSE; } - if (!(pTDFXConfigPtrs = (TDFXConfigPrivPtr*)xnfcalloc(sizeof(TDFXConfigPrivPtr), - numConfigs))) { + + pTDFXConfigPtrs = (TDFXConfigPrivPtr *) xnfcalloc(sizeof(TDFXConfigPrivPtr), numConfigs); + if (!pTDFXConfigPtrs) { xfree(pConfigs); xfree(pTDFXConfigs); return FALSE; } - for (i=0; i<numConfigs; i++) + + for (i = 0; i < numConfigs; i++) pTDFXConfigPtrs[i] = &pTDFXConfigs[i]; i=0; @@ -228,7 +225,8 @@ TDFXInitVisualConfigs(ScreenPtr pScreen) } } if (i!=numConfigs) { - ErrorF("Incorrect initialization of visuals\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "Incorrect initialization of visuals\n"); return FALSE; } else ErrorF("Created %d visuals\n", numConfigs); break; @@ -285,8 +283,21 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) if (!LoaderSymbol("drmAvailable")) return FALSE; #endif + /* Check the DRI version */ + { + int major, minor, patch; + DRIQueryVersion(&major, &minor, &patch); + if (major != 3 || minor != 0 || patch < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "TDFXDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", + major, minor, patch); + return FALSE; + } + } + pDRIInfo = DRICreateInfoRec(); - if (!pDRIInfo) return FALSE; + if (!pDRIInfo) + return FALSE; pTDFX->pDRIInfo = pDRIInfo; pDRIInfo->drmDriverName = TDFXKernelDriverName; @@ -296,10 +307,10 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) ((pciConfigPtr)pTDFX->PciInfo->thisCard)->busnum, ((pciConfigPtr)pTDFX->PciInfo->thisCard)->devnum, ((pciConfigPtr)pTDFX->PciInfo->thisCard)->funcnum); - pDRIInfo->ddxDriverMajorVersion = 0; - pDRIInfo->ddxDriverMinorVersion = 1; - pDRIInfo->ddxDriverPatchVersion = 0; - pDRIInfo->frameBufferPhysicalAddress = pTDFX->LinearAddr[0]; + pDRIInfo->ddxDriverMajorVersion = TDFX_MAJOR_VERSION; + pDRIInfo->ddxDriverMinorVersion = TDFX_MINOR_VERSION; + pDRIInfo->ddxDriverPatchVersion = TDFX_PATCHLEVEL; + pDRIInfo->frameBufferPhysicalAddress = pTDFX->LinearAddr; pDRIInfo->frameBufferSize = pTDFX->FbMapSize; pDRIInfo->frameBufferStride = pTDFX->stride; pDRIInfo->ddxDrawableTableEntry = TDFX_MAX_DRAWABLES; @@ -326,7 +337,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) * in the SAREA header */ if (sizeof(XF86DRISAREARec)+sizeof(TDFXSAREAPriv)>SAREA_MAX) { - ErrorF("Data does not fit in SAREA\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "Data does not fit in SAREA\n"); return FALSE; } pDRIInfo->SAREASize = SAREA_MAX; @@ -356,6 +367,27 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen) return FALSE; } + /* Check the TDFX DRM version */ + { + drmVersionPtr version = drmGetVersion(pTDFX->drmSubFD); + if (version) { + if (version->version_major != 1 || + version->version_minor != 0 || + version->version_patchlevel < 0) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "TDFXDRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + TDFXDRICloseScreen(pScreen); + drmFreeVersion(version); + return FALSE; + } + drmFreeVersion(version); + } + } + pTDFXDRI->regsSize=TDFXIOMAPSIZE; if (drmAddMap(pTDFX->drmSubFD, (drmHandle)pTDFX->MMIOAddr[0], pTDFXDRI->regsSize, DRM_REGISTERS, 0, &pTDFXDRI->regs)<0) { diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c index c18e1b9d0..8b0c2dc38 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c @@ -146,17 +146,11 @@ static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagermentMode, int flags); #endif -#define VERSION 4000 -#define TDFX_NAME "TDFX" -#define TDFX_DRIVER_NAME "tdfx" -#define TDFX_MAJOR_VERSION 1 -#define TDFX_MINOR_VERSION 0 -#define TDFX_PATCHLEVEL 0 #define PCI_SUBDEVICE_ID_VOODOO3_2000 0x0036 #define PCI_SUBDEVICE_ID_VOODOO3_3000 0x003a DriverRec TDFX = { - VERSION, + TDFX_VERSION, TDFX_DRIVER_NAME, #if 0 "Accelerated driver for 3dfx cards", @@ -434,7 +428,7 @@ TDFXProbe(DriverPtr drv, int flags) { /* Allocate new ScrnInfoRec and claim the slot */ pScrn = xf86AllocateScreen(drv, 0); - pScrn->driverVersion = VERSION; + pScrn->driverVersion = TDFX_VERSION; pScrn->driverName = TDFX_DRIVER_NAME; pScrn->name = TDFX_NAME; pScrn->Probe = TDFXProbe; @@ -538,7 +532,7 @@ TDFXCountRam(ScrnInfoPtr pScrn) { extern xf86MonPtr ConfiguredMonitor; -void +static void TDFXProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c index a8cffc976..0d09b79dd 100644 --- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c +++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c @@ -27,7 +27,10 @@ void TDFXSendNOPPrivate3D(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - if (!pTDFX->syncDone) return TDFXFirstSync(pScrn); + if (!pTDFX->syncDone) { + TDFXFirstSync(pScrn); + return; + } pTDFX=TDFXPTR(pScrn); TDFXAllocateSlots(pTDFX, 2); SET_3DPK4_HEADER(1, 0x48<<3); @@ -114,7 +117,7 @@ void TDFXResetFifo(ScrnInfoPtr pScrn) !!! We should use expedential backoff in our reads !!! */ -void TDFXSyncFifo(ScrnInfoPtr pScrn) +static void TDFXSyncFifo(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; int i, cnt; @@ -237,7 +240,8 @@ void TDFXSwapContextPrivate(ScreenPtr pScreen) pTDFX->fifoSlots = pTDFX->fifoEnd-pTDFX->fifoPtr-8; } -void TDFXLostContext(ScreenPtr pScreen) { +void TDFXLostContext(ScreenPtr pScreen) +{ ScrnInfoPtr pScrn; TDFXPtr pTDFX; TDFXSAREAPriv *sPriv; @@ -323,7 +327,8 @@ TDFXMakeSpace(TDFXPtr pTDFX, uint32 slots) } void -TDFXAllocateSlots(TDFXPtr pTDFX, int slots) { +TDFXAllocateSlots(TDFXPtr pTDFX, int slots) +{ #ifdef TDFX_DEBUG_FIFO if (pTDFX->fifoEnd-pTDFX->fifoPtr<pTDFX->fifoSlots) ErrorF("FIFO overrun\n"); diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c index b1589b67e..9844d6d90 100644 --- a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c +++ b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c @@ -785,6 +785,8 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86fstat) SYMFUNC(xf86access) SYMFUNC(xf86geteuid) + SYMFUNC(xf86getegid) + SYMFUNC(xf86getpid) SYMFUNC(xf86mknod) SYMFUNC(xf86chmod) SYMFUNC(xf86chown) diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux index 368c3c850..ecc196bdd 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux @@ -1,7 +1,8 @@ # Makefile -- For the Direct Rendering Manager module (drm) # Created: Mon Jan 4 09:26:53 1999 by faith@precisioninsight.com # -# Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. +# Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. +# Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. # All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a @@ -23,8 +24,22 @@ # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. # -# $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux,v 1.6 2000/02/23 04:47:25 martin Exp $ -# +# +# ***** NOTE NOTE NOTE NOTE NOTE ***** +# To override the automatic Linux source tree determination, pass the +# pathname for the kernel that you want to compile on the command line, +# like this: +# make TREE=/usr/my-kernel-tree/include +# +# +# ***** NOTE NOTE NOTE NOTE NOTE ***** +# Because some distributions patch 2.2.x kernels to make kill_fasync have +# three parameters, this script tries to determine, via the examination of +# header files, if your kernel has been patched. If this detection is +# incorrect, you can override the value on the command line, like this: +# make PARAMS=2 +# or +# make PARAMS=3 .SUFFIXES: @@ -96,11 +111,6 @@ endif endif endif -# To override this determination, pass the path on the make command line: -# make TREE=/usr/my-kernel-tree/include -# or hardcode a value for TREE here: -# TREE:=/usr/include - ifeq ($(TREE),0) all:; @echo Error: Could not locate kernel tree in $A $B $C else @@ -110,6 +120,8 @@ MODVERSIONS := $(shell gcc -E -I $(TREE) picker.c 2>/dev/null \ | grep -s 'MODVERSIONS = ' | cut -d' ' -f3) AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \ | grep -s 'AGP = ' | cut -d' ' -f3) +PARAMS := $(shell if fgrep kill_fasync $(TREE)/linux/fs.h \ + | fgrep -q band; then echo 3; else echo 2; fi) ifeq ($(AGP),0) AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \ | grep -s 'AGP_MODULE = ' | cut -d' ' -f3) @@ -127,8 +139,9 @@ I810OBJS= i810_drv.o i810_dma.o i810_bufs.o i810_context.o I810HEADERS= i810_drv.h $(DRMHEADERS) endif -all::;@echo KERNEL HEADERS IN $(TREE): SMP=${SMP} MODVERSIONS=${MODVERSIONS} \ - AGP=${AGP} +all::;@echo === KERNEL HEADERS IN $(TREE) +all::;@echo === SMP=${SMP} MODVERSIONS=${MODVERSIONS} AGP=${AGP} +all::;@echo === kill_fasync has $(PARAMS) parameters all:: $(LIBS) $(MODS) $(PROGS) endif @@ -141,7 +154,9 @@ endif ifeq ($(MODVERSIONS),1) MODCFLAGS += -DMODVERSIONS -include $(TREE)/linux/modversions.h endif - +ifeq ($(PARAMS),3) +MODCFLAGS += -DKILLFASYNCHASTHREEPARAMETERS +endif # **** End of configuration @@ -178,7 +193,7 @@ ChangeLog: # .o files are used for modules %.o: %.c - $(CC) $(MODCFLAGS) -c $< -o $@ + $(CC) $(MODCFLAGS) -I$(TREE) -c $< -o $@ %.po: %.c $(CC) $(PRGCFLAGS) -DDRM_USE_MALLOC -c $< -o $@ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c index 14fb8b53f..c89c3e258 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c @@ -2,6 +2,7 @@ * Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,9 +24,7 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Author: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c,v 1.1 2000/02/11 17:26:02 dawes Exp $ + * Author: Rickard E. (Rik) Faith <faith@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c index 0e3b1c565..b133bc506 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c @@ -1,8 +1,8 @@ /* auth.c -- IOCTLs for authentication -*- linux-c -*- * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 11:31:48 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c,v 1.2 2000/02/23 04:47:25 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -44,7 +45,6 @@ static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) down(&dev->struct_sem); for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { - if (pt->priv->authenticated) continue; if (pt->magic == magic) { retval = pt->priv; break; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c index 85244c7dc..011e42410 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c @@ -1,8 +1,8 @@ /* bufs.c -- IOCTLs to manage buffers -*- linux-c -*- * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * Revised: Mon Feb 14 00:14:11 2000 by kevin@precisioninsight.com * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,11 +24,13 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c,v 1.5 2000/02/23 04:47:25 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ #define __NO_VERSION__ +#include <linux/config.h> #include "drmP.h" #include "linux/un.h" @@ -102,6 +104,11 @@ int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd, dev->lock.hw_lock = map->handle; /* Pointer to lock */ } break; +#ifdef DRM_AGP + case _DRM_AGP: + map->offset = map->offset + dev->agp->base; + break; +#endif default: drm_free(map, sizeof(*map), DRM_MEM_MAPS); return -EINVAL; @@ -172,7 +179,7 @@ int drm_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; if (dev->queue_count) return -EBUSY; /* Not while in use */ - alignment = (request.flags & DRM_PAGE_ALIGN) ? PAGE_ALIGN(size) :size; + alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size):size; page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; total = PAGE_SIZE << page_order; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c index fdf8fd9f1..ca491094e 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c @@ -1,8 +1,8 @@ /* context.c -- IOCTLs for contexts and DMA queues -*- linux-c -*- * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 11:32:09 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c,v 1.2 2000/02/23 04:47:26 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c index f67209d44..615505979 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c @@ -1,7 +1,8 @@ /* ctxbitmap.c -- Context bitmap management -*- linux-c -*- * Created: Thu Jan 6 03:56:42 2000 by jhartmann@precisioninsight.com * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,9 +24,7 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Author: Jeff Hartmann <jhartmann@precisioninsight.com> - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c,v 1.1 2000/02/11 17:26:02 dawes Exp $ + * Author: Jeff Hartmann <jhartmann@valinux.com> * */ @@ -53,7 +52,7 @@ int drm_ctxbitmap_next(drm_device_t *dev) bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP); if (bit < DRM_MAX_CTXBITMAP) { set_bit(bit, dev->ctx_bitmap); - printk("drm_ctxbitmap_next bit : %d\n", bit); + DRM_DEBUG("drm_ctxbitmap_next bit : %d\n", bit); return bit; } return -1; @@ -64,15 +63,15 @@ int drm_ctxbitmap_init(drm_device_t *dev) int i; int temp; - dev->ctx_bitmap = (unsigned long *) drm_alloc(PAGE_SIZE * 4, + dev->ctx_bitmap = (unsigned long *) drm_alloc(PAGE_SIZE, DRM_MEM_CTXBITMAP); if(dev->ctx_bitmap == NULL) { return -ENOMEM; } - memset((void *) dev->ctx_bitmap, 0, PAGE_SIZE * 4); + memset((void *) dev->ctx_bitmap, 0, PAGE_SIZE); for(i = 0; i < DRM_RESERVED_CONTEXTS; i++) { temp = drm_ctxbitmap_next(dev); - printk("drm_ctxbitmap_init : %d\n", temp); + DRM_DEBUG("drm_ctxbitmap_init : %d\n", temp); } return 0; @@ -80,7 +79,7 @@ int drm_ctxbitmap_init(drm_device_t *dev) void drm_ctxbitmap_cleanup(drm_device_t *dev) { - drm_free((void *)dev->ctx_bitmap, PAGE_SIZE * 4, + drm_free((void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c index 8291e52e4..ac2d1bc5a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c @@ -1,8 +1,8 @@ /* dma.c -- DMA IOCTL and function support -*- linux-c -*- * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com - * Revised: Sun Feb 13 23:19:45 2000 by kevin@precisioninsight.com * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c,v 1.5 2000/02/23 04:47:26 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinuxa.com> * */ @@ -63,15 +64,24 @@ void drm_dma_takedown(drm_device_t *dev) dma->bufs[i].page_order, DRM_MEM_DMA); } - drm_free(dma->bufs[i].buflist, - dma->buf_count - * sizeof(*dma->bufs[0].buflist), - DRM_MEM_BUFS); drm_free(dma->bufs[i].seglist, - dma->buf_count + dma->bufs[i].seg_count * sizeof(*dma->bufs[0].seglist), DRM_MEM_SEGS); - drm_freelist_destroy(&dma->bufs[i].freelist); + } + if(dma->bufs[i].buf_count) { + for(j = 0; j < dma->bufs[i].buf_count; j++) { + if(dma->bufs[i].buflist[j].dev_private) { + drm_free(dma->bufs[i].buflist[j].dev_private, + dma->bufs[i].buflist[j].dev_priv_size, + DRM_MEM_BUFS); + } + } + drm_free(dma->bufs[i].buflist, + dma->bufs[i].buf_count * + sizeof(*dma->bufs[0].buflist), + DRM_MEM_BUFS); + drm_freelist_destroy(&dma->bufs[i].freelist); } } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c index c7acecb97..03839f5be 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c @@ -1,8 +1,8 @@ /* drawable.c -- IOCTLs for drawables -*- linux-c -*- * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 09:27:03 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c,v 1.2 2000/02/23 04:47:26 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h index c63d0f637..c8c5581da 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h @@ -1,7 +1,8 @@ /* drm.h -- Header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -22,8 +23,9 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.5 2000/02/23 04:47:26 martin Exp $ + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * * Acknowledgements: * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg. diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h index 43670e28a..350d1ef9b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h @@ -1,7 +1,8 @@ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.6 2000/02/23 04:47:27 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -528,6 +530,7 @@ typedef struct drm_device { /* Misc. support (init.c) */ extern int drm_flags; extern void drm_parse_options(char *s); +extern int drm_cpu_valid(void); /* Device support (fops.c) */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c index 8fe6f7072..8c691c49b 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c @@ -1,8 +1,8 @@ /* drmstat.c -- DRM device status and testing program * Created: Tue Jan 5 08:19:24 1999 by faith@precisioninsight.com - * Revised: Sun Feb 13 23:35:00 2000 by kevin@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,7 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmstat.c,v 1.6 2000/02/23 04:47:27 martin Exp $ + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -187,7 +187,7 @@ int main(int argc, char **argv) case 'b': count = strtoul(optarg, &pt, 0); size = strtoul(pt+1, NULL, 0); - if ((r = drmAddBufs(fd, count, size, 0)) < 0) { + if ((r = drmAddBufs(fd, count, size, 0, 65536)) < 0) { drmError(r, argv[0]); return 1; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c index 2a064e5df..1eb2bdac7 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c @@ -1,8 +1,8 @@ /* fops.c -- File operations for DRM -*- linux-c -*- * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * Revised: Fri Dec 3 10:26:26 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,8 +23,10 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c,v 1.6 2000/02/23 04:47:27 martin Exp $ + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Daryll Strauss <daryll@valinux.com> * */ @@ -40,6 +42,7 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev) drm_file_t *priv; if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */ + if (!drm_cpu_valid()) return -EINVAL; DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); @@ -211,10 +214,15 @@ int drm_write_string(drm_device_t *dev, const char *s) send -= count; } -#if LINUX_VERSION_CODE < 0x020315 +#if LINUX_VERSION_CODE < 0x020315 && !defined(KILLFASYNCHASTHREEPARAMETERS) + /* The extra parameter to kill_fasync was added in 2.3.21, and is + _not_ present in _stock_ 2.2.14 and 2.2.15. However, some + distributions patch 2.2.x kernels to add this parameter. The + Makefile.linux attempts to detect this addition and defines + KILLFASYNCHASTHREEPARAMETERS if three parameters are found. */ if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO); #else - /* Parameter added in 2.3.21 */ + /* Parameter added in 2.3.21 */ if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN); #endif DRM_DEBUG("waking\n"); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c index 444f25efb..eb78c0374 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c @@ -1,8 +1,8 @@ /* gamma_dma.c -- DMA support for GMX 2000 -*- linux-c -*- * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com - * Revised: Thu Sep 16 12:55:37 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,8 +23,9 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c,v 1.2 2000/02/23 04:47:28 martin Exp $ + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c index 875952443..d42cf4aea 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c @@ -1,8 +1,8 @@ /* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*- * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * Revised: Tue Oct 12 08:51:36 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c,v 1.4 2000/02/23 04:47:28 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -38,9 +39,9 @@ EXPORT_SYMBOL(gamma_cleanup); #define GAMMA_NAME "gamma" #define GAMMA_DESC "3dlabs GMX 2000" #define GAMMA_DATE "19990830" -#define GAMMA_MAJOR 0 +#define GAMMA_MAJOR 1 #define GAMMA_MINOR 0 -#define GAMMA_PATCHLEVEL 5 +#define GAMMA_PATCHLEVEL 0 static drm_device_t gamma_device; @@ -125,7 +126,7 @@ void cleanup_module(void) #ifndef MODULE /* gamma_setup is called by the kernel to parse command-line options passed * via the boot-loader (e.g., LILO). It calls the insmod option routine, - * drm_parse_drm. + * drm_parse_options. * * This is not currently supported, since it requires changes to * linux/init/main.c. */ @@ -275,10 +276,12 @@ static int gamma_takedown(drm_device_t *dev) - PAGE_SHIFT, DRM_MEM_SAREA); break; +#ifdef DRM_AGP case _DRM_AGP: /* Do nothing here, because this is all handled in the AGP/GART driver. */ break; +#endif } drm_free(map, sizeof(*map), DRM_MEM_MAPS); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h index 3d5b5dec1..55dc26bec 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h @@ -1,8 +1,8 @@ /* gamma_drv.h -- Private header for 3dlabs GMX 2000 driver -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 09:24:27 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,8 +24,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h,v 1.2 2000/02/23 04:47:28 martin Exp $ - * */ #ifndef _GAMMA_DRV_H_ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c index 9737ae92d..fa1f84dcd 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c @@ -2,6 +2,7 @@ * Created: Thu Jan 6 01:47:26 2000 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,11 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * Jeff Hartmann <jhartmann@precisioninsight.com> + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c,v 1.1 2000/02/11 17:26:04 dawes Exp $ - * */ #define __NO_VERSION__ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_context.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_context.c new file mode 100644 index 000000000..689814db5 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_context.c @@ -0,0 +1,205 @@ +/* i810_context.c -- IOCTLs for i810 contexts -*- linux-c -*- + * Created: Mon Dec 13 09:51:35 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * + */ + +#include <linux/sched.h> + +#define __NO_VERSION__ +#include "drmP.h" +#include "i810_drv.h" + +static int i810_alloc_queue(drm_device_t *dev) +{ + int temp = drm_ctxbitmap_next(dev); + DRM_DEBUG("i810_alloc_queue: %d\n", temp); + return temp; +} + +int i810_context_switch(drm_device_t *dev, int old, int new) +{ + char buf[64]; + + atomic_inc(&dev->total_ctx); + + if (test_and_set_bit(0, &dev->context_flag)) { + DRM_ERROR("Reentering -- FIXME\n"); + return -EBUSY; + } + +#if DRM_DMA_HISTOGRAM + dev->ctx_start = get_cycles(); +#endif + + DRM_DEBUG("Context switch from %d to %d\n", old, new); + + if (new == dev->last_context) { + clear_bit(0, &dev->context_flag); + return 0; + } + + if (drm_flags & DRM_FLAG_NOCTX) { + i810_context_switch_complete(dev, new); + } else { + sprintf(buf, "C %d %d\n", old, new); + drm_write_string(dev, buf); + } + + return 0; +} + +int i810_context_switch_complete(drm_device_t *dev, int new) +{ + dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ + dev->last_switch = jiffies; + + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("Lock isn't held after context switch\n"); + } + + /* If a context switch is ever initiated + when the kernel holds the lock, release + that lock here. */ +#if DRM_DMA_HISTOGRAM + atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() + - dev->ctx_start)]); + +#endif + clear_bit(0, &dev->context_flag); + wake_up(&dev->context_wait); + + return 0; +} + +int i810_resctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_res_t res; + drm_ctx_t ctx; + int i; + + DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); + copy_from_user_ret(&res, (drm_ctx_res_t *)arg, sizeof(res), -EFAULT); + if (res.count >= DRM_RESERVED_CONTEXTS) { + memset(&ctx, 0, sizeof(ctx)); + for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { + ctx.handle = i; + copy_to_user_ret(&res.contexts[i], + &i, + sizeof(i), + -EFAULT); + } + } + res.count = DRM_RESERVED_CONTEXTS; + copy_to_user_ret((drm_ctx_res_t *)arg, &res, sizeof(res), -EFAULT); + return 0; +} + +int i810_addctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + if ((ctx.handle = i810_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { + /* Skip kernel's context and get a new one. */ + ctx.handle = i810_alloc_queue(dev); + } + if (ctx.handle == -1) { + DRM_DEBUG("Not enough free contexts.\n"); + /* Should this return -EBUSY instead? */ + return -ENOMEM; + } + DRM_DEBUG("%d\n", ctx.handle); + copy_to_user_ret((drm_ctx_t *)arg, &ctx, sizeof(ctx), -EFAULT); + return 0; +} + +int i810_modctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + /* This does nothing for the i810 */ + return 0; +} + +int i810_getctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t*)arg, sizeof(ctx), -EFAULT); + /* This is 0, because we don't hanlde any context flags */ + ctx.flags = 0; + copy_to_user_ret((drm_ctx_t*)arg, &ctx, sizeof(ctx), -EFAULT); + return 0; +} + +int i810_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + DRM_DEBUG("%d\n", ctx.handle); + return i810_context_switch(dev, dev->last_context, ctx.handle); +} + +int i810_newctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + DRM_DEBUG("%d\n", ctx.handle); + i810_context_switch_complete(dev, ctx.handle); + + return 0; +} + +int i810_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); + DRM_DEBUG("%d\n", ctx.handle); + if(ctx.handle != DRM_KERNEL_CONTEXT) { + drm_ctxbitmap_free(dev, ctx.handle); + } + + return 0; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c index 2380a434c..94f35b61c 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c @@ -2,6 +2,7 @@ * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,11 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * Jeff Hartmann <jhartmann@precisioninsight.com> - * Keith Whitwell <keithw@precisioninsight.com> - * - * $XFree86$ + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keithw@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c index 75b402daa..b523db902 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c @@ -2,6 +2,7 @@ * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,10 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * Jeff Hartmann <jhartmann@precisioninsight.com> - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c,v 1.1 2000/02/11 17:26:05 dawes Exp $ + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> * */ @@ -41,9 +40,9 @@ EXPORT_SYMBOL(i810_cleanup); #define I810_NAME "i810" #define I810_DESC "Intel I810" #define I810_DATE "19991213" -#define I810_MAJOR 0 +#define I810_MAJOR 1 #define I810_MINOR 0 -#define I810_PATCHLEVEL 1 +#define I810_PATCHLEVEL 0 static drm_device_t i810_device; drm_ctx_t i810_res_ctx; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h index 334cacb2a..c387bf727 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h @@ -2,6 +2,7 @@ * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,10 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * Jeff Hartmann <jhartmann@precisioninsight.com> + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h,v 1.1 2000/02/11 17:26:05 dawes Exp $ */ #ifndef _I810_DRV_H_ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c index 25c0aed22..aefc884eb 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c @@ -1,8 +1,8 @@ /* init.c -- Setup/Cleanup for DRM -*- linux-c -*- * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 09:27:02 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c,v 1.2 2000/02/23 04:47:29 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -34,7 +35,7 @@ int drm_flags = 0; /* drm_parse_option parses a single option. See description for - drm_parse_drm for details. */ + drm_parse_options for details. */ static void drm_parse_option(char *s) { @@ -96,3 +97,10 @@ void drm_parse_options(char *s) } } +int drm_cpu_valid(void) +{ +#if defined(__i386__) + if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */ +#endif + return 1; +} diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c index 8edfb4374..b246f76e5 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c @@ -1,8 +1,8 @@ /* ioctl.c -- IOCTL processing for DRM -*- linux-c -*- * Created: Fri Jan 8 09:01:26 1999 by faith@precisioninsight.com - * Revised: Fri Aug 20 09:27:02 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c,v 1.2 2000/02/23 04:47:29 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c index af8f6150a..f62495aa2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c @@ -1,8 +1,8 @@ /* lists.c -- Buffer list handling routines -*- linux-c -*- * Created: Mon Apr 19 20:54:22 1999 by faith@precisioninsight.com - * Revised: Sun Feb 13 23:37:52 2000 by kevin@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c,v 1.6 2000/02/23 04:56:42 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c index adf27ab5d..550827278 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c @@ -1,8 +1,8 @@ /* lock.c -- IOCTLs for locking -*- linux-c -*- * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * Revised: Sun Feb 13 23:38:25 2000 by kevin@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c,v 1.5 2000/02/23 04:47:29 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c index a8a81abd8..0e92401bb 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c @@ -1,8 +1,8 @@ /* memory.c -- Memory management wrappers for DRM -*- linux-c -*- * Created: Thu Feb 4 14:00:34 1999 by faith@precisioninsight.com - * Revised: Sun Feb 13 23:39:37 2000 by kevin@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c,v 1.5 2000/02/23 04:47:30 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ @@ -44,21 +45,25 @@ static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED; static unsigned long drm_ram_available = 0; /* In pages */ static unsigned long drm_ram_used = 0; static drm_mem_stats_t drm_mem_stats[] = { - [DRM_MEM_DMA] = { "dmabufs" }, - [DRM_MEM_SAREA] = { "sareas" }, - [DRM_MEM_DRIVER] = { "driver" }, - [DRM_MEM_MAGIC] = { "magic" }, - [DRM_MEM_IOCTLS] = { "ioctltab" }, - [DRM_MEM_MAPS] = { "maplist" }, - [DRM_MEM_VMAS] = { "vmalist" }, - [DRM_MEM_BUFS] = { "buflist" }, - [DRM_MEM_SEGS] = { "seglist" }, - [DRM_MEM_PAGES] = { "pagelist" }, - [DRM_MEM_FILES] = { "files" }, - [DRM_MEM_QUEUES] = { "queues" }, - [DRM_MEM_CMDS] = { "commands" }, - [DRM_MEM_MAPPINGS] = { "mappings" }, - [DRM_MEM_BUFLISTS] = { "buflists" }, + [DRM_MEM_DMA] = { "dmabufs" }, + [DRM_MEM_SAREA] = { "sareas" }, + [DRM_MEM_DRIVER] = { "driver" }, + [DRM_MEM_MAGIC] = { "magic" }, + [DRM_MEM_IOCTLS] = { "ioctltab" }, + [DRM_MEM_MAPS] = { "maplist" }, + [DRM_MEM_VMAS] = { "vmalist" }, + [DRM_MEM_BUFS] = { "buflist" }, + [DRM_MEM_SEGS] = { "seglist" }, + [DRM_MEM_PAGES] = { "pagelist" }, + [DRM_MEM_FILES] = { "files" }, + [DRM_MEM_QUEUES] = { "queues" }, + [DRM_MEM_CMDS] = { "commands" }, + [DRM_MEM_MAPPINGS] = { "mappings" }, + [DRM_MEM_BUFLISTS] = { "buflists" }, + [DRM_MEM_AGPLISTS] = { "agplist" }, + [DRM_MEM_TOTALAGP] = { "totalagp" }, + [DRM_MEM_BOUNDAGP] = { "boundagp" }, + [DRM_MEM_CTXBITMAP] = { "ctxbitmap"}, { NULL, 0, } /* Last entry must be null */ }; @@ -324,3 +329,120 @@ void drm_ioremapfree(void *pt, unsigned long size) free_count, alloc_count); } } + +#ifdef DRM_AGP +agp_memory *drm_alloc_agp(int pages, u32 type) +{ + agp_memory *handle; + + if (!pages) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n"); + return NULL; + } + + if (drm_agp.allocate_memory) { + if ((handle = (*drm_agp.allocate_memory)(pages, + type))) { + spin_lock(&drm_mem_lock); + ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; + drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated + += pages << PAGE_SHIFT; + spin_unlock(&drm_mem_lock); + return handle; + } + } + spin_lock(&drm_mem_lock); + ++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count; + spin_unlock(&drm_mem_lock); + return NULL; +} + +int drm_free_agp(agp_memory *handle, int pages) +{ + int alloc_count; + int free_count; + int retval = -EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, + "Attempt to free NULL AGP handle\n"); + return retval;; + } + + if (drm_agp.free_memory) { + (*drm_agp.free_memory)(handle); + spin_lock(&drm_mem_lock); + free_count = ++drm_mem_stats[DRM_MEM_TOTALAGP].free_count; + alloc_count = drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; + drm_mem_stats[DRM_MEM_TOTALAGP].bytes_freed + += pages << PAGE_SHIFT; + spin_unlock(&drm_mem_lock); + if (free_count > alloc_count) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } + return 0; + } + return retval; +} + +int drm_bind_agp(agp_memory *handle, unsigned int start) +{ + int retcode = -EINVAL; + + DRM_DEBUG("drm_bind_agp called\n"); + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Attempt to bind NULL AGP handle\n"); + return retcode; + } + + DRM_DEBUG("drm_agp.bind_memory : %p\n", drm_agp.bind_memory); + if (drm_agp.bind_memory) { + if (!(retcode = (*drm_agp.bind_memory)(handle, start))) { + spin_lock(&drm_mem_lock); + ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; + drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated + += handle->page_count << PAGE_SHIFT; + spin_unlock(&drm_mem_lock); + DRM_DEBUG("drm_agp.bind_memory: retcode %d\n", retcode); + return retcode; + } + } + spin_lock(&drm_mem_lock); + ++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count; + spin_unlock(&drm_mem_lock); + return retcode; +} + +int drm_unbind_agp(agp_memory *handle) +{ + int alloc_count; + int free_count; + int retcode = -EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Attempt to unbind NULL AGP handle\n"); + return retcode; + } + + if (drm_agp.unbind_memory) { + int c = handle->page_count; + if ((retcode = (*drm_agp.unbind_memory)(handle))) + return retcode; + spin_lock(&drm_mem_lock); + free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count; + alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; + drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed += c << PAGE_SHIFT; + spin_unlock(&drm_mem_lock); + if (free_count > alloc_count) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } + } + return retcode; +} +#endif diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c index 34f1112a6..b97eb4959 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c @@ -2,6 +2,7 @@ * Created: Thu Jan 6 01:47:26 2000 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,179 +24,176 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * Jeff Hartmann <jhartmann@precisioninsight.com> - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c,v 1.1 2000/02/11 17:26:06 dawes Exp $ + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> * */ #define __NO_VERSION__ #include "drmP.h" #include "mga_drv.h" -#include "mga_dma.h" #include "linux/un.h" int mga_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - drm_buf_entry_t *entry; - drm_buf_t *buf; - unsigned long offset; - unsigned long agp_offset; - int count; - int order; - int size; - int alignment; - int page_order; - int total; - int byte_count; - int i; - - if (!dma) return -EINVAL; - - copy_from_user_ret(&request, - (drm_buf_desc_t *)arg, - sizeof(request), - -EFAULT); - - count = request.count; - order = drm_order(request.size); - size = 1 << order; - agp_offset = request.agp_start; - alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size) :size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - byte_count = 0; - - DRM_DEBUG("count: %d\n", count); - DRM_DEBUG("order: %d\n", order); - DRM_DEBUG("size: %d\n", size); - DRM_DEBUG("agp_offset: %d\n", agp_offset); - DRM_DEBUG("alignment: %d\n", alignment); - DRM_DEBUG("page_order: %d\n", page_order); - DRM_DEBUG("total: %d\n", total); - DRM_DEBUG("byte_count: %d\n", byte_count); - - if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; - if (dev->queue_count) return -EBUSY; /* Not while in use */ - spin_lock(&dev->count_lock); - if (dev->buf_use) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - atomic_inc(&dev->buf_alloc); - spin_unlock(&dev->count_lock); + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + drm_buf_entry_t *entry; + drm_buf_t *buf; + unsigned long offset; + unsigned long agp_offset; + int count; + int order; + int size; + int alignment; + int page_order; + int total; + int byte_count; + int i; + + if (!dma) return -EINVAL; + + copy_from_user_ret(&request, + (drm_buf_desc_t *)arg, + sizeof(request), + -EFAULT); + + count = request.count; + order = drm_order(request.size); + size = 1 << order; + agp_offset = request.agp_start; + alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size) :size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + byte_count = 0; + + DRM_DEBUG("count: %d\n", count); + DRM_DEBUG("order: %d\n", order); + DRM_DEBUG("size: %d\n", size); + DRM_DEBUG("agp_offset: %ld\n", agp_offset); + DRM_DEBUG("alignment: %d\n", alignment); + DRM_DEBUG("page_order: %d\n", page_order); + DRM_DEBUG("total: %d\n", total); + DRM_DEBUG("byte_count: %d\n", byte_count); + + if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; + if (dev->queue_count) return -EBUSY; /* Not while in use */ + spin_lock(&dev->count_lock); + if (dev->buf_use) { + spin_unlock(&dev->count_lock); + return -EBUSY; + } + atomic_inc(&dev->buf_alloc); + spin_unlock(&dev->count_lock); - down(&dev->struct_sem); - entry = &dma->bufs[order]; - if (entry->buf_count) { - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; /* May only call once for each order */ - } + down(&dev->struct_sem); + entry = &dma->bufs[order]; + if (entry->buf_count) { + up(&dev->struct_sem); + atomic_dec(&dev->buf_alloc); + return -ENOMEM; /* May only call once for each order */ + } - entry->buflist = drm_alloc(count * sizeof(*entry->buflist), - DRM_MEM_BUFS); - if (!entry->buflist) { - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; - } - memset(entry->buflist, 0, count * sizeof(*entry->buflist)); + entry->buflist = drm_alloc(count * sizeof(*entry->buflist), + DRM_MEM_BUFS); + if (!entry->buflist) { + up(&dev->struct_sem); + atomic_dec(&dev->buf_alloc); + return -ENOMEM; + } + memset(entry->buflist, 0, count * sizeof(*entry->buflist)); - entry->buf_size = size; - entry->page_order = page_order; - offset = 0; + entry->buf_size = size; + entry->page_order = page_order; + offset = 0; - while(entry->buf_count < count) { - buf = &entry->buflist[entry->buf_count]; - buf->idx = dma->buf_count + entry->buf_count; - buf->total = alignment; - buf->order = order; - buf->used = 0; - - DRM_DEBUG("offset : %d\n", offset); - - buf->offset = offset; /* Hrm */ - buf->bus_address = dev->agp->base + agp_offset + offset; - buf->address = (void *)(agp_offset + offset + dev->agp->base); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - init_waitqueue_head(&buf->dma_wait); - buf->pid = 0; - - buf->dev_private = drm_alloc(sizeof(drm_mga_buf_priv_t), DRM_MEM_BUFS); - buf->dev_priv_size = sizeof(drm_mga_buf_priv_t); + while(entry->buf_count < count) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + + DRM_DEBUG("offset : %ld\n", offset); + + buf->offset = offset; /* Hrm */ + buf->bus_address = dev->agp->base + agp_offset + offset; + buf->address = (void *)(agp_offset + offset + dev->agp->base); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head(&buf->dma_wait); + buf->pid = 0; + + buf->dev_private = drm_alloc(sizeof(drm_mga_buf_priv_t), DRM_MEM_BUFS); + buf->dev_priv_size = sizeof(drm_mga_buf_priv_t); #if DRM_DMA_HISTOGRAM - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; + buf->time_queued = 0; + buf->time_dispatched = 0; + buf->time_completed = 0; + buf->time_freed = 0; #endif - offset = offset + alignment; - entry->buf_count++; - byte_count += PAGE_SIZE << page_order; + offset = offset + alignment; + entry->buf_count++; + byte_count += PAGE_SIZE << page_order; - DRM_DEBUG("buffer %d @ %p\n", - entry->buf_count, buf->address); - } + DRM_DEBUG("buffer %d @ %p\n", + entry->buf_count, buf->address); + } - dma->buflist = drm_realloc(dma->buflist, - dma->buf_count * sizeof(*dma->buflist), - (dma->buf_count + entry->buf_count) - * sizeof(*dma->buflist), - DRM_MEM_BUFS); - for (i = dma->buf_count; i < dma->buf_count + entry->buf_count; i++) - dma->buflist[i] = &entry->buflist[i - dma->buf_count]; + dma->buflist = drm_realloc(dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS); + for (i = dma->buf_count; i < dma->buf_count + entry->buf_count; i++) + dma->buflist[i] = &entry->buflist[i - dma->buf_count]; - dma->buf_count += entry->buf_count; + dma->buf_count += entry->buf_count; - DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); + DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); - dma->byte_count += byte_count; + dma->byte_count += byte_count; - DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); + DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); - drm_freelist_create(&entry->freelist, entry->buf_count); - for (i = 0; i < entry->buf_count; i++) { - drm_freelist_put(dev, &entry->freelist, &entry->buflist[i]); - } + drm_freelist_create(&entry->freelist, entry->buf_count); + for (i = 0; i < entry->buf_count; i++) { + drm_freelist_put(dev, &entry->freelist, &entry->buflist[i]); + } - up(&dev->struct_sem); + up(&dev->struct_sem); - request.count = entry->buf_count; - request.size = size; + request.count = entry->buf_count; + request.size = size; - copy_to_user_ret((drm_buf_desc_t *)arg, - &request, - sizeof(request), - -EFAULT); + copy_to_user_ret((drm_buf_desc_t *)arg, + &request, + sizeof(request), + -EFAULT); - atomic_dec(&dev->buf_alloc); + atomic_dec(&dev->buf_alloc); - DRM_DEBUG("count: %d\n", count); - DRM_DEBUG("order: %d\n", order); - DRM_DEBUG("size: %d\n", size); - DRM_DEBUG("agp_offset: %d\n", agp_offset); - DRM_DEBUG("alignment: %d\n", alignment); - DRM_DEBUG("page_order: %d\n", page_order); - DRM_DEBUG("total: %d\n", total); - DRM_DEBUG("byte_count: %d\n", byte_count); + DRM_DEBUG("count: %d\n", count); + DRM_DEBUG("order: %d\n", order); + DRM_DEBUG("size: %d\n", size); + DRM_DEBUG("agp_offset: %ld\n", agp_offset); + DRM_DEBUG("alignment: %d\n", alignment); + DRM_DEBUG("page_order: %d\n", page_order); + DRM_DEBUG("total: %d\n", total); + DRM_DEBUG("byte_count: %d\n", byte_count); - dma->flags = _DRM_DMA_USE_AGP; + dma->flags = _DRM_DMA_USE_AGP; - DRM_DEBUG("dma->flags : %lx\n", dma->flags); + DRM_DEBUG("dma->flags : %x\n", dma->flags); - return 0; + return 0; } int mga_addbufs_pci(struct inode *inode, struct file *filp, unsigned int cmd, @@ -362,17 +360,17 @@ int mga_addbufs_pci(struct inode *inode, struct file *filp, unsigned int cmd, int mga_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - drm_buf_desc_t request; + drm_buf_desc_t request; - copy_from_user_ret(&request, - (drm_buf_desc_t *)arg, - sizeof(request), - -EFAULT); + copy_from_user_ret(&request, + (drm_buf_desc_t *)arg, + sizeof(request), + -EFAULT); - if(request.flags & _DRM_AGP_BUFFER) - return mga_addbufs_agp(inode, filp, cmd, arg); - else - return mga_addbufs_pci(inode, filp, cmd, arg); + if(request.flags & _DRM_AGP_BUFFER) + return mga_addbufs_agp(inode, filp, cmd, arg); + else + return mga_addbufs_pci(inode, filp, cmd, arg); } int mga_infobufs(struct inode *inode, struct file *filp, unsigned int cmd, @@ -546,7 +544,7 @@ int mga_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, spin_lock(&dev->count_lock); if (atomic_read(&dev->buf_alloc)) { spin_unlock(&dev->count_lock); - DRM_DEBUG("Buzy\n"); + DRM_DEBUG("Busy\n"); return -EBUSY; } ++dev->buf_use; /* Can't allocate more after this call */ @@ -558,79 +556,84 @@ int mga_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, -EFAULT); DRM_DEBUG("mga_mapbufs\n"); - DRM_DEBUG("dma->flags : %lx\n", dma->flags); + DRM_DEBUG("dma->flags : %x\n", dma->flags); - if (request.count >= dma->buf_count) { - if(dma->flags & _DRM_DMA_USE_AGP) { - drm_mga_private_t *dev_priv = dev->dev_private; - drm_map_t *map = NULL; + if (request.count >= dma->buf_count) { + if(dma->flags & _DRM_DMA_USE_AGP) { + drm_mga_private_t *dev_priv = dev->dev_private; + drm_map_t *map = NULL; - map = dev->maplist[dev_priv->buffer_map_idx]; - if (!map) { - DRM_DEBUG("map is null\n"); - retcode = -EINVAL; - goto done; - } - - DRM_DEBUG("map->offset : %lx\n", map->offset); - DRM_DEBUG("map->size : %lx\n", map->size); - DRM_DEBUG("map->type : %d\n", map->type); - DRM_DEBUG("map->flags : %x\n", map->flags); - DRM_DEBUG("map->handle : %lx\n", map->handle); - DRM_DEBUG("map->mtrr : %d\n", map->mtrr); - - virtual = do_mmap(filp, 0, map->size, PROT_READ|PROT_WRITE, - MAP_SHARED, (unsigned long)map->offset); - } else { - virtual = do_mmap(filp, 0, dma->byte_count, - PROT_READ|PROT_WRITE, MAP_SHARED, 0); - } - if (virtual > -1024UL) { - /* Real error */ - DRM_DEBUG("mmap error\n"); - retcode = (signed long)virtual; - goto done; - } - request.virtual = (void *)virtual; + map = dev->maplist[dev_priv->buffer_map_idx]; + if (!map) { + DRM_DEBUG("map is null\n"); + retcode = -EINVAL; + goto done; + } + + DRM_DEBUG("map->offset : %lx\n", map->offset); + DRM_DEBUG("map->size : %lx\n", map->size); + DRM_DEBUG("map->type : %d\n", map->type); + DRM_DEBUG("map->flags : %x\n", map->flags); + DRM_DEBUG("map->handle : %p\n", map->handle); + DRM_DEBUG("map->mtrr : %d\n", map->mtrr); + down(¤t->mm->mmap_sem); + virtual = do_mmap(filp, 0, map->size, + PROT_READ|PROT_WRITE, + MAP_SHARED, + (unsigned long)map->offset); + up(¤t->mm->mmap_sem); + } else { + down(¤t->mm->mmap_sem); + virtual = do_mmap(filp, 0, dma->byte_count, + PROT_READ|PROT_WRITE, MAP_SHARED, 0); + up(¤t->mm->mmap_sem); + } + if (virtual > -1024UL) { + /* Real error */ + DRM_DEBUG("mmap error\n"); + retcode = (signed long)virtual; + goto done; + } + request.virtual = (void *)virtual; - for (i = 0; i < dma->buf_count; i++) { - if (copy_to_user(&request.list[i].idx, - &dma->buflist[i]->idx, - sizeof(request.list[0].idx))) { - retcode = -EFAULT; - goto done; - } - if (copy_to_user(&request.list[i].total, - &dma->buflist[i]->total, - sizeof(request.list[0].total))) { - retcode = -EFAULT; - goto done; - } - if (copy_to_user(&request.list[i].used, - &zero, - sizeof(zero))) { - retcode = -EFAULT; - goto done; - } - address = virtual + dma->buflist[i]->offset; - if (copy_to_user(&request.list[i].address, - &address, - sizeof(address))) { - retcode = -EFAULT; - goto done; - } - } - } - done: - request.count = dma->buf_count; - DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode); + for (i = 0; i < dma->buf_count; i++) { + if (copy_to_user(&request.list[i].idx, + &dma->buflist[i]->idx, + sizeof(request.list[0].idx))) { + retcode = -EFAULT; + goto done; + } + if (copy_to_user(&request.list[i].total, + &dma->buflist[i]->total, + sizeof(request.list[0].total))) { + retcode = -EFAULT; + goto done; + } + if (copy_to_user(&request.list[i].used, + &zero, + sizeof(zero))) { + retcode = -EFAULT; + goto done; + } + address = virtual + dma->buflist[i]->offset; + if (copy_to_user(&request.list[i].address, + &address, + sizeof(address))) { + retcode = -EFAULT; + goto done; + } + } + } + done: + request.count = dma->buf_count; + DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode); - copy_to_user_ret((drm_buf_map_t *)arg, - &request, - sizeof(request), - -EFAULT); + copy_to_user_ret((drm_buf_map_t *)arg, + &request, + sizeof(request), + -EFAULT); - DRM_DEBUG("retcode : %d\n", retcode); + DRM_DEBUG("retcode : %d\n", retcode); - return retcode; + return retcode; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c index fb0d336fa..d02592740 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c @@ -2,6 +2,7 @@ * Created: Mon Dec 13 09:51:35 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,9 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Author: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c,v 1.1 2000/02/11 17:26:06 dawes Exp $ + * Author: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> * */ @@ -38,7 +38,7 @@ static int mga_alloc_queue(drm_device_t *dev) { int temp = drm_ctxbitmap_next(dev); - printk("mga_alloc_queue: %d\n", temp); + DRM_DEBUG("mga_alloc_queue: %d\n", temp); return temp; } @@ -57,7 +57,7 @@ int mga_context_switch(drm_device_t *dev, int old, int new) dev->ctx_start = get_cycles(); #endif - printk("Context switch from %d to %d\n", old, new); + DRM_DEBUG("Context switch from %d to %d\n", old, new); if (new == dev->last_context) { clear_bit(0, &dev->context_flag); @@ -104,7 +104,7 @@ int mga_resctx(struct inode *inode, struct file *filp, unsigned int cmd, drm_ctx_t ctx; int i; - printk("%d\n", DRM_RESERVED_CONTEXTS); + DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); copy_from_user_ret(&res, (drm_ctx_res_t *)arg, sizeof(res), -EFAULT); if (res.count >= DRM_RESERVED_CONTEXTS) { memset(&ctx, 0, sizeof(ctx)); @@ -134,11 +134,11 @@ int mga_addctx(struct inode *inode, struct file *filp, unsigned int cmd, ctx.handle = mga_alloc_queue(dev); } if (ctx.handle == -1) { - printk("Not enough free contexts.\n"); + DRM_DEBUG("Not enough free contexts.\n"); /* Should this return -EBUSY instead? */ return -ENOMEM; } - printk("%d\n", ctx.handle); + DRM_DEBUG("%d\n", ctx.handle); copy_to_user_ret((drm_ctx_t *)arg, &ctx, sizeof(ctx), -EFAULT); return 0; } @@ -170,7 +170,7 @@ int mga_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, drm_ctx_t ctx; copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); - printk("%d\n", ctx.handle); + DRM_DEBUG("%d\n", ctx.handle); return mga_context_switch(dev, dev->last_context, ctx.handle); } @@ -182,7 +182,7 @@ int mga_newctx(struct inode *inode, struct file *filp, unsigned int cmd, drm_ctx_t ctx; copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); - printk("%d\n", ctx.handle); + DRM_DEBUG("%d\n", ctx.handle); mga_context_switch_complete(dev, ctx.handle); return 0; @@ -194,51 +194,11 @@ int mga_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_ctx_t ctx; - drm_queue_t *q; - drm_buf_t *buf; copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); - printk("%d\n", ctx.handle); - if(ctx.handle == DRM_KERNEL_CONTEXT) { - q = dev->queuelist[ctx.handle]; - atomic_inc(&q->use_count); - if (atomic_read(&q->use_count) == 1) { - /* No longer in use */ - atomic_dec(&q->use_count); - return -EINVAL; - } - atomic_inc(&q->finalization); /* Mark queue in finalization state */ - atomic_sub(2, &q->use_count); - /* Mark queue as unused (pending finalization) */ - - while (test_and_set_bit(0, &dev->interrupt_flag)) { - printk("Calling schedule from rmctx\n"); - schedule(); - if (signal_pending(current)) { - clear_bit(0, &dev->interrupt_flag); - return -EINTR; - } - } - - /* Remove queued buffers */ - while ((buf = drm_waitlist_get(&q->waitlist))) { - drm_free_buffer(dev, buf); - } - clear_bit(0, &dev->interrupt_flag); - - /* Wakeup blocked processes */ - wake_up_interruptible(&q->read_queue); - wake_up_interruptible(&q->write_queue); - wake_up_interruptible(&q->flush_queue); - - /* Finalization over. Queue is made - available when both use_count and - finalization become 0, which won't - happen until all the waiting processes - stop waiting. */ - atomic_dec(&q->finalization); - } else { - drm_ctxbitmap_free(dev, ctx.handle); + DRM_DEBUG("%d\n", ctx.handle); + if(ctx.handle != DRM_KERNEL_CONTEXT) { + drm_ctxbitmap_free(dev, ctx.handle); } return 0; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c index fe6a7b525..25e3622ca 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c @@ -2,6 +2,7 @@ * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,11 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * Jeff Hartmann <jhartmann@precisioninsight.com> - * Keith Whitwell <keithw@precisioninsight.com> - * - * $XFree86$ + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keithw@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h index 7228b9051..e75e91a4f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h @@ -2,6 +2,7 @@ * Created: Tue Jan 25 01:50:01 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,10 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Jeff Hartmann <jhartmann@precisioninsight.com> - * Keith Whitwell <keithw@precisioninsight.com> + * Authors: Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keithw@valinux.com> * - * $XFree86$ */ #ifndef _MGA_DRM_H_ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c index 5fabe1f25..4b2c835fa 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c @@ -2,6 +2,7 @@ * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,10 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * Jeff Hartmann <jhartmann@precisioninsight.com> + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c,v 1.1 2000/02/11 17:26:07 dawes Exp $ * */ @@ -39,9 +39,9 @@ EXPORT_SYMBOL(mga_cleanup); #define MGA_NAME "mga" #define MGA_DESC "Matrox g200/g400" #define MGA_DATE "19991213" -#define MGA_MAJOR 0 +#define MGA_MAJOR 1 #define MGA_MINOR 0 -#define MGA_PATCHLEVEL 1 +#define MGA_PATCHLEVEL 0 static drm_device_t mga_device; drm_ctx_t mga_res_ctx; @@ -385,9 +385,9 @@ int mga_init(void) DRM_DEBUG("doing agp init\n"); dev->agp = drm_agp_init(); if(dev->agp == NULL) { - DRM_DEBUG("The mga drm module requires the agpgart module" - " to function correctly\nPlease load the agpgart" - " module before you load the mga module\n"); + DRM_INFO("The mga drm module requires the agpgart module" + " to function correctly\nPlease load the agpgart" + " module before you load the mga module\n"); drm_proc_cleanup(); misc_deregister(&mga_misc); mga_takedown(dev); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h index ee75a03e2..f217acb97 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h @@ -2,6 +2,7 @@ * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,10 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * Jeff Hartmann <jhartmann@precisioninsight.com> + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> * - * $XFree86$ */ #ifndef _MGA_DRV_H_ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c index 32f6bcf4b..c9c6ef3df 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c @@ -2,6 +2,7 @@ * Created: Thu Jan 27 02:53:43 2000 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -26,369 +27,362 @@ * Authors: Jeff Hartmann <jhartmann@precisioninsight.com> * Keith Whitwell <keithw@precisioninsight.com> * - * $XFree86$ - * */ - + #define __NO_VERSION__ #include "drmP.h" #include "mga_drv.h" #include "drm.h" -static void mgaEmitClipRect( drm_mga_private_t *dev_priv, - drm_clip_rect_t *box ) +static void mgaEmitClipRect(drm_mga_private_t * dev_priv, + drm_clip_rect_t * box) { - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->ContextState; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - /* This takes 10 dwords */ - PRIMGETPTR( dev_priv ); - - /* Force reset of dwgctl (eliminates clip disable) */ -#if 1 - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DWGSYNC, 0 ); - PRIMOUTREG( MGAREG_DWGSYNC, 0 ); - PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] ); + /* This takes 10 dwords */ + PRIMGETPTR(dev_priv); + + /* Force reset of dwgctl (eliminates clip disable) */ +#if 0 + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0); + PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); #else - PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] ); - PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000 ); - PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] ); - PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000 ); + PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000); + PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000); #endif - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_CXBNDRY, ((box->x2)<<16)|(box->x1) ); - PRIMOUTREG( MGAREG_YTOP, box->y1 * dev_priv->stride/2 ); - PRIMOUTREG( MGAREG_YBOT, box->y2 * dev_priv->stride/2 ); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_CXBNDRY, ((box->x2) << 16) | (box->x1)); + PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / 2); + PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / 2); - PRIMADVANCE( dev_priv ); + PRIMADVANCE(dev_priv); } -static void mgaEmitContext(drm_mga_private_t *dev_priv ) +static void mgaEmitContext(drm_mga_private_t * dev_priv) { - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->ContextState; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - - /* This takes a max of 15 dwords */ - PRIMGETPTR( dev_priv ); - - PRIMOUTREG( MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG] ); - PRIMOUTREG( MGAREG_MACCESS, regs[MGA_CTXREG_MACCESS] ); - PRIMOUTREG( MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT] ); - PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] ); - - PRIMOUTREG( MGAREG_ALPHACTRL, regs[MGA_CTXREG_ALPHACTRL] ); - PRIMOUTREG( MGAREG_FOGCOL, regs[MGA_CTXREG_FOGCOLOR] ); - PRIMOUTREG( MGAREG_WFLAG, regs[MGA_CTXREG_WFLAG] ); - PRIMOUTREG( MGAREG_ZORG, dev_priv->depthOffset ); /* invarient */ - - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { - PRIMOUTREG( MGAREG_WFLAG1, regs[MGA_CTXREG_WFLAG] ); - PRIMOUTREG( MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0] ); - PRIMOUTREG( MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1] ); - PRIMOUTREG( MGAREG_FCOL, regs[MGA_CTXREG_FCOL] ); + + /* This takes a max of 15 dwords */ + PRIMGETPTR(dev_priv); + + PRIMOUTREG(MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG]); + PRIMOUTREG(MGAREG_MACCESS, regs[MGA_CTXREG_MACCESS]); + PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]); + PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); + + PRIMOUTREG(MGAREG_ALPHACTRL, regs[MGA_CTXREG_ALPHACTRL]); + PRIMOUTREG(MGAREG_FOGCOL, regs[MGA_CTXREG_FOGCOLOR]); + PRIMOUTREG(MGAREG_WFLAG, regs[MGA_CTXREG_WFLAG]); + PRIMOUTREG(MGAREG_ZORG, dev_priv->depthOffset); /* invarient */ + + if (dev_priv->chipset == MGA_CARD_TYPE_G400) { + PRIMOUTREG(MGAREG_WFLAG1, regs[MGA_CTXREG_WFLAG]); + PRIMOUTREG(MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0]); + PRIMOUTREG(MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1]); + PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); } else { - PRIMOUTREG( MGAREG_FCOL, regs[MGA_CTXREG_FCOL] ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); + PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); } - - PRIMADVANCE( dev_priv ); + + PRIMADVANCE(dev_priv); } -static void mgaG200EmitTex( drm_mga_private_t *dev_priv ) +static void mgaG200EmitTex(drm_mga_private_t * dev_priv) { - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->TexState[0]; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - PRIMGETPTR( dev_priv ); - - /* This takes 20 dwords */ + PRIMGETPTR(dev_priv); - PRIMOUTREG( MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] ); - PRIMOUTREG( MGAREG_TEXCTL, regs[MGA_TEXREG_CTL] ); - PRIMOUTREG( MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER] ); - PRIMOUTREG( MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL] ); + /* This takes 20 dwords */ - PRIMOUTREG( MGAREG_TEXORG, regs[MGA_TEXREG_ORG] ); - PRIMOUTREG( MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1] ); - PRIMOUTREG( MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2] ); - PRIMOUTREG( MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3] ); + PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2]); + PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); + PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); + PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); - PRIMOUTREG( MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4] ); - PRIMOUTREG( MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH] ); - PRIMOUTREG( MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT] ); - PRIMOUTREG( 0x2d00 + 24*4, regs[MGA_TEXREG_WIDTH] ); + PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); + PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); + PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); + PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); - PRIMOUTREG( 0x2d00 + 34*4, regs[MGA_TEXREG_HEIGHT] ); - PRIMOUTREG( MGAREG_TEXTRANS, 0xffff ); - PRIMOUTREG( MGAREG_TEXTRANSHIGH, 0xffff ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); + PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); + PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); + PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); + PRIMOUTREG(0x2d00 + 24 * 4, regs[MGA_TEXREG_WIDTH]); - PRIMADVANCE( dev_priv ); + PRIMOUTREG(0x2d00 + 34 * 4, regs[MGA_TEXREG_HEIGHT]); + PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); + PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); + PRIMOUTREG(MGAREG_DMAPAD, 0); + + PRIMADVANCE(dev_priv); } -static void mgaG400EmitTex0( drm_mga_private_t *dev_priv ) +static void mgaG400EmitTex0(drm_mga_private_t * dev_priv) { - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->TexState[0]; int multitex = sarea_priv->WarpPipe & MGA_T2; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - - PRIMGETPTR( dev_priv ); - - /* This takes a max of 30 dwords */ - - PRIMOUTREG( MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] ); - PRIMOUTREG( MGAREG_TEXCTL, regs[MGA_TEXREG_CTL] ); - PRIMOUTREG( MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER] ); - PRIMOUTREG( MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL] ); - - PRIMOUTREG( MGAREG_TEXORG, regs[MGA_TEXREG_ORG] ); - PRIMOUTREG( MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1] ); - PRIMOUTREG( MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2] ); - PRIMOUTREG( MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3] ); - - PRIMOUTREG( MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4] ); - PRIMOUTREG( MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH] ); - PRIMOUTREG( MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT] ); - PRIMOUTREG( 0x2d00 + 49*4, 0 ); - - PRIMOUTREG( 0x2d00 + 57*4, 0 ); - PRIMOUTREG( 0x2d00 + 53*4, 0 ); - PRIMOUTREG( 0x2d00 + 61*4, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - if (!multitex) { - PRIMOUTREG( 0x2d00 + 52*4, 0x40 ); - PRIMOUTREG( 0x2d00 + 60*4, 0x40 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - } - - PRIMOUTREG( 0x2d00 + 54*4, regs[MGA_TEXREG_WIDTH] | 0x40 ); - PRIMOUTREG( 0x2d00 + 62*4, regs[MGA_TEXREG_HEIGHT] | 0x40 ); - PRIMOUTREG( MGAREG_TEXTRANS, 0xffff ); - PRIMOUTREG( MGAREG_TEXTRANSHIGH, 0xffff ); - - PRIMADVANCE( dev_priv ); -} + PRIMGETPTR(dev_priv); -#define TMC_map1_enable 0x80000000 + /* This takes a max of 30 dwords */ -static void mgaG400EmitTex1( drm_mga_private_t *dev_priv ) -{ - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->TexState[1]; - PRIMLOCALS; - DRM_DEBUG("%s\n", __FUNCTION__); - - PRIMGETPTR( dev_priv ); + PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000); + PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); + PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); + PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); - /* This takes 25 dwords */ + PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); + PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); + PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); + PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); - PRIMOUTREG( MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | TMC_map1_enable ); - PRIMOUTREG( MGAREG_TEXCTL, regs[MGA_TEXREG_CTL] ); - PRIMOUTREG( MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER] ); - PRIMOUTREG( MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL] ); + PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); + PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); + PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); + PRIMOUTREG(0x2d00 + 49 * 4, 0); - PRIMOUTREG( MGAREG_TEXORG, regs[MGA_TEXREG_ORG] ); - PRIMOUTREG( MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1] ); - PRIMOUTREG( MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2] ); - PRIMOUTREG( MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3] ); + PRIMOUTREG(0x2d00 + 57 * 4, 0); + PRIMOUTREG(0x2d00 + 53 * 4, 0); + PRIMOUTREG(0x2d00 + 61 * 4, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG( MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4] ); - PRIMOUTREG( MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH] ); - PRIMOUTREG( MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT] ); - PRIMOUTREG( 0x2d00 + 49*4, 0 ); - - PRIMOUTREG( 0x2d00 + 57*4, 0 ); - PRIMOUTREG( 0x2d00 + 53*4, 0 ); - PRIMOUTREG( 0x2d00 + 61*4, 0 ); - PRIMOUTREG( 0x2d00 + 52*4, regs[MGA_TEXREG_WIDTH] | 0x40 ); + if (!multitex) { + PRIMOUTREG(0x2d00 + 52 * 4, 0x40); + PRIMOUTREG(0x2d00 + 60 * 4, 0x40); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + } - PRIMOUTREG( 0x2d00 + 60*4, regs[MGA_TEXREG_HEIGHT] | 0x40 ); - PRIMOUTREG( MGAREG_TEXTRANS, 0xffff ); - PRIMOUTREG( MGAREG_TEXTRANSHIGH, 0xffff ); - PRIMOUTREG( MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] ); + PRIMOUTREG(0x2d00 + 54 * 4, regs[MGA_TEXREG_WIDTH] | 0x40); + PRIMOUTREG(0x2d00 + 62 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40); + PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); + PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); - PRIMADVANCE( dev_priv ); + PRIMADVANCE(dev_priv); } -/* Required when switching from multitexturing to single texturing. - */ -static void mgaG400EmitTexFlush( drm_mga_private_t *dev_priv ) +#define TMC_map1_enable 0x80000000 + +static void mgaG400EmitTex1(drm_mga_private_t * dev_priv) { + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int *regs = sarea_priv->TexState[1]; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - - PRIMGETPTR( dev_priv ); - /* This takes 15 dwords */ + PRIMGETPTR(dev_priv); - PRIMOUTREG( MGAREG_YDST, 0 ); - PRIMOUTREG( MGAREG_FXLEFT, 0 ); - PRIMOUTREG( MGAREG_FXRIGHT, 1 ); - PRIMOUTREG( MGAREG_DWGCTL, MGA_FLUSH_CMD ); + /* This takes 25 dwords */ - PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 1 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DWGSYNC, 0x7000 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); + PRIMOUTREG(MGAREG_TEXCTL2, + regs[MGA_TEXREG_CTL2] | TMC_map1_enable | 0x00008000); + PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); + PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); + PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); - PRIMOUTREG( MGAREG_TEXCTL2, 0 ); - PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 0 ); - PRIMOUTREG( MGAREG_TEXCTL2, 0x80 ); - PRIMOUTREG( MGAREG_LEN + MGAREG_MGA_EXEC, 0 ); + PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); + PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); + PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); + PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); - PRIMADVANCE( dev_priv ); + PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); + PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); + PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); + PRIMOUTREG(0x2d00 + 49 * 4, 0); + + PRIMOUTREG(0x2d00 + 57 * 4, 0); + PRIMOUTREG(0x2d00 + 53 * 4, 0); + PRIMOUTREG(0x2d00 + 61 * 4, 0); + PRIMOUTREG(0x2d00 + 52 * 4, regs[MGA_TEXREG_WIDTH] | 0x40); + + PRIMOUTREG(0x2d00 + 60 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40); + PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); + PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); + PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000); + + PRIMADVANCE(dev_priv); } -static void mgaG400EmitPipe( drm_mga_private_t *dev_priv ) +#define EMIT_PIPE 50 +static void mgaG400EmitPipe(drm_mga_private_t * dev_priv) { - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int pipe = sarea_priv->WarpPipe; float fParam = 12800.0f; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - - PRIMGETPTR( dev_priv ); - /* This takes 30 dwords */ + PRIMGETPTR(dev_priv); + + /* This takes 50 dwords */ /* Establish vertex size. */ + PRIMOUTREG(MGAREG_WIADDR2, WIA_wmode_suspend); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + if (pipe & MGA_T2) { - PRIMOUTREG( MGAREG_WIADDR2, WIA_wmode_suspend ); - PRIMOUTREG( MGAREG_WVRTXSZ, 0x00001e09 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - - PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 ); - PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 ); - PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 ); - PRIMOUTREG( MGAREG_WACCEPTSEQ, 0x1e000000 ); + PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001e09); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + + PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); + PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); + PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); + PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x1e000000); } else { - PRIMOUTREG( MGAREG_WIADDR2, WIA_wmode_suspend ); - PRIMOUTREG( MGAREG_WVRTXSZ, 0x00001807 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - - PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 ); - PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 ); - PRIMOUTREG( MGAREG_WACCEPTSEQ, 0 ); - PRIMOUTREG( MGAREG_WACCEPTSEQ, 0x18000000 ); - } - - PRIMOUTREG( MGAREG_WFLAG, 0 ); - PRIMOUTREG( MGAREG_WFLAG1, 0 ); - PRIMOUTREG( 0x2d00 + 56*4, *((u32 *)(&fParam)) ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - - PRIMOUTREG( 0x2d00 + 49*4, 0 ); /* Tex stage 0 */ - PRIMOUTREG( 0x2d00 + 57*4, 0 ); /* Tex stage 0 */ - PRIMOUTREG( 0x2d00 + 53*4, 0 ); /* Tex stage 1 */ - PRIMOUTREG( 0x2d00 + 61*4, 0 ); /* Tex stage 1 */ - - PRIMOUTREG( 0x2d00 + 54*4, 0x40 ); /* Tex stage 0 : w */ - PRIMOUTREG( 0x2d00 + 62*4, 0x40 ); /* Tex stage 0 : h */ - PRIMOUTREG( 0x2d00 + 52*4, 0x40 ); /* Tex stage 1 : w */ - PRIMOUTREG( 0x2d00 + 60*4, 0x40 ); /* Tex stage 1 : h */ - + if (dev_priv->WarpPipe & MGA_T2) { + /* Flush the WARP pipe */ + PRIMOUTREG(MGAREG_YDST, 0); + PRIMOUTREG(MGAREG_FXLEFT, 0); + PRIMOUTREG(MGAREG_FXRIGHT, 1); + PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); + + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + PRIMOUTREG(MGAREG_DMAPAD, 0); + + PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000); + PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + } + + PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + + PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); + PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); + PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); + PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x18000000); + } + + PRIMOUTREG(MGAREG_WFLAG, 0); + PRIMOUTREG(MGAREG_WFLAG1, 0); + PRIMOUTREG(0x2d00 + 56 * 4, *((u32 *) (&fParam))); + PRIMOUTREG(MGAREG_DMAPAD, 0); + + PRIMOUTREG(0x2d00 + 49 * 4, 0); /* Tex stage 0 */ + PRIMOUTREG(0x2d00 + 57 * 4, 0); /* Tex stage 0 */ + PRIMOUTREG(0x2d00 + 53 * 4, 0); /* Tex stage 1 */ + PRIMOUTREG(0x2d00 + 61 * 4, 0); /* Tex stage 1 */ + + PRIMOUTREG(0x2d00 + 54 * 4, 0x40); /* Tex stage 0 : w */ + PRIMOUTREG(0x2d00 + 62 * 4, 0x40); /* Tex stage 0 : h */ + PRIMOUTREG(0x2d00 + 52 * 4, 0x40); /* Tex stage 1 : w */ + PRIMOUTREG(0x2d00 + 60 * 4, 0x40); /* Tex stage 1 : h */ + /* Dma pading required due to hw bug */ - PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff ); - PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff ); - PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff ); - PRIMOUTREG( MGAREG_WIADDR2, (u32)(dev_priv->WarpIndex[pipe].phys_addr | - WIA_wmode_start | WIA_wagp_agp) ); - PRIMADVANCE( dev_priv ); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_WIADDR2, + (u32) (dev_priv->WarpIndex[pipe]. + phys_addr | WIA_wmode_start | WIA_wagp_agp)); + PRIMADVANCE(dev_priv); } -static void mgaG200EmitPipe( drm_mga_private_t *dev_priv ) +static void mgaG200EmitPipe(drm_mga_private_t * dev_priv) { - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int pipe = sarea_priv->WarpPipe; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - PRIMGETPTR( dev_priv ); - - /* This takes 15 dwords */ - - PRIMOUTREG( MGAREG_WIADDR, WIA_wmode_suspend ); - PRIMOUTREG( MGAREG_WVRTXSZ, 7 ); - PRIMOUTREG( MGAREG_WFLAG, 0 ); - PRIMOUTREG( 0x2d00 + 24*4, 0 ); /* tex w/h */ - - PRIMOUTREG( 0x2d00 + 25*4, 0x100 ); - PRIMOUTREG( 0x2d00 + 34*4, 0 ); /* tex w/h */ - PRIMOUTREG( 0x2d00 + 42*4, 0xFFFF ); - PRIMOUTREG( 0x2d00 + 60*4, 0xFFFF ); - + PRIMGETPTR(dev_priv); + + /* This takes 15 dwords */ + + PRIMOUTREG(MGAREG_WIADDR, WIA_wmode_suspend); + PRIMOUTREG(MGAREG_WVRTXSZ, 7); + PRIMOUTREG(MGAREG_WFLAG, 0); + PRIMOUTREG(0x2d00 + 24 * 4, 0); /* tex w/h */ + + PRIMOUTREG(0x2d00 + 25 * 4, 0x100); + PRIMOUTREG(0x2d00 + 34 * 4, 0); /* tex w/h */ + PRIMOUTREG(0x2d00 + 42 * 4, 0xFFFF); + PRIMOUTREG(0x2d00 + 60 * 4, 0xFFFF); + /* Dma pading required due to hw bug */ - PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff ); - PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff ); - PRIMOUTREG( MGAREG_DMAPAD, 0xffffffff ); - PRIMOUTREG( MGAREG_WIADDR, (u32)(dev_priv->WarpIndex[pipe].phys_addr | - WIA_wmode_start | WIA_wagp_agp) ); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); + PRIMOUTREG(MGAREG_WIADDR, + (u32) (dev_priv->WarpIndex[pipe]. + phys_addr | WIA_wmode_start | WIA_wagp_agp)); PRIMADVANCE( dev_priv ); } -static void mgaEmitState( drm_mga_private_t *dev_priv ) +static void mgaEmitState(drm_mga_private_t * dev_priv) { - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int dirty = sarea_priv->dirty; DRM_DEBUG("%s\n", __FUNCTION__); - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { + if (dev_priv->chipset == MGA_CARD_TYPE_G400) { int multitex = sarea_priv->WarpPipe & MGA_T2; if (sarea_priv->WarpPipe != dev_priv->WarpPipe) { - if ((dev_priv->WarpPipe & MGA_T2) && !multitex) { - mgaG400EmitTexFlush( dev_priv ); - } - mgaG400EmitPipe( dev_priv ); + mgaG400EmitPipe(dev_priv); dev_priv->WarpPipe = sarea_priv->WarpPipe; } if (dirty & MGA_UPLOAD_CTX) { - mgaEmitContext( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_CTX; + mgaEmitContext(dev_priv); + sarea_priv->dirty &= ~MGA_UPLOAD_CTX; } if (dirty & MGA_UPLOAD_TEX0) { - mgaG400EmitTex0( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; + mgaG400EmitTex0(dev_priv); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; } if ((dirty & MGA_UPLOAD_TEX1) && multitex) { - mgaG400EmitTex1( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; + mgaG400EmitTex1(dev_priv); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; } } else { - if (sarea_priv->WarpPipe != dev_priv->WarpPipe) { - mgaG200EmitPipe( dev_priv ); + if (sarea_priv->WarpPipe != dev_priv->WarpPipe) { + mgaG200EmitPipe(dev_priv); dev_priv->WarpPipe = sarea_priv->WarpPipe; } if (dirty & MGA_UPLOAD_CTX) { - mgaEmitContext( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_CTX; + mgaEmitContext(dev_priv); + sarea_priv->dirty &= ~MGA_UPLOAD_CTX; } if (dirty & MGA_UPLOAD_TEX0) { - mgaG200EmitTex( dev_priv ); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; + mgaG200EmitTex(dev_priv); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; } } } @@ -396,19 +390,19 @@ static void mgaEmitState( drm_mga_private_t *dev_priv ) /* Disallow all write destinations except the front and backbuffer. */ -static int mgaVerifyContext(drm_mga_private_t *dev_priv ) +static int mgaVerifyContext(drm_mga_private_t * dev_priv) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->ContextState; - DRM_DEBUG("%s\n", __FUNCTION__); + DRM_DEBUG("%s\n", __FUNCTION__); if (regs[MGA_CTXREG_DSTORG] != dev_priv->frontOffset && regs[MGA_CTXREG_DSTORG] != dev_priv->backOffset) { - DRM_DEBUG("BAD DSTORG: %x (front %x, back %x)\n\n", - regs[MGA_CTXREG_DSTORG], dev_priv->frontOffset, - dev_priv->backOffset); - regs[MGA_CTXREG_DSTORG] = 0; + DRM_DEBUG("BAD DSTORG: %x (front %x, back %x)\n\n", + regs[MGA_CTXREG_DSTORG], dev_priv->frontOffset, + dev_priv->backOffset); + regs[MGA_CTXREG_DSTORG] = 0; return -1; } @@ -417,210 +411,196 @@ static int mgaVerifyContext(drm_mga_private_t *dev_priv ) /* Disallow texture reads from PCI space. */ -static int mgaVerifyTex(drm_mga_private_t *dev_priv, - int unit) +static int mgaVerifyTex(drm_mga_private_t * dev_priv, int unit) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - DRM_DEBUG("%s\n", __FUNCTION__); + DRM_DEBUG("%s\n", __FUNCTION__); if ((sarea_priv->TexState[unit][MGA_TEXREG_ORG] & 0x3) == 0x1) { - DRM_DEBUG("BAD TEXREG_ORG: %x, unit %d\n", - sarea_priv->TexState[unit][MGA_TEXREG_ORG], - unit); + DRM_DEBUG("BAD TEXREG_ORG: %x, unit %d\n", + sarea_priv->TexState[unit][MGA_TEXREG_ORG], + unit); sarea_priv->TexState[unit][MGA_TEXREG_ORG] = 0; return -1; - } + } return 0; } -static int mgaVerifyState( drm_mga_private_t *dev_priv ) +static int mgaVerifyState(drm_mga_private_t * dev_priv) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int dirty = sarea_priv->dirty; int rv = 0; - DRM_DEBUG("%s\n", __FUNCTION__); + DRM_DEBUG("%s\n", __FUNCTION__); - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; if (dirty & MGA_UPLOAD_CTX) - rv |= mgaVerifyContext( dev_priv ); + rv |= mgaVerifyContext(dev_priv); if (dirty & MGA_UPLOAD_TEX0) - rv |= mgaVerifyTex( dev_priv, 0 ); + rv |= mgaVerifyTex(dev_priv, 0); - if (dev_priv->chipset == MGA_CARD_TYPE_G400) - { + if (dev_priv->chipset == MGA_CARD_TYPE_G400) { if (dirty & MGA_UPLOAD_TEX1) - rv |= mgaVerifyTex( dev_priv, 1 ); - - if (dirty & MGA_UPLOAD_PIPE) - rv |= (sarea_priv->WarpPipe > MGA_MAX_G400_PIPES); - } - else - { - if (dirty & MGA_UPLOAD_PIPE) - rv |= (sarea_priv->WarpPipe > MGA_MAX_G200_PIPES); - } + rv |= mgaVerifyTex(dev_priv, 1); + + if (dirty & MGA_UPLOAD_PIPE) + rv |= (sarea_priv->WarpPipe > MGA_MAX_G400_PIPES); + } else { + if (dirty & MGA_UPLOAD_PIPE) + rv |= (sarea_priv->WarpPipe > MGA_MAX_G200_PIPES); + } return rv == 0; } -static int mgaVerifyIload( drm_mga_private_t *dev_priv, - unsigned long bus_address, - unsigned int dstOrg, int length ) +static int mgaVerifyIload(drm_mga_private_t * dev_priv, + unsigned long bus_address, + unsigned int dstOrg, int length) { - DRM_DEBUG("%s\n", __FUNCTION__); + DRM_DEBUG("%s\n", __FUNCTION__); - if(dstOrg < dev_priv->textureOffset || - dstOrg + length > - (dev_priv->textureOffset + dev_priv->textureSize)) { - return -EINVAL; + if (dstOrg < dev_priv->textureOffset || + dstOrg + length > + (dev_priv->textureOffset + dev_priv->textureSize)) { + return -EINVAL; } - if(length % 64) { - return -EINVAL; + if (length % 64) { + return -EINVAL; } - return 0; + return 0; } /* This copies a 64 byte aligned agp region to the frambuffer * with a standard blit, the ioctl needs to do checking */ -static void mga_dma_dispatch_tex_blit( drm_device_t *dev, - unsigned long bus_address, - int length, - unsigned int destOrg ) +static void mga_dma_dispatch_tex_blit(drm_device_t * dev, + unsigned long bus_address, + int length, unsigned int destOrg) { - drm_mga_private_t *dev_priv = dev->dev_private; - int use_agp = PDEA_pagpxfer_enable | 0x00000001; - u16 y2; - PRIMLOCALS; + drm_mga_private_t *dev_priv = dev->dev_private; + int use_agp = PDEA_pagpxfer_enable | 0x00000001; + u16 y2; + PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - - y2 = length / 64; - - PRIM_OVERFLOW( dev, dev_priv, 30 ); - PRIMGETPTR( dev_priv ); - - PRIMOUTREG( MGAREG_DSTORG, destOrg ); - PRIMOUTREG( MGAREG_MACCESS, 0x00000000 ); - DRM_DEBUG("srcorg : %lx\n", bus_address | use_agp); - PRIMOUTREG( MGAREG_SRCORG, (u32) bus_address | use_agp ); - PRIMOUTREG( MGAREG_AR5, 64 ); - - PRIMOUTREG( MGAREG_PITCH, 64 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DWGCTL, MGA_COPY_CMD ); - - PRIMOUTREG( MGAREG_AR0, 63 ); - PRIMOUTREG( MGAREG_AR3, 0 ); - PRIMOUTREG( MGAREG_FXBNDRY, (63 << 16) ); - PRIMOUTREG( MGAREG_YDSTLEN+MGAREG_MGA_EXEC, y2 ); - - PRIMOUTREG( MGAREG_SRCORG, 0 ); - PRIMOUTREG( MGAREG_PITCH, dev_priv->stride / dev_priv->cpp ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMADVANCE( dev_priv ); + + y2 = length / 64; + + PRIM_OVERFLOW(dev, dev_priv, 30); + PRIMGETPTR(dev_priv); + + PRIMOUTREG(MGAREG_DSTORG, destOrg); + PRIMOUTREG(MGAREG_MACCESS, 0x00000000); + DRM_DEBUG("srcorg : %lx\n", bus_address | use_agp); + PRIMOUTREG(MGAREG_SRCORG, (u32) bus_address | use_agp); + PRIMOUTREG(MGAREG_AR5, 64); + + PRIMOUTREG(MGAREG_PITCH, 64); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); + + PRIMOUTREG(MGAREG_AR0, 63); + PRIMOUTREG(MGAREG_AR3, 0); + PRIMOUTREG(MGAREG_FXBNDRY, (63 << 16)); + PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, y2); + + PRIMOUTREG(MGAREG_SRCORG, 0); + PRIMOUTREG(MGAREG_PITCH, dev_priv->stride / dev_priv->cpp); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMADVANCE(dev_priv); } -static void mga_dma_dispatch_vertex(drm_device_t *dev, - drm_buf_t *buf) +static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf) { - drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned long address = (unsigned long)buf->bus_address; - int length = buf->used; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned long address = (unsigned long) buf->bus_address; + int length = buf->used; int use_agp = PDEA_pagpxfer_enable; int i = 0; - int primary_needed; - PRIMLOCALS; + int primary_needed; + PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("dispatch vertex %d addr 0x%lx, " - "length 0x%x nbox %d dirty %x\n", - buf->idx, address, length, + "length 0x%x nbox %d dirty %x\n", + buf->idx, address, length, sarea_priv->nbox, sarea_priv->dirty); DRM_DEBUG("used : %d, total : %d\n", buf->used, buf->total); - if(sarea_priv->WarpPipe & MGA_T2) { - if ((buf->used/4) % 10) - DRM_DEBUG("Multitex Buf is not aligned properly!!!\n"); - } else { - if ((buf->used/4) % 8) - DRM_DEBUG("Buf is not aligned properly!!!\n"); - } if (buf->used) { /* WARNING: if you change any of the state functions verify * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; - primary_needed = (30+15+15+30+25+ - 10 + - 15 * MGA_NR_SAREA_CLIPRECTS); + primary_needed = (50 + 15 + 15 + 30 + 25 + + 10 + 15 * MGA_NR_SAREA_CLIPRECTS); PRIM_OVERFLOW(dev, dev_priv, primary_needed); - mgaEmitState( dev_priv ); + mgaEmitState(dev_priv); do { if (i < sarea_priv->nbox) { DRM_DEBUG("idx %d Emit box %d/%d:" - "%d,%d - %d,%d\n", + "%d,%d - %d,%d\n", buf->idx, i, sarea_priv->nbox, - sarea_priv->boxes[i].x1, + sarea_priv->boxes[i].x1, sarea_priv->boxes[i].y1, - sarea_priv->boxes[i].x2, + sarea_priv->boxes[i].x2, sarea_priv->boxes[i].y2); - - mgaEmitClipRect( dev_priv, - &sarea_priv->boxes[i] ); + + mgaEmitClipRect(dev_priv, + &sarea_priv->boxes[i]); } - - PRIMGETPTR( dev_priv ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_SECADDRESS, - ((u32)address) | TT_VERTEX ); - PRIMOUTREG( MGAREG_SECEND, - (((u32)(address + length)) | use_agp) ); - PRIMADVANCE( dev_priv ); - } while (++i < sarea_priv->nbox); + + PRIMGETPTR(dev_priv); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_SECADDRESS, + ((u32) address) | TT_VERTEX); + PRIMOUTREG(MGAREG_SECEND, + (((u32) (address + length)) | use_agp)); + PRIMADVANCE(dev_priv); + } while (++i < sarea_priv->nbox); } - if (buf_priv->discard) { - if (buf_priv->dispatched == 1) AGEBUF(dev_priv, buf_priv); + if (buf_priv->discard) { + if (buf_priv->dispatched == 1) + AGEBUF(dev_priv, buf_priv); buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); + mga_freelist_put(dev, buf); } } -static void mga_dma_dispatch_indices(drm_device_t *dev, - drm_buf_t *buf, - unsigned int start, - unsigned int end) +static void mga_dma_dispatch_indices(drm_device_t * dev, + drm_buf_t * buf, + unsigned int start, unsigned int end) { - drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int address = (unsigned int)buf->bus_address; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int address = (unsigned int) buf->bus_address; int use_agp = PDEA_pagpxfer_enable; int i = 0; - int primary_needed; - PRIMLOCALS; + int primary_needed; + PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("dispatch indices %d addr 0x%x, " - "start 0x%x end 0x%x nbox %d dirty %x\n", - buf->idx, address, start, end, + "start 0x%x end 0x%x nbox %d dirty %x\n", + buf->idx, address, start, end, sarea_priv->nbox, sarea_priv->dirty); if (start != end) { @@ -628,174 +608,182 @@ static void mga_dma_dispatch_indices(drm_device_t *dev, * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; - primary_needed = (25+15+30+25+ - 10 + - 15 * MGA_NR_SAREA_CLIPRECTS); - PRIM_OVERFLOW( dev, dev_priv, primary_needed ); - mgaEmitState( dev_priv ); + primary_needed = (50 + 15 + 15 + 30 + 25 + + 10 + 15 * MGA_NR_SAREA_CLIPRECTS); + PRIM_OVERFLOW(dev, dev_priv, primary_needed); + mgaEmitState(dev_priv); do { if (i < sarea_priv->nbox) { DRM_DEBUG("idx %d Emit box %d/%d:" - "%d,%d - %d,%d\n", + "%d,%d - %d,%d\n", buf->idx, i, sarea_priv->nbox, - sarea_priv->boxes[i].x1, + sarea_priv->boxes[i].x1, sarea_priv->boxes[i].y1, - sarea_priv->boxes[i].x2, + sarea_priv->boxes[i].x2, sarea_priv->boxes[i].y2); - - mgaEmitClipRect( dev_priv, - &sarea_priv->boxes[i] ); + + mgaEmitClipRect(dev_priv, + &sarea_priv->boxes[i]); } - PRIMGETPTR( dev_priv ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_SETUPADDRESS, - ((address + start) | - SETADD_mode_vertlist) ); - PRIMOUTREG( MGAREG_SETUPEND, - ((address + end) | use_agp) ); - PRIMADVANCE( dev_priv ); - } while (++i < sarea_priv->nbox); + PRIMGETPTR(dev_priv); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_SETUPADDRESS, + ((address + start) | + SETADD_mode_vertlist)); + PRIMOUTREG(MGAREG_SETUPEND, + ((address + end) | use_agp)); + PRIMADVANCE(dev_priv); + } while (++i < sarea_priv->nbox); } - if (buf_priv->discard) { - if (buf_priv->dispatched == 1) AGEBUF(dev_priv, buf_priv); + if (buf_priv->discard) { + if (buf_priv->dispatched == 1) + AGEBUF(dev_priv, buf_priv); buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); + mga_freelist_put(dev, buf); } } -static void mga_dma_dispatch_clear( drm_device_t *dev, int flags, - unsigned int clear_color, - unsigned int clear_zval ) +static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, + unsigned int clear_color, + unsigned int clear_zval) { - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->ContextState; int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; unsigned int cmd; int i; - int primary_needed; - PRIMLOCALS; + int primary_needed; + PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - if ( dev_priv->sgram ) + if (dev_priv->sgram) cmd = MGA_CLEAR_CMD | DC_atype_blk; else cmd = MGA_CLEAR_CMD | DC_atype_rstr; - - primary_needed = nbox * 70; - if (primary_needed == 0) primary_needed = 70; - PRIM_OVERFLOW( dev, dev_priv, primary_needed ); - PRIMGETPTR( dev_priv ); - - for (i = 0 ; i < nbox ; i++) { + + primary_needed = nbox * 70; + if (primary_needed == 0) + primary_needed = 70; + PRIM_OVERFLOW(dev, dev_priv, primary_needed); + PRIMGETPTR(dev_priv); + + for (i = 0; i < nbox; i++) { unsigned int height = pbox[i].y2 - pbox[i].y1; - DRM_DEBUG("dispatch clear %d,%d-%d,%d flags %x!\n", - pbox[i].x1, pbox[i].y1, pbox[i].x2, + DRM_DEBUG("dispatch clear %d,%d-%d,%d flags %x!\n", + pbox[i].x1, pbox[i].y1, pbox[i].x2, pbox[i].y2, flags); - if ( flags & MGA_FRONT ) { - DRM_DEBUG("clear front\n"); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_YDSTLEN, (pbox[i].y1<<16)|height); - PRIMOUTREG( MGAREG_FXBNDRY, (pbox[i].x2<<16)|pbox[i].x1); - - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_FCOL, clear_color ); - PRIMOUTREG( MGAREG_DSTORG, dev_priv->frontOffset ); - PRIMOUTREG( MGAREG_DWGCTL+MGAREG_MGA_EXEC, cmd ); + if (flags & MGA_FRONT) { + DRM_DEBUG("clear front\n"); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_YDSTLEN, + (pbox[i].y1 << 16) | height); + PRIMOUTREG(MGAREG_FXBNDRY, + (pbox[i].x2 << 16) | pbox[i].x1); + + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_FCOL, clear_color); + PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset); + PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd); } - if ( flags & MGA_BACK ) { + if (flags & MGA_BACK) { DRM_DEBUG("clear back\n"); - PRIMOUTREG( MGAREG_DMAPAD, 0); - PRIMOUTREG( MGAREG_DMAPAD, 0); - PRIMOUTREG( MGAREG_YDSTLEN, (pbox[i].y1<<16)|height ); - PRIMOUTREG( MGAREG_FXBNDRY, (pbox[i].x2<<16)|pbox[i].x1 ); - - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_FCOL, clear_color ); - PRIMOUTREG( MGAREG_DSTORG, dev_priv->backOffset ); - PRIMOUTREG( MGAREG_DWGCTL+MGAREG_MGA_EXEC, cmd ); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_YDSTLEN, + (pbox[i].y1 << 16) | height); + PRIMOUTREG(MGAREG_FXBNDRY, + (pbox[i].x2 << 16) | pbox[i].x1); + + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_FCOL, clear_color); + PRIMOUTREG(MGAREG_DSTORG, dev_priv->backOffset); + PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd); } - if ( flags & MGA_DEPTH ) { + if (flags & MGA_DEPTH) { DRM_DEBUG("clear depth\n"); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_YDSTLEN, (pbox[i].y1<<16)|height ); - PRIMOUTREG( MGAREG_FXBNDRY, (pbox[i].x2<<16)|pbox[i].x1 ); - - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_FCOL, clear_zval ); - PRIMOUTREG( MGAREG_DSTORG, dev_priv->depthOffset ); - PRIMOUTREG( MGAREG_DWGCTL+MGAREG_MGA_EXEC, cmd ); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_YDSTLEN, + (pbox[i].y1 << 16) | height); + PRIMOUTREG(MGAREG_FXBNDRY, + (pbox[i].x2 << 16) | pbox[i].x1); + + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_FCOL, clear_zval); + PRIMOUTREG(MGAREG_DSTORG, dev_priv->depthOffset); + PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd); } } /* Force reset of DWGCTL */ - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] ); - PRIMADVANCE( dev_priv ); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); + PRIMADVANCE(dev_priv); } -static void mga_dma_dispatch_swap( drm_device_t *dev ) +static void mga_dma_dispatch_swap(drm_device_t * dev) { - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->ContextState; int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; int i; - int primary_needed; - PRIMLOCALS; + int primary_needed; + PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - primary_needed = nbox * 5; - primary_needed += 60; + primary_needed = nbox * 5; + primary_needed += 60; PRIM_OVERFLOW(dev, dev_priv, primary_needed); - PRIMGETPTR( dev_priv ); - - PRIMOUTREG( MGAREG_DSTORG, dev_priv->frontOffset ); - PRIMOUTREG( MGAREG_MACCESS, dev_priv->mAccess ); - PRIMOUTREG( MGAREG_SRCORG, dev_priv->backOffset ); - PRIMOUTREG( MGAREG_AR5, dev_priv->stride/2 ); - - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DWGCTL, MGA_COPY_CMD ); - - for (i = 0 ; i < nbox; i++) { + PRIMGETPTR(dev_priv); + + PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset); + PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess); + PRIMOUTREG(MGAREG_SRCORG, dev_priv->backOffset); + PRIMOUTREG(MGAREG_AR5, dev_priv->stride / 2); + + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); + + for (i = 0; i < nbox; i++) { unsigned int h = pbox[i].y2 - pbox[i].y1; - unsigned int start = pbox[i].y1 * dev_priv->stride/2; - - DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", - pbox[i].x1, pbox[i].y1, - pbox[i].x2, pbox[i].y2); - - PRIMOUTREG( MGAREG_AR0, start + pbox[i].x2 - 1 ); - PRIMOUTREG( MGAREG_AR3, start + pbox[i].x1 ); - PRIMOUTREG( MGAREG_FXBNDRY, pbox[i].x1|((pbox[i].x2 - 1)<<16) ); - PRIMOUTREG( MGAREG_YDSTLEN+MGAREG_MGA_EXEC, (pbox[i].y1<<16)|h ); + unsigned int start = pbox[i].y1 * dev_priv->stride / 2; + + DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", + pbox[i].x1, pbox[i].y1, pbox[i].x2, pbox[i].y2); + + PRIMOUTREG(MGAREG_AR0, start + pbox[i].x2 - 1); + PRIMOUTREG(MGAREG_AR3, start + pbox[i].x1); + PRIMOUTREG(MGAREG_FXBNDRY, + pbox[i].x1 | ((pbox[i].x2 - 1) << 16)); + PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, + (pbox[i].y1 << 16) | h); } - /* Force reset of DWGCTL */ - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_DMAPAD, 0 ); - PRIMOUTREG( MGAREG_SRCORG, 0 ); - PRIMOUTREG( MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL] ); + /* Force reset of DWGCTL */ + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_SRCORG, 0); + PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); - PRIMADVANCE( dev_priv ); + PRIMADVANCE(dev_priv); } int mga_clear_bufs(struct inode *inode, struct file *filp, @@ -803,32 +791,32 @@ int mga_clear_bufs(struct inode *inode, struct file *filp, { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_private_t *dev_priv = + (drm_mga_private_t *) dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_mga_clear_t clear; - copy_from_user_ret(&clear, (drm_mga_clear_t *)arg, sizeof(clear), + copy_from_user_ret(&clear, (drm_mga_clear_t *) arg, sizeof(clear), -EFAULT); DRM_DEBUG("%s\n", __FUNCTION__); - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("mga_clear_bufs called without lock held\n"); return -EINVAL; } - - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + + if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; /* Make sure we restore the 3D state next time. */ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; - mga_dma_dispatch_clear( dev, clear.flags, - clear.clear_color, - clear.clear_depth ); - PRIMUPDATE(dev_priv); + mga_dma_dispatch_clear(dev, clear.flags, + clear.clear_color, clear.clear_depth); + PRIMUPDATE(dev_priv); mga_flush_write_combine(); mga_dma_schedule(dev, 1); - return 0; + return 0; } int mga_swap_bufs(struct inode *inode, struct file *filp, @@ -836,76 +824,77 @@ int mga_swap_bufs(struct inode *inode, struct file *filp, { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_private_t *dev_priv = + (drm_mga_private_t *) dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; DRM_DEBUG("%s\n", __FUNCTION__); - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("mga_swap_bufs called without lock held\n"); return -EINVAL; } - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) - sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; /* Make sure we restore the 3D state next time. */ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; - mga_dma_dispatch_swap( dev ); - PRIMUPDATE(dev_priv); - set_bit(MGA_BUF_SWAP_PENDING, &dev_priv->current_prim->buffer_status); + mga_dma_dispatch_swap(dev); + PRIMUPDATE(dev_priv); + set_bit(MGA_BUF_SWAP_PENDING, + &dev_priv->current_prim->buffer_status); mga_flush_write_combine(); mga_dma_schedule(dev, 1); - return 0; + return 0; } int mga_iload(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_iload_t iload; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = + (drm_mga_private_t *) dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + drm_mga_iload_t iload; unsigned long bus_address; DRM_DEBUG("%s\n", __FUNCTION__); - - DRM_DEBUG("Starting Iload\n"); - copy_from_user_ret(&iload, (drm_mga_iload_t *)arg, sizeof(iload), - -EFAULT); - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_DEBUG("Starting Iload\n"); + copy_from_user_ret(&iload, (drm_mga_iload_t *) arg, sizeof(iload), + -EFAULT); + + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("mga_iload called without lock held\n"); return -EINVAL; } - buf = dma->buflist[ iload.idx ]; + buf = dma->buflist[iload.idx]; buf_priv = buf->dev_private; - bus_address = buf->bus_address; - DRM_DEBUG("bus_address %lx, length %d, destorg : %x\n", - bus_address, iload.length, iload.destOrg); - - if(mgaVerifyIload(dev_priv, - bus_address, - iload.destOrg, - iload.length)) { - mga_freelist_put(dev, buf); - return -EINVAL; + bus_address = buf->bus_address; + DRM_DEBUG("bus_address %lx, length %d, destorg : %x\n", + bus_address, iload.length, iload.destOrg); + + if (mgaVerifyIload(dev_priv, + bus_address, iload.destOrg, iload.length)) { + mga_freelist_put(dev, buf); + return -EINVAL; } - - sarea_priv->dirty |= MGA_UPLOAD_CTX; - mga_dma_dispatch_tex_blit(dev, bus_address, iload.length, + sarea_priv->dirty |= MGA_UPLOAD_CTX; + + mga_dma_dispatch_tex_blit(dev, bus_address, iload.length, iload.destOrg); AGEBUF(dev_priv, buf_priv); buf_priv->discard = 1; - mga_freelist_put(dev, buf); + mga_freelist_put(dev, buf); mga_flush_write_combine(); mga_dma_schedule(dev, 1); - return 0; + return 0; } int mga_vertex(struct inode *inode, struct file *filp, @@ -913,45 +902,47 @@ int mga_vertex(struct inode *inode, struct file *filp, { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = + (drm_mga_private_t *) dev->dev_private; + drm_device_dma_t *dma = dev->dma; drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; + drm_mga_buf_priv_t *buf_priv; drm_mga_vertex_t vertex; DRM_DEBUG("%s\n", __FUNCTION__); - copy_from_user_ret(&vertex, (drm_mga_vertex_t *)arg, sizeof(vertex), - -EFAULT); - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + copy_from_user_ret(&vertex, (drm_mga_vertex_t *) arg, + sizeof(vertex), -EFAULT); + + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("mga_vertex called without lock held\n"); return -EINVAL; } DRM_DEBUG("mga_vertex\n"); - buf = dma->buflist[ vertex.idx ]; - buf_priv = buf->dev_private; + buf = dma->buflist[vertex.idx]; + buf_priv = buf->dev_private; buf->used = vertex.used; buf_priv->discard = vertex.discard; - + if (!mgaVerifyState(dev_priv)) { - if (vertex.discard) { - if(buf_priv->dispatched == 1) AGEBUF(dev_priv, buf_priv); - buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); - } - DRM_DEBUG("bad state\n"); - return -EINVAL; + if (vertex.discard) { + if (buf_priv->dispatched == 1) + AGEBUF(dev_priv, buf_priv); + buf_priv->dispatched = 0; + mga_freelist_put(dev, buf); + } + DRM_DEBUG("bad state\n"); + return -EINVAL; } mga_dma_dispatch_vertex(dev, buf); - PRIMUPDATE(dev_priv); + PRIMUPDATE(dev_priv); mga_flush_write_combine(); mga_dma_schedule(dev, 1); - return 0; + return 0; } @@ -960,48 +951,50 @@ int mga_indices(struct inode *inode, struct file *filp, { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = + (drm_mga_private_t *) dev->dev_private; + drm_device_dma_t *dma = dev->dma; drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; + drm_mga_buf_priv_t *buf_priv; drm_mga_indices_t indices; DRM_DEBUG("%s\n", __FUNCTION__); - copy_from_user_ret(&indices, (drm_mga_indices_t *)arg, sizeof(indices), - -EFAULT); - - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + copy_from_user_ret(&indices, (drm_mga_indices_t *) arg, + sizeof(indices), -EFAULT); + + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("mga_indices called without lock held\n"); return -EINVAL; } DRM_DEBUG("mga_indices\n"); - buf = dma->buflist[ indices.idx ]; - buf_priv = buf->dev_private; + buf = dma->buflist[indices.idx]; + buf_priv = buf->dev_private; buf_priv->discard = indices.discard; - + if (!mgaVerifyState(dev_priv)) { - if (indices.discard) { - if(buf_priv->dispatched == 1) AGEBUF(dev_priv, buf_priv); - buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); - } - return -EINVAL; + if (indices.discard) { + if (buf_priv->dispatched == 1) + AGEBUF(dev_priv, buf_priv); + buf_priv->dispatched = 0; + mga_freelist_put(dev, buf); + } + return -EINVAL; } mga_dma_dispatch_indices(dev, buf, indices.start, indices.end); - PRIMUPDATE(dev_priv); + PRIMUPDATE(dev_priv); mga_flush_write_combine(); mga_dma_schedule(dev, 1); - return 0; + return 0; } -static int mga_dma_get_buffers(drm_device_t *dev, drm_dma_t *d) +static int mga_dma_get_buffers(drm_device_t * dev, drm_dma_t * d) { int i; drm_buf_t *buf; @@ -1009,16 +1002,13 @@ static int mga_dma_get_buffers(drm_device_t *dev, drm_dma_t *d) for (i = d->granted_count; i < d->request_count; i++) { buf = mga_freelist_get(dev); - if (!buf) break; + if (!buf) + break; buf->pid = current->pid; copy_to_user_ret(&d->request_indices[i], - &buf->idx, - sizeof(buf->idx), - -EFAULT); + &buf->idx, sizeof(buf->idx), -EFAULT); copy_to_user_ret(&d->request_sizes[i], - &buf->total, - sizeof(buf->total), - -EFAULT); + &buf->total, sizeof(buf->total), -EFAULT); ++d->granted_count; } return 0; @@ -1027,18 +1017,18 @@ static int mga_dma_get_buffers(drm_device_t *dev, drm_dma_t *d) int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - int retcode = 0; - drm_dma_t d; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + int retcode = 0; + drm_dma_t d; DRM_DEBUG("%s\n", __FUNCTION__); - copy_from_user_ret(&d, (drm_dma_t *)arg, sizeof(d), -EFAULT); + copy_from_user_ret(&d, (drm_dma_t *) arg, sizeof(d), -EFAULT); DRM_DEBUG("%d %d: %d send, %d req\n", current->pid, d.context, d.send_count, d.request_count); - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("mga_dma called without lock held\n"); return -EINVAL; } @@ -1046,19 +1036,21 @@ int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd, /* Please don't send us buffers. */ if (d.send_count != 0) { - DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", - current->pid, d.send_count); + DRM_ERROR + ("Process %d trying to send %d buffers via drmDMA\n", + current->pid, d.send_count); return -EINVAL; } - + /* We'll send you buffers. */ if (d.request_count < 0 || d.request_count > dma->buf_count) { - DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", - current->pid, d.request_count, dma->buf_count); + DRM_ERROR + ("Process %d trying to get %d buffers (of %d max)\n", + current->pid, d.request_count, dma->buf_count); return -EINVAL; } - + d.granted_count = 0; if (d.request_count) { @@ -1067,6 +1059,6 @@ int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd, DRM_DEBUG("%d returning, granted = %d\n", current->pid, d.granted_count); - copy_to_user_ret((drm_dma_t *)arg, &d, sizeof(d), -EFAULT); + copy_to_user_ret((drm_dma_t *) arg, &d, sizeof(d), -EFAULT); return retcode; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c index 392abceb9..ba6dee00d 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c @@ -1,7 +1,8 @@ /* proc.c -- /proc support for DRM -*- linux-c -*- * Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -22,9 +23,9 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.6 2000/02/23 04:47:30 martin Exp $ * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> */ #define __NO_VERSION__ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c index 45ade1def..53ac8ce34 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c @@ -38,10 +38,10 @@ EXPORT_SYMBOL(r128_cleanup); #define R128_NAME "r128" #define R128_DESC "r128" -#define R128_DATE "20000422" -#define R128_MAJOR 0 +#define R128_DATE "20000607" +#define R128_MAJOR 1 #define R128_MINOR 0 -#define R128_PATCHLEVEL 5 +#define R128_PATCHLEVEL 0 static drm_device_t r128_device; drm_ctx_t r128_res_ctx; diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c index 842d6f5d5..c8d6e50ea 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c @@ -1,8 +1,8 @@ /* tdfx_context.c -- IOCTLs for tdfx contexts -*- linux-c -*- * Created: Thu Oct 7 10:50:22 1999 by faith@precisioninsight.com - * Revised: Sat Oct 9 23:39:56 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,8 +24,10 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c,v 1.2 2000/02/23 04:47:30 martin Exp $ - * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Daryll Strauss <daryll@valinux.com> + * */ #include <linux/sched.h> @@ -38,9 +40,7 @@ extern drm_ctx_t tdfx_res_ctx; static int tdfx_alloc_queue(drm_device_t *dev) { - static int context = 0; - - return ++context; /* Should this reuse contexts in the future? */ + return drm_ctxbitmap_next(dev); } int tdfx_context_switch(drm_device_t *dev, int old, int new) @@ -137,6 +137,12 @@ int tdfx_addctx(struct inode *inode, struct file *filp, unsigned int cmd, ctx.handle = tdfx_alloc_queue(dev); } DRM_DEBUG("%d\n", ctx.handle); + if (ctx.handle == -1) { + DRM_DEBUG("Not enough free contexts.\n"); + /* Should this return -EBUSY instead? */ + return -ENOMEM; + } + copy_to_user_ret((drm_ctx_t *)arg, &ctx, sizeof(ctx), -EFAULT); return 0; } @@ -193,13 +199,13 @@ int tdfx_newctx(struct inode *inode, struct file *filp, unsigned int cmd, int tdfx_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; drm_ctx_t ctx; copy_from_user_ret(&ctx, (drm_ctx_t *)arg, sizeof(ctx), -EFAULT); DRM_DEBUG("%d\n", ctx.handle); - /* This is currently a noop because we - don't reuse context values. Perhaps we - should? */ - + drm_ctxbitmap_free(dev, ctx.handle); + return 0; } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c index 57c1c719d..d8fef9538 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c @@ -1,8 +1,8 @@ /* tdfx.c -- tdfx driver -*- linux-c -*- * Created: Thu Oct 7 10:38:32 1999 by faith@precisioninsight.com - * Revised: Tue Oct 12 08:51:35 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c,v 1.3 2000/02/23 04:47:31 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Daryll Strauss <daryll@valinux.com> * */ @@ -37,9 +39,9 @@ EXPORT_SYMBOL(tdfx_cleanup); #define TDFX_NAME "tdfx" #define TDFX_DESC "tdfx" #define TDFX_DATE "19991009" -#define TDFX_MAJOR 0 +#define TDFX_MAJOR 1 #define TDFX_MINOR 0 -#define TDFX_PATCHLEVEL 1 +#define TDFX_PATCHLEVEL 0 static drm_device_t tdfx_device; drm_ctx_t tdfx_res_ctx; @@ -85,6 +87,16 @@ static drm_ioctl_desc_t tdfx_ioctls[] = { [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 }, [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, +#ifdef DRM_AGP + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = {drm_agp_free, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = {drm_agp_unbind, 1, 1}, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_bind, 1, 1}, +#endif }; #define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls) @@ -228,7 +240,24 @@ static int tdfx_takedown(drm_device_t *dev) } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } - +#ifdef DRM_AGP + /* Clear AGP information */ + if (dev->agp) { + drm_agp_mem_t *temp; + drm_agp_mem_t *temp_next; + + temp = dev->agp->memory; + while(temp != NULL) { + temp_next = temp->next; + drm_free_agp(temp->memory, temp->pages); + drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); + temp = temp_next; + } + if(dev->agp->acquired) (*drm_agp.release)(); + drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); + dev->agp = NULL; + } +#endif /* Clear vma list (only built for debugging) */ if (dev->vmalist) { for (vma = dev->vmalist; vma; vma = vma_next) { @@ -262,6 +291,10 @@ static int tdfx_takedown(drm_device_t *dev) - PAGE_SHIFT, DRM_MEM_SAREA); break; + case _DRM_AGP: + /* Do nothing here, because this is all + handled in the AGP/GART driver. */ + break; } drm_free(map, sizeof(*map), DRM_MEM_MAPS); } @@ -309,6 +342,16 @@ int tdfx_init(void) drm_mem_init(); drm_proc_init(dev); +#ifdef DRM_AGP + dev->agp = drm_agp_init(); +#endif + if((retcode = drm_ctxbitmap_init(dev))) { + DRM_ERROR("Cannot allocate memory for context bitmap.\n"); + drm_proc_cleanup(); + misc_deregister(&tdfx_misc); + tdfx_takedown(dev); + return retcode; + } DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", TDFX_NAME, @@ -335,6 +378,7 @@ void tdfx_cleanup(void) } else { DRM_INFO("Module unloaded\n"); } + drm_ctxbitmap_cleanup(dev); tdfx_takedown(dev); } diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h index 3866010a8..6b1c208ef 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h @@ -1,8 +1,8 @@ /* tdfx_drv.h -- Private header for tdfx driver -*- linux-c -*- * Created: Thu Oct 7 10:40:04 1999 by faith@precisioninsight.com - * Revised: Sat Oct 9 23:38:19 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,6 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h,v 1.2 2000/02/23 04:47:31 martin Exp $ * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c index 9c2cea56a..0b2b00e0a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c @@ -1,7 +1,8 @@ /* vm.c -- Memory mapping for DRM -*- linux-c -*- * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,7 +24,8 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c,v 1.5 2000/02/23 04:47:31 martin Exp $ + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * */ diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c index 2e3c9b431..1174a0fa2 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c @@ -1,7 +1,8 @@ /* xf86drm.c -- User-level interface to DRM device * Created: Tue Jan 5 08:16:21 1999 by faith@precisioninsight.com * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -23,8 +24,9 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Author: Rickard E. (Rik) Faith <faith@precisioninsight.com> - * + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.10 2000/02/23 04:47:23 martin Exp $ * */ @@ -71,10 +73,23 @@ extern int xf86RemoveSIGIOHandler(int fd); #define MAP_FAILED ((void *)-1) #endif -#include <sys/sysmacros.h> /* for makedev() */ #include "xf86drm.h" #include "drm.h" +#define DRM_FIXED_DEVICE_MAJOR 145 + +#ifdef __linux__ +#include <sys/sysmacros.h> /* for makedev() */ +#endif + +#ifndef makedev + /* This definition needs to be changed on + some systems if dev_t is a structure. + If there is a header file we can get it + from, there would be best. */ +#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) +#endif + static void *drmHashTable = NULL; /* Context switch callbacks */ typedef struct drmHashEntry { @@ -95,9 +110,16 @@ void drmFree(void *pt) if (pt) _DRM_FREE(pt); } +/* drmStrdup can't use strdup(3), since it doesn't call _DRM_MALLOC... */ static char *drmStrdup(const char *s) { - return s ? strdup(s) : NULL; + char *retval = NULL; + + if (s) { + retval = _DRM_MALLOC(strlen(s)+1); + strcpy(retval, s); + } + return retval; } @@ -134,7 +156,7 @@ static drmHashEntry *drmGetEntry(int fd) return entry; } -/* drm_open is used to open the /dev/drm device */ +/* drm_open is used to open the /dev/dri device */ static int drm_open(const char *file) { @@ -144,14 +166,6 @@ static int drm_open(const char *file) return -errno; } -/* drmAvailable looks for /proc/dri, and returns 1 if it is present. */ - -int drmAvailable(void) -{ - if (!access("/proc/dri/0", R_OK)) return 1; - return 0; -} - static int drmOpenDevice(const char *path, long dev, mode_t mode, uid_t user, gid_t group) { @@ -161,7 +175,16 @@ static int drmOpenDevice(const char *path, long dev, struct stat st; #endif - if (!stat(path, &st) && st.st_rdev == dev) return drm_open(path); + /* Fiddle mode to remove execute bits */ + mode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); + + if (!stat(path, &st) && st.st_rdev == dev) { + if (!geteuid()) { + chown(path, user, group); + chmod(path, mode); + } + return drm_open(path); + } if (geteuid()) return DRM_ERR_NOT_ROOT; remove(path); @@ -174,6 +197,38 @@ static int drmOpenDevice(const char *path, long dev, return drm_open(path); } +/* drmAvailable looks for /proc/dri, and returns 1 if it is present. On + OSs that do not have a Linux-like /proc, this information will not be + available, and we'll have to create a device and check if the driver is + loaded that way. */ + +int drmAvailable(void) +{ + char dev_name[64]; + drmVersionPtr version; + int retval = 0; + int fd; + + if (!access("/proc/dri/0", R_OK)) return 1; + + sprintf(dev_name, "/dev/dri-temp-%d", getpid()); + + remove(dev_name); + if ((fd = drmOpenDevice(dev_name, makedev(DRM_FIXED_DEVICE_MAJOR, 0), + S_IRUSR, geteuid(), getegid())) >= 0) { + /* Read version to make sure this is + actually a DRI device. */ + if ((version = drmGetVersion(fd))) { + retval = 1; + drmFreeVersion(version); + } + close(fd); + } + remove(dev_name); + + return retval; +} + static int drmOpenByBusid(const char *busid) { int i; @@ -268,7 +323,24 @@ static int drmOpenByName(const char *name) } } } - } else remove(dev_name); + } else { + drmVersionPtr version; + /* /proc/dri not available, possibly + because we aren't on a Linux system. + So, try to create the next device and + see if it's active. */ + dev = makedev(DRM_FIXED_DEVICE_MAJOR, i); + if ((fd = drmOpenDevice(dev_name, dev, mode, user, group))) { + if ((version = drmGetVersion(fd))) { + if (!strcmp(version->name, name)) { + drmFreeVersion(version); + return fd; + } + drmFreeVersion(version); + } + } + remove(dev_name); + } } return -1; } @@ -303,7 +375,7 @@ static void drmFreeKernelVersion(drm_version_t *v) drmFree(v); } -static void drmCopyVersion(drmVersionPtr d, drm_version_t *s) +static void drmCopyVersion(drmVersionPtr d, const drm_version_t *s) { d->version_major = s->version_major; d->version_minor = s->version_minor; @@ -317,7 +389,7 @@ static void drmCopyVersion(drmVersionPtr d, drm_version_t *s) } /* drmVersion obtains the version information via an ioctl. Similar - * information is available via /proc/drm. */ + * information is available via /proc/dri. */ drmVersionPtr drmGetVersion(int fd) { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h index c63d0f637..c8c5581da 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h @@ -1,7 +1,8 @@ /* drm.h -- Header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -22,8 +23,9 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h,v 1.5 2000/02/23 04:47:26 martin Exp $ + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> * * Acknowledgements: * Dec 1999, Richard Henderson <rth@twiddle.net>, move to generic cmpxchg. diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c index fc08cb51a..14a8c9f5a 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c +++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c @@ -1361,6 +1361,18 @@ xf86geteuid(void) return geteuid(); } +xf86gid_t +xf86getegid(void) +{ + return getegid(); +} + +int +xf86getpid(void) +{ + return getpid(); +} + static mode_t xfToOsMknodMode(xf86mode_t xfmode) { diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h index 23389ea39..01e12ec0f 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h @@ -267,6 +267,8 @@ extern long xf86fpossize(void); extern int xf86chmod(const char *, xf86mode_t); extern int xf86chown(const char *, xf86uid_t, xf86gid_t); extern xf86uid_t xf86geteuid(void); +extern xf86gid_t xf86getegid(void); +extern int xf86getpid(void); extern int xf86mknod(const char *, xf86mode_t, xf86dev_t); extern int xf86mkdir(const char *, xf86mode_t); unsigned int xf86sleep(unsigned int seconds); diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h index 321fd3f13..c11c73c48 100644 --- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h +++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h @@ -421,6 +421,10 @@ typedef int xf86key_t; #define chown(a,b,c) xf86chown(a,b,c) #undef geteuid #define geteuid xf86geteuid +#undef getegid +#define getegid xf86getegid +#undef getpid +#define getpid xf86getpid #undef mknod #define mknod(a,b,c) xf86mknod(a,b,c) #undef sleep |