From a0c4815433ccd57322f4f7703ca35e9ccfa59250 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 8 Oct 2009 13:15:52 +0000 Subject: Added MesaLib-7.6 --- mesalib/Makefile | 574 ++ mesalib/acinclude.m4 | 119 + mesalib/aclocal.m4 | 172 + mesalib/bin/config.guess | 1555 ++++ mesalib/bin/config.sub | 1685 ++++ mesalib/bin/install-sh | 0 mesalib/bin/minstall | 93 + mesalib/bin/mklib | 976 ++ mesalib/bin/version.mk | 17 + mesalib/configs/aix | 30 + mesalib/configs/aix-64 | 27 + mesalib/configs/aix-64-static | 25 + mesalib/configs/aix-gcc | 23 + mesalib/configs/aix-static | 25 + mesalib/configs/autoconf.in | 148 + mesalib/configs/beos | 104 + mesalib/configs/bluegene-osmesa | 33 + mesalib/configs/bluegene-xlc-osmesa | 29 + mesalib/configs/catamount-osmesa-pgi | 32 + mesalib/configs/config.mgw | 42 + mesalib/configs/darwin | 57 + mesalib/configs/darwin-fat-32bit | 7 + mesalib/configs/darwin-fat-all | 7 + mesalib/configs/darwin-x86ppc | 33 + mesalib/configs/default | 148 + mesalib/configs/freebsd | 31 + mesalib/configs/freebsd-dri | 55 + mesalib/configs/freebsd-dri-amd64 | 10 + mesalib/configs/freebsd-dri-x86 | 13 + mesalib/configs/hpux10 | 14 + mesalib/configs/hpux10-gcc | 20 + mesalib/configs/hpux10-static | 30 + mesalib/configs/hpux11-32 | 30 + mesalib/configs/hpux11-32-static | 27 + mesalib/configs/hpux11-32-static-nothreads | 26 + mesalib/configs/hpux11-64 | 31 + mesalib/configs/hpux11-64-static | 27 + mesalib/configs/hpux11-ia64 | 30 + mesalib/configs/hpux11-ia64-static | 27 + mesalib/configs/hpux9 | 16 + mesalib/configs/hpux9-gcc | 14 + mesalib/configs/irix6-64 | 17 + mesalib/configs/irix6-64-static | 26 + mesalib/configs/irix6-n32 | 17 + mesalib/configs/irix6-n32-static | 25 + mesalib/configs/irix6-o32 | 18 + mesalib/configs/irix6-o32-static | 25 + mesalib/configs/linux | 38 + mesalib/configs/linux-alpha | 22 + mesalib/configs/linux-alpha-static | 31 + mesalib/configs/linux-cell | 67 + mesalib/configs/linux-cell-debug | 10 + mesalib/configs/linux-debug | 8 + mesalib/configs/linux-directfb | 38 + mesalib/configs/linux-dri | 67 + mesalib/configs/linux-dri-debug | 16 + mesalib/configs/linux-dri-ppc | 17 + mesalib/configs/linux-dri-x86 | 13 + mesalib/configs/linux-dri-x86-64 | 24 + mesalib/configs/linux-dri-xcb | 72 + mesalib/configs/linux-egl | 65 + mesalib/configs/linux-fbdev | 19 + mesalib/configs/linux-glide | 23 + mesalib/configs/linux-ia64-icc | 21 + mesalib/configs/linux-ia64-icc-static | 27 + mesalib/configs/linux-icc | 22 + mesalib/configs/linux-icc-static | 27 + mesalib/configs/linux-indirect | 53 + mesalib/configs/linux-llvm | 42 + mesalib/configs/linux-osmesa | 28 + mesalib/configs/linux-osmesa-static | 37 + mesalib/configs/linux-osmesa16 | 31 + mesalib/configs/linux-osmesa16-static | 32 + mesalib/configs/linux-osmesa32 | 31 + mesalib/configs/linux-ppc | 9 + mesalib/configs/linux-ppc-static | 15 + mesalib/configs/linux-profile | 8 + mesalib/configs/linux-solo | 54 + mesalib/configs/linux-solo-ia64 | 7 + mesalib/configs/linux-solo-x86 | 10 + mesalib/configs/linux-sparc | 9 + mesalib/configs/linux-sparc5 | 7 + mesalib/configs/linux-static | 26 + mesalib/configs/linux-ultrasparc | 7 + mesalib/configs/linux-x86 | 11 + mesalib/configs/linux-x86-32 | 7 + mesalib/configs/linux-x86-64 | 14 + mesalib/configs/linux-x86-64-debug | 8 + mesalib/configs/linux-x86-64-profile | 8 + mesalib/configs/linux-x86-64-static | 27 + mesalib/configs/linux-x86-debug | 9 + mesalib/configs/linux-x86-glide | 28 + mesalib/configs/linux-x86-profile | 8 + mesalib/configs/linux-x86-static | 26 + mesalib/configs/netbsd | 17 + mesalib/configs/openbsd | 22 + mesalib/configs/osf1 | 16 + mesalib/configs/osf1-static | 17 + mesalib/configs/solaris-x86 | 18 + mesalib/configs/solaris-x86-gcc | 21 + mesalib/configs/solaris-x86-gcc-static | 28 + mesalib/configs/sunos4 | 12 + mesalib/configs/sunos4-gcc | 19 + mesalib/configs/sunos4-static | 25 + mesalib/configs/sunos5 | 18 + mesalib/configs/sunos5-64-gcc | 11 + mesalib/configs/sunos5-gcc | 40 + mesalib/configs/sunos5-smp | 19 + mesalib/configs/sunos5-v8 | 18 + mesalib/configs/sunos5-v8-static | 16 + mesalib/configs/sunos5-v9 | 23 + mesalib/configs/sunos5-v9-cc-g++ | 35 + mesalib/configs/sunos5-v9-static | 18 + mesalib/configs/ultrix-gcc | 25 + mesalib/configure | 9013 +++++++++++++++++++ mesalib/configure.ac | 1309 +++ mesalib/docs/COPYING | 490 + mesalib/docs/MESA_agp_offset.spec | 95 + mesalib/docs/MESA_copy_sub_buffer.spec | 96 + mesalib/docs/MESA_pack_invert.spec | 138 + mesalib/docs/MESA_pixmap_colormap.spec | 90 + mesalib/docs/MESA_release_buffers.spec | 85 + mesalib/docs/MESA_resize_buffers.spec | 81 + mesalib/docs/MESA_set_3dfx_mode.spec | 85 + mesalib/docs/MESA_shader_debug.spec | 264 + mesalib/docs/MESA_swap_control.spec | 132 + mesalib/docs/MESA_swap_frame_usage.spec | 201 + mesalib/docs/MESA_texture_array.spec | 804 ++ mesalib/docs/MESA_texture_signed_rgba.spec | 214 + mesalib/docs/MESA_window_pos.spec | 126 + mesalib/docs/MESA_ycbcr_texture.spec | 204 + mesalib/docs/MiniGLX.html | 534 ++ mesalib/docs/README.3DFX | 830 ++ mesalib/docs/README.AMIWIN | 181 + mesalib/docs/README.BEOS | 136 + mesalib/docs/README.CYGWIN | 256 + mesalib/docs/README.D3D | 124 + mesalib/docs/README.DJ | 275 + mesalib/docs/README.GGI | 26 + mesalib/docs/README.LYNXOS | 64 + mesalib/docs/README.MINGW32 | 153 + mesalib/docs/README.MITS | 102 + mesalib/docs/README.NeXT | 6 + mesalib/docs/README.OS2 | 96 + mesalib/docs/README.OpenStep | 35 + mesalib/docs/README.QUAKE | 207 + mesalib/docs/README.THREADS | 52 + mesalib/docs/README.VMS | 38 + mesalib/docs/README.WIN32 | 163 + mesalib/docs/README.WINDML | 146 + mesalib/docs/README.directfb | 29 + mesalib/docs/RELNOTES-3.1 | 145 + mesalib/docs/RELNOTES-3.2 | 11 + mesalib/docs/RELNOTES-3.2.1 | 31 + mesalib/docs/RELNOTES-3.3 | 270 + mesalib/docs/RELNOTES-3.4 | 21 + mesalib/docs/RELNOTES-3.4.1 | 21 + mesalib/docs/RELNOTES-3.4.2 | 21 + mesalib/docs/RELNOTES-3.5 | 227 + mesalib/docs/RELNOTES-4.0 | 162 + mesalib/docs/RELNOTES-4.0.1 | 21 + mesalib/docs/RELNOTES-4.0.2 | 49 + mesalib/docs/RELNOTES-4.0.3 | 51 + mesalib/docs/RELNOTES-4.1 | 307 + mesalib/docs/RELNOTES-5.0 | 84 + mesalib/docs/RELNOTES-5.0.1 | 45 + mesalib/docs/RELNOTES-5.0.2 | 45 + mesalib/docs/RELNOTES-5.1 | 279 + mesalib/docs/RELNOTES-6.0 | 86 + mesalib/docs/RELNOTES-6.0.1 | 49 + mesalib/docs/RELNOTES-6.1 | 111 + mesalib/docs/RELNOTES-6.2 | 51 + mesalib/docs/RELNOTES-6.2.1 | 49 + mesalib/docs/RELNOTES-6.3 | 114 + mesalib/docs/RELNOTES-6.3.1 | 48 + mesalib/docs/RELNOTES-6.3.2 | 36 + mesalib/docs/RELNOTES-6.4 | 49 + mesalib/docs/autoconf.html | 289 + mesalib/docs/banner.html | 27 + mesalib/docs/bugs.html | 53 + mesalib/docs/cell.html | 138 + mesalib/docs/conform.html | 695 ++ mesalib/docs/contents.html | 104 + mesalib/docs/debugging.html | 38 + mesalib/docs/demos.html | 18 + mesalib/docs/developers.html | 51 + mesalib/docs/devinfo.html | 220 + mesalib/docs/dispatch.html | 274 + mesalib/docs/download.html | 136 + mesalib/docs/envvars.html | 54 + mesalib/docs/extensions.html | 35 + mesalib/docs/faq.html | 397 + mesalib/docs/fbdev-dri.html | 341 + mesalib/docs/games.html | 64 + mesalib/docs/glfbdev-driver.html | 111 + mesalib/docs/glu.html | 45 + mesalib/docs/helpwanted.html | 74 + mesalib/docs/index.html | 29 + mesalib/docs/install.html | 411 + mesalib/docs/intro.html | 315 + mesalib/docs/libraries.html | 57 + mesalib/docs/license.html | 117 + mesalib/docs/lists.html | 69 + mesalib/docs/mangling.html | 30 + mesalib/docs/modelers.html | 68 + mesalib/docs/news.html | 1250 +++ mesalib/docs/openvg.html | 68 + mesalib/docs/osmesa.html | 88 + mesalib/docs/pbuffers.html | 54 + mesalib/docs/perf.html | 68 + mesalib/docs/precompiled.html | 20 + mesalib/docs/relnotes-6.4.1.html | 68 + mesalib/docs/relnotes-6.4.2.html | 75 + mesalib/docs/relnotes-6.4.html | 90 + mesalib/docs/relnotes-6.5.1.html | 139 + mesalib/docs/relnotes-6.5.2.html | 126 + mesalib/docs/relnotes-6.5.3.html | 119 + mesalib/docs/relnotes-6.5.html | 131 + mesalib/docs/relnotes-7.0.1.html | 101 + mesalib/docs/relnotes-7.0.2.html | 88 + mesalib/docs/relnotes-7.0.3.html | 84 + mesalib/docs/relnotes-7.0.4.html | 80 + mesalib/docs/relnotes-7.0.html | 93 + mesalib/docs/relnotes-7.1.html | 94 + mesalib/docs/relnotes-7.2.html | 104 + mesalib/docs/relnotes-7.3.html | 93 + mesalib/docs/relnotes-7.4.1.html | 79 + mesalib/docs/relnotes-7.4.2.html | 74 + mesalib/docs/relnotes-7.4.3.html | 79 + mesalib/docs/relnotes-7.4.4.html | 68 + mesalib/docs/relnotes-7.4.html | 89 + mesalib/docs/relnotes-7.5.1.html | 72 + mesalib/docs/relnotes-7.5.2.html | 60 + mesalib/docs/relnotes-7.5.html | 102 + mesalib/docs/relnotes-7.6.html | 76 + mesalib/docs/relnotes.html | 75 + mesalib/docs/repository.html | 132 + mesalib/docs/science.html | 72 + mesalib/docs/shading.html | 367 + mesalib/docs/sourcedocs.html | 37 + mesalib/docs/subset-A.html | 3579 ++++++++ mesalib/docs/subset.html | 24 + mesalib/docs/systems.html | 71 + mesalib/docs/thanks.html | 134 + mesalib/docs/utilities.html | 26 + mesalib/docs/utility.html | 44 + mesalib/docs/versions.html | 1656 ++++ mesalib/docs/webmaster.html | 24 + mesalib/docs/xlibdriver.html | 275 + mesalib/include/EGL/egl.h | 300 + mesalib/include/EGL/eglext.h | 186 + mesalib/include/EGL/eglplatform.h | 93 + mesalib/include/GL/dmesa.h | 160 + mesalib/include/GL/ggimesa.h | 85 + mesalib/include/GL/gl.h | 2224 +++++ mesalib/include/GL/gl_mangle.h | 1898 ++++ mesalib/include/GL/glext.h | 9253 +++++++++++++++++++ mesalib/include/GL/glfbdev.h | 149 + mesalib/include/GL/glu.h | 353 + mesalib/include/GL/glu_mangle.h | 86 + mesalib/include/GL/glx.h | 519 ++ mesalib/include/GL/glx_mangle.h | 81 + mesalib/include/GL/glxext.h | 845 ++ mesalib/include/GL/internal/dri_interface.h | 737 ++ mesalib/include/GL/internal/glcore.h | 185 + mesalib/include/GL/internal/sarea.h | 92 + mesalib/include/GL/mesa_wgl.h | 121 + mesalib/include/GL/mglmesa.h | 79 + mesalib/include/GL/osmesa.h | 289 + mesalib/include/GL/svgamesa.h | 97 + mesalib/include/GL/vms_x_fix.h | 1224 +++ mesalib/include/GL/wglext.h | 834 ++ mesalib/include/GL/wmesa.h | 141 + mesalib/include/GLES/egl.h | 6 + mesalib/include/GLES/egltypes.h | 45 + mesalib/include/GLES/gl.h | 797 ++ mesalib/include/GLES/glext.h | 607 ++ mesalib/include/GLES/glplatform.h | 76 + mesalib/include/GLES2/gl2.h | 652 ++ mesalib/include/GLES2/gl2ext.h | 388 + mesalib/include/GLES2/gl2platform.h | 72 + mesalib/progs/Makefile | 32 + mesalib/progs/util/README | 21 + mesalib/progs/util/dumpstate.c | 1959 ++++ mesalib/progs/util/errcheck.c | 27 + mesalib/progs/util/extfuncs.h | 277 + mesalib/progs/util/glstate.c | 502 ++ mesalib/progs/util/glstate.h | 51 + mesalib/progs/util/glutskel.c | 141 + mesalib/progs/util/idproj.c | 26 + mesalib/progs/util/imagesgi.h | 55 + mesalib/progs/util/matrix.c | 181 + mesalib/progs/util/mwmborder.c | 91 + mesalib/progs/util/readtex.c | 460 + mesalib/progs/util/readtex.h | 26 + mesalib/progs/util/sampleMakefile | 47 + mesalib/progs/util/shaderutil.c | 315 + mesalib/progs/util/shaderutil.h | 63 + mesalib/progs/util/showbuffer.c | 198 + mesalib/progs/util/showbuffer.h | 36 + mesalib/progs/util/trackball.c | 338 + mesalib/progs/util/trackball.h | 84 + mesalib/progs/util/winpos.c | 42 + mesalib/src/Makefile | 40 + mesalib/src/glu/Makefile | 40 + mesalib/src/glu/glu.pc.in | 13 + mesalib/src/glu/sgi/Makefile | 149 + mesalib/src/glu/sgi/Makefile.mgw | 230 + mesalib/src/glu/sgi/Makefile.win | 149 + mesalib/src/glu/sgi/dummy.cc | 4 + mesalib/src/glu/sgi/glu.def | 88 + mesalib/src/glu/sgi/glu.exports | 118 + mesalib/src/glu/sgi/glu.exports.darwin | 59 + mesalib/src/glu/sgi/include/gluos.h | 72 + .../src/glu/sgi/libnurbs/interface/bezierEval.cc | 260 + .../src/glu/sgi/libnurbs/interface/bezierEval.h | 48 + .../src/glu/sgi/libnurbs/interface/bezierPatch.cc | 206 + .../src/glu/sgi/libnurbs/interface/bezierPatch.h | 104 + .../glu/sgi/libnurbs/interface/bezierPatchMesh.cc | 610 ++ .../glu/sgi/libnurbs/interface/bezierPatchMesh.h | 120 + .../src/glu/sgi/libnurbs/interface/glcurveval.cc | 402 + .../src/glu/sgi/libnurbs/interface/glcurveval.h | 157 + mesalib/src/glu/sgi/libnurbs/interface/glimports.h | 42 + .../src/glu/sgi/libnurbs/interface/glinterface.cc | 469 + .../src/glu/sgi/libnurbs/interface/glrenderer.cc | 301 + .../src/glu/sgi/libnurbs/interface/glrenderer.h | 146 + .../src/glu/sgi/libnurbs/interface/glsurfeval.cc | 1293 +++ .../src/glu/sgi/libnurbs/interface/glsurfeval.h | 404 + .../src/glu/sgi/libnurbs/interface/incurveeval.cc | 206 + .../src/glu/sgi/libnurbs/interface/insurfeval.cc | 2064 +++++ mesalib/src/glu/sgi/libnurbs/interface/mystdio.h | 60 + mesalib/src/glu/sgi/libnurbs/interface/mystdlib.h | 57 + mesalib/src/glu/sgi/libnurbs/internals/arc.cc | 347 + mesalib/src/glu/sgi/libnurbs/internals/arc.h | 133 + .../src/glu/sgi/libnurbs/internals/arcsorter.cc | 172 + mesalib/src/glu/sgi/libnurbs/internals/arcsorter.h | 73 + mesalib/src/glu/sgi/libnurbs/internals/arctess.cc | 611 ++ mesalib/src/glu/sgi/libnurbs/internals/arctess.h | 66 + mesalib/src/glu/sgi/libnurbs/internals/backend.cc | 589 ++ mesalib/src/glu/sgi/libnurbs/internals/backend.h | 113 + .../src/glu/sgi/libnurbs/internals/basiccrveval.cc | 138 + .../src/glu/sgi/libnurbs/internals/basiccrveval.h | 62 + .../glu/sgi/libnurbs/internals/basicsurfeval.cc | 232 + .../src/glu/sgi/libnurbs/internals/basicsurfeval.h | 90 + mesalib/src/glu/sgi/libnurbs/internals/bezierarc.h | 51 + mesalib/src/glu/sgi/libnurbs/internals/bin.cc | 166 + mesalib/src/glu/sgi/libnurbs/internals/bin.h | 121 + mesalib/src/glu/sgi/libnurbs/internals/bufpool.cc | 110 + mesalib/src/glu/sgi/libnurbs/internals/bufpool.h | 141 + .../src/glu/sgi/libnurbs/internals/cachingeval.cc | 78 + .../src/glu/sgi/libnurbs/internals/cachingeval.h | 51 + mesalib/src/glu/sgi/libnurbs/internals/ccw.cc | 565 ++ .../src/glu/sgi/libnurbs/internals/coveandtiler.cc | 440 + .../src/glu/sgi/libnurbs/internals/coveandtiler.h | 72 + mesalib/src/glu/sgi/libnurbs/internals/curve.cc | 198 + mesalib/src/glu/sgi/libnurbs/internals/curve.h | 70 + .../src/glu/sgi/libnurbs/internals/curvelist.cc | 110 + mesalib/src/glu/sgi/libnurbs/internals/curvelist.h | 62 + mesalib/src/glu/sgi/libnurbs/internals/curvesub.cc | 103 + .../glu/sgi/libnurbs/internals/dataTransform.cc | 209 + .../src/glu/sgi/libnurbs/internals/dataTransform.h | 59 + mesalib/src/glu/sgi/libnurbs/internals/defines.h | 50 + .../src/glu/sgi/libnurbs/internals/displaylist.cc | 82 + .../src/glu/sgi/libnurbs/internals/displaylist.h | 78 + .../src/glu/sgi/libnurbs/internals/displaymode.h | 40 + mesalib/src/glu/sgi/libnurbs/internals/flist.cc | 118 + mesalib/src/glu/sgi/libnurbs/internals/flist.h | 59 + .../src/glu/sgi/libnurbs/internals/flistsorter.cc | 81 + .../src/glu/sgi/libnurbs/internals/flistsorter.h | 53 + mesalib/src/glu/sgi/libnurbs/internals/gridline.h | 46 + .../glu/sgi/libnurbs/internals/gridtrimvertex.h | 89 + .../src/glu/sgi/libnurbs/internals/gridvertex.h | 48 + mesalib/src/glu/sgi/libnurbs/internals/hull.cc | 165 + mesalib/src/glu/sgi/libnurbs/internals/hull.h | 69 + .../src/glu/sgi/libnurbs/internals/intersect.cc | 665 ++ mesalib/src/glu/sgi/libnurbs/internals/jarcloc.h | 87 + .../src/glu/sgi/libnurbs/internals/knotvector.cc | 139 + .../src/glu/sgi/libnurbs/internals/knotvector.h | 62 + mesalib/src/glu/sgi/libnurbs/internals/mapdesc.cc | 841 ++ mesalib/src/glu/sgi/libnurbs/internals/mapdesc.h | 271 + mesalib/src/glu/sgi/libnurbs/internals/mapdescv.cc | 243 + mesalib/src/glu/sgi/libnurbs/internals/maplist.cc | 117 + mesalib/src/glu/sgi/libnurbs/internals/maplist.h | 81 + mesalib/src/glu/sgi/libnurbs/internals/mesher.cc | 486 + mesalib/src/glu/sgi/libnurbs/internals/mesher.h | 83 + .../libnurbs/internals/monoTriangulationBackend.cc | 397 + .../src/glu/sgi/libnurbs/internals/monotonizer.cc | 260 + .../src/glu/sgi/libnurbs/internals/monotonizer.h | 64 + mesalib/src/glu/sgi/libnurbs/internals/myassert.h | 51 + mesalib/src/glu/sgi/libnurbs/internals/mycode.cc | 67 + mesalib/src/glu/sgi/libnurbs/internals/mymath.h | 68 + mesalib/src/glu/sgi/libnurbs/internals/mysetjmp.h | 85 + mesalib/src/glu/sgi/libnurbs/internals/mystring.h | 56 + .../src/glu/sgi/libnurbs/internals/nurbsconsts.h | 120 + .../glu/sgi/libnurbs/internals/nurbsinterfac.cc | 537 ++ .../src/glu/sgi/libnurbs/internals/nurbstess.cc | 691 ++ mesalib/src/glu/sgi/libnurbs/internals/nurbstess.h | 172 + mesalib/src/glu/sgi/libnurbs/internals/patch.cc | 504 ++ mesalib/src/glu/sgi/libnurbs/internals/patch.h | 94 + .../src/glu/sgi/libnurbs/internals/patchlist.cc | 170 + mesalib/src/glu/sgi/libnurbs/internals/patchlist.h | 92 + mesalib/src/glu/sgi/libnurbs/internals/pwlarc.h | 78 + mesalib/src/glu/sgi/libnurbs/internals/quilt.cc | 276 + mesalib/src/glu/sgi/libnurbs/internals/quilt.h | 92 + mesalib/src/glu/sgi/libnurbs/internals/reader.cc | 146 + mesalib/src/glu/sgi/libnurbs/internals/reader.h | 132 + .../src/glu/sgi/libnurbs/internals/renderhints.cc | 133 + .../src/glu/sgi/libnurbs/internals/renderhints.h | 60 + .../src/glu/sgi/libnurbs/internals/simplemath.h | 50 + mesalib/src/glu/sgi/libnurbs/internals/slicer.cc | 1300 +++ mesalib/src/glu/sgi/libnurbs/internals/slicer.h | 84 + mesalib/src/glu/sgi/libnurbs/internals/sorter.cc | 139 + mesalib/src/glu/sgi/libnurbs/internals/sorter.h | 51 + .../src/glu/sgi/libnurbs/internals/splitarcs.cc | 293 + .../src/glu/sgi/libnurbs/internals/subdivider.cc | 910 ++ .../src/glu/sgi/libnurbs/internals/subdivider.h | 200 + mesalib/src/glu/sgi/libnurbs/internals/tobezier.cc | 687 ++ mesalib/src/glu/sgi/libnurbs/internals/trimline.cc | 223 + mesalib/src/glu/sgi/libnurbs/internals/trimline.h | 103 + .../src/glu/sgi/libnurbs/internals/trimregion.cc | 114 + .../src/glu/sgi/libnurbs/internals/trimregion.h | 84 + .../src/glu/sgi/libnurbs/internals/trimvertex.h | 63 + .../src/glu/sgi/libnurbs/internals/trimvertpool.cc | 119 + .../src/glu/sgi/libnurbs/internals/trimvertpool.h | 57 + mesalib/src/glu/sgi/libnurbs/internals/types.h | 47 + mesalib/src/glu/sgi/libnurbs/internals/uarray.cc | 72 + mesalib/src/glu/sgi/libnurbs/internals/uarray.h | 55 + mesalib/src/glu/sgi/libnurbs/internals/varray.cc | 144 + mesalib/src/glu/sgi/libnurbs/internals/varray.h | 68 + .../src/glu/sgi/libnurbs/nurbtess/definitions.h | 40 + .../src/glu/sgi/libnurbs/nurbtess/directedLine.cc | 848 ++ .../src/glu/sgi/libnurbs/nurbtess/directedLine.h | 171 + mesalib/src/glu/sgi/libnurbs/nurbtess/glimports.h | 42 + mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.cc | 293 + mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.h | 137 + mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.cc | 934 ++ mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.h | 103 + .../src/glu/sgi/libnurbs/nurbtess/monoPolyPart.cc | 299 + .../src/glu/sgi/libnurbs/nurbtess/monoPolyPart.h | 41 + .../glu/sgi/libnurbs/nurbtess/monoTriangulation.cc | 1482 +++ .../glu/sgi/libnurbs/nurbtess/monoTriangulation.h | 184 + mesalib/src/glu/sgi/libnurbs/nurbtess/mystdio.h | 60 + mesalib/src/glu/sgi/libnurbs/nurbtess/mystdlib.h | 57 + .../src/glu/sgi/libnurbs/nurbtess/partitionX.cc | 162 + mesalib/src/glu/sgi/libnurbs/nurbtess/partitionX.h | 54 + .../src/glu/sgi/libnurbs/nurbtess/partitionY.cc | 836 ++ mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.h | 97 + mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc | 734 ++ mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.h | 68 + mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.cc | 90 + mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.h | 47 + .../glu/sgi/libnurbs/nurbtess/primitiveStream.cc | 190 + .../glu/sgi/libnurbs/nurbtess/primitiveStream.h | 109 + mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.cc | 77 + mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.h | 42 + mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.cc | 196 + mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.h | 82 + .../src/glu/sgi/libnurbs/nurbtess/sampleComp.cc | 371 + mesalib/src/glu/sgi/libnurbs/nurbtess/sampleComp.h | 86 + .../src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc | 844 ++ .../src/glu/sgi/libnurbs/nurbtess/sampleCompBot.h | 138 + .../glu/sgi/libnurbs/nurbtess/sampleCompRight.cc | 644 ++ .../glu/sgi/libnurbs/nurbtess/sampleCompRight.h | 117 + .../src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc | 1030 +++ .../src/glu/sgi/libnurbs/nurbtess/sampleCompTop.h | 67 + .../glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc | 2427 +++++ .../src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.h | 184 + .../src/glu/sgi/libnurbs/nurbtess/sampledLine.cc | 179 + .../src/glu/sgi/libnurbs/nurbtess/sampledLine.h | 71 + .../src/glu/sgi/libnurbs/nurbtess/searchTree.cc | 282 + mesalib/src/glu/sgi/libnurbs/nurbtess/searchTree.h | 61 + mesalib/src/glu/sgi/libnurbs/nurbtess/zlassert.h | 34 + mesalib/src/glu/sgi/libtess/README | 446 + mesalib/src/glu/sgi/libtess/alg-outline | 228 + mesalib/src/glu/sgi/libtess/dict-list.h | 100 + mesalib/src/glu/sgi/libtess/dict.c | 111 + mesalib/src/glu/sgi/libtess/dict.h | 100 + mesalib/src/glu/sgi/libtess/geom.c | 264 + mesalib/src/glu/sgi/libtess/geom.h | 84 + mesalib/src/glu/sgi/libtess/memalloc.c | 55 + mesalib/src/glu/sgi/libtess/memalloc.h | 54 + mesalib/src/glu/sgi/libtess/mesh.c | 789 ++ mesalib/src/glu/sgi/libtess/mesh.h | 266 + mesalib/src/glu/sgi/libtess/normal.c | 253 + mesalib/src/glu/sgi/libtess/normal.h | 45 + mesalib/src/glu/sgi/libtess/priorityq-heap.c | 252 + mesalib/src/glu/sgi/libtess/priorityq-heap.h | 107 + mesalib/src/glu/sgi/libtess/priorityq-sort.h | 117 + mesalib/src/glu/sgi/libtess/priorityq.c | 260 + mesalib/src/glu/sgi/libtess/priorityq.h | 117 + mesalib/src/glu/sgi/libtess/render.c | 498 ++ mesalib/src/glu/sgi/libtess/render.h | 52 + mesalib/src/glu/sgi/libtess/sweep.c | 1357 +++ mesalib/src/glu/sgi/libtess/sweep.h | 77 + mesalib/src/glu/sgi/libtess/tess.c | 628 ++ mesalib/src/glu/sgi/libtess/tess.h | 165 + mesalib/src/glu/sgi/libtess/tessmono.c | 201 + mesalib/src/glu/sgi/libtess/tessmono.h | 71 + mesalib/src/glu/sgi/libutil/error.c | 83 + mesalib/src/glu/sgi/libutil/glue.c | 93 + mesalib/src/glu/sgi/libutil/gluint.h | 48 + mesalib/src/glu/sgi/libutil/mipmap.c | 8931 +++++++++++++++++++ mesalib/src/glu/sgi/libutil/project.c | 359 + mesalib/src/glu/sgi/libutil/quad.c | 1155 +++ mesalib/src/glu/sgi/libutil/registry.c | 91 + mesalib/src/mesa/Makefile | 166 + mesalib/src/mesa/Makefile.mgw | 235 + mesalib/src/mesa/depend | 0 mesalib/src/mesa/descrip.mms | 27 + mesalib/src/mesa/drivers/Makefile | 29 + mesalib/src/mesa/drivers/common/descrip.mms | 42 + mesalib/src/mesa/drivers/common/driverfuncs.c | 353 + mesalib/src/mesa/drivers/common/driverfuncs.h | 37 + mesalib/src/mesa/drivers/common/meta.c | 1638 ++++ mesalib/src/mesa/drivers/common/meta.h | 81 + mesalib/src/mesa/drivers/dri/Makefile | 55 + mesalib/src/mesa/drivers/dri/Makefile.template | 99 + mesalib/src/mesa/drivers/dri/common/depthtmp.h | 270 + mesalib/src/mesa/drivers/dri/common/dri_metaops.c | 298 + mesalib/src/mesa/drivers/dri/common/dri_metaops.h | 81 + mesalib/src/mesa/drivers/dri/common/dri_util.c | 957 ++ mesalib/src/mesa/drivers/dri/common/dri_util.h | 555 ++ .../src/mesa/drivers/dri/common/drirenderbuffer.c | 217 + .../src/mesa/drivers/dri/common/drirenderbuffer.h | 78 + .../src/mesa/drivers/dri/common/extension_helper.h | 6609 ++++++++++++++ mesalib/src/mesa/drivers/dri/common/memops.h | 17 + mesalib/src/mesa/drivers/dri/common/mmio.h | 62 + mesalib/src/mesa/drivers/dri/common/mmx.h | 560 ++ mesalib/src/mesa/drivers/dri/common/spantmp.h | 338 + mesalib/src/mesa/drivers/dri/common/spantmp2.h | 686 ++ .../src/mesa/drivers/dri/common/spantmp_common.h | 81 + mesalib/src/mesa/drivers/dri/common/stenciltmp.h | 245 + mesalib/src/mesa/drivers/dri/common/texmem.c | 1347 +++ mesalib/src/mesa/drivers/dri/common/texmem.h | 333 + mesalib/src/mesa/drivers/dri/common/utils.c | 839 ++ mesalib/src/mesa/drivers/dri/common/utils.h | 147 + mesalib/src/mesa/drivers/dri/common/vblank.c | 434 + mesalib/src/mesa/drivers/dri/common/vblank.h | 75 + mesalib/src/mesa/drivers/dri/common/xmlconfig.c | 1008 +++ mesalib/src/mesa/drivers/dri/common/xmlconfig.h | 124 + mesalib/src/mesa/drivers/dri/common/xmlpool.h | 98 + .../src/mesa/drivers/dri/common/xmlpool/Makefile | 96 + mesalib/src/mesa/drivers/dri/common/xmlpool/de.po | 240 + mesalib/src/mesa/drivers/dri/common/xmlpool/es.po | 219 + mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po | 225 + mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po | 230 + .../src/mesa/drivers/dri/common/xmlpool/options.h | 568 ++ mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po | 226 + .../mesa/drivers/dri/common/xmlpool/t_options.h | 249 + mesalib/src/mesa/drivers/dri/dri.pc.in | 11 + mesalib/src/mesa/drivers/dri/swrast/Makefile | 24 + mesalib/src/mesa/drivers/dri/swrast/swrast.c | 754 ++ mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h | 144 + mesalib/src/mesa/drivers/dri/swrast/swrast_span.c | 439 + .../src/mesa/drivers/dri/swrast/swrast_spantemp.h | 328 + mesalib/src/mesa/drivers/windows/fx/fxopengl.def | 955 ++ mesalib/src/mesa/drivers/windows/fx/fxwgl.c | 1307 +++ mesalib/src/mesa/drivers/windows/gdi/colors.h | 29 + mesalib/src/mesa/drivers/windows/gdi/mesa.def | 979 ++ mesalib/src/mesa/drivers/windows/gdi/wgl.c | 707 ++ mesalib/src/mesa/drivers/windows/gdi/wmesa.c | 1681 ++++ mesalib/src/mesa/drivers/windows/gdi/wmesadef.h | 43 + mesalib/src/mesa/drivers/windows/gldirect/ddlog.c | 192 + mesalib/src/mesa/drivers/windows/gldirect/ddlog.h | 109 + .../src/mesa/drivers/windows/gldirect/dglcontext.c | 2214 +++++ .../src/mesa/drivers/windows/gldirect/dglcontext.h | 281 + .../src/mesa/drivers/windows/gldirect/dglglobals.c | 149 + .../src/mesa/drivers/windows/gldirect/dglglobals.h | 198 + .../src/mesa/drivers/windows/gldirect/dglmacros.h | 91 + mesalib/src/mesa/drivers/windows/gldirect/dglpf.c | 620 ++ mesalib/src/mesa/drivers/windows/gldirect/dglpf.h | 77 + mesalib/src/mesa/drivers/windows/gldirect/dglwgl.c | 2964 ++++++ mesalib/src/mesa/drivers/windows/gldirect/dglwgl.h | 127 + .../src/mesa/drivers/windows/gldirect/dll_main.c | 817 ++ .../src/mesa/drivers/windows/gldirect/dllmain.h | 64 + .../mesa/drivers/windows/gldirect/gld_debug_clip.c | 39 + .../mesa/drivers/windows/gldirect/gld_debug_norm.c | 39 + .../drivers/windows/gldirect/gld_debug_xform.c | 41 + .../mesa/drivers/windows/gldirect/gld_dispatch.c | 73 + .../src/mesa/drivers/windows/gldirect/gld_driver.c | 279 + .../src/mesa/drivers/windows/gldirect/gld_driver.h | 90 + .../src/mesa/drivers/windows/gldirect/gldlame8.c | 181 + .../src/mesa/drivers/windows/gldirect/opengl32.def | 488 + .../src/mesa/drivers/windows/gldirect/pixpack.h | 108 + mesalib/src/mesa/drivers/windows/icd/icd.c | 347 + mesalib/src/mesa/drivers/windows/icd/icdlist.h | 336 + mesalib/src/mesa/drivers/windows/icd/mesa.def | 108 + mesalib/src/mesa/gl.pc.in | 12 + mesalib/src/mesa/glapi/dispatch.h | 3985 +++++++++ mesalib/src/mesa/glapi/glapi.c | 650 ++ mesalib/src/mesa/glapi/glapi.h | 171 + mesalib/src/mesa/glapi/glapi_getproc.c | 592 ++ mesalib/src/mesa/glapi/glapioffsets.h | 1218 +++ mesalib/src/mesa/glapi/glapitable.h | 837 ++ mesalib/src/mesa/glapi/glapitemp.h | 6921 ++++++++++++++ mesalib/src/mesa/glapi/glprocs.h | 2353 +++++ mesalib/src/mesa/glapi/glthread.c | 326 + mesalib/src/mesa/glapi/glthread.h | 333 + mesalib/src/mesa/main/accum.c | 108 + mesalib/src/mesa/main/accum.h | 62 + mesalib/src/mesa/main/api_arrayelt.c | 1319 +++ mesalib/src/mesa/main/api_arrayelt.h | 42 + mesalib/src/mesa/main/api_exec.c | 925 ++ mesalib/src/mesa/main/api_exec.h | 37 + mesalib/src/mesa/main/api_loopback.c | 1657 ++++ mesalib/src/mesa/main/api_loopback.h | 37 + mesalib/src/mesa/main/api_noop.c | 1000 +++ mesalib/src/mesa/main/api_noop.h | 50 + mesalib/src/mesa/main/api_validate.c | 300 + mesalib/src/mesa/main/api_validate.h | 55 + mesalib/src/mesa/main/arrayobj.c | 572 ++ mesalib/src/mesa/main/arrayobj.h | 83 + mesalib/src/mesa/main/attrib.c | 1501 ++++ mesalib/src/mesa/main/attrib.h | 60 + mesalib/src/mesa/main/bitset.h | 122 + mesalib/src/mesa/main/blend.c | 592 ++ mesalib/src/mesa/main/blend.h | 83 + mesalib/src/mesa/main/bufferobj.c | 1678 ++++ mesalib/src/mesa/main/bufferobj.h | 172 + mesalib/src/mesa/main/buffers.c | 502 ++ mesalib/src/mesa/main/buffers.h | 56 + mesalib/src/mesa/main/clear.c | 184 + mesalib/src/mesa/main/clear.h | 44 + mesalib/src/mesa/main/clip.c | 159 + mesalib/src/mesa/main/clip.h | 49 + mesalib/src/mesa/main/colormac.h | 222 + mesalib/src/mesa/main/colortab.c | 1102 +++ mesalib/src/mesa/main/colortab.h | 100 + mesalib/src/mesa/main/compiler.h | 484 + mesalib/src/mesa/main/config.h | 323 + mesalib/src/mesa/main/context.c | 1672 ++++ mesalib/src/mesa/main/context.h | 308 + mesalib/src/mesa/main/convolve.c | 1427 +++ mesalib/src/mesa/main/convolve.h | 114 + mesalib/src/mesa/main/cpuinfo.c | 109 + mesalib/src/mesa/main/cpuinfo.h | 47 + mesalib/src/mesa/main/dd.h | 1195 +++ mesalib/src/mesa/main/debug.c | 440 + mesalib/src/mesa/main/debug.h | 72 + mesalib/src/mesa/main/depth.c | 162 + mesalib/src/mesa/main/depth.h | 62 + mesalib/src/mesa/main/depthstencil.c | 655 ++ mesalib/src/mesa/main/depthstencil.h | 56 + mesalib/src/mesa/main/descrip.mms | 258 + mesalib/src/mesa/main/dispatch.c | 96 + mesalib/src/mesa/main/dlist.c | 9402 ++++++++++++++++++++ mesalib/src/mesa/main/dlist.h | 96 + mesalib/src/mesa/main/dlopen.c | 101 + mesalib/src/mesa/main/dlopen.h | 42 + mesalib/src/mesa/main/drawpix.c | 311 + mesalib/src/mesa/main/drawpix.h | 49 + mesalib/src/mesa/main/enable.c | 1407 +++ mesalib/src/mesa/main/enable.h | 57 + mesalib/src/mesa/main/enums.c | 5201 +++++++++++ mesalib/src/mesa/main/enums.h | 61 + mesalib/src/mesa/main/eval.c | 962 ++ mesalib/src/mesa/main/eval.h | 128 + mesalib/src/mesa/main/execmem.c | 155 + mesalib/src/mesa/main/extensions.c | 675 ++ mesalib/src/mesa/main/extensions.h | 86 + mesalib/src/mesa/main/fbobject.c | 2103 +++++ mesalib/src/mesa/main/fbobject.h | 146 + mesalib/src/mesa/main/feedback.c | 536 ++ mesalib/src/mesa/main/feedback.h | 83 + mesalib/src/mesa/main/ffvertex_prog.c | 1672 ++++ mesalib/src/mesa/main/ffvertex_prog.h | 40 + mesalib/src/mesa/main/fog.c | 188 + mesalib/src/mesa/main/fog.h | 66 + mesalib/src/mesa/main/framebuffer.c | 961 ++ mesalib/src/mesa/main/framebuffer.h | 85 + mesalib/src/mesa/main/get.c | 7419 +++++++++++++++ mesalib/src/mesa/main/get.h | 62 + mesalib/src/mesa/main/getstring.c | 271 + mesalib/src/mesa/main/glheader.h | 88 + mesalib/src/mesa/main/hash.c | 530 ++ mesalib/src/mesa/main/hash.h | 69 + mesalib/src/mesa/main/hint.c | 149 + mesalib/src/mesa/main/hint.h | 57 + mesalib/src/mesa/main/histogram.c | 1078 +++ mesalib/src/mesa/main/histogram.h | 83 + mesalib/src/mesa/main/image.c | 5820 ++++++++++++ mesalib/src/mesa/main/image.h | 328 + mesalib/src/mesa/main/imports.c | 1231 +++ mesalib/src/mesa/main/imports.h | 630 ++ mesalib/src/mesa/main/light.c | 1427 +++ mesalib/src/mesa/main/light.h | 146 + mesalib/src/mesa/main/lines.c | 118 + mesalib/src/mesa/main/lines.h | 48 + mesalib/src/mesa/main/macros.h | 695 ++ mesalib/src/mesa/main/matrix.c | 793 ++ mesalib/src/mesa/main/matrix.h | 112 + mesalib/src/mesa/main/mfeatures.h | 86 + mesalib/src/mesa/main/mipmap.c | 1794 ++++ mesalib/src/mesa/main/mipmap.h | 64 + mesalib/src/mesa/main/mm.c | 278 + mesalib/src/mesa/main/mm.h | 93 + mesalib/src/mesa/main/mtypes.h | 3139 +++++++ mesalib/src/mesa/main/multisample.c | 61 + mesalib/src/mesa/main/multisample.h | 38 + mesalib/src/mesa/main/pixel.c | 845 ++ mesalib/src/mesa/main/pixel.h | 80 + mesalib/src/mesa/main/pixelstore.c | 286 + mesalib/src/mesa/main/pixelstore.h | 50 + mesalib/src/mesa/main/points.c | 263 + mesalib/src/mesa/main/points.h | 57 + mesalib/src/mesa/main/polygon.c | 322 + mesalib/src/mesa/main/polygon.h | 66 + mesalib/src/mesa/main/queryobj.c | 576 ++ mesalib/src/mesa/main/queryobj.h | 71 + mesalib/src/mesa/main/rastpos.c | 508 ++ mesalib/src/mesa/main/rastpos.h | 193 + mesalib/src/mesa/main/rbadaptors.c | 577 ++ mesalib/src/mesa/main/rbadaptors.h | 40 + mesalib/src/mesa/main/readpix.c | 210 + mesalib/src/mesa/main/readpix.h | 42 + mesalib/src/mesa/main/renderbuffer.c | 2209 +++++ mesalib/src/mesa/main/renderbuffer.h | 112 + mesalib/src/mesa/main/scissor.c | 99 + mesalib/src/mesa/main/scissor.h | 46 + mesalib/src/mesa/main/shaders.c | 728 ++ mesalib/src/mesa/main/shaders.h | 236 + mesalib/src/mesa/main/shared.c | 374 + mesalib/src/mesa/main/shared.h | 37 + mesalib/src/mesa/main/simple_list.h | 202 + mesalib/src/mesa/main/state.c | 718 ++ mesalib/src/mesa/main/state.h | 49 + mesalib/src/mesa/main/stencil.c | 590 ++ mesalib/src/mesa/main/stencil.h | 80 + mesalib/src/mesa/main/syncobj.c | 409 + mesalib/src/mesa/main/syncobj.h | 70 + mesalib/src/mesa/main/texcompress.c | 362 + mesalib/src/mesa/main/texcompress.h | 74 + mesalib/src/mesa/main/texcompress_fxt1.c | 1724 ++++ mesalib/src/mesa/main/texcompress_s3tc.c | 761 ++ mesalib/src/mesa/main/texenv.c | 1078 +++ mesalib/src/mesa/main/texenv.h | 63 + mesalib/src/mesa/main/texenvprogram.c | 1579 ++++ mesalib/src/mesa/main/texenvprogram.h | 35 + mesalib/src/mesa/main/texformat.c | 1989 +++++ mesalib/src/mesa/main/texformat.h | 293 + mesalib/src/mesa/main/texformat_tmp.h | 1474 +++ mesalib/src/mesa/main/texgen.c | 339 + mesalib/src/mesa/main/texgen.h | 62 + mesalib/src/mesa/main/texgetimage.c | 581 ++ mesalib/src/mesa/main/texgetimage.h | 55 + mesalib/src/mesa/main/teximage.c | 3660 ++++++++ mesalib/src/mesa/main/teximage.h | 260 + mesalib/src/mesa/main/texobj.c | 1237 +++ mesalib/src/mesa/main/texobj.h | 118 + mesalib/src/mesa/main/texparam.c | 1285 +++ mesalib/src/mesa/main/texparam.h | 63 + mesalib/src/mesa/main/texrender.c | 567 ++ mesalib/src/mesa/main/texrender.h | 15 + mesalib/src/mesa/main/texstate.c | 823 ++ mesalib/src/mesa/main/texstate.h | 91 + mesalib/src/mesa/main/texstore.c | 3925 ++++++++ mesalib/src/mesa/main/texstore.h | 231 + mesalib/src/mesa/main/varray.c | 1187 +++ mesalib/src/mesa/main/varray.h | 186 + mesalib/src/mesa/main/version.h | 53 + mesalib/src/mesa/main/viewport.c | 180 + mesalib/src/mesa/main/viewport.h | 52 + mesalib/src/mesa/main/vsnprintf.c | 165 + mesalib/src/mesa/main/vtxfmt.c | 195 + mesalib/src/mesa/main/vtxfmt.h | 43 + mesalib/src/mesa/main/vtxfmt_tmp.h | 542 ++ mesalib/src/mesa/math/descrip.mms | 47 + mesalib/src/mesa/math/m_clip_tmp.h | 243 + mesalib/src/mesa/math/m_copy_tmp.h | 86 + mesalib/src/mesa/math/m_debug.h | 42 + mesalib/src/mesa/math/m_debug_clip.c | 371 + mesalib/src/mesa/math/m_debug_norm.c | 383 + mesalib/src/mesa/math/m_debug_util.h | 320 + mesalib/src/mesa/math/m_debug_xform.c | 339 + mesalib/src/mesa/math/m_dotprod_tmp.h | 102 + mesalib/src/mesa/math/m_eval.c | 461 + mesalib/src/mesa/math/m_eval.h | 103 + mesalib/src/mesa/math/m_matrix.c | 1642 ++++ mesalib/src/mesa/math/m_matrix.h | 210 + mesalib/src/mesa/math/m_norm_tmp.h | 390 + mesalib/src/mesa/math/m_trans_tmp.h | 281 + mesalib/src/mesa/math/m_translate.c | 751 ++ mesalib/src/mesa/math/m_translate.h | 122 + mesalib/src/mesa/math/m_vector.c | 185 + mesalib/src/mesa/math/m_vector.h | 92 + mesalib/src/mesa/math/m_xform.c | 128 + mesalib/src/mesa/math/m_xform.h | 166 + mesalib/src/mesa/math/m_xform_tmp.h | 810 ++ mesalib/src/mesa/osmesa.pc.in | 12 + mesalib/src/mesa/shader/Makefile | 7 + mesalib/src/mesa/shader/arbprogparse.c | 212 + mesalib/src/mesa/shader/arbprogparse.h | 41 + mesalib/src/mesa/shader/arbprogram.c | 1042 +++ mesalib/src/mesa/shader/arbprogram.h | 152 + mesalib/src/mesa/shader/atifragshader.c | 759 ++ mesalib/src/mesa/shader/atifragshader.h | 123 + mesalib/src/mesa/shader/descrip.mms | 95 + mesalib/src/mesa/shader/grammar/grammar.c | 3178 +++++++ mesalib/src/mesa/shader/grammar/grammar.h | 103 + mesalib/src/mesa/shader/grammar/grammar_crt.c | 64 + mesalib/src/mesa/shader/grammar/grammar_crt.h | 20 + mesalib/src/mesa/shader/grammar/grammar_mesa.c | 87 + mesalib/src/mesa/shader/grammar/grammar_mesa.h | 43 + mesalib/src/mesa/shader/grammar/grammar_syn.h | 202 + mesalib/src/mesa/shader/hash_table.c | 163 + mesalib/src/mesa/shader/hash_table.h | 117 + mesalib/src/mesa/shader/lex.yy.c | 3574 ++++++++ mesalib/src/mesa/shader/nvfragparse.c | 1582 ++++ mesalib/src/mesa/shader/nvfragparse.h | 43 + mesalib/src/mesa/shader/nvprogram.c | 890 ++ mesalib/src/mesa/shader/nvprogram.h | 113 + mesalib/src/mesa/shader/nvvertparse.c | 1455 +++ mesalib/src/mesa/shader/nvvertparse.h | 45 + mesalib/src/mesa/shader/prog_cache.c | 206 + mesalib/src/mesa/shader/prog_cache.h | 55 + mesalib/src/mesa/shader/prog_execute.c | 1757 ++++ mesalib/src/mesa/shader/prog_execute.h | 85 + mesalib/src/mesa/shader/prog_instruction.c | 352 + mesalib/src/mesa/shader/prog_instruction.h | 439 + mesalib/src/mesa/shader/prog_noise.c | 638 ++ mesalib/src/mesa/shader/prog_noise.h | 34 + mesalib/src/mesa/shader/prog_optimize.c | 832 ++ mesalib/src/mesa/shader/prog_optimize.h | 45 + mesalib/src/mesa/shader/prog_parameter.c | 750 ++ mesalib/src/mesa/shader/prog_parameter.h | 174 + mesalib/src/mesa/shader/prog_parameter_layout.c | 217 + mesalib/src/mesa/shader/prog_parameter_layout.h | 42 + mesalib/src/mesa/shader/prog_print.c | 1019 +++ mesalib/src/mesa/shader/prog_print.h | 94 + mesalib/src/mesa/shader/prog_statevars.c | 1120 +++ mesalib/src/mesa/shader/prog_statevars.h | 145 + mesalib/src/mesa/shader/prog_uniform.c | 165 + mesalib/src/mesa/shader/prog_uniform.h | 92 + mesalib/src/mesa/shader/program.c | 889 ++ mesalib/src/mesa/shader/program.h | 129 + mesalib/src/mesa/shader/program_lexer.l | 489 + mesalib/src/mesa/shader/program_parse.tab.c | 5249 +++++++++++ mesalib/src/mesa/shader/program_parse.tab.h | 207 + mesalib/src/mesa/shader/program_parse.y | 2379 +++++ mesalib/src/mesa/shader/program_parse_extra.c | 117 + mesalib/src/mesa/shader/program_parser.h | 266 + mesalib/src/mesa/shader/programopt.c | 575 ++ mesalib/src/mesa/shader/programopt.h | 45 + mesalib/src/mesa/shader/shader_api.c | 2154 +++++ mesalib/src/mesa/shader/shader_api.h | 100 + mesalib/src/mesa/shader/slang/descrip.mms | 68 + mesalib/src/mesa/shader/slang/library/Makefile | 81 + mesalib/src/mesa/shader/slang/library/gc_to_bin.c | 85 + .../mesa/shader/slang/library/slang_120_core.gc | 1978 ++++ .../mesa/shader/slang/library/slang_120_core_gc.h | 764 ++ .../slang/library/slang_builtin_120_common.gc | 200 + .../slang/library/slang_builtin_120_common_gc.h | 108 + .../slang/library/slang_builtin_120_fragment.gc | 30 + .../slang/library/slang_builtin_120_fragment_gc.h | 5 + .../shader/slang/library/slang_common_builtin.gc | 1873 ++++ .../shader/slang/library/slang_common_builtin_gc.h | 872 ++ .../src/mesa/shader/slang/library/slang_core.gc | 2619 ++++++ .../src/mesa/shader/slang/library/slang_core_gc.h | 869 ++ .../shader/slang/library/slang_fragment_builtin.gc | 235 + .../slang/library/slang_fragment_builtin_gc.h | 110 + .../shader/slang/library/slang_pp_directives.syn | 405 + .../shader/slang/library/slang_pp_directives_syn.h | 250 + .../shader/slang/library/slang_pp_expression.syn | 265 + .../shader/slang/library/slang_pp_expression_syn.h | 179 + .../mesa/shader/slang/library/slang_pp_version.syn | 122 + .../shader/slang/library/slang_pp_version_syn.h | 69 + .../src/mesa/shader/slang/library/slang_shader.syn | 1716 ++++ .../mesa/shader/slang/library/slang_shader_syn.h | 866 ++ .../mesa/shader/slang/library/slang_version.syn | 118 + .../shader/slang/library/slang_vertex_builtin.gc | 190 + .../shader/slang/library/slang_vertex_builtin_gc.h | 109 + mesalib/src/mesa/shader/slang/library/syn_to_c.c | 72 + mesalib/src/mesa/shader/slang/slang_builtin.c | 895 ++ mesalib/src/mesa/shader/slang/slang_builtin.h | 54 + mesalib/src/mesa/shader/slang/slang_codegen.c | 5319 +++++++++++ mesalib/src/mesa/shader/slang/slang_codegen.h | 72 + mesalib/src/mesa/shader/slang/slang_compile.c | 2825 ++++++ mesalib/src/mesa/shader/slang/slang_compile.h | 100 + .../src/mesa/shader/slang/slang_compile_function.c | 262 + .../src/mesa/shader/slang/slang_compile_function.h | 92 + .../mesa/shader/slang/slang_compile_operation.c | 332 + .../mesa/shader/slang/slang_compile_operation.h | 226 + .../src/mesa/shader/slang/slang_compile_struct.c | 174 + .../src/mesa/shader/slang/slang_compile_struct.h | 66 + .../src/mesa/shader/slang/slang_compile_variable.c | 247 + .../src/mesa/shader/slang/slang_compile_variable.h | 90 + mesalib/src/mesa/shader/slang/slang_emit.c | 2518 ++++++ mesalib/src/mesa/shader/slang/slang_emit.h | 51 + mesalib/src/mesa/shader/slang/slang_ir.c | 497 ++ mesalib/src/mesa/shader/slang/slang_ir.h | 279 + mesalib/src/mesa/shader/slang/slang_label.c | 104 + mesalib/src/mesa/shader/slang/slang_label.h | 45 + mesalib/src/mesa/shader/slang/slang_link.c | 898 ++ mesalib/src/mesa/shader/slang/slang_link.h | 37 + mesalib/src/mesa/shader/slang/slang_log.c | 134 + mesalib/src/mesa/shader/slang/slang_log.h | 57 + mesalib/src/mesa/shader/slang/slang_mem.c | 243 + mesalib/src/mesa/shader/slang/slang_mem.h | 55 + mesalib/src/mesa/shader/slang/slang_preprocess.c | 1406 +++ mesalib/src/mesa/shader/slang/slang_preprocess.h | 41 + mesalib/src/mesa/shader/slang/slang_print.c | 883 ++ mesalib/src/mesa/shader/slang/slang_print.h | 29 + mesalib/src/mesa/shader/slang/slang_simplify.c | 526 ++ mesalib/src/mesa/shader/slang/slang_simplify.h | 50 + mesalib/src/mesa/shader/slang/slang_storage.c | 316 + mesalib/src/mesa/shader/slang/slang_storage.h | 139 + mesalib/src/mesa/shader/slang/slang_typeinfo.c | 1138 +++ mesalib/src/mesa/shader/slang/slang_typeinfo.h | 239 + mesalib/src/mesa/shader/slang/slang_utility.c | 228 + mesalib/src/mesa/shader/slang/slang_utility.h | 100 + mesalib/src/mesa/shader/slang/slang_vartable.c | 362 + mesalib/src/mesa/shader/slang/slang_vartable.h | 42 + mesalib/src/mesa/shader/symbol_table.c | 350 + mesalib/src/mesa/shader/symbol_table.h | 55 + mesalib/src/mesa/sources.mak | 375 + mesalib/src/mesa/swrast/descrip.mms | 82 + mesalib/src/mesa/swrast/s_aaline.c | 524 ++ mesalib/src/mesa/swrast/s_aaline.h | 38 + mesalib/src/mesa/swrast/s_aalinetemp.h | 274 + mesalib/src/mesa/swrast/s_aatriangle.c | 417 + mesalib/src/mesa/swrast/s_aatriangle.h | 38 + mesalib/src/mesa/swrast/s_aatritemp.h | 383 + mesalib/src/mesa/swrast/s_accum.c | 599 ++ mesalib/src/mesa/swrast/s_accum.h | 37 + mesalib/src/mesa/swrast/s_alpha.c | 160 + mesalib/src/mesa/swrast/s_alpha.h | 38 + mesalib/src/mesa/swrast/s_atifragshader.c | 604 ++ mesalib/src/mesa/swrast/s_atifragshader.h | 37 + mesalib/src/mesa/swrast/s_bitmap.c | 228 + mesalib/src/mesa/swrast/s_blend.c | 1002 +++ mesalib/src/mesa/swrast/s_blend.h | 41 + mesalib/src/mesa/swrast/s_blit.c | 615 ++ mesalib/src/mesa/swrast/s_clear.c | 344 + mesalib/src/mesa/swrast/s_context.c | 957 ++ mesalib/src/mesa/swrast/s_context.h | 348 + mesalib/src/mesa/swrast/s_copypix.c | 932 ++ mesalib/src/mesa/swrast/s_depth.c | 1429 +++ mesalib/src/mesa/swrast/s_depth.h | 55 + mesalib/src/mesa/swrast/s_drawpix.c | 898 ++ mesalib/src/mesa/swrast/s_feedback.c | 140 + mesalib/src/mesa/swrast/s_feedback.h | 50 + mesalib/src/mesa/swrast/s_fog.c | 330 + mesalib/src/mesa/swrast/s_fog.h | 44 + mesalib/src/mesa/swrast/s_fragprog.c | 269 + mesalib/src/mesa/swrast/s_fragprog.h | 38 + mesalib/src/mesa/swrast/s_imaging.c | 196 + mesalib/src/mesa/swrast/s_lines.c | 307 + mesalib/src/mesa/swrast/s_lines.h | 41 + mesalib/src/mesa/swrast/s_linetemp.h | 421 + mesalib/src/mesa/swrast/s_logic.c | 246 + mesalib/src/mesa/swrast/s_logic.h | 43 + mesalib/src/mesa/swrast/s_masking.c | 134 + mesalib/src/mesa/swrast/s_masking.h | 42 + mesalib/src/mesa/swrast/s_points.c | 598 ++ mesalib/src/mesa/swrast/s_points.h | 39 + mesalib/src/mesa/swrast/s_readpix.c | 620 ++ mesalib/src/mesa/swrast/s_span.c | 1795 ++++ mesalib/src/mesa/swrast/s_span.h | 226 + mesalib/src/mesa/swrast/s_spantemp.h | 235 + mesalib/src/mesa/swrast/s_stencil.c | 1245 +++ mesalib/src/mesa/swrast/s_stencil.h | 52 + mesalib/src/mesa/swrast/s_texcombine.c | 710 ++ mesalib/src/mesa/swrast/s_texcombine.h | 35 + mesalib/src/mesa/swrast/s_texfilter.c | 3266 +++++++ mesalib/src/mesa/swrast/s_texfilter.h | 38 + mesalib/src/mesa/swrast/s_texstore.c | 601 ++ mesalib/src/mesa/swrast/s_triangle.c | 1150 +++ mesalib/src/mesa/swrast/s_triangle.h | 50 + mesalib/src/mesa/swrast/s_trispan.h | 31 + mesalib/src/mesa/swrast/s_tritemp.h | 979 ++ mesalib/src/mesa/swrast/s_zoom.c | 477 + mesalib/src/mesa/swrast/s_zoom.h | 59 + mesalib/src/mesa/swrast/swrast.h | 292 + mesalib/src/mesa/swrast_setup/descrip.mms | 42 + mesalib/src/mesa/swrast_setup/ss_context.c | 317 + mesalib/src/mesa/swrast_setup/ss_context.h | 46 + mesalib/src/mesa/swrast_setup/ss_triangle.c | 317 + mesalib/src/mesa/swrast_setup/ss_triangle.h | 38 + mesalib/src/mesa/swrast_setup/ss_tritmp.h | 266 + mesalib/src/mesa/swrast_setup/ss_vb.h | 38 + mesalib/src/mesa/swrast_setup/swrast_setup.h | 61 + mesalib/src/mesa/tnl/descrip.mms | 68 + mesalib/src/mesa/tnl/t_context.c | 231 + mesalib/src/mesa/tnl/t_context.h | 551 ++ mesalib/src/mesa/tnl/t_draw.c | 451 + mesalib/src/mesa/tnl/t_pipeline.c | 215 + mesalib/src/mesa/tnl/t_pipeline.h | 74 + mesalib/src/mesa/tnl/t_rasterpos.c | 505 ++ mesalib/src/mesa/tnl/t_vb_cliptmp.h | 320 + mesalib/src/mesa/tnl/t_vb_cull.c | 97 + mesalib/src/mesa/tnl/t_vb_fog.c | 277 + mesalib/src/mesa/tnl/t_vb_light.c | 362 + mesalib/src/mesa/tnl/t_vb_lighttmp.h | 824 ++ mesalib/src/mesa/tnl/t_vb_normals.c | 189 + mesalib/src/mesa/tnl/t_vb_points.c | 114 + mesalib/src/mesa/tnl/t_vb_program.c | 563 ++ mesalib/src/mesa/tnl/t_vb_render.c | 347 + mesalib/src/mesa/tnl/t_vb_rendertmp.h | 486 + mesalib/src/mesa/tnl/t_vb_texgen.c | 611 ++ mesalib/src/mesa/tnl/t_vb_texmat.c | 130 + mesalib/src/mesa/tnl/t_vb_vertex.c | 264 + mesalib/src/mesa/tnl/t_vertex.c | 564 ++ mesalib/src/mesa/tnl/t_vertex.h | 181 + mesalib/src/mesa/tnl/t_vertex_generic.c | 1155 +++ mesalib/src/mesa/tnl/t_vertex_sse.c | 684 ++ mesalib/src/mesa/tnl/t_vp_build.c | 60 + mesalib/src/mesa/tnl/t_vp_build.h | 42 + mesalib/src/mesa/tnl/tnl.h | 100 + mesalib/src/mesa/vbo/descrip.mms | 62 + mesalib/src/mesa/vbo/vbo.h | 142 + mesalib/src/mesa/vbo/vbo_attrib.h | 107 + mesalib/src/mesa/vbo/vbo_attrib_tmp.h | 486 + mesalib/src/mesa/vbo/vbo_context.c | 273 + mesalib/src/mesa/vbo/vbo_context.h | 114 + mesalib/src/mesa/vbo/vbo_exec.c | 97 + mesalib/src/mesa/vbo/vbo_exec.h | 179 + mesalib/src/mesa/vbo/vbo_exec_api.c | 838 ++ mesalib/src/mesa/vbo/vbo_exec_array.c | 965 ++ mesalib/src/mesa/vbo/vbo_exec_draw.c | 413 + mesalib/src/mesa/vbo/vbo_exec_eval.c | 254 + mesalib/src/mesa/vbo/vbo_rebase.c | 223 + mesalib/src/mesa/vbo/vbo_save.c | 110 + mesalib/src/mesa/vbo/vbo_save.h | 184 + mesalib/src/mesa/vbo/vbo_save_api.c | 1238 +++ mesalib/src/mesa/vbo/vbo_save_draw.c | 290 + mesalib/src/mesa/vbo/vbo_save_loopback.c | 191 + mesalib/src/mesa/vbo/vbo_split.c | 161 + mesalib/src/mesa/vbo/vbo_split.h | 72 + mesalib/src/mesa/vbo/vbo_split_copy.c | 616 ++ mesalib/src/mesa/vbo/vbo_split_inplace.c | 271 + 1030 files changed, 410865 insertions(+) create mode 100644 mesalib/Makefile create mode 100644 mesalib/acinclude.m4 create mode 100644 mesalib/aclocal.m4 create mode 100644 mesalib/bin/config.guess create mode 100644 mesalib/bin/config.sub create mode 100644 mesalib/bin/install-sh create mode 100644 mesalib/bin/minstall create mode 100644 mesalib/bin/mklib create mode 100644 mesalib/bin/version.mk create mode 100644 mesalib/configs/aix create mode 100644 mesalib/configs/aix-64 create mode 100644 mesalib/configs/aix-64-static create mode 100644 mesalib/configs/aix-gcc create mode 100644 mesalib/configs/aix-static create mode 100644 mesalib/configs/autoconf.in create mode 100644 mesalib/configs/beos create mode 100644 mesalib/configs/bluegene-osmesa create mode 100644 mesalib/configs/bluegene-xlc-osmesa create mode 100644 mesalib/configs/catamount-osmesa-pgi create mode 100644 mesalib/configs/config.mgw create mode 100644 mesalib/configs/darwin create mode 100644 mesalib/configs/darwin-fat-32bit create mode 100644 mesalib/configs/darwin-fat-all create mode 100644 mesalib/configs/darwin-x86ppc create mode 100644 mesalib/configs/default create mode 100644 mesalib/configs/freebsd create mode 100644 mesalib/configs/freebsd-dri create mode 100644 mesalib/configs/freebsd-dri-amd64 create mode 100644 mesalib/configs/freebsd-dri-x86 create mode 100644 mesalib/configs/hpux10 create mode 100644 mesalib/configs/hpux10-gcc create mode 100644 mesalib/configs/hpux10-static create mode 100644 mesalib/configs/hpux11-32 create mode 100644 mesalib/configs/hpux11-32-static create mode 100644 mesalib/configs/hpux11-32-static-nothreads create mode 100644 mesalib/configs/hpux11-64 create mode 100644 mesalib/configs/hpux11-64-static create mode 100644 mesalib/configs/hpux11-ia64 create mode 100644 mesalib/configs/hpux11-ia64-static create mode 100644 mesalib/configs/hpux9 create mode 100644 mesalib/configs/hpux9-gcc create mode 100644 mesalib/configs/irix6-64 create mode 100644 mesalib/configs/irix6-64-static create mode 100644 mesalib/configs/irix6-n32 create mode 100644 mesalib/configs/irix6-n32-static create mode 100644 mesalib/configs/irix6-o32 create mode 100644 mesalib/configs/irix6-o32-static create mode 100644 mesalib/configs/linux create mode 100644 mesalib/configs/linux-alpha create mode 100644 mesalib/configs/linux-alpha-static create mode 100644 mesalib/configs/linux-cell create mode 100644 mesalib/configs/linux-cell-debug create mode 100644 mesalib/configs/linux-debug create mode 100644 mesalib/configs/linux-directfb create mode 100644 mesalib/configs/linux-dri create mode 100644 mesalib/configs/linux-dri-debug create mode 100644 mesalib/configs/linux-dri-ppc create mode 100644 mesalib/configs/linux-dri-x86 create mode 100644 mesalib/configs/linux-dri-x86-64 create mode 100644 mesalib/configs/linux-dri-xcb create mode 100644 mesalib/configs/linux-egl create mode 100644 mesalib/configs/linux-fbdev create mode 100644 mesalib/configs/linux-glide create mode 100644 mesalib/configs/linux-ia64-icc create mode 100644 mesalib/configs/linux-ia64-icc-static create mode 100644 mesalib/configs/linux-icc create mode 100644 mesalib/configs/linux-icc-static create mode 100644 mesalib/configs/linux-indirect create mode 100644 mesalib/configs/linux-llvm create mode 100644 mesalib/configs/linux-osmesa create mode 100644 mesalib/configs/linux-osmesa-static create mode 100644 mesalib/configs/linux-osmesa16 create mode 100644 mesalib/configs/linux-osmesa16-static create mode 100644 mesalib/configs/linux-osmesa32 create mode 100644 mesalib/configs/linux-ppc create mode 100644 mesalib/configs/linux-ppc-static create mode 100644 mesalib/configs/linux-profile create mode 100644 mesalib/configs/linux-solo create mode 100644 mesalib/configs/linux-solo-ia64 create mode 100644 mesalib/configs/linux-solo-x86 create mode 100644 mesalib/configs/linux-sparc create mode 100644 mesalib/configs/linux-sparc5 create mode 100644 mesalib/configs/linux-static create mode 100644 mesalib/configs/linux-ultrasparc create mode 100644 mesalib/configs/linux-x86 create mode 100644 mesalib/configs/linux-x86-32 create mode 100644 mesalib/configs/linux-x86-64 create mode 100644 mesalib/configs/linux-x86-64-debug create mode 100644 mesalib/configs/linux-x86-64-profile create mode 100644 mesalib/configs/linux-x86-64-static create mode 100644 mesalib/configs/linux-x86-debug create mode 100644 mesalib/configs/linux-x86-glide create mode 100644 mesalib/configs/linux-x86-profile create mode 100644 mesalib/configs/linux-x86-static create mode 100644 mesalib/configs/netbsd create mode 100644 mesalib/configs/openbsd create mode 100644 mesalib/configs/osf1 create mode 100644 mesalib/configs/osf1-static create mode 100644 mesalib/configs/solaris-x86 create mode 100644 mesalib/configs/solaris-x86-gcc create mode 100644 mesalib/configs/solaris-x86-gcc-static create mode 100644 mesalib/configs/sunos4 create mode 100644 mesalib/configs/sunos4-gcc create mode 100644 mesalib/configs/sunos4-static create mode 100644 mesalib/configs/sunos5 create mode 100644 mesalib/configs/sunos5-64-gcc create mode 100644 mesalib/configs/sunos5-gcc create mode 100644 mesalib/configs/sunos5-smp create mode 100644 mesalib/configs/sunos5-v8 create mode 100644 mesalib/configs/sunos5-v8-static create mode 100644 mesalib/configs/sunos5-v9 create mode 100644 mesalib/configs/sunos5-v9-cc-g++ create mode 100644 mesalib/configs/sunos5-v9-static create mode 100644 mesalib/configs/ultrix-gcc create mode 100644 mesalib/configure create mode 100644 mesalib/configure.ac create mode 100644 mesalib/docs/COPYING create mode 100644 mesalib/docs/MESA_agp_offset.spec create mode 100644 mesalib/docs/MESA_copy_sub_buffer.spec create mode 100644 mesalib/docs/MESA_pack_invert.spec create mode 100644 mesalib/docs/MESA_pixmap_colormap.spec create mode 100644 mesalib/docs/MESA_release_buffers.spec create mode 100644 mesalib/docs/MESA_resize_buffers.spec create mode 100644 mesalib/docs/MESA_set_3dfx_mode.spec create mode 100644 mesalib/docs/MESA_shader_debug.spec create mode 100644 mesalib/docs/MESA_swap_control.spec create mode 100644 mesalib/docs/MESA_swap_frame_usage.spec create mode 100644 mesalib/docs/MESA_texture_array.spec create mode 100644 mesalib/docs/MESA_texture_signed_rgba.spec create mode 100644 mesalib/docs/MESA_window_pos.spec create mode 100644 mesalib/docs/MESA_ycbcr_texture.spec create mode 100644 mesalib/docs/MiniGLX.html create mode 100644 mesalib/docs/README.3DFX create mode 100644 mesalib/docs/README.AMIWIN create mode 100644 mesalib/docs/README.BEOS create mode 100644 mesalib/docs/README.CYGWIN create mode 100644 mesalib/docs/README.D3D create mode 100644 mesalib/docs/README.DJ create mode 100644 mesalib/docs/README.GGI create mode 100644 mesalib/docs/README.LYNXOS create mode 100644 mesalib/docs/README.MINGW32 create mode 100644 mesalib/docs/README.MITS create mode 100644 mesalib/docs/README.NeXT create mode 100644 mesalib/docs/README.OS2 create mode 100644 mesalib/docs/README.OpenStep create mode 100644 mesalib/docs/README.QUAKE create mode 100644 mesalib/docs/README.THREADS create mode 100644 mesalib/docs/README.VMS create mode 100644 mesalib/docs/README.WIN32 create mode 100644 mesalib/docs/README.WINDML create mode 100644 mesalib/docs/README.directfb create mode 100644 mesalib/docs/RELNOTES-3.1 create mode 100644 mesalib/docs/RELNOTES-3.2 create mode 100644 mesalib/docs/RELNOTES-3.2.1 create mode 100644 mesalib/docs/RELNOTES-3.3 create mode 100644 mesalib/docs/RELNOTES-3.4 create mode 100644 mesalib/docs/RELNOTES-3.4.1 create mode 100644 mesalib/docs/RELNOTES-3.4.2 create mode 100644 mesalib/docs/RELNOTES-3.5 create mode 100644 mesalib/docs/RELNOTES-4.0 create mode 100644 mesalib/docs/RELNOTES-4.0.1 create mode 100644 mesalib/docs/RELNOTES-4.0.2 create mode 100644 mesalib/docs/RELNOTES-4.0.3 create mode 100644 mesalib/docs/RELNOTES-4.1 create mode 100644 mesalib/docs/RELNOTES-5.0 create mode 100644 mesalib/docs/RELNOTES-5.0.1 create mode 100644 mesalib/docs/RELNOTES-5.0.2 create mode 100644 mesalib/docs/RELNOTES-5.1 create mode 100644 mesalib/docs/RELNOTES-6.0 create mode 100644 mesalib/docs/RELNOTES-6.0.1 create mode 100644 mesalib/docs/RELNOTES-6.1 create mode 100644 mesalib/docs/RELNOTES-6.2 create mode 100644 mesalib/docs/RELNOTES-6.2.1 create mode 100644 mesalib/docs/RELNOTES-6.3 create mode 100644 mesalib/docs/RELNOTES-6.3.1 create mode 100644 mesalib/docs/RELNOTES-6.3.2 create mode 100644 mesalib/docs/RELNOTES-6.4 create mode 100644 mesalib/docs/autoconf.html create mode 100644 mesalib/docs/banner.html create mode 100644 mesalib/docs/bugs.html create mode 100644 mesalib/docs/cell.html create mode 100644 mesalib/docs/conform.html create mode 100644 mesalib/docs/contents.html create mode 100644 mesalib/docs/debugging.html create mode 100644 mesalib/docs/demos.html create mode 100644 mesalib/docs/developers.html create mode 100644 mesalib/docs/devinfo.html create mode 100644 mesalib/docs/dispatch.html create mode 100644 mesalib/docs/download.html create mode 100644 mesalib/docs/envvars.html create mode 100644 mesalib/docs/extensions.html create mode 100644 mesalib/docs/faq.html create mode 100644 mesalib/docs/fbdev-dri.html create mode 100644 mesalib/docs/games.html create mode 100644 mesalib/docs/glfbdev-driver.html create mode 100644 mesalib/docs/glu.html create mode 100644 mesalib/docs/helpwanted.html create mode 100644 mesalib/docs/index.html create mode 100644 mesalib/docs/install.html create mode 100644 mesalib/docs/intro.html create mode 100644 mesalib/docs/libraries.html create mode 100644 mesalib/docs/license.html create mode 100644 mesalib/docs/lists.html create mode 100644 mesalib/docs/mangling.html create mode 100644 mesalib/docs/modelers.html create mode 100644 mesalib/docs/news.html create mode 100644 mesalib/docs/openvg.html create mode 100644 mesalib/docs/osmesa.html create mode 100644 mesalib/docs/pbuffers.html create mode 100644 mesalib/docs/perf.html create mode 100644 mesalib/docs/precompiled.html create mode 100644 mesalib/docs/relnotes-6.4.1.html create mode 100644 mesalib/docs/relnotes-6.4.2.html create mode 100644 mesalib/docs/relnotes-6.4.html create mode 100644 mesalib/docs/relnotes-6.5.1.html create mode 100644 mesalib/docs/relnotes-6.5.2.html create mode 100644 mesalib/docs/relnotes-6.5.3.html create mode 100644 mesalib/docs/relnotes-6.5.html create mode 100644 mesalib/docs/relnotes-7.0.1.html create mode 100644 mesalib/docs/relnotes-7.0.2.html create mode 100644 mesalib/docs/relnotes-7.0.3.html create mode 100644 mesalib/docs/relnotes-7.0.4.html create mode 100644 mesalib/docs/relnotes-7.0.html create mode 100644 mesalib/docs/relnotes-7.1.html create mode 100644 mesalib/docs/relnotes-7.2.html create mode 100644 mesalib/docs/relnotes-7.3.html create mode 100644 mesalib/docs/relnotes-7.4.1.html create mode 100644 mesalib/docs/relnotes-7.4.2.html create mode 100644 mesalib/docs/relnotes-7.4.3.html create mode 100644 mesalib/docs/relnotes-7.4.4.html create mode 100644 mesalib/docs/relnotes-7.4.html create mode 100644 mesalib/docs/relnotes-7.5.1.html create mode 100644 mesalib/docs/relnotes-7.5.2.html create mode 100644 mesalib/docs/relnotes-7.5.html create mode 100644 mesalib/docs/relnotes-7.6.html create mode 100644 mesalib/docs/relnotes.html create mode 100644 mesalib/docs/repository.html create mode 100644 mesalib/docs/science.html create mode 100644 mesalib/docs/shading.html create mode 100644 mesalib/docs/sourcedocs.html create mode 100644 mesalib/docs/subset-A.html create mode 100644 mesalib/docs/subset.html create mode 100644 mesalib/docs/systems.html create mode 100644 mesalib/docs/thanks.html create mode 100644 mesalib/docs/utilities.html create mode 100644 mesalib/docs/utility.html create mode 100644 mesalib/docs/versions.html create mode 100644 mesalib/docs/webmaster.html create mode 100644 mesalib/docs/xlibdriver.html create mode 100644 mesalib/include/EGL/egl.h create mode 100644 mesalib/include/EGL/eglext.h create mode 100644 mesalib/include/EGL/eglplatform.h create mode 100644 mesalib/include/GL/dmesa.h create mode 100644 mesalib/include/GL/ggimesa.h create mode 100644 mesalib/include/GL/gl.h create mode 100644 mesalib/include/GL/gl_mangle.h create mode 100644 mesalib/include/GL/glext.h create mode 100644 mesalib/include/GL/glfbdev.h create mode 100644 mesalib/include/GL/glu.h create mode 100644 mesalib/include/GL/glu_mangle.h create mode 100644 mesalib/include/GL/glx.h create mode 100644 mesalib/include/GL/glx_mangle.h create mode 100644 mesalib/include/GL/glxext.h create mode 100644 mesalib/include/GL/internal/dri_interface.h create mode 100644 mesalib/include/GL/internal/glcore.h create mode 100644 mesalib/include/GL/internal/sarea.h create mode 100644 mesalib/include/GL/mesa_wgl.h create mode 100644 mesalib/include/GL/mglmesa.h create mode 100644 mesalib/include/GL/osmesa.h create mode 100644 mesalib/include/GL/svgamesa.h create mode 100644 mesalib/include/GL/vms_x_fix.h create mode 100644 mesalib/include/GL/wglext.h create mode 100644 mesalib/include/GL/wmesa.h create mode 100644 mesalib/include/GLES/egl.h create mode 100644 mesalib/include/GLES/egltypes.h create mode 100644 mesalib/include/GLES/gl.h create mode 100644 mesalib/include/GLES/glext.h create mode 100644 mesalib/include/GLES/glplatform.h create mode 100644 mesalib/include/GLES2/gl2.h create mode 100644 mesalib/include/GLES2/gl2ext.h create mode 100644 mesalib/include/GLES2/gl2platform.h create mode 100644 mesalib/progs/Makefile create mode 100644 mesalib/progs/util/README create mode 100644 mesalib/progs/util/dumpstate.c create mode 100644 mesalib/progs/util/errcheck.c create mode 100644 mesalib/progs/util/extfuncs.h create mode 100644 mesalib/progs/util/glstate.c create mode 100644 mesalib/progs/util/glstate.h create mode 100644 mesalib/progs/util/glutskel.c create mode 100644 mesalib/progs/util/idproj.c create mode 100644 mesalib/progs/util/imagesgi.h create mode 100644 mesalib/progs/util/matrix.c create mode 100644 mesalib/progs/util/mwmborder.c create mode 100644 mesalib/progs/util/readtex.c create mode 100644 mesalib/progs/util/readtex.h create mode 100644 mesalib/progs/util/sampleMakefile create mode 100644 mesalib/progs/util/shaderutil.c create mode 100644 mesalib/progs/util/shaderutil.h create mode 100644 mesalib/progs/util/showbuffer.c create mode 100644 mesalib/progs/util/showbuffer.h create mode 100644 mesalib/progs/util/trackball.c create mode 100644 mesalib/progs/util/trackball.h create mode 100644 mesalib/progs/util/winpos.c create mode 100644 mesalib/src/Makefile create mode 100644 mesalib/src/glu/Makefile create mode 100644 mesalib/src/glu/glu.pc.in create mode 100644 mesalib/src/glu/sgi/Makefile create mode 100644 mesalib/src/glu/sgi/Makefile.mgw create mode 100644 mesalib/src/glu/sgi/Makefile.win create mode 100644 mesalib/src/glu/sgi/dummy.cc create mode 100644 mesalib/src/glu/sgi/glu.def create mode 100644 mesalib/src/glu/sgi/glu.exports create mode 100644 mesalib/src/glu/sgi/glu.exports.darwin create mode 100644 mesalib/src/glu/sgi/include/gluos.h create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/bezierEval.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/bezierEval.h create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/bezierPatch.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/bezierPatch.h create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/bezierPatchMesh.h create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/glcurveval.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/glcurveval.h create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/glimports.h create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/glinterface.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/glrenderer.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/glrenderer.h create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/glsurfeval.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/glsurfeval.h create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/incurveeval.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/insurfeval.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/mystdio.h create mode 100644 mesalib/src/glu/sgi/libnurbs/interface/mystdlib.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/arc.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/arc.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/arcsorter.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/arcsorter.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/arctess.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/arctess.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/backend.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/backend.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/basiccrveval.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/basiccrveval.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/basicsurfeval.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/basicsurfeval.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/bezierarc.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/bin.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/bin.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/bufpool.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/bufpool.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/cachingeval.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/cachingeval.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/ccw.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/coveandtiler.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/coveandtiler.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/curve.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/curve.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/curvelist.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/curvelist.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/curvesub.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/dataTransform.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/dataTransform.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/defines.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/displaylist.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/displaylist.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/displaymode.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/flist.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/flist.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/flistsorter.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/flistsorter.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/gridline.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/gridtrimvertex.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/gridvertex.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/hull.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/hull.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/intersect.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/jarcloc.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/knotvector.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/knotvector.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/mapdesc.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/mapdesc.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/mapdescv.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/maplist.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/maplist.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/mesher.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/mesher.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/monoTriangulationBackend.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/monotonizer.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/monotonizer.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/myassert.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/mycode.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/mymath.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/mysetjmp.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/mystring.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/nurbsconsts.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/nurbstess.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/nurbstess.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/patch.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/patch.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/patchlist.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/patchlist.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/pwlarc.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/quilt.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/quilt.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/reader.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/reader.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/renderhints.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/renderhints.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/simplemath.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/slicer.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/slicer.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/sorter.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/sorter.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/splitarcs.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/subdivider.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/subdivider.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/tobezier.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/trimline.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/trimline.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/trimregion.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/trimregion.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/trimvertex.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/trimvertpool.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/trimvertpool.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/types.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/uarray.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/uarray.h create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/varray.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/internals/varray.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/definitions.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/directedLine.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/directedLine.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/glimports.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/monoPolyPart.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/monoPolyPart.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/monoTriangulation.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/mystdio.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/mystdlib.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/partitionX.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/partitionX.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/primitiveStream.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleComp.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleComp.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/searchTree.cc create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/searchTree.h create mode 100644 mesalib/src/glu/sgi/libnurbs/nurbtess/zlassert.h create mode 100644 mesalib/src/glu/sgi/libtess/README create mode 100644 mesalib/src/glu/sgi/libtess/alg-outline create mode 100644 mesalib/src/glu/sgi/libtess/dict-list.h create mode 100644 mesalib/src/glu/sgi/libtess/dict.c create mode 100644 mesalib/src/glu/sgi/libtess/dict.h create mode 100644 mesalib/src/glu/sgi/libtess/geom.c create mode 100644 mesalib/src/glu/sgi/libtess/geom.h create mode 100644 mesalib/src/glu/sgi/libtess/memalloc.c create mode 100644 mesalib/src/glu/sgi/libtess/memalloc.h create mode 100644 mesalib/src/glu/sgi/libtess/mesh.c create mode 100644 mesalib/src/glu/sgi/libtess/mesh.h create mode 100644 mesalib/src/glu/sgi/libtess/normal.c create mode 100644 mesalib/src/glu/sgi/libtess/normal.h create mode 100644 mesalib/src/glu/sgi/libtess/priorityq-heap.c create mode 100644 mesalib/src/glu/sgi/libtess/priorityq-heap.h create mode 100644 mesalib/src/glu/sgi/libtess/priorityq-sort.h create mode 100644 mesalib/src/glu/sgi/libtess/priorityq.c create mode 100644 mesalib/src/glu/sgi/libtess/priorityq.h create mode 100644 mesalib/src/glu/sgi/libtess/render.c create mode 100644 mesalib/src/glu/sgi/libtess/render.h create mode 100644 mesalib/src/glu/sgi/libtess/sweep.c create mode 100644 mesalib/src/glu/sgi/libtess/sweep.h create mode 100644 mesalib/src/glu/sgi/libtess/tess.c create mode 100644 mesalib/src/glu/sgi/libtess/tess.h create mode 100644 mesalib/src/glu/sgi/libtess/tessmono.c create mode 100644 mesalib/src/glu/sgi/libtess/tessmono.h create mode 100644 mesalib/src/glu/sgi/libutil/error.c create mode 100644 mesalib/src/glu/sgi/libutil/glue.c create mode 100644 mesalib/src/glu/sgi/libutil/gluint.h create mode 100644 mesalib/src/glu/sgi/libutil/mipmap.c create mode 100644 mesalib/src/glu/sgi/libutil/project.c create mode 100644 mesalib/src/glu/sgi/libutil/quad.c create mode 100644 mesalib/src/glu/sgi/libutil/registry.c create mode 100644 mesalib/src/mesa/Makefile create mode 100644 mesalib/src/mesa/Makefile.mgw create mode 100644 mesalib/src/mesa/depend create mode 100644 mesalib/src/mesa/descrip.mms create mode 100644 mesalib/src/mesa/drivers/Makefile create mode 100644 mesalib/src/mesa/drivers/common/descrip.mms create mode 100644 mesalib/src/mesa/drivers/common/driverfuncs.c create mode 100644 mesalib/src/mesa/drivers/common/driverfuncs.h create mode 100644 mesalib/src/mesa/drivers/common/meta.c create mode 100644 mesalib/src/mesa/drivers/common/meta.h create mode 100644 mesalib/src/mesa/drivers/dri/Makefile create mode 100644 mesalib/src/mesa/drivers/dri/Makefile.template create mode 100644 mesalib/src/mesa/drivers/dri/common/depthtmp.h create mode 100644 mesalib/src/mesa/drivers/dri/common/dri_metaops.c create mode 100644 mesalib/src/mesa/drivers/dri/common/dri_metaops.h create mode 100644 mesalib/src/mesa/drivers/dri/common/dri_util.c create mode 100644 mesalib/src/mesa/drivers/dri/common/dri_util.h create mode 100644 mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c create mode 100644 mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h create mode 100644 mesalib/src/mesa/drivers/dri/common/extension_helper.h create mode 100644 mesalib/src/mesa/drivers/dri/common/memops.h create mode 100644 mesalib/src/mesa/drivers/dri/common/mmio.h create mode 100644 mesalib/src/mesa/drivers/dri/common/mmx.h create mode 100644 mesalib/src/mesa/drivers/dri/common/spantmp.h create mode 100644 mesalib/src/mesa/drivers/dri/common/spantmp2.h create mode 100644 mesalib/src/mesa/drivers/dri/common/spantmp_common.h create mode 100644 mesalib/src/mesa/drivers/dri/common/stenciltmp.h create mode 100644 mesalib/src/mesa/drivers/dri/common/texmem.c create mode 100644 mesalib/src/mesa/drivers/dri/common/texmem.h create mode 100644 mesalib/src/mesa/drivers/dri/common/utils.c create mode 100644 mesalib/src/mesa/drivers/dri/common/utils.h create mode 100644 mesalib/src/mesa/drivers/dri/common/vblank.c create mode 100644 mesalib/src/mesa/drivers/dri/common/vblank.h create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlconfig.c create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlconfig.h create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool.h create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/Makefile create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/de.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/es.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/fr.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/nl.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/options.h create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/sv.po create mode 100644 mesalib/src/mesa/drivers/dri/common/xmlpool/t_options.h create mode 100644 mesalib/src/mesa/drivers/dri/dri.pc.in create mode 100644 mesalib/src/mesa/drivers/dri/swrast/Makefile create mode 100644 mesalib/src/mesa/drivers/dri/swrast/swrast.c create mode 100644 mesalib/src/mesa/drivers/dri/swrast/swrast_priv.h create mode 100644 mesalib/src/mesa/drivers/dri/swrast/swrast_span.c create mode 100644 mesalib/src/mesa/drivers/dri/swrast/swrast_spantemp.h create mode 100644 mesalib/src/mesa/drivers/windows/fx/fxopengl.def create mode 100644 mesalib/src/mesa/drivers/windows/fx/fxwgl.c create mode 100644 mesalib/src/mesa/drivers/windows/gdi/colors.h create mode 100644 mesalib/src/mesa/drivers/windows/gdi/mesa.def create mode 100644 mesalib/src/mesa/drivers/windows/gdi/wgl.c create mode 100644 mesalib/src/mesa/drivers/windows/gdi/wmesa.c create mode 100644 mesalib/src/mesa/drivers/windows/gdi/wmesadef.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/ddlog.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/ddlog.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglcontext.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglcontext.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglglobals.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglglobals.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglmacros.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglpf.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglpf.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglwgl.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dglwgl.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dll_main.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/dllmain.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_debug_clip.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_debug_norm.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_debug_xform.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_dispatch.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_driver.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gld_driver.h create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/gldlame8.c create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/opengl32.def create mode 100644 mesalib/src/mesa/drivers/windows/gldirect/pixpack.h create mode 100644 mesalib/src/mesa/drivers/windows/icd/icd.c create mode 100644 mesalib/src/mesa/drivers/windows/icd/icdlist.h create mode 100644 mesalib/src/mesa/drivers/windows/icd/mesa.def create mode 100644 mesalib/src/mesa/gl.pc.in create mode 100644 mesalib/src/mesa/glapi/dispatch.h create mode 100644 mesalib/src/mesa/glapi/glapi.c create mode 100644 mesalib/src/mesa/glapi/glapi.h create mode 100644 mesalib/src/mesa/glapi/glapi_getproc.c create mode 100644 mesalib/src/mesa/glapi/glapioffsets.h create mode 100644 mesalib/src/mesa/glapi/glapitable.h create mode 100644 mesalib/src/mesa/glapi/glapitemp.h create mode 100644 mesalib/src/mesa/glapi/glprocs.h create mode 100644 mesalib/src/mesa/glapi/glthread.c create mode 100644 mesalib/src/mesa/glapi/glthread.h create mode 100644 mesalib/src/mesa/main/accum.c create mode 100644 mesalib/src/mesa/main/accum.h create mode 100644 mesalib/src/mesa/main/api_arrayelt.c create mode 100644 mesalib/src/mesa/main/api_arrayelt.h create mode 100644 mesalib/src/mesa/main/api_exec.c create mode 100644 mesalib/src/mesa/main/api_exec.h create mode 100644 mesalib/src/mesa/main/api_loopback.c create mode 100644 mesalib/src/mesa/main/api_loopback.h create mode 100644 mesalib/src/mesa/main/api_noop.c create mode 100644 mesalib/src/mesa/main/api_noop.h create mode 100644 mesalib/src/mesa/main/api_validate.c create mode 100644 mesalib/src/mesa/main/api_validate.h create mode 100644 mesalib/src/mesa/main/arrayobj.c create mode 100644 mesalib/src/mesa/main/arrayobj.h create mode 100644 mesalib/src/mesa/main/attrib.c create mode 100644 mesalib/src/mesa/main/attrib.h create mode 100644 mesalib/src/mesa/main/bitset.h create mode 100644 mesalib/src/mesa/main/blend.c create mode 100644 mesalib/src/mesa/main/blend.h create mode 100644 mesalib/src/mesa/main/bufferobj.c create mode 100644 mesalib/src/mesa/main/bufferobj.h create mode 100644 mesalib/src/mesa/main/buffers.c create mode 100644 mesalib/src/mesa/main/buffers.h create mode 100644 mesalib/src/mesa/main/clear.c create mode 100644 mesalib/src/mesa/main/clear.h create mode 100644 mesalib/src/mesa/main/clip.c create mode 100644 mesalib/src/mesa/main/clip.h create mode 100644 mesalib/src/mesa/main/colormac.h create mode 100644 mesalib/src/mesa/main/colortab.c create mode 100644 mesalib/src/mesa/main/colortab.h create mode 100644 mesalib/src/mesa/main/compiler.h create mode 100644 mesalib/src/mesa/main/config.h create mode 100644 mesalib/src/mesa/main/context.c create mode 100644 mesalib/src/mesa/main/context.h create mode 100644 mesalib/src/mesa/main/convolve.c create mode 100644 mesalib/src/mesa/main/convolve.h create mode 100644 mesalib/src/mesa/main/cpuinfo.c create mode 100644 mesalib/src/mesa/main/cpuinfo.h create mode 100644 mesalib/src/mesa/main/dd.h create mode 100644 mesalib/src/mesa/main/debug.c create mode 100644 mesalib/src/mesa/main/debug.h create mode 100644 mesalib/src/mesa/main/depth.c create mode 100644 mesalib/src/mesa/main/depth.h create mode 100644 mesalib/src/mesa/main/depthstencil.c create mode 100644 mesalib/src/mesa/main/depthstencil.h create mode 100644 mesalib/src/mesa/main/descrip.mms create mode 100644 mesalib/src/mesa/main/dispatch.c create mode 100644 mesalib/src/mesa/main/dlist.c create mode 100644 mesalib/src/mesa/main/dlist.h create mode 100644 mesalib/src/mesa/main/dlopen.c create mode 100644 mesalib/src/mesa/main/dlopen.h create mode 100644 mesalib/src/mesa/main/drawpix.c create mode 100644 mesalib/src/mesa/main/drawpix.h create mode 100644 mesalib/src/mesa/main/enable.c create mode 100644 mesalib/src/mesa/main/enable.h create mode 100644 mesalib/src/mesa/main/enums.c create mode 100644 mesalib/src/mesa/main/enums.h create mode 100644 mesalib/src/mesa/main/eval.c create mode 100644 mesalib/src/mesa/main/eval.h create mode 100644 mesalib/src/mesa/main/execmem.c create mode 100644 mesalib/src/mesa/main/extensions.c create mode 100644 mesalib/src/mesa/main/extensions.h create mode 100644 mesalib/src/mesa/main/fbobject.c create mode 100644 mesalib/src/mesa/main/fbobject.h create mode 100644 mesalib/src/mesa/main/feedback.c create mode 100644 mesalib/src/mesa/main/feedback.h create mode 100644 mesalib/src/mesa/main/ffvertex_prog.c create mode 100644 mesalib/src/mesa/main/ffvertex_prog.h create mode 100644 mesalib/src/mesa/main/fog.c create mode 100644 mesalib/src/mesa/main/fog.h create mode 100644 mesalib/src/mesa/main/framebuffer.c create mode 100644 mesalib/src/mesa/main/framebuffer.h create mode 100644 mesalib/src/mesa/main/get.c create mode 100644 mesalib/src/mesa/main/get.h create mode 100644 mesalib/src/mesa/main/getstring.c create mode 100644 mesalib/src/mesa/main/glheader.h create mode 100644 mesalib/src/mesa/main/hash.c create mode 100644 mesalib/src/mesa/main/hash.h create mode 100644 mesalib/src/mesa/main/hint.c create mode 100644 mesalib/src/mesa/main/hint.h create mode 100644 mesalib/src/mesa/main/histogram.c create mode 100644 mesalib/src/mesa/main/histogram.h create mode 100644 mesalib/src/mesa/main/image.c create mode 100644 mesalib/src/mesa/main/image.h create mode 100644 mesalib/src/mesa/main/imports.c create mode 100644 mesalib/src/mesa/main/imports.h create mode 100644 mesalib/src/mesa/main/light.c create mode 100644 mesalib/src/mesa/main/light.h create mode 100644 mesalib/src/mesa/main/lines.c create mode 100644 mesalib/src/mesa/main/lines.h create mode 100644 mesalib/src/mesa/main/macros.h create mode 100644 mesalib/src/mesa/main/matrix.c create mode 100644 mesalib/src/mesa/main/matrix.h create mode 100644 mesalib/src/mesa/main/mfeatures.h create mode 100644 mesalib/src/mesa/main/mipmap.c create mode 100644 mesalib/src/mesa/main/mipmap.h create mode 100644 mesalib/src/mesa/main/mm.c create mode 100644 mesalib/src/mesa/main/mm.h create mode 100644 mesalib/src/mesa/main/mtypes.h create mode 100644 mesalib/src/mesa/main/multisample.c create mode 100644 mesalib/src/mesa/main/multisample.h create mode 100644 mesalib/src/mesa/main/pixel.c create mode 100644 mesalib/src/mesa/main/pixel.h create mode 100644 mesalib/src/mesa/main/pixelstore.c create mode 100644 mesalib/src/mesa/main/pixelstore.h create mode 100644 mesalib/src/mesa/main/points.c create mode 100644 mesalib/src/mesa/main/points.h create mode 100644 mesalib/src/mesa/main/polygon.c create mode 100644 mesalib/src/mesa/main/polygon.h create mode 100644 mesalib/src/mesa/main/queryobj.c create mode 100644 mesalib/src/mesa/main/queryobj.h create mode 100644 mesalib/src/mesa/main/rastpos.c create mode 100644 mesalib/src/mesa/main/rastpos.h create mode 100644 mesalib/src/mesa/main/rbadaptors.c create mode 100644 mesalib/src/mesa/main/rbadaptors.h create mode 100644 mesalib/src/mesa/main/readpix.c create mode 100644 mesalib/src/mesa/main/readpix.h create mode 100644 mesalib/src/mesa/main/renderbuffer.c create mode 100644 mesalib/src/mesa/main/renderbuffer.h create mode 100644 mesalib/src/mesa/main/scissor.c create mode 100644 mesalib/src/mesa/main/scissor.h create mode 100644 mesalib/src/mesa/main/shaders.c create mode 100644 mesalib/src/mesa/main/shaders.h create mode 100644 mesalib/src/mesa/main/shared.c create mode 100644 mesalib/src/mesa/main/shared.h create mode 100644 mesalib/src/mesa/main/simple_list.h create mode 100644 mesalib/src/mesa/main/state.c create mode 100644 mesalib/src/mesa/main/state.h create mode 100644 mesalib/src/mesa/main/stencil.c create mode 100644 mesalib/src/mesa/main/stencil.h create mode 100644 mesalib/src/mesa/main/syncobj.c create mode 100644 mesalib/src/mesa/main/syncobj.h create mode 100644 mesalib/src/mesa/main/texcompress.c create mode 100644 mesalib/src/mesa/main/texcompress.h create mode 100644 mesalib/src/mesa/main/texcompress_fxt1.c create mode 100644 mesalib/src/mesa/main/texcompress_s3tc.c create mode 100644 mesalib/src/mesa/main/texenv.c create mode 100644 mesalib/src/mesa/main/texenv.h create mode 100644 mesalib/src/mesa/main/texenvprogram.c create mode 100644 mesalib/src/mesa/main/texenvprogram.h create mode 100644 mesalib/src/mesa/main/texformat.c create mode 100644 mesalib/src/mesa/main/texformat.h create mode 100644 mesalib/src/mesa/main/texformat_tmp.h create mode 100644 mesalib/src/mesa/main/texgen.c create mode 100644 mesalib/src/mesa/main/texgen.h create mode 100644 mesalib/src/mesa/main/texgetimage.c create mode 100644 mesalib/src/mesa/main/texgetimage.h create mode 100644 mesalib/src/mesa/main/teximage.c create mode 100644 mesalib/src/mesa/main/teximage.h create mode 100644 mesalib/src/mesa/main/texobj.c create mode 100644 mesalib/src/mesa/main/texobj.h create mode 100644 mesalib/src/mesa/main/texparam.c create mode 100644 mesalib/src/mesa/main/texparam.h create mode 100644 mesalib/src/mesa/main/texrender.c create mode 100644 mesalib/src/mesa/main/texrender.h create mode 100644 mesalib/src/mesa/main/texstate.c create mode 100644 mesalib/src/mesa/main/texstate.h create mode 100644 mesalib/src/mesa/main/texstore.c create mode 100644 mesalib/src/mesa/main/texstore.h create mode 100644 mesalib/src/mesa/main/varray.c create mode 100644 mesalib/src/mesa/main/varray.h create mode 100644 mesalib/src/mesa/main/version.h create mode 100644 mesalib/src/mesa/main/viewport.c create mode 100644 mesalib/src/mesa/main/viewport.h create mode 100644 mesalib/src/mesa/main/vsnprintf.c create mode 100644 mesalib/src/mesa/main/vtxfmt.c create mode 100644 mesalib/src/mesa/main/vtxfmt.h create mode 100644 mesalib/src/mesa/main/vtxfmt_tmp.h create mode 100644 mesalib/src/mesa/math/descrip.mms create mode 100644 mesalib/src/mesa/math/m_clip_tmp.h create mode 100644 mesalib/src/mesa/math/m_copy_tmp.h create mode 100644 mesalib/src/mesa/math/m_debug.h create mode 100644 mesalib/src/mesa/math/m_debug_clip.c create mode 100644 mesalib/src/mesa/math/m_debug_norm.c create mode 100644 mesalib/src/mesa/math/m_debug_util.h create mode 100644 mesalib/src/mesa/math/m_debug_xform.c create mode 100644 mesalib/src/mesa/math/m_dotprod_tmp.h create mode 100644 mesalib/src/mesa/math/m_eval.c create mode 100644 mesalib/src/mesa/math/m_eval.h create mode 100644 mesalib/src/mesa/math/m_matrix.c create mode 100644 mesalib/src/mesa/math/m_matrix.h create mode 100644 mesalib/src/mesa/math/m_norm_tmp.h create mode 100644 mesalib/src/mesa/math/m_trans_tmp.h create mode 100644 mesalib/src/mesa/math/m_translate.c create mode 100644 mesalib/src/mesa/math/m_translate.h create mode 100644 mesalib/src/mesa/math/m_vector.c create mode 100644 mesalib/src/mesa/math/m_vector.h create mode 100644 mesalib/src/mesa/math/m_xform.c create mode 100644 mesalib/src/mesa/math/m_xform.h create mode 100644 mesalib/src/mesa/math/m_xform_tmp.h create mode 100644 mesalib/src/mesa/osmesa.pc.in create mode 100644 mesalib/src/mesa/shader/Makefile create mode 100644 mesalib/src/mesa/shader/arbprogparse.c create mode 100644 mesalib/src/mesa/shader/arbprogparse.h create mode 100644 mesalib/src/mesa/shader/arbprogram.c create mode 100644 mesalib/src/mesa/shader/arbprogram.h create mode 100644 mesalib/src/mesa/shader/atifragshader.c create mode 100644 mesalib/src/mesa/shader/atifragshader.h create mode 100644 mesalib/src/mesa/shader/descrip.mms create mode 100644 mesalib/src/mesa/shader/grammar/grammar.c create mode 100644 mesalib/src/mesa/shader/grammar/grammar.h create mode 100644 mesalib/src/mesa/shader/grammar/grammar_crt.c create mode 100644 mesalib/src/mesa/shader/grammar/grammar_crt.h create mode 100644 mesalib/src/mesa/shader/grammar/grammar_mesa.c create mode 100644 mesalib/src/mesa/shader/grammar/grammar_mesa.h create mode 100644 mesalib/src/mesa/shader/grammar/grammar_syn.h create mode 100644 mesalib/src/mesa/shader/hash_table.c create mode 100644 mesalib/src/mesa/shader/hash_table.h create mode 100644 mesalib/src/mesa/shader/lex.yy.c create mode 100644 mesalib/src/mesa/shader/nvfragparse.c create mode 100644 mesalib/src/mesa/shader/nvfragparse.h create mode 100644 mesalib/src/mesa/shader/nvprogram.c create mode 100644 mesalib/src/mesa/shader/nvprogram.h create mode 100644 mesalib/src/mesa/shader/nvvertparse.c create mode 100644 mesalib/src/mesa/shader/nvvertparse.h create mode 100644 mesalib/src/mesa/shader/prog_cache.c create mode 100644 mesalib/src/mesa/shader/prog_cache.h create mode 100644 mesalib/src/mesa/shader/prog_execute.c create mode 100644 mesalib/src/mesa/shader/prog_execute.h create mode 100644 mesalib/src/mesa/shader/prog_instruction.c create mode 100644 mesalib/src/mesa/shader/prog_instruction.h create mode 100644 mesalib/src/mesa/shader/prog_noise.c create mode 100644 mesalib/src/mesa/shader/prog_noise.h create mode 100644 mesalib/src/mesa/shader/prog_optimize.c create mode 100644 mesalib/src/mesa/shader/prog_optimize.h create mode 100644 mesalib/src/mesa/shader/prog_parameter.c create mode 100644 mesalib/src/mesa/shader/prog_parameter.h create mode 100644 mesalib/src/mesa/shader/prog_parameter_layout.c create mode 100644 mesalib/src/mesa/shader/prog_parameter_layout.h create mode 100644 mesalib/src/mesa/shader/prog_print.c create mode 100644 mesalib/src/mesa/shader/prog_print.h create mode 100644 mesalib/src/mesa/shader/prog_statevars.c create mode 100644 mesalib/src/mesa/shader/prog_statevars.h create mode 100644 mesalib/src/mesa/shader/prog_uniform.c create mode 100644 mesalib/src/mesa/shader/prog_uniform.h create mode 100644 mesalib/src/mesa/shader/program.c create mode 100644 mesalib/src/mesa/shader/program.h create mode 100644 mesalib/src/mesa/shader/program_lexer.l create mode 100644 mesalib/src/mesa/shader/program_parse.tab.c create mode 100644 mesalib/src/mesa/shader/program_parse.tab.h create mode 100644 mesalib/src/mesa/shader/program_parse.y create mode 100644 mesalib/src/mesa/shader/program_parse_extra.c create mode 100644 mesalib/src/mesa/shader/program_parser.h create mode 100644 mesalib/src/mesa/shader/programopt.c create mode 100644 mesalib/src/mesa/shader/programopt.h create mode 100644 mesalib/src/mesa/shader/shader_api.c create mode 100644 mesalib/src/mesa/shader/shader_api.h create mode 100644 mesalib/src/mesa/shader/slang/descrip.mms create mode 100644 mesalib/src/mesa/shader/slang/library/Makefile create mode 100644 mesalib/src/mesa/shader/slang/library/gc_to_bin.c create mode 100644 mesalib/src/mesa/shader/slang/library/slang_120_core.gc create mode 100644 mesalib/src/mesa/shader/slang/library/slang_120_core_gc.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_builtin_120_common.gc create mode 100644 mesalib/src/mesa/shader/slang/library/slang_builtin_120_common_gc.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_builtin_120_fragment.gc create mode 100644 mesalib/src/mesa/shader/slang/library/slang_builtin_120_fragment_gc.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_common_builtin.gc create mode 100644 mesalib/src/mesa/shader/slang/library/slang_common_builtin_gc.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_core.gc create mode 100644 mesalib/src/mesa/shader/slang/library/slang_core_gc.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_fragment_builtin.gc create mode 100644 mesalib/src/mesa/shader/slang/library/slang_fragment_builtin_gc.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_pp_directives.syn create mode 100644 mesalib/src/mesa/shader/slang/library/slang_pp_directives_syn.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_pp_expression.syn create mode 100644 mesalib/src/mesa/shader/slang/library/slang_pp_expression_syn.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_pp_version.syn create mode 100644 mesalib/src/mesa/shader/slang/library/slang_pp_version_syn.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_shader.syn create mode 100644 mesalib/src/mesa/shader/slang/library/slang_shader_syn.h create mode 100644 mesalib/src/mesa/shader/slang/library/slang_version.syn create mode 100644 mesalib/src/mesa/shader/slang/library/slang_vertex_builtin.gc create mode 100644 mesalib/src/mesa/shader/slang/library/slang_vertex_builtin_gc.h create mode 100644 mesalib/src/mesa/shader/slang/library/syn_to_c.c create mode 100644 mesalib/src/mesa/shader/slang/slang_builtin.c create mode 100644 mesalib/src/mesa/shader/slang/slang_builtin.h create mode 100644 mesalib/src/mesa/shader/slang/slang_codegen.c create mode 100644 mesalib/src/mesa/shader/slang/slang_codegen.h create mode 100644 mesalib/src/mesa/shader/slang/slang_compile.c create mode 100644 mesalib/src/mesa/shader/slang/slang_compile.h create mode 100644 mesalib/src/mesa/shader/slang/slang_compile_function.c create mode 100644 mesalib/src/mesa/shader/slang/slang_compile_function.h create mode 100644 mesalib/src/mesa/shader/slang/slang_compile_operation.c create mode 100644 mesalib/src/mesa/shader/slang/slang_compile_operation.h create mode 100644 mesalib/src/mesa/shader/slang/slang_compile_struct.c create mode 100644 mesalib/src/mesa/shader/slang/slang_compile_struct.h create mode 100644 mesalib/src/mesa/shader/slang/slang_compile_variable.c create mode 100644 mesalib/src/mesa/shader/slang/slang_compile_variable.h create mode 100644 mesalib/src/mesa/shader/slang/slang_emit.c create mode 100644 mesalib/src/mesa/shader/slang/slang_emit.h create mode 100644 mesalib/src/mesa/shader/slang/slang_ir.c create mode 100644 mesalib/src/mesa/shader/slang/slang_ir.h create mode 100644 mesalib/src/mesa/shader/slang/slang_label.c create mode 100644 mesalib/src/mesa/shader/slang/slang_label.h create mode 100644 mesalib/src/mesa/shader/slang/slang_link.c create mode 100644 mesalib/src/mesa/shader/slang/slang_link.h create mode 100644 mesalib/src/mesa/shader/slang/slang_log.c create mode 100644 mesalib/src/mesa/shader/slang/slang_log.h create mode 100644 mesalib/src/mesa/shader/slang/slang_mem.c create mode 100644 mesalib/src/mesa/shader/slang/slang_mem.h create mode 100644 mesalib/src/mesa/shader/slang/slang_preprocess.c create mode 100644 mesalib/src/mesa/shader/slang/slang_preprocess.h create mode 100644 mesalib/src/mesa/shader/slang/slang_print.c create mode 100644 mesalib/src/mesa/shader/slang/slang_print.h create mode 100644 mesalib/src/mesa/shader/slang/slang_simplify.c create mode 100644 mesalib/src/mesa/shader/slang/slang_simplify.h create mode 100644 mesalib/src/mesa/shader/slang/slang_storage.c create mode 100644 mesalib/src/mesa/shader/slang/slang_storage.h create mode 100644 mesalib/src/mesa/shader/slang/slang_typeinfo.c create mode 100644 mesalib/src/mesa/shader/slang/slang_typeinfo.h create mode 100644 mesalib/src/mesa/shader/slang/slang_utility.c create mode 100644 mesalib/src/mesa/shader/slang/slang_utility.h create mode 100644 mesalib/src/mesa/shader/slang/slang_vartable.c create mode 100644 mesalib/src/mesa/shader/slang/slang_vartable.h create mode 100644 mesalib/src/mesa/shader/symbol_table.c create mode 100644 mesalib/src/mesa/shader/symbol_table.h create mode 100644 mesalib/src/mesa/sources.mak create mode 100644 mesalib/src/mesa/swrast/descrip.mms create mode 100644 mesalib/src/mesa/swrast/s_aaline.c create mode 100644 mesalib/src/mesa/swrast/s_aaline.h create mode 100644 mesalib/src/mesa/swrast/s_aalinetemp.h create mode 100644 mesalib/src/mesa/swrast/s_aatriangle.c create mode 100644 mesalib/src/mesa/swrast/s_aatriangle.h create mode 100644 mesalib/src/mesa/swrast/s_aatritemp.h create mode 100644 mesalib/src/mesa/swrast/s_accum.c create mode 100644 mesalib/src/mesa/swrast/s_accum.h create mode 100644 mesalib/src/mesa/swrast/s_alpha.c create mode 100644 mesalib/src/mesa/swrast/s_alpha.h create mode 100644 mesalib/src/mesa/swrast/s_atifragshader.c create mode 100644 mesalib/src/mesa/swrast/s_atifragshader.h create mode 100644 mesalib/src/mesa/swrast/s_bitmap.c create mode 100644 mesalib/src/mesa/swrast/s_blend.c create mode 100644 mesalib/src/mesa/swrast/s_blend.h create mode 100644 mesalib/src/mesa/swrast/s_blit.c create mode 100644 mesalib/src/mesa/swrast/s_clear.c create mode 100644 mesalib/src/mesa/swrast/s_context.c create mode 100644 mesalib/src/mesa/swrast/s_context.h create mode 100644 mesalib/src/mesa/swrast/s_copypix.c create mode 100644 mesalib/src/mesa/swrast/s_depth.c create mode 100644 mesalib/src/mesa/swrast/s_depth.h create mode 100644 mesalib/src/mesa/swrast/s_drawpix.c create mode 100644 mesalib/src/mesa/swrast/s_feedback.c create mode 100644 mesalib/src/mesa/swrast/s_feedback.h create mode 100644 mesalib/src/mesa/swrast/s_fog.c create mode 100644 mesalib/src/mesa/swrast/s_fog.h create mode 100644 mesalib/src/mesa/swrast/s_fragprog.c create mode 100644 mesalib/src/mesa/swrast/s_fragprog.h create mode 100644 mesalib/src/mesa/swrast/s_imaging.c create mode 100644 mesalib/src/mesa/swrast/s_lines.c create mode 100644 mesalib/src/mesa/swrast/s_lines.h create mode 100644 mesalib/src/mesa/swrast/s_linetemp.h create mode 100644 mesalib/src/mesa/swrast/s_logic.c create mode 100644 mesalib/src/mesa/swrast/s_logic.h create mode 100644 mesalib/src/mesa/swrast/s_masking.c create mode 100644 mesalib/src/mesa/swrast/s_masking.h create mode 100644 mesalib/src/mesa/swrast/s_points.c create mode 100644 mesalib/src/mesa/swrast/s_points.h create mode 100644 mesalib/src/mesa/swrast/s_readpix.c create mode 100644 mesalib/src/mesa/swrast/s_span.c create mode 100644 mesalib/src/mesa/swrast/s_span.h create mode 100644 mesalib/src/mesa/swrast/s_spantemp.h create mode 100644 mesalib/src/mesa/swrast/s_stencil.c create mode 100644 mesalib/src/mesa/swrast/s_stencil.h create mode 100644 mesalib/src/mesa/swrast/s_texcombine.c create mode 100644 mesalib/src/mesa/swrast/s_texcombine.h create mode 100644 mesalib/src/mesa/swrast/s_texfilter.c create mode 100644 mesalib/src/mesa/swrast/s_texfilter.h create mode 100644 mesalib/src/mesa/swrast/s_texstore.c create mode 100644 mesalib/src/mesa/swrast/s_triangle.c create mode 100644 mesalib/src/mesa/swrast/s_triangle.h create mode 100644 mesalib/src/mesa/swrast/s_trispan.h create mode 100644 mesalib/src/mesa/swrast/s_tritemp.h create mode 100644 mesalib/src/mesa/swrast/s_zoom.c create mode 100644 mesalib/src/mesa/swrast/s_zoom.h create mode 100644 mesalib/src/mesa/swrast/swrast.h create mode 100644 mesalib/src/mesa/swrast_setup/descrip.mms create mode 100644 mesalib/src/mesa/swrast_setup/ss_context.c create mode 100644 mesalib/src/mesa/swrast_setup/ss_context.h create mode 100644 mesalib/src/mesa/swrast_setup/ss_triangle.c create mode 100644 mesalib/src/mesa/swrast_setup/ss_triangle.h create mode 100644 mesalib/src/mesa/swrast_setup/ss_tritmp.h create mode 100644 mesalib/src/mesa/swrast_setup/ss_vb.h create mode 100644 mesalib/src/mesa/swrast_setup/swrast_setup.h create mode 100644 mesalib/src/mesa/tnl/descrip.mms create mode 100644 mesalib/src/mesa/tnl/t_context.c create mode 100644 mesalib/src/mesa/tnl/t_context.h create mode 100644 mesalib/src/mesa/tnl/t_draw.c create mode 100644 mesalib/src/mesa/tnl/t_pipeline.c create mode 100644 mesalib/src/mesa/tnl/t_pipeline.h create mode 100644 mesalib/src/mesa/tnl/t_rasterpos.c create mode 100644 mesalib/src/mesa/tnl/t_vb_cliptmp.h create mode 100644 mesalib/src/mesa/tnl/t_vb_cull.c create mode 100644 mesalib/src/mesa/tnl/t_vb_fog.c create mode 100644 mesalib/src/mesa/tnl/t_vb_light.c create mode 100644 mesalib/src/mesa/tnl/t_vb_lighttmp.h create mode 100644 mesalib/src/mesa/tnl/t_vb_normals.c create mode 100644 mesalib/src/mesa/tnl/t_vb_points.c create mode 100644 mesalib/src/mesa/tnl/t_vb_program.c create mode 100644 mesalib/src/mesa/tnl/t_vb_render.c create mode 100644 mesalib/src/mesa/tnl/t_vb_rendertmp.h create mode 100644 mesalib/src/mesa/tnl/t_vb_texgen.c create mode 100644 mesalib/src/mesa/tnl/t_vb_texmat.c create mode 100644 mesalib/src/mesa/tnl/t_vb_vertex.c create mode 100644 mesalib/src/mesa/tnl/t_vertex.c create mode 100644 mesalib/src/mesa/tnl/t_vertex.h create mode 100644 mesalib/src/mesa/tnl/t_vertex_generic.c create mode 100644 mesalib/src/mesa/tnl/t_vertex_sse.c create mode 100644 mesalib/src/mesa/tnl/t_vp_build.c create mode 100644 mesalib/src/mesa/tnl/t_vp_build.h create mode 100644 mesalib/src/mesa/tnl/tnl.h create mode 100644 mesalib/src/mesa/vbo/descrip.mms create mode 100644 mesalib/src/mesa/vbo/vbo.h create mode 100644 mesalib/src/mesa/vbo/vbo_attrib.h create mode 100644 mesalib/src/mesa/vbo/vbo_attrib_tmp.h create mode 100644 mesalib/src/mesa/vbo/vbo_context.c create mode 100644 mesalib/src/mesa/vbo/vbo_context.h create mode 100644 mesalib/src/mesa/vbo/vbo_exec.c create mode 100644 mesalib/src/mesa/vbo/vbo_exec.h create mode 100644 mesalib/src/mesa/vbo/vbo_exec_api.c create mode 100644 mesalib/src/mesa/vbo/vbo_exec_array.c create mode 100644 mesalib/src/mesa/vbo/vbo_exec_draw.c create mode 100644 mesalib/src/mesa/vbo/vbo_exec_eval.c create mode 100644 mesalib/src/mesa/vbo/vbo_rebase.c create mode 100644 mesalib/src/mesa/vbo/vbo_save.c create mode 100644 mesalib/src/mesa/vbo/vbo_save.h create mode 100644 mesalib/src/mesa/vbo/vbo_save_api.c create mode 100644 mesalib/src/mesa/vbo/vbo_save_draw.c create mode 100644 mesalib/src/mesa/vbo/vbo_save_loopback.c create mode 100644 mesalib/src/mesa/vbo/vbo_split.c create mode 100644 mesalib/src/mesa/vbo/vbo_split.h create mode 100644 mesalib/src/mesa/vbo/vbo_split_copy.c create mode 100644 mesalib/src/mesa/vbo/vbo_split_inplace.c (limited to 'mesalib') diff --git a/mesalib/Makefile b/mesalib/Makefile new file mode 100644 index 000000000..d360ddfd8 --- /dev/null +++ b/mesalib/Makefile @@ -0,0 +1,574 @@ +# Top-level Mesa makefile + +TOP = . + +SUBDIRS = src progs + + +default: $(TOP)/configs/current + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done + +all: default + + +doxygen: + cd doxygen && $(MAKE) + +clean: + -@touch $(TOP)/configs/current + -@for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) ; \ + fi \ + done + -@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current + + +realclean: clean + -rm -rf lib* + -rm -f $(TOP)/configs/current + -rm -f $(TOP)/configs/autoconf + -rm -rf autom4te.cache + -find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \ + -name depend -o -name depend.bak ')' -exec rm -f '{}' ';' + + +distclean: realclean + + +install: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) install) || exit 1 ; \ + fi \ + done + + +.PHONY: default doxygen clean realclean distclean install linux-directfb-install + +# If there's no current configuration file +$(TOP)/configs/current: + @echo + @echo + @echo "Please choose a configuration from the following list:" + @ls -1 $(TOP)/configs | grep -v "current\|default\|CVS\|autoconf.*" + @echo + @echo "Then type 'make ' (ex: 'make linux-x86')" + @echo + @echo "Or, run './configure' then 'make'" + @echo "See './configure --help' for details" + @echo + @echo "(ignore the following error message)" + @exit 1 + + +# Rules to set/install a specific build configuration +aix \ +aix-64 \ +aix-64-static \ +aix-gcc \ +aix-static \ +autoconf \ +bluegene-osmesa \ +bluegene-xlc-osmesa \ +beos \ +catamount-osmesa-pgi \ +darwin \ +darwin-fat-32bit \ +darwin-fat-all \ +darwin-static \ +darwin-static-x86ppc \ +freebsd \ +freebsd-dri \ +freebsd-dri-amd64 \ +freebsd-dri-x86 \ +hpux10 \ +hpux10-gcc \ +hpux10-static \ +hpux11-32 \ +hpux11-32-static \ +hpux11-32-static-nothreads \ +hpux11-64 \ +hpux11-64-static \ +hpux11-ia64 \ +hpux11-ia64-static \ +hpux9 \ +hpux9-gcc \ +irix6-64 \ +irix6-64-static \ +irix6-n32 \ +irix6-n32-static \ +irix6-o32 \ +irix6-o32-static \ +linux \ +linux-alpha \ +linux-alpha-static \ +linux-cell \ +linux-cell-debug \ +linux-debug \ +linux-directfb \ +linux-dri \ +linux-dri-debug \ +linux-dri-x86 \ +linux-dri-x86-64 \ +linux-dri-ppc \ +linux-dri-xcb \ +linux-egl \ +linux-indirect \ +linux-fbdev \ +linux-glide \ +linux-ia64-icc \ +linux-ia64-icc-static \ +linux-icc \ +linux-icc-static \ +linux-llvm \ +linux-osmesa \ +linux-osmesa-static \ +linux-osmesa16 \ +linux-osmesa16-static \ +linux-osmesa32 \ +linux-ppc \ +linux-ppc-static \ +linux-profile \ +linux-solo \ +linux-solo-x86 \ +linux-solo-ia64 \ +linux-sparc \ +linux-sparc5 \ +linux-static \ +linux-ultrasparc \ +linux-tcc \ +linux-x86 \ +linux-x86-debug \ +linux-x86-32 \ +linux-x86-64 \ +linux-x86-64-debug \ +linux-x86-64-profile \ +linux-x86-64-static \ +linux-x86-glide \ +linux-x86-profile \ +linux-x86-static \ +netbsd \ +openbsd \ +osf1 \ +osf1-static \ +solaris-x86 \ +solaris-x86-gcc \ +solaris-x86-gcc-static \ +sunos4 \ +sunos4-gcc \ +sunos4-static \ +sunos5 \ +sunos5-gcc \ +sunos5-64-gcc \ +sunos5-smp \ +sunos5-v8 \ +sunos5-v8-static \ +sunos5-v9 \ +sunos5-v9-static \ +sunos5-v9-cc-g++ \ +ultrix-gcc: + @ if test -f configs/current || test -L configs/current ; then \ + echo "Please run 'make realclean' before changing configs" ; \ + exit 1 ; \ + fi + (cd configs && rm -f current && ln -s $@ current) + $(MAKE) default + + +# Rules for making release tarballs + +VERSION=7.6 +DIRECTORY = Mesa-$(VERSION) +LIB_NAME = MesaLib-$(VERSION) +DEMO_NAME = MesaDemos-$(VERSION) +GLUT_NAME = MesaGLUT-$(VERSION) + +MAIN_FILES = \ + $(DIRECTORY)/Makefile* \ + $(DIRECTORY)/configure \ + $(DIRECTORY)/configure.ac \ + $(DIRECTORY)/acinclude.m4 \ + $(DIRECTORY)/aclocal.m4 \ + $(DIRECTORY)/bin/config.guess \ + $(DIRECTORY)/bin/config.sub \ + $(DIRECTORY)/bin/install-sh \ + $(DIRECTORY)/bin/mklib \ + $(DIRECTORY)/bin/minstall \ + $(DIRECTORY)/bin/version.mk \ + $(DIRECTORY)/configs/[a-z]* \ + $(DIRECTORY)/docs/*.html \ + $(DIRECTORY)/docs/COPYING \ + $(DIRECTORY)/docs/README.* \ + $(DIRECTORY)/docs/RELNOTES* \ + $(DIRECTORY)/docs/*.spec \ + $(DIRECTORY)/include/GL/internal/glcore.h \ + $(DIRECTORY)/include/GL/dmesa.h \ + $(DIRECTORY)/include/GL/ggimesa.h \ + $(DIRECTORY)/include/GL/gl.h \ + $(DIRECTORY)/include/GL/glext.h \ + $(DIRECTORY)/include/GL/gl_mangle.h \ + $(DIRECTORY)/include/GL/glu.h \ + $(DIRECTORY)/include/GL/glu_mangle.h \ + $(DIRECTORY)/include/GL/glx.h \ + $(DIRECTORY)/include/GL/glxext.h \ + $(DIRECTORY)/include/GL/glx_mangle.h \ + $(DIRECTORY)/include/GL/glfbdev.h \ + $(DIRECTORY)/include/GL/mesa_wgl.h \ + $(DIRECTORY)/include/GL/mglmesa.h \ + $(DIRECTORY)/include/GL/osmesa.h \ + $(DIRECTORY)/include/GL/svgamesa.h \ + $(DIRECTORY)/include/GL/vms_x_fix.h \ + $(DIRECTORY)/include/GL/wglext.h \ + $(DIRECTORY)/include/GL/wmesa.h \ + $(DIRECTORY)/src/Makefile \ + $(DIRECTORY)/src/mesa/Makefile* \ + $(DIRECTORY)/src/mesa/sources.mak \ + $(DIRECTORY)/src/mesa/descrip.mms \ + $(DIRECTORY)/src/mesa/gl.pc.in \ + $(DIRECTORY)/src/mesa/osmesa.pc.in \ + $(DIRECTORY)/src/mesa/depend \ + $(DIRECTORY)/src/mesa/main/*.[chS] \ + $(DIRECTORY)/src/mesa/main/descrip.mms \ + $(DIRECTORY)/src/mesa/glapi/*.[chS] \ + $(DIRECTORY)/src/mesa/math/*.[ch] \ + $(DIRECTORY)/src/mesa/math/descrip.mms \ + $(DIRECTORY)/src/mesa/shader/*.[chly] \ + $(DIRECTORY)/src/mesa/shader/Makefile \ + $(DIRECTORY)/src/mesa/shader/descrip.mms \ + $(DIRECTORY)/src/mesa/shader/grammar/*.[ch] \ + $(DIRECTORY)/src/mesa/shader/slang/*.[ch] \ + $(DIRECTORY)/src/mesa/shader/slang/descrip.mms \ + $(DIRECTORY)/src/mesa/shader/slang/library/*.[ch] \ + $(DIRECTORY)/src/mesa/shader/slang/library/*.gc \ + $(DIRECTORY)/src/mesa/shader/slang/library/*.syn \ + $(DIRECTORY)/src/mesa/shader/slang/library/Makefile \ + $(DIRECTORY)/src/mesa/swrast/*.[ch] \ + $(DIRECTORY)/src/mesa/swrast/descrip.mms \ + $(DIRECTORY)/src/mesa/swrast_setup/*.[ch] \ + $(DIRECTORY)/src/mesa/swrast_setup/descrip.mms \ + $(DIRECTORY)/src/mesa/vbo/*.[chS] \ + $(DIRECTORY)/src/mesa/vbo/descrip.mms \ + $(DIRECTORY)/src/mesa/tnl/*.[chS] \ + $(DIRECTORY)/src/mesa/tnl/descrip.mms \ + $(DIRECTORY)/src/mesa/tnl_dd/*.[ch] \ + $(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch] \ + $(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm \ + $(DIRECTORY)/src/mesa/drivers/Makefile \ + $(DIRECTORY)/src/mesa/drivers/beos/*.cpp \ + $(DIRECTORY)/src/mesa/drivers/beos/Makefile \ + $(DIRECTORY)/src/mesa/drivers/common/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/common/descrip.mms \ + $(DIRECTORY)/src/mesa/drivers/directfb/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/directfb/Makefile \ + $(DIRECTORY)/src/mesa/drivers/dos/*.[chS] \ + $(DIRECTORY)/src/mesa/drivers/fbdev/Makefile \ + $(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \ + $(DIRECTORY)/src/mesa/drivers/glide/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/ggi/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/ggi/ggimesa.conf.in \ + $(DIRECTORY)/src/mesa/drivers/ggi/default/*.c \ + $(DIRECTORY)/src/mesa/drivers/ggi/default/genkgi.conf.in \ + $(DIRECTORY)/src/mesa/drivers/ggi/display/*.c \ + $(DIRECTORY)/src/mesa/drivers/ggi/display/fbdev.conf.in \ + $(DIRECTORY)/src/mesa/drivers/ggi/include/ggi/mesa/*.h \ + $(DIRECTORY)/src/mesa/drivers/osmesa/Makefile \ + $(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win \ + $(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms \ + $(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def \ + $(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/svga/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/windows/*/*.def \ + $(DIRECTORY)/src/mesa/drivers/x11/Makefile \ + $(DIRECTORY)/src/mesa/drivers/x11/descrip.mms \ + $(DIRECTORY)/src/mesa/drivers/x11/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/glslcompiler/Makefile \ + $(DIRECTORY)/src/mesa/drivers/glslcompiler/glslcompiler.c \ + $(DIRECTORY)/src/mesa/ppc/*.[ch] \ + $(DIRECTORY)/src/mesa/sparc/*.[chS] \ + $(DIRECTORY)/src/mesa/x86/Makefile \ + $(DIRECTORY)/src/mesa/x86/*.[ch] \ + $(DIRECTORY)/src/mesa/x86/*.S \ + $(DIRECTORY)/src/mesa/x86/rtasm/*.[ch] \ + $(DIRECTORY)/src/mesa/x86-64/*.[chS] \ + $(DIRECTORY)/src/mesa/x86-64/Makefile \ + $(DIRECTORY)/progs/Makefile \ + $(DIRECTORY)/progs/util/README \ + $(DIRECTORY)/progs/util/*.[ch] \ + $(DIRECTORY)/progs/util/sampleMakefile \ + $(DIRECTORY)/windows/VC8/ + +EGL_FILES = \ + $(DIRECTORY)/include/EGL/*.h \ + $(DIRECTORY)/include/GLES/*.h \ + $(DIRECTORY)/include/GLES2/*.h \ + $(DIRECTORY)/src/egl/Makefile \ + $(DIRECTORY)/src/egl/*/Makefile \ + $(DIRECTORY)/src/egl/*/*.[ch] \ + $(DIRECTORY)/src/egl/*/*/Makefile \ + $(DIRECTORY)/src/egl/*/*/*.[ch] \ + +GALLIUM_FILES = \ + $(DIRECTORY)/src/mesa/state_tracker/*[ch] \ + $(DIRECTORY)/src/gallium/Makefile \ + $(DIRECTORY)/src/gallium/Makefile.template \ + $(DIRECTORY)/src/gallium/SConscript \ + $(DIRECTORY)/src/gallium/*/Makefile \ + $(DIRECTORY)/src/gallium/*/SConscript \ + $(DIRECTORY)/src/gallium/*/*/Makefile \ + $(DIRECTORY)/src/gallium/*/*/Makefile.template \ + $(DIRECTORY)/src/gallium/*/*/SConscript \ + $(DIRECTORY)/src/gallium/*/*/*.[ch] \ + $(DIRECTORY)/src/gallium/*/*/*.py \ + $(DIRECTORY)/src/gallium/*/*/*.csv \ + $(DIRECTORY)/src/gallium/*/*/*/Makefile \ + $(DIRECTORY)/src/gallium/*/*/*/SConscript \ + $(DIRECTORY)/src/gallium/*/*/*/*.[ch] \ + $(DIRECTORY)/src/gallium/*/*/*/*.py \ + $(DIRECTORY)/src/gallium/*/*/*/*/Makefile \ + $(DIRECTORY)/src/gallium/*/*/*/*/*.[ch] \ + + +DRI_FILES = \ + $(DIRECTORY)/include/GL/internal/dri_interface.h \ + $(DIRECTORY)/include/GL/internal/glcore.h \ + $(DIRECTORY)/include/GL/internal/sarea.h \ + $(DIRECTORY)/src/glx/Makefile \ + $(DIRECTORY)/src/glx/x11/Makefile \ + $(DIRECTORY)/src/glx/x11/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/dri/Makefile \ + $(DIRECTORY)/src/mesa/drivers/dri/Makefile.template \ + $(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in \ + $(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.[ch] \ + $(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \ + $(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \ + $(DIRECTORY)/src/mesa/drivers/dri/*/*/*.[chS] \ + $(DIRECTORY)/src/mesa/drivers/dri/*/Makefile \ + $(DIRECTORY)/src/mesa/drivers/dri/*/*/Makefile \ + $(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile \ + $(DIRECTORY)/src/mesa/drivers/dri/*/server/*.[ch] + +SGI_GLU_FILES = \ + $(DIRECTORY)/src/glu/Makefile \ + $(DIRECTORY)/src/glu/glu.pc.in \ + $(DIRECTORY)/src/glu/sgi/Makefile \ + $(DIRECTORY)/src/glu/sgi/Makefile.mgw \ + $(DIRECTORY)/src/glu/sgi/Makefile.win \ + $(DIRECTORY)/src/glu/sgi/glu.def \ + $(DIRECTORY)/src/glu/sgi/dummy.cc \ + $(DIRECTORY)/src/glu/sgi/glu.exports \ + $(DIRECTORY)/src/glu/sgi/glu.exports.darwin \ + $(DIRECTORY)/src/glu/sgi/mesaglu.opt \ + $(DIRECTORY)/src/glu/sgi/include/gluos.h \ + $(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.h \ + $(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.cc \ + $(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.h \ + $(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.cc \ + $(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.h \ + $(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.cc \ + $(DIRECTORY)/src/glu/sgi/libtess/README \ + $(DIRECTORY)/src/glu/sgi/libtess/alg-outline \ + $(DIRECTORY)/src/glu/sgi/libtess/*.[ch] \ + $(DIRECTORY)/src/glu/sgi/libutil/*.[ch] + +MESA_GLU_FILES = \ + $(DIRECTORY)/src/glu/mesa/README[12] \ + $(DIRECTORY)/src/glu/mesa/Makefile* \ + $(DIRECTORY)/src/glu/mesa/descrip.mms \ + $(DIRECTORY)/src/glu/mesa/mms_depend \ + $(DIRECTORY)/src/glu/mesa/*.def \ + $(DIRECTORY)/src/glu/mesa/depend \ + $(DIRECTORY)/src/glu/mesa/*.[ch] + +GLW_FILES = \ + $(DIRECTORY)/src/glw/*.[ch] \ + $(DIRECTORY)/src/glw/Makefile* \ + $(DIRECTORY)/src/glw/README \ + $(DIRECTORY)/src/glw/glw.pc.in \ + $(DIRECTORY)/src/glw/depend + +GLEW_FILES = \ + $(DIRECTORY)/include/GL/glew.h \ + $(DIRECTORY)/include/GL/glxew.h \ + $(DIRECTORY)/include/GL/wglew.h \ + $(DIRECTORY)/src/glew/*.c \ + $(DIRECTORY)/src/glew/Makefile \ + $(DIRECTORY)/src/glew/SConscript \ + $(DIRECTORY)/src/glew/LICENSE.txt + +DEMO_FILES = \ + $(GLEW_FILES) \ + $(DIRECTORY)/progs/beos/*.cpp \ + $(DIRECTORY)/progs/beos/Makefile \ + $(DIRECTORY)/progs/images/*.rgb \ + $(DIRECTORY)/progs/images/*.rgba \ + $(DIRECTORY)/progs/demos/Makefile* \ + $(DIRECTORY)/progs/demos/descrip.mms \ + $(DIRECTORY)/progs/demos/*.[ch] \ + $(DIRECTORY)/progs/demos/*.cxx \ + $(DIRECTORY)/progs/demos/*.dat \ + $(DIRECTORY)/progs/demos/README \ + $(DIRECTORY)/progs/fbdev/Makefile \ + $(DIRECTORY)/progs/fbdev/glfbdevtest.c \ + $(DIRECTORY)/progs/osdemos/Makefile \ + $(DIRECTORY)/progs/osdemos/*.c \ + $(DIRECTORY)/progs/xdemos/Makefile* \ + $(DIRECTORY)/progs/xdemos/*.[chf] \ + $(DIRECTORY)/progs/redbook/Makefile* \ + $(DIRECTORY)/progs/redbook/README \ + $(DIRECTORY)/progs/redbook/*.[ch] \ + $(DIRECTORY)/progs/samples/Makefile* \ + $(DIRECTORY)/progs/samples/README \ + $(DIRECTORY)/progs/samples/*.c \ + $(DIRECTORY)/progs/glsl/Makefile* \ + $(DIRECTORY)/progs/glsl/*.c \ + $(DIRECTORY)/progs/glsl/*.frag \ + $(DIRECTORY)/progs/glsl/*.vert \ + $(DIRECTORY)/progs/glsl/*.shtest \ + $(DIRECTORY)/progs/windml/Makefile.ugl \ + $(DIRECTORY)/progs/windml/*.c \ + $(DIRECTORY)/progs/windml/*.bmp \ + $(DIRECTORY)/progs/ggi/*.c \ + $(DIRECTORY)/windows/VC7/progs/progs.sln + +GLUT_FILES = \ + $(DIRECTORY)/include/GL/glut.h \ + $(DIRECTORY)/include/GL/glutf90.h \ + $(DIRECTORY)/src/glut/glx/Makefile* \ + $(DIRECTORY)/src/glut/glx/depend \ + $(DIRECTORY)/src/glut/glx/glut.pc.in \ + $(DIRECTORY)/src/glut/glx/*def \ + $(DIRECTORY)/src/glut/glx/*.[ch] \ + $(DIRECTORY)/src/glut/beos/*.[ch] \ + $(DIRECTORY)/src/glut/beos/*.cpp \ + $(DIRECTORY)/src/glut/beos/Makefile \ + $(DIRECTORY)/src/glut/dos/*.[ch] \ + $(DIRECTORY)/src/glut/dos/PC_HW/*.[chS] \ + $(DIRECTORY)/src/glut/ggi/*.[ch] \ + $(DIRECTORY)/src/glut/ggi/Makefile \ + $(DIRECTORY)/src/glut/fbdev/Makefile \ + $(DIRECTORY)/src/glut/fbdev/*[ch] \ + $(DIRECTORY)/src/glut/mini/*[ch] \ + $(DIRECTORY)/src/glut/mini/glut.pc.in \ + $(DIRECTORY)/src/glut/directfb/Makefile \ + $(DIRECTORY)/src/glut/directfb/NOTES \ + $(DIRECTORY)/src/glut/directfb/*[ch] \ + $(DIRECTORY)/windows/VC6/progs/glut/glut.dsp \ + $(DIRECTORY)/windows/VC7/progs/glut/glut.vcproj + +DEPEND_FILES = \ + $(TOP)/src/mesa/depend \ + $(TOP)/src/glx/x11/depend \ + $(TOP)/src/glw/depend \ + $(TOP)/src/glut/glx/depend \ + $(TOP)/src/glu/sgi/depend + + +LIB_FILES = \ + $(MAIN_FILES) \ + $(EGL_FILES) \ + $(GALLIUM_FILES) \ + $(DRI_FILES) \ + $(SGI_GLU_FILES) \ + $(GLW_FILES) + + +# Everything for new a Mesa release: +tarballs: rm_depend configure aclocal.m4 lib_gz demo_gz glut_gz \ + lib_bz2 demo_bz2 glut_bz2 lib_zip demo_zip glut_zip md5 + + +# Helper for autoconf builds +ACLOCAL = aclocal +ACLOCAL_FLAGS = +AUTOCONF = autoconf +AC_FLAGS = +aclocal.m4: configure.ac acinclude.m4 + $(ACLOCAL) $(ACLOCAL_FLAGS) +configure: configure.ac aclocal.m4 acinclude.m4 + $(AUTOCONF) $(AC_FLAGS) + +rm_depend: + @for dep in $(DEPEND_FILES) ; do \ + rm -f $$dep ; \ + touch $$dep ; \ + done + +lib_gz: + rm -f configs/current ; \ + rm -f configs/autoconf ; \ + cd .. ; \ + tar -cf $(LIB_NAME).tar $(LIB_FILES) ; \ + gzip $(LIB_NAME).tar ; \ + mv $(LIB_NAME).tar.gz $(DIRECTORY) + +demo_gz: + cd .. ; \ + tar -cf $(DEMO_NAME).tar $(DEMO_FILES) ; \ + gzip $(DEMO_NAME).tar ; \ + mv $(DEMO_NAME).tar.gz $(DIRECTORY) + +glut_gz: + cd .. ; \ + tar -cf $(GLUT_NAME).tar $(GLUT_FILES) ; \ + gzip $(GLUT_NAME).tar ; \ + mv $(GLUT_NAME).tar.gz $(DIRECTORY) + +lib_bz2: + rm -f configs/current ; \ + rm -f configs/autoconf ; \ + cd .. ; \ + tar -cf $(LIB_NAME).tar $(LIB_FILES) ; \ + bzip2 $(LIB_NAME).tar ; \ + mv $(LIB_NAME).tar.bz2 $(DIRECTORY) + +demo_bz2: + cd .. ; \ + tar -cf $(DEMO_NAME).tar $(DEMO_FILES) ; \ + bzip2 $(DEMO_NAME).tar ; \ + mv $(DEMO_NAME).tar.bz2 $(DIRECTORY) + +glut_bz2: + cd .. ; \ + tar -cf $(GLUT_NAME).tar $(GLUT_FILES) ; \ + bzip2 $(GLUT_NAME).tar ; \ + mv $(GLUT_NAME).tar.bz2 $(DIRECTORY) + +lib_zip: + rm -f configs/current ; \ + rm -f configs/autoconf ; \ + rm -f $(LIB_NAME).zip ; \ + cd .. ; \ + zip -qr $(LIB_NAME).zip $(LIB_FILES) ; \ + mv $(LIB_NAME).zip $(DIRECTORY) + +demo_zip: + rm -f $(DEMO_NAME).zip ; \ + cd .. ; \ + zip -qr $(DEMO_NAME).zip $(DEMO_FILES) ; \ + mv $(DEMO_NAME).zip $(DIRECTORY) + +glut_zip: + rm -f $(GLUT_NAME).zip ; \ + cd .. ; \ + zip -qr $(GLUT_NAME).zip $(GLUT_FILES) ; \ + mv $(GLUT_NAME).zip $(DIRECTORY) + +md5: + @-md5sum $(LIB_NAME).tar.gz + @-md5sum $(LIB_NAME).tar.bz2 + @-md5sum $(LIB_NAME).zip + @-md5sum $(DEMO_NAME).tar.gz + @-md5sum $(DEMO_NAME).tar.bz2 + @-md5sum $(DEMO_NAME).zip + @-md5sum $(GLUT_NAME).tar.gz + @-md5sum $(GLUT_NAME).tar.bz2 + @-md5sum $(GLUT_NAME).zip + +.PHONY: tarballs rm_depend lib_gz demo_gz glut_gz lib_bz2 demo_bz2 \ + glut_bz2 lib_zip demo_zip glut_zip md5 diff --git a/mesalib/acinclude.m4 b/mesalib/acinclude.m4 new file mode 100644 index 000000000..a5b389d5d --- /dev/null +++ b/mesalib/acinclude.m4 @@ -0,0 +1,119 @@ +# A few convenience macros for Mesa, mostly to keep all the platform +# specifics out of configure.ac. + +# MESA_PIC_FLAGS() +# +# Find out whether to build PIC code using the option --enable-pic and +# the configure enable_static/enable_shared settings. If PIC is needed, +# figure out the necessary flags for the platform and compiler. +# +# The platform checks have been shamelessly taken from libtool and +# stripped down to just what's needed for Mesa. See _LT_COMPILER_PIC in +# /usr/share/aclocal/libtool.m4 or +# http://git.savannah.gnu.org/gitweb/?p=libtool.git;a=blob;f=libltdl/m4/libtool.m4;hb=HEAD +# +AC_DEFUN([MESA_PIC_FLAGS], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_ARG_VAR([PIC_FLAGS], [compiler flags for PIC code]) +AC_ARG_ENABLE([pic], + [AS_HELP_STRING([--disable-pic], + [compile PIC objects @<:@default=enabled for shared builds + on supported platforms@:>@])], + [enable_pic="$enableval" + test "x$enable_pic" = x && enable_pic=auto], + [enable_pic=auto]) +# disable PIC by default for static builds +if test "$enable_pic" = auto && test "$enable_static" = yes; then + enable_pic=no +fi +# if PIC hasn't been explicitly disabled, try to figure out the flags +if test "$enable_pic" != no; then + AC_MSG_CHECKING([for $CC option to produce PIC]) + # allow the user's flags to override + if test "x$PIC_FLAGS" = x; then + # see if we're using GCC + if test "x$GCC" = xyes; then + case "$host_os" in + aix*|beos*|cygwin*|irix5*|irix6*|osf3*|osf4*|osf5*) + # PIC is the default for these OSes. + ;; + mingw*|os2*|pw32*) + # This hack is so that the source file can tell whether + # it is being built for inclusion in a dll (and should + # export symbols for example). + PIC_FLAGS="-DDLL_EXPORT" + ;; + darwin*|rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + PIC_FLAGS="-fno-common" + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, + # but not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + PIC_FLAGS="-fPIC" + ;; + esac + ;; + *) + # Everyone else on GCC uses -fPIC + PIC_FLAGS="-fPIC" + ;; + esac + else # !GCC + case "$host_os" in + hpux9*|hpux10*|hpux11*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, + # but not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + PIC_FLAGS="+Z" + ;; + esac + ;; + linux*|k*bsd*-gnu) + case `basename "$CC"` in + icc*|ecc*|ifort*) + PIC_FLAGS="-KPIC" + ;; + pgcc*|pgf77*|pgf90*|pgf95*) + # Portland Group compilers (*not* the Pentium gcc + # compiler, which looks to be a dead project) + PIC_FLAGS="-fpic" + ;; + ccc*) + # All Alpha code is PIC. + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + PIC_FLAGS="-qpic" + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*|*Sun\ F*) + # Sun C 5.9 or Sun Fortran + PIC_FLAGS="-KPIC" + ;; + esac + esac + ;; + solaris*) + PIC_FLAGS="-KPIC" + ;; + sunos4*) + PIC_FLAGS="-PIC" + ;; + esac + fi # GCC + fi # PIC_FLAGS + AC_MSG_RESULT([$PIC_FLAGS]) +fi +AC_SUBST([PIC_FLAGS]) +])# MESA_PIC_FLAGS diff --git a/mesalib/aclocal.m4 b/mesalib/aclocal.m4 new file mode 100644 index 000000000..e46192caf --- /dev/null +++ b/mesalib/aclocal.m4 @@ -0,0 +1,172 @@ +# generated automatically by aclocal 1.11 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + +m4_include([acinclude.m4]) diff --git a/mesalib/bin/config.guess b/mesalib/bin/config.guess new file mode 100644 index 000000000..e5716eea7 --- /dev/null +++ b/mesalib/bin/config.guess @@ -0,0 +1,1555 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2009-02-03' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd | genuineintel) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/mesalib/bin/config.sub b/mesalib/bin/config.sub new file mode 100644 index 000000000..d546a94b9 --- /dev/null +++ b/mesalib/bin/config.sub @@ -0,0 +1,1685 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2009-02-03' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/mesalib/bin/install-sh b/mesalib/bin/install-sh new file mode 100644 index 000000000..e69de29bb diff --git a/mesalib/bin/minstall b/mesalib/bin/minstall new file mode 100644 index 000000000..130025829 --- /dev/null +++ b/mesalib/bin/minstall @@ -0,0 +1,93 @@ +#!/bin/sh + + +# A minimal replacement for 'install' that supports installing symbolic links. +# Only a limited number of options are supported: +# -d dir Create a directory +# -m mode Sets a file's mode when installing + + +# If these commands aren't portable, we'll need some "if (arch)" type stuff +SYMLINK="ln -s" +MKDIR="mkdir -p" +RM="rm -f" + +MODE="" + +if [ "$1" = "-d" ] ; then + # make a directory path + $MKDIR "$2" + exit 0 +fi + +if [ "$1" = "-m" ] ; then + # set file mode + MODE=$2 + shift 2 +fi + +# install file(s) into destination +if [ $# -ge 2 ] ; then + + # Last cmd line arg is the dest dir + for FILE in $@ ; do + DEST="$FILE" + done + + # Loop over args, moving them to DEST directory + I=1 + for FILE in $@ ; do + if [ $I = $# ] ; then + # stop, don't want to install $DEST into $DEST + exit 0 + fi + + PWDSAVE=`pwd` + + # determine file's type + if [ -h "$FILE" ] ; then + #echo $FILE is a symlink + # Unfortunately, cp -d isn't universal so we have to + # use a work-around. + + # Use ls -l to find the target that the link points to + LL=`ls -l "$FILE"` + for L in $LL ; do + TARGET=$L + done + #echo $FILE is a symlink pointing to $TARGET + + FILE=`basename "$FILE"` + # Go to $DEST and make the link + cd "$DEST" # pushd + $RM "$FILE" + $SYMLINK "$TARGET" "$FILE" + cd "$PWDSAVE" # popd + + elif [ -f "$FILE" ] ; then + #echo "$FILE" is a regular file + # Only copy if the files differ + if ! cmp -s $FILE $DEST/`basename $FILE`; then + $RM "$DEST/`basename $FILE`" + cp "$FILE" "$DEST" + fi + if [ $MODE ] ; then + FILE=`basename "$FILE"` + chmod $MODE "$DEST/$FILE" + fi + else + echo "Unknown type of argument: " "$FILE" + exit 1 + fi + + I=`expr $I + 1` + done + + exit 0 +fi + +# If we get here, we didn't find anything to do +echo "Usage:" +echo " install -d dir Create named directory" +echo " install [-m mode] file [...] dest Install files in destination" + diff --git a/mesalib/bin/mklib b/mesalib/bin/mklib new file mode 100644 index 000000000..db97087c0 --- /dev/null +++ b/mesalib/bin/mklib @@ -0,0 +1,976 @@ +#!/bin/sh + +# Make a shared library. +# This script should be useful for projects other than Mesa. +# Improvements/fixes are welcome. + + +# Copyright (C) 1999-2006 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. + + +# +# Option defaults +# +LIBNAME="" +MAJOR=1 +MINOR=0 +PATCH="" +DEPS="" +LINK="" +LDFLAGS="" +CPLUSPLUS=0 +STATIC=0 +DLOPEN=0 +INSTALLDIR="." +ARCH="auto" +ARCHOPT="" +NOPREFIX=0 +EXPORTS="" +ID="" + +# +# Parse arguments +# +while true +do + case $1 in + '-h' | '--help') + echo 'Usage: mklib [options] objects' + echo 'Create a shared library from object files.' + echo ' -o LIBRARY specifies the name of the resulting library, without' + echo ' the leading "lib" or any suffix.' + echo ' (eg: "-o GL" might result in "libGL.so" being made)' + echo ' -major N specifies major version number (default is 1)' + echo ' -minor N specifies minor version number (default is 0)' + echo ' -patch N specifies patch version number (default is 0)' + echo ' -lLIBRARY specifies a dependency on LIBRARY' + echo ' -LDIR search in DIR for library dependencies at build time' + echo ' -RDIR search in DIR for library dependencies at run time' + echo ' -linker L explicity specify the linker program to use (eg: gcc, g++)' + echo ' Not observed on all systems at this time.' + echo ' -ldflags OPT specify any additional linker flags in OPT' + echo ' -cplusplus link with C++ runtime' + echo ' -static make a static library (default is dynamic/shared)' + echo ' -dlopen make a shared library suitable for dynamic loading' + echo ' -install DIR put resulting library file(s) in DIR' + echo ' -arch ARCH override using `uname` to determine host system' + echo ' -archopt OPT specify an extra achitecture-specific option OPT' + echo ' -altopts OPTS alternate options to override all others' + echo " -noprefix don't prefix library name with 'lib' nor add any suffix" + echo ' -exports FILE only export the symbols listed in FILE' + echo ' -id NAME Sets the id of the dylib (Darwin)' + echo ' -h, --help display this information and exit' + exit 1 + ;; + '-o') + shift 1; + LIBNAME=$1 + ;; + '-major') + shift 1; + MAJOR=$1 + ;; + '-minor') + shift 1; + MINOR=$1 + ;; + '-patch') + shift 1; + PATCH=$1 + ;; + '-linker') + shift 1; + LINK=$1 + ;; + '-ldflags') + shift 1; + LDFLAGS=$1 + ;; + -l*) + DEPS="$DEPS $1" + ;; + -L*) + DEPS="$DEPS $1" + ;; + -R*) + DEPS="$DEPS $1" + ;; + -Wl*) + DEPS="$DEPS $1" + ;; + -pthread) + # this is a special case (see bugzilla 10876) + DEPS="$DEPS $1" + ;; + '-pthread') + DEPS="$DEPS -pthread" + ;; + '-cplusplus') + CPLUSPLUS=1 + ;; + '-static') + STATIC=1 + ;; + '-dlopen') + DLOPEN=1 + ;; + '-install') + shift 1; + INSTALLDIR=$1 + ;; + '-arch') + shift 1; + ARCH=$1 + ;; + '-archopt') + shift 1; + ARCHOPT=$1 + ;; + '-altopts') + shift 1; + ALTOPTS=$1 + ;; + '-noprefix') + NOPREFIX=1 + ;; + '-exports') + shift 1; + EXPORTS=$1 + ;; + '-id') + shift 1; + ID=$1 + ;; + -*) + echo "mklib: Unknown option: " $1 ; + exit 1 + ;; + *) + # This should be the first object file, stop parsing + break + esac + shift 1 +done +OBJECTS=$@ + + +if [ ${ARCH} = "auto" ] ; then + ARCH=`uname` +fi + + +if [ $STATIC = 1 ]; then + # filter out linker options inside object list + NEWOBJECTS="" + for OBJ in $OBJECTS ; do + case $OBJ in + -Wl,*) + echo "mklib: warning: ignoring $OBJ for static library" + ;; + *) + NEWOBJECTS="$NEWOBJECTS $OBJ" + ;; + esac + done + OBJECTS=$NEWOBJECTS +fi + + +# +# Error checking +# +if [ "x${LIBNAME}" = "x" ] ; then + echo "mklib: Error: no library name specified" + exit 1 +fi +if [ "x${OBJECTS}" = "x" ] ; then + echo "mklib: Error: no object files specified" + exit 1 +fi + + +# +# Debugging info +# +if [ ] ; then + echo "-----------------" + echo ARCH is $ARCH + echo LIBNAME is $LIBNAME + echo MAJOR is $MAJOR + echo MINOR is $MINOR + echo PATCH is $PATCH + echo DEPS are $DEPS + echo "EXPORTS in" $EXPORTS + echo ID is $ID + echo "-----------------" +fi + + +# +# OK, make the library now +# +case $ARCH in + + 'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/*) + # we assume gcc + + if [ "x$LINK" = "x" ] ; then + # -linker was not specified so set default link command now + if [ $CPLUSPLUS = 1 ] ; then + LINK=g++ + else + LINK=gcc + fi + fi + + if [ $NOPREFIX = 1 ] ; then + # No "lib" or ".so" part + echo "mklib: Making" $ARCH "shared library: " ${LIBNAME} + case $ARCH in 'Linux' | 'GNU' | GNU/*) + OPTS="-Xlinker -Bsymbolic -shared" + ;; + *) + OPTS="-shared" + ;; + esac + + # Check if objects are 32-bit and we're running in 64-bit + # environment. If so, pass -m32 flag to linker. + set ${OBJECTS} + ABI32=`file $1 | grep 32-bit` + if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then + OPTS="-m32 ${OPTS}" + fi + + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + + rm -f ${LIBNAME} + # make lib + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + # finish up + FINAL_LIBS="${LIBNAME}" + elif [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" # prefix with "lib", suffix with ".a" + echo "mklib: Making" $ARCH "static library: " ${LIBNAME} + LINK="ar" + OPTS="-ru" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + rm -f ${LIBNAME} + + # expand any .a objects into constituent .o files. + NEWOBJECTS="" + DELETIA="" + for OBJ in $OBJECTS ; do + case $OBJ in + *.a) + # extract the .o files from this .a archive + FILES=`ar t $OBJ` + ar x $OBJ + NEWOBJECTS="$NEWOBJECTS $FILES" + # keep track of temporary .o files and delete them below + DELETIA="$DELETIA $FILES" + ;; + *) + # ordinary .o file + NEWOBJECTS="$NEWOBJECTS $OBJ" + ;; + esac + done + + # make lib + ${LINK} ${OPTS} ${LIBNAME} ${NEWOBJECTS} + ranlib ${LIBNAME} + + # remove temporary extracted .o files + rm -f ${DELETIA} + + # finish up + FINAL_LIBS=${LIBNAME} + else + LIBNAME="lib${LIBNAME}" # prefix with "lib" + case $ARCH in 'Linux' | 'GNU' | GNU/*) + OPTS="-Xlinker -Bsymbolic -shared -Wl,-soname,${LIBNAME}.so.${MAJOR}" + ;; + *) + OPTS="-shared -Wl,-soname,${LIBNAME}.so.${MAJOR}" + ;; + esac + if [ $EXPORTS ] ; then + #OPTS="${OPTS} -Xlinker --retain-symbols-file ${EXPORTS}" + # Make the 'exptmp' file for --version-script option + echo "{" > exptmp + echo "global:" >> exptmp + sed 's/$/;/' ${EXPORTS} >> exptmp + echo "local:" >> exptmp + echo "*;" >> exptmp + echo "};" >> exptmp + OPTS="${OPTS} -Xlinker --version-script=exptmp" + # exptmp is removed below + fi + + # Check if objects are 32-bit and we're running in 64-bit + # environment. If so, pass -m32 flag to linker. + set ${OBJECTS} + ABI32=`file $1 | grep 32-bit` + if [ "${ABI32}" -a `uname -m` = "x86_64" ] ; then + OPTS="-m32 ${OPTS}" + fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + + if [ x${PATCH} = "x" ] ; then + VERSION="${MAJOR}.${MINOR}" + else + VERSION="${MAJOR}.${MINOR}.${PATCH}" + fi + + echo "mklib: Making" $ARCH "shared library: " ${LIBNAME}.so.${VERSION} + + # rm any old libs + rm -f ${LIBNAME}.so.${VERSION} + rm -f ${LIBNAME}.so.${MAJOR} + rm -f ${LIBNAME}.so + + # make lib + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} + # make usual symlinks + ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} + ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so + # finish up + FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so" +# rm -f exptmp + fi + ;; + + 'SunOS') + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making SunOS static library: " ${LIBNAME} + rm -f ${LIBNAME} + ar -ruv ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + else + if [ $NOPREFIX = 0 ] ; then + LIBNAME="lib${LIBNAME}.so" + fi + echo "mklib: Making SunOS shared library: " ${LIBNAME} + + if [ "x$LINK" = "x" ] ; then + # -linker was not specified, choose default linker now + if [ $CPLUSPLUS = 1 ] ; then + # determine linker and options for C++ code + if [ `which c++` ] ; then + # use Sun c++ + LINK="c++" + elif [ `type g++` ] ; then + # use g++ + LINK="g++" + else + echo "mklib: warning: can't find C++ compiler, trying CC." + LINK="CC" + fi + else + # use native Sun linker for C code + LINK="ld" + fi + fi + + # linker options + if [ ${LINK} = "ld" -o ${LINK} = "cc" -o ${LINK} = "CC" ] ; then + # SunOS tools, -G to make shared libs + OPTS="-G" + else + # gcc linker + # Check if objects are 32-bit and we're running in 64-bit + # environment. If so, pass -m32 flag to linker. + set ${OBJECTS} + ABI32=`file $1 | grep 32-bit` + if [ "${ABI32}" ] ; then + OPTS="-m32 -shared -Wl,-Bdynamic" + else + OPTS="-m64 -shared -Wl,-Bdynamic" + fi + fi + + # If using Sun C++ compiler, need to tell it not to add runpaths + # that are specific to the build machine + if [ ${LINK} = "CC" ] ; then + OPTS="${OPTS} -norunpath" + fi + + # Solaris linker requires explicitly listing the Standard C & C++ + # libraries in the link path when building shared objects + if [ ${LINK} = "CC" ] ; then + DEPS="${DEPS} -lCrun" + fi + DEPS="${DEPS} -lc" + + if [ $EXPORTS ] ; then + # Make the 'mapfile.scope' linker mapfile + echo "{" > mapfile.scope + echo "global:" >> mapfile.scope + sed 's/$/;/' ${EXPORTS} >> mapfile.scope + echo "local:" >> mapfile.scope + echo " *;" >> mapfile.scope + echo "};" >> mapfile.scope + OPTS="${OPTS} -Wl,-Mmapfile.scope" + fi + + # Check if objects are SPARC v9 + # file says: ELF 64-bit MSB relocatable SPARCV9 Version 1 + set ${OBJECTS} + if [ ${LINK} = "cc" -o ${LINK} = "CC" ] ; then + SPARCV9=`file $1 | grep SPARCV9` + if [ "${SPARCV9}" ] ; then + OPTS="${OPTS} -xarch=v9" + fi + fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + + # for debug: + #echo "mklib: linker is" ${LINK} ${OPTS} + if [ $NOPREFIX = 1 ] ; then + rm -f ${LIBNAME} + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS="${LIBNAME}" + else + rm -f ${LIBNAME}.${MAJOR} ${LIBNAME} + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS} + ln -s ${LIBNAME}.${MAJOR} ${LIBNAME} + FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}" + fi + fi + ;; + + 'FreeBSD') + # we assume gcc + + if [ "x$LINK" = "x" ] ; then + # -linker was not specified so set default link command now + if [ $CPLUSPLUS = 1 ] ; then + LINK=g++ + else + LINK=gcc + fi + fi + + if [ $NOPREFIX = 1 ] ; then + # No "lib" or ".so" part + echo "mklib: Making FreeBSD shared library: " ${LIBNAME} + OPTS="-shared" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + rm -f ${LIBNAME} + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS=${LIBNAME} + elif [ $STATIC = 1 ] ; then + STLIB="lib${LIBNAME}.a" + echo "mklib: Making FreeBSD static library: " ${STLIB} + rm -f ${STLIB} + ar cq ${STLIB} ${OBJECTS} + ranlib ${STLIB} + FINAL_LIBS=${STLIB} + else + SHLIB="lib${LIBNAME}.so.${MAJOR}" + OPTS="-shared -Wl,-soname,${SHLIB}" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + echo "mklib: Making FreeBSD shared library: " ${SHLIB} + rm -f ${SHLIB} + ${LINK} ${OPTS} ${LDFLAGS} -o ${SHLIB} ${OBJECTS} ${DEPS} + ln -sf ${SHLIB} "lib${LIBNAME}.so" + FINAL_LIBS="${SHLIB} lib${LIBNAME}.so" + fi + ;; + + 'NetBSD') + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}_pic.a" + echo "mklib: Making NetBSD PIC static library: " ${LIBNAME} + rm -f ${LIBNAME} + ar cq ${LIBNAME} ${OBJECTS} + ranlib ${LIBNAME} + FINAL_LIBS=${LIBNAME} + else + LIBNAME="lib${LIBNAME}.so.${MAJOR}.${MINOR}" + echo "mklib: Making NetBSD PIC shared library: " ${LIBNAME} + rm -f ${LIBNAME} + ld -x -Bshareable -Bforcearchive -o ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + fi + ;; + + 'IRIX' | 'IRIX64') + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + rm -f ${LIBNAME} + ar rc ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + else + LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" + + # examine first object to determine ABI + set ${OBJECTS} + ABI_O32=`file $1 | grep 'ELF 32-bit'` + ABI_N32=`file $1 | grep 'ELF N32'` + ABI_N64=`file $1 | grep 'ELF 64-bit'` + if [ "${ABI_O32}" ] ; then + OPTS="-32 -shared -all" + ABI="o32-bit" + elif [ "${ABI_N32}" ] ; then + OPTS="-n32 -shared -all" + ABI="n32-bit" + elif [ "${ABI_N64}" ] ; then + OPTS="-64 -shared -all" + ABI="64-bit" + else + echo "Error: Unexpected IRIX ABI!" + exit 1 + fi + + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + + if [ $CPLUSPLUS = 1 ] ; then + LINK="CC" + else + LINK="ld" + fi + + echo "mklib: Making IRIX " ${ABI} " shared library: " ${LIBNAME} + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS=${LIBNAME} + fi + ;; + + 'linux-cygwin') + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making linux-cygwin library: " ${LIBNAME} + rm -f ${LIBNAME} + gnuwin32ar ruv ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + ;; + + 'HP-UX') + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making HP-UX static library: " ${LIBNAME} + rm -f ${LIBNAME} + ar -ruv ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + else + # HP uses a .2 for their current GL/GLU libraries + if [ ${LIBNAME} = "GL" -o ${LIBNAME} = "GLU" ] ; then + MAJOR=2 + fi + RUNLIB="lib${LIBNAME}.${MAJOR}" + DEVLIB="lib${LIBNAME}.sl" + echo "mklib: Making HP-UX shared library: " ${RUNLIB} ${DEVLIB} + ld -b -o ${RUNLIB} +b ${RUNLIB} ${OBJECTS} ${DEPS} + ln -s ${RUNLIB} ${DEVLIB} + FINAL_LIBS="${RUNLIB} ${DEVLIB}" + fi + ;; + + 'AIX' ) + # examine first object to determine ABI + set ${OBJECTS} + ABI_64=`file $1 | grep '64-bit'` + if [ "${ABI_64}" ] ; then + X64="-X64" + Q64="-q64" + OFILE=shr_64.o + else + OFILE=shr.o #Want to be consistent with the IBM libGL.a + fi + + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making AIX static library: " ${LIBNAME} + ar -ruv ${X64} ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + else + EXPFILE="lib${LIBNAME}.exp" + LIBNAME="lib${LIBNAME}.a" # shared objects are still stored in the .a libraries + OPTS="-bE:${EXPFILE} -bM:SRE -bnoentry ${Q64}" + rm -f ${EXPFILE} ${OFILE} + NM="/bin/nm -eC ${X64}" + echo "#! /usr/lib/${LIBNAME}" > ${EXPFILE} + ${NM} ${OBJECTS} | awk '{ + if ((($2 == "T") || ($2 == "D") || ($2 == "B")) \ + && ( substr($1,1,1) != ".")) { + if (substr ($1, 1, 7) != "__sinit" && + substr ($1, 1, 7) != "__sterm") { + if (substr ($1, 1, 5) == "__tf1") + print (substr ($1, 7)) + else if (substr ($1, 1, 5) == "__tf9") + print (substr ($1, 15)) + else + print $1 + } + } + }' | sort -u >> ${EXPFILE} + + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + + # On AIX a shared library is linked differently when + # you want to dlopen the file + if [ $DLOPEN = "1" ] ; then + cc -G ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + else + cc ${OPTS} ${LDFLAGS} -o ${OFILE} ${OBJECTS} ${DEPS} + ar ${X64} -r ${LIBNAME} ${OFILE} + fi + + FINAL_LIBS="${LIBNAME}" + fi + ;; + + 'OpenSTEP') + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making OpenSTEP static library: " ${LIBNAME} + libtool -static -o ${LIBNAME} - ${OBJECTS} + FINAL_LIBS=${LIBNAME} + ;; + + 'OSF1') + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making OSF/1 static library: " ${LIBNAME} + rm -f ${LIBNAME} + ar -ruv ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + else + VERSION="${MAJOR}.${MINOR}" + LIBNAME="lib${LIBNAME}.so" + echo "mklib: Making OSF/1 shared library: " ${LIBNAME} + if [ "x$LINK" = "x" ] ; then + if [ $CPLUSPLUS = 1 ] ; then + LINK=cxx + else + LINK=cc + fi + fi + rm -f ${LIBNAME}.${VERSION} + ${LINK} -o ${LIBNAME}.${VERSION} -shared -set_version ${VERSION} -soname ${LIBNAME}.${VERSION} -expect_unresolved \* -all ${OBJECTS} ${DEPS} + ln -sf ${LIBNAME}.${VERSION} ${LIBNAME} + FINAL_LIBS="${LIBNAME} ${LIBNAME}.${VERSION}" + fi + ;; + + 'Darwin') + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making Darwin static library: " ${LIBNAME} + LINK="ar" + OPTS="-ruvs" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + ${LINK} ${OPTS} ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + else + # On Darwin a .bundle is used for a library that you want to dlopen + if [ $DLOPEN = "1" ] ; then + LIBSUFFIX="bundle" + OPTS="${ARCHOPT} -bundle -multiply_defined suppress" + else + LIBSUFFIX="dylib" + if [ -z "$ID" ] ; then + ID="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" + fi + OPTS="${ARCHOPT} -dynamiclib -multiply_defined suppress -current_version ${MAJOR}.${MINOR}.0 -compatibility_version ${MAJOR}.${MINOR}.0 -install_name ${ID}" + fi + + if [ ${EXPORTS} ] ; then + if [ -f ${EXPORTS}".darwin" ] ; then + EXPORTS=$EXPORTS".darwin" + fi + OPTS="${OPTS} -exported_symbols_list ${EXPORTS}" + fi + + LINKNAME="lib${LIBNAME}.${MAJOR}.${LIBSUFFIX}" + LINKNAME2="lib${LIBNAME}.${LIBSUFFIX}" + LIBNAME="lib${LIBNAME}.${MAJOR}.${MINOR}.${LIBSUFFIX}" + + # examine first object to determine ABI + set ${OBJECTS} + ABI_PPC=`file $1 | grep ' ppc'` + ABI_I386=`file $1 | grep ' i386'` + ABI_PPC64=`file $1 | grep ' ppc64'` + ABI_X86_64=`file $1 | grep ' x86_64'` + if [ "${ABI_PPC}" ] ; then + OPTS="${OPTS} -arch ppc" + fi + if [ "${ABI_I386}" ] ; then + OPTS="${OPTS} -arch i386" + fi + if [ "${ABI_PPC64}" ] ; then + OPTS="${OPTS} -arch ppc64" + fi + if [ "${ABI_X86_64}" ] ; then + OPTS="${OPTS} -arch x86_64" + fi + + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + + # XXX can we always add -isysroot /Developer/SDKs/MacOSX10.4u.sdk + # to OPTS here? + + # determine linker + if [ $CPLUSPLUS = 1 ] ; then + LINK="g++" + else + LINK="cc" + fi + + echo "mklib: Making Darwin shared library: " ${LIBNAME} + + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + ln -s ${LIBNAME} ${LINKNAME} + ln -s ${LIBNAME} ${LINKNAME2} + FINAL_LIBS="${LIBNAME} ${LINKNAME} ${LINKNAME2}" + fi + ;; + + 'LynxOS') + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making LynxOS static library: " ${LIBNAME} + rm -f ${LIBNAME} + ar ru ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + ;; + + 'BeOS') + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making BeOS static library: " ${LIBNAME} + ar -cru "${LIBNAME}" ${OBJECTS} + else + LIBNAME="lib${LIBNAME}.so" + echo "mklib: Making BeOS shared library: " ${LIBNAME} + gcc -nostart -Xlinker "-soname=${LIBNAME}" -L/Be/develop/lib/x86 -lbe ${DEPS} ${OBJECTS} -o "${LIBNAME}" + mimeset -f "${LIBNAME}" + # XXX remove the Mesa3D stuff here since mklib isn't mesa-specific. + setversion "${LIBNAME}" -app ${MAJOR} ${MINOR} ${PATCH} -short "Powered by Mesa3D!" -long "Powered by Mesa3D!" + fi + FINAL_LIBS=${LIBNAME} + ;; + + 'QNX') + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making QNX library: " ${LIBNAME} + wlib ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + ;; + + 'MorphOS') + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making MorphOS library: " ${LIBNAME} + ppc-morphos-ar rc ${LIBNAME} ${OBJECTS} + FINAL_LIBS="${LIBNAME}" + ;; + + 'icc' | 'icc-istatic') + # Intel C compiler + # This should get merged into the Linux code, above, since this isn't + # really a different architecture. + LIBNAME="lib${LIBNAME}" # prefix with "lib" + + if [ $STATIC = 1 ] ; then + echo "mklib: Making Intel ICC static library: " ${LIBNAME}.a + LINK="ar" + OPTS="-ruv" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + # make lib + ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} + # finish up + FINAL_LIBS="${LIBNAME}.a" + else + if [ $ARCH = icc-istatic ] ; then + OPTS="-shared -i-static -cxxlib-icc" + else + OPTS="-shared" + fi + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + VERSION="${MAJOR}.${MINOR}.${PATCH}" + echo "mklib: Making Intel ICC shared library: " ${LIBNAME}.so.${VERSION} + + if [ $CPLUSPLUS = 1 ] ; then + LINK="icpc" + else + LINK="icc" + fi + # rm any old libs + rm -f ${LIBNAME}.so.${VERSION} + rm -f ${LIBNAME}.so.${MAJOR} + rm -f ${LIBNAME}.so + # make lib + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.so.${VERSION} ${OBJECTS} ${DEPS} + # make usual symlinks + ln -s ${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} + ln -s ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so + # finish up + FINAL_LIBS="${LIBNAME}.so.${VERSION} ${LIBNAME}.so.${MAJOR} ${LIBNAME}.so" + fi + ;; + + 'aix-gcc') + # AIX with gcc + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making AIX GCC static library: " ${LIBNAME} + rm -f ${LIBNAME} + ar ru ${LIBNAME} ${OBJECTS} + FINAL_LIBS=${LIBNAME} + else + LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" + echo "mklib: Making AIX GCC shared library: " ${LIBNAME} + # remove old lib + rm -f ${LIBNAME} + # make the lib + gcc -shared -Wl,-G ${OBJECTS} ${DEPS} -o ${LIBNAME} + # NOTE: the application linking with this library must specify + # the -Wl,-brtl flags to gcc + FINAL_LIBS=${LIBNAME} + fi + ;; + + 'ultrix') + # XXX untested + if [ $STATIC = 0 ] ; then + echo "mklib: Warning shared libs not supported on Ultrix" + fi + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making static library for Ultrix: " ${LIBNAME} + rm -f ${LIBNAME} + ar ru ${LIBNAME} ${OBJECTS} + FINAL_LIBS="${LIBNAME}" + ;; + + CYGWIN*) + # GCC-based environment + if [ $NOPREFIX = 1 ] ; then + # No "lib" or ".so" part + echo "mklib: Making CYGWIN shared library: " ${LIBNAME} + OPTS="-shared -Wl,--enable-auto-image-base" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + rm -f ${LIBNAME} + ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS=${LIBNAME} + else + CYGNAME="cyg${LIBNAME}" # prefix with "cyg" + LIBNAME="lib${LIBNAME}" # prefix with "lib" + + if [ $STATIC = 1 ] ; then + echo "mklib: Making" $ARCH "static library: " ${LIBNAME}.a + LINK="ar" + OPTS="-ru" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + # make lib + ${LINK} ${OPTS} ${LIBNAME}.a ${OBJECTS} + ranlib ${LIBNAME}.a + # finish up + FINAL_LIBS=${LIBNAME}.a + else + OPTS="-shared -Wl,--enable-auto-image-base -Wl,-export-all -Wl,--out-implib=${LIBNAME}-${MAJOR}.dll.a" + if [ "${ALTOPTS}" ] ; then + OPTS=${ALTOPTS} + fi + echo "mklib: Making" $ARCH "shared library: " ${CYGNAME}-${MAJOR}.dll + + if [ $CPLUSPLUS = 1 ] ; then + LINK="g++" + else + LINK="gcc" + fi + + # rm any old libs + rm -f ${CYGNAME}-${MAJOR}.dll + rm -f ${LIBNAME}-${MAJOR}.dll.a + rm -f ${LIBNAME}.dll.a + rm -f ${LIBNAME}.a + + # make lib + ${LINK} ${OPTS} ${LDFLAGS} -o ${CYGNAME}-${MAJOR}.dll ${OBJECTS} ${DEPS} + # make usual symlinks + ln -s ${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a + # finish up + FINAL_LIBS="${LIBNAME}-${MAJOR}.dll.a ${LIBNAME}.dll.a" + # special case for installing in bin + FINAL_BINS="${CYGNAME}-${MAJOR}.dll" + fi + fi + ;; + + 'example') + # If you're adding support for a new architecture, you can + # start with this: + if [ $STATIC = 1 ] ; then + LIBNAME="lib${LIBNAME}.a" + echo "mklib: Making static library for example arch: " ${LIBNAME} + rm -f ${LIBNAME} + ar rv ${LIBNAME} ${OBJECTS} + FINAL_LIBS="${LIBNAME}" + else + LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix with ".so" + echo "mklib: Making shared library for example arch: " ${LIBNAME} + ld -o ${LIBNAME} ${OBJECTS} ${DEPS} + FINAL_LIBS="${LIBNAME}" + fi + ;; + + *) + echo "mklib: ERROR: Don't know how to make a static/shared library for" ${ARCH} + echo "mklib: Please add necessary commands to mklib script." + ;; +esac + + +# +# Put library files into installation directory if specified. +# +if [ ${INSTALLDIR} != "." ] ; then + echo "mklib: Installing" ${FINAL_LIBS} "in" ${INSTALLDIR} + test -d ${INSTALLDIR} || mkdir -p ${INSTALLDIR} + mv ${FINAL_LIBS} ${INSTALLDIR}/ +fi diff --git a/mesalib/bin/version.mk b/mesalib/bin/version.mk new file mode 100644 index 000000000..ab20d79da --- /dev/null +++ b/mesalib/bin/version.mk @@ -0,0 +1,17 @@ +#!/usr/bin/make -sf +# Print the various Mesa version fields. This is mostly used to add the +# version to configure. + +# This reflects that this script is usually called from the toplevel +TOP = . + +include $(TOP)/configs/default + +version: + @echo $(MESA_VERSION) +major: + @echo $(MESA_MAJOR) +minor: + @echo $(MESA_MINOR) +tiny: + @echo $(MESA_TINY) diff --git a/mesalib/configs/aix b/mesalib/configs/aix new file mode 100644 index 000000000..ebbf58374 --- /dev/null +++ b/mesalib/configs/aix @@ -0,0 +1,30 @@ +# Configuration for AIX, dynamic libs + +include $(TOP)/configs/default + +CONFIG_NAME = aix + +# Compiler and flags +CC = cc +CXX = xlC + +CFLAGS = -O -DAIXV3 -DPTHREADS +CXXFLAGS = -O -DAIXV3 -DPTHREADS + +# Misc tools and flags +MKLIB_OPTIONS = + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +GL_LIB_DEPS = -lX11 -lXext -lpthread -lm +GLU_LIB_DEPS = -L$(TOP)/lib -l$(GL_LIB) -lm -lC +GLUT_LIB_DEPS = -L$(TOP)/lib -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu -lX11 -lm +GLW_LIB_DEPS = -L$(TOP)/lib -l$(GL_LIB) -lXm -lXt -lX11 +OSMESA_LIB_DEPS = -L$(TOP)/lib -l$(GL_LIB) +APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lpthread -lm -lC + diff --git a/mesalib/configs/aix-64 b/mesalib/configs/aix-64 new file mode 100644 index 000000000..5d2edc587 --- /dev/null +++ b/mesalib/configs/aix-64 @@ -0,0 +1,27 @@ +# Configuration for AIX 64-bit, dynamic libs + +include $(TOP)/configs/default + +CONFIG_NAME = aix-64 + +# Compiler and flags +CC = xlc +CXX = xlC + +CFLAGS = -q64 -qmaxmem=16384 -O -DAIXV3 -DPTHREADS +CXXFLAGS = -q64 -qmaxmem=16384 -O -DAIXV3 -DPTHREADS +LIB_DIR = lib64 + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +GL_LIB_DEPS = -lX11 -lXext -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lC +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu -lX11 -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXm -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/lib64 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lm -lpthread -lC + diff --git a/mesalib/configs/aix-64-static b/mesalib/configs/aix-64-static new file mode 100644 index 000000000..6910e890d --- /dev/null +++ b/mesalib/configs/aix-64-static @@ -0,0 +1,25 @@ +# Configuration for AIX, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = aix-64-static + +# Compiler and flags +CC = cc +CXX = xlC + +CFLAGS = -q64 -O -DAIXV3 -DPTHREADS +CXXFLAGS = -q64 -O -DAIXV3 -DPTHREADS +MKLIB_OPTIONS = -static +LIB_DIR = lib64 + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +APP_LIB_DEPS = -q64 -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \ + -lX11 -lXext -lXmu -lXi -lm -lpthread -lC + diff --git a/mesalib/configs/aix-gcc b/mesalib/configs/aix-gcc new file mode 100644 index 000000000..3b964f351 --- /dev/null +++ b/mesalib/configs/aix-gcc @@ -0,0 +1,23 @@ +# Configuration for AIX with gcc + +include $(TOP)/configs/default + +CONFIG_NAME = aix-gcc + +# Compiler and flags +CC = gcc +CXX = g++ + +CFLAGS = -O2 -DAIXV3 +CXXFLAGS = -O2 -DAIXV3 + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +MKLIB_OPTIONS = -arch aix-gcc +GL_LIB_DEPS = -lX11 -lXext -lm +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -Wl,-brtl -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lX11 -lXext -lXmu -lXi + diff --git a/mesalib/configs/aix-static b/mesalib/configs/aix-static new file mode 100644 index 000000000..563184344 --- /dev/null +++ b/mesalib/configs/aix-static @@ -0,0 +1,25 @@ +# Configuration for AIX, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = aix-static + +# Compiler and flags +CC = cc +CXX = xlC + +CFLAGS = -O -DAIXV3 -DPTHREADS +CXXFLAGS = -O -DAIXV3 -DPTHREADS +MKLIB_OPTIONS = -static + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \ + -lX11 -lXext -lXmu -lXi -lm -lpthread -lC + + diff --git a/mesalib/configs/autoconf.in b/mesalib/configs/autoconf.in new file mode 100644 index 000000000..83737e3a7 --- /dev/null +++ b/mesalib/configs/autoconf.in @@ -0,0 +1,148 @@ +# Autoconf configuration + +# Pull in the defaults +include $(TOP)/configs/default + +# This is generated by configure +CONFIG_NAME = autoconf + +# Compiler and flags +CC = @CC@ +CXX = @CXX@ +OPT_FLAGS = @OPT_FLAGS@ +ARCH_FLAGS = @ARCH_FLAGS@ +ASM_FLAGS = @ASM_FLAGS@ +PIC_FLAGS = @PIC_FLAGS@ +DEFINES = @DEFINES@ +CFLAGS = @CPPFLAGS@ @CFLAGS@ \ + $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) +CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \ + $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +LDFLAGS = @LDFLAGS@ +EXTRA_LIB_PATH = @EXTRA_LIB_PATH@ +RADEON_CFLAGS = @RADEON_CFLAGS@ +RADEON_LDFLAGS = @RADEON_LDFLAGS@ + +# Assembler +MESA_ASM_SOURCES = @MESA_ASM_SOURCES@ +GLAPI_ASM_SOURCES = @GLAPI_ASM_SOURCES@ + +# Misc tools and flags +MAKE = @MAKE@ +SHELL = @SHELL@ +MKLIB_OPTIONS = @MKLIB_OPTIONS@ +MKDEP = @MKDEP@ +MKDEP_OPTIONS = @MKDEP_OPTIONS@ +INSTALL = @INSTALL@ + +# Python and flags (generally only needed by the developers) +PYTHON2 = python +PYTHON_FLAGS = -t -O -O + +# Library names (base name) +GL_LIB = GL +GLU_LIB = GLU +GLUT_LIB = glut +GLW_LIB = GLw +OSMESA_LIB = @OSMESA_LIB@ + +# Library names (actual file names) +GL_LIB_NAME = @GL_LIB_NAME@ +GLU_LIB_NAME = @GLU_LIB_NAME@ +GLUT_LIB_NAME = @GLUT_LIB_NAME@ +GLW_LIB_NAME = @GLW_LIB_NAME@ +OSMESA_LIB_NAME = @OSMESA_LIB_NAME@ + +# Globs used to install the lib and all symlinks +GL_LIB_GLOB = @GL_LIB_GLOB@ +GLU_LIB_GLOB = @GLU_LIB_GLOB@ +GLUT_LIB_GLOB = @GLUT_LIB_GLOB@ +GLW_LIB_GLOB = @GLW_LIB_GLOB@ +OSMESA_LIB_GLOB = @OSMESA_LIB_GLOB@ + +# Directories to build +LIB_DIR = @LIB_DIR@ +SRC_DIRS = @SRC_DIRS@ +GLU_DIRS = @GLU_DIRS@ +DRIVER_DIRS = @DRIVER_DIRS@ +GALLIUM_DIRS = @GALLIUM_DIRS@ +GALLIUM_AUXILIARY_DIRS = @GALLIUM_AUXILIARY_DIRS@ +GALLIUM_DRIVERS_DIRS = @GALLIUM_DRIVERS_DIRS@ +GALLIUM_WINSYS_DIRS = @GALLIUM_WINSYS_DIRS@ +GALLIUM_WINSYS_DRM_DIRS = @GALLIUM_WINSYS_DRM_DIRS@ +GALLIUM_STATE_TRACKERS_DIRS = @GALLIUM_STATE_TRACKERS_DIRS@ +GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a) +GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) + +# Which subdirs under $(TOP)/progs/ to enter: +PROGRAM_DIRS = @PROGRAM_DIRS@ + +# Driver specific build vars +DRI_DIRS = @DRI_DIRS@ +WINDOW_SYSTEM = @WINDOW_SYSTEM@ +USING_EGL = @USING_EGL@ + +# Dependencies +X11_INCLUDES = @X11_INCLUDES@ + +# GLw motif setup +GLW_SOURCES = @GLW_SOURCES@ +MOTIF_CFLAGS = @MOTIF_CFLAGS@ + +# Library/program dependencies +GL_LIB_DEPS = $(EXTRA_LIB_PATH) @GL_LIB_DEPS@ +OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \ + $(EXTRA_LIB_PATH) @OSMESA_LIB_DEPS@ +EGL_LIB_DEPS = $(EXTRA_LIB_PATH) @EGL_LIB_DEPS@ +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \ + $(EXTRA_LIB_PATH) @GLU_LIB_DEPS@ +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \ + $(EXTRA_LIB_PATH) @GLUT_LIB_DEPS@ +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \ + $(EXTRA_LIB_PATH) @GLW_LIB_DEPS@ +APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@ + +# DRI dependencies +DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIB = @LIBDRM_LIBS@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +EXPAT_INCLUDES = @EXPAT_INCLUDES@ + +# Autoconf directories +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ + +# Installation directories (for make install) +INSTALL_DIR = $(prefix) +INSTALL_LIB_DIR = $(libdir) +INSTALL_INC_DIR = $(includedir) + +# DRI installation directories +DRI_DRIVER_INSTALL_DIR = @DRI_DRIVER_INSTALL_DIR@ + +# Where libGL will look for DRI hardware drivers +DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) + +# Xorg driver install directory (for xorg state-tracker) +XORG_DRIVER_INSTALL_DIR = @XORG_DRIVER_INSTALL_DIR@ + +# pkg-config substitutions +GL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@ +GL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@ +GL_PC_CFLAGS = @GL_PC_CFLAGS@ +DRI_PC_REQ_PRIV = @DRI_PC_REQ_PRIV@ +GLU_PC_REQ = @GLU_PC_REQ@ +GLU_PC_REQ_PRIV = @GLU_PC_REQ_PRIV@ +GLU_PC_LIB_PRIV = @GLU_PC_LIB_PRIV@ +GLU_PC_CFLAGS = @GLU_PC_CFLAGS@ +GLUT_PC_REQ_PRIV = @GLUT_PC_REQ_PRIV@ +GLUT_PC_LIB_PRIV = @GLUT_PC_LIB_PRIV@ +GLUT_PC_CFLAGS = @GLUT_PC_CFLAGS@ +GLW_PC_REQ_PRIV = @GLW_PC_REQ_PRIV@ +GLW_PC_LIB_PRIV = @GLW_PC_LIB_PRIV@ +GLW_PC_CFLAGS = @GLW_PC_CFLAGS@ +OSMESA_PC_REQ = @OSMESA_PC_REQ@ +OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@ diff --git a/mesalib/configs/beos b/mesalib/configs/beos new file mode 100644 index 000000000..69a8fd426 --- /dev/null +++ b/mesalib/configs/beos @@ -0,0 +1,104 @@ +# Configuration for BeOS +# Written by Philippe Houdoin + +include $(TOP)/configs/default + +CONFIG_NAME = beos + + +DEFINES = \ + -DBEOS_THREADS + +MACHINE=$(shell uname -m) +ifeq ($(MACHINE), BePC) + CPU = x86 +else + CPU = ppc +endif + +ifeq ($(CPU), x86) + # BeOS x86 settings + + DEFINES += \ + -DGNU_ASSEMBLER \ + -DUSE_X86_ASM \ + -DUSE_MMX_ASM \ + -DUSE_3DNOW_ASM \ + -DUSE_SSE_ASM + + MESA_ASM_SOURCES = $(X86_SOURCES) + GLAPI_ASM_SOURCES = $(X86_API) + + CC = gcc + CXX = g++ + LD = gcc + + CFLAGS = \ + -Wall -Wno-multichar -Wno-ctor-dtor-privacy \ + $(DEFINES) + + CXXFLAGS = $(CFLAGS) + + # Work around aliasing bugs - developers should comment this out + CFLAGS += -fno-strict-aliasing + CXXFLAGS += -fno-strict-aliasing + + LDFLAGS += -Xlinker + + ifdef DEBUG + CFLAGS += -g -O0 + LDFLAGS += -g + DEFINES += -DDEBUG + else + CFLAGS += -O3 + endif + + GLUT_CFLAGS = -fexceptions + +else + # BeOS PPC settings + + CC = mwcc + CXX = $(CC) + LD = mwldppc + + CFLAGS = \ + -w on -requireprotos \ + $(DEFINES) + + CXXFLAGS = $(CFLAGS) + + LDFLAGS += \ + -export pragma \ + -init _init_routine_ \ + -term _term_routine_ \ + -lroot \ + /boot/develop/lib/ppc/glue-noinit.a \ + /boot/develop/lib/ppc/init_term_dyn.o \ + /boot/develop/lib/ppc/start_dyn.o + + ifdef DEBUG + CFLAGS += -g -O0 + CXXFLAGS += -g -O0 + LDFLAGS += -g + else + CFLAGS += -O7 + CXXFLAGS += -O7 + endif + + GLUT_CFLAGS = -fexceptions +endif + +# Directories +SRC_DIRS = gallium mesa glu glut/beos glew +GLU_DIRS = sgi +DRIVER_DIRS = beos +PROGRAM_DIRS = beos samples redbook demos tests + +# Library/program dependencies +GL_LIB_DEPS = +OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) +GLU_LIB_DEPS = +GLUT_LIB_DEPS = -lgame -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) +APP_LIB_DEPS = -lbe -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -l$(GLUT_LIB) + diff --git a/mesalib/configs/bluegene-osmesa b/mesalib/configs/bluegene-osmesa new file mode 100644 index 000000000..d22454fa2 --- /dev/null +++ b/mesalib/configs/bluegene-osmesa @@ -0,0 +1,33 @@ +# Configuration for building only libOSMesa on BlueGene, no Xlib driver +# This doesn't really have a lot of dependencies, so it should be usable +# on other (gcc-based) systems too. +# It uses static linking and disables multithreading. + +include $(TOP)/configs/default + +CONFIG_NAME = bluegene-osmesa + +# Compiler and flags +CC = /bgl/BlueLight/ppcfloor/blrts-gnu/bin/powerpc-bgl-blrts-gnu-gcc +CXX = /bgl/BlueLight/ppcfloor/blrts-gnu/bin/powerpc-bgl-blrts-gnu-g++ +CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURC + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +MKLIB_OPTIONS = -static + +OSMESA_LIB_NAME = libOSMesa.a + +# Directories +SRC_DIRS = mesa glu +DRIVER_DIRS = osmesa +PROGRAM_DIRS = osdemos + + +# Dependencies +OSMESA_LIB_DEPS = -lm +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB) +APP_LIB_DEPS = -lOSMesa -lGLU -lm diff --git a/mesalib/configs/bluegene-xlc-osmesa b/mesalib/configs/bluegene-xlc-osmesa new file mode 100644 index 000000000..b0c762de9 --- /dev/null +++ b/mesalib/configs/bluegene-xlc-osmesa @@ -0,0 +1,29 @@ +# Configuration for building only libOSMesa on BlueGene using the IBM xlc compiler +# This doesn't really have a lot of dependencies, so it should be usable +# on similar systems too. +# It uses static linking and disables multithreading. + +include $(TOP)/configs/default + +CONFIG_NAME = bluegene-osmesa + +# Compiler and flags +CC = /opt/ibmcmp/vacpp/bg/8.0/bin/blrts_xlc +CXX = /opt/ibmcmp/vacpp/bg/8.0/bin/blrts_xlC +CFLAGS = -O3 -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +CXXFLAGS = -O3 -pedantic -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE + +MKLIB_OPTIONS = -static + +OSMESA_LIB_NAME = libOSMesa.a + +# Directories +SRC_DIRS = mesa glu +DRIVER_DIRS = osmesa +PROGRAM_DIRS = osdemos + + +# Dependencies +OSMESA_LIB_DEPS = -lm +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB) +APP_LIB_DEPS = -lOSMesa -lGLU -lm diff --git a/mesalib/configs/catamount-osmesa-pgi b/mesalib/configs/catamount-osmesa-pgi new file mode 100644 index 000000000..835f6eb7d --- /dev/null +++ b/mesalib/configs/catamount-osmesa-pgi @@ -0,0 +1,32 @@ +# Configuration for building only libOSMesa on Cray Xt3 +# for the compute nodes running Catamount using the +# Portland Group compiler. The Portland Group toolchain has to be +# enabled before using "module switch PrgEnv-gnu PrgEnv-pgi" . +# This doesn't really have a lot of dependencies, so it should be usable +# on other similar systems too. +# It uses static linking and disables multithreading. + +include $(TOP)/configs/default + +CONFIG_NAME = catamount-osmesa-pgi + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -target=catamount -fastsse -O3 -Mnontemporal -Mprefetch=distance:8,nta -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +CXXFLAGS = -target=catamount -fastsse -O3 -Mnontemporal -Mprefetch=distance:8,nta -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE + +MKLIB_OPTIONS = -static + +OSMESA_LIB_NAME = libOSMesa.a + +# Directories +SRC_DIRS = mesa glu +DRIVER_DIRS = osmesa +PROGRAM_DIRS = osdemos + + +# Dependencies +OSMESA_LIB_DEPS = -lm +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB) +APP_LIB_DEPS = -lOSMesa -lGLU -lm diff --git a/mesalib/configs/config.mgw b/mesalib/configs/config.mgw new file mode 100644 index 000000000..af74fdadc --- /dev/null +++ b/mesalib/configs/config.mgw @@ -0,0 +1,42 @@ +# MinGW config include file updated for Mesa 7.0 +# +# Updated : by Heromyth, on 2007-7-21 +# Email : zxpmyth@yahoo.com.cn +# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. +# The others havn't been tested yet. +# 2) The generated DLLs are *not* compatible with the ones built +# with the other compilers like VC8, especially for GLUT. +# 3) Although more tests are needed, it can be used individually! + +# The generated DLLs by MingW with STDCALL are not totally compatible +# with the ones linked by Microsoft's compilers. +# +# xxx_USING_STDCALL = 1 Compiling MESA with __stdcall. This is default! +# +# xxx_USING_STDCALL = 0 Compiling MESA without __stdcall. I like this:) +# + +# In fact, GL_USING_STDCALL and GLUT_USING_STDCALL can be +# different. For example: +# +# GL_USING_STDCALL = 0 +# GLUT_USING_STDCALL = 1 +# +# Suggested setting: +# +# ALL_USING_STDCALL = 1 +# +# That's default! +# + + +ALL_USING_STDCALL = 1 + + +ifeq ($(ALL_USING_STDCALL),1) + GL_USING_STDCALL = 1 + GLUT_USING_STDCALL = 1 +else + GL_USING_STDCALL = 0 + GLUT_USING_STDCALL = 0 +endif diff --git a/mesalib/configs/darwin b/mesalib/configs/darwin new file mode 100644 index 000000000..213c39728 --- /dev/null +++ b/mesalib/configs/darwin @@ -0,0 +1,57 @@ +# Configuration for Darwin / MacOS X, making dynamic libs + +include $(TOP)/configs/default + +CONFIG_NAME = darwin + +INSTALL_DIR = /usr/X11 + +X11_DIR = $(INSTALL_DIR) + +# Compiler and flags +CC = gcc +CXX = g++ +PIC_FLAGS = -fPIC +DEFINES = -D_DARWIN_C_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L \ + -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DPTHREADS \ + -DGLX_ALIAS_UNSUPPORTED -DGLX_INDIRECT_RENDERING + +# -DGLX_DIRECT_RENDERING - pulls in libdrm stuff in glx/x11 +# -DGLX_USE_APPLEGL - supposed to be used with GLX_DIRECT_RENDERING to use AGL rather than DRM, but doesn't compile +# -DIN_DRI_DRIVER + +ARCH_FLAGS += $(RC_CFLAGS) + +CFLAGS = -ggdb3 -Os -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing \ + -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) +CXXFLAGS = -ggdb3 -Os -Wall -fno-strict-aliasing \ + -I$(INSTALL_DIR)/include -I$(X11_DIR)/include $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES) + +# Library names (actual file names) +GL_LIB_NAME = libGL.dylib +GLU_LIB_NAME = libGLU.dylib +GLUT_LIB_NAME = libglut.dylib +GLW_LIB_NAME = libGLw.dylib +OSMESA_LIB_NAME = libOSMesa.dylib + +# globs used to install the lib and all symlinks +GL_LIB_GLOB = libGL.*dylib +GLU_LIB_GLOB = libGLU.*dylib +GLUT_LIB_GLOB = libglut.*dylib +GLW_LIB_GLOB = libGLw.*dylib +OSMESA_LIB_GLOB = libOSMesa.*dylib + +GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread +OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm + +# omit glw lib for now: +SRC_DIRS = glx/x11 mesa glu glut/glx glew +GLU_DIRS = sgi +DRIVER_DIRS = osmesa +#DRIVER_DIRS = dri +DRI_DIRS = swrast +PROGRAM_DIRS = xdemos diff --git a/mesalib/configs/darwin-fat-32bit b/mesalib/configs/darwin-fat-32bit new file mode 100644 index 000000000..56bc6a37a --- /dev/null +++ b/mesalib/configs/darwin-fat-32bit @@ -0,0 +1,7 @@ +# Configuration for Darwin / MacOS X, making 32bit fat dynamic libs + +RC_CFLAGS=-arch ppc -arch i386 + +include $(TOP)/configs/darwin + +CONFIG_NAME = darwin-fat-32bit diff --git a/mesalib/configs/darwin-fat-all b/mesalib/configs/darwin-fat-all new file mode 100644 index 000000000..b8668dc5a --- /dev/null +++ b/mesalib/configs/darwin-fat-all @@ -0,0 +1,7 @@ +# Configuration for Darwin / MacOS X, making 32bit and 64bit fat dynamic libs + +RC_CFLAGS=-arch ppc -arch i386 -arch ppc64 -arch x86_64 + +include $(TOP)/configs/darwin + +CONFIG_NAME = darwin-fat-all diff --git a/mesalib/configs/darwin-x86ppc b/mesalib/configs/darwin-x86ppc new file mode 100644 index 000000000..3d82e3040 --- /dev/null +++ b/mesalib/configs/darwin-x86ppc @@ -0,0 +1,33 @@ +# Configuration for Darwin / MacOS X, making dynamic libs + +include $(TOP)/configs/default + +CONFIG_NAME = darwin + +# Compiler and flags +CC = cc +CXX = cc +CFLAGS = -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \ + -I/usr/X11R6/include -O3 -fPIC -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin +CXXFLAGS = -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk \ + -I/usr/X11R6/include -O3 -fPIC -fno-common -ffast-math -funroll-loops -fexpensive-optimizations -no-cpp-precomp -dynamic -Ddarwin + +MKLIB_OPTIONS = -archopt "-isysroot /Developer/SDKs/MacOSX10.4u.sdk" + +# Library names (actual file names) +GL_LIB_NAME = libGL.dylib +GLU_LIB_NAME = libGLU.dylib +GLUT_LIB_NAME = libglut.dylib +GLW_LIB_NAME = libGLw.dylib +OSMESA_LIB_NAME = libOSMesa.dylib + +GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread +OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lGL +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lGL +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lGL -lGLU -L/usr/X11R6/lib -lX11 -lXmu -lXi -lXext +GLW_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXt $(TOP)/lib/GL.dylib +APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm + +# omit glw lib for now: +SRC_DIRS = gallium mesa glu glut/glx glew + diff --git a/mesalib/configs/default b/mesalib/configs/default new file mode 100644 index 000000000..2168b29e3 --- /dev/null +++ b/mesalib/configs/default @@ -0,0 +1,148 @@ +# Default/template configuration + +# This is included by other config files which may override some +# of these variables. +# Think of this as a base class from which configs are derived. + + +CONFIG_NAME = default + +# Version info +MESA_MAJOR=7 +MESA_MINOR=6 +MESA_TINY=0 +MESA_VERSION = $(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY) + +# external projects. This should be useless now that we use libdrm. +DRM_SOURCE_PATH=$(TOP)/../drm + +# Compiler and flags +CC = cc +CXX = CC +HOST_CC = $(CC) +CFLAGS = -O +CXXFLAGS = -O +LDFLAGS = +HOST_CFLAGS = $(CFLAGS) +GLU_CFLAGS = + +# Compiler for building demos/tests/etc +APP_CC = $(CC) +APP_CXX = $(CXX) + +# Misc tools and flags +SHELL = /bin/sh +MKLIB = $(SHELL) $(TOP)/bin/mklib +MKLIB_OPTIONS = +MKDEP = makedepend +MKDEP_OPTIONS = -fdepend +MAKE = make + +# Use MINSTALL for installing libraries, INSTALL for everything else +MINSTALL = $(SHELL) $(TOP)/bin/minstall +INSTALL = $(MINSTALL) + +# Tools for regenerating glapi (generally only needed by the developers) +PYTHON2 = python +PYTHON_FLAGS = -t -O -O +INDENT = indent +INDENT_FLAGS = -i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool + +# Library names (base name) +GL_LIB = GL +GLU_LIB = GLU +GLUT_LIB = glut +GLEW_LIB = GLEW +GLW_LIB = GLw +OSMESA_LIB = OSMesa + + +# Library names (actual file names) +GL_LIB_NAME = lib$(GL_LIB).so +GLU_LIB_NAME = lib$(GLU_LIB).so +GLUT_LIB_NAME = lib$(GLUT_LIB).so +GLEW_LIB_NAME = lib$(GLEW_LIB).a +GLW_LIB_NAME = lib$(GLW_LIB).so +OSMESA_LIB_NAME = lib$(OSMESA_LIB).so + +# globs used to install the lib and all symlinks +GL_LIB_GLOB = $(GL_LIB_NAME)* +GLU_LIB_GLOB = $(GLU_LIB_NAME)* +GLUT_LIB_GLOB = $(GLUT_LIB_NAME)* +GLW_LIB_GLOB = $(GLW_LIB_NAME)* +OSMESA_LIB_GLOB = $(OSMESA_LIB_NAME)* + +# Optional assembly language optimization files for libGL +MESA_ASM_SOURCES = + +# GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in +# order to build the Motif widget too) +GLW_SOURCES = GLwDrawA.c +MOTIF_CFLAGS = -I/usr/include/Motif1.2 + + +# Directories to build +LIB_DIR = lib +SRC_DIRS = mesa gallium egl gallium/winsys glu glut/glx glew glw +GLU_DIRS = sgi +DRIVER_DIRS = x11 osmesa +# Which subdirs under $(TOP)/progs/ to enter: +PROGRAM_DIRS = demos redbook samples glsl xdemos + +# EGL directories +EGL_DRIVERS_DIRS = demo + +# Gallium directories and +GALLIUM_DIRS = auxiliary drivers state_trackers +GALLIUM_AUXILIARY_DIRS = rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices +GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a) +GALLIUM_DRIVERS_DIRS = softpipe i915simple failover trace identity +GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) +GALLIUM_WINSYS_DIRS = xlib egl_xlib +GALLIUM_WINSYS_DRM_DIRS = +GALLIUM_STATE_TRACKERS_DIRS = glx + + +# Library dependencies +#EXTRA_LIB_PATH ?= +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread +EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -ldl -lpthread +OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) +GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm +GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm +GLW_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11 +APP_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm + +# Program dependencies - specific GL/glut libraries added in Makefiles +APP_LIB_DEPS = -lm + + +# Installation directories (for make install) +INSTALL_DIR = /usr/local +INSTALL_LIB_DIR = $(INSTALL_DIR)/$(LIB_DIR) +INSTALL_INC_DIR = $(INSTALL_DIR)/include +DRI_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/dri + +# Where libGL will look for DRI hardware drivers +DRI_DRIVER_SEARCH_DIR = $(DRI_DRIVER_INSTALL_DIR) + +# Xorg driver install directory (for xorg state-tracker) +XORG_DRIVER_INSTALL_DIR = $(INSTALL_LIB_DIR)/xorg/modules/drivers + +# pkg-config substitutions +GL_PC_REQ_PRIV = +GL_PC_LIB_PRIV = +GL_PC_CFLAGS = +DRI_PC_REQ_PRIV = +GLU_PC_REQ = gl +GLU_PC_REQ_PRIV = +GLU_PC_LIB_PRIV = +GLU_PC_CFLAGS = +GLUT_PC_REQ_PRIV = +GLUT_PC_LIB_PRIV = +GLUT_PC_CFLAGS = +GLW_PC_REQ_PRIV = +GLW_PC_LIB_PRIV = +GLW_PC_CFLAGS = +OSMESA_PC_REQ = +OSMESA_PC_LIB_PRIV = diff --git a/mesalib/configs/freebsd b/mesalib/configs/freebsd new file mode 100644 index 000000000..976ddd19e --- /dev/null +++ b/mesalib/configs/freebsd @@ -0,0 +1,31 @@ +# Configuration for FreeBSD + +include $(TOP)/configs/default + +CONFIG_NAME = FreeBSD + +# Compiler and flags +CC = cc +CXX = c++ +MAKE = gmake + +OPT_FLAGS = -O2 +PIC_FLAGS = -fPIC + +DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM \ + -DHZ=100 + +X11_INCLUDES = -I/usr/local/include + +CFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES) -ffast-math -pedantic + +CXXFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES) + +GLUT_CFLAGS = -fexceptions + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +EXTRA_LIB_PATH = -L/usr/local/lib +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) $(EXTRA_LIB_PATH) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm diff --git a/mesalib/configs/freebsd-dri b/mesalib/configs/freebsd-dri new file mode 100644 index 000000000..0ec25f916 --- /dev/null +++ b/mesalib/configs/freebsd-dri @@ -0,0 +1,55 @@ +# -*-makefile-*- +# Configuration for freebsd-dri: FreeBSD DRI hardware drivers + +include $(TOP)/configs/freebsd + +CONFIG_NAME = freebsd-dri + +# Compiler and flags +CC = gcc +CXX = g++ +WARN_FLAGS = -Wall +OPT_FLAGS = -O -g + +EXPAT_INCLUDES = -I/usr/local/include +X11_INCLUDES = -I/usr/local/include +DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \ + -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \ + -DHAVE_ALIAS + +CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) -Wmissing-prototypes -std=c99 -Wundef -ffast-math \ + $(ASM_FLAGS) $(X11_INCLUDES) $(DEFINES) + +CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) -Wall -ansi -pedantic $(ASM_FLAGS) $(X11_INCLUDES) + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +ASM_SOURCES = +MESA_ASM_SOURCES = + +# Library/program dependencies +LIBDRM_CFLAGS = `pkg-config --cflags libdrm` +LIBDRM_LIB = `pkg-config --libs libdrm` +DRI_LIB_DEPS = -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB) +GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ + -lm -pthread $(LIBDRM_LIB) + +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11 + + +# Directories +SRC_DIRS = glx/x11 gallium mesa glu glut/glx glew glw +DRIVER_DIRS = dri +PROGRAM_DIRS = +WINDOW_SYSTEM=dri + +DRM_SOURCE_PATH=$(TOP)/../drm + +# ffb and gamma are missing because they have not been converted to use the new +# interface. +DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \ + unichrome savage sis + diff --git a/mesalib/configs/freebsd-dri-amd64 b/mesalib/configs/freebsd-dri-amd64 new file mode 100644 index 000000000..bb6c36139 --- /dev/null +++ b/mesalib/configs/freebsd-dri-amd64 @@ -0,0 +1,10 @@ +# -*-makefile-*- +# Configuration for freebsd-dri-amd64: FreeBSD DRI hardware drivers + +include $(TOP)/configs/freebsd-dri + +CONFIG_NAME = freebsd-dri-x86-64 + +ASM_FLAGS = -DUSE_X86_64_ASM +MESA_ASM_SOURCES = $(X86-64_SOURCES) +GLAPI_ASM_SOURCES = $(X86-64_API) diff --git a/mesalib/configs/freebsd-dri-x86 b/mesalib/configs/freebsd-dri-x86 new file mode 100644 index 000000000..9475437fc --- /dev/null +++ b/mesalib/configs/freebsd-dri-x86 @@ -0,0 +1,13 @@ +# -*-makefile-*- +# Configuration for freebsd-dri: FreeBSD DRI hardware drivers + +include $(TOP)/configs/freebsd-dri + +CONFIG_NAME = freebsd-dri-x86 + +# Unnecessary on x86, generally. +PIC_FLAGS = + +ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM +MESA_ASM_SOURCES = $(X86_SOURCES) +GLAPI_ASM_SOURCES = $(X86_API) diff --git a/mesalib/configs/hpux10 b/mesalib/configs/hpux10 new file mode 100644 index 000000000..9ec08c0bb --- /dev/null +++ b/mesalib/configs/hpux10 @@ -0,0 +1,14 @@ +# Configuration for HPUX v10, shared libs + +include $(TOP)/configs/default + +CONFIG_NAME = hpux10 + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = -O +DAportable +z -Ae -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM +CXXFLAGS = -O +DAportable +Z -Ae -D_HPUX_SOURCE + +APP_LIB_DEPS = -$(TOP)/$(LIB_DIR) -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm diff --git a/mesalib/configs/hpux10-gcc b/mesalib/configs/hpux10-gcc new file mode 100644 index 000000000..be396f854 --- /dev/null +++ b/mesalib/configs/hpux10-gcc @@ -0,0 +1,20 @@ +# Configuration for HPUX v10, with gcc + +include $(TOP)/configs/default + +CONFIG_NAME = hpux10-gcc + +# Compiler and flags +CC = gcc +CXX = g++ + +CFLAGS = -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM +CXXFLAGS = -ansi -O3 -D_HPUX_SOURCE +GLUT_CFLAGS = -fexceptions + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm + diff --git a/mesalib/configs/hpux10-static b/mesalib/configs/hpux10-static new file mode 100644 index 000000000..6101a4ece --- /dev/null +++ b/mesalib/configs/hpux10-static @@ -0,0 +1,30 @@ +# Configuration for HPUX v10, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = hpux10-static + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = -O +DAportable +z -Ae -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM +CXXFLAGS = -O +DAportable +Z -Ae -D_HPUX_SOURCE + +MKLIB_OPTIONS = -static + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies (static libs don't have dependencies) +GL_LIB_DEPS = +OSMESA_LIB_DEPS = +GLU_LIB_DEPS = +GLUT_LIB_DEPS = +GLW_LIB_DEPS = +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lpthread -lm -lstdc++ +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm -lstdc++ diff --git a/mesalib/configs/hpux11-32 b/mesalib/configs/hpux11-32 new file mode 100644 index 000000000..035ef796d --- /dev/null +++ b/mesalib/configs/hpux11-32 @@ -0,0 +1,30 @@ +# Configuration for HPUX v11 + +include $(TOP)/configs/default + +CONFIG_NAME = hpux11-32 + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = +z -Ae -O +Onolimit -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM -DPTHREADS + +CXXFLAGS = +z -Ae -O +Onolimit -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DPTHREADS + +MKLIB_OPTIONS = + + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) +GL_LIB_DEPS = -L/usr/lib/X11R6/ -L/usr/contrib/X11R6/lib/ -lXext -lXt -lXi -lX11 -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCsup -lcl +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(GL_LIB_DEPS) +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(GL_LIB_DEPS) diff --git a/mesalib/configs/hpux11-32-static b/mesalib/configs/hpux11-32-static new file mode 100644 index 000000000..b8e843618 --- /dev/null +++ b/mesalib/configs/hpux11-32-static @@ -0,0 +1,27 @@ +# Configuration for HPUX v11, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = hpux11-32-static + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = -O +DA2.0 -Ae -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM -DPTHREADS + +CXXFLAGS = -O +DA2.0 -Ae -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DPTHREADS + +MKLIB_OPTIONS = -static + + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/lib/X11R6/ -L/usr/contrib/X11R6/lib/ -lXext -lXmu -lXt -lXi -lX11 -lm -lpthread -lCsup -lcl + diff --git a/mesalib/configs/hpux11-32-static-nothreads b/mesalib/configs/hpux11-32-static-nothreads new file mode 100644 index 000000000..cba166a08 --- /dev/null +++ b/mesalib/configs/hpux11-32-static-nothreads @@ -0,0 +1,26 @@ +# Configuration for HPUX v11, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = hpux11-32-static + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = -O +DA2.0 -Ae -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM + +CXXFLAGS = -O +DA2.0 -Ae -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include + +MKLIB_OPTIONS = -static + + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies +APP_LIB_DEPS = -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm diff --git a/mesalib/configs/hpux11-64 b/mesalib/configs/hpux11-64 new file mode 100644 index 000000000..3833c07c6 --- /dev/null +++ b/mesalib/configs/hpux11-64 @@ -0,0 +1,31 @@ +# Configuration for HPUX v11, 64-bit + +include $(TOP)/configs/default + +CONFIG_NAME = hpux11-64 + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = +z -Ae +DD64 -O +Onolimit -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM -DPTHREADS + +CXXFLAGS = +z -Ae +DD64 -O +Onolimit -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DPTHREADS + +MKLIB_OPTIONS = + +LIB_DIR = lib64 + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) +GL_LIB_DEPS = -L/usr/lib/X11R6/pa20_64 -L/usr/contrib/X11R6/lib/pa20_64 -lXext -lXmu -lXt -lXi -lX11 -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCsup -lcl +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(GL_LIB_DEPS) +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(GL_LIB_DEPS) diff --git a/mesalib/configs/hpux11-64-static b/mesalib/configs/hpux11-64-static new file mode 100644 index 000000000..32944f928 --- /dev/null +++ b/mesalib/configs/hpux11-64-static @@ -0,0 +1,27 @@ +# Configuration for HPUX v11, 64-bit, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = hpux11-64-static + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = -O +DA2.0W -Ae -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM -DPTHREADS + +CXXFLAGS = -O +DA2.0W -Ae -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DPTHREADS + +MKLIB_OPTIONS = -static + +LIB_DIR = lib64 + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/lib/X11R6/pa20_64 -L/usr/contrib/X11R6/lib/pa20_64 -lXext -lXmu -lXt -lXi -lX11 -lm -lpthread -lCsup -lcl diff --git a/mesalib/configs/hpux11-ia64 b/mesalib/configs/hpux11-ia64 new file mode 100644 index 000000000..b94560baf --- /dev/null +++ b/mesalib/configs/hpux11-ia64 @@ -0,0 +1,30 @@ +# Configuration for HPUX IA64 v11, 64-bit + +include $(TOP)/configs/default + +CONFIG_NAME = hpux11-ia64 + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = +z -Ae +DD64 -O +DSmckinley -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM -DPTHREADS + +CXXFLAGS = +z -Ae +DD64 -O +DSmckinley -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DPTHREADS + +MKLIB_OPTIONS = + +LIB_DIR = lib64 + +# Library names (actual file names) +GL_LIB_NAME = libGL.so +GLU_LIB_NAME = libGLU.so +GLUT_LIB_NAME = libglut.so +GLW_LIB_NAME = libGLw.so +OSMESA_LIB_NAME = libOSMesa.so + +# Library/program dependencies +GL_LIB_DEPS = -L/usr/lib/X11R6/ -L/usr/contrib/X11R6/lib/ -lXext -lXmu -lXt -lXi -lX11 -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCsup -lcl +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(GL_LIB_DEPS) +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(GL_LIB_DEPS) diff --git a/mesalib/configs/hpux11-ia64-static b/mesalib/configs/hpux11-ia64-static new file mode 100644 index 000000000..e094c9f87 --- /dev/null +++ b/mesalib/configs/hpux11-ia64-static @@ -0,0 +1,27 @@ +# Configuration for HPUX v11, 64-bit, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = hpux11-ia64-static + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = -O +DD64 -Ae -D_HPUX_SOURCE +DSmckinley -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM -DPTHREADS + +CXXFLAGS = -O +DD64 -Ae -D_HPUX_SOURCE +DSmckinley -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DPTHREADS + +MKLIB_OPTIONS = -static + +LIB_DIR = lib64 + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lXt -lX11 -lpthread -lm -lCsup -lcl diff --git a/mesalib/configs/hpux9 b/mesalib/configs/hpux9 new file mode 100644 index 000000000..d0105e5c8 --- /dev/null +++ b/mesalib/configs/hpux9 @@ -0,0 +1,16 @@ +# Configuration for HPUX v9, shared libs + +include $(TOP)/configs/default + +CONFIG_NAME = hpux9 + +# Compiler and flags +CC = cc +# XXX fix this +CXX = c++ + +CFLAGS = +z -O +Olibcalls +ESlit -Ae +Onolimit -D_HPUX_SOURCE -I/usr/include/X11R5 -DUSE_XSHM +CXXFLAGS = +z -O +Olibcalls +ESlit -Ae +Onolimit -D_HPUX_SOURCE -I/usr/include/X11R5 + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/lib/X11R5 -s -Wl,+s,-B,nonfatal,-B,immediate -lXext -lXmu -lXi -lX11 -lm + diff --git a/mesalib/configs/hpux9-gcc b/mesalib/configs/hpux9-gcc new file mode 100644 index 000000000..df3042056 --- /dev/null +++ b/mesalib/configs/hpux9-gcc @@ -0,0 +1,14 @@ +# Configuration for HPUX v10, shared libs + +include $(TOP)/configs/default + +CONFIG_NAME = hpux9-gcc + +# Compiler and flags +CC = cc +CXX = aCC + +CFLAGS = -O +DAportable +z -Ae -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM +CXXFLAGS = -O +DAportable +Z -Ae -D_HPUX_SOURCE + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm diff --git a/mesalib/configs/irix6-64 b/mesalib/configs/irix6-64 new file mode 100644 index 000000000..aae6d78ea --- /dev/null +++ b/mesalib/configs/irix6-64 @@ -0,0 +1,17 @@ +# Configuration for IRIX 6.x, make n64 DSOs + +include $(TOP)/configs/default + +CONFIG_NAME = irix6-64 + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -64 -O3 -ansi -woff 1068,1069,1174,1185,1209,1474,1552 -DUSE_XSHM -DPTHREADS +CXXFLAGS = -64 -O3 -ansi -woff 1174 -DPTHREADS + +GLW_SOURCES = GLwDrawA.c GLwMDrawA.c + +LIB_DIR = lib64 + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -64 -rpath $(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lpthread -lm diff --git a/mesalib/configs/irix6-64-static b/mesalib/configs/irix6-64-static new file mode 100644 index 000000000..ea9dabcc0 --- /dev/null +++ b/mesalib/configs/irix6-64-static @@ -0,0 +1,26 @@ +# Configuration for IRIX 6.x, make n64 static libs + +include $(TOP)/configs/default + +CONFIG_NAME = irix6-64-static + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -64 -O3 -ansi -woff 1068,1069,1174,1185,1209,1474,1552 -DUSE_XSHM -DPTHREADS +CXXFLAGS = -64 -O3 -ansi -woff 1174 -DPTHREADS +MKLIB_OPTIONS = -static + +GLW_SOURCES = GLwDrawA.c GLwMDrawA.c + +LIB_DIR = lib64 + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -64 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lpthread -lm -lC + +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + + diff --git a/mesalib/configs/irix6-n32 b/mesalib/configs/irix6-n32 new file mode 100644 index 000000000..8a7817343 --- /dev/null +++ b/mesalib/configs/irix6-n32 @@ -0,0 +1,17 @@ +# Configuration for IRIX 6.x, make n32 DSOs + +include $(TOP)/configs/default + +CONFIG_NAME = irix6-n32 + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -n32 -mips3 -O3 -ansi -woff 1174,1521,1552 -DUSE_XSHM -DPTHREADS +CXXFLAGS = -n32 -mips3 -O3 -ansi -woff 1174,1552 -DPTHREADS + +GLW_SOURCES = GLwDrawA.c GLwMDrawA.c + +LIB_DIR = lib32 + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -n32 -rpath $(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lfpe -lpthread -lm diff --git a/mesalib/configs/irix6-n32-static b/mesalib/configs/irix6-n32-static new file mode 100644 index 000000000..fe47ccdcb --- /dev/null +++ b/mesalib/configs/irix6-n32-static @@ -0,0 +1,25 @@ +# Configuration for IRIX 6.x, make n32 static libs + +include $(TOP)/configs/default + +CONFIG_NAME = irix6-n32-static + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -n32 -mips2 -O2 -ansi -woff 1521,1552 -DUSE_XSHM -DPTHREADS +CXXFLAGS = -n32 -mips2 -O2 -ansi -woff 3262,3666 -DPTHREADS +MKLIB_OPTIONS = -static + +GLW_SOURCES = GLwDrawA.c GLwMDrawA.c + +LIB_DIR = lib32 + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -n32 -glut -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lpthread -lm -lC + +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + diff --git a/mesalib/configs/irix6-o32 b/mesalib/configs/irix6-o32 new file mode 100644 index 000000000..1e4c8c53e --- /dev/null +++ b/mesalib/configs/irix6-o32 @@ -0,0 +1,18 @@ +# Configuration for IRIX 6.x, make o32 DSOs + +include $(TOP)/configs/default + +CONFIG_NAME = irix6-o32 + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -32 -mips2 -O2 -ansi -woff 1521,1552 -DUSE_XSHM +CXXFLAGS = -32 -mips2 -O2 -ansi -woff 3262,3666 + +GLW_SOURCES = GLwDrawA.c GLwMDrawA.c + +LIB_DIR = lib32 + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -32 -rpath $(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lm + diff --git a/mesalib/configs/irix6-o32-static b/mesalib/configs/irix6-o32-static new file mode 100644 index 000000000..2d265df98 --- /dev/null +++ b/mesalib/configs/irix6-o32-static @@ -0,0 +1,25 @@ +# Configuration for IRIX 6.x, make o32 static libs + +include $(TOP)/configs/default + +CONFIG_NAME = irix6-o32-static + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -32 -mips2 -O2 -ansi -woff 1521,1552 -DUSE_XSHM +CXXFLAGS = -32 -mips2 -O2 -ansi -woff 3262,3666 +MKLIB_OPTIONS = -static + +GLW_SOURCES = GLwDrawA.c GLwMDrawA.c + +LIB_DIR = lib32 + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -32 -glut -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lm -lC + +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + diff --git a/mesalib/configs/linux b/mesalib/configs/linux new file mode 100644 index 000000000..73a6b61b2 --- /dev/null +++ b/mesalib/configs/linux @@ -0,0 +1,38 @@ +# Configuration for generic Linux + +include $(TOP)/configs/default + +CONFIG_NAME = linux + +# Compiler and flags +CC = gcc +CXX = g++ + +OPT_FLAGS = -O3 -g +PIC_FLAGS = -fPIC + +# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. Add -m32 +# to build properly on 64-bit platforms. + +ARCH_FLAGS ?= + +DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE \ + -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN + +X11_INCLUDES = -I/usr/X11R6/include + +CFLAGS = -Wall -Wmissing-prototypes -Wdeclaration-after-statement \ + $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \ + $(DEFINES) $(ASM_FLAGS) $(X11_INCLUDES) -std=c99 -ffast-math + +CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ + $(X11_INCLUDES) + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +GLUT_CFLAGS = -fexceptions + +EXTRA_LIB_PATH = -L/usr/X11R6/lib diff --git a/mesalib/configs/linux-alpha b/mesalib/configs/linux-alpha new file mode 100644 index 000000000..65bf0c2ab --- /dev/null +++ b/mesalib/configs/linux-alpha @@ -0,0 +1,22 @@ +# Configuration for Linux on Alpha + +include $(TOP)/configs/default + +CONFIG_NAME = linux-alpha + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -fPIC -D_XOPEN_SOURCE -DUSE_XSHM +CXXFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -fPIC -D_XOPEN_SOURCE +GLUT_CFLAGS = -fexceptions + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm + diff --git a/mesalib/configs/linux-alpha-static b/mesalib/configs/linux-alpha-static new file mode 100644 index 000000000..53808d77c --- /dev/null +++ b/mesalib/configs/linux-alpha-static @@ -0,0 +1,31 @@ +# Configuration for Linux on Alpha, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = linux-alpha-static + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -D_XOPEN_SOURCE -DUSE_XSHM +CXXFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -D_XOPEN_SOURCE +GLUT_CFLAGS = -fexceptions +MKLIB_OPTIONS = -static +PIC_FLAGS = + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + + +GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -L/usr/X11R6/lib -lX11 -lm diff --git a/mesalib/configs/linux-cell b/mesalib/configs/linux-cell new file mode 100644 index 000000000..19d435fec --- /dev/null +++ b/mesalib/configs/linux-cell @@ -0,0 +1,67 @@ +# linux-cell (non-debug build) + +include $(TOP)/configs/default + +CONFIG_NAME = linux-cell + + +# Omiting other gallium drivers: +GALLIUM_DRIVERS_DIRS = cell softpipe trace + + +# Compiler and flags +CC = ppu32-gcc +CXX = ppu32-g++ +HOST_CC = gcc +APP_CC = gcc +APP_CXX = g++ + +OPT_FLAGS = -O3 + +# Cell SDK location +## For SDK 2.1: (plus, remove -DSPU_MAIN_PARAM_LONG_LONG below) +#SDK = /opt/ibm/cell-sdk/prototype/sysroot/usr +## For SDK 3.0: +SDK = /opt/cell/sdk/usr + + +CFLAGS = $(OPT_FLAGS) -Wall -Winline -Wmissing-prototypes \ + -fPIC -m32 -std=c99 -mabi=altivec -maltivec \ + -I. -I$(SDK)/include \ + -DGALLIUM_CELL -DUSE_XSHM -D_BSD_SOURCE -D_SVID_SOURCE + +CXXFLAGS = $(CFLAGS) + +# Omitting glw here: +SRC_DIRS = gallium mesa gallium/winsys glu glut/glx glew + +# Build no traditional Mesa drivers: +DRIVER_DIRS = + + +MKDEP_OPTIONS = -fdepend -Y + + +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread \ + -L$(SDK)/lib -m32 -Wl,-m,elf32ppc -R$(SDK)/lib -lspe2 + + +CELL_SPU_LIB = $(TOP)/src/gallium/drivers/cell/spu/g3d_spu.a + + +### SPU stuff + +SPU_CC = spu-gcc + +SPU_CFLAGS = $(OPT_FLAGS) -W -Wall -Winline -Wmissing-prototypes -Wno-main \ + -I. -I$(SDK)/spu/include -I$(TOP)/src/mesa/ $(INCLUDE_DIRS) \ + -DSPU_MAIN_PARAM_LONG_LONG \ + -include spu_intrinsics.h + +SPU_LFLAGS = -L$(SDK)/spu/lib -Wl,-N -lmisc -lm + +SPU_AR = ppu-ar +SPU_AR_FLAGS = -qcs + +SPU_EMBED = ppu32-embedspu +SPU_EMBED_FLAGS = -m32 diff --git a/mesalib/configs/linux-cell-debug b/mesalib/configs/linux-cell-debug new file mode 100644 index 000000000..42f3245ed --- /dev/null +++ b/mesalib/configs/linux-cell-debug @@ -0,0 +1,10 @@ +# linux-cell-debug + +include $(TOP)/configs/linux-cell + +# just override name and OPT_FLAGS here: + +CONFIG_NAME = linux-cell-debug + +OPT_FLAGS = -g -DDEBUG + diff --git a/mesalib/configs/linux-debug b/mesalib/configs/linux-debug new file mode 100644 index 000000000..bc6d2336f --- /dev/null +++ b/mesalib/configs/linux-debug @@ -0,0 +1,8 @@ +# Configuration for debugging on Linux + +include $(TOP)/configs/linux + +CONFIG_NAME = linux-debug + +OPT_FLAGS = -g -ansi -pedantic +DEFINES += -DDEBUG -DDEBUG_MATH diff --git a/mesalib/configs/linux-directfb b/mesalib/configs/linux-directfb new file mode 100644 index 000000000..9ae3de96d --- /dev/null +++ b/mesalib/configs/linux-directfb @@ -0,0 +1,38 @@ +# Configuration for DirectFB + +include $(TOP)/configs/default + +CONFIG_NAME = linux-directfb + +# Compiler and flags +CC = gcc +CXX = g++ + +CFLAGS = -Wall -O3 -ffast-math -fPIC -std=c99 -D_GNU_SOURCE -D_POSIX_SOURCE -D_SVID_SOURCE \ + -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DPTHREADS + +CXXFLAGS = -Wall -O3 -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +HAVE_X86 = $(shell uname -m | grep 'i[3-6]86' >/dev/null && echo yes) +ifeq ($(HAVE_X86), yes) + CFLAGS += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM + CXXFLAGS += -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM + MESA_ASM_SOURCES = $(X86_SOURCES) + GLAPI_ASM_SOURCES = $(X86_API) +endif + +# Directories +SRC_DIRS = gallium mesa glu glut/directfb glew +GLU_DIRS = sgi +DRIVER_DIRS = directfb +PROGRAM_DIRS = demos directfb + +# Library/program dependencies +GL_LIB_DEPS = -lm -lpthread +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -l$(GLU_LIB) +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -l$(GLU_LIB) -l$(GLUT_LIB) + diff --git a/mesalib/configs/linux-dri b/mesalib/configs/linux-dri new file mode 100644 index 000000000..0998ba854 --- /dev/null +++ b/mesalib/configs/linux-dri @@ -0,0 +1,67 @@ +# -*-makefile-*- +# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others + +include $(TOP)/configs/default + +CONFIG_NAME = linux-dri + +# Compiler and flags +CC = gcc +CXX = g++ + +#MKDEP = /usr/X11R6/bin/makedepend +#MKDEP = gcc -M +#MKDEP_OPTIONS = -MF depend + +OPT_FLAGS = -O2 -g +PIC_FLAGS = -fPIC + +# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. +ARCH_FLAGS ?= + +DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE \ + -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \ + -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \ + -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN + +X11_INCLUDES = -I/usr/X11R6/include + +CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \ + $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS) + +CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) + +GLUT_CFLAGS = -fexceptions + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +MESA_ASM_SOURCES = + +# Library/program dependencies +EXTRA_LIB_PATH=-L/usr/X11R6/lib + +LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm) +LIBDRM_LIB = $(shell pkg-config --libs libdrm) +DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ + -lm -lpthread -ldl $(LIBDRM_LIB) + + +# Directories +SRC_DIRS := glx/x11 egl $(SRC_DIRS) +PROGRAM_DIRS := egl $(PROGRAM_DIRS) + +# EGL directories +EGL_DRIVERS_DIRS = demo glx + +DRIVER_DIRS = dri +WINDOW_SYSTEM = dri +GALLIUM_WINSYS_DIRS = drm +GALLIUM_WINSYS_DRM_DIRS = intel +GALLIUM_STATE_TRACKERS_DIRS = egl + +DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \ + savage sis tdfx trident unichrome ffb swrast diff --git a/mesalib/configs/linux-dri-debug b/mesalib/configs/linux-dri-debug new file mode 100644 index 000000000..c3a458459 --- /dev/null +++ b/mesalib/configs/linux-dri-debug @@ -0,0 +1,16 @@ +# -*-makefile-*- +# Configuration for linux-dri-debug: Linux DRI hardware drivers for XFree86 & others + +include $(TOP)/configs/linux-dri + +CONFIG_NAME = linux-dri-debug +OPT_FLAGS = -O0 -g +ARCH_FLAGS = -DDEBUG + +# Helpful to reduce the amount of stuff that gets built sometimes: +#DRI_DIRS = i915tex i915 +#DRI_DIRS = i965 +#DRI_DIRS = radeon r200 r300 +#DRI_DIRS = unichrome sis trident +#DRI_DIRS = i810 mga r128 tdfx + diff --git a/mesalib/configs/linux-dri-ppc b/mesalib/configs/linux-dri-ppc new file mode 100644 index 000000000..a3a3ca83c --- /dev/null +++ b/mesalib/configs/linux-dri-ppc @@ -0,0 +1,17 @@ +# -*-makefile-*- +# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others + +include $(TOP)/configs/linux-dri + +CONFIG_NAME = linux-dri-ppc + +OPT_FLAGS = -Os -mcpu=603 +PIC_FLAGS = -fPIC + +ASM_FLAGS = -DUSE_PPC_ASM -DUSE_VMX_ASM +MESA_ASM_SOURCES = $(PPC_SOURCES) + +# Build only the drivers for cards that exist on PowerPC. At some point MGA +# will be added, but not yet. +DRI_DIRS = mach64 r128 r200 r300 radeon tdfx + diff --git a/mesalib/configs/linux-dri-x86 b/mesalib/configs/linux-dri-x86 new file mode 100644 index 000000000..4e7d45d35 --- /dev/null +++ b/mesalib/configs/linux-dri-x86 @@ -0,0 +1,13 @@ +# -*-makefile-*- +# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others + +include $(TOP)/configs/linux-dri + +CONFIG_NAME = linux-dri-x86 + +ARCH_FLAGS = -m32 -mmmx -msse -msse2 + +ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM +MESA_ASM_SOURCES = $(X86_SOURCES) +GLAPI_ASM_SOURCES = $(X86_API) + diff --git a/mesalib/configs/linux-dri-x86-64 b/mesalib/configs/linux-dri-x86-64 new file mode 100644 index 000000000..ceab05d5d --- /dev/null +++ b/mesalib/configs/linux-dri-x86-64 @@ -0,0 +1,24 @@ +# -*-makefile-*- +# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others + +include $(TOP)/configs/linux-dri + +CONFIG_NAME = linux-dri-x86-64 + +ARCH_FLAGS = -m64 + +ASM_FLAGS = -DUSE_X86_64_ASM +MESA_ASM_SOURCES = $(X86-64_SOURCES) +GLAPI_ASM_SOURCES = $(X86-64_API) + +LIB_DIR = lib64 + +# Library/program dependencies +EXTRA_LIB_PATH=-L/usr/X11R6/lib64 + +# ffb, gamma, and sis are missing because they have not be converted to use +# the new interface. i810 are missing because there is no x86-64 +# system where they could *ever* be used. +# +DRI_DIRS = i915 i965 mach64 mga r128 r200 r300 radeon savage tdfx unichrome + diff --git a/mesalib/configs/linux-dri-xcb b/mesalib/configs/linux-dri-xcb new file mode 100644 index 000000000..e9c15a82e --- /dev/null +++ b/mesalib/configs/linux-dri-xcb @@ -0,0 +1,72 @@ +# -*-makefile-*- +# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others + +include $(TOP)/configs/default + +CONFIG_NAME = linux-dri-xcb + +# Compiler and flags +CC = gcc +CXX = g++ + +#MKDEP = /usr/X11R6/bin/makedepend +#MKDEP = gcc -M +#MKDEP_OPTIONS = -MF depend + +OPT_FLAGS = -g +PIC_FLAGS = -fPIC + +# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. +ARCH_FLAGS ?= + +DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE \ + -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \ + -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \ + -DHAVE_ALIAS -DUSE_XCB -DHAVE_POSIX_MEMALIGN + +X11_INCLUDES = $(shell pkg-config --cflags-only-I x11) $(shell pkg-config --cflags-only-I xcb) $(shell pkg-config --cflags-only-I x11-xcb) $(shell pkg-config --cflags-only-I xcb-glx) + +CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \ + $(DEFINES) $(ASM_FLAGS) -std=c99 -ffast-math + +CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +MESA_ASM_SOURCES = + +# Library/program dependencies +EXTRA_LIB_PATH=$(shell pkg-config --libs-only-L x11) + +LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm) +LIBDRM_LIB = $(shell pkg-config --libs libdrm) +DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \ + $(LIBDRM_LIB) $(shell pkg-config --libs xcb) $(shell pkg-config --libs x11-xcb) $(shell pkg-config --libs xcb-glx) + + +# This is now 0 by default since it seems to confuse the hell out of people +# and generate a lot of extra noise on bugzilla. If you need to build with +# EGL, do 'make linux-dri USING_EGL=1' + +USING_EGL=0 + +# Directories +ifeq ($(USING_EGL), 1) +SRC_DIRS = egl glx/x11 gallium mesa glu glut/glx glew glw +PROGRAM_DIRS = egl +else +SRC_DIRS = glx/x11 gallium mesa glu glut/glx glew glw +PROGRAM_DIRS = xdemos +endif + +DRIVER_DIRS = dri +WINDOW_SYSTEM=dri + +# gamma are missing because they have not been converted to use the new +# interface. +DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon s3v \ + savage sis tdfx trident unichrome ffb diff --git a/mesalib/configs/linux-egl b/mesalib/configs/linux-egl new file mode 100644 index 000000000..e906806f4 --- /dev/null +++ b/mesalib/configs/linux-egl @@ -0,0 +1,65 @@ +# -*-makefile-*- +# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others + +include $(TOP)/configs/default + +CONFIG_NAME = linux-dri + +# Compiler and flags +CC = gcc +CXX = g++ + +#MKDEP = /usr/X11R6/bin/makedepend +#MKDEP = gcc -M +#MKDEP_OPTIONS = -MF depend + +OPT_FLAGS = -O -g +PIC_FLAGS = -fPIC + +# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. +ARCH_FLAGS ?= + +DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE \ + -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \ + -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \ + -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN + +X11_INCLUDES = -I/usr/X11R6/include + +CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \ + $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS) + +CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) + + +MESA_ASM_SOURCES = + +# Library/program dependencies +EXTRA_LIB_PATH=-L/usr/X11R6/lib + +LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm) +LIBDRM_LIB = $(shell pkg-config --libs libdrm) +DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ + -lm -lpthread -ldl \ + $(LIBDRM_LIB) + + +# This is now 0 by default since it seems to confuse the hell out of people +# and generate a lot of extra noise on bugzilla. If you need to build with +# EGL, do 'make linux-dri USING_EGL=1' + +USING_EGL=0 + +# Directories +SRC_DIRS = gallium mesa gallium/winsys glu egl +PROGRAM_DIRS = egl + +DRIVER_DIRS = dri +WINDOW_SYSTEM = dri +GALLIUM_WINSYS_DIRS = egl_drm + +# gamma are missing because they have not been converted to use the new +# interface. +DRI_DIRS = intel diff --git a/mesalib/configs/linux-fbdev b/mesalib/configs/linux-fbdev new file mode 100644 index 000000000..0b03c33af --- /dev/null +++ b/mesalib/configs/linux-fbdev @@ -0,0 +1,19 @@ +# Configuration for Linux fbdev interface + +include $(TOP)/configs/linux + +CONFIG_NAME = linux-fbdev + +CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing + +SRC_DIRS = gallium mesa glu glut/fbdev glew +DRIVER_DIRS = fbdev osmesa +PROGRAM_DIRS = fbdev demos redbook samples + +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread +OSMESA_LIB_DEPS = -lm -lpthread +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lgpm -lm + diff --git a/mesalib/configs/linux-glide b/mesalib/configs/linux-glide new file mode 100644 index 000000000..31475c81d --- /dev/null +++ b/mesalib/configs/linux-glide @@ -0,0 +1,23 @@ +# Configuration for generic Linux with 3Dfx Glide driver + +include $(TOP)/configs/default + +CONFIG_NAME = linux-glide + +# Compiler and flags +CC = gcc +CXX = g++ + +CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DFX -I/usr/include/glide -I/usr/local/glide/include +CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +GLUT_CFLAGS = -fexceptions + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +# Library/program dependencies +GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -L/usr/local/glide/lib -lglide3x -lm -lpthread +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/local/glide/lib -lglide3x -lm diff --git a/mesalib/configs/linux-ia64-icc b/mesalib/configs/linux-ia64-icc new file mode 100644 index 000000000..bd1189775 --- /dev/null +++ b/mesalib/configs/linux-ia64-icc @@ -0,0 +1,21 @@ +# Configuration for Linux with Intel C compiler + +include $(TOP)/configs/default + +CONFIG_NAME = linux-icc + +# Compiler and flags +CC = icc +CXX = icpc +CFLAGS = -O3 -ansi -KPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include +CXXFLAGS = -O3 -ansi -KPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include +GLUT_CFLAGS = -fexceptions +MKLIB_OPTIONS = -arch icc-istatic + +GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(GL_LIB_DEPS) +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) + + diff --git a/mesalib/configs/linux-ia64-icc-static b/mesalib/configs/linux-ia64-icc-static new file mode 100644 index 000000000..ce8daf1d7 --- /dev/null +++ b/mesalib/configs/linux-ia64-icc-static @@ -0,0 +1,27 @@ +# Configuration for Linux with Intel C compiler, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = linux-icc-static + +# Compiler and flags +CC = icc +CXX = icpc +CFLAGS = -O3 -ansi -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include +CXXFLAGS = -O3 -ansi -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include +GLUT_CFLAGS = -fexceptions +MKLIB_OPTIONS = -static -arch icc-istatic + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +GL_LIB_DEPS = +GLU_LIB_DEPS = +GLUT_LIB_DEPS = +GLW_LIB_DEPS = +APP_LIB_DEPS = -i-static -cxxlib-icc -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lpthread -lm -lcxa -lunwind + diff --git a/mesalib/configs/linux-icc b/mesalib/configs/linux-icc new file mode 100644 index 000000000..d90a1dab3 --- /dev/null +++ b/mesalib/configs/linux-icc @@ -0,0 +1,22 @@ +# Configuration for Linux with Intel C compiler + +include $(TOP)/configs/default + +CONFIG_NAME = linux-icc + +# Compiler and flags +CC = icc +CXX = g++ +CFLAGS = -O3 -tpp6 -axK -KPIC -D_GCC_LIMITS_H_ -D__GNUC__ -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -I/usr/X11R6/include +CXXFLAGS = -O3 +GLUT_CFLAGS = -fexceptions +MKLIB_OPTIONS = -arch icc + +GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm + +MESA_ASM_SOURCES = $(X86_SOURCES) +GLAPI_ASM_SOURCES = $(X86_API) + + diff --git a/mesalib/configs/linux-icc-static b/mesalib/configs/linux-icc-static new file mode 100644 index 000000000..384db3bfe --- /dev/null +++ b/mesalib/configs/linux-icc-static @@ -0,0 +1,27 @@ +# Configuration for Linux with Intel C compiler, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = linux-icc-static + +# Compiler and flags +CC = icc +CXX = icpc +CFLAGS = -O3 -tpp6 -axK -D_GCC_LIMITS_H_ -D__GNUC__ -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -I/usr/X11R6/include +CXXFLAGS = -O3 -tpp6 -axK -DPTHREADS +GLUT_CFLAGS = -fexceptions +MKLIB_OPTIONS = -static -arch icc + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +GL_LIB_DEPS = +GLUT_LIB_DEPS = +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm -lpthread -lcxa -lunwind + +MESA_ASM_SOURCES = $(X86_SOURCES) +GLAPI_ASM_SOURCES = $(X86_API) diff --git a/mesalib/configs/linux-indirect b/mesalib/configs/linux-indirect new file mode 100644 index 000000000..4b81383c0 --- /dev/null +++ b/mesalib/configs/linux-indirect @@ -0,0 +1,53 @@ +# -*-makefile-*- +# Configuration for linux-indirect: Builds a libGL capable of indirect +# rendering, but *NOT* capable of direct rendering. + +include $(TOP)/configs/default + +CONFIG_NAME = linux-dri + +# Compiler and flags +CC = gcc +CXX = g++ + +#MKDEP = /usr/X11R6/bin/makedepend +#MKDEP = gcc -M +#MKDEP_OPTIONS = -MF depend + +WARN_FLAGS = -Wall +OPT_FLAGS = -O -g +PIC_FLAGS = -fPIC + +# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. +ARCH_FLAGS ?= + +DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE \ + -DGLX_INDIRECT_RENDERING \ + -DPTHREADS -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN + +X11_INCLUDES = -I/usr/X11R6/include + +CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ + $(ASM_FLAGS) -std=c99 -ffast-math + +CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +MESA_ASM_SOURCES = + +# Library/program dependencies +EXTRA_LIB_PATH=-L/usr/X11R6/lib + +DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl + + +# Directories +SRC_DIRS = glx/x11 glu glut/glx glew glw +DRIVER_DIRS = +PROGRAM_DIRS = +WINDOW_SYSTEM=dri diff --git a/mesalib/configs/linux-llvm b/mesalib/configs/linux-llvm new file mode 100644 index 000000000..19b53cc54 --- /dev/null +++ b/mesalib/configs/linux-llvm @@ -0,0 +1,42 @@ +# -*-makefile-*- +# Configuration for Linux and LLVM with debugging info +# Builds the llvmpipe gallium driver + +include $(TOP)/configs/linux + +CONFIG_NAME = linux-llvm + +#GALLIUM_AUXILIARY_DIRS += gallivm + +# Add llvmpipe driver +GALLIUM_DRIVERS_DIRS += llvmpipe + +OPT_FLAGS = -g -ansi -pedantic +DEFINES += -DDEBUG -DDEBUG_MATH -DGALLIUM_LLVMPIPE -DHAVE_UDIS86 + +# override -std=c99 +CFLAGS += -std=gnu99 + +LLVM_VERSION := $(shell llvm-config --version) + +ifeq ($(LLVM_VERSION),) + $(warning Could not find LLVM! Make Sure 'llvm-config' is in the path) + MESA_LLVM=0 +else + MESA_LLVM=1 +# $(info Using LLVM version: $(LLVM_VERSION)) +endif + +ifeq ($(MESA_LLVM),1) +# LLVM_CFLAGS=`llvm-config --cflags` + LLVM_CXXFLAGS=`llvm-config --cxxflags backend bitreader engine ipo interpreter instrumentation` -Wno-long-long + LLVM_LDFLAGS = $(shell llvm-config --ldflags backend bitreader engine ipo interpreter instrumentation) + LLVM_LIBS = $(shell llvm-config --libs backend bitreader engine ipo interpreter instrumentation) + MKLIB_OPTIONS=-cplusplus +else + LLVM_CFLAGS= + LLVM_CXXFLAGS= +endif + +LD = g++ +GL_LIB_DEPS = $(LLVM_LDFLAGS) $(LLVM_LIBS) $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread -lstdc++ -ludis86 diff --git a/mesalib/configs/linux-osmesa b/mesalib/configs/linux-osmesa new file mode 100644 index 000000000..c112642f8 --- /dev/null +++ b/mesalib/configs/linux-osmesa @@ -0,0 +1,28 @@ +# Configuration for building only libOSMesa on Linux, no Xlib driver +# This doesn't really have any Linux dependencies, so it should be usable +# on other (gcc-based) systems. + +include $(TOP)/configs/default + +CONFIG_NAME = linux-osmesa + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS +CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +# Directories +SRC_DIRS = gallium mesa glu +DRIVER_DIRS = osmesa +PROGRAM_DIRS = osdemos + + +# Dependencies +OSMESA_LIB_DEPS = -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB) +APP_LIB_DEPS = -lm -lpthread diff --git a/mesalib/configs/linux-osmesa-static b/mesalib/configs/linux-osmesa-static new file mode 100644 index 000000000..a03e63eb7 --- /dev/null +++ b/mesalib/configs/linux-osmesa-static @@ -0,0 +1,37 @@ +# Configuration for building static libOSMesa.a on Linux, no Xlib driver +# This doesn't really have any Linux dependencies, so it should be usable +# on other (gcc-based) systems. + +include $(TOP)/configs/default + +CONFIG_NAME = linux-osmesa + +# Compiler and flags +CC = gcc -m32 +CXX = g++ -m32 +CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS +CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE + +MKLIB_OPTIONS = -static + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Directories +SRC_DIRS = mesa glu +DRIVER_DIRS = osmesa +PROGRAM_DIRS = osdemos + + +# Dependencies +GL_LIB_DEPS = +OSMESA_LIB_DEPS = +GLU_LIB_DEPS = +GLUT_LIB_DEPS = +GLW_LIB_DEPS = +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \ + $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm diff --git a/mesalib/configs/linux-osmesa16 b/mesalib/configs/linux-osmesa16 new file mode 100644 index 000000000..b3c8da099 --- /dev/null +++ b/mesalib/configs/linux-osmesa16 @@ -0,0 +1,31 @@ +# Configuration for 16 bits/channel OSMesa library on Linux + +include $(TOP)/configs/default + +CONFIG_NAME = linux-osmesa16 + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31 +CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +# Library names +OSMESA_LIB = OSMesa16 +OSMESA_LIB_NAME = libOSMesa16.so + + +# Directories +SRC_DIRS = gallium mesa glu +DRIVER_DIRS = osmesa +PROGRAM_DIRS = + + +# Dependencies +OSMESA_LIB_DEPS = -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB) +APP_LIB_DEPS = -lm -lpthread diff --git a/mesalib/configs/linux-osmesa16-static b/mesalib/configs/linux-osmesa16-static new file mode 100644 index 000000000..146aeb85a --- /dev/null +++ b/mesalib/configs/linux-osmesa16-static @@ -0,0 +1,32 @@ +# Configuration for 16 bits/channel OSMesa library on Linux + +include $(TOP)/configs/default + +CONFIG_NAME = linux-osmesa16-static + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O3 -ansi -pedantic -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31 +CXXFLAGS = -O3 -ansi -pedantic -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +MKLIB_OPTIONS = -static +PIC_FLAGS = + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +# Library names +OSMESA_LIB = OSMesa16 +OSMESA_LIB_NAME = libOSMesa16.a + + +# Directories +SRC_DIRS = gallium mesa glu +DRIVER_DIRS = osmesa +PROGRAM_DIRS = + + +# Dependencies +OSMESA_LIB_DEPS = -lm -lpthread +APP_LIB_DEPS = -lm -lpthread diff --git a/mesalib/configs/linux-osmesa32 b/mesalib/configs/linux-osmesa32 new file mode 100644 index 000000000..5804ef8e5 --- /dev/null +++ b/mesalib/configs/linux-osmesa32 @@ -0,0 +1,31 @@ +# Configuration for 32 bits/channel OSMesa library on Linux + +include $(TOP)/configs/default + +CONFIG_NAME = linux-osmesa32 + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=32 -DDEFAULT_SOFTWARE_DEPTH_BITS=31 +CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +# Library names +OSMESA_LIB = OSMesa32 +OSMESA_LIB_NAME = libOSMesa32.so + + +# Directories +SRC_DIRS = gallium mesa glu +DRIVER_DIRS = osmesa +PROGRAM_DIRS = + + +# Dependencies +OSMESA_LIB_DEPS = -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB) +APP_LIB_DEPS = -lm -lpthread diff --git a/mesalib/configs/linux-ppc b/mesalib/configs/linux-ppc new file mode 100644 index 000000000..13cfdeb42 --- /dev/null +++ b/mesalib/configs/linux-ppc @@ -0,0 +1,9 @@ +# Configuration for Linux on PPC + +include $(TOP)/configs/linux + +CONFIG_NAME = linux-ppc + +OPT_FLAGS = -O3 -mcpu=603 -fsigned-char -funroll-loops + +# FIXME: Use of PowerPC assembly should be enabled here. \ No newline at end of file diff --git a/mesalib/configs/linux-ppc-static b/mesalib/configs/linux-ppc-static new file mode 100644 index 000000000..3f3dc5564 --- /dev/null +++ b/mesalib/configs/linux-ppc-static @@ -0,0 +1,15 @@ +# Configuration for Linux on PPC, static libs + +include $(TOP)/configs/linux-ppc + +CONFIG_NAME = linux-ppc-static + +MKLIB_OPTIONS = -static +PIC_FLAGS = + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a diff --git a/mesalib/configs/linux-profile b/mesalib/configs/linux-profile new file mode 100644 index 000000000..e3895dd8b --- /dev/null +++ b/mesalib/configs/linux-profile @@ -0,0 +1,8 @@ +# Configuration for profiling on Linux with gprof + +include $(TOP)/configs/linux-static + +CONFIG_NAME = linux-profile + +OPT_FLAGS = -pg -g -O2 +DEFINES += -DNDEBUG diff --git a/mesalib/configs/linux-solo b/mesalib/configs/linux-solo new file mode 100644 index 000000000..247a2d489 --- /dev/null +++ b/mesalib/configs/linux-solo @@ -0,0 +1,54 @@ +# Configuration for linux-solo: Linux DRI hardware drivers for fbdev + +include $(TOP)/configs/default + +CONFIG_NAME = linux-solo + +# Compiler and flags +CC = gcc +CXX = g++ + +WARN_FLAGS = -Wall -Wundef +OPT_FLAGS = -O3 -g +PIC_FLAGS = -fPIC + +# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support. +ARCH_FLAGS ?= + +# DRM and pciaccess +LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm) +LIBDRM_LIB = $(shell pkg-config --libs libdrm) +PCIACCESS_CFLAGS = $(shell pkg-config --cflags pciaccess) +PCIACCESS_LIB = $(shell pkg-config --libs pciaccess) + + +DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \ + -D_BSD_SOURCE -D_GNU_SOURCE -DHAVE_POSIX_MEMALIGN \ + -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \ + -DHAVE_ALIAS + +CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ + $(ASM_FLAGS) -std=c99 -ffast-math + +CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +MESA_ASM_SOURCES = + +# Library/program dependencies +DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(TOP)/$(LIB_DIR) $(PCIACCESS_LIB) +GL_LIB_DEPS = -lm -lpthread -ldl +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lpthread + +# Directories +SRC_DIRS = glx/mini gallium mesa glu glut/mini glew +DRIVER_DIRS = dri +PROGRAM_DIRS = miniglx + +#DRI_DIRS = ffb gamma sis savage tdfx unichrome fb +DRI_DIRS = i810 i915tex i915 mach64 mga r128 r200 radeon diff --git a/mesalib/configs/linux-solo-ia64 b/mesalib/configs/linux-solo-ia64 new file mode 100644 index 000000000..b2051fac8 --- /dev/null +++ b/mesalib/configs/linux-solo-ia64 @@ -0,0 +1,7 @@ +# Configuration for linux-solo-ia64: Linux DRI hardware drivers for fbdev + +include $(TOP)/configs/linux-solo + +CONFIG_NAME = linux-solo-ia64 + +DRI_DIRS = fb mach64 mga r128 r200 radeon sis tdfx unichrome diff --git a/mesalib/configs/linux-solo-x86 b/mesalib/configs/linux-solo-x86 new file mode 100644 index 000000000..a9bf38826 --- /dev/null +++ b/mesalib/configs/linux-solo-x86 @@ -0,0 +1,10 @@ +# -*-makefile-*- +# Configuration for linux-solo-x86: Linux hardware drivers for fbdev for x86 + +include $(TOP)/configs/linux-solo + +CONFIG_NAME = linux-solo-x86 + +ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM +MESA_ASM_SOURCES = $(X86_SOURCES) +GLAPI_ASM_SOURCES = $(X86_API) diff --git a/mesalib/configs/linux-sparc b/mesalib/configs/linux-sparc new file mode 100644 index 000000000..346d438c2 --- /dev/null +++ b/mesalib/configs/linux-sparc @@ -0,0 +1,9 @@ +# Configuration for Linux on Sparc + +include $(TOP)/configs/linux + +CONFIG_NAME = linux-sparc + +#ASM_FLAGS = -DUSE_SPARC_ASM +#MESA_ASM_SOURCES = $(SPARC_SOURCES) +#GLAPI_ASM_SOURCES = $(SPARC_API) diff --git a/mesalib/configs/linux-sparc5 b/mesalib/configs/linux-sparc5 new file mode 100644 index 000000000..e8848d26a --- /dev/null +++ b/mesalib/configs/linux-sparc5 @@ -0,0 +1,7 @@ +# Configuration for Linux on Sparc5 + +include $(TOP)/configs/linux-sparc + +CONFIG_NAME = linux-sparc5 + +ARCH_FLAGS += -mcpu=ultrasparc diff --git a/mesalib/configs/linux-static b/mesalib/configs/linux-static new file mode 100644 index 000000000..907904bda --- /dev/null +++ b/mesalib/configs/linux-static @@ -0,0 +1,26 @@ +# Configuration for generic Linux, making static libs + +include $(TOP)/configs/linux + +CONFIG_NAME = linux-static + +MKLIB_OPTIONS = -static +PIC_FLAGS = + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies (static libs don't have dependencies) +GL_LIB_DEPS = +OSMESA_LIB_DEPS = +GLU_LIB_DEPS = +GLUT_LIB_DEPS = +GLW_LIB_DEPS = + +# Need to specify all libraries we may need +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) \ + -l$(GL_LIB) -lm -L/usr/X11R6/lib/ -lX11 -lXext -lXmu -lXi -lpthread diff --git a/mesalib/configs/linux-ultrasparc b/mesalib/configs/linux-ultrasparc new file mode 100644 index 000000000..d6c838ed9 --- /dev/null +++ b/mesalib/configs/linux-ultrasparc @@ -0,0 +1,7 @@ +# Configuration for Linux on UltraSparc + +include $(TOP)/configs/linux-sparc + +CONFIG_NAME = linux-ultrasparc + +ARCH_FLAGS += -mv8 -mtune=ultrasparc diff --git a/mesalib/configs/linux-x86 b/mesalib/configs/linux-x86 new file mode 100644 index 000000000..5970b185c --- /dev/null +++ b/mesalib/configs/linux-x86 @@ -0,0 +1,11 @@ +# Configuration for Linux with x86 optimizations + +include $(TOP)/configs/linux + +CONFIG_NAME = linux-x86 + +ARCH_FLAGS = -m32 -mmmx -msse -msse2 + +ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM +MESA_ASM_SOURCES = $(X86_SOURCES) +GLAPI_ASM_SOURCES = $(X86_API) diff --git a/mesalib/configs/linux-x86-32 b/mesalib/configs/linux-x86-32 new file mode 100644 index 000000000..f18ce7a45 --- /dev/null +++ b/mesalib/configs/linux-x86-32 @@ -0,0 +1,7 @@ +# To build Linux x86 32-bit in an x86-64 environment + +include $(TOP)/configs/linux-x86 + +CONFIG_NAME = linux-x86-32 + +ARCH_FLAGS += -m32 diff --git a/mesalib/configs/linux-x86-64 b/mesalib/configs/linux-x86-64 new file mode 100644 index 000000000..c2441e09d --- /dev/null +++ b/mesalib/configs/linux-x86-64 @@ -0,0 +1,14 @@ +# Configuration for Linux for 64-bit X86 (Opteron) + +include $(TOP)/configs/linux + +CONFIG_NAME = linux-x86-64 + +ARCH_FLAGS = -m64 + +MESA_ASM_SOURCES = $(X86-64_SOURCES) +GLAPI_ASM_SOURCES = $(X86-64_API) +ASM_FLAGS = -DUSE_X86_64_ASM + +LIB_DIR = lib64 +EXTRA_LIB_PATH = -L/usr/X11R6/lib64 diff --git a/mesalib/configs/linux-x86-64-debug b/mesalib/configs/linux-x86-64-debug new file mode 100644 index 000000000..6f631c0e8 --- /dev/null +++ b/mesalib/configs/linux-x86-64-debug @@ -0,0 +1,8 @@ +# Configuration for Linux for 64-bit X86 (Opteron) + +include $(TOP)/configs/linux-x86-64 + +CONFIG_NAME = linux-x86-64-debug + +OPT_FLAGS = -g +DEFINES += -DDEBUG -DDEBUG_MATH diff --git a/mesalib/configs/linux-x86-64-profile b/mesalib/configs/linux-x86-64-profile new file mode 100644 index 000000000..6eb9c6844 --- /dev/null +++ b/mesalib/configs/linux-x86-64-profile @@ -0,0 +1,8 @@ +# Configuration for profiling on Linux for 64-bit X86 (Opteron) with gprof + +include $(TOP)/configs/linux-x86-64-static + +CONFIG_NAME = linux-x86-64-profile + +OPT_FLAGS = -pg -g -O2 +DEFINES += -DNDEBUG diff --git a/mesalib/configs/linux-x86-64-static b/mesalib/configs/linux-x86-64-static new file mode 100644 index 000000000..626d579ac --- /dev/null +++ b/mesalib/configs/linux-x86-64-static @@ -0,0 +1,27 @@ +# Configuration for Linux for 64-bit X86 (Opteron), static libs + +include $(TOP)/configs/linux-x86-64 + +CONFIG_NAME = linux-x86-64-static + +MKLIB_OPTIONS = -static +PIC_FLAGS = + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies (static libs don't have dependencies) +GL_LIB_DEPS = +OSMESA_LIB_DEPS = +GLU_LIB_DEPS = +GLUT_LIB_DEPS = +GLW_LIB_DEPS = + +# Need to specify all libraries we may need +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \ + -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group \ + $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm diff --git a/mesalib/configs/linux-x86-debug b/mesalib/configs/linux-x86-debug new file mode 100644 index 000000000..d35012ffa --- /dev/null +++ b/mesalib/configs/linux-x86-debug @@ -0,0 +1,9 @@ +# Configuration for Linux with x86 code, but no gcc optimizations and +# debugging enabled. + +include $(TOP)/configs/linux-x86 + +CONFIG_NAME = linux-x86-debug + +OPT_FLAGS = -g +DEFINES += -DDEBUG -DDEBUG_MATH diff --git a/mesalib/configs/linux-x86-glide b/mesalib/configs/linux-x86-glide new file mode 100644 index 000000000..603b2bf75 --- /dev/null +++ b/mesalib/configs/linux-x86-glide @@ -0,0 +1,28 @@ +# Configuration for Linux with 3Dfx Glide driver and x86 optimizations + +include $(TOP)/configs/default + +CONFIG_NAME = linux-x86-glide + +# Compiler and flags +CC = gcc +CXX = g++ + +CFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -I/usr/X11R6/include -DFX -I/usr/include/glide -I/usr/local/glide/include + +CXXFLAGS = -Wall -O3 -ansi -pedantic -fPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE + +GLUT_CFLAGS = -fexceptions + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +MESA_ASM_SOURCES = $(X86_SOURCES) +GLAPI_ASM_SOURCES = $(X86_API) + +# Library/program dependencies +GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -L/usr/local/glide/lib -lglide3x -lm -lpthread +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/local/glide/lib -lglide3x -lm diff --git a/mesalib/configs/linux-x86-profile b/mesalib/configs/linux-x86-profile new file mode 100644 index 000000000..987b5f0cf --- /dev/null +++ b/mesalib/configs/linux-x86-profile @@ -0,0 +1,8 @@ +# Configuration for profiling on Linux with x86 optimizations with gprof + +include $(TOP)/configs/linux-x86-static + +CONFIG_NAME = linux-x86-profile + +OPT_FLAGS = -pg -g -O2 +DEFINES += -DNDEBUG diff --git a/mesalib/configs/linux-x86-static b/mesalib/configs/linux-x86-static new file mode 100644 index 000000000..16c8731c1 --- /dev/null +++ b/mesalib/configs/linux-x86-static @@ -0,0 +1,26 @@ +# Configuration for Linux with x86 optimizations, static libs + +include $(TOP)/configs/linux-x86 + +CONFIG_NAME = linux-x86-static + +MKLIB_OPTIONS = -static +PIC_FLAGS = + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies (static libs don't have dependencies) +GL_LIB_DEPS = +OSMESA_LIB_DEPS = +GLU_LIB_DEPS = +GLUT_LIB_DEPS = +GLW_LIB_DEPS = + +# Need to specify all libraries we may need +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) \ + -l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm diff --git a/mesalib/configs/netbsd b/mesalib/configs/netbsd new file mode 100644 index 000000000..aec456950 --- /dev/null +++ b/mesalib/configs/netbsd @@ -0,0 +1,17 @@ +# Configuration for NetBSD + +include $(TOP)/configs/default + +CONFIG_NAME = netbsd + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O2 -fPIC -DUSE_XSHM -I/usr/X11R6/include -DHZ=100 +CXXFLAGS = -O2 -fPIC +GLUT_CFLAGS = -fexceptions +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing diff --git a/mesalib/configs/openbsd b/mesalib/configs/openbsd new file mode 100644 index 000000000..bd19fa84d --- /dev/null +++ b/mesalib/configs/openbsd @@ -0,0 +1,22 @@ +# Configuration for OpenBSD + +include $(TOP)/configs/default + +CONFIG_NAME = openbsd + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O2 -fPIC -I/usr/X11R6/include -DUSE_XSHM -DHZ=100 +CXXFLAGS = -O2 -fPIC -I/usr/X11R6/include -DHZ=100 + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm +OSMESA_LIB_DEPS = -lm +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lm +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm + diff --git a/mesalib/configs/osf1 b/mesalib/configs/osf1 new file mode 100644 index 000000000..88a2ecc73 --- /dev/null +++ b/mesalib/configs/osf1 @@ -0,0 +1,16 @@ +# Configuration for OSF/1 + +include $(TOP)/configs/default + +CONFIG_NAME = osf1 + +# Compiler and flags +CC = cc +CXX = cxx +CFLAGS = -O0 -std1 -ieee_with_no_inexact -DUSE_XSHM -DPTHREADS -D_REENTRANT +CXXFLAGS = -O2 -std ansi -ieee -DPTHREADS -D_REENTRANT + +GL_LIB_DEPS = -lX11 -lXext -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXt -lXi -lm +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lpthread -lm diff --git a/mesalib/configs/osf1-static b/mesalib/configs/osf1-static new file mode 100644 index 000000000..e00f7ce01 --- /dev/null +++ b/mesalib/configs/osf1-static @@ -0,0 +1,17 @@ +# Configuration for OSF/1 + +include $(TOP)/configs/default + +CONFIG_NAME = osf1 + +# Compiler and flags +CC = cc +CXX = cxx +CFLAGS = -O2 -std1 -ieee_with_no_inexact -DUSE_XSHM -DPTHREADS -D_REENTRANT +CXXFLAGS = -O2 -std ansi -ieee -DPTHREADS -D_REENTRANT +MKLIB_OPTIONS = -static + +GL_LIB_DEPS = +GLU_LIB_DEPS = +GLUT_LIB_DEPS = +APP_LIB_DEPS = -noso -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -so_archive -lX11 -lXext -lXmu -lXi -lpthread -lm -lcxx diff --git a/mesalib/configs/solaris-x86 b/mesalib/configs/solaris-x86 new file mode 100644 index 000000000..a5a7a63fa --- /dev/null +++ b/mesalib/configs/solaris-x86 @@ -0,0 +1,18 @@ +# Configuration for Solaris on x86 + +include $(TOP)/configs/default + +CONFIG_NAME = solaris-x86 + +# Compiler and flags +CC = cc +CFLAGS = -Xa -xO3 -xpentium -KPIC -I/usr/openwin/include -DUSE_XSHM +MKLIB_OPTIONS = -static + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm -lglut -lGLU -lGL + +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a diff --git a/mesalib/configs/solaris-x86-gcc b/mesalib/configs/solaris-x86-gcc new file mode 100644 index 000000000..616bfdfd7 --- /dev/null +++ b/mesalib/configs/solaris-x86-gcc @@ -0,0 +1,21 @@ +# Configuration for Solaris on x86 with gcc, dynamic libs + +include $(TOP)/configs/default + +CONFIG_NAME = solaris-x86-gcc + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O3 -march=i486 -fPIC -I/usr/openwin/include -DUSE_XSHM +CXXFLAGS = -O3 -march=i486 -fPIC +GLUT_CFLAGS = -fexceptions + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +GL_LIB_DEPS = -L/usr/openwin/lib -lX11 -lXext -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lX11 -lXmu -lXt -lXi -lm +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/openwin/lib -R/usr/openwin/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lX11 -lXext -lXi -lXmu diff --git a/mesalib/configs/solaris-x86-gcc-static b/mesalib/configs/solaris-x86-gcc-static new file mode 100644 index 000000000..4850284a5 --- /dev/null +++ b/mesalib/configs/solaris-x86-gcc-static @@ -0,0 +1,28 @@ +# Configuration for Solaris on x86 with gcc, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = solaris-x86-gcc + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -O3 -march=i486 -fPIC -I/usr/openwin/include -DUSE_XSHM +CXXFLAGS = -O3 -march=i486 -fPIC +GLUT_CFLAGS = -fexceptions +MKLIB_OPTIONS = -static + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +GL_LIB_DEPS = -L/usr/openwin/lib -lX11 -lXext -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lX11 -lXmu -lXt -lXi -lm +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/openwin/lib -R/usr/openwin/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lX11 -lXext -lXi -lXmu + +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a diff --git a/mesalib/configs/sunos4 b/mesalib/configs/sunos4 new file mode 100644 index 000000000..9e6627dc0 --- /dev/null +++ b/mesalib/configs/sunos4 @@ -0,0 +1,12 @@ +# Configuration for SunOS 4, shared libs + +include $(TOP)/configs/default + +CONFIG_NAME = sunos4 + +# Compiler and flags +CC = acc +CFLAGS = -Kpic -O -I/usr/include/X11R5 -DUSE_XSHM -DSUNOS4 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/lib/X11R5 -lX11 -lXext -lXmu -lXi -lm + + diff --git a/mesalib/configs/sunos4-gcc b/mesalib/configs/sunos4-gcc new file mode 100644 index 000000000..094229158 --- /dev/null +++ b/mesalib/configs/sunos4-gcc @@ -0,0 +1,19 @@ +# Configuration for SunOS 4, with gcc, shared libs + +include $(TOP)/configs/default + +CONFIG_NAME = sunos4-gcc + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -fPIC -O3 -I/usr/openwin/include -I/usr/include/X11R5 -I/usr/include/X11R5 -DUSE_XSHM -DSUNOS4 +CXXFLAGS = -fPIC -O3 -I/usr/openwin/include -DSUNOS4 +GLUT_CFLAGS = -fexceptions -DSOLARIS_2_4_BUG + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm + diff --git a/mesalib/configs/sunos4-static b/mesalib/configs/sunos4-static new file mode 100644 index 000000000..9135fa7df --- /dev/null +++ b/mesalib/configs/sunos4-static @@ -0,0 +1,25 @@ +# Configuration for SunOS 4, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = sunos4-static + +# Compiler and flags +CC = acc +CFLAGS = -O -DUSE_XSHM -DSUNOS4 +MKLIB_OPTIONS = -static + +# Library names (actual file names) +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +# Library/program dependencies (static libs don't have dependencies) +GL_LIB_DEPS = +OSMESA_LIB_DEPS = +GLU_LIB_DEPS = +GLUT_LIB_DEPS = +GLW_LIB_DEPS = +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lpthread -lm diff --git a/mesalib/configs/sunos5 b/mesalib/configs/sunos5 new file mode 100644 index 000000000..6dd7539c6 --- /dev/null +++ b/mesalib/configs/sunos5 @@ -0,0 +1,18 @@ +# Configuration for SunOS 5 + +include $(TOP)/configs/default + +CONFIG_NAME = sunos5 + +# Compiler and flags +CC = cc +CXX = c++ +CFLAGS = -KPIC -Xa -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM +CXXFLAGS = -KPIC -Xa -O -I/usr/openwin/include -I/usr/dt/include +GLUT_CFLAGS = -DSOLARIS_2_4_BUG + +GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lCrun -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm diff --git a/mesalib/configs/sunos5-64-gcc b/mesalib/configs/sunos5-64-gcc new file mode 100644 index 000000000..c03903f8c --- /dev/null +++ b/mesalib/configs/sunos5-64-gcc @@ -0,0 +1,11 @@ +# Configuration for 64-bit SunOS 5, with gcc + +include $(TOP)/configs/sunos5-gcc + +CONFIG_NAME = sunos5-64-gcc + +# only set vars that differ from sunos5-gcc config + +OPT_FLAGS = -O3 -m64 -mcpu=ultrasparc -mv8plus -mvis -g -fomit-frame-pointer -pipe + +ARCH_FLAGS = -m64 diff --git a/mesalib/configs/sunos5-gcc b/mesalib/configs/sunos5-gcc new file mode 100644 index 000000000..571ff24a2 --- /dev/null +++ b/mesalib/configs/sunos5-gcc @@ -0,0 +1,40 @@ +# Configuration for SunOS 5, with gcc + +include $(TOP)/configs/default + +CONFIG_NAME = sunos5-gcc + +# Compiler and flags +CC = gcc +CXX = g++ + +WARN_FLAGS = -Wall +OPT_FLAGS = -O3 -g -fomit-frame-pointer -pipe +PIC_FLAGS = -fPIC + +ARCH_FLAGS ?= + +DEFINES = -D_REENTRANT -DUSE_XSHM + +MESA_ASM_SOURCES = $(SPARC_SOURCES) +GLAPI_ASM_SOURCES = $(SPARC_API) +ASM_FLAGS = -DUSE_SPARC_ASM + +CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ + $(ASM_FLAGS) -std=c99 -ffast-math -I/usr/openwin/include + +CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \ + -I/usr/openwin/include + +GLUT_CFLAGS = -fexceptions -DSOLARIS_2_4_BUG + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +# Library/program dependencies +EXTRA_LIB_PATH=-L/usr/openwin/lib + +GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXi -lm +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm diff --git a/mesalib/configs/sunos5-smp b/mesalib/configs/sunos5-smp new file mode 100644 index 000000000..274080590 --- /dev/null +++ b/mesalib/configs/sunos5-smp @@ -0,0 +1,19 @@ +# Configuration for SunOS 5, SMP systems + +include $(TOP)/configs/default + +CONFIG_NAME = sunos5-smp + +# Compiler and flags +CC = cc +CXX = c++ +CFLAGS = -KPIC -Xa -native -fast -xO5 -xlibmil -xsafe=mem -xdepend -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG +CXXFLAGS = -KPIC -Xa -native -fast -xO5 -xlibmil -xsafe=mem -xdepend -I/usr/openwin/include -I/usr/dt/include +GLUT_CFLAGS = -DSOLARIS_2_4_BUG + +GL_LIB_DEPS = -L/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lCrun + diff --git a/mesalib/configs/sunos5-v8 b/mesalib/configs/sunos5-v8 new file mode 100644 index 000000000..cdaf3eee7 --- /dev/null +++ b/mesalib/configs/sunos5-v8 @@ -0,0 +1,18 @@ +# Configuration for SunOS 5 + +include $(TOP)/configs/default + +CONFIG_NAME = sunos5-v8 + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -xarch=v8 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS +CXXFLAGS = -xarch=v8 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS +GLUT_CFLAGS = -DSOLARIS_2_4_BUG + +GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCstd -lCrun +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm diff --git a/mesalib/configs/sunos5-v8-static b/mesalib/configs/sunos5-v8-static new file mode 100644 index 000000000..5e428b1a5 --- /dev/null +++ b/mesalib/configs/sunos5-v8-static @@ -0,0 +1,16 @@ +# Configuration for SunOS 5 + +include $(TOP)/configs/default + +CONFIG_NAME = sunos5-v8-static + +MKLIB_OPTIONS = -static + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -xarch=v8 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS +CXXFLAGS = -xarch=v8 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS +GLUT_CFLAGS = -DSOLARIS_2_4_BUG + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11 -lXext -lXmu -lXi -lpthread -lm -lCstd -lCrun diff --git a/mesalib/configs/sunos5-v9 b/mesalib/configs/sunos5-v9 new file mode 100644 index 000000000..ea2ab23e2 --- /dev/null +++ b/mesalib/configs/sunos5-v9 @@ -0,0 +1,23 @@ +# Configuration for SunOS 5, SPARC V9 + +include $(TOP)/configs/default + +CONFIG_NAME = sunos5-v9 + +MKLIB_OPTIONS = -cplusplus + +LIB_DIR = lib64 + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS +CXXFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS +GLUT_CFLAGS = -DSOLARIS_2_4_BUG + +GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCstd -lCrun +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm + diff --git a/mesalib/configs/sunos5-v9-cc-g++ b/mesalib/configs/sunos5-v9-cc-g++ new file mode 100644 index 000000000..8656251e3 --- /dev/null +++ b/mesalib/configs/sunos5-v9-cc-g++ @@ -0,0 +1,35 @@ +# Configuration for SunOS 5, SPARC V9 and cc/g++ (for C and C++ sources) + +include $(TOP)/configs/default + +CONFIG_NAME = sunos5-v9-cc-g++ + +MKLIB_OPTIONS = -cplusplus + +LIB_DIR = lib64 + +# Compiler and flags +CC = cc +CXX = g++ + +CXX_WARN_FLAGS = -Wall +CXX_PIC_FLAGS = -fPIC +CXX_OPT_FLAGS = -O3 -m64 -mcpu=ultrasparc -mv8plus -mvis -g -fomit-frame-pointer -pipe +CXX_ARCH_FLAGS = -m64 + + +CXXFLAGS = $(CXX_WARN_FLAGS) $(CXX_OPT_FLAGS) $(CXX_PIC_FLAGS) $(CXX_ARCH_FLAGS) $(DEFINES) \ + -I/usr/openwin/include + +# Work around aliasing bugs - developers should comment this out +CXXFLAGS += -fno-strict-aliasing + +CFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS +#CXXFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS +GLUT_CFLAGS = -DSOLARIS_2_4_BUG + +GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm -lpthread +GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCstd -lCrun +GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm +GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11 +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm diff --git a/mesalib/configs/sunos5-v9-static b/mesalib/configs/sunos5-v9-static new file mode 100644 index 000000000..4919570c7 --- /dev/null +++ b/mesalib/configs/sunos5-v9-static @@ -0,0 +1,18 @@ +# Configuration for SunOS 5, SPARC V9, static libs + +include $(TOP)/configs/default + +CONFIG_NAME = sunos5-v9-static + +MKLIB_OPTIONS = -static -cplusplus + +LIB_DIR = lib64 + +# Compiler and flags +CC = cc +CXX = CC +CFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS +CXXFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS +GLUT_CFLAGS = -DSOLARIS_2_4_BUG + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11 -lXext -lXmu -lXi -lpthread -lm -lCstd -lCrun diff --git a/mesalib/configs/ultrix-gcc b/mesalib/configs/ultrix-gcc new file mode 100644 index 000000000..455b6932d --- /dev/null +++ b/mesalib/configs/ultrix-gcc @@ -0,0 +1,25 @@ +# Configuration for Ultrix, with gcc + +include $(TOP)/configs/default + +CONFIG_NAME = ultrix-gcc + +# Compiler and flags +CC = gcc +CXX = g++ +CFLAGS = -pedantic -O2 +CXXFLAGS = -pedantic -O2 +GLUT_CFLAGS = -fexceptions +MKLIB_OPTIONS = -static + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +GL_LIB_NAME = libGL.a +GLU_LIB_NAME = libGLU.a +GLUT_LIB_NAME = libglut.a +GLW_LIB_NAME = libGLw.a +OSMESA_LIB_NAME = libOSMesa.a + +APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lXmu -lX11 -lXi -lm diff --git a/mesalib/configure b/mesalib/configure new file mode 100644 index 000000000..63d3ff32e --- /dev/null +++ b/mesalib/configure @@ -0,0 +1,9013 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.64 for Mesa 7.6.0. +# +# Report bugs to . +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software +# Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa +$0: about your system, including any error possibly output +$0: before this message. Then install a modern shell, or +$0: manually run the script under such a shell if you do +$0: have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with status $?, using 1 if that was 0. +as_fn_error () +{ + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + fi + $as_echo "$as_me: error: $1" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='Mesa' +PACKAGE_TARNAME='mesa' +PACKAGE_VERSION='7.6.0' +PACKAGE_STRING='Mesa 7.6.0' +PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa' +PACKAGE_URL='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +XORG_DRIVER_INSTALL_DIR +PROGRAM_DIRS +APP_LIB_DEPS +GLUT_PC_CFLAGS +GLUT_PC_LIB_PRIV +GLUT_PC_REQ_PRIV +GLUT_MESA_DEPS +GLUT_LIB_DEPS +GLUT_LIBS +GLUT_CFLAGS +GLW_PC_CFLAGS +GLW_PC_LIB_PRIV +GLW_PC_REQ_PRIV +MOTIF_CFLAGS +GLW_SOURCES +GLW_MESA_DEPS +GLW_LIB_DEPS +MOTIF_CONFIG +GLW_LIBS +GLW_CFLAGS +GLU_PC_CFLAGS +GLU_PC_LIB_PRIV +GLU_PC_REQ_PRIV +GLU_PC_REQ +GLU_MESA_DEPS +GLU_LIB_DEPS +EGL_LIB_DEPS +EGL_LIBS +EGL_CFLAGS +OSMESA_PC_LIB_PRIV +OSMESA_PC_REQ +OSMESA_MESA_DEPS +OSMESA_LIB_DEPS +OSMESA_LIB +DRI_LIB_DEPS +EXPAT_INCLUDES +DRI_DIRS +USING_EGL +DRI_DRIVER_INSTALL_DIR +DRI_PC_REQ_PRIV +GL_PC_CFLAGS +GL_PC_LIB_PRIV +GL_PC_REQ_PRIV +GL_LIB_DEPS +XCB_LIBS +XCB_CFLAGS +DRIGL_LIBS +DRIGL_CFLAGS +LIBDRM_RADEON_LIBS +LIBDRM_RADEON_CFLAGS +DRI2PROTO_LIBS +DRI2PROTO_CFLAGS +LIBDRM_LIBS +LIBDRM_CFLAGS +XLIBGL_LIBS +XLIBGL_CFLAGS +X_EXTRA_LIBS +X_LIBS +X_PRE_LIBS +X_CFLAGS +XMKMF +RADEON_LDFLAGS +RADEON_CFLAGS +GALLIUM_STATE_TRACKERS_DIRS +GALLIUM_AUXILIARY_DIRS +GALLIUM_DRIVERS_DIRS +GALLIUM_WINSYS_DRM_DIRS +GALLIUM_WINSYS_DIRS +GALLIUM_DIRS +WINDOW_SYSTEM +DRIVER_DIRS +GLU_DIRS +SRC_DIRS +EGREP +GREP +PIC_FLAGS +GLAPI_ASM_SOURCES +MESA_ASM_SOURCES +ASM_FLAGS +OSMESA_LIB_GLOB +GLW_LIB_GLOB +GLUT_LIB_GLOB +GLU_LIB_GLOB +GL_LIB_GLOB +OSMESA_LIB_NAME +GLW_LIB_NAME +GLUT_LIB_NAME +GLU_LIB_NAME +GL_LIB_NAME +MKLIB_OPTIONS +ARCH_FLAGS +OPT_FLAGS +DEFINES +X11_INCLUDES +EXTRA_LIB_PATH +LIB_DIR +PKG_CONFIG +MKDEP_OPTIONS +POSIX_SHELL +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +SED +MKDEP +MAKE +ac_ct_CXX +CXXFLAGS +CXX +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_32_bit +enable_64_bit +enable_static +enable_shared +enable_debug +enable_asm +enable_pic +enable_selinux +with_driver +with_demos +with_x +enable_xcb +enable_glx_tls +with_dri_driverdir +enable_driglx_direct +with_dri_drivers +with_expat +enable_gl_osmesa +with_osmesa_bits +enable_egl +enable_glu +enable_glw +enable_motif +enable_glut +enable_gallium +with_state_trackers +with_xorg_driver_dir +with_max_width +with_max_height +enable_gallium_intel +enable_gallium_radeon +enable_gallium_nouveau +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +CCC +PKG_CONFIG +EXTRA_LIB_PATH +X11_INCLUDES +OPT_FLAGS +ARCH_FLAGS +MKLIB_OPTIONS +PIC_FLAGS +XMKMF +XLIBGL_CFLAGS +XLIBGL_LIBS +LIBDRM_CFLAGS +LIBDRM_LIBS +DRI2PROTO_CFLAGS +DRI2PROTO_LIBS +LIBDRM_RADEON_CFLAGS +LIBDRM_RADEON_LIBS +DRIGL_CFLAGS +DRIGL_LIBS +XCB_CFLAGS +XCB_LIBS +EGL_CFLAGS +EGL_LIBS +GLW_CFLAGS +GLW_LIBS +GLUT_CFLAGS +GLUT_LIBS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information." + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures Mesa 7.6.0 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/mesa] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +X features: + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +These options are only used when the X libraries cannot be found by the +pkg-config utility. + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of Mesa 7.6.0:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-32-bit build 32-bit libraries [default=auto] + --enable-64-bit build 64-bit libraries [default=auto] + --enable-static build static libraries [default=disabled] + --disable-shared build shared libraries [default=enabled] + --enable-debug use debug compiler flags and macros + [default=disabled] + --disable-asm disable assembly usage [default=enabled on supported + plaforms] + --disable-pic compile PIC objects [default=enabled for shared + builds on supported platforms] + --enable-selinux Build SELinux-aware Mesa [default=disabled] + --enable-xcb use XCB for GLX [default=disabled] + --enable-glx-tls enable TLS support in GLX [default=disabled] + --disable-driglx-direct enable direct rendering in GLX for DRI + [default=enabled] + --enable-gl-osmesa enable OSMesa on libGL [default=enabled for xlib + driver] + --disable-egl disable EGL library [default=enabled] + --disable-glu enable OpenGL Utility library [default=enabled] + --disable-glw enable Xt/Motif widget library [default=enabled] + --enable-motif use Motif widgets in GLw [default=disabled] + --disable-glut enable GLUT library [default=enabled if source + available] + --disable-gallium build gallium [default=enabled] + --disable-gallium-intel build gallium intel [default=enabled] + --enable-gallium-radeon build gallium radeon [default=disabled] + --enable-gallium-nouveau + build gallium nouveau [default=disabled] + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-driver=DRIVER driver for Mesa: xlib,dri,osmesa [default=dri when + available, or xlib] + --with-demos[=DIRS...] optional comma delimited demo directories to build + [default=auto if source available] + --with-x use the X Window System + --with-dri-driverdir=DIR + directory for the DRI drivers [${libdir}/dri] + --with-dri-drivers[=DIRS...] + comma delimited DRI drivers list, e.g. + "swrast,i965,radeon" [default=auto] + --with-expat=DIR expat install directory + --with-osmesa-bits=BITS OSMesa channel bits and library name: 8, 16, 32 + [default=8] + --with-state-trackers[=DIRS...] + comma delimited state_trackers list, e.g. "egl,glx" + [default=auto] + --with-xorg-driver-dir=DIR + Default xorg driver + directory[[default=${libdir}/xorg/modules/drivers]] + --with-max-width=N Maximum framebuffer width (4096) + --with-max-height=N Maximum framebuffer height (4096) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + PKG_CONFIG path to pkg-config utility + EXTRA_LIB_PATH + Extra -L paths for the linker + X11_INCLUDES + Extra -I paths for X11 headers + OPT_FLAGS Additional optimization flags for the compiler. Default is to + use CFLAGS. + ARCH_FLAGS Additional architecture specific flags for the compiler. Default + is to use CFLAGS. + MKLIB_OPTIONS + Options for the Mesa library script, mklib + PIC_FLAGS compiler flags for PIC code + XMKMF Path to xmkmf, Makefile generator for X Window System + XLIBGL_CFLAGS + C compiler flags for XLIBGL, overriding pkg-config + XLIBGL_LIBS linker flags for XLIBGL, overriding pkg-config + LIBDRM_CFLAGS + C compiler flags for LIBDRM, overriding pkg-config + LIBDRM_LIBS linker flags for LIBDRM, overriding pkg-config + DRI2PROTO_CFLAGS + C compiler flags for DRI2PROTO, overriding pkg-config + DRI2PROTO_LIBS + linker flags for DRI2PROTO, overriding pkg-config + LIBDRM_RADEON_CFLAGS + C compiler flags for LIBDRM_RADEON, overriding pkg-config + LIBDRM_RADEON_LIBS + linker flags for LIBDRM_RADEON, overriding pkg-config + DRIGL_CFLAGS + C compiler flags for DRIGL, overriding pkg-config + DRIGL_LIBS linker flags for DRIGL, overriding pkg-config + XCB_CFLAGS C compiler flags for XCB, overriding pkg-config + XCB_LIBS linker flags for XCB, overriding pkg-config + EGL_CFLAGS C compiler flags for EGL, overriding pkg-config + EGL_LIBS linker flags for EGL, overriding pkg-config + GLW_CFLAGS C compiler flags for GLW, overriding pkg-config + GLW_LIBS linker flags for GLW, overriding pkg-config + GLUT_CFLAGS C compiler flags for GLUT, overriding pkg-config + GLUT_LIBS linker flags for GLUT, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +See docs/autoconf.html for more details on the options for Mesa. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +Mesa configure 7.6.0 +generated by GNU Autoconf 2.64 + +Copyright (C) 2009 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( cat <<\_ASBOX +## ---------------------------------------------------------------------- ## +## Report this to https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa ## +## ---------------------------------------------------------------------- ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + return $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by Mesa $as_me 7.6.0, which was +generated by GNU Autoconf 2.64. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------------- ## +## File substitutions. ## +## ------------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + ac_site_file1=$CONFIG_SITE +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_aux_dir= +for ac_dir in bin "$srcdir"/bin; do + for ac_t in install-sh install.sh shtool; do + if test -f "$ac_dir/$ac_t"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/$ac_t -c" + break 2 + fi + done +done +if test -z "$ac_aux_dir"; then + as_fn_error "cannot find install-sh, install.sh, or shtool in bin \"$srcdir\"/bin" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if test "${ac_cv_build+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if test "${ac_cv_host+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + +LIBDRM_REQUIRED=2.4.3 +DRI2PROTO_REQUIRED=1.99.3 + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "no acceptable C compiler found in \$PATH +See \`config.log' for more details." "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + rm -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +if test -z "$ac_file"; then : + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ as_fn_set_status 77 +as_fn_error "C compiler cannot create executables +See \`config.log' for more details." "$LINENO" 5; }; } +fi +ac_exeext=$ac_cv_exeext + +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out +ac_clean_files=$ac_clean_files_save +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." "$LINENO" 5; } +fi +rm -f conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot compute suffix of object files: cannot compile +See \`config.log' for more details." "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "no acceptable C compiler found in \$PATH +See \`config.log' for more details." "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + rm -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + rm -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if test "${ac_cv_prog_cxx_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +for ac_prog in gmake make +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_MAKE+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MAKE"; then + ac_cv_prog_MAKE="$MAKE" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MAKE="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MAKE=$ac_cv_prog_MAKE +if test -n "$MAKE"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKE" >&5 +$as_echo "$MAKE" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$MAKE" && break +done + +# Extract the first word of "makedepend", so it can be a program name with args. +set dummy makedepend; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_MKDEP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MKDEP in + [\\/]* | ?:[\\/]*) + ac_cv_path_MKDEP="$MKDEP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_MKDEP="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +MKDEP=$ac_cv_path_MKDEP +if test -n "$MKDEP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDEP" >&5 +$as_echo "$MKDEP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +# Extract the first word of "sed", so it can be a program name with args. +set dummy sed; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_SED+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $SED in + [\\/]* | ?:[\\/]*) + ac_cv_path_SED="$SED" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +SED=$ac_cv_path_SED +if test -n "$SED"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5 +$as_echo "$SED" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)' + +case "$host_os" in +solaris*) + # Solaris /bin/sh is too old/non-POSIX compliant + for ac_prog in ksh93 ksh sh +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_POSIX_SHELL+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $POSIX_SHELL in + [\\/]* | ?:[\\/]*) + ac_cv_path_POSIX_SHELL="$POSIX_SHELL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_POSIX_SHELL="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +POSIX_SHELL=$ac_cv_path_POSIX_SHELL +if test -n "$POSIX_SHELL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $POSIX_SHELL" >&5 +$as_echo "$POSIX_SHELL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$POSIX_SHELL" && break +done + + SHELL="$POSIX_SHELL" + ;; +esac + +MKDEP_OPTIONS=-fdepend +if test "x$GCC" = xyes; then + for dir in include include-fixed; do + GCC_INCLUDES=`$CC -print-file-name=$dir` + if test "x$GCC_INCLUDES" != x && \ + test "$GCC_INCLUDES" != "$dir" && \ + test -d "$GCC_INCLUDES"; then + MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES" + fi + done +fi + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi + +fi + +LIB_DIR=`echo $libdir | $SED 's%.*/%%'` + + +_SAVE_LDFLAGS="$LDFLAGS" + + + +_SAVE_CPPFLAGS="$CPPFLAGS" + + + +DEFINES="" + +case "$host_os" in +linux*|*-gnu*|gnu*) + DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS" + ;; +solaris*) + DEFINES="$DEFINES -DPTHREADS -DSVR4" + ;; +esac + +if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math" + + # Work around aliasing bugs - developers should comment this out + CFLAGS="$CFLAGS -fno-strict-aliasing" +fi +if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -Wall" + + # Work around aliasing bugs - developers should comment this out + CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" +fi + + + + + + +# Check whether --enable-32-bit was given. +if test "${enable_32_bit+set}" = set; then : + enableval=$enable_32_bit; enable_32bit="$enableval" +else + enable_32bit=auto + +fi + +if test "x$enable_32bit" = xyes; then + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -m32" + ARCH_FLAGS="$ARCH_FLAGS -m32" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -m32" + fi +fi +# Check whether --enable-64-bit was given. +if test "${enable_64_bit+set}" = set; then : + enableval=$enable_64_bit; enable_64bit="$enableval" +else + enable_64bit=auto + +fi + +if test "x$enable_64bit" = xyes; then + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -m64" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -m64" + fi +fi + +# Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; enable_static="$enableval" +else + enable_static=no + +fi + +case "x$enable_static" in +xyes|xno ) ;; +x ) enable_static=no ;; +* ) + as_fn_error "Static library option '$enable_static' is not a valid" "$LINENO" 5 + ;; +esac +# Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; enable_shared="$enableval" +else + enable_shared=yes + +fi + +case "x$enable_shared" in +xyes|xno ) ;; +x ) enable_shared=yes ;; +* ) + as_fn_error "Shared library option '$enable_shared' is not a valid" "$LINENO" 5 + ;; +esac + +case "x$enable_static$enable_shared" in +xyesyes ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't build static and shared libraries, disabling shared" >&5 +$as_echo "$as_me: WARNING: Can't build static and shared libraries, disabling shared" >&2;} + enable_shared=no + ;; +xnono ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't disable both static and shared libraries, enabling static" >&5 +$as_echo "$as_me: WARNING: Can't disable both static and shared libraries, enabling static" >&2;} + enable_static=yes + ;; +esac + + +if test "$enable_static" = yes; then + MKLIB_OPTIONS="$MKLIB_OPTIONS -static" +fi + + +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; enable_debug="$enableval" +else + enable_debug=no + +fi + +if test "x$enable_debug" = xyes; then + DEFINES="$DEFINES -DDEBUG" + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -g" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -g" + fi +fi + +if test "$enable_static" = yes; then + LIB_EXTENSION='a' +else + case "$host_os" in + darwin* ) + LIB_EXTENSION='dylib' ;; + cygwin* ) + LIB_EXTENSION='dll' ;; + * ) + LIB_EXTENSION='so' ;; + esac +fi + +GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION} +GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION} +GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION} +GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION} +OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION} + +GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*' +GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*' +GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*' +GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*' +OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*' + + + + + + + + + + + + + +# Check whether --enable-asm was given. +if test "${enable_asm+set}" = set; then : + enableval=$enable_asm; enable_asm="$enableval" +else + enable_asm=yes + +fi + +asm_arch="" +ASM_FLAGS="" +MESA_ASM_SOURCES="" +GLAPI_ASM_SOURCES="" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable assembly" >&5 +$as_echo_n "checking whether to enable assembly... " >&6; } +test "x$enable_asm" = xno && { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +# disable if cross compiling on x86/x86_64 since we must run gen_matypes +if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then + case "$host_cpu" in + i?86 | x86_64) + enable_asm=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, cross compiling" >&5 +$as_echo "no, cross compiling" >&6; } + ;; + esac +fi +# check for supported arches +if test "x$enable_asm" = xyes; then + case "$host_cpu" in + i?86) + case "$host_os" in + linux* | *freebsd* | dragonfly*) + test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86 + ;; + esac + ;; + x86_64) + case "$host_os" in + linux* | *freebsd* | dragonfly*) + test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64 + ;; + esac + ;; + powerpc) + case "$host_os" in + linux*) + asm_arch=ppc + ;; + esac + ;; + sparc*) + case "$host_os" in + linux*) + asm_arch=sparc + ;; + esac + ;; + esac + + case "$asm_arch" in + x86) + ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" + MESA_ASM_SOURCES='$(X86_SOURCES)' + GLAPI_ASM_SOURCES='$(X86_API)' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, x86" >&5 +$as_echo "yes, x86" >&6; } + ;; + x86_64) + ASM_FLAGS="-DUSE_X86_64_ASM" + MESA_ASM_SOURCES='$(X86-64_SOURCES)' + GLAPI_ASM_SOURCES='$(X86-64_API)' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, x86_64" >&5 +$as_echo "yes, x86_64" >&6; } + ;; + ppc) + ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" + MESA_ASM_SOURCES='$(PPC_SOURCES)' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, ppc" >&5 +$as_echo "yes, ppc" >&6; } + ;; + sparc) + ASM_FLAGS="-DUSE_SPARC_ASM" + MESA_ASM_SOURCES='$(SPARC_SOURCES)' + GLAPI_ASM_SOURCES='$(SPARC_API)' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, sparc" >&5 +$as_echo "yes, sparc" >&6; } + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, platform not supported" >&5 +$as_echo "no, platform not supported" >&6; } + ;; + esac +fi + + + + + +# Check whether --enable-pic was given. +if test "${enable_pic+set}" = set; then : + enableval=$enable_pic; enable_pic="$enableval" + test "x$enable_pic" = x && enable_pic=auto +else + enable_pic=auto +fi + +# disable PIC by default for static builds +if test "$enable_pic" = auto && test "$enable_static" = yes; then + enable_pic=no +fi +# if PIC hasn't been explicitly disabled, try to figure out the flags +if test "$enable_pic" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to produce PIC" >&5 +$as_echo_n "checking for $CC option to produce PIC... " >&6; } + # allow the user's flags to override + if test "x$PIC_FLAGS" = x; then + # see if we're using GCC + if test "x$GCC" = xyes; then + case "$host_os" in + aix*|beos*|cygwin*|irix5*|irix6*|osf3*|osf4*|osf5*) + # PIC is the default for these OSes. + ;; + mingw*|os2*|pw32*) + # This hack is so that the source file can tell whether + # it is being built for inclusion in a dll (and should + # export symbols for example). + PIC_FLAGS="-DDLL_EXPORT" + ;; + darwin*|rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + PIC_FLAGS="-fno-common" + ;; + hpux*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, + # but not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + PIC_FLAGS="-fPIC" + ;; + esac + ;; + *) + # Everyone else on GCC uses -fPIC + PIC_FLAGS="-fPIC" + ;; + esac + else # !GCC + case "$host_os" in + hpux9*|hpux10*|hpux11*) + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, + # but not for PA HP-UX. + case "$host_cpu" in + hppa*64*|ia64*) + # +Z the default + ;; + *) + PIC_FLAGS="+Z" + ;; + esac + ;; + linux*|k*bsd*-gnu) + case `basename "$CC"` in + icc*|ecc*|ifort*) + PIC_FLAGS="-KPIC" + ;; + pgcc*|pgf77*|pgf90*|pgf95*) + # Portland Group compilers (*not* the Pentium gcc + # compiler, which looks to be a dead project) + PIC_FLAGS="-fpic" + ;; + ccc*) + # All Alpha code is PIC. + ;; + xl*) + # IBM XL C 8.0/Fortran 10.1 on PPC + PIC_FLAGS="-qpic" + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*|*Sun\ F*) + # Sun C 5.9 or Sun Fortran + PIC_FLAGS="-KPIC" + ;; + esac + esac + ;; + solaris*) + PIC_FLAGS="-KPIC" + ;; + sunos4*) + PIC_FLAGS="-PIC" + ;; + esac + fi # GCC + fi # PIC_FLAGS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PIC_FLAGS" >&5 +$as_echo "$PIC_FLAGS" >&6; } +fi + + + + +ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = x""yes; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if test "${ac_cv_lib_dl_dlopen+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then : + DLOPEN_LIBS="-ldl" +fi + +fi + + +ac_fn_c_check_func "$LINENO" "posix_memalign" "ac_cv_func_posix_memalign" +if test "x$ac_cv_func_posix_memalign" = x""yes; then : + DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN" +fi + + +# Check whether --enable-selinux was given. +if test "${enable_selinux+set}" = set; then : + enableval=$enable_selinux; MESA_SELINUX="$enableval" +else + MESA_SELINUX=no +fi + +if test "x$enable_selinux" = "xyes"; then + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +eval as_val=\$$as_ac_Header + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default" +if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then : + +else + as_fn_error "SELinux headers not found" "$LINENO" 5 +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for is_selinux_enabled in -lselinux" >&5 +$as_echo_n "checking for is_selinux_enabled in -lselinux... " >&6; } +if test "${ac_cv_lib_selinux_is_selinux_enabled+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lselinux $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char is_selinux_enabled (); +int +main () +{ +return is_selinux_enabled (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_selinux_is_selinux_enabled=yes +else + ac_cv_lib_selinux_is_selinux_enabled=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_is_selinux_enabled" >&5 +$as_echo "$ac_cv_lib_selinux_is_selinux_enabled" >&6; } +if test "x$ac_cv_lib_selinux_is_selinux_enabled" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSELINUX 1 +_ACEOF + + LIBS="-lselinux $LIBS" + +else + as_fn_error "SELinux library not found" "$LINENO" 5 +fi + + SELINUX_LIBS="-lselinux" + DEFINES="$DEFINES -DMESA_SELINUX" +fi + +default_driver="xlib" + +case "$host_os" in +linux*) + case "$host_cpu" in + i*86|x86_64|powerpc*|sparc*) default_driver="dri";; + esac + ;; +*freebsd* | dragonfly*) + case "$host_cpu" in + i*86|x86_64|powerpc*|sparc*) default_driver="dri";; + esac + ;; +esac + + +# Check whether --with-driver was given. +if test "${with_driver+set}" = set; then : + withval=$with_driver; mesa_driver="$withval" +else + mesa_driver="$default_driver" +fi + +case "x$mesa_driver" in +xxlib|xdri|xosmesa) + ;; +*) + as_fn_error "Driver '$mesa_driver' is not a valid option" "$LINENO" 5 + ;; +esac + +SRC_DIRS="mesa glew" +GLU_DIRS="sgi" +WINDOW_SYSTEM="" +GALLIUM_DIRS="auxiliary drivers state_trackers" +GALLIUM_WINSYS_DIRS="" +GALLIUM_WINSYS_DRM_DIRS="" +GALLIUM_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices" +GALLIUM_DRIVERS_DIRS="softpipe failover trace identity" +GALLIUM_STATE_TRACKERS_DIRS="" + +case "$mesa_driver" in +xlib) + DRIVER_DIRS="x11" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib" + ;; +dri) + SRC_DIRS="glx/x11 $SRC_DIRS" + DRIVER_DIRS="dri" + WINDOW_SYSTEM="dri" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm" + ;; +osmesa) + DRIVER_DIRS="osmesa" + ;; +esac + + + + + + + + + + + + + +if test -d "$srcdir/progs/demos"; then + default_demos=yes +else + default_demos=no +fi + +# Check whether --with-demos was given. +if test "${with_demos+set}" = set; then : + withval=$with_demos; with_demos="$withval" +else + with_demos="$default_demos" +fi + +if test "x$with_demos" = x; then + with_demos=no +fi + +PROGRAM_DIRS="" +case "$with_demos" in +no) ;; +yes) + # If the driver isn't osmesa, we have libGL and can build xdemos + if test "$mesa_driver" != osmesa; then + PROGRAM_DIRS="xdemos" + fi + ;; +*) + # verify the requested demos directories exist + demos=`IFS=,; echo $with_demos` + for demo in $demos; do + test -d "$srcdir/progs/$demo" || \ + as_fn_error "Program directory '$demo' doesn't exist" "$LINENO" 5 + done + PROGRAM_DIRS="$demos" + ;; +esac + +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config files for X11 are available" >&5 +$as_echo_n "checking pkg-config files for X11 are available... " >&6; } + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + + x11_pkgconfig=yes + have_x=yes + +else + + x11_pkgconfig=no + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $x11_pkgconfig" >&5 +$as_echo "$x11_pkgconfig" >&6; } +else + x11_pkgconfig=no +fi +if test "$x11_pkgconfig" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 +$as_echo_n "checking for X... " >&6; } + + +# Check whether --with-x was given. +if test "${with_x+set}" = set; then : + withval=$with_x; +fi + +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + case $x_includes,$x_libraries in #( + *\'*) as_fn_error "cannot use X directory names containing '" "$LINENO" 5;; #( + *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +rm -f -r conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + cat >Imakefile <<'_ACEOF' +incroot: + @echo incroot='${INCROOT}' +usrlibdir: + @echo usrlibdir='${USRLIBDIR}' +libdir: + @echo libdir='${LIBDIR}' +_ACEOF + if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + for ac_var in incroot usrlibdir libdir; do + eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" + done + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl dylib la dll; do + if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && + test -f "$ac_im_libdir/libX11.$ac_extension"; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ac_x_includes= ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /usr/lib64 | /lib | /lib64) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -f -r conftest.dir +fi + +# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R7/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/usr/include/X11 +/usr/include/X11R7 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R7/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R7 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Xlib.h. + # First, try using that file with no special directory specified. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # We can compile using X headers with no special include directory. +ac_x_includes= +else + for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Xlib.h"; then + ac_x_includes=$ac_dir + break + fi +done +fi +rm -f conftest.err conftest.$ac_ext +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lX11 $LIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +XrmInitialize () + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries= +else + LIBS=$ac_save_LIBS +for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl dylib la dll; do + if test -r "$ac_dir/libX11.$ac_extension"; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi # $ac_x_libraries = no + +case $ac_x_includes,$ac_x_libraries in #( + no,* | *,no | *\'*) + # Didn't find X, or a directory has "'" in its name. + ac_cv_have_x="have_x=no";; #( + *) + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$ac_x_includes'\ + ac_x_libraries='$ac_x_libraries'" +esac +fi +;; #( + *) have_x=yes;; + esac + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 +$as_echo "$have_x" >&6; } + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes\ + ac_x_includes='$x_includes'\ + ac_x_libraries='$x_libraries'" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 +$as_echo "libraries $x_libraries, headers $x_includes" >&6; } +fi + +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + +$as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h + + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 +$as_echo_n "checking whether -R must be followed by a space... " >&6; } + ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" + ac_xsave_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + X_LIBS="$X_LIBS -R$x_libraries" +else + LIBS="$ac_xsave_LIBS -R $x_libraries" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + X_LIBS="$X_LIBS -R $x_libraries" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 +$as_echo "neither works" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_c_werror_flag=$ac_xsave_c_werror_flag + LIBS=$ac_xsave_LIBS + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn Johnson says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And Karl Berry says + # the Alpha needs dnet_stub (dnet does not exist). + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XOpenDisplay (); +int +main () +{ +return XOpenDisplay (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 +$as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } +if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dnet_ntoa (); +int +main () +{ +return dnet_ntoa (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dnet_dnet_ntoa=yes +else + ac_cv_lib_dnet_dnet_ntoa=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 +$as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } +if test "x$ac_cv_lib_dnet_dnet_ntoa" = x""yes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" +fi + + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 +$as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } +if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldnet_stub $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dnet_ntoa (); +int +main () +{ +return dnet_ntoa (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dnet_stub_dnet_ntoa=yes +else + ac_cv_lib_dnet_stub_dnet_ntoa=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 +$as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } +if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = x""yes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" +fi + + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$ac_xsave_LIBS" + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to T.E. Dickey. + # The functions gethostbyname, getservbyname, and inet_addr are + # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. + ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" +if test "x$ac_cv_func_gethostbyname" = x""yes; then : + +fi + + if test $ac_cv_func_gethostbyname = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 +$as_echo_n "checking for gethostbyname in -lnsl... " >&6; } +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int +main () +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_nsl_gethostbyname=yes +else + ac_cv_lib_nsl_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 +$as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } +if test "x$ac_cv_lib_nsl_gethostbyname" = x""yes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" +fi + + if test $ac_cv_lib_nsl_gethostbyname = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 +$as_echo_n "checking for gethostbyname in -lbsd... " >&6; } +if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char gethostbyname (); +int +main () +{ +return gethostbyname (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_bsd_gethostbyname=yes +else + ac_cv_lib_bsd_gethostbyname=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 +$as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } +if test "x$ac_cv_lib_bsd_gethostbyname" = x""yes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" +fi + + fi + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says Simon Leinen: it contains gethostby* + # variants that don't use the name server (or something). -lsocket + # must be given before -lnsl if both are needed. We assume that + # if connect needs -lnsl, so does gethostbyname. + ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" +if test "x$ac_cv_func_connect" = x""yes; then : + +fi + + if test $ac_cv_func_connect = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 +$as_echo_n "checking for connect in -lsocket... " >&6; } +if test "${ac_cv_lib_socket_connect+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $X_EXTRA_LIBS $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char connect (); +int +main () +{ +return connect (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_socket_connect=yes +else + ac_cv_lib_socket_connect=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 +$as_echo "$ac_cv_lib_socket_connect" >&6; } +if test "x$ac_cv_lib_socket_connect" = x""yes; then : + X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" +fi + + fi + + # Guillermo Gomez says -lposix is necessary on A/UX. + ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" +if test "x$ac_cv_func_remove" = x""yes; then : + +fi + + if test $ac_cv_func_remove = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 +$as_echo_n "checking for remove in -lposix... " >&6; } +if test "${ac_cv_lib_posix_remove+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char remove (); +int +main () +{ +return remove (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_posix_remove=yes +else + ac_cv_lib_posix_remove=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 +$as_echo "$ac_cv_lib_posix_remove" >&6; } +if test "x$ac_cv_lib_posix_remove" = x""yes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" +fi + + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" +if test "x$ac_cv_func_shmat" = x""yes; then : + +fi + + if test $ac_cv_func_shmat = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 +$as_echo_n "checking for shmat in -lipc... " >&6; } +if test "${ac_cv_lib_ipc_shmat+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lipc $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shmat (); +int +main () +{ +return shmat (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ipc_shmat=yes +else + ac_cv_lib_ipc_shmat=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 +$as_echo "$ac_cv_lib_ipc_shmat" >&6; } +if test "x$ac_cv_lib_ipc_shmat" = x""yes; then : + X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" +fi + + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS=$LDFLAGS + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # John Interrante, Karl Berry + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 +$as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } +if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lICE $X_EXTRA_LIBS $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char IceConnectionNumber (); +int +main () +{ +return IceConnectionNumber (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ICE_IceConnectionNumber=yes +else + ac_cv_lib_ICE_IceConnectionNumber=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 +$as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } +if test "x$ac_cv_lib_ICE_IceConnectionNumber" = x""yes; then : + X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" +fi + + LDFLAGS=$ac_save_LDFLAGS + +fi + +fi + + + +case "$mesa_driver" in +xlib|dri) + if test "$no_x" = yes; then + as_fn_error "X11 development libraries needed for $mesa_driver driver" "$LINENO" 5 + fi + ;; +esac + +# Check whether --enable-xcb was given. +if test "${enable_xcb+set}" = set; then : + enableval=$enable_xcb; enable_xcb="$enableval" +else + enable_xcb=no +fi + +if test "x$enable_xcb" = xyes; then + DEFINES="$DEFINES -DUSE_XCB" +else + enable_xcb=no +fi + +case "$mesa_driver" in +xlib) + if test "$x11_pkgconfig" = yes; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XLIBGL" >&5 +$as_echo_n "checking for XLIBGL... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$XLIBGL_CFLAGS"; then + pkg_cv_XLIBGL_CFLAGS="$XLIBGL_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xext\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 xext") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XLIBGL_CFLAGS=`$PKG_CONFIG --cflags "x11 xext" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$XLIBGL_LIBS"; then + pkg_cv_XLIBGL_LIBS="$XLIBGL_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xext\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 xext") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XLIBGL_LIBS=`$PKG_CONFIG --libs "x11 xext" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + XLIBGL_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "x11 xext"` + else + XLIBGL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "x11 xext"` + fi + # Put the nasty error message in config.log where it belongs + echo "$XLIBGL_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (x11 xext) were not met: + +$XLIBGL_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables XLIBGL_CFLAGS +and XLIBGL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables XLIBGL_CFLAGS +and XLIBGL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + XLIBGL_CFLAGS=$pkg_cv_XLIBGL_CFLAGS + XLIBGL_LIBS=$pkg_cv_XLIBGL_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + GL_PC_REQ_PRIV="x11 xext" + X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS" + GL_LIB_DEPS="$XLIBGL_LIBS" + else + # should check these... + X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" + GL_LIB_DEPS="$X_LIBS -lX11 -lXext" + GL_PC_LIB_PRIV="$GL_LIB_DEPS" + GL_PC_CFLAGS="$X11_INCLUDES" + fi + GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread" + GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread" + + # if static, move the external libraries to the programs + # and empty the libraries for libGL + if test "$enable_static" = yes; then + APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS" + GL_LIB_DEPS="" + fi + ;; +dri) + # DRI must be shared, I think + if test "$enable_static" = yes; then + as_fn_error "Can't use static libraries for DRI drivers" "$LINENO" 5 + fi + + # Check for libdrm + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDRM" >&5 +$as_echo_n "checking for LIBDRM... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$LIBDRM_CFLAGS"; then + pkg_cv_LIBDRM_CFLAGS="$LIBDRM_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= \$LIBDRM_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libdrm >= $LIBDRM_REQUIRED") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBDRM_CFLAGS=`$PKG_CONFIG --cflags "libdrm >= $LIBDRM_REQUIRED" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$LIBDRM_LIBS"; then + pkg_cv_LIBDRM_LIBS="$LIBDRM_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm >= \$LIBDRM_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libdrm >= $LIBDRM_REQUIRED") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBDRM_LIBS=`$PKG_CONFIG --libs "libdrm >= $LIBDRM_REQUIRED" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBDRM_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libdrm >= $LIBDRM_REQUIRED"` + else + LIBDRM_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libdrm >= $LIBDRM_REQUIRED"` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBDRM_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (libdrm >= $LIBDRM_REQUIRED) were not met: + +$LIBDRM_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables LIBDRM_CFLAGS +and LIBDRM_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables LIBDRM_CFLAGS +and LIBDRM_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + LIBDRM_CFLAGS=$pkg_cv_LIBDRM_CFLAGS + LIBDRM_LIBS=$pkg_cv_LIBDRM_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DRI2PROTO" >&5 +$as_echo_n "checking for DRI2PROTO... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$DRI2PROTO_CFLAGS"; then + pkg_cv_DRI2PROTO_CFLAGS="$DRI2PROTO_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dri2proto >= \$DRI2PROTO_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dri2proto >= $DRI2PROTO_REQUIRED") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DRI2PROTO_CFLAGS=`$PKG_CONFIG --cflags "dri2proto >= $DRI2PROTO_REQUIRED" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$DRI2PROTO_LIBS"; then + pkg_cv_DRI2PROTO_LIBS="$DRI2PROTO_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dri2proto >= \$DRI2PROTO_REQUIRED\""; } >&5 + ($PKG_CONFIG --exists --print-errors "dri2proto >= $DRI2PROTO_REQUIRED") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DRI2PROTO_LIBS=`$PKG_CONFIG --libs "dri2proto >= $DRI2PROTO_REQUIRED" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + DRI2PROTO_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "dri2proto >= $DRI2PROTO_REQUIRED"` + else + DRI2PROTO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "dri2proto >= $DRI2PROTO_REQUIRED"` + fi + # Put the nasty error message in config.log where it belongs + echo "$DRI2PROTO_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (dri2proto >= $DRI2PROTO_REQUIRED) were not met: + +$DRI2PROTO_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables DRI2PROTO_CFLAGS +and DRI2PROTO_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables DRI2PROTO_CFLAGS +and DRI2PROTO_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + DRI2PROTO_CFLAGS=$pkg_cv_DRI2PROTO_CFLAGS + DRI2PROTO_LIBS=$pkg_cv_DRI2PROTO_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED" + DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBDRM_RADEON" >&5 +$as_echo_n "checking for LIBDRM_RADEON... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$LIBDRM_RADEON_CFLAGS"; then + pkg_cv_LIBDRM_RADEON_CFLAGS="$LIBDRM_RADEON_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm_radeon\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libdrm_radeon") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBDRM_RADEON_CFLAGS=`$PKG_CONFIG --cflags "libdrm_radeon" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$LIBDRM_RADEON_LIBS"; then + pkg_cv_LIBDRM_RADEON_LIBS="$LIBDRM_RADEON_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdrm_radeon\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libdrm_radeon") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBDRM_RADEON_LIBS=`$PKG_CONFIG --libs "libdrm_radeon" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBDRM_RADEON_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libdrm_radeon"` + else + LIBDRM_RADEON_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libdrm_radeon"` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBDRM_RADEON_PKG_ERRORS" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + HAVE_LIBDRM_RADEON=no +elif test $pkg_failed = untried; then + HAVE_LIBDRM_RADEON=no +else + LIBDRM_RADEON_CFLAGS=$pkg_cv_LIBDRM_RADEON_CFLAGS + LIBDRM_RADEON_LIBS=$pkg_cv_LIBDRM_RADEON_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_LIBDRM_RADEON=yes +fi + + if test "$HAVE_LIBDRM_RADEON" = yes; then + RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS" + RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS + fi + + # find the DRI deps for libGL + if test "$x11_pkgconfig" = yes; then + # add xcb modules if necessary + dri_modules="x11 xext xxf86vm xdamage xfixes" + if test "$enable_xcb" = yes; then + dri_modules="$dri_modules x11-xcb xcb-glx" + fi + + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for DRIGL" >&5 +$as_echo_n "checking for DRIGL... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$DRIGL_CFLAGS"; then + pkg_cv_DRIGL_CFLAGS="$DRIGL_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$dri_modules\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$dri_modules") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DRIGL_CFLAGS=`$PKG_CONFIG --cflags "$dri_modules" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$DRIGL_LIBS"; then + pkg_cv_DRIGL_LIBS="$DRIGL_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$dri_modules\""; } >&5 + ($PKG_CONFIG --exists --print-errors "$dri_modules") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_DRIGL_LIBS=`$PKG_CONFIG --libs "$dri_modules" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + DRIGL_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$dri_modules"` + else + DRIGL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$dri_modules"` + fi + # Put the nasty error message in config.log where it belongs + echo "$DRIGL_PKG_ERRORS" >&5 + + as_fn_error "Package requirements ($dri_modules) were not met: + +$DRIGL_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables DRIGL_CFLAGS +and DRIGL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables DRIGL_CFLAGS +and DRIGL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + DRIGL_CFLAGS=$pkg_cv_DRIGL_CFLAGS + DRIGL_LIBS=$pkg_cv_DRIGL_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules" + X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS" + GL_LIB_DEPS="$DRIGL_LIBS" + else + # should check these... + X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" + GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes" + GL_PC_LIB_PRIV="$GL_LIB_DEPS" + GL_PC_CFLAGS="$X11_INCLUDES" + + # XCB can only be used from pkg-config + if test "$enable_xcb" = yes; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XCB" >&5 +$as_echo_n "checking for XCB... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$XCB_CFLAGS"; then + pkg_cv_XCB_CFLAGS="$XCB_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11-xcb xcb-glx\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11-xcb xcb-glx") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XCB_CFLAGS=`$PKG_CONFIG --cflags "x11-xcb xcb-glx" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$XCB_LIBS"; then + pkg_cv_XCB_LIBS="$XCB_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11-xcb xcb-glx\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11-xcb xcb-glx") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_XCB_LIBS=`$PKG_CONFIG --libs "x11-xcb xcb-glx" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + XCB_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "x11-xcb xcb-glx"` + else + XCB_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "x11-xcb xcb-glx"` + fi + # Put the nasty error message in config.log where it belongs + echo "$XCB_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (x11-xcb xcb-glx) were not met: + +$XCB_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables XCB_CFLAGS +and XCB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables XCB_CFLAGS +and XCB_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + XCB_CFLAGS=$pkg_cv_XCB_CFLAGS + XCB_LIBS=$pkg_cv_XCB_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx" + X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS" + GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS" + fi + fi + + # need DRM libs, -lpthread, etc. + GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" + GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" + ;; +osmesa) + # No libGL for osmesa + GL_LIB_DEPS="" + ;; +esac + + + + + + +if test "$mesa_driver" = xlib; then + DEFINES="$DEFINES -DUSE_XSHM" +fi + +# Check whether --enable-glx-tls was given. +if test "${enable_glx_tls+set}" = set; then : + enableval=$enable_glx_tls; GLX_USE_TLS="$enableval" +else + GLX_USE_TLS=no +fi + + +# Check whether --with-dri-driverdir was given. +if test "${with_dri_driverdir+set}" = set; then : + withval=$with_dri_driverdir; DRI_DRIVER_INSTALL_DIR="$withval" +else + DRI_DRIVER_INSTALL_DIR='${libdir}/dri' +fi + + +# Check whether --enable-driglx-direct was given. +if test "${enable_driglx_direct+set}" = set; then : + enableval=$enable_driglx_direct; driglx_direct="$enableval" +else + driglx_direct="yes" +fi + + +# Check whether --with-dri-drivers was given. +if test "${with_dri_drivers+set}" = set; then : + withval=$with_dri_drivers; with_dri_drivers="$withval" +else + with_dri_drivers=yes +fi + +if test "x$with_dri_drivers" = x; then + with_dri_drivers=no +fi + +DRI_DIRS="" +case "$with_dri_drivers" in +no) ;; +yes) + DRI_DIRS="yes" + ;; +*) + # verify the requested driver directories exist + dri_drivers=`IFS=', '; echo $with_dri_drivers` + for driver in $dri_drivers; do + test -d "$srcdir/src/mesa/drivers/dri/$driver" || \ + as_fn_error "DRI driver directory '$driver' doesn't exist" "$LINENO" 5 + done + DRI_DIRS="$dri_drivers" + ;; +esac + +USING_EGL=0 + + +if test "$mesa_driver" = dri; then + # Use TLS in GLX? + if test "x$GLX_USE_TLS" = xyes; then + DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS" + fi + + if test "x$USING_EGL" = x1; then + PROGRAM_DIRS="egl" + fi + + # Platform specific settings and drivers to build + case "$host_os" in + linux*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" + + case "$host_cpu" in + x86_64) + # ffb, gamma, and sis are missing because they have not be + # converted to use the new interface. i810 are missing + # because there is no x86-64 system where they could *ever* + # be used. + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \ + savage tdfx unichrome swrast" + fi + ;; + powerpc*) + # Build only the drivers for cards that exist on PowerPC. + # At some point MGA will be added, but not yet. + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast" + fi + ;; + sparc*) + # Build only the drivers for cards that exist on sparc` + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast" + fi + ;; + esac + ;; + freebsd* | dragonfly*) + DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1" + DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -ansi -pedantic" + fi + + # ffb and gamma are missing because they have not been converted + # to use the new interface. + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \ + unichrome savage sis swrast" + fi + ;; + gnu*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" + ;; + solaris*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + ;; + esac + + # default drivers + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon s3v \ + savage sis tdfx trident unichrome ffb swrast" + fi + + DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'` + + # Check for expat + EXPAT_INCLUDES="" + EXPAT_LIB=-lexpat + +# Check whether --with-expat was given. +if test "${with_expat+set}" = set; then : + withval=$with_expat; + EXPAT_INCLUDES="-I$withval/include" + CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES" + LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR" + EXPAT_LIB="-L$withval/$LIB_DIR -lexpat" + +fi + + ac_fn_c_check_header_mongrel "$LINENO" "expat.h" "ac_cv_header_expat_h" "$ac_includes_default" +if test "x$ac_cv_header_expat_h" = x""yes; then : + +else + as_fn_error "Expat required for DRI." "$LINENO" 5 +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML_ParserCreate in -lexpat" >&5 +$as_echo_n "checking for XML_ParserCreate in -lexpat... " >&6; } +if test "${ac_cv_lib_expat_XML_ParserCreate+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lexpat $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XML_ParserCreate (); +int +main () +{ +return XML_ParserCreate (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_expat_XML_ParserCreate=yes +else + ac_cv_lib_expat_XML_ParserCreate=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_expat_XML_ParserCreate" >&5 +$as_echo "$ac_cv_lib_expat_XML_ParserCreate" >&6; } +if test "x$ac_cv_lib_expat_XML_ParserCreate" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBEXPAT 1 +_ACEOF + + LIBS="-lexpat $LIBS" + +else + as_fn_error "Expat required for DRI." "$LINENO" 5 +fi + + + # put all the necessary libs together + DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS" +fi + + + + +if test "$mesa_driver" = xlib; then + default_gl_osmesa=yes +else + default_gl_osmesa=no +fi +# Check whether --enable-gl-osmesa was given. +if test "${enable_gl_osmesa+set}" = set; then : + enableval=$enable_gl_osmesa; gl_osmesa="$enableval" +else + gl_osmesa="$default_gl_osmesa" +fi + +if test "x$gl_osmesa" = xyes; then + if test "$mesa_driver" = osmesa; then + as_fn_error "libGL is not available for OSMesa driver" "$LINENO" 5 + else + DRIVER_DIRS="$DRIVER_DIRS osmesa" + fi +fi + + +# Check whether --with-osmesa-bits was given. +if test "${with_osmesa_bits+set}" = set; then : + withval=$with_osmesa_bits; osmesa_bits="$withval" +else + osmesa_bits=8 +fi + +if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring OSMesa channel bits for non-OSMesa driver" >&5 +$as_echo "$as_me: WARNING: Ignoring OSMesa channel bits for non-OSMesa driver" >&2;} + osmesa_bits=8 +fi +case "x$osmesa_bits" in +x8) + OSMESA_LIB=OSMesa + ;; +x16|x32) + OSMESA_LIB="OSMesa$osmesa_bits" + DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31" + ;; +*) + as_fn_error "OSMesa bits '$osmesa_bits' is not a valid option" "$LINENO" 5 + ;; +esac + + +case "$mesa_driver" in +osmesa) + # only link libraries with osmesa if shared + if test "$enable_static" = no; then + OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" + else + OSMESA_LIB_DEPS="" + fi + OSMESA_MESA_DEPS="" + OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" + ;; +*) + # Link OSMesa to libGL otherwise + OSMESA_LIB_DEPS="" + # only link libraries with osmesa if shared + if test "$enable_static" = no; then + OSMESA_MESA_DEPS='-l$(GL_LIB)' + else + OSMESA_MESA_DEPS="" + fi + OSMESA_PC_REQ="gl" + ;; +esac +OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV" + + + + + +# Check whether --enable-egl was given. +if test "${enable_egl+set}" = set; then : + enableval=$enable_egl; enable_egl="$enableval" +else + enable_egl=yes +fi + +if test "x$enable_egl" = xyes; then + SRC_DIRS="$SRC_DIRS egl" + + if test "$x11_pkgconfig" = yes; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGL" >&5 +$as_echo_n "checking for EGL... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$EGL_CFLAGS"; then + pkg_cv_EGL_CFLAGS="$EGL_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_EGL_CFLAGS=`$PKG_CONFIG --cflags "x11" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$EGL_LIBS"; then + pkg_cv_EGL_LIBS="$EGL_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_EGL_LIBS=`$PKG_CONFIG --libs "x11" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + EGL_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "x11"` + else + EGL_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "x11"` + fi + # Put the nasty error message in config.log where it belongs + echo "$EGL_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (x11) were not met: + +$EGL_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables EGL_CFLAGS +and EGL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables EGL_CFLAGS +and EGL_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + EGL_CFLAGS=$pkg_cv_EGL_CFLAGS + EGL_LIBS=$pkg_cv_EGL_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + EGL_LIB_DEPS="$EGL_LIBS" + else + # should check these... + EGL_LIB_DEPS="$X_LIBS -lX11" + fi + EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS" +fi + + +# Check whether --enable-glu was given. +if test "${enable_glu+set}" = set; then : + enableval=$enable_glu; enable_glu="$enableval" +else + enable_glu=yes +fi + +if test "x$enable_glu" = xyes; then + SRC_DIRS="$SRC_DIRS glu" + + case "$mesa_driver" in + osmesa) + # If GLU is available and we have libOSMesa (not 16 or 32), + # we can build the osdemos + if test "$with_demos" = yes && test "$osmesa_bits" = 8; then + PROGRAM_DIRS="$PROGRAM_DIRS osdemos" + fi + + # Link libGLU to libOSMesa instead of libGL + GLU_LIB_DEPS="" + GLU_PC_REQ="osmesa" + if test "$enable_static" = no; then + GLU_MESA_DEPS='-l$(OSMESA_LIB)' + else + GLU_MESA_DEPS="" + fi + ;; + *) + # If static, empty GLU_LIB_DEPS and add libs for programs to link + GLU_PC_REQ="gl" + GLU_PC_LIB_PRIV="-lm" + if test "$enable_static" = no; then + GLU_LIB_DEPS="-lm" + GLU_MESA_DEPS='-l$(GL_LIB)' + else + GLU_LIB_DEPS="" + GLU_MESA_DEPS="" + APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++" + fi + ;; + esac +fi +if test "$enable_static" = no; then + GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS" +fi +GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS" + + + + + + + +# Check whether --enable-glw was given. +if test "${enable_glw+set}" = set; then : + enableval=$enable_glw; enable_glw="$enableval" +else + enable_glw=yes +fi + +if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling GLw since the driver is OSMesa" >&5 +$as_echo "$as_me: WARNING: Disabling GLw since the driver is OSMesa" >&2;} + enable_glw=no +fi +# Check whether --enable-motif was given. +if test "${enable_motif+set}" = set; then : + enableval=$enable_motif; enable_motif="$enableval" +else + enable_motif=no +fi + + +if test "x$enable_glw" = xyes; then + SRC_DIRS="$SRC_DIRS glw" + if test "$x11_pkgconfig" = yes; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLW" >&5 +$as_echo_n "checking for GLW... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$GLW_CFLAGS"; then + pkg_cv_GLW_CFLAGS="$GLW_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 xt") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLW_CFLAGS=`$PKG_CONFIG --cflags "x11 xt" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$GLW_LIBS"; then + pkg_cv_GLW_LIBS="$GLW_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xt\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 xt") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLW_LIBS=`$PKG_CONFIG --libs "x11 xt" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GLW_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "x11 xt"` + else + GLW_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "x11 xt"` + fi + # Put the nasty error message in config.log where it belongs + echo "$GLW_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (x11 xt) were not met: + +$GLW_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GLW_CFLAGS +and GLW_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GLW_CFLAGS +and GLW_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + GLW_CFLAGS=$pkg_cv_GLW_CFLAGS + GLW_LIBS=$pkg_cv_GLW_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + GLW_PC_REQ_PRIV="x11 xt" + GLW_LIB_DEPS="$GLW_LIBS" + else + # should check these... + GLW_LIB_DEPS="$X_LIBS -lXt -lX11" + GLW_PC_LIB_PRIV="$GLW_LIB_DEPS" + GLW_PC_CFLAGS="$X11_INCLUDES" + fi + + GLW_SOURCES="GLwDrawA.c" + MOTIF_CFLAGS= + if test "x$enable_motif" = xyes; then + GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c" + # Extract the first word of "motif-config", so it can be a program name with args. +set dummy motif-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_MOTIF_CONFIG+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + case $MOTIF_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_MOTIF_CONFIG="$MOTIF_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_MOTIF_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_MOTIF_CONFIG" && ac_cv_path_MOTIF_CONFIG="no" + ;; +esac +fi +MOTIF_CONFIG=$ac_cv_path_MOTIF_CONFIG +if test -n "$MOTIF_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MOTIF_CONFIG" >&5 +$as_echo "$MOTIF_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test "x$MOTIF_CONFIG" != xno; then + MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags` + MOTIF_LIBS=`$MOTIF_CONFIG --libs` + else + ac_fn_c_check_header_mongrel "$LINENO" "Xm/PrimitiveP.h" "ac_cv_header_Xm_PrimitiveP_h" "$ac_includes_default" +if test "x$ac_cv_header_Xm_PrimitiveP_h" = x""yes; then : + +else + as_fn_error "Can't locate Motif headers" "$LINENO" 5 +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XmGetPixmap in -lXm" >&5 +$as_echo_n "checking for XmGetPixmap in -lXm... " >&6; } +if test "${ac_cv_lib_Xm_XmGetPixmap+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lXm $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char XmGetPixmap (); +int +main () +{ +return XmGetPixmap (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_Xm_XmGetPixmap=yes +else + ac_cv_lib_Xm_XmGetPixmap=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xm_XmGetPixmap" >&5 +$as_echo "$ac_cv_lib_Xm_XmGetPixmap" >&6; } +if test "x$ac_cv_lib_Xm_XmGetPixmap" = x""yes; then : + MOTIF_LIBS="-lXm" +else + as_fn_error "Can't locate Motif Xm library" "$LINENO" 5 +fi + + fi + # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11 + GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS" + GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV" + GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS" + fi + + # If static, empty GLW_LIB_DEPS and add libs for programs to link + GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV" + if test "$enable_static" = no; then + GLW_MESA_DEPS='-l$(GL_LIB)' + GLW_LIB_DEPS="$GLW_LIB_DEPS" + else + APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS" + GLW_LIB_DEPS="" + GLW_MESA_DEPS="" + fi +fi + + + + + + + + +if test -f "$srcdir/include/GL/glut.h"; then + default_glut=yes +else + default_glut=no +fi +# Check whether --enable-glut was given. +if test "${enable_glut+set}" = set; then : + enableval=$enable_glut; enable_glut="$enableval" +else + enable_glut="$default_glut" +fi + + +if test "x$enable_glu$enable_glut" = xnoyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling glut since GLU is disabled" >&5 +$as_echo "$as_me: WARNING: Disabling glut since GLU is disabled" >&2;} + enable_glut=no +fi +if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling glut since the driver is OSMesa" >&5 +$as_echo "$as_me: WARNING: Disabling glut since the driver is OSMesa" >&2;} + enable_glut=no +fi + +if test "x$enable_glut" = xyes; then + SRC_DIRS="$SRC_DIRS glut/glx" + GLUT_CFLAGS="" + if test "x$GCC" = xyes; then + GLUT_CFLAGS="-fexceptions" + fi + if test "$x11_pkgconfig" = yes; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLUT" >&5 +$as_echo_n "checking for GLUT... " >&6; } + +if test -n "$PKG_CONFIG"; then + if test -n "$GLUT_CFLAGS"; then + pkg_cv_GLUT_CFLAGS="$GLUT_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xmu xi\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 xmu xi") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLUT_CFLAGS=`$PKG_CONFIG --cflags "x11 xmu xi" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$GLUT_LIBS"; then + pkg_cv_GLUT_LIBS="$GLUT_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"x11 xmu xi\""; } >&5 + ($PKG_CONFIG --exists --print-errors "x11 xmu xi") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_GLUT_LIBS=`$PKG_CONFIG --libs "x11 xmu xi" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GLUT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "x11 xmu xi"` + else + GLUT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "x11 xmu xi"` + fi + # Put the nasty error message in config.log where it belongs + echo "$GLUT_PKG_ERRORS" >&5 + + as_fn_error "Package requirements (x11 xmu xi) were not met: + +$GLUT_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GLUT_CFLAGS +and GLUT_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" "$LINENO" 5 +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GLUT_CFLAGS +and GLUT_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details." "$LINENO" 5; } +else + GLUT_CFLAGS=$pkg_cv_GLUT_CFLAGS + GLUT_LIBS=$pkg_cv_GLUT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + GLUT_PC_REQ_PRIV="x11 xmu xi" + GLUT_LIB_DEPS="$GLUT_LIBS" + else + # should check these... + GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi" + GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS" + GLUT_PC_CFLAGS="$X11_INCLUDES" + fi + GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm" + GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm" + + # If glut is available, we can build most programs + if test "$with_demos" = yes; then + PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl" + fi + + # If static, empty GLUT_LIB_DEPS and add libs for programs to link + if test "$enable_static" = no; then + GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)' + else + APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS" + GLUT_LIB_DEPS="" + GLUT_MESA_DEPS="" + fi +fi + + + + + + + +if test "x$APP_LIB_DEPS" = x; then + case "$host_os" in + solaris*) + APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm" + ;; + cygwin*) + APP_LIB_DEPS="-lX11" + ;; + *) + APP_LIB_DEPS="-lm" + ;; + esac +fi + + + +# Check whether --enable-gallium was given. +if test "${enable_gallium+set}" = set; then : + enableval=$enable_gallium; enable_gallium="$enableval" +else + enable_gallium=yes +fi + +if test "x$enable_gallium" = xyes; then + SRC_DIRS="$SRC_DIRS gallium gallium/winsys" +fi + + +# Check whether --with-state-trackers was given. +if test "${with_state_trackers+set}" = set; then : + withval=$with_state_trackers; with_state_trackers="$withval" +else + with_state_trackers=yes +fi + + +case "$with_state_trackers" in +no) + GALLIUM_STATE_TRACKERS_DIRS="" + ;; +yes) + # look at what else is built + case "$mesa_driver" in + xlib) + GALLIUM_STATE_TRACKERS_DIRS=glx + ;; + dri) + test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl + ;; + esac + ;; +*) + # verify the requested state tracker exist + state_trackers=`IFS=', '; echo $with_state_trackers` + for tracker in $state_trackers; do + test -d "$srcdir/src/gallium/state_trackers/$tracker" || \ + as_fn_error "state tracker '$tracker' doesn't exist" "$LINENO" 5 + + if test "$tracker" = egl && test "x$enable_egl" != xyes; then + as_fn_error "cannot build egl state tracker without EGL library" "$LINENO" 5 + fi + done + GALLIUM_STATE_TRACKERS_DIRS="$state_trackers" + ;; +esac + + +# Check whether --with-xorg-driver-dir was given. +if test "${with_xorg_driver_dir+set}" = set; then : + withval=$with_xorg_driver_dir; XORG_DRIVER_INSTALL_DIR="$withval" +else + XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers" +fi + + + + +# Check whether --with-max-width was given. +if test "${with_max_width+set}" = set; then : + withval=$with_max_width; DEFINES="${DEFINES} -DMAX_WIDTH=${withval}"; + if test "${withval}" -gt "4096"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Large framebuffer: see s_tritemp.h comments." >&5 +$as_echo "$as_me: WARNING: Large framebuffer: see s_tritemp.h comments." >&2;} +fi + +fi + + +# Check whether --with-max-height was given. +if test "${with_max_height+set}" = set; then : + withval=$with_max_height; DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}"; + if test "${withval}" -gt "4096"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Large framebuffer: see s_tritemp.h comments." >&5 +$as_echo "$as_me: WARNING: Large framebuffer: see s_tritemp.h comments." >&2;} +fi + +fi + + +# Check whether --enable-gallium-intel was given. +if test "${enable_gallium_intel+set}" = set; then : + enableval=$enable_gallium_intel; enable_gallium_intel="$enableval" +else + enable_gallium_intel=yes +fi + +if test "x$enable_gallium_intel" = xyes; then + GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel" + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915simple" +fi + +# Check whether --enable-gallium-radeon was given. +if test "${enable_gallium_radeon+set}" = set; then : + enableval=$enable_gallium_radeon; enable_gallium_radeon="$enableval" +else + enable_gallium_radeon=no +fi + +if test "x$enable_gallium_radeon" = xyes; then + GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon" + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300" +fi + +# Check whether --enable-gallium-nouveau was given. +if test "${enable_gallium_nouveau+set}" = set; then : + enableval=$enable_gallium_nouveau; enable_gallium_nouveau="$enableval" +else + enable_gallium_nouveau=no +fi + +if test "x$enable_gallium_nouveau" = xyes; then + GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau" + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50" +fi + + +LDFLAGS="$_SAVE_LDFLAGS" +CPPFLAGS="$_SAVE_CPPFLAGS" + +ac_config_files="$ac_config_files configs/autoconf" + + +ac_config_commands="$ac_config_commands configs" + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +ac_script=' +:mline +/\\$/{ + N + s,\\\n,, + b mline +} +t clear +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g +t quote +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g +t quote +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.h` + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error ERROR [LINENO LOG_FD] +# --------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with status $?, using 1 if that was 0. +as_fn_error () +{ + as_status=$?; test $as_status -eq 0 && as_status=1 + if test "$3"; then + as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3 + fi + $as_echo "$as_me: error: $1" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by Mesa $as_me 7.6.0, which was +generated by GNU Autoconf 2.64. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_version="\\ +Mesa config.status 7.6.0 +configured by $0, generated by GNU Autoconf 2.64, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2009 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h | --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "configs/autoconf") CONFIG_FILES="$CONFIG_FILES configs/autoconf" ;; + "configs") CONFIG_COMMANDS="$CONFIG_COMMANDS configs" ;; + + *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\).*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\).*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + + +eval set X " :F $CONFIG_FILES :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error "could not create $ac_file" "$LINENO" 5 + ;; + + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "configs":C) +if test -f configs/current || test -L configs/current; then + rm -f configs/current +fi +ln -s autoconf configs/current + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit $? +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +echo "" +echo " prefix: $prefix" +echo " exec_prefix: $exec_prefix" +echo " libdir: $libdir" +echo " includedir: $includedir" + +echo "" +echo " Driver: $mesa_driver" +if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then + echo " OSMesa: lib$OSMESA_LIB" +else + echo " OSMesa: no" +fi +if test "$mesa_driver" = dri; then + # cleanup the drivers var + dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` +if test "x$DRI_DIRS" = x; then + echo " DRI drivers: no" +else + echo " DRI drivers: $dri_dirs" +fi + echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR" +fi +echo " Use XCB: $enable_xcb" + +echo "" +if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then + echo " Gallium: yes" + echo " Gallium dirs: $GALLIUM_DIRS" + echo " Winsys dirs: $GALLIUM_WINSYS_DIRS" + echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS" + echo " Auxiliary dirs: $GALLIUM_AUXILIARY_DIRS" + echo " Driver dirs: $GALLIUM_DRIVERS_DIRS" + echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS" +else + echo " Gallium: no" +fi + +echo "" +echo " Shared libs: $enable_shared" +echo " Static libs: $enable_static" +echo " EGL: $enable_egl" +echo " GLU: $enable_glu" +echo " GLw: $enable_glw (Motif: $enable_motif)" +echo " glut: $enable_glut" + +# cleanup the programs var for display +program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` +if test "x$program_dirs" = x; then + echo " Demos: no" +else + echo " Demos: $program_dirs" +fi + +# cleanup the CFLAGS/CXXFLAGS/DEFINES vars +cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ + $SED 's/^ *//;s/ */ /;s/ *$//'` +cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ + $SED 's/^ *//;s/ */ /;s/ *$//'` +defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'` +echo "" +echo " CFLAGS: $cflags" +echo " CXXFLAGS: $cxxflags" +echo " Macros: $defines" + +echo "" +echo " Run '${MAKE-make}' to build Mesa" +echo "" diff --git a/mesalib/configure.ac b/mesalib/configure.ac new file mode 100644 index 000000000..75189761e --- /dev/null +++ b/mesalib/configure.ac @@ -0,0 +1,1309 @@ +dnl Process this file with autoconf to create configure. + +AC_PREREQ([2.59]) + +dnl Versioning - scrape the version from configs/default +m4_define([mesa_version], + [m4_esyscmd([${MAKE-make} -s -f bin/version.mk version | tr -d '\n'])]) +m4_ifval(mesa_version,, + [m4_fatal([Failed to get the Mesa version from `make -f bin/version.mk version`])]) + +dnl Tell the user about autoconf.html in the --help output +m4_divert_once([HELP_END], [ +See docs/autoconf.html for more details on the options for Mesa.]) + +AC_INIT([Mesa],[mesa_version], + [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa]) +AC_CONFIG_AUX_DIR([bin]) +AC_CANONICAL_HOST + +dnl Versions for external dependencies +LIBDRM_REQUIRED=2.4.3 +DRI2PROTO_REQUIRED=1.99.3 + +dnl Check for progs +AC_PROG_CPP +AC_PROG_CC +AC_PROG_CXX +AC_CHECK_PROGS([MAKE], [gmake make]) +AC_PATH_PROG([MKDEP], [makedepend]) +AC_PATH_PROG([SED], [sed]) + +dnl Our fallback install-sh is a symlink to minstall. Use the existing +dnl configuration in that case. +AC_PROG_INSTALL +test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)' + +dnl We need a POSIX shell for parts of the build. Assume we have one +dnl in most cases. +case "$host_os" in +solaris*) + # Solaris /bin/sh is too old/non-POSIX compliant + AC_PATH_PROGS(POSIX_SHELL, [ksh93 ksh sh]) + SHELL="$POSIX_SHELL" + ;; +esac + +MKDEP_OPTIONS=-fdepend +dnl Ask gcc where it's keeping its secret headers +if test "x$GCC" = xyes; then + for dir in include include-fixed; do + GCC_INCLUDES=`$CC -print-file-name=$dir` + if test "x$GCC_INCLUDES" != x && \ + test "$GCC_INCLUDES" != "$dir" && \ + test -d "$GCC_INCLUDES"; then + MKDEP_OPTIONS="$MKDEP_OPTIONS -I$GCC_INCLUDES" + fi + done +fi +AC_SUBST([MKDEP_OPTIONS]) + +dnl Make sure the pkg-config macros are defined +m4_ifndef([PKG_PROG_PKG_CONFIG], + [m4_fatal([Could not locate the pkg-config autoconf macros. + These are usually located in /usr/share/aclocal/pkg.m4. If your macros + are in a different location, try setting the environment variable + ACLOCAL="aclocal -I/other/macro/dir" before running autoreconf.])]) +PKG_PROG_PKG_CONFIG() + +dnl LIB_DIR - library basename +LIB_DIR=`echo $libdir | $SED 's%.*/%%'` +AC_SUBST([LIB_DIR]) + +dnl Cache LDFLAGS so we can add EXTRA_LIB_PATH and restore it later +_SAVE_LDFLAGS="$LDFLAGS" +AC_ARG_VAR([EXTRA_LIB_PATH],[Extra -L paths for the linker]) +AC_SUBST([EXTRA_LIB_PATH]) + +dnl Cache CPPFLAGS so we can add *_INCLUDES and restore it later +_SAVE_CPPFLAGS="$CPPFLAGS" +AC_ARG_VAR([X11_INCLUDES],[Extra -I paths for X11 headers]) +AC_SUBST([X11_INCLUDES]) + +dnl Compiler macros +DEFINES="" +AC_SUBST([DEFINES]) +case "$host_os" in +linux*|*-gnu*|gnu*) + DEFINES="$DEFINES -D_GNU_SOURCE -DPTHREADS" + ;; +solaris*) + DEFINES="$DEFINES -DPTHREADS -DSVR4" + ;; +esac + +dnl Add flags for gcc and g++ +if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math" + + # Work around aliasing bugs - developers should comment this out + CFLAGS="$CFLAGS -fno-strict-aliasing" +fi +if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -Wall" + + # Work around aliasing bugs - developers should comment this out + CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" +fi + +dnl These should be unnecessary, but let the user set them if they want +AC_ARG_VAR([OPT_FLAGS], [Additional optimization flags for the compiler. + Default is to use CFLAGS.]) +AC_ARG_VAR([ARCH_FLAGS], [Additional architecture specific flags for the + compiler. Default is to use CFLAGS.]) +AC_SUBST([OPT_FLAGS]) +AC_SUBST([ARCH_FLAGS]) + +dnl +dnl Hacks to enable 32 or 64 bit build +dnl +AC_ARG_ENABLE([32-bit], + [AS_HELP_STRING([--enable-32-bit], + [build 32-bit libraries @<:@default=auto@:>@])], + [enable_32bit="$enableval"], + [enable_32bit=auto] +) +if test "x$enable_32bit" = xyes; then + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -m32" + ARCH_FLAGS="$ARCH_FLAGS -m32" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -m32" + fi +fi +AC_ARG_ENABLE([64-bit], + [AS_HELP_STRING([--enable-64-bit], + [build 64-bit libraries @<:@default=auto@:>@])], + [enable_64bit="$enableval"], + [enable_64bit=auto] +) +if test "x$enable_64bit" = xyes; then + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -m64" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -m64" + fi +fi + +dnl +dnl shared/static libraries, mimic libtool options +dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static], + [build static libraries @<:@default=disabled@:>@])], + [enable_static="$enableval"], + [enable_static=no] +) +case "x$enable_static" in +xyes|xno ) ;; +x ) enable_static=no ;; +* ) + AC_MSG_ERROR([Static library option '$enable_static' is not a valid]) + ;; +esac +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--disable-shared], + [build shared libraries @<:@default=enabled@:>@])], + [enable_shared="$enableval"], + [enable_shared=yes] +) +case "x$enable_shared" in +xyes|xno ) ;; +x ) enable_shared=yes ;; +* ) + AC_MSG_ERROR([Shared library option '$enable_shared' is not a valid]) + ;; +esac + +dnl Can't have static and shared libraries, default to static if user +dnl explicitly requested. If both disabled, set to static since shared +dnl was explicitly requirested. +case "x$enable_static$enable_shared" in +xyesyes ) + AC_MSG_WARN([Can't build static and shared libraries, disabling shared]) + enable_shared=no + ;; +xnono ) + AC_MSG_WARN([Can't disable both static and shared libraries, enabling static]) + enable_static=yes + ;; +esac + +dnl +dnl mklib options +dnl +AC_ARG_VAR([MKLIB_OPTIONS],[Options for the Mesa library script, mklib]) +if test "$enable_static" = yes; then + MKLIB_OPTIONS="$MKLIB_OPTIONS -static" +fi +AC_SUBST([MKLIB_OPTIONS]) + +dnl +dnl other compiler options +dnl +AC_ARG_ENABLE([debug], + [AS_HELP_STRING([--enable-debug], + [use debug compiler flags and macros @<:@default=disabled@:>@])], + [enable_debug="$enableval"], + [enable_debug=no] +) +if test "x$enable_debug" = xyes; then + DEFINES="$DEFINES -DDEBUG" + if test "x$GCC" = xyes; then + CFLAGS="$CFLAGS -g" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -g" + fi +fi + +dnl +dnl library names +dnl +if test "$enable_static" = yes; then + LIB_EXTENSION='a' +else + case "$host_os" in + darwin* ) + LIB_EXTENSION='dylib' ;; + cygwin* ) + LIB_EXTENSION='dll' ;; + * ) + LIB_EXTENSION='so' ;; + esac +fi + +GL_LIB_NAME='lib$(GL_LIB).'${LIB_EXTENSION} +GLU_LIB_NAME='lib$(GLU_LIB).'${LIB_EXTENSION} +GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION} +GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION} +OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION} + +GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*' +GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*' +GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*' +GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*' +OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*' + +AC_SUBST([GL_LIB_NAME]) +AC_SUBST([GLU_LIB_NAME]) +AC_SUBST([GLUT_LIB_NAME]) +AC_SUBST([GLW_LIB_NAME]) +AC_SUBST([OSMESA_LIB_NAME]) + +AC_SUBST([GL_LIB_GLOB]) +AC_SUBST([GLU_LIB_GLOB]) +AC_SUBST([GLUT_LIB_GLOB]) +AC_SUBST([GLW_LIB_GLOB]) +AC_SUBST([OSMESA_LIB_GLOB]) + +dnl +dnl Arch/platform-specific settings +dnl +AC_ARG_ENABLE([asm], + [AS_HELP_STRING([--disable-asm], + [disable assembly usage @<:@default=enabled on supported plaforms@:>@])], + [enable_asm="$enableval"], + [enable_asm=yes] +) +asm_arch="" +ASM_FLAGS="" +MESA_ASM_SOURCES="" +GLAPI_ASM_SOURCES="" +AC_MSG_CHECKING([whether to enable assembly]) +test "x$enable_asm" = xno && AC_MSG_RESULT([no]) +# disable if cross compiling on x86/x86_64 since we must run gen_matypes +if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then + case "$host_cpu" in + i?86 | x86_64) + enable_asm=no + AC_MSG_RESULT([no, cross compiling]) + ;; + esac +fi +# check for supported arches +if test "x$enable_asm" = xyes; then + case "$host_cpu" in + i?86) + case "$host_os" in + linux* | *freebsd* | dragonfly*) + test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86 + ;; + esac + ;; + x86_64) + case "$host_os" in + linux* | *freebsd* | dragonfly*) + test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64 + ;; + esac + ;; + powerpc) + case "$host_os" in + linux*) + asm_arch=ppc + ;; + esac + ;; + sparc*) + case "$host_os" in + linux*) + asm_arch=sparc + ;; + esac + ;; + esac + + case "$asm_arch" in + x86) + ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM" + MESA_ASM_SOURCES='$(X86_SOURCES)' + GLAPI_ASM_SOURCES='$(X86_API)' + AC_MSG_RESULT([yes, x86]) + ;; + x86_64) + ASM_FLAGS="-DUSE_X86_64_ASM" + MESA_ASM_SOURCES='$(X86-64_SOURCES)' + GLAPI_ASM_SOURCES='$(X86-64_API)' + AC_MSG_RESULT([yes, x86_64]) + ;; + ppc) + ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM" + MESA_ASM_SOURCES='$(PPC_SOURCES)' + AC_MSG_RESULT([yes, ppc]) + ;; + sparc) + ASM_FLAGS="-DUSE_SPARC_ASM" + MESA_ASM_SOURCES='$(SPARC_SOURCES)' + GLAPI_ASM_SOURCES='$(SPARC_API)' + AC_MSG_RESULT([yes, sparc]) + ;; + *) + AC_MSG_RESULT([no, platform not supported]) + ;; + esac +fi +AC_SUBST([ASM_FLAGS]) +AC_SUBST([MESA_ASM_SOURCES]) +AC_SUBST([GLAPI_ASM_SOURCES]) + +dnl PIC code macro +MESA_PIC_FLAGS + +dnl Check to see if dlopen is in default libraries (like Solaris, which +dnl has it in libc), or if libdl is needed to get it. +AC_CHECK_FUNC([dlopen], [], + [AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIBS="-ldl"])]) + +dnl See if posix_memalign is available +AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"]) + +dnl SELinux awareness. +AC_ARG_ENABLE([selinux], + [AS_HELP_STRING([--enable-selinux], + [Build SELinux-aware Mesa @<:@default=disabled@:>@])], + [MESA_SELINUX="$enableval"], + [MESA_SELINUX=no]) +if test "x$enable_selinux" = "xyes"; then + AC_CHECK_HEADER([selinux/selinux.h],[], + [AC_MSG_ERROR([SELinux headers not found])]) + AC_CHECK_LIB([selinux],[is_selinux_enabled],[], + [AC_MSG_ERROR([SELinux library not found])]) + SELINUX_LIBS="-lselinux" + DEFINES="$DEFINES -DMESA_SELINUX" +fi + +dnl +dnl Driver configuration. Options are xlib, dri and osmesa right now. +dnl More later: directfb, fbdev, ... +dnl +default_driver="xlib" + +case "$host_os" in +linux*) + case "$host_cpu" in + i*86|x86_64|powerpc*|sparc*) default_driver="dri";; + esac + ;; +*freebsd* | dragonfly*) + case "$host_cpu" in + i*86|x86_64|powerpc*|sparc*) default_driver="dri";; + esac + ;; +esac + +AC_ARG_WITH([driver], + [AS_HELP_STRING([--with-driver=DRIVER], + [driver for Mesa: xlib,dri,osmesa @<:@default=dri when available, or xlib@:>@])], + [mesa_driver="$withval"], + [mesa_driver="$default_driver"]) +dnl Check for valid option +case "x$mesa_driver" in +xxlib|xdri|xosmesa) + ;; +*) + AC_MSG_ERROR([Driver '$mesa_driver' is not a valid option]) + ;; +esac + +dnl +dnl Driver specific build directories +dnl +SRC_DIRS="mesa glew" +GLU_DIRS="sgi" +WINDOW_SYSTEM="" +GALLIUM_DIRS="auxiliary drivers state_trackers" +GALLIUM_WINSYS_DIRS="" +GALLIUM_WINSYS_DRM_DIRS="" +GALLIUM_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices" +GALLIUM_DRIVERS_DIRS="softpipe failover trace identity" +GALLIUM_STATE_TRACKERS_DIRS="" + +case "$mesa_driver" in +xlib) + DRIVER_DIRS="x11" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS xlib" + ;; +dri) + SRC_DIRS="glx/x11 $SRC_DIRS" + DRIVER_DIRS="dri" + WINDOW_SYSTEM="dri" + GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS drm" + ;; +osmesa) + DRIVER_DIRS="osmesa" + ;; +esac +AC_SUBST([SRC_DIRS]) +AC_SUBST([GLU_DIRS]) +AC_SUBST([DRIVER_DIRS]) +AC_SUBST([WINDOW_SYSTEM]) +AC_SUBST([GALLIUM_DIRS]) +AC_SUBST([GALLIUM_WINSYS_DIRS]) +AC_SUBST([GALLIUM_WINSYS_DRM_DIRS]) +AC_SUBST([GALLIUM_DRIVERS_DIRS]) +AC_SUBST([GALLIUM_AUXILIARY_DIRS]) +AC_SUBST([GALLIUM_STATE_TRACKERS_DIRS]) +AC_SUBST([RADEON_CFLAGS]) +AC_SUBST([RADEON_LDFLAGS]) + +dnl +dnl User supplied program configuration +dnl +if test -d "$srcdir/progs/demos"; then + default_demos=yes +else + default_demos=no +fi +AC_ARG_WITH([demos], + [AS_HELP_STRING([--with-demos@<:@=DIRS...@:>@], + [optional comma delimited demo directories to build + @<:@default=auto if source available@:>@])], + [with_demos="$withval"], + [with_demos="$default_demos"]) +if test "x$with_demos" = x; then + with_demos=no +fi + +dnl If $with_demos is yes, directories will be added as libs available +PROGRAM_DIRS="" +case "$with_demos" in +no) ;; +yes) + # If the driver isn't osmesa, we have libGL and can build xdemos + if test "$mesa_driver" != osmesa; then + PROGRAM_DIRS="xdemos" + fi + ;; +*) + # verify the requested demos directories exist + demos=`IFS=,; echo $with_demos` + for demo in $demos; do + test -d "$srcdir/progs/$demo" || \ + AC_MSG_ERROR([Program directory '$demo' doesn't exist]) + done + PROGRAM_DIRS="$demos" + ;; +esac + +dnl +dnl Find out if X is available. The variable have_x is set if libX11 is +dnl found to mimic AC_PATH_XTRA. +dnl +if test -n "$PKG_CONFIG"; then + AC_MSG_CHECKING([pkg-config files for X11 are available]) + PKG_CHECK_EXISTS([x11],[ + x11_pkgconfig=yes + have_x=yes + ],[ + x11_pkgconfig=no + ]) + AC_MSG_RESULT([$x11_pkgconfig]) +else + x11_pkgconfig=no +fi +dnl Use the autoconf macro if no pkg-config files +if test "$x11_pkgconfig" = no; then + AC_PATH_XTRA +fi + +dnl Try to tell the user that the --x-* options are only used when +dnl pkg-config is not available. This must be right after AC_PATH_XTRA. +m4_divert_once([HELP_BEGIN], +[These options are only used when the X libraries cannot be found by the +pkg-config utility.]) + +dnl We need X for xlib and dri, so bomb now if it's not found +case "$mesa_driver" in +xlib|dri) + if test "$no_x" = yes; then + AC_MSG_ERROR([X11 development libraries needed for $mesa_driver driver]) + fi + ;; +esac + +dnl XCB - this is only used for GLX right now +AC_ARG_ENABLE([xcb], + [AS_HELP_STRING([--enable-xcb], + [use XCB for GLX @<:@default=disabled@:>@])], + [enable_xcb="$enableval"], + [enable_xcb=no]) +if test "x$enable_xcb" = xyes; then + DEFINES="$DEFINES -DUSE_XCB" +else + enable_xcb=no +fi + +dnl +dnl libGL configuration per driver +dnl +case "$mesa_driver" in +xlib) + if test "$x11_pkgconfig" = yes; then + PKG_CHECK_MODULES([XLIBGL], [x11 xext]) + GL_PC_REQ_PRIV="x11 xext" + X11_INCLUDES="$X11_INCLUDES $XLIBGL_CFLAGS" + GL_LIB_DEPS="$XLIBGL_LIBS" + else + # should check these... + X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" + GL_LIB_DEPS="$X_LIBS -lX11 -lXext" + GL_PC_LIB_PRIV="$GL_LIB_DEPS" + GL_PC_CFLAGS="$X11_INCLUDES" + fi + GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread" + GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread" + + # if static, move the external libraries to the programs + # and empty the libraries for libGL + if test "$enable_static" = yes; then + APP_LIB_DEPS="$APP_LIB_DEPS $GL_LIB_DEPS" + GL_LIB_DEPS="" + fi + ;; +dri) + # DRI must be shared, I think + if test "$enable_static" = yes; then + AC_MSG_ERROR([Can't use static libraries for DRI drivers]) + fi + + # Check for libdrm + PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) + PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) + GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED" + DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" + + PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no) + + if test "$HAVE_LIBDRM_RADEON" = yes; then + RADEON_CFLAGS="-DHAVE_LIBDRM_RADEON=1 $LIBDRM_RADEON_CFLAGS" + RADEON_LDFLAGS=$LIBDRM_RADEON_LIBS + fi + + # find the DRI deps for libGL + if test "$x11_pkgconfig" = yes; then + # add xcb modules if necessary + dri_modules="x11 xext xxf86vm xdamage xfixes" + if test "$enable_xcb" = yes; then + dri_modules="$dri_modules x11-xcb xcb-glx" + fi + + PKG_CHECK_MODULES([DRIGL], [$dri_modules]) + GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV $dri_modules" + X11_INCLUDES="$X11_INCLUDES $DRIGL_CFLAGS" + GL_LIB_DEPS="$DRIGL_LIBS" + else + # should check these... + X11_INCLUDES="$X11_INCLUDES $X_CFLAGS" + GL_LIB_DEPS="$X_LIBS -lX11 -lXext -lXxf86vm -lXdamage -lXfixes" + GL_PC_LIB_PRIV="$GL_LIB_DEPS" + GL_PC_CFLAGS="$X11_INCLUDES" + + # XCB can only be used from pkg-config + if test "$enable_xcb" = yes; then + PKG_CHECK_MODULES([XCB],[x11-xcb xcb-glx]) + GL_PC_REQ_PRIV="$GL_PC_REQ_PRIV x11-xcb xcb-glx" + X11_INCLUDES="$X11_INCLUDES $XCB_CFLAGS" + GL_LIB_DEPS="$GL_LIB_DEPS $XCB_LIBS" + fi + fi + + # need DRM libs, -lpthread, etc. + GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS" + GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS" + ;; +osmesa) + # No libGL for osmesa + GL_LIB_DEPS="" + ;; +esac +AC_SUBST([GL_LIB_DEPS]) +AC_SUBST([GL_PC_REQ_PRIV]) +AC_SUBST([GL_PC_LIB_PRIV]) +AC_SUBST([GL_PC_CFLAGS]) +AC_SUBST([DRI_PC_REQ_PRIV]) + +dnl +dnl More X11 setup +dnl +if test "$mesa_driver" = xlib; then + DEFINES="$DEFINES -DUSE_XSHM" +fi + +dnl +dnl More DRI setup +dnl +AC_ARG_ENABLE([glx-tls], + [AS_HELP_STRING([--enable-glx-tls], + [enable TLS support in GLX @<:@default=disabled@:>@])], + [GLX_USE_TLS="$enableval"], + [GLX_USE_TLS=no]) +dnl Directory for DRI drivers +AC_ARG_WITH([dri-driverdir], + [AS_HELP_STRING([--with-dri-driverdir=DIR], + [directory for the DRI drivers @<:@${libdir}/dri@:>@])], + [DRI_DRIVER_INSTALL_DIR="$withval"], + [DRI_DRIVER_INSTALL_DIR='${libdir}/dri']) +AC_SUBST([DRI_DRIVER_INSTALL_DIR]) +dnl Direct rendering or just indirect rendering +AC_ARG_ENABLE([driglx-direct], + [AS_HELP_STRING([--disable-driglx-direct], + [enable direct rendering in GLX for DRI @<:@default=enabled@:>@])], + [driglx_direct="$enableval"], + [driglx_direct="yes"]) +dnl Which drivers to build - default is chosen by platform +AC_ARG_WITH([dri-drivers], + [AS_HELP_STRING([--with-dri-drivers@<:@=DIRS...@:>@], + [comma delimited DRI drivers list, e.g. + "swrast,i965,radeon" @<:@default=auto@:>@])], + [with_dri_drivers="$withval"], + [with_dri_drivers=yes]) +if test "x$with_dri_drivers" = x; then + with_dri_drivers=no +fi + +dnl If $with_dri_drivers is yes, directories will be added through +dnl platform checks +DRI_DIRS="" +case "$with_dri_drivers" in +no) ;; +yes) + DRI_DIRS="yes" + ;; +*) + # verify the requested driver directories exist + dri_drivers=`IFS=', '; echo $with_dri_drivers` + for driver in $dri_drivers; do + test -d "$srcdir/src/mesa/drivers/dri/$driver" || \ + AC_MSG_ERROR([DRI driver directory '$driver' doesn't exist]) + done + DRI_DIRS="$dri_drivers" + ;; +esac + +dnl Just default to no EGL for now +USING_EGL=0 +AC_SUBST([USING_EGL]) + +dnl Set DRI_DIRS, DEFINES and LIB_DEPS +if test "$mesa_driver" = dri; then + # Use TLS in GLX? + if test "x$GLX_USE_TLS" = xyes; then + DEFINES="$DEFINES -DGLX_USE_TLS -DPTHREADS" + fi + + if test "x$USING_EGL" = x1; then + PROGRAM_DIRS="egl" + fi + + # Platform specific settings and drivers to build + case "$host_os" in + linux*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" + + case "$host_cpu" in + x86_64) + # ffb, gamma, and sis are missing because they have not be + # converted to use the new interface. i810 are missing + # because there is no x86-64 system where they could *ever* + # be used. + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="i915 i965 mach64 mga r128 r200 r300 r600 radeon \ + savage tdfx unichrome swrast" + fi + ;; + powerpc*) + # Build only the drivers for cards that exist on PowerPC. + # At some point MGA will be added, but not yet. + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="mach64 r128 r200 r300 r600 radeon tdfx swrast" + fi + ;; + sparc*) + # Build only the drivers for cards that exist on sparc` + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="mach64 r128 r200 r300 r600 radeon ffb swrast" + fi + ;; + esac + ;; + freebsd* | dragonfly*) + DEFINES="$DEFINES -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1" + DEFINES="$DEFINES -DIN_DRI_DRIVER -DHAVE_ALIAS" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + if test "x$GXX" = xyes; then + CXXFLAGS="$CXXFLAGS -ansi -pedantic" + fi + + # ffb and gamma are missing because they have not been converted + # to use the new interface. + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon tdfx \ + unichrome savage sis swrast" + fi + ;; + gnu*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING -DHAVE_ALIAS" + ;; + solaris*) + DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" + DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" + if test "x$driglx_direct" = xyes; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + ;; + esac + + # default drivers + if test "x$DRI_DIRS" = "xyes"; then + DRI_DIRS="i810 i915 i965 mach64 mga r128 r200 r300 r600 radeon s3v \ + savage sis tdfx trident unichrome ffb swrast" + fi + + DRI_DIRS=`echo "$DRI_DIRS" | $SED 's/ */ /g'` + + # Check for expat + EXPAT_INCLUDES="" + EXPAT_LIB=-lexpat + AC_ARG_WITH([expat], + [AS_HELP_STRING([--with-expat=DIR], + [expat install directory])],[ + EXPAT_INCLUDES="-I$withval/include" + CPPFLAGS="$CPPFLAGS $EXPAT_INCLUDES" + LDFLAGS="$LDFLAGS -L$withval/$LIB_DIR" + EXPAT_LIB="-L$withval/$LIB_DIR -lexpat" + ]) + AC_CHECK_HEADER([expat.h],[],[AC_MSG_ERROR([Expat required for DRI.])]) + AC_CHECK_LIB([expat],[XML_ParserCreate],[], + [AC_MSG_ERROR([Expat required for DRI.])]) + + # put all the necessary libs together + DRI_LIB_DEPS="$SELINUX_LIBS $LIBDRM_LIBS $EXPAT_LIB -lm -lpthread $DLOPEN_LIBS" +fi +AC_SUBST([DRI_DIRS]) +AC_SUBST([EXPAT_INCLUDES]) +AC_SUBST([DRI_LIB_DEPS]) + +dnl +dnl OSMesa configuration +dnl +if test "$mesa_driver" = xlib; then + default_gl_osmesa=yes +else + default_gl_osmesa=no +fi +AC_ARG_ENABLE([gl-osmesa], + [AS_HELP_STRING([--enable-gl-osmesa], + [enable OSMesa on libGL @<:@default=enabled for xlib driver@:>@])], + [gl_osmesa="$enableval"], + [gl_osmesa="$default_gl_osmesa"]) +if test "x$gl_osmesa" = xyes; then + if test "$mesa_driver" = osmesa; then + AC_MSG_ERROR([libGL is not available for OSMesa driver]) + else + DRIVER_DIRS="$DRIVER_DIRS osmesa" + fi +fi + +dnl Configure the channel bits for OSMesa (libOSMesa, libOSMesa16, ...) +AC_ARG_WITH([osmesa-bits], + [AS_HELP_STRING([--with-osmesa-bits=BITS], + [OSMesa channel bits and library name: 8, 16, 32 @<:@default=8@:>@])], + [osmesa_bits="$withval"], + [osmesa_bits=8]) +if test "$mesa_driver" != osmesa && test "x$osmesa_bits" != x8; then + AC_MSG_WARN([Ignoring OSMesa channel bits for non-OSMesa driver]) + osmesa_bits=8 +fi +case "x$osmesa_bits" in +x8) + OSMESA_LIB=OSMesa + ;; +x16|x32) + OSMESA_LIB="OSMesa$osmesa_bits" + DEFINES="$DEFINES -DCHAN_BITS=$osmesa_bits -DDEFAULT_SOFTWARE_DEPTH_BITS=31" + ;; +*) + AC_MSG_ERROR([OSMesa bits '$osmesa_bits' is not a valid option]) + ;; +esac +AC_SUBST([OSMESA_LIB]) + +case "$mesa_driver" in +osmesa) + # only link libraries with osmesa if shared + if test "$enable_static" = no; then + OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" + else + OSMESA_LIB_DEPS="" + fi + OSMESA_MESA_DEPS="" + OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS" + ;; +*) + # Link OSMesa to libGL otherwise + OSMESA_LIB_DEPS="" + # only link libraries with osmesa if shared + if test "$enable_static" = no; then + OSMESA_MESA_DEPS='-l$(GL_LIB)' + else + OSMESA_MESA_DEPS="" + fi + OSMESA_PC_REQ="gl" + ;; +esac +OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV" +AC_SUBST([OSMESA_LIB_DEPS]) +AC_SUBST([OSMESA_MESA_DEPS]) +AC_SUBST([OSMESA_PC_REQ]) +AC_SUBST([OSMESA_PC_LIB_PRIV]) + +dnl +dnl EGL configuration +dnl +AC_ARG_ENABLE([egl], + [AS_HELP_STRING([--disable-egl], + [disable EGL library @<:@default=enabled@:>@])], + [enable_egl="$enableval"], + [enable_egl=yes]) +if test "x$enable_egl" = xyes; then + SRC_DIRS="$SRC_DIRS egl" + + if test "$x11_pkgconfig" = yes; then + PKG_CHECK_MODULES([EGL], [x11]) + EGL_LIB_DEPS="$EGL_LIBS" + else + # should check these... + EGL_LIB_DEPS="$X_LIBS -lX11" + fi + EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS" +fi +AC_SUBST([EGL_LIB_DEPS]) + +dnl +dnl GLU configuration +dnl +AC_ARG_ENABLE([glu], + [AS_HELP_STRING([--disable-glu], + [enable OpenGL Utility library @<:@default=enabled@:>@])], + [enable_glu="$enableval"], + [enable_glu=yes]) +if test "x$enable_glu" = xyes; then + SRC_DIRS="$SRC_DIRS glu" + + case "$mesa_driver" in + osmesa) + # If GLU is available and we have libOSMesa (not 16 or 32), + # we can build the osdemos + if test "$with_demos" = yes && test "$osmesa_bits" = 8; then + PROGRAM_DIRS="$PROGRAM_DIRS osdemos" + fi + + # Link libGLU to libOSMesa instead of libGL + GLU_LIB_DEPS="" + GLU_PC_REQ="osmesa" + if test "$enable_static" = no; then + GLU_MESA_DEPS='-l$(OSMESA_LIB)' + else + GLU_MESA_DEPS="" + fi + ;; + *) + # If static, empty GLU_LIB_DEPS and add libs for programs to link + GLU_PC_REQ="gl" + GLU_PC_LIB_PRIV="-lm" + if test "$enable_static" = no; then + GLU_LIB_DEPS="-lm" + GLU_MESA_DEPS='-l$(GL_LIB)' + else + GLU_LIB_DEPS="" + GLU_MESA_DEPS="" + APP_LIB_DEPS="$APP_LIB_DEPS -lstdc++" + fi + ;; + esac +fi +if test "$enable_static" = no; then + GLU_LIB_DEPS="$GLU_LIB_DEPS $OS_CPLUSPLUS_LIBS" +fi +GLU_PC_LIB_PRIV="$GLU_PC_LIB_PRIV $OS_CPLUSPLUS_LIBS" +AC_SUBST([GLU_LIB_DEPS]) +AC_SUBST([GLU_MESA_DEPS]) +AC_SUBST([GLU_PC_REQ]) +AC_SUBST([GLU_PC_REQ_PRIV]) +AC_SUBST([GLU_PC_LIB_PRIV]) +AC_SUBST([GLU_PC_CFLAGS]) + +dnl +dnl GLw configuration +dnl +AC_ARG_ENABLE([glw], + [AS_HELP_STRING([--disable-glw], + [enable Xt/Motif widget library @<:@default=enabled@:>@])], + [enable_glw="$enableval"], + [enable_glw=yes]) +dnl Don't build GLw on osmesa +if test "x$enable_glw" = xyes && test "$mesa_driver" = osmesa; then + AC_MSG_WARN([Disabling GLw since the driver is OSMesa]) + enable_glw=no +fi +AC_ARG_ENABLE([motif], + [AS_HELP_STRING([--enable-motif], + [use Motif widgets in GLw @<:@default=disabled@:>@])], + [enable_motif="$enableval"], + [enable_motif=no]) + +if test "x$enable_glw" = xyes; then + SRC_DIRS="$SRC_DIRS glw" + if test "$x11_pkgconfig" = yes; then + PKG_CHECK_MODULES([GLW],[x11 xt]) + GLW_PC_REQ_PRIV="x11 xt" + GLW_LIB_DEPS="$GLW_LIBS" + else + # should check these... + GLW_LIB_DEPS="$X_LIBS -lXt -lX11" + GLW_PC_LIB_PRIV="$GLW_LIB_DEPS" + GLW_PC_CFLAGS="$X11_INCLUDES" + fi + + GLW_SOURCES="GLwDrawA.c" + MOTIF_CFLAGS= + if test "x$enable_motif" = xyes; then + GLW_SOURCES="$GLW_SOURCES GLwMDrawA.c" + AC_PATH_PROG([MOTIF_CONFIG], [motif-config], [no]) + if test "x$MOTIF_CONFIG" != xno; then + MOTIF_CFLAGS=`$MOTIF_CONFIG --cflags` + MOTIF_LIBS=`$MOTIF_CONFIG --libs` + else + AC_CHECK_HEADER([Xm/PrimitiveP.h], [], + [AC_MSG_ERROR([Can't locate Motif headers])]) + AC_CHECK_LIB([Xm], [XmGetPixmap], [MOTIF_LIBS="-lXm"], + [AC_MSG_ERROR([Can't locate Motif Xm library])]) + fi + # MOTIF_LIBS is prepended to GLW_LIB_DEPS since Xm needs Xt/X11 + GLW_LIB_DEPS="$MOTIF_LIBS $GLW_LIB_DEPS" + GLW_PC_LIB_PRIV="$MOTIF_LIBS $GLW_PC_LIB_PRIV" + GLW_PC_CFLAGS="$MOTIF_CFLAGS $GLW_PC_CFLAGS" + fi + + # If static, empty GLW_LIB_DEPS and add libs for programs to link + GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV" + if test "$enable_static" = no; then + GLW_MESA_DEPS='-l$(GL_LIB)' + GLW_LIB_DEPS="$GLW_LIB_DEPS" + else + APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS" + GLW_LIB_DEPS="" + GLW_MESA_DEPS="" + fi +fi +AC_SUBST([GLW_LIB_DEPS]) +AC_SUBST([GLW_MESA_DEPS]) +AC_SUBST([GLW_SOURCES]) +AC_SUBST([MOTIF_CFLAGS]) +AC_SUBST([GLW_PC_REQ_PRIV]) +AC_SUBST([GLW_PC_LIB_PRIV]) +AC_SUBST([GLW_PC_CFLAGS]) + +dnl +dnl GLUT configuration +dnl +if test -f "$srcdir/include/GL/glut.h"; then + default_glut=yes +else + default_glut=no +fi +AC_ARG_ENABLE([glut], + [AS_HELP_STRING([--disable-glut], + [enable GLUT library @<:@default=enabled if source available@:>@])], + [enable_glut="$enableval"], + [enable_glut="$default_glut"]) + +dnl Can't build glut if GLU not available +if test "x$enable_glu$enable_glut" = xnoyes; then + AC_MSG_WARN([Disabling glut since GLU is disabled]) + enable_glut=no +fi +dnl Don't build glut on osmesa +if test "x$enable_glut" = xyes && test "$mesa_driver" = osmesa; then + AC_MSG_WARN([Disabling glut since the driver is OSMesa]) + enable_glut=no +fi + +if test "x$enable_glut" = xyes; then + SRC_DIRS="$SRC_DIRS glut/glx" + GLUT_CFLAGS="" + if test "x$GCC" = xyes; then + GLUT_CFLAGS="-fexceptions" + fi + if test "$x11_pkgconfig" = yes; then + PKG_CHECK_MODULES([GLUT],[x11 xmu xi]) + GLUT_PC_REQ_PRIV="x11 xmu xi" + GLUT_LIB_DEPS="$GLUT_LIBS" + else + # should check these... + GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi" + GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS" + GLUT_PC_CFLAGS="$X11_INCLUDES" + fi + GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm" + GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm" + + # If glut is available, we can build most programs + if test "$with_demos" = yes; then + PROGRAM_DIRS="$PROGRAM_DIRS demos redbook samples glsl" + fi + + # If static, empty GLUT_LIB_DEPS and add libs for programs to link + if test "$enable_static" = no; then + GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)' + else + APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS" + GLUT_LIB_DEPS="" + GLUT_MESA_DEPS="" + fi +fi +AC_SUBST([GLUT_LIB_DEPS]) +AC_SUBST([GLUT_MESA_DEPS]) +AC_SUBST([GLUT_CFLAGS]) +AC_SUBST([GLUT_PC_REQ_PRIV]) +AC_SUBST([GLUT_PC_LIB_PRIV]) +AC_SUBST([GLUT_PC_CFLAGS]) + +dnl +dnl Program library dependencies +dnl Only libm is added here if necessary as the libraries should +dnl be pulled in by the linker +dnl +if test "x$APP_LIB_DEPS" = x; then + case "$host_os" in + solaris*) + APP_LIB_DEPS="-lX11 -lsocket -lnsl -lm" + ;; + cygwin*) + APP_LIB_DEPS="-lX11" + ;; + *) + APP_LIB_DEPS="-lm" + ;; + esac +fi +AC_SUBST([APP_LIB_DEPS]) +AC_SUBST([PROGRAM_DIRS]) + +dnl +dnl Gallium configuration +dnl +AC_ARG_ENABLE([gallium], + [AS_HELP_STRING([--disable-gallium], + [build gallium @<:@default=enabled@:>@])], + [enable_gallium="$enableval"], + [enable_gallium=yes]) +if test "x$enable_gallium" = xyes; then + SRC_DIRS="$SRC_DIRS gallium gallium/winsys" +fi + +dnl +dnl Gallium state trackers configuration +dnl +AC_ARG_WITH([state-trackers], + [AS_HELP_STRING([--with-state-trackers@<:@=DIRS...@:>@], + [comma delimited state_trackers list, e.g. + "egl,glx" @<:@default=auto@:>@])], + [with_state_trackers="$withval"], + [with_state_trackers=yes]) + +case "$with_state_trackers" in +no) + GALLIUM_STATE_TRACKERS_DIRS="" + ;; +yes) + # look at what else is built + case "$mesa_driver" in + xlib) + GALLIUM_STATE_TRACKERS_DIRS=glx + ;; + dri) + test "x$enable_egl" = xyes && GALLIUM_STATE_TRACKERS_DIRS=egl + ;; + esac + ;; +*) + # verify the requested state tracker exist + state_trackers=`IFS=', '; echo $with_state_trackers` + for tracker in $state_trackers; do + test -d "$srcdir/src/gallium/state_trackers/$tracker" || \ + AC_MSG_ERROR([state tracker '$tracker' doesn't exist]) + + if test "$tracker" = egl && test "x$enable_egl" != xyes; then + AC_MSG_ERROR([cannot build egl state tracker without EGL library]) + fi + done + GALLIUM_STATE_TRACKERS_DIRS="$state_trackers" + ;; +esac + +AC_ARG_WITH([xorg-driver-dir], + [AS_HELP_STRING([--with-xorg-driver-dir=DIR], + [Default xorg driver directory[[default=${libdir}/xorg/modules/drivers]]])], + [XORG_DRIVER_INSTALL_DIR="$withval"], + [XORG_DRIVER_INSTALL_DIR="${libdir}/xorg/modules/drivers"]) +AC_SUBST([XORG_DRIVER_INSTALL_DIR]) + +AC_ARG_WITH([max-width], + [AS_HELP_STRING([--with-max-width=N], + [Maximum framebuffer width (4096)])], + [DEFINES="${DEFINES} -DMAX_WIDTH=${withval}"; + AS_IF([test "${withval}" -gt "4096"], + [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])] +) +AC_ARG_WITH([max-height], + [AS_HELP_STRING([--with-max-height=N], + [Maximum framebuffer height (4096)])], + [DEFINES="${DEFINES} -DMAX_HEIGHT=${withval}"; + AS_IF([test "${withval}" -gt "4096"], + [AC_MSG_WARN([Large framebuffer: see s_tritemp.h comments.])])] +) + +dnl +dnl Gallium Intel configuration +dnl +AC_ARG_ENABLE([gallium-intel], + [AS_HELP_STRING([--disable-gallium-intel], + [build gallium intel @<:@default=enabled@:>@])], + [enable_gallium_intel="$enableval"], + [enable_gallium_intel=yes]) +if test "x$enable_gallium_intel" = xyes; then + GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS intel" + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS i915simple" +fi + +dnl +dnl Gallium Radeon configuration +dnl +AC_ARG_ENABLE([gallium-radeon], + [AS_HELP_STRING([--enable-gallium-radeon], + [build gallium radeon @<:@default=disabled@:>@])], + [enable_gallium_radeon="$enableval"], + [enable_gallium_radeon=no]) +if test "x$enable_gallium_radeon" = xyes; then + GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS radeon" + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS r300" +fi + +dnl +dnl Gallium Nouveau configuration +dnl +AC_ARG_ENABLE([gallium-nouveau], + [AS_HELP_STRING([--enable-gallium-nouveau], + [build gallium nouveau @<:@default=disabled@:>@])], + [enable_gallium_nouveau="$enableval"], + [enable_gallium_nouveau=no]) +if test "x$enable_gallium_nouveau" = xyes; then + GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau" + GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50" +fi + + +dnl Restore LDFLAGS and CPPFLAGS +LDFLAGS="$_SAVE_LDFLAGS" +CPPFLAGS="$_SAVE_CPPFLAGS" + +dnl Substitute the config +AC_CONFIG_FILES([configs/autoconf]) + +dnl Replace the configs/current symlink +AC_CONFIG_COMMANDS([configs],[ +if test -f configs/current || test -L configs/current; then + rm -f configs/current +fi +ln -s autoconf configs/current +]) + +AC_OUTPUT + +dnl +dnl Output some configuration info for the user +dnl +echo "" +echo " prefix: $prefix" +echo " exec_prefix: $exec_prefix" +echo " libdir: $libdir" +echo " includedir: $includedir" + +dnl Driver info +echo "" +echo " Driver: $mesa_driver" +if echo "$DRIVER_DIRS" | grep 'osmesa' >/dev/null 2>&1; then + echo " OSMesa: lib$OSMESA_LIB" +else + echo " OSMesa: no" +fi +if test "$mesa_driver" = dri; then + # cleanup the drivers var + dri_dirs=`echo $DRI_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` +if test "x$DRI_DIRS" = x; then + echo " DRI drivers: no" +else + echo " DRI drivers: $dri_dirs" +fi + echo " DRI driver dir: $DRI_DRIVER_INSTALL_DIR" +fi +echo " Use XCB: $enable_xcb" + +echo "" +if echo "$SRC_DIRS" | grep 'gallium' >/dev/null 2>&1; then + echo " Gallium: yes" + echo " Gallium dirs: $GALLIUM_DIRS" + echo " Winsys dirs: $GALLIUM_WINSYS_DIRS" + echo " Winsys drm dirs:$GALLIUM_WINSYS_DRM_DIRS" + echo " Auxiliary dirs: $GALLIUM_AUXILIARY_DIRS" + echo " Driver dirs: $GALLIUM_DRIVERS_DIRS" + echo " Trackers dirs: $GALLIUM_STATE_TRACKERS_DIRS" +else + echo " Gallium: no" +fi + +dnl Libraries +echo "" +echo " Shared libs: $enable_shared" +echo " Static libs: $enable_static" +echo " EGL: $enable_egl" +echo " GLU: $enable_glu" +echo " GLw: $enable_glw (Motif: $enable_motif)" +echo " glut: $enable_glut" + +dnl Programs +# cleanup the programs var for display +program_dirs=`echo $PROGRAM_DIRS | $SED 's/^ *//;s/ */ /;s/ *$//'` +if test "x$program_dirs" = x; then + echo " Demos: no" +else + echo " Demos: $program_dirs" +fi + +dnl Compiler options +# cleanup the CFLAGS/CXXFLAGS/DEFINES vars +cflags=`echo $CFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ + $SED 's/^ *//;s/ */ /;s/ *$//'` +cxxflags=`echo $CXXFLAGS $OPT_FLAGS $PIC_FLAGS $ARCH_FLAGS | \ + $SED 's/^ *//;s/ */ /;s/ *$//'` +defines=`echo $DEFINES $ASM_FLAGS | $SED 's/^ *//;s/ */ /;s/ *$//'` +echo "" +echo " CFLAGS: $cflags" +echo " CXXFLAGS: $cxxflags" +echo " Macros: $defines" + +echo "" +echo " Run '${MAKE-make}' to build Mesa" +echo "" diff --git a/mesalib/docs/COPYING b/mesalib/docs/COPYING new file mode 100644 index 000000000..b88946cc6 --- /dev/null +++ b/mesalib/docs/COPYING @@ -0,0 +1,490 @@ + +Some parts of Mesa are copyrighted under the GNU LGPL. See the +Mesa/docs/COPYRIGHT file for details. + +The following is the standard GNU copyright file. +---------------------------------------------------------------------- + + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + diff --git a/mesalib/docs/MESA_agp_offset.spec b/mesalib/docs/MESA_agp_offset.spec new file mode 100644 index 000000000..8dcc72379 --- /dev/null +++ b/mesalib/docs/MESA_agp_offset.spec @@ -0,0 +1,95 @@ +Name + + MESA_agp_offset + +Name Strings + + GLX_MESA_agp_offset + +Contact + + Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com) + Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com) + +Status + + Shipping (Mesa 4.0.4 and later. Only implemented in particular + XFree86/DRI drivers.) + +Version + + 1.0 + +Number + + TBD + +Dependencies + + OpenGL 1.0 or later is required + GLX_NV_vertex_array_range is required. + This extensions is written against the OpenGL 1.4 Specification. + +Overview + + This extensions provides a way to convert pointers in an AGP memory + region into byte offsets into the AGP aperture. + Note, this extension depends on GLX_NV_vertex_array_range, for which + no real specification exists. See GL_NV_vertex_array_range for more + information. + +IP Status + + None + +Issues + + None + +New Procedures and Functions + + unsigned int glXGetAGPOffsetMESA( const void *pointer ) + +New Tokens + + None + +Additions to the OpenGL 1.4 Specification + + None + +Additions to Chapter 3 the GLX 1.4 Specification (Functions and Errors) + + Add a new section, 3.6 as follows: + + 3.6 AGP Memory Access + + On "PC" computers, AGP memory can be allocated with glXAllocateMemoryNV + and freed with glXFreeMemoryNV. Sometimes it's useful to know where a + block of AGP memory is located with respect to the start of the AGP + aperature. The function + + GLuint glXGetAGPOffsetMESA( const GLvoid *pointer ) + + Returns the offset of the given memory block from the start of AGP + memory in basic machine units (i.e. bytes). If pointer is invalid + the value ~0 will be returned. + +GLX Protocol + + None. This is a client side-only extension. + +Errors + + glXGetAGPOffsetMESA will return ~0 if the pointer does not point to + an AGP memory region. + +New State + + None + +Revision History + + 20 September 2002 - Initial draft + 2 October 2002 - finished GLX chapter 3 additions + 27 July 2004 - use unsigned int instead of GLuint, void instead of GLvoid diff --git a/mesalib/docs/MESA_copy_sub_buffer.spec b/mesalib/docs/MESA_copy_sub_buffer.spec new file mode 100644 index 000000000..752a014b3 --- /dev/null +++ b/mesalib/docs/MESA_copy_sub_buffer.spec @@ -0,0 +1,96 @@ +Name + + MESA_copy_sub_buffer + +Name Strings + + GLX_MESA_copy_sub_buffer + +Contact + + Brian Paul (brian.paul 'at' tungstengraphics.com) + +Status + + Shipping since Mesa 2.6 in February, 1998. + +Version + + Last Modified Date: 12 January 2009 + +Number + + 215 + +Dependencies + + OpenGL 1.0 or later is required. + GLX 1.0 or later is required. + +Overview + + The glxCopySubBufferMESA() function copies a rectangular region + of the back color buffer to the front color buffer. This can be + used to quickly repaint 3D windows in response to expose events + when the back color buffer cannot be damaged by other windows. + +IP Status + + Open-source; freely implementable. + +Issues + + None. + +New Procedures and Functions + + void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, + int x, int y, int width, int height ); + +New Tokens + + None. + +Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors) + + Add to section 3.3.10 Double Buffering: + + The function + + void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable, + int x, int y, int width, int height ); + + may be used to copy a rectangular region of the back color buffer to + the front color buffer. This can be used to quickly repaint 3D windows + in response to expose events when the back color buffer cannot be + damaged by other windows. + + and indicates the lower-left corner of the region to copy and + and indicate the size in pixels. Coordinate (0,0) + corresponds to the lower-left pixel of the window, like glReadPixels. + + If dpy and drawable are the display and drawable for the calling + thread's current context, glXCopySubBufferMESA performs an + implicit glFlush before it returns. Subsequent OpenGL commands + may be issued immediately after calling glXCopySubBufferMESA, but + are not executed until the copy is completed. + +GLX Protocol + + None at this time. The extension is implemented in terms of ordinary + Xlib protocol inside of Mesa. + +Errors + + None. + +New State + + None. + +Revision History + + 12 January 2009 Ian Romanick - Added language about implicit flush + and command completion. + 8 June 2000 Brian Paul - initial specification + diff --git a/mesalib/docs/MESA_pack_invert.spec b/mesalib/docs/MESA_pack_invert.spec new file mode 100644 index 000000000..53d5fca71 --- /dev/null +++ b/mesalib/docs/MESA_pack_invert.spec @@ -0,0 +1,138 @@ +Name + + MESA_pack_invert + +Name Strings + + GL_MESA_pack_invert + +Contact + + Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com) + Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com) + +Status + + Shipping (Mesa 4.0.4 and later) + +Version + + 1.0 + +Number + + TBD + +Dependencies + + OpenGL 1.0 or later is required + This extensions is written against the OpenGL 1.4 Specification. + +Overview + + This extension adds a new pixel storage parameter to indicate that + images are to be packed in top-to-bottom order instead of OpenGL's + conventional bottom-to-top order. Only pixel packing can be + inverted (i.e. for glReadPixels, glGetTexImage, glGetConvolutionFilter, + etc). + + Almost all known image file formats store images in top-to-bottom + order. As it is, OpenGL reads images from the frame buffer in + bottom-to-top order. Thus, images usually have to be inverted before + writing them to a file with image I/O libraries. This extension + allows images to be read such that inverting isn't needed. + +IP Status + + None + +Issues + + 1. Should we also defined UNPACK_INVERT_MESA for glDrawPixels, etc? + + Resolved: No, we're only concerned with pixel packing. There are other + solutions for inverting images when using glDrawPixels (negative Y pixel + zoom) or glTexImage (invert the vertex T coordinates). It would be easy + enough to define a complementary extension for pixel packing in the + future if needed. + +New Procedures and Functions + + None + +New Tokens + + Accepted by the parameter of PixelStorei and PixelStoref + and the parameter of GetIntegerv, GetFloatv, GetDoublev + and GetBooleanv: + + PACK_INVERT_MESA 0x8758 + +Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization) + + None + +Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment +Operations and the Frame Buffer) + + Add the following entry to table 4.4 (PixelStore parameters) on page 182: + + Parameter Name Type Initial Value Valid Range + --------------------------------------------------------- + PACK_INVERT_MESA boolean FALSE TRUE/FALSE + + In the section labeled "Placement in Client Memory" on page 184 + insert the following text into the paragraph before the sentence + that starts with "If the format is RED, GREEN, BLUE...": + + "The parameter PACK_INVERT_MESA controls whether the image is packed + in bottom-to-top order (the default) or top-to-bottom order. Equation + 3.8 is modified as follows: + + ... the first element of the Nth row is indicated by + + p + Nk, if PACK_INVERT_MESA is false + p + k * (H - 1) - Nk, if PACK_INVERT_MESA is true, where H is the + image height + " + +Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions) + + None + +Additions to Chapter 6 of the OpenGL 1.4 Specification (State and +State Requests) + + None + +Additions to Appendix A of the OpenGL 1.4 Specification (Invariance) + + None + +Additions to the AGL/GLX/WGL Specifications + + None + +GLX Protocol + + None + +Errors + + None + +New State + + Add the following entry to table 6.20 (Pixels) on page 235: + + Get Value Type Get Cmd Initial Value Description Sec Attribute + -------------------------------------------------------------------------------------------------- + PACK_INVERT_MESA boolean GetBoolean FALSE Value of PACK_INVERT_MESA 4.3.2 pixel-store + +Revision History + + 21 September 2002 - Initial draft diff --git a/mesalib/docs/MESA_pixmap_colormap.spec b/mesalib/docs/MESA_pixmap_colormap.spec new file mode 100644 index 000000000..fb0b441cc --- /dev/null +++ b/mesalib/docs/MESA_pixmap_colormap.spec @@ -0,0 +1,90 @@ +Name + + MESA_pixmap_colormap + +Name Strings + + GLX_MESA_pixmap_colormap + +Contact + + Brian Paul (brian.paul 'at' tungstengraphics.com) + +Status + + Shipping since Mesa 1.2.8 in May, 1996. + +Version + + Last Modified Date: 8 June 2000 + +Number + + 216 + +Dependencies + + OpenGL 1.0 or later is required. + GLX 1.0 or later is required. + +Overview + + Since Mesa allows RGB rendering into drawables with PseudoColor, + StaticColor, GrayScale and StaticGray visuals, Mesa needs a colormap + in order to compute pixel values during rendering. + + The colormap associated with a window can be queried with normal + Xlib functions but there is no colormap associated with pixmaps. + + The glXCreateGLXPixmapMESA function is an alternative to glXCreateGLXPixmap + which allows specification of a colormap. + +IP Status + + Open-source; freely implementable. + +Issues + + None. + +New Procedures and Functions + + GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, + Pixmap pixmap, Colormap cmap ); + +New Tokens + + None. + +Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors) + + Add to section 3.4.2 Off Screen Rendering + + The Mesa implementation of GLX allows RGB rendering into X windows and + pixmaps of any visual class, not just TrueColor or DirectColor. In order + to compute pixel values from RGB values Mesa requires a colormap. + + The function + + GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, + Pixmap pixmap, Colormap cmap ); + + allows one to create a GLXPixmap with a specific colormap. The image + rendered into the pixmap may then be copied to a window (which uses the + same colormap and visual) with the expected results. + +GLX Protocol + + None since this is a client-side extension. + +Errors + + None. + +New State + + None. + +Revision History + + 8 June 2000 - initial specification diff --git a/mesalib/docs/MESA_release_buffers.spec b/mesalib/docs/MESA_release_buffers.spec new file mode 100644 index 000000000..8db9350d8 --- /dev/null +++ b/mesalib/docs/MESA_release_buffers.spec @@ -0,0 +1,85 @@ +Name + + MESA_release_buffers + +Name Strings + + GLX_MESA_release_buffers + +Contact + + Brian Paul (brian.paul 'at' tungstengraphics.com) + +Status + + Shipping since Mesa 2.0 in October, 1996. + +Version + + Last Modified Date: 8 June 2000 + +Number + + 217 + +Dependencies + + OpenGL 1.0 or later is required. + GLX 1.0 or later is required. + +Overview + + Mesa's implementation of GLX is entirely implemented on the client side. + Therefore, Mesa cannot immediately detect when an X window or pixmap is + destroyed in order to free any ancilliary data associated with the window + or pixmap. + + The glxMesaReleaseBuffers() function can be used to explicitly indicate + when the back color buffer, depth buffer, stencil buffer, and/or accum- + ulation buffer associated with a drawable can be freed. + +IP Status + + Open-source; freely implementable. + +Issues + + None. + +New Procedures and Functions + + Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); + +New Tokens + + None. + +Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors) + + The function + + Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d ); + + causes all software ancilliary buffers (back buffer, depth, stencil, + accum, etc) associated with the named drawable to be immediately + deallocated. True is returned if is a valid Mesa GLX drawable, + else False is returned. After calling glXReleaseBuffersMESA, the + drawable should no longer be used for GL rendering. Results of + attempting to do so are undefined. + + +GLX Protocol + + None, since this is a client-side operation. + +Errors + + None. + +New State + + None. + +Revision History + + 8 June 2000 - initial specification diff --git a/mesalib/docs/MESA_resize_buffers.spec b/mesalib/docs/MESA_resize_buffers.spec new file mode 100644 index 000000000..533d017c9 --- /dev/null +++ b/mesalib/docs/MESA_resize_buffers.spec @@ -0,0 +1,81 @@ +Name + + MESA_resize_buffers + +Name Strings + + GL_MESA_resize_buffers + +Contact + + Brian Paul (brian.paul 'at' tungstengraphics.com) + +Status + + Shipping (since Mesa version 2.2) + +Version + + +Number + + 196 + +Dependencies + + Mesa 2.2 or later is required. + +Overview + + Mesa is often used as a client library with no integration with + the computer's window system (an X server, for example). And since + Mesa does not have an event loop nor window system callbacks, it + cannot properly respond to window system events. In particular, + Mesa cannot automatically detect when a window has been resized. + + Mesa's glViewport command queries the current window size and updates + its internal data structors accordingly. This normally works fine + since most applications call glViewport in responce to window size + changes. + + In some situations, however, the application may not call glViewport + when a window size changes but would still like Mesa to adjust to + the new window size. This extension exports a new function to solve + this problem. + +New Procedures and Functions + + void glResizeBuffersMESA( void ) + +New Tokens + + none + +Additions to the OpenGL Specification (no particular section) + + The glResizeBuffersMESA command may be called when the client + determines that a window has been resized. Calling + glResizeBuffersMESA causes Mesa to query the current window size + and adjust its internal data structures. This may include + reallocating depth, stencil, alpha and accumulation buffers. + +Additions to the AGL/GLX/WGL Specifications + + None + +Errors + + INVALID_OPERATION is generated if ResizeBuffersMESA is called betweeen + Begin and End. + +New State + + None. + +New Implementation Dependent State + + None. + +Revision History + + * Revision 1.0 - Initial specification diff --git a/mesalib/docs/MESA_set_3dfx_mode.spec b/mesalib/docs/MESA_set_3dfx_mode.spec new file mode 100644 index 000000000..06d97ca02 --- /dev/null +++ b/mesalib/docs/MESA_set_3dfx_mode.spec @@ -0,0 +1,85 @@ +Name + + MESA_set_3dfx_mode + +Name Strings + + GLX_MESA_set_3dfx_mode + +Contact + + Brian Paul (brian.paul 'at' tungstengraphics.com) + +Status + + Shipping since Mesa 2.6 in February, 1998. + +Version + + Last Modified Date: 8 June 2000 + +Number + + 218 + +Dependencies + + OpenGL 1.0 or later is required. + GLX 1.0 or later is required. + +Overview + + The Mesa Glide driver allows full-screen rendering or rendering into + an X window. The glXSet3DfxModeMESA() function allows an application + to switch between full-screen and windowed rendering. + +IP Status + + Open-source; freely implementable. + +Issues + + None. + +New Procedures and Functions + + GLboolean glXSet3DfxModeMESA( GLint mode ); + +New Tokens + + GLX_3DFX_WINDOW_MODE_MESA 0x1 + GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 + +Additions to Chapter 3 of the GLX 1.3 Specification (Functions and Errors) + + The Mesa Glide device driver allows either rendering in full-screen + mode or rendering into an X window. An application can switch between + full-screen and window rendering with the command: + + GLboolean glXSet3DfxModeMESA( GLint mode ); + + may either be GLX_3DFX_WINDOW_MODE_MESA to indicate window + rendering or GLX_3DFX_FULLSCREEN_MODE_MESA to indicate full-screen mode. + + GL_TRUE is returned if is valid and the operation completed + normally. GL_FALSE is returned if is invalid or if the Glide + driver is not being used. + + Note that only one drawable and context can be created at any given + time with the Mesa Glide driver. + +GLX Protocol + + None since this is a client-side extension. + +Errors + + None. + +New State + + None. + +Revision History + + 8 June 2000 - initial specification diff --git a/mesalib/docs/MESA_shader_debug.spec b/mesalib/docs/MESA_shader_debug.spec new file mode 100644 index 000000000..fab92abc7 --- /dev/null +++ b/mesalib/docs/MESA_shader_debug.spec @@ -0,0 +1,264 @@ +Name + + MESA_shader_debug + +Name Strings + + GL_MESA_shader_debug + +Contact + + Brian Paul (brian.paul 'at' tungstengraphics.com) + Michal Krol (mjkrol 'at' gmail.com) + +Status + + Obsolete. + +Version + + Last Modified Date: July 30, 2006 + Author Revision: 0.2 + +Number + + TBD + +Dependencies + + OpenGL 1.0 is required. + + The ARB_shader_objects extension is required. + + The ARB_shading_language_100 extension is required. + + The extension is written against the OpenGL 1.5 specification. + + The extension is written against the OpenGL Shading Language 1.10 + Specification. + +Overview + + This extension introduces a debug object that can be attached to + a program object to enable debugging. Vertex and/or fragment shader, + during execution, issue diagnostic function calls that are logged + to the debug object's log. A separate debug log for each shader type + is maintained. A debug object can be attached, detached and queried + at any time outside the Begin/End pair. Multiple debug objects can + be attached to a single program object. + +IP Status + + None + +Issues + + None + +New Procedures and Functions + + handleARB CreateDebugObjectMESA(void) + void ClearDebugLogMESA(handleARB obj, enum logType, enum shaderType) + void GetDebugLogMESA(handleARB obj, enum logType, enum shaderType, + sizei maxLength, sizei *length, + charARB *debugLog) + sizei GetDebugLogLengthMESA(handleARB obj, enum logType, + enum shaderType) + +New Types + + None + +New Tokens + + Returned by the parameter of GetObjectParameter{fi}vARB: + + DEBUG_OBJECT_MESA 0x8759 + + Accepted by the argument of ClearDebugLogMESA, + GetDebugLogLengthMESA and GetDebugLogMESA: + + DEBUG_PRINT_MESA 0x875A + DEBUG_ASSERT_MESA 0x875B + +Additions to Chapter 2 of the OpenGL 1.5 Specification +(OpenGL Operation) + + None + +Additions to Chapter 3 of the OpenGL 1.5 Specification (Rasterization) + + None + +Additions to Chapter 4 of the OpenGL 1.5 Specification (Per-Fragment +Operations and the Frame Buffer) + + None + +Additions to Chapter 5 of the OpenGL 1.5 Specification +(Special Functions) + + None + +Additions to Chapter 6 of the OpenGL 1.5 Specification (State and State +Requests) + + None + +Additions to Appendix A of the OpenGL 1.5 Specification (Invariance) + + None + +Additions to Chapter 1 of the OpenGL Shading Language 1.10 Specification +(Introduction) + + None + +Additions to Chapter 2 of the OpenGL Shading Language 1.10 Specification +(Overview of OpenGL Shading) + + None + +Additions to Chapter 3 of the OpenGL Shading Language 1.10 Specification +(Basics) + + None + +Additions to Chapter 4 of the OpenGL Shading Language 1.10 Specification +(Variables and Types) + + None + +Additions to Chapter 5 of the OpenGL Shading Language 1.10 Specification +(Operators and Expressions) + + None + +Additions to Chapter 6 of the OpenGL Shading Language 1.10 Specification +(Statements and Structure) + + None + +Additions to Chapter 7 of the OpenGL Shading Language 1.10 Specification +(Built-in Variables) + + None + +Additions to Chapter 8 of the OpenGL Shading Language 1.10 Specification +(Built-in Functions) + + Add a new section 8.10 "Debug Functions": + + Debug functions are available to both fragment and vertex shaders. + They are used to track the execution of a shader by logging + passed-in arguments to the debug object's log. Those values can be + retrieved by the application for inspection after shader execution + is complete. + + The text, if any, produced by any of these functions is appended + to each debug object that is attached to the program object. + There are different debug log types + + Add a new section 8.10.1 "Print Function": + + The following printMESA prototypes are available. + + void printMESA(const float value) + void printMESA(const int value) + void printMESA(const bool value) + void printMESA(const vec2 value) + void printMESA(const vec3 value) + void printMESA(const vec4 value) + void printMESA(const ivec2 value) + void printMESA(const ivec3 value) + void printMESA(const ivec4 value) + void printMESA(const bvec2 value) + void printMESA(const bvec3 value) + void printMESA(const bvec4 value) + void printMESA(const mat2 value) + void printMESA(const mat3 value) + void printMESA(const mat4 value) + void printMESA(const sampler1D value) + void printMESA(const sampler2D value) + void printMESA(const sampler3D value) + void printMESA(const samplerCube value) + void printMESA(const sampler1DShadow value) + void printMESA(const sampler2DShadow value) + + The printMESA function writes the argument to the "debug + print log" (XXX DEBUG_PRINT_MESA?). Each component is written in + text format (XXX format!) and is delimited by a white space (XXX 1 + or more?). + + Add a new section 8.10.2 "Assert Function": + + The following assertMESA prototypes are available. + + void assertMESA(const bool condition) + void assertMESA(const bool condition, const int cookie) + void assertMESA(const bool condition, const int cookie, + const int file, const int line) + + The assertMESA function checks if the argument is + true or false. If it is true, nothing happens. If it is false, + a diagnostic message is written to the "debug assert log". + The message contains the argument , , and + implementation dependent double-quoted string, each of this + delimited by a white space. If the argument is not present, + it is meant as if it was of value 0. If the arguments and + are not present, they are meant as if they were of values + __FILE__ and __LINE__, respectively. The following three calls + produce the same output, assuming they were issued from the same + file and line. + + assertMESA (false); + assertMESA (false, 0); + assertMESA (false, 0, __FILE__, __LINE__); + + The diagnostic message examples follow. + + 1 89 0 "" + 1 45 333 "all (lessThanEqual (fragColor, vec4 (1.0)))" + 1 66 1 "assertion failed in file 1, line 66, cookie 1" + +Additions to Chapter 9 of the OpenGL Shading Language 1.10 Specification +(Shading Language Grammar) + + None + +Additions to Chapter 10 of the OpenGL Shading Language 1.10 +Specification (Issues) + + None + +Additions to the AGL/EGL/GLX/WGL Specifications + + None + +GLX Protocol + + None + +Errors + + TBD + +New State + + TBD + +New Implementation Dependent State + + TBD + +Sample Code + + TBD + +Revision History + + 29 May 2006 + Initial draft. (Michal Krol) + 30 July 2006 + Add Overview, New Procedures and Functions, New Tokens sections. + Add sections 8.10.1, 8.10.2 to GLSL spec. diff --git a/mesalib/docs/MESA_swap_control.spec b/mesalib/docs/MESA_swap_control.spec new file mode 100644 index 000000000..ecc674649 --- /dev/null +++ b/mesalib/docs/MESA_swap_control.spec @@ -0,0 +1,132 @@ +Name + + MESA_swap_control + +Name Strings + + GLX_MESA_swap_control + +Contact + + Ian Romanick, IBM, idr at us.ibm.com + +Status + + Deployed in DRI drivers post-XFree86 4.3. + +Version + + Date: 5/1/2003 Revision: 1.1 + +Number + + ??? + +Dependencies + + None + + Based on GLX_SGI_swap_control version 1.9 and WGL_EXT_swap_control + version 1.5. + +Overview + + This extension allows an application to specify a minimum periodicity + of color buffer swaps, measured in video frame periods. + +Issues + + * Should implementations that export GLX_MESA_swap_control also export + GL_EXT_swap_control for compatibility with WGL_EXT_swap_control? + + UNRESOLVED. + +New Procedures and Functions + + int glXSwapIntervalMESA(int interval) + int glXGetSwapIntervalMESA(void) + +New Tokens + + None + +Additions to Chapter 2 of the 1.4 GL Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the 1.4 GL Specification (Rasterization) + + None + +Additions to Chapter 4 of the 1.4 GL Specification (Per-Fragment Operations +and the Framebuffer) + + None + +Additions to Chapter 5 of the 1.4 GL Specification (Special Functions) + + None + +Additions to Chapter 6 of the 1.4 GL Specification (State and State Requests) + + None + +Additions to the GLX 1.3 Specification + + [Add the following to Section 3.3.10 of the GLX Specification (Double + Buffering)] + + glXSwapIntervalMESA specifies the minimum number of video frame periods + per buffer swap. (e.g. a value of two means that the color buffers + will be swapped at most every other video frame.) A return value + of zero indicates success; otherwise an error occurred. The interval + takes effect when glXSwapBuffers is first called subsequent to the + glXSwapIntervalMESA call. + + A video frame period is the time required by the monitor to display a + full frame of video data. In the case of an interlaced monitor, + this is typically the time required to display both the even and odd + fields of a frame of video data. + + If is set to a value of 0, buffer swaps are not synchron- + ized to a video frame. The value is silently clamped to + the maximum implementation-dependent value supported before being + stored. + + The swap interval is not part of the render context state. It cannot + be pushed or popped. The current swap interval for the window + associated with the current context can be obtained by calling + glXGetSwapIntervalMESA. The default swap interval is 0. + + On XFree86, setting the environment variable LIBGL_THROTTLE_REFRESH sets + the swap interval to 1. + +Errors + + glXSwapIntervalMESA returns GLX_BAD_VALUE if parameter is + less than zero. + + glXSwapIntervalMESA returns GLX_BAD_CONTEXT if there is no current + GLXContext. + +GLX Protocol + + None. This extension only extends to direct rendering contexts. + +New State + + Get Value Get Command Type Initial Value + --------- ----------- ---- ------------- + [swap interval] GetSwapInterval Z+ 0 + +New Implementation Dependent State + + None + + +Revision History + + 1.1, 5/1/03 Added the issues section and contact information. + Changed the default swap interval to 0. + 1.0, 3/17/03 Initial version based on GLX_SGI_swap_control and + WGL_EXT_swap_control. diff --git a/mesalib/docs/MESA_swap_frame_usage.spec b/mesalib/docs/MESA_swap_frame_usage.spec new file mode 100644 index 000000000..5023eadd8 --- /dev/null +++ b/mesalib/docs/MESA_swap_frame_usage.spec @@ -0,0 +1,201 @@ +Name + + MESA_swap_frame_usage + +Name Strings + + GLX_MESA_swap_frame_usage + +Contact + + Ian Romanick, IBM, idr at us.ibm.com + +Status + + Deployed in DRI drivers post-XFree86 4.3. + +Version + + Date: 5/1/2003 Revision: 1.1 + +Number + + ??? + +Dependencies + + GLX_SGI_swap_control affects the definition of this extension. + GLX_MESA_swap_control affects the definition of this extension. + GLX_OML_sync_control affects the definition of this extension. + + Based on WGL_I3D_swap_frame_usage version 1.3. + +Overview + + This extension allows an application to determine what portion of the + swap period has elapsed since the last swap operation completed. The + "usage" value is a floating point value on the range [0,max] which is + calculated as follows: + + td + percent = ---- + tf + + where td is the time measured from the last completed buffer swap (or + call to enable the statistic) to when the next buffer swap completes, tf + is the entire time for a frame which may be multiple screen refreshes + depending on the swap interval as set by the GLX_SGI_swap_control or + GLX_OML_sync_control extensions. + + The value, percent, indicates the amount of time spent between the + completion of the two swaps. If the value is in the range [0,1], the + buffer swap occurred within the time period required to maintain a + constant frame rate. If the value is in the range (1,max], a constant + frame rate was not achieved. The value indicates the number of frames + required to draw. + + This definition of "percent" differs slightly from + WGL_I3D_swap_frame_usage. In WGL_I3D_swap_frame_usage, the measurement + is taken from the completion of one swap to the issuance of the next. + This representation may not be as useful as measuring between + completions, as a significant amount of time may pass between the + issuance of a swap and the swap actually occurring. + + There is also a mechanism to determine whether a frame swap was + missed. + +New Procedures and Functions + + int glXGetFrameUsageMESA(Display *dpy, + GLXDrawable drawable, + float *usage) + + int glXBeginFrameTrackingMESA(Display *dpy, + GLXDrawable drawable) + + int glXEndFrameTrackingMESA(Display *dpy, + GLXDrawable drawable) + + int glXQueryFrameTrackingMESA(Display *dpy, + GLXDrawable drawable, + int64_t *swapCount, + int64_t *missedFrames, + float *lastMissedUsage) + +New Tokens + + None + +Additions to Chapter 2 of the 1.4 GL Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the 1.4 GL Specification (Rasterization) + + None + +Additions to Chapter 4 of the 1.4 GL Specification (Per-Fragment Operations +and the Framebuffer) + + None + +Additions to Chapter 5 of the 1.4 GL Specification (Special Functions) + + None + +Additions to Chapter 6 of the 1.4 GL Specification (State and State Requests) + + None + +Additions to the GLX 1.3 Specification + + The frame usage is measured as the percentage of the swap period elapsed + between two buffer-swap operations being committed. In unextended GLX the + swap period is the vertical refresh time. If SGI_swap_control or + MESA_swap_control are supported, the swap period is the vertical refresh + time multiplied by the swap interval (or one if the swap interval is set + to zero). + + If OML_sync_control is supported, the swap period is the vertical + refresh time multiplied by the divisor parameter to + glXSwapBuffersMscOML. The frame usage in this case is less than 1.0 if + the swap is committed before target_msc, and is greater than or equal to + 1.0 otherwise. The actual usage value is based on the divisor and is + never less than 0.0. + + int glXBeginFrameTrackingMESA(Display *dpy, + GLXDrawable drawable, + float *usage) + + glXGetFrameUsageMESA returns a floating-point value in + that represents the current swap usage, as defined above. + + Missed frame swaps can be tracked by calling the following function: + + int glXBeginFrameTrackingMESA(Display *dpy, + GLXDrawable drawable) + + glXBeginFrameTrackingMESA resets a "missed frame" count and + synchronizes with the next frame vertical sync before it returns. + If a swap is missed based in the rate control specified by the + set by glXSwapIntervalSGI or the default swap of once + per frame, the missed frame count is incremented. + + The current missed frame count and total number of swaps since + the last call to glXBeginFrameTrackingMESA can be obtained by + calling the following function: + + int glXQueryFrameTrackingMESA(Display *dpy, + GLXDrawable drawable, + int64_t *swapCount, + int64_t *missedFrames, + float *lastMissedUsage) + + The location pointed to by will be updated with the + number of swaps that have been committed. This value may not match the + number of swaps that have been requested since swaps may be + queued by the implementation. This function can be called at any + time and does not synchronize to vertical blank. + + The location pointed to by will contain the number + swaps that missed the specified frame. The frame usage for the + last missed frame is returned in the location pointed to by + . + + Frame tracking is disabled by calling the function + + int glXEndFrameTrackingMESA(Display *dpy, + GLXDrawable drawable) + + This function will not return until all swaps have occurred. The + application can call glXQueryFrameTrackingMESA for a final swap and + missed frame count. + + If these functions are successful, zero is returned. If the context + associated with dpy and drawable is not a direct context, + GLX_BAD_CONTEXT is returned. + +Errors + + If the function succeeds, zero is returned. If the function + fails, one of the following error codes is returned: + + GLX_BAD_CONTEXT The current rendering context is not a direct + context. + +GLX Protocol + + None. This extension only extends to direct rendering contexts. + +New State + + None + +New Implementation Dependent State + + None + +Revision History + + 1.1, 5/1/03 Added contact information. + 1.0, 3/17/03 Initial version based on WGL_I3D_swap_frame_usage. diff --git a/mesalib/docs/MESA_texture_array.spec b/mesalib/docs/MESA_texture_array.spec new file mode 100644 index 000000000..9dee65b04 --- /dev/null +++ b/mesalib/docs/MESA_texture_array.spec @@ -0,0 +1,804 @@ +Name + + MESA_texture_array + +Name Strings + + GL_MESA_texture_array + +Contact + + Ian Romanick, IBM (idr 'at' us.ibm.com) + +IP Status + + No known IP issues. + +Status + + Shipping in Mesa 7.1 + +Version + + +Number + + TBD + +Dependencies + + OpenGL 1.2 or GL_EXT_texture3D is required. + + Support for ARB_fragment_program is assumed, but not required. + + Support for ARB_fragment_program_shadow is assumed, but not required. + + Support for EXT_framebuffer_object is assumed, but not required. + + Written based on the wording of the OpenGL 2.0 specification and + ARB_fragment_program_shadow but not dependent on them. + +Overview + + There are a number of circumstances where an application may wish to + blend two textures out of a larger set of textures. Moreover, in some + cases the selected textures may vary on a per-fragment basis within + a polygon. Several examples include: + + 1. High dynamic range textures. The application stores several + different "exposures" of an image as different textures. On a + per-fragment basis, the application selects which exposures are + used. + + 2. A terrain engine where the altitude of a point determines the + texture applied to it. If the transition is from beach sand to + grass to rocks to snow, the application will store each texture + in a different texture map, and dynamically select which two + textures to blend at run-time. + + 3. Storing short video clips in textures. Each depth slice is a + single frame of video. + + Several solutions to this problem have been proposed, but they either + involve using a separate texture unit for each texture map or using 3D + textures without mipmaps. Both of these options have major drawbacks. + + This extension provides a third alternative that eliminates the major + drawbacks of both previous methods. A new texture target, + TEXTURE_2D_ARRAY, is added that functions identically to TEXTURE_3D in + all aspects except the sizes of the non-base level images. In + traditional 3D texturing, the size of the N+1 LOD is half the size + of the N LOD in all three dimensions. For the TEXTURE_2D_ARRAY target, + the height and width of the N+1 LOD is halved, but the depth is the + same for all levels of detail. The texture then becomes an array of + 2D textures. The per-fragment texel is selected by the R texture + coordinate. + + References: + + http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011557 + http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=000516 + http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=3;t=011903 + http://www.delphi3d.net/articles/viewarticle.php?article=terraintex.htm + +New Procedures and Functions + + All functions come directly from EXT_texture_array. + + void FramebufferTextureLayerEXT(enum target, enum attachment, + uint texture, int level, int layer); + +New Tokens + + All token names and values come directly from EXT_texture_array. + + Accepted by the parameter of Enable, Disable, and IsEnabled, by + the parameter of GetBooleanv, GetIntegerv, GetFloatv, and + GetDoublev, and by the parameter of TexImage3D, GetTexImage, + GetTexLevelParameteriv, GetTexLevelParameterfv, GetTexParameteriv, and + GetTexParameterfv: + + TEXTURE_1D_ARRAY_EXT 0x8C18 + TEXTURE_2D_ARRAY_EXT 0x8C1A + + Accepted by the parameter of TexImage2D, TexSubImage2D, + CopyTexImage2D, CopyTexSubImage2D, CompressedTexImage2D, + CompressedTexSubImage2D, GetTexLevelParameteriv, and + GetTexLevelParameterfv: + + TEXTURE_1D_ARRAY_EXT + PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 + + Accepted by the parameter of TexImage3D, TexSubImage3D, + CopyTexSubImage3D, CompressedTexImage3D, CompressedTexSubImage3D, + GetTexLevelParameteriv, and GetTexLevelParameterfv: + + TEXTURE_2D_ARRAY_EXT + PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B + + Accepted by the parameter of GetBooleanv, GetIntegerv, + GetFloatv, and GetDoublev + + TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C + TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D + MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF + + Accepted by the parameter of TexParameterf, TexParameteri, + TexParameterfv, and TexParameteriv when the parameter is + TEXTURE_COMPARE_MODE_ARB: + + COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E + + (Note: COMPARE_REF_DEPTH_TO_TEXTURE_EXT is simply an alias for the + existing COMPARE_R_TO_TEXTURE token in OpenGL 2.0; the alternate name + reflects the fact that the R coordinate is not always used.) + + Accepted by the parameter of TexImage3D and + CompressedTexImage3D, and by the parameter of + CompressedTexSubImage3D: + + COMPRESSED_RGB_S3TC_DXT1_EXT + COMPRESSED_RGBA_S3TC_DXT1_EXT + COMPRESSED_RGBA_S3TC_DXT3_EXT + COMPRESSED_RGBA_S3TC_DXT5_EXT + + Accepted by the parameter of + GetFramebufferAttachmentParameterivEXT: + + FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 + + (Note: FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER is simply an alias for the + FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT token provided in + EXT_framebuffer_object. This extension generalizes the notion of + "" to include layers of an array texture.) + +Additions to Chapter 2 of the OpenGL 2.0 Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) + + -- Section 3.8.1 "Texture Image Specification" + + Change the first paragraph (page 150) to say (spec changes identical to + EXT_texture_array): + + "The command + + void TexImage3D(enum target, int level, int internalformat, + sizei width, sizei height, sizei depth, int border, + enum format, enum type, void *data); + + is used to specify a three-dimensional texture image. target must be one + one of TEXTURE_3D for a three-dimensional texture or + TEXTURE_2D_ARRAY_EXT for an two-dimensional array texture. + Additionally, target may be either PROXY_TEXTURE_3D for a + three-dimensional proxy texture, or PROXY_TEXTURE_2D_ARRAY_EXT for a + two-dimensional proxy array texture." + + Change the fourth paragraph on page 151 to say (spec changes identical + to EXT_texture_array): + + "Textures with a base internal format of DEPTH_COMPONENT are supported + by texture image specification commands only if target is TEXTURE_1D, + TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_2D_ARRAY_EXT, + PROXY_TEXTURE_1D, PROXY_TEXTURE_2D, PROXY_TEXTURE_1D_ARRAY_EXT, or + PROXY_TEXTURE_2D_ARRAY_EXT. Using this format in conjunction with any + other target will result in an INVALID_OPERATION error." + + + Change the fourth paragraph on page 156 to say (spec changes identical + to EXT_texture_array): + + "The command + + void TexImage2D(enum target, int level, + int internalformat, sizei width, sizei height, + int border, enum format, enum type, void *data); + + is used to specify a two-dimensional texture image. target must be one + of TEXTURE_2D for a two-dimensional texture, TEXTURE_1D_ARRAY_EXT for a + one-dimensional array texture, or one of TEXTURE_CUBE_MAP_POSITIVE_X, + TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y, + TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or + TEXTURE_CUBE_MAP_NEGATIVE_Z for a cube map texture. Additionally, + target may be either PROXY_TEXTURE_2D for a two-dimensional proxy + texture, PROXY_TEXTURE_1D_ARRAY_EXT for a one-dimensional proxy array + texture, or PROXY TEXTURE_CUBE_MAP for a cube map proxy texture in the + special case discussed in section 3.8.11. The other parameters match + the corresponding parameters of TexImage3D. + + For the purposes of decoding the texture image, TexImage2D is + equivalent to calling TexImage3D with corresponding arguments and depth + of 1, except that + + * The border depth, d_b, is zero, and the depth of the image is + always 1 regardless of the value of border. + + * The border height, h_b, is zero if is + TEXTURE_1D_ARRAY_EXT, and otherwise. + + * Convolution will be performed on the image (possibly changing its + width and height) if SEPARABLE 2D or CONVOLUTION 2D is enabled. + + * UNPACK SKIP IMAGES is ignored." + + -- Section 3.8.2 "Alternate Texture Image Specification Commands" + + Change the second paragraph (page 159) (spec changes identical + to EXT_texture_array): + + "The command + + void CopyTexImage2D(enum target, int level, + enum internalformat, int x, int y, sizei width, + sizei height, int border); + + defines a two-dimensional texture image in exactly the manner of + TexImage2D, except that the image data are taken from the framebuffer + rather than from client memory. Currently, target must be one of + TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, TEXTURE_CUBE_MAP_POSITIVE_X, + TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE MAP_POSITIVE_Y, + TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, or + TEXTURE_CUBE_MAP_NEGATIVE_Z. + + + Change the last paragraph on page 160 to say (spec changes identical + to EXT_texture_array): + + "Currently the target arguments of TexSubImage1D and CopyTexSubImage1D + must be TEXTURE_1D, the target arguments of TexSubImage2D and + CopyTexSubImage2D must be one of TEXTURE_2D, TEXTURE_1D_ARRAY_EXT, + TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X, + TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y, + TEXTURE_CUBE_MAP_POSITIVE_Z, or TEXTURE_CUBE_MAP_NEGATIVE_Z, and the + target arguments of TexSubImage3D and CopyTexSubImage3D must be + TEXTURE_3D or TEXTURE_2D_ARRAY_EXT. ..." + + + -- Section 3.8.4 "Texture Parameters" + + Change the first paragraph (page 166) to say: + + "Various parameters control how the texel array is treated when + specified or changed, and when applied to a fragment. Each parameter is + set by calling + + void TexParameter{if}(enum target, enum pname, T param); + void TexParameter{if}v(enum target, enum pname, T params); + + target is the target, either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, + TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT." + + + -- Section 3.8.8 "Texture Minification" in the section "Scale Factor and Level of Detail" + + Change the first paragraph (page 172) to say: + + "Let s(x,y) be the function that associates an s texture coordinate + with each set of window coordinates (x,y) that lie within a primitive; + define t(x,y) and r(x,y) analogously. Let u(x,y) = w_t * s(x,y), + v(x,y) = h_t * t(x,y), and w(x,y) = d_t * r(x,y), where w_t, h_t, + and d_t are as defined by equations 3.15, 3.16, and 3.17 with + w_s, h_s, and d_s equal to the width, height, and depth of the + image array whose level is level_base. For a one-dimensional + texture or a one-dimensional array texture, define v(x,y) = 0 and + w(x,y) = 0; for a two-dimensional texture or a two-dimensional array + texture, define w(x,y) = 0..." + + -- Section 3.8.8 "Texture Minification" in the section "Mipmapping" + + Change the third paragraph (page 174) to say: + + "For a two-dimensional texture, two-dimensional array texture, or + cube map texture," + + Change the fourth paragraph (page 174) to say: + + "And for a one-dimensional texture or a one-dimensional array texture," + + After the first paragraph (page 175) add: + + "For one-dimensional array textures, h_b and d_b are treated as 1, + regardless of the actual values, when performing mipmap calculations. + For two-dimensional array textures, d_b is always treated as one, + regardless of the actual value, when performing mipmap calculations." + + -- Section 3.8.8 "Automatic Mipmap Generation" in the section "Mipmapping" + + Change the third paragraph (page 176) to say (spec changes identical + to EXT_texture_array): + + "The contents of the derived arrays are computed by repeated, filtered + reduction of the level_base array. For one- and two-dimensional array + textures, each layer is filtered independently. ..." + + -- Section 3.8.8 "Manual Mipmap Generation" in the section "Mipmapping" + + Change first paragraph to say (spec changes identical to + EXT_texture_array): + + "Mipmaps can be generated manually with the command + + void GenerateMipmapEXT(enum target); + + where is one of TEXTURE_1D, TEXTURE_2D, TEXTURE_CUBE_MAP, + TEXTURE_3D, TEXTURE_1D_ARRAY, or TEXTURE_2D_ARRAY. Mipmap generation + affects the texture image attached to . ..." + + -- Section 3.8.10 "Texture Completeness" + + Change the second paragaph (page 177) to say (spec changes identical + to EXT_texture_array): + + "For one-, two-, or three-dimensional textures and one- or + two-dimensional array textures, a texture is complete if the following + conditions all hold true:" + + -- Section 3.8.11 "Texture State and Proxy State" + + Change the second and third paragraphs (page 179) to say (spec changes + identical to EXT_texture_array): + + "In addition to image arrays for one-, two-, and three-dimensional + textures, one- and two-dimensional array textures, and the six image + arrays for the cube map texture, partially instantiated image arrays + are maintained for one-, two-, and three-dimensional textures and one- + and two-dimensional array textures. Additionally, a single proxy image + array is maintained for the cube map texture. Each proxy image array + includes width, height, depth, border width, and internal format state + values, as well as state for the red, green, blue, alpha, luminance, + and intensity component resolutions. Proxy image arrays do not include + image data, nor do they include texture properties. When TexImage3D is + executed with target specified as PROXY_TEXTURE_3D, the + three-dimensional proxy state values of the specified level-of-detail + are recomputed and updated. If the image array would not be supported + by TexImage3D called with target set to TEXTURE 3D, no error is + generated, but the proxy width, height, depth, border width, and + component resolutions are set to zero. If the image array would be + supported by such a call to TexImage3D, the proxy state values are set + exactly as though the actual image array were being specified. No pixel + data are transferred or processed in either case. + + Proxy arrays for one- and two-dimensional textures and one- and + two-dimensional array textures are operated on in the same way when + TexImage1D is executed with target specified as PROXY_TEXTURE_1D, + TexImage2D is executed with target specified as PROXY_TEXTURE_2D or + PROXY_TEXTURE_1D_ARRAY_EXT, or TexImage3D is executed with target + specified as PROXY_TETXURE_2D_ARRAY_EXT." + + -- Section 3.8.12 "Texture Objects" + + Change section (page 180) to say (spec changes identical to + EXT_texture_array): + + "In addition to the default textures TEXTURE_1D, TEXTURE_2D, + TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_EXT, + named one-, two-, and three-dimensional, cube map, and one- and + two-dimensional array texture objects can be created and operated upon. + The name space for texture objects is the unsigned integers, with zero + reserved by the GL. + + A texture object is created by binding an unused name to TEXTURE_1D, + TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or + TEXTURE_2D_ARRAY_EXT. The binding is effected by calling + + void BindTexture(enum target, uint texture); + + with set to the desired texture target and set to + the unused name. The resulting texture object is a new state vector, + comprising all the state values listed in section 3.8.11, set to the + same initial values. If the new texture object is bound to TEXTURE_1D, + TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or + TEXTURE_2D_ARRAY_EXT, it is and remains a one-, two-, + three-dimensional, cube map, one- or two-dimensional array texture + respectively until it is deleted. + + BindTexture may also be used to bind an existing texture object to + either TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, + TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT. The error + INVALID_OPERATION is generated if an attempt is made to bind a texture + object of different dimensionality than the specified target. If the + bind is successful no change is made to the state of the bound texture + object, and any previous binding to target is broken. + + While a texture object is bound, GL operations on the target to which + it is bound affect the bound object, and queries of the target to which + it is bound return state from the bound object. If texture mapping of + the dimensionality of the target to which a texture object is bound is + enabled, the state of the bound texture object directs the texturing + operation. + + In the initial state, TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, + TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and TEXTURE_2D_ARRAY_EXT have + one-, two-, three-dimensional, cube map, and one- and two-dimensional + array texture state vectors respectively associated with them. In order + that access to these initial textures not be lost, they are treated as + texture objects all of whose names are 0. The initial one-, two-, + three-dimensional, cube map, one- and two-dimensional array textures + are therefore operated upon, queried, and applied as TEXTURE_1D, + TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, and + TEXTURE_2D_ARRAY_EXT respectively while 0 is bound to the corresponding + targets. + + Change second paragraph on page 181 to say (spec changes identical to + EXT_texture_array): + + "... If a texture that is currently bound to one of the targets + TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, + TEXTURE_1D_ARRAY_EXT, or TEXTURE_2D_ARRAY_EXT is deleted, it is as + though BindTexture had been executed with the same target and texture + zero. ..." + + Change second paragraph on page 182 to say (spec changes identical to + EXT_texture_array): + + "The texture object name space, including the initial one-, two-, and + three dimensional, cube map, and one- and two-dimensional array texture + objects, is shared among all texture units. ..." + + + -- Section 3.8.14 "Depth Texture Comparison Modes" in "Texture Comparison Modes" + + Change second through fourth paragraphs (page 188) to say: + + "Let D_t be the depth texture value, in the range [0, 1]. For + texture lookups from one- and two-dimesional, rectangle, and + one-dimensional array targets, let R be the interpolated + texture coordinate, clamped to the range [0, 1]. For texture lookups + from two-dimesional array texture targets, let R be the interpolated + texture coordinate, clamped to the range [0, 1]. Then the + effective texture value L_t, I_t, or A_t is computed as follows: + + If the value of TEXTURE_COMPARE_MODE is NONE, then + + r = Dt + + If the value of TEXTURE_COMPARE_MODE is + COMPARE_REF_DEPTH_TO_TEXTURE_EXT), then r depends on the texture + comparison function as shown in table 3.27." + + -- Section 3.8.15 "Texture Application" + + Change the first paragraph (page 189) to say: + + "Texturing is enabled or disabled using the generic Enable and Disable + commands, respectively, with the symbolic constants TEXTURE_1D, + TEXTURE_2D, TEXTURE_3D, TEXTURE_CUBE_MAP, TEXTURE_1D_ARRAY_EXT, or + TEXTURE_2D_ARRAY_EXT to enable one-, two-, three-dimensional, cube + map, one-dimensional array, or two-dimensional array texture, + respectively. If both two- and one-dimensional textures are enabled, + the two-dimensional texture is used. If the three-dimensional and + either of the two- or one-dimensional textures is enabled, the + three-dimensional texture is used. If the cube map texture and any of + the three-, two-, or one-dimensional textures is enabled, then cube map + texturing is used. If one-dimensional array texture is enabled and any + of cube map, three-, two-, or one-dimensional textures is enabled, + one-dimensional array texturing is used. If two-dimensional array + texture is enabled and any of cube map, three-, two-, one-dimensional + textures or one-dimensional array texture is enabled, two-dimensional + array texturing is used..." + + -- Section 3.11.2 of ARB_fragment_program (Fragment Program Grammar and Restrictions): + + (mostly add to existing grammar rules) + + ::= "MESA_texture_array" + + ::= "1D" + | "2D" + | "3D" + | "CUBE" + | "RECT" + | (if program option is present) + | (if program option is present) + + ::= "ARRAY1D" + | "ARRAY2D" + + ::= "SHADOW1D" + | "SHADOW2D" + | "SHADOWRECT" + | (if program option is present) + + ::= "SHADOWARRAY1D" + | "SHADOWARRAY2D" + + + -- Add Section 3.11.4.5.4 "Texture Stack Option" + + "If a fragment program specifies the "MESA_texture_array" program + option, the rule is modified to add the texture targets + ARRAY1D and ARRAY2D (See Section 3.11.2)." + + -- Section 3.11.6 "Fragment Program Texture Instruction Set" + + (replace 1st and 2nd paragraphs with the following paragraphs) + + "The first three texture instructions described below specify the + mapping of 4-tuple input vectors to 4-tuple output vectors. + The sampling of the texture works as described in section 3.8, + except that texture environments and texture functions are not + applicable, and the texture enables hierarchy is replaced by explicit + references to the desired texture target (i.e., 1D, 2D, 3D, cube map, + rectangle, ARRAY1D, ARRAY2D). These texture instructions specify + how the 4-tuple is mapped into the coordinates used for sampling. The + following function is used to describe the texture sampling in the + descriptions below: + + vec4 TextureSample(vec4 coord, float lodBias, int texImageUnit, + enum texTarget); + + Note that not all four components of the texture coordinates + are used by all texture targets. Component usage for each + is defined in table X. + + coordinates used + texTarget Texture Type s t r layer shadow + ---------------- --------------------- ----- ----- ------ + 1D TEXTURE_1D x - - - - + 2D TEXTURE_2D x y - - - + 3D TEXTURE_3D x y z - - + CUBE TEXTURE_CUBE_MAP x y z - - + RECT TEXTURE_RECTANGLE_ARB x y - - - + ARRAY1D TEXTURE_1D_ARRAY_EXT x - - y - + ARRAY2D TEXTURE_2D_ARRAY_EXT x y - z - + SHADOW1D TEXTURE_1D x - - - z + SHADOW2D TEXTURE_2D x y - - z + SHADOWRECT TEXTURE_RECTANGLE_ARB x y - - z + SHADOWARRAY1D TEXTURE_1D_ARRAY_EXT x - - y z + SHADOWARRAY2D TEXTURE_2D_ARRAY_EXT x y - z w + + Table X: Texture types accessed for each of the , and + coordinate mappings. The "coordinates used" column indicate the + input values used for each coordinate of the texture lookup, the + layer selector for array textures, and the reference value for + texture comparisons." + + -- Section 3.11.6.2 "TXP: Project coordinate and map to color" + + Add to the end of the section: + + "A program will fail to load if the TXP instruction is used in + conjunction with the SHADOWARRAY2D target." + +Additions to Chapter 4 of the OpenGL 2.0 Specification (Per-Fragment Operations) + + -- Section 4.4.2.3 "Attaching Texture Images to a Framebuffer" + + Add to the end of the section (spec changes identical to + EXT_texture_array): + + "The command + + void FramebufferTextureLayerEXT(enum target, enum attachment, + uint texture, int level, int layer); + + operates identically to FramebufferTexture3DEXT, except that it + attaches a single layer of a three-dimensional texture or a one- or + two-dimensional array texture. is an integer indicating the + layer number, and is treated identically to the parameter in + FramebufferTexture3DEXT. The error INVALID_VALUE is generated if + is negative. The error INVALID_OPERATION is generated if + is non-zero and is not the name of a three dimensional + texture or one- or two-dimensional array texture. Unlike + FramebufferTexture3D, no parameter is accepted. + + If is non-zero and the command does not result in an error, + the framebuffer attachment state corresponding to is + updated as in the other FramebufferTexture commands, except that + FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT is set to ." + + -- Section 4.4.4.1 "Framebuffer Attachment Completeness" + + Add to the end of the list of completeness rules (spec changes + identical to EXT_texture_array): + + "* If FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE and + FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT names a one- or + two-dimensional array texture, then + FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT must be smaller than the + number of layers in the texture." + +Additions to Chapter 5 of the OpenGL 2.0 Specification (Special Functions) + + -- Section 5.4 "Display Lists" + + Change the first paragraphi on page 242 to say (spec changes + identical to EXT_texture_array): + + "TexImage3D, TexImage2D, TexImage1D, Histogram, and ColorTable are + executed immediately when called with the corresponding proxy arguments + PROXY_TEXTURE_3D or PROXY_TEXTURE_2D_ARRAY_EXT; PROXY_TEXTURE_2D, + PROXY_TEXTURE_CUBE_MAP, or PROXY_TEXTURE_1D_ARRAY_EXT; + PROXY_TEXTURE_1D; PROXY_HISTOGRAM; and PROXY_COLOR_TABLE, + PROXY_POST_CONVOLUTION_COLOR_TABLE, or + PROXY_POST_COLOR_MATRIX_COLOR_TABLE." + +Additions to Chapter 6 of the OpenGL 2.0 Specification (State and State Requests) + + -- Section 6.1.3 "Enumerated Queries" + + Add after the line beginning "If the value of + FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT is TEXTURE" (spec changes + identical to EXT_texture_array): + + "If is FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT and the + texture object named FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT is a + three-dimensional texture or a one- or two-dimensional array texture, + then will contain the number of texture layer attached to the + attachment point. Otherwise, will contain the value zero." + + -- Section 6.1.4 "Texture Queries" + + Change the first three paragraphs (page 248) to say (spec changes + identical to EXT_texture_array): + + "The command + + void GetTexImage(enum tex, int lod, enum format, + enum type, void *img); + + is used to obtain texture images. It is somewhat different from the + other get commands; tex is a symbolic value indicating which texture + (or texture face in the case of a cube map texture target name) is to + be obtained. TEXTURE_1D, TEXTURE_2D, TEXTURE_3D, TEXTURE_1D_ARRAY_EXT, + and TEXTURE_2D_ARRAY_EXT indicate a one-, two-, or three-dimensional + texture, or one- or two-dimensional array texture, respectively. + TEXTURE_CUBE_MAP_POSITIVE_X, ... + + GetTexImage obtains... from the first image to the last for + three-dimensional textures. One- and two-dimensional array textures + are treated as two- and three-dimensional images, respectively, where + the layers are treated as rows or images. These groups are then... + + For three-dimensional and two-dimensional array textures, pixel storage + operations are applied as if the image were two-dimensional, except + that the additional pixel storage state values PACK_IMAGE_HEIGHT and + PACK_SKIP_IMAGES are applied. ..." + +Additions to Appendix A of the OpenGL 2.0 Specification (Invariance) + + None + +Additions to the AGL/GLX/WGL Specifications + + None + +GLX Protocol + + None + +Dependencies on ARB_fragment_program + + If ARB_fragment_program is not supported, the changes to section 3.11 + should be ignored. + +Dependencies on EXT_framebuffer_object + + If EXT_framebuffer_object is not supported, the changes to section + 3.8.8 ("Manual Mipmap Generation"), 4.4.2.3, and 6.1.3 should be ignored. + +Dependencies on EXT_texture_compression_s3tc and NV_texture_compression_vtc + + (Identical dependency as EXT_texture_array.) + + S3TC texture compression is supported for two-dimensional array textures. + When is TEXTURE_2D_ARRAY_EXT, each layer is stored independently + as a compressed two-dimensional textures. When specifying or querying + compressed images using one of the S3TC formats, the images are provided + and/or returned as a series of two-dimensional textures stored + consecutively in memory, with the layer closest to zero specified first. + For array textures, images are not arranged in 4x4x4 or 4x4x2 blocks as in + the three-dimensional compression format provided in the + EXT_texture_compression_vtc extension. Pixel store parameters, including + those specific to three-dimensional images, are ignored when compressed + image data are provided or returned, as in the + EXT_texture_compression_s3tc extension. + + S3TC compression is not supported for one-dimensional texture targets in + EXT_texture_compression_s3tc, and is not supported for one-dimensional + array textures in this extension. If compressed one-dimensional arrays + are needed, use a two-dimensional texture with a height of one. + + This extension allows the use of the four S3TC internal format types in + TexImage3D, CompressedTexImage3D, and CompressedTexSubImage3D calls. + +Errors + + None + +New State + + (add to table 6.15, p. 276) + + Initial + Get Value Type Get Command Value Description Sec. Attribute + ---------------------------- ----- ----------- ----- -------------------- ------ --------- + TEXTURE_BINDING_1D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture + to TEXTURE_1D_ARRAY + TEXTURE_BINDING_2D_ARRAY_EXT 2*xZ+ GetIntegerv 0 texture object bound 3.8.12 texture + to TEXTURE_2D_ARRAY + + +New Implementation Dependent State + + (add to Table 6.32, p. 293) + + Minimum + Get Value Type Get Command Value Description Sec. Attribute + ---------------------------- ---- ----------- ------- ------------------ ----- --------- + MAX_TEXTURE_ARRAY_LAYERS_EXT Z+ GetIntegerv 64 maximum number of 3.8.1 - + layers for texture + arrays + +Issues + + (1) Is "texture stack" a good name for this functionality? + + NO. The name is changed to "array texture" to match the + nomenclature used by GL_EXT_texture_array. + + (2) Should the R texture coordinate be treated as normalized or + un-normalized? If it were un-normalized, floor(R) could be thought + of as a direct index into the array texture. This may be more + convenient for applications. + + RESOLVED. All texture coordinates are normalized. The issue of + un-normalized texture coordinates has been discussed in the ARB + before and should be left for a layered extension. + + RE-RESOLVED. The R coordinate is un-normalized. Accessing an array + using [0, layers-1] coordinates is much more natural. + + (3) How does LOD selection work for stacked textures? + + RESOLVED. For 2D array textures the R coordinate is ignored, and + the LOD selection equations for 2D textures are used. For 1D + array textures the T coordinate is ignored, and the LOD selection + equations for 1D textures are used. The expected usage is in a + fragment program with an explicit LOD selection. + + (4) What is the maximum size of a 2D array texture? Is it the same + as for a 3D texture, or should a new query be added? How about for 1D + array textures? + + RESOLVED. A new query is added. + + (5) How are array textures exposed in GLSL? + + RESOLVED. Use GL_EXT_texture_array. + + (6) Should a 1D array texture also be exposed? + + RESOLVED. For orthogonality, yes. + + (7) How are stacked textures attached to framebuffer objects? + + RESOLVED. Layers of both one- and two-dimensional array textures + are attached using FreambufferTextureLayerEXT. Once attached, the + array texture layer behaves exactly as either a one- or + two-dimensional texture. + + (8) How is this extension related to GL_EXT_texture_array? + + This extension adapats GL_MESAX_texture_stack to the notation, + indexing, and FBO access of GL_EXT_texture_array. This extension + replaces the GLSL support of GL_EXT_texture_array with + GL_ARB_fragment_program support. + + Assembly program support is also provided by GL_NV_gpu_program4. + GL_NV_gpu_program4 also adds support for other features that are + specific to Nvidia hardware, while this extension adds only support + for array textures. + + Much of text of this extension that has changed since + GL_MESAX_texture_stack comes directly from either + GL_EXT_texture_array or GL_NV_gpu_program4. + +Revision History + + ||2005/11/15||0.1||idr||Initial draft MESAX version.|| + ||2005/12/07||0.2||idr||Added framebuffer object interactions.|| + ||2005/12/12||0.3||idr||Updated fragment program interactions.|| + ||2007/05/16||0.4||idr||Converted to MESA_texture_array. Brought in line with EXT_texture_array and NV_gpu_program4.|| diff --git a/mesalib/docs/MESA_texture_signed_rgba.spec b/mesalib/docs/MESA_texture_signed_rgba.spec new file mode 100644 index 000000000..49c8e9e5d --- /dev/null +++ b/mesalib/docs/MESA_texture_signed_rgba.spec @@ -0,0 +1,214 @@ +Name + + MESA_texture_signed_rgba + +Name Strings + + GL_MESA_texture_signed_rgba + +Contact + + + +Notice + + + +IP Status + + No known IP issues + +Status + + + +Version + + 0.3, 2009-03-24 + +Number + + Not assigned ? + +Dependencies + + Written based on the wording of the OpenGL 2.0 specification. + + This extension trivially interacts with ARB_texture_float. + This extension shares some language with ARB_texture_compression_rgtc + but does not depend on it. + +Overview + + OpenGL prior to 3.1 does not support any signed texture formats. + ARB_texture_compression_rgtc introduces some compressed red and + red_green signed formats but no uncompressed ones, which might + still be useful. NV_texture_shader adds signed texture formats, + but also a lot of functionality which has been superceded by fragment + shaders. + It is usually possible to get the same functionality + using a unsigned format by doing scale and bias in a shader, but this + is undesirable since modern hardware has direct support for this. + This extension adds a signed 4-channel texture format by backporting + the relevant features from OpenGL 3.1, as a means to support this in + OpenGL implementations only supporting older versions. + +Issues + + 1) What should this extension be called? + + RESOLVED: MESA_texture_signed_rgba seems reasonable. + The rgba part is there because only 4 channel format is supported. + + + 2) Should the full set of signed formats (alpha, luminance, rgb, etc.) + be supported? + + RESOLVED: NO. To keep this extension simple, only add the most + universal format, rgba. alpha/luminance can't be trivially supported + since OpenGL 3.1 does not support them any longer, and there is some + implied dependency on ARB_texture_rg for red/red_green formats so + avoid all this. Likewise, only 8 bits per channel is supported. + + + 3) Should this extension use new enums for the texture formats? + + RESOLVED: NO. Same enums as those used in OpenGL 3.1. + + + 4) How are signed integer values mapped to floating-point values? + + RESOLVED: Same as described in issue 5) of + ARB_texture_compression_rgtc (quote): + A signed 8-bit two's complement value X is computed to + a floating-point value Xf with the formula: + + { X / 127.0, X > -128 + Xf = { + { -1.0, X == -128 + + This conversion means -1, 0, and +1 are all exactly representable, + however -128 and -127 both map to -1.0. Mapping -128 to -1.0 + avoids the numerical awkwardness of have a representable value + slightly more negative than -1.0. + + This conversion is intentionally NOT the "byte" conversion listed + in Table 2.9 for component conversions. That conversion says: + + Xf = (2*X + 1) / 255.0 + + The Table 2.9 conversion is incapable of exactly representing + zero. + + (Difference to ARB_texture_compression_rgtc): + This is the same mapping as OpenGL 3.1 uses. + This is also different to what NV_texture_shader used. + The above mapping should be considered the reference, but there + is some leeway so other mappings are allowed for implementations which + cannot do this. Particulary the mapping given in NV_texture_shader or + the standard OpenGL byte/float mapping is considered acceptable too, as + might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by + 127 (that is, uses different scale factors for negative and positive + numbers). + Also, it is ok to store incoming GL_BYTE user data as-is, without + converting to GL_FLOAT (using the standard OpenGL float/byte mapping) + and converting back (using the mapping described here). + Other than those subtle issues there are no other non-standard + conversions used, so when using for instance CopyTexImage2D with + a framebuffer clamped to [0,1] all converted numbers will be in the range + [0, 127] (and not scaled and biased). + + + 5) How will signed components resulting from RGBA8_SNORM texture + fetches interact with fragment coloring? + + RESOLVED: Same as described in issue 6) of + ARB_texture_compression_rgtc (quote): + The specification language for this extension is silent + about clamping behavior leaving this to the core specification + and other extensions. The clamping or lack of clamping is left + to the core specification and other extensions. + + For assembly program extensions supporting texture fetches + (ARB_fragment_program, NV_fragment_program, NV_vertex_program3, + etc.) or the OpenGL Shading Language, these signed formats will + appear as expected with unclamped signed components as a result + of a texture fetch instruction. + + If ARB_color_buffer_float is supported, its clamping controls + will apply. + + NV_texture_shader extension, if supported, adds support for + fixed-point textures with signed components and relaxed the + fixed-function texture environment clamping appropriately. If the + NV_texture_shader extension is supported, its specified behavior + for the texture environment applies where intermediate values + are clamped to [-1,1] unless stated otherwise as in the case + of explicitly clamped to [0,1] for GL_COMBINE. or clamping the + linear interpolation weight to [0,1] for GL_DECAL and GL_BLEND. + + Otherwise, the conventional core texture environment clamps + incoming, intermediate, and output color components to [0,1]. + + This implies that the conventional texture environment + functionality of unextended OpenGL 1.5 or OpenGL 2.0 without + using GLSL (and with none of the extensions referred to above) + is unable to make proper use of the signed texture formats added + by this extension because the conventional texture environment + requires texture source colors to be clamped to [0,1]. Texture + filtering of these signed formats would be still signed, but + negative values generated post-filtering would be clamped to + zero by the core texture environment functionality. The + expectation is clearly that this extension would be co-implemented + with one of the previously referred to extensions or used with + GLSL for the new signed formats to be useful. + + + 6) Should the RGBA_SNORM tokens also be accepted by CopyTexImage + functions? + + RESOLVED: YES. + + + 7) What to do with GetTexParameter if ARB_texture_float is supported, + in particular what datatype should this return for TEXTURE_RED_TYPE_ARB, + TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB, TEXTURE_ALPHA_TYPE_ARB? + + RESOLVED: ARB_texture_float states type is either NONE, + UNSIGNED_NORMALIZED_ARB, or FLOAT. This extension adds a new enum, + SIGNED_NORMALIZED, which will be returned accordingly. This is the + same behaviour as in OpenGL 3.1. + + +New Tokens + + + Accepted by the parameter of + TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, and CopyTexImage2D: + + RGBA_SNORM 0x8F93 + RGBA8_SNORM 0x8F97 + + Returned by the parameter of GetTexLevelParameter: + + SIGNED_NORMALIZED 0x8F9C + + +Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization): + + -- Section 3.8.1, Texture Image Specification + + Add to Table 3.16 (page 154): Sized internal formats + + Sized Base R G B A L I D + Internal Format Internal Format bits bits bits bits bits bits bits + --------------- --------------- ---- ---- ---- ---- ---- ---- ---- + RGBA8_SNORM RGBA 8 8 8 8 0 0 0 + + +Dependencies on ARB_texture_float extension: + + If ARB_texture_float is supported, GetTexParameter queries with + of TEXTURE_RED_TYPE_ARB, TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB or + TEXTURE_ALPHA_TYPE_ARB return SIGNED_NORMALIZED if + the base internal format is RGBA_SNORM. diff --git a/mesalib/docs/MESA_window_pos.spec b/mesalib/docs/MESA_window_pos.spec new file mode 100644 index 000000000..4d01f1814 --- /dev/null +++ b/mesalib/docs/MESA_window_pos.spec @@ -0,0 +1,126 @@ +Name + + MESA_window_pos + +Name Strings + + GL_MESA_window_pos + +Contact + + Brian Paul, brian.paul 'at' tungstengraphics.com + +Status + + Shipping (since Mesa version 1.2.8) + +Version + + +Number + + 197 + +Dependencies + + OpenGL 1.0 is required. + The extension is written against the OpenGL 1.2 Specification + +Overview + + In order to set the current raster position to a specific window + coordinate with the RasterPos command, the modelview matrix, projection + matrix and viewport must be set very carefully. Furthermore, if the + desired window coordinate is outside of the window's bounds one must + rely on a subtle side-effect of the Bitmap command in order to circumvent + frustum clipping. + + This extension provides a set of functions to directly set the + current raster position, bypassing the modelview matrix, the + projection matrix and the viewport to window mapping. Furthermore, + clip testing is not performed. + + This greatly simplifies the process of setting the current raster + position to a specific window coordinate prior to calling DrawPixels, + CopyPixels or Bitmap. + +New Procedures and Functions + + void WindowPos2dMESA(double x, double y) + void WindowPos2fMESA(float x, float y) + void WindowPos2iMESA(int x, int y) + void WindowPos2sMESA(short x, short y) + void WindowPos2ivMESA(const int *p) + void WindowPos2svMESA(const short *p) + void WindowPos2fvMESA(const float *p) + void WindowPos2dvMESA(const double *p) + void WindowPos3iMESA(int x, int y, int z) + void WindowPos3sMESA(short x, short y, short z) + void WindowPos3fMESA(float x, float y, float z) + void WindowPos3dMESA(double x, double y, double z) + void WindowPos3ivMESA(const int *p) + void WindowPos3svMESA(const short *p) + void WindowPos3fvMESA(const float *p) + void WindowPos3dvMESA(const double *p) + void WindowPos4iMESA(int x, int y, int z, int w) + void WindowPos4sMESA(short x, short y, short z, short w) + void WindowPos4fMESA(float x, float y, float z, float w) + void WindowPos4dMESA(double x, double y, double z, double ) + void WindowPos4ivMESA(const int *p) + void WindowPos4svMESA(const short *p) + void WindowPos4fvMESA(const float *p) + void WindowPos4dvMESA(const double *p) + +New Tokens + + none + +Additions to Chapter 2 of the OpenGL 1.2 Specification (OpenGL Operation) + + - (2.12, p. 41) Insert after third paragraph: + + Alternately, the current raster position may be set by one of the + WindowPosMESA commands: + + void WindowPos{234}{sidf}MESA( T coords ); + void WindowPos{234}{sidf}vMESA( T coords ); + + WindosPos4MESA takes four values indicating x, y, z, and w. + WindowPos3MESA (or WindowPos2MESA) is analaguos, but sets only + x, y, and z with w implicitly set to 1 (or only x and y with z + implicititly set to 0 and w implicitly set to 1). + + WindowPosMESA operates like RasterPos except that the current modelview + matrix, projection matrix and viewport parameters are ignored and the + clip test operation always passes. The current raster position values + are directly set to the parameters passed to WindowPosMESA. The current + color, color index and texture coordinate update the current raster + position's associated data. + +Additions to the AGL/GLX/WGL Specifications + + None + +GLX Protocol + + Not specified at this time. However, a protocol message very similar + to that of RasterPos is expected. + +Errors + + INVALID_OPERATION is generated if WindowPosMESA is called betweeen + Begin and End. + +New State + + None. + +New Implementation Dependent State + + None. + +Revision History + + * Revision 1.0 - Initial specification + * Revision 1.1 - Minor clean-up (7 Jan 2000, Brian Paul) + diff --git a/mesalib/docs/MESA_ycbcr_texture.spec b/mesalib/docs/MESA_ycbcr_texture.spec new file mode 100644 index 000000000..0fa1f7b39 --- /dev/null +++ b/mesalib/docs/MESA_ycbcr_texture.spec @@ -0,0 +1,204 @@ +Name + + MESA_ycbcr_texture + +Name Strings + + GL_MESA_ycbcr_texture + +Contact + + Brian Paul, Tungsten Graphics, Inc. (brian.paul 'at' tungstengraphics.com) + Keith Whitwell, Tungsten Graphics, Inc. (keith 'at' tungstengraphics.com) + +Status + + Shipping (Mesa 4.0.4 and later) + +Version + + 1.0 + +Number + + TBD + +Dependencies + + OpenGL 1.0 or later is required + This extensions is written against the OpenGL 1.4 Specification. + NV_texture_rectangle effects the definition of this extension. + +Overview + + This extension supports texture images stored in the YCbCr format. + There is no support for converting YCbCr images to RGB or vice versa + during pixel transfer. The texture's YCbCr colors are converted to + RGB during texture sampling, after-which, all the usual per-fragment + operations take place. Only 2D texture images are supported (not + glDrawPixels, glReadPixels, etc). + + A YCbCr pixel (texel) is a 16-bit unsigned short with two components. + The first component is luminance (Y). For pixels in even-numbered + image columns, the second component is Cb. For pixels in odd-numbered + image columns, the second component is Cr. If one were to convert the + data to RGB one would need to examine two pixels from columns N and N+1 + (where N is even) to deduce the RGB color. + +IP Status + + None + +Issues + + None + +New Procedures and Functions + + None + +New Tokens + + Accepted by the and parameters of + TexImage2D and TexSubImage2D: + + YCBCR_MESA 0x8757 + + Accepted by the parameter of TexImage2D and TexSubImage2D: + + UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple's */ + UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple's */ + +Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization) + + In section 3.6.4, Rasterization of Pixel Rectangles, on page 101, + add the following to Table 3.8 (Packed pixel formats): + + type Parameter GL Data Number of Matching + Token Name Type Components Pixel Formats + -------------- ------- ---------- ------------- + UNSIGNED_SHORT_8_8_MESA ushort 2 YCBCR_MESA + UNSIGNED_SHORT_8_8_REV_MESA ushort 2 YCBCR_MESA + + + In section 3.6.4, Rasterization of Pixel Rectangles, on page 102, + add the following to Table 3.10 (UNSIGNED_SHORT formats): + + UNSIGNED_SHORT_8_8_MESA: + + 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + +-------------------------------+-------------------------------+ + | 1st | 2nd | + +-------------------------------+-------------------------------+ + + UNSIGNED_SHORT_8_8_REV_MESA: + + 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + +-------------------------------+-------------------------------+ + | 2nd | 1st | + +-------------------------------+-------------------------------+ + + + In section 3.6.4, Rasterization of Pixel Rectangles, on page 104, + add the following to Table 3.12 (Packed pixel fiedl assignments): + + First Second Third Fourth + Format Element Element Element Element + ------ ------- ------- ------- ------- + YCBCR_MESA luminance chroma + + + In section 3.8.1, Texture Image Specification, on page 125, add + another item to the list of TexImage2D and TexImage3D equivalence + exceptions: + + * The value of internalformat and format may be YCBCR_MESA to + indicate that the image data is in YCbCr format. type must + be either UNSIGNED_SHORT_8_8_MESA or UNSIGNED_SHORT_8_8_REV_MESA + as seen in tables 3.8 and 3.10. Table 3.12 describes the mapping + between Y and Cb/Cr to the components. + If NV_texture_rectangle is supported target may also be + TEXTURE_RECTANGLE_NV or PROXY_TEXTURE_RECTANGLE_NV. + All pixel transfer operations are bypassed. The texture is stored as + YCbCr, not RGB. Queries of the texture's red, green and blue component + sizes will return zero. The YCbCr colors are converted to RGB during + texture sampling using an implementation dependent conversion. + + + In section 3.8.1, Texture Image Specification, on page 126, add + another item to the list of TexImage1D and TexImage2D equivalence + exceptions: + + * The value of internalformat and format can not be YCBCR_MESA. + + + In section 3.8.2, Alternate Texture Image Specification Commands, on + page 129, insert this paragraph after the first full paragraph on the + page: + + "If the internal storage format of the image being updated by + TexSubImage2D is YCBCR_MESA then format must be YCBCR_MESA. + The error INVALID_OPERATION will be generated otherwise." + + +Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment +Operations and the Frame Buffer) + + None + +Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions) + + None + +Additions to Chapter 6 of the OpenGL 1.4 Specification (State and +State Requests) + + None + +Additions to Appendix A of the OpenGL 1.4 Specification (Invariance) + + None + +Additions to the AGL/GLX/WGL Specifications + + None + +GLX Protocol + + None + +Errors + + INVALID_ENUM is generated by TexImage2D if is + MESA_YCBCR but is not MESA_YCBCR. + + INVALID_ENUM is generated by TexImage2D if is MESA_YCBCR but + is not MESA_YCBCR. + + INVALID_VALUE is generated by TexImage2D if is MESA_YCBCR and + is MESA_YCBCR and is not zero. + + INVALID_OPERATION is generated by TexSubImage2D if the internal image + format is YCBCR_MESA and is not YCBCR_MESA. + + INVALID_OPERATION is generated by CopyTexSubImage2D if the internal + image is YCBCR_MESA. + +New State + + Edit table 6.16 on page 231: change the type of TEXTURE_INTERNAL_FORMAT + from n x Z42 to n x Z43 to indicate that internal format may also be + YCBCR_MESA. + +Revision History + + 20 September 2002 - Initial draft + 29 April 2003 - minor updates + 3 September 2003 - further clarify when YCbCr->RGB conversion takes place + 19 September 2003 - a few more updates prior to submitting to extension + registry. + 3 April 2004 - fix assorted inaccuracies diff --git a/mesalib/docs/MiniGLX.html b/mesalib/docs/MiniGLX.html new file mode 100644 index 000000000..e7ebae685 --- /dev/null +++ b/mesalib/docs/MiniGLX.html @@ -0,0 +1,534 @@ + + + + Mini GLX Specification + + +

+
Mini GLX Specification
+

+

+
Tungsten Graphics, Inc.
+
+January 20, 2003
+
+
+

+

Copyright © 2002-2003 by Tungsten Graphics, Inc., Cedar Park, +Texas. All Rights Reserved.
+
+Permission is granted to make and distribute verbatim copies of this +document provided the copyright notice and this permission notice are +preserved on all copies.
+
+

+

1. Introduction

+

The Mini GLX interface facilitates OpenGL rendering on embedded +devices. The interface is a subset of the GLX interface, plus a minimal +set of Xlib-like functions.

+

Programs written to the Mini GLX specification should run unchanged +on systems with the X Window System and the GLX extension. The intention +is to allow flexibility for prototyping and testing.

+

This document serves as both the reference guide and programming +guide for Mini GLX.
+
+

+

2. Mini GLX Concepts

+

The OpenGL specification does not describe how OpenGL rendering +contexts and drawing surfaces (i.e. the frame buffer) are created and +managed. Rather, this is handled by an OpenGL window system interface, +such as Mini GLX.

+

There are three main datatypes or resources managed by Mini GLX. The +resources and their corresponding GLX or Xlib data types are:

+ + + + + + + + + + + + + + + + + + + +
ResourceData type
pixel formatsX Visual and XVisualInfo
drawing surfacesX Window or GLXDrawable
rendering contextsGLXContext
+

Pixel formats or X Visuals describe the per-pixel attributes of the +frame buffer. For example, bits per color component, Z buffer size, +stencil size, TrueColor vs PseudoColor, etc.

+

Drawing surfaces or X Windows typically describe a spatial +allocation of the frame buffer (i.e. the position and size of a +rectangular region of pixels). Since MiniGLX doesn't really support a +window system, the window is effectively the entire frame buffer.

+

A rendering context represents the current OpenGL state such as +current drawing color, line width, blending mode, texture parameters, +etc. Several rendering contexts can be created but only one can be in +use at any given time.

+

The Mini GLX interface provides all the functions needed for +choosing pixel formats, create drawing surfaces, creating rendering +contexts and binding rendering contexts to drawing surfaces.
+
+

+

3. Using Mini GLX

+

To use the Mini GLX interface in your application, include the +GL/miniglx.h header file at compile time:

+
#include <GL/miniglx.h>
+
+Applications should link with libGL.so (i.e. gcc +myprogram.o -lGL -o myprogram).  libGL.so implements the +MiniGLX API functions and, in turn, loads a hardware-specific device +driver (such as radeon_dri.so) at runtime.  The +environment variable LIBGL_DRIVERS_PATH should name the +directory where these modules are located.
+
+The remainder of this section describes the MiniGLX API functions.
+
+

3.1 Initialization

+

The XOpenDisplay function is used to initialize the graphics system:

+
+
Display *XOpenDisplay(const char *displayname)
+
+

The displayName parameter is currently ignored in Mini +GLX. It is recommended that NULL be passed as thedisplayName +parameter.

+

If XOpenDisplay is able to initialize the graphics system a pointer +to a Display will be returned. Otherwise, NULL will be returned.

+

3.2 Choosing a Visual

+

A visual (i.e. pixel format) must be chosen before a drawing surface +or rendering context can be created. This is done with the +glXChooseVisual function:

+
+
XVisualInfo *glXChooseVisual(Display *dpy, int screen, const int *attribList)
+
+

dpy is a pointer to the display returned by +XOpenDisplay.

+

screen is currently ignored by Mini GLX and should be +zero.

+

attribList is a list of GLX attributes which describe +the desired pixel format. It is terminated by the token None. +The attributes are as follows:

+
+
+
GLX_USE_GL
+
This attribute should always be present in order to maintain +compatibility with GLX.
+
GLX_RGBA
+
If present, only RGBA pixel formats will be considered. +Otherwise, only color index formats are considered.
+
GLX_DOUBLEBUFFER
+
if present, only double-buffered pixel formats will be chosen.
+
GLX_RED_SIZE n
+
Must be followed by a non-negative integer indicating the +minimum number of bits per red pixel component that is acceptable.
+
GLX_GREEN_SIZE n
+
Must be followed by a non-negative integer indicating the +minimum number of bits per green pixel component that is acceptable.
+
GLX_BLUE_SIZE n
+
Must be followed by a non-negative integer indicating the +minimum number of bits per blue pixel component that is acceptable.
+
GLX_ALPHA_SIZE n
+
Must be followed by a non-negative integer indicating the +minimum number of bits per alpha pixel component that is acceptable.
+
GLX_STENCIL_SIZE n
+
Must be followed by a non-negative integer indicating the +minimum number of bits per stencil value that is acceptable.
+
None
+
This token is used to terminate the attribute list.
+
+
+

glXChooseVisual will return a pointer to an XVisualInfo object which +most closely matches the requirements of the attribute list. If there +is no visual which matches the request, NULL will be returned.

+

Note that visuals with accumulation buffers and depth buffers are +not available.
+
+

+

3.3 Creating a Drawing Surface

+

Drawing surfaces are created as X windows.  For Mini GLX, +windows are full-screen; they cover the entire frame buffer. + Also, Mini GLX imposes a limit of one window. A second window +cannot be created until the first one is destroyed.

+

3.3.1 Window Creation

+

The XCreateWindow function is used to create a drawing surface:

+
+
Window XCreateWindow( Display *display,
Window parent,
int x, int y,
unsigned int width, unsigned int height,
unsigned int borderWidth,
int depth,
unsigned int class,
Visual *visual,
unsigned long valuemask,
XSetWindowAttributes *attributes )
+
+

The parameters are as follows:

+
+
+
display
+
A Display pointer, as returned by XOpenDisplay.
+
parent
+
The parent window for the new window. For Mini GLX, this +should beRootWindow(dpy, 0).
+
x, y
+
The position of the window. For Mini GLX, both values should +be zero.
+
width, height
+
The size of the window. For Mini GLX, this specifies the +desired screen size such as 1024, 768 or 1280, 1024.
+
borderWidth
+
This parameter should be zero.
+
depth
+
The pixel depth for the window. For Mini GLX this should be +the depth found in the XVisualInfo object returned by glxChooseVisual.
+
class
+
The window class. For Mini GLX this value should be InputOutput.
+
visual
+
This parameter should be the visual field of the XVisualInfo +object returned by glxChooseVisual.
+
valuemask
+
This parameter indicates which fields of the XSetWindowAttributes +are to be used. For Mini GLX this is typically the bitmaskCWBackPixel +| CWBorderPixel | CWColormap.
+
attributes
+
Initial window attributes. Of the fields in the XSetWindowAttributes +structure, thebackground_pixel, border_pixel +and colormap fields should be set.  See the discussion +below regarding colormaps.
+
+
+

XCreateWindow will return a window handle if it succeeds +or zero if it fails.

+

3.3.2 Window Mapping

+

To display the window the XMapWindow function must be called:

+
+
void XMapWindow(Display *dpy, Window w)
+
+

This function does nothing in Mini GLX but is required for Xlib/GLX +compatibility

+

3.3.3 Colormaps
+

+

Xlib requires specification of a colormap when creating a window. + For purposes of interoperability, Mini GLX requires this as well, +though the colormap is not actually used.  The XCreateColormap +function is used to create a colormap:

+
Colormap XCreateColormap(Display *dpy, Window window, +Visual *visual, int alloc)
+
+

The parameters are as follows:
+

+
+
+
dpy
+
The display handle as returned by XOpenDisplay.
+
window
+
This parameter is ignored by Mini GLX but should be the value +returned by the RootWindow(dpy, 0) macro.
+
+
visual
+
This parameter is ignored by Mini GLX but should be the visual +field of the XVisualInfo object returned by glXChooseVisual.
+
alloc
+
This parameter is ignored by Mini GLX but should be set to AllocNone.
+
+
+
+

3.4 Creating a Rendering Context

+

An OpenGL rendering context is created with the glXCreateContext +function:

+
+
GLXContext glXCreateContext(Display *dpy, XVisualInfo *visInfo, GLXContext shareList, Bool direct)
+
+

The parameters are as follows:

+
+
+
dpy
+
The display handle as returned by XOpenDisplay.
+
visInfo
+
The visual as returned by glXChooseVisual.
+
shareList
+
If non-zero, texture objects and display lists are shared with +the named rendering context. If zero, texture objects and display lists +will (initially) be private to this context. They may be shared when a +subsequent context is created.
+
direct
+
Specifies whether direct or indirect rendering is desired. For +Mini GLX this value is ignored but it should be set to True.
+
+
+

glXCreateContext will return a GLXContext handle if it +succeeds or zero if it fails due to invalid parameter or insufficient +resources.
+
+

+

3.5 Binding a Rendering Context

+

The final step before beginning OpenGL rendering is to bind (i.e. +activate) a rendering context and drawing surface with the +glXMakeCurrent function:

+
+
Bool glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
+
+

The parameters are as follows:

+
+
+
dpy
+
The display handle, as returned by XOpenDisplay.
+
drawable
+
The window or drawable to bind to the rendering context. This +should be the value returned by XCreateWindow.
+
ctx
+
The rendering context to bind, as returned by glXCreateContext.
+
+
+

If glXMakeCurrent succeeds True is returned. Otherwise False is +returned to indicate an invalid display, window or context parameter.

+

After the rendering context has been bound to the drawing surface +OpenGL rendering can begin.

+

The current rendering context may be unbound by calling +glXMakeCurrent with the window and context parameters set to zero.

+

An application may create any number of rendering contexts and bind +them as needed. Note that binding a rendering context is generally not a +light-weight operation.  Most simple OpenGL applications create +only one rendering context.
+
+

+

3.6 Color Buffer Swapping

+

A double buffered window has two color buffers: a front buffer and a +back buffer. Normally, rendering is directed to the back buffer while +the front buffer is displayed. When rendering of a frame is finished +the front and back buffers are swapped to provide the illusion of +instanteous screen updates.

+

The color buffers for a particular window (i.e. drawable) may be +swapped with the glXSwapBuffers command:

+
+
void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
+
+Any pending rendering commands will be completed before the buffer swap +takes place.
+
+Calling glXSwapBuffers on a window which is single-buffered has no +effect.
+
+

3.7 Releasing Resources

+

3.7.1 Releasing Rendering Contexts

+

A rendering context may be destroyed by calling glXDestroyContext:

+
+
void glXDestroyContext(Display *dpy, GLXContext ctx)
+
+

3.7.2 Releasing Windows

+

A window may be destroyed by calling XDestroyWindow:

+
+
void XDestroyWindow(Display *dpy, Window window)
+
+

3.7.3 Releasing Visuals

+

An XVisualInfo object may be freed by calling XFree:

+
+
void XFree(void *data)
+
+

3.7.4 Releasing Colormaps

+

A colormap may be freed by calling XFreeColormap:

+
+
void XFreeColormap(Display *dpy, Colormap colormap)
+
+

3.7.4 Releasing Display Resources

+

When the application is about to exit, the resources associated with +the graphics system can be released by calling XCloseDisplay:

+
+
void XCloseDisplay(Display *dpy)
+
+

The display handle becomes invalid at this point.
+
+

+

3.8 Query Functions

+

3.8.1 Querying Available Visuals

+A list of all available visuals can be obtained with the XGetVisualInfo +function:
+
+
XVisualInfo +*XGetVisualInfo(Display *dpy, long vinfo_mask, XVisualInfo +*vinfo_template, int *nitems_return)
+
+
+The parameters are as follows:
+
+
+
dpy
+
The display handle, as returned by XOpenDisplay.
+
vinfo_mask
+
A bitmask indicating which fields of the vinfo_template are to +be matched.  The value must be VisualScreenMask.
+
vinfo_template
+
A template whose fields indicate which visual attributes must +be matched by the results.  The screen field of this structure must +be zero.
+
nitems_return
+
Returns the number of visuals returned.
+
+
+The return value is the address of an array of all available visuals.
+
+An example of using XGetVisualInfo to get all available visuals follows:
+
+
XVisualInfo visTemplate, *results;
+int numVisuals;
+Display *dpy = XOpenDisplay(NULL);
+visTemplate.screen = 0;
+results = XGetVisualInfo(dpy, VisualScreenMask, &visTemplate, +&numVisuals);
+
+
+

3.8.2 Querying Visual Attributes

+

The GLX attributes of an X visual may be queried with the +glXGetConfig function:

+
+
int glXGetConfig(Display *dpy, XVisualInfo *vis, int attribute, int *value)
+
+

The parameters are as follows:

+
+
+
dpy
+
The display handle, as returned by XOpenDisplay.
+
vis
+
The visual, as returned by glXChooseVisual.
+
attribute
+
The attribute to query. The attributes are listed below.
+
value
+
Pointer to an integer in which the result of the query will be +stored.
+
+
+

The return value will be zero if no error occurs. + GLX_INVALID_ATTRIBUTE will be returned if the attribute +parameter is invalid.  GLX_BAD_VISUAL will be returned +if the XVisualInfo parameter is invalid.

+

The following attributes may be queried:

+
+
+
GLX_USE_GL
+
The result will be True or False to +indicate if OpenGL rendering is supported with the visual. Mini GLX +always return True.
+
GLX_RGBA
+
The result will be True for RGBA visuals or False +for color index visuals.
+
GLX_DOUBLEBUFFER
+
The result will be True if the visual has two +color buffers or False if the visual has one color buffer.
+
GLX_RED_SIZE
+
The result will be the number of red bits per pixel.
+
GLX_GREEN_SIZE
+
The result will be the number of green bits per pixel.
+
GLX_BLUE_SIZE
+
The result will be the number of blue bits per pixel.
+
GLX_ALPHA_SIZE
+
The result will be the number of alpha bits per pixel.
+
GLX_DEPTH_SIZE
+
The result will be the number of bits per Z value.
+
GLX_STENCIL_SIZE
+
The result will be the number of bits per stencil value.
+
+
+
+
+

3.8.3 Querying the Current Rendering Context

+

The current rendering context can be queried with +glXGetCurrentContext:

+
+
GLXContext glXGetCurrentContext(void)
+
+

Zero will be returned if no context is currently bound.
+
+

+

3.8.4 Querying the Current Drawable

+

The current drawable (i.e. window or drawing surface) can be queried +with glXGetCurrentDrawable:

+
+
GLXDrawable glXGetCurrentDrawable(void)
+
+

Zero will be returned if no drawable is currently bound.
+
+

+

3.8.5 Function Address Queries

+

The glXGetProcAddress function will return the address of any +available OpenGL or Mini GLX function:

+
+
void *glXGetProcAddress(const GLubyte *procName)
+
+

If procName is a valid function name, a pointer to that +function will be returned.  Otherwise, NULL will be returned.

+

The purpose of glXGetProcAddress is to facilitate using future +extensions to OpenGL or Mini GLX. If a future version of the library +adds new extension functions they'll be accessible via +glXGetProcAddress. The alternative is to hard-code calls to the new +functions in the application but doing so will prevent linking the +application with older versions of the library.
+
+

+

3.9 Versioning

+The Mini GLX version can be queried at run time with glXQueryVersion: +
+
Bool glXQueryVersion(Display *dpy, int *major, int *minor)
+
+

major will be set to the major version number andminor +will be set to the minor version number.True will be +returned if the function succeeds. False will be returned +if the function fails due to invalid parameters. The dpy +argument is currently ignored, but should be the value returned by +XOpenDisplay.

+

At compile time, the Mini GLX interface version can be tested with +the MINI_GLX_VERSION_1_x preprocessor tokens. For example, if +version 1.0 of Mini GLX is supported, then MINI_GLX_VERSION_1_0 +will be defined. If version 1.1 of Mini GLX is supported, then +MINI_GLX_VERSION_1_1 will be defined.

+

At the time of writing the current Mini GLX version is 1.0.
+
+

+

4.0 Interoperability with GLX and Xlib

+While Mini GLX strives to be compatible with GLX and Xlib there are +some unavoidable differences which must be taken into consideration.
+

4.1 Public vs Private Structures

+The structure of many X data types is public.  For example, the Display +data type is defined as a structure in /usr/include/X11/Xlib.h and +programmers may access any fields of that structure at will.  Mini +GLX also defines a Display data type but its fields are hidden and not +visiblein miniglx.h.  Duplicating the Xlib +declaration for the Display data type in minigl.h would +require defining a large number of other superfluous Xlib datatypes.
+
+Mini GLX users are discouraged from directly accessing the fields of +Xlib data types to maximize portability - though this is unavoidable to +some extent.  For example, the XVisualInfo and XSetWindowAtttributes +data types must be completely public. +

4.2 Macros

+In some cases, Xlib defines macros which are meant to be used instead +of direct structure accesses.  For example, the RootWindow(dpy, +screen) macro returns the root window for a given screen on a +given display.  Unfortunately, macros do nothing to aid in ABI +compatibility since they are resolved at compile time instead of at +link/run time.
+
+Mini GLX also defines a RootWindow macro since it's +essential for creating windows.  But the implementation of this +macro by Xlib and Mini GLX is completely different.
+

4.3 Summary

+Because Xlib and Mini GLX define data types and macros differently, +Mini GLX applications must be recompiled when retargeting Mini GLX or +native Xlib/GLX.  That is, applications can't simply be re-linked +because of ABI incompatibilities.
+
+Nevertheless, the fact that Mini GLX programs can be recompiled for +Xlib and GLX increases portability and flexibility for testing and +prototyping.
+
+

5.0 Example Program

+

This section shows an example program which uses the Mini GLX +interface. The program simply draws several frames of a rotating square.
+

+

The program may be compiled for use with Xlib/GLX or Mini GLX by +setting the USE_MINIGLX token to 0 or 1, respectively. + Note that the only difference is the header files which are +included.
+

+

+

#define USE_MINIGLX 1 /* 1 = use Mini GLX, 0 = use Xlib/GLX */

#include <stdio.h>
#include <stdlib.h>
#include <GL/gl.h>

#if USE_MINIGLX
#include <GL/miniglx.h>
#else
#include <GL/glx.h>
#include <X11/Xlib.h>
#endif

/*
* Create a simple double-buffered RGBA window.
*/
static Window
MakeWindow(Display * dpy, unsigned int width, unsigned int height)
{
int visAttributes[] = {
GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
None
};
XSetWindowAttributes attr;
unsigned long attrMask;
Window root;
Window win;
GLXContext ctx;
XVisualInfo *visinfo;

root = RootWindow(dpy, 0);

/* Choose GLX visual / pixel format */
visinfo = glXChooseVisual(dpy, 0, visAttributes);
if (!visinfo) {
printf("Error: couldn't get an RGB, Double-buffered visual\n");
exit(1);
}

/* Create the window */
attr.background_pixel = 0;
attr.border_pixel = 0;
attr.colormap = XCreateColormap(dpy, root, visinfo->visual, AllocNone);
attrMask = CWBackPixel | CWBorderPixel | CWColormap;
win = XCreateWindow(dpy, root, 0, 0, width, height,
0, visinfo->depth, InputOutput,
visinfo->visual, attrMask, &attr);
if (!win) {
printf("Error: XCreateWindow failed\n");
exit(1);
}

/* Display the window */
XMapWindow(dpy, win);

/* Create GLX rendering context */
ctx = glXCreateContext(dpy, visinfo, NULL, True);
if (!ctx) {
printf("Error: glXCreateContext failed\n");
exit(1);
}

/* Bind the rendering context and window */
glXMakeCurrent(dpy, win, ctx);

return win;
}


/*
* Draw a few frames of a rotating square.
*/
static void
DrawFrames(Display * dpy, Window win)
{
int angle;
glShadeModel(GL_FLAT);
glClearColor(0.5, 0.5, 0.5, 1.0);
for (angle = 0; angle < 360; angle += 10) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 0.0);
glPushMatrix();
glRotatef(angle, 0, 0, 1);
glRectf(-0.8, -0.8, 0.8, 0.8);
glPopMatrix();
glXSwapBuffers(dpy, win);
}
}


int
main(int argc, char *argv[])
{
Display *dpy;
Window win;

dpy = XOpenDisplay(NULL);
if (!dpy) {
printf("Error: XOpenDisplay failed\n");
return 1;
}

win = MakeWindow(dpy, 300, 300);

DrawFrames(dpy, win);

return 0;
}
+
+ + diff --git a/mesalib/docs/README.3DFX b/mesalib/docs/README.3DFX new file mode 100644 index 000000000..037e8fa7c --- /dev/null +++ b/mesalib/docs/README.3DFX @@ -0,0 +1,830 @@ + + 3Dfx Glide device driver + + + +Requirements: +------------- + +A Voodoo-based videocard/accelerator +DOS (with DJGPP), Windows9x/2k (with MinGW), Linux +Glide3x library for your OS + +http://sourceforge.net/projects/glide/ + + + +How to compile: +--------------- + +DJGPP: + Place the Glide3 SDK in the top Mesa directory: + $(MESA)/glide3/include/ + 3dfx.h, g3ext.h, glide.h, glidesys.h, glideutl.h, sst1vid.h + $(MESA)/glide3/lib/ + libgld3x.a, libgld3i.a, glide3x.dxe + Type: + make -f Makefile.DJ X86=1 FX=1 + Look into the makefile for further information. + +MinGW: + Place the Glide3 SDK in the top Mesa directory: + $(MESA)/glide3/include/ + 3dfx.h, g3ext.h, glide.h, glidesys.h, glideutl.h, sst1vid.h + $(MESA)/glide3/lib/ + libglide3x.a, glide3x.dll + Type: + make -f Makefile.mgw X86=1 FX=1 + Look into the makefile for further information. + +Linux: + Place the Glide3 SDK in /usr/local/glide + /usr/local/glide/include/ + 3dfx.h, g3ext.h, glide.h, glidesys.h, glideutl.h, sst1vid.h + /usr/local/glide/lib/ + libglide3x.a, libglide3x.so + Type: + make linux-glide + or + make linux-x86-glide + + + +Compilation defines: +-------------------- + +FX_DEBUG + enable driver debug code +FX_TRAP_GLIDE + enable Glide trace code +FX_PACKEDCOLOR + use packed color in vertex structure +FX_TC_NAPALM + map GL_COMPRESSED_RGB[A] to FXT1. Works with VSA100-based cards only. +FX_COMPRESS_S3TC_AS_FXT1_HACK + map S3TC to FXT1 +FX_RESCALE_BIG_TEXURES_HACK + fake textures larger than HW can support + (see MESA_FX_MAXLOD environment variable) + + + +Environment variables: +---------------------- + +The following environment variables affect MesaFX. Those that affect Glide +only, are beyond the scope of this section. Entries that don't have a "Value" +field, can have any value whatsoever + ex: set MESA_FX_IGNORE_CMBEXT=y + +"Note" (*) means that the environment variable affects Glide, too; also, if +the var is not found in the environment, it is searched in windoze registry. +"Note" (!) means that the environment variable is not working as expected; +may have undefined effects, might have effects only at Glide level or might +not have any effect whatsoever. Caveat emptor! Those are to be revised soon. + +It is recommended to leave the envvars alone, so that Mesa/Glide will run with +default values. Use them only when you experience crashes or strange behavior. + +FX_GLIDE_NUM_TMU + OS: all + HW: dual-TMU cards (Voodoo2, Avenger, Napalm) + Desc: force single-TMU + Note: (*) + Value: "1" +FX_GLIDE_SWAPPENDINGCOUNT + OS: all + HW: all + Desc: max # of buffers allowed to build up + Note: (*) (!) + Value: "0", "1", "2", "3", "4", "5" or "6" +FX_GLIDE_SWAPINTERVAL + OS: all + HW: all + Desc: number of vertical retraces to wait before swapping + Note: (*) (!) works only at Glide-level? +SSTH3_SLI_AA_CONFIGURATION + OS: all + HW: VSA100-based cards + Desc: SLI/AA setup + Note: (*) (!) works only at Glide-level? + Value: + 1, 2, 4 chip cards + "0" - SLI & AA disable + "1" - SLI disabled, 2 sample AA enabled + 2, 4 chip cards + "2" - 2-way SLI enabled, AA disabled + "3" - 2-way SLI enabled, 2 sample AA enabled + "4" - SLI disabled, 4 sample AA enabled + 4 chip cards + "5" - 4-way SLI enabled, AA disabled + "6" - 4-way SLI enabled, 2 sample AA enabled + "7" - 2-way SLI enabled, 4 sample AA enabled + "8" - SLI disabled, 8 sample AA enabled +SST_DUALHEAD + OS: win32 + HW: ? + Desc: ? + Note: (!) disabled? +MESA_FX_NO_SIGNALS + OS: linux + HW: all + Desc: avoid installing signals + Note: (!) untested! +MESA_FX_INFO + OS: all + HW: all + Desc: verbose to stderr + Value: any; special value "r" to redirect stderr to MESA.LOG +MESA_FX_NOSNAP + OS: all + HW: Voodoo1, Rush, Banshee + Desc: do not snap vertices inside Mesa + Note: to be used with Glide3x that snaps vertices internally +MESA_FX_POINTCAST + OS: all + HW: dual-TMU cards (some Voodoo1, Voodoo2, Avenger, Napalm) + Desc: try to use pointcast palette + Note: may give adverse effects on UMA cards (Avenger, Napalm) +MESA_FX_IGNORE_PALEXT + OS: all + HW: all + Desc: disable 6666 palette +MESA_FX_IGNORE_PIXEXT + OS: all + HW: Napalm + Desc: force 565 16bpp mode (traditional Voodoo, no 32/15bpp) +MESA_FX_IGNORE_TEXFMT + OS: all + HW: Napalm + Desc: disable 32bit textures +MESA_FX_IGNORE_CMBEXT + OS: all + HW: Napalm + Desc: disable Napalm combiners (color/alpha/texture) + Note: this option allows dual-TMU cards perform single-pass + trilinear, but some advanced (multi)texturing modes + won't work (GL_EXT_texture_env_combine) +MESA_FX_IGNORE_MIREXT + OS: all + HW: all + Desc: disable mirror extension +MESA_FX_IGNORE_TEXUMA + OS: all + HW: all + Desc: disable UMA +MESA_FX_IGNORE_TEXUS2 + OS: all + HW: all + Desc: disable Texus2 +MESA_FX_MAXLOD + OS: all + HW: non VSA-100 cards + Desc: enable large texture support using SW rescaling + Value: + "9" - 512x512 textures + "10" - 1024x1024 textures + "11" - 2048x2048 textures +MESA_FX_ALLOW_VP + OS: all + HW: all + Desc: allow vertex program extensions +MESA_GLX_FX + OS: linux + HW: Voodoo1, Rush, Voodoo2 + Desc: display mode + Note: (!) experimental + Value: + "w" - windowed mode + "f" - fullscreen mode + "d" - disable glide driver + OS: win32 + HW: Rush, Banshee, Avenger, Napalm + Desc: display mode + Note: (!) experimental + Value: + "w" - windowed mode + + + +Contact: +-------- + +Daniel Borca +Hiroshi Morii + + + +WARNING! The info below this line is outdated (yet some of it useful). WARNING! +******************************************************************************* + + + +Info for Mesa 4.1 +----------------- + +The 3dfx Glide driver in Mesa is disabled by default. Not too many people +use this driver anymore and at some point down the road it will be dropped. + +To use/enable the Glide driver either do this: + +'./configure --with-glide=DIR' Where DIR is the location of Glide, like + /usr/ or /usr/local + +OR + +'make linux-x86-glide' If using the old-style Makefile system. + +The rest of this file hasn't changed since Mesa 3.3. Some of it's out of +date, but some is still valid. + + + +What do you need ? +------------------ + + - A PC with a 3Dfx Voodoo1/2 Graphics or Voodoo Rush based board + (Pure3D, Monster 3D, R3D, Obsidian, Stingray 128/3D, etc.). + The Quantum3D Obsidian3D-2 X-24 requires some special env. setting + under Linux (more information in the "Useful Glide Environment + Variables"); + + - The 3Dfx Glide library 2.3 or later for your OS (the 2.4 works fine). + The Voodoo2 requires the Glide library 2.51. The Glide 3.1 is not + compatible with the Glide 2.x so it doesn't work with the current + version of the driver; + + - A compiler supported by the Glide library (Micro$oft VC++ (tested), + Watcom (tested), GCC for Linux (tested), etc.); + + - It's nice to have two monitors - one for your normal graphics + card and one for your 3Dfx card. If something goes wrong with + an application using the 3Dfx hardware you can still see your + normal screen in order to recover. + + + +Tested on: +---------- + Windows 95 - David Bucciarelli + Windows NT - Henri Fousse + MS-DOS + Linux - Daryll Strauss, Brian Paul, David Bucciarelli + FreeBSD + BeOS - Duncan Wilcox + MacOS - Fazekas Miklos + + +What is able to do ? +-------------------- + + - It is able accelerate points, lines and polygon with flat + shading, gouraud shading, Z-buffer, texture mapping, blending, fog and + antialiasing (when possible). There is also the support for rendering + in a window with a slow trick for the Voodoo Graphics (available only + for Linux) and at full speed with the Voodoo Rush chipset. + Under Linux is also possible to switch on-the-fly between the fullscreen + and in-window rendering hack. + There is also the support for using more than one Voodoo Graphics in the + some application/PC (you can create one context for each board and use + multiple video outputs for driving monitors, videoprojectors or HMDs). + The driver is able to fallback to pure software rendering when afeature + isn't supported by the Voodoo hardware (however software rendering is + very slow compared to hardware supported rendering) + + + +How to compile: +--------------- + +Linux: +------ + Here are the basic steps for using the 3Dfx hardware with Mesa + on Linux: + + - You'll need the Glide library and headers. Mesa expects: + /usr/local/glide/include/*.h // all the Glide headers + /usr/local/glide/lib/libglide2x.so + + If your Glide libraries and headers are in a different directory + you'll have to modify the Mesa-config and mklib.glide files. + + - Unpack the MesaLib-3.1.tar.gz and MesaDemos-3.1.tar.gz archives; + + - If you're going to use a newer Mesa/Glide driver than v0.27 then + unpack the new driver archive over the Mesa directory. + + - In the Mesa-3.1 directory type "make linux-glide" + + - Compilation _should_ finish without errors; + + - Set your LD_LIBRARY_PATH environment variable so that the + libglide2x.so and Mesa library files can be found. For example: + setenv LD_LIBRARY_PATH "/usr/local/glide/lib:/SOMEDIR/Mesa-3.1/lib" + + - You'll have to run Glide-based programs as root or set the suid + bit on executables; + + - Try a demo: + cd gdemos + su + setenv MESA_GLX_FX f + ./gears (hit ESC to exit) + + - You can find the demos especially designed for the Voodoo driver in + in the Mesa-3.1/3Dfx/demos directory (type "make" in order to compile + everything). + +MacOS: +------ + Check the WEB page at http://valerie.inf.elte.hu/~boga/Mesa.html + +MS Windows: +----------- + + For the MSVC++: + - The glide2x.lib have to be in the default MSVC++ lib directory; + + - The Glide headers have to be in the default MSVC++ include directory; + + - You must have the vcvars32.bat script in your PATH; + + - Go to the directory Mesa-3.1 and run the mesafx.bat; + + - The script will compile everything (Mesa-3.1/lib/OpenGL32.{lib,dll}, + Mesa-3.1/lib/GLU32.{lib,dll}, Mesa-3.1/lib/GLUT32.{lib,dll} and + Voodoo demos); + + - At the end, you will be in the Mesa-3.1/3Dfx/demos directory; + + - Try some demo (fire.exe, teapot.exe, etc.) in order to check if + everything is OK (you can use Alt-Tab or Ctrl-F9 to switch between + the Voodoo screen and the windows desktop); + + - Remember to copy the Mesa OpenGL32.dll, GLU32.dll and GLUT32.dll in the + some directory were you run your Mesa based applications. + + - I think that you can easy change the Makefile.fx files in order + to work with other kind of compilers; + + - To discover how open the 3Dfx screen, read the sources under + the Mesa-3.1/3Dfx/demos directory. You can use the GLUT library or + the Diego Picciani's wgl emulator. + + NOTE: the MSVC++ 5.0 optimizer is really buggy. Also if you install the + SP3, you could have some problem (you can disable optimization in order + solve these kind of problems). + + +Doing more with Mesa & Linux Glide: +----------------------------------- + + The MESA_GLX_FX environment variable can be used to coax most + GLX-based programs into using Glide (and the __GLUT library + is GLX-based__). + + Full-screen 3Dfx rendering: + --------------------------- + + 1. Set the MESA_GLX_FX variable to "fullscreen": + + ksh: + export MESA_GLX_FX = "fullscreen" + csh: + setenv MESA_GLX_FX fullscreen + + 2. As root, run a GLX-based program (any GLUT demo on Linux). + + 3. Be careful: once the 3Dfx screen appears you won't be able + to see the GLUT windows on your X display. This can make using + the mouse tricky! One solution is to hook up your 3Dfx card to + a second monitor. If you can do this then set these env vars + first: + + setenv SST_VGA_PASS 1 + setenv SST_NOSHUTDOWN + + or for the Voodoo2: + + setenv SSTV2_VGA_PASS 1 + setenv SSTV2_NOSHUTDOWN + + Rendering into an X window with the help of the Voodoo hardware: + ---------------------------------------------------------------- + + 1. Start your X server in 16 bpp mode (XFree86: startx -- -bpp 16) + in order to have the best performance and the best visual + quality. However you can use any visual depth supported by X. + + 2. Set the following environment variables: + export MESA_GLX_FX="window" # to enable window rendering + export SST_VGA_PASS=1 # to stop video signal switching + export SST_NOSHUTDOWN=1 # to stop video signal switching + OR + setenv MESA_GLX_FX window + setenv SST_VGA_PASS 1 + setenv SST_NOSHUTDOWN 1 + + (the Voodoo2 requires to use "SSTV2_" instead "SST_"). + + 3. As root, try running a GLX-based program + + How does it work? We use the 3Dfx hardware to do rendering then + copy the image from the 3Dfx frame buffer into an X window when + the SwapBuffers() function is called. The problem with this + idea is it's slow. The image must be copied from the 3Dfx frame + buffer to main memory then copied into the X window (and when the X + visual depth doesn't match the Voodoo framebufffer bit per pixel, it + is required also a pixel format translation). + + NOTE: the in-window rendering feature only works with double-buffering. + + + On the fly switching between in window rendering and full screen rendering + -------------------------------------------------------------------------- + + The Mesa 2.6 has introduced the capability of switching + on-the-fly between the fullscreen/fullspeed rendering and the in-window + hack and vice versa. The on-the-fly switching requires a direct support + by the application but it is really easy to add. You have to start + your X server in 16 bpp mode and to add the following lines to your + application: + + #if defined(FX) && define(XMESA) + #include + + static int fullscreen=1; + #endif + + ... + + /* In the GLUT keyboard event callback */ + + #if defined(FX) && !define(WIN32) + case ' ': + fullscreen=(!fullscreen); + XMesaSetFXmode(fullscreen ? XMESA_FX_FULLSCREEN : XMESA_FX_WINDOW); + break; + #endif + ... + + See the 3Dfx/demos/tunnel.c program + for an example. You have to set the -DXMESA flag in the Makefile's COPTS + to enable it. + + Rendering into an X window with the X11 software driver: + -------------------------------------------------------- + + Set the MESA_GLX_FX variable to "disable" your GLX-based program will use + the X11 software driver (the 3Dfx hardware isn't used at all). + + + +Useful Glide Environment Variables: +----------------------------------- + + - To disable the 3Dfx logo, set the FX_GLIDE_NO_SPLASH variable. + + - To disable video signal switching: + setenv SST_VGA_PASS 1 + setenv SST_NOSHUTDOWN + or for the Voodoo2: + setenv SSTV2_VGA_PASS 1 + setenv SSTV2_NOSHUTDOWN + + - To set the default screen refresh rate: + setenv SST_SCREENREFRESH=75 + + the supported values are 60, 70, 72, 75, 80, 85, 90, 100, 120. + + - To force the Mesa library to swap buffers as fast as possible, + without any vertical blanking synchronization (useful for benchmarks): + setenv FX_GLIDE_SWAPINTERVAL 0 + setenv SST_SWAP_EN_WAIT_ON_VIDSYNC 0 + + - You can slight improve the performances of your Voodoo1 board with + the following env. var.: + setenv SST_FASTMEM 1 + setenv SST_PCIRD 1 + setenv SST_GRXCLK 57 + + (don't use this setting with the Quantum3D 100SB or with any other + SLI configuration: it will hang everything !). + The following setting can be used with the Voodoo2: + setenv SSTV2_FASTMEM_RAS_READS=1 + setenv SSTV2_FASTPCIRD=1 + setenv SSTV2_GRXCLK=95 + + - The Quantum3D Obsidian3D-2 X-24 requires some special env. setting + in order to work under Linux: + + export SSTV2_FT_CLKDEL=5 + export SSTV2_TF0_CLKDEL=7 + export SSTV2_TF1_CLKDEL=7 + export SSTV2_TF2_CLKDEL=7 + export SSTV2_SLIM_VIN_CLKDEL=3 + export SSTV2_SLIM_VOUT_CLKDEL=2 + export SSTV2_SLIS_VIN_CLKDEL=3 + export SSTV2_SLIS_VOUT_CLKDEL=2 + + (Thanks to Phil Ross for this trick). + + + + +The Mesa/Voodoo Environment Variables: +-------------------------------------- + + - Only for Windows/Voodoo Rush users, if you define the + env. var. MESA_WGL_FX: + export MESA_WGL_FX=fullscreen + you will get fullscreen rendering; + + - Only for Windows/Voodoo Rush users, if you define the + env. var. MESA_WGL_FX: + export MESA_WGL_FX=window + you will get window rendering (default value); + + - Only for Linux users, you can find more informations about + the env. var. MESA_GLX_FX in the "Doing more with Mesa & Linux Glide" + section; + + - If you define the env. var. MESA_FX_SWAP_PENDING: + export MESA_FX_SWAP_PENDING=4 + you will able to set the maximum number of swapbuffers + commands in the Voodoo FIFO after a swapbuffer (default value: 2); + + - If you define the env. var. MESA_FX_INFO: + export MESA_FX_INFO=1 + you will get some useful statistic. + + - If you define the env. var. MESA_FX_NO_SIGNALS: + export MESA_FX_NO_SIGNALS=1 + Mesa/FX will not install atexit() or signal() handlers. + + + +Know BUGS and Problems: +----------------------- + + - fog doesn't work in the right way when using the glDepthRange() function; + + - Maximum texture size: 256x256 (this is an hardware limit); + + - Texture border aren't yet supported; + + - A GL_BLEND in a glTexEnv() is not supported (it is an hardware limit); + + - Use the glBindTexture extension (standard in OpenGL 1.1) for texture + mapping (the old way: glTexImage inside a display list, download + the texture map each time that you call the display list !!!); + + - Stencil buffer and Accumulation buffer are emulated in software (they are not + directly supported by the Hardware); + + - Color index mode not implemented (this is an hardware limit); + + - Thre is an know bug in the Linux Glide library so the in-window-rendering hack + and any other operations that requires to read the Voodoo frame buffer + (like the accumulation buffer support) doesn't work on Voodoo SLI cards. + + - The driver switch to pure software (_slow_) rendering when: + + - Stencil enabled; + - Using the Accumulation buffer; + - Blend enabled and blend equation != GL_FUNC_ADD_EXT; + - Color logic operation enabled and color logic operation != GL_COPY; + - Using GL_SEPARATE_SPECULAR_COLOR; + - The four values of glColorMask() aren't the some; + - Texture 1D or 3D enabled; + - Texture function is GL_BLEND; + - Using the Multitexture extension with Voodoo cards with only one TMU; + - Using the Multitexture extension with Voodoo cards with more than + one TMU, and texture function isn't GL_MODULATE; + - Point size is != 1.0 or point params vector != (1.0,0.0,0.0); + - Line width != 1.0 or using stipple lines. + - Using polygon offset or stipple polygons; + + NOTE: this is list is not yet complete. + + +Hints and Special Features: +--------------------------- + + - Under Linux and with a Voodoo Graphics board, you can use + XMesaSetFXmode(XMESA_FX_FULLSCREEN or XMESA_FX_WINDOW) in order to + switch on the fly between fullscreen rendering and the in-window-rendering + hack. + + - The driver is able to use all the texture memory available: 2/4MB on + Voodoo1 boards and 8MB (!) on high-end Voodoo1 and Voodoo2 boards. + + - Trilinear filtering is fully supported on Voodoo boards with two TMUs + (high-end Voodoo1 boards and Voodoo2 boards). When only one TMU is + available the driver fallback to bilinear filter also if you ask + for trilinear filtering. + + - The Voodoo driver support multiple Voodoo Graphics boards in the + some PC. Using this feature, you can write applications that use + multiple monitors, videoprojectors or HMDs for the output. See + Mesa-3.1/3Dfx/demos/tunnel2.c for an example of how setup one + context for each board. + + - The v0.19 introduces a new powerful texture memory manager: the + texture memory is used as a cache of the set of all defined texture + maps. You can now define several MBs of texture maps also with a 2MB + of texture memory (the texture memory manager will do automatically + all the swap out/swap in + texture memory work). The new texture memory manager has also + solved a lot of other bugs/no specs compliance/problems + related to the texture memory usage. + + - Use triangles and quads strip: they are a LOT faster than sparse + triangles and quads. + + - The Voodoo driver supports the GL_EXT_paletted_texture. it works + only with GL_COLOR_INDEX8_EXT, GL_RGBA palettes and the alpha value + is ignored because this is a limitation of the the current Glide + version and of the Voodoo hardware. See Mesa-3.1/3Dfx/demos/paltex.c for + a demo of this extension. + + - The Voodoo driver directly supports 3Dfx Global Palette extension. + It was written for GLQuake and I think that it isn't a good idea + to use this extension for any other purpose (it is a trick). See + Mesa-3.1/3Dfx/demos/glbpaltex.c for a demo of this extension. + + - The Voodoo driver chooses the screen resolution according to the + requested window size. If you open a 640x480 window, you will get + a 640x480 screen resolution, if you open a 800x600 window, you + will get a 800x600 screen resolution, etc. + Most GLUT demos support the '-geometry' option, so you can choose + the screen resolution: 'tunnel -geometry 800x600'. + Clearly, you Voodoo board must have enough framebuffer RAM (otherwise + the window creation will fail). + + - The glGetString(GL_RENDERER) returns more information + about the hardware configuration: "Mesa Glide + CARD/ FB/ + TM/ TMU/" + where: CARD is the card used for the current context, + FB is the number of MB for the framebuffer, + TM is the number of MB for the texture memory, + TMU is the number of TMU. You can try to run + Mesa/demos/glinfo in order to have an example of the output. + +Did you find a lot BUGs and problems ? Good, send me an email. + + + +FAQ: +---- + +For a complete FAQ check the Bernd Kreimeier's Linux 3Dfx HOWTO +available at http://www.gamers.org/dEngine/xf3D (it includes also +a lot of informations not strictly related to Linux, so it can be +useful also if you don't use Linux) + +1. What is 3Dfx? + +3Dfx Interactive, Inc. is the company which builds the VooDoo 3-D graphics +chipset (and others) used in popular PC cards such as the Diamond Monster 3D +and the Orchid Righteous 3D (more informations at http://www.3dfx.com). + + +2. What is Glide? + +Glide is a "thin" programming interface for the 3Dfx hardware. It was +originally written for Windows/Intel but has been ported to Linux/Intel +by Daryll Strauss. + +3Dfx, Inc. should be applauded for allowing the Linux version of Glide +to be written. + +You can directly program with the Glide library if you wish. You can +obtain Glide from the "Developer" section of the 3Dfx website: www.3dfx.com +There's a Linux/Glide newsgroup at news://news.3dfx.com/3dfx.glide.linux + + +3. What is fxmesa? + +"fxmesa" is the name of the Mesa device driver for the 3Dfx Glide library. +It was written by David Bucciarelli and others. It works on both Linux +and Windows. Basically, it allows you to write and run OpenGL-style programs +on the 3Dfx hardware. + + +4. What is GLQuake? + +Quake is a very popular game from id software, Inc. See www.idsoftware.com +GLQuake is a version of Quake written for OpenGL. There is now a Linux +version of GLQuake with works with the Mesa/3Dfx/Glide combo. + +Here's what you need to run GLQuake on Linux: + PC with 100MHz Pentium or better + a 3Dfx-based card + Mesa 3.1 libraries: libMesaGL.so libMesaGLU.so + Glide 2.4 libraries: libglide2x.so libtexus.so + GLQuake for Linux. + +Also, the windows version of GLQuake works fine with the Mesa OpenGL32.dll, +you have only to copy the Mesa-3.1/lib/OpenGL32.dll in the GLQuake directory +in order to test 'MesaQuake'. + + +5. What is GLUT? + +GLUT is Mark Kilgard's OpenGL Utility Toolkit. It provides an API for +writing portable OpenGL programs with support for multiple windows, pop- +up menus, event handling, etc. + +Check the Mark's home page for more informations (http://reality.sgi.com/mjk_asd). + +Every OpenGL programmer should check out GLUT. + +GLUT on Linux uses GLX. + + +6. What is GLX? + +GLX is the OpenGL extension to the X Window System. I defines both a +programming API (glX*() functions) and a network protocol. Mesa implements +an emulation of GLX on Linux. A real GLX implementation would requires +hooks into the X server. The 3Dfx hardware can be used with GLX-based +programs via the MESA_GLX_FX environment variable. + + +7. Is the Voodoo driver able to use the 4Mb texture memory of +the Pure3D boards ? + +Yes, the Voodoo driver v0.20 includes the support for Voodoo +Graphics boards with more than 2Mb of texture memory. + + +8. Do the Voodoo driver support the Voodoo Rush under Windows ? + +Yes, Diego Picciani has developed the support for the Voodoo +Rush but David Bucciarelli has a Pure3D and a Monster3D and Brian Paul +has a Monster3D, so the new versions of the Mesa/Voodoo sometime are +not tested with the Voodoo Rush. + + +9. Do the Voodoo driver support the Voodoo Rush under Linux ? + +No because the Linux Glide doesn't (yet) support the Voodoo Rush. + + +10. Can I sell my Mesa/Voodoo based software and include +a binary copy of the Mesa in order to make the software +working out of the box ? + +Yes. + + +11. Which is the best make target for compiling the Mesa for +Linux GLQuake ('make linux-glide', 'make linux-386-glide', etc.) ? + +'make linux-386-opt-glide' for Voodoo1 and 'make linux-386-opt-V2-glide' +for Voodoo2 boards because it doesn't include the '-fPIC' +option (4-5% faster). + + +12. Can I use a Mesa compiled with a 'make linux-386-opt-V2-glide' +for my applications/programs/demos ? + +Yes, there is only one constrain: you can't run two Mesa applications +at the some time. This isn't a big issue with the today Voodoo Graphics. + + +Thanks to: +---------- + +Henri Fousse (he has written several parts of the v0.15 and the old GLUT + emulator for Win); + +Diego Picciani (he has developed all the Voodoo Rush support and the wgl + emulator); + +Daryll Strauss (for the Linux Glide and the first Linux support); + +Brian Paul (of course); + +Dave 'Zoid' Kirsch (for the Linux GLQuake and Linux Quake2test/Q2 ports) + +Bernd Kreimeier (for the Linux 3Dfx HOWTO and for pushing companies to offer + a better Linux support) + +3Dfx and Quantum3D (for actively supporting Linux) + +The most update places where find Mesa VooDoo driver related informations are +the Mesa mailing list and my driver WEB page +(http://www-hmw.caribel.pisa.it/fxmesa/index.shtml) + + +David Bucciarelli (davibu@tin.it) + +Humanware s.r.l. +Via XXIV Maggio 62 +Pisa, Italy +Tel./Fax +39-50-554108 +email: info.hmw@plus.it +www: www-hmw.caribel.pisa.it diff --git a/mesalib/docs/README.AMIWIN b/mesalib/docs/README.AMIWIN new file mode 100644 index 000000000..47cf696cc --- /dev/null +++ b/mesalib/docs/README.AMIWIN @@ -0,0 +1,181 @@ +AMIGA AMIWIN PORT of MESA: THE OPENGL SOFTWARE EMULATION +======================================================== +Port by Victor Ng-Thow-Hing (victorng@dgp.toronto.edu) +Original Author (Brian Paul (brianp@ssec.wisc.edu) + +Dec.1 , 1995: Port of release Mesa 1.2.5 + - Modifications made to minimize changes to Mesa distribution. + +Nov.25, 1995: Port of release Mesa 1.2.4 + + +HISTORY +======= +As a 3D graphics progammer, I was increasingly frustrated to see OpenGL +appearing on so many platforms EXCEPT the Amiga. Up to now, the task +of porting OpenGL directly from native Amiga drawing routines seemed like +a daunting task. However, two important events made this port possible. + +First of all, Brian Paul wrote Mesa, the OpenGL software emulator that +can be found on many platforms - except the Amiga and Atari (who cares +about the latter!). This was pretty ironic considering that Mesa was +originally prototyped on an Amiga! The second great event was when +Holger Kruse developed AmiWin, the X11R6 server for the Amiga (definitely +register for this great piece of software) and released a development kit +so one could compile X programs with SAS/C. + +Since Mesa had X routines as its primitive drawing operations, this made +a marriage of Mesa and Amiwin feasible. I copied over the sources from +an ftp site, played with the code, wrote some Smakefiles, and voila, +I had OpenGL programs displaying on my Amiga. + +Although the speed is nothing to be impressed about, this port can be +potentially useful to those who want to quickly test their code in +wireframe or perhaps learn more about programming with the OpenGL API. + +I hope Amiga developers will continue to write excellent software for +their machine, especially more X clients for Amiwin. If you have any +solutions so some of my problems in the porting notes, please send me +some email! + +See you around, +Vic. + +HOW TO CREATE THE LIBRARIES AND SAMPLE CODE +=========================================== + +Just run the shell script mklib.amiwin in the mesa directory. This will +make all the libraries and copy them into the mesa/lib directory. If you +don't want to compile everything, just go to the desired directory and +type smake in that directory. + +Change any of the variables in the smakefiles as necessary. You will REQUIRE +the Amiwin development kit to compile these libraries since you need X11.LIB +and the shareable X libraries. Some examples require the AmiTCP4.0 +net.lib static link library and related header files for unix related +header files and functions like sleep(). + +HOW TO USE THE MESA LIBRARIES +============================= + +Study the Smakefiles in the demos, samples and book directories for the +proper SAS/C options and linkable libraries to use. Basically aux calls +require Mesaaux.LIB, gl calls require MesaGL.LIB, glu calls MesaGLU.LIB, +tk calls Mesatk.LIB. There is a preliminary port of MesaGLUT.LIB toolkit +available in the lib directory with the other Mesa libraries. However, +it seems to cause crashes on some of the sample code. Someone else may want +to attempt a more stable port. + +PORTING NOTES TO AMIWIN +======================= + +My strategy of porting was to leave as much of the code untouched as +possible. I surrounded any amiga specific changes with +#ifdef AMIWIN ... #endif or #ifndef AMIWIN ... #endif preprocessor +symbols. The code was ported on an Amiga 2000, with Fusion 40 accelerator +and a Picasso II graphics card. The SAS/C 6.56 compiler was used, with +the AmiWin 2.16 X development kit. + +All compilations were done for a 68040 CPU with 68882 math coprocessor for +maximum speed. Please edit the smakefile for other compilers. +I wrote smakefiles for the directories I ported. I omitted the Windows +and Widgets directories. The former is for MS Windows and the latter +requires Motif, which is not easily available for the Amiga. + +Here are the changes I did per directory: + +* mesa +Nov. 25, 1995 v 1.2.4 + - added a mklib.amiwin shell script that will make all the libraries and + sample code for Mesa + - created this readme file: readme.AMIGA + +* mesa/include +Dec. 1, 1995 v 1.2.5 + - added the following to GL/xmesa.h + #ifdef AMIWIN + #include + extern struct Library *XLibBase; + #endif +NET CHANGE: xmesa.h + +* mesa/src +Nov. 25, 1995 v 1.2.4 + - added the necessary pragma calls for X functions to the following: + xmesa1.c, xmesa2.c, xmesa3.c, xfonts.c, glx.c + This prevents undefined symbols errors during the linking phase for + X library calls + - created smakefile +Dec. 1, 1995 v 1.2.5 + - removed AMIWIN includes from xmesa1.c, xmesa2.c, xmesa3.c, xfonts.c, + glx.c since they are now defined in include/GL/xmesa.h +NET CHANGE: smakefile + +* mesa/src-tk +Nov. 25, 1995 v 1.2.4 + - added the necessary pragma calls for X functions to the following: + private.h + - created smakefile +Dec. 1, 1995 v 1.2.5 + - removed AMIWIN includes from private.h since it is now defined in + include/GL/xmesa.h +NET CHANGE: smakefile + +* mesa/src-glu +Nov. 25, 1995 v 1.2.4 + - created smakefile +NET CHANGE: smakefile + +* mesa/src-aux +Nov. 25, 1995 v 1.2.4 + - added the necessary pragma calls for X functions to the following: + glaux.c + - created smakefile +NET CHANGE: glaux.c, smakefile + +* mesa/demos +Nov. 25, 1995 v 1.2.4 + - added the necessary pragma calls for X functions to the following: + xdemo.c, glxdemo.c, offset.c + - created smakefile + - put #ifndef AMIWIN ... #endif around sleep() calls in xdemo.c since + they are not part of AmigaDOS. +Dec. 1, 1995 v 1.2.5 + - removed AMIWIN defines from xdemo.c, glxdemo.c, offset.c since + already defined in include/GL/xmesa.h + - modified Smakefile to include header and includes from the AmiTCP4.0 + net.lib linkable library to provide unix-compatible sys/time.h and + the sleep() function + - removed AMIWIN defines in xdemo.c since sleep() now defined +NET CHANGE: smakefile + +* mesa/samples +Nov. 25, 1995 v 1.2.4 + - added the necessary pragma calls for X functions to the following: + oglinfo.c + - created smakefile + - put #ifndef AMIWIN ... #endif around sleep() in blendxor.c + - removed olympic from smakefile targets since not defined +Dec. 1, 1995 v 1.2.5 + - removed AMIWIN defines from oglinfo.c, since already defined in + include/GL/xmesa.h + - modified Smakefile to include header and includes from the AmiTCP4.0 + net.lib linkable library to provide unix-compatible sys/time.h and + the sleep() function + - removed AMIWIN defines in blendxor.c for sleep() + - added AMIWIN defines around _MACHTEN_ in olympic.c since xrandom() + functions are not defined in any libraries + - added olympic back into the Smakefile targets +NET CHANGE: smakefile, olympic.c + +* mesa/book +Nov. 25, 1995 v 1.2.4 +- created smakefile +- removed accpersp and dof from smakefile targets since the SAS/C compile seems to + confuse the near,far variables with near/far memory models. +NET CHANGE: smakefile + +* mesa/windows +Dec. 1, 1995 v 1.2.5 +- Removed directory to save space since this is only needed for Windows based + machines. diff --git a/mesalib/docs/README.BEOS b/mesalib/docs/README.BEOS new file mode 100644 index 000000000..efd84e888 --- /dev/null +++ b/mesalib/docs/README.BEOS @@ -0,0 +1,136 @@ + + Mesa / BeOS Information + + + +* Introduction + +Brian Paul added in Mesa 3.1 a driver for BeOS R4.5 operating system. +This driver implements a clone of the BGLView class. This class, +derived from BView, allows OpenGL rendering into any BeOS window. His +driver was updated in Mesa 4.1 and again in version 6.1 by Philippe +Houdoin, who's maintaining this driver since. + +Any application which uses the BGLView should be able to use Mesa +instead of Be's OpenGL without changing any code. + +Since Be's OpenGL implementation (as of R5) is basically just the +SGI sample implementation, it's pretty slow. You'll see that Mesa +is considerably faster. + + +* Source Code + +The source code for the driver is in src/mesa/drivers/beos/ directory. +It's not 100% finished at this time but many GLUT-based demos are +working. No optimizations have been made at this time. + + +* Compiling + +Since Mesa 6.x, it can be build under BeOS with both the R5 builtin gcc version +or more recent gcc versions available for BeOS, like this gcc version 2.95.3 for BeOS +you can find at http://www.bebits.com/app/2157. +Anyway, keep in mind that to take full advantage of Mesa x86 optimizations, you better +want to use gcc 2.95.3 or sooner versions... + +To build Mesa-powered BeOS libGL.so version, open an Terminal window, +move to Mesa root folder and type this command: + +$ make beos + +Note that the "beos" argument is only needed the first time to setup build config. +Next times, typing "make" will be enough. + +When it finishes the Mesa based libGL.so library for +BeOS will be in the lib/ directory, along libglut.so library. +Several demo/test programs should have been build too under progs/* folders. +If it stop when building one of the progs/* programs, you may want to ignore it +and force make to move on next target by adding the -k make option: + +$ cd progs +$ make -k + +To install it as Be's default libGL.so replacement, put it in your +/boot/home/config/lib/ directory. All your GL/GLUT apps will use +the Mesa based then. + +By default, it build a non-debug version library. +The x86 (MMX, SSE and 3DNOW) optimizations are also supported for x86 target. +For PowerPC BeOS flavor, sorry, Mesa don't have ppc (Altivec) optimizations +yet. + +To build a DEBUG version, type instead this : + +$ DEBUG=1 make + + +* Example Programs + +Look under progs/beos/ for some BGLView-based programs. +You should find under progs/samples and progs/redbook directories GLUT-based programs too. +They all should have been compiled along with the Mesa library. + + +* GLUT + +A beta version of GLUT 3.7 port for BeOS, made by Jake Hamby, can be found at +http://anobject.com/jehamby/Code/Glut-3.7-x86.zip. +This is the version currently included in Mesa source code, and +build in lib/libglut.so. + +A previous 3.5 version of this GLUT BeOS port used to be available at +http://home.beoscentral.com/jehamby/Glut-3.5-x86.zip. + +They're special versions of GLUT for the BeOS platform. I don't +believe Mark Kilgard's normal GLUT distribution includes BeOS +support. + + +* Special Features + +Mesa's implementation of the BGLView class has an extra member +function: CopySubBufferMESA(). It basically works like SwapBuffers() +but it only copies a sub region from the back buffer to the front +buffer. This is a useful optimization for some applications. +If you use this method in your code be sure that you check at runtime +that you're actually using Mesa (with glGetString) so you don't +cause a fatal error when running with Be's OpenGL. + + +* Work Left To Do + +- BDirectWindow single buffering support is not implemented yet. +- Color index mode is not implemented yet. +- Reading pixels from the front buffer not implemented yet. +- There is also a BGLScreen class in BeOS for full-screen OpenGL rendering. + This should also be implemented for Mesa. +- Multiple renderers add-ons support, first step toward hardware acceleration + support. + +* Other contributors to this BeOS port + +Jake Hamby jhamby anobject com +Marcin Konicki ahwayakchih neoni net +Francois Revol revol free fr +Nathan Whitehorn nathanw uchicago edu + + +* Older BeOS Driver + +Mesa 2.6 had an earlier BeOS driver. It was based on Mesa's Off-screen +rendering interface, not BGLView. If you're interested in the older +driver you should get Mesa 2.6. + + +* BeOS and Glide + +Mesa 3.0 supported the 3Dfx/Glide library on Beos. Download Mesa 3.0 +if interested. Ideally, the 3Dfx/Glide support should be updated to +work with the new Mesa 3.1 BGLView implementation. + +The Glide library hasn't been updated for BeOS R4 and newer, to my knowledge, +as of February, 1999. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/README.CYGWIN b/mesalib/docs/README.CYGWIN new file mode 100644 index 000000000..58d5af3e2 --- /dev/null +++ b/mesalib/docs/README.CYGWIN @@ -0,0 +1,256 @@ + + Mesa Cygwin/X11 Information + + +WARNING +======= + +If you installed X11 (packages xorg-x11-devel and xorg-x11-bin-dlls ) with the +latest setup.exe from Cygwin the GL (Mesa) libraries and include are already +installed in /usr/X11R6. + +The following will explain how to "replace" them. + +Installation +============ + +How to compile Mesa on Cygwin/X11 systems: + +1. Shared libs: + type 'make cygwin-sl'. + + When finished, the Mesa DLL will be in the Mesa-x.y/lib/ and + Mesa-x.y/bin directories. + + +2. Static libs: + type 'make cygwin-static'. + When finished, the Mesa libraries will be in the Mesa-x.y/lib/ directory. + +Header and library files: + After you've compiled Mesa and tried the demos I recommend the following + procedure for "installing" Mesa. + + Copy the Mesa include/GL directory to /usr/X11R6/include: + cp -a include/GL /usr/X11R6/include + + Copy the Mesa library files to /usr/X11R6/lib: + cp -a lib/* /usr/X11R6ocal/lib + + Copy the Mesa bin files (used by the DLL stuff) to /usr/X11R6/bin: + cp -a lib/cyg* /usr/X11R6/bin + +Xt/Motif widgets: + If you want to use Mesa or OpenGL in your Xt/Motif program you can build + the widgets found in either the widgets-mesa or widgets-sgi directories. + The former were written for Mesa and the later are the original SGI + widgets. Look in those directories for more information. + For the Motif widgets you must have downloaded the lesstif package. + + +Using the library +================= + +Configuration options: + The file src/mesa/main/config.h has many parameters which you can adjust + such as maximum number of lights, clipping planes, maximum texture size, + etc. In particular, you may want to change DEPTH_BITS from 16 to 32 + if a 16-bit depth buffer isn't precise enough for your application. + + +Shared libraries: + If you compile shared libraries (Win32 DLLS) you may have to set an + environment variable to specify where the Mesa libraries are located. + Set the PATH variable to include /your-dir/Mesa-2.6/bin. + Otherwise, when you try to run a demo it may fail with a message saying + that one or more DLL couldn't be found. + + +Xt/Motif Widgets: + Two versions of the Xt/Motif OpenGL drawing area widgets are included: + + widgets-sgi/ SGI's stock widgets + widgets-mesa/ Mesa-tuned widgets + + Look in those directories for details + + +Togl: + Togl is an OpenGL/Mesa widget for Tcl/Tk. + See http://togl.sourceforge.net for more information. + + + +X Display Modes: + Mesa supports RGB(A) rendering into almost any X visual type and depth. + + The glXChooseVisual function tries its best to pick an appropriate visual + for the given attribute list. However, if this doesn't suit your needs + you can force Mesa to use any X visual you want (any supported by your + X server that is) by setting the MESA_RGB_VISUAL and MESA_CI_VISUAL + environment variables. When an RGB visual is requested, glXChooseVisual + will first look if the MESA_RGB_VISUAL variable is defined. If so, it + will try to use the specified visual. Similarly, when a color index + visual is requested, glXChooseVisual will look for the MESA_CI_VISUAL + variable. + + The format of accepted values is: + Here are some examples: + + using the C-shell: + % setenv MESA_RGB_VISUAL "TrueColor 8" // 8-bit TrueColor + % setenv MESA_CI_VISUAL "PseudoColor 12" // 12-bit PseudoColor + % setenv MESA_RGB_VISUAL "PseudoColor 8" // 8-bit PseudoColor + + using the KornShell: + $ export MESA_RGB_VISUAL="TrueColor 8" + $ export MESA_CI_VISUAL="PseudoColor 12" + $ export MESA_RGB_VISUAL="PseudoColor 8" + + +Double buffering: + Mesa can use either an X Pixmap or XImage as the backbuffer when in + double buffer mode. Using GLX, the default is to use an XImage. The + MESA_BACK_BUFFER environment variable can override this. The valid + values for MESA_BACK_BUFFER are: Pixmap and XImage (only the first + letter is checked, case doesn't matter). + + A pixmap is faster when drawing simple lines and polygons while an + XImage is faster when Mesa has to do pixel-by-pixel rendering. If you + need depth buffering the XImage will almost surely be faster. Exper- + iment with the MESA_BACK_BUFFER variable to see which is faster for + your application. + + +Colormaps: + When using Mesa directly or with GLX, it's up to the application writer + to create a window with an appropriate colormap. The aux, tk, and GLUT + toolkits try to minimize colormap "flashing" by sharing colormaps when + possible. Specifically, if the visual and depth of the window matches + that of the root window, the root window's colormap will be shared by + the Mesa window. Otherwise, a new, private colormap will be allocated. + + When sharing the root colormap, Mesa may be unable to allocate the colors + it needs, resulting in poor color quality. This can happen when a + large number of colorcells in the root colormap are already allocated. + To prevent colormap sharing in aux, tk and GLUT, define the environment + variable MESA_PRIVATE_CMAP. The value isn't significant. + + +Gamma correction: + To compensate for the nonlinear relationship between pixel values + and displayed intensities, there is a gamma correction feature in + Mesa. Some systems, such as Silicon Graphics, support gamma + correction in hardware (man gamma) so you won't need to use Mesa's + gamma facility. Other systems, however, may need gamma adjustment + to produce images which look correct. If in the past you thought + Mesa's images were too dim, read on. + + Gamma correction is controlled with the MESA_GAMMA environment + variable. Its value is of the form "Gr Gg Gb" or just "G" where + Gr is the red gamma value, Gg is the green gamma value, Gb is the + blue gamma value and G is one gamma value to use for all three + channels. Each value is a positive real number typically in the + range 1.0 to 2.5. The defaults are all 1.0, effectively disabling + gamma correction. Examples using csh: + + % setenv MESA_GAMMA "2.3 2.2 2.4" // separate R,G,B values + % setenv MESA_GAMMA "2.0" // same gamma for R,G,B + + The demos/gamma.c program may help you to determine reasonable gamma + value for your display. With correct gamma values, the color intensities + displayed in the top row (drawn by dithering) should nearly match those + in the bottom row (drawn as grays). + + Alex De Bruyn reports that gamma values of 1.6, 1.6 and 1.9 work well + on HP displays using the HP-ColorRecovery technology. + + Mesa implements gamma correction with a lookup table which translates + a "linear" pixel value to a gamma-corrected pixel value. There is a + small performance penalty. Gamma correction only works in RGB mode. + Also be aware that pixel values read back from the frame buffer will + not be "un-corrected" so glReadPixels may not return the same data + drawn with glDrawPixels. + + For more information about gamma correction see: + http://www.inforamp.net/~poynton/notes/colour_and_gamma/GammaFAQ.html + + +Overlay Planes + + Overlay planes in the frame buffer are supported by Mesa but require + hardware and X server support. To determine if your X server has + overlay support you can test for the SERVER_OVERLAY_VISUALS property: + + xprop -root | grep SERVER_OVERLAY_VISUALS + + +HPCR glClear(GL_COLOR_BUFFER_BIT) dithering + + If you set the MESA_HPCR_CLEAR environment variable then dithering + will be used when clearing the color buffer. This is only applicable + to HP systems with the HPCR (Color Recovery) system. + + +Extensions +========== + There are three Mesa-specific GLX extensions at this time. + + GLX_MESA_pixmap_colormap + + This extension adds the GLX function: + + GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual, + Pixmap pixmap, Colormap cmap ) + + It is an alternative to the standard glXCreateGLXPixmap() function. + Since Mesa supports RGB rendering into any X visual, not just True- + Color or DirectColor, Mesa needs colormap information to convert RGB + values into pixel values. An X window carries this information but a + pixmap does not. This function associates a colormap to a GLX pixmap. + See the xdemos/glxpixmap.c file for an example of how to use this + extension. + + GLX_MESA_release_buffers + + Mesa associates a set of ancillary (depth, accumulation, stencil and + alpha) buffers with each X window it draws into. These ancillary + buffers are allocated for each X window the first time the X window + is passed to glXMakeCurrent(). Mesa, however, can't detect when an + X window has been destroyed in order to free the ancillary buffers. + + The best it can do is to check for recently destroyed windows whenever + the client calls the glXCreateContext() or glXDestroyContext() + functions. This may not be sufficient in all situations though. + + The GLX_MESA_release_buffers extension allows a client to explicitly + deallocate the ancillary buffers by calling glxReleaseBuffersMESA() + just before an X window is destroyed. For example: + + #ifdef GLX_MESA_release_buffers + glXReleaseBuffersMESA( dpy, window ); + #endif + XDestroyWindow( dpy, window ); + + This extension is new in Mesa 2.0. + + GLX_MESA_copy_sub_buffer + + This extension adds the glXCopySubBufferMESA() function. It works + like glXSwapBuffers() but only copies a sub-region of the window + instead of the whole window. + + This extension is new in Mesa version 2.6 + + + +Summary of X-related environment variables: + MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode (X only) + MESA_CI_VISUAL - specifies the X visual and depth for CI mode (X only) + MESA_BACK_BUFFER - specifies how to implement the back color buffer (X only) + MESA_PRIVATE_CMAP - force aux/tk libraries to use private colormaps (X only) + MESA_GAMMA - gamma correction coefficients (X only) + + +---------------------------------------------------------------------- +README.CYGWIN - lassauge April 2004 - based on README.X11 diff --git a/mesalib/docs/README.D3D b/mesalib/docs/README.D3D new file mode 100644 index 000000000..b41fcb620 --- /dev/null +++ b/mesalib/docs/README.D3D @@ -0,0 +1,124 @@ + + DirectX 6 Driver for Mesa 3.0 + + +This software is distributed under the terms of the GNU Library +General Public License, see the LICENSE file for details. + + + +What do you need ? +------------------ + + - A PC with a DirectX 6 video driver installed. + + - Mesa 3.0 + + - The 3Dfx Glide library 2.3 or later for your OS (the 2.4 works fine). + The Voodoo2 requires the Glide library 2.51. The Glide 3.0 is not + compatible with the Glide 2.x so it doesn't work with the current + version of the driver; + + - Visual C++ 5.0 is only compiler test but others should be ok with + changes to the makefiles (CFLAGS/LFLAGS). + + - DirectX 6 SDK (was a MS download but not sure if still available). + + - SoftIce or another debugger that will get DPF's is nice. + + +Tested on: +---------- + Windows 95 + Windows 98 + Windows NT 5.0 (beta 2) + + +What is able to do ? +-------------------- + + - the driver will try and use DirectX to rasterize the OpenGL primitives + that are sent to the driver. The driver will fall back to SW if the rendering + context is too big. The fallback to SW still uses DirectDraw. If the driver + fails to support and operation (accum, stencil, etc) then it will try and get + Mesa to render it in SW. DirectX 6 features that are unsupported by the + installed DirectX 6 driver will be mapped to some other best fit feature. + + +How to compile: +--------------- + + These instructions assume you have Visual C++ installed. + + You might need to increase you enviroment space. You can do this by + adding the following statement to you config.sys. + + shell=C:\COMMAND.COM C:\ /p /e:8198 + + Next setup you compiler enviroment by running vcvars32.bat in the Visual C++ + 'bin' directoy. + + c:\DevStudio\VC\bin\vcvars32.bat + + Modify the D3D makefile to point at your SDK install. Example has the SDK + installed on my 'f' drive in the root. + + file: \Mesa-3.0\src\makefile.d3d + + SDKROOT=f:\mssdk + + Now you can simply make the project. If you look in the makefile you can see + I have some different targets like 'install'. + + nmake /f makefile.d3d + + +FAQ: +---- + + 1) I don't think the driver is using my DirectX driver. + + This maybe true as the current version will only select the Primary D3D driver + installed. If you 3D card is the secondary (3dfx) then your out of luck for this + release. + + 2) The driver seems like its not HW accelerated. + + If you have a video card with limited memory then you might want to try and + change your destop resolution to a low setting (640x480x16) so that the 3D part + of the card has more resources. Remeber the driver can't make the card better... + + 3) Nothing works. + + Make sure you have a DirectX '6' driver installed. Check you driver docs for this + info or use the SDK info utilities. + The final 'dll' is named opengl32.dll and is either in the same directory as the + OpenGL program or in your system directory (x:\windows\system or x:\winnt\system32). + Check your destop resolution. Most DirectX 6 drivers will only support 16bit and + 32bit color depth. To find out for sure you can check the DirectX Info Viewer in + the SDK. + + + 4) Rendering doesn't look right. + + Sometimes this is because the card doesn't support a feature that that is required. + This is usually due to unsupported alpha functions (test/blend) or texture mapping. + Some cards suffer from too small of an alpha channel. The driver does its best to + fallback on unsupported features. This is not to say the driver may not have a bug(s). + + 5) Textures look bad. + + No mipmapping in this release. + + +Thanks to: +---------- + +Brian Paul + + + + +Leigh McRae (leigh@altsoftware.com) +February 9, 1999 + diff --git a/mesalib/docs/README.DJ b/mesalib/docs/README.DJ new file mode 100644 index 000000000..5f783ac53 --- /dev/null +++ b/mesalib/docs/README.DJ @@ -0,0 +1,275 @@ + Mesa 6.5 DOS/DJGPP Port v1.8 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + + +Description: +~~~~~~~~~~~~ + +Well, guess what... this is the DOS port of Mesa 6.5, for DJGPP fans... Whoa! +The driver uses OSMesa to draw off screen, and then blits the buffer. This is +not terribly efficient, and has some drawbacks, but saves maintenance costs. + + + +Legal: +~~~~~~ + +Mesa copyright applies. + + + +Installation: +~~~~~~~~~~~~~ + +Unzip and type: + + make -f Makefile.DJ [OPTIONS...] + +Available options: + + Environment variables: + CPU optimize for the given processor. + default = pentium + GLIDE path to Glide3 SDK; used with FX. + default = $(TOP)/glide3 + FX=1 build for 3dfx Glide3. Note that this disables + compilation of most DMesa code and requires fxMesa. + As a consequence, you'll need the DJGPP Glide3 + library to build any application. + default = no + X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). + default = no + + Targets: + all: build everything + libgl: build GL + libglu: build GLU + libglut: build GLUT + clean: remove object files + realclean: remove all generated files + + + +Tested on: + Video card: Radeon 9500 + DJGPP: djdev 2.04 + gcc v4.1.0 + make v3.80 + OS: DOS, Win98SE, WinXP (using Videoport driver) + + + +FAQ: +~~~~ + +1. Compilation + + Q) `make' barfs and exits because it cannot find some stupid file. + A) You need LFN support. + A) When compiling for Glide (FX=1), pay attention to Glide path. + + Q) Libraries built OK, but linker complains about `vsnprintf' every time I + compile some demo. + A) Upgrade to DJGPP 2.04. + A) Add `vsnprintf.c' to the CORE_SOURCES in `src/Makefile.DJ' (untested!). + A) Patch `src/mesa/main/imports.c' with the following line: + #define vsnprintf(buf, max, fmt, arg) vsprintf(buf, fmt, arg) + This hack should be safe in 90% of the cases, but if anything goes wrong, + don't come back to me crying. + + Q) `make' complains about DXE3 or something, yet it builds the libraries. + A) DXE3 refers to the DJGPP dynamic modules. You'll need either the latest + DJGPP distro, or download the separate package from my web page. Read the + DXE3 documentation on how to use them. + A) When compiling for Glide (FX=1), make sure `glide3x.dxe' can be found in + LD_LIBRARY_PATH (or top `lib' directory). + +2. Using Mesa for DJGPP + + Q) Every test I tried crashes badly. + A) If you have compiled with SSE and you're running under plain DOS, you + have to disable SSE at run-time. See environment variables below. + + Q) DMesa is so SLOOOW! The Win32 OpenGL performs so much better... + A) Is that a question? If you have a 3dfx Voodoo (any model), you're + lucky (check http://sourceforge.net/projects/glide for the DJGPP port). + If you haven't, sorry; everything is done in software. + + Q) I tried to set refresh rate w/ DMesa, but without success. + A) Refresh rate control works only for VESA 3.0 and the 3dfx driver (in + which case FX_GLIDE_REFRESH will be overwritten if it is defined and + is not 0). + + Q) I made a simple application and it does nothing. It exits right away. Not + even a blank screen. + A) Software drivers (VESA/VGA/NUL) must to be constructed as single-buffered + visuals. However, DMesaSwapBuffers must be called to get any output. + A) Another weird "feature" is that buffer width must be multiple of 8 (I'm a + lazy programmer and I found that the easiest way to keep buffer handling + at peak performance ;-). + + Q) I'm getting a "bad font!" fatal error. + A) Always use GLUT_STROKE_* and GLUT_BITMAP_* constants when dealing with + GLUT fonts. If you're using `glut.dxe', then make sure GLUT_STROKE_* and + GLUT_BITMAP_* are mapped to integer constants, not to the actual font + address (same mechanism used for Win32 _DLL). + + Q) What is NUL driver good for, if I don't get any output at all? + A) For debugging. The NUL driver is very much like OSMesa. Everything is + done just the same as VESA/VGA drivers, only it doesn't touch your video + hardware. You can query the actual buffer by issuing: + DMesaGetIntegerv(DMESA_GET_BUFFER_ADDR, &buffer); + and dump it to a file. + + Q) How do I query for a list of available video modes to choose as a visual? + A) This is an ugly hack, for which I'm sure I'll burn in hell. + First, query for a list of modes: + n = DMesaGetIntegerv(DMESA_GET_VIDEO_MODES, NULL); + If `n' is strictly positive, you allocate an array of pointers to a given + struct (which is guaranteed to be extended only - not changed in future): + struct { + int xres, yres; + int bpp; + } **l = malloc(n * sizeof(void *)); + Now pass the newly allocated buffer to fill in: + DMesaGetIntegerv(DMESA_GET_VIDEO_MODES, (GLint *)l); + And collect the info: + for (i = 0; i < n; i++) { + printf("%dx%d:%d\n", l[i]->xres, l[i]->yres, l[i]->bpp); + } + + Q) The GLUT is incomplete. + A) See below. + + + +libGLUT (the toolkit): +~~~~~~~~~~~~~~~~~~~~~~ + +Well, this "skeletal" GLUT implementation was taken from AllegGL project and +heavily changed. Thanks should go to Bernhard Tschirren, Mark Kilgard, Brian +Paul and probably others (or probably not ;-). GLUT functionality will be +extended only on an "as needed" basis. + +GLUT talks to hardware via PC_HW package which was put together from various +pieces I wrote long time ago. It consists from the keyboard, mouse and timer +drivers. + +My keyboard driver used only scancodes; as GLUT requires ASCII values for keys, +I borrowed the translation tables (and maybe more) from Allegro -- many thanks +to Shawn Hargreaves et co. Ctrl-Alt-Del (plus Ctrl-Alt-End, for Windows users) +will shut down the GLUT engine unconditionally: it will raise SIGINT, which in +turn will (hopefully) call the destructors, thus cleaning up your/my mess ;-) +NB: since the DJGPP guys ensured signal handlers won't go beyond program's +space (and since dynamic modules shall) the SIGINT can't be hooked (well, it +can, but it is useless), therefore you must live with the 'Exiting due to +signal SIGINT' message... + +The mouse driver is far from complete (lack of drawing, etc), but is enough to +make almost all the demos work. Supports the CuteMouse WheelAPI. + +The timer is pretty versatile for it supports multiple timers with different +frequencies. While not being the most accurate timer in the known universe, I +think it's OK. Take this example: you have timer A with a very high rate, and +then you have timer B with very low rate compared to A; now, A ticks OK, but +timer B will probably loose precision! + +As an addition, stdout and stderr are redirected and dumped upon exit. This +means that `printf' can be safely called during graphics. A bit of a hack, I +know, because all messages come in bulk, but I think it's better than nothing. +"Borrowed" from LIBRHUTI (Robert Hoehne). + +Window creating defaults: (0, 0, 300, 300), 16bpp. However, the video mode is +chosen in such a way that first window will fit. If you need high resolution +with small windows, set initial position far to the right (or way down); then +you can move them back to any position right before the main loop. + + + +Environment variables: +~~~~~~~~~~~~~~~~~~~~~~ + DMESA_NULDRV - (any value) force NUL driver + GLUT_FPS - print frames/second statistics to stderr + MESA_NO_SSE - (any value) safe option under pure DOS + DMESA_GLUT_REFRESH - set vertical screen refresh rate (VESA3) + DMESA_GLUT_BPP - set default bits per pixel (VGA needs 8) + DMESA_GLUT_ALPHA - set default alpha bits (8) + DMESA_GLUT_DEPTH - set default depth bits (16) + DMESA_GLUT_STENCIL - set default stencil bits (8) + DMESA_GLUT_ACCUM - set default accum bits (16) + + + +History: +~~~~~~~~ + +v1.0 (mar-2002) + initial release + +v1.1 (sep-2002) + + added 3dfx Glide3 support + + added refresh rate control + + added fonts in GLUT + * lots of minor changes + +v1.2 (nov-2002) + * synced w/ Mesa-4.1 + - removed dmesadxe.h + +v1.3 (mar-2003) + + enabled OpenGL 1.4 support + + added MMX clear/blit routines + + enabled SGI's GLU compilation + + added samples makefile + + added new GLUT functions + + added color-index modes + + added Matrox Millennium MGA2064W driver + + added 8bit FakeColor (thanks to Neil Funk) + + added VGA support (to keep Ben Decker happy) + ! fixed some compilation errors (reported by Chan Kar Heng) + * optimized driver for faster callback access... yeah, right :) + * overhauled virtual buffer and internal video drivers + * better fxMesa integration + * revamped GLUT + * switched to DXE3 + +v1.4 (dec-2003) + + enabled GLUT fonts with DXE + + truly added multi-window support in GLUT (for Adrian Woodward) + * accomodated makefiles with the new sourcetree + * fixed some ALPHA issues + * minor changes to PC_HW/timer interface + x hacked and slashed the 3dfx driver (w/ help from Hiroshi Morii) + +v1.5 (jan-2004) + + added interface to query available "visuals" (GLFW - Marcus Geelnard) + + added GLUT timer callback + - removed Matrox Millennium MGA2064W driver + x more changes to the 3dfx driver + +v1.6 (aug-2004) + + implemented NUL driver + + added DMesaGetProcAddress and glutGetProcAddress + * reorganized fxMesa wrapper to handle multiple contexts + ! fixed a horrible bug in VGA initialization routine + ! fixed partial clears + +v1.7 (???-2005) + + enabled OpenGL 2.0 support + + added support for sw texture compression + + added FreeGLUT specific functions + * no more GLX sources in DOS GLUT + * made GLUT timer callbacks less accurate but safer + +v1.8 (apr-2006) + * killed lots of code, the driver is now a front-end to OSMesa + * fixed problem with WinNT (http://www.volny.cz/martin.sulak/) + - removed 3dfx Glide3 support (temporarily?) + + + +Contact: +~~~~~~~~ + +Name: Daniel Borca +E-mail: dborca@users.sourceforge.net +WWW: http://www.geocities.com/dborca/ diff --git a/mesalib/docs/README.GGI b/mesalib/docs/README.GGI new file mode 100644 index 000000000..ddb67725f --- /dev/null +++ b/mesalib/docs/README.GGI @@ -0,0 +1,26 @@ +GGIMesa for LibGGI 2.x + +Requirements: +------------- +LibGGI 2.0 or greater + +Installation: +------------- +To install GGIMesa, follow the instructions in INSTALL.GNU. If you +wish to install GGIGLUT as well, first install GGIMesa and then run + +make +make install (must be root) + +in ggi/ggiglut. + +Notes: +------ + +* Set the environment variables GGIMESA_DEBUG and/or GGIGLUT_DEBUG +to 255 to see lots of debugging output. + +* GGIGLUT contains support for all of the GLUT 3.6 API except for the +high-level primitive drawing functions, but many of the functions (in +particular the menu drawing functions) are just stubs. + diff --git a/mesalib/docs/README.LYNXOS b/mesalib/docs/README.LYNXOS new file mode 100644 index 000000000..e3ab9804b --- /dev/null +++ b/mesalib/docs/README.LYNXOS @@ -0,0 +1,64 @@ + +Mesa 3.0 for LynxOS builds in the following way: + +make lynxos + +This will build all the libraries and demo applications. You should have +around 400 megabytes free for everything since everything is done with +static +libraries. + +Before using this make file however, you should perform the following +actions: +0) cd to the Mesa-3.0 directory +1) Copy the GL directory under the include directory to /usr/include. +2) Copy the files in the lib directory to /lib. +3) Make links so that the Mesa libraries look like ordinary OpenGL +libraries +in /lib. This is important for compatibility with other OpenGL apps. This +is done as follows: + +cd /lib +ln -s libMesaGL.a libGL.a +ln -s libMesaGLU.a libGLU.a + +Mesa 3.0 includes the GLUT (GL Utility Toolkit) by default. +The demo applications are done using this toolkit. + +Mesa makefiles for building their apps could be used as well, but the +following one is much more concise. Note that the order of the X libraries +is important to the linker so that all symbols get resolved correctly. +Changing the order may result in having to list a library twice to make +sure all linkages are made correctly. + +----cut here for Makefile ----- + +FILES = your_app.x + +SPECIAL_INCLUDES = -I/usr/include/GL + +SPECIAL_CFLAGS = -g -ansi -pedantic -funroll-loops -ffast-math -DSHM + +SPECIAL_LIBS = -lglut -lGLU -lGL -lm -L/usr/X11/lib -lXext -lXmu -lXi \ +-lX11 -lbsd -g + +STANDARD_OFILES = $(FILES:.x=.o) + +%.o: %.c + gcc -c $(SPECIAL_CFLAGS) $(SPECIAL_INCLUDES) $< -o $@ + +all: $(STANDARD_OFILES) + gcc -o your_app $(STANDARD_OFILES) $(SPECIAL_LIBS) + + +----cut here for Makefile----- + +I have tested Mesa under LynxOS 3.0 and 3.01. It should build fine under +other +versions as well. Note, however, that LynxOS versions prior to 3.0 are not +binary compatible, so you will have to rebuild from source. + + +Vik Sohal +vik@lynx.com +January 13, 1999 diff --git a/mesalib/docs/README.MINGW32 b/mesalib/docs/README.MINGW32 new file mode 100644 index 000000000..9477b2bd3 --- /dev/null +++ b/mesalib/docs/README.MINGW32 @@ -0,0 +1,153 @@ + Mesa 6.1 for MinGW32 + ~~~~~~~~~~~~~~~~~~~~ + + + +Quick & dirty start: +-------------------- + + mingw32-make -f Makefile.mgw [OPTIONS...] + + Look into the corresponding makefiles for further information. + Check README.3DFX to find out how to compile Mesa Glide3 driver + with MinGW32! + + + +******************************************************************************* +The Mingw port for Mesa 3-D Graphics Library was created August 30, 1998 by Paul Garceau. + +Updated January 13, 2000; June 3, 2005 -- Paul Garceau + +DISCLAIMER: I make this port of the Mesa 3-D Graphics Library as a service +to the general public. I can, in no way support or make any guarantee that the +build will work for your system. + +Acknowledgements: + + Daniel Borca, whose work and commitment to maintaining the Mingw port of the Mesa 3-D Graphics Library has been, and will continue to be greatly appreciated by an overworked and underpaid developer such as myself. + Without the creative inspiration and personal commitment provided by Mumit Khan, Jan-Jaap Vanderhagen and Colin Peters, Mingw would never have existed. Acknowledgements also need to be given to all of the developers who have worked on Mingw, Mesa and Msys over the years. + Last, but certainly far from the least, Brian Paul, who has dedicated at least the last seven or eight years of his life to making Mesa 3-D Graphics Library what it is today and managing the development for all of those years. +********************************************************************************* + +Greetings, + + Feel free to modify or change things related to the Mingw build as you see fit, just remember that, the author of the current build may not be able to support any modifications you might want to make to the files which have been included for the build. + +Mesa core components are licensed under XFree-86 (for more on licensing of Mesa 3-D Graphics Library, check out the Mesa homepage (http://www.mesa3d.org). + +The Mingw generated libraries themselves are licensed under the GNU-LGPL license. Source code for Mingw can be found at http://www.mingw.org. For licensing terms on Mingw, please visit http://www.mingw.org. + + It is recommended that you use the latest "stable" release of Mingw. "Candidates" are beta testing distributions for Mingw. Mingw is available at http://www.mingw.org. + + This build has been tested under WinNT4/SP6. Win9x and WinNT5 remain untested by me. I have not tested any of the demos included with Mesa3d. + +Installation: + + This readme assumes that you already have extracted the necessary files to a working directory/folder that Mingw can use to build the Mesa3D libraries and that you know where that directory/folder is located on your Windows system. If you have any questions about how to set things up properly which is specific to Mesa3D, the folks on the Mesa3D mailing lists (http://www.mesa3d.org) would probably be happy to assist you. Also you can probably ask anyone on the Mingw mailing lists for any questions specific to Mingw (http://www.mingw.org) + +Targets and Environment variables used for Mingw build: + + Before going into the actual build of the libraries, here is a list of available targets for the make process: + + "all" or "libgl" -- this target will build libopengl.a, a static library. It will not build the demos, etc. + + clean -- this target will clean up most of the Mesa 3-D Graphics Library/object code from your hard drive. + + realclean -- this target will clean up all of the Mesa 3D Graphics Library and the Mesa object code that it can find. + + Environment Variables: + + The environment variables are used to determine what sort of graphics driver support needs to be included in the finished Mesa 3-D Graphics Library. + + GLIDE path to Glide3 SDK; used with FX. + default = $(TOP)/glide3 + FX=1 build for 3dfx Glide3. Note that this disables + compilation of most WMesa code and requires fxMesa. + As a consequence, you'll need the Win32 Glide3 + library to build any application. + default = no + ICD=1 build the installable client driver interface + (windows opengl driver interface) + default = no + X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). + default = no + + +Running the Build: + + Launch Mingw. + From the Windows Command Prompt: + Set Environment Variables (as needed). + "cd" to your Mesa3D 'root' directory. + Enter "mingw32-make -f makefile.mgw + + That's all there is to it. + + Enjoy! + + Paul G. + Daniel Borca + + + +******This section is added by Heromyth ************* + +==================== +Updated on 2007-7-21 +==================== + +Notice: + 1) The generated DLLs are *not* compatible with the ones built +with the other compilers like VC8, especially for GLUT. + + 2) Although more tests are needed, it can be used individually! + + 3) You can set the options about whether using STDCALL to build MESA. The +config file is \configs\config.mgw. The default setting is that: + ALL_USING_STDCALL = 1 +, which means using STDCALL to build MESA. + + 4) Of course, you can MESA without using STDCALL,I like this:) +The setting is : + ALL_USING_STDCALL = 0 +To do this, however, you must modify wingdi.h which is in MingW's include dir. +For example, run: + notepad C:\MingW\include\wingdi.h +, and delete all the lines where all the wgl*() functions are. Because they would +be conflicted with the ones in \include\GL\mesa_wgl.h. + +>>>>>>>>>> Conflicted Functions List >>>>>>>>>> +WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT); +WINGDIAPI HGLRC WINAPI wglCreateContext(HDC); +WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int); +WINGDIAPI BOOL WINAPI wglDeleteContext(HGLRC); +WINGDIAPI BOOL WINAPI wglDescribeLayerPlane(HDC,int,int,UINT,LPLAYERPLANEDESCRIPTOR); +WINGDIAPI HGLRC WINAPI wglGetCurrentContext(void); +WINGDIAPI HDC WINAPI wglGetCurrentDC(void); +WINGDIAPI int WINAPI wglGetLayerPaletteEntries(HDC,int,int,int,COLORREF*); +WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR); +WINGDIAPI BOOL WINAPI wglMakeCurrent(HDC,HGLRC); +WINGDIAPI BOOL WINAPI wglRealizeLayerPalette(HDC,int,BOOL); +WINGDIAPI int WINAPI wglSetLayerPaletteEntries(HDC,int,int,int,const COLORREF*); +WINGDIAPI BOOL WINAPI wglShareLists(HGLRC,HGLRC); +WINGDIAPI BOOL WINAPI wglSwapLayerBuffers(HDC,UINT); +WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC,DWORD,DWORD,DWORD); +WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD); +WINGDIAPI BOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); +WINGDIAPI BOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); +<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + +==================== +Updated on 2007-7-22 +==================== + I havn't thought that I would find a better way to solve my problems so soon. +I changed the method in which the import-libs and DLLs are made. After this update, +the DLLs of MESA are more optimized and more compatible. + It seems that there is no need to keep the building way of 'NO-STDCALL'.The +way of USING_STDCALL is so nice! The file \configs\config.mgw is +also not needed, and can be deleted safely! + + + +********************************************************************************* \ No newline at end of file diff --git a/mesalib/docs/README.MITS b/mesalib/docs/README.MITS new file mode 100644 index 000000000..a89176a62 --- /dev/null +++ b/mesalib/docs/README.MITS @@ -0,0 +1,102 @@ + + Mesa 3.0 MITS Information + + +This software is distributed under the terms of the GNU Library +General Public License, see the LICENSE file for details. + + +This document is a preliminary introduction to help you get +started. For more detaile information consult the web page. + +http://10-dencies.zkm.de/~mesa/ + + + +Version 0.1 (Yes it's very alpha code so be warned!) +Contributors: + Emil Briggs (briggs@bucky.physics.ncsu.edu) + David Bucciarelli (tech.hmw@plus.it) + Andreas Schiffler (schiffler@zkm.de) + + + +1. Requirements: + Mesa 3.0. + An SMP capable machine running Linux 2.x + libpthread installed on your machine. + + +2. What does MITS stand for? + MITS stands for Mesa Internal Threading System. By adding + internal threading to Mesa it should be possible to improve + performance of OpenGL applications on SMP machines. + + +3. Do applications have to be recoded to take advantage of MITS? + No. The threading is internal to Mesa and transparent to + applications. + + +4. Will all applications benefit from the current implementation of MITS? + No. This implementation splits the processing of the vertex buffer + over two threads. There is a certain amount of overhead involved + with the thread synchronization and if there is not enough work + to be done the extra overhead outweighs any speedup from using + dual processors. You will not for example see any speedup when + running Quake because it uses GL_POLYGON and there is only one + polygon for each vertex buffer processed. Test results on a + dual 200 Mhz. Pentium Pro system show that one needs around + 100-200 vertices in the vertex buffer before any there is any + appreciable benefit from the threading. + + +5. Are there any parameters that I can tune to try to improve performance. + Yes. You can try to vary the size of the vertex buffer which is + define in VB_MAX located in the file src/vb.h from your top level + Mesa distribution. The number needs to be a multiple of 12 and + the optimum value will probably depend on the capabilities of + your machine and the particular application you are running. + + +6. Are there any ways I can modify the application to improve its + performance with the MITS? + Yes. Try to use as many vertices between each Begin/End pair + as possbile. This will reduce the thread synchronization + overhead. + + +7. What sort of speedups can I expect? + On some benchmarks performance gains of up to 30% have been + observerd. Others may see no gain at all and in a few rare + cases even some degradation. + + +8. What still needs to be done? + Lots of testing and benchmarking. + A portable implementation that works within the Mesa thread API. + Threading of additional areas of Mesa to improve performance + even more. + + + +Installation: + + 1. This assumes that you already have a working Mesa 3.0 installation + from source. + 2. Place the tarball MITS.tar.gz in your top level Mesa directory. + 3. Unzip it and untar it. It will replace the following files in + your Mesa source tree so back them up if you want to save them. + + + README.MITS + Make-config + Makefile + mklib.glide + src/vbxform.c + src/vb.h + + 4. Rebuild Mesa using the command + + make linux-386-glide-mits + diff --git a/mesalib/docs/README.NeXT b/mesalib/docs/README.NeXT new file mode 100644 index 000000000..1ad9a9e5c --- /dev/null +++ b/mesalib/docs/README.NeXT @@ -0,0 +1,6 @@ +The NeXT support has now been incorporated into the OpenStep support. +You can build NeXT libraries simply by typing "make next", though before +linking they will need to be ranlib'd by hand. For more information see +the README.OpenStep file, together with the README files in OpenStep/Old_Demos. + +-Pete French. (pete@ohm.york.ac.uk) 28/5/1998 diff --git a/mesalib/docs/README.OS2 b/mesalib/docs/README.OS2 new file mode 100644 index 000000000..b3374ea23 --- /dev/null +++ b/mesalib/docs/README.OS2 @@ -0,0 +1,96 @@ + README for port of Mesa 3.x to XFree86 on OS/2 (X/2) + (as of 19990514) + + + Contents: + + 1) Binary release + 2) Building from sources + 3) History + 4) Todo + 5) Mesa Home Page + + +1) Binary release + + Though the Mesa sources should build in a quite reasonable time even on + a 585 class machine a binary relase is available (check topic 4) for an URL) + This package includes: + + - lib/MesaGL.dll, MesaGL.a + - lib/MesaGLU.dll, MesaGLU.a + - lib/glut.dll, glut.a + - include/GL/*.h + + Installing this in your XFree86 tree will enable you to build and + run all applications compatible with Mesa (and the current DLL + interface, of course ;-) + As usual the OMF-style libraries can be created using emxomf. + (e.g. "emxomf foo.a" creates the foo.lib omf-style library). + The static libraries are rarely used and you have to rebuild + Mesa to get them. They're a supported target, so you get + them in a straightforward way (see below). + + The testing of these libraries was limited to the supplied + demos/examples and a quite small number of third-party apps. + No warranty ... as usual ... ;-) + + +2) Instructions to build Mesa 3.x for XFree86/OS2 from sources: + + Except the official Mesa source distribution you need: + - a recent version of XFree86 (3.3.x or above) including + the programming libraries + - EMX 0.9c (0.9d might work, never checked) + - GNU make + - REXX (!) + + The creation of the DLLs as well as of the static libraries + (if you want to have them) is handled in "mklib-emx.cmd", + a small REXX script. Perhaps not the best idea, but this + way it fits best in the scheme used to build libraries + on all platforms in Mesa 3.x. + + To actually build the libraries and demos, check mklib-emx.cmd + and modify it as desired. Then type + make os2-x11 + and wait for completion ;-) + + +3) History + + Initially Darren Abbott (abbott@hiwaay.net) ported Mesa versions 2.x + to XFree86 OS/2. This port might still be available from + http://fly.HiWAAY.net/~abbott/xfree86-os2/xfree86.html + + The current port picked up things during the beta test for 3.0. + No major changes in the source were done. The build mechanism under OS/2 + has been made very similar to other platforms (if you treat mklib-emx.cmd + as a "black box"). + Advantage is that X/2 is now a valid target and all files are + integrated in the official source distribution. + Disadvantage is that this port (i.e. the DLLs' interface itself) is + definitly NOT COMPATIBLE to those of version 2.x. + It's uncertain whether this would be at all possible but since there + a _very_ few those apps it's not worth to find out anyway. + Also some libs (MesaTK, MesaAUX) are withdrawn from the Mesa distribution, + and accordingly from the OS/2 port. + +4) Todo + + By now binary compatiblity is ensured by using the function names + as entry points instead of ordinals. This might cost performance and + is subject to change in future. In addition the supplied X86 assembler + source is not used yet. + +5) Mesa Home Page + + You can get the source code and more information about Mesa from + http://www.mesa3d.org/ + + The OS/2 ports should be available from + http://r350.ee.ntu.edu.tw/~hcchu/os2/ports + +-- +Alexander Mai +st002279@hrzpub.tu-darmstadt.de diff --git a/mesalib/docs/README.OpenStep b/mesalib/docs/README.OpenStep new file mode 100644 index 000000000..a566eca67 --- /dev/null +++ b/mesalib/docs/README.OpenStep @@ -0,0 +1,35 @@ +This is a port of the GL and GLU libraries to NeXT/Apple object +orientated systems. As these systems have their own window handling +systems we simply use the offscreen rendering capability of Mesa +to generate bitmaps which may then be displayed by the application +with a View as required. Example pieces of code may be found in the +OpenStep directory. + +Sadly there are now a proliferation of different system that we need to +support compilation for: The original NextStep system, The OpenStep +system, the Rhapsody/Mac OS X system and also the windows implementations +of the latter two systems. This version of the code has been compiled and +tested under the following architectures: + + NextStep 3.3 + OpenStep 4.2 + Rhapsody DR2 + WebObjects for NT 3.5 + WebObjects for NT 4.0 + +All tests were done with Intel processors. Feedback on other systems would, +however, be appreciated ! + +On UNIX systems simply type "make openstep". Under Windows systems +with WebObjects run the "win32-openstep.sh" script from within the Bourne +shell provided with the development environment. In both cases this will +build the libraries and place them into the "lib" directory. Some examples +may be found in the OpenStep directory showing how to use the code in an +actual application (MesaView) as well as some command line demos. + +The CC variable may be specified on the command line for doing such things +as building FFAT libraries or using alternative compilers to the standard 'cc' +e.g. make CC='cc -arch m68k -arch i386' openstep" will build the libraries +with both intel and motorola architectures. + +-Pete French. (pete@ohm.york.ac.uk) 7/6/1999 diff --git a/mesalib/docs/README.QUAKE b/mesalib/docs/README.QUAKE new file mode 100644 index 000000000..e90c76a08 --- /dev/null +++ b/mesalib/docs/README.QUAKE @@ -0,0 +1,207 @@ + + Info on using Mesa 3.0 with Linux Quake I and Quake II + + + +Disclaimer +---------- + +I am _not_ a Quake expert by any means. I pretty much only run it to +test Mesa. There have been a lot of questions about Linux Quake and +Mesa so I'm trying to provide some useful info here. If this file +doesn't help you then you should look elsewhere for help. The Mesa +mailing list or the news://news.3dfx.com/3dfx.linux.glide newsgroup +might be good. + +Again, all the information I have is in this file. Please don't email +me with questions. + +If you have information to contribute to this file please send it to +me at brianp@elastic.avid.com + + + +Linux Quake +----------- + +You can get Linux Quake from http://www.idsoftware.com/ + +Quake I and II for Linux were tested with, and include, Mesa 2.6. You +shouldn't have too many problems if you simply follow the instructions +in the Quake distribution. + + + +RedHat 5.0 Linux problems +------------------------- + +RedHat Linux 5.x uses the GNU C library ("glibc" or "libc6") whereas +previous RedHat and other Linux distributions use "libc5" for its +runtime C library. + +Linux Quake I and II were compiled for libc5. If you compile Mesa +on a RedHat 5.x system the resulting libMesaGL.so file will not work +with Linux Quake because of the different C runtime libraries. +The symptom of this is a segmentation fault soon after starting Quake. + +If you want to use a newer version of Mesa (like 3.x) with Quake on +RedHat 5.x then read on. + +The solution to the C library problem is to force Mesa to use libc5. +libc5 is in /usr/i486-linux-libc5/lib on RedHat 5.x systems. + +Emil Briggs (briggs@tick.physics.ncsu.edu) nicely gave me the following +info: + +> I only know what works on a RedHat 5.0 distribution. RH5 includes +> a full set of libraries for both libc5 and glibc. The loader ld.so +> uses the libc5 libraries in /usr/i486-linux-libc5/lib for programs +> linked against libc5 while it uses the glibc libraries in /lib and +> /usr/lib for programs linked against glibc. +> +> Anyway I changed line 41 of mklib.glide to +> GLIDELIBS="-L/usr/local/glide/lib -lglide2x -L/usr/i486-linux-libc5/lib" +> +> And I started quake2 up with a script like this +> #!/bin/csh +> setenv LD_LIBRARY_PATH /usr/i486-linux-libc5/lib +> setenv MESA_GLX_FX f +> ./quake2 +set vid_ref gl +> kbd_mode -a +> reset + + +I've already patched the mklib.glide file. You'll have to start Quake +with the script shown above though. + + + +********************** + +Daryll Strauss writes: + +Here's my thoughts on the problem. On a RH 5.x system, you can NOT build +a libc5 executable or library. Red Hat just doesn't include the right +stuff to do it. + +Since Quake is a libc5 based application, you are in trouble. You need +libc5 libraries. + +What can you do about it? Well there's a package called gcc5 that does +MOST of the right stuff to compile with libc5. (It brings back older +header files, makes appropriate symbolic links for libraries, and sets +up the compiler to use the correct directories) You can find gcc5 here: +ftp://ecg.mit.edu/pub/linux/gcc5-1.0-1.i386.rpm + +No, this isn't quite enough. There are still a few tricks to getting +Mesa to compile as a libc5 application. First you have to make sure that +every compile uses gcc5 instead of gcc. Second, in some cases the link +line actually lists -L/usr/lib which breaks gcc5 (because it forces you +to use the glibc version of things) + +If you get all the stuff correctly compiled with gcc5 it should work. +I've run Mesa 3.0B6 and its demos in a window with my Rush on a Red Hat +5.1 system. It is a big hassle, but it can be done. I've only made Quake +segfault, but I think that's from my libRush using the wrong libc. + +Yes, mixing libc5 and glibc is a major pain. I've been working to get +all my libraries compiling correctly with this setup. Someone should +make an RPM out of it and feed changes back to Brian once they get it +all working. If no one else has done so by the time I get the rest of my +stuff straightened out, I'll try to do it myself. + + - |Daryll + + + +********************* + +David Bucciarelli (tech.hmw@plus.it) writes: + +I'm using the Mesa-3.0beta7 and the RedHat 5.1 and QuakeII is +working fine for me. I had only to make a small change to the +Mesa-3.0/mklib.glide file, from: + + + GLIDELIBS="-L/usr/local/glide/lib -lglide2x +-L/usr/i486-linux-libc5/lib -lm" + +to: + + GLIDELIBS="-L/usr/i486-linux-libc5/lib -lglide2x" + +and to make two symbolic links: + +[david@localhost Mesa]$ ln -s libMesaGL.so libMesaGL.so.2 +[david@localhost Mesa]$ ln -s libMesaGLU.so libMesaGLU.so.2 + +I'm using the Daryll's Linux glide rpm for the Voodoo2 and glibc (it +includes also the Glide for the libc5). I'm not using the /dev/3Dfx and +running QuakeII as root with the following env. var: + +export +LD_LIBRARY_PATH=/dsk1/home/david/src/gl/Mesa/lib:/usr/i486-linux-libc5/lib + +I think that all problems are related to the glibc, Quake will never +work if you get the following output: + +[david@localhost Mesa]$ ldd lib/libMesaGL.so + libglide2x.so => /usr/lib/libglide2x.so (0x400f8000) + libm.so.6 => /lib/libm.so.6 (0x40244000) + libc.so.6 => /lib/libc.so.6 (0x4025d000) + /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000) + +You must get the following outputs: + +[david@localhost Mesa]# ldd lib/libMesaGL.so + libglide2x.so => /usr/i486-linux-libc5/lib/libglide2x.so +(0x400f3000) + +[root@localhost quake2]# ldd quake2 + libdl.so.1 => /lib/libdl.so.1 (0x40005000) + libm.so.5 => /usr/i486-linux-libc5/lib/libm.so.5 (0x40008000) + libc.so.5 => /usr/i486-linux-libc5/lib/libc.so.5 (0x40010000) + +[root@localhost quake2]# ldd ref_gl.so + libMesaGL.so.2 => +/dsk1/home/david/src/gl/Mesa/lib/libMesaGL.so.2 (0x400eb000) + libglide2x.so => /usr/i486-linux-libc5/lib/libglide2x.so +(0x401d9000) + libX11.so.6 => /usr/i486-linux-libc5/lib/libX11.so.6 +(0x40324000) + libXext.so.6 => /usr/i486-linux-libc5/lib/libXext.so.6 +(0x403b7000) + libvga.so.1 => /usr/i486-linux-libc5/lib/libvga.so.1 +(0x403c1000) + libm.so.5 => /usr/i486-linux-libc5/lib/libm.so.5 (0x403f5000) + libc.so.5 => /usr/i486-linux-libc5/lib/libc.so.5 (0x403fd000) + + +*********************** + +Steve Davies (steve@one47.demon.co.uk) writes: + + +Try using: + + export LD_LIBRARY_PATH=/usr/i486-linux-libc5/lib + ./quake2 +set vid_ref gl + +to start the game... Works for me, but assumes that you have the +compatability libc5 RPMs installed. + + +*************************** + +WWW resources - you may find additional Linux Quake help at these URLs: + + +http://quake.medina.net/howto + +http://webpages.mr.net/bobz + +http://www.linuxgames.com/quake2/ + + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/README.THREADS b/mesalib/docs/README.THREADS new file mode 100644 index 000000000..fb6e0ff3d --- /dev/null +++ b/mesalib/docs/README.THREADS @@ -0,0 +1,52 @@ + + +Mesa Threads README +------------------- + +Thread safety was introduced in Mesa 2.6 by John Stone and +Christoph Poliwoda. + +It was redesigned in Mesa 3.3 so that thread safety is +supported by default (on systems which support threads, +that is). There is no measurable penalty on single +threaded applications. + +NOTE that the only _driver_ which is thread safe at this time +is the OS/Mesa driver! + + +At present the mthreads code supports three thread APIS: + 1) POSIX threads (aka pthreads). + 2) Solaris / Unix International threads. + 3) Win32 threads (Win 95/NT). + +Support for other thread libraries can be added src/glthread.[ch] + + +In order to guarantee proper operation, it is +necessary for both Mesa and application code to use the same threads API. +So, if your application uses Sun's thread API, then you should build Mesa +using one of the targets for Sun threads. + +The mtdemos directory contains some example programs which use +multiple threads to render to osmesa rendering context(s). + +Linux users should be aware that there exist many different POSIX +threads packages. The best solution is the linuxthreads package +(http://pauillac.inria.fr/~xleroy/linuxthreads/) as this package is the +only one that really supports multiprocessor machines (AFAIK). See +http://pauillac.inria.fr/~xleroy/linuxthreads/README for further +information about the usage of linuxthreads. + +If you are interested in helping with thread safety work in Mesa +join the Mesa developers mailing list and post your proposal. + + +Regards, + John Stone -- j.stone@acm.org johns@cs.umr.edu + Christoph Poliwoda -- poliwoda@volumegraphics.com + + +Version info: + Mesa 2.6 - initial thread support. + Mesa 3.3 - thread support mostly rewritten (Brian Paul) diff --git a/mesalib/docs/README.VMS b/mesalib/docs/README.VMS new file mode 100644 index 000000000..6b02909d5 --- /dev/null +++ b/mesalib/docs/README.VMS @@ -0,0 +1,38 @@ + +VMS support contributed by Jouk Jansen (joukj@hrem.stm.tudelft.nl) + + +The latest version was tested on a VMSAlpha7.2 system using DECC6.0, but +probably also works for other versions. + +At the moment only the libraries LIBMESGL.EXE/LIBMESGL.OLB, +LIBMESAGLU.EXE/LIBMESAGLU.OLB and LIBGLUT.EXE/LIBGLUT.OLB and the demos of the +directory [.DEMOS] can be build. +However, feel free to create the missing "decrip.mms-files" in the other +directories. + + The make files were tested +using the DIGITAL make utility called MMS. There is also a public domain +clone available (MMK) and I think, but it is not tested, that this +utility will give (hardly) any problem. + +To make everything just type MMS (or MMK) in the main directory of +mesagl. For MMS the deafult makefile is called descrip.mms, and +that is what I have called it. I included alse some config files, +all having mms somewhere in the name which all the makefiles need +(just as your unix makefiles). + +On Alpha platforms at default a sharable images for the libraries are created. +To get a static library make it by typing MMS/MACRO=(NOSHARE=1). +On VAX platforms only static libraries can be build. + +23-sep-2005 +changed default compilation to use /float=ieee/ieee=denorm. The reason for +this is that it makes Mesa on OpenVMS better compatible with other platforms +and other packages for VMS that I maintain. +For more information see + http://nchrem.tnw.tudelft.nl/openvms + https://bugs.freedesktop.org/show_bug.cgi?id=4270 +You may want to compile Mesa to use VAX-floating point arithmetic, instead +of IEEE floating point by removing the /float=IEEE/denorm flag from the +compiler options in the descrip.mms files. diff --git a/mesalib/docs/README.WIN32 b/mesalib/docs/README.WIN32 new file mode 100644 index 000000000..97e1ffb7a --- /dev/null +++ b/mesalib/docs/README.WIN32 @@ -0,0 +1,163 @@ +File: docs/README.WIN32 + +Last updated: Apr 25, 2007 - Karl Schultz - kschultz@users.sourceforge.net + +Quick Start +----- ----- + +Unzip the MesaLib, MesaGLUT, and MesaDemos ZIP files into the same +directory. The libs and demos build separately, so if you do not care +about the demos or GLUT, you only need to unzip MesaLib. If you unzip +more than one ZIP file, they all need to be unzipped into the same +directory. Don't worry, you will not overwrite anything. + +The Windows build system uses Microsoft Visual Studio. Project files +for a specific version of Visual Studio are in their own directory in +the top-level "windows" directory. For example, Visual Studio 8 files +are in windows/VC8. + +Support has been dropped for versions of Visual Studio prior to 8. The +main reason is because Microsoft now provides a free compiler and +developer environment. Visual Studio Express can be found at + +http://msdn.microsoft.com/vstudio/express/visualc/default.aspx + +You'll also need the Platform SDK. Instructions for obtaining and +using the SDK with Visual Studio Express can be found at + +http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/ + +If you are stuck using VC6 or VC7, you may start with these project +files, but you may need to modify them to reflect changes in the +Mesa source code tree. If you sucessfully update the project files, +please submit them to the author of this document so that they may +be included in the next distribution. + +The project files to build the core Mesa library, Windows Mesa +drivers, OSMesa, and GLU are in the mesa directory. The project files +to build GLUT and some demo programs are in the progs directory. + +Makefiles are no longer shipped or supported, but can be generated +from the projects using Visual Studio. + + +Windows Drivers +------- ------- + +At this time, only the GDI driver is known to work. Most of the demos +in progs/demos should work with this driver. + +Source code also exists in the tree for other drivers in +src/mesa/drivers/windows, but the status of this code is unknown. + +The GDI driver operates basically by writing pixel spans into a DIB +section and then blitting the DIB to the window. The driver was +recently cleaned up and rewitten and so may have bugs or may be +missing some functionality. The older versions of the CVS source may +be useful in figuring out any problems, or report them to me. + +To build Mesa with the GDI driver, build the mesa, gdi, and glu +projects in the Visual Studio workspace found at + + windows/VC8/mesa/mesa.sln + +The osmesa DLL can also be built with the osmesa project. + +The build system creates a lib top-level directory and copies +resulting LIB and DLL files to this lib directory. The files are: + + OPENGL32.LIB, GLU32.LIB, OSMESA32.LIB + OPENGL32.DLL, GLU32.DLL, OSMESA32.DLL + +If the MesaDemos ZIP file was extracted, the DLL files are also copied +to the demos directory. This facilitates running the demos as described +below. + + +GLUT and Demos +---- --- ----- + +A Visual Studio workspace can be found at + + windows/VC8/progs/progs.sln + +It can be used to build GLUT and a few demos. The GLUT lib and DLL +are copied to the top-level lib directory, along with the Mesa libs. + +The demo build system expects to find the LIB files in the top level +lib directory, so you must build the Mesa libs first. The demo +executables are placed in the demos directory, because some of them +rely on data files found there. Also, the Mesa lib DLL's were copied +there by the Mesa lib build process. Therefore, you should be able to +simply run the demo executables from the demo directory. + +If you want to run the demos from the Visual Studio, you may have to +change the startup directory and explicitly state where the executables are. + +You may also build all the demo programs by using a makefile. Go to +the progs/demos directory and make sure you have executed VCVARS32.BAT +or whatever setup script is appropriate for your compiler. Then, + + nmake -f Makefile.win + +should build all the demos. + + +Build System Notes +----- ------ ----- + +VC6 (not actively supported) +--- + +Visual Studio 6 does not recognize files with the .cc extension as C++ +language files, without a lot of unnatural tweaking. So, the VC6 +build process uses custom build steps to compile these files in the +GLU library. + +Two additional configurations are provided, Debug x86 and Release x86 +that activate the shader code compilation by defining SLANG_86. It is +unknown if and how this works. + +VC7 (not actively supported) +--- + +The above-mentioned .cc problem does not exist in this version. + +VC8 +--- + +No notes. + + +General +------- + +After building, you can copy the above DLL files to a place in your +PATH such as $SystemRoot/SYSTEM32. If you don't like putting things +in a system directory, place them in the same directory as the +executable(s). Be careful about accidentially overwriting files of +the same name in the SYSTEM32 directory. + +The DLL files are built so that the external entry points use the +stdcall calling convention. + +Static LIB files are not built. The LIB files that are built with are +the linker import files associated with the DLL files. + +The si-glu sources are used to build the GLU libs. This was done +mainly to get the better tessellator code. + +To build "mangled" Mesa, add the preprocessor define USE_MGL_NAMESPACE +to the project settings. You will also need to edit src/mesa.def to +change all the gl* symbols to mgl*. Because this is easy to do with a +global replace operation in a text editor, no additional mangled +version of mesa.def is maintained or shipped. + +If you have a Windows-related build problem or question, it is +probably better to direct it to me (kschultz@users.sourceforge.net), +rather than directly to the other Mesa developers. I will help you as +much as I can. I also monitor the Mesa mailing lists and will answer +questions in this area there as well. + + +Karl Schultz diff --git a/mesalib/docs/README.WINDML b/mesalib/docs/README.WINDML new file mode 100644 index 000000000..448db71f8 --- /dev/null +++ b/mesalib/docs/README.WINDML @@ -0,0 +1,146 @@ + + WindML Driver for Mesa 4.0 + + +Requirements +------------ + +Tornado 2 + WindML, Cumulative Patchs are recommended. + +I suppose you have a valid WindML installation. Double buffer hardware +gives better performance than double buffer software so if you can +compile your WindML driver with this option, just do it. I/O +redirection is adviced in target server. + + +Tested on +--------- + +During the development, my main target was a CoolMonster: +- Video card: CT69000 +- CPU: PENTIUM 266MHz + +and my host a Windows NT + Tornado 2. + + +Installation +------------ + +1. Mesa sources must be in root directory (C:\) + +2. Add the following line to your torVars.bat: +set MESA_BASE=C:\Mesa + +OR copy the new torVars.bat in your bin path: +c:/Mesa/src/ugl/tornado/torVars.sample -> +/mnt/nt/Tornado/host/x86-win32/bin/torVars (for example) + +3. In a command prompt: +$ torVars +$ cd c:\Mesa +$ make -f Makefile.ugl CPU=PENTIUM + +Take a long while... + +5. Include all the files from ugldemos folder to build some downloadable + application modules + +4. Download UGL/Mesa object files on target + +For example via the WindShell: +ld < c:\Tornado\target\lib\objMesaGL.o +ld < c:\Tornado\target\lib\objMesaUGL.o +ld < c:\Tornado\target\lib\objMesaGLU.o +ld < c:\Tornado\target\lib\objGLUTshapes.o +ld < c:\Tornado\target\lib\objMesaOS.o + +You can put the previous lines in a file and use: +< filename + +6. Download the application modules. + +7. In WindShell, run: +-> uglalldemos + +During the show some messages will appear, it provides some useful +information on key management. + + +Coding +------ + +Sample Usage: + +In addition to the usual ugl calls to initialize UGL, (may be find an +input driver), you must do the following to use the UGL/Mesa interface: + +1. Call uglMesaCreateContext() to create a UGL/Mesa rendering context, + given the display format. + +2. Call uglMesaMakeCurrent() to bind the UGL/Mesa buffers to an + UGL/Mesa Context and to make the context the current one. + +3. Make gl* calls to render your graphics. + +4. Use uglMesaSwapBuffers() when double buffering to swap front/back buffers. + +5. Before the UGL is destroyed, call MesaDestroyContext(). + +6. Before exiting, call if required uglEventQDestroy and then + uglDeinitialize(); + +Limitations +----------- + +I found the following limitations in my driver : + - Color Indexed management is only in 8 bits + - It's possible to mix UGL/OpenGL application with a software + double buffer + +Modifications +------------ + +New files in Mesa: +- Makefile.ugl +- rules.windmlmesa +- docs/README.UGL +- include/GL/uglmesa.h +- si-glu/Makefile.ugl +- src/Makefile.ugl +- src/ugl/torGLUTShapesInit.c +- src/ugl/torMesaUGLInit.c +- src/ugl/ugl_api.c +- src/ugl/ugl_dd.c +- src/ugl/ugl_glutshapes.c +- src/ugl/ugl_line.c +- src/ugl/ugl_span.c +- src/ugl/ugl_tri.c +- src/ugl/uglmesaP.h +- ugldemos/* + +Modified files in Tornado 2.0: +- c:\Tornado\host\x86-win32\bin\torVars.bat +rem Command line build environments +set WIND_HOST_TYPE=x86-win32 +set WIND_BASE=C:\Tornado +set MESA_BASE=C:\Mesa +set PATH=%WIND_BASE%\host\%WIND_HOST_TYPE%\bin;%PATH% +- c:\Tornado\target\config\comps\VxWorks\01uglmesa.cdf +- c:\Tornado\target\h\GL\* + +Todo +---- +- GCC 2.96, ASM compilation + +Thanks to: +---------- + +Precision Insight team for their great job around Mesa, XFree, and DRI. +Wind River Systems to take me as an intern. + + +Stephane Raimbault + + + +July 24, 2001 diff --git a/mesalib/docs/README.directfb b/mesalib/docs/README.directfb new file mode 100644 index 000000000..d66ca8d3c --- /dev/null +++ b/mesalib/docs/README.directfb @@ -0,0 +1,29 @@ + + Mesa DirectFB Information + + +Requirements +============ + + To build Mesa with DirectFB (DirectFBGL) support you need: + - DirectFB at least 1.0.0 (http://directfb.org) + - pkg-config at least 0.9 (http://pkgconfig.sf.net) + + +Installation +============ + Run + + make linux-directfb + + to build Mesa and DirectFBGL module, + + make install + + to install OpenGL libraries and + + cd src/mesa/drivers/directfb ; make install + + to install DirectFBGL module in the proper location. + Actually, that last command may not be needed. Please provide feedback. + diff --git a/mesalib/docs/RELNOTES-3.1 b/mesalib/docs/RELNOTES-3.1 new file mode 100644 index 000000000..65324eb49 --- /dev/null +++ b/mesalib/docs/RELNOTES-3.1 @@ -0,0 +1,145 @@ + + Mesa 3.1 release notes + + PLEASE READ!!!! + + +New copyright +------------- + +Mesa 3.1 will be distributed under an XFree86-style copyright instead +of the GNU LGPL. + + +New directories +--------------- + +All documentation files are now in the docs/ directory. +All shell scripts are now in the bin/ directory. + + +New library names +----------------- + +Formerly, the main Mesa library was named libMesaGL.so (or libMesaGL.a) +and the GLU library was named libMesaGLU.so (or libMesaGLU.a). + +Now, the main library is named libGL.so (or libGL.a) and the GLU library +is named libGLU.so (or libGLU.a). + +The change allows Mesa to be more easily substituted for OpenGL. +Specifically, the linker/loader on some Unix-like systems won't +allow libMesaGL.so to be used instead of libGL.so if the application +was linked with the former. + +Warning: if you have another OpenGL implementation installed on your +system (i.e. you have another OpenGL libGL.so) you'll have to be +carefull about which library (OpenGL or Mesa) you link against. Be +aware of -L linker flags and the value of the LD_LIBRARY_PATH environment +variable. + + +New library versioning +---------------------- + +Previously, the Mesa GL library was named libMesaGL.so.3.0 +To better support Linux/OpenGL standards, the Mesa GL library is now +named libGL.so.1.2.030100 This indicates version 1.2 of the OpenGL spec +and Mesa implementation 3.1.0 + +In the long term this will allow better interoperability with other +OpenGL implementations, especially on Linux. In the short term, +OpenGL apps may have to be relinked to use the new library naming. + + + +New makefiles +------------- + +The old Makefiles found in the various directories have been renamed +to Makefile.X11 in order to prevent filename collisions with autoconfig- +generated Makefiles. + +The top-level Makefile simply includes Makefile.X11 +If your top-level Makefile get's overwritten/destroyed you can restore +it by copying Makefile.X11 to Makefile + + +New extensions +-------------- + +GL_EXT_stencil_wrap + Implements two new stencil operations: GL_INCR_WRAP_EXT and + GL_DECR_WRAP_EXT which allow stencil increment and decrement + without clamping. + +GL_INGR_blend_func_separate + Allows specification of blend factors for RGB and Alpha independently. + (INGR = Intergraph) + +GL_ARB_multitexture + Multiple simultaneous textures. (ARB = Architecture Review Board) + +GL_NV_texgen_reflection + nVidia texgen extension for better reflection mapping. + +GL_PGI_misc_hints + Assorted transformation hints. + +GL_EXT_compiled_vertex_array + Compiled vertex arrays. + +GL_EXT_clip_volume_hint + Allows one to disable clip volume (frustum) testing. + + + +Extensions removed +------------------ + +GL_EXT_multitexture - obsolete in favor of GL_ARB_multitexture + + + +Config file +----------- + +By default, /etc/mesa.conf will be read when Mesa starts. This +file controls default hints, enable/disable of extensions, and +more. See the CONFIG file for documentation. + + + +Optimizations +------------- + +Keith Whitwell has contributed significant optimizations to Mesa's +vertex transformation code. Basically, the whole transformation +stage of Mesa has been rewritten. + +It's impossible to give a speedup factor. You'll just have to +try your app and see how it performs. + + + +Device Driver changes +--------------------- + +A bunch of new device driver functions have been added. See src/dd.h +Keith Harrison contributed many of them. I've been planning on adding +a bunch of functions like these to make writing hardware drivers easier. +More such function will probably be added in the near future. + + + +Miscellaneous +------------- + +util/glstate.c has some handy functions for debugging. Basically, it +offers a simple function for printing GL state variables. It's not +finished yet. There's a LOT more GLenum records to be added (see the +code). Anyone want to help? + + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-3.2 b/mesalib/docs/RELNOTES-3.2 new file mode 100644 index 000000000..ec7d4f8dc --- /dev/null +++ b/mesalib/docs/RELNOTES-3.2 @@ -0,0 +1,11 @@ + + Mesa 3.2 release notes + + PLEASE READ!!!! + + +Mesa 3.2 is a stabilization of the Mesa 3.1 release. No new features +have been added. For a list of bug fixes please read the VERSIONS file. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-3.2.1 b/mesalib/docs/RELNOTES-3.2.1 new file mode 100644 index 000000000..d34efcc86 --- /dev/null +++ b/mesalib/docs/RELNOTES-3.2.1 @@ -0,0 +1,31 @@ + + Mesa 3.2.1 release notes + + PLEASE READ!!!! + + + +The Mesa 3.2.1 release mainly just fixes bugs since the 3.2 release. +See the VERSIONS file for the exact list. + + + +GLU Polygon Tessellator +----------------------- + +The GLU tessellator has been reverted back to the version included +with Mesa 3.0 since it's more stable. The Mesa 3.1/3.2 tessellator +implemented the GLU 1.3 specification but suffered from a number of +bugs. + +Mesa implements GLU 1.1. + +Ideally, people should use the GLU 1.3 library included in SGI's +OpenGL Sample Implementation (SI) available from +http://oss.sgi.com/projects/ogl-sample/ +People are working to make easy-to-install Linux RPMs of the +GLU library. + + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-3.3 b/mesalib/docs/RELNOTES-3.3 new file mode 100644 index 000000000..3850767bb --- /dev/null +++ b/mesalib/docs/RELNOTES-3.3 @@ -0,0 +1,270 @@ + + Mesa 3.3 release notes + + July 21, 2000 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.3) designate new developmental releases. +Even numbered versions (such as 3.2.1) designate stable releases. + +Mesa 3.3 has a undergone many internal changes since version 3.2 +and features a lot of new extensions. 3.3 is expected to be pretty +stable, but perhaps not as stable as 3.2 which has been used by +thousands of users over the past months. + +Everyone is encouraged to try Mesa 3.3. Bugs should be reported to +the Mesa bug database on www.sourceforge.net. + + + +Header file / GLenum changes +---------------------------- + +The gl.h and glu.h headers now use #defines to define all GL_* tokens +instead of C-language enums. This change improves Mesa/OpenGL +interoperability. + + + +New API dispatch code +--------------------- + +The core Mesa gl* functions are now implemented with a new dispatch +(jump table) which will allow simultaneous direct/indirect rendering. + +The code is found in the glapi*.[ch] files. + +Of interest: the actual "glFooBar" functions are generated with +templatized code defined in glapitemp.h and included by glapi.c +The glapitemp.h template should be reusable for all sorts of OpenGL +projects. + +The new dispatch code has also optimized with x86 assembly code. +This optimization eliminates copying the function arguments during +dispatch. + + + +New thread support +------------------ + +Thread support in Mesa has been rewritten. The glthread.[ch] files +replace mthreads.[ch]. Thread safety is always enabled (on platforms +which support threads, that is). There is virtually no performance +penalty for typical single-thread applications. See the glapi.c +file for details. + +The Xlib driver (XMesa) is now thread-safe as well. Be sure to +call XInitThreads() in your app first. See the xdemos/glthreads.c +demo for an example. + + + +Make configuration changes +-------------------------- + +If you use the old-style (non GNU automake) method to build Mesa note +that several of the configuration names have changed: + + Old name New name + ------------- ---------------- + linux-elf linux + linux linux-static + linux-386-elf linux-386 + linux-386 linux-386-static + etc. + + + +New extensions +-------------- + +GL_ARB_transpose_matrix + Adds glLoadTransposeMatrixARB() and glMultTransposeMatrixARB() + functions. + +GL_ARB_texture_cube_map + For cube-based reflection mapping. + +GL_EXT_texture_add_env + Adds GL_ADD texture environment mode. + See http://www.berkelium.com/OpenGL/EXT/texture_env_add.txt + +GL_EXT_texture_lod_bias + Allows mipmapped texture blurring and sharpening. + +GLX_EXT_visual_rating extension + This extension has no effect in stand-alone Mesa (used for DRI). + +GL_HP_occlusion_test + Used for bounding box occlusion testing (see demos/occlude.c). + +GL_SGIX_pixel_texture / GL_SGIS_pixel_texture + Lets glDraw/CopyPixels draw a texture coordinate image. + +GL_SGI_color_matrix + Adds a color matrix and another set of scale and bias parameters + to the glDraw/CopyPixels paths. + +GL_SGI_color_table + Adds additional color tables to the glDraw/Read/CopyPixels paths. + +GL_EXT_histogram + Compute histograms for glDraw/Read/CopyPixels. + +GL_EXT_blend_func_separate + This is the same as GL_INGR_blend_func_separate. + +GL_ARB_texture_cube_mapping + 6-face cube mapping, nicer than sphere mapping + +GL_EXT_texture_env_combine + For advanced texture environment effects. + + +Documentation for all these functions can be found at +http://oss.sgi.com/projects/ogl-sample/registry/ + + + +GLX_SGI_make_current_read functionality +--------------------------------------- + +The functionality of this extension is needed for GLX 1.3 (and required +for the Linux/OpenGL standards base). + +Implementing this function required a **DEVICE DRIVER CHANGE**. +The old SetBuffer() function has been replaced by SetReadBuffer() and +SetDrawBuffer(). All device drivers will have to be updated because +of this change. + +The new function, glXMakeContextCurrent(), in GLX 1.3 now works in Mesa. +The xdemos/wincopy.c program demonstrates it. + + + +Image-related code changes +-------------------------- + +The imaging path code used by glDrawPixels, glTexImage[123]D, +glTexSubImage[123], etc has been rewritten. It's now faster, +uses less memory and has several bug fixes. This work was +actually started in Mesa 3.1 with the glTexImage paths but has now +been carried over to glDrawPixels as well. + + + +Device driver interface changes +------------------------------- + +Added new functions for hardware stencil buffer support: + WriteStencilSpan + ReadStencilSpan + WriteStencilPixels + ReadStencilPixels + + +Removed old depth buffer functions: + AllocDepthBuffer + DepthTestSpan + DepthTestPixels + ReadDepthSpanFloat + ReadDepthSpanInt + + +Added new depth buffer functions: + WriteDepthSpan + ReadDepthSpan + WriteDepthPixels + ReadDepthPixels + + These functions always read/write 32-bit GLuints. This will allow + drivers to have anywhere from 0 to 32-bit Z buffers without + recompiling for 16 vs 32 bits as was previously needed. + + +New texture image functions + The entire interface for texture image specification has been updated. + With the new functions, it's optional for Mesa to keep an internal copy + of all textures. Texture download should be a lot faster when the extra + copy isn't made. + +Misc changes + TexEnv now takes a target argument + Removed UseGlobalTexturePalette (use Enable function instead) + + +Also added + ReadPixels + CopyPixels + + +The SetBufffer function has been replaced by SetDrawBuffer and +SetReadBuffer functions. This lets core Mesa independently +specify which buffer is to be used for reading and which for +drawing. + +The Clear function's mask parameter has changed. Instead of +mask being the flags specified by the user to glClear, the +mask is now a bitmask of the DD_*_BIT flags in dd.h. Now +multiple color buffers can be specified for clearing (ala +glDrawBuffers). The driver's Clear function must also +check the glColorMask glIndexMask, and glStencilMask settings +and do the right thing. See the X/Mesa, OS/Mesa, or FX/Mesa +drivers for examples. + + +The depth buffer changes shouldn't be hard to make for existing +drivers. In fact, it should simply the code. Be careful with +the depthBits value passed to gl_create_context(). 1 is a bad +value! It should normally be 0, 16, 24, or 32. + + +gl_create_framebuffer() takes new arguments which explicitly tell +core Mesa which ancillary buffers (depth, stencil, accum, alpha) +should be implemented in software. Mesa hardware drivers should +carefully set these flags depending on which buffers are in the +graphics card. + + + +Internal constants +------------------ + +Point and line size range and granularity limits are now stored +in the gl_constants struct, which is the Const member of GLcontext. +The limits are initialized from values in config.h but may be +overridden by device drivers to reflect the limits of that driver's +hardware. + +Also added constants for NumAuxBuffers and SubPixelBits. + + + +OpenGL Conformance +------------------ + +Mesa now passes all the OpenGL 1.1 conformance tests, except for +antialiased lines. AA lines fail on some, but not all, the tests. +In order to fix the remaining failures, a new AA line algorithm will +be needed (which computes coverage values for end-point fragments). +This will be done for Mesa 3.5/3.6. + + + +OpenGL 1.2 GL_ARB_imaging subset +-------------------------------- + +Mesa 3.3 implements all the features of GL_ARB_imaging except for +image convolution. This will (hopefully) be done for Mesa 3.5/3.6. + + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-3.4 b/mesalib/docs/RELNOTES-3.4 new file mode 100644 index 000000000..657ccdaab --- /dev/null +++ b/mesalib/docs/RELNOTES-3.4 @@ -0,0 +1,21 @@ + + Mesa 3.4 release notes + + November 3, 2000 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.3) designate new developmental releases. +Even numbered versions (such as 3.4) designate stable releases. + +Mesa 3.4 simply fixes bugs found in the Mesa 3.3 release. For details, +see the VERSIONS file. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-3.4.1 b/mesalib/docs/RELNOTES-3.4.1 new file mode 100644 index 000000000..73d75c64d --- /dev/null +++ b/mesalib/docs/RELNOTES-3.4.1 @@ -0,0 +1,21 @@ + + Mesa 3.4.1 release notes + + February 9, 2001 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.3) designate new developmental releases. +Even numbered versions (such as 3.4) designate stable releases. + +Mesa 3.4.1 is a maintenance release that simply fixes bugs found since +the Mesa 3.4 release. For details, see the VERSIONS file. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-3.4.2 b/mesalib/docs/RELNOTES-3.4.2 new file mode 100644 index 000000000..9caea900d --- /dev/null +++ b/mesalib/docs/RELNOTES-3.4.2 @@ -0,0 +1,21 @@ + + Mesa 3.4.2 release notes + + May 17, 2001 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.3) designate new developmental releases. +Even numbered versions (such as 3.4) designate stable releases. + +Mesa 3.4.2 is a maintenance release that simply fixes bugs found since +the Mesa 3.4.1 release. For details, see the VERSIONS file. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-3.5 b/mesalib/docs/RELNOTES-3.5 new file mode 100644 index 000000000..b2aa1b852 --- /dev/null +++ b/mesalib/docs/RELNOTES-3.5 @@ -0,0 +1,227 @@ + + Mesa 3.5 release notes + + June 21, 2001 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.5) designate new developmental releases. +Even numbered versions (such as 3.4) designate stable releases. + +The biggest change in Mesa 3.5 is a complete overhaul of the source +code in order to make it more modular. This was driven by the DRI +hardware drivers. It simplifies the DRI drivers and opens the door +to hardware transform/clip/lighting (TCL). Keith Whitwell can take +the credit for that. + + + +Driver Support +-------------- + +The device driver interface in Mesa 3.5 has changed a lot since Mesa 3.4 +Not all of the older Mesa drivers have been updated. Here's the status: + +Driver Status +---------------------- ----------- +XMesa (Xlib) updated +OSMesa (off-screen) updated +FX (3dfx Voodoo1/2) updated +SVGA updated +GGI not updated +Windows/Win32 not updated +DOS/DJGPP not updated +BeOS not updated +Allegro not updated +D3D not updated +DOS not updated + +We're looking for volunteers to update the remaining drivers. Please +post to the Mesa3d-dev mailing list if you can help. + + + +GLU 1.3 +------- + +Mesa 3.5 includes the SGI Sample Implementation (SI) GLU library. +This version of GLU supports the GLU 1.3 specification. The old +Mesa GLU library implemented the 1.1 specification. The SI GLU +library should work much better. + +You'll need a C++ compiler to compile the SI GLU library. This may +be a problem on some systems. + + + +New Extensions +-------------- + +GL_EXT_convolution + Adds image convolution to glRead/Copy/DrawPixels/TexImage. + +GL_ARB_imaging + This is the optional imaging subset of OpenGL 1.2. + It's the GL_EXT_convolution, GL_HP_convolution_border_modes, + GL_EXT_histogram, GL_EXT_color_table, GL_EXT_color_subtable + GL_EXT_blend_color, GL_EXT_blend_minmax, GL_EXT_blend_subtract + and GL_SGI_color_matrix extensions all rolled together. + This is supported in all software renderers but not in all + hardware drivers (3dfx for example). + +GL_ARB_texture_compression + This is supported in Mesa but only used by the 3dfx DRI drivers + for Voodoo4 and later. + +GL_ARB_texture_env_add + This is identical to GL_EXT_texture_env_add. + +GL_NV_blend_square + Adds extra blend source and dest factors which allow squaring + of color values. + +GL_EXT_fog_coord + Allows specification of a per-vertex fog coordinate instead of + having fog always computed from the eye distance. + +GL_EXT_secondary_color + Allows specifying the secondary (specular) color for each vertex + instead of getting it only from lighting in GL_SEPARATE_SPECULAR_COLOR + mode. + +GL_ARB_texture_env_combine + Basically the same as GL_EXT_texture_env_combine + +GL_ARB_texture_env_add extension + Texture addition mode. + +GL_ARB_texture_env_dot3 extension + Dot product texture environment. + +GL_ARB_texture_border_clamp + Adds GL_CLAMP_TO_BORDER_ARB texture wrap mode + +GL_SGIX_depth_texture, GL_SGIX_shadow and GL_SGIX_shadow_ambient + Implements a shadow casting algorithm based on depth map textures + +GL_SGIS_generate_mipmap + Automatically generate lower mipmap images whenever the base mipmap + image is changed with glTexImage, glCopyTexImage, etc. + + + +libOSMesa.so +------------ + +libOSMesa.so is a new library which contains the OSMesa interface for +off-screen rendering. Apps which need the OSMesa interface should link +with both -lOSMesa and -lGL. This change was made so that stand-alone +Mesa works the same way as XFree86/DRI's libGL. + + + +Device Driver Changes / Core Mesa Changes +----------------------------------------- + +The ctx->Driver.LogicOp() function has been removed. It used to +be called during state update in order to determine if the driver +could do glLogicOp() operations, and if not, set the SWLogicOpEnabled +flag. Drivers should instead examine the LogicOp state themselves +and choose specialized point, line, and triangle functions appropriately, +or fall back to software rendering. The Xlib driver was the only driver +to use this function. And since the Xlib driver no longer draws +points, lines or triangles using Xlib, the LogicOp function isn't needed. + +The ctx->Driver.Dither() function has been removed. Drivers should +detect dither enable/disable via ctx->Driver.Enable() instead. + +The ctx->Driver.IndexMask() and ctx->Driver.ColorMask() functions +are now just called from glIndexMask and glColorMask like the other +GL state-changing functions. They are no longer called from inside +gl_update_state(). Also, they now return void. The change was made +mostly for sake of uniformity. + +The NEW_DRVSTATE[0123] flags have been removed. They weren't being used +and are obsolete w.r.t. the way state updates are done in DRI drivers. + + +Removed obsolete gl_create_visual() and gl_destroy_visual(). + +Renamed functions (new namespace): + +old new +gl_create_framebuffer _mesa_create_framebuffer +gl_destroy_framebuffer _mesa_destroy_framebuffer +gl_create_context _mesa_create_context +gl_destroy_context _mesa_destroy_context +gl_context_initialize _mesa_context_initialize +gl_copy_context _mesa_copy_context +gl_make_current _mesa_make_current +gl_make_current2 _mesa_make_current2 +gl_get_current_context _mesa_get_current_context +gl_flush_vb _mesa_flush_vb +gl_warning _mesa_warning +gl_compile_error _mesa_compile_error + + +All the drivers have been updated, but not all of them have been +tested since I can't test some platforms (DOS, Windows, Allegro, etc). + + +X/Mesa Driver +------------- + +The source files for the X/Mesa driver in src/X have been renamed. +The xmesa[1234].c files are gone. The new files are xm_api.c, +xm_dd.c, xm_line.c, xm_span.c and xm_tri.c. + + + +Multitexture +------------ + +Eight texture units are now supported by default. + + + +OpenGL SI related changes +------------------------- + +In an effort to make Mesa's internal interfaces more like the OpenGL +SI interfaces, a number of changes have been made: + +1. Importing the SI's glcore.h file which defines a number of +interface structures like __GLimports and __GLexports. + +2. Renamed "struct gl_context" to "struct __GLcontextRec". + +3. Added __glCoreCreateContext() and __glCoreNopDispatch() functions. + +4. The GLcontext member Visual is no longer a pointer. + +5. New file: imports.c to setup default import functions for Mesa. + + + + +16-bit color channels +--------------------- + +There's experimental support for 16-bit color channels (64-bit pixels) +in Mesa 3.5. Only the OSMesa interface can be used for 16-bit rendering. +Type "make linux-osmesa16" in the top-level directory to build the +special libOSMesa16.so library. + +This hasn't been tested very thoroughly yet so please file bug reports +if you have trouble. + +In the future I hope to implement support for 32-bit, floating point +color channels. + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-4.0 b/mesalib/docs/RELNOTES-4.0 new file mode 100644 index 000000000..2f729db15 --- /dev/null +++ b/mesalib/docs/RELNOTES-4.0 @@ -0,0 +1,162 @@ + + Mesa 4.0 release notes + + October 18, 2001 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.3) designate new developmental releases. +Even numbered versions (such as 3.4) designate stable releases. + +Mesa version 4.0 signifies two things: + + 1. A stabilization of the 3.5 development release + 2. Implementation of the OpenGL 1.3 specification + + +Note that the Mesa major version number is incremented with the OpenGL +minor version number: + + Mesa 1.x == OpenGL 1.0 + Mesa 2.x == OpenGL 1.1 + Mesa 3.x == OpenGL 1.2 + Mesa 4.x == OpenGL 1.3 + + + +New Features +------------ + +Mesa 3.5 already had all the new features of OpenGL 1.3, implemented as +extensions. These extensions were simply promoted to standard features: + + GL_ARB_multisample + GL_ARB_multitexture + GL_ARB_texture_border_clamp + GL_ARB_texture_compression + GL_ARB_texture_cube_map + GL_ARB_texture_env_add + GL_ARB_texture_env_combine + GL_ARB_texture_env_dot3 + GL_ARB_transpose_matrix + +In Mesa 4.0 the functions defined by these extensions are now available +without the "ARB" suffix. For example, glLoadTransposeMatrixf() is now +a standard API function. The new functions in OpenGL 1.3 and Mesa 4.0 are: + + glActiveTexture + glClientActiveTexture + glCompressedTexImage1D + glCompressedTexImage2D + glCompressedTexImage3D + glCompressedTexSubImage1D + glCompressedTexSubImage2D + glCompressedTexSubImage3D + glGetCompressedTexImage + glLoadTransposeMatrixd + glLoadTransposeMatrixf + glMultiTexCoord1d + glMultiTexCoord1dv + glMultiTexCoord1f + glMultiTexCoord1fv + glMultiTexCoord1i + glMultiTexCoord1iv + glMultiTexCoord1s + glMultiTexCoord1sv + glMultiTexCoord2d + glMultiTexCoord2dv + glMultiTexCoord2f + glMultiTexCoord2fv + glMultiTexCoord2i + glMultiTexCoord2iv + glMultiTexCoord2s + glMultiTexCoord2sv + glMultiTexCoord3d + glMultiTexCoord3dv + glMultiTexCoord3f + glMultiTexCoord3fv + glMultiTexCoord3i + glMultiTexCoord3iv + glMultiTexCoord3s + glMultiTexCoord3sv + glMultiTexCoord4d + glMultiTexCoord4dv + glMultiTexCoord4f + glMultiTexCoord4fv + glMultiTexCoord4i + glMultiTexCoord4iv + glMultiTexCoord4s + glMultiTexCoord4sv + glMultTransposeMatrixd + glMultTransposeMatrixf + glSampleCoverage + glSamplePass + + +GLX 1.4 is the companion to OpenGL 1.3. The only new features in GLX 1.4 +are support for multisampling and the GLX_ARB_get_proc_address extension. +glXGetProcAddress() is the only new function in GLX 1.4. + + + +Multisample and Texture Compression +----------------------------------- + +The OpenGL 1.3 specification allows the multisample and texture compression +features to essentially be no-ops. For example, if you query for multisample +support you'll find none, but the API functions work. + +Similarly, texture compression is not implemented by any of the software +drivers but you can specify a generic compressed texture format (like +GL_COMPRESSED_RGBA) to glTexImage2D and it'll be accepted. + + + +Device Drivers +-------------- + +Mesa advertises itself as either OpenGL 1.2 or OpenGL 1.3 depending on the +device driver. If the driver enables all the ARB extensions which are part +of OpenGL 1.3 then glGetString(GL_VERSION) will return "1.3". Otherwise, +it'll return "1.2". + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of the drivers. +Here's the current status of all included drivers: + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.3 +OSMesa (off-screen) implements OpenGL 1.3 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.3 +GGI needs updating +DOS/DJGPP needs updating +BeOS needs updating +Allegro needs updating +D3D needs updating +DOS needs updating + +Special thanks go to Karl Schultz for updating the Windows driver. + +The XFree86/DRI drivers have not yet been updated to use Mesa 4.0 as of +September 2001, but that should happen eventually. + + + +Other Changes +------------- + +See the VERSIONS file for more details about bug fixes, etc. in Mesa 4.0. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-4.0.1 b/mesalib/docs/RELNOTES-4.0.1 new file mode 100644 index 000000000..e84df6bf8 --- /dev/null +++ b/mesalib/docs/RELNOTES-4.0.1 @@ -0,0 +1,21 @@ + + Mesa 4.0.1 release notes + + December 17, 2001 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.3) designate new developmental releases. +Even numbered versions (such as 3.4) designate stable releases. + +Mesa 4.0.1 only contains bug fixes since version 4.0. + +See the docs/VERSIONS file for the list of bug fixes. + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-4.0.2 b/mesalib/docs/RELNOTES-4.0.2 new file mode 100644 index 000000000..b476956ba --- /dev/null +++ b/mesalib/docs/RELNOTES-4.0.2 @@ -0,0 +1,49 @@ + + Mesa 4.0.2 release notes + + March 25, 2002 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.3) designate new developmental releases. +Even numbered versions (such as 3.4) designate stable releases. + +Mesa 4.0.2 only contains bug fixes and a new DOS driver since version 4.0.1. + +See the docs/VERSIONS file for the list of bug fixes. + + +Device Drivers +-------------- + +Mesa advertises itself as either OpenGL 1.2 or OpenGL 1.3 depending on the +device driver. If the driver enables all the ARB extensions which are part +of OpenGL 1.3 then glGetString(GL_VERSION) will return "1.3". Otherwise, +it'll return "1.2". + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of the drivers. +Here's the current status of all included drivers: + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.3 +OSMesa (off-screen) implements OpenGL 1.3 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.3 +DOS/DJGPP implements OpenGL 1.3 (new in Mesa 4.0.2) +GGI needs updating +BeOS needs updating +Allegro needs updating +D3D needs updating + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-4.0.3 b/mesalib/docs/RELNOTES-4.0.3 new file mode 100644 index 000000000..0b3e34bef --- /dev/null +++ b/mesalib/docs/RELNOTES-4.0.3 @@ -0,0 +1,51 @@ + + Mesa 4.0.3 release notes + + June 25, 2002 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 3.3) designate new developmental releases. +Even numbered versions (such as 3.4) designate stable releases. + +Mesa 4.0.3 basically just contains bug fixes version 4.0.2. + +See the docs/VERSIONS file for the list of bug fixes. + +The GGI driver has been updated, thanks to Filip Spacek. + + +Device Drivers +-------------- + +Mesa advertises itself as either OpenGL 1.2 or OpenGL 1.3 depending on the +device driver. If the driver enables all the ARB extensions which are part +of OpenGL 1.3 then glGetString(GL_VERSION) will return "1.3". Otherwise, +it'll return "1.2". + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of the drivers. +Here's the current status of all included drivers: + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.3 +OSMesa (off-screen) implements OpenGL 1.3 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.3 +DOS/DJGPP implements OpenGL 1.3 (new in Mesa 4.0.2) +GGI implements OpenGL 1.3 +BeOS needs updating +Allegro needs updating +D3D needs updating + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-4.1 b/mesalib/docs/RELNOTES-4.1 new file mode 100644 index 000000000..24e9299eb --- /dev/null +++ b/mesalib/docs/RELNOTES-4.1 @@ -0,0 +1,307 @@ + + Mesa 4.1 release notes + + October 29, 2002 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Even numbered versions (such as 4.0) designate stable releases. +Odd numbered versions (such as 4.1) designate new developmental releases. + + +New Features in Mesa 4.1 +------------------------ + +New extensions. Docs at http://oss.sgi.com/projects/ogl-sample/registry/ + +GL_NV_vertex_program + + NVIDIA's vertex programming extension + +GL_NV_vertex_program1_1 + + A few features built on top of GL_NV_vertex_program + +GL_ARB_window_pos + + This is the ARB-approved version of GL_MESA_window_pos + +GL_ARB_depth_texture + + This is the ARB-approved version of GL_SGIX_depth_texture. + It allows depth (Z buffer) data to be stored in textures. + This is used by GL_ARB_shadow + +GL_ARB_shadow + + Shadow mapping with depth textures. + This is the ARB-approved version of GL_SGIX_shadow. + +GL_ARB_shadow_ambient + + Allows one to specify the luminance of shadowed pixels. + This is the ARB-approved version of GL_SGIX_shadow_ambient. + +GL_EXT_shadow_funcs + + Extends the set of GL_ARB_shadow texture comparision functions to + include all eight of standard OpenGL dept-test functions. + +GL_ARB_point_parameters + + This is basically the same as GL_EXT_point_parameters. + +GL_ARB_texture_env_crossbar + + Allows any texture combine stage to reference any texture source unit. + +GL_NV_point_sprite + + For rendering points as textured quads. Useful for particle effects. + +GL_NV_texture_rectangle (new in 4.0.4 actually) + + Allows one to use textures with sizes that are not powers of two. + Note that mipmapping and several texture wrap modes are not allowed. + +GL_EXT_multi_draw_arrays + + Allows arrays of vertex arrays to be rendered with one call. + +GL_EXT_stencil_two_side + + Separate stencil modes for front and back-facing polygons. + +GLX_SGIX_fbconfig & GLX_SGIX_pbuffer + + Off-screen rendering support. + +GL_ATI_texture_mirror_once + + Adds two new texture wrap modes: GL_MIRROR_CLAMP_ATI and + GL_MIRROR_CLAMP_TO_EDGE_ATI. + + + +Device Driver Status +-------------------- + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of these drivers. +Here's the current status of all included drivers: + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.3 +OSMesa (off-screen) implements OpenGL 1.3 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.3 +DOS/DJGPP implements OpenGL 1.3 +GGI implements OpenGL 1.3 +BeOS needs updating (underway) +Allegro needs updating +D3D needs updating +DOS needs updating + + + +New features in GLUT +-------------------- + +1. Frames per second printing + + GLUT now looks for an environment variable called "GLUT_FPS". If it's + set, GLUT will print out a frames/second statistic to stderr when + glutSwapBuffers() is called. By default, frames/second is computed + and displayed once every 5 seconds. You can specify a different + interval (in milliseconds) when you set the env var. For example + 'export GLUT_FPS=1000' or 'setenv GLUT_FPS 1000' will set the interval + to one second. + + NOTE: the demo or application must call the glutInit() function for + this to work. Otherwise, the env var will be ignored. + + Finally, this feature may not be reliable in multi-window programs. + + +2. glutGetProcAddress() function + + The new function: + + void *glutGetProcAddress(const char *procName) + + is a wrapper for glXGetProcAddressARB() and wglGetProcAddress(). It + lets you dynamically get the address of an OpenGL function at runtime. + The GLUT_API_VERSION has been bumped to 5, but I haven't bumped the + GLUT version number from 3.7 since that's probably Mark Kilgard's role. + + This function should probably also be able to return the address of + GLUT functions themselves, but it doesn't do that yet. + + + +XXX Things To Do Yet XXXX +------------------------- + +isosurf with vertex program exhibits some missing triangles (probably +when recycling the vertex buffer for long prims). + + + +Porting Info +------------ + +If you're porting a DRI or other driver from Mesa 4.0.x to Mesa 4.1 here +are some things to change: + +1. ctx->Texture._ReallyEnabled is obsolete. + + Since there are now 5 texture targets (1D, 2D, 3D, cube and rect) that + left room for only 6 units (6*5 < 32) in this field. + This field is being replaced by ctx->Texture._EnabledUnits which has one + bit per texture unit. If the bit k of _EnabledUnits is set, that means + ctx->Texture.Unit[k]._ReallyEnabled is non-zero. You'll have to look at + ctx->Texture.Unit[k]._ReallyEnabled to learn if the 1D, 2D, 3D, cube or + rect texture is enabled for unit k. + + This also means that the constants TEXTURE1_*, TEXTURE2_*, etc are + obsolete. + + The tokens TEXTURE0_* have been replaced as well (since there's no + significance to the "0" part: + + old token new token + TEXTURE0_1D TEXTURE_1D_BIT + TEXTURE0_2D TEXTURE_2D_BIT + TEXTURE0_3D TEXTURE_3D_BIT + TEXTURE0_CUBE TEXTURE_CUBE_BIT + TEXTURE_RECT_BIT + + These tokens are only used for the ctx->Texture.Unit[i].Enabled and + ctx->Texture.Unit[i]._ReallyEnabled fields. Exactly 0 or 1 bits will + be set in _ReallyEnabled at any time! + + Q: "What's the purpose of Unit[i].Enabled vs Unit[i]._ReallyEnabled?" + A: The user can enable GL_TEXTURE_1D, GL_TEXTURE_2D, etc for any + texure unit all at once (an unusual thing to do). + OpenGL defines priorities that basically say GL_TEXTURE_2D has + higher priority than GL_TEXTURE_1D, etc. Also, just because a + texture target is enabled by the user doesn't mean we'll actually + use that texture! If a texture object is incomplete (missing mip- + map levels, etc) it's as if texturing is disabled for that target. + The _ReallyEnabled field will have a bit set ONLY if the texture + target is enabled and complete. This spares the driver writer from + examining a _lot_ of GL state to determine which texture target is + to be used. + + +2. Tnl tokens changes + + During the implementation of GL_NV_vertex_program some of the vertex + buffer code was changed. Specifically, the VERT_* bits defined in + tnl/t_context.h have been renamed to better match the conventions of + GL_NV_vertex_program. The old names are still present but obsolete. + Drivers should use the newer names. + + For example: VERT_RGBA is now VERT_BIT_COLOR0 and + VERT_SPEC_RGB is now VERT_BIT_COLOR1. + + + +3. Read/Draw Buffer changes + + The business of setting the current read/draw buffers in Mesa 4.0.x + was complicated. It's much simpler now in Mesa 4.1. + + Here are the changes: + + - Renamed ctx->Color.DrawDestMask to ctx->Color._DrawDestMask + - Removed ctx->Color.DriverDrawBuffer + - Removed ctx->Pixel.DriverReadBuffer + - Removed ctx->Color.MultiDrawBuffer + - Removed ctx->Driver.SetDrawBuffer() + - Removed swrast->Driver.SetReadBuffer(). + - Added ctx->Color._DrawDestMask - a bitmask of FRONT/BACK_LEFT/RIGHT_BIT + values to indicate the current draw buffers. + - Added ctx->Pixel._ReadSrcMask to indicate the source for pixel reading. + The value is _one_ of the FRONT/BACK_LEFT/RIGHT_BIT values. + - Added ctx->Driver.DrawBuffer() and ctx->Driver.ReadBuffer(). + These functions exactly correspond to glDrawBuffer and glReadBuffer calls. + Many drivers will set ctx->Driver.DrawBuffer = _swrast_DrawBuffer and + leave ctx->Draw.ReadBuffer NULL. + DRI drivers should implement their own function for ctx->Driver.DrawBuffer + and use it to set the current hardware drawing buffer. You'll probably + also want to check for GL_FRONT_AND_BACK mode and fall back to software. + Call _swrast_DrawBuffer() too, to update the swrast state. + - Added swrast->Driver.SetBuffer(). + This function should be implemented by all device drivers that use swrast. + Mesa will call it to specify the buffer to use for span reading AND + writing and point/line/triangle rendering. + There should be no confusion between current read or draw buffer anymore. + - Added swrast->CurrentBuffer to indicate which color buffer to read/draw. + Will be FRONT_LEFT_BIT, BACK_LEFT_BIT, FRONT_RIGHT_BIT or BACK_RIGHT_BIT. + This value is usually passed to swrast->Driver.SetBuffer(). + + +4. _mesa_create_context() changes. This function now takes a pointer to + a __GLimports object. The __GLimports structure contains function + pointers to system functions like fprintf(), malloc(), etc. + The _mesa_init_default_imports() function can be used to initialize + a __GLimports object. Most device drivers (like the DRI drivers) + should use this. + + +5. In tnl's struct vertex_buffer, the field "ProjectedClipCoords" + has been replaced by "NdcPtr" to better match the OpenGL spec's + terminology. + + +6. Since GL_EXT_stencil_two_side has been implemented, many of the + ctx->Stencil fields are now 2-element arrays. For example, + "GLenum Ref" is now "GLenum Ref[2]" The [0] elements are the front-face + values and the [1] elements are the back-face values. + ctx->Stencil.ActiveFace is 0 or 1 to indicate the current face for + the glStencilOp/Func/Mask() functions. + ctx->Stencil.TestTwoSide controls whether or not 1 or 2-sided stenciling + is enabled. + + +7. Removed ctx->Polygon._OffsetAny. Removed ctx->Polygon.OffsetMRD. + + +8. GLfloat / GLchan changes: + + - Changed ctx->Driver.ClearColor() to take GLfloat[4] instead of GLchan[4]. + ctx->Color.ClearColor is now GLfloat[4] too. + - Changed ctx->Driver.AlphaRef() to take GLfloat instead of GLchan. + - ctx->Color.AlphaRef is now GLfloat. + - texObj->BorderColor is now GLfloat[4]. texObj->_BorderChan is GLchan[4]. + + This is part of an effort to remove all GLchan types from core Mesa so + that someday we can support 8, 16 and 32-bit color channels dynamically + at runtime, instead of at compile-time. + + +9. GLboolean ctx->Tranform.ClipEnabled[MAX_CLIP_PLANES] has been replaced + by GLuint ctx->Transform.ClipPlanesEnabled. The later is a bitfield. + + +10. There's a new matrix_stack type in mtypes.h used for the Modelview, + Projection, Color and Texcoord matrix stacks. + + +11. The ctx->Current.* fields have changed a lot. Now, there's a + ctx->Current.Attrib[] array for all vertex attributes which matches + the NV vertex program conventions. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-5.0 b/mesalib/docs/RELNOTES-5.0 new file mode 100644 index 000000000..1b22996d8 --- /dev/null +++ b/mesalib/docs/RELNOTES-5.0 @@ -0,0 +1,84 @@ + + Mesa 5.0 release notes + + November 13, 2002 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Even-numbered versions (such as 5.0) designate stable releases. +Odd-numbered versions (such as 4.1) designate new developmental releases. + +Mesa 5.0 is basically just a stabilization of Mesa 4.1. To see a list of +bug fixes, etc. see the VERSIONS file. + + + +New Features in Mesa 5.0 +------------------------ + +Mesa 5.0 supports OpenGL 1.4. Note Mesa's versioning convention: + + OpenGL Version Mesa Version + ------------------------------ + 1.0 1.x + 1.1 2.x + 1.2 3.x + 1.3 4.x + 1.4 5.x + +OpenGL 1.4 (and Mesa 5.0) incorporates the following OpenGL extensions as +standard features: + + GL_ARB_depth_texture + GL_ARB_shadow + GL_ARB_texture_env_crossbar + GL_ARB_texture_mirror_repeat + GL_ARB_window_pos + GL_EXT_blend_color + GL_EXT_blend_func_separate + GL_EXT_blend_logic_op + GL_EXT_blend_minmax + GL_EXT_blend_subtract + GL_EXT_fog_coord + GL_EXT_multi_draw_arrays + GL_EXT_point_parameters + GL_EXT_secondary_color + GL_EXT_stencil_wrap + GL_SGIS_generate_mipmap + + + +Device Driver Status +-------------------- + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of these drivers. +Here's the current status of all included drivers: + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.4 +OSMesa (off-screen) implements OpenGL 1.4 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.4 +DOS/DJGPP implements OpenGL 1.3 +GGI implements OpenGL 1.3 +DOS implements OpenGL 1.4 +BeOS needs updating (underway) +Allegro needs updating +D3D needs updating + +Note: supporting OpenGL 1.4 (vs. 1.3 or 1.2) usually only requires that the +driver call the _mesa_enable_1_4_extensions() function. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-5.0.1 b/mesalib/docs/RELNOTES-5.0.1 new file mode 100644 index 000000000..f37e9c4a7 --- /dev/null +++ b/mesalib/docs/RELNOTES-5.0.1 @@ -0,0 +1,45 @@ + + Mesa 5.0.1 release notes + + March 30, 2003 + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Even-numbered versions (such as 5.0.x) designate stable releases. +Odd-numbered versions (such as 4.1.x) designate new developmental releases. + +Mesa 5.0.1 just fixes bugs found since the 5.0 release. See the VERSIONS +file for details. + + +Device Driver Status +-------------------- + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of these drivers. +Here's the current status of all included drivers: + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.4 +OSMesa (off-screen) implements OpenGL 1.4 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.4 +DJGPP implements OpenGL 1.4 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.4 +Allegro needs updating +D3D needs updating + +Note: supporting OpenGL 1.4 (vs. 1.3 or 1.2) usually only requires that the +driver call the _mesa_enable_1_4_extensions() function. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-5.0.2 b/mesalib/docs/RELNOTES-5.0.2 new file mode 100644 index 000000000..d0e05b2c7 --- /dev/null +++ b/mesalib/docs/RELNOTES-5.0.2 @@ -0,0 +1,45 @@ + + Mesa 5.0.2 release notes + + September 5, 2003 + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Even-numbered versions (such as 5.0.x) designate stable releases. +Odd-numbered versions (such as 4.1.x) designate new developmental releases. + +Mesa 5.0.2 just fixes bugs found since the 5.0.1 release. See the VERSIONS +file for details. + + +Device Driver Status +-------------------- + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of these drivers. +Here's the current status of all included drivers: + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.4 +OSMesa (off-screen) implements OpenGL 1.4 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.4 +DJGPP implements OpenGL 1.4 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.4 +Allegro needs updating +D3D needs updating + +Note: supporting OpenGL 1.4 (vs. 1.3 or 1.2) usually only requires that the +driver call the _mesa_enable_1_4_extensions() function. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-5.1 b/mesalib/docs/RELNOTES-5.1 new file mode 100644 index 000000000..aed6e102b --- /dev/null +++ b/mesalib/docs/RELNOTES-5.1 @@ -0,0 +1,279 @@ + + Mesa 5.1 release notes + + December 17, 2003 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Even-numbered versions (such as 5.0) designate stable releases. +Odd-numbered versions (such as 5.1) designate new developmental releases. + + +Bug fixes +--------- +See the VERSIONS file for a list of bugs fixed in this release. + + + +New Features in Mesa 5.1 +------------------------ + +GL_ARB_vertex_program / GL_ARB_fragment_program + Michal Krol and Karl Rasche implemented these extensions. Thanks! + Be aware that there may be some rough edges and lurking bugs. + +GL_ATI_texture_env_combine3 extension + This adds a few new texture combine modes. + Contributed by Ian Romanick. + +GL_SGI_texture_color_table + Adds a color table lookup to the RGBA texture path. There's a separate + color table for each texture unit. + Contributed by Eric Plante. + +GL_NV_fragment_program + NVIDIA's fragment-level programming feature. + Possible lurking bugs: + - the DDX and DDY commands aren't fully tested + - there may be bugs in the parser + - the TEX and TXP instructions both do perspective correction + - the pack/unpack instructions may not be correct + +GL_EXT_depth_bounds_test + This extension adds a scissor-like test for the Z axis. It's used to + optimize stencil-volume shadow algorithms. + +GL_NV_light_max_exponent + Lifts the 128 limit for max light exponent. + +GL_EXT_texture_rectangle + Identical to GL_NV_texture_rectangle + +GL_ARB_occlusion_query + Useful for visibility-based culling. + +GL_ARB_texture_non_power_of_two + Removes the restriction that texture dimensions must be powers of two. + +GL_ARB_vertex_buffer_object + Allows server-side vertex arrays, optimized host/card data transfers, etc. + +GL_ARB_point_sprite + ARB-approved version of GL_NV_point_sprite. Basically allows textures + to be applied to points. + +GL_IBM_multimode_draw_arrays + Allows multiple vertex arrays to be drawn with one call, including arrays + of different types of primitives. + +GL_SUN_multi_draw_arrays + An alias for GL_EXT_multi_draw_arrays, standard in OpenGL 1.4. + +Faster glDrawPixels / glCopyPixels in X11 driver + If your X screen is 32bpp, glDrawPixels to the front color buffer will + be accelerated (via XPutImage()) if the image format is GL_BGRA and the + type is GL_UNSIGNED_BYTE. No raster operations, such as depth test, + blend, fog, etc. can be enabled. + + If your X screen is 16bpp, glDrawPixels to the front color buffer will + be accelerated (via XPutImage()) if the image format is GL_RGB and the + type is GL_UNSIGNED_SHORT_5_6_5. No raster operations, such as depth + test, blend, fog, etc. can be enabled. + + glCopyPixels() calls for the front color buffer will be accelerated + (via XCopyArea()) if no raster operations, such as depth test, blend, + fog, pixel zoom, etc. are enabled. + + The speed-up over typical software rendering is a factor of 10 for + glDrawPixels and 100 for glCopyPixels. + + +With the addition of GL_ARB_occlusion_query, GL_ARB_vertex_buffer_object, +GL_ARB_texture_non_power_of_two and GL_EXT_shadow_funcs, Mesa 5.1 supports +all the new features of OpenGL 1.5. Mesa 6.0 (the next stable release) +will advertise GL_VERSION = "1.5". + + + +Vertex/Fragment program debugger +-------------------------------- + +GL_MESA_program_debug is an experimental extension to support +interactive debugging of vertex and fragment programs. See the +docs/MESA_program_debug.spec file for details. + +The bulk of the vertex/fragment program debugger is implemented +outside of Mesa. The GL_MESA_program_debug extension just has minimal +hooks for stopping running programs and inspecting programs. + +The progs/tests/debugger.c (only in CVS) program is an example of how +the extension can be used. Presently, the debugger code and demo code +is in the same file. Eventually the debugger code should be moved +into a reusable module. + +As it is now, the demo lets you set breakpoings in vertex/fragment +programs, single step, and print intermediate register values. It's +basically just a proof of concept. + + + +Directory tree reorganization +----------------------------- + +The directory structure for Mesa has been overhauled to improve its layout. +All source code for Mesa, GLU, GLUT, etc is now under the src/ directory +in appropriate subdirectories. + +The Mesa source code and drivers has been reorganized under src/mesa/. + +All demonstration programs and tests are now in subdirectories under progs/. + + + +Build System Changes +-------------------- + +The GNU automake/autoconf support has been removed. As it was, it seldom +worked on anything but Linux. The Mesa developers aren't big fans of +automake/autoconf/libtool and didn't have the time to maintain it. +If someone wants to contribute new automake/autoconf support (and is +willing to maintain it), it may be re-incorporated into Mesa, subject +to some requirements. + +The "old style" makefile system has been updated: + 1. Make-config has been trimmed down to fewer, modern configurations. + 2. Most of the bin/mklib.* scripts have been rolled into a new "mklib" + script that works on all sorts of systems. There are probably some + bugs in it, but it's been tested on Linux, SunOS 5.8 and IRIX 6.5. + Improvements/contributes are greatly appreciated. + 3. The Makefile.X11 files have been cleaned up in various ways + + + +Source File Changes +------------------- + +The mmath.[ch] files are obsolete. Their contents have been moved +into the imports.[ch] and macros.[ch] files. + +The files related to vertex and fragment programming have changed. +Old files: + vpexec.[ch] + vpparse.[ch] + vpstate.[ch] +New files: + program.[ch] - generic ARB/NV program code + arbprogram.[ch] - ARB program API functions + arbfragparse.[ch] - ARB fragment program parsing + arbvertparse.[ch] - ARB vertex program parsing + arbparse.[ch] - ARB vertex/fragment parsing + arbparse_syn.h - vertex/fragment program syntax + nvprogram.[ch] - NV program API functions + nvvertprog.h - NV vertex program definitions + nvfragprog.h - NV fragment program definitions + nvvertparse.[ch] - NV vertex program parser + nvfragparse.[ch] - NV fragment program parser + nvvertexec.[ch] - NV vertex program execution + swrast/s_nvfragprog.[ch] - NV fragment program execution + +The files related to per-vertex handling have changed. +Old files: + tnl/t_eval_api.c - old per-vertex code + tnl/t_imm_alloc.c - old per-vertex code + tnl/t_imm_api.c - old per-vertex code + tnl/t_imm_debug.c - old per-vertex code + tnl/t_imm_dlist.c - old per-vertex code + tnl/t_imm_elt.c - old per-vertex code + tnl/t_imm_eval.c - old per-vertex code + tnl/t_imm_exec.c - old per-vertex code + tnl/t_imm_fixup.c - old per-vertex code + tnl/t_vtx_sse.c - old per-vertex code + tnl/t_vtx_x86.c - old per-vertex code +New files: + tnl/t_save_api.c - new per-vertex code + tnl/t_save_loopback.c - new per-vertex code + tnl/t_save_playback.c - new per-vertex code + tnl/t_vtx_eval.c - old per-vertex code + +Other new files: + bufferobj.[ch] - GL_ARB_vertex_buffer_object functions + version.h - defines the Mesa version info + +Other removed files: + swrast/s_histogram.[ch] - moved into src/histogram.c + + + +Other Changes +------------- + +The ctx->Driver.CreateTexture function has been removed - it wasn't used. + +New device driver hook functions: + NewTextureObject - used to allocate struct gl_texture_objects + NewTextureImage - used to allocate struct gl_texture_images + +New ctx->Texture._EnabledCoordUnits field: + With the addition of GL_NV_fragment_program we may need to interpolate + various sets of texture coordinates even when the corresponding texture + unit is not enabled. That is, glEnable(GL_TEXTURE_xD) may never get + called but we still may have to interpolate texture coordinates across + triangles so that the fragment program will get them. + This new field indicates which sets of texture coordinates are needed. + If a bit is set in the ctx->Texture._EnabledUnits bitmask is set, the + same bit MUST be set in ctx->Texture._EnabledCoordUnits. + +The ctx->_TriangleCaps field is deprecated. + Instead of testing the DD_* bits in _TriangleCaps, you should instead + directly test the relevant state variables, or use one of the helper + functions like NEED_SECONDARY_COLOR() at the bottom of context.h + While testing _TriangleCaps bits was fast, it was kludgey, and setting + the bits in the first place could be error prone. + +New vertex processing code. + The code behind glBegin, glEnd, glVertex, glNormal, etc. has been + totally rewritten. It's a cleaner implementation now and should use + less memory. (Keith) + + + +To Do +----- +Add screen-awareness to fakeglx.c + + + + +Device Driver Status +-------------------- + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of these drivers. +Here's the current status of all included drivers: + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.4 +OSMesa (off-screen) implements OpenGL 1.4 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.4 +DJGPP implements OpenGL 1.4 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.4 +Allegro needs updating +D3D needs updating + +Note: supporting OpenGL 1.4 (vs. 1.3 or 1.2) usually only requires that the +driver call the _mesa_enable_1_4_extensions() function. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-6.0 b/mesalib/docs/RELNOTES-6.0 new file mode 100644 index 000000000..1a3c2fb1a --- /dev/null +++ b/mesalib/docs/RELNOTES-6.0 @@ -0,0 +1,86 @@ + + Mesa 6.0 release notes + + January 16, 2004 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 5.1) designate new developmental releases. +Even numbered versions (such as 6.0) designate stable releases. + +Mesa version 6.0 signifies two things: + + 1. A stabilization of the 5.1 development release + 2. Implementation of the OpenGL 1.5 specification. When you query + glGetString(GL_VERSION) "1.5" will be returned (as long as the + driver supports all the required features). + + +Note that the Mesa major version number is incremented with the OpenGL +minor version number: + + Mesa 1.x == OpenGL 1.0 + Mesa 2.x == OpenGL 1.1 + Mesa 3.x == OpenGL 1.2 + Mesa 4.x == OpenGL 1.3 + Mesa 5.x == OpenGL 1.4 + Mesa 6.x == OpenGL 1.5 + + + +New Features +------------ + +Mesa 5.1 already had all the new features of OpenGL 1.5, implemented as +extensions. These extensions were simply promoted to standard features: + + GL_ARB_occlusion_query extension + GL_ARB_texture_non_power_of_two extension + GL_ARB_vertex_buffer_object extension + GL_EXT_shadow_funcs + + + +Device Drivers +-------------- + +Mesa advertises itself as either OpenGL 1.2 or OpenGL 1.3 depending on +the device driver. For example, if the driver enables all the ARB +extensions which are part of OpenGL 1.3 then glGetString(GL_VERSION) +will return "1.3". Otherwise, it'll return "1.2". + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of the drivers. +Here's the current status of all included drivers: + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.5 +OSMesa (off-screen) implements OpenGL 1.5 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.5 +DJGPP implements OpenGL 1.5 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.5 +Allegro needs updating +D3D needs updating + + + + +Other Changes +------------- + +See the VERSIONS file for more details about bug fixes, etc. in Mesa 6.0. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-6.0.1 b/mesalib/docs/RELNOTES-6.0.1 new file mode 100644 index 000000000..1444b9fc8 --- /dev/null +++ b/mesalib/docs/RELNOTES-6.0.1 @@ -0,0 +1,49 @@ + + Mesa 6.0.1 release notes + + April 2, 2003 + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Even-numbered versions (such as 6.0.x) designate stable releases. +Odd-numbered versions (such as 6.1.x) designate new developmental releases. + +Mesa 6.0.1 just fixes bugs found since the 6.0 release. See the VERSIONS +file for details. + + + +Device Drivers +-------------- + +Mesa advertises itself as supporting OpenGL 1.2, 1.3, 1.4 or 1.5 +depending on the device driver's capabilities. For example, if the +driver enables all the ARB extensions which are part of OpenGL 1.5 +then glGetString(GL_VERSION) will return "1.5". Otherwise, it'll +return "1.4" or the next lower version that implements all required +functionality. + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of the drivers. +Here's the current status of all included drivers: + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.5 +OSMesa (off-screen) implements OpenGL 1.5 +FX (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.5 +DJGPP implements OpenGL 1.5 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.5 +Allegro needs updating +D3D needs updating + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-6.1 b/mesalib/docs/RELNOTES-6.1 new file mode 100644 index 000000000..8de64d1f1 --- /dev/null +++ b/mesalib/docs/RELNOTES-6.1 @@ -0,0 +1,111 @@ + + Mesa 6.1 release notes + + August 18, 2004 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 6.1) designate new developmental releases. +Even numbered versions (such as 6.0) designate stable releases. + + +New Features +------------ + +Half-precision floating point (GLhalf) pixel formats are supported +in Mesa, but the feature isn't exposed yet since the ARB extension +hasn't been finalized yet. + + +Texture image handling +---------------------- + +The code which implements image conversion, pixel transfer ops, etc +for glTexImage commands has been rewritten. + +Now the gl_texture_format struct has a new StoreImage function +pointer. Each texture format must implement this function. The +function is totally responsible for converting the user's texture +image into the specific format. A few helper functions makes this +relatively simple. + +Overall, the code is much simpler, cleaner and easier to work with +now. Adding new texture formats is straight-forward and there's no +longer any distinction between "hardware" and "software" formats. + +Finally, the code for compressed texture images has been reorganized +as well. + +Removed files: + texutil.c + texutil.h + texutil_tmp.h + +New files: + texcompress_s3tc.c + texcompress_fxt1.c + + + +Driver / context changes +------------------------ + +The _mesa_create_context() and _mesa_initialize_context() function +parameters have changed. They now take a pointer to a struct +dd_function_table. Drivers can initialize this table by calling +_mesa_init_driver_functions(). Drivers should then plug in the special +functions they implement. In particular, the ctx->Driver.NewTextureObject +pointer _must_ be set so that the default texture objects created in +_mesa_create/initialize_context() are correctly built. + +The _mesa_init_driver_functions() function allows a lot of redundant code +to be removed from the device drivers (such as initializing +ctx->Driver.Accum to point to _swrast_Accum). Adding new functions to +the dd_function_table can be done with less hassle since the pointer can +be initialized in _mesa_init_driver_functions() rather than in _all_ the +drivers. + + +Device Drivers +-------------- + +Mesa advertises itself as supporting OpenGL 1.2, 1.3, 1.4 or 1.5 +depending on the device driver's capabilities. For example, if the +driver enables all the ARB extensions which are part of OpenGL 1.5 +then glGetString(GL_VERSION) will return "1.5". Otherwise, it'll +return "1.4" or the next lower version that implements all required +functionality. + +A number of Mesa's software drivers haven't been actively maintained for +some time. We rely on volunteers to maintain many of the drivers. +Here's the current status of all included drivers: + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.5 +OSMesa (off-screen) implements OpenGL 1.5 +Glide (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.5 +DJGPP implements OpenGL 1.5 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.5 +Allegro needs updating +D3D needs updating + + + +Other Changes +------------- + +See the VERSIONS file for more details about bug fixes, etc. in Mesa 6.1. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-6.2 b/mesalib/docs/RELNOTES-6.2 new file mode 100644 index 000000000..06cfba0c7 --- /dev/null +++ b/mesalib/docs/RELNOTES-6.2 @@ -0,0 +1,51 @@ + + Mesa 6.2 release notes + + October 2, 2004 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 6.1) designate new developmental releases. +Even numbered versions (such as 6.2) designate stable releases. + + +This release primarily just fixes bugs found in the Mesa 6.1 release. +See the VERSIONS file for details. + + +ToDo: PBO for polygon stipple, convolution filter, etc. + + + +Known Issues +------------ + +The GL_EXT_pixel_buffer_object extension isn't fully implemented for +functions like glPolygonStipple, glConvolutionFilter, glColorTable, +etc. The important functions like glRead/DrawPixels, glTex[Sub]Image, +and glBitmap work with PBOs. + + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.5 +OSMesa (off-screen) implements OpenGL 1.5 +Glide (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.5 +DJGPP implements OpenGL 1.5 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.5 +Allegro needs updating +D3D needs updating + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-6.2.1 b/mesalib/docs/RELNOTES-6.2.1 new file mode 100644 index 000000000..c7baa5d42 --- /dev/null +++ b/mesalib/docs/RELNOTES-6.2.1 @@ -0,0 +1,49 @@ + + Mesa 6.2.1 release notes + + December 9, 2004 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 6.1) designate new developmental releases. +Even numbered versions (such as 6.2.x) designate stable releases. + + +This release primarily just fixes bugs found in the Mesa 6.2 release. +See the VERSIONS file for details. + + + +Known Issues +------------ + +The GL_EXT_pixel_buffer_object extension isn't fully implemented for +functions like glPolygonStipple, glConvolutionFilter, glColorTable, +etc. The important functions like glRead/DrawPixels, glTex[Sub]Image, +and glBitmap work with PBOs. This has been fixed for Mesa 6.3. + + + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.5 +OSMesa (off-screen) implements OpenGL 1.5 +Glide (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.5 +DJGPP implements OpenGL 1.5 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.5 +Allegro needs updating +D3D needs updating + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-6.3 b/mesalib/docs/RELNOTES-6.3 new file mode 100644 index 000000000..6b4dfaaf9 --- /dev/null +++ b/mesalib/docs/RELNOTES-6.3 @@ -0,0 +1,114 @@ + + Mesa 6.3 release notes + + July 20, 2005 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 6.3) designate new developmental releases. +Even numbered versions (such as 6.2) designate stable releases. + + + +New Features +------------ + +GL_ARB_draw_buffers - allows a fragment program to write to a number of + separate color buffers, instead of just one. + +GL_OES_read_format - allows one to query the fastest glReadPixels format + and datatype. + +GL_ARB_pixel_buffer_object - buffer objects for pixel read/write functions. + +GL_EXT_framebuffer_object - allows render-to-texture and provides a + window-system indepedent Pbuffer facility. + The Mesa CVS tree contains a couple tests of this extension. + +DirectFB driver, contributed by Claudio Ciccani. See docs/README.directfb +for details. + + + +Vertex/Fragment Program PRINT Instruction +----------------------------------------- + +The GL_NV_vertex_program and GL_NV_fragment_program languages have been +extended with a PRINT instruction. + + + +glDeleteTextures(), glDeletePrograms() and glDeleteBuffers() Changed +-------------------------------------------------------------------- + +To match the behaviour of other OpenGL implementations, glDeleteTextures, +glDeletePrograms and glDeleteBuffers have been modified so that: + + * The named texture/program/buffer ID is immediately freed for re-use. + + * The actual texture object, program or buffers isn't really deleted until + it is no longer bound in any rendering context (the reference count + is zero). + +Previously, the texture/program/buffer ID wasn't freed until the object +was really deleted. + +Note that textures, programs and buffers can be shared by several rendering +contexts so they can't be deleted until they're unbound in _all_ contexts. + + + +GL_EXT_framebuffer_object changes +--------------------------------- + +Implementing this extension involved changing a lot of code (for the better). + +The gl_framebuffer object now a collection of gl_renderbuffer objects. +Renderbuffers may store colors, stencil indices, or depth values. The +gl_framebuffer and gl_renderbuffer types are object-oriented in design. + +All the old RGB, color index, stencil and depth-related span functions for +reading/writing pixels from/to buffers has changed. Now, all pixels are +read/written through a set of common renderbuffer functions (methods). + +Most device drivers have been updated for these changes, but some haven't. + + + +To Do (someday) items +--------------------- + Switch to freeglut + Increase MAX_DRAWBUFFERS + driver hooks for BeginQuery/EndQuery + + + +Miscellaneous +------------- + +The main/get.c file is now generated with a Python script (get_gen.py). + + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.5 +OSMesa (off-screen) implements OpenGL 1.5 +Glide (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.5 +DJGPP implements OpenGL 1.5 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.5 +Allegro needs updating +D3D needs updating + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-6.3.1 b/mesalib/docs/RELNOTES-6.3.1 new file mode 100644 index 000000000..eacc952ae --- /dev/null +++ b/mesalib/docs/RELNOTES-6.3.1 @@ -0,0 +1,48 @@ + + Mesa 6.3.1 release notes + + July XX, 2005 + + PLEASE READ!!!! + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 6.3) designate new developmental releases. +Even numbered versions (such as 6.2) designate stable releases. + + + +DRI drivers +----------- + +This release includes the DRI drivers and GLX code for hardware rendering. + + + +Bug fixes +--------- + +Bugs fixed in 6.3.1 are listed in the VERSIONS file. + + + +Driver Status +---------------------- --------------------- +XMesa (Xlib) implements OpenGL 1.5 +OSMesa (off-screen) implements OpenGL 1.5 +Glide (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.5 +DJGPP implements OpenGL 1.5 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.5 +Allegro needs updating +D3D needs updating + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-6.3.2 b/mesalib/docs/RELNOTES-6.3.2 new file mode 100644 index 000000000..e5243ef78 --- /dev/null +++ b/mesalib/docs/RELNOTES-6.3.2 @@ -0,0 +1,36 @@ + + Mesa 6.3.2 Release Notes + + August 19, 2005 + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 6.3) designate new developmental releases. +Even numbered versions (such as 6.2) designate stable releases. + + +6.3.2 is primarily a bug-fix release. See the VERSIONS file for details. + + + +Driver Status +---------------------- ---------------------- +DRI drivers varies with the driver +XMesa (Xlib) implements OpenGL 1.5 +OSMesa (off-screen) implements OpenGL 1.5 +Glide (3dfx Voodoo1/2) implements OpenGL 1.3 +SVGA implements OpenGL 1.3 +Wind River UGL implements OpenGL 1.3 +Windows/Win32 implements OpenGL 1.5 +DJGPP implements OpenGL 1.5 +GGI implements OpenGL 1.3 +BeOS implements OpenGL 1.5 +Allegro needs updating +D3D needs updating + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/RELNOTES-6.4 b/mesalib/docs/RELNOTES-6.4 new file mode 100644 index 000000000..1a945a103 --- /dev/null +++ b/mesalib/docs/RELNOTES-6.4 @@ -0,0 +1,49 @@ + + Mesa 6.4 Release Notes + + October 24, 2005 + + + +Introduction +------------ + +Mesa uses an even/odd version number scheme like the Linux kernel. +Odd numbered versions (such as 6.3) designate new developmental releases. +Even numbered versions (such as 6.4) designate stable releases. + + +6.4 is a bug-fix release. See the VERSIONS file for details. + + + +GLUT tarball +------------ + +Starting with 6.4, the GLUT library sources are distributed in a separate +tarball. This was done at the request of Linux distro vendors who prefer +to use freeglut. + + + + +Driver Status +---------------------- ---------------------- +DRI drivers varies with the driver +XMesa (Xlib) implements OpenGL 1.5 +OSMesa (off-screen) implements OpenGL 1.5 +Windows/Win32 implements OpenGL 1.5 +Glide (3dfx Voodoo1/2) requires updates +SVGA requires updates +DJGPP requires updates +GGI requires updates +BeOS requires updates +Allegro requires updates +D3D requires updates + +The drivers which require updates mostly need to be updated to work +with the new gl_renderbuffer / gl_framebuffer infrastructure introduced +in Mesa 6.3. + + +---------------------------------------------------------------------- diff --git a/mesalib/docs/autoconf.html b/mesalib/docs/autoconf.html new file mode 100644 index 000000000..936ddcffe --- /dev/null +++ b/mesalib/docs/autoconf.html @@ -0,0 +1,289 @@ + + +Compilation and Installation using Autoconf + + + + + + +

Compilation and Installation using Autoconf

+ +
    +
  1. Basic Usage
  2. +
  3. Driver Options
  4. + +
  5. Library Options
  6. + +
  7. Demo Program Options
  8. +
+ + + +

1. Basic Usage

+ +

+The autoconf generated configure script can be used to guess your +platform and change various options for building Mesa. To use the +configure script, type: +

+ +
+    ./configure
+
+ +

+To see a short description of all the options, type ./configure +--help. If you are using a development snapshot and the configure +script does not exist, type ./autogen.sh to generate it +first. If you know the options you want to pass to +configure, you can pass them to autogen.sh. It +will run configure with these options after it is +generated. Once you have run configure and set the options +to your preference, type: +

+ +
+    make
+
+ +

+This will produce libGL.so and several other libraries depending on the +options you have chosen. Later, if you want to rebuild for a different +configuration run make realclean before rebuilding. +

+ +

+Some of the generic autoconf options are used with Mesa: + +

    +
  • --prefix=PREFIX - This is the root directory where +files will be installed by make install. The default is +/usr/local. +
  • +
  • --exec-prefix=EPREFIX - This is the root directory +where architecture-dependent files will be installed. In Mesa, this is +only used to derive the directory for the libraries. The default is +${prefix}. +
  • +
  • --libdir=LIBDIR - This option specifies the directory +where the GL libraries will be installed. The default is +${exec_prefix}/lib. It also serves as the name of the +library staging area in the source tree. For instance, if the option +--libdir=/usr/local/lib64 is used, the libraries will be +created in a lib64 directory at the top of the Mesa source +tree. +
  • +
  • --enable-static, --disable-shared - By default, Mesa +will build shared libraries. Either of these options will force static +libraries to be built. It is not currently possible to build static and +shared libraries in a single pass. +
  • +
  • CC, CFLAGS, CXX, CXXFLAGS - These environment variables +control the C and C++ compilers used during the build. By default, +gcc and g++ are used with the options +"-g -O2". +
  • +
  • LDFLAGS - An environment variable specifying flags to +pass when linking programs. These are normally empty, but can be used +to direct the linker to use libraries in nonstandard directories. For +example, LDFLAGS="-L/usr/X11R6/lib". +
  • +
  • PKG_CONFIG_PATH - When available, the +pkg-config utility is used to search for external libraries +on the system. This environment variable is used to control the search +path for pkg-config. For instance, setting +PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig will search for +package metadata in /usr/X11R6 before the standard +directories. +
  • +
+

+ +

+There are also a few general options for altering the Mesa build: +

    +
  • --with-x - When the X11 development libraries are +needed, the pkg-config utility will +be used for locating them. If they cannot be found through +pkg-config a fallback routing using imake will +be used. In this case, the --with-x, +--x-includes and --x-libraries options can +control the use of X for Mesa. +
  • +
  • --enable-gl-osmesa - The OSMesa +library can be built on top of libGL for drivers that provide it. +This option controls whether to build libOSMesa. By default, this is +enabled for the Xlib driver and disabled otherwise. Note that this +option is different than using OSMesa as the driver. +
  • +
  • --enable-debug - This option will enable compiler +options and macros to aid in debugging the Mesa libraries. +
  • +
  • --disable-asm - There are assembly routines +available for a few architectures. These will be used by default if +one of these architectures is detected. This option ensures that +assembly will not be used. +
  • +
  • --enable-32-bit, --enable-64-bit - By default, the +build will compile code as directed by the environment variables +CC, CFLAGS, etc. If the compiler is +gcc, these options offer a helper to add the compiler flags +to force 32- or 64-bit code generation as used on the x86 and x86_64 +architectures. +
  • +
+

+ + + +

2. Driver Options

+ +

+There are several different driver modes that Mesa can use. These are +described in more detail in the basic +installation instructions. The Mesa driver is controlled through the +configure option --with-driver. There are currently three supported +options in the configure script. +

+ + + + + +

3. Library Options

+ +

+The configure script provides more fine grained control over the GL +libraries that will be built. More details on the specific GL libraries +can be found in the basic installation +instructions. + +

+

+ + +
+

4. Demo Program Options

+ +

+There are many demonstration programs in the MesaDemos tarball. If the +programs are available when ./configure is run, a subset of +the programs will be built depending on the driver and library options +chosen. See the directory progs for the full set of demos. + +

    +
  • --with-demos=DEMOS,DEMOS,... - This option allows a +specific set of demo programs to be built. For example, +--with-demos="xdemos,slang". Beware that if this option is +used, it will not be ensured that the necessary GL libraries will be +available. +
  • +
  • --without-demos - This completely disables building the +demo programs. It is equivalent to --with-demos=no. +
  • +
+

+ + + diff --git a/mesalib/docs/banner.html b/mesalib/docs/banner.html new file mode 100644 index 000000000..9cb27bb6d --- /dev/null +++ b/mesalib/docs/banner.html @@ -0,0 +1,27 @@ + + + + Banner + + +
+ + + + + + + + +
+

+
The +Mesa 3D Graphics Library +

+
+


+

+
+ + diff --git a/mesalib/docs/bugs.html b/mesalib/docs/bugs.html new file mode 100644 index 000000000..4397339e9 --- /dev/null +++ b/mesalib/docs/bugs.html @@ -0,0 +1,53 @@ + + +Mesa Bug Reporting + + + + + +

Bug Database

+ +

+The Mesa bug database is hosted on +freedesktop.org. +The old bug database on SourceForge is no longer used. +

+ +

+To file a Mesa bug, go to + +Bugzilla on freedesktop.org +

+ +

+Please follow these bug reporting guidelines: +

+ +
    +
  • Check if a new version of Mesa is available which might have fixed +the problem. +
  • Check if your bug is already reported in the database. +
  • Monitor your bug report for requests for additional information, etc. +
  • If you're reporting a crash, try to use your debugger (gdb) to get a stack +trace. Also, recompile Mesa in debug mode to get more detailed information. +
  • Describe in detail how to reproduce the bug, especially with games +and applications that the Mesa developers might not be familiar with. +
  • Provide a simple GLUT-based test program if possible +
+ +

+Bug reports will automatically be forwarded by bugzilla to the Mesa +developer's mailing list. +

+ +

+The easier a bug is to reproduce, the sooner it will be fixed. +Please do everything you can to facilitate quickly fixing bugs. +If your bug report is vague or your test program doesn't compile +easily, the problem may not be fixed very quickly. +

+ + + diff --git a/mesalib/docs/cell.html b/mesalib/docs/cell.html new file mode 100644 index 000000000..30626b60b --- /dev/null +++ b/mesalib/docs/cell.html @@ -0,0 +1,138 @@ + + +Cell Driver + + + + + +

Mesa/Gallium Cell Driver

+ +

+The Mesa +Cell +driver is part of the +Gallium3D +architecture. +Tungsten Graphics did the original implementation of the Cell driver. +

+ + +

Source Code

+ +

+The latest Cell driver source code is on the master branch of the Mesa +git repository. +

+

+To build the driver you'll need the IBM Cell SDK (version 2.1 or 3.0). +To use the driver you'll need a Cell system, such as a PS3 running Linux, +or the Cell Simulator (untested, though). +

+ +

+If using Cell SDK 2.1, see the configs/linux-cell file for some +special changes. +

+ +

+To compile the code, run make linux-cell. +Or to build in debug mode, run make linux-cell-debug. +

+ +

+To use the library, make sure your current directory is the top of the +Mesa tree, then set LD_LIBRARY_PATH like this: +

+  export LD_LIBRARY_PATH=$PWD/lib/gallium:$PWD/lib/
+
+ +

+Verify that the Cell driver is being used by running +progs/xdemos/glxinfo and looking for: +

+  OpenGL renderer string: Gallium 0.3, Cell on Xlib
+
+ + +

Driver Implementation Summary

+ +

+Rasterization is parallelized across the SPUs in a tiled-based manner. +Batches of transformed triangles are sent to the SPUs (actually, pulled by from +main memory by the SPUs). +Each SPU loops over a set of 32x32-pixel screen tiles, rendering the triangles +into each tile. +Because of the limited SPU memory, framebuffer tiles are paged in/out of +SPU local store as needed. +Similarly, textures are tiled and brought into local store as needed. +

+ + +

Status

+ +

+As of October 2008, the driver runs quite a few OpenGL demos. +Features that work include: +

+
    +
  • Point/line/triangle rendering, glDrawPixels +
  • 2D, NPOT and cube texture maps with nearest/linear/mipmap filtering +
  • Dynamic SPU code generation for fragment shaders, but not complete +
  • Dynamic SPU code generation for fragment ops (blend, Z-test, etc), but not complete +
  • Dynamic PPU/PPC code generation for vertex shaders, but not complete +
+

+Performance has recently improved with the addition of PPC code generation +for vertex shaders, but the code quality isn't too great yet. +

+

+Another bottleneck is SwapBuffers. It may be the limiting factor for +many simple GL tests. +

+ + + +

Debug Options

+ +

+The CELL_DEBUG env var can be set to a comma-separated list of one or +more of the following debug options: +

+
    +
  • checker - use a different background clear color for each SPU. + This lets you see which SPU is rendering which screen tiles. +
  • sync - wait/synchronize after each DMA transfer +
  • asm - print generated SPU assembly code to stdout +
  • fragops - emit fragment ops debug messages +
  • fragopfallback - don't use codegen for fragment ops +
  • cmd - print SPU commands as their received +
  • cache - print texture cache statistics when program exits +
+

+Note that some of these options may only work for linux-cell-debug builds. +

+ +

+If the GALLIUM_NOPPC env var is set, PPC code generation will not be used +and vertex shaders will be run with the TGSI interpreter. +

+

+If the GALLIUM_NOCELL env var is set, the softpipe driver will be used +intead of the Cell driver. +This is useful for comparison/validation. +

+ + + +

Contributing

+ +

+If you're interested in contributing to the effort, familiarize yourself +with the code, join the mesa3d-dev mailing list, +and describe what you'd like to do. +

+ + + + diff --git a/mesalib/docs/conform.html b/mesalib/docs/conform.html new file mode 100644 index 000000000..3611f8c6f --- /dev/null +++ b/mesalib/docs/conform.html @@ -0,0 +1,695 @@ + + +Conformance + + + + + +

Conformance

+ +

+The SGI OpenGL conformance tests verify correct operation of OpenGL +implementations. I, Brian Paul, have been given a copy of the tests +for testing Mesa. The tests are not publically available. +

+

+This file has the latest results of testing Mesa with the OpenGL 1.2 +conformance tests. Testing with the preliminary OpenGL 1.3 tests has +also been done. Mesa passes all the 1.3 tests. +

+

+The tests were run using the software X11 device driver on 24-bpp +and 16-bpp displays. +

+

+Mesa 4.0 and later pass all conformance tests at all path levels. +Note that this says nothing about the conformance of hardware drivers +based upon Mesa. +

+ + +
+
+COVERAGE TESTS
+--------------
+
+Test that all API functions accept the legal parameters and reject
+illegal parameters.  The result of each test is either pass or fail.
+
+% covgl
+OpenGL Coverage Test.
+Version 1.2
+
+covgl passed.
+
+covgl passed at 1.1 level.
+
+covgl passed at 1.2 level.
+
+covgl passed for ARB_multitexture.
+
+
+% covglu
+OpenGL GLU Coverage Test.
+Version 1.3
+
+covglu passed.
+
+covglu passed at 1.1 level.
+
+
+% covglx
+OpenGL X Coverage Test.
+Version 1.1.1
+
+covglx passed.
+
+
+% primtest -v
+Open GL Primitives Test.
+Version 1.2
+
+[lots of output deleted]
+
+292159 Combinations.
+primtest passed.
+
+
+
+
+GL CONFORMANCE TEST
+===================
+
+Render test images, read them back, then test for expected results.
+
+
+----------------------------------------------------------------------
+% conform -v 2
+
+OpenGL Conformance Test
+Version 1.2
+
+Setup Report.
+    Verbose level = 2.
+    Random number seed = 1.
+    Path inactive.
+
+Visual Report.
+    Display ID = 35. Indirect Rendering.
+    Double Buffered.
+    RGBA (5, 6, 5, 0).
+    Stencil (8).
+    Depth (16).
+    Accumulation (16, 16, 16, 16).
+
+Epsilon Report.
+    zero error epsilon = 0.000122.
+    RGBA error epsilon = 0.0324, 0.016, 0.0324, 0.000122.
+    Depth buffer error epsilon = 0.000137.
+    Stencil plane error epsilon = 0.00404.
+    Accumulation error epsilon = 0.000137, 0.000137, 0.000137, 0.000137.
+
+Default State test passed.
+Must Pass test passed.
+Divide By Zero test passed.
+Viewport Clamp test passed.
+Matrix Stack test passed.
+Matrix Stack Mixing test passed.
+Vertex Order test passed.
+Transformations test passed.
+Transformation Normal test passed.
+Viewport Transformation test passed.
+Buffer Clear test passed.
+Buffer Corners test passed.
+Buffer Color test passed.
+Color Ramp test passed.
+Mask test passed.
+Buffer Invariance test passed.
+Accumulation Buffer test passed.
+Select test passed.
+Feedback test passed.
+Scissor test passed.
+Alpha Plane Function test passed.
+Stencil Plane Clear test passed.
+Stencil Plane Corners test passed.
+Stencil Plane Operation test passed.
+Stencil Plane Function test passed.
+Depth Buffer Clear test passed.
+Depth Buffer Function test passed.
+Blend test passed.
+Dither test passed.
+LogicOp Function test does not exist for an RGB visual.
+DrawPixels test passed.
+CopyPixels test passed.
+Bitmap Rasterization test passed.
+Point Rasterization test passed.
+Anti-aliased Point test passed.
+Line Rasterization test passed.
+Line Stipple test passed.
+Anti-aliased Line test passed.
+Horizontal and Vertical Line test passed.
+Triangle Rasterization test passed.
+Triangle Tile test passed.
+Triangle Stipple test passed.
+Anti-aliased Triangles test passed.
+Quad Rasterization test passed.
+Polygon Face test passed.
+Polygon Cull test passed.
+Polygon Stipple test passed.
+Polygon Edge test passed.
+Ambient Material test passed.
+Ambient Scene test passed.
+Attenuation Position test passed.
+Diffuse Light test passed.
+Diffuse Material test passed.
+Diffuse Material Normal test passed.
+Diffuse Material Positioning test passed.
+Emissive Material test passed.
+Specular Exponent test passed.
+Specular Exponent Normal test passed.
+Specular Local Eye Half Angle test passed.
+Specular Light test passed.
+Specular Material test passed.
+Specular Normal test passed.
+Spot Positioning test passed.
+Spot Exponent and Positioning test passed.
+Spot Exponent and Direction test passed.
+Fog Exponential test passed.
+Fog Linear test passed.
+Texture Decal test passed.
+Texture Border test passed.
+Mipmaps Selection test passed.
+Mipmaps Interpolation test passed.
+Display Lists test passed.
+Evaluator test passed.
+Evaluator Color test passed.
+Texture Edge Clamp test passed.
+Packed Pixels test passed.
+Texture LOD test passed.
+Rescale Normal test passed.
+Color Table test passed.
+Convolution test passed.
+Convolution Border test passed.
+Histogram test passed.
+MinMax test passed.
+MultiTexture test passed.
+
+Conform passed.
+
+----------------------------------------------------------------------
+% conform -v 2 -p 1
+
+OpenGL Conformance Test
+Version 1.2
+
+Setup Report.
+    Verbose level = 2.
+    Random number seed = 1.
+    Path level = 1.
+
+Visual Report.
+    Display ID = 35. Indirect Rendering.
+    Double Buffered.
+    RGBA (5, 6, 5, 0).
+    Stencil (8).
+    Depth (16).
+    Accumulation (16, 16, 16, 16).
+
+Epsilon Report.
+    zero error epsilon = 0.000122.
+    RGBA error epsilon = 0.0324, 0.016, 0.0324, 0.000122.
+    Depth buffer error epsilon = 0.000137.
+    Stencil plane error epsilon = 0.00404.
+    Accumulation error epsilon = 0.000137, 0.000137, 0.000137, 0.000137.
+
+Default State test passed.
+Must Pass test passed.
+Divide By Zero test passed.
+Viewport Clamp test passed.
+Matrix Stack test passed.
+Matrix Stack Mixing test passed.
+Vertex Order test passed.
+Transformations test passed.
+Transformation Normal test passed.
+Viewport Transformation test passed.
+Buffer Clear test passed.
+Buffer Corners test passed.
+Buffer Color test passed.
+Color Ramp test passed.
+Mask test passed.
+Buffer Invariance test passed.
+Accumulation Buffer test passed.
+Select test passed.
+Feedback test passed.
+Scissor test passed.
+Alpha Plane Function test passed.
+Stencil Plane Clear test passed.
+Stencil Plane Corners test passed.
+Stencil Plane Operation test passed.
+Stencil Plane Function test passed.
+Depth Buffer Clear test passed.
+Depth Buffer Function test passed.
+Blend test passed.
+Dither test passed.
+LogicOp Function test does not exist for an RGB visual.
+DrawPixels test passed.
+CopyPixels test passed.
+Bitmap Rasterization test passed.
+Point Rasterization test passed.
+Anti-aliased Point test passed.
+Line Rasterization test passed.
+Line Stipple test passed.
+Anti-aliased Line test passed.
+Horizontal and Vertical Line test passed.
+Triangle Rasterization test passed.
+Triangle Tile test passed.
+Triangle Stipple test passed.
+Anti-aliased Triangles test passed.
+Quad Rasterization test passed.
+Polygon Face test passed.
+Polygon Cull test passed.
+Polygon Stipple test passed.
+Polygon Edge test passed.
+Ambient Material test passed.
+Ambient Scene test passed.
+Attenuation Position test passed.
+Diffuse Light test passed.
+Diffuse Material test passed.
+Diffuse Material Normal test passed.
+Diffuse Material Positioning test passed.
+Emissive Material test passed.
+Specular Exponent test passed.
+Specular Exponent Normal test passed.
+Specular Local Eye Half Angle test passed.
+Specular Light test passed.
+Specular Material test passed.
+Specular Normal test passed.
+Spot Positioning test passed.
+Spot Exponent and Positioning test passed.
+Spot Exponent and Direction test passed.
+Fog Exponential test passed.
+Fog Linear test passed.
+Texture Decal test passed.
+Texture Border test passed.
+Mipmaps Selection test passed.
+Mipmaps Interpolation test passed.
+Display Lists test passed.
+Evaluator test passed.
+Evaluator Color test passed.
+Texture Edge Clamp test passed.
+Packed Pixels test passed.
+Texture LOD test passed.
+Rescale Normal test passed.
+Color Table test passed.
+Convolution test passed.
+Convolution Border test passed.
+Histogram test passed.
+MinMax test passed.
+MultiTexture test passed.
+
+Conform passed.
+
+----------------------------------------------------------------------
+% conform -v 2 -p 2
+
+OpenGL Conformance Test
+Version 1.2
+
+Setup Report.
+    Verbose level = 2.
+    Random number seed = 1.
+    Path level = 2.
+
+Visual Report.
+    Display ID = 35. Indirect Rendering.
+    Double Buffered.
+    RGBA (5, 6, 5, 0).
+    Stencil (8).
+    Depth (16).
+    Accumulation (16, 16, 16, 16).
+
+Epsilon Report.
+    zero error epsilon = 0.000122.
+    RGBA error epsilon = 0.0324, 0.016, 0.0324, 0.000122.
+    Depth buffer error epsilon = 0.000137.
+    Stencil plane error epsilon = 0.00404.
+    Accumulation error epsilon = 0.000137, 0.000137, 0.000137, 0.000137.
+
+Default State test passed.
+Must Pass test passed.
+Divide By Zero test passed.
+Viewport Clamp test passed.
+Matrix Stack test passed.
+Matrix Stack Mixing test passed.
+Vertex Order test passed.
+Transformations test passed.
+Transformation Normal test passed.
+Viewport Transformation test passed.
+Buffer Clear test passed.
+Buffer Corners test passed.
+Buffer Color test passed.
+Color Ramp test passed.
+Mask test passed.
+Buffer Invariance test passed.
+Accumulation Buffer test passed.
+Select test passed.
+Feedback test passed.
+Scissor test passed.
+Alpha Plane Function test passed.
+Stencil Plane Clear test passed.
+Stencil Plane Corners test passed.
+Stencil Plane Operation test passed.
+Stencil Plane Function test passed.
+Depth Buffer Clear test passed.
+Depth Buffer Function test passed.
+Blend test passed.
+Dither test passed.
+LogicOp Function test does not exist for an RGB visual.
+DrawPixels test passed.
+CopyPixels test passed.
+Bitmap Rasterization test passed.
+Point Rasterization test passed.
+Anti-aliased Point test passed.
+Line Rasterization test passed.
+Line Stipple test passed.
+Anti-aliased Line test passed.
+Horizontal and Vertical Line test passed.
+Triangle Rasterization test passed.
+Triangle Tile test passed.
+Triangle Stipple test passed.
+Anti-aliased Triangles test passed.
+Quad Rasterization test passed.
+Polygon Face test passed.
+Polygon Cull test passed.
+Polygon Stipple test passed.
+Polygon Edge test passed.
+Ambient Material test passed.
+Ambient Scene test passed.
+Attenuation Position test passed.
+Diffuse Light test passed.
+Diffuse Material test passed.
+Diffuse Material Normal test passed.
+Diffuse Material Positioning test passed.
+Emissive Material test passed.
+Specular Exponent test passed.
+Specular Exponent Normal test passed.
+Specular Local Eye Half Angle test passed.
+Specular Light test passed.
+Specular Material test passed.
+Specular Normal test passed.
+Spot Positioning test passed.
+Spot Exponent and Positioning test passed.
+Spot Exponent and Direction test passed.
+Fog Exponential test passed.
+Fog Linear test passed.
+Texture Decal test passed.
+Texture Border test passed.
+Mipmaps Selection test passed.
+Mipmaps Interpolation test passed.
+Display Lists test passed.
+Evaluator test passed.
+Evaluator Color test passed.
+Texture Edge Clamp test passed.
+Packed Pixels test passed.
+Texture LOD test passed.
+Rescale Normal test passed.
+Color Table test passed.
+Convolution test passed.
+Convolution Border test passed.
+Histogram test passed.
+MinMax test passed.
+MultiTexture test passed.
+
+Conform passed.
+
+----------------------------------------------------------------------
+% conform -v 2 -p 3
+
+OpenGL Conformance Test
+Version 1.2
+
+Setup Report.
+    Verbose level = 2.
+    Random number seed = 1.
+    Path level = 3.
+
+Visual Report.
+    Display ID = 35. Indirect Rendering.
+    Double Buffered.
+    RGBA (5, 6, 5, 0).
+    Stencil (8).
+    Depth (16).
+    Accumulation (16, 16, 16, 16).
+
+Epsilon Report.
+    zero error epsilon = 0.000122.
+    RGBA error epsilon = 0.0324, 0.016, 0.0324, 0.000122.
+    Depth buffer error epsilon = 0.000137.
+    Stencil plane error epsilon = 0.00404.
+    Accumulation error epsilon = 0.000137, 0.000137, 0.000137, 0.000137.
+
+Default State test passed.
+Must Pass test passed.
+Divide By Zero test passed.
+Viewport Clamp test passed.
+Matrix Stack test passed.
+Matrix Stack Mixing test passed.
+Vertex Order test passed.
+Transformations test passed.
+Transformation Normal test passed.
+Viewport Transformation test passed.
+Buffer Clear test passed.
+Buffer Corners test passed.
+Buffer Color test passed.
+Color Ramp test passed.
+Mask test passed.
+Buffer Invariance test passed.
+Accumulation Buffer test passed.
+Select test passed.
+Feedback test passed.
+Scissor test passed.
+Alpha Plane Function test passed.
+Stencil Plane Clear test passed.
+Stencil Plane Corners test passed.
+Stencil Plane Operation test passed.
+Stencil Plane Function test passed.
+Depth Buffer Clear test passed.
+Depth Buffer Function test passed.
+Blend test passed.
+Dither test passed.
+LogicOp Function test does not exist for an RGB visual.
+DrawPixels test passed.
+CopyPixels test passed.
+Bitmap Rasterization test passed.
+Point Rasterization test passed.
+Anti-aliased Point test passed.
+Line Rasterization test passed.
+Line Stipple test passed.
+Anti-aliased Line test passed.
+Horizontal and Vertical Line test passed.
+Triangle Rasterization test passed.
+Triangle Tile test passed.
+Triangle Stipple test passed.
+Anti-aliased Triangles test passed.
+Quad Rasterization test passed.
+Polygon Face test passed.
+Polygon Cull test passed.
+Polygon Stipple test passed.
+Polygon Edge test passed.
+Ambient Material test passed.
+Ambient Scene test passed.
+Attenuation Position test passed.
+Diffuse Light test passed.
+Diffuse Material test passed.
+Diffuse Material Normal test passed.
+Diffuse Material Positioning test passed.
+Emissive Material test passed.
+Specular Exponent test passed.
+Specular Exponent Normal test passed.
+Specular Local Eye Half Angle test passed.
+Specular Light test passed.
+Specular Material test passed.
+Specular Normal test passed.
+Spot Positioning test passed.
+Spot Exponent and Positioning test passed.
+Spot Exponent and Direction test passed.
+Fog Exponential test passed.
+Fog Linear test passed.
+Texture Decal test passed.
+Texture Border test passed.
+Mipmaps Selection test passed.
+Mipmaps Interpolation test passed.
+Display Lists test passed.
+Evaluator test passed.
+Evaluator Color test passed.
+Texture Edge Clamp test passed.
+Packed Pixels test passed.
+Texture LOD test passed.
+Rescale Normal test passed.
+Color Table test passed.
+Convolution test passed.
+Convolution Border test passed.
+Histogram test passed.
+MinMax test passed.
+MultiTexture test passed.
+
+Conform passed.
+
+----------------------------------------------------------------------
+% conform -v 2 -p 4
+
+OpenGL Conformance Test
+Version 1.2
+
+Setup Report.
+    Verbose level = 2.
+    Random number seed = 1.
+    Path level = 4.
+
+Visual Report.
+    Display ID = 35. Indirect Rendering.
+    Double Buffered.
+    RGBA (5, 6, 5, 0).
+    Stencil (8).
+    Depth (16).
+    Accumulation (16, 16, 16, 16).
+
+Epsilon Report.
+    zero error epsilon = 0.000122.
+    RGBA error epsilon = 0.0324, 0.016, 0.0324, 0.000122.
+    Depth buffer error epsilon = 0.000137.
+    Stencil plane error epsilon = 0.00404.
+    Accumulation error epsilon = 0.000137, 0.000137, 0.000137, 0.000137.
+
+Default State test passed.
+Must Pass test passed.
+Divide By Zero test passed.
+Viewport Clamp test passed.
+Matrix Stack test passed.
+Matrix Stack Mixing test passed.
+Vertex Order test passed.
+Transformations test passed.
+Transformation Normal test passed.
+Viewport Transformation test passed.
+Buffer Clear test passed.
+Buffer Corners test passed.
+Buffer Color test passed.
+Color Ramp test passed.
+Mask test passed.
+Buffer Invariance test passed.
+Accumulation Buffer test passed.
+Select test passed.
+Feedback test passed.
+Scissor test passed.
+Alpha Plane Function test passed.
+Stencil Plane Clear test passed.
+Stencil Plane Corners test passed.
+Stencil Plane Operation test passed.
+Stencil Plane Function test passed.
+Depth Buffer Clear test passed.
+Depth Buffer Function test passed.
+Blend test passed.
+Dither test passed.
+LogicOp Function test does not exist for an RGB visual.
+DrawPixels test passed.
+CopyPixels test passed.
+Bitmap Rasterization test passed.
+Point Rasterization test passed.
+Anti-aliased Point test passed.
+Line Rasterization test passed.
+Line Stipple test passed.
+Anti-aliased Line test passed.
+Horizontal and Vertical Line test passed.
+Triangle Rasterization test passed.
+Triangle Tile test passed.
+Triangle Stipple test passed.
+Anti-aliased Triangles test passed.
+Quad Rasterization test passed.
+Polygon Face test passed.
+Polygon Cull test passed.
+Polygon Stipple test passed.
+Polygon Edge test passed.
+Ambient Material test passed.
+Ambient Scene test passed.
+Attenuation Position test passed.
+Diffuse Light test passed.
+Diffuse Material test passed.
+Diffuse Material Normal test passed.
+Diffuse Material Positioning test passed.
+Emissive Material test passed.
+Specular Exponent test passed.
+Specular Exponent Normal test passed.
+Specular Local Eye Half Angle test passed.
+Specular Light test passed.
+Specular Material test passed.
+Specular Normal test passed.
+Spot Positioning test passed.
+Spot Exponent and Positioning test passed.
+Spot Exponent and Direction test passed.
+Fog Exponential test passed.
+Fog Linear test passed.
+Texture Decal test passed.
+Texture Border test passed.
+Mipmaps Selection test passed.
+Mipmaps Interpolation test passed.
+Display Lists test passed.
+Evaluator test passed.
+Evaluator Color test passed.
+Texture Edge Clamp test passed.
+Packed Pixels test passed.
+Texture LOD test passed.
+Rescale Normal test passed.
+Color Table test passed.
+Convolution test passed.
+Convolution Border test passed.
+Histogram test passed.
+MinMax test passed.
+MultiTexture test passed.
+
+Conform passed.
+
+
+
+GLX CONFORMANCE TEST
+====================
+
+% conformx -v 2
+
+OpenGL X Conformance Test
+Version 1.1.1
+
+Setup Report.
+    Verbose level = 2.
+    Random number seed = 1.
+    Path inactive.
+
+Visual Report.
+    Display ID = 34. Direct Rendering.
+    Double Buffered.
+    RGBA (8, 8, 8, 0).
+    Stencil (8).
+    Depth (16).
+    Accumulation (16, 16, 16, 16).
+
+Epsilon Report.
+    zero error epsilon = 0.000122.
+    RGBA error epsilon = 0.00404, 0.00404, 0.00404, 0.000122.
+    Depth buffer error epsilon = 0.000137.
+    Stencil plane error epsilon = 0.00404.
+    Accumulation error epsilon = 0.000137, 0.000137, 0.000137, 0.000137.
+
+Default State test passed.
+glReadPixels() test passed.
+Font test passed.
+
+Conformx passed.
+
+
+
+ +NOTE: conformx passes for all machine path levels (-p option). + + + + diff --git a/mesalib/docs/contents.html b/mesalib/docs/contents.html new file mode 100644 index 000000000..d15e6c1e3 --- /dev/null +++ b/mesalib/docs/contents.html @@ -0,0 +1,104 @@ + + +Contents + + + + + + + +Documentation + + +Download / Install + + +Resources + + +User Topics + + +Developer Topics + + +Links + + +Hosted by: +
+
+Sourceforge.net +
+ + + diff --git a/mesalib/docs/debugging.html b/mesalib/docs/debugging.html new file mode 100644 index 000000000..2df62f56e --- /dev/null +++ b/mesalib/docs/debugging.html @@ -0,0 +1,38 @@ + + +Debugging Tips + + + + + +

Debugging Tips

+ +

+ Normally Mesa (and OpenGL) records but does not notify the user of + errors. It is up to the application to call + glGetError to check for errors. Mesa supports an + environment variable, MESA_DEBUG, to help with debugging. If + MESA_DEBUG is defined, a message will be printed to stdout whenever + an error occurs. +

+ +

+ More extensive error checking is done when Mesa is compiled with the + DEBUG symbol defined. You'll have to edit the Make-config file and + add -DDEBUG to the CFLAGS line for your system configuration. You may + also want to replace any optimization flags with the -g flag so you can + use your debugger. After you've edited Make-config type 'make clean' + before recompiling. +

+

+ In your debugger you can set a breakpoint in _mesa_error() to trap Mesa + errors. +

+

+ There is a display list printing/debugging facility. See the end of + src/dlist.c for details. +

+ + + diff --git a/mesalib/docs/demos.html b/mesalib/docs/demos.html new file mode 100644 index 000000000..b4a2cc5e3 --- /dev/null +++ b/mesalib/docs/demos.html @@ -0,0 +1,18 @@ + + +Demos + + + + + +

Demos

+ + + + + + + \ No newline at end of file diff --git a/mesalib/docs/developers.html b/mesalib/docs/developers.html new file mode 100644 index 000000000..410f1ac5e --- /dev/null +++ b/mesalib/docs/developers.html @@ -0,0 +1,51 @@ + + +Developers + + + + + +

Developers

+ +

+Both professional and volunteer developers contribute to Mesa. +

+

+Tungsten Graphics +employs several of the main Mesa developers including Brian Paul +and Keith Whitwell. +Much of the on-going work in Mesa is done through Tungsten Graphics engineering +contracts. +Prominent examples of this work includes: +

+
    +
  • DRI drivers for Intel i965, i945, i915 and other chips +
  • Advanced memory manager and framebuffer object support +
  • Shading language compiler and OpenGL 2.0 support +
  • MiniGLX environment +
+ +

+Other companies including +Intel +and IBM also actively contribute to the project. +

+ +

+Volunteers have made significant contributions to all parts of Mesa, including +complete device drivers. +

+ + +

Custom Development

+

+Contact +Tungsten Graphics +for information about custom development in Mesa, OpenGL, X and other +graphics technologies. +

+ + + + diff --git a/mesalib/docs/devinfo.html b/mesalib/docs/devinfo.html new file mode 100644 index 000000000..0fb816749 --- /dev/null +++ b/mesalib/docs/devinfo.html @@ -0,0 +1,220 @@ + + +Development Notes + + + + + +

Development Notes

+ + +

Adding Extentions

+ +

+To add a new GL extension to Mesa you have to do at least the following. + +

    +
  • + If glext.h doesn't define the extension, edit include/GL/gl.h and add + code like this: +
    +     #ifndef GL_EXT_the_extension_name
    +     #define GL_EXT_the_extension_name 1
    +     /* declare the new enum tokens */
    +     /* prototype the new functions */
    +     /* TYPEDEFS for the new functions */
    +     #endif
    +   
    +
  • +
  • + In the src/mesa/glapi/ directory, add the new extension functions and + enums to the gl_API.xml file. + Then, a bunch of source files must be regenerated by executing the + corresponding Python scripts. +
  • +
  • + Add a new entry to the gl_extensions struct in mtypes.h +
  • +
  • + Update the extensions.c file. +
  • +
  • + From this point, the best way to proceed is to find another extension, + similar to the new one, that's already implemented in Mesa and use it + as an example. +
  • +
  • + If the new extension adds new GL state, the functions in get.c, enable.c + and attrib.c will most likely require new code. +
  • +
+ + + +

Coding Style

+ +

+Mesa's code style has changed over the years. Here's the latest. +

+ +

+Comment your code! It's extremely important that open-source code be +well documented. Also, strive to write clean, easily understandable code. +

+ +

+3-space indentation +

+ +

+If you use tabs, set them to 8 columns +

+ +

+Brace example: +

+
+	if (condition) {
+	   foo;
+	}
+	else {
+	   bar;
+	}
+
+ +

+Here's the GNU indent command which will best approximate my preferred style: +

+
+	indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
+
+ + +

+Local variable name example: localVarName (no underscores) +

+ +

+Constants and macros are ALL_UPPERCASE, with _ between words +

+ +

+Global variables are not allowed. +

+ +

+Function name examples: +

+
+	glFooBar()       - a public GL entry point (in dispatch.c)
+	_mesa_FooBar()   - the internal immediate mode function
+	save_FooBar()    - retained mode (display list) function in dlist.c
+	foo_bar()        - a static (private) function
+	_mesa_foo_bar()  - an internal non-static Mesa function
+
+ + +

Making a New Mesa Release

+ +

+These are the instructions for making a new Mesa release. +

+ +

Get latest source files

+

+Use git to get the latest Mesa files from the git repository, from whatever +branch is relevant. +

+ + +

Verify and update version info

+

+Create/edit the docs/relnotes-x.y.html file to document what's new in the release. +Add the new relnotes-x.y.html file to relnotes.html. +

+ +

+Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in +configs/default. +Also update the VERSION line in the top-level Makefile. +

+ +

+Make sure the values in src/mesa/main/version.h are correct. +

+ +

+Update the docs/news.html file and docs/download.html files. +

+ +

+Check in all updates to git. +

+ +

+Tag the files with the release name (in the form mesa_X_Y) +with: git tag -a mesa_X_Y +Then: git push origin mesa_X_Y +

+ + +

Make the tarballs

+

+Make a symbolic link from $(DIRECTORY) to 'Mesa'. For example, +ln -s Mesa Mesa-7.5 +This is needed in order to make a correct tar file in the next step. +

+ +

+Make the distribution files. From inside the Mesa directory: +

+	make tarballs
+
+ +

+After the tarballs are created, the md5 checksums for the files will +be computed. +Add them to the docs/relnotes-X.Y.html file. +

+ +

+Copy the distribution files to a temporary directory, unpack them, +compile everything, and run some demos to be sure everything works. +

+ +

Update the website and announce the release

+

+Follow the directions on SourceForge for creating a new "release" and +uploading the tarballs. +

+ +

+Basically, to upload the tarball files with: +
+ +rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/ + +

+ +

+Update the web site by copying the docs/ directory's files to +/home/users/b/br/brianp/mesa-www/htdocs/ with: +
+ +sftp USERNAME,mesa3d@web.sourceforge.net + +

+ +

+Make an announcement on the mailing lists: +mesa3d-dev@lists.sf.net, +mesa3d-users@lists.sf.net +and +mesa3d-announce@lists.sf.net +

+ + + + + diff --git a/mesalib/docs/dispatch.html b/mesalib/docs/dispatch.html new file mode 100644 index 000000000..bcab74c70 --- /dev/null +++ b/mesalib/docs/dispatch.html @@ -0,0 +1,274 @@ + + +GL Dispatch in Mesa + + + + +

GL Dispatch in Mesa

+ +

Several factors combine to make efficient dispatch of OpenGL functions +fairly complicated. This document attempts to explain some of the issues +and introduce the reader to Mesa's implementation. Readers already familiar +with the issues around GL dispatch can safely skip ahead to the overview of Mesa's implementation.

+ +

1. Complexity of GL Dispatch

+ +

Every GL application has at least one object called a GL context. +This object, which is an implicit parameter to ever GL function, stores all +of the GL related state for the application. Every texture, every buffer +object, every enable, and much, much more is stored in the context. Since +an application can have more than one context, the context to be used is +selected by a window-system dependent function such as +glXMakeContextCurrent.

+ +

In environments that implement OpenGL with X-Windows using GLX, every GL +function, including the pointers returned by glXGetProcAddress, are +context independent. This means that no matter what context is +currently active, the same glVertex3fv function is used.

+ +

This creates the first bit of dispatch complexity. An application can +have two GL contexts. One context is a direct rendering context where +function calls are routed directly to a driver loaded within the +application's address space. The other context is an indirect rendering +context where function calls are converted to GLX protocol and sent to a +server. The same glVertex3fv has to do the right thing depending +on which context is current.

+ +

Highly optimized drivers or GLX protocol implementations may want to +change the behavior of GL functions depending on current state. For +example, glFogCoordf may operate differently depending on whether +or not fog is enabled.

+ +

In multi-threaded environments, it is possible for each thread to have a +differnt GL context current. This means that poor old glVertex3fv +has to know which GL context is current in the thread where it is being +called.

+ + +

2. Overview of Mesa's Implementation

+ +

Mesa uses two per-thread pointers. The first pointer stores the address +of the context current in the thread, and the second pointer stores the +address of the dispatch table associated with that context. The +dispatch table stores pointers to functions that actually implement +specific GL functions. Each time a new context is made current in a thread, +these pointers a updated.

+ +

The implementation of functions such as glVertex3fv becomes +conceptually simple:

+ +
    +
  • Fetch the current dispatch table pointer.
  • +
  • Fetch the pointer to the real glVertex3fv function from the +table.
  • +
  • Call the real function.
  • +
+ +

This can be implemented in just a few lines of C code. The file +src/mesa/glapi/glapitemp.h contains code very similar to this.

+ +
+ + +
+void glVertex3f(GLfloat x, GLfloat y, GLfloat z)
+{
+    const struct _glapi_table * const dispatch = GET_DISPATCH();
+    
+    (*dispatch->Vertex3f)(x, y, z);
+}
Sample dispatch function
+
+ +

The problem with this simple implementation is the large amount of +overhead that it adds to every GL function call.

+ +

In a multithreaded environment, a niave implementation of +GET_DISPATCH involves a call to pthread_getspecific or a +similar function. Mesa provides a wrapper function called +_glapi_get_dispatch that is used by default.

+ +

3. Optimizations

+ +

A number of optimizations have been made over the years to diminish the +performance hit imposed by GL dispatch. This section describes these +optimizations. The benefits of each optimization and the situations where +each can or cannot be used are listed.

+ +

3.1. Dual dispatch table pointers

+ +

The vast majority of OpenGL applications use the API in a single threaded +manner. That is, the application has only one thread that makes calls into +the GL. In these cases, not only do the calls to +pthread_getspecific hurt performance, but they are completely +unnecessary! It is possible to detect this common case and avoid these +calls.

+ +

Each time a new dispatch table is set, Mesa examines and records the ID +of the executing thread. If the same thread ID is always seen, Mesa knows +that the application is, from OpenGL's point of view, single threaded.

+ +

As long as an application is single threaded, Mesa stores a pointer to +the dispatch table in a global variable called _glapi_Dispatch. +The pointer is also stored in a per-thread location via +pthread_setspecific. When Mesa detects that an application has +become multithreaded, NULL is stored in _glapi_Dispatch.

+ +

Using this simple mechanism the dispatch functions can detect the +multithreaded case by comparing _glapi_Dispatch to NULL. +The resulting implementation of GET_DISPATCH is slightly more +complex, but it avoids the expensive pthread_getspecific call in +the common case.

+ +
+ + +
+#define GET_DISPATCH() \
+    (_glapi_Dispatch != NULL) \
+        ? _glapi_Dispatch : pthread_getspecific(&_glapi_Dispatch_key)
+
Improved GET_DISPATCH Implementation
+
+ +

3.2. ELF TLS

+ +

Starting with the 2.4.20 Linux kernel, each thread is allocated an area +of per-thread, global storage. Variables can be put in this area using some +extensions to GCC. By storing the dispatch table pointer in this area, the +expensive call to pthread_getspecific and the test of +_glapi_Dispatch can be avoided.

+ +

The dispatch table pointer is stored in a new variable called +_glapi_tls_Dispatch. A new variable name is used so that a single +libGL can implement both interfaces. This allows the libGL to operate with +direct rendering drivers that use either interface. Once the pointer is +properly declared, GET_DISPACH becomes a simple variable +reference.

+ +
+ + +
+extern __thread struct _glapi_table *_glapi_tls_Dispatch
+    __attribute__((tls_model("initial-exec")));
+
+#define GET_DISPATCH() _glapi_tls_Dispatch
+
TLS GET_DISPATCH Implementation
+
+ +

Use of this path is controlled by the preprocessor define +GLX_USE_TLS. Any platform capable of using TLS should use this as +the default dispatch method.

+ +

3.3. Assembly Language Dispatch Stubs

+ +

Many platforms has difficulty properly optimizing the tail-call in the +dispatch stubs. Platforms like x86 that pass parameters on the stack seem +to have even more difficulty optimizing these routines. All of the dispatch +routines are very short, and it is trivial to create optimal assembly +language versions. The amount of optimization provided by using assembly +stubs varies from platform to platform and application to application. +However, by using the assembly stubs, many platforms can use an additional +space optimization (see below).

+ +

The biggest hurdle to creating assembly stubs is handling the various +ways that the dispatch table pointer can be accessed. There are four +different methods that can be used:

+ +
    +
  1. Using _glapi_Dispatch directly in builds for non-multithreaded +environments.
  2. +
  3. Using _glapi_Dispatch and _glapi_get_dispatch in +multithreaded environments.
  4. +
  5. Using _glapi_Dispatch and pthread_getspecific in +multithreaded environments.
  6. +
  7. Using _glapi_tls_Dispatch directly in TLS enabled +multithreaded environments.
  8. +
+ +

People wishing to implement assembly stubs for new platforms should focus +on #4 if the new platform supports TLS. Otherwise, implement #2 followed by +#3. Environments that do not support multithreading are uncommon and not +terribly relevant.

+ +

Selection of the dispatch table pointer access method is controlled by a +few preprocessor defines.

+ +
    +
  • If GLX_USE_TLS is defined, method #4 is used.
  • +
  • If PTHREADS is defined, method #3 is used.
  • +
  • If any of PTHREADS, +SOLARIS_THREADS, WIN32_THREADS, or BEOS_THREADS +is defined, method #2 is used.
  • +
  • If none of the preceeding are defined, method #1 is used.
  • +
+ +

Two different techniques are used to handle the various different cases. +On x86 and SPARC, a macro called GL_STUB is used. In the preamble +of the assembly source file different implementations of the macro are +selected based on the defined preprocessor variables. The assmebly code +then consists of a series of invocations of the macros such as: + +

+ + +
+GL_STUB(Color3fv, _gloffset_Color3fv)
+
SPARC Assembly Implementation of glColor3fv
+
+ +

The benefit of this technique is that changes to the calling pattern +(i.e., addition of a new dispatch table pointer access method) require fewer +changed lines in the assembly code.

+ +

However, this technique can only be used on platforms where the function +implementation does not change based on the parameters passed to the +function. For example, since x86 passes all parameters on the stack, no +additional code is needed to save and restore function parameters around a +call to pthread_getspecific. Since x86-64 passes parameters in +registers, varying amounts of code needs to be inserted around the call to +pthread_getspecific to save and restore the GL function's +parameters.

+ +

The other technique, used by platforms like x86-64 that cannot use the +first technique, is to insert #ifdef within the assembly +implementation of each function. This makes the assembly file considerably +larger (e.g., 29,332 lines for glapi_x86-64.S versus 1,155 lines for +glapi_x86.S) and causes simple changes to the function +implementation to generate many lines of diffs. Since the assmebly files +are typically generated by scripts (see below), this +isn't a significant problem.

+ +

Once a new assembly file is created, it must be inserted in the build +system. There are two steps to this. The file must first be added to +src/mesa/sources. That gets the file built and linked. The second +step is to add the correct #ifdef magic to +src/mesa/main/dispatch.c to prevent the C version of the dispatch +functions from being built.

+ + +

3.4. Fixed-Length Dispatch Stubs

+ +

To implement glXGetProcAddress, Mesa stores a table that +associates function names with pointers to those functions. This table is +stored in src/mesa/glapi/glprocs.h. For different reasons on +different platforms, storing all of those pointers is inefficient. On most +platforms, including all known platforms that support TLS, we can avoid this +added overhead.

+ +

If the assembly stubs are all the same size, the pointer need not be +stored for every function. The location of the function can instead be +calculated by multiplying the size of the dispatch stub by the offset of the +function in the table. This value is then added to the address of the first +dispatch stub.

+ +

This path is activated by adding the correct #ifdef magic to +src/mesa/glapi/glapi.c just before glprocs.h is +included.

+ +
+

4. Automatic Generation of Dispatch Stubs

+ + + diff --git a/mesalib/docs/download.html b/mesalib/docs/download.html new file mode 100644 index 000000000..3cb9423dd --- /dev/null +++ b/mesalib/docs/download.html @@ -0,0 +1,136 @@ + + +Getting Mesa + + + + + +

Downloading

+ +

+Primary Mesa download site: +freedesktop.org (FTP) +

+ +

+When a new release is coming, release candidates (betas) may be found +here. +

+ + +

+Mesa is distributed in several parts: +

+
    +
  • MesaLib-x.y.z - the main Mesa library source code, drivers + and documentation. +
  • +
  • MesaDemos-x.y.z - OpenGL demonstration and test programs. + Most of the programs require GLUT (either the + original GLUT by Mark Kilgard or + freeglut or + OpenGLUT). +
  • +
  • MesaGLUT-x.y.z - Mark Kilgard's GLUT, easily compiled and used + with Mesa. Plus, other implementation of GLUT for DOS, OS/2, BeOS, etc. +
  • +
+ +

+If you're not interested in running the demos, you'll only need the first +package. +

+ +

+If you're new to this and not sure what you're doing, grab all three packages. +

+ +

+The packages are available in .tar.gz, .tar.bz2 and .zip formats. +Other sites might offer additional package formats. +

+ +

Unpacking

+ +

+All the packages should be in the same directory prior to unpacking. +

+ +
    +
  • To unpack .tar.gz files: +
    +	tar zxf MesaLib-X.Y.tar.gz
    +	tar zxf MesaDemos-X.Y.tar.gz
    +	tar zxf MesaGLUT-X.Y.tar.gz
    +
    +or +
    +	gzcat MesaLib-X.Y.tar.gz | tar xf -
    +	gzcat MesaDemos-X.Y.tar.gz | tar xf -
    +	gzcat MesaGLUT-X.Y.tar.gz | tar xf -
    +
    +or +
    +	gunzip MesaLib-X.Y.tar.gz ; tar xf MesaLib-X.Y.tar
    +	gunzip MesaDemos-X.Y.tar.gz ; tar xf MesaDemos-X.Y.tar
    +	gunzip MesaGLUT-X.Y.tar.gz ; tar xf MesaGLUT-X.Y.tar
    +
    +
  • To unpack .tar.bz2 files: +
    +	bunzip2 -c MesaLib-X.Y.tar.gz | tar xf -
    +	bunzip2 -c MesaDemos-X.Y.tar.gz | tar xf -
    +	bunzip2 -c MesaGLUT-X.Y.tar.gz | tar xf -
    +
    +
  • To unpack .zip files: +
    +	unzip MesaLib-X.Y.zip
    +	unzip MesaDemos-X.Y.zip
    +	unzip MesaGLUT-X.Y.zip
    +
    +
+ + +

Contents

+ +

+After unpacking you'll have these files and directories (among others): +

+
+Makefile	- top-level Makefile for most systems
+configs/	- makefile parameter files for various systems
+include/	- GL header (include) files
+bin/		- shell scripts for making shared libraries, etc
+docs/		- documentation
+src/		- source code for libraries
+src/mesa	- sources for the main Mesa library and device drivers
+src/glu		- libGLU source code
+src/glx		- sources for building libGL with full GLX and DRI support
+src/glw		- Xt/Motif/OpenGL widget code
+
+ +If you downloaded and unpacked the MesaDemos.X.Y package: + +
+progs/demos	- original Mesa demos
+progs/xdemos	- GLX OpenGL/Mesa demos
+progs/redbook	- examples from the OpenGL Programming Guide
+progs/samples	- examples from SGI
+progs/images/	- image files
+
+ +If you downloaded and unpacked the MesaGLUT.X.Y package: +
+src/glut	- GLUT library source code
+
+ +

+Proceed to the compilation and installation +instructions. +

+ + + + diff --git a/mesalib/docs/envvars.html b/mesalib/docs/envvars.html new file mode 100644 index 000000000..6d7a321da --- /dev/null +++ b/mesalib/docs/envvars.html @@ -0,0 +1,54 @@ + + +Environment Variables + + + + + +

Environment Variables

+ +

+Mesa supports the following environment variables: +

+
    +
  • MESA_NO_ASM - if set, disables all assembly language optimizations +
  • MESA_NO_MMX - if set, disables Intel MMX optimizations +
  • MESA_NO_3DNOW - if set, disables AMD 3DNow! optimizations +
  • MESA_NO_SSE - if set, disables Intel SSE optimizations +
  • MESA_DEBUG - if set, error messages are printed to stderr. +If the value of MESA_DEBUG is "FP" floating point arithmetic errors will +generate exceptions. +
  • MESA_NO_DITHER - if set, disables dithering, overriding glEnable(GL_DITHER) +
  • MESA_TEX_PROG - if set, implement conventional texture env modes with +fragment programs (intended for developers only) +
  • MESA_TNL_PROG - if set, implement conventional vertex transformation +operations with vertex programs (intended for developers only). +Setting this variable automatically sets the MESA_TEX_PROG variable as well. +
  • MESA_EXTENSION_OVERRIDE - can be used to enable/disable extensions. +A value such as "GL_EXT_foo -GL_EXT_bar" will enable the GL_EXT_foo extension +and disable the GL_EXT_bar extension. +
+ +

+The following are only applicable to the Xlib software driver. +See the Xlib software driver page for details. +

+
    +
  • MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode +
  • MESA_CI_VISUAL - specifies the X visual and depth for CI mode +
  • MESA_BACK_BUFFER - specifies how to implement the back color buffer, + either "pixmap" or "ximage" +
  • MESA_GAMMA - gamma correction coefficients for red, green, blue channels +
  • MESA_XSYNC - enable synchronous X behavior (for debugging only) +
  • MESA_GLX_FORCE_CI - if set, force GLX to treat 8bpp visuals as CI visuals +
  • MESA_GLX_FX - set to either "fullscreen" for full-screen rendering, + "window" to render into a window, or "disable" to disable the Glide driver. +
  • MESA_GLX_FORCE_ALPHA - if set, forces RGB windows to have an alpha channel. +
  • MESA_GLX_DEPTH_BITS - specifies default number of bits for depth buffer. +
  • MESA_GLX_ALPHA_BITS - specifies default number of bits for alpha channel. +
+ + + + diff --git a/mesalib/docs/extensions.html b/mesalib/docs/extensions.html new file mode 100644 index 000000000..91ed20e5c --- /dev/null +++ b/mesalib/docs/extensions.html @@ -0,0 +1,35 @@ + + +Mesa Extensions + + + + + +

Mesa Extensions

+ +

+A number of extensions have been developed especially for Mesa. +The specifications follow. +

+ + + + + + + diff --git a/mesalib/docs/faq.html b/mesalib/docs/faq.html new file mode 100644 index 000000000..65e279aac --- /dev/null +++ b/mesalib/docs/faq.html @@ -0,0 +1,397 @@ + + +Mesa FAQ + + + + + + +
+

Mesa Frequently Asked Questions

+Last updated: 21 August 2006 +
+ +
+
+

Index

+1. High-level Questions and Answers +
+2. Compilation and Installation Problems +
+3. Runtime / Rendering Problems +
+4. Developer Questions +
+
+
+ + + + +

1. High-level Questions and Answers

+ +

1.1 What is Mesa?

+

+Mesa is an open-source implementation of the OpenGL specification. +OpenGL is a programming library for writing interactive 3D applications. +See the OpenGL website for more +information. +

+

+Mesa 6.x supports the OpenGL 1.5 specification. +

+ + +

1.2 Does Mesa support/use graphics hardware?

+

+Yes. Specifically, Mesa serves as the OpenGL core for the open-source DRI +drivers for XFree86/X.org. See the DRI +website for more information. +

+

+There have been other hardware drivers for Mesa over the years (such as +the 3Dfx Glide/Voodoo driver, an old S3 driver, etc) but the DRI drivers +are the modern ones. +

+ +

1.3 What purpose does Mesa serve today?

+

+Hardware-accelerated OpenGL implementations are available for most popular +operating systems today. +Still, Mesa serves at least these purposes: +

+
    +
  • Mesa is used as the core of the open-source XFree86/X.org DRI + hardware drivers. +
  • +
  • Mesa is quite portable and allows OpenGL to be used on systems + that have no other OpenGL solution. +
  • +
  • Software rendering with Mesa serves as a reference for validating the + hardware drivers. +
  • +
  • A software implementation of OpenGL is useful for experimentation, + such as testing new rendering techniques. +
  • +
  • Mesa can render images with deep color channels: 16-bit integer + and 32-bit floating point color channels are supported. + This capability is only now appearing in hardware. +
  • +
  • Mesa's internal limits (max lights, clip planes, texture size, etc) can be + changed for special needs (hardware limits are hard to overcome). +
  • +
+ + +

1.4 What's the difference between"Stand-Alone" Mesa and the DRI drivers?

+

+Stand-alone Mesa is the original incarnation of Mesa. +On systems running the X Window System it does all its rendering through +the Xlib API: +

    +
  • The GLX API is supported, but it's really just an emulation of the + real thing. +
  • The GLX wire protocol is not supported and there's no OpenGL extension + loaded by the X server. +
  • There is no hardware acceleration. +
  • The OpenGL library, libGL.so, contains everything (the programming API, + the GLX functions and all the rendering code). +
+

+

+Alternately, Mesa acts as the core for a number of OpenGL hardware drivers +within the DRI (Direct Rendering Infrastructure): +

    +
  • The libGL.so library provides the GL and GLX API functions, a GLX + protocol encoder, and a device driver loader. +
  • The device driver modules (such as r200_dri.so) contain a built-in + copy of the core Mesa code. +
  • The X server loads the GLX module. + The GLX module decodes incoming GLX protocol and dispatches the commands + to a rendering module. + For the DRI, this module is basically a software Mesa renderer. +
+ + + +

1.5 How do I upgrade my DRI installation to use a new Mesa release?

+

+This wasn't easy in the past. +Now, the DRI drivers are included in the Mesa tree and can be compiled +separately from the X server. +Just follow the Mesa compilation instructions. +

+ + +

1.6 Are there other open-source implementations of OpenGL?

+

+Yes, SGI's +OpenGL Sample Implemenation (SI) is available. +The SI was written during the time that OpenGL was originally designed. +Unfortunately, development of the SI has stagnated. +Mesa is much more up to date with modern features and extensions. +

+ +

+Vincent is +an open-source implementation of OpenGL ES for mobile devices. + +

+miniGL +is a subset of OpenGL for PalmOS devices. + +

+TinyGL is a subset of OpenGL. +

+ +

+SoftGL +is an OpenGL subset for mobile devices. +

+ +

+Chromium +isn't a conventional OpenGL implementation (it's layered upon OpenGL), +but it does export the OpenGL API. It allows tiled rendering, sort-last +rendering, etc. +

+ +

+ClosedGL is an OpenGL subset library for TI +graphing calculators. +

+ +

+There may be other open OpenGL implementations, but Mesa is the most +popular and feature-complete. +

+ + + +
+
+ + + +

2. Compilation and Installation Problems

+ + +

2.1 What's the easiest way to install Mesa?

+

+If you're using a Linux-based system, your distro CD most likely already +has Mesa packages (like RPM or DEB) which you can easily install. +

+ + +

2.2 I get undefined symbols such as bgnpolygon, v3f, etc...

+

+You're application is written in IRIS GL, not OpenGL. +IRIS GL was the predecessor to OpenGL and is a different thing (almost) +entirely. +Mesa's not the solution. +

+ + +

2.3 Where is the GLUT library?

+

+GLUT (OpenGL Utility Toolkit) is in the separate MesaGLUT-x.y.z.tar.gz file. +If you don't already have GLUT installed, you should grab the MesaGLUT +package and compile it with the rest of Mesa. +

+ + + +

2.4 What's the proper place for the libraries and headers?

+

+On Linux-based systems you'll want to follow the +Linux ABI standard. +Basically you'll want the following: +

+
    +
  • /usr/include/GL/gl.h - the main OpenGL header +
  • /usr/include/GL/glu.h - the OpenGL GLU (utility) header +
  • /usr/include/GL/glx.h - the OpenGL GLX header +
  • /usr/include/GL/glext.h - the OpenGL extensions header +
  • /usr/include/GL/glxext.h - the OpenGL GLX extensions header +
  • /usr/include/GL/osmesa.h - the Mesa off-screen rendering header +
  • /usr/lib/libGL.so - a symlink to libGL.so.1 +
  • /usr/lib/libGL.so.1 - a symlink to libGL.so.1.xyz +
  • /usr/lib/libGL.so.xyz - the actual OpenGL/Mesa library. xyz denotes the +Mesa version number. +
  • /usr/lib/libGLU.so - a symlink to libGLU.so.1 +
  • /usr/lib/libGLU.so.1 - a symlink to libGLU.so.1.3.xyz +
  • /usr/lib/libGLU.so.xyz - the OpenGL Utility library. xyz denotes the Mesa +version number. +
+

+After installing XFree86/X.org and the DRI drivers, some of these files +may be symlinks into the /usr/X11R6/ tree. +

+

+The old-style Makefile system doesn't install the Mesa libraries; it's +up to you to copy them (and the headers) to the right place. +

+

+The GLUT header and library should go in the same directories. +

+
+
+ + + +

3. Runtime / Rendering Problems

+ +

3.1 Rendering is slow / why isn't my graphics hardware being used?

+

+Stand-alone Mesa (downloaded as MesaLib-x.y.z.tar.gz) doesn't have any +support for hardware acceleration (with the exception of the 3DFX Voodoo +driver). +

+

+What you really want is a DRI or NVIDIA (or another vendor's OpenGL) driver +for your particular hardware. +

+

+You can run the glxinfo program to learn about your OpenGL +library. +Look for the GL_VENDOR and GL_RENDERER values. +That will identify who's OpenGL library you're using and what sort of +hardware it has detected. +

+

+If your DRI-based driver isn't working, go to the +DRI website for trouble-shooting information. +

+ + +

3.2 I'm seeing errors in depth (Z) buffering. Why?

+

+Make sure the ratio of the far to near clipping planes isn't too great. +Look + here for details. +

+

+Mesa uses a 16-bit depth buffer by default which is smaller and faster +to clear than a 32-bit buffer but not as accurate. +If you need a deeper you can modify the parameters to + glXChooseVisual in your code. +

+ + +

3.3 Why Isn't depth buffering working at all?

+

+Be sure you're requesting a depth buffered-visual. If you set the MESA_DEBUG +environment variable it will warn you about trying to enable depth testing +when you don't have a depth buffer. +

+

Specifically, make sure glutInitDisplayMode is being called +with GLUT_DEPTH or glXChooseVisual is being +called with a non-zero value for GLX_DEPTH_SIZE. +

+

This discussion applies to stencil buffers, accumulation buffers and +alpha channels too. +

+ + +

3.4 Why does glGetString() always return NULL?

+

+Be sure you have an active/current OpenGL rendering context before +calling glGetString. +

+ + +

3.5 GL_POINTS and GL_LINES don't touch the right pixels

+

+If you're trying to draw a filled region by using GL_POINTS or GL_LINES +and seeing holes or gaps it's because of a float-to-int rounding problem. +But this is not a bug. +See Appendix H of the OpenGL Programming Guide - "OpenGL Correctness Tips". +Basically, applying a translation of (0.375, 0.375, 0.0) to your coordinates +will fix the problem. +

+ +

3.6 How can I change the maximum framebuffer size in Mesa's +swrast backend?

+

+These can be overridden by using the --with-max-width and +--with-max-height options. The two need not be equal. +

+Do note that Mesa uses these values to size some internal buffers, +so increasing these sizes will cause Mesa to require additional +memory. Furthermore, increasing these limits beyond 4096 +may introduce rasterization artifacts; see the leading comments in +src/mesa/swrast/s_tritemp.h. +

+ +
+
+ + + +

4. Developer Questions

+ +

4.1 How can I contribute?

+

+First, join the Mesa3d-dev +mailing list. +That's where Mesa development is discussed. +

+

+The +OpenGL Specification is the bible for OpenGL implemention work. +You should read it. +

+

Most of the Mesa development work involves implementing new OpenGL +extensions, writing hardware drivers (for the DRI), and code optimization. +

+ +

4.2 How do I write a new device driver?

+

+Unfortunately, writing a device driver isn't easy. +It requires detailed understanding of OpenGL, the Mesa code, and your +target hardware/operating system. +3D graphics are not simple. +

+

+The best way to get started is to use an existing driver as your starting +point. +For a software driver, the X11 and OSMesa drivers are good examples. +For a hardware driver, the Radeon and R200 DRI drivers are good examples. +

+

The DRI website has more information about writing hardware drivers. +The process isn't well document because the Mesa driver interface changes +over time, and we seldome have spare time for writing documentation. +That being said, many people have managed to figure out the process. +

+

+Joining the appropriate mailing lists and asking questions (and searching +the archives) is a good way to get information. +

+ + +

4.3 Why isn't GL_EXT_texture_compression_s3tc implemented in Mesa?

+

+The specification for the extension +indicates that there are intellectual property (IP) and/or patent issues +to be dealt with. +

+

We've been unsucessful in getting a response from S3 (or whoever owns +the IP nowadays) to indicate whether or not an open source project can +implement the extension (specifically the compression/decompression +algorithms). +

+

+In the mean time, a 3rd party plug-in library is available. +

+ + + + diff --git a/mesalib/docs/fbdev-dri.html b/mesalib/docs/fbdev-dri.html new file mode 100644 index 000000000..e941b1679 --- /dev/null +++ b/mesalib/docs/fbdev-dri.html @@ -0,0 +1,341 @@ +Mesa fbdev/DRI Environment + + + + + + + +

Mesa fbdev/DRI Drivers

+
+ +

1. Introduction

+ +

+The fbdev/DRI environment supports hardware-accelerated 3D rendering without +the X window system. This is typically used for embedded applications. +

+ +

+Contributors to this project include Jon Smirl, Keith Whitwell and Dave Airlie. +

+ +

+Applications in the fbdev/DRI environment use +the MiniGLX interface to choose pixel +formats, create rendering contexts, etc. It's a subset of the GLX and +Xlib interfaces allowing some degree of application portability between +the X and X-less environments. +

+ +

+Note that this environment is not well-supported and these instructions +may not be completely up to date. +

+
+ + + +

2. Compilation

+

+ +

2.1 glxproto

+ +Get glxproto.h. Copy it to the /mesa/include/GL/ directory. +

+ +

2.2 libpciaccess

+

+Check if you have libpciaccess installed: +

+ +
pkg-config --modversion pciaccess
+
+

+If not you can download the latest code from: +

+
   git clone git://anongit.freedesktop.org/git/xorg/lib/libpciaccess
+
+

+Run autogen.sh to generate a configure file. autogen.sh uses autoconf +utility. This utility may not be installed with your linux distro, +check if it is available. if not you can use your package manager or +type: +

+
sudo apt-get install autoconf
+
+The next step is to install the libpciaccess library. +
make
+make install
+
+

Now your libpciaccess.a file is saved into /usr/local/lib +directory. If you have a libpciaccess.a in /usr/lib you may simply copy +and overwrite these files. Don't forget to copy libpciaccess.pc file to +/usr/lib/pkgconfig, which is also located in /usr/local/lib/pkgconfig/. +Or you may use the following system variables: +

+
export LD_LIBRARY_PATH=/usr/local/lib
+export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
+
+ +

2.3 drm

+ +

The next step is to compile the drm. DRM consists of two seperate parts, +the DRM client library(lindrm.so) and kernel device module(such as +radeon.ko). We need to make a small change in kernel device module. So +you need to download the kernel source. You may choose the nearest +mirror from www.kernel.org, or you are using Fedora Core 5, for +example, you may need to install RPMs such as: +kernel-smp-devel-2.16.15-1.2054_FC5.i686.rpm +kernel-devel-2.6.15-1.2054_FC5.i686.rpm +etc. You can find a detailed information here. +

+ +

You will find drm_drv.c at /usr/src/LINUX-VERSION/drivers/char/drm/. Edit this code and comment out the following part: +

+ +
+   /* ||
+   ((ioctl->flags & DRM_MASTER) && !priv->master)*/
+
+Now you are ready to compile your kernel. If your kernel version is +identical to the version you have compiled, you can simply over write +your new "ko" files over older ones. If you have compiled a different +kernel, you must configure your grub or lilo to be able to boot your +new kernel.

+You'll need fbdev header files. Check with: +

+
+   ls -l /usr/include/linux/fb.
+
+

This file may be missing if you have not installed linux header files. + + +

2.4 Mesa

+ +

Get latest development Mesa sources from git repository +(currently 7.1-prerelease) +

+
+   git clone git://anongit.freedesktop.org/git/mesa/mesa
+
+ +

You will need the makedepend utility which is a part of mesa project +to build your linux-solo. You probably wont have this utility. You can +download its source from following git repulsitory: +

+
+   git clone git://anongit.freedesktop.org/git/xorg/util/makedepend
+
+ +

Get the latest stable mesa version from SourceForge (currently 7.0.3) +http://sourceforge.net/project/showfiles.php?group_id=3 +

+ +

Copy the miniglx folder from 7.1-prerelease to 7.0.3. +You may also extract GLUT to 7.0.3 version at this step. +

+ +

Edit linux-solo.conf at /conf directory, just only compile the +graphics driver you need, delete the unwanted drivers names from the +list(some drivers are causing problems...) +

+
+   while(build==0)
+   {
+     make linux-solo
+
+     There will be some missing header files, copy them from 7.1-prerelease
+   }
+
+ +

+When complete you should have the following: +

+
    +
  • lib/libGL.so - the GL library which applications link with +
  • lib/*_dri_so - DRI drivers +
  • lib/miniglx.conf - sample MiniGLX config file +
  • progs/miniglx/* - several MiniGLX sample programs +
+ +To install these files into appropriate locations in system: +
+   make install
+
+ +Now your openGL libraries are copied to /usr/local/lib and +miniglx.conf is copied to /etc. You may copy them to /usr/lib and +overwrite your old GL libraries. Or you may export following variable: + +
+   export LIBGL_DRIVERS_PATH=/usr/local/lib
+
+
+ + +

3. Using fbdev/DRI

+ +

+If an X server currently running, exit/stop it so you're working from +the console. Following command shuts down the x window and also the multi user support. +

+
+   init 1
+
+ +

Also you may define the runlevel as 1 in "/etc/inittab". Your system +will always start in single user mode and without x-window with this +option set. +

3.1 Load Kernel Modules

+ +

+You'll need to load the kernel modules specific to your graphics hardware. +Typically, this consists of the agpgart module, an fbdev driver module +and the DRM kernel module. +

+

+As root, the kernel modules can be loaded as follows: +

+ +

+If you have Intel i915/i945 hardware: +

+
   modprobe agpgart            # the AGP GART module
+   modprobe intelfb            # the Intel fbdev driver
+   modprobe i915               # the i915/945 DRI kernel module
+
+ +

+If you have ATI Radeon/R200 hardware: +

+
   modprobe agpgart            # the AGP GART module
+   modprobe radeonfb           # the Radeon fbdev driver
+   modprobe radeon             # the Radeon DRI kernel module
+
+ +

+If you have ATI Rage 128 hardware: +

+
   modprobe agpgart            # the AGP GART module
+   modprobe aty128fb           # the Rage 128 fbdev driver
+   modprobe r128               # the Rage 128 DRI kernel module
+
+ +

+If you have Matrox G200/G400 hardware: +

+
   modprobe agpgart            # the AGP GART module
+   modprobe mgafb              # the Matrox fbdev driver
+   modprobe mga                # the Matrox DRI kernel module
+
+ +

+To verify that the agpgart, fbdev and drm modules are loaded: +

+
   ls -l /dev/agpgart /dev/fb* /dev/dri
+
+

+Alternately, use lsmod to inspect the currently installed modules. +If you have problems, look at the output of dmesg. +

+ + +

3.2 Configuration File

+ +

+review/edit /etc/miniglx.conf. +Alternately, the MINIGLX_CONF environment variable can be used to +indicate the location of miniglx.conf +

+ +To determine the pciBusID value, run lspci and examine the output. +For example: +

+
   /sbin/lspci:
+   00:02.0 VGA compatible controller: Intel Corporation 82915G/GV/910GL Express Chipset Family Graphics Controller (rev 04)
+
+

+00:02.0 indicates that pciBusID should be PCI:0:2:0 +

+ + + + +

3.3 Running fbdev/DRI Programs

+ +

+Make sure your LD_LIBRARY_PATH environment variable is set to the +location of the libGL.so library. You may need to append other paths +to LD_LIBRARY_PATH if libpciaccess.so is in a non-standard location, +for example. +

+ +

+Change to the Mesa/progs/miniglx/ directory and +start the sample_server program in the background: +

+
   ./sample_server &
+
+ +

+Then try running the miniglxtest program: +

+
   ./miniglxtest
+
+

+You should see a rotating quadrilateral which changes color as it rotates. +It will exit automatically after a bit. +

+ +

+If you run other tests in the miniglx/ directory, you may want to run +them from a remote shell so that you can stop them with ctrl-C. +

+
+ + +

4.0 Troubleshooting

+ +
    +
  1. +If you try to run miniglxtest and get the following: +
    +
       [miniglx] failed to probe chipset
    +   connect: Connection refused
    +   server connection lost
    +
    +It means that the sample_server process is not running. +
    +
    +
  2. +
+ + +

5.0 Programming Information

+ +

+OpenGL/Mesa is interfaced to fbdev via the MiniGLX +interface. +MiniGLX is a subset of Xlib and GLX API functions which provides just +enough functionality to setup OpenGL rendering and respond to simple +input events. +

+ +

+Since MiniGLX is a subset of the usual Xlib and GLX APIs, programs written +to the MiniGLX API can also be run on full Xlib/GLX implementations. +This allows some degree of flexibility for software development and testing. +

+ +

+However, the MiniGLX API is not binary-compatible with full Xlib/GLX. +Some of the structures are different and some macros/functions work +differently. +See the GL/miniglx.h header file for details. +

+ + + + + diff --git a/mesalib/docs/games.html b/mesalib/docs/games.html new file mode 100644 index 000000000..dcf5cf2d0 --- /dev/null +++ b/mesalib/docs/games.html @@ -0,0 +1,64 @@ + + +Games + + + + + +

Games

+ + + + + + \ No newline at end of file diff --git a/mesalib/docs/glfbdev-driver.html b/mesalib/docs/glfbdev-driver.html new file mode 100644 index 000000000..981df7c08 --- /dev/null +++ b/mesalib/docs/glfbdev-driver.html @@ -0,0 +1,111 @@ + + +Mesa glFBDev Driver + + + + + +

Mesa glFBDev Driver

+ + +

1. Introduction

+ +

+The GLFBDev driver interface allows one to do OpenGL rendering into a +framebuffer managed with the Linux's fbdev interface. +

+ +

+Basically, the programmer uses the fbdev functions to initialize the +graphics hardware and setup the framebuffer. +Then, using a calls to Mesa's glFBDev API functions, one can render +into the framebuffer with the OpenGL API functions. +

+ +

+Note, only software rendering is supported; there is no hardware +acceleration. +

+ + +

+The GL/glfbdev.h header file defines the glFBDev interface. +

+ +

+The progs/fbdev/glfbdevtest.c demonstrates how to use the glFBDev interface. +

+ + +

+For more information about fbdev, see the + +Framebuffer Howto +

+

+You will need at minimum, a framebuffer device, check /dev/fb0 +

+ +

2. Compilation

+ +

+To compile Mesa with support for the glFBDev interface: +

+      make realclean
+      make linux-fbdev
+
+ +

+When compilation is finished look in progs/glfbdev/ for the glfbdevtest demo. +

+

3. Permissions

+ +

+Typically /dev/fb/0 is grouped to the video group. It may be useful to add +your user to the video group so the demos will not have to be run as root. +To use fbdevglut with the prefered tty input, you should add the user to the +tty group as well +

+ +

4. Using fbdevglut

+Almost all of the programs in the progs directory use glut, and they compile with fbdevglut. + +

+To compile the redbook sample programs: +

+       cd progs/redbook
+       make
+
+

+

glut features not supported: +

  • Overlays +
  • Subwindows +
  • Input devices other than Keyboard/Mouse +
  • No support for GLUT_MULTISAMPLE, GLUT_STEREO, or GLUT_LUMINANCE +
  • Cursor and Menu Support will flicker in GLUT_SINGLE mode + +

    Keyboard input is read by opening /dev/tty and reading keycodes in medium raw mode. +

    Mouse input is read from env var MOUSE, or /dev/gpmdata and should be in ms3 format. +To forward data in this format to /dev/gpmdata, run gpm with the -Rms3 option. +

    glutInit allows glut programs to pass parameters to the glut library, currently the +following options are supported for fbdevglut: +

  • -geometry widthxheight -- This will force the resolution to be widthxheight instead of autodetecting. +The modes are read from /etc/fb.modes +

  • -bpp -- This will force the bitdepth to the one specified +

  • -vt -- This allows you to specify the virtual terminal to attach keyboard input to. It is useful to specify when running inside screen. +

  • -mousespeed -- A floating point multiplication factor to increase mouse speed +

  • -nomouse -- Disable mouse support +

  • -nokeyboard -- Disable keyboard support (this will probably break mouse support as well) +

  • -stdin -- Use stdin for input instead of attaching to kbd in medium-raw mode. +This will make it impossible to detect keypresses like Shift+Tab, you will also need to specify -gpmmouse for mouse support. This option can be used with a debugger, and it is possible to single step a program with gdb and set the FRAMEBUFFER environment variable to a different framebuffer for display. The program will not be able to handle vt switching on it's own, so it will always display. +

  • -gpmmouse -- This will attempt to connect to the /dev/gpmctl socket using liblow +for mouse data. Gpm does not provide this data when in graphics mode, so vt switching +will briefly display text. This mode typically has no initial mouse delay. +

  • -- Ignore any additional arguments +

    Notes: +

    +1. The mouse pointer flickers in single buffering mode, as it must be rendered in software. Hopefully in the future there will be a way to access hardware cursors in fbdev devices. +

    + + diff --git a/mesalib/docs/glu.html b/mesalib/docs/glu.html new file mode 100644 index 000000000..8adaf42bc --- /dev/null +++ b/mesalib/docs/glu.html @@ -0,0 +1,45 @@ + + +SGI GLU + + + + + +

    SGI SI GLU

    + +(Silicon Graphics, Inc. Sample Implementation of the OpenGL Utility library) + +

    +SGI open-sourced their OpenGL Sample Implementation (SI) in January, 2000. +This includes the GLU library. +

    + +

    +The SI GLU library implements GLU version 1.3 whereas the original +Mesa GLU library only implemented version 1.2. +We recommend using the SI GLU library instead of Mesa's GLU library +since it's more up-to-date, complete and reliable. +We're no longer developing the original Mesa GLU library. +

    + +

    +The SI GLU library code is included in the Mesa distribution. +You don't have to download it separately. +

    + + +

    +Olivier Michel has made Linux RPMs of GLU for i386 and PowerPC. +You can download them from the +download area under Miscellaneous. +

    + +

    +Visit the +OpenGL Sample Implementation home page for more information about the SI. +

    + + + diff --git a/mesalib/docs/helpwanted.html b/mesalib/docs/helpwanted.html new file mode 100644 index 000000000..34afe49f7 --- /dev/null +++ b/mesalib/docs/helpwanted.html @@ -0,0 +1,74 @@ + + +Help Wanted + + + + + +

    Help Wanted / To-Do List

    + +

    +We can always use more help with the Mesa project. +Here are some specific ideas and areas where help would be appreciated: +

    + +
      +
    1. +Driver patching and testing. +Patches are often posted to the mesa3d-dev mailing list, but aren't +immediately checked into git because not enough people are testing them. +Just applying patches, testing and reporting back is helpful. +
    2. +Driver debugging. +There are plenty of open bugs in the bug database. +
    3. +Remove aliasing warnings. +Enable gcc -Wstrict-aliasing=2 -fstrict-aliasing and track down aliasing +issues in the code. +
    4. +Windows driver building, testing and maintenance. +The Visual Studio project files aren't always updated in a timely manner +when new source files are added or old ones are removed. +Fixing these tends to delay new Mesa releases. +
    5. +Maintenance and testing of lesser-used drivers. +Drivers such as DOS/DJGPP, GGI, etc that aren't being maintained are being +deprecated starting in Mesa 7.3. +
    6. +Contribute more tests to +glean. +
    7. +Automatic testing. + +It would be great if someone would set up an automated system for grabbing +the latest Mesa code and run tests (such as glean) then report issues to +the mailing list. +
    + + +

    +If you want to do something new in Mesa, first join the Mesa developer's +mailing list. +Then post a message to propose what you want to do, just to make sure +there's no issues. +

    + +

    +Anyone is welcome to contribute code to the Mesa project. +By doing so, it's assumed that you agree to the code's licensing terms. +

    + +

    +Finally: +

    + +

      +
    1. Try to write high-quality code that follows the existing style. +
    2. Use uniform indentation, write comments, use meaningful identifiers, etc. +
    3. Test your code thoroughly. Include test programs if appropriate. +
    + + + + diff --git a/mesalib/docs/index.html b/mesalib/docs/index.html new file mode 100644 index 000000000..eec4d725c --- /dev/null +++ b/mesalib/docs/index.html @@ -0,0 +1,29 @@ + + + + +Mesa Home Page + + + + + + + + + + + + + + + +<p>Sorry, this site requires frame support</p> + + + + + diff --git a/mesalib/docs/install.html b/mesalib/docs/install.html new file mode 100644 index 000000000..953d2094d --- /dev/null +++ b/mesalib/docs/install.html @@ -0,0 +1,411 @@ + + +Compiling and Installing + + + + + + +

    Compiling and Installing

    + +
      +
    1. Unix / X11 + +
    2. Windows +
    3. SCons +
    4. Other +
    +
    + + + +

    1. Unix/X11 Compilation and Installation

    + + +
    +

    1.1 Prerequisites for DRI and hardware acceleration

    + +

    +The following are required for DRI-based hardware acceleration with Mesa 7.3: +

    + +
      +
    • dri2proto version 1.99.3 or later +
    • Linux 2.6.28 +
    • libDRM +version 2.4.3 or later +
    • Xorg server version 1.5 or later +
    +

    + + + +

    1.2 Building with Autoconf

    + +

    +Mesa may be built using autoconf. +This should work well on most GNU-based systems. +If that fails the traditional Mesa build system is available. + + + + +

    1.3 Building with traditional Makefiles

    + +

    +The traditional Mesa build system is based on a collection of pre-defined +system configurations. +

    +

    +To see the list of configurations, just type make. +Then choose a configuration from the list and type make +configname. +

    + +

    +Mesa may be built in several different ways using the predefined configurations: +

    +
      +
    • Stand-alone/Xlib mode - Mesa will be compiled as +a software renderer using Xlib to do all rendering. +The libGL.so library will be a self-contained rendering library that will +allow you to run OpenGL/GLX applications on any X server (regardless of +whether it supports the GLX X server extension). +You will not be able to use hardware 3D acceleration. +

      +To compile stand-alone Mesa type make in the top-level directory. +You'll see a list of supported system configurations. +Choose one from the list (such as linux-x86), and type: +

      +
      +    make linux-x86
      +
      +

      This will produce libGL.so and several other libraries

      +
    • + +
    • DRI/accelerated - The DRI hardware drivers for +accelerated OpenGL rendering (for ATI, Intel, Matrox, etc) will be built. +The libGL.so library will support the GLX extension and will load/use +the DRI hardware drivers. + + +

      +Build Mesa and the DRI hardware drivers by running +

      +
      +   make linux-dri
      +
      +

      +There are also linux-dri-x86, linux-dri-x86-64, +and linux-ppc configurations which are optimized for those +architectures. +

      +

      +Make sure you have the prerequisite versions of DRM and Xserver mentioned +above. +

      + +
    • + +
    + + +

    +Later, if you want to rebuild for a different configuration run +make realclean before rebuilding. +

    + + +
    +

    1.4 The libraries

    + +

    +When compilation has finished, look in the top-level lib/ +(or lib64/) directory. +You'll see a set of library files similar to this: +

    +
    +lrwxrwxrwx    1 brian    users          10 Mar 26 07:53 libGL.so -> libGL.so.1*
    +lrwxrwxrwx    1 brian    users          19 Mar 26 07:53 libGL.so.1 -> libGL.so.1.5.060100*
    +-rwxr-xr-x    1 brian    users     3375861 Mar 26 07:53 libGL.so.1.5.060100*
    +lrwxrwxrwx    1 brian    users          11 Mar 26 07:53 libGLU.so -> libGLU.so.1*
    +lrwxrwxrwx    1 brian    users          20 Mar 26 07:53 libGLU.so.1 -> libGLU.so.1.3.060100*
    +-rwxr-xr-x    1 brian    users      549269 Mar 26 07:53 libGLU.so.1.3.060100*
    +lrwxrwxrwx    1 brian    users          12 Mar 26 07:53 libglut.so -> libglut.so.3*
    +lrwxrwxrwx    1 brian    users          16 Mar 26 07:53 libglut.so.3 -> libglut.so.3.7.1*
    +-rwxr-xr-x    1 brian    users      597754 Mar 26 07:53 libglut.so.3.7.1*
    +lrwxrwxrwx    1 brian    users          11 Mar 26 08:04 libGLw.so -> libGLw.so.1*
    +lrwxrwxrwx    1 brian    users          15 Mar 26 08:04 libGLw.so.1 -> libGLw.so.1.0.0*
    +-rwxr-xr-x    1 brian    users       20750 Mar 26 08:04 libGLw.so.1.0.0*
    +lrwxrwxrwx    1 brian    users          14 Mar 26 07:53 libOSMesa.so -> libOSMesa.so.6*
    +lrwxrwxrwx    1 brian    users          23 Mar 26 07:53 libOSMesa.so.6 -> libOSMesa.so.6.1.060100*
    +-rwxr-xr-x    1 brian    users       23871 Mar 26 07:53 libOSMesa.so.6.1.060100*
    +
    + +

    +libGL is the main OpenGL library (i.e. Mesa). +
    +libGLU is the OpenGL Utility library. +
    +libglut is the GLUT library. +
    +libGLw is the Xt/Motif OpenGL drawing area widget library. +
    +libOSMesa is the OSMesa (Off-Screen) interface library. +

    + +

    +If you built the DRI hardware drivers, you'll also see the DRI drivers: +

    +
    +-rwxr-xr-x   1 brian users 15607851 Jul 21 12:11 ffb_dri.so
    +-rwxr-xr-x   1 brian users 15148747 Jul 21 12:11 i810_dri.so
    +-rwxr-xr-x   1 brian users 14497814 Jul 21 12:11 i830_dri.so
    +-rwxr-xr-x   1 brian users 16895413 Jul 21 12:11 i915_dri.so
    +-rwxr-xr-x   1 brian users 11320803 Jul 21 12:11 mach64_dri.so
    +-rwxr-xr-x   1 brian users 11418014 Jul 21 12:12 mga_dri.so
    +-rwxr-xr-x   1 brian users 11064426 Jul 21 12:12 r128_dri.so
    +-rwxr-xr-x   1 brian users 11849858 Jul 21 12:12 r200_dri.so
    +-rwxr-xr-x   1 brian users 16050488 Jul 21 12:11 r300_dri.so
    +-rwxr-xr-x   1 brian users 11757388 Jul 21 12:12 radeon_dri.so
    +-rwxr-xr-x   1 brian users 11232304 Jul 21 12:13 s3v_dri.so
    +-rwxr-xr-x   1 brian users 11062970 Jul 21 12:13 savage_dri.so
    +-rwxr-xr-x   1 brian users 11214212 Jul 21 12:13 sis_dri.so
    +-rwxr-xr-x   1 brian users 11368736 Jul 21 12:13 tdfx_dri.so
    +-rwxr-xr-x   1 brian users 10598868 Jul 21 12:13 trident_dri.so
    +-rwxr-xr-x   1 brian users 10997120 Jul 21 12:13 unichrome_dri.so
    +
    + + +
    +

    1.5 Running the demos

    + +

    +If you downloaded/unpacked the MesaDemos-x.y.z.tar.gz archive or +obtained Mesa from CVS, the progs/ directory will contain a +bunch of demonstration programs. +

    + +

    +Before running a demo, you'll probably have to set two environment variables +to indicate where the libraries are located. For example: +

    +

    +cd lib/ +
    +export LD_LIBRARY_PATH=${PWD} +
    +export LIBGL_DRIVERS_PATH=${PWD} (if using DRI drivers) +
    + +

    +Next, change to the Mesa/demos/ directory: +

    +
    +cd ../progs/demos +
    + +

    +Run a demo such as gears: +

    +
    +./gears +
    + +

    +If this doesn't work, try the Mesa/progs/xdemos/glxinfo program +and see that it prints the expected Mesa version number. +

    + +

    +If you're using Linux or a similar OS, verify that the demo program is +being linked with the proper library files: +

    +
    +ldd gears +
    + +

    +You should see something like this: +

    +
    +        libglut.so.3 => /home/brian/Mesa/lib/libglut.so.3 (0x40013000)
    +        libGLU.so.1 => /home/brian/Mesa/lib/libGLU.so.1 (0x40051000)
    +        libGL.so.1 => /home/brian/Mesa/lib/libGL.so.1 (0x400e0000)
    +        libc.so.6 => /lib/i686/libc.so.6 (0x42000000)
    +        libm.so.6 => /lib/i686/libm.so.6 (0x403da000)
    +        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x403fc000)
    +        libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x404da000)
    +        libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x404f1000)
    +        libXi.so.6 => /usr/X11R6/lib/libXi.so.6 (0x40543000)
    +        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4054b000)
    +        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x405fd000)
    +        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x40605000)
    +        libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40613000)
    +        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
    +        libdl.so.2 => /lib/libdl.so.2 (0x40644000)
    +        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x40647000)
    +        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x40650000)
    +
    + +

    +Retrace your steps if this doesn't look right. +

    + + +
    +

    1.6 Installing the header and library files

    + +

    +The standard location for the OpenGL header files on Unix-type systems is +in /usr/include/GL/. +The standard location for the libraries is /usr/lib/. +For more information see, the + +Linux/OpenGL ABI specification. +

    + +

    +If you'd like Mesa to co-exist with another implementation of OpenGL that's +already installed, you'll have to choose different directories, like +/usr/local/include/GL/ and /usr/local/lib/. +

    + +

    +To install Mesa's headers and libraries, run make install. +But first, check the Mesa/configs/default file and examine the values +of the INSTALL_DIR and DRI_DRIVER_INSTALL_DIR variables. +Change them if needed, then run make install. +

    + +

    +The variable +DESTDIR may also be used to install the contents to a temporary +staging directory. +This can be useful for package management. +For example: make install DESTDIR=/somepath/ +

    + +

    +Note: at runtime you can use the LD_LIBRARY_PATH environment variable +(on Linux at least) to switch +between the Mesa libraries and other vendor's libraries whenever you want. +This is a handy way to compare multiple OpenGL implementations. +

    + + + +

    1.7 Building OpenGL programs with pkg-config

    + +

    +Running make install will install package configuration files +for the pkg-config utility. +

    + +

    +When compiling your OpenGL application you can use pkg-config to determine +the proper compiler and linker flags. +

    + +

    +For example, compiling and linking a GLUT application can be done with: +

    +
    +   gcc `pkg-config --cflags --libs glut` mydemo.c -o mydemo
    +
    + +
    + +
    +

    2. Windows Compilation and Installation

    + +

    +Please see the instructions on building with SCons. +Alternatively see README.WIN32 file. +

    + + + + +

    3. Building with SCons

    + +

    +To build Mesa with SCons on Linux or Windows do +

    +
    +    scons
    +
    +

    +The build output will be placed in +build/platform-machine-debug/..., where platform is for +example linux or windows, machine is x86 or x86_64, optionally followed +by -debug for debug builds. +

    + +

    +The sample programs are built seperately. To build them do +

    +    scons -C progs
    +
    +And the build output will be placed in progs/build/... +

    + +

    +To build Mesa with SCons for Windows on Linux using the MinGW crosscompiler toolchain do +

    +
    +    scons platform=windows toolchain=crossmingw machine=x86 statetrackers=mesa drivers=softpipe,trace winsys=gdi
    +    scons -C progs platform=windows toolchain=crossmingw machine=x86 -k
    +
    +

    +This will create: +

    +
      +
    • build/windows-x86-debug/gallium/winsys/gdi/opengl32.dll — Mesa + Gallium + softpipe, binary compatible with Windows's opengl32.dll +
    • build/windows-x86-debug/glut/glx/glut32.dll +
    • progs/build/windows-x86-debug/wgl/wglinfo.exe +
    • progs/build/windows-x86-debug/trivial/tri.exe +
    • and many other samples in progs/build/windows-x86-debug/... +
    +

    +Put them all in the same directory to test them. +

    + + +
    +

    4. Other systems

    + +

    +Documentation for other environments (some may be very out of date): +

    + +
    + + + + + + diff --git a/mesalib/docs/intro.html b/mesalib/docs/intro.html new file mode 100644 index 000000000..aae2e6e19 --- /dev/null +++ b/mesalib/docs/intro.html @@ -0,0 +1,315 @@ + + +Mesa Introduction + + + + + +

    Introduction

    + +

    +Mesa is an open-source implementation of the +OpenGL specification - +a system for rendering interactive 3D graphics. +

    + +

    +A variety of device drivers allows Mesa to be used in many different +environments ranging from software emulation to complete hardware acceleration +for modern GPUs. +

    + +

    +Mesa ties into several other open-source projects: the +Direct Rendering +Infrastructure and X.org to +provide OpenGL support to users of X on Linux, FreeBSD and other operating +systems. +

    + + + +

    Project History

    + +

    +The Mesa project was originally started by Brian Paul. +Here's a short history of the project. +

    + +

    +August, 1993: I begin working on Mesa in my spare time. The project +has no name at that point. I was simply interested in writing a simple +3D graphics library that used the then-new OpenGL API. I was partially +inspired by the VOGL library which emulated a subset of IRIS GL. +I had been programming with IRIS GL since 1991. +

    + +

    +November 1994: I contact SGI to ask permission to distribute my OpenGL-like +graphics library on the internet. SGI was generally receptive to the +idea and after negotiations with SGI's legal department, I get permission +to release it. +

    + +

    +February 1995: Mesa 1.0 is released on the internet. I expected that +a few people would be interested in it, but not thousands. +I was soon receiving patches, new features and thank-you notes on a +daily basis. That encouraged me to continue working on Mesa. The +name Mesa just popped into my head one day. SGI had asked me not to use +the terms "Open" or "GL" in the project name and I didn't +want to make up a new acronym. Later, I heard of the Mesa programming +language and the Mesa spreadsheet for NeXTStep. +

    + +

    +In the early days, OpenGL wasn't available on too many systems. +It even took a while for SGI to support it across their product line. +Mesa filled a big hole during that time. +For a lot of people, Mesa was their first introduction to OpenGL. +I think SGI recognized that Mesa actually helped to promote +the OpenGL API, so they didn't feel threatened by the project. +

    + + +

    +1995-1996: I continue working on Mesa both during my spare time and during +my work hours at the Space Science and Engineering Center at the University +of Wisconsin in Madison. My supervisor, Bill Hibbard, lets me do this because +Mesa is now being using for the Vis5D project. +

    +October 1996: Mesa 2.0 is released. It implements the OpenGL 1.1 specification. +

    + +

    +March 1997: Mesa 2.2 is released. It supports the new 3dfx Voodoo graphics +card via the Glide library. It's the first really popular hardware OpenGL +implementation for Linux. +

    + +

    +September 1998: Mesa 3.0 is released. It's the first publicly-available +implementation of the OpenGL 1.2 API. +

    + +

    +March 1999: I attend my first OpenGL ARB meeting. I contribute to the +development of several official OpenGL extensions over the years. +

    + +

    +September 1999: I'm hired by Precision Insight, Inc. Mesa is a key +component of 3D hardware acceleration in the new DRI project for XFree86. +Drivers for 3dfx, 3dLabs, Intel, Matrox and ATI hardware soon follow. +

    + +

    +October 2001: Mesa 4.0 is released. +It implements the OpenGL 1.3 specification. +

    + + +

    +November 2001: I cofound +Tungsten Graphics, Inc. with Keith Whitwell, Jens Owen, David Dawes and +Frank LaMonica. +I continue to develop Mesa as part of my resposibilities with Tungsten +Graphics and as a spare-time project. +

    + +

    +November 2002: Mesa 5.0 is released. +It implements the OpenGL 1.4 specification. +

    + +

    +January 2003: Mesa 6.0 is released. It implements the OpenGL 1.5 +specification as well as the GL_ARB_vertex_program and +GL_ARB_fragment_program extensions. +

    + +

    +June 2007: Mesa 7.0 is released, implementing the OpenGL 2.1 specification +and OpenGL Shading Language. +

    + + +

    +Ongoing: Mesa is used as the core of many hardware OpenGL drivers for +the XFree86 and X.org X servers within the +DRI project. +I continue to enhance Mesa with new extensions and features. +

    + + + +

    Major Versions

    + +

    +This is a summary of the major versions of Mesa. +Mesa's major version number has been incremented whenever a new version +of the OpenGL specification is implemented. +

    + + +

    Version 7.x features

    +

    +Version 7.x of Mesa implements the OpenGL 2.1 API. The main feature +of OpenGL 2.x is the OpenGL Shading Language. +

    + + +

    Version 6.x features

    +

    +Version 6.x of Mesa implements the OpenGL 1.5 API with the following +extensions incorporated as standard features: +

    +
      +
    • GL_ARB_occlusion_query +
    • GL_ARB_vertex_buffer_object +
    • GL_EXT_shadow_funcs +
    +

    +Also note that several OpenGL tokens were renamed in OpenGL 1.5 +for the sake of consistency. +The old tokens are still available. +

    +
    +New Token                   Old Token
    +------------------------------------------------------------
    +GL_FOG_COORD_SRC            GL_FOG_COORDINATE_SOURCE
    +GL_FOG_COORD                GL_FOG_COORDINATE
    +GL_CURRENT_FOG_COORD        GL_CURRENT_FOG_COORDINATE
    +GL_FOG_COORD_ARRAY_TYPE     GL_FOG_COORDINATE_ARRAY_TYPE
    +GL_FOG_COORD_ARRAY_STRIDE   GL_FOG_COORDINATE_ARRAY_STRIDE
    +GL_FOG_COORD_ARRAY_POINTER  GL_FOG_COORDINATE_ARRAY_POINTER
    +GL_FOG_COORD_ARRAY          GL_FOG_COORDINATE_ARRAY
    +GL_SRC0_RGB                 GL_SOURCE0_RGB
    +GL_SRC1_RGB                 GL_SOURCE1_RGB
    +GL_SRC2_RGB                 GL_SOURCE2_RGB
    +GL_SRC0_ALPHA               GL_SOURCE0_ALPHA
    +GL_SRC1_ALPHA               GL_SOURCE1_ALPHA
    +GL_SRC2_ALPHA               GL_SOURCE2_ALPHA
    +
    +

    +See the + +OpenGL specification for more details. +

    + + + +

    Version 5.x features

    +

    +Version 5.x of Mesa implements the OpenGL 1.4 API with the following +extensions incorporated as standard features: +

    +
      +
    • GL_ARB_depth_texture +
    • GL_ARB_shadow +
    • GL_ARB_texture_env_crossbar +
    • GL_ARB_texture_mirror_repeat +
    • GL_ARB_window_pos +
    • GL_EXT_blend_color +
    • GL_EXT_blend_func_separate +
    • GL_EXT_blend_logic_op +
    • GL_EXT_blend_minmax +
    • GL_EXT_blend_subtract +
    • GL_EXT_fog_coord +
    • GL_EXT_multi_draw_arrays +
    • GL_EXT_point_parameters +
    • GL_EXT_secondary_color +
    • GL_EXT_stencil_wrap +
    • GL_EXT_texture_lod_bias (plus, a per-texture LOD bias parameter) +
    • GL_SGIS_generate_mipmap +
    + + +

    Version 4.x features

    + +

    +Version 4.x of Mesa implements the OpenGL 1.3 API with the following +extensions incorporated as standard features: +

    + +
      +
    • GL_ARB_multisample +
    • GL_ARB_multitexture +
    • GL_ARB_texture_border_clamp +
    • GL_ARB_texture_compression +
    • GL_ARB_texture_cube_map +
    • GL_ARB_texture_env_add +
    • GL_ARB_texture_env_combine +
    • GL_ARB_texture_env_dot3 +
    • GL_ARB_transpose_matrix +
    + +

    Version 3.x features

    + +

    +Version 3.x of Mesa implements the OpenGL 1.2 API with the following +features: +

    +
      +
    • BGR, BGRA and packed pixel formats +
    • New texture border clamp mode +
    • glDrawRangeElements() +
    • standard 3-D texturing +
    • advanced MIPMAP control +
    • separate specular color interpolation +
    + + +

    Version 2.x features

    +

    +Version 2.x of Mesa implements the OpenGL 1.1 API with the following +features. +

    +
      +
    • Texture mapping: +
        +
      • glAreTexturesResident +
      • glBindTexture +
      • glCopyTexImage1D +
      • glCopyTexImage2D +
      • glCopyTexSubImage1D +
      • glCopyTexSubImage2D +
      • glDeleteTextures +
      • glGenTextures +
      • glIsTexture +
      • glPrioritizeTextures +
      • glTexSubImage1D +
      • glTexSubImage2D +
      +
    • Vertex Arrays: +
        +
      • glArrayElement +
      • glColorPointer +
      • glDrawElements +
      • glEdgeFlagPointer +
      • glIndexPointer +
      • glInterleavedArrays +
      • glNormalPointer +
      • glTexCoordPointer +
      • glVertexPointer +
      +
    • Client state management: +
        +
      • glDisableClientState +
      • glEnableClientState +
      • glPopClientAttrib +
      • glPushClientAttrib +
      +
    • Misc: +
        +
      • glGetPointer +
      • glIndexub +
      • glIndexubv +
      • glPolygonOffset +
      +
    + + + + diff --git a/mesalib/docs/libraries.html b/mesalib/docs/libraries.html new file mode 100644 index 000000000..eaeb0451a --- /dev/null +++ b/mesalib/docs/libraries.html @@ -0,0 +1,57 @@ + + +Libraries and Toolkits + + + + + +

    Libraries and Toolkits

    + +
      +
    • Apprentice - free OpenInventor work-alike +
    • Coin - OSS Open Inventor clone +
    • Ch - OpenGL bindings for the Ch C/C++ interpreter +
    • FOX - GUI Library +
    • GL4Java - a Java wrapper for OpenGL +
    • GtkGLArea - OpenGL Gtk widget +
    • GtkGLArea-- - OpenGL Gtk-- widget for C++ +
    • GTKpas - OpenGL Gtk widget for FreePascal +
    • FreeGLUT - a GLUT work-alike +
    • Fortran77/90 bindings for OpenGL and Mesa - by William Mitchell +
    • GLOW - a GUI toolkit for GLUT and OpenGL +
    • Glt - an OpenGL C++ toolkit +
    • GLUT (GL Utility Toolkit) - by Mark Kilgard +
    • GuileGL - OpenGL and GtkGLArea language bindings for Guile +
    • IDL - Interactive Data Language +
    • JX - C++ application framework and GUI library +
    • MAM/VRS - object-oriented toolkit for 3D graphics +
    • MINOS - GUI library +
    • OglCLib - C++ wrapper for OpenGL +
    • Open Inventor - the Open Inventor toolkit from SGI +
    • Open Inventor - the Open Inventor toolkit from Template Graphics Software, Inc. +
    • OpenRM +- Open Source, multithreaded, parallel scene graph API +
    • +Open SG PLUS - a scene-graph library +
    • Open Scene Graph + - a scene-graph library +
    • OpenVRML +- a VRML parsing/display library with "lookat" - an example VRML browser +
    • PLIB - A collection of portable games libraries, including an OpenGL GUI and a simple Scene Graph API +
    • Pryan - an OpenInventor-like toolkit +
    • PyOpenGL - OpenGL interface for Python +
    • Quesa - QuickDraw3D-compatible library based on OpenGL, Mesa or Direct3D +
    • repGL - IRIS GL emulated with OpenGL +
    • SciTech MGL - A multiplatform (Windows, Linux, OS/2, DOS, QNX, SMX, RT-Target & more) graphics library +
    • SGL - a 3D Scene Graph Library +
    • SoFree - a free implementation of Open Inventor +
    • Togl - Tcl/Tk widget for OpenGL +
    • VLE - Virtual Reality Toolkit +
    • View3D Widget - 3-D GUI widget +
    • VTK - Visualization Toolkit +
    • YAJOGL - Yet Another Java GL Binding. +
    + + + \ No newline at end of file diff --git a/mesalib/docs/license.html b/mesalib/docs/license.html new file mode 100644 index 000000000..44b980d93 --- /dev/null +++ b/mesalib/docs/license.html @@ -0,0 +1,117 @@ + + +License / Cppyright Information + + + + + +

    Disclaimer

    + +

    +Mesa is a 3-D graphics library with an API which is very similar to +that of OpenGL.* +To the extent that Mesa utilizes the OpenGL command syntax or state +machine, it is being used with authorization from Silicon Graphics, +Inc.(SGI). However, the author does not possess an OpenGL license +from SGI, and makes no claim that Mesa is in any way a compatible +replacement for OpenGL or associated with SGI. Those who want a +licensed implementation of OpenGL should contact a licensed +vendor. +

    + +

    +Please do not refer to the library as MesaGL (for legal +reasons). It's just Mesa or The Mesa 3-D graphics +library.
    +

    + +

    +* OpenGL is a trademark of Silicon Graphics Incorporated. +

    + + + +

    License / Copyright Information

    + +

    +The Mesa distribution consists of several components. Different copyrights +and licenses apply to different components. For example, GLUT is copyrighted +by Mark Kilgard, some demo programs are copyrighted by SGI, some of the Mesa +device drivers are copyrighted by their authors. See below for a list of +Mesa's main components and the license for each. +

    +

    +The core Mesa library is licensed according to the terms of the MIT license. +This allows integration with the XFree86, Xorg and DRI projects. +

    +

    +The default Mesa license is as follows: +

    + +
    +Copyright (C) 1999-2007  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.
    +
    + + +

    Attention, Contributors

    + +

    +When contributing to the Mesa project you must agree to the licensing terms +of the component to which you're contributing. +The following section lists the primary components of the Mesa distribution +and their respective licenses. +

    + + +

    Mesa Component Licenses

    + +
    +Component         Location               License
    +------------------------------------------------------------------
    +Main Mesa code    src/mesa/              Mesa (MIT)
    +
    +Device drivers    src/mesa/drivers/*     MIT, generally
    +
    +Ext headers       include/GL/glext.h     Khronos
    +                  include/GL/glxext.h
    +
    +GLUT              src/glut/              Mark Kilgard's copyright
    +
    +SGI GLU library   src/glu/sgi/           SGI Free B
    +
    +demo programs     progs/demos/           see source files
    +
    +X demos           progs/xdemos/          see source files
    +
    +SGI demos         progs/samples/         SGI license
    +
    +RedBook demos     progs/redbook/         SGI license
    +
    + +

    +In general, consult the source files for license terms. +

    + + + + diff --git a/mesalib/docs/lists.html b/mesalib/docs/lists.html new file mode 100644 index 000000000..5227fbd05 --- /dev/null +++ b/mesalib/docs/lists.html @@ -0,0 +1,69 @@ + + +Mesa Mailing Lists + + + + + +

    Mailing Lists

    + + +

    There are four Mesa 3D / DRI mailing lists: +

    + +
      +
    • mesa3d-announce - announcements of new Mesa +versions are sent to this list. +
    • +
      +
    • mesa3d-users - intended for users of the Mesa and DRI. +Newbie questions are appropriate, but please try the general OpenGL +resources and Mesa/DRI documentation first. +
    • +
      +
    • mesa3d-dev - for discussion of Mesa and Direct Rendering +Infrastructure development. Not for beginners. +
    • +
      +
    • mesa-commit - relays git check-in messages +(for developers). +
      +Note: the old mesa3d-cvs list is no longer in use. +
    • +
    + +

    For mailing lists about Direct Rendering Modules (drm) in Linux/BSD +kernels, see wiki. + +

    +Notice: non-member posts to any of these lists will be automatically +rejected. +

    + + +
    + +

    OpenGL Forums

    + +

    +Here are some other OpenGL-related forums you might find useful: +

    + +
      +
    • OpenGL discussion forums at www.opengl.org
    • +
    • Usenet newsgroups: +
        +
      • comp.graphics.algorithms
      • +
      • comp.graphics.api.opengl
      • +
      • comp.os.linux.x
      • +
      +
    + + + diff --git a/mesalib/docs/mangling.html b/mesalib/docs/mangling.html new file mode 100644 index 000000000..55071544f --- /dev/null +++ b/mesalib/docs/mangling.html @@ -0,0 +1,30 @@ + + +Function Name Mangling + + + + + +

    Function Name Mangling

    + +

    +If you want to use both Mesa and another OpenGL library in the same +application at the same time you may find it useful to compile Mesa with +name mangling. +This results in all the Mesa functions being prefixed with +mgl instead of gl. +

    + +

    +To do this, recompile Mesa with the compiler flag -DUSE_MGL_NAMESPACE. +Add the flag to CFLAGS in the configuration file which you want to use. +For example: +

    +CFLAGS += -DUSE_MGL_NAMESPACE
    +
    +

    + + + + diff --git a/mesalib/docs/modelers.html b/mesalib/docs/modelers.html new file mode 100644 index 000000000..aae968695 --- /dev/null +++ b/mesalib/docs/modelers.html @@ -0,0 +1,68 @@ + + +Modelers, Renderers and Viewers + + + + + +

    Modelers, Renderers and Viewers

    + + + + + diff --git a/mesalib/docs/news.html b/mesalib/docs/news.html new file mode 100644 index 000000000..07ad42ed4 --- /dev/null +++ b/mesalib/docs/news.html @@ -0,0 +1,1250 @@ + + +Mesa News + + + + + + + +

    News

    + + +

    September 3, 2009

    +

    +Mesa 7.5.1 is released. +This is a bug-fix release which fixes bugs found in version 7.5. +

    + + +

    July 17, 2009

    +

    +Mesa 7.5 is released. +This is a new features release. People especially concerned about +stability may want to wait for the follow-on 7.5.1 bug-fix release. +

    + + +

    June 23, 2009

    +

    +Mesa 7.4.4 is released. +This is a stable release that fixes a regression in the i915/i965 drivers +that slipped into the 7.4.3 release. +

    + + +

    June 19, 2009

    +

    +Mesa 7.4.3 is released. +This is a stable release fixing bugs since the 7.4.2 release. +

    + + +

    May 15, 2009

    +

    +Mesa 7.4.2 is released. +This is a stable release fixing bugs since the 7.4.1 release. +

    + + +

    April 18, 2009

    +

    +Mesa 7.4.1 is released. +This is a stable release fixing bugs since the 7.4 release. +

    + + +

    March 27, 2009

    +

    +Mesa 7.4 is released. +This is a stable release fixing bugs since the 7.3 release. +

    + + +

    January 22, 2009

    +

    +Mesa 7.3 is released. +This is a new development release. +Mesa 7.4 will follow and will have bug fixes relative to 7.3. +

    + + +

    September 20, 2008

    +

    +Mesa 7.2 is released. +This is a stable, bug-fix release. +

    + + +

    August 26, 2008

    +

    +Mesa 7.1 is released. +This is a new development release. +It should be relatively stable, but those especially concerned about +stability should wait for the 7.2 release or use Mesa 7.0.4 (the +previous stable release). +

    + + +

    August 16, 2008

    +

    +Mesa 7.0.4 is released. +This is a bug-fix release. +

    + + +

    April 4, 2008

    +

    +Mesa 7.0.3 is released. +This is a bug-fix release. +

    + + +

    January 24, 2008

    + +

    +Added a new page describing the Mesa Cell driver. +

    + + + +

    November 13, 2007

    + +

    +Gallium3D is the codename for the new Mesa device driver architecture +which is currently under development. +A summary of the architecture can be found on the +Tungsten Graphics website. +

    +

    +Gallium3D development is taking place on the gallium-0.1 branch +of the git repository. +Currently, there's only a software-only driver and an Intel i915/945 driver +but other drivers will be coming... +

    + + +

    November 10, 2007

    +

    +Mesa 7.0.2 is released. +This is a bug-fix release. +

    + + +

    August 3, 2007

    +

    +Mesa 7.0.1 is released. +This is a bug-fix release. +

    + + +

    June 22, 2007

    +

    +Mesa 7.0 is released. +This is a stable release featuring OpenGL 2.1 support. +

    + + +

    April 27, 2007

    +

    +Mesa 6.5.3 is released. +This is a development release which will lead up to the Mesa 7.0 release +(which will advertise OpenGL 2.1 API support). +

    + + +

    March 26, 2007

    +

    +The new Shading Language compiler branch has been merged into the git +master branch. This is a step toward hardware support for the OpenGL +2.0 Shading Language and will be included in the next Mesa release. +In conjunction, Glean + has been updated with a new test that does over 130 tests of the +shading language and built-in functions. +

    + +

    April 2007

    +

    +Thomas Hellström of + +Tungsten Graphics has written a whitepaper describing the new +DRI memory management +system. +

    + +

    December 5, 2006

    +

    +Mesa is now using git as its source code management system. +The previous CVS repository should no longer be used. +See the repository page for more information. +

    + +

    December 2, 2006

    +

    +Mesa 6.5.2 has been released. +This is a new development release. +

    + +

    September 15, 2006

    +

    +Mesa 6.5.1 has been released. +This is a new development release. +

    + +

    March 31, 2006

    +

    +Mesa 6.5 has been released. +This is a new development release. +

    + + +

    February 2, 2006

    +

    +Mesa 6.4.2 has been released. +This is stable, bug-fix release. +

    + + +

    November 29, 2005

    +

    +Mesa 6.4.1 has been released. +This is stable, bug-fix release. +

    + + + +

    October 24, 2005

    +

    +Mesa 6.4 has been released. +This is stable, bug-fix release. +

    + + +

    August 19, 2005

    +

    +Mesa 6.3.2 has been released. +Note: there was no public release of version 6.3.1. +

    +Changes in version 6.3.1 +

    +The MD5 checksums are: +

    +
    +98192e45ed8d69113688f89f90869346  MesaLib-6.3.2.tar.gz
    +0df27701df0924d17ddf41185efa8ce1  MesaLib-6.3.2.tar.bz2
    +ccb2423aab77fc7e81ce628734586140  MesaLib-6.3.2.zip
    +9d0fca0a7d051c34a0b485423fb3e85d  MesaDemos-6.3.2.tar.gz
    +96708868450c188205e42229b5d813c4  MesaDemos-6.3.2.tar.bz2
    +c5102501e609aa8996d832fafacb8ab9  MesaDemos-6.3.2.zip
    +
    + + +

    July 20, 2005

    +

    +Mesa 6.3 has been released. +This is a development release with new features, changes and bug fixes. +

    +
    +    New:
    +	- GL_EXT_framebuffer_object extension
    +	- GL_ARB_draw_buffers extension
    +	- GL_ARB_pixel_buffer_object extension
    +	- GL_OES_read_format extension (Ian Romanick)
    +	- DirectFB driver (Claudio Ciccani)
    +	- x86_64 vertex transformation code (Mikko T.)
    +    Changes:
    +	- added -stereo option for glxgears demo (Jacek Rosik)
    +	- updated the PBuffer demo code in xdemos/ directory
    +	- glDeleteTextures/Programs/Buffers() now makes the object ID
    +	  available for immediate re-use
    +	- assorted 64-bit clean-ups fixes (x86_64 and Win64)
    +	- lots of internal changes for GL_EXT_framebuffer_object
    +    Bug fixes:
    +	- some functions didn't support PBO functionality
    +	- glGetTexImage didn't convert color index images to RGBA as required
    +	- fragment program texcoords were sometimes wrong for points and lines
    +	- fixed problem with negative dot product in arbfplight, fplight demos
    +	- fixed bug in perspective correction of antialiased, textured lines
    +	- querying GL_POST_CONVOLUTION_ALPHA_BIAS_EXT returned wrong value
    +	- fixed a couple per-pixel fog bugs (Soju Matsumoto)
    +	- glGetBooleanv(GL_FRAGMENT_PROGRAM_BINDING_NV) was broken
    +	- fixed float parsing bug in ARB frag/vert programs (bug 2520)
    +	- XMesaGetDepthBuffer() returned incorrect value for bytesPerValue
    +	- GL_COLOR_MATERIAL with glColor3 didn't properly set diffuse alpha
    +	- glXChooseFBConfig() crashed if attribList pointer was NULL
    +	- program state.light[n].spot.direction.w was wrong value (bug 3083)
    +	- fragment program fog option required glEnable(GL_FOG) - wrong.
    +	- glColorTable() could produce a Mesa implementation error (bug 3135)
    +	- RasterPos could get corrupted by color index rendering path
    +	- Removed bad XTranslateCoordinates call when rendering to Pixmaps
    +	- glPopAttrib() didn't properly restore GL_TEXTURE_GEN enable state
    +	- fixed a few Darwin compilation problems
    +
    +

    +The MD5 checksums are: +

    +
    +0236f552d37514776945d5a013e5bb7b  MesaLib-6.3.tar.gz
    +60e1a8f78c4a8c7750a1e95753190986  MesaLib-6.3.tar.bz2
    +ca7c950fbace68c70caa822322db7223  MesaLib-6.3.zip
    +25ea801645b376c014051804fe4974b2  MesaDemos-6.3.tar.gz
    +9248e74872ea88c57ec25c900c295057  MesaDemos-6.3.tar.bz2
    +8537dfa734ef258dcc7272097558d434  MesaDemos-6.3.zip
    +
    + + +

    December 9, 2004

    +

    +Mesa 6.2.1 has been released. +This is a stable release which just fixes bugs since the 6.2 release. +

    +
    +    Bug fixes:
    +	- don't apply regular fog or color sum when using a fragment program
    +	- glProgramEnvParameter4fARB always generated an error on
    +	  GL_FRAGMENT_PROGRAM_ARB (fdo bug 1645)
    +	- glVertexAttrib3svNV and glVertexAttrib3svARB were broken
    +	- fixed width/height mix-up in glSeparableFilter2D()
    +	- fixed regression in glCopyPixels + convolution
    +	- glReadPixels from a clipped front color buffer didn't always work
    +	- glTexImage didn't accept GL_RED/GREEN/BLUE as the format
    +	- Attempting queries/accesses of VBO 0 weren't detected as errors
    +	- paletted textures failed if the palette had fewer than 256 entries
    +    Changes:
    +	- fixed a bunch of compiler warnings found with gcc 3.4
    +	- bug reports should to go bugzilla.freedesktop.org
    +
    +

    +The MD5 checksums are: +

    +
    +80008a92f6e055d3bfdde2cf331ec3fa  MesaLib-6.2.1.tar.gz
    +f43228cd2bf70f583ef3275c1c545421  MesaLib-6.2.1.tar.bz2
    +dec26cfd40116ad021020fea2d94f652  MesaLib-6.2.1.zip
    +2c7af3c986a7571c8713c8bfee7e49e3  MesaDemos-6.2.1.tar.gz
    +3cac74667b50bcbd4f67f594fb4224a2  MesaDemos-6.2.1.tar.bz2
    +75b3edd12eb2b370caf05f29b99e508a  MesaDemos-6.2.1.zip
    +
    + + +

    October 2, 2004

    +

    +Mesa 6.2 has been released. +This is a stable release which just fixes bugs since the 6.1 release. +

    +
    +    New:
    +	- enabled GL_ARB_texture_rectangle (same as GL_NV_texture_rectangle)
    +	- updated Doxygen support (Jose Fonseca)
    +    Changes:
    +	- some GGI driver updates (Christoph Egger, bug 1025977)
    +    Bug fixes:
    +	- Omit GL_ARB_texture_non_power_of_two from list of OpenGL 1.5 features
    +	- fixed a few compilation issues on IRIX
    +	- fixed a matrix classification bug (reported by Wes Bethel)
    +	- we weren't reseting the vertex/fragment program error state
    +	  before parsing (Dave Reveman)
    +	- adjust texcoords for sampling texture rectangles (Dave Reveman)
    +	- glGet*(GL_MAX_VERTEX_ATTRIBS_ARB) wasn't implemented
    +	- repeated calls to glDeleteTexture(t) could lead to a crash
    +	- fixed potential ref count bugs in VBOs and vertex/fragment programs
    +	- spriteblast demo didn't handle window size changes correctly
    +	- glTexSubImage didn't handle pixels=NULL correctly for PBOs
    +	- fixed color index mode glDrawPixels bug (Karl Schultz)
    +
    +

    +The MD5 checksums are: +

    +
    +9e8f34b059272dbb8e1f2c968b33bbf0  MesaLib-6.2.tar.gz
    +3d6a6362390b6a37d3cb2e615f3ac7db  MesaLib-6.2.tar.bz2
    +6cfd7895d28e695c0dbbed9469564091  MesaLib-6.2.zip
    +3e06e33b0809f09855cb60883b8bdfef  MesaDemos-6.2.tar.gz
    +9d160009c3dfdb35fe7e4088c9ba8f85  MesaDemos-6.2.tar.bz2
    +856f7ec947122eb3c8985ebc2f654dcd  MesaDemos-6.2.zip
    +
    + + +

    August 18, 2004

    +

    +Mesa 6.1 has been released. +This is a new development release (version 6.2 will be a stabilization +release). +

    +
    +    New:
    +	- Revamped Makefile system
    +	- glXUseRotatedXFont() utility (see xdemos/xuserotfont.c)
    +	- internal driver interface changes related to texture object
    +	  allocation, vertex/fragment programs, BlendEquationSeparate, etc.
    +	- option to walk triangle edges with double-precision floats
    +	  (Justin Novosad of Discreet) (see config.h file)
    +	- support for AUX buffers in software GLX driver
    +	- updated glext.h to version 24 and glxext.h to version 6
    +	- new MESA_GLX_FORCE_ALPHA and MESA_GLX_DEPTH_BITS env vars
    +	- updated BeOS support (Philippe Houdoin)
    +    Changes:
    +	- fragment fog interpolation is perspective corrected now
    +	- new glTexImage code, much cleaner, may be a bit faster
    +    Bug fixes:
    +	- glArrayElement in display lists didn't handle generic vertex attribs
    +	- glFogCoord didn't always work properly
    +	- ARB_fragment_program fog options didn't work
    +	- frag prog TEX instruction no longer incorrectly divides s,t,r by q
    +	- ARB frag prog TEX and TEXP instructions now use LOD=0
    +	- glTexEnviv in display lists didn't work
    +	- glRasterPos didn't do texgen or apply texture matrix
    +	- GL_DOUBLE-valued vertex arrays were broken in some cases
    +	- fixed texture rectangle edge/border sampling bugs
    +	- sampling an incomplete texture in a fragment program would segfault
    +	- glTexImage was missing a few error checks
    +	- fixed some minor glGetTexParameter glitches
    +	- GL_INTENSITY was mistakenly accepted as a  to glTexImage
    +	- fragment program writes to RC/HC register were broken
    +	- fixed a few glitches in GL_HP_occlusion_test extension
    +	- glBeginQueryARB and glEndQueryARB didn't work inside display lists
    +	- vertex program state references were broken
    +	- fixed triangle color interpolation bug on AIX (Shane Blackett)
    +	- fixed a number of minor memory leaks (bug #1002030)
    +
    +The MD5 checksums are: +

    +
    +c9284d295ebcd2e0486cc3cd54e5863c  MesaLib-6.1.tar.gz
    +5de1f53ec0709f60fc68fdfed57351f3  MesaLib-6.1.tar.bz2
    +483e77cac4789a5d36c42f3c0136d6d8  MesaLib-6.1.zip
    +8c46cfa6f9732acc6f6c25724aad0246  MesaDemos-6.1.tar.gz
    +89bfe0f6c69b39fd0ebd9fff481a4e9b  MesaDemos-6.1.tar.bz2
    +161268531fcc6f0c5a056430ee97e0c1  MesaDemos-6.1.zip
    +
    + + + +

    April 2, 2004

    + +

    +Mesa 6.0.1 has been released. +This release basically just fixes bugs since the 6.0. release. +

    +
    +    New:
    +	- upgraded glext.h to version 22
    +	- new build targets (Dan Schikore)
    +	- new linux-x86-opteron build target (Heath Feather)
    +    Bug fixes:
    +	- glBindProgramARB didn't update all necessary state
    +	- fixed build problems on OpenBSD
    +	- omit CVS directories from tarballs
    +	- glGetTexImage(GL_COLOR_INDEX) was broken
    +	- fixed an infinite loop in t&l module
    +	- silenced some valgrind warnings about using unitialized memory
    +	- fixed some compilation/link glitches on IRIX (Mike Stephens)
    +	- glBindProgram wasn't getting compiled into display lists
    +	- GLX_FBCONFIG_ID wasn't recognized in glXChooseFBConfig() (bug 888079)
    +	- two-sided lighting and vertex program didn't work (bug 887330)
    +	- stores to program parameter registers in vertex state programs
    +	  didn't work.
    +	- fixed glOrtho bug found with gcc 3.2.2 (RH9)
    +	- glXCreateWindow() wasn't fully implemented (bug 890894)
    +	- generic vertex attribute arrays didn't work in display lists
    +	- vertex buffer objects' default usage and access fields were wrong
    +	- glDrawArrays with start!=0 was broken
    +	- fragment program PK2H, UP2H, UP4B and UP4UB instructions were broken
    +	- linux-osmesa16-static config didn't work
    +	- fixed a few color index rendering problems (bug 910687)
    +	- glInterleavedArrays didn't respect GL_CLIENT_ACTIVE_TEXTURE
    +	- OSMesa RGB and BGR modes were broken
    +	- glProgramStringARB mistakenly required a null-terminated string
    +	- fragment program XPD instruction was incorrect
    +	- glGetMaterial() didn't work reliably
    +
    +The MD5 checksums are: +

    +
    +011be0e79666c7a6eb9693fbf9348653  MesaLib-6.0.1.tar.gz
    +b7f14088c5c2f14490d2739a91102112  MesaLib-6.0.1.tar.bz2
    +bf0510cf0a2b87d64cdd317eca3f1db1  MesaLib-6.0.1.zip
    +b7b648599e0aaee1c4ffc554a2a9139e  MesaDemos-6.0.1.tar.gz
    +dd6aadfd9ca8e1cfa90c6ee492bc6f43  MesaDemos-6.0.1.tar.bz2
    +eff71d59c211825e949199852f5a2316  MesaDemos-6.0.1.zip
    +
    + + + +

    January 16, 2004

    + +

    +Mesa 6.0 has been released. This is a stabilization of the 5.1 release +and primarily just incorporates bug fixes. +

    +
    +    New:
    +	- full OpenGL 1.5 support
    +	- updated GL/glext.h file to version 21
    +    Changes:
    +	- changed max framebuffer size to 4Kx4K (MAX_WIDTH/HEIGHT in config.h)
    +    Bug fixes:
    +	- fixed bug in UNCLAMPED_FLOAT_TO_UBYTE macro; solves a color
    +	  clamping issue
    +	- updated suno5-gcc configs
    +	- glColor3 functions sometimes resulted in undefined alpha values
    +	- fixed FP divide by zero error seen on VMS with xlockmore, others
    +	- fixed vertex/fragment program debug problem (bug 873011)
    +	- building on AIX with gcc works now
    +	- glDeleteProgramsARB failed for ARB fragment programs (bug 876160)
    +	- glDrawRangeElements tried to modify potentially read-only storage
    +	- updated files for building on Windows
    +
    + + + +

    December 28, 2003

    + +

    +The Mesa CVS server has been moved to +freedesktop.org because of problems with SourceForge's anonymous +CVS service. +

    + +

    Please see the CVS access page for details. +

    + + +

    December 17, 2003

    + +

    +Mesa 5.1 has been released. This is a new development release. +Mesa 6.0 will be the next stable release and will support all +OpenGL 1.5 features. +

    +
    +    New features:
    +	- reorganized directory tree
    +	- GL_ARB_vertex/fragment_program extensions (Michal Krol & Karl Rasche)
    +	- GL_ATI_texture_env_combine3 extension (Ian Romanick)
    +	- GL_SGI_texture_color_table extension (Eric Plante)
    +	- GL_NV_fragment_program extension
    +	- GL_NV_light_max_exponent extension
    +	- GL_EXT_texture_rectangle (identical to GL_NV_texture_rectangle)
    +	- GL_ARB_occlusion_query extension
    +	- GL_ARB_point_sprite extension
    +	- GL_ARB_texture_non_power_of_two extension
    +	- GL_IBM_multimode_draw_arrays extension
    +	- GL_EXT_texture_mirror_clamp extension (Ian Romanick)
    +	- GL_ARB_vertex_buffer_object extension
    +	- new X86 feature detection code (Petr Sebor)
    +	- less memory used for display lists and vertex buffers
    +	- demo of per-pixel lighting with a fragment program (demos/fplight.c)
    +	- new version (18) of glext.h header
    +	- new spriteblast.c demo of GL_ARB_point_sprite
    +	- faster glDrawPixels in X11 driver in some cases (see RELNOTES-5.1)
    +	- faster glCopyPixels in X11 driver in some cases (see RELNOTES-5.1)
    +    Bug fixes:
    +	- really enable OpenGL 1.4 features in DOS driver.
    +	- fixed issues in glDrawPixels and glCopyPixels for very wide images
    +	- glPixelMapf/ui/usv()'s size parameter is GLsizei, not GLint
    +	- fixed some texgen bugs reported by Daniel Borca
    +	- fixed wglMakeCurrent(NULL, NULL) bug (#835861)
    +	- fixed glTexSubImage3D z-offset bug (Cedric Gautier)
    +	- fixed RGBA blend enable bug (Ville Syrjala)
    +	- glAccum is supposed to be a no-op in selection/feedback mode
    +	- fixed texgen bug #597589 (John Popplewell)
    +    Changes:
    +	- dropped API trace feature (src/Trace/)
    +	- documentation overhaul.  merged with website content.  more html.
    +	- glxgears.c demo updated to use GLX swap rate extensions
    +	- glTexImage1/2/3D now allows width/height/depth = 0
    +	- disable SPARC asm code on Linux (bug 852204)
    +
    + +The MD5 checksums are: +

    +
    +78f452f6c55478471a744f07147612b5  MesaLib-5.1.tar.gz
    +67b3b8d3f7f4c8c44904551b851d01af  MesaLib-5.1.tar.bz2
    +6dd19ffa750ec7f634e370a987505c9d  MesaLib-5.1.zip
    +e0214d4ebb22409dfa9262f2b52fd828  MesaDemos-5.1.tar.gz
    +066c9aff4fd924405de1ae9bad5ec9a7  MesaDemos-5.1.tar.bz2
    +d2b5ba32b53e0ad0576c637a4cc1fb41  MesaDemos-5.1.zip
    +
    + + +

    November 12, 2003

    + +

    +New Mesa 5.0.2 tarballs have been uploaded to SourceForge which fix a +number of automake/libtool problems. +

    +

    +The new MD5 checksums are: +

    +
    +a9dcf3ff9ad1b7d6ce73a0df7cff8b5b  MesaLib-5.0.2.tar.gz
    +7b4bf9261657c2fca03796d4955e6f50  MesaLib-5.0.2.tar.bz2
    +79c141bddcbad557647535d02194f346  MesaLib-5.0.2.zip
    +952d9dc823dd818981d1a648d7b2668a  MesaDemos-5.0.2.tar.gz
    +b81fafff90995025d2f25ea02b786642  MesaDemos-5.0.2.tar.bz2
    +a21be975589e8a2d1871b6bb7874fffa  MesaDemos-5.0.2.zip
    +
    + + + +

    September 5, 2003

    + +

    +Mesa 5.0.2 has been released. This is a stable, bug-fix release. +

    +
    +    Bug fixes:
    +	- fixed texgen problem causing texcoord's Q to be zero (stex3d)
    +	- default GL_TEXTURE_COMPARE_MODE_ARB was wrong
    +	- GL_CURRENT_MATRIX_NV query was wrong
    +	- GL_CURRENT_MATRIX_STACK_DEPTH_NV query was off by one
    +	- GL_LIST_MODE query wasn't correct
    +	- GL_FOG_COORDINATE_SOURCE_EXT query wasn't supported
    +	- GL_SECONDARY_COLOR_ARRAY_SIZE_EXT query returned wrong value
    +	- blended, wide lines didn't always work correctly (bug 711595)
    +	- glVertexAttrib4svNV w component was always 1
    +	- fixed bug in GL_IBM_rasterpos_clip (missing return)
    +	- GL_DEPTH_TEXTURE_MODE = GL_ALPHA didn't work correctly
    +	- a few Solaris compilation fixes
    +	- fixed glClear() problem for DRI drivers (non-existant stencil, etc)
    +	- fixed int/REAL mixup in GLU NURBS curve evaluator (Eric Cazeaux)
    +	- fixed delete [] bug in SI GLU (bug 721765) (Diego Santa Cruz)
    +	- glFog() didn't clamp fog colors
    +	- fixed bad float/int conversion for GL_TEXTURE_PRIORITY in the
    +	  gl[Get]TexParameteri[v] functions
    +	- fixed invalid memory references in glTexGen functions (bug 781602)
    +	- integer-valued color arrays weren't handled correctly
    +	- glDrawPixels(GL_DEPTH_COMPONENT) with glPixelZoom didn't work
    +	- GL_EXT_texture_lod_bias is part of 1.4, overlooked in 5.0.1
    +    Changes:
    +	- build GLUT with -fexceptions so C++ apps propogate exceptions
    +
    + + + +

    June 2003

    + +

    +Mesa's directory tree has been overhauled. +Things are better organized now with some thought toward future needs. +

    +

    +In CVS, the latest Mesa 5.1 development code is now rooted under the +Mesa-newtree/ directory. The old top-level Mesa/ directory +holds the Mesa 5.0.x code which will be abandoned at some point. +

    + + + +

    March 30, 2003

    + +

    +Mesa 5.0.1 has been released. This is a stable, bug-fix release. +

    +
    +    New:
    +	- DOS driver updates from Daniel Borca
    +	- updated GL/gl_mangle.h file (Bill Hoffman)
    +    Bug fixes:
    +	- auto mipmap generation for cube maps was broken (bug 641363)
    +	- writing/clearing software alpha channels was unreliable
    +	- minor compilation fixes for OS/2 (Evgeny Kotsuba)
    +	- fixed some bad assertions found with shadowtex demo
    +	- fixed error checking bug in glCopyTexSubImage2D (bug 659020)
    +	- glRotate(angle, -x, 0, 0) was incorrect (bug 659677)
    +	- fixed potential segfault in texture object validation (bug 659012)
    +	- fixed some bogus code in _mesa_test_os_sse_exception_support (Linus)
    +	- fix fog stride bug in tnl code for h/w drivers (Michel Danzer)
    +	- fixed glActiveTexture / glMatrixMode(GL_TEXTURE) bug (#669080)
    +	- glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3
    +	- fixed compilation problem on Solaris7/x86 (bug 536406)
    +	- fixed prefetch bug in 3DNow! code (Felix Kuhling)
    +	- fixed NeXT build problem (FABSF macro)
    +	- glDrawPixels Z values when glPixelZoom!=1 were invalid (bug 687811)
    +	- zoomed glDraw/CopyPixels with clipping sometimes failed (bug 689964)
    +	- AA line and triangle Z values are now rounded, not truncated
    +	- fixed color interpolation bug when GLchan==GLfloat (bug 694461)
    +	- glArePrograms/TexturesResident() wasn't 100% correct (Jose Fonseca)
    +	- fixed a minor GL_COLOR_MATERIAL bug
    +	- NV vertex program EXP instruction was broken
    +	- glColorMask misbehaved with X window / pixmap rendering
    +	- fix autoconf/libtool GLU C++ linker problem on Linux (a total hack)
    +	- attempt to fix GGI compilation problem when MesaDemos not present
    +	- NV vertex program ARL-relative fetches didn't work
    +    Changes:
    +	- use glPolygonOffset in gloss demo to avoid z-fighting artifacts
    +	- updated winpos and pointblast demos to use ARB extensions
    +	- disable SPARC normal transformation code (bug 673938)
    +	- GLU fixes for OS/2 (Evgeny Kotsuba)
    +
    +

    +MD5 checksums follow: +

    +
    +b80f8b5d53a3e9f19b9fde5af0c542f0  MesaLib-5.0.1.tar.gz
    +513b4bbd7d38951f05027179063d876b  MesaLib-5.0.1.tar.bz2
    +eebd395678f4520d33b267e5d5c22651  MesaLib-5.0.1.zip
    +49d7feaec6dc1d2091d7c3cc72a9b320  MesaDemos-5.0.1.tar.gz
    +37190374a98c3c892f0698be9ca3acf0  MesaDemos-5.0.1.tar.bz2
    +becd8bf17f5791361b4a54ba2a78e5c9  MesaDemos-5.0.1.zip
    +
    + + + +

    March 7, 2003

    +

    +Website and documentation overhaul. +

    +

    +The website content and Mesa documentation (from the doc/ directory) have +been merged together. +All the documentation files have been entered into the CVS repository. +Many of the old plain-text files have been converted to html and modernized. +

    + + +

    November 13, 2002

    +

    Mesa 5.0 has been released. This is a stable release which +implements the OpenGL 1.4 specification. +

    New:
    +    - OpenGL 1.4 support (glGetString(GL_VERSION) returns "1.4")
    +    - removed some overlooked debugging code
    +    - glxinfo updated to support GLX_ARB_multisample
    +    - GLUT now support GLX_ARB_multisample
    +    - updated DOS driver (Daniel Borca)
    +Bug fixes:
    +    - GL_POINT and GL_LINE-mode polygons didn't obey cull state
    +    - fixed potential bug in _mesa_align_malloc/calloc()
    +    - fixed missing triangle bug when running vertex programs
    +    - fixed a few HPUX compilation problems
    +    - FX (Glide) driver didn't compile
    +    - setting GL_TEXTURE_BORDER_COLOR with glTexParameteriv() didn't work
    +    - a few EXT functions, like glGenTexturesEXT, were no-ops
    +    - a few OpenGL 1.4 functions like glFogCoord*, glBlendFuncSeparate,
    +      glMultiDrawArrays and glMultiDrawElements were missing
    +    - glGet*(GL_ACTIVE_STENCIL_FACE_EXT) was broken
    +    - Pentium 4 Mobile was mistakenly identified as having 3DNow!
    +    - fixed one-bit error in point/line fragment Z calculation
    +    - fixed potential segfault in fakeglx code
    +    - fixed color overflow problem in DOT3 texture env mode
    +
    + + +

    October 29, 2002

    +

    Mesa 4.1 has been released. This is a new development release. +For a stable release, get 4.0.4. +

    New:
    +    - GL_NV_vertex_program extension
    +    - GL_NV_vertex_program1_1 extension
    +    - GL_ARB_window_pos extension
    +    - GL_ARB_depth_texture extension
    +    - GL_ARB_shadow extension
    +    - GL_ARB_shadow_ambient extension
    +    - GL_EXT_shadow_funcs extension
    +    - GL_ARB_point_parameters extension
    +    - GL_ARB_texture_env_crossbar
    +    - GL_NV_point_sprite extension
    +    - GL_NV_texture_rectangle extension
    +    - GL_EXT_multi_draw_arrays extension
    +    - GL_EXT_stencil_two_side extension
    +    - GLX_SGIX_fbconfig and GLX_SGIX_pbuffer extensions
    +    - GL_ATI_texture_mirror_once extension (Ian Romanick)
    +    - massive overhaul/simplification of software rasterizer module,
    +      many contributions from Klaus Niederkrueger
    +    - faster software texturing in some cases (i.e. trilinear filtering)
    +    - new OSMesaGetProcAddress() function
    +    - more blend modes implemented with MMX code (Jose Fonseca)
    +    - added glutGetProcAddress() to GLUT
    +    - added GLUT_FPS env var to compute frames/second in glutSwapBuffers()
    +    - pbinfo and pbdemo PBuffer programs
    +    - glxinfo -v prints transprent pixel info (Gerd Sussner)
    +Bug fixes:
    +    - better mipmap LOD computation (prevents excessive blurriness)
    +    - OSMesaMakeCurrent() didn't recognize buffer size changes
    +    - assorted conformance fixes for 16-bit/channel rendering
    +    - texcombine alpha subtraction mode was broken
    +    - fixed some blend problems when GLchan==GLfloat (Gerk Huisma)
    +    - clamp colors to [0,1] in OSMesa if GLchan==GLfloat (Gerk Huisma)
    +    - fixed divide by zero error in NURBS tessellator (Jon Perry)
    +    - fixed GL_LINEAR fog bug by adding clamping
    +    - fixed FP exceptions found using Alpha CPU
    +    - 3dfx/glide driver render-to-window feature was broken
    +    - added missing GLX_TRANSPARENT_RGB token to glx.h
    +    - fixed error checking related to paletted textures
    +    - fixed reference count error in glDeleteTextures (Randy Fayan)
    +Changes:
    +    - New spec file and Python code to generate some GL dispatch files
    +    - Glide driver defaults to "no" with autoconf/automake
    +    - floating point color channels now clamped to [0,inf)
    +    - updated demos/stex3d with new options
    +
    + + +

    October 4, 2002

    +

    +The Mesa FAQ has been rewritten. +

    + +

    October 3, 2002

    +

    Mesa 4.0.4 has been released. This is a stable bug-fix release. +

        New:
    +	- GL_NV_texture_rectangle extension
    +	- updated glext.h header (version 17)
    +	- updated DOS driver (Daniel Borca)
    +	- updated BeOS R5 driver (Philippe Houdoin)
    +	- added GL_IBM_texture_mirror_repeat
    +	- glxinfo now takes -l option to print interesting OpenGL limits info
    +	- GL_MESA_ycbcr_texture extension
    +	- GL_APPLE_client_storage extension (for some DRI drivers only)
    +	- GL_MESA_pack_invert extension
    +    Bug fixes:
    +	- fixed GL_LINEAR fog bug by adding clamping
    +	- fixed FP exceptions found using Alpha CPU
    +	- 3dfx MESA_GLX_FX=window (render to window) didn't work
    +	- fixed memory leak in wglCreateContest (Karl Schultz)
    +	- define GLAPIENTRY and GLAPI if undefined in glu.h
    +	- wglGetProcAddress didn't handle all API functions
    +	- when testing for OpenGL 1.2 vs 1.3, check for GL_ARB_texture_cube_map
    +	- removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT from glGetInteger/Float/etc()
    +	- error checking in compressed tex image functions had some glitches
    +	- fixed AIX compile problem in src/config.c
    +	- glGetTexImage was using pixel unpacking instead of packing params
    +	- auto-mipmap generation for cube maps was incorrect
    +    Changes:
    +	- max texture units reduced to six to accomodate texture rectangles
    +	- removed unfinished GL_MESA_sprite_point extension code
    +
    + +

    June 25, 2002

    +

    Mesa 4.0.3 has been released. This is a stable bug-fix release. +

        New:
    +    - updated GL/glext.h file (version 15)
    +    - corrected MMX blend code (Jose Fonseca)
    +    - support for software-based alpha planes in Windows driver
    +    - updated GGI driver (Filip Spacek)
    +    Bug fixes:
    +    - glext.h had wrong values for GL_DOT3_RGB[A]_EXT tokens
    +    - OSMesaMakeCurrent() didn't recognize buffer size changes
    +    - assorted conformance fixes for 16-bit/channel rendering
    +    - texcombine alpha subtraction mode was broken
    +    - fixed lighting bug with non-uniform scaling and display lists
    +    - fixed bug when deleting shared display lists
    +    - disabled SPARC cliptest assembly code (Mesa bug 544665)
    +    - fixed a couple Solaris compilation/link problems
    +    - blending clipped glDrawPixels didn't always work
    +    - glGetTexImage() didn't accept packed pixel types
    +    - glPixelMapu[is]v() could explode given too large of pixelmap
    +    - glGetTexParameter[if]v() didn't accept GL_TEXTURE_MAX_ANISOTROPY_EXT
    +    - glXCopyContext() could lead to segfaults
    +    - glCullFace(GL_FRONT_AND_BACK) didn't work (bug 572665)
    +    Changes:
    +    - lots of C++ (g++) code clean-ups
    +    - lots of T&L updates for the Radeon DRI driver
    +    Known bugs:
    +    - mipmap LOD computation (fixed for Mesa 4.1)
    +
    + +

    April 2, 2002

    +

    Mesa 4.0.2 has been released. This is a stable bug-fix release. +

        New:
    +      - New DOS (DJGPP) driver written by Daniel Borca
    +      - New driver interface functions for TCL drivers (such as Radeon DRI)
    +      - GL_RENDERER string returns "Mesa Offscreen16" or "Mesa Offscreen32"
    +        if using deep color channels
    +      - latest GL/glext.h and GL/glxext.h headers from SGI
    +    Bug fixes:
    +      - GL_BLEND with non-black texture env color wasn't always correct
    +      - GL_REPLACE with GL_RGB texture format wasn't always correct (alpha)
    +      - glTexEnviv( pname != GL_TEXTURE_ENV_COLOR ) was broken
    +      - glReadPixels was sometimes mistakenly clipped by the scissor box
    +      - glDraw/ReadPixels didn't catch all the errors that they should have
    +      - Fixed 24bpp rendering problem in Windows driver (Karl Schultz)
    +      - 16-bit GLchan mode fixes (m_trans_tmp.h, s_triangle.c)
    +      - Fixed 1-bit float->int conversion bug in glDrawPixels(GL_DEPTH_COMP)
    +      - glColorMask as sometimes effecting glXSwapBuffers()
    +      - fixed a potential bug in XMesaGarbageCollect()
    +      - N threads rendering into one window didn't work reliably
    +      - glCopyPixels didn't work for deep color channels
    +      - improved 8 -> 16bit/channel texture image conversion (Gerk Huisma)
    +      - glPopAttrib() didn't correctly restore user clip planes
    +      - user clip planes failed for some perspective projections (Chromium)
    +
    + +

    December 17, 2001

    +

    Mesa 4.0.1 has been released. This is a stable bug-fix release. +

        New:
    +      - better sub-pixel sample positions for AA triangles (Ray Tice)
    +      - slightly faster blending for (GL_ZERO, GL_ONE) and (GL_ONE, GL_ZERO)
    +    Bug fixes:
    +      - added missing break statements in glGet*() for multisample cases
    +      - fixed uninitialized hash table mutex bug (display lists / texobjs)
    +      - fixed bad teximage error check conditional (bug 476846)
    +      - fixed demos readtex.c compilation problem on Windows (Karl Schultz)
    +      - added missing glGet() query for GL_MAX_TEXTURE_LOD_BIAS_EXT
    +      - silence some compiler warnings (gcc 2.96)
    +      - enable the #define GL_VERSION_1_3 in GL/gl.h
    +      - added GL 1.3 and GLX 1.4 entries to gl_mangle.h and glx_mangle.h
    +      - fixed glu.h typedef problem found with MSDev 6.0
    +      - build libGL.so with -Bsymbolic (fixes bug found with Chromium)
    +      - added missing 'const' to glXGetContextIDEXT() in glxext.h
    +      - fixed a few glXGetProcAddress() errors (texture compression, etc)
    +      - fixed start index bug in compiled vertex arrays (Keith)
    +      - fixed compilation problems in src/SPARC/glapi_sparc.S
    +      - fixed triangle strip "parity" bug found in VTK medical1 demo (Keith)
    +      - use glXGetProcAddressARB in GLUT to avoid extension linking problems
    +      - provoking vertex of flat-shaded, color-index triangles was wrong
    +      - fixed a few display list bugs (GLUT walker, molecule, etc) (Keith)
    +      - glTexParameter didn't flush the vertex buffer (Ray Tice)
    +      - feedback attributes for glDraw/CopyPixels and glBitmap were wrong
    +      - fixed bug in normal length caching (ParaView lighting bug)
    +
    + +

    October 22, 2001

    +

    Mesa 4.0 has been released. This is a stable release. +

        New:
    +      - Mesa 4.0 implements the OpenGL 1.3 specification
    +      - GL_IBM_rasterpos_clip extension
    +      - GL_EXT_texture_edge_clamp extension (aka GL_SGIS_texture_edge_clamp)
    +      - GL_ARB_texture_mirrored_repeat extension
    +      - WindML UGL driver (Stephane Raimbault)
    +      - added OSMESA_MAX_WIDTH/HEIGHT queries
    +      - attempted compiliation fixes for Solaris 5, 7 and 8
    +      - updated glext.h and glxext.h files
    +      - updated Windows driver (Karl Schultz)
    +    Bug fixes:
    +      - added some missing GLX 1.3 tokens to include/GL/glx.h
    +      - GL_COLOR_MATRIX changes weren't recognized by teximage functions
    +      - glCopyPixels with scale and bias was broken
    +      - glRasterPos with lighting could segfault
    +      - glDeleteTextures could leave a dangling pointer
    +      - Proxy textures for cube maps didn't work
    +      - fixed a number of 16-bit color channel bugs
    +      - fixed a few minor memory leaks
    +      - GLX context sharing was broken in 3.5
    +      - fixed state-update bugs in glPopClientAttrib()
    +      - fixed glDrawRangeElements() bug
    +      - fixed a glPush/PopAttrib() bug related to texture binding
    +      - flat-shaded, textured lines were broken
    +      - fixed a dangling pointer problem in the XMesa code (Chris Burghart)
    +      - lighting didn't always produce the correct alpha value
    +      - fixed 3DNow! code to not read past end of arrays (Andrew Lewycky)
    +
    + + +

    June 21, 2001

    +

    Mesa 3.5 has been released. This is a new development release. +

        New:
    +	- internals of Mesa divided into modular pieces (Keith Whitwell)
    +	- 100% OpenGL 1.2 conformance (passes all conformance tests)
    +	- new AA line algorithm
    +	- GL_EXT_convolution extension
    +        - GL_ARB_imaging subset
    +        - OSMesaCreateContextExt() function
    +        - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add)
    +        - GL_MAX_TEXTURE_UNITS_ARB now defaults to eight
    +        - GL_EXT_fog_coord extension (Keith Whitwell)
    +        - GL_EXT_secondary_color extension (Keith Whitwell)
    +        - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add)
    +        - GL_SGIX_depth_texture extension
    +        - GL_SGIX_shadow and GL_SGIX_shadow_ambient extensions
    +        - demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow
    +        - GL_ARB_texture_env_combine extension
    +        - GL_ARB_texture_env_dot3 extension
    +        - GL_ARB_texture_border_clamp (aka GL_SGIS_texture_border_clamp)
    +        - OSMesaCreateContextExt() function
    +        - libOSMesa.so library, contains the OSMesa driver interface
    +        - GL/glxext.h header file for GLX extensions
    +        - somewhat faster software texturing, fogging, depth testing
    +        - all color-index conformance tests now pass (only 8bpp tested)
    +        - SPARC assembly language TCL optimizations (David Miller)
    +        - GL_SGIS_generate_mipmap extension
    +    Bug Fixes:
    +        - fbiRev and tmuRev were unitialized when using Glide3
    +        - fixed a few color index mode conformance failures; all pass now
    +        - now appling antialiasing coverage to alpha after texturing
    +        - colors weren't getting clamped to [0,1] before color table lookup
    +        - fixed RISC alignment errors caused by COPY_4UBV macro
    +        - drawing wide, flat-shaded lines could cause a segfault
    +        - vertices now snapped to 1/16 pixel to fix rendering of tiny triangles
    +    Changes:
    +        - SGI's Sample Implementation (SI) 1.3 GLU library replaces Mesa GLU
    +        - new libOSMesa.so library, contains the OSMesa driver interface
    +
    + + +

    May 17, 2001

    +

    Mesa 3.4.2 has been released. This is basically just a bug-fix release. +Here's what's new:

    +
        Bug fixes:
    +        - deleting the currently bound texture could cause bad problems
    +        - using fog could result in random vertex alpha values
    +         - AA triangle rendering could touch pixels outside right window bound
    +        - fixed byteswapping problem in clear_32bit_ximage() function
    +        - fixed bugs in wglUseFontBitmapsA(), by Frank Warmerdam
    +        - fixed memory leak in glXUseXFont()
    +        - fragment sampling in AA triangle function was off by 1/2 pixel
    +        - Windows: reading pixels from framebuffer didn't always work
    +        - glConvolutionFilter2D could segfault or cause FP exception
    +        - fixed segfaults in FX and X drivers when using tex unit 1 but not 0
    +        - GL_NAND logicop didn't work right in RGBA mode
    +        - fixed a memory corruption bug in vertex buffer reset code
    +        - clearing the softwara alpha buffer with scissoring was broken
    +        - fixed a few color index mode fog bugs
    +        - fixed some bad assertions in color index mode
    +        - fixed FX line 'stipple' bug #420091
    +    Changes:
    +        - optimized writing mono-colored pixel spans to X pixmaps
    +        - increased max viewport size to 2048 x 2048
    +
    + + +

    April 29, 2001

    +

    New Mesa website

    +

    Mark Manning produced the new website.
    Thanks, Mark!

    + + +

    February 14, 2001

    +

    Mesa 3.4.1 has been released. Here's what's new:

    +
        New:
    +        - fixed some Linux build problems
    +        - fixed some Windows build problems
    +        - GL_EXT_texture_env_dot3 extension (Gareth Hughes)
    +    Bug fixes:
    +        - added RENDER_START/RENDER_FINISH macros for glCopyTexImage in DRI
    +        - various state-update code changes needed for DRI bugs
    +        - disabled pixel transfer ops in glColorTable commands, not needed
    +        - fixed bugs in glCopyConvolutionFilter1D/2D, glGetConvolutionFilter
    +        - updated sources and fixed compile problems in widgets-mesa/
    +        - GLX_PBUFFER enum value was wrong in glx.h
    +        - fixed a glColorMaterial lighting bug
    +        - fixed bad args to Read/WriteStencilSpan in h/w stencil clear function
    +        - glXCopySubBufferMESA() Y position was off by one
    +        - Error checking of glTexSubImage3D() was broken (bug 128775)
    +        - glPopAttrib() didn't restore all derived Mesa state correctly
    +        - Better glReadPixels accuracy for 16bpp color - fixes lots of OpenGL
    +          conformance problems at 16bpp.
    +        - clearing depth buffer with scissoring was broken, would segfault
    +        - OSMesaGetDepthBuffer() returned bad bytesPerValue value
    +        - fixed a line clipping bug (reported by Craig McDaniel)
    +        - fixed RGB color over/underflow bug for very tiny triangles
    +    Known problems:
    +        - NURBS or evaluator surfaces inside display lists don't always work
    +
    +

    +

    November 3, 2000

    +

    Mesa 3.4 has been released. Here's what's new since the 3.3 release:

    +
        New:
    +    - optimized glDrawPixels for glPixelZoom(1,-1)
    +    Bug Fixes:
    +    - widgets-mesa/src/*.c files were missing from 3.3 distro
    +    - include/GL/mesa_wgl.h file was missing from 3.3 distro
    +    - fixed some Win32 compile problems
    +    - texture object priorities weren't getting initialized to 1.0
    +    - glAreTexturesResident return value was wrong when using hardware
    +    - glXUseXFont segfaulted when using 3dfx driver (via MESA_GLX_FX)
    +    - glReadPixels with GLushort packed types was broken
    +    - fixed a few bugs in the GL_EXT_texture_env_combine texture code
    +    - glPush/PopAttrib(GL_ENABLE_BIT) mishandled multi-texture enables
    +    - fixed some typos/bugs in the VB code
    +    - glDrawPixels(GL_COLOR_INDEX) to RGB window didn't work
    +    - optimized glDrawPixels paths weren't being used
    +    - per-fragment fog calculation didn't work without a Z buffer
    +    - improved blending accuracy, fixes Glean  blendFunc test failures
    +    - glPixelStore(GL_PACK/UNPACK_SKIP_IMAGES) wasn't handled correctly
    +    - glXGetProcAddressARB() didn't always return the right address
    +    - gluBuild[12]DMipmaps() didn't grok the GL_BGR pixel format
    +    - texture matrix changes weren't always detected (GLUT projtex demo)
    +    - fixed random color problem in vertex fog code
    +    - fixed Glide-related bug that let Quake get a 24-bit Z buffer
    +    Changes:
    +    - finished internal support for compressed textures for DRI
    +
    +

    +

    April 24, 2000

    +

    Mesa 3.2 has been released. Here's what's new since the beta release:

    +
        Bug fixes:
    +    - fixed memcpy bugs in span.c
    +    - fixed missing glEnd problem in demos/tessdemo.c
    +    - fixed bug when clearing 24bpp Ximages
    +    - fixed clipping problem found in Unreal Tournament
    +    - fixed Loki's "ice bug" and "crazy triangles" seen in Heretic2
    +    - fixed Loki's 3dfx RGB vs BGR bug
    +    - fixed Loki's 3dfx smooth/flat shading bug in SoF
    +    Changes:
    +    - updated docs/README file
    +    - use bcopy() optimizations on FreeBSD
    +    - re-enabled the optimized persp_textured_triangle() function
    +
    +

    +

    March 23, 2000

    +

    I've just upload the Mesa 3.2 beta 1 files to SourceForge at http://sourceforge.net/project/filelist.php?group_id=3

    +

    3.2 (note even number) is a stabilization release of Mesa 3.1 meaning it's mainly +just bug fixes.

    +

    Here's what's changed: + +

      + Bug fixes: +
        + - mixed drawing of lines and bitmaps sometimes had wrong colors
        + - added missing glHintPGI() function
        + - fixed a polygon culling bug
        + - fixed bugs in gluPartialDisk()
        + - Z values in selection mode were wrong
        + - added missing tokens: +
          + GL_SMOOTH_POINT_SIZE_RANGE
          + GL_SMOOTH_POINT_SIZE_GRANULARITY
          + GL_SMOOTH_LINE_WIDTH_RANGE
          + GL_SMOOTH_LINE_WIDTH_GRANULARITY
          + GL_ALIASED_POINT_SIZE_RANGE
          + GL_ALIASED_LINE_WIDTH_RANGE +
        + - fixed glCopyPixels when copying from back to front buffer
        + - GL_EXT_compiled_vertex_array tokens had _SGI suffix instead of _EXT
        + - glDrawRangeElements(GL_LINES, 0, 1, 2, type, indices) was broken
        + - glDeleteTextures() didn't decrement reference count correctly
        + - GL_SRCA_ALPHA_SATURATE blend mode didn't work correctly
        + - Actual depth of transformation matrix stacks was off by one
        + - 24bpp visuals didn't address pixels correctly
        + - mipmap level of detail (lambda) calculation simplified, more accurate
        + - 101691 - Polygon clipping and GL_LINE
        + - 101928 - Polygon clipping and GL_LINE (same fix as above)
        + - 101808 - Non-glVertexArrays tristrip bug
        + - 101971 - find_last_3f on Dec OSF (worked around)
        + - 102369 - segv on dec osf (possibly a duplicate of the above)
        + - 102893 - orientations of modelview cause segfault +
      + New: +
        + - updated SVGA Linux driver
        + - added the MESA_FX_NO_SIGNALS env var, see docs/README.3DFX
        + - build libGLw.a (Xt/OpenGL drawing area widget) library by default
        + - changed -O2 to -O3 for a number of gcc configs +
      + Changes: +
        + - glXCopyContext's mask parameter is now unsigned long, per GLX spec +
      +
    + +

    Please report any problems with this release ASAP. Bugs should be filed on the +Mesa3D website at sourceforge.
    +After 3.2 is wrapped up I hope to release 3.3 beta 1 soon afterward.

    +

    -- Brian

    +

    +

    December 17, 1999

    +

    A Slashdot interview with Brian about Mesa (questions submitted by Slashdot readers) +can be found at http://slashdot.org/interviews/99/12/17/0927212.shtml.

    +

    +

    December 14, 1999

    +

    Mesa 3.1 is released!

    +

    +

    September 21, 1999

    +

    There appear to be two new files on the ftp site, MesaLib-3.1beta3.tar.gz +and MesaDemos-3.1beta3.tar.gz, +that seem to be... yes, I've just received confirmation from the beta center, they +are indeed the THIRD beta release of Mesa 3.1! Happy Days. Happy Days. Thanks +Keith Whitwell for preparing these for us during Brian's absence.

    +

    +

    August 30, 1999

    +

    I'm pleased to announce that I've accepted a position with Precision Insight, +Inc. effective October, 1999. I'll be leaving Avid Technology in September.

    +

    I've been working on Mesa in my spare time for over five years. With Precision +Insight I now have the opportunity to devote my full attention to advancing Mesa +and OpenGL on Linux.

    +

    While I'll be focused on Linux, the X Window System, and hardware acceleration, +my work will continue to be open sourced and available to any other programmers who +may want to contribute to it, or use it for other projects or platforms

    +

    PS: I'm going to be traveling until Sep 6 and won't be reading email until then.

    +

    +

    August 23, 1999

    +

    Anonymous CVS access is back online so suck up all the bandwidth you can afford. +Note that this is a new archive, so you will need to re-checkout the archive. That +means don't cvs update from a previous download.

    +

    +

    August 17, 1999

    +

    A report from the SIGGRAPH '99 Linux/OpenGL +BOF meeting is now available.

    +

    -Brian

    +

    +

    August 14, 1999

    +

    www.mesa3d.org is having technical problems due to hardware failures at VA Linux +systems. The Mac pages, ftp, and CVS services aren't fully restored yet. Please be +patient.

    +

    -Brian

    +

    +

    June 7, 1999

    +

    RPMS of the nVidia RIVA server can be found at ftp://ftp.mesa3d.org/mesa/misc/nVidia/.

    +

    +

    June 2, 1999

    +

    nVidia has released some Linux binaries for +xfree86 3.3.3.1, along with the full source, which includes GLX acceleration +based on Mesa 3.0. They can be downloaded from http://www.nvidia.com/Products.nsf/htmlmedia/software_drivers.html.

    +

    +

    May 24, 1999

    +

    Beta 2 of Mesa 3.1 has been make available at ftp://ftp.mesa3d.org/mesa/beta/. +If you are into the quake scene, you may want to try this out, as it contains some +optimizations specifically in the Q3A rendering path. +

    +

    May 13, 1999

    +

    For those interested in the integration of Mesa into XFree86 4.0, Precision Insight +has posted their lowlevel design documents at http://www.precisioninsight.com.

    +

    +

    May 13, 1999

    +
    May 1999 - John Carmack of id Software, Inc. has made a donation of
    +US$10,000 to the Mesa project to support its continuing development.
    +Mesa is a free implementation of the OpenGL 3D graphics library and id's
    +newest game, Quake 3 Arena, will use Mesa as the 3D renderer on Linux.
    +
    +The donation will go to Keith Whitwell, who has been optimizing Mesa to
    +improve performance on 3d hardware.  Thanks to Keith's work, many
    +applications using Mesa 3.1 will see a dramatic performance increase
    +over Mesa 3.0.  The donation will allow Keith to continue working on
    +Mesa full time for some time to come.
    +
    +For more information about Mesa see www.mesa3d.org.  For more
    +information about id Software, Inc. see www.idsoftware.com.
    +
    +--------------------------------
    +
    +This donation from John/id is very generous.  Keith and I are very
    +grateful.
    +
    +
    +

    +

    May 1, 1999

    +

    John Carmack made an interesting .plan update yesterday: + +

      + "I put together a document on optimizing OpenGL drivers for Q3 that + should be helpful to the various Linux 3D teams.
      +
      http://www.quake3arena.com/news/glopt.html" +
    + +

    +

    April 7, 1999

    +

    Updated the Mesa contributors section and added links to RPM Mesa packages.

    +

    +

    March 18, 1999

    +

    The new webpages are now online. Enjoy, and let me know if you find any errors. +For an eye-candy free version you can use http://www.mesa3d.org/txt/.

    +

    +

    February 16, 1999

    +

    SGI releases its GLX +source code.

    +

    +

    January 22, 1999

    +

    www.mesa3d.org established

    + + +

    + + +
    + + diff --git a/mesalib/docs/openvg.html b/mesalib/docs/openvg.html new file mode 100644 index 000000000..442ee522f --- /dev/null +++ b/mesalib/docs/openvg.html @@ -0,0 +1,68 @@ + + +Mesa Release Notes + + + + + + + +

    OpenVG State Tracker

    + +

    +The current version of the OpenVG state tracker implements OpenVG 1.0. +

    +

    +More informations about OpenVG can be found at + +http://www.khronos.org/openvg/ . +

    +

    +The OpenVG state tracker depends on the Gallium architecture and a working EGL implementation. +

    + + +

    Building the library

    +
      +
    1. Build Mesa3D with Gallium3D. Any build that builds Gallium3D libraries and EGL will suffice
    2. +
    3. cd src/gallium/state_trackers/vega; make
    4. +
    5. The last step will build libOpenVG library. You can add the libdir to LD_LIBRARY_PATH or install libOpenVG
    6. +
    + +

    Sample build

    +A sample build looks as follows: +
    +  make linux-x86-64-debug
    +  cd src/gallium/state_trackers/vega
    +  make
    +  cd ../../../..
    +  export LD_LIBRARY_PATH=$PWD/lib64
    +  export EGL_DRIVER="egl_softpipe"
    +
    + +

    OpenVG Demos

    + +

    +To build the OpenVG demos: +

    +
    +  cd progs/openvg
    +  make
    +
    +

    +To run a demo: +

    +
    +  cd openvg/demos
    +  ./lion
    +
    + + +

    Notes

    +
      +
    • EGL_DRIVER environmental variable: forces usage of a specific EGL driver. Unless you force egl_softpipe the implementation will look for a DRI hardware accelerate driver and unless you have a Gallium driver that supports it, you'll see crashes
    • +
    + + + diff --git a/mesalib/docs/osmesa.html b/mesalib/docs/osmesa.html new file mode 100644 index 000000000..629d054f4 --- /dev/null +++ b/mesalib/docs/osmesa.html @@ -0,0 +1,88 @@ + + +Off-screen Rendering + + + + + +

    Off-screen Rendering

    + + +

    +Mesa's off-screen rendering interface is used for rendering into +user-allocated blocks of memory. +That is, the GL_FRONT colorbuffer is actually a buffer in main memory, +rather than a window on your display. +There are no window system or operating system dependencies. +One potential application is to use Mesa as an off-line, batch-style renderer. +

    + +

    +The OSMesa API provides three basic functions for making off-screen +renderings: OSMesaCreateContext(), OSMesaMakeCurrent(), and +OSMesaDestroyContext(). See the Mesa/include/GL/osmesa.h header for +more information about the API functions. +

    + +

    +There are several examples of OSMesa in the progs/osdemo/ +directory. +

    + + +

    Deep color channels

    + +

    +For some applications 8-bit color channels don't have sufficient +precision. +OSMesa supports 16-bit and 32-bit color channels through the OSMesa interface. +When using 16-bit channels, channels are GLushorts and RGBA pixels occupy +8 bytes. +When using 32-bit channels, channels are GLfloats and RGBA pixels occupy +16 bytes. +

    + +

    +Before version 6.5.1, Mesa had to be recompiled to support exactly +one of 8, 16 or 32-bit channels. +With Mesa 6.5.1, Mesa can be compiled for either 8, 16 or 32-bit channels +and render into any of the smaller size channels. +For example, if Mesa's compiled for 32-bit channels, you can also render +16 and 8-bit channel images. +

    + +

    +To build Mesa/OSMesa for 16 and 8-bit color channel support: +

    +      make realclean
    +      make linux-osmesa16
    +
    + +

    +To build Mesa/OSMesa for 32, 16 and 8-bit color channel support: +

    +      make realclean
    +      make linux-osmesa32
    +
    + +

    +You'll wind up with a library named libOSMesa16.so or libOSMesa32.so. +Otherwise, most Mesa configurations build an 8-bit/channel libOSMesa.so library +by default. +

    + +

    +If performance is important, compile Mesa for the channel size you're +most interested in. +

    + +

    +If you need to compile on a non-Linux platform, copy Mesa/configs/linux-osmesa16 +to a new config file and edit it as needed. Then, add the new config name to +the top-level Makefile. Send a patch to the Mesa developers too, if you're +inclined. +

    + + + diff --git a/mesalib/docs/pbuffers.html b/mesalib/docs/pbuffers.html new file mode 100644 index 000000000..259910155 --- /dev/null +++ b/mesalib/docs/pbuffers.html @@ -0,0 +1,54 @@ + + +PBuffer Rendering + + + + + +

    PBuffer Rendering

    + +

    +Basically, FBconfigs and PBuffers allow you to do off-screen rendering +with OpenGL. The OSMesa interface does basically the same thing, but +fbconfigs and pbuffers are supported by more vendors. +PBuffer rendering may also be hardware accelerated. +

    + +

    +PBuffers are getting more use nowadays, though they've actually been +around for a long time on IRIX systems and other workstations. +

    + +

    +The +GL_SGIX_fbconfig +and + +GL_SGIX_pbuffer extensions describe the functionality. +More recently, these extensions have been promoted to ARB extensions (on +Windows at least). +

    + +

    +The Mesa/progs/xdemos/ directory has some useful code for working +with pbuffers: +

    + +
      +
    • pbinfo.c - like glxinfo, it prints a list of available + fbconfigs and whether each supports pbuffers. +
    • pbutil.c - a few utility functions for dealing with + fbconfigs and pbuffers. +
    • pbdemo.c - a demonstration of off-screen rendering with pbuffers. +
    + +

    +Mesa 4.1 and later support GL_SGIX_fbconfig and GL_SGIX_pbuffer (software +rendering only). +

    + + + diff --git a/mesalib/docs/perf.html b/mesalib/docs/perf.html new file mode 100644 index 000000000..ee9c4b117 --- /dev/null +++ b/mesalib/docs/perf.html @@ -0,0 +1,68 @@ + + +Performance Tips + + + + + +

    Performance Tips

    + +

    +Performance tips for software rendering: +

    +
      + +
    1. Turn off smooth shading when you don't need it (glShadeModel) +
    2. Turn off depth buffering when you don't need it. +
    3. Turn off dithering when not needed. +
    4. Use double buffering as it's often faster than single buffering +
    5. Compile in the X Shared Memory extension option if it's supported + on your system by adding -DSHM to CFLAGS and -lXext to XLIBS for + your system in the Make-config file. +
    6. Recompile Mesa with more optimization if possible. +
    7. Try to maximize the amount of drawing done between glBegin/glEnd pairs. +
    8. Use the MESA_BACK_BUFFER variable to find best performance in double + buffered mode. (X users only) +
    9. Optimized polygon rasterizers are employed when: + rendering into back buffer which is an XImage + RGB mode, not grayscale, not monochrome + depth buffering is GL_LESS, or disabled + flat or smooth shading + dithered or non-dithered + no other rasterization operations enabled (blending, stencil, etc) +
    10. Optimized line drawing is employed when: + rendering into back buffer which is an XImage + RGB mode, not grayscale, not monochrome + depth buffering is GL_LESS or disabled + flat shading + dithered or non-dithered + no other rasterization operations enabled (blending, stencil, etc) +
    11. Textured polygons are fastest when: + using a 3-component (RGB), 2-D texture + minification and magnification filters are GL_NEAREST + texture coordinate wrap modes for S and T are GL_REPEAT + GL_DECAL environment mode + glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST ) + depth buffering is GL_LESS or disabled +
    12. Lighting is fastest when: + Two-sided lighting is disabled + GL_LIGHT_MODEL_LOCAL_VIEWER is false + GL_COLOR_MATERIAL is disabled + No spot lights are used (all GL_SPOT_CUTOFFs are 180.0) + No local lights are used (all position W's are 0.0) + All material and light coefficients are >= zero +
    13. XFree86 users: if you want to use 24-bit color try starting your + X server in 32-bit per pixel mode for better performance. That is, + start your X server with + startx -- -bpp 32 + instead of + startx -- -bpp 24 +
    14. Try disabling dithering with the MESA_NO_DITHER environment variable. + If this env var is defined Mesa will disable dithering and the + command glEnable(GL_DITHER) will be ignored. +
    + + + + diff --git a/mesalib/docs/precompiled.html b/mesalib/docs/precompiled.html new file mode 100644 index 000000000..50cb2af60 --- /dev/null +++ b/mesalib/docs/precompiled.html @@ -0,0 +1,20 @@ + + +Precompiled libraries + + + + + +

    Precompiled Libraries

    + +

    +In general, precompiled Mesa libraries are not available. +

    +

    +However, some Linux distros (such as Ubuntu) seem to closely track +Mesa and often have the latest Mesa release available as an update. +

    + + + diff --git a/mesalib/docs/relnotes-6.4.1.html b/mesalib/docs/relnotes-6.4.1.html new file mode 100644 index 000000000..3d6ff1c4f --- /dev/null +++ b/mesalib/docs/relnotes-6.4.1.html @@ -0,0 +1,68 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 6.4.1 / November 29, 2006

    + +

    +Mesa 6.4.1 is a stable, bug-fix release. +

    + + +

    MD5 checksums

    +
    +698ceb574cf882b0226761f5913c0da9  MesaLib-6.4.1.tar.gz
    +ea148c828ec6f645526451db1b8556f1  MesaLib-6.4.1.tar.bz2
    +42e93279468975ed2bf3111b8721e5d9  MesaLib-6.4.1.zip
    +e3b0d50807fd2bdcd1a95aaddd786f13  MesaDemos-6.4.1.tar.gz
    +99df1fdcb98d391666b476ca6f1dda8a  MesaDemos-6.4.1.tar.bz2
    +b999d2c6d92fb4b7740a3dbd889348e3  MesaDemos-6.4.1.zip
    +eadfe01fe5ddfb1eb8227dd567b31635  MesaGLUT-6.4.1.tar.gz
    +bd003bb4f981a4f91dee4c38644d4f3f  MesaGLUT-6.4.1.tar.bz2
    +71c401c037088bf688a88afdaeb3420f  MesaGLUT-6.4.1.zip
    +
    + + +

    Bug fixes

    +
      +
    • redefining a vertex program string didn't take effect in TNL module +
    • fixed occasional segfault upon vertex/fragment parsing error +
    • vertex program LIT instruction didn't handle 0^0=1 correctly +
    • fragment program fog option didn't work with glDrawPixels, glBitmap +
    • USE_MGL_NAMESPACE didn't work for x86-64 +
    • OSMesa demos were missing from previous release tarballs +
    • fixed problem with float->ushort conversion in glClear (bug 4992) +
    • popping of GL_EYE_PLANE texgen state was broken (bug 4996) +
    • popping of GL_SPOT_DIRECTION light state was broken (bug 5005) +
    • fixed occasional triangle color interpolation problem on VMS +
    • work around invalid free() call (bug 5131) +
    • fixed BSD X server compilation problem by including stdint.h +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa (Xlib)		implements OpenGL 1.5
    +OSMesa (off-screen)	implements OpenGL 1.5
    +Windows/Win32		implements OpenGL 1.5
    +Glide (3dfx Voodoo1/2)  requires updates	
    +SVGA			requires updates
    +DJGPP			requires updates
    +GGI			requires updates
    +BeOS			requires updates
    +Allegro			requires updates
    +D3D			requires updates
    +
    + + + diff --git a/mesalib/docs/relnotes-6.4.2.html b/mesalib/docs/relnotes-6.4.2.html new file mode 100644 index 000000000..f5a658f99 --- /dev/null +++ b/mesalib/docs/relnotes-6.4.2.html @@ -0,0 +1,75 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 6.4.2 / February 2, 2006

    + +

    +Mesa 6.4.2 is a stable, bug-fix release. +

    + + +

    MD5 checksums

    +
    +cb0d745d520fa7c2bb9178058b763544  MesaLib-6.4.2.tar.gz
    +7674d2c603b5834259e4e5a820cefd5b  MesaLib-6.4.2.tar.bz2
    +d224e1325b33ff71a0f3893fc6b4d594  MesaLib-6.4.2.zip
    +d4b345d4588fc750cd3d34f3ac26673e  MesaDemos-6.4.2.tar.gz
    +9cae1ab874af533ce356bd7dfe2e0bb0  MesaDemos-6.4.2.tar.bz2
    +2da6e1d1245e441d27813595c6ba50de  MesaDemos-6.4.2.zip
    +84427d18c3453f0ea52388eeba7169b5  MesaGLUT-6.4.2.tar.gz
    +b157ba8ad1ea63260cf5339132e7aac6  MesaGLUT-6.4.2.tar.bz2
    +fe1523744fc05edc3811dfc6a1bf4181  MesaGLUT-6.4.2.zip
    +
    + + +

    New features

    +
      +
    • added OSMesaColorClamp() function/feature +
    • added wglGetExtensionStringARB() function +
    + +

    Changes

    +
      +
    • GLUT tarball +
      +Starting with 6.4, the GLUT library sources are distributed in a separate +tarball. This was done at the request of Linux distro vendors who prefer +to use freeglut. +
    + +

    Bug fixes

    +
      +
    • fixed some problems when building on Windows +
    • GLw header files weren't installed by installmesa script (bug 5396) +
    • GL/glfbdev.h file was missing from tarballs +
    • fixed TNL initialization bug which could lead to crash (bug 5791) +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa (Xlib)		implements OpenGL 1.5
    +OSMesa (off-screen)	implements OpenGL 1.5
    +Windows/Win32		implements OpenGL 1.5
    +Glide (3dfx Voodoo1/2)  requires updates	
    +SVGA			requires updates
    +DJGPP			requires updates
    +GGI			requires updates
    +BeOS			requires updates
    +Allegro			requires updates
    +D3D			requires updates
    +
    + + + diff --git a/mesalib/docs/relnotes-6.4.html b/mesalib/docs/relnotes-6.4.html new file mode 100644 index 000000000..1fffa27f6 --- /dev/null +++ b/mesalib/docs/relnotes-6.4.html @@ -0,0 +1,90 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 6.4 / October 24, 2005

    + +

    +Mesa 6.4 is a stable, bug-fix release. +

    + + +

    MD5 checksums

    +
    +1cce0c1eb4fd15e9dfe837a1ce0c9812  MesaLib-6.4.tar.gz
    +85a84e47a3f718f752f306b9e0954ef6  MesaLib-6.4.tar.bz2
    +b976fea4f3ee06354c53f91b6e3f2ffc  MesaLib-6.4.zip
    +d8734f2c69bcf7ef9f5ae454a85743ba  MesaDemos-6.4.tar.gz
    +1a8c4d4fc699233f5fdb902b8753099e  MesaDemos-6.4.tar.bz2
    +607ab7c7a7de0cc5febbdde2bfa03098  MesaDemos-6.4.zip
    +3260156f66174322a092be0767962d34  MesaGLUT-6.4.tar.gz
    +0465d053f83775f44a12dec4050dfd78  MesaGLUT-6.4.tar.bz2
    +02abfcdcdf72ba938ae00f6e3b70fbe0  MesaGLUT-6.4.zip
    +
    + + +

    New

    +
      +
    • Added a fast XOR line drawing function in Xlib driver +
    • Added support for GL_ARB_texture_mirrored_repeat to savage driver (supported only on Savage4 hardware). +
    + +

    Changes

    +
      +
    • Mesa now packaged in three parts: Library, Demos and GLUT +
    + +

    Bug fixes

    +
      +
    • GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig +
    • Some files were present multiple times in the 6.3.2 tarballs +
    • r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207) +
    • glxgears_fbconfig demo didn't work (bug 4237) +
    • fixed bug when bilinear sampling 2d textures with borders +
    • glXCreatePbuffer() could segfault instead of returning 0 (bug 4235) +
    • fixed undefined frexp and rand in X.org libGLcore.a (bug 4242) +
    • fixed a few problems with proxy color tables (bug 4270) +
    • fixed precision problem in Z clearing (bug 4395) +
    • glBitmap, glDraw/CopyPixels mistakenly generated selection hits +
    • fixed potential segfault caused by reading pixels outside + of renderbuffer bounds +
    • glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB +
    • fixed memory corruption bug involving software alpha buffers +
    • glReadPixels clipped by window bounds was sometimes broken +
    • glDraw/CopyPixels of stencil data ignored the stencil write mask +
    • glReadPixels from a texture bound to a framebuffer object didn't work +
    • glIsRender/FramebufferEXT weren't totally correct +
    • fixed a number of point size attenuation/fade bugs +
    • fixed glFogCoord bug 4729 +
    • GLX encoding for transpose matrix functions was broken +
    • fixed broken fragment program KIL and SWZ instructions +
    • fragment programs that wrote result.depth.z didn't work +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa (Xlib)		implements OpenGL 1.5
    +OSMesa (off-screen)	implements OpenGL 1.5
    +Windows/Win32		implements OpenGL 1.5
    +Glide (3dfx Voodoo1/2)  requires updates	
    +SVGA			requires updates
    +DJGPP			requires updates
    +GGI			requires updates
    +BeOS			requires updates
    +Allegro			requires updates
    +D3D			requires updates
    +
    + + + diff --git a/mesalib/docs/relnotes-6.5.1.html b/mesalib/docs/relnotes-6.5.1.html new file mode 100644 index 000000000..0f03f931e --- /dev/null +++ b/mesalib/docs/relnotes-6.5.1.html @@ -0,0 +1,139 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 6.5.1 Release Notes / September 15, 2006

    + +

    +Mesa 6.5.1 is a 6.5 follow-on development release mostly consisting of +bug fixes. +

    + + +

    MD5 checksums

    +
    +d9a555297319bb932a3192952d53d073  MesaLib-6.5.1.tar.gz
    +c46f2c6646a270911b791dd8e1c2d977  MesaLib-6.5.1.tar.bz2
    +939eaaff33322bfeafac784402b45f4f  MesaLib-6.5.1.zip
    +9e4bbe83c007bfbaa67449a81cc3d36a  MesaDemos-6.5.1.tar.gz
    +0f2794baf7a9d98b22caea9f78c6942d  MesaDemos-6.5.1.tar.bz2
    +14c77eab9cc7a265c331abf239927c1c  MesaDemos-6.5.1.zip
    +c5f87c23aaf4eaf1bda0d007ea98366c  MesaGLUT-6.5.1.tar.gz
    +2525642fe7f454e3e1a1aad01359b406  MesaGLUT-6.5.1.tar.bz2
    +e33b165c22551e23b58ede8767378543  MesaGLUT-6.5.1.zip
    +
    + + +

    New Features

    +
      +
    • Intel i965 "broadwater" DRI driver + +
    • GL_APPLE_vertex_array_object - allows encapsulation of a set of vertex + arrays in an object. + +
    • GL_EXT_texture_sRGB - non-linearly mapped texture formats + +
    • GL_EXT_gpu_program_parameters - addes a few new functions for setting + multiple vertex/fragment program parameters with one call. +
    • "engine" demo +
    • updated fbdev driver and GLUT for fbdev (Sean D'Epagnier) +
    • many updates to the DRI drivers +
    + +

    Changes

    +
      +
    • The glVertexAttribARB functions no longer alias the conventional + vertex attributes. +
    • glxinfo program prints more info with -l option +
    • GL_FRAGMENT_PROGRAM_NV and GL_FRAGMENT_PROGRAM_ARB are now + compatible, in terms of glBindProgramARB() +
    • The GL_ARB_vertex_program attribute vertex.weight is now + accepted by the parser, even though the GL_ARB_vertex_blend and + GL_EXT_vertex_weighting extensions aren't supported. + Allows Warcraft to run. +
    + +

    Bug fixes

    +
      +
    • fixed broken texture border handling for depth textures (bug 6498) +
    • removed the test for duplicated framebuffer attachments, per + version 117 of the GL_EXT_framebuffer_object specification +
    • fixed a few render-to-texture bugs, including render to depth texture +
    • clipping of lines against user-defined clip planes was broken (6512) +
    • assembly language dispatch for SPARC was broken (bug 6484) +
    • assorted compilation fixes on various Unix platforms (Dan Schikore) +
    • glPopAttrib could restore an invalid value for GL_DRAW_BUFFER +
    • assorted minor fixes for 16 and 32 bit/channel modes +
    • fixed assorted bugs in texture compression paths +
    • fixed indirect rendering vertex array crashes (bug 6863) +
    • glDrawPixels GL_INDEX_OFFSET didn't always work +
    • fixed convolution memory leak (bug 7077) +
    • rectangular depth textures didn't work +
    • invalid mode to glBegin didn't generate an error (bug 7142) +
    • 'normalized' parameter to glVertexAttribPointerARB didn't work +
    • disable bogus GLX_SGI_video_sync extension in xlib driver +
    • fixed R128 driver locking bug (Martijn van Oosterhout) +
    • using evaluators with vertex programs caused crashes (bug 7564) +
    • fragment.position wasn't set correctly for point/line primitives +
    • fixed parser bug for scalar sources for GL_NV_fragment_program +
    • max fragment program length was incorrectly 128, now 1024 +
    • writes to result.depth in fragment programs weren't clamped to [0,1] +
    • fixed potential dangling pointer bug in glBindProgram() +
    • fixed some memory leaks (and potential crashes) in Xlib driver +
    • fixed a number of build issues on HP-UX (Christopher Bell) +
    • accum buffer didn't work with OSMesa interface +
    + + +

    Internal code changes

    + +

    +A number of Mesa program-related structs were renamed. +For example struct vertex_program is now struct gl_vertex_program. +All the effected drivers have been updated. +

    + +

    Ian Romanick updated the GL API dispatch code in a number of ways. +First, many old/unused extensions were removed. +Second, the static entrypoints for some extensions were removed. +This means GL function pointers will have to be used more often +(e.g. use glXGetProcAddressARB()). +

    + + +

    To Do (someday) items

    +
      +
    • Switch to freeglut +
    • Increase MAX_DRAWBUFFERS +
    • Fix linux-glide target/driver. +
    • Fix lambda calculation for frag progs. +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 1.5
    +OSMesa (off-screen)	implements OpenGL 1.5
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			implements OpenGL 1.3
    +Wind River UGL		implements OpenGL 1.3
    +Windows/Win32		implements OpenGL 1.5
    +DJGPP			implements OpenGL 1.5
    +GGI			implements OpenGL 1.3
    +BeOS			implements OpenGL 1.5
    +Allegro			needs updating
    +D3D			needs updating
    +
    + + + diff --git a/mesalib/docs/relnotes-6.5.2.html b/mesalib/docs/relnotes-6.5.2.html new file mode 100644 index 000000000..db2038ab0 --- /dev/null +++ b/mesalib/docs/relnotes-6.5.2.html @@ -0,0 +1,126 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 6.5.2 Release Notes / December 2, 2006

    + +

    +Mesa 6.5.2 is a 6.5 follow-on development release with a few new features +but mostly consisting of bug fixes. +

    + + +

    MD5 checksums

    +
    +11a033b078e090b3caaeb467234fe299  MesaLib-6.5.2.tar.gz
    +e4d894181f1859651658b3704633e10d  MesaLib-6.5.2.tar.bz2
    +63bf1d444fa738cca52ce1043e284021  MesaLib-6.5.2.zip
    +2b8f1375d16bda5f5a2304174cd5bcf7  MesaDemos-6.5.2.tar.gz
    +e870efe98d3a50be01ab211b9b2e25d9  MesaDemos-6.5.2.tar.bz2
    +d92cc6f5fee5ca75af0be04f9f4908f0  MesaDemos-6.5.2.zip
    +8d4d77e3a7132f4217bbc7c1ab157030  MesaGLUT-6.5.2.tar.gz
    +e84edbb11c69c8e408dfadd2ed08e95b  MesaGLUT-6.5.2.tar.bz2
    +c6d7134843ed5faf11f6686ecb5d2a2e  MesaGLUT-6.5.2.zip
    +
    + + +

    New features

    +
      +
    • New DRI memory manager system. Currently used by the i915tex driver. +Other DRI drivers will be updated to use the new memory manager in coming +months. +
      +To use the new driver you'll need the most recent DRM library and drivers +(version 2.2 or later) and a recent xf86-video-intel driver module from X.org. +
      +New features resulting from this work include: +
        +
      • EXT_framebuffer_objects, render to texture +
      • ARB_pixel_buffer_objects +
      • Accelerated CopyTexSubimage, DrawPixels, ReadPixels, CopyPixels +
      • Accelerated texture uploads from pixel buffer objects +
      • Potentially texturing directly from the pixel buffer object (zero +copy texturing). +
      +
    • New Intel i965 DRI driver +
    • New minstall script to replace normal install program +
    • Faster fragment program execution in software +
    • Added (or fixed) support for + GLX_SGI_make_current_read to the following drivers:
    • +
        +
      • radeon
      • +
      • savage
      • +
      • mga
      • +
      • tdfx
      • +
      +
    • Added support for ARB_occlusion_query to the tdfx driver (Ian +Romanick).
    • +
    + +

    Bug fixes

    +
      +
    • fixed invalid memory read while rendering textured points (bug 8320) +
    • fixed problems with freebsd-dri configuration (bug 8344) +
    • Mesa's fake glxGetCurrentContext() wasn't thread-aware +
    • OPTION NV_position_invariant didn't work in NV vertex programs +
    • glDrawPixels into a user-created framebuffer object could crash Xlib driver +
    • Line clipping was broken in some circumstances +
    • fragment.fogcoord register didn't always contain the correct value +
    • RGBA logicops didn't work reliably in some DRI drivers +
    • Fixed broken RGBA LogicOps in Intel DRI drivers +
    • Fixed some fragment program bugs in Intel i915 DRI driver +
    • Fixed glGetVertexAttribfvARB bug 8883 +
    • Implemented glGetUniform[fi]vARB() functions +
    • Fixed glDrawPixels(GL_COLOR_INDEX, GL_BITMAP) segfault (bug 9044) +
    • Fixed some gluBuild2DMipmaps() bugs (Greg McGarragh) +
    • Fixed broken "mgl" name mangling +
    • Indirect rending was broken for glMap* functions (bug 8899) +
    + + +

    Internal code changes

    + +
      +
    • The device driver functions ResizeBuffers and GetBufferSize have been +decprecated. +
    • OpenGL 2.0 and 2.1 support is nearly done. We need to do quite a bit +more testing of the shading language functions. +
    + + +

    To Do (someday) items

    +
      +
    • Switch to freeglut +
    • Increase MAX_DRAWBUFFERS +
    • Fix linux-glide target/driver. +
    • Improved lambda and derivative calculation for frag progs. +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 1.5
    +OSMesa (off-screen)	implements OpenGL 1.5
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			implements OpenGL 1.3
    +Wind River UGL		implements OpenGL 1.3
    +Windows/Win32		implements OpenGL 1.5
    +DJGPP			implements OpenGL 1.5
    +GGI			implements OpenGL 1.3
    +BeOS			implements OpenGL 1.5
    +Allegro			needs updating
    +D3D			needs updating
    +
    + + + diff --git a/mesalib/docs/relnotes-6.5.3.html b/mesalib/docs/relnotes-6.5.3.html new file mode 100644 index 000000000..0d68d9901 --- /dev/null +++ b/mesalib/docs/relnotes-6.5.3.html @@ -0,0 +1,119 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 6.5.3 Release Notes / April 27, 2007

    + +

    +Mesa 6.5.3 is a development release with many changes and new features. +Mesa 7.0 is expected to follow shortly. +

    + + +

    MD5 checksums

    +
    +39f33ea64e34e2d5b20640b008b57649  MesaLib-6.5.3.tar.gz
    +46359457147c469745f24b5074a186f0  MesaLib-6.5.3.tar.bz2
    +a8946fa861634ce15971396f47992c41  MesaLib-6.5.3.zip
    +08e26948d57eaca74d02a530b2d8106e  MesaDemos-6.5.3.tar.gz
    +8af91773ab2653fe537499676b05f2e8  MesaDemos-6.5.3.tar.bz2
    +783f81b171bf89b0929abc894efd25a6  MesaDemos-6.5.3.zip
    +9467d415388fe1ad82991fb20704b812  MesaGLUT-6.5.3.tar.gz
    +360843e46b7ebb6909290b023f9b26fa  MesaGLUT-6.5.3.tar.bz2
    +7686065e5c15a30de08a1610860b6840  MesaGLUT-6.5.3.zip
    +
    + + +

    Shared library numbering

    +

    +Mesa 6.5.3 supports the OpenGL 2.0/2.1 API. However, the (unix) +shared library version is still 1.5 (i.e. libGL.so.1.5.xxxxxx). +Bumping the shared library version to 2.x would cause linking problems +with existing OpenGL applications. Since OpenGL 2.x is backward +compatible with OpenGL 1.x the shared library version number doesn't +have to be incremented (which would indicate an incompatible ABI). +

    +

    +Other OpenGL vendors name their OpenGL 2.x libraries libGL.so.1.0.xxxxx +for the same reason. +

    + + + +

    New features

    +
      +
    • OpenGL 2.0 and 2.1 API support. +
    • Entirely new Shading Language code generator. See the +Shading Language page for more information. +
    • Much faster software execution of vertex, fragment shaders. +
    • New vertex buffer object (vbo) infrastructure +
    • Updated glext.h file (version 39) +
    • Updated glxext.h file (version 19) +
    • GL_MAX_DRAWBUFFERS is now 4 (software rendering) so + "multiple render targets" are really supported. +
    + +

    Bug fixes

    +
      +
    • Fog was errantly applied when a fragment shader was enabled (bug 9346) +
    • glPush/PopClientAttrib didn't handle VBO bindings correctly (bug 9445) +
    • With 32-bit Z buffer, the fragment Z of lines and points was sometimes wrong. +
    • GL_POST_CONVOLUTION_ALPHA_BIAS/SCALE was broken. +
    • 1D convolution state could effect 2D image transfers +
    • Overlapping glCopyPixels with negative Y zoom didn't work (bug 10521) +
    • Fixed a number of framebuffer/renderbuffer reference counting bugs +
    • Fixed a few bugs in software-emulated alpha planes +
    • Assorted minor bug fixes in glCopy/DrawPixels, glPixelZoom, etc. +
    • Assorted DRI driver bug fixes. +
    • Fixed a number of bugs that prevented "depth-peeling" rendering from working. +
    + + +

    Internal code changes

    +
      +
    • Old array_cache module replaced by new vbo module. All geometry +rendering is now cast in the form of vertex buffer objects. +
    • Massive changes to the Shading Language compiler and related state. +
    • Vertex/fragment shaders are compiled into GPU instructions and +programs very similar to GL_ARB_vertex/fragment_program. +
    • Vertex and fragment programs are executed with the same code now. +
    • The SSE-optimized vertex program path has been removed since it didn't +support more than 12 temp registers, didn't support branching/looping, etc. +
    + + +

    To Do (someday) items

    +
      +
    • Switch to freeglut +
    • Fix linux-glide target/driver. +
    • Improved lambda and derivative calculation for frag progs. +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-6.5.html b/mesalib/docs/relnotes-6.5.html new file mode 100644 index 000000000..9d1d6691e --- /dev/null +++ b/mesalib/docs/relnotes-6.5.html @@ -0,0 +1,131 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 6.5 Release Notes / March 31, 2006

    + +

    +Mesa 6.5 is a new development release. +

    + + +

    MD5 checksums

    +
    +657be3b92f6dabc78a67ed9cb8d67813  MesaLib-6.5.tar.gz
    +61beda590bfc5b4a12e979d5f2d70d7a  MesaLib-6.5.tar.bz2
    +19d48b872d579d4f91466060804a59ac  MesaLib-6.5.zip
    +694ad3a7007010c7418a9c72d1cba5b7  MesaDemos-6.5.tar.gz
    +ab95b590dcd640726a2d89e62068c66e  MesaDemos-6.5.tar.bz2
    +b792c303fefd87294488e2b7eab976e5  MesaDemos-6.5.zip
    +ac1d585483617db0c91e5c15cb5ec3a3  MesaGLUT-6.5.tar.gz
    +59f0bf2b2ffb67fe23ee479f9b044f31  MesaGLUT-6.5.tar.bz2
    +005decb2136718e22222ac1c4805cd15  MesaGLUT-6.5.zip
    +
    + + + +

    New Features

    +
      +
    • OpenGL Shading language support +
      + This includes the GL_ARB_shader_objects, GL_ARB_shading_language_100, + GL_ARB_vertex_shader and GL_ARB_fragment_shader extensions. Most of + the work was done by Michal Krol. + There's probably a fair number of bugs since this is a pretty large, + complicated body of code. +
      + The OpenGL 2.0 interface to these features will be implemented in a + future version of Mesa, + +
    • GL_EXT_timer_query +
      + Used to measure the time of OpenGL operations at high precision. + Only supported in the software/Xlib driver at this time. + +
    • GL_EXT_packed_depth_stencil +
      + Defines a new GL_DEPTH_STENCIL_EXT pixel format. + +
    • GL_EXT_framebuffer_blit +
      + A simplified glCopyPixels-like feature for copying pixel rectangles. + +
    • GL_ARB_half_float_pixel +
      + Adds a new half-precision floating point format for image transfers, + such as for glDrawPixels, glReadPixels, glTexImage, etc. +
    + +

    Changes

    +
      +
    • removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead) +
    • removed GL_SGIX/SGIS_pixel_texture extensions +
    +

    Bug fixes

    +
      +
    • fixed glxcontextmodes.c datatype problem (bug 5835) +
    • fixed aix-gcc build/install bugs (bug 5874) +
    • fixed some bugs in texture env program generation +
    • glXCopyContext() didn't handle texture object bindings properly +
    • glXCopyContext() didn't copy all lighting state +
    • fixed FreeBSD config (Pedro Giffuni) +
    • fixed some minor framebuffer object bugs +
    • replaced dprintf() with _glu_printf() in GLU (bug 6244) +
    • fixed a number of thread safety bugs/regressions +
    • fixed a number of GLU tesselator bugs (John Shell, bug 6339) +
    • paletted texturing was broken w/ floating point palettes (K. Schultz) +
    • lots of assorted framebuffer object bug fixes +
    + + +

    Known Issues

    +
      +
    • Rendering to depth textures will not work. Rendering to GL_DEPTH_STENCIL +textures should work. +
    + + +

    Driver Interface Changes

    +
      +
    • Stencil: The Driver.StencilOp/Func/Mask() functions have been replaced by +the two-sided versions: Driver.Stencil*Separate(). +
    • Render-to-texture: The functions for rendering to textures have changed. +
    + + +

    To Do (someday) items

    +
      +
    • Switch to freeglut +
    • Increase MAX_DRAWBUFFERS +
    • Fix linux-glide target/driver. +
    • Fix lambda calculation for frag progs. +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 1.5
    +OSMesa (off-screen)	implements OpenGL 1.5
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			implements OpenGL 1.3
    +Wind River UGL		implements OpenGL 1.3
    +Windows/Win32		implements OpenGL 1.5
    +DJGPP			implements OpenGL 1.5
    +GGI			implements OpenGL 1.3
    +BeOS			implements OpenGL 1.5
    +Allegro			needs updating
    +D3D			needs updating
    +
    + + + diff --git a/mesalib/docs/relnotes-7.0.1.html b/mesalib/docs/relnotes-7.0.1.html new file mode 100644 index 000000000..02713ad5e --- /dev/null +++ b/mesalib/docs/relnotes-7.0.1.html @@ -0,0 +1,101 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.0.1 Release Notes / August 3, 2007

    + +

    +Mesa 7.0.1 is a stable release with bug fixes since version 7.0. +

    + + +

    MD5 checksums

    +
    +db55141a44b902fcc61d9265b7862c06  MesaLib-7.0.1.tar.gz
    +c056abd763e899114bf745c9eedbf9ad  MesaLib-7.0.1.tar.bz2
    +ecc2637547fae2b38271ae362d013afa  MesaLib-7.0.1.zip
    +b85a4a5be4e829f4a1165e4514b13183  MesaDemos-7.0.1.tar.gz
    +3b66b3268df12ca8a6c4e0c4c457912c  MesaDemos-7.0.1.tar.bz2
    +b1c18006f16e44e80fea66774c59b391  MesaDemos-7.0.1.zip
    +b87a69986839ae43ce12fc8e3dc1ebb4  MesaGLUT-7.0.1.tar.gz
    +25f30d0c1651997b4412366ba0572f7f  MesaGLUT-7.0.1.tar.bz2
    +676ee6682a6ce78a5540554fd975c03e  MesaGLUT-7.0.1.zip
    +
    + + +

    New features

    +
      +
    • Added a bluegene-osmesa build config +
    + +

    Bug fixes

    +
      +
    • Fixed some MingW build issues +
    • Added a few missing OpenGL 2.0 API entrypoints: +
        +
      • glVertexAttrib4bv +
      • glVertexAttrib4iv +
      • glVertexAttrib4ubv +
      • glVertexAttrib4uiv +
      • glVertexAttrib4usv +
      +
    • Fixed glDrawPixels(GL_STENCIL_INDEX) pixel transfer bug 11457 +
    • GLSL bug fix: added vec2(vec4) constructor +
    • GLSL bug fix: .strq and .rgba writemasks didn't always work +
    • Stencil pixel map didn't always work for glDrawPixels (bug 11475) +
    • Fixed polygon stipple bug in i915 driver +
    • Binding a zero-sized texture didn't disable texturing (bug 11309) +
    • Queries of GL_INFO_LOG_LENGTH, GL_SHADER_SOURCE_LENGTH didn't include +the terminating zero (bug 11588) +
    • glXChooseFBConfig() in Xlib driver didn't handle GLX_STEREO flag properly +
    • Fixed a GLSL function call bug (#11731) +
    • glPointParameteriv(GL_DISTANCE_ATTENUATION_EXT) didn't work (bug 11754) +
    • glGetAttribLocation() always returned 1 (bug 11774) +
    • Fixed a few memory-related bugs in GLU library +
    + + +

    Changes

    +
      +
    • The libOSMesa library version has been reverted to 6.5.3 (soname=6) +in order to avoid application linking issues. Otherwise, applications +previously linked with libOSMesa.so.6 would no longer link with libOSMesa.so.7 +
    • Dropped obsolete, unmaintained Windows project files for VC6 and VC7. +
    + + +

    To Do (someday) items

    +
      +
    • Switch to freeglut +
    • Fix linux-glide target/driver. +
    • Improved lambda and derivative calculation for frag progs. +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.0.2.html b/mesalib/docs/relnotes-7.0.2.html new file mode 100644 index 000000000..7a7c70f13 --- /dev/null +++ b/mesalib/docs/relnotes-7.0.2.html @@ -0,0 +1,88 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.0.2 Release Notes / November 10, 2007

    + +

    +Mesa 7.0.2 is a stable release with bug fixes since version 7.0. +

    + + +

    MD5 checksums

    +
    +c9cf607f36e7e50172f5f9c7d552c34e  MesaLib-7.0.2.tar.gz
    +93e6ed7924ff069a4f883b4fce5349dc  MesaLib-7.0.2.tar.bz2
    +10c324c3613f90f059cb8429f700f300  MesaLib-7.0.2.zip
    +aa8b1244a5de1d23e5814bf9b67f1435  MesaDemos-7.0.2.tar.gz
    +11a10410bae7be85cf25bc7119966468  MesaDemos-7.0.2.tar.bz2
    +1dd0b5fd6d69430a2fd76a6adbfd8fff  MesaDemos-7.0.2.zip
    +a7dbf25c025955858bd2d89a6eb6db4c  MesaGLUT-7.0.2.tar.gz
    +3a33f8efc8c58a592a854cfc7a643286  MesaGLUT-7.0.2.tar.bz2
    +eba4ef2aa8c362ead81b54357f1903a3  MesaGLUT-7.0.2.zip
    +
    + + +

    New features

    +
      +
    • Updated Windows VC7 project files +
    • Added DESTDIR variable for 'make install' +
    • Added pkg-config files for gl, glu, glut and glw libraries +
    • Added bluegene-xlc-osmesa and catamount-osmesa-pgi configs +
    • Support for Intel G33/Q33/Q35 graphics chipsets +
    + +

    Bug fixes

    +
      +
    • Fixed a vertex buffer wrapping issue (bug 9962) +
    • Added mutex protection around texture object reference counters +
    • Added checking/support for additional chips in the i915/i945 family +(see 11978) +
    • Fixed a blending/banding issue (bug 11931) +
    • Fixed a GLU matrix inversion bug (#6748) +
    • Fixed problem with large glDrawArrays calls and indirect rendering (bug 12141) +
    • Fixed an assortment of i965 driver bugs +
    • Fixed x86-64 vertex transformation bug (12216) +
    • Fixed X server crash caused by multiple indirect rendering clients +
    • Parsing of state.texgen in ARB vertex/fragment programs didn't work (bug 12313) +
    • Fixed a glCopyPixels/glPixelZoom bug (12417) +
    • Fixed a bug when using glMaterial in display lists (bug 10604) +
    • Fixed a few GLUT/Fortran issues (Bill Mitchell) +
    • Fixed Blender crash bug (12164) +
    • Fixed some issues preventing cross-compiling +
    • Fixed up broken GL_ATI_separate_stencil extension +
    • glDrawArrays(count=0) led to a crash +
    • Fix SSE code gen memory leak, possible crash +
    • Fixed MMX 565 rgb conversion problem (bug 12614) +
    • Added -fno-strict-aliasing and -fPIC flags for gcc +
    • Fixed Blender crash in Unichrome driver (bug 13142) +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.0.3.html b/mesalib/docs/relnotes-7.0.3.html new file mode 100644 index 000000000..5c8efc79d --- /dev/null +++ b/mesalib/docs/relnotes-7.0.3.html @@ -0,0 +1,84 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.0.3 Release Notes / April 4, 2008

    + +

    +Mesa 7.0.3 is a stable release with bug fixes since version 7.0.2. +

    + + +

    MD5 checksums

    +
    +3fd1cb76531b2515ef7db92d9a93dbf8  MesaLib-7.0.3.tar.gz
    +e6e6379d7793af40a6bc3ce1bace572e  MesaLib-7.0.3.tar.bz2
    +97882bac195229ee0b78cab82e0e3be1  MesaLib-7.0.3.zip
    +8abf6bbcb1661e7dd4ce73b3fbb85898  MesaDemos-7.0.3.tar.gz
    +47fd6863621d3c9c7dbb870ab7f0c303  MesaDemos-7.0.3.tar.bz2
    +99e442e14da1928f76a7297bb421a3af  MesaDemos-7.0.3.zip
    +2b50fe9fadc4709b57c52adef09fce3c  MesaGLUT-7.0.3.tar.gz
    +0ff23c4e91b238abae63a5fc9fa003e7  MesaGLUT-7.0.3.tar.bz2
    +70e83554a4462dad28e0d6e20f79aada  MesaGLUT-7.0.3.zip
    +
    + + +

    Bug fixes

    +
      +
    • Added missing glw.pc.in file to release tarball +
    • Fix GLUT/Fortran issues +
    • GLSL gl_FrontLightModelProduct.sceneColor variable wasn't defined +
    • Fix crash upon GLSL variable array indexes (not yet supported) +
    • Two-sided stencil test didn't work in software rendering +
    • Fix two-sided lighting bugs/crashes (bug 13368) +
    • GLSL gl_FrontFacing didn't work properly +
    • glGetActiveUniform returned incorrect sizes (bug 13751) +
    • Fix several bugs relating to uniforms and attributes in GLSL API (Bruce Merry, bug 13753) +
    • glTexImage3D(GL_PROXY_TEXTURE_3D) mis-set teximage depth field +
    • Fixed GLX indirect vertex array rendering bug (14197) +
    • Fixed crash when deleting framebuffer objects (bugs 13507, 14293) +
    • User-defined clip planes enabled for R300 (bug 9871) +
    • Fixed glBindTexture() crash upon bad target (bug 14514) +
    • Fixed potential crash in glDrawPixels(GL_DEPTH_COMPONENT) (bug 13915) +
    • Bad strings given to glProgramStringARB() didn't generate GL_INVALID_OPERATION +
    • Fixed minor point rasterization regression (bug 11016) +
    • state.texenv.color state var didn't work in GL_ARB_fragment_program (bug 14931) +
    • glBitmap from a PBO didn't always work +
    • glGetTexImage into a PBO didn't always work +
    • Comments at the end of ARB vertex/fragment programs crashed the parser +
    + +

    Changes

    +
      +
    • Updated glext.h to version 40 +
    + + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.0.4.html b/mesalib/docs/relnotes-7.0.4.html new file mode 100644 index 000000000..f100d99f0 --- /dev/null +++ b/mesalib/docs/relnotes-7.0.4.html @@ -0,0 +1,80 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.0.4 Release Notes / August 16, 2008

    + +

    +Mesa 7.0.4 is a stable release with bug fixes since version 7.0.3. +

    + + +

    MD5 checksums

    +
    +909afa3a01ae31478d363837681415ac  MesaLib-7.0.4.tar.gz
    +8d7bacbe0234742a5d08c8088c4619e9  MesaLib-7.0.4.tar.bz2
    +5e44261ef85b049a868e1785d9adc276  MesaLib-7.0.4.zip
    +53dcd77d37a819feaf50b5fcdd0a6e0f  MesaDemos-7.0.4.tar.gz
    +c1215b31c5f7b85f81eed3bfba07d556  MesaDemos-7.0.4.tar.bz2
    +b1825a7361f116b28d82d328077630b4  MesaDemos-7.0.4.zip
    +d7677d015f52602d1bf8b837fb717848  MesaGLUT-7.0.4.tar.gz
    +f5f8b46f7e763d9f7b7d1d115c1c44ee  MesaGLUT-7.0.4.tar.bz2
    +a786775271a02c62a3370b13b26bf48d  MesaGLUT-7.0.4.zip
    +
    + + +

    Bug fixes

    +
      +
    • define #extension GL_ARB_texture_rectangle in shading language +
    • fixed WIN32 compile problem in libGLU +
    • Fixed a per-vertex glMaterial bug which could cause bad lighting +
    • Fixed potential crash in AA/smoothed triangle rendering when using a fragment shader +
    • Fixed glDrawElement + VBO segfault (bug 16156) +
    • Fixed GLSL linker bug causing generic vertex attributes to get aliased +
    • Fixed stack overflow when using glPixelZoom on Windows +
    • Fixed broken all(bvec2) GLSL function, added misc missing bvec constructors +
    • ARB program "state.clip[n].plane" didn't parse correctly +
    • Fixed broken glGetUniformiv() (bug 13774) +
    + +

    Changes

    +
      +
    • Including the latest glext.h and glxext.h header files from Khronos +
    • Added support for DragonFly OS +
    • Added a build config for FreeBSD static libs (Anatolij Shkodin) +
    • Enabled GL_EXT_multi_draw_arrays extension in R200/R300 drivers +
    • Enabled GL_ARB_point_sprite extension in I965 driver +
    • Enabled GL_EXT_texture_sRGB extension in I965 driver +
    • Added support for GL shading language in I965 driver +
    + + + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.0.html b/mesalib/docs/relnotes-7.0.html new file mode 100644 index 000000000..2c036b2ec --- /dev/null +++ b/mesalib/docs/relnotes-7.0.html @@ -0,0 +1,93 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.0 Release Notes / June 22, 2007

    + +

    +Mesa 7.0 is a stable release, featuring OpenGL 2.1 API support. +A number of bugs have been fixed since the 6.5.3 release. +

    + + +

    MD5 checksums

    +
    +35a1698986f7ac8dc435624ee9256cda  MesaLib-7.0.tar.gz
    +50c371455fa7532c04aa0a970f9bc51f  MesaLib-7.0.tar.bz2
    +bcedb6f43c97c1bc49e5cc7f12835722  MesaLib-7.0.zip
    +9bad332c7b74f59be96556135212ca9e  MesaDemos-7.0.tar.gz
    +fada2bc1f29da513e015fda1e3abd0c0  MesaDemos-7.0.tar.bz2
    +84e3bbe470d983ae32f1f0c779faf99e  MesaDemos-7.0.zip
    +76c7bb54f9850c689eba844f6daed332  MesaGLUT-7.0.tar.gz
    +4af28296e02772ef1de00e4e79bf3d12  MesaGLUT-7.0.tar.bz2
    +9043cb0b54cc03d1874728d74b12188c  MesaGLUT-7.0.zip
    +
    + + +

    New features

    +
      +
    • OpenGL 2.0 and 2.1 API support. +
    + +

    Bug fixes

    +
      +
    • Fixed a few fog-related bugs. +
    • Fixed broken GLSL mix() function. +
    • Fixed broken GLSL exp() functions. +
    • Fixed GLSL mod4(vec4, vec4) bug. +
    • Implemented GLSL asin(), acos(), atan() functions. +
    • Fixed an R300 driver bug that caused Xorg composite manager to crash +
    • Fixed R300 vertex program/matrix bug (10848) +
    • GLSL dFdx() and dFdy() work for fragment program inputs now (texcoords) +
    • Specifying an invalid texture unit as a sampler could lead to a crash +
    • The GLX protocol request for glXDestroyPBuffer() was incorrect (bug 10983) +
    • ARB vp state.light[n].half value was incorrect (bug 10987) +
    • Fixed a positional light source bug (bug 11009) +
    • Fixed point size attenuation problem (bug 11042) +
    • glPopAttrib didn't restore texture object's LOD bias (bug 11049) +
    • Fixed a TLS / TEXTREL problem (bug 7459) +
    + + +

    Internal code changes

    +
      +
    • Some texture code consolidation and simplifiction (Ian Romanick) +
    • R300 driver clean-ups. +
    + + +

    To Do (someday) items

    +
      +
    • Switch to freeglut +
    • Fix linux-glide target/driver. +
    • Improved lambda and derivative calculation for frag progs. +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.1.html b/mesalib/docs/relnotes-7.1.html new file mode 100644 index 000000000..e8a39c8d3 --- /dev/null +++ b/mesalib/docs/relnotes-7.1.html @@ -0,0 +1,94 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.1 Release Notes / August 26, 2008

    + +

    +Mesa 7.1 is a new development release. +There have been many internal code changes since Mesa 7.0.x. +It should be relatively stable, but those who are especially concerned about +stability should wait for Mesa 7.2 or use Mesa 7.0.4 (the previous stable +release). +

    + +Note that this version of Mesa does not use the GEM memory manager. +The master branch of git uses GEM. +

    +

    +DRM version 2.3.1 should be used with Mesa 7.1 +

    + + +

    MD5 checksums

    +
    +971c2fe6e6949dc5ba200a6f97a6dc81  MesaLib-7.1.tar.gz
    +6bff7f532d16f90f944a400c8bd7074d  MesaLib-7.1.tar.bz2
    +d48224bf9d54c3da6776adb4869ba024  MesaLib-7.1.zip
    +3de268420efca43e9a19ab506cdfc993  MesaDemos-7.1.tar.gz
    +abfc9775e1462363af8ec160d1feb01f  MesaDemos-7.1.tar.bz2
    +f7b3623387c4036e9895cd9ac0dfad99  MesaDemos-7.1.zip
    +fdf348f78cd09304b6ff801ef8acc8eb  MesaGLUT-7.1.tar.gz
    +f6d88a4eeb02e98c7e92f1c895d3c76b  MesaGLUT-7.1.tar.bz2
    +4dc102a5ca51e1c41dde87d3f8c7b22a  MesaGLUT-7.1.zip
    +
    + + +

    New features

    +
      +
    • autoconf-based configuration (and clean-up of Makefiles) +
    • Assorted DRI driver enhancements +
    • Reduced dependencies between X server and Mesa +
    • GL_EXT_texture_from_pixmap extension for Xlib driver +
    • Support for the GL shading language with i965 driver (implemented by Intel) +
    • ATI R500 series support (Radeon X1300–X1950) in r300 DRI driver +
    + + +

    Bug fixes

    +
      +
    • Numerous GLSL fixes +
    • Fixed some error code/detection bugs in the GLSL-related API functions +
    • Lots of DRI driver fixes. +
    + + +

    To Do (someday) items

    +
      +
    • Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy(). +Probably do the same for malloc, calloc, etc. +The wrappers were useful in the past for memory debugging but now we +have valgrind. Not worried about SunOS 4 support anymore either... +
    • Switch to freeglut +
    • Fix linux-glide target/driver. +
    • Improved lambda and derivative calculation for frag progs. +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.2.html b/mesalib/docs/relnotes-7.2.html new file mode 100644 index 000000000..0ad3b5b60 --- /dev/null +++ b/mesalib/docs/relnotes-7.2.html @@ -0,0 +1,104 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.2 Release Notes / 20 September 2008

    + +

    +Mesa 7.2 is a stable release fixing bugs found in 7.1, which was a +new development release. +

    +

    +Mesa 7.2 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +Note that this version of Mesa does not use the GEM memory manager. +The master branch of git uses GEM. +The prototype DRI2 code that was in 7.1 has also been removed. +

    +

    +DRM version 2.3.1 should be used with Mesa 7.2 +

    + + +

    MD5 checksums

    +
    +81a2a4b7cbfce7553f7ad8d924edbe2f  MesaLib-7.2.tar.gz
    +04d379292e023df0b0266825cb0dbde5  MesaLib-7.2.tar.bz2
    +8bc497a37977a55e987a4d1fabc3d882  MesaLib-7.2.zip
    +10c762e39486df395838af1d7b57e69c  MesaDemos-7.2.tar.gz
    +22e03dc4038cd63f32c21eb60994892b  MesaDemos-7.2.tar.bz2
    +1197bc4eb3bf44e291c14d4eb2e19381  MesaDemos-7.2.zip
    +42e3c6c6d156cd9dc545dbef72407354  MesaGLUT-7.2.tar.gz
    +f67daf93e12c4a459703bbf3e4004e31  MesaGLUT-7.2.tar.bz2
    +0390567eb2c2d12fbf82e8523fd77e2b  MesaGLUT-7.2.zip
    +
    + + +

    New features

    +
      +
    • i965 driver: added support for G41 chipset (Intel) +
    + + +

    Bug fixes

    +
      +
    • Fixed display list bug involving primitives split across lists (bug 17564) +
    • Fixed some issues with glBindAttribLocation() +
    • Fixed crash in _tnl_InvalidateState() found with Amira (bug 15834) +
    • Assorted bug fixes for Ming build +
    • Fixed some vertex/pixel buffer object reference counting bugs +
    • Fixed depth/stencil bug in i915/945 driver +
    • Fixed some shader flow control bugs in i965 driver +
    • Fixed a few tdfx driver bugs which prevented driver from working +
    • Fixed multisample enable/disable bug +
    + +

    Changes

    +
      +
    • Updated SGI header files with new license terms. +
    + + + +

    To Do (someday) items

    +
      +
    • Remove the MEMCPY() and _mesa_memcpy() wrappers and just use memcpy(). +Probably do the same for malloc, calloc, etc. +The wrappers were useful in the past for memory debugging but now we +have valgrind. Not worried about SunOS 4 support anymore either... +
    • Switch to freeglut +
    • Fix linux-glide target/driver. +
    • Improved lambda and derivative calculation for frag progs. +
    + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.3.html b/mesalib/docs/relnotes-7.3.html new file mode 100644 index 000000000..df8988443 --- /dev/null +++ b/mesalib/docs/relnotes-7.3.html @@ -0,0 +1,93 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.3 Release Notes / 22 January 2009

    + +

    +Mesa 7.3 is a new development release. +Users especially concerned with stability should stick with latest +stable release: version 7.2. +

    +

    +Mesa 7.3 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +8ed03191432b22d118d88d6db497f304  MesaLib-7.3.tar.gz
    +781e7811a6ed5c97b2b8defefc8ffbc9  MesaLib-7.3.tar.bz2
    +3ccba9a1734ed6d4b3389e1535d90fbf  MesaLib-7.3.zip
    +d312e974b31043b13b61bac5fbf00b87  MesaDemos-7.3.tar.gz
    +3f0741394069bdf2329565a387396cda  MesaDemos-7.3.tar.bz2
    +4d0887fd4c66a824295cdd619f6d34cb  MesaDemos-7.3.zip
    +2d7661b66022bcb8878728f3d5bd33ab  MesaGLUT-7.3.tar.gz
    +abe8036a724c1a483bdad6b5a55ddc1a  MesaGLUT-7.3.tar.bz2
    +5f247819b47e2a7c62d07a6afe5262fb  MesaGLUT-7.3.zip
    +
    + + +

    New features

    +
      +
    • Support for GLSL 1.20 +
    • Intel DRI drivers now use GEM and DRI2 +
    + + +

    Bug fixes

    +
      +
    • Assorted GLSL bug fixes +
    • Assorted i965 driver fixes +
    • Fix for wglCreateLayerContext() in WGL/Windows driver +
    • Build fixes for OpenBSD and gcc 2.95 +
    • GLSL preprocessor handles #pragma now +
    • Fix incorrect transformation of GL_SPOT_DIRECTION +
    • Fixed several bugs (#18367 and #19625) in glXMakeContextCurrent() +
    • Assorted Windows build fixes +
    + +

    Changes

    +
      +
    • Deprecated the "XMesa" interface (include/GL/xmesa*.h files) +
    • Deprecated the "FXMesa" interface (include/GL/fxmesa.h file) +
    • Deprecated the "Allegro" interface (include/GL/amesa.h file) +
    • Removed include/GL/uglmesa.h header +
    • Removed include/GLView.h header for BeOS +
    + + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.4.1.html b/mesalib/docs/relnotes-7.4.1.html new file mode 100644 index 000000000..40f4fb172 --- /dev/null +++ b/mesalib/docs/relnotes-7.4.1.html @@ -0,0 +1,79 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.4.1 Release Notes / 18 April 2009

    + +

    +Mesa 7.4.1 is a stable development release fixing bugs since the 7.4 release. +

    +

    +Mesa 7.4.1 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +0c3a72f3295a53a134c04bd7d209ea62  MesaLib-7.4.1.tar.gz
    +423260578b653818ba66c2fcbde6d7ad  MesaLib-7.4.1.tar.bz2
    +84f78b154d4bd5c3ecc42eeff2e56676  MesaLib-7.4.1.zip
    +aa0ad323e59d6d10ff33ac0dde462a60  MesaDemos-7.4.1.tar.gz
    +1e169fb6abc2b45613f1c98a82dfe690  MesaDemos-7.4.1.tar.bz2
    +294e42be2d74176596c994ec23322fcf  MesaDemos-7.4.1.zip
    +92373bfa48e7b68dddf356e86b0e5699  MesaGLUT-7.4.1.tar.gz
    +336f3824b578b072211e0beecf4f04f4  MesaGLUT-7.4.1.tar.bz2
    +20751388d8ef16b42d25d9e3d705d101  MesaGLUT-7.4.1.zip
    +
    + + +

    Bug fixes

    +
      +
    • Fixed a two-sided lighting bug in fixed-function-to-GPU code generation +
    • Fixed some Darwin issues (Jeremy Huddleston) +
    • Indexing the GLSL gl_EyePlane[] or gl_ObjectPlane[] arrays with a variable + was broken, bug 20986 +
    • Fixed incorrect texture unit bias in TXB instruction +
    • glTexParameter settings weren't always propogated to drivers +
    • Assorted vertex/fragment program bug fixes +
    • Fixed point rendering in software rasterizer +
    • Fixed potential deadlock in object hash functions +
    • Fix a couple bugs surrounding front-buffer rendering with DRI2, but this + is not quite complete. +
    • Fixed glPopAttrib() bug when restoring user clip planes +
    + + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.4.2.html b/mesalib/docs/relnotes-7.4.2.html new file mode 100644 index 000000000..7d066e418 --- /dev/null +++ b/mesalib/docs/relnotes-7.4.2.html @@ -0,0 +1,74 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.4.2 Release Notes / May 15, 2009

    + +

    +Mesa 7.4.2 is a stable development release fixing bugs since the 7.4.1 release. +

    +

    +Mesa 7.4.2 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +172f5193154dad731387f97bd44ab68f  MesaLib-7.4.2.tar.gz
    +b10a76e32bde4645cfc34ea0416d7d8b  MesaLib-7.4.2.tar.bz2
    +cc6dfc2efd424cc342b84e6bcd78ce5d  MesaLib-7.4.2.zip
    +182a7e78aa7a480b3650a5c956dbddd1  MesaDemos-7.4.2.tar.gz
    +bf559a0485667a3bfa4513a23501579b  MesaDemos-7.4.2.tar.bz2
    +5379e622b65e8c22022dba34aeb6f4f9  MesaDemos-7.4.2.zip
    +7cc43c1c35bf6a279a16e063dea3b8c5  MesaGLUT-7.4.2.tar.gz
    +e0dfc44d537904a030861e5b3c760c11  MesaGLUT-7.4.2.tar.bz2
    +4a6cf5bbbac190d6ba97448b3098b7f4  MesaGLUT-7.4.2.zip
    +
    + + +

    Bug fixes

    +
      +
    • Fixed segfault when rendering to front buffer with DRI 1. +
    • Fixed swrast texture rectangle bug when wrap mode = GL_CLAMP_TO_BORDER and + filter mode = GL_LINEAR. (bug 21461) +
    • Fixed texture object mem leak during context destruction. +
    • Fixed a state validation bug in glCopyTex[Sub]Image() +
    • Fixed some i965 GLSL bugs. +
    • Fixed an R300 driver texture object bad memory reference. +
    + + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.4.3.html b/mesalib/docs/relnotes-7.4.3.html new file mode 100644 index 000000000..35b5dccbb --- /dev/null +++ b/mesalib/docs/relnotes-7.4.3.html @@ -0,0 +1,79 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.4.3 Release Notes / 19 June 2009

    + +

    +Mesa 7.4.3 is a stable development release fixing bugs since the 7.4.2 release. +

    +

    +Mesa 7.4.3 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +34c5a6c47ed51f31c4fa36e269831352  MesaLib-7.4.3.tar.gz
    +70a983ba3deaa8bd63b18bbab283f698  MesaLib-7.4.3.tar.bz2
    +34f21b3205b271d575030aa98a2dda51  MesaLib-7.4.3.zip
    +56752b7adede212e6097afb10d0c0d59  MesaDemos-7.4.3.tar.gz
    +8ffa51c4833b1e298300a005e2d7ca2a  MesaDemos-7.4.3.tar.bz2
    +0037d24d41400d6fb9800ae55b8c863f  MesaDemos-7.4.3.zip
    +20e24f6692c0c90e7e3b220f79c4108d  MesaGLUT-7.4.3.tar.gz
    +03a4beeef74fc5ef0b1d6d04710e5a8a  MesaGLUT-7.4.3.tar.bz2
    +273788230adbdb9d57371309adedcf5f  MesaGLUT-7.4.3.zip
    +
    + + +

    Bug fixes

    +
      +
    • Fixed texture object reference counting bug (bug 21756) +
    • Allow depth/stencil textures to be attached to GL_STENCIL_ATTACHMENT point + (SF bug 2793846) +
    • Added missing glGet case for GL_VERTEX_ARRAY_BINDING_APPLE +
    • Fixed some OSMesa build issues +
    • Fixed a vertex buffer object crash +
    • Fixed broken glTexImage3D() when image type = GL_BITMAP +
    • Fixed some GLSL preprocessor bugs +
    • Fixed framebuffer mem leak in i945/i965 DRI drivers +
    • Fixed texture coordinate repeat bug in swrast (bug 21872) +
    • Fixed incorrect viewport clamping (lower bound is zero, not one) +
    • GLX fix for glean's makeCurrent test case +
    + + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.4.4.html b/mesalib/docs/relnotes-7.4.4.html new file mode 100644 index 000000000..2a34568a7 --- /dev/null +++ b/mesalib/docs/relnotes-7.4.4.html @@ -0,0 +1,68 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.4.4 Release Notes / 23 June 2009

    + +

    +Mesa 7.4.4 is a stable development release fixing bugs since the 7.4.3 release. +

    +

    +Mesa 7.4.4 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +0b56fe5a88ab0c3c5b2da5068f63f416  MesaLib-7.4.4.tar.gz
    +b66528d314c574dccbe0ed963cac5e93  MesaLib-7.4.4.tar.bz2
    +2818076f3ba23fa87fdfe4602a637a18  MesaLib-7.4.4.zip
    +3e77b208386c47b18165bce5ae317e2c  MesaDemos-7.4.4.tar.gz
    +628142ec9a54cd28cc027e6ce26cff47  MesaDemos-7.4.4.tar.bz2
    +d08a30d30ab7174859aa709cba6c726d  MesaDemos-7.4.4.zip
    +e6e91ba16e274d40cf3a97ad3218af01  MesaGLUT-7.4.4.tar.gz
    +e14bbb52517e8121b31f1387515365ab  MesaGLUT-7.4.4.tar.bz2
    +f10ed20469753c2b3d68c99854f80fd4  MesaGLUT-7.4.4.zip
    +
    + + +

    Bug fixes

    +
      +
    • Fixed i965/i915 segfault in screen destruction (bug 22408) +
    + + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.4.html b/mesalib/docs/relnotes-7.4.html new file mode 100644 index 000000000..55ba019b2 --- /dev/null +++ b/mesalib/docs/relnotes-7.4.html @@ -0,0 +1,89 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.4 Release Notes / 27 March 2009

    + +

    +Mesa 7.4 is a stable development release fixing bugs since the 7.3 release. +

    +

    +Mesa 7.4 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +ed6bd7437177307e51e16d0c7c381dfa  MesaLib-7.4.tar.gz
    +7ecddb341a2691e0dfdb02f697109834  MesaLib-7.4.tar.bz2
    +433e823f8245f9fd5f397e7b719a8e47  MesaLib-7.4.zip
    +656eee6128016fb237e01aa8dabbc703  MesaDemos-7.4.tar.gz
    +02816f10f30b1dc5e069e0f68c177c98  MesaDemos-7.4.tar.bz2
    +44a70d6db4aa4c64ecc47871b6aceee8  MesaDemos-7.4.zip
    +25f80db4f8645cd3e58e2c9af53ec341  MesaGLUT-7.4.tar.gz
    +04ec01caebde44f5b0d619f00716b368  MesaGLUT-7.4.tar.bz2
    +019dc213baecaa3cb1278847d41b8591  MesaGLUT-7.4.zip
    +
    + + +

    New features

    +
      +
    • Added MESA_GLX_FORCE_DIRECT env var for Xlib/software driver +
    • GLSL version 1.20 is returnd by the GL_SHADING_LANGUAGE_VERSION query +
    + + +

    Bug fixes

    +
      +
    • glGetActiveUniform() returned wrong size for some array types +
    • Fixed some error checking in glUniform() +
    • Fixed a potential glTexImage('proxy target') segfault +
    • Fixed bad reference counting for 1D/2D texture arrays +
    • Fixed VBO + glPush/PopClientAttrib() bug #19835 +
    • Assorted i965 driver bug fixes +
    • Fixed a Windows compilation failure in s_triangle.c +
    • Fixed a GLSL array indexing bug +
    • Fixes for building on Haiku +
    + +

    Changes

    +
      +
    • Updated GL/glxext.h to version 48 +
    • Assorted updates for building on Solaris +
    + + + +

    Driver Status

    + +
    +Driver			Status
    +----------------------	----------------------
    +DRI drivers		varies with the driver
    +XMesa/GLX (on Xlib)	implements OpenGL 2.1
    +OSMesa (off-screen)	implements OpenGL 2.1
    +Windows/Win32		implements OpenGL 2.1
    +Glide (3dfx Voodoo1/2)	implements OpenGL 1.3
    +SVGA			unsupported
    +Wind River UGL		unsupported
    +DJGPP			unsupported
    +GGI			unsupported
    +BeOS			unsupported
    +Allegro			unsupported
    +D3D			unsupported
    +
    + + + diff --git a/mesalib/docs/relnotes-7.5.1.html b/mesalib/docs/relnotes-7.5.1.html new file mode 100644 index 000000000..1a4f608b7 --- /dev/null +++ b/mesalib/docs/relnotes-7.5.1.html @@ -0,0 +1,72 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.5.1 Release Notes, 3 September 2009

    + +

    +Mesa 7.5.1 is a bug-fix release fixing issues found since the 7.5 release. +

    +

    +The main new feature of Mesa 7.5.x is the +Gallium3D infrastructure. +

    +

    +Mesa 7.5.1 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +d7269e93bc7484430637d54ced250876  MesaLib-7.5.1.tar.gz
    +877d6a4b24efc2b1d02aa553f262cba8  MesaLib-7.5.1.tar.bz2
    +23f4fb757a05c8396425681234ae20e5  MesaLib-7.5.1.zip
    +5af4bd113652108f5cec5113dad813f2  MesaDemos-7.5.1.tar.gz
    +785402e3b9f0e335538fcc6bf19f6987  MesaDemos-7.5.1.tar.bz2
    +950058cc6d6106e9c7d5876a03789fe9  MesaDemos-7.5.1.zip
    +cb52ce2c93389c2711cbe8d857ec5303  MesaGLUT-7.5.1.tar.gz
    +e3a9892e056d625c5353617a7c5b7e9c  MesaGLUT-7.5.1.tar.bz2
    +da1de364df148c94b4994006191a1e69  MesaGLUT-7.5.1.zip
    +
    + + +

    New features

    +
      +
    • Added configure --with-max-width=W, --with-max-height=H options to specify + max framebuffer, viewport size. +
    + + +

    Bug fixes

    +
      +
    • Added missing GLEW library to MesaDemos tarballs. +
    • Fixed swapbuffers jerkiness in Doom3/etc in Intel drivers. +
    • Fixed front buffer rendering bug in Intel drivers. +
    • Fixed minor GLX memory leaks. +
    • Fixed some texture env / fragment program state bugs. +
    • Fixed some Gallium glBlitFramebuffer() bugs +
    • Empty glBegin/glEnd() pair could cause divide by zero (bug 23489) +
    • Fixed Gallium glBitmap() Z position bug +
    • Setting arrays of sampler uniforms did not work +
    • Selection/Feedback mode didn't handle polygon culling correctly (bug 16866) +
    • Fixed 32/64-bit cross compilation issue in gen_matypes.c +
    • Fixed glXCreateGLXPixmap() for direct rendering. +
    • Fixed Gallium glCopyPixels(GL_STENCIL_INDEX) mispositioned image bug. +
    + + + + diff --git a/mesalib/docs/relnotes-7.5.2.html b/mesalib/docs/relnotes-7.5.2.html new file mode 100644 index 000000000..0832e11bb --- /dev/null +++ b/mesalib/docs/relnotes-7.5.2.html @@ -0,0 +1,60 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.5.2 Release Notes, (date tbd)

    + +

    +Mesa 7.5.2 is a bug-fix release fixing issues found since the 7.5.1 release. +

    +

    +The main new feature of Mesa 7.5.x is the +Gallium3D infrastructure. +

    +

    +Mesa 7.5.2 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +tbd
    +
    + + +

    New features

    +
      +
    • Detect B43 chipset in Intel driver +
    + + +

    Bug fixes

    +
      +
    • Assorted bug fixes for i965/i945 drivers +
    • Fixed Gallium glDrawPixels(GL_STENCIL_INDEX) failure. +
    • Fixed GLSL linker/preprocessor version directive issue seen in Wine + (such as bug 23946) +
    • glUseProgram() is now compiled into display lists (bug 23746). +
    • glUniform functions are now compiled into display lists +
    • Auto mipmap generation didn't work reliably with Gallium. +
    • Fixed random number usage in GLX code. +
    • Fixed invalid GL_OUT_OF_MEMORY error sometimes raised by glTexSubImage2D + when using Gallium. +
    + + + + diff --git a/mesalib/docs/relnotes-7.5.html b/mesalib/docs/relnotes-7.5.html new file mode 100644 index 000000000..56deca6a8 --- /dev/null +++ b/mesalib/docs/relnotes-7.5.html @@ -0,0 +1,102 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.5 Release Notes / 17 July 2009

    + +

    +Mesa 7.5 is a new development release. +People who are concerned with stability and reliability should stick +with the 7.4.x branch or wait for Mesa 7.5.1. +

    +

    +The main new feature of Mesa 7.5 is the +Gallium3D infrastructure. +

    +

    +Mesa 7.5 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    +

    +Note that the Mesa project is no longer using odd/even version numbers +to indicate development/stable releases. +The so-called development releases have been fairly stable. +If you're especially concerned with stability you should probably look for +"point" releases such as 7.5.1 which will be a bug-fix release. +

    + + +

    MD5 checksums

    +
    +553fd956e544727f30fbe249619b6286  MesaLib-7.5.tar.gz
    +459f332551f6ebb86f384d21dd15e1f0  MesaLib-7.5.tar.bz2
    +8c02c0e17a9025250d20424ae32f5163  MesaLib-7.5.zip
    +a188da2886fa5496ea0c2cda602b2eeb  MesaDemos-7.5.tar.gz
    +398ee8801814a00e47f6c2314e3dfddc  MesaDemos-7.5.tar.bz2
    +15a0c8ae013c54335a26335e1a98d609  MesaDemos-7.5.zip
    +81010147def5a644ba14f9bbb7a49a2a  MesaGLUT-7.5.tar.gz
    +baa7a1e850b6e39bae58868fd0684004  MesaGLUT-7.5.tar.bz2
    +265228418e4423fa328f2f5b7970cf08  MesaGLUT-7.5.zip
    +
    + + +

    New features

    +
      +
    • Gallium3D - this is the new architecture for OS-independent and + API-independent 3D drivers. + Gallium3D is intended for GPUs that fully support vertex/fragment shaders. + The Gallium3D drivers currently included are: +
        +
      • softpipe - a software/reference driver +
      • i915 - Intel 915/945 driver +
      • Cell - IBM/Sony/Toshiba Cell processor driver +
      • nouveau (for NVIDIA GPUs) and R300 for (AMD/ATI R300). + PLEASE NOTE: these drivers are incomplete and still under development. + It's probably NOT worthwhile to report any bugs unless you have patches. + +
      +
    • GL_ARB_framebuffer_object extension (software drivers, i965 driver) +
    • Reworked two-sided stencil support. +This allows a driver to support all three variations of two-sided stencil +including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0 +
    • GL_EXT_vertex_array_bgra extension (software drivers, i965 driver) +
    • GL_NV_texture_env_combine4 extension (software drivers, i965/i915 drivers) +
    • GL_EXT_texture_swizzle extension (software drivers, i965 driver) +
    • Updated SPARC assembly optimizations (David S. Miller) +
    • Initial support for separate compilation units in GLSL compiler. +
    • Increased max number of generic GLSL varying variables to 16 (formerly 8). +
    • GLSL linker now detects when too many varying variables are used. +
    • Optimize-out redundant glMaterial and glShadeModel calls in display lists +
    • Fixed gl_TextureMatrix[i][j] array indexing bug in GLSL compiler. +
    + + +

    Bug fixes

    +
      +
    • Lots of i965 driver bug fixes +
    • Fixed some GLSL preprocessor bugs +
    • GLSL: continue inside of a for-loop didn't work +
    + + +

    Changes

    +
      +
    • Remove support for GL_SGIX_shadow, GL_SGIX_shadow_ambient and +GL_SGIX_depth_texture extensions. Superseded by the ARB versions. +
    • Omitted some old Mesa demos from the release tarballs, added some others. +
    + + + diff --git a/mesalib/docs/relnotes-7.6.html b/mesalib/docs/relnotes-7.6.html new file mode 100644 index 000000000..69b035217 --- /dev/null +++ b/mesalib/docs/relnotes-7.6.html @@ -0,0 +1,76 @@ + + +Mesa Release Notes + + + + + + + +

    Mesa 7.6 Release Notes, 28 September 2009

    + +

    +Mesa 7.6 is a new development release. +People who are concerned with stability and reliability should stick +with a previous release or wait for Mesa 7.6.1. +

    +

    +Mesa 7.6 implements the OpenGL 2.1 API, but the version reported by +glGetString(GL_VERSION) depends on the particular driver being used. +Some drivers don't support all the features required in OpenGL 2.1. +

    +

    +See the Compiling/Installing page for prerequisites +for DRI hardware acceleration. +

    + + +

    MD5 checksums

    +
    +tbd
    +
    + + +

    New features

    +
      +
    • OpenVG front-end (state tracker for Gallium). +This was written by Zack Rusin at Tungsten Graphics. +
    • GL_ARB_vertex_array_object and GL_APPLE_vertex_array_object extensions + (supported in Gallium drivers, Intel DRI drivers, and software drivers)
    • +
    • GL_ARB_copy_buffer extension + (supported in Gallium drivers, Intel DRI drivers, and software drivers)
    • +
    • GL_ARB_map_buffer_range extension + (supported in Gallium drivers, Intel DRI drivers, and software drivers)
    • +
    • GL_ARB_seamless_cube_map extension + (supported in software drivers and i965 drivers)
    • +
    • GL_ARB_vertex_array_bgra (ARB synonym for GL_EXT_vertex_array_bgra)
    • +
    • GL_ARB_sync (supported in software drivers and Intel DRI drivers)
    • +
    • GL_EXT_provoking_vertex extension (supported in Gallium, i915, i965, and software drivers) +
    • Rewritten radeon/r200/r300 driver using a buffer manager +
    • radeon/r200/r300 GL_EXT_framebuffer_object support when used with + kernel memory manager +
    • radeon/r200/r300 support for GL_ARB_occlusion_query
    • +
    • r300 driver supports OpenGL 1.5
    • +
    • r300 driver support for GL_EXT_vertex_array_bgra, GL_EXT_texture_sRGB +
    • i915/945 driver support for GL_ARB_point_sprite, GL_EXT_stencil_two_side + and GL_ATI_separate_stencil extensions +
    • Rewritten assembler for GL_ARB_vertex_program / + GL_ARB_fragment_program.
    • +
    • Added configure --with-max-width=W, --with-max-height=H options to specify + max framebuffer, viewport size. +
    • Initial version of Gallium llvmpipe driver. This is a new driver based + on LLVM which makes exensive use of run-time code generation. This is + an "alpha" stage driver. See the src/gallium/drivers/llvmpipe/README + file for more information. +
    + + +

    Bug fixes

    +
      +
    • i965 DRI driver fixes, including support for "unlimited" size constant + buffers (GLSL uniforms) +
    + + + diff --git a/mesalib/docs/relnotes.html b/mesalib/docs/relnotes.html new file mode 100644 index 000000000..560a660af --- /dev/null +++ b/mesalib/docs/relnotes.html @@ -0,0 +1,75 @@ + + +Mesa Release Notes + + + + + +

    Release Notes

    + +

    +The release notes summarize what's new or changed in each Mesa release. +

    + + +Versions of Mesa prior to 6.4 are summarized in the +versions file and the following release notes. +

    + + + + + + diff --git a/mesalib/docs/repository.html b/mesalib/docs/repository.html new file mode 100644 index 000000000..ed385288e --- /dev/null +++ b/mesalib/docs/repository.html @@ -0,0 +1,132 @@ + + +Cocd Repository + + + + + +

    Code Repository

    + +

    +As of December 5, 2006, Mesa is using +git +as its source code management system. +CVS was used previously. +The old CVS repository should no longer be used. +

    + +The master git repository is hosted on +freedesktop.org. +

    + +

    +You may access the repository either as an +anonymous user (read-only) or as a +developer +(read/write). +

    + +

    +You may also +browse the git repository. +

    + + + +

    Anonymous git Access

    + +

    +To get the Mesa sources anonymously (read-only): +

    + +
      +
    1. Install the git software on your computer if needed.

      +
    2. Get an initial, local copy of the repository with: +
      +    git clone git://anongit.freedesktop.org/git/mesa/mesa
      +    
      +
    3. Later, you can update your tree from the master repository with: +
      +    git pull origin
      +    
      +
    + + +
    +

    Developer git Access

    + +

    +Mesa developers need to first have an account on +freedesktop.org. +To get an account, please ask Brian or the other Mesa developers for +permission. +Then, if there are no objections, follow this + +procedure. +

    + +

    +Once your account is established: +

    + +
      +
    1. Install the git software on your computer if needed.

      +
    2. Get an initial, local copy of the repository with: +
      +    git clone git+ssh://username@git.freedesktop.org/git/mesa/mesa
      +    
      + Replace username with your actual login name.

      +
    3. Later, you can update your tree from the master repository with: +
      +    git pull origin
      +    
      +
    + + +

    Windows Users

    + +

    +If you're +using git on Windows you'll want to enable automatic CR/LF conversion in +your local copy of the repository: +

    +
    +   git config --global core.autocrlf true
    +
    + +

    +This will cause git to convert all text files to CR+LF on checkout, +and to LF on commit. +

    +

    +Unix users don't need to set this option. +

    +
    + + + +

    Development Branches

    + +

    +At any given time, there may be several active branches in Mesa's +repository. +Generally, the trunk contains the latest development (unstable) +code while a branch has the latest stable code. +

    + +

    +The command git-branch will list all available branches. +

    + +

    +Questions about branch status/activity should be posted to the +mesa3d-dev mailing list. +

    + + + + + + diff --git a/mesalib/docs/science.html b/mesalib/docs/science.html new file mode 100644 index 000000000..f55cf3124 --- /dev/null +++ b/mesalib/docs/science.html @@ -0,0 +1,72 @@ + + +Science and Technical + + + + + +

    Science and Technical

    + +
      +
    • Ch - OpenGL bindings for the Ch C/C++ interpreter +
    • CLEO3D - event displayer for the CLEOIII detector +
    • DINO - Visualizing + Structural Biology +
    • General + Mesh Viewer (GMV) - scientific vis. +
    • GiD - finite element + analysis +
    • glpoisson - A finite + element analysis program that simulates wave in an arbitrary region. +
    • GLWaves - + Electromagnetic wave visualization +
    • Gmsh - + finite element mesh generator / viewer +
    • gOpenMol + - computational chemistry +
    • GPS 3D - GPS-based map visualization +
    • Hitchhiker + - virtual solar system +
    • Hydra - physics + and engineering pkg +
    • Light Speed + - a real-time, interactive relativistic simulator +
    • LinkWinds - scientific + vis +
    • MathGL3d - Mathematica viewer +
    • Mathworks + - mathematics and visualization +
    • Medit - 3D surface mesh viewer +
    • MOLMOL + - molecular modeling and analysis +
    • Molscript - molecular + modeling +
    • +
    • OpenDX - Data visualization + system +
    • +
    • ORSA - An interactive tool for Celestial Mechanics +
    • +
    • ParaView - Scientific visualization package +
    • +
    • PHLEX - Finite element vis +
    • ROOT - Object Oriented Data + Analysis Framework +
    • SLFFEA - GNU finite element + package +
    • Spock - molecular + modeling +
    • Ssystem - solar + system simulation +
    • SPARROW - robot simulation +
    • Vis5D + - atmospheric visualization +
    • VMD - molecular + modeling +
    • Webots - 3-D mobile + robot simulator +
    + + + \ No newline at end of file diff --git a/mesalib/docs/shading.html b/mesalib/docs/shading.html new file mode 100644 index 000000000..77c86be3a --- /dev/null +++ b/mesalib/docs/shading.html @@ -0,0 +1,367 @@ + + +Shading Language Support + + + + + +

    Shading Language Support

    + +

    +This page describes the features and status of Mesa's support for the + +OpenGL Shading Language. +

    + +

    +Last updated on 15 December 2008. +

    + +

    +Contents +

    + + + + + +

    Environment Variables

    + +

    +The MESA_GLSL environment variable can be set to a comma-separated +list of keywords to control some aspects of the GLSL compiler: +

    +
      +
    • dump - print GLSL shader code to stdout at link time +
    • log - log all GLSL shaders to files. + The filenames will be "shader_X.vert" or "shader_X.frag" where X + the shader ID. +
    • nopt - disable compiler optimizations +
    • opt - force compiler optimizations +
    • uniform - print message to stdout when glUniform is called +
    +

    +Example: export MESA_GLSL=dump,nopt +

    + + +
    +

    GLSL 1.20 support

    + +

    +GLSL version 1.20 is supported in Mesa 7.3 and later. +Among the features/differences of GLSL 1.20 are: +

      +
    • mat2x3, mat2x4, etc. types and functions +
    • transpose(), outerProduct(), matrixCompMult() functions +(but untested) +
    • precision qualifiers (lowp, mediump, highp) +
    • invariant qualifier +
    • array.length() method +
    • float[5] a; array syntax +
    • centroid qualifier +
    • unsized array constructors +
    • initializers for uniforms +
    • const initializers calling built-in functions +
    + + + +
    +

    Unsupported Features

    + +

    +The following features of the shading language are not yet fully supported +in Mesa: +

    + +
      +
    • Linking of multiple shaders does not always work. Currently, linking + is implemented through shader concatenation and re-compiling. This + doesn't always work because of some #pragma and preprocessor issues. +
    • gl_ClipVertex +
    • The gl_Color and gl_SecondaryColor varying vars are interpolated + without perspective correction +
    + +

    +All other major features of the shading language should function. +

    + + +
    +

    Implementation Notes

    + +
      +
    • Shading language programs are compiled into low-level programs + very similar to those of GL_ARB_vertex/fragment_program. +
    • All vector types (vec2, vec3, vec4, bvec2, etc) currently occupy full + float[4] registers. +
    • Float constants and variables are packed so that up to four floats + can occupy one program parameter/register. +
    • All function calls are inlined. +
    • Shaders which use too many registers will not compile. +
    • The quality of generated code is pretty good, register usage is fair. +
    • Shader error detection and reporting of errors (InfoLog) is not + very good yet. +
    • The ftransform() function doesn't necessarily match the results of + fixed-function transformation. +
    + +

    +These issues will be addressed/resolved in the future. +

    + + +
    +

    Programming Hints

    + +
      +
    • Declare in function parameters as const whenever possible. + This improves the efficiency of function inlining. +
    • +
      +
    • To reduce register usage, declare variables within smaller scopes. + For example, the following code: +
      +    void main()
      +    {
      +       vec4 a1, a2, b1, b2;
      +       gl_Position = expression using a1, a2.
      +       gl_Color = expression using b1, b2;
      +    }
      +
      + Can be rewritten as follows to use half as many registers: +
      +    void main()
      +    {
      +       {
      +          vec4 a1, a2;
      +          gl_Position = expression using a1, a2.
      +       }
      +       {
      +          vec4 b1, b2;
      +          gl_Color = expression using b1, b2;
      +       }
      +    }
      +
      + Alternately, rather than using several float variables, use + a vec4 instead. Use swizzling and writemasks to access the + components of the vec4 as floats. +
    • +
      +
    • Use the built-in library functions whenever possible. + For example, instead of writing this: +
      +        float x = 1.0 / sqrt(y);
      +
      + Write this: +
      +        float x = inversesqrt(y);
      +
      +
    • + Use ++i when possible as it's more efficient than i++ +
    • +
    + + +
    +

    Stand-alone GLSL Compiler

    + +

    +A unique stand-alone GLSL compiler driver has been added to Mesa. +

    + +

    +The stand-alone compiler (like a conventional command-line compiler) +is a tool that accepts Shading Language programs and emits low-level +GPU programs. +

    + +

    +This tool is useful for: +

    +

      +
    • Inspecting GPU code to gain insight into compilation +
    • Generating initial GPU code for subsequent hand-tuning +
    • Debugging the GLSL compiler itself +
    + +

    +After building Mesa, the glslcompiler can be built by manually running: +

    +
    +    make realclean
    +    make linux
    +    cd src/mesa/drivers/glslcompiler
    +    make
    +
    + + +

    +Here's an example of using the compiler to compile a vertex shader and +emit GL_ARB_vertex_program-style instructions: +

    +
    +    bin/glslcompiler --debug --numbers --fs progs/glsl/CH06-brick.frag.txt
    +
    +

    +results in: +

    +
    +# Fragment Program/Shader
    +  0: RCP TEMP[4].x, UNIFORM[2].xxxx;
    +  1: RCP TEMP[4].y, UNIFORM[2].yyyy;
    +  2: MUL TEMP[3].xy, VARYING[0], TEMP[4];
    +  3: MOV TEMP[1], TEMP[3];
    +  4: MUL TEMP[0].w, TEMP[1].yyyy, CONST[4].xxxx;
    +  5: FRC TEMP[1].z, TEMP[0].wwww;
    +  6: SGT.C TEMP[0].w, TEMP[1].zzzz, CONST[4].xxxx;
    +  7: IF (NE.wwww); # (if false, goto 9);
    +  8:    ADD TEMP[1].x, TEMP[1].xxxx, CONST[4].xxxx;
    +  9: ENDIF;
    + 10: FRC TEMP[1].xy, TEMP[1];
    + 11: SGT TEMP[2].xy, UNIFORM[3], TEMP[1];
    + 12: MUL TEMP[1].z, TEMP[2].xxxx, TEMP[2].yyyy;
    + 13: LRP TEMP[0], TEMP[1].zzzz, UNIFORM[0], UNIFORM[1];
    + 14: MUL TEMP[0].xyz, TEMP[0], VARYING[1].xxxx;
    + 15: MOV OUTPUT[0].xyz, TEMP[0];
    + 16: MOV OUTPUT[0].w, CONST[4].yyyy;
    + 17: END
    +
    + +

    +Note that some shading language constructs (such as uniform and varying +variables) aren't expressible in ARB or NV-style programs. +Therefore, the resulting output is not always legal by definition of +those program languages. +

    +

    +Also note that this compiler driver is still under development. +Over time, the correctness of the GPU programs, with respect to the ARB +and NV languagues, should improve. +

    + + + +
    +

    Compiler Implementation

    + +

    +The source code for Mesa's shading language compiler is in the +src/mesa/shader/slang/ directory. +

    + +

    +The compiler follows a fairly standard design and basically works as follows: +

    +
      +
    • The input string is tokenized (see grammar.c) and parsed +(see slang_compiler_*.c) to produce an Abstract Syntax Tree (AST). +The nodes in this tree are slang_operation structures +(see slang_compile_operation.h). +The nodes are decorated with symbol table, scoping and datatype information. +
    • The AST is converted into an Intermediate representation (IR) tree +(see the slang_codegen.c file). +The IR nodes represent basic GPU instructions, like add, dot product, +move, etc. +The IR tree is mostly a binary tree, but a few nodes have three or four +children. +In principle, the IR tree could be executed by doing an in-order traversal. +
    • The IR tree is traversed in-order to emit code (see slang_emit.c). +This is also when registers are allocated to store variables and temps. +
    • In the future, a pattern-matching code generator-generator may be +used for code generation. +Programs such as L-BURG (Bottom-Up Rewrite Generator) and Twig look for +patterns in IR trees, compute weights for subtrees and use the weights +to select the best instructions to represent the sub-tree. +
    • The emitted GPU instructions (see prog_instruction.h) are stored in a +gl_program object (see mtypes.h). +
    • When a fragment shader and vertex shader are linked (see slang_link.c) +the varying vars are matched up, uniforms are merged, and vertex +attributes are resolved (rewriting instructions as needed). +
    + +

    +The final vertex and fragment programs may be interpreted in software +(see prog_execute.c) or translated into a specific hardware architecture +(see drivers/dri/i915/i915_fragprog.c for example). +

    + +

    Code Generation Options

    + +

    +Internally, there are several options that control the compiler's code +generation and instruction selection. +These options are seen in the gl_shader_state struct and may be set +by the device driver to indicate its preferences: + +

    +struct gl_shader_state
    +{
    +   ...
    +   /** Driver-selectable options: */
    +   GLboolean EmitHighLevelInstructions;
    +   GLboolean EmitCondCodes;
    +   GLboolean EmitComments;
    +};
    +
    + +
      +
    • EmitHighLevelInstructions +
      +This option controls instruction selection for loops and conditionals. +If the option is set high-level IF/ELSE/ENDIF, LOOP/ENDLOOP, CONT/BRK +instructions will be emitted. +Otherwise, those constructs will be implemented with BRA instructions. +
    • + +
    • EmitCondCodes +
      +If set, condition codes (ala GL_NV_fragment_program) will be used for +branching and looping. +Otherwise, ordinary registers will be used (the IF instruction will +examine the first operand's X component and do the if-part if non-zero). +This option is only relevant if EmitHighLevelInstructions is set. +
    • + +
    • EmitComments +
      +If set, instructions will be annoted with comments to help with debugging. +Extra NOP instructions will also be inserted. +
      + +
    + + +
    +

    Compiler Validation

    + +

    +A Glean test has +been create to exercise the GLSL compiler. +

    +

    +The glsl1 test runs over 170 sub-tests to check that the language +features and built-in functions work properly. +This test should be run frequently while working on the compiler to catch +regressions. +

    +

    +The test coverage is reasonably broad and complete but additional tests +should be added. +

    + + + + diff --git a/mesalib/docs/sourcedocs.html b/mesalib/docs/sourcedocs.html new file mode 100644 index 000000000..90538af5c --- /dev/null +++ b/mesalib/docs/sourcedocs.html @@ -0,0 +1,37 @@ + + +Source Code Documentation + + + + + +

    Source Code Documentation

    + +

    +Doxygen +is used to automatically +produce cross-referenced documentation from the Mesa source code. +

    + +

    +The Doxygen configuration files and generated files are not included +in the normal Mesa distribution (they're very large). +To generate Doxygen documentation, download Mesa from CVS, change to +the doxygen directory and run make. +

    + +

    +For an example of Doxygen usage in Mesa, see a recent source file +such as bufferobj.c. +

    + + +

    +If you're reading this page from your local copy of Mesa, and have +run the doxygen scripts, you can read the documentation +here +

    + + + diff --git a/mesalib/docs/subset-A.html b/mesalib/docs/subset-A.html new file mode 100644 index 000000000..dac66a61b --- /dev/null +++ b/mesalib/docs/subset-A.html @@ -0,0 +1,3579 @@ + + + + Mini GLX Specification + + + +

    +
    Mesa Subset Specification
    +

    +

    +
    +

    Tungsten Graphics, Inc.

    +

    February 26, 2003
    +

    +
    +

    +

    Copyright © 2002-2003 by Tungsten Graphics, Inc., +Cedar Park, Texas. All Rights Reserved.
    +
    +Permission is granted to make and distribute verbatim copies of this +document provided the copyright notice and this permission notice are +preserved on all copies.
    +

    +

    OpenGL is a trademark of Silicon +Graphics, Inc..

    +

    1. Introduction

    +This document describes a subset of the Mesa implemented by Tungsten +Graphics, Inc. for embedded devices.  Prior to reading this +document the reader should be familiar with the OpenGL 1.2.1 +specification dated April 1, 1999 (available from http://www.opengl.org/developers/documentation/specs.html.) + Experience with OpenGL programming is highly advisable.
    +

    +Tungsten Graphics, Inc. is working with industry standards +organizations +in an attempt to standardize this Mesa subset and any +other possible subsets +as a result of this work.
    +
    +Appendix A contains a list of issues of which some may not be resolved.
    +
    +To summarize, the following major features of Mesa are omitted from the +subset:
    +
      +
    • Vertex arrays
    • +
    • Texture coordinate generation
    • +
    • Lighting
    • +
    • Point size
    • +
    • Polygon stipple
    • +
    • DrawPixels, CopyPixels, PixelZoom
    • +
    • 1-D and 3-D textures
    • +
    • CopyTex[Sub]Image
    • +
    • Fog
    • +
    • Depth test
    • +
    • Color Index mode
    • +
    • Accumulation buffer
    • +
    • Feedback mode
    • +
    • Evaluators
    • +
    • Push/Pop attributes
    • +
    • Display lists
      +
    • +
    +

    Further reductions are made at a lower level of detail.
    +

    +

    Mesa function names are printed in bold +face.  Function parameters are printed in italics.
    +

    +

    The Tungsten Graphics, Inc. Mesa subset library is hereafter +referred to as the subset.
    +
    +

    +

    2. Primitive Specification

    +

    2.1 glBegin, glEnd and glVertex Commands

    +The basic rendering primitives are points, lines and triangles. + Quadrilaterals and polygons are composed of triangles. + Primitives are drawn with the glBegin +and glEnd commands and a subset +of the glVertex commands:
    +
    +
    void glBegin(GLenummode)
    +void glEnd(void)
    +
    +void glVertex2f(GLfloat x, GLfloat y)
    +void glVertex2fv(const GLfloat +*v)
    +void glVertex3f(GLfloat x, GLfloat y, GLfloat z)
    +void glVertex3fv(const GLfloat +*v)
    +
    +
    +The mode parameter to glBegin may be one of the following
    +
    +
    GL_POINTS - a series of individual +points
    +GL_LINES - a series of disjoint line segments
    +GL_LINE_STRIP - series of connected line segments
    +GL_LINE_LOOP - a closed loop of line segments
    +GL_TRIANGLES - a series of individual triangles
    +GL_TRIANGLE_STRIP - a connected strip of triangles
    +GL_TRIANGLE_FAN - a sequence of triangles all sharing a common vertex
    +GL_QUADS - a sequence of individual quadrilaterals
    +GL_QUAD_STRIP - a connected strip of quadrilaterals
    +GL_POLYGON - a closed, convex polygon
    +
    +
    +
    +The glVertex commands take two +or three floating point coordinates, or a pointer to an array of two or +three floating point coordinates.  Vertices are actually 4-element +homogeneous coordinates.  The fourth component, unspecified by the +subset's glVertex commands, is +one.
    +
    + +

    2.2 Other Per-vertex Commands
    +

    +The glColor and glTexCoord commands may be used to +specify colors and texture coordinates for each vertex:
    +
    +
    void glColor3f(GLfloatred, GLfloat green, GLfloat blue)
    +void glColor3fv(const GLfloat *rgb)
    +void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
    +void glColor4fv(const GLfloat *rgba)
    +void glTexCoord2f(GLfloat s, GLfloat t)
    +void glTexCoord2fv(const +GLfloat *c)
    +
    +
    +The glColor commands specify +the color and optionally, the alpha value, for subsequent vertices. + For the glColor3 commands, +alpha is set to one.
    +
    +The glTexCoord2 commands +specify the texture coordinate for subsequent vertices.  Texture +coordinates are actually four-component coordinates: (s, t, r, q). + The glTexCoord2 commands +set s and t explicitly.  The r and q components are zero and one, +respectively.
    +
    +Only glVertex, glColor and glTexCoord commands are allowed +between glBegin and glEnd.  Calling any other +command between glBegin and glEnd will result in the error +GL_INVALID_OPERATION.
    +
    +

    2.3 Unsupported Commands

    +None of the following commands related to primitive specification are +supported by the subset:
    +
    +
    Per-Vertex commands:
    +
    +
    +
    glVertex2d, +glVertex2i, glVertex2s, glVertex3d, glVertex3i, glVertex3s, glVertex4d, +glVertex4i, glVertex4s, glVertex2dv, glVertex2iv, glVertex2sv, +glVertex3dv, glVertex3iv, glVertex3sv, glVertex4dv, glVertex4iv, +glVertex4sv,
    +glNormal3b, glNormal3d, glNormal3f, glNormal3i, glNormal3s,
    glNormal3bv, glNormal3dv, glNormal3fv, +glNormal3iv, glNormal3sv,
    +glIndexd, glIndexf, glIndexi, glIndexs, glIndexub, glIndexdv, +glIndexfv, glIndexiv, glIndexsv, glIndexubv,
    +glColor3b, glColor3d, glColor3i, glColor3s, glColor3ub, glColor3ui, +glColor3us,
    glColor3bv, +glColor3dv, glColor3iv, glColor3sv, glColor3ubv, glColor3uiv, +glColor3usv, lColor4b, +glColor4d, glColor4i, glColor4s, glColor4ub, glColor4ui, glColor4us, glColor4bv, glColor4dv, glColor4iv, +glColor4sv, glColor4ubv, glColor4uiv, glColor4usv,
    +
    glTexCoord1d, glTexCoord1f, +glTexCoord1i, glTexCoord1s, glTexCoord2d, glTexCoord2i, glTexCoord2s, +glTexCoord3d, glTexCoord3f, glTexCoord3i, glTexCoord3s, glTexCoord4d, +glTexCoord4f, glTexCoord4i, glTexCoord4s, glTexCoord1dv, glTexCoord1fv, +glTexCoord1iv, glTexCoord1sv, glTexCoord2dv, glTexCoord2iv, +glTexCoord2sv, glTexCoord3dv, glTexCoord3fv, glTexCoord3iv, +glTexCoord3sv, glTexCoord4dv, glTexCoord4fv, glTexCoord4iv, +glTexCoord4sv,
    +glEdgeFlag, glEdgeFlagv

    +
    +
    +Vertex array commands:
    +
    glVertexPointer, +glColorPointer, glIndexPointer, glTexCoordPointer, glEdgeFlagPointer, +glNormalPointer, glInterleavedArrays, glArrayElement, glDrawArrays, +glDrawElements, glDrawRangeElements, glEnableClientState, +glDisableClientState
    +
    +
    +

    +Rectangle commands:
    +
    glRects, +glRecti, glRectf, glRectd, glRectsv, glRectiv, glRectfv, glRectdv,
    +
    +
    +
    +
    Lighting commands:
    +
    +
    glMaterialf, +glMateriali, glMaterialfv, glMaterialiv
    +

    +
    +
    Evaluator commands:
    +
    glEvalCoord1d, +glEvalCoord1f, glEvalCoord1dv, glEvalCoord1fv, glEvalCoord2d, glEvalCoord2f, +glEvalCoord2dv, glEvalCoord2fv,
    +
    glEvalPoint1, glEvalPoint2
    +
    +
    +
    +

    3. Coordinate Transformation

    +

    3.1 Vertex Transformation

    +Vertex coordinates are transformed by the current modelview and +projection matrices then mapped to window coordinates as specified by +the viewport.  The following coordinate transformation commands are +supported by the subset
    +
    +
    glMatrixMode(GLenum mode)
    +glLoadIdentity(void)
    +glPushMatrix(void)
    +glPopMatrix(void)
    +glLoadMatrixf(const GLfloat *m)
    +glMultMatrixf(const GLfloat *m)
    +glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
    +glTranslatef(GLfloat x, GLfloat y, GLfloat z)
    +glScalef(GLfloat x, GLfloat y, GLfloat z)
    +glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)

    +glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
    +glViewport(GLint x, GLint y, GLsize width, GLsizei height)
    +
    +
    +The glMatrixMode command +specifies the current matrix. + The mode parameter may be GL_MODELVIEW or GL_PROJECTION to specify +the modelview matrix or projection matrix.  Subsequent matrix +commands will effect the current matrix.  Also associated with the +modelview and projection matrices are a modelview matrix stack and +projection matrix stack.
    +
    +The glLoadIdentity command +replaces the current matrix with the identity matrix.  The matrix +elements are specified in column-major order.
    +
    +The glPushMatrix command pushes +a copy of the current matrix onto either the modelview matrix stack or +the projection matrix stack.  The glPopMatrix +command replaces the current matrix with a copy of the top matrix off +the modelview matrix stack or projection matrix stack, the pops the +stack.  Matrix stacks are useful for traversing and rendering +hierarchical models.
    +
    +The glMultMatrixf command +post-multiplies the current matrix by the specified matrix.  The +matrix elements are specified in column-major order.
    +
    +The glRotatef command +post-multiplies the current matrix by a rotation matrix defined by the +angle and rotation axis defined by x, y and z.
    +
    +The glTranslatef command +post-multiplies the current matrix by a translation matrix defined by +the x, y and z translation parameters.
    +
    +The glScalef command +post-multiplies the current matrix by a scaling matrix defined by the x, y and z scale factors.
    +
    +The glFrustum command +post-multiplies the current matrix by a perspective projection matrix. + The near and far values specify the position of +the hither and yon Z-axis clipping planes.  The left, right, bottom and top parameters are the X and Y +extents at the near clipping plane.  glFrustum is normally used to modify +the projection matrix.
    +
    +The glOrtho command +post-multiplies the current matrix by an orthographic projection matrix. + The near and far values specify the position of +the hither and yon Z-axis clipping planes.  The left, right, bottom and top parameters specify the X and +Y-axis clipping planes.  glOrtho +is normally used to modify the projection matrix.
    +
    +The glViewport command +specifies the mapping of coordinates from normalized device coordinates +to window coordinates.  The x +and y parameters specify the +viewport's lower-left corner in the window and the width and height parameters specify the size +of the viewport.  glViewport +does not effect the current matrix.
    +
    +A coordinate transformed to window coordinates is hereafter known as (xw, +yw, zw).
    +
    +

    3.2 Clipping

    +View-volume clipping automatically discards or trims primitives which +lie completely or partially outside of the view volume specified by glFrustum and glOrtho.  Note that the glViewport command does not define a +clipping region.
    +
    +Clipping occurs in clip coordinate +space - the coordinates produced after applying the projection +matrix.
    +
    +

    3.3 Current Raster Position

    +The current raster position specifies the location for drawing images +with glBitmap.  The current +raster position is set with the commands:
    +
    +
    void glRasterPos2f(GLfloatx, GLfloat y)
    +void glRasterPos2fv(const +GLfloat *v)
    +void glRasterPos2i(GLint x, GLint y)
    +void glRasterPos2iv(const +GLint *v)
    +
    +
    +glRasterPos specifies a +4-component coordinate (x, y, 0, 1).  The coordinate is processed +like a vertex; it is transformed by the modelview matrix, the projection +matrix and mapped to the viewport.  The resulting window coordinate +is stored as the current raster position.  The coordinate is +clipped-tested against the frustum like a vertex.  If the +coordinate is clipped, then the current raster position becomes invalid +and subsequent glBitmap commands +have no effect.
    +
    +glRasterPos also updates the +current raster color and current raster texture coordinates.  The +current raster color is updated (copied) from the current color (as +specified by glColor). + The current raster texture coordinate is updated (copied) from the +current texture coordinate (as specified by glTexCoord).
    +
    +

    3.4 Unsupported Commands

    +The following commands related to vertex transformation are not +supported by the subset:
    +
    +
    User-defined clip plane commands:
    +
    glClipPlane
    +
    +
    +
    +
    Lighting and material commands:
    +
    glLightModeli, +glLightModelf, glLightModeliv, +glLightModelfv, glLightf, +glLighti, glLightfv, glLightiv, glColorMaterial
    +
    +
    +
    Automatic texture coordinate generation +commands:
    +
    +
    +
    glTexGend, +glTexGenf, glTexGeni, glTexGendv, +glTexGenfv, glTexGeniv,
    +
    +
    +Double-valued commands:
    +
    glLoadMatrixd, +glMultMatrixd, glRotated, glTranslated, glScaled
    +
    +
    +Depth Range command:
    +
    glDepthRange +(the near value is always 0.0 and the far value is always 1.0)
    +
    +
    +Extra RasterPos commands:
    +
    glRasterPos2d, +glRasterPos2s, glRasterPos3d, glRasterPos3f, glRasterPos3i, +glRasterPos3s, glRasterPos4d, glRasterPos4f, glRasterPos4i, +glRasterPos4s, glRasterPos2dv, glRasterPos2sv, glRasterPos3dv, +glRasterPos3fv, glRasterPos3iv, glRasterPos3sv, glRasterPos4dv, +glRasterPos4fv, glRasterPos4iv, glRasterPos4sv
    +
    +
    +
    +
    +

    4. Rasterization

    +This section describes the commands and options for drawing points, +lines, triangles and bitmaps.  Rasterization +is the term for the process which produces fragments from the geometric +description of a primitive (a point, line, polygon or bitmap).  For +example, given the two coordinates for the end-points of a line segment, +rasterization determines which pixels in the frame buffer are modified +to draw the line.  A +fragment is a tuple which consists of a window coordinate, colors and +texture coordinates.  The fragments produced by rasterization are +subsequently processed by the per-fragment operations described later.
    +
    +

    4.1 Point Rasterization

    +Points are rendered with the command sequence glBegin(GL_POINTS), glVertex, ... glEnd.  The window coordinate (xw, +yw, zw) is truncated to rasterize the point. + The truncated coordinate with its associated color and texture +coordinate is sent as a single fragment to the per-fragment processing +stages.
    +
    +The glPointSize command is not +supported; only 1-pixel points are supported.
    +
    +Point smoothing (antialiasing) is also not supported.
    +
    +

    4.2 Line Rasterization

    +Lines are rendered with the command sequence glBegin(mode), glVertex, glVertex, ... glEnd where mode is one of GL_LINES, +GL_LINE_STRIP or GL_LINE_LOOP.  Lines are rasterized as described +in the OpenGL specification.  Note that OpenGL specifies the half-open convention for drawing +lines: the last fragment in a line segment is omitted so that endpoint +pixels shared by two line segments will only be drawn once instead of +twice.
    +
    +

    4.2.1 Line Width

    +The width of lines can be controlled by
    +
    +
    void glLineWidth(GLfloatwidth)
    +
    +
    +where width is the line width +in pixels.  The width defaults to 1.0.  Attempting to set the +width to a value less than or equal to zero will raise the error +GL_INVALID_VALUE.
    +
    +

    4.2.2 Line Stipple
    +

    +Lines may be stippled (i.e. dashed) with the command
    +
    +
    glLineStipple(GLintfactor, GLushort pattern)
    +
    +
    +pattern describes an on/off +pattern for the fragments produced by rasterization and factor specifies how many subsequent +fragments are kept or culled for each pattern bit.  Line stippling +can be enabled or disabled by the commands glEnable(GL_LINE_STIPPLE) and glDisable(GL_LINE_STIPPLE).
    +
    +

    4.2.3 Line Antialiasing

    +Lines may be antialiased.  For antialiased lines, each fragment +produced by rasterization is assigned a coverage value which describes how +much of the fragment's area is considered to be inside the line.  Later, the +alpha value of each fragment is multiplied by the coverage value. + By blending the fragments into the frame buffer, the edges of +lines appear smoothed.
    +
    +Line antialiasing can be enabled or disabled with the commands glEnable(GL_LINE_SMOOTH) and glDisable(GL_LINE_SMOOTH).
    +
    +

    4.3 Polygon Rasterization

    +Polygons, quadrilaterals and triangles share the same polygon +rasterization options.
    +
    +Triangles are rendered by the command sequence glBegin(mode),glVertex, glVertex, ... glEnd where mode may be one of GL_TRIANGLES, +GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN. + For GL_TRIANGLES mode, the number of vertices should be a multiple +of three - extra vertices will be ignored.  For GL_TRIANGLE_STRIP +and GL_TRIANGLE_FAN, at least three vertices should be specified. + If less than three are specified, nothing is drawn.  
    +
    +Quadrilaterals are rendered by +the command sequence glBegin(mode),glVertex, glVertex, ... glEnd where mode may be one of GL_QUADS or +GL_QUAD_STRIP.   For +GL_QUADS, the number of vertices should be a multiple of four - extra +vertices will be ignored.  For GL_QUAD_STRIP, the number of +vertices should be even and at least four.  Extra vertices (one) +will be ignored.
    +
    +Convex polygons are rendered +by the command sequence glBegin(GL_POLYGON),glVertex, glVertex, ... glEnd. + If less than three vertices are specified, nothing is drawn.
    +
    +

    4.3.1 Polygon Orientation

    +The winding order of vertices +(clockwise or counter-clockwise) is significant.  It is used to +determine the front-facing or back-facing orientation of polygons. + By default, a front-facing polygon's vertices are in +counter-clockwise order (in window coordinates).  Figures 2.4 and +2.5 of the OpenGL 1.2.1 specification illustrate the winding order for +front-facing triangles and quadrilaterals, respectively.
    +
    +The command
    +
    +
    void glFrontFace(GLenum mode)
    +
    +
    +specifies whether clockwise or counter-clockwise winding indicates a +front-facing polygon.  If mode +is GL_CW then polygons with clockwise winding are front-facing.  If mode is GL_CCW then polygons with +counter-clockwise winding are front-facing.  The default value is +GL_CCW.  If mode is not +GL_CCW or GL_CW then the error GL_INVALID_ENUM will be raised.
    +
    +

    4.3.2 Polygon Culling

    +Polygons may be culled (discarded) depending on whether they are +front-facing or back-facing.  The command
    +
    +
    void +glCullFace(GLenum mode)
    +
    +
    +specifies whether front-facing, back-facing or all polygons should be +culled.  If mode is +GL_FRONT then front-facing polygons will be culled.  If mode is GL_BACK then back-facing +polygons will be culled. Otherwise, if mode +is GL_FRONT_AND_BACK then all polygons will be culled.  Any other +value for mode will raise the +error GL_INVALID_ENUM.
    +
    +Polygon culling is enabled and disabled with the commands glEnable(GL_CULL_FACE) and glDisable(GL_CULL_FACE), +respectively.
    +
    +

    4.3.3 Polygon Antialiasing

    +Polygons may be antialiased in order to smooth their edges. + Polygon antialiasing is enabled and disabled with the commands glEnable(GL_POLYGON_SMOOTH) and glDisable(GL_POLYGON_SMOOTH).
    +
    +When polygon antialiasing is enabled each fragment produced by polygon, +triangle and quadrilateral rasterization will be given a coverage value which indicates how +much of the fragment is covered by the polygon.  Fragments +completely inside the polygon have coverage 1.0.  Fragments +completely outside the polygon have zero coverage (in theory). + Fragments which intersect the polygon's edge have a coverage value +in the range (0, 1).
    +
    +The fragment's alpha value is multiplied by the coverage value. + By enabling the appropriate blending mode, polygon edges will +appear smoothed.
    +
    +

    4.4 Shading

    +The command
    +
    +
    void glShadeModel(GLenummode)
    +
    +
    +determines whether colors are interpolated between vertices during +rasterization.  If mode is +GL_FLAT then vertex colors are not interpolated.  The color used +for drawing lines, triangles and quadrilaterals is that of the last +vertex used to specify each primitive.  For polygons, the color of +the first vertex specifies the color for the entire polygon.  If mode is GL_SMOOTH then vertex colors +are linearly interpolated to produce the fragment colors.
    +
    +

    4.5 Bitmap Rasterization

    +A bitmap is a monochromatic, binary image in which each image element +(or pixel) is represented by one bit.  Fragments are only generated +for the bits (pixels) which are set.  Bitmaps are commonly used to +draw text (glyphs) and markers.
    +
    +A bitmap is drawn with the command
    +
    +
    void glBitmap(GLsizeiwidth, GLsizei height, GLfloat xOrig, GLfloat yOrig, GLfloat xMove, GLfloat yMove, const  GLubyte *image)
    +
    +
    +width and height specify the image size in +pixels.  xOrig and yOrig specify the bitmap origin. + xMove and yMove are added to the current +raster position after the bitmap is rasterized.  image is a pointer to the bitmap +data.
    +
    +If the current raster position is not valid, glBitmap has no effect.
    +
    +

    4.5.1 Bitmap Unpacking

    +The first step in bitmap rendering is unpacking. + Unpacking is the process of extracting image data from +client memory subject to byte swapping, non-default row strides, etc. + The unpacking parameters are specified with the command
    +
    +
    void +glPixelStorei(GLenum pname, GLint value)
    +
    +
    +The following unpacking parameters may be set:
    +
    + + + + + + + + + + + + + + + + + + +
    Parameter (pname)
    +
    Value (value)
    +
    Default
    +
    GL_UNPACK_ROW_LENGTH
    +
    Width of the image in memory, in +pixels.
    +
    0
    +
    GL_UNPACK_LSB_FIRST
    +
    GL_FALSE indicates that the most +significant bit is unpacked first from each byte.  GL_TRUE +indicates that the least significant bit is unpacked first from each +byte.
    +
    GL_FALSE
    +
    +
    +
    +The GL_UNPACK_ROW_LENGTH specifies the stride (in pixels) for advancing +from one row of the image to the next.  If it's zero, the width parameter to glBitmap specifies the width of the +image in memory.
    +
    +GL_UNPACK_LSB_FIRST determines whether the least significant or most +significant bit in each byte is unpacked first.  Unpacking occurs +in left to right order (in image space).
    +
    +The value of bit (i, j) of the image (where i is the image row and j is +the image column) is found as follows:
    +
    +
    rowLength = (GL_UNPACK_ROW_LENGTH != 0) +? GL_UNPACK_ROW_LENGTH : width;
    +
    +byte = image[((rowLength + 7) +/ 8) * i + j / 8];
    +
    +if (GL_UNPACK_LSB_FIRST != 0)
    +    bitMask = 1 << (j % 8);
    +else
    +    bitMask = 128 >> (j % 8);
    +
    +if (byte & bitMask)
    +    bit = 1;
    +else
    +    bit = 0;
    +
    +
    + +

    4.5.2 Rasterization

    +If the current raster position is (xrp, yrp, zrp, +wrp), then the bitmap is rasterized according to the +following algorithm:
    +
    +for (j = 0; j < height; +j++) {
    +    for (i = 0; i < width; +i++) {
    +        if (bit(i,j)) {
    +            fragment.x = +floor(xrp - xOrig) ++ i;
    +            fragment.y = +floor(yrp - yOrig) ++ j;
    +            fragment.color += GL_CURRENT_RASTER_COLOR;
    +            +fragment.texture = GL_CURRENT_RASTER_TEXTURE_COORDS;
    +            +ProcessFragment(fragment)
    +         }
    +    }
    +}
    +
    +After the bitmap has been rendered the current raster position is +updated as follows:
    +
    +
    xrp = xrp + xMove
    +yrp = yrp + yMove
    +
    +
    +

    4.5.3 Per-fragment Operations

    +XXX supported?  See issue in appendix A.
    +
    +

    4.6 Unsupported Commands

    +The following commands related to rasterization are not supported by +the subset.
    +
    +
    Point commands:
    +
    glPointSize
    +
    +
    +Polygon commands:
    +
    glPolygonStipple
    +glPolygonOffset
    +glPolygonMode
    +
    +
    +
    +
    Pixel storage commands:
    +
    +
    glPixelStoref
    +
    +
    +
    +

    5. Texture Mapping
    +

    +There are four elements to texture mapping: texture coordinate +specification, texture image specification, texture sampling and texture +application.
    +
    +Texture mapping is enabled and disabled with the commands glEnable(GL_TEXTURE_2D) and glDisable(GL_TEXTURE_2D).
    +
    +

    5.1 Texture Image Specification

    +A texture image is specified with the command:
    +
    +
    void glTexImage2D(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels )
    +
    +
    +target must be GL_TEXTURE_2D. + level indicates the +mipmap level for mipmap textures.  internalFormat +is a hint to indicate the preferred internal storage format for the +texture.  width and height indicate the image size in +pixels (or texels).  border must +be zero.  format and type describe the pixel format and +data type for the incoming image.  pixels +points to the incoming texture image.  These parameters are +described in more detail below.
    +
    +

    5.1.1 Texture Image Size and Mipmaps

    +

    +Texture images must have dimensions (width and height) that are powers +of two. For example: 256 x 256, 32 x 1024, 1 x 8, etc.  That is, it +must be the case that width = +2n and height = 2m +for some positive integers n and m.
    +
    +Mipmapping is a method of antialiasing or filtering textures to improve +their appearance.  A mipmap is a set of images consisting of a base +image and a set of filtered, reduced-resolution images.  If the +base image (level=0) is of +width 2n and height 2m then the level 1 image must +be of width 2n-1 and height 2m-1.  Each mipmap +level is half the width and height of the previous level, or at least +one.  The last mipmap level has a width and height of one.
    +
    +The following is an example of a mipmap's image levels:
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    mipmap level
    +
    width
    +
    height
    +
    0
    +
    256
    +
    64
    +
    1
    +
    128
    +
    32
    +
    2
    +
    64
    +
    16
    +
    3
    +
    32
    +
    8
    +
    4
    +
    16
    +
    4
    +
    5
    +
    8
    +
    2
    +
    6
    +
    4
    +
    1
    +
    7
    +
    2
    +
    1
    +
    8
    +
    1
    +
    1
    +
    +
    +If the width or height parameters are not powers of +two, the error GL_INVALID_VALUE is raised.  If the image levels in +a mipmap do not satisfy the restrictions listed above the texture is +considered to be inconsistent +and the system will behave as if the texturing is disabled.
    +
    +

    5.1.2 Texture Image Formats and Unpacking

    +The glTexImage2D command's format and type parameters describe the format +of the incoming texture image.  Accepted values for format are GL_INTENSITY, GL_RGB and +GL_RGBA.  The type +parameter must be GL_UNSIGNED_BYTE.  Pixel component values are +thus in the range 0 through 255.
    +
    +If format is GL_INTENSITY then +the image has one byte per pixel which specifies the pixel's red, green, +blue and alpha values.
    +
    +If format is GL_RGB then the +image has three bytes per pixel which specify the pixel's red, green and +blue values (in that order).  The alpha value defaults to 255.
    +
    +If format is GL_RGBA then the +image has four bytes per pixel which specify the pixel's red, green, +blue and alpha values (in that order).
    +
    +The command
    +
    +
    void +glPixelStorei(GLenum pname, +GLint value)
    +
    +
    +controls the unpacking of texture image data from client memory.  pname may be GL_UNPACK_ROW_LENGTH to +indicate the stride, in pixels, between subsequent rows of the image in +client memory.  If GL_UNPACK_ROW_LENGTH is zero (the default) then +the width parameter to glTexImage2D determines the stride.
    +
    +

    5.1.3 Internal Texture Format

    +glTexImage2D converts the incoming +texture image to one of the supported internal texture formats.
    +
    +The internalFormat parameter +indicates the desired internal format for the texture and may be either +GL_INTENSITY8, GL_RGB5 or GL_RGBA8.
    +
    +If internalFormat is +GL_INTENSITY8 then the texture has one byte per texel (texture element) +which indicates the texel's intensity (or brightness).  The +intensity is obtained from the incoming image's red channel.
    +
    +If internalFormat is GL_RGB5 +then the texture is stored with two bytes per texel:  5 bits per +red value, 5 bits per green value and 5 bits per blue value.
    +
    +If internalFormat is +GL_RGBA8 then the texture is stored with four bytes per texel:  8 +bits for each of the red, green,  blue and alpha values.
    +
    +The internal format is also significant to texture application (see +section 5.4).
    +
    +

    5.2 Texture Coordinates

    +Texture coordinates control the mapping from local polygon space to +texture image space.  Texture coordinates are set for each vertex +with the glTexCoord commands. + During line and polygon rasterization the vertex's texture +coordinates are interpolated across the primitive to produce a texture +coordinate for each fragment.  The fragment texture coordinates are +used to sample the current texture image.
    +
    +Texture coordinates are normally in the range [0, 1].  Values +outside that range are processed according to the texture wrap mode.  The +texture wrap mode is set with the command
    +
    +
    void glTexParameteri(GLenum target, GLenum pname, GLint value)
    +
    +
    +target must be GL_TEXTURE_2D. + If pname is +GL_TEXTURE_WRAP_S or GL_TEXTURE_WRAP_T then value must be either +GL_CLAMP_TO_EDGE or GL_REPEAT.
    +
    +For GL_CLAMP_TO_EDGE, texture coordinates are effectively clamped to +the interval [0, 1].
    +
    +For GL_REPEAT, the integer part of texture coordinates is ignored; only +the fractional part of the texture coordinates is used.  This +allows texture images to repeated or tiled across an object.
    +
    +

    5.3 Texture Sampling

    +Texture sampling is the process of using texture coordinates to extract +a color from the texture image.  Multiple, weighted samples may be +taken from the texture and combined during the filtering step.
    +
    +During texture coordinate interpolation a level of detail value (lambda) is +computed for each fragment.  For a mipmapped texture, lambda +determines which level (or levels) of the mipmap will be sampled to +obtain the texture color.
    +
    +If lambda indicates that multiple texels map to a single screen pixel, +then the texture minification +filter will be used.  Otherwise, if lambda indicates that a single +texel maps to multiple screen pixels, then the texture magnification filter will be used.
    +
    +

    5.3.1 Texture Minification

    +The texture minification filter is set with the glTexParameteri command by setting target to GL_TEXTURE_2D, setting pname to GL_TEXTURE_MIN_FILTER and +setting value to GL_NEAREST, +GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST,  +GL_NEAREST_MIPMAP_LINEAR,   GL_LINEAR_MIPMAP_NEAREST or +GL_LINEAR_MIPMAP_LINEAR.
    +
    +GL_NEAREST samples the texel nearest the texture coordinate in the +level 0 texture image.
    +
    +GL_LINEAR samples the four texels around the texture coordinate in the +level 0 texture image.  The four texels are linearly weighted to +compute the final texel value.
    +
    +GL_NEAREST_MIPMAP_NEAREST samples the texel nearest the texture +coordinate in the level N texture image.  N is the level of detail +and is computed by the partial derivatives of the texture coordinates +with respect to the window coordinates.
    +
    +GL_NEAREST_MIPMAP_LINEAR samples two texels nearest the texture +coordinates in the level N and N+1 texture images.  The two texels +are linearly weighted to compute the final texel value.  N is the +level of detail and is computed by the partial derivatives of the +texture coordinates with respect to the window coordinates.
    +
    +GL_LINEAR_MIPMAP_NEAREST samples four texels around the texture +coordinate in the level N texture image.  The four texels are +linearly weighted to compute the final texel value.  N is the level +of detail and is computed by the partial derivatives of the texture +coordinates with respect to the window coordinates.
    +
    +GL_LINEAR_MIPMAP_LINEAR samples four texels around the texture +coordinate in the level N texture image and four texels around the +texture coordinate in the level N+1 texture image.  The eight +texels are linearly weighted to compute the final texel value.  N +is the level of detail and is computed by the partial derivatives of the +texture coordinates with respect to the window coordinates.
    +
    +Filter modes other than GL_LINEAR and GL_NEAREST requires that the +texture have a complete set of mipmaps.  If the mipmap is +incomplete, it is as if texturing is disabled.

    +

    5.3.2 Texture Magnification

    +The texture magnification filter is set with the glTexParameteri command +by setting target to +GL_TEXTURE_2D, setting pname to +GL_TEXTURE_MAG_FILTER and setting value +to GL_NEAREST or GL_LINEAR.
    +
    +GL_NEAREST samples the texel nearest the texture coordinate in the +level 0 texture image.
    +
    +GL_LINEAR samples the four texels around the texture coordinate in the +level 0 texture image.  The four texels are linearly weighted to +compute the final texel value.
    +
    +

    5.4 Texture Application

    +The sampled texture value is combined with the incoming fragment color +to produce a new fragment color.  The fragment and texture colors +are combined according to the texture environment mode and the current +texture's base internal format.  The texture environment mode is +set with the command
    +
    +
    void +glTexEnvi(GLenum target, +GLenum pname, GLint value)
    +
    +
    +target must be GL_TEXTURE_ENV. + If pname is +GL_TEXTURE_ENV_MODE then value +must be one of GL_REPLACE, GL_MODULATE, GL_DECAL, or GL_BLEND.
    +
    +There is also a texture environment +color that can factor into texture application.  The texture +environment color can be set with the command
    +
    +
    void +glTexEnvfv(GLenum target, +GLenum pname, const GLfloat *value)
    +
    +
    +target must be GL_TEXTURE_ENV. + If pname is +GL_TEXTURE_ENV_COLOR then value must +point to an array of four values which specify the red, green, blue, +and alpha values of the texture environment color.  The values are +clamped to the range [0, 1].  The default color is (0, 0, 0, 0).
    +
    +The following table describes the arithmetic used for each combination +of environment mode and base internal format.  (Rf, Gf, Bf, Af) is +the incoming fragment color.  (Rt, Gt, Bt, At) is the sampled +texture color.  Lt is the sampled texture luminance.  'It' is the sampled texture +intensity.  (Rc, Gc, Bc, Ac) is the texture environment color. + (Rv, Gv, Bv, Av) is the resulting value.
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Base Internal Format
    +
    GL_REPLACE
    +
    GL_MODULATE
    +
    GL_DECAL
    +
    GL_BLEND
    +
    GL_INTENSITY
    +
    Rv = It
    +Gv = It
    +Bv = It
    +Bf = It
    +
    Rv = Rf * It
    +Gv = Gf * It
    +Bv = Bf * It
    +Av = Af * It
    undefined
    +
    Rv = Rf*(1-It) + Rc*It
    +Gv = Gf*(1-It) + Gc*It
    +Bv = Bf*(1-It) + Bc*It
    +Av = Af*(1-It) + Ac*It
    GL_RGB
    +
    Rv = Rt
    +Gv = Gt
    +Bv = Bt
    +Av = Af
    +
    Rv = Rf * Rt
    +Gv = Gf * Gt
    +Bv = Bf * Bt
    +Av = Af
    +
    Rv = Rt
    +Gv = Gt
    +Bv = Bt
    +Av = Af
    Rv = Rf*(1-Rt) + Rc*Rt
    +Gv = Gf*(1-Gt) + Gc*Gt
    +Bv = Bf*(1-Bt) + Bc*Bt
    +Av = Af
    GL_RGBA
    +
    Rv = Rt
    +Gv = Gt
    +Bv = Bt
    +Av = At
    +
    Rv = Rf * Rt
    +Gv = Gf * Gt
    +Bv = Bf * Bt
    +Av = Af * At
    Rv = Rf*(1-At) + Rt*At
    +Gv = Gf*(1-At) + Gt*At
    +Bv = Bf*(1-At) + Bt*At
    +Av = Af
    +
    Rv = Rf*(1-Rt) + Rc*Rt
    +Gv = Gf*(1-Gt) + Gc*Gt
    +Bv = Bf*(1-Bt) + Bc*Bt
    +Av = Af*At
    +
    +
    +
    +

    5.5 Texture Objects

    +Texture objects encapsulate a set of texture images (mipmap) and +related state into a named object.  This facilitates use of +multiple textures in an application.  Texture objects are named +with GLuints (unsigned integers).  There is a default texture +object with the name/identifier zero which can never be deleted.
    +
    +

    5.5.1 Creating Texture Objects

    +A texture object is created by binding a new GLuint identifier to the +GL_TEXTURE_2D target with the command:
    +
    +
    void glBindTexture(GLenum target, GLuint textureID)
    +
    +
    +target must be GL_TEXTURE_2D. + textureID may be any +unsigned integer.  If textureID +does not name an existing texture object, a new texture object with that +ID will be created, initialized to the default state.  Whether the +ID is new or existed previously, that named texture object is bound as +the current texture object. + Subsequent glTexParameter andglTexImage2D calls will effect the +current texture object.
    +
    +

    5.5.2 Deleting Texture Objects

    +One or more texture objects may be deleted with the command:
    +
    +
    void glDeleteTextures(GLsizein, const GLuint *textureIDs)
    +
    +
    +textureIDs is an array of n texture IDs.  The named +texture objects will be deleted.  If the current texture object is +deleted the default texture object (number 0) will be bound as the +current texture object.
    +
    +

    5.5.3 Allocating Texture Object Identifiers

    +A list of new, unused texture IDs can be obtained by calling the command
    +
    +
    void glGenTextures(GLsizei n, GLuint *textureIDs)
    +
    +
    +An array of n unused texture +IDs will be returned in the textureIDs +array.
    +
    +
    +

    6. Per-fragment Operations

    +The fragments produced by rasterization are subjected to a number of +operations which either modify the fragment or test the fragment +(discarding the fragment if the test fails.)  This chapter +describes the per-fragment operations.  They are presented in the +order in which they're performed.  If a fragment fails a test it is +discarded and not subjected to subsequent tests or modifications.
    +
    +

    6.1 Scissor Test

    +The scissor test limits rendering to a 2-D rectangular region of the +framebuffer.  The command
    +
    +
    void glScissor(GLintx, GLint y, GLsizei width, GLsizei height)
    +
    +
    +defines a clipping region with the lower-left corner at (x, y) and the given width and height.  The scissor test is +enabled and disabled with the command glEnable(GL_SCISSOR_TEST) +and glDisable(GL_SCISSOR_TEST).
    +
    +If the incoming fragment's position is (xf, yf) +then the fragment will pass the test if x <= xf < x + width and y <= yf < y + height.  Otherwise, the +fragment is discarded.
    +
    +If width or height is less than zero the error +GL_INVALID_VALUE is raised.  The default scissor rectangle bounds +are (0, 0, w, h) where w is the initial window width and h is the +initial window height.  The scissor test is disabled by default.
    +
    +

    6.2 Alpha Test

    +The alpha test compares the fragment's alpha value against a reference +value and discards the fragment if the comparison fails.  The test +is specified by the command
    +
    +
    void glAlphaFunc(GLenummode, GLclampf reference)
    +
    +
    +mode specifies an inequality +and reference specifies a value +to compare against.  The following table lists all possible +modes and the +corresponding test:
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Comparison mode
    +
    The test passes if
    +
    GL_LESS
    +
    alpha < reference
    +
    GL_LEQUAL
    +
    alpha <= reference
    GL_GREATER
    +
    alpha > reference
    GL_GEQUAL
    +
    alpha >= reference
    GL_EQUAL
    +
    alpha == reference
    GL_NOTEQUAL
    +
    alpha != reference
    GL_NEVER
    +
    never pass
    +
    GL_ALWAYS
    +
    always passes
    +
    +
    +The reference parameter is +clamped to the range [0, 1].
    +
    +The alpha test is enabled and disabled with the commands glEnable(GL_ALPHA_TEST) and glDisable(GL_ALPHA_TEST).
    +
    +The default mode is GL_ALWAYS and the default reference value is 0.
    +
    +

    6.3 Stencil Test

    +The stencil buffer stores an N-bit integer value for each pixel in the +frame buffer.  The stencil test compares the stencil buffer value +at the fragment's position to a reference value and possibly discards +the fragment based on the outcome.  Furthermore, the stencil buffer +value may be updated or modified depending on the outcome.  If +there is no stencil buffer the stencil test is bypassed.
    +
    +Stenciling is controlled by the commands
    +
    +
    void glStencilFunc(GLenumfunc, GLint ref, GLuint mask)
    +void glStencilOp(GLenum stencilFail, GLenum depthTestFail, GLenum depthTestPass)
    +
    +
    +The glStencilFunc command controls the +stencil test while glStencilOp +command controls the how the stencil buffer is updated/modified after +the test.
    +
    +ref is clamped to the range [0, +2N-1] where N is the number of bits per stencil value in the +stencil buffer.
    +
    +The following table lists all possible values for the func parameter and when the stencil +test will pass.  Both the stencil buffer value and the stencil +reference value are bit-wise ANDed with the mask parameter before the test.
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Stencil func value
    +
    Stencil test passes if
    +
    GL_LESS
    +
    (ref&mask) < (stencil buffer value +& mask)
    +
    GL_LEQUAL
    +
    (ref +& mask) <= (stencil +buffer value & mask)
    GL_GREATER
    +
    (ref +& mask) > (stencil +buffer value & mask)
    GL_GEQUAL
    +
    (ref +& mask) >= (stencil +buffer value & mask)
    GL_EQUAL
    +
    (ref +& mask) == (stencil +buffer value & mask)
    GL_NOTEQUAL
    +
    (ref +& mask) != (stencil +buffer value & mask)
    GL_NEVER
    +
    never passes
    +
    GL_ALWAYS
    +
    always passes
    +
    +
    +
    +If the stencil test passes, the fragment is passed to the next +per-fragment operation.  Otherwise, if the stencil test fails, the +value in the stencil buffer is updated according to the value of the stencilFail parameter to glStencilOp.
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    stencilFail +value
    +
    New stencil buffer value
    +
    GL_KEEP
    +
    originalValue
    +
    GL_ZERO
    +
    0
    +
    GL_INVERT
    +
    BitWiseInvert(originalValue) +i.e. ~originalValue
    +
    GL_REPLACE
    +
    ref
    +
    GL_INCR
    +
    originalValue + 1, clamped to +[0, 2N-1]
    GL_DECR
    +
    originalValue - 1, clamped to +[0, 2N-1]
    +
    +
    +The depthTestFail and depthTestPass parameters to glStencilOp are ignored.  Values +for func and stencilFail other than those listed +in the table will cause the error GL_INVALID_ENUM to be raised.
    +
    +The stencil test is enabled and disabled with the commands glEnable(GL_STENCIL_TEST) and glDisable(GL_STENCIL_TEST).
    +
    +The default stencil function is GL_ALWAYS.  The default stencil +reference value is 0.  The default stencil mask is ~0.  The +default stencil fail operation is GL_KEEP.
    +
    +Values written into the stencil buffer are masked with the command
    +
    +
    void glStencilMask(GLuintmask)
    +
    +
    +Only the bits which are set in mask +will be modified in the stencil buffer when written to.  If each +stencil buffer value has N bits, only the least significant N bits of mask are relevant.  The default +stencil mask is ~0.
    +
    +

    6.4 Blending and Logicop

    +Blending or a logic operation combines the incoming fragment color with +the destination frame buffer color according to a blending equation or +bit-wise Boolean logical operation.
    +
    +Blending is enabled and disabled with the commands glEnable(GL_BLEND) and glDisable(GL_BLEND).
    +
    +The logic operation is enabled and disabled with the commands glEnable(GL_LOGIC_OP) and glDisable(GL_LOGIC_OP).
    +
    +If both blending and the logic operation are enabled, the logic +operation has higher priority; blending is bypassed.
    +
    +

    6.4.1 Logic Op

    +The command
    +
    +
    void glLogicop(GLenummode)
    +
    +
    +Specifies the Boolean logic operation for combining the incoming +fragment color with the destination frame buffer color.  Both the +incoming fragment color and destination frame buffer colors are +interpreted as four-tuples of unsigned integer color components in the +range [0, 2N-1] where N is the number of bits per color +channel.  N may not be the same for all color channels.
    +
    +The following table lists all values for mode and the boolean arithmetic used +to combine the incoming fragment color value (src) with the destination framebuffer +color value (dst).  Standard ANSI C operators used.
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    LogicOp mode
    +
    Resulting channel value
    +
    GL_CLEAR
    +
    0
    +
    GL_SET
    +
    ~0
    +
    GL_COPY
    +
    src
    +
    GL_COPY_INVERTED
    +
    ~s
    +
    GL_NOOP
    +
    dst
    +
    GL_INVERT
    +
    ~dst
    +
    GL_AND
    +
    src & dst
    +
    GL_NAND
    +
    ~(src & dst)
    +
    GL_AND_REVERSE
    +
    src & ~dst
    +
    GL_AND_INVERTED
    +
    ~src & dst
    +
    GL_OR
    +
    src | dst
    +
    GL_NOR
    +
    ~(src | dst)
    +
    GL_OR_REVERSE
    +
    src | ~dst
    +
    GL_OR_INVERTED
    +
    ~src | dst
    +
    GL_XOR
    +
    src ^ dst
    +
    GL_EQUIV
    +
    ~(src ^ dst)
    +
    +
    +The fragment's color is replaced by the result of the logic operation.
    +
    +Specifying any value for mode +other than those listed in the above table will cause the error +GL_INVALID_ENUM to be raised.
    +
    +The default value for mode is +GL_COPY.  The logic operation is disabled by default.
    +
    +

    6.4.2 Blending

    +The command
    +
    +
    void glBlendFunc(GLenumsrcTerm, GLenum dstTerm)
    +
    +
    +specifies the terms of the blending equation.  If Cf = (Rf, Gf, +Bf, Af) is the incoming fragment color and Cb = (Rb, Gb, Bb, Ab) is the +frame buffer color, then the resulting color Cv = (Rv, Gv, Bv, Av) is +computed by:
    +
    +
    Cv = Cf * srcTerm + Cb * dstTerm
    +
    +
    +All possible values for srcTerm +and the corresponding arithmetic term are listed in the following table:
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    srcTerm
    +
    srcTermArithmetic
    +
    GL_ZERO
    +
    (0, 0, 0, 0)
    +
    GL_ONE
    +
    (1, 1, 1, 1)
    +
    GL_DST_COLOR
    +
    (Rb, Gb, Bb, Ab)
    +
    GL_ONE_MINUS_DST_COLOR
    +
    (1-Rb, 1-Gb, 1-Bb, 1-Ab)
    +
    GL_SRC_ALPHA
    +
    (Af, Af, Af, AF)
    +
    GL_ONE_MINUS_SRC_ALPHA
    +
    (1-Af, 1-Af, 1-Af, 1-Af)
    +
    GL_DST_ALPHA
    +
    (Ab, Ab, Ab, Ab)
    +
    GL_ONE_MINUS_DST_ALPHA
    +
    (1-Ab, 1-Ab, 1-Ab, 1-Ab)
    +
    GL_SRC_ALPHA_SATURATE
    +
    (m, m, m, 1) where m = MIN(Af, +1-Ab)
    +
    +
    +All possible values for srcTerm +and the corresponding arithmetic term are listed in the following table:
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    dstTerm
    +
    dstTermArithmetic
    +
    GL_ZERO
    +
    (0, 0, 0, 0)
    +
    GL_ONE
    +
    (1, 1, 1, 1)
    +
    GL_SRC_COLOR
    +
    (Rf, Gf, Bf, Af)
    +
    GL_ONE_MINUS_SRC_COLOR
    +
    (1-Rf, 1-Gf, 1-Bf, 1-Af)
    +
    GL_SRC_ALPHA
    +
    (Af, Af, Af, AF)
    +
    GL_ONE_MINUS_SRC_ALPHA
    +
    (1-Af, 1-Af, 1-Af, 1-Af)
    +
    GL_DST_ALPHA
    +
    (Ab, Ab, Ab, Ab)
    +
    GL_ONE_MINUS_DST_ALPHA
    +
    (1-Ab, 1-Ab, 1-Ab, 1-Ab)
    +
    +
    +The fragment's color is replaced by the result of the blending equation.
    +
    +Values for srcTerm and dstTerm other than those listed in +the table will cause the error GL_INVALID_ENUM to be raised.
    +
    +The default value for srcTerm +is GL_ONE.  The default value for dstTerm +is GL_ZERO.  Blending is disabled by default.
    +
    +

    6.5 Color Mask

    +The final fragment color is written into the current color buffer at +the end of the per-fragment operations.  Normally, all color +channels in the frame buffer are replaced with the final fragment color. + However, the command
    +
    +
    void glColorMask(GLbooleanredMask, GLboolean greenMask, GLboolean blueMask, GLboolean alphaMask)
    +
    +
    +allows selective writing to individual color channels.  If redMask is GL_TRUE then writing to +the red color channel is enabled, otherwise it's disabled. + Similarly, the green, blue and alpha channels can also be masked.
    +
    +Initially all four mask values are GL_TRUE.
    +
    +Color masking is not enabled/disabled with the glEnable/glDisable commands.
    +
    +

    7. Frame Buffer Operations

    +The frame buffer is considered to be a two-dimensional array of pixels. + The frame buffer is also organized into layers or logical buffers. + There may be a front color buffer, back color buffer and stencil +buffer.  A double-buffered frame buffer has both a front color +buffer and back color buffer.  A single-buffered framebuffer only +has a front color buffer.  Each pixel in a color buffer has a red, +green and blue value and an optional alpha value.
    +
    +

    7.1 Clearing Buffers

    +Buffers are cleared (set to uniform values) with the command
    +
    +
    void glClear(GLbitfieldbuffers)
    +
    +
    +buffers is a bitmask for which +the value may be the bitwise-OR of the values GL_COLOR_BUFFER_BIT and +GL_STENCIL_BUFFER_BIT.  If the GL_COLOR_BUFFER_BIT bit is +specified, the current color buffer will be cleared.  If the +GL_STENCIL_BUFFER_BIT bit is specified, the stencil buffer will be +cleared.
    +
    +The current color buffer is specified with the command
    +
    +
    void glDrawBuffer(GLenum buffer)
    +
    +
    +buffer may be either GL_FRONT, +GL_BACK or GL_NONE.  GL_FRONT indicates that the front color buffer +will be modified by glClear and +any drawing command.  GL_BACK indicates that the back color buffer +will be modified by glClear and +any drawing command.  GL_NONE indicates that neither color buffer +will be modified by glClear or +any drawing command.  GL_BACK is only valid for double-buffered +frame buffers.
    +
    +The current scissor rectangle, set by the glScissor command, effects glClear, limiting +the clear to the scissor rectangle, if it's enabled.  Furthermore, only the color channels enabled by glColorMask will be effected by glClear(GL_COLOR_BUFFER_BIT). + Likewise, only the stencil bits enabled by glStencilMask will be effected by glClear(GL_STENCIL_BUFFER_BIT).
    +
    +The current clear color is set with the command
    +
    +
    void glClearColor(GLclampfred, GLclampf green, GLclampf blue, GLclampf alpha)
    +
    +
    +Subsequent calls to glClear +will use the color (red, green, blue, +alpha) to clear the front or back color buffers.
    +
    +The current stencil clear value is set with the command
    +
    +
    void glClearStencil(GLintclearValue)
    +
    +
    +If the stencil buffer is N bits deep, the least significant N bits of clearValue will be used to clear the +stencil buffer.
    +
    +
    +

    8. Other Features

    +

    8.1 Frame Buffer Readback

    +A rectangular region of pixels can be read from the frame buffer and +placed in client memory with the command
    +
    +
    void glReadPixels(GLintx, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *data)
    +
    +
    +x and y specify the coordinate of the +lower-left corner of the region to read and width and height specify the size of the +rectangular region to read.  format +specifies the format of image data and must be either GL_RGB or +GL_RGBA.  type specify the +data type of the image data and must be either GL_UNSIGNED_BYTE or +GL_FLOAT.  Other values for format +or type will cause the error +GL_INVALID_ENUM to be raised.
    +
    +The framebuffer may contain 3-component colors (red, green, blue) or +4-component colors (red, green, blue, alpha).  If an alpha channel +is not present, alpha values default to 1.0.
    +
    +The frame buffer color components (red, green, blue, alpha) are either +converted to 8-bit unsigned integers in the range[0, 255] if type is GL_UNSIGNED_BYTE or +converted to floating point values in the range [0, 1] if type is GL_FLOAT.  The (red, +green, blue, alpha) tuples are then stored as GL_RGB triplets (by +dropping the alpha component) or GL_RGBA quadruples in client memory.
    +
    +Image data is packed into +client memory according to the pixel packing parameters which are set by +the command
    +
    +
    void glPixelStorei(GLenum pname, GLint value)
    +
    +
    +pname must be +GL_PACK_ROW_LENGTH.  value +indicates the stride (in pixels) between subsequent rows in the +destination image.  If GL_PACK_ROW_LENGTH is zero (the default) +then the width parameter to glReadPixels indicates the row stride.
    +
    +Pixel readback takes place as follows:
    +
    +
    if (GL_PACK_ROW_LENGTH == 0)
    +    rowLength = width;
    +else
    +    rowLength = GL_PACK_ROW_LENGTH
    +
    +if (format == GL_RGB) {
    +    for (i = 0; i < height; +i++) {
    +        for (j = 0; j < width; j++) {
    +            k = (i * +rowLength + j) * 3;
    +            data[k+0] = FrameBuffer(x + j, y + i).red;
    +            data[k+1] = FrameBuffer(x + j, y + i).green;
    +            data[k+2] = FrameBuffer(x + j, y + i).blue;
    +        }
    +    }
    +}
    +else {
    +    for (i = 0; i < height; +i++) {
    +        for (j = 0; j < width; j++) {
    +            k = (i * +rowLength + j) * 4;
    +            data[k+0] = FrameBuffer(x + j, y + i).red;
    +            data[k+1] = FrameBuffer(x + j, y + i).green;
    +            data[k+2] = FrameBuffer(x + j, y + i).blue;
    +            data[k+3] = FrameBuffer(x + j, y + i).alpha;
    +        }
    +    }
    +}
    +
    +
    +The function FrameBuffer(c, r) +returns the pixel in the frame buffer at column c of row r.  data is considered to be either a +GLubyte pointer or a GLfloat pointer, depending on the type parameter.  Similarly, the +FrameBuffer function returns either GLubyte values in the range [0, 255] +or GLfloat values in the range [0,1], depending on the type parameter.
    +
    +Pixels may be read from either the front or back color buffer. + The command
    +
    +
    void glReadBuffer(GLenumbuffer)
    +
    +
    +specifies the source for reading images with glReadPixels.  If buffer is GL_FRONT then front color +buffer is the source.  If buffer +is GL_BACK then the back color buffer is the source.  It is illegal +to specify GL_BACK when the color buffer is not double buffered. + Any invalid value for buffer +will raise the error GL_INVALID_ENUM.
    +
    +The default read source is GL_BACK if the frame buffer is double +buffered.  Otherwise, the default read source is GL_FRONT.
    +
    +

    8.2 Selection Mode

    +Selection mode is typically used to implement picking: determining which +primitive(s) are present at particular window positions.  The +command
    +
    +
    GLint glRenderMode(GLenummode)
    +
    +
    +is used to enable selection mode.  If mode is GL_SELECTION the graphics +library is put into selection mode.  If mode is GL_RENDER the graphic +library is put into normal rendering mode.  Any other value for mode will raise the error +GL_INVALID_ENUM.
    +
    +When in selection mode rendering commands will not effect the +framebuffer.  Instead, a record of the primitives that would have +been drawn is placed in the selection buffer.  The selection buffer +is specified with the command
    +
    +
    void glSelectionBuffer(GLsizein, GLuint *buffer)
    +
    +
    +buffer
    is an array of n +unsigned integers.  No more than n +values will be placed in the buffer.
    +
    +The name stack is a stack +(LIFO) of unsigned integer names.  The following commands +manipulate the name stack:
    +
    +
    void glInitNames(void)
    +void glPushName(GLuint name)
    +void glPopName(void)
    +void glLoadName(GLuint name)
    +
    +
    +glInitNames resets the name +stack to an empty state.  glPushName pushes the given name value onto the stack.  glPopName pops the top name from the +stack.  glLoadName replaces the top value on +the stack with the specified name. + Stack underflow and overflow conditions cause the errors +GL_STACK_OVERFLOW and GL_STACK_UNDERFLOW to be raised.
    +
    +While in selection mode, primitives (points, lines, polygons) are +transformed and clip-tested normally.  Primitives which aren't +discarded by clipping cause the hit data to be updated.  The hit +data consists of three pieces of information: a hit flag, a minimum Z +value and a maximum Z value.  First, the hit flag is set. + Then, for each of the primitive's vertices, the vertex Z value is +compared to the minimum and maximum Z values.  The minimum Z value +is updated if the vertex's Z value is less than the minimum Z value. + The maximum Z value is updated if the vertex's Z value is greater +than the maximum Z value.
    +
    +When any of glInitNames, glPushName, glPopName, glLoadName or glRenderMode are called and the hit +flag is set, a hit record is +written to the selection buffer.
    +
    +A hit record consists of a sequence of unsigned integers.  The +first value is the size of the name stack.  The second value is the +minimum Z value multiplied by 232-1.  The third value is +the maximum Z value multiplied by 232-1.  The remaining +values are the values in the name stack, in bottom to top order. + The hit flag is cleared after a hit record is written to the +selection buffer.  Hit records are places sequentially into the +selection buffer until it is full or selection mode is terminated.
    +
    +Selection mode is terminated by calling glRenderMode(GL_RENDER).   The +return value of glRenderMode +will be -1 if the selection buffer overflowed.  Otherwise, the +return value will indicate the number of values written into the +selection buffer.
    +
    +

    8.3 Synchronization

    +The command
    +
    +
    void glFlush(void)
    +
    +
    +makes the graphics library to flush all pending graphics commands. + The command
    +

    +void glFinish(void)
    +
    +
    +makes the graphics library flush the command queue and wait until those +commands are completed.  glFlush +will not return until all previous graphics commands have been fully +completed.
    +
    +These commands are typically used to force completion of rendering to +the front color buffer.  Otherwise, rendering to the front color +buffer may not appear.  The swapbuffers +command (part of the window system binding library) does an implicit +flush before swapping the front and back color buffers.  The glReadPixels command also does an +implicit flush before reading pixel data from the frame buffer.
    +
    +

    9. State Queries

    +The current value of nearly all library state variables can be queried. + This chapter describes the commands used for querying the value of +state variables.
    +
    +

    9.1 General State Queries

    +The command
    +
    +
    void glGetFloatv(GLenumpname, GLfloat *values)
    +
    +
    +returns the value(s) of the state variable specified by pname.  The following table +lists all accepted values for pname +and a description of the value(s).  Specifying any other value for pname causes the error +GL_INVALID_ENUM to be raised.
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Variable (pname)
    +
    Number of values
    +
    Value(s) Description
    +
    GL_ALPHA_BITS
    +
    1
    +
    Number of bits per alpha value +in the frame buffer.
    +
    GL_ALPHA_TEST
    +
    1
    +
    Zero if the alpha test is +disabled.
    +One if the alpha test is enabled.
    +
    GL_ALPHA_TEST_FUNC
    +
    1
    +
    The alpha test function.
    +
    GL_BLEND
    +
    1
    +
    Zero if blending is disabled.
    +One if blending is enabled.
    +
    GL_BLEND_DST
    +
    1
    +
    Blend destination function/term.
    +
    GL_BLEND_SRC
    +
    1
    +
    Blend source function/term.
    +
    GL_BLUE_BITS
    +
    1
    +
    Number of bits per blue value in +the frame buffer.
    +
    GL_COLOR_CLEAR_VALUE
    +
    4
    +
    Clear color (red, green, blue, +alpha).
    +
    GL_COLOR_WRITE_MASK
    +
    4
    +
    Color buffer writemask (red, +green, blue, alpha).
    +Zero if writing is disabled.
    +One if writing is enabled.
    +
    GL_CULL_FACE
    +
    1
    +
    Zero if polygon culling is +disabled.
    +One if polygon culling is enabled.
    +
    GL_CULL_FACE_MODE
    +
    1
    +
    Polygon cull mode: GL_FRONT, +GL_BACK or GL_FRONT_AND_BACK.
    +
    GL_CURRENT_COLOR
    +
    4
    +
    Current color (red, green, blue, +alpha).
    +
    GL_CURRENT_RASTER_COLOR
    +
    4
    +
    Current raster position color +(red, green, blue, alpha).
    +
    GL_CURRENT_RASTER_TEXTURE_COORDS
    +
    4
    +
    Current raster position texture +coordinates (s, t, r, q).
    +
    GL_CURRENT_RASTER_POSITION
    +
    4
    +
    Current raster position (x, y, +z, w).
    +
    GL_CURRENT_POSITION_VALID
    +
    1
    +
    Zero if current raster position +is invalid.
    +One if current raster position is valid.
    +
    GL_CURRENT_TEXTURE_COORDS
    +
    4
    +
    Current texture coordinates (s, +t, r, q)
    +
    GL_DOUBLEBUFFER
    +
    1
    +
    Zero if color buffer is +single-buffered.
    +One if color buffer is double-buffered.
    +
    GL_DRAW_BUFFER
    +
    1
    +
    Current color draw buffer: +GL_FRONT or GL_BACK.
    +
    GL_FRONT_FACE1
    +
    Polygon front-face winding: +GL_CW or GL_CCW.
    +
    GL_GREEN_BITS
    +
    1
    +
    Number of bits per green value +in the frame buffer.
    +
    GL_LINE_SMOOTH
    +
    1
    +
    Zero if line smoothing is +disabled.
    +One if line smoothing is enabled.
    +
    GL_LINE_STIPPLE
    +
    1
    +
    Zero if line stippling is +disabled.
    +One if line stippling is enabled.
    +
    GL_LINE_STIPPLE_PATTERN
    +
    1
    +
    Line stipple pattern.
    +
    GL_LINE_STIPPLE_REPEAT
    +
    1
    +
    Line stipple repeat factor.
    +
    GL_LINE_WIDTH
    +
    1
    +
    Line width in pixels.
    +
    GL_LINE_WIDTH_GRANULARITY
    +
    1
    +
    Aliased line width granularity.
    +
    GL_LINE_WIDTH_RANGE
    +
    2
    +
    Minimum and maximum aliased line +widths.
    +
    GL_ALIASED_LINE_WIDTH_RANGE
    +
    2
    +
    Minimum and maximum antialiased +line widths.
    GL_COLOR_LOGIC_OP
    +
    1
    +
    Zero if logicop is disabled.
    +One if logicop is enabled.
    +
    GL_LOGIC_OP_MODE
    +
    1
    +
    Logicop function.
    +
    GL_MATRIX_MODE
    +
    1
    +
    Matrix mode: GL_MODELVIEW or +GL_PROJECTION.
    +
    GL_MAX_MODELVIEW_STACK_DEPTH
    +
    1
    +
    Maximum size of the modelview +matrix stack.
    +
    GL_MAX_NAME_STACK_DEPTH
    +
    1
    +
    Maximum size of the selection +name stack.
    +
    GL_MAX_PROJECTION_STACK_DEPTH
    +
    1
    +
    Maximum size of the projection +matrix stack.
    +
    GL_MAX_TEXTURE_SIZE
    +
    1
    +
    Maximum 2D texture image width +and height.
    +
    GL_MAX_VIEWPORT_DIMS
    +
    2Maximum viewport width and +height in pixels.
    +
    GL_MODELVIEW_MATRIX
    +
    16
    +
    Current/top modelview matrix +values.
    +
    GL_MODELVIEW_MATRIX_STACK_DEPTH
    +
    1
    +
    Current size of the modelview +matrix stack.
    +
    GL_NAME_STACK_DEPTH
    +
    1
    +
    Current size of the selection +name stack.
    +
    GL_PACK_ROW_LENGTH
    +
    1
    +
    Pixel packing row length.
    +
    GL_POLYGON_SMOOTH
    +
    1
    +
    Zero if polygon smoothing is +disabled.
    +One if polygon smoothing is enabled.
    +
    GL_PROJECTION_MATRIX
    +
    16
    +
    Current/top projection matrix +values.
    +
    GL_PROJECTION_STACK_DEPTH
    +
    1
    +
    Current size of projection +matrix stack.
    +
    GL_READ_BUFFER
    +
    1
    +
    Current read buffer: GL_FRONT or +GL_BACK.
    +
    GL_RED_BITS
    +
    1
    +
    Number of bits per red value in +the frame buffer.
    +
    GL_RENDER_MODE
    +
    1
    +
    Current rendering mode: +GL_RENDER or GL_SELECTION.
    +
    GL_RGBA_MODE
    +
    1
    +
    Always one.
    +
    GL_SCISSOR_BOX
    +
    4
    +
    Scissor box (x, y, width, +height).
    +
    GL_SCISSOR_TEST
    +
    1
    +
    Zero if scissor test is disabled.
    +One if scissor test is enabled.
    +
    GL_SELECTION_BUFFER_SIZE
    +
    1
    +
    Size of selection buffer.
    +
    GL_SHADE_MODEL
    +
    1
    +
    Shade model: GL_FLAT or +GL_SMOOTH.
    +
    GL_STENCIL_BITS
    +
    1
    +
    Number of bits per stencil value +in the frame buffer.
    +
    GL_STENCIL_CLEAR_VALUE
    +
    1
    +
    Stencil buffer clear value.
    +
    GL_STENCIL_FAIL
    +
    1
    +
    Stencil fail operation.
    +
    GL_STENCIL_FUNC
    +
    1
    +
    Stencil function.
    +
    GL_STENCIL_REF
    +
    1
    +
    Stencil reference value.
    +
    GL_STENCIL_TEST
    +
    1
    +
    Zero if stencil test is disabled.
    +One if stencil test is enabled.
    +
    GL_STENCIL_VALUE_MASK
    +
    1
    +
    Stencil mask value.
    +
    GL_STENCIL_WRITE_MASK
    +
    1
    +
    Stencil buffer write mask.
    +
    GL_TEXTURE_2D
    +
    1
    +
    Zero if 2D texture mapping is +disabled.
    +One if 2D texture mapping is enabled.
    +
    GL_TEXTURE_BINDING_2D1
    +
    Name of currently bound 2D +texture object.
    +
    GL_TEXTURE_ENV_COLOR
    +
    4
    +
    Texture environment color (red, +green, blue, alpha).
    +
    GL_TEXTURE_ENV_MODE
    +
    1
    +
    Texture environment mode.
    +
    GL_UNPACK_ROW_LENGTH
    +
    1
    +
    Pixel unpacking row length.
    +
    GL_UNPACK_LSB_FIRST
    +
    1
    +
    Zero if most significant bit is +unpacked first for bitmaps.
    +One if least significant bit is unpacked first for bitmaps.
    +
    GL_VIEWPORT
    +
    4
    +
    Current viewport (x, y, width, +height).
    +
    +
    +
    +

    9.2 String Queries

    +The command
    +
    +
    const GLubyte *glGetString(GLenum name)
    +
    +
    +is used to query string-valued values.  The legal values for name are described in the following +table:
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    name
    +
    Return value
    +
    GL_VERSION
    +
    The library version, such as +"1.2".
    +
    GL_RENDERER
    +
    The renderer, such as "Mesa DRI +Radeon".
    +
    GL_VENDOR
    +
    The vendor of this +implementation, such as "Tungsten Graphics, Inc."
    +
    GL_EXTENSIONS
    +
    A white-space separated list of +the supported extensions.
    +
    +

    9.3 Error Queries

    +The command
    +
    +
    GLenum glGetError(void)
    +
    +
    +returns the current error code.  The current error code will be +set by a GL command when an error condition has been detected.  If +the current error code is already set, subsequent errors will not be +recorded.  The error code is reset/cleared to GL_NO_ERROR when glGetError returns.  The +following error codes are possible:
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Error code
    +
    Meaning
    +
    GL_NO_ERROR
    +
    No error has been recorded.
    +
    GL_INVALID_ENUM
    +
    An enum parameter had an invalid +value.
    +
    GL_INVALID_VALUE
    +
    A numeric parameter had an +invalid value.
    +
    GL_INVALID_OPERATION
    +
    A function was called when not +legal to do so.
    +
    GL_STACK_OVERFLOW
    +
    The current transformation +matrix stack is full.
    +
    GL_STACK_UNDERFLOW
    +
    The current transformation +matrix stack is empty.
    +
    GL_OUT_OF_MEMORY
    +
    The system ran out of dynamic +memory.
    +
    +
    +
    +

    10. Unsupported Features

    +This section lists other features and functions which are not supported +and not previously discussed.
    +
    +

    10.1 Feedback Mode

    +Feedback mode and the following related functions are not supported.
    +
    +
    glFeedbackBuffer
    +glPassThrough
    +
    +
    +

    10.2 1D and 3D Textures
    +

    +Only 2D texture images are supported.  The following functions +used to specify 1D and 3D texture images are not supported:
    +
    +
    glTexImage1D
    +glTexImage3D
    +glTexSubImage1D
    + glTexSubImage3D
    +glCopyTexImage1D
    + glCopyTexSubImage1D
    + glCopyTexSubImage3D
    +
    +
    +

    10.3 Alternate Texture Image Commands
    +

    +Texture images may only be specified with glTexImage2D.  The following +alternate texture image commands are not supported:
    +
    +
    glTexSubImage2D
    +glCopyTexImage2D
    +glCopyTexSubImage2D
    +
    +
    +

    10.4 Proxy Textures

    +Proxy textures are not supported and the GL_PROXY_TEXTURE_2D token is +not supported by any function.
    +
    +
    +

    10.5 Other Texture Commands

    +The following commands related to texture mapping are not supported by +the subset:
    +
    +
    glPrioritizeTextures
    +glAreTexturesResident
    +glIsTexture
    +glTexEnviv
    +glTexEnvf
    +glTexParameterf
    +glTexParameteriv
    +glTexParameterfv
    +
    +
    +
    +

    10.6 Copy and Draw Pixels
    +

    +The following commands are not supported:
    +
    +
    glDrawPixels
    +glCopyPixels
    +glPixelZoom
    +
    +
    +

    10.7 Color Index Mode
    +

    +Color index mode and the following related commands are not supported:
    +
    + +
    glIndexub
    +
    glIndexi
    +glIndexs
    +glIndexf
    +glIndexd
    +
    glIndexubv
    +
    glIndexiv
    +glIndexsv
    +glIndexfv
    +glIndexdv

    +glIndexMask
    +
    glClearIndex
    +glIndexPointer

    +
    +
    +

    10.8 Pixel Transfer Operations

    +The pixel transfer operations (scale, bias, look-up table, etc) are not +supported and the following commands are omitted:
    +
    +
    glPixelTransferf
    +glPixelTransferi
    +glPixelMapfv
    +glPixelMapuiv
    +glPixelMapusv
    +glGetPixelMapfv
    +glGetPixelMapuiv
    +glGetPixelMapusv
    +
    +
    +

    10.9 Hints

    +Hints and the following related command is not supported:
    +
    +
    glHint
    +

    +
    +

    10.10 State Query Commands
    +

    +The following state query commands are not supported:
    +
    +
    glGetBooleanv
    +glGetIntegerv
    +glGetDoublev
    +glGetPointerv
    +glGetTexEnvi
    +glGetTexEnvf
    +glGetTexParameteriv
    +glGetTexParameterfv
    +glGetTexLevelParameteriv
    +glGetTexLevelParameterfv
    +glGetTexImage
    +glGetClipPlane
    +
    +
    +

    10.11 Attribute Stacks

    +State attribute stacks and the following related commands are not +supported:
    +
    +
    glPushAttrib
    +glPopAtttrib
    +
    +
    +

    10.12 Double-Valued Functions

    +All functions which take double-precision floating point values, but +for which there is an equivalent single-precision valued function, are +omitted.  This includes, but is not limited to:
    +
    +
    glVertex2d
    +glVertex2dv
    +glVertex3d
    + glVertex3dv
    +glVertex4d
    + glVertex4dv
    +glColor3d
    +glColor3dv
    +glColor4d
    + glColor4dv
    +glTexCoord1d
    +glTexCoord1dv
    +glTexCoord2d
    + glTexCoord2dv
    +glTexCoord3d
    + glTexCoord3dv
    +glTexCoord4d
    + glTexCoord4dv
    +glRasterPos2d
    + glRasterPos2dv
    +glRasterPos3d
    + glRasterPos3dv
    +glRasterPos4d
    + glRasterPos4dv
    +glLoadMatrixd
    +glMultMatrixd
    +glScaled
    +glRotated
    +glTranslated
    +glRectd
    +glRectdv
    +

    +
    +

    10.13 Evaluators

    +Evaluators and the following related commands are not supported:
    +
    +
    glMap1f
    +glMap2d
    +glMap2f
    +glGetMapdv
    +glGetMapfv
    +glGetMapiv
    +glEvalCoord1d
    +glEvalCoord1f
    +glEvalCoord1dv
    +glEvalCoord1fv
    +glEvalCoord2d
    +glEvalCoord2f
    +glEvalCoord2dv
    +glEvalCoord2fv
    +glMapGrid1d
    +glMapGrid1f
    +glMapGrid2d
    +glMapGrid2f
    +glEvalPoint1
    +glEvalPoint2
    +glEvalMesh1
    +glEvalMesh2
    +
    +
    +

    10.14 Display Lists

    +Display lists and the following related commands are not supported:
    +
    +
    glIsList
    +glDeleteLists
    +glGenLists
    +glNewList
    +glEndList
    +glCallList
    +glCallLists
    +glListBase
    +
    +
    +

    10.15 Accumulation Buffer

    +The accumulation buffer and the following related commands are not +supported:
    +
    +
    glAccum
    +glClearAccum
    +
    +
    +

    10.16 Fog

    +Fog and the following related commands are not supported:
    +
    +
    glFogi
    +glFogf
    +glFogiv
    +glFogfv
    +
    +
    +

    10.17 Depth Test

    +Depth testing and the following related commands are not supported:
    +
    +
    glDepthFunc
    +glDepthMask
    +glDepthRange
    +glClearDepth
    +
    +
    +

    10.18 Imaging Subset

    +The OpenGL imaging subset (which implements features such as +convolution, histogram, min/max recording, color matrix and color +tables) is not supported.
    +
    +
    +

    Appendix A: Issues

    +This appendix lists documentation and subset issues with their current +status.  For items which are still open, the documentation (above) +follows the recommended solution.
    +
    +

    A.1 Vertex Arrays

    +Should vertex arrays be supported?  Is there a performance +advantage?
    +
    +RESOLUTION: No, there isn't enough of a performance advantage to +justify them.
    +
    +

    A.2 Polygon Antialiasing and Edge Flags

    +Should edge flags be supported for antialiasing?
    +
    +Edge flags don't effect antialiasing, at least not normally.  A +number of approaches to antialiasing have been summarized in email.
    +
    +RECOMMENDATION: don't support edge flags.  They don't effect +polygon antialiasing.
    +
    +RESOLUTION: closed, as of 26 Feb 2003.
    +
    +

    A.3 glRasterPos vs. glWindowPos

    +Should glRasterPos and/or glWindowPos commands be supported?
    +
    +RESOLUTION: Closed: implement glRasterPos commands, but not glWindowPos +commands.
    +
    +

    A.4 GL_IBM_rasterpos_clip extension

    +Should the GL_IBM_rasterpos_clip extension be implemented?
    +
    +RESOLUTION:  No.  It's not required.
    +
    +

    A.5 Image Formats and Types

    +Which image formats and types should be supported for glTexImage2D and glReadPixels?
    +
    +OpenGL specifies a large +variety of image formats and data types.  Only a few are commonly +used.
    +
    +RECOMMENDATION:  we propose a subset:
    +
    +For glTexImage2D only allow type=GL_UNSIGNED_BYTE and format=GL_RGBA, GL_RGB, +GL_INTENSITY.   Only allow internalFormat +to be GL_RGBA, GL_RGB or GL_INTENSITY as well.  Basically, only +support image formats/types that are directly supported by the Radeon +hardware.  This will allow glTexImage2D +to basically just use memcpy to +copy texture images.
    +
    +For glReadPixels, only allow type = GL_UNSIGNED_BYTE or GL_FLOAT. + Only allow format = +GL_RGB or GL_RGBA.  This is just enough to support the OpenGL +conformance tests.
    +
    +RESOLUTION: open
    +
    +

    A.6 Texture Environment Modes

    +Which texture environment modes should be supported?  OpenGL 1.2 +has GL_REPLACE, GL_MODULATE, GL_DECAL and GL_BLEND.  GL_DECAL isn't +defined for all base internal texture formats.  GL_ADD is another +useful mode.  Perhaps drop GL_DECAL mode and add GL_ADD mode.
    +
    +RECOMMENDATION: implement the standard modes GL_REPLACE, GL_MODULATE, +GL_DECAL and GL_BLEND.
    +
    +RESOLUTION: open
    +
    +

    A.7 Truncated Mipmaps and LOD Control

    +Should we support the GL_TEXTURE_BASE_LEVEL, GL_TEXTURE_MAX_LEVEL, +GL_TEXTURE_MIN_LOD and GL_TEXTURE_MAX_LOD texture parameters?
    +
    +RECOMMENDATION:  We propose omitting these features at this time, +in the interest of simplifying the driver.
    +
    +RESOLUTION: open
    +
    +

    A.8 Texture Priorities and Residency

    +Should the subset support texture priorities via glPrioritizeTextures and the glAreTexturesResident command?
    +
    +RECOMMENDATION:  Few applications use these features and +functions.  We propose omitting them to simplify the driver.
    +
    +RESOLUTION: open
    +
    +

    A.9 Pixel Pack/Unpack Alignment Control

    +Should we support the GL_PACK_ALIGNMENT and GL_UNPACK_ALIGNMENT options?
    +
    +These are used to align pixel data addresses to 1, 2 and 4-byte +multiples for glBitmap, glTexImage2D +and glReadPixels.  These +aren't strictly needed since the user can provide a 1, 2 or 4-byte +aligned address and appropriate GL_PACK_ROW_LENGTH or +GL_UNPACK_ROW_LENGTH values instead.
    +
    +RECOMMENDATION:  We recommend omitting them to simplify the driver.
    +
    +RESOLUTION: open
    +
    +

    A.10 Pixel Pack/Unpack Skip Rows/Pixels Control

    +Should we support the GL_UNPACK_SKIP_PIXELS, GL_UNPACK_SKIP_ROWS, +GL_PACK_SKIP_PIXELS and GL_PACK_SKIP_ROWS options for pixel +unpacking/packing?
    +
    +These options aren't really needed since the user can adjust the start +address and GL_PACK/UNPACK_ROW_LENGTH parameters to achieve the same +effect.
    +
    +RECOMMENDATION:  omit these parameters.
    +
    +RESOLUTION: open
    +
    +

    A.11 Texture State Queries

    +Should we support the command glGetTexEnvi/fv, +glGetTexParameteri/fv and glGetTexLevelParameteri/fv?
    +
    +RECOMMENDATION:  No. They're seldom needed and their +implementation is several hundred lines of code in length.
    +
    +RESOLUTION:  open
    +
    +

    A.12 glGetIntegerv, glGetBooleanv and glGetDoublev

    +Should we support the commands glGetIntegerv, +glGetBooleanv and glGetDoublev +in addition to glGetFloatv?
    +
    +RECOMMENDATION:  Omit the boolean, integer and double-valued +functions. All state values which can be queried by these commands can +be expressed as floating point values and queried with glGetFloatv.  The +implementation of the other three commands involves many lines of code.
    +
    +RESOLUTION:  open
    +
    +

    A.13 glBitmap and Per-Fragment Operations

    +Should bitmaps rendered with glBitmap +be subjected to the per-fragment operations?
    +
    +If bitmaps are implemented with points it will be easy to implement the +per-fragment operations.  Otherwise, it could be difficult.
    +
    +RECOMMENDATION:  Implement glBitmap by drawing points/pixels with +the hardware.  This will make supporting the per-fragments +trivially easy.  Also, it makes portrait-mode display relatively +easy.
    +
    +RESOLUTION:  open
    +
    +

    A.14 Reduced gl.h Header File

    +Should we produce a reduced gl.h header file which only defines the +tokens and functions which are implemented by the subset?
    +
    +RECOMMENDATION: yes.  It would be a useful reference to +programmers to quickly determine which functions and tokens are +supported.
    +
    +RESOLUTION: open
    +
    +

    A.15 glPolygonMode

    +Is glPolygonMode needed?
    +
    +RECOMMENDATION: No.  Omit it.
    +
    +RESOLUTION: closed, as of 26 Feb 2003
    +
    +
    +

    + + diff --git a/mesalib/docs/subset.html b/mesalib/docs/subset.html new file mode 100644 index 000000000..4ac2eadff --- /dev/null +++ b/mesalib/docs/subset.html @@ -0,0 +1,24 @@ + + +Mesa Subset Driver + + + + + +

    Mesa Subset Driver

    + +

    +In 2002/2003 Tungsten Graphics was contracted to develop a subset Mesa/Radeon +driver for an embedded environment. The result is a reduced-size DRI driver +for the ATI R200 chip, for use with +fbdev/DRI environment. +

    + +

    +The specification for this subset can be found +here. +

    + + + diff --git a/mesalib/docs/systems.html b/mesalib/docs/systems.html new file mode 100644 index 000000000..5137b074e --- /dev/null +++ b/mesalib/docs/systems.html @@ -0,0 +1,71 @@ + + +Supported Systems and Drivers + + + + + +

    Supported Systems and Drivers

    + +

    +Mesa was originally designed for Unix/X11 systems and is still best +supported on those systems. All you need is an ANSI C compiler and the +X development environment to use Mesa. +

    + +

    +The DRI hardware drivers for the X.org server and XFree86 provide +hardware accelerated rendering for chips from ATI, Intel, Matrox, 3dfx +and others on Linux and FreeBSD. +

    + +

    +Drivers for other assorted platforms include: +the Amiga, Apple Macintosh, BeOS, NeXT, OS/2, MS-DOS, VMS, Windows +9x/NT, and Direct3D. +

    + +

    +Details about particular drivers follows: +

    + + + + +

    Deprecated Systems

    + +

    +These drivers have not been maintained and are being deprecated. +They can be saved if someone steps up to help. +

    + + + +And for historical reference: + + + + diff --git a/mesalib/docs/thanks.html b/mesalib/docs/thanks.html new file mode 100644 index 000000000..2031788f0 --- /dev/null +++ b/mesalib/docs/thanks.html @@ -0,0 +1,134 @@ + + + +Acknowledgements + + + + + + +

    Acknowledgments

    + + +The following individuals and groups are to be acknowledged for their +contributions to Mesa over the years. +This list is far from complete and somewhat dated, unfortunately. + + +
      +
    • Early Mesa development was done while Brian was part of the +SSEC Visualization Project at the University of +Wisconsin. He'd like to thank Bill Hibbard for letting him work on +Mesa as part of that project. +
      +
      +
    • John Carmack of id Software, Inc. funded Keith Whitwell in 1999 in +order to optimize Mesa's vertex transformation module. This is a very +substantial piece of work. +
      +
      +
    • Precision Insight, Inc., VA Linux Systems, Inc., and most recently, +Tungsten Graphics, Inc. have supported the ongoing development of Mesa. +
      +
      +
    • The +Mesa +website is hosted by + +Sourceforge.net +
      +
      + +
    • The Mesa git repository is hosted by +freedesktop.org. +
      +
      + + +
    • alt.software contributed the Direct3D driver. + +
    • Bernd Barsuhn wrote the evaluator code for (splines, +patches) in Mesa. + +
    • Bernhard Tschirren wrote the Allegro DJGPP driver. + +
    • Bogdan Sikorski wrote the GLU NURBS and polygon tessellator +in Mesa. + +
    • Charlie Wallace wrote the MS-DOS driver. + +
    • CJ Beyer was the www.mesa3d.org webmaster. + +
    • Darren Abbott provided the OS/2 driver. + +
    • David Bucciarelli wrote and maintained the 3Dfx Glide +driver. Thousands of Linux/Quake players thank David! + +
    • Gareth Hughes wrote new GLU 1.2 Polygon Tessellation code +(now superceded by SGI SI GLU). + +
    • Holger Waechtler contributed AMD 3DNow! assembly code which +accelerates vertex transformation in Mesa 3.1. Holger also implemented +the GL_EXT_texture_env_combine extension. + +
    • Jeroen van der Zijp and Thorsten Ohl contributed the +Xt/Motif widget code. + +
    • John Stone provided the multi-threading support in Mesa 3.0. + +
    • John Watson assisted with web page design. + +
    • Josh Vanderhoof contributed Intel x86 assembly code which +accelerates vertex transformation in Mesa 3.x. + +
    • Jouk Jansen contributed and continues to maintain the VMS +support. + +
    • Karl Schultz has been maintaining the Windows driver. + +
    • Keith Whitwell has made extension contributions to Mesa +since 1999. + +
    • Kendall Bennett wrote the SciTech MGL driver. + +
    • Klaus Niederkrueger contributed many improvements to Mesa's +software rasterizer. + +
    • Mark Kilgard contributed antialiased line improvements and +several extensions. + +
    • Michael Pichler contributed many bug fixes + +
    • Miklos Fazekas wrote and maintains the Macintosh driver. + +
    • Pascal Thibaudeau wrote the NeXT driver. + +
    • Pedro Vazquez setup and maintains the Mesa Mailing list. + +
    • Randy Frank contributed many bug fixes. + +
    • Stefan Zivkovic wrote the Amiga driver. + +
    • Stephane Rehel provided the Cygnus Win32 support + +
    • Ted Jump maintained the +makefiles and project files for Windows 95/98/NT compilation for some time. + +
    • Uwe Maurer wrote the LibGGI driver for Mesa-3.0. + +
    • Victor Ng-Thow-Hing wrote the Amiwin driver for the Amiga. + +
    + +

    +Apologies to anyone who's been omitted. +Please send corrections and additions to Brian. +

    + + + + diff --git a/mesalib/docs/utilities.html b/mesalib/docs/utilities.html new file mode 100644 index 000000000..4693639b8 --- /dev/null +++ b/mesalib/docs/utilities.html @@ -0,0 +1,26 @@ + + +Development Utilities + + + + + +

    Development Utilities

    + +
      + +
    • The Mesa distribution includes several utility routines in the +progs/util/ directory + +
    • Allen Akin's glean is a framework for OpenGL testing. + +
    • Valgrind is a very useful tool for tracking down +memory-related problems in your code. + +
    + + + \ No newline at end of file diff --git a/mesalib/docs/utility.html b/mesalib/docs/utility.html new file mode 100644 index 000000000..c7cad0114 --- /dev/null +++ b/mesalib/docs/utility.html @@ -0,0 +1,44 @@ + + +Utilities + + + + + +

    Utilities

    + + + + + + diff --git a/mesalib/docs/versions.html b/mesalib/docs/versions.html new file mode 100644 index 000000000..84b40fd21 --- /dev/null +++ b/mesalib/docs/versions.html @@ -0,0 +1,1656 @@ + + +Mesa Version History + + + + + + + + +NOTE: Changes for Mesa 6.4 and later are documented in the corresponding +release notes file. + + + +

    Mesa Version History

    + + +

    1.0 beta February 1995

    +
      +
    • Initial release +
    + +

    1.1 beta March 4, 1995

    +Changes: +
      +
    • faster point and line drawing (2x faster) +
    • more systems supported, better Makefiles +
    • Renamed lib*.a files to avoid collisions +
    • many small bug fixes +
    +New: +
      +
    • pseudo-GLX functions added +
    • new implementation of evaluators (eval2.c) +
    • GLUT support +
    + +

    1.1.1 beta March 7, 1995

    +Changes: +
      +
    • Reverted from eval2.c to eval.c due to FPE on Linux +
    • more speed improvements +
    • more Makefile changes +
    + +

    1.1.2 beta March 14, 1995

    +New: +
      +
    • implementation of SGI's blending extensions +
    • glXUseXFont implemented +
    • added MESA_DEBUG environment variable support +
    +Changes: +
      +
    • Using eval2.c again +
    • more FPE-prevention checks (0-length normals are OK) +
    • a few small bug fixes +
    • much faster pixel logic ops! +
    • faster transformation arithmetic +
    + +

    1.1.3 beta March 31, 1995

    +New: +
      +
    • gluScaleImage() and gluBuild2DMipMaps() implemented +
    • Mesa widgets for Xt/Motif +
    • blendEXT demos +
    • added environment variables for selecting visuals +
    +Changes: +
      +
    • almost all GLUT demos work correctly now +
    • faster X device driver functions +
    • more bug fixes +
    + +

    1.1.4 beta April 20, 1995

    +Bug fixes: +
      +
    • missing #define SEEK_SET in src-tk/image.c +
    • compile glShadeModel into display lists +
    • fixed pow() domain error in src/light.c +
    • fixed "flickering bitmaps" in double buffer mode +
    • fixed tk.h and aux.h for C++ +
    • state of LIGHT_MODEL_LOCAL_VIEWER was inverted +
    +New features: +
      +
    • MUCH, MUCH nicer dithering in 8-bit RGB mode +
    • updated widgets and widget demos +
    • Implemented GLXPixmap functions +
    • Added GLU 1.1 and GLX 1.1 functions +
    • Changed the X/Mesa interface API, more versatile +
    • Implemented gluPartialDisk() +
    + +

    1.2 May 22, 1995

    +Bug fixes: +
      +
    • IRIX 4.x makefile problem +
    • modified tk to share root colormap as needed +
    • gluLookAt normalization problem +
    • suppress Expose, NoExpose events in swapbuffers +
    • glBitmap() and glDrawPixels() clipping +
    +New features: +
      +
    • GL_BLEND, GL_MODULATE, GL_DECAL, and GL_REPLACE_EXT texture + modes implemented +
    • texture maps stored more efficiently +
    • texture maps can be compiled into display lists +
    • Bogdan Sikorski's GLU polygon tesselation code +
    • Linas Vepstas's sweep and extrusion library +
    • glXCreateContext()'s shareList parameter works as it's supposed to. + XMesaCreateContext() updated to accept a shareList parameter too. +
    • Mesa can be compiled with real OpenGL .h files +
    • MESA_BACK_BUFFER environment variable +
    • better GLX error checking +
    + +

    1.2.1 June 22, 1995

    +Bug fixes: +
      +
    • X/Mesa double buffer window resize crash +
    • widgets now pass PointerMotion events +
    • X/Mesa incorrect default clear color and drawing color +
    • more robust X MIT-SHM support in X/Mesa +
    • glTexImage( format=GL_LUMINANCE ) didn't work +
    • GL_LINE mode polygons with line width > 1.0 could cause a crash +
    • numerous feedback bugs +
    • glReadPixels() from depth buffer was wrong +
    • error prone depth and stencil buffer allocation +New features: +
    • Preliminary Microsoft Windows driver +
    • Implemented a number of missing functions: glEvalCoord[12][df]v(), + glGet...(), etc. +
    • Added a few missing symbols to gl.h and glu.h +
    • Faster rendering of smooth-shaded, RGBA, depth-buffered polygons. +
    • Faster rendering of lines when width=2.0 +
    • Stencil-related functions now work in display lists +
    +Changes: +
      +
    • renamed aux.h as glaux.h (MS-DOS names can't start with aux) +
    • most filenames are in 8.3 format to accomodate MS-DOS +
    • use GLubytes to store arrays of colors instead of GLints +
    + +

    1.2.2 August 2, 1995

    +New features: +
      +
    • texture mapped points and lines +
    • NURBS! (but not 100% complete) +
    • viewports may safely extend beyond window boundaries +
    • MESA_PRIVATE_CMAP environment variable +
    • Grayscale X display support +
    • two new demos: demos/gears.c and demos/shadow.c +
    • MachTen for Macintosh configuration +
    +Bug fixes: +
      +
    • glGet*(GL_DEPTH_BITS) returned bytes, not bits +
    • point, line, and bitmap rasterization suffered from roundoff errors +
    • fixed a division by zero error in line clippping +
    • occasional wrong default background color really fixed! +
    • glDepthFunc(GL_ALWAYS) with glDepthMask(GL_FALSE) didn't work +
    • gluBuild2DMipmaps malloc problem fixed +
    • view volume clipping of smooth shaded lines resulted in bad colors +
    +Changes: +
      +
    • new visual selection method in glXChooseVisual() +
    • improved GLU quadric functions +
    • call XSync for glFinish and XFlush for glFlush +
    • glVertex() calls now use a function pointer to avoid conditionals +
    • removed contrib directory from Mesa tar file (available on ftp site) +
    • AIX shared library support +
    • Removed GLUenum type as it's not in OpenGL +
    + +

    1.2.3 September 26, 1995

    +New features: +
      +
    • Mesa header files now equivalent to SGI OpenGL headers +
    • Support for HP's Color Recovery dithering displays +
    • Faster vertex transformation +
    • Faster raster operations into X windows under certain conditions +
    • New configurations: HP w/ shared libs, Ultrix w/ GCC, Data General +
    • 4-bit visuals now supported +
    +Bug fixes: +
      +
    • glScissor bug fixed +
    • round-off errors in clipping lines against clip planes fixed +
    • byte swapping between hosts and display servers implemented +
    • glGetError() can be called without a current rendering context +
    • problem with accidentally culled polygons is fixed +
    • fixed some widget compilation problems +
    + +

    1.2.4 November 17, 1995

    +New features: +
      +
    • More speed improvements (lighting, fogging, polygon drawing) +
    • Window system and OS-independent off-screen rendering +
    • Preliminary Fortran bindings +
    • glPolygonOffsetEXT implemented +
    • glColorMask and glIndexMask now fully implemented +
    • glPixelZoom implemented +
    • display lists fully implemented +
    • gamma correction +
    • dithering in 8-bit TrueColor/DirectColor visuals +
    +Changes: +
      +
    • Improved device driver interface +
    • tk.h renamed to gltk.h to avoid conflicts with Tcl's Tk +
    • Dithering support moved from core into device driver +
    +Bug fixes: +
      +
    • glEnable/Disable( GL_LIGHTING ) didn't always take effect +
    • glReadPixels byte swapping was broken +
    • glMaterial with pname==GL_AMBIENT_AND_DIFFUSE was broken +
    • duplicate glColor4b() prototype in GL/gl.h removed +
    • stripes in wave -ci demo fixed +
    • GL_LINEAR_MIPMAP_NEAREST had wrong value +
    • bugs in HP Color Recovery support fixed +
    • fixed bug when blending lines, points, bitmaps outside of window +
    + +

    1.2.5 November 30, 1995

    +New Features: +
      +
    • updated MS Windows driver +
    • new implementation of StaticGray/GrayScale visual support +
    +Bug fixes: +
      +
    • pixelzooming with gamma correction or blending didn't work +
    • HP color recovery visual wasn't being picked by glXChooseVisual +
    • glClear didn't always observe glColorMask changes +
    • olympic and offset demos didn't compile on some Suns +
    • texcoord clamping wasn't correct +
    • a polygon optimization introduced an occasional sampling problem +
    + +

    1.2.6 January 26, 1996

    +New Features: +
      +
    • faster line and polygon rendering under certain conditions. See + Performance Tips 9 and 10 in README +
    • profiling +
    • lighting is a bit faster +
    • better perspective corrected texture mapping +
    • Amiga AmiWin (X11) support +
    • preliminary Linux SVGA driver +Changes: +
    • now using a 16-bit depth buffer, faster, smaller +
    • GL_NORMALIZE is disabled by default +
    +Bug fixes: +
      +
    • projective texture mapping +
    • fixed a memory leak in the context destroy function +
    • GL_POLYGON with less than 3 vertices caused a crash +
    • glGet*() returned wrong result for GL_INDEX_MODE +
    • reading pixels from an unmapped X window caused a BadMatch error +
    + +

    1.2.7 March 5, 1996

    +New: +
      +
    • faster lighting +
    • faster 16-bit TrueColor rendering on Linux +
    • faster 32-bit TrueColor rendering on Linux, HP, IBM +
    • non-depth-buffered XImage polygons are faster +
    • vertex array extension +
    • software alpha planes +
    • updated Macintosh driver +
    • new NeXT driver +
    • GLU quadric functions generate texture coordinates +
    • reflect.c demo - reflective, textured surface demo +
    +Changes: +
      +
    • gamma correction code moved into the X driver for better performance +
    +Bug fixes: +
      +
    • multiple glClipPlane()'s didn't work reliably +
    • glPolygonMode() didn't always work +
    • glCullFace( GL_FRONT_AND_BACK ) didn't work +
    • texture mapping with gamma correction was buggy +
    • floating point exceptions in texture coordinate interpolation +
    • XImage byte swapping didn't always work +
    • polygon edge flags weren't always used correctly +
    + +

    1.2.8 May 22, 1996

    +New: +
      +
    • overlay planes on X servers with the SERVER_OVERLAY_VISUALS property +
    • better monochrome output +
    • more IRIX 6.x configurations +
    • more robust RGB mode color allocation +
    • added MESA_XSYNC environment variable +
    • GLX_MESA_pixmap_colormap and GLX_EXT_visual_info extensions +
    • GL_MESA_window_pos extension +
    • faster glReadPixels/glDrawPixels for GL_DEPTH and GL_UNSIGNED_SHORT + and GL_UNSIGNED_INT +
    • driver for prototype Cirrus Mondello 3-D board +
    • updated AmigaDOS driver +
    • a few small speed optimizations in polygon rendering +
    +Changes: +
      +
    • internal device driver interface modified to simplify device + driver implementations and to support hardware Z buffers +
    • several changes to the X/Mesa interface (xmesa.h) +
    +Bug fixes: +
      +
    • fixed pow(0,0) domain error triggered on some systems +
    • glStencilClear() in a display list caused an infinite loop +
    • glRasterPos*() was sometimes off by +/-0.5 in X and Y +
    • color masking and blending were performed in wrong order +
    • auxSolidCylinder() sometimes drew a wire-frame cylinder +
    • fixed file writing bug in osdemo.c +
    • pixel mapping didn't always work +
    • the GL_GEQUAL stencil func didn't work +
    • the GL_INVERT stencil op didn't work +
    • the stencil write mask didn't work +
    • glPush/PopAttrib() didn't do enough error checking +
    • glIsList() didn't always work correctly +
    + +

    2.0 October 10, 1996

    +New: +
      +
    • Implements OpenGL 1.1 API functions +
    • all texture filtering modes supported (mipmapping) +
    • faster texture mapping, see Performance Tip 11 in README +
    • antialiased RGB points +
    • X support for line and polygon stippling +
    • glDrawBuffer( GL_FRONT_AND_BACK ) works +
    • util/ directory of useful stuff +
    • demos/texobj demo of texture objects +
    +Changes: +
      +
    • major internal changes for thread-safeness +
    • new device driver interface +
    • MESA_ALPHA env variable removed +
    • triangle rasterizer replaces polygon rasterizer +
    +Bug fixes: +
      +
    • glPopAttrib() bug +
    • glDrawBuffer(GL_NONE) works now +
    + +

    2.1 December 14, 1996

    +New: +
      +
    • VMS support +
    • MS-DOS driver +
    • OpenStep support +
    • updated, combined Windows 95/NT driver +
    • implemented glGetLighti() and glGetTexGen*() +
    • GLX does garbage collection of ancillary buffers +
    +Bug fixes: +
      +
    • removed unused _EXT constants from gl.h +
    • fixed polygon offset bugs +
    • Z coordinates of clipped lines were incorrect +
    • glEdgeFlag() in display lists didn't always work +
    • glLight*() in display lists didn't work +
    • fixed X line stipple bugs (Michael Pichler) +
    • glXUseXfonts XFreeFont/XFreeFontInfo bug fixed +
    • fixed a feedback bug +
    • glTexGen*() now transforms GL_EYE_PLANE by inverse modelview matrix +
    • polygons were sometimes culled instead of clipped +
    • triangle rasterizer suffered from float/int overflow exceptions +
    • fixed FP underflow exception in lighting (specular exponent) +
    • glEnable/glDisable of GL_EXT_vertex_array enums didn't work +
    • fixed free(NULL) in GLU tesselator code +
    • using 24-bit color on some X servers resulted in garbage rendering +
    • 32-bit per pixel mode for XFree86 now works +
    • glRotate(a,0,0,0) gave unpredictable results +
    • GL_LINE_STRIP with > 480 vertices had occasional clipping problems +
    • 8-bit TrueColor GLXPixmap rendering incorrectly required a colormap +
    • glMaterial() wasn't ignored when GL_COLOR_MATERIAL was enabled +
    • glEnable(GL_COLOR_MATERIAL) followed by glColor() didn't work right +
    • accumulation buffer was limited to positive values +
    • projective textures didn't work +
    • selection buffer overflows weren't handled correctly +
    +Changes: +
      +
    • restored the GL_EXT_polygon_offset extension +
    • slightly faster RGB dithering +
    • the SVGA driver works again +
    • Amiga driver now distributed separately +
    • NeXT driver updated for Mesa 2.x +
    + +

    2.2 March 14, 1997

    +New: +
      +
    • better color selection when dithering +
    • added GL_EXT_texture_object extension +
    • updated MS-DOS driver for DJGPP +
    • added openbsd make configuration +
    • faster dithered flat-shaded triangles +
    • various compilation problems with Motif widgets fixed +
    • gl.h, glx.h and glu.h name mangling option +
    • BeOS driver +
    • 3D texture mapping extension +
    • GL_MESA_resize_buffers extension +
    • morph3d, stex3d and spectex demos +
    • 3Dfx support +
    +Bug fixes: +
      +
    • glColorMaterial should finally work right in all respects +
    • linear interpolation of mipmap levels was incorrectly weighted +
    • readpix.c didn't compile on Macintosh +
    • GL_INVERT and related logic ops didn't work right +
    • glTexImage[12]D() didn't check its parameters consistantly +
    • fixed a memory leak in glTexImage[12]D() +
    • kludged around a SunOS 5.x/GCC compiler bug in the feedback code +
    • glReadPixels aborted instead of normally catching some errors +
    • a few 1.1 constants were missing or misnamed in gl.h +
    • glBegin(p); glBegin(q); didn't generate an error +
    • fixed a memory leak in GLX code +
    • clipping of concave polygons could cause a core dump +
    • 1-component alpha texture maps didn't work +
    • fixed a GLU polygon tesselator bug +
    • polygons with colinear vertices were sometimes culled +
    • feedback triangle colors were wrong when using smooth shading +
    • textures with borders didn't work correctly +
    • colors returned in feedback mode were wrong when using lighting +
    • spotlights didn't effect ambient lighting correctly +
    • gluPartialDisk() had a few bugs +
    +Changes: +
      +
    • device driver interface expanded to support texture mapping +
    • faster matrix inversion subroutine +
    • commented out #include "wmesa_extend.h" from src/wmesa.c +
    • fixed many compiler warnings in the demo programs +
    + +

    2.3 June 30, 1997

    +New: +
      +
    • Mesa distribution divided into two pieces: library code and demos +
    • faster vertex transformation, clip testing, lighting +
    • faster line drawing +
    • TrueColor visuals how have dithering (for depths < 24 bits) +
    • added MESA_NO_DITHER environment variable +
    • new device driver function: NearFar(), RenderVB(), RasterSetup() +
    • added LynxOS configuration +
    • added cygnus Win32 configuration +
    • added texcyl.c GLUT demo +
    • added XMesaDitherColor() to X/Mesa interface +
    • new NURBS code from Bogdan Sikorski +
    • added demos/shape.c (non-rectangular X window!) +
    +Bug fixes: +
      +
    • glEnable/DisableClientState() were missing from GL/gl.h +
    • GL_SPHERE_MAP texcoord generation didn't work correctly +
    • glXGetConfig() returned wrong number of depth, stencil, accum bits +
    • glDrawPixels feedback/selection didn't examine RasterPos valid bit +
    • black and white were reversed on some monochrome displays +
    • fixed potential image memory leak (wasn't setting reference counter) +
    • glDrawPixels sometimes didn't recognize some GL state changes +
    • gluProject/UnProject() didn't check for divide by zero +
    • stex3d demo called random() and srandom(), not portable +
    • fixed memory leaks in context.c and drawpix.c +
    • fixed NULL dereferencing problem in gl_update_texture_state() +
    • glReadPixels between glBegin/glEnd didn't generate an error. +
    • fixed memory leak in polygon tesselator (Randy Frank) +
    • fixed seg fault bug drawing flat-shaded, depth-tested lines +
    • clipped GL_TRIANGLE_STRIPs sometimes had wrong color when flat-shaded +
    • glBindTexture sometimes didn't work +
    • fixed a bug deep in glXReleaseBuffersMESA() +
    • fog was mistakenly applied to alpha +
    • glPopMatrix didn't set "dirty matrix" flag +
    • glPolygonStipple pattern was sometimes wrong +
    • glClear wasn't disabled during feedback and selection +
    • fixed memory leak in glTexSubImage[123]D +
    +Changes: +
      +
    • many library source files reorganized +
    • faster X color allocation, colors also freed when finished with them +
    • new texture sampling function pointer in texture objects +
    • incorporated 3Dfx VooDoo driver v0.16 into main source tree +
    • many 3Dfx driver updates +
    • cygnus Makefiles now included +
    • updated DOS driver +
    • made a few changes to dosmesa.c and wmesa.c (VB->Unclipped) +
    • internally, colors now stored in GLubytes, not GLfixed +
    • optimized changing of GL_SHININESS parameter +
    + +

    2.4 September 18, 1997

    +New: +
      +
    • updated 3Dfx Glide driver +
    • hacks for 3Dfx rendering into an X window or fullscreen +
    • added depth buffer access functions to X/Mesa and OS/Mesa interfaces +
    +Bug fixes: +
      +
    • pixel buffer could overflow with long, wide lines +
    • fixed FP underflow problems in lighting +
    • glTexSubImage1D() had an unitialized variable +
    • incomplete texture objects could cause a segfault +
    • glDrawPixels with GL_COMPILE_AND_EXECUTE caused infinite loop +
    • flat-shaded quads in a strip were miscolored if clipped +
    • mipmapped triangle lod computation now works correctly +
    • fixed a few under/overflow bugs in triangle rasterizer +
    • glArrayElement() assigned bad normal if normal array disabled +
    • changed argument to glXReleaseBuffersMESA() +
    • fixed small triangle underflow bugs in tritemp.h (hopefully) +
    • glBindTexture(target, 0) caused a crash +
    • glTexImage[123]D() with NULL image pointer caused crash +
    • glPixelStore parameters are now ignored during display list execution +
    • fixed a two-sided lighting w/ clipping bug (black vertices) +
    • textures with width!=height were sometimes mis-rendered +
    • "weird" projection matrices could cause div by 0, other fp errors +
    +Changes: +
      +
    • changed precompiled header symbol from PCH to PC_HEADER +
    • split api.c into api1.c and api2.c +
    • added hash.c source file (but not used yet) +
    • a few Sun and HP configuration file changes +
    • MESA_GLX_FX env var replaces MESA_FX_WINDOW and MESA_FX_FULLSCREEN +
    • fixed a few cygnus build problems (src/Makefile.cygnus, src/wmesa.c) +
    + +

    2.5 November 20, 1997

    +New: +
      +
    • updated 3Dfx driver (v20) for GLQuake +
    • added GL_EXT_paletted_texture extension +
    • added GL_EXT_shared_texture_palette extension +
    • added GL_EXT_point_parameters extension +
    • now including Mark Kilgard's GLUT library v3.6 +
    • new GLUT-based demos in gdemos/ +
    • added a few more Unix config targets +
    • added Intel X86 assembly language vertex transformation code +
    • 3Dfx/Glide driver for Mesa now recognizes SST_SCREENREFRESH env var +
    • Windows 95 S3 Virge driver +
    +Bug fixes: +
      +
    • glCopyTexImage?D would crash due to uninitialized variable +
    • glColor w/ glColorMaterial in a display list caused a bug +
    • fixed several glDrawPixels() and ReadPixels() bugs in 3Dfx driver +
    • glVertex4*() vertices weren't always projected correctly +
    • trying to use mipmapped textured points or lines caused crash +
    • glColor[34][fd]() values now clamped to [0,1] before int conversion +
    +Changes: +
      +
    • new device driver functions for texture mapping +
    • hash tables used for display list and texture object lookup +
    • fixed GLX visual handling code to avoid saving redundant visuals +
    • 3Dfx Glide libraries automatically linked to libMesaGL.so +
    • dropped the Cirrus Logic Mondello code since it's obsolete +
    • updated Cygnus Makefiles (Stephane Rehel) +
    • updated Windows MSVC++ Makefiles (Oleg Letsinsky) +
    • procedure for making library files has changed: scripts now take + a major and minor version arguments. Make-config changed a lot. +
    • new implementation of glTexSubImage2D() +
    • updated widgets-mesa directory to create libMesaGLwM.a (Motif widget) +
    • separate linux-glide and linux-386-glide configurations +
    + +

    2.6 February 12, 1998

    +New: +
      +
    • Windows WGL functions +
    • updated VMS, DOS, Windows, Cygnus, BeOS, Amiga compilation support +
    • v0.22 of 3Dfx Glide driver +
    • more X86 assembly language optimizations +
    • faster blending for some modes +
    • XMesaSetFXmode() to switch between 3Dfx window and full-screen mode +
    • added preliminary thread support +
    • added GLX_MESA_copy_sub_buffer extension +
    • some clipping optimizations +
    +Bug fixes: +
      +
    • fixed shading/material bug when drawing long primitive strips +
    • fixed clipping problem in long primitive strips +
    • fixed clipping bug when using 3Dfx driver +
    • fixed a problem when trying to use X fonts w/ 3Dfx driver +
    • fixed a texture filter bug in 3Dfx/Glide driver +
    • fixed bug in 3Dfx/Glide driver involving depth mask & clearing +
    • glLoadMatrix to set projection matrix confused the 3Dfx driver +
    • non-identity texture matrices didn't work with linux-386 configs +
    • glGenTextures() didn't reserve the returned texture IDs +
    • NULL proxy image sent to glTexImageXD() caused crash +
    • added texture state validation optimization (Henk Kok) +
    • fixed colormap reuse problem when using both RGB and CI windows +
    • 32bpp True/DirectColor X visuals weren't recognized +
    • fixed potential problem in evaluators memory allocation +
    • fixed assorted demo compilation bugs +
    +Changes: +
      +
    • replaced old Mesa/windows/ directory with Mesa/WIN32/ directory +
    • converted a few old glaux/gltk demos to GLUT +
    • renamed directories: demos -> xdemos, gdemos -> demos +
    + + +

    3.0 September 17, 1998

    +New: +
      +
    • OpenGL 1.2 API +
    • GL_EXT_abgr pixel format extension +
    • GL_SGIS_texture_edge_clamp extension +
    • GL_SGIS_multitexture extension (to be replaced by GL_ARB_multitex) +
    • GL_EXT_multitexture extension (to be replaced by GL_ARB_multitex) +
    • GL_EXT_rescale_normal extension and renormal.c demo +
    • GLX_SGI_video_sync extension (a no-op) +
    • antialiased lines +
    • glGetTexImage() now implemented +
    • glDraw/Copy/ReadPixels() optimizations +
    • optimized textured triangle code (Marten Stromberg) +
    • more optimization of dithered TrueColor triangles in X driver +
    • Linux GGI driver +
    • updated MGL driver +
    +Bug fixes: +
      +
    • lots of assorted compilation fixes +
    • glInitNames didn't write initial hit record +
    • glBitmap didn't always check for invalid raster position +
    • switching between GLX and OSMesa contexts caused a crash +
    • fixed uninitialized variable in Mesa widget code +
    • fixed typo in texture code which caused book/texgen to crash +
    • fixed texture sampling bug when filter=GL_LINEAR and wrap=GL_CLAMP +
    • gluDisk() in POINT or LINE mode sometimes failed +
    • fixed texture + fog bug +
    • GL_COMPILE_AND_EXECUTE mode didn't work reliably +
    • glMultMatrix in projection matrix mode w/ 3Dfx driver could fail +
    • glDrawPixels(color index pixels) weren't converted to RGBA +
    • fixed possible getenv() buffer overflow security bug +
    • glBitmap in feedback mode was offset by xOrig, yOrig params +
    • device driver's DrawPixels hook was never used +
    • glDrawPixels with zoomY!=1 and top/bottom clipping didn't work +
    • glDrawPixels optimized for GL_LUMINANCE, GL_LUMINANCE_ALPHA, GLubyte +
    • fixed MakeCurrent bug in GLwRedrawObjects() in MesaWorkstation.c +
    • glCopyTexSubImage2D() didn't work with 3Dfx driver +
    • lines with width = 2 could cause crash +
    • glClear with scissor rect sometimes cleared whole buffer +
    • glTexSubImage2D( .. GL_COLOR_INDEX .. ) didn't work +
    • glTexImageXD( .. GL_ABGR_EXT .. ) didn't work +
    • computation of inverse modelview matrix sometimes failed +
    • fixed GL_CLAMP mode texture sampling bug +
    • textured line interpolation was somewhat broken +
    • textured triangle interpolation was also somewhat broken +
    • glGet(MODELVIEW/PROJECTION/TEXTURE_MATRIX_STACK_DEPTH) off by one +
    • evaluator state wasn't fully initialized +
    • texture coordinate clipping was buggy +
    • evaluator surfaces could be mis-colored +
    • glAccum(GL_RETURN, s) didn't obey glColorMask() settings +
    • zero area polygons shouldn't be culled if polygon mode is point/line +
    • clipped width and height of glReadPixels was sometimes off by one +
    • blending with alpha = 0 or 1.0 wasn't always exact +
    • reading of pixels from clipped region was buggy +
    • minor tweaking of X visual management in GLX emulator +
    • glPolygonStipple now obeys pixel unpacking parameters +
    • glGetPolygonStipple now obeys pixel packing parameters +
    • interleaved vertex array texture coordinates were broken +
    • query of proxy texture internal format was broken +
    • alpha channel wasn't reliably cleared +
    • fixed divide by zero error in gluScaleImage if dest size = 1 x 1 +
    +Conformance bug fixes: +
      +
    • GL_SELECTION_BUFFER_POINTER and GL_SELECTION_BUFFER_SIZE were missing +
    • GL_TEXTURE_INTERNAL_FORMAT was missing +
    • glGet*(GL_POLYGON_STIPPLE) was broken +
    • glPush/PopAttrib() didn't save/restore all texture state +
    • glBitmap in feedback mode didn't work +
    • feedback of texture coords didn't always work +
    • glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLbyte was broke +
    • glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLubyte was broke +
    • glDrawPixels w/ format=GL_STENCIL_INDEX, type=GL_BITMAP was broke +
    +Changes: +
      +
    • upgraded GLUT to version 3.7 +
    • only GL and GLU library code included in MesaLib.tar.gz +
    • GLUT and all demos now in MesaDemos.tar.gz +
    • glaux and gltk libraries removed +
    • IRIX -n32 and -64 libs go in lib32/ and lib64/ directories +
    + + +

    3.1 beta 1 November 19, 1998

    +New: +
      +
    • GL_EXT_stencil_wrap extension +
    • GL_INGR_blend_func_separate extension +
    • GL_ARB_multitexture extension +
    • GL_NV_texgen_reflection extension +
    • newly optimized vertex transformation code +
    • updated GLUT 3.7 code +
    • better precision when using 32-bit Z buffer +
    • Allegro DJGPP driver +
    +Bug fixes: +
      +
    • glCopyPixels between front/back buffers didn't copy alpha correctly +
    • fixed out-of-bounds memory access in optimized 2-D texture code +
    • glPixelStorei didn't accept GL_PACK/UNPACK_IMAGE_HEIGHT parameter +
    • glGet*() didn't accept GL_MAX_3D_TEXTURE_SIZE parameter +
    • clipping of texture coordinates sometimes had bad R,Q values +
    • GL_CLAMP_TO_EDGE texture sampling was off by 0.5 texels +
    • glEdgeFlagPointer() now takes a GLvoid * instead of GLboolean * +
    • texture was sometimes applied twice with 3Dfx driver +
    • glPush/PopAttrib() fouled up texture object reference counts +
    • glDeleteLists(0, n) caused assertion failure +
    • bilinear texture sampling wasn't accurate enough +
    • glClear w/ glDepthMask(GL_FALSE) didn't work right on 3Dfx +
    • color components were reversed on big endian 32 bpp X visuals +
    +Changes: +
      +
    • removed GL_EXT_multitexture extension +
    + + +

    3.1 beta 2 May 24, 1999

    +New: +
      +
    • multi-textured points and lines (mjk@nvidia.com) +
    • optimized 24bpp X rendering (bernd.paysan@gmx.de) +
    • added allegro support (bernie-t@geocities.com) +
    • cleaned-up Windows-related stuff (Ted Jump) +
    • minor stereo changes (KendallB@scitechsoft.com) +
    • new BeOS driver which implements BGLView class +
    • new Direct3D driver (see src/D3D) +
    • more efficient filled gluCylinder() function +
    • utilities: util/showbuffer.[ch] and util/glstate.[ch] +
    • fixed some IRIX compiler warnings +
    • added support for building Mesa in XFree86 with + SGI's GLX (kevin@precisioninsight.com) +
    +Bug fixes: +
      +
    • a variety of Windows/Mesa bug fixes (mjk@nvidia.com) +
    • packed pixel images weren't unpacked correctly +
    • patches some win32 files in GLUT (mjk@nvidia.com) +
    • glTexImage[123]D() didn't accept internalFormat == GL_COLOR_INDEX +
    • fixed lighting bug in Keith's new shading code +
    • fixed texture segfault seen in Lament screensaver +
    • fixed miscellaneous low-memory bugs +
    • glClear(GL_COLOR_BUFFER_BIT) with RGBA or CI masking was broken +
    • GL_LINEAR sampling of 3D textures was broken +
    • fixed SVR4 'cc' compiler macro problem (dawes@xfree86.org) +
    • added GL_TEXTURE_PRIORITY fix (keithh@netcomuk.co.uk) +
    • fixed wide point and wide line conformance bugs (brianp) +
    +Changes: +
      +
    • some device driver changes (see src/dd.h) +
    • new copyright on core Mesa code +
    + + +

    3.1 beta 3 September 17, 1999

    +New: +
      +
    • optimized glAccum function +
    • optimized 24bpp rendering in XMesa driver +
    • GLU 1.2 polygon tessellator +
    +Bug Fixes: +
      +
    • glGetTexLevelParameter wasn't fully implemented +
    • glXUseXFont now handles multi-byte fonts +
    • glIsEnabled(GL_TEXTURE_2D / 3D) returned wrong result +
    • alpha channel of blending points, lines was sometimes incorrect +
    +Changes: +
      +
    • New library names: "libGL" instead of "libMesaGL" +
    • New library numbering: libGL.so.1.2.310 +
    • New subdirectories: docs/ and bin/ +
    • New Makefile-system (autoconf,automake,libtool) +
    + + +

    3.1 final December 14, 1999

    +New: +
      +
    • added demos/gloss.c +
    • added xdemos/glxdpyinfo.c +
    • added GLX_ARB_get_proc_address extension +
    • rewritten glTexImage code paths (faster, less memory, bug fixes) +
    +Bug Fixes: +
      +
    • several vertex array bug fixes +
    • overlapping glCopyPixels with pixel zooming now works +
    • glXUseXFont() bitmaps were vertically shifted by one pixel +
    • glCopyPixels with pixel zooming now works +
    + + +

    3.2 final April 24, 2000

    +Bug fixes: +
      +
    • fixed memcpy bugs in span.c +
    • fixed missing glEnd problem in demos/tessdemo.c +
    • fixed bug when clearing 24bpp Ximages +
    • fixed clipping problem found in Unreal Tournament +
    • fixed Loki's "ice bug" and "crazy triangles" seen in Heretic2 +
    • fixed Loki's 3dfx RGB vs BGR bug +
    • fixed Loki's 3dfx smooth/flat shading bug in SoF +
    +Changes: +
      +
    • updated docs/README file +
    • use bcopy() optimizations on FreeBSD +
    • re-enabled the optimized persp_textured_triangle() function +
    + + +

    3.2.1 July 19, 2000

    +Bug fixes: +
      +
    • gluBuild2DMipmaps() didn't accept GL_BGRA +
    • Fixed compile/makefile problems on IRIX +
    • fixed segfault in 3dfx driver when using GL selection/feedback +
    • no longer cull very, very tiny triangles +
    • blending w/ drawbuffer==GL_FRONT_BACK caused segfault (sw rendering) +
    • fixed Motif detection code in widgets-mesa/configure.in +
    • glColorMaterial and glMaterial updates to emissive and ambient + didn't always work right +
    • Specular highlights weren't always in the right place +
    • clipped GL_LINE mode polygons had interior lines appear +
    • blend term GL_ONE_MINUS_CONSTANT_ALPHA was broken +
    • GL_NICEST fog didn't always work with flat shading +
    • glRect commands in display lists were sometimes miscolored +
    • Line Z offset didn't always work +
    • fixed texgen normal vector problem (gloss's teapot) +
    • numerous GL conformance bugs fixed +
    +Changes: +
      +
    • glColorMask(false, false, false, false) handled better/faster +
    • reverted to old GLU polygon tessellator, GLU 1.1 +
    • updated Win32 build files +
    + + +

    3.3 July 21, 2000

    +New: +
      +
    • antialiased triangles now implemented +
    • GL_EXT_texture_env_add texture mode extension +
    • GLX 1.3 API +
    • support for separate draw/read buffers (ie GL_SGI_make_current_read) +
    • thread-safe API dispath +
    • improved glxinfo program +
    • demos/texdown program to measure texture download performance +
    • glext.h header file +
    • demos/geartrain program +
    • GL_EXT_texture_lod_bias extension +
    • demos/lodbias program +
    • further optimized glRead/DrawPixels for 16-bit TrueColor X visuals +
    • GLX_EXT_visual_rating extension (a no-op, however) +
    • GL_HP_occlusion_test extension (for X and OS/Mesa drivers) +
    • demos/occlude program +
    • GL_SGIS_pixel_texture and GL_SGIX_pixel_texture extensions +
    • demos/pixeltex program +
    • GL_SGI_color_matrix extension +
    • GL_SGI_color_table extension +
    • GL_EXT_histogram extension +
    • GL_ARB_texture_cube_map extension +
    • added xdemos/glxheads and xdemos/manywin +
    • demos/texenv.c demo +
    • GL_EXT_texture_env_combine extension (by Holger Waechtler) +
    • Xlib driver is now thread-safe (see xdemos/glthreads) +
        +Bug Fixes: +
      +
    • various GL conformance failures fixed since 3.2.1 +
    +Changes: +
      +
    • gl.h now uses #defines instead of C enums for all tokens +
    • glu.h now uses #defines instead of C enums for all tokens +
    • moved programs from 3Dfx/demos/ into demos/ directory +
    + + +

    3.4 November 3, 2000

    +New: +
      +
    • optimized glDrawPixels for glPixelZoom(1,-1) +Bug Fixes: +
    • widgets-mesa/src/*.c files were missing from 3.3 distro +
    • include/GL/mesa_wgl.h file was missing from 3.3 distro +
    • fixed some Win32 compile problems +
    • texture object priorities weren't getting initialized to 1.0 +
    • glAreTexturesResident return value was wrong when using hardware +
    • glXUseXFont segfaulted when using 3dfx driver (via MESA_GLX_FX) +
    • glReadPixels with GLushort packed types was broken +
    • fixed a few bugs in the GL_EXT_texture_env_combine texture code +
    • glPush/PopAttrib(GL_ENABLE_BIT) mishandled multi-texture enables +
    • fixed some typos/bugs in the VB code +
    • glDrawPixels(GL_COLOR_INDEX) to RGB window didn't work +
    • optimized glDrawPixels paths weren't being used +
    • per-fragment fog calculation didn't work without a Z buffer +
    • improved blending accuracy, fixes Glean blendFunc test failures +
    • glPixelStore(GL_PACK/UNPACK_SKIP_IMAGES) wasn't handled correctly +
    • glXGetProcAddressARB() didn't always return the right address +
    • gluBuild[12]DMipmaps() didn't grok the GL_BGR pixel format +
    • texture matrix changes weren't always detected (GLUT projtex demo) +
    • fixed random color problem in vertex fog code +
    • fixed Glide-related bug that let Quake get a 24-bit Z buffer +
        +Changes: +
      +
    • finished internal support for compressed textures for DRI +
    + + +

    3.4.1 February 14, 2001

    +New: +
      +
    • fixed some Linux build problems +
    • fixed some Windows build problems +
    • GL_EXT_texture_env_dot3 extension (Gareth Hughes) +
    +Bug fixes: +
      +
    • added RENDER_START/RENDER_FINISH macros for glCopyTexImage in DRI +
    • various state-update code changes needed for DRI bugs +
    • disabled pixel transfer ops in glColorTable commands, not needed +
    • fixed bugs in glCopyConvolutionFilter1D/2D, glGetConvolutionFilter +
    • updated sources and fixed compile problems in widgets-mesa/ +
    • GLX_PBUFFER enum value was wrong in glx.h +
    • fixed a glColorMaterial lighting bug +
    • fixed bad args to Read/WriteStencilSpan in h/w stencil clear function +
    • glXCopySubBufferMESA() Y position was off by one +
    • Error checking of glTexSubImage3D() was broken (bug 128775) +
    • glPopAttrib() didn't restore all derived Mesa state correctly +
    • Better glReadPixels accuracy for 16bpp color - fixes lots of OpenGL + conformance problems at 16bpp. +
    • clearing depth buffer with scissoring was broken, would segfault +
    • OSMesaGetDepthBuffer() returned bad bytesPerValue value +
    • fixed a line clipping bug (reported by Craig McDaniel) +
    • fixed RGB color over/underflow bug for very tiny triangles +
    +Known problems: +
      +
    • NURBS or evaluator surfaces inside display lists don't always work +
    + + +

    3.4.2 May 17, 2001

    +Bug fixes: +
      +
    • deleting the currently bound texture could cause bad problems +
    • using fog could result in random vertex alpha values +
    • AA triangle rendering could touch pixels outside right window bound +
    • fixed byteswapping problem in clear_32bit_ximage() function +
    • fixed bugs in wglUseFontBitmapsA(), by Frank Warmerdam +
    • fixed memory leak in glXUseXFont() +
    • fragment sampling in AA triangle function was off by 1/2 pixel +
    • Windows: reading pixels from framebuffer didn't always work +
    • glConvolutionFilter2D could segfault or cause FP exception +
    • fixed segfaults in FX and X drivers when using tex unit 1 but not 0 +
    • GL_NAND logicop didn't work right in RGBA mode +
    • fixed a memory corruption bug in vertex buffer reset code +
    • clearing the softwara alpha buffer with scissoring was broken +
    • fixed a few color index mode fog bugs +
    • fixed some bad assertions in color index mode +
    • fixed FX line 'stipple' bug #420091 +
    • fixed stencil buffer clear width/height typo +
    • fixed GL error glitches in gl[Client]ActiveTextureARB() +
    • fixed Windows compilation problem in texutil.c +
    • fixed 1/8-pixel AA triangle sampling error +
    +Changes: +
      +
    • optimized writing mono-colored pixel spans to X pixmaps +
    • increased max viewport size to 2048 x 2048 +
    + + +

    3.5 June 21, 2001

    +New: +
      +
    • internals of Mesa divided into modular pieces (Keith Whitwell) +
    • 100% OpenGL 1.2 conformance (passes all conformance tests) +
    • new AA line algorithm +
    • GL_EXT_convolution extension +
    • GL_ARB_imaging subset +
    • OSMesaCreateContextExt() function +
    • GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add) +
    • GL_MAX_TEXTURE_UNITS_ARB now defaults to eight +
    • GL_EXT_fog_coord extension (Keith Whitwell) +
    • GL_EXT_secondary_color extension (Keith Whitwell) +
    • GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add) +
    • GL_SGIX_depth_texture extension +
    • GL_SGIX_shadow and GL_SGIX_shadow_ambient extensions +
    • demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow +
    • GL_ARB_texture_env_combine extension +
    • GL_ARB_texture_env_dot3 extension +
    • GL_ARB_texture_border_clamp (aka GL_SGIS_texture_border_clamp) +
    • OSMesaCreateContextExt() function +
    • libOSMesa.so library, contains the OSMesa driver interface +
    • GL/glxext.h header file for GLX extensions +
    • somewhat faster software texturing, fogging, depth testing +
    • all color-index conformance tests now pass (only 8bpp tested) +
    • SPARC assembly language TCL optimizations (David Miller) +
    • GL_SGIS_generate_mipmap extension +
    +Bug Fixes: +
      +
    • fbiRev and tmuRev were unitialized when using Glide3 +
    • fixed a few color index mode conformance failures; all pass now +
    • now appling antialiasing coverage to alpha after texturing +
    • colors weren't getting clamped to [0,1] before color table lookup +
    • fixed RISC alignment errors caused by COPY_4UBV macro +
    • drawing wide, flat-shaded lines could cause a segfault +
    • vertices now snapped to 1/16 pixel to fix rendering of tiny triangles +
    +Changes: +
      +
    • SGI's Sample Implementation (SI) 1.3 GLU library replaces Mesa GLU +
    • new libOSMesa.so library, contains the OSMesa driver interface +
    + + +

    4.0 October 22, 2001

    +New: +
      +
    • Mesa 4.0 implements the OpenGL 1.3 specification +
    • GL_IBM_rasterpos_clip extension +
    • GL_EXT_texture_edge_clamp extension (aka GL_SGIS_texture_edge_clamp) +
    • GL_ARB_texture_mirrored_repeat extension +
    • WindML UGL driver (Stephane Raimbault) +
    • added OSMESA_MAX_WIDTH/HEIGHT queries +
    • attempted compiliation fixes for Solaris 5, 7 and 8 +
    • updated glext.h and glxext.h files +
    • updated Windows driver (Karl Schultz) +
    +Bug fixes: +
      +
    • added some missing GLX 1.3 tokens to include/GL/glx.h +
    • GL_COLOR_MATRIX changes weren't recognized by teximage functions +
    • glCopyPixels with scale and bias was broken +
    • glRasterPos with lighting could segfault +
    • glDeleteTextures could leave a dangling pointer +
    • Proxy textures for cube maps didn't work +
    • fixed a number of 16-bit color channel bugs +
    • fixed a few minor memory leaks +
    • GLX context sharing was broken in 3.5 +
    • fixed state-update bugs in glPopClientAttrib() +
    • fixed glDrawRangeElements() bug +
    • fixed a glPush/PopAttrib() bug related to texture binding +
    • flat-shaded, textured lines were broken +
    • fixed a dangling pointer problem in the XMesa code (Chris Burghart) +
    • lighting didn't always produce the correct alpha value +
    • fixed 3DNow! code to not read past end of arrays (Andrew Lewycky) +
    + + +

    4.0.1 December 17, 2001

    +New: +
      +
    • better sub-pixel sample positions for AA triangles (Ray Tice) +
    • slightly faster blending for (GL_ZERO, GL_ONE) and (GL_ONE, GL_ZERO) +
    +Bug fixes: +
      +
    • added missing break statements in glGet*() for multisample cases +
    • fixed uninitialized hash table mutex bug (display lists / texobjs) +
    • fixed bad teximage error check conditional (bug 476846) +
    • fixed demos readtex.c compilation problem on Windows (Karl Schultz) +
    • added missing glGet() query for GL_MAX_TEXTURE_LOD_BIAS_EXT +
    • silence some compiler warnings (gcc 2.96) +
    • enable the #define GL_VERSION_1_3 in GL/gl.h +
    • added GL 1.3 and GLX 1.4 entries to gl_mangle.h and glx_mangle.h +
    • fixed glu.h typedef problem found with MSDev 6.0 +
    • build libGL.so with -Bsymbolic (fixes bug found with Chromium) +
    • added missing 'const' to glXGetContextIDEXT() in glxext.h +
    • fixed a few glXGetProcAddress() errors (texture compression, etc) +
    • fixed start index bug in compiled vertex arrays (Keith) +
    • fixed compilation problems in src/SPARC/glapi_sparc.S +
    • fixed triangle strip "parity" bug found in VTK medical1 demo (Keith) +
    • use glXGetProcAddressARB in GLUT to avoid extension linking problems +
    • provoking vertex of flat-shaded, color-index triangles was wrong +
    • fixed a few display list bugs (GLUT walker, molecule, etc) (Keith) +
    • glTexParameter didn't flush the vertex buffer (Ray Tice) +
    • feedback attributes for glDraw/CopyPixels and glBitmap were wrong +
    • fixed bug in normal length caching (ParaView lighting bug) +
    • fixed separate_specular color bug found in Chimera (18 Dec 2001) +
    + + +

    4.0.2 April 2, 2002

    +New: +
      +
    • New DOS (DJGPP) driver written by Daniel Borca +
    • New driver interface functions for TCL drivers (such as Radeon DRI) +
    • GL_RENDERER string returns "Mesa Offscreen16" or "Mesa Offscreen32" + if using deep color channels +
    • latest GL/glext.h and GL/glxext.h headers from SGI +
    +Bug fixes: +
      +
    • GL_BLEND with non-black texture env color wasn't always correct +
    • GL_REPLACE with GL_RGB texture format wasn't always correct (alpha) +
    • glTexEnviv( pname != GL_TEXTURE_ENV_COLOR ) was broken +
    • glReadPixels was sometimes mistakenly clipped by the scissor box +
    • glDraw/ReadPixels didn't catch all the errors that they should have +
    • Fixed 24bpp rendering problem in Windows driver (Karl Schultz) +
    • 16-bit GLchan mode fixes (m_trans_tmp.h, s_triangle.c) +
    • Fixed 1-bit float->int conversion bug in glDrawPixels(GL_DEPTH_COMP) +
    • glColorMask as sometimes effecting glXSwapBuffers() +
    • fixed a potential bug in XMesaGarbageCollect() +
    • N threads rendering into one window didn't work reliably +
    • glCopyPixels didn't work for deep color channels +
    • improved 8 -> 16bit/channel texture image conversion (Gerk Huisma) +
    • glPopAttrib() didn't correctly restore user clip planes +
    • user clip planes failed for some perspective projections (Chromium) +
    +Known bugs: +
      +
    • mipmap LOD computation +
    + + +

    4.0.3 June 25, 2002

    +New: +
      +
    • updated GL/glext.h file (version 15) +
    • corrected MMX blend code (Jose Fonseca) +
    • support for software-based alpha planes in Windows driver +
    • updated GGI driver (Filip Spacek) +
    +Bug fixes: +
      +
    • glext.h had wrong values for GL_DOT3_RGB[A]_EXT tokens +
    • OSMesaMakeCurrent() didn't recognize buffer size changes +
    • assorted conformance fixes for 16-bit/channel rendering +
    • texcombine alpha subtraction mode was broken +
    • fixed lighting bug with non-uniform scaling and display lists +
    • fixed bug when deleting shared display lists +
    • disabled SPARC cliptest assembly code (Mesa bug 544665) +
    • fixed a couple Solaris compilation/link problems +
    • blending clipped glDrawPixels didn't always work +
    • glGetTexImage() didn't accept packed pixel types +
    • glPixelMapu[is]v() could explode given too large of pixelmap +
    • glGetTexParameter[if]v() didn't accept GL_TEXTURE_MAX_ANISOTROPY_EXT +
    • glXCopyContext() could lead to segfaults +
    • glCullFace(GL_FRONT_AND_BACK) didn't work (bug 572665) +
    +Changes: +
      +
    • lots of C++ (g++) code clean-ups +
    • lots of T&L updates for the Radeon DRI driver +
    +Known bugs: +
      +
    • mipmap LOD computation (fixed for Mesa 4.1) +
    + + +

    4.0.4 October 3, 2002

    +New: +
      +
    • GL_NV_texture_rectangle extension +
    • updated glext.h header (version 17) +
    • updated DOS driver (Daniel Borca) +
    • updated BeOS R5 driver (Philippe Houdoin) +
    • added GL_IBM_texture_mirror_repeat +
    • glxinfo now takes -l option to print interesting OpenGL limits info +
    • GL_MESA_ycbcr_texture extension +
    • GL_APPLE_client_storage extension (for some DRI drivers only) +
    • GL_MESA_pack_invert extension +
    +Bug fixes: +
      +
    • fixed GL_LINEAR fog bug by adding clamping +
    • fixed FP exceptions found using Alpha CPU +
    • 3dfx MESA_GLX_FX=window (render to window) didn't work +
    • fixed memory leak in wglCreateContest (Karl Schultz) +
    • define GLAPIENTRY and GLAPI if undefined in glu.h +
    • wglGetProcAddress didn't handle all API functions +
    • when testing for OpenGL 1.2 vs 1.3, check for GL_ARB_texture_cube_map +
    • removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT from glGetInteger/Float/etc() +
    • error checking in compressed tex image functions had some glitches +
    • fixed AIX compile problem in src/config.c +
    • glGetTexImage was using pixel unpacking instead of packing params +
    • auto-mipmap generation for cube maps was incorrect +
    +Changes: +
      +
    • max texture units reduced to six to accomodate texture rectangles +
    • removed unfinished GL_MESA_sprite_point extension code +
    + + +

    4.1 October 29, 2002

    +New: +
      +
    • GL_NV_vertex_program extension +
    • GL_NV_vertex_program1_1 extension +
    • GL_ARB_window_pos extension +
    • GL_ARB_depth_texture extension +
    • GL_ARB_shadow extension +
    • GL_ARB_shadow_ambient extension +
    • GL_EXT_shadow_funcs extension +
    • GL_ARB_point_parameters extension +
    • GL_ARB_texture_env_crossbar +
    • GL_NV_point_sprite extension +
    • GL_NV_texture_rectangle extension +
    • GL_EXT_multi_draw_arrays extension +
    • GL_EXT_stencil_two_side extension +
    • GLX_SGIX_fbconfig and GLX_SGIX_pbuffer extensions +
    • GL_ATI_texture_mirror_once extension (Ian Romanick) +
    • massive overhaul/simplification of software rasterizer module, + many contributions from Klaus Niederkrueger +
    • faster software texturing in some cases (i.e. trilinear filtering) +
    • new OSMesaGetProcAddress() function +
    • more blend modes implemented with MMX code (Jose Fonseca) +
    • added glutGetProcAddress() to GLUT +
    • added GLUT_FPS env var to compute frames/second in glutSwapBuffers() +
    • pbinfo and pbdemo PBuffer programs +
    • glxinfo -v prints transprent pixel info (Gerd Sussner) +
    +Bug fixes: +
      +
    • better mipmap LOD computation (prevents excessive blurriness) +
    • OSMesaMakeCurrent() didn't recognize buffer size changes +
    • assorted conformance fixes for 16-bit/channel rendering +
    • texcombine alpha subtraction mode was broken +
    • fixed some blend problems when GLchan==GLfloat (Gerk Huisma) +
    • clamp colors to [0,inf] in OSMesa if GLchan==GLfloat (Gerk Huisma) +
    • fixed divide by zero error in NURBS tessellator (Jon Perry) +
    • fixed GL_LINEAR fog bug by adding clamping +
    • fixed FP exceptions found using Alpha CPU +
    • 3dfx/glide driver render-to-window feature was broken +
    • added missing GLX_TRANSPARENT_RGB token to glx.h +
    • fixed error checking related to paletted textures +
    • fixed reference count error in glDeleteTextures (Randy Fayan) +
    +Changes: +
      +
    • New spec file and Python code to generate some GL dispatch files +
    • Glide driver defaults to "no" with autoconf/automake +
    • updated demos/stex3d with new options +
    + + +

    5.0 November 13, 2002

    +New: +
      +
    • OpenGL 1.4 support (glGetString(GL_VERSION) returns "1.4") +
    • removed some overlooked debugging code +
    • glxinfo updated to support GLX_ARB_multisample +
    • GLUT now support GLX_ARB_multisample +
    • updated DOS driver (Daniel Borca) +
    +Bug fixes: +
      +
    • GL_POINT and GL_LINE-mode polygons didn't obey cull state +
    • fixed potential bug in _mesa_align_malloc/calloc() +
    • fixed missing triangle bug when running vertex programs +
    • fixed a few HPUX compilation problems +
    • FX (Glide) driver didn't compile +
    • setting GL_TEXTURE_BORDER_COLOR with glTexParameteriv() didn't work +
    • a few EXT functions, like glGenTexturesEXT, were no-ops +
    • a few OpenGL 1.4 functions like glFogCoord*, glBlendFuncSeparate, + glMultiDrawArrays and glMultiDrawElements were missing +
    • glGet*(GL_ACTIVE_STENCIL_FACE_EXT) was broken +
    • Pentium 4 Mobile was mistakenly identified as having 3DNow! +
    • fixed one-bit error in point/line fragment Z calculation +
    • fixed potential segfault in fakeglx code +
    • fixed color overflow problem in DOT3 texture env mode +
    + + +

    5.0.1 March 30, 2003

    +New: +
      +
    • DOS driver updates from Daniel Borca +
    • updated GL/gl_mangle.h file (Bill Hoffman) +Bug fixes: +
    • auto mipmap generation for cube maps was broken (bug 641363) +
    • writing/clearing software alpha channels was unreliable +
    • minor compilation fixes for OS/2 (Evgeny Kotsuba) +
    • fixed some bad assertions found with shadowtex demo +
    • fixed error checking bug in glCopyTexSubImage2D (bug 659020) +
    • glRotate(angle, -x, 0, 0) was incorrect (bug 659677) +
    • fixed potential segfault in texture object validation (bug 659012) +
    • fixed some bogus code in _mesa_test_os_sse_exception_support (Linus) +
    • fix fog stride bug in tnl code for h/w drivers (Michel Danzer) +
    • fixed glActiveTexture / glMatrixMode(GL_TEXTURE) bug (#669080) +
    • glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3 +
    • fixed compilation problem on Solaris7/x86 (bug 536406) +
    • fixed prefetch bug in 3DNow! code (Felix Kuhling) +
    • fixed NeXT build problem (FABSF macro) +
    • glDrawPixels Z values when glPixelZoom!=1 were invalid (bug 687811) +
    • zoomed glDraw/CopyPixels with clipping sometimes failed (bug 689964) +
    • AA line and triangle Z values are now rounded, not truncated +
    • fixed color interpolation bug when GLchan==GLfloat (bug 694461) +
    • glArePrograms/TexturesResident() wasn't 100% correct (Jose Fonseca) +
    • fixed a minor GL_COLOR_MATERIAL bug +
    • NV vertex program EXP instruction was broken +
    • glColorMask misbehaved with X window / pixmap rendering +
    • fix autoconf/libtool GLU C++ linker problem on Linux (a total hack) +
    • attempt to fix GGI compilation problem when MesaDemos not present +
    • NV vertex program ARL-relative fetches didn't work +
    +Changes: +
      +
    • use glPolygonOffset in gloss demo to avoid z-fighting artifacts +
    • updated winpos and pointblast demos to use ARB extensions +
    • disable SPARC normal transformation code (bug 673938) +
    • GLU fixes for OS/2 (Evgeny Kotsuba) +
    + + +

    5.0.2 September 5, 2003

    +Bug fixes: +
      +
    • fixed texgen problem causing texcoord's Q to be zero (stex3d) +
    • default GL_TEXTURE_COMPARE_MODE_ARB was wrong +
    • GL_CURRENT_MATRIX_NV query was wrong +
    • GL_CURRENT_MATRIX_STACK_DEPTH_NV query was off by one +
    • GL_LIST_MODE query wasn't correct +
    • GL_FOG_COORDINATE_SOURCE_EXT query wasn't supported +
    • GL_SECONDARY_COLOR_ARRAY_SIZE_EXT query returned wrong value +
    • blended, wide lines didn't always work correctly (bug 711595) +
    • glVertexAttrib4svNV w component was always 1 +
    • fixed bug in GL_IBM_rasterpos_clip (missing return) +
    • GL_DEPTH_TEXTURE_MODE = GL_ALPHA didn't work correctly +
    • a few Solaris compilation fixes +
    • fixed glClear() problem for DRI drivers (non-existant stencil, etc) +
    • fixed int/REAL mixup in GLU NURBS curve evaluator (Eric Cazeaux) +
    • fixed delete [] bug in SI GLU (bug 721765) (Diego Santa Cruz) +
    • glFog() didn't clamp fog colors +
    • fixed bad float/int conversion for GL_TEXTURE_PRIORITY in the + gl[Get]TexParameteri[v] functions +
    • fixed invalid memory references in glTexGen functions (bug 781602) +
    • integer-valued color arrays weren't handled correctly +
    • glDrawPixels(GL_DEPTH_COMPONENT) with glPixelZoom didn't work +
    • GL_EXT_texture_lod_bias is part of 1.4, overlooked in 5.0.1 +
    +Changes: +
      +
    • build GLUT with -fexceptions so C++ apps propogate exceptions +
    + + +

    5.1 December 17, 2003

    +New: +
      +
    • reorganized directory tree +
    • GL_ARB_vertex/fragment_program extensions (Michal Krol & Karl Rasche) +
    • GL_ATI_texture_env_combine3 extension (Ian Romanick) +
    • GL_SGI_texture_color_table extension (Eric Plante) +
    • GL_NV_fragment_program extension +
    • GL_NV_light_max_exponent extension +
    • GL_EXT_texture_rectangle (identical to GL_NV_texture_rectangle) +
    • GL_ARB_occlusion_query extension +
    • GL_ARB_point_sprite extension +
    • GL_ARB_texture_non_power_of_two extension +
    • GL_IBM_multimode_draw_arrays extension +
    • GL_EXT_texture_mirror_clamp extension (Ian Romanick) +
    • GL_ARB_vertex_buffer_object extension +
    • new X86 feature detection code (Petr Sebor) +
    • less memory used for display lists and vertex buffers +
    • demo of per-pixel lighting with a fragment program (demos/fplight.c) +
    • new version (18) of glext.h header +
    • new spriteblast.c demo of GL_ARB_point_sprite +
    • faster glDrawPixels in X11 driver in some cases (see RELNOTES-5.1) +
    • faster glCopyPixels in X11 driver in some cases (see RELNOTES-5.1) +
    +Bug fixes: +
      +
    • really enable OpenGL 1.4 features in DOS driver. +
    • fixed issues in glDrawPixels and glCopyPixels for very wide images +
    • glPixelMapf/ui/usv()'s size parameter is GLsizei, not GLint +
    • fixed some texgen bugs reported by Daniel Borca +
    • fixed wglMakeCurrent(NULL, NULL) bug (#835861) +
    • fixed glTexSubImage3D z-offset bug (Cedric Gautier) +
    • fixed RGBA blend enable bug (Ville Syrjala) +
    • glAccum is supposed to be a no-op in selection/feedback mode +
    • fixed texgen bug #597589 (John Popplewell) +
    +Changes: +
      +
    • dropped API trace feature (src/Trace/) +
    • documentation overhaul. merged with website content. more html. +
    • glxgears.c demo updated to use GLX swap rate extensions +
    • glTexImage1/2/3D now allows width/height/depth = 0 +
    • disable SPARC asm code on Linux (bug 852204) +
    + + +

    6.0 January 16, 2004

    +New: +
      +
    • full OpenGL 1.5 support +
    • updated GL/glext.h file to version 21 +Changes: +
    • changed max framebuffer size to 4Kx4K (MAX_WIDTH/HEIGHT in config.h) +Bug fixes: +
    • fixed bug in UNCLAMPED_FLOAT_TO_UBYTE macro; solves a color + clamping issue +
    • updated suno5-gcc configs +
    • glColor3 functions sometimes resulted in undefined alpha values +
    • fixed FP divide by zero error seen on VMS with xlockmore, others +
    • fixed vertex/fragment program debug problem (bug 873011) +
    • building on AIX with gcc works now +
    • glDeleteProgramsARB failed for ARB fragment programs (bug 876160) +
    • glDrawRangeElements tried to modify potentially read-only storage +
    • updated files for building on Windows +
    + + +

    6.0.1 April 2, 2004

    +New: +
      +
    • upgraded glext.h to version 22 +
    • new build targets (Dan Schikore) +
    • new linux-x86-opteron build target (Heath Feather) +
    +Bug fixes: +
      +
    • glBindProgramARB didn't update all necessary state +
    • fixed build problems on OpenBSD +
    • omit CVS directories from tarballs +
    • glGetTexImage(GL_COLOR_INDEX) was broken +
    • fixed an infinite loop in t&l module +
    • silenced some valgrind warnings about using unitialized memory +
    • fixed some compilation/link glitches on IRIX (Mike Stephens) +
    • glBindProgram wasn't getting compiled into display lists +
    • GLX_FBCONFIG_ID wasn't recognized in glXChooseFBConfig() (bug 888079) +
    • two-sided lighting and vertex program didn't work (bug 887330) +
    • stores to program parameter registers in vertex state programs + didn't work. +
    • fixed glOrtho bug found with gcc 3.2.2 (RH9) +
    • glXCreateWindow() wasn't fully implemented (bug 890894) +
    • generic vertex attribute arrays didn't work in display lists +
    • vertex buffer objects' default usage and access fields were wrong +
    • glDrawArrays with start!=0 was broken +
    • fragment program PK2H, UP2H, UP4B and UP4UB instructions were broken +
    • linux-osmesa16-static config didn't work +
    • fixed a few color index rendering problems (bug 910687) +
    • glInterleavedArrays didn't respect GL_CLIENT_ACTIVE_TEXTURE +
    • OSMesa RGB and BGR modes were broken +
    • glProgramStringARB mistakenly required a null-terminated string +
    • fragment program XPD instruction was incorrect +
    • glGetMaterial() didn't work reliably +
    • ARB_fragment_program KIL instruction was incorrect +
    + + +

    6.1 August 18, 2004

    +New: +
      +
    • Revamped Makefile system +
    • glXUseRotatedXFont() utility (see xdemos/xuserotfont.c) +
    • internal driver interface changes related to texture object + allocation, vertex/fragment programs, BlendEquationSeparate, etc. +
    • option to walk triangle edges with double-precision floats + (Justin Novosad of Discreet) (see config.h file) +
    • support for AUX buffers in software GLX driver +
    • updated glext.h to version 24 and glxext.h to version 6 +
    • new MESA_GLX_FORCE_ALPHA and MESA_GLX_DEPTH_BITS env vars +
    • updated BeOS support (Philippe Houdoin) +
    +Changes: +
      +
    • fragment fog interpolation is perspective corrected now +
    • new glTexImage code, much cleaner, may be a bit faster +
    +Bug fixes: +
      +
    • glArrayElement in display lists didn't handle generic vertex attribs +
    • glFogCoord didn't always work properly +
    • ARB_fragment_program fog options didn't work +
    • frag prog TEX instruction no longer incorrectly divides s,t,r by q +
    • ARB frag prog TEX and TEXP instructions now use LOD=0 +
    • glTexEnviv in display lists didn't work +
    • glRasterPos didn't do texgen or apply texture matrix +
    • GL_DOUBLE-valued vertex arrays were broken in some cases +
    • fixed texture rectangle edge/border sampling bugs +
    • sampling an incomplete texture in a fragment program would segfault +
    • glTexImage was missing a few error checks +
    • fixed some minor glGetTexParameter glitches +
    • GL_INTENSITY was mistakenly accepted as a to glTexImage +
    • fragment program writes to RC/HC register were broken +
    • fixed a few glitches in GL_HP_occlusion_test extension +
    • glBeginQueryARB and glEndQueryARB didn't work inside display lists +
    • vertex program state references were broken +
    • fixed triangle color interpolation bug on AIX (Shane Blackett) +
    • fixed a number of minor memory leaks (bug #1002030) +
    + + +

    6.2 October 2, 2004

    +New: +
      +
    • enabled GL_ARB_texture_rectangle (same as GL_NV_texture_rectangle) +
    • updated Doxygen support (Jose Fonseca) +
    +Changes: +
      +
    • some GGI driver updates (Christoph Egger, bug 1025977) +
    +Bug fixes: +
      +
    • Omit GL_ARB_texture_non_power_of_two from list of OpenGL 1.5 features +
    • fixed a few compilation issues on IRIX +
    • fixed a matrix classification bug (reported by Wes Bethel) +
    • we weren't reseting the vertex/fragment program error state + before parsing (Dave Reveman) +
    • adjust texcoords for sampling texture rectangles (Dave Reveman) +
    • glGet*(GL_MAX_VERTEX_ATTRIBS_ARB) wasn't implemented +
    • repeated calls to glDeleteTexture(t) could lead to a crash +
    • fixed potential ref count bugs in VBOs and vertex/fragment programs +
    • spriteblast demo didn't handle window size changes correctly +
    • glTexSubImage didn't handle pixels=NULL correctly for PBOs +
    • fixed color index mode glDrawPixels bug (Karl Schultz) +
    + + +

    6.2.1 December 9, 2004

    +Bug fixes: +
      +
    • don't apply regular fog or color sum when using a fragment program +
    • glProgramEnvParameter4fARB always generated an error on + GL_FRAGMENT_PROGRAM_ARB (fdo bug 1645) +
    • glVertexAttrib3svNV and glVertexAttrib3svARB were broken +
    • fixed width/height mix-up in glSeparableFilter2D() +
    • fixed regression in glCopyPixels + convolution +
    • glReadPixels from a clipped front color buffer didn't always work +
    • glTexImage didn't accept GL_RED/GREEN/BLUE as the format +
    • Attempting queries/accesses of VBO 0 weren't detected as errors +
    • paletted textures failed if the palette had fewer than 256 entries +
    +Changes: +
      +
    • fixed a bunch of compiler warnings found with gcc 3.4 +
    • bug reports should to go bugzilla.freedesktop.org +
    + + +

    6.3 July 20, 2005

    +New: +
      +
    • GL_EXT_framebuffer_object extension +
    • GL_ARB_draw_buffers extension +
    • GL_ARB_pixel_buffer_object extension +
    • GL_OES_read_format extension (Ian Romanick) +
    • DirectFB driver (Claudio Ciccani) +
    • x86_64 vertex transformation code (Mikko T.) +
    • Updated GL/glext.h to version 29 +
    +Changes: +
      +
    • added -stereo option for glxgears demo (Jacek Rosik) +
    • updated the PBuffer demo code in xdemos/ directory +
    • glDeleteTextures/Programs/Buffers() now makes the object ID + available for immediate re-use +
    • assorted 64-bit clean-ups fixes (x86_64 and Win64) +
    • lots of internal changes for GL_EXT_framebuffer_object +
    +Bug fixes: +
      +
    • some functions didn't support PBO functionality +
    • glGetTexImage didn't convert color index images to RGBA as required +
    • fragment program texcoords were sometimes wrong for points and lines +
    • fixed problem with negative dot product in arbfplight, fplight demos +
    • fixed bug in perspective correction of antialiased, textured lines +
    • querying GL_POST_CONVOLUTION_ALPHA_BIAS_EXT returned wrong value +
    • fixed a couple per-pixel fog bugs (Soju Matsumoto) +
    • glGetBooleanv(GL_FRAGMENT_PROGRAM_BINDING_NV) was broken +
    • fixed float parsing bug in ARB frag/vert programs (bug 2520) +
    • XMesaGetDepthBuffer() returned incorrect value for bytesPerValue +
    • GL_COLOR_MATERIAL with glColor3 didn't properly set diffuse alpha +
    • glXChooseFBConfig() crashed if attribList pointer was NULL +
    • program state.light[n].spot.direction.w was wrong value (bug 3083) +
    • fragment program fog option required glEnable(GL_FOG) - wrong. +
    • glColorTable() could produce a Mesa implementation error (bug 3135) +
    • RasterPos could get corrupted by color index rendering path +
    • Removed bad XTranslateCoordinates call when rendering to Pixmaps +
    • glPopAttrib() didn't properly restore GL_TEXTURE_GEN enable state +
    • fixed a few Darwin compilation problems +
    + + +

    6.3.1

    +

    +This was an intermediate release for X.org which wasn't otherwise released.) +

    + + +

    6.3.2 August 19, 2005

    +New: +
      +
    • The distribution now includes the DRI drivers and GLX code +
    +Changes: +
      +
    • Made the DRI "new" driver interface standard, remove old code +
    +Bug fixes: +
      +
    • GL_ARB_vertex/fragment_shader were mistakenly listed in the + extensions string +
    • negative relative addressing in vertex programs was broken +
    • update/fix SPARC assembly code for vertex transformation +
    • fixed memory leak when freeing GLX drawables/renderbuffers +
    • fixed display list memory leak +
    • the GL_PIXEL_MAP_I_TO_I table is now floating point, not integer +
    • wglGetProcAddress() didn't handle wgl-functions +
    • fixed glxext.h cross-compile issue (Colin Harrison) +
    • assorted DRI driver fixes +
    + + + +NOTE: Changes for Mesa 6.4 and later are documented in the corresponding +
    release notes file. + + + + + diff --git a/mesalib/docs/webmaster.html b/mesalib/docs/webmaster.html new file mode 100644 index 000000000..16f4dc803 --- /dev/null +++ b/mesalib/docs/webmaster.html @@ -0,0 +1,24 @@ + + +Mesa Introduction + + + + + +

    Webmaster

    + +

    +If you have problems, edits or additions for this website send them +to Brian +(brian.e.paul gmail.com). +

    + +

    +Mark Manning made the frame-based layout for the website. +Brian's modified it a lot since then. +

    + + + + diff --git a/mesalib/docs/xlibdriver.html b/mesalib/docs/xlibdriver.html new file mode 100644 index 000000000..d95f4d579 --- /dev/null +++ b/mesalib/docs/xlibdriver.html @@ -0,0 +1,275 @@ + + +Xlib Software Driver + + + + + +

    Xlib Software Driver

    + +

    +Mesa's Xlib driver provides an emulation of the GLX interface so that +OpenGL programs which use the GLX API can render to any X display, even +those that don't support the GLX extension. +Effectively, the Xlib driver converts all OpenGL rendering into Xlib calls. +

    + +

    +The Xlib driver is the oldest Mesa driver and the most mature of Mesa's +software-only drivers. +

    + +

    +Since the Xlib driver emulates the GLX extension, it's not +totally conformant with a true GLX implementation. +The differences are fairly obscure, however. +

    + +

    +The unique features of the Xlib driver follows. +

    + + +

    X Visual Selection

    +

    +Mesa supports RGB(A) rendering into almost any X visual type and depth. +

    +

    +The glXChooseVisual function tries to choose the best X visual +for the given attribute list. However, if this doesn't suit your needs +you can force Mesa to use any X visual you want (any supported by your +X server that is) by setting the MESA_RGB_VISUAL and +MESA_CI_VISUAL +environment variables. +When an RGB visual is requested, glXChooseVisual +will first look if the MESA_RGB_VISUAL variable is defined. +If so, it will try to use the specified visual. +Similarly, when a color index visual is requested, glXChooseVisual will +look for the MESA_CI_VISUAL variable. +

    + +

    +The format of accepted values is: visual-class depth +

    +

    +Here are some examples: +

    +
    +   using csh:
    +	% setenv MESA_RGB_VISUAL "TrueColor 8"		// 8-bit TrueColor
    +	% setenv MESA_CI_VISUAL "PseudoColor 12"	// 12-bit PseudoColor
    +	% setenv MESA_RGB_VISUAL "PseudoColor 8"	// 8-bit PseudoColor
    +
    +   using bash:
    +	$ export MESA_RGB_VISUAL="TrueColor 8"
    +	$ export MESA_CI_VISUAL="PseudoColor 12"
    +	$ export MESA_RGB_VISUAL="PseudoColor 8"
    +
    + + +

    Double Buffering

    +

    +Mesa can use either an X Pixmap or XImage as the back color buffer when in +double-buffer mode. +The default is to use an XImage. +The MESA_BACK_BUFFER environment variable can override this. +The valid values for MESA_BACK_BUFFER are: Pixmap and +XImage (only the first letter is checked, case doesn't matter). +

    + +

    +Using XImage is almost always faster than a Pixmap since it resides in +the application's address space. +When glXSwapBuffers() is called, XPutImage() or XShmPutImage() is used +to transfer the XImage to the on-screen window. +

    +

    +A Pixmap may be faster when doing remote rendering of a simple scene. +Some OpenGL features will be very slow with a Pixmap (for example, blending +will require a round-trip message for pixel readback.) +

    +

    +Experiment with the MESA_BACK_BUFFER variable to see which is faster +for your application. +

    + + +

    Colormaps

    +

    +When using Mesa directly or with GLX, it's up to the application +writer to create a window with an appropriate colormap. The GLUT +toolkit tris to minimize colormap flashing by sharing +colormaps when possible. Specifically, if the visual and depth of the +window matches that of the root window, the root window's colormap +will be shared by the Mesa window. Otherwise, a new, private colormap +will be allocated. +

    + +

    +When sharing the root colormap, Mesa may be unable to allocate the colors +it needs, resulting in poor color quality. This can happen when a +large number of colorcells in the root colormap are already allocated. +To prevent colormap sharing in GLUT, set the +MESA_PRIVATE_CMAP environment variable. The value isn't +significant. +

    + + +

    Gamma Correction

    +

    +To compensate for the nonlinear relationship between pixel values +and displayed intensities, there is a gamma correction feature in +Mesa. Some systems, such as Silicon Graphics, support gamma +correction in hardware (man gamma) so you won't need to use Mesa's +gamma facility. Other systems, however, may need gamma adjustment +to produce images which look correct. If you believe that +Mesa's images are too dim, read on. +

    + +

    +Gamma correction is controlled with the MESA_GAMMA environment +variable. Its value is of the form Gr Gg Gb or just G where +Gr is the red gamma value, Gg is the green gamma value, Gb is the +blue gamma value and G is one gamma value to use for all three +channels. Each value is a positive real number typically in the +range 1.0 to 2.5. +The defaults are all 1.0, effectively disabling gamma correction. +Examples: +

    +
    +	% export MESA_GAMMA="2.3 2.2 2.4"	// separate R,G,B values
    +	% export MESA_GAMMA="2.0"		// same gamma for R,G,B
    +
    +

    +The progs/demos/gamma.c program may help you to determine reasonable gamma +value for your display. With correct gamma values, the color intensities +displayed in the top row (drawn by dithering) should nearly match those +in the bottom row (drawn as grays). +

    + +

    +Alex De Bruyn reports that gamma values of 1.6, 1.6 and 1.9 work well +on HP displays using the HP-ColorRecovery technology. +

    + +

    +Mesa implements gamma correction with a lookup table which translates +a "linear" pixel value to a gamma-corrected pixel value. There is a +small performance penalty. Gamma correction only works in RGB mode. +Also be aware that pixel values read back from the frame buffer will +not be "un-corrected" so glReadPixels may not return the same data +drawn with glDrawPixels. +

    + +

    +For more information about gamma correction see: + +

    + + +

    Overlay Planes

    +

    +Hardware overlay planes are supported by the Xlib driver. To +determine if your X server has overlay support you can test for the +SERVER_OVERLAY_VISUALS property: +

    +
    +	xprop -root | grep SERVER_OVERLAY_VISUALS
    +
    + + +

    HPCR Dithering

    +

    +If you set the MESA_HPCR_CLEAR environment variable then dithering +will be used when clearing the color buffer. This is only applicable +to HP systems with the HPCR (Color Recovery) feature. +This incurs a small performance penalty. +

    + + +

    Extensions

    +

    +The following MESA-specific extensions are implemented in the Xlib driver. +

    + +

    GLX_MESA_pixmap_colormap

    + +

    +This extension adds the GLX function: +

    +
    +    GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
    +                                      Pixmap pixmap, Colormap cmap )
    +
    +

    +It is an alternative to the standard glXCreateGLXPixmap() function. +Since Mesa supports RGB rendering into any X visual, not just True- +Color or DirectColor, Mesa needs colormap information to convert RGB +values into pixel values. An X window carries this information but a +pixmap does not. This function associates a colormap to a GLX pixmap. +See the xdemos/glxpixmap.c file for an example of how to use this +extension. +

    +

    +GLX_MESA_pixmap_colormap specification +

    + + +

    GLX_MESA_release_buffers

    +

    +Mesa associates a set of ancillary (depth, accumulation, stencil and +alpha) buffers with each X window it draws into. These ancillary +buffers are allocated for each X window the first time the X window +is passed to glXMakeCurrent(). Mesa, however, can't detect when an +X window has been destroyed in order to free the ancillary buffers. +

    +

    +The best it can do is to check for recently destroyed windows whenever +the client calls the glXCreateContext() or glXDestroyContext() +functions. This may not be sufficient in all situations though. +

    +

    +The GLX_MESA_release_buffers extension allows a client to explicitly +deallocate the ancillary buffers by calling glxReleaseBuffersMESA() +just before an X window is destroyed. For example: +

    +
    +         #ifdef GLX_MESA_release_buffers
    +            glXReleaseBuffersMESA( dpy, window );
    +         #endif
    +         XDestroyWindow( dpy, window );
    +
    +

    +GLX_MESA_release_buffers specification +

    +

    +This extension was added in Mesa 2.0. +

    + +

    GLX_MESA_copy_sub_buffer

    +

    +This extension adds the glXCopySubBufferMESA() function. It works +like glXSwapBuffers() but only copies a sub-region of the window +instead of the whole window. +

    +

    +GLX_MESA_copy_sub_buffer specification +

    +

    +This extension was added in Mesa 2.6 +

    + +

    Summary of X-related environment variables

    +
    +   MESA_RGB_VISUAL - specifies the X visual and depth for RGB mode (X only)
    +   MESA_CI_VISUAL - specifies the X visual and depth for CI mode (X only)
    +   MESA_BACK_BUFFER - specifies how to implement the back color buffer (X only)
    +   MESA_PRIVATE_CMAP - force aux/tk libraries to use private colormaps (X only)
    +   MESA_GAMMA - gamma correction coefficients (X only)
    +
    + + + + diff --git a/mesalib/include/EGL/egl.h b/mesalib/include/EGL/egl.h new file mode 100644 index 000000000..e33a31572 --- /dev/null +++ b/mesalib/include/EGL/egl.h @@ -0,0 +1,300 @@ +/* -*- mode: c; tab-width: 8; -*- */ +/* vi: set sw=4 ts=8: */ +/* Reference version of egl.h for EGL 1.4. + * Last modified 2008/05/02 + */ + +#ifndef __egl_h_ +#define __egl_h_ + +/* All platform-dependent types and macro boilerplate (such as EGLAPI + * and EGLAPIENTRY) should go in eglplatform.h. + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* EGL Types */ +typedef int32_t EGLint; +typedef unsigned int EGLBoolean; +typedef unsigned int EGLenum; +typedef void *EGLConfig; +typedef void *EGLContext; +typedef void *EGLDisplay; +typedef void *EGLSurface; +typedef void *EGLClientBuffer; + +/* EGL Versioning */ +#define EGL_VERSION_1_0 1 +#define EGL_VERSION_1_1 1 +#define EGL_VERSION_1_2 1 +#define EGL_VERSION_1_3 1 +#define EGL_VERSION_1_4 1 + +/* EGL Enumerants. Bitmasks and other exceptional cases aside, most + * enums are assigned unique values starting at 0x3000. + */ + +/* EGL aliases */ +#define EGL_FALSE 0 +#define EGL_TRUE 1 + +/* Out-of-band handle values */ +#define EGL_DEFAULT_DISPLAY ((void *)0) +#define EGL_NO_CONTEXT ((EGLContext)0) +#define EGL_NO_DISPLAY ((EGLDisplay)0) +#define EGL_NO_SURFACE ((EGLSurface)0) + +/* Out-of-band attribute value */ +#define EGL_DONT_CARE ((EGLint)-1) + +/* Errors / GetError return values */ +#define EGL_SUCCESS 0x3000 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */ + +/* Reserved 0x300F-0x301F for additional errors */ + +/* Config attributes */ +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BLUE_SIZE 0x3022 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_RED_SIZE 0x3024 +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +#define EGL_PRESERVED_RESOURCES 0x3030 +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_NONE 0x3038 /* Attrib list terminator */ +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C +#define EGL_LUMINANCE_SIZE 0x303D +#define EGL_ALPHA_MASK_SIZE 0x303E +#define EGL_COLOR_BUFFER_TYPE 0x303F +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */ +#define EGL_CONFORMANT 0x3042 + +/* Reserved 0x3041-0x304F for additional config attributes */ + +/* Config attribute values */ +#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ +#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */ +#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ +#define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */ +#define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */ + +/* More config attribute values, for EGL_TEXTURE_FORMAT */ +#define EGL_NO_TEXTURE 0x305C +#define EGL_TEXTURE_RGB 0x305D +#define EGL_TEXTURE_RGBA 0x305E +#define EGL_TEXTURE_2D 0x305F + +/* Config attribute mask bits */ +#define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */ +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */ + +#define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */ +#define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */ + +/* QueryString targets */ +#define EGL_VENDOR 0x3053 +#define EGL_VERSION 0x3054 +#define EGL_EXTENSIONS 0x3055 +#define EGL_CLIENT_APIS 0x308D + +/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */ +#define EGL_HEIGHT 0x3056 +#define EGL_WIDTH 0x3057 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_TEXTURE_FORMAT 0x3080 +#define EGL_TEXTURE_TARGET 0x3081 +#define EGL_MIPMAP_TEXTURE 0x3082 +#define EGL_MIPMAP_LEVEL 0x3083 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_VG_COLORSPACE 0x3087 +#define EGL_VG_ALPHA_FORMAT 0x3088 +#define EGL_HORIZONTAL_RESOLUTION 0x3090 +#define EGL_VERTICAL_RESOLUTION 0x3091 +#define EGL_PIXEL_ASPECT_RATIO 0x3092 +#define EGL_SWAP_BEHAVIOR 0x3093 +#define EGL_MULTISAMPLE_RESOLVE 0x3099 + +/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ +#define EGL_BACK_BUFFER 0x3084 +#define EGL_SINGLE_BUFFER 0x3085 + +/* OpenVG color spaces */ +#define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */ +#define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */ + +/* OpenVG alpha formats */ +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */ +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */ + +/* Constant scale factor by which fractional display resolutions & + * aspect ratio are scaled when queried as integer values. + */ +#define EGL_DISPLAY_SCALING 10000 + +/* Unknown display resolution/aspect ratio */ +#define EGL_UNKNOWN ((EGLint)-1) + +/* Back buffer swap behaviors */ +#define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */ +#define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */ + +/* CreatePbufferFromClientBuffer buffer types */ +#define EGL_OPENVG_IMAGE 0x3096 + +/* QueryContext targets */ +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 + +/* CreateContext attributes */ +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 + +/* Multisample resolution behaviors */ +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */ +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */ + +/* BindAPI/QueryAPI targets */ +#define EGL_OPENGL_ES_API 0x30A0 +#define EGL_OPENVG_API 0x30A1 +#define EGL_OPENGL_API 0x30A2 + +/* GetCurrentSurface targets */ +#define EGL_DRAW 0x3059 +#define EGL_READ 0x305A + +/* WaitNative engines */ +#define EGL_CORE_NATIVE_ENGINE 0x305B + +/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */ +#define EGL_COLORSPACE EGL_VG_COLORSPACE +#define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT +#define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB +#define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR +#define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE +#define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE + +/* EGL extensions must request enum blocks from the Khronos + * API Registrar, who maintains the enumerant registry. Submit + * a bug in Khronos Bugzilla against task "Registry". + */ + + + +/* EGL Functions */ + +EGLAPI EGLint EGLAPIENTRY eglGetError(void); + +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id); +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy); + +EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name); + +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, + EGLint config_size, EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, + EGLConfig *configs, EGLint config_size, + EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, + EGLint attribute, EGLint *value); + +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, + EGLNativeWindowType win, + const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, + const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, + EGLNativePixmapType pixmap, + const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint *value); + +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api); +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void); + +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void); + +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void); + +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer( + EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, + EGLConfig config, const EGLint *attrib_list); + +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, + EGLint attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); + + +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); + + +EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, + EGLContext share_context, + const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, + EGLSurface read, EGLContext ctx); + +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void); +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw); +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, + EGLint attribute, EGLint *value); + +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, + EGLNativePixmapType target); + +EGLAPI void (* EGLAPIENTRY eglGetProcAddress(const char *procname))(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __egl_h_ */ diff --git a/mesalib/include/EGL/eglext.h b/mesalib/include/EGL/eglext.h new file mode 100644 index 000000000..b65f7f2bc --- /dev/null +++ b/mesalib/include/EGL/eglext.h @@ -0,0 +1,186 @@ +#ifndef __eglext_h_ +#define __eglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +#include + +/*************************************************************/ + +/* Header file version number */ +/* eglext.h last updated 2007/11/20 */ +/* Current version at http://www.khronos.org/registry/egl/ */ +#define EGL_EGLEXT_VERSION 1 + +#ifndef EGL_KHR_config_attribs +#define EGL_KHR_config_attribs 1 +#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */ +#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */ +#endif + +#ifndef EGL_KHR_lock_surface +#define EGL_KHR_lock_surface 1 +#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ +#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */ +#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */ +#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */ +#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */ +#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */ +#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */ +#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */ +#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */ +#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */ +#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */ +#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */ +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface); +#endif + +#ifndef EGL_KHR_image +#define EGL_KHR_image 1 +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */ +typedef void *EGLImageKHR; +extern const EGLImageKHR EGL_NO_IMAGE_KHR; +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); +#endif /* EGL_EGLEXT_PROTOTYPES */ +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, EGLint *attr_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#endif + +#ifndef EGL_KHR_vg_parent_image +#define EGL_KHR_vg_parent_image 1 +#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_gl_texture_2D_image +#define EGL_KHR_gl_texture_2D_image 1 +#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_gl_texture_cubemap_image +#define EGL_KHR_gl_texture_cubemap_image 1 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */ +#endif + +#ifndef EGL_KHR_gl_texture_3D_image +#define EGL_KHR_gl_texture_3D_image 1 +#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */ +#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */ +#endif + +#ifndef EGL_KHR_gl_renderbuffer_image +#define EGL_KHR_gl_renderbuffer_image 1 +#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */ +#endif + + +/* EGL_MESA_screen extension >>> PRELIMINARY <<< */ +#ifndef EGL_MESA_screen_surface +#define EGL_MESA_screen_surface 1 + +#define EGL_BAD_SCREEN_MESA 0x4000 +#define EGL_BAD_MODE_MESA 0x4001 +#define EGL_SCREEN_COUNT_MESA 0x4002 +#define EGL_SCREEN_POSITION_MESA 0x4003 +#define EGL_SCREEN_POSITION_GRANULARITY_MESA 0x4004 +#define EGL_MODE_ID_MESA 0x4005 +#define EGL_REFRESH_RATE_MESA 0x4006 +#define EGL_OPTIMAL_MESA 0x4007 +#define EGL_INTERLACED_MESA 0x4008 +#define EGL_SCREEN_BIT_MESA 0x08 + +typedef uint32_t EGLScreenMESA; +typedef uint32_t EGLModeMESA; + +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); +EGLAPI EGLBoolean EGLAPIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); +EGLAPI EGLBoolean EGLAPIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); +EGLAPI EGLSurface EGLAPIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode); +EGLAPI EGLBoolean EGLAPIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode); +EGLAPI const char * EGLAPIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode); +#endif /* EGL_EGLEXT_PROTOTYPES */ + +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCHOOSEMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETMODESMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGetModeATTRIBMESA) (EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSCRREENSMESA) (EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESCREENSURFACEMESA) (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSHOWSCREENSURFACEMESA) (EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSCREENPOSIITONMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENSURFACEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSCREENMODEMESA) (EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode); +typedef const char * (EGLAPIENTRYP PFNEGLQUERYMODESTRINGMESA) (EGLDisplay dpy, EGLModeMESA mode); + +#endif /* EGL_MESA_screen_surface */ + + +#ifndef EGL_MESA_copy_context +#define EGL_MESA_copy_context 1 + +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask); +#endif /* EGL_EGLEXT_PROTOTYPES */ + +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask); + +#endif /* EGL_MESA_copy_context */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/include/EGL/eglplatform.h b/mesalib/include/EGL/eglplatform.h new file mode 100644 index 000000000..9e83b6000 --- /dev/null +++ b/mesalib/include/EGL/eglplatform.h @@ -0,0 +1,93 @@ +/* -*- mode: c; tab-width: 8; -*- */ +/* vi: set sw=4 ts=8: */ +/* Platform-specific types and definitions for egl.h */ + +#ifndef __eglplatform_h_ +#define __eglplatform_h_ + +/* Windows calling convention boilerplate */ +#if (defined(WIN32) || defined(_WIN32_WCE)) +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ +#endif +#include +#endif + +#if !defined(_WIN32_WCE) +#include +#include +#endif + +/* Macros used in EGL function prototype declarations. + * + * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); + * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); + * + * On Windows, EGLAPIENTRY can be defined like APIENTRY. + * On most other platforms, it should be empty. + */ + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY +#endif +#ifndef EGLAPIENTRYP +#define EGLAPIENTRYP EGLAPIENTRY * +#endif + +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType + * are aliases of window-system-dependent types, such as X Display * or + * Windows Device Context. They must be defined in platform-specific + * code below. The EGL-prefixed versions of Native*Type are the same + * types, renamed in EGL 1.3 so all types in the API start with "EGL". + */ + +/* Unix (tentative) + #include + typedef Display *NativeDisplayType; + - or maybe, if encoding "hostname:display.head" + typedef const char *NativeWindowType; + etc. + */ + + +#if (defined(WIN32) || defined(_WIN32_WCE)) + +/** BEGIN Added for Windows **/ +#ifndef EGLAPI +#define EGLAPI __declspec(dllexport) +#endif + +typedef long int32_t; +typedef unsigned long uint32_t; +typedef unsigned char uint8_t; +#define snprintf _snprintf +#define strcasecmp _stricmp +#define vsnprintf _vsnprintf + +typedef HDC NativeDisplayType; +typedef HWND NativeWindowType; +typedef HBITMAP NativePixmapType; +/** END Added for Windows **/ + +#elif defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__APPLE__) + + +/** BEGIN Added for X (Mesa) **/ +#ifndef EGLAPI +#define EGLAPI extern +#endif + +#include +typedef Display *NativeDisplayType; +typedef Window NativeWindowType; +typedef Pixmap NativePixmapType; +/** END Added for X (Mesa) **/ + +#endif + +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +typedef NativeDisplayType EGLNativeDisplayType; +typedef NativePixmapType EGLNativePixmapType; +typedef NativeWindowType EGLNativeWindowType; + +#endif /* __eglplatform_h */ diff --git a/mesalib/include/GL/dmesa.h b/mesalib/include/GL/dmesa.h new file mode 100644 index 000000000..358082e3e --- /dev/null +++ b/mesalib/include/GL/dmesa.h @@ -0,0 +1,160 @@ +/* + * Mesa 3-D graphics library + * Version: 6.1 + * + * Copyright (C) 1999-2004 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. + */ + +/* + * DOS/DJGPP device driver for Mesa + * + * Author: Daniel Borca + * Email : dborca@users.sourceforge.net + * Web : http://www.geocities.com/dborca + */ + + +#ifndef DMESA_H_included +#define DMESA_H_included + +#define DMESA_MAJOR_VERSION 6 +#define DMESA_MINOR_VERSION 5 + +/* Sample Usage: + * + * 1. Call DMesaCreateVisual() to initialize graphics. + * 2. Call DMesaCreateContext() to create a DMesa rendering context. + * 3. Call DMesaCreateBuffer() to define the window. + * 4. Call DMesaMakeCurrent() to bind the DMesaBuffer to a DMesaContext. + * 5. Make gl* calls to render your graphics. + * 6. Use DMesaSwapBuffers() when double buffering to swap front/back buffers. + * 7. Before exiting, destroy DMesaBuffer, DMesaContext and DMesaVisual. + */ + +typedef struct dmesa_context *DMesaContext; +typedef struct dmesa_visual *DMesaVisual; +typedef struct dmesa_buffer *DMesaBuffer; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create a new Visual and set graphics mode. + */ +DMesaVisual DMesaCreateVisual (GLint width, /* X res */ + GLint height, /* Y res */ + GLint colDepth, /* BPP */ + GLint refresh, /* refresh rate: 0=default */ + GLboolean dbFlag, /* double-buffered */ + GLboolean rgbFlag, /* RGB mode */ + GLint alphaSize, /* requested bits/alpha */ + GLint depthSize, /* requested bits/depth */ + GLint stencilSize, /* requested bits/stencil */ + GLint accumSize); /* requested bits/accum */ + +/* + * Destroy Visual and restore screen. + */ +void DMesaDestroyVisual (DMesaVisual v); + + + +/* + * Create a new Context for rendering. + */ +DMesaContext DMesaCreateContext (DMesaVisual visual, DMesaContext share); + +/* + * Destroy Context. + */ +void DMesaDestroyContext (DMesaContext c); + +/* + * Return a handle to the current context. + */ +DMesaContext DMesaGetCurrentContext (void); + + + +/* + * Create a new Buffer (window). + */ +DMesaBuffer DMesaCreateBuffer (DMesaVisual visual, + GLint xpos, GLint ypos, + GLint width, GLint height); + +/* + * Destroy Buffer. + */ +void DMesaDestroyBuffer (DMesaBuffer b); + +/* + * Return a handle to the current buffer. + */ +DMesaBuffer DMesaGetCurrentBuffer (void); + +/* + * Swap the front and back buffers for the given Buffer. + * No action is taken if the buffer is not double buffered. + */ +void DMesaSwapBuffers (DMesaBuffer b); + +/* + * Bind Buffer to Context and make the Context the current one. + */ +GLboolean DMesaMakeCurrent (DMesaContext c, DMesaBuffer b); + + + +/* + * Move/Resize current Buffer. + */ +GLboolean DMesaMoveBuffer (GLint xpos, GLint ypos); +GLboolean DMesaResizeBuffer (GLint width, GLint height); + +/* + * Set palette index, using normalized values. + */ +void DMesaSetCI (int ndx, GLfloat red, GLfloat green, GLfloat blue); + +/* + * DMesa functions + */ +typedef void (*DMesaProc) (); +DMesaProc DMesaGetProcAddress (const char *name); + +/* + * DMesa state retrieval. + */ +#define DMESA_GET_SCREEN_SIZE 0x0100 +#define DMESA_GET_DRIVER_CAPS 0x0200 +#define DMESA_GET_VIDEO_MODES 0x0300 +#define DMESA_GET_BUFFER_ADDR 0x0400 + +#define DMESA_DRIVER_DBL_BIT 0x1 /* double-buffered */ +#define DMESA_DRIVER_YUP_BIT 0x2 /* lower-left window origin */ +int DMesaGetIntegerv (GLenum pname, GLint *params); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/include/GL/ggimesa.h b/mesalib/include/GL/ggimesa.h new file mode 100644 index 000000000..90e0b4222 --- /dev/null +++ b/mesalib/include/GL/ggimesa.h @@ -0,0 +1,85 @@ +/* + * Mesa 3-D graphics library GGI bindings (GGIGL [giggle]) + * Version: 4.0 + * Copyright (C) 1995-2000 Brian Paul + * Copyright (C) 1998 Uwe Maurer + * Copyrigth (C) 2001 Filip Spacek + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef GGIMESA_H +#define GGIMESA_H + +#define GGIMESA_MAJOR_VERSION 4 +#define GGIMESA_MINOR_VERSION 0 + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "GL/gl.h" + +typedef struct ggi_mesa_context *ggi_mesa_context_t; + +/* + * Initialize Mesa GGI extension + */ +int ggiMesaInit(void); +/* + * Clean up Mesa GGI exension + */ +int ggiMesaExit(void); + +/* + * Attach Mesa GGI extension to the visual 'vis' + */ +int ggiMesaAttach(ggi_visual_t vis); +/* + * Detach Mesa GGI extension from the visual 'vis' + */ +int ggiMesaDetach(ggi_visual_t vis); + +int ggiMesaExtendVisual(ggi_visual_t vis, GLboolean alpha_flag, + GLboolean stereo_flag, GLint depth_size, + GLint stencil_size, GLint accum_red_size, + GLint accum_green_size, GLint accum_blue_size, + GLint accum_alpha_size, GLint num_samples); + +/* + * Create a new context capable of displaying on the visual vis. + */ +ggi_mesa_context_t ggiMesaCreateContext(ggi_visual_t vis); +/* + * Destroy the context 'ctx' + */ +void ggiMesaDestroyContext(ggi_mesa_context_t ctx); + +/* + * Make context 'ctx' the current context and bind it to visual 'vis'. + * Note that the context must have been created with respect to that visual. + */ +void ggiMesaMakeCurrent(ggi_mesa_context_t ctx, ggi_visual_t vis); + +void ggiMesaSwapBuffers(void); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/include/GL/gl.h b/mesalib/include/GL/gl.h new file mode 100644 index 000000000..5f8bc2b70 --- /dev/null +++ b/mesalib/include/GL/gl.h @@ -0,0 +1,2224 @@ +/* + * Mesa 3-D graphics library + * Version: 7.6 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef __gl_h_ +#define __gl_h_ + +#if defined(USE_MGL_NAMESPACE) +#include "gl_mangle.h" +#endif + + +/********************************************************************** + * Begin system-specific stuff. Do not do any of this when building + * for SciTech SNAP, as this is all done before this header file is + * included. + */ +#if !defined(__SCITECH_SNAP__) + +#if defined(__BEOS__) +#include /* to get some BeOS-isms */ +#endif + +#if !defined(OPENSTEP) && (defined(NeXT) || defined(NeXT_PDO)) +#define OPENSTEP +#endif + +#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) +#define __WIN32__ +#endif + +#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) +# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */ +# define GLAPI __declspec(dllexport) +# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */ +# define GLAPI __declspec(dllimport) +# else /* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +# endif /* _STATIC_MESA support */ +# if defined(__MINGW32__) && defined(GL_NO_STDCALL) || defined(UNDER_CE) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */ +# define GLAPIENTRY +# else +# define GLAPIENTRY __stdcall +# endif +#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ +# define GLAPI extern +# define GLAPIENTRY __stdcall +#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 +# define GLAPI __attribute__((visibility("default"))) +# define GLAPIENTRY +#endif /* WIN32 && !CYGWIN */ + +#if (defined(__BEOS__) && defined(__POWERPC__)) || defined(__QUICKDRAW__) +# define PRAGMA_EXPORT_SUPPORTED 1 +#endif + +/* + * WINDOWS: Include windows.h here to define APIENTRY. + * It is also useful when applications include this file by + * including only glut.h, since glut.h depends on windows.h. + * Applications needing to include windows.h with parms other + * than "WIN32_LEAN_AND_MEAN" may include windows.h before + * glut.h or gl.h. + */ +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_WIN32_WCE) \ + && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) \ + && !defined(__CYGWIN__) || defined(__MINGW32__) +#include +#endif + +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import on +#endif + +#ifndef GLAPI +#define GLAPI extern +#endif + +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#ifndef APIENTRY +#define APIENTRY GLAPIENTRY +#endif + +/* "P" suffix to be used for a pointer to a function */ +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif + +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GLAPIENTRY * +#endif + +#ifdef CENTERLINE_CLPP +#define signed +#endif + +#if defined(PRAGMA_EXPORT_SUPPORTED) +#pragma export on +#endif + +#endif /* !__SCITECH_SNAP__ */ +/* + * End system-specific stuff. + **********************************************************************/ + + + +#ifdef __cplusplus +extern "C" { +#endif + + + +#define GL_VERSION_1_1 1 +#define GL_VERSION_1_2 1 +#define GL_VERSION_1_3 1 +#define GL_ARB_imaging 1 + + +/* + * Datatypes + */ +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef void GLvoid; +typedef signed char GLbyte; /* 1-byte signed */ +typedef short GLshort; /* 2-byte signed */ +typedef int GLint; /* 4-byte signed */ +typedef unsigned char GLubyte; /* 1-byte unsigned */ +typedef unsigned short GLushort; /* 2-byte unsigned */ +typedef unsigned int GLuint; /* 4-byte unsigned */ +typedef int GLsizei; /* 4-byte signed */ +typedef float GLfloat; /* single precision float */ +typedef float GLclampf; /* single precision float in [0,1] */ +typedef double GLdouble; /* double precision float */ +typedef double GLclampd; /* double precision float in [0,1] */ + + + +/* + * Constants + */ + +/* Boolean values */ +#define GL_FALSE 0x0 +#define GL_TRUE 0x1 + +/* Data types */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_2_BYTES 0x1407 +#define GL_3_BYTES 0x1408 +#define GL_4_BYTES 0x1409 +#define GL_DOUBLE 0x140A + +/* Primitives */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_QUADS 0x0007 +#define GL_QUAD_STRIP 0x0008 +#define GL_POLYGON 0x0009 + +/* Vertex Arrays */ +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_INDEX_ARRAY 0x8077 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_EDGE_FLAG_ARRAY 0x8079 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_INDEX_ARRAY_TYPE 0x8085 +#define GL_INDEX_ARRAY_STRIDE 0x8086 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_INDEX_ARRAY_POINTER 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 +#define GL_V2F 0x2A20 +#define GL_V3F 0x2A21 +#define GL_C4UB_V2F 0x2A22 +#define GL_C4UB_V3F 0x2A23 +#define GL_C3F_V3F 0x2A24 +#define GL_N3F_V3F 0x2A25 +#define GL_C4F_N3F_V3F 0x2A26 +#define GL_T2F_V3F 0x2A27 +#define GL_T4F_V4F 0x2A28 +#define GL_T2F_C4UB_V3F 0x2A29 +#define GL_T2F_C3F_V3F 0x2A2A +#define GL_T2F_N3F_V3F 0x2A2B +#define GL_T2F_C4F_N3F_V3F 0x2A2C +#define GL_T4F_C4F_N3F_V4F 0x2A2D + +/* Matrix Mode */ +#define GL_MATRIX_MODE 0x0BA0 +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* Points */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_POINT_SIZE_RANGE 0x0B12 + +/* Lines */ +#define GL_LINE_SMOOTH 0x0B20 +#define GL_LINE_STIPPLE 0x0B24 +#define GL_LINE_STIPPLE_PATTERN 0x0B25 +#define GL_LINE_STIPPLE_REPEAT 0x0B26 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_LINE_WIDTH_RANGE 0x0B22 + +/* Polygons */ +#define GL_POINT 0x1B00 +#define GL_LINE 0x1B01 +#define GL_FILL 0x1B02 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_POLYGON_MODE 0x0B40 +#define GL_POLYGON_SMOOTH 0x0B41 +#define GL_POLYGON_STIPPLE 0x0B42 +#define GL_EDGE_FLAG 0x0B43 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_POINT 0x2A01 +#define GL_POLYGON_OFFSET_LINE 0x2A02 +#define GL_POLYGON_OFFSET_FILL 0x8037 + +/* Display Lists */ +#define GL_COMPILE 0x1300 +#define GL_COMPILE_AND_EXECUTE 0x1301 +#define GL_LIST_BASE 0x0B32 +#define GL_LIST_INDEX 0x0B33 +#define GL_LIST_MODE 0x0B30 + +/* Depth buffer */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_COMPONENT 0x1902 + +/* Lighting */ +#define GL_LIGHTING 0x0B50 +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_SHININESS 0x1601 +#define GL_EMISSION 0x1600 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +#define GL_COLOR_INDEXES 0x1603 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 +#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_SHADE_MODEL 0x0B54 +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_COLOR_MATERIAL_FACE 0x0B55 +#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 +#define GL_NORMALIZE 0x0BA1 + +/* User clipping planes */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* Accumulation buffer */ +#define GL_ACCUM_RED_BITS 0x0D58 +#define GL_ACCUM_GREEN_BITS 0x0D59 +#define GL_ACCUM_BLUE_BITS 0x0D5A +#define GL_ACCUM_ALPHA_BITS 0x0D5B +#define GL_ACCUM_CLEAR_VALUE 0x0B80 +#define GL_ACCUM 0x0100 +#define GL_ADD 0x0104 +#define GL_LOAD 0x0101 +#define GL_MULT 0x0103 +#define GL_RETURN 0x0102 + +/* Alpha testing */ +#define GL_ALPHA_TEST 0x0BC0 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_ALPHA_TEST_FUNC 0x0BC1 + +/* Blending */ +#define GL_BLEND 0x0BE2 +#define GL_BLEND_SRC 0x0BE1 +#define GL_BLEND_DST 0x0BE0 +#define GL_ZERO 0x0 +#define GL_ONE 0x1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 + +/* Render Mode */ +#define GL_FEEDBACK 0x1C01 +#define GL_RENDER 0x1C00 +#define GL_SELECT 0x1C02 + +/* Feedback */ +#define GL_2D 0x0600 +#define GL_3D 0x0601 +#define GL_3D_COLOR 0x0602 +#define GL_3D_COLOR_TEXTURE 0x0603 +#define GL_4D_COLOR_TEXTURE 0x0604 +#define GL_POINT_TOKEN 0x0701 +#define GL_LINE_TOKEN 0x0702 +#define GL_LINE_RESET_TOKEN 0x0707 +#define GL_POLYGON_TOKEN 0x0703 +#define GL_BITMAP_TOKEN 0x0704 +#define GL_DRAW_PIXEL_TOKEN 0x0705 +#define GL_COPY_PIXEL_TOKEN 0x0706 +#define GL_PASS_THROUGH_TOKEN 0x0700 +#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 +#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 +#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 + +/* Selection */ +#define GL_SELECTION_BUFFER_POINTER 0x0DF3 +#define GL_SELECTION_BUFFER_SIZE 0x0DF4 + +/* Fog */ +#define GL_FOG 0x0B60 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_COLOR 0x0B66 +#define GL_FOG_INDEX 0x0B61 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_LINEAR 0x2601 +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* Logic Ops */ +#define GL_LOGIC_OP 0x0BF1 +#define GL_INDEX_LOGIC_OP 0x0BF1 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_CLEAR 0x1500 +#define GL_SET 0x150F +#define GL_COPY 0x1503 +#define GL_COPY_INVERTED 0x150C +#define GL_NOOP 0x1505 +#define GL_INVERT 0x150A +#define GL_AND 0x1501 +#define GL_NAND 0x150E +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_XOR 0x1506 +#define GL_EQUIV 0x1509 +#define GL_AND_REVERSE 0x1502 +#define GL_AND_INVERTED 0x1504 +#define GL_OR_REVERSE 0x150B +#define GL_OR_INVERTED 0x150D + +/* Stencil */ +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_INDEX 0x1901 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 + +/* Buffers, Pixel Drawing/Reading */ +#define GL_NONE 0x0 +#define GL_LEFT 0x0406 +#define GL_RIGHT 0x0407 +/*GL_FRONT 0x0404 */ +/*GL_BACK 0x0405 */ +/*GL_FRONT_AND_BACK 0x0408 */ +#define GL_FRONT_LEFT 0x0400 +#define GL_FRONT_RIGHT 0x0401 +#define GL_BACK_LEFT 0x0402 +#define GL_BACK_RIGHT 0x0403 +#define GL_AUX0 0x0409 +#define GL_AUX1 0x040A +#define GL_AUX2 0x040B +#define GL_AUX3 0x040C +#define GL_COLOR_INDEX 0x1900 +#define GL_RED 0x1903 +#define GL_GREEN 0x1904 +#define GL_BLUE 0x1905 +#define GL_ALPHA 0x1906 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_ALPHA_BITS 0x0D55 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_INDEX_BITS 0x0D51 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_AUX_BUFFERS 0x0C00 +#define GL_READ_BUFFER 0x0C02 +#define GL_DRAW_BUFFER 0x0C01 +#define GL_DOUBLEBUFFER 0x0C32 +#define GL_STEREO 0x0C33 +#define GL_BITMAP 0x1A00 +#define GL_COLOR 0x1800 +#define GL_DEPTH 0x1801 +#define GL_STENCIL 0x1802 +#define GL_DITHER 0x0BD0 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 + +/* Implementation limits */ +#define GL_MAX_LIST_NESTING 0x0B31 +#define GL_MAX_EVAL_ORDER 0x0D30 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 +#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_NAME_STACK_DEPTH 0x0D37 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B + +/* Gets */ +#define GL_ATTRIB_STACK_DEPTH 0x0BB0 +#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_CURRENT_INDEX 0x0B01 +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_RASTER_COLOR 0x0B04 +#define GL_CURRENT_RASTER_DISTANCE 0x0B09 +#define GL_CURRENT_RASTER_INDEX 0x0B05 +#define GL_CURRENT_RASTER_POSITION 0x0B07 +#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 +#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_INDEX_CLEAR_VALUE 0x0C20 +#define GL_INDEX_MODE 0x0C30 +#define GL_INDEX_WRITEMASK 0x0C21 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_NAME_STACK_DEPTH 0x0D70 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_RENDER_MODE 0x0C40 +#define GL_RGBA_MODE 0x0C31 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_VIEWPORT 0x0BA2 + +/* Evaluators */ +#define GL_AUTO_NORMAL 0x0D80 +#define GL_MAP1_COLOR_4 0x0D90 +#define GL_MAP1_INDEX 0x0D91 +#define GL_MAP1_NORMAL 0x0D92 +#define GL_MAP1_TEXTURE_COORD_1 0x0D93 +#define GL_MAP1_TEXTURE_COORD_2 0x0D94 +#define GL_MAP1_TEXTURE_COORD_3 0x0D95 +#define GL_MAP1_TEXTURE_COORD_4 0x0D96 +#define GL_MAP1_VERTEX_3 0x0D97 +#define GL_MAP1_VERTEX_4 0x0D98 +#define GL_MAP2_COLOR_4 0x0DB0 +#define GL_MAP2_INDEX 0x0DB1 +#define GL_MAP2_NORMAL 0x0DB2 +#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 +#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 +#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 +#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 +#define GL_MAP2_VERTEX_3 0x0DB7 +#define GL_MAP2_VERTEX_4 0x0DB8 +#define GL_MAP1_GRID_DOMAIN 0x0DD0 +#define GL_MAP1_GRID_SEGMENTS 0x0DD1 +#define GL_MAP2_GRID_DOMAIN 0x0DD2 +#define GL_MAP2_GRID_SEGMENTS 0x0DD3 +#define GL_COEFF 0x0A00 +#define GL_ORDER 0x0A01 +#define GL_DOMAIN 0x0A02 + +/* Hints */ +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_FOG_HINT 0x0C54 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* Scissor box */ +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 + +/* Pixel Mode / Transfer */ +#define GL_MAP_COLOR 0x0D10 +#define GL_MAP_STENCIL 0x0D11 +#define GL_INDEX_SHIFT 0x0D12 +#define GL_INDEX_OFFSET 0x0D13 +#define GL_RED_SCALE 0x0D14 +#define GL_RED_BIAS 0x0D15 +#define GL_GREEN_SCALE 0x0D18 +#define GL_GREEN_BIAS 0x0D19 +#define GL_BLUE_SCALE 0x0D1A +#define GL_BLUE_BIAS 0x0D1B +#define GL_ALPHA_SCALE 0x0D1C +#define GL_ALPHA_BIAS 0x0D1D +#define GL_DEPTH_SCALE 0x0D1E +#define GL_DEPTH_BIAS 0x0D1F +#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 +#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 +#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 +#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 +#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 +#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 +#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 +#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 +#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 +#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 +#define GL_PIXEL_MAP_S_TO_S 0x0C71 +#define GL_PIXEL_MAP_I_TO_I 0x0C70 +#define GL_PIXEL_MAP_I_TO_R 0x0C72 +#define GL_PIXEL_MAP_I_TO_G 0x0C73 +#define GL_PIXEL_MAP_I_TO_B 0x0C74 +#define GL_PIXEL_MAP_I_TO_A 0x0C75 +#define GL_PIXEL_MAP_R_TO_R 0x0C76 +#define GL_PIXEL_MAP_G_TO_G 0x0C77 +#define GL_PIXEL_MAP_B_TO_B 0x0C78 +#define GL_PIXEL_MAP_A_TO_A 0x0C79 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_PACK_LSB_FIRST 0x0D01 +#define GL_PACK_ROW_LENGTH 0x0D02 +#define GL_PACK_SKIP_PIXELS 0x0D04 +#define GL_PACK_SKIP_ROWS 0x0D03 +#define GL_PACK_SWAP_BYTES 0x0D00 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNPACK_LSB_FIRST 0x0CF1 +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SWAP_BYTES 0x0CF0 +#define GL_ZOOM_X 0x0D16 +#define GL_ZOOM_Y 0x0D17 + +/* Texture mapping */ +#define GL_TEXTURE_ENV 0x2300 +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_1D 0x0DE0 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_ENV_COLOR 0x2201 +#define GL_TEXTURE_GEN_S 0x0C60 +#define GL_TEXTURE_GEN_T 0x0C61 +#define GL_TEXTURE_GEN_MODE 0x2500 +#define GL_TEXTURE_BORDER_COLOR 0x1004 +#define GL_TEXTURE_WIDTH 0x1000 +#define GL_TEXTURE_HEIGHT 0x1001 +#define GL_TEXTURE_BORDER 0x1005 +#define GL_TEXTURE_COMPONENTS 0x1003 +#define GL_TEXTURE_RED_SIZE 0x805C +#define GL_TEXTURE_GREEN_SIZE 0x805D +#define GL_TEXTURE_BLUE_SIZE 0x805E +#define GL_TEXTURE_ALPHA_SIZE 0x805F +#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 +#define GL_TEXTURE_INTENSITY_SIZE 0x8061 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_OBJECT_LINEAR 0x2401 +#define GL_OBJECT_PLANE 0x2501 +#define GL_EYE_LINEAR 0x2400 +#define GL_EYE_PLANE 0x2502 +#define GL_SPHERE_MAP 0x2402 +#define GL_DECAL 0x2101 +#define GL_MODULATE 0x2100 +#define GL_NEAREST 0x2600 +#define GL_REPEAT 0x2901 +#define GL_CLAMP 0x2900 +#define GL_S 0x2000 +#define GL_T 0x2001 +#define GL_R 0x2002 +#define GL_Q 0x2003 +#define GL_TEXTURE_GEN_R 0x0C62 +#define GL_TEXTURE_GEN_Q 0x0C63 + +/* Utility */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* Errors */ +#define GL_NO_ERROR 0x0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* glPush/PopAttrib bits */ +#define GL_CURRENT_BIT 0x00000001 +#define GL_POINT_BIT 0x00000002 +#define GL_LINE_BIT 0x00000004 +#define GL_POLYGON_BIT 0x00000008 +#define GL_POLYGON_STIPPLE_BIT 0x00000010 +#define GL_PIXEL_MODE_BIT 0x00000020 +#define GL_LIGHTING_BIT 0x00000040 +#define GL_FOG_BIT 0x00000080 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_ACCUM_BUFFER_BIT 0x00000200 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_VIEWPORT_BIT 0x00000800 +#define GL_TRANSFORM_BIT 0x00001000 +#define GL_ENABLE_BIT 0x00002000 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_HINT_BIT 0x00008000 +#define GL_EVAL_BIT 0x00010000 +#define GL_LIST_BIT 0x00020000 +#define GL_TEXTURE_BIT 0x00040000 +#define GL_SCISSOR_BIT 0x00080000 +#define GL_ALL_ATTRIB_BITS 0x000FFFFF + + +/* OpenGL 1.1 */ +#define GL_PROXY_TEXTURE_1D 0x8063 +#define GL_PROXY_TEXTURE_2D 0x8064 +#define GL_TEXTURE_PRIORITY 0x8066 +#define GL_TEXTURE_RESIDENT 0x8067 +#define GL_TEXTURE_BINDING_1D 0x8068 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 +#define GL_ALPHA4 0x803B +#define GL_ALPHA8 0x803C +#define GL_ALPHA12 0x803D +#define GL_ALPHA16 0x803E +#define GL_LUMINANCE4 0x803F +#define GL_LUMINANCE8 0x8040 +#define GL_LUMINANCE12 0x8041 +#define GL_LUMINANCE16 0x8042 +#define GL_LUMINANCE4_ALPHA4 0x8043 +#define GL_LUMINANCE6_ALPHA2 0x8044 +#define GL_LUMINANCE8_ALPHA8 0x8045 +#define GL_LUMINANCE12_ALPHA4 0x8046 +#define GL_LUMINANCE12_ALPHA12 0x8047 +#define GL_LUMINANCE16_ALPHA16 0x8048 +#define GL_INTENSITY 0x8049 +#define GL_INTENSITY4 0x804A +#define GL_INTENSITY8 0x804B +#define GL_INTENSITY12 0x804C +#define GL_INTENSITY16 0x804D +#define GL_R3_G3_B2 0x2A10 +#define GL_RGB4 0x804F +#define GL_RGB5 0x8050 +#define GL_RGB8 0x8051 +#define GL_RGB10 0x8052 +#define GL_RGB12 0x8053 +#define GL_RGB16 0x8054 +#define GL_RGBA2 0x8055 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA8 0x8058 +#define GL_RGB10_A2 0x8059 +#define GL_RGBA12 0x805A +#define GL_RGBA16 0x805B +#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 +#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 +#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF +#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF + + + +/* + * Miscellaneous + */ + +GLAPI void GLAPIENTRY glClearIndex( GLfloat c ); + +GLAPI void GLAPIENTRY glClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY glClear( GLbitfield mask ); + +GLAPI void GLAPIENTRY glIndexMask( GLuint mask ); + +GLAPI void GLAPIENTRY glColorMask( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); + +GLAPI void GLAPIENTRY glAlphaFunc( GLenum func, GLclampf ref ); + +GLAPI void GLAPIENTRY glBlendFunc( GLenum sfactor, GLenum dfactor ); + +GLAPI void GLAPIENTRY glLogicOp( GLenum opcode ); + +GLAPI void GLAPIENTRY glCullFace( GLenum mode ); + +GLAPI void GLAPIENTRY glFrontFace( GLenum mode ); + +GLAPI void GLAPIENTRY glPointSize( GLfloat size ); + +GLAPI void GLAPIENTRY glLineWidth( GLfloat width ); + +GLAPI void GLAPIENTRY glLineStipple( GLint factor, GLushort pattern ); + +GLAPI void GLAPIENTRY glPolygonMode( GLenum face, GLenum mode ); + +GLAPI void GLAPIENTRY glPolygonOffset( GLfloat factor, GLfloat units ); + +GLAPI void GLAPIENTRY glPolygonStipple( const GLubyte *mask ); + +GLAPI void GLAPIENTRY glGetPolygonStipple( GLubyte *mask ); + +GLAPI void GLAPIENTRY glEdgeFlag( GLboolean flag ); + +GLAPI void GLAPIENTRY glEdgeFlagv( const GLboolean *flag ); + +GLAPI void GLAPIENTRY glScissor( GLint x, GLint y, GLsizei width, GLsizei height); + +GLAPI void GLAPIENTRY glClipPlane( GLenum plane, const GLdouble *equation ); + +GLAPI void GLAPIENTRY glGetClipPlane( GLenum plane, GLdouble *equation ); + +GLAPI void GLAPIENTRY glDrawBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glReadBuffer( GLenum mode ); + +GLAPI void GLAPIENTRY glEnable( GLenum cap ); + +GLAPI void GLAPIENTRY glDisable( GLenum cap ); + +GLAPI GLboolean GLAPIENTRY glIsEnabled( GLenum cap ); + + +GLAPI void GLAPIENTRY glEnableClientState( GLenum cap ); /* 1.1 */ + +GLAPI void GLAPIENTRY glDisableClientState( GLenum cap ); /* 1.1 */ + + +GLAPI void GLAPIENTRY glGetBooleanv( GLenum pname, GLboolean *params ); + +GLAPI void GLAPIENTRY glGetDoublev( GLenum pname, GLdouble *params ); + +GLAPI void GLAPIENTRY glGetFloatv( GLenum pname, GLfloat *params ); + +GLAPI void GLAPIENTRY glGetIntegerv( GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glPushAttrib( GLbitfield mask ); + +GLAPI void GLAPIENTRY glPopAttrib( void ); + + +GLAPI void GLAPIENTRY glPushClientAttrib( GLbitfield mask ); /* 1.1 */ + +GLAPI void GLAPIENTRY glPopClientAttrib( void ); /* 1.1 */ + + +GLAPI GLint GLAPIENTRY glRenderMode( GLenum mode ); + +GLAPI GLenum GLAPIENTRY glGetError( void ); + +GLAPI const GLubyte * GLAPIENTRY glGetString( GLenum name ); + +GLAPI void GLAPIENTRY glFinish( void ); + +GLAPI void GLAPIENTRY glFlush( void ); + +GLAPI void GLAPIENTRY glHint( GLenum target, GLenum mode ); + + +/* + * Depth Buffer + */ + +GLAPI void GLAPIENTRY glClearDepth( GLclampd depth ); + +GLAPI void GLAPIENTRY glDepthFunc( GLenum func ); + +GLAPI void GLAPIENTRY glDepthMask( GLboolean flag ); + +GLAPI void GLAPIENTRY glDepthRange( GLclampd near_val, GLclampd far_val ); + + +/* + * Accumulation Buffer + */ + +GLAPI void GLAPIENTRY glClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); + +GLAPI void GLAPIENTRY glAccum( GLenum op, GLfloat value ); + + +/* + * Transformation + */ + +GLAPI void GLAPIENTRY glMatrixMode( GLenum mode ); + +GLAPI void GLAPIENTRY glOrtho( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glFrustum( GLdouble left, GLdouble right, + GLdouble bottom, GLdouble top, + GLdouble near_val, GLdouble far_val ); + +GLAPI void GLAPIENTRY glViewport( GLint x, GLint y, + GLsizei width, GLsizei height ); + +GLAPI void GLAPIENTRY glPushMatrix( void ); + +GLAPI void GLAPIENTRY glPopMatrix( void ); + +GLAPI void GLAPIENTRY glLoadIdentity( void ); + +GLAPI void GLAPIENTRY glLoadMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glLoadMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glMultMatrixd( const GLdouble *m ); +GLAPI void GLAPIENTRY glMultMatrixf( const GLfloat *m ); + +GLAPI void GLAPIENTRY glRotated( GLdouble angle, + GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRotatef( GLfloat angle, + GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glScaled( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glScalef( GLfloat x, GLfloat y, GLfloat z ); + +GLAPI void GLAPIENTRY glTranslated( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glTranslatef( GLfloat x, GLfloat y, GLfloat z ); + + +/* + * Display Lists + */ + +GLAPI GLboolean GLAPIENTRY glIsList( GLuint list ); + +GLAPI void GLAPIENTRY glDeleteLists( GLuint list, GLsizei range ); + +GLAPI GLuint GLAPIENTRY glGenLists( GLsizei range ); + +GLAPI void GLAPIENTRY glNewList( GLuint list, GLenum mode ); + +GLAPI void GLAPIENTRY glEndList( void ); + +GLAPI void GLAPIENTRY glCallList( GLuint list ); + +GLAPI void GLAPIENTRY glCallLists( GLsizei n, GLenum type, + const GLvoid *lists ); + +GLAPI void GLAPIENTRY glListBase( GLuint base ); + + +/* + * Drawing Functions + */ + +GLAPI void GLAPIENTRY glBegin( GLenum mode ); + +GLAPI void GLAPIENTRY glEnd( void ); + + +GLAPI void GLAPIENTRY glVertex2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glVertex2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glVertex2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glVertex2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glVertex3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glVertex3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glVertex3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glVertex3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glVertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glVertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glVertex4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glVertex2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex2iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex3iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glVertex4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glVertex4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glVertex4iv( const GLint *v ); +GLAPI void GLAPIENTRY glVertex4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glNormal3b( GLbyte nx, GLbyte ny, GLbyte nz ); +GLAPI void GLAPIENTRY glNormal3d( GLdouble nx, GLdouble ny, GLdouble nz ); +GLAPI void GLAPIENTRY glNormal3f( GLfloat nx, GLfloat ny, GLfloat nz ); +GLAPI void GLAPIENTRY glNormal3i( GLint nx, GLint ny, GLint nz ); +GLAPI void GLAPIENTRY glNormal3s( GLshort nx, GLshort ny, GLshort nz ); + +GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glNormal3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glNormal3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glNormal3iv( const GLint *v ); +GLAPI void GLAPIENTRY glNormal3sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glIndexd( GLdouble c ); +GLAPI void GLAPIENTRY glIndexf( GLfloat c ); +GLAPI void GLAPIENTRY glIndexi( GLint c ); +GLAPI void GLAPIENTRY glIndexs( GLshort c ); +GLAPI void GLAPIENTRY glIndexub( GLubyte c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glIndexdv( const GLdouble *c ); +GLAPI void GLAPIENTRY glIndexfv( const GLfloat *c ); +GLAPI void GLAPIENTRY glIndexiv( const GLint *c ); +GLAPI void GLAPIENTRY glIndexsv( const GLshort *c ); +GLAPI void GLAPIENTRY glIndexubv( const GLubyte *c ); /* 1.1 */ + +GLAPI void GLAPIENTRY glColor3b( GLbyte red, GLbyte green, GLbyte blue ); +GLAPI void GLAPIENTRY glColor3d( GLdouble red, GLdouble green, GLdouble blue ); +GLAPI void GLAPIENTRY glColor3f( GLfloat red, GLfloat green, GLfloat blue ); +GLAPI void GLAPIENTRY glColor3i( GLint red, GLint green, GLint blue ); +GLAPI void GLAPIENTRY glColor3s( GLshort red, GLshort green, GLshort blue ); +GLAPI void GLAPIENTRY glColor3ub( GLubyte red, GLubyte green, GLubyte blue ); +GLAPI void GLAPIENTRY glColor3ui( GLuint red, GLuint green, GLuint blue ); +GLAPI void GLAPIENTRY glColor3us( GLushort red, GLushort green, GLushort blue ); + +GLAPI void GLAPIENTRY glColor4b( GLbyte red, GLbyte green, + GLbyte blue, GLbyte alpha ); +GLAPI void GLAPIENTRY glColor4d( GLdouble red, GLdouble green, + GLdouble blue, GLdouble alpha ); +GLAPI void GLAPIENTRY glColor4f( GLfloat red, GLfloat green, + GLfloat blue, GLfloat alpha ); +GLAPI void GLAPIENTRY glColor4i( GLint red, GLint green, + GLint blue, GLint alpha ); +GLAPI void GLAPIENTRY glColor4s( GLshort red, GLshort green, + GLshort blue, GLshort alpha ); +GLAPI void GLAPIENTRY glColor4ub( GLubyte red, GLubyte green, + GLubyte blue, GLubyte alpha ); +GLAPI void GLAPIENTRY glColor4ui( GLuint red, GLuint green, + GLuint blue, GLuint alpha ); +GLAPI void GLAPIENTRY glColor4us( GLushort red, GLushort green, + GLushort blue, GLushort alpha ); + + +GLAPI void GLAPIENTRY glColor3bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor3iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor3sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor3ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor3uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor3usv( const GLushort *v ); + +GLAPI void GLAPIENTRY glColor4bv( const GLbyte *v ); +GLAPI void GLAPIENTRY glColor4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glColor4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glColor4iv( const GLint *v ); +GLAPI void GLAPIENTRY glColor4sv( const GLshort *v ); +GLAPI void GLAPIENTRY glColor4ubv( const GLubyte *v ); +GLAPI void GLAPIENTRY glColor4uiv( const GLuint *v ); +GLAPI void GLAPIENTRY glColor4usv( const GLushort *v ); + + +GLAPI void GLAPIENTRY glTexCoord1d( GLdouble s ); +GLAPI void GLAPIENTRY glTexCoord1f( GLfloat s ); +GLAPI void GLAPIENTRY glTexCoord1i( GLint s ); +GLAPI void GLAPIENTRY glTexCoord1s( GLshort s ); + +GLAPI void GLAPIENTRY glTexCoord2d( GLdouble s, GLdouble t ); +GLAPI void GLAPIENTRY glTexCoord2f( GLfloat s, GLfloat t ); +GLAPI void GLAPIENTRY glTexCoord2i( GLint s, GLint t ); +GLAPI void GLAPIENTRY glTexCoord2s( GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY glTexCoord3d( GLdouble s, GLdouble t, GLdouble r ); +GLAPI void GLAPIENTRY glTexCoord3f( GLfloat s, GLfloat t, GLfloat r ); +GLAPI void GLAPIENTRY glTexCoord3i( GLint s, GLint t, GLint r ); +GLAPI void GLAPIENTRY glTexCoord3s( GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY glTexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); +GLAPI void GLAPIENTRY glTexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); +GLAPI void GLAPIENTRY glTexCoord4i( GLint s, GLint t, GLint r, GLint q ); +GLAPI void GLAPIENTRY glTexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY glTexCoord1dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord1fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord1iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord1sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord2iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord3iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glTexCoord4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glTexCoord4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glTexCoord4iv( const GLint *v ); +GLAPI void GLAPIENTRY glTexCoord4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRasterPos2d( GLdouble x, GLdouble y ); +GLAPI void GLAPIENTRY glRasterPos2f( GLfloat x, GLfloat y ); +GLAPI void GLAPIENTRY glRasterPos2i( GLint x, GLint y ); +GLAPI void GLAPIENTRY glRasterPos2s( GLshort x, GLshort y ); + +GLAPI void GLAPIENTRY glRasterPos3d( GLdouble x, GLdouble y, GLdouble z ); +GLAPI void GLAPIENTRY glRasterPos3f( GLfloat x, GLfloat y, GLfloat z ); +GLAPI void GLAPIENTRY glRasterPos3i( GLint x, GLint y, GLint z ); +GLAPI void GLAPIENTRY glRasterPos3s( GLshort x, GLshort y, GLshort z ); + +GLAPI void GLAPIENTRY glRasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); +GLAPI void GLAPIENTRY glRasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); +GLAPI void GLAPIENTRY glRasterPos4i( GLint x, GLint y, GLint z, GLint w ); +GLAPI void GLAPIENTRY glRasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w ); + +GLAPI void GLAPIENTRY glRasterPos2dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos2fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos2iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos2sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos3dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos3fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos3iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos3sv( const GLshort *v ); + +GLAPI void GLAPIENTRY glRasterPos4dv( const GLdouble *v ); +GLAPI void GLAPIENTRY glRasterPos4fv( const GLfloat *v ); +GLAPI void GLAPIENTRY glRasterPos4iv( const GLint *v ); +GLAPI void GLAPIENTRY glRasterPos4sv( const GLshort *v ); + + +GLAPI void GLAPIENTRY glRectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); +GLAPI void GLAPIENTRY glRectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); +GLAPI void GLAPIENTRY glRecti( GLint x1, GLint y1, GLint x2, GLint y2 ); +GLAPI void GLAPIENTRY glRects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); + + +GLAPI void GLAPIENTRY glRectdv( const GLdouble *v1, const GLdouble *v2 ); +GLAPI void GLAPIENTRY glRectfv( const GLfloat *v1, const GLfloat *v2 ); +GLAPI void GLAPIENTRY glRectiv( const GLint *v1, const GLint *v2 ); +GLAPI void GLAPIENTRY glRectsv( const GLshort *v1, const GLshort *v2 ); + + +/* + * Vertex Arrays (1.1) + */ + +GLAPI void GLAPIENTRY glVertexPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glNormalPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glColorPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glIndexPointer( GLenum type, GLsizei stride, + const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glTexCoordPointer( GLint size, GLenum type, + GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glEdgeFlagPointer( GLsizei stride, const GLvoid *ptr ); + +GLAPI void GLAPIENTRY glGetPointerv( GLenum pname, GLvoid **params ); + +GLAPI void GLAPIENTRY glArrayElement( GLint i ); + +GLAPI void GLAPIENTRY glDrawArrays( GLenum mode, GLint first, GLsizei count ); + +GLAPI void GLAPIENTRY glDrawElements( GLenum mode, GLsizei count, + GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glInterleavedArrays( GLenum format, GLsizei stride, + const GLvoid *pointer ); + +/* + * Lighting + */ + +GLAPI void GLAPIENTRY glShadeModel( GLenum mode ); + +GLAPI void GLAPIENTRY glLightf( GLenum light, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLighti( GLenum light, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightfv( GLenum light, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glLightiv( GLenum light, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetLightfv( GLenum light, GLenum pname, + GLfloat *params ); +GLAPI void GLAPIENTRY glGetLightiv( GLenum light, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glLightModelf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glLightModeli( GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glLightModelfv( GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glLightModeliv( GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glMaterialf( GLenum face, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glMateriali( GLenum face, GLenum pname, GLint param ); +GLAPI void GLAPIENTRY glMaterialfv( GLenum face, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glMaterialiv( GLenum face, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetMaterialfv( GLenum face, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetMaterialiv( GLenum face, GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glColorMaterial( GLenum face, GLenum mode ); + + +/* + * Raster functions + */ + +GLAPI void GLAPIENTRY glPixelZoom( GLfloat xfactor, GLfloat yfactor ); + +GLAPI void GLAPIENTRY glPixelStoref( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelStorei( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelTransferf( GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glPixelTransferi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glPixelMapfv( GLenum map, GLsizei mapsize, + const GLfloat *values ); +GLAPI void GLAPIENTRY glPixelMapuiv( GLenum map, GLsizei mapsize, + const GLuint *values ); +GLAPI void GLAPIENTRY glPixelMapusv( GLenum map, GLsizei mapsize, + const GLushort *values ); + +GLAPI void GLAPIENTRY glGetPixelMapfv( GLenum map, GLfloat *values ); +GLAPI void GLAPIENTRY glGetPixelMapuiv( GLenum map, GLuint *values ); +GLAPI void GLAPIENTRY glGetPixelMapusv( GLenum map, GLushort *values ); + +GLAPI void GLAPIENTRY glBitmap( GLsizei width, GLsizei height, + GLfloat xorig, GLfloat yorig, + GLfloat xmove, GLfloat ymove, + const GLubyte *bitmap ); + +GLAPI void GLAPIENTRY glReadPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLvoid *pixels ); + +GLAPI void GLAPIENTRY glDrawPixels( GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glCopyPixels( GLint x, GLint y, + GLsizei width, GLsizei height, + GLenum type ); + +/* + * Stenciling + */ + +GLAPI void GLAPIENTRY glStencilFunc( GLenum func, GLint ref, GLuint mask ); + +GLAPI void GLAPIENTRY glStencilMask( GLuint mask ); + +GLAPI void GLAPIENTRY glStencilOp( GLenum fail, GLenum zfail, GLenum zpass ); + +GLAPI void GLAPIENTRY glClearStencil( GLint s ); + + + +/* + * Texture mapping + */ + +GLAPI void GLAPIENTRY glTexGend( GLenum coord, GLenum pname, GLdouble param ); +GLAPI void GLAPIENTRY glTexGenf( GLenum coord, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexGeni( GLenum coord, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexGendv( GLenum coord, GLenum pname, const GLdouble *params ); +GLAPI void GLAPIENTRY glTexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexGeniv( GLenum coord, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); +GLAPI void GLAPIENTRY glGetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexGeniv( GLenum coord, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexEnvf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexEnvi( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexEnvfv( GLenum target, GLenum pname, const GLfloat *params ); +GLAPI void GLAPIENTRY glTexEnviv( GLenum target, GLenum pname, const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexEnvfv( GLenum target, GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexEnviv( GLenum target, GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexParameterf( GLenum target, GLenum pname, GLfloat param ); +GLAPI void GLAPIENTRY glTexParameteri( GLenum target, GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glTexParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); +GLAPI void GLAPIENTRY glTexParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glGetTexParameterfv( GLenum target, + GLenum pname, GLfloat *params); +GLAPI void GLAPIENTRY glGetTexParameteriv( GLenum target, + GLenum pname, GLint *params ); + +GLAPI void GLAPIENTRY glGetTexLevelParameterfv( GLenum target, GLint level, + GLenum pname, GLfloat *params ); +GLAPI void GLAPIENTRY glGetTexLevelParameteriv( GLenum target, GLint level, + GLenum pname, GLint *params ); + + +GLAPI void GLAPIENTRY glTexImage1D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexImage2D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glGetTexImage( GLenum target, GLint level, + GLenum format, GLenum type, + GLvoid *pixels ); + + +/* 1.1 functions */ + +GLAPI void GLAPIENTRY glGenTextures( GLsizei n, GLuint *textures ); + +GLAPI void GLAPIENTRY glDeleteTextures( GLsizei n, const GLuint *textures); + +GLAPI void GLAPIENTRY glBindTexture( GLenum target, GLuint texture ); + +GLAPI void GLAPIENTRY glPrioritizeTextures( GLsizei n, + const GLuint *textures, + const GLclampf *priorities ); + +GLAPI GLboolean GLAPIENTRY glAreTexturesResident( GLsizei n, + const GLuint *textures, + GLboolean *residences ); + +GLAPI GLboolean GLAPIENTRY glIsTexture( GLuint texture ); + + +GLAPI void GLAPIENTRY glTexSubImage1D( GLenum target, GLint level, + GLint xoffset, + GLsizei width, GLenum format, + GLenum type, const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels ); + + +GLAPI void GLAPIENTRY glCopyTexImage1D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexImage2D( GLenum target, GLint level, + GLenum internalformat, + GLint x, GLint y, + GLsizei width, GLsizei height, + GLint border ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage1D( GLenum target, GLint level, + GLint xoffset, GLint x, GLint y, + GLsizei width ); + + +GLAPI void GLAPIENTRY glCopyTexSubImage2D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height ); + + +/* + * Evaluators + */ + +GLAPI void GLAPIENTRY glMap1d( GLenum target, GLdouble u1, GLdouble u2, + GLint stride, + GLint order, const GLdouble *points ); +GLAPI void GLAPIENTRY glMap1f( GLenum target, GLfloat u1, GLfloat u2, + GLint stride, + GLint order, const GLfloat *points ); + +GLAPI void GLAPIENTRY glMap2d( GLenum target, + GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, + GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, + const GLdouble *points ); +GLAPI void GLAPIENTRY glMap2f( GLenum target, + GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, + GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, + const GLfloat *points ); + +GLAPI void GLAPIENTRY glGetMapdv( GLenum target, GLenum query, GLdouble *v ); +GLAPI void GLAPIENTRY glGetMapfv( GLenum target, GLenum query, GLfloat *v ); +GLAPI void GLAPIENTRY glGetMapiv( GLenum target, GLenum query, GLint *v ); + +GLAPI void GLAPIENTRY glEvalCoord1d( GLdouble u ); +GLAPI void GLAPIENTRY glEvalCoord1f( GLfloat u ); + +GLAPI void GLAPIENTRY glEvalCoord1dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord1fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glEvalCoord2d( GLdouble u, GLdouble v ); +GLAPI void GLAPIENTRY glEvalCoord2f( GLfloat u, GLfloat v ); + +GLAPI void GLAPIENTRY glEvalCoord2dv( const GLdouble *u ); +GLAPI void GLAPIENTRY glEvalCoord2fv( const GLfloat *u ); + +GLAPI void GLAPIENTRY glMapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); +GLAPI void GLAPIENTRY glMapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); + +GLAPI void GLAPIENTRY glMapGrid2d( GLint un, GLdouble u1, GLdouble u2, + GLint vn, GLdouble v1, GLdouble v2 ); +GLAPI void GLAPIENTRY glMapGrid2f( GLint un, GLfloat u1, GLfloat u2, + GLint vn, GLfloat v1, GLfloat v2 ); + +GLAPI void GLAPIENTRY glEvalPoint1( GLint i ); + +GLAPI void GLAPIENTRY glEvalPoint2( GLint i, GLint j ); + +GLAPI void GLAPIENTRY glEvalMesh1( GLenum mode, GLint i1, GLint i2 ); + +GLAPI void GLAPIENTRY glEvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); + + +/* + * Fog + */ + +GLAPI void GLAPIENTRY glFogf( GLenum pname, GLfloat param ); + +GLAPI void GLAPIENTRY glFogi( GLenum pname, GLint param ); + +GLAPI void GLAPIENTRY glFogfv( GLenum pname, const GLfloat *params ); + +GLAPI void GLAPIENTRY glFogiv( GLenum pname, const GLint *params ); + + +/* + * Selection and Feedback + */ + +GLAPI void GLAPIENTRY glFeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); + +GLAPI void GLAPIENTRY glPassThrough( GLfloat token ); + +GLAPI void GLAPIENTRY glSelectBuffer( GLsizei size, GLuint *buffer ); + +GLAPI void GLAPIENTRY glInitNames( void ); + +GLAPI void GLAPIENTRY glLoadName( GLuint name ); + +GLAPI void GLAPIENTRY glPushName( GLuint name ); + +GLAPI void GLAPIENTRY glPopName( void ); + + + +/* + * OpenGL 1.2 + */ + +#define GL_RESCALE_NORMAL 0x803A +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_TEXTURE_BINDING_3D 0x806A + +GLAPI void GLAPIENTRY glDrawRangeElements( GLenum mode, GLuint start, + GLuint end, GLsizei count, GLenum type, const GLvoid *indices ); + +GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level, + GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLsizei width, + GLsizei height, GLsizei depth, + GLenum format, + GLenum type, const GLvoid *pixels); + +GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint zoffset, GLint x, + GLint y, GLsizei width, + GLsizei height ); + +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); + + +/* + * GL_ARB_imaging + */ + +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_BLEND_EQUATION 0x8009 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_COLOR 0x8005 + + +GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, + GLenum type, const GLvoid *table ); + +GLAPI void GLAPIENTRY glColorSubTable( GLenum target, + GLsizei start, GLsizei count, + GLenum format, GLenum type, + const GLvoid *data ); + +GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname, + const GLint *params); + +GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname, + const GLfloat *params); + +GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format, + GLenum type, GLvoid *table ); + +GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glBlendEquation( GLenum mode ); + +GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green, + GLclampf blue, GLclampf alpha ); + +GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width, + GLenum internalformat, GLboolean sink ); + +GLAPI void GLAPIENTRY glResetHistogram( GLenum target ); + +GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset, + GLenum format, GLenum type, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat, + GLboolean sink ); + +GLAPI void GLAPIENTRY glResetMinmax( GLenum target ); + +GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset, + GLenum format, GLenum types, + GLvoid *values ); + +GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target, + GLenum internalformat, GLsizei width, GLenum format, GLenum type, + const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *image ); + +GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname, + GLfloat params ); + +GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname, + const GLfloat *params ); + +GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname, + GLint params ); + +GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname, + const GLint *params ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width ); + +GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target, + GLenum internalformat, GLint x, GLint y, GLsizei width, + GLsizei height); + +GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format, + GLenum type, GLvoid *image ); + +GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname, + GLfloat *params ); + +GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname, + GLint *params ); + +GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target, + GLenum internalformat, GLsizei width, GLsizei height, GLenum format, + GLenum type, const GLvoid *row, const GLvoid *column ); + +GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format, + GLenum type, GLvoid *row, GLvoid *column, GLvoid *span ); + +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); + + + +/* + * OpenGL 1.3 + */ + +/* multitexture */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +/* texture_cube_map */ +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +/* texture_compression */ +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +/* multisample */ +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_MULTISAMPLE_BIT 0x20000000 +/* transpose_matrix */ +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +/* texture_env_combine */ +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +/* texture_env_dot3 */ +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +/* texture_border_clamp */ +#define GL_CLAMP_TO_BORDER 0x812D + +GLAPI void GLAPIENTRY glActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY glClientActiveTexture( GLenum texture ); + +GLAPI void GLAPIENTRY glCompressedTexImage1D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexImage2D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexImage3D( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ); + +GLAPI void GLAPIENTRY glCompressedTexSubImage3D( 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 GLAPIENTRY glGetCompressedTexImage( GLenum target, GLint lod, GLvoid *img ); + +GLAPI void GLAPIENTRY glMultiTexCoord1d( GLenum target, GLdouble s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord1f( GLenum target, GLfloat s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord1i( GLenum target, GLint s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord1s( GLenum target, GLshort s ); + +GLAPI void GLAPIENTRY glMultiTexCoord1sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2d( GLenum target, GLdouble s, GLdouble t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2f( GLenum target, GLfloat s, GLfloat t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2i( GLenum target, GLint s, GLint t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord2s( GLenum target, GLshort s, GLshort t ); + +GLAPI void GLAPIENTRY glMultiTexCoord2sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3d( GLenum target, GLdouble s, GLdouble t, GLdouble r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3f( GLenum target, GLfloat s, GLfloat t, GLfloat r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3i( GLenum target, GLint s, GLint t, GLint r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord3s( GLenum target, GLshort s, GLshort t, GLshort r ); + +GLAPI void GLAPIENTRY glMultiTexCoord3sv( GLenum target, const GLshort *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4d( GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4dv( GLenum target, const GLdouble *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4f( GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4fv( GLenum target, const GLfloat *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4i( GLenum target, GLint s, GLint t, GLint r, GLint q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4iv( GLenum target, const GLint *v ); + +GLAPI void GLAPIENTRY glMultiTexCoord4s( GLenum target, GLshort s, GLshort t, GLshort r, GLshort q ); + +GLAPI void GLAPIENTRY glMultiTexCoord4sv( GLenum target, const GLshort *v ); + + +GLAPI void GLAPIENTRY glLoadTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY glLoadTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY glMultTransposeMatrixd( const GLdouble m[16] ); + +GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] ); + +GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert ); + + +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (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 (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); + + + +/* + * 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); + +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); + +#endif /* GL_ARB_multitexture */ + + + +/* + * Define this token if you want "old-style" header file behaviour (extensions + * defined in gl.h). Otherwise, extensions will be included from glext.h. + */ +#if defined(GL_GLEXT_LEGACY) + +/* All extensions that used to be here are now found in glext.h */ + +#else /* GL_GLEXT_LEGACY */ + +#include + +#endif /* GL_GLEXT_LEGACY */ + + + +#if GL_ARB_shader_objects + +#ifndef GL_MESA_shader_debug +#define GL_MESA_shader_debug 1 + +#define GL_DEBUG_OBJECT_MESA 0x8759 +#define GL_DEBUG_PRINT_MESA 0x875A +#define GL_DEBUG_ASSERT_MESA 0x875B + +GLAPI GLhandleARB GLAPIENTRY glCreateDebugObjectMESA (void); +GLAPI void GLAPIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); +GLAPI void GLAPIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength, + GLsizei *length, GLcharARB *debugLog); +GLAPI GLsizei GLAPIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType); + +#endif /* GL_MESA_shader_debug */ + +#endif /* GL_ARB_shader_objects */ + + +/* + * ???. GL_MESA_packed_depth_stencil + * XXX obsolete + */ +#ifndef GL_MESA_packed_depth_stencil +#define GL_MESA_packed_depth_stencil 1 + +#define GL_DEPTH_STENCIL_MESA 0x8750 +#define GL_UNSIGNED_INT_24_8_MESA 0x8751 +#define GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 +#define GL_UNSIGNED_SHORT_15_1_MESA 0x8753 +#define GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 + +#endif /* GL_MESA_packed_depth_stencil */ + + +#ifndef GL_MESA_program_debug +#define GL_MESA_program_debug 1 + +#define GL_FRAGMENT_PROGRAM_POSITION_MESA 0x8bb0 +#define GL_FRAGMENT_PROGRAM_CALLBACK_MESA 0x8bb1 +#define GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x8bb2 +#define GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x8bb3 +#define GL_VERTEX_PROGRAM_POSITION_MESA 0x8bb4 +#define GL_VERTEX_PROGRAM_CALLBACK_MESA 0x8bb5 +#define GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x8bb6 +#define GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x8bb7 + +typedef void (*GLprogramcallbackMESA)(GLenum target, GLvoid *data); + +GLAPI void GLAPIENTRY glProgramCallbackMESA(GLenum target, GLprogramcallbackMESA callback, GLvoid *data); + +GLAPI void GLAPIENTRY glGetProgramRegisterfvMESA(GLenum target, GLsizei len, const GLubyte *name, GLfloat *v); + +#endif /* GL_MESA_program_debug */ + + +#ifndef GL_MESA_texture_array +#define GL_MESA_texture_array 1 + +/* GL_MESA_texture_array uses the same enum values as GL_EXT_texture_array. + */ +#ifndef GL_EXT_texture_array + +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFramebufferTextureLayerEXT(GLenum target, + GLenum attachment, GLuint texture, GLint level, GLint layer); +#endif /* GL_GLEXT_PROTOTYPES */ + +#if 0 +/* (temporarily) disabled because of collision with typedef in glext.h + * that happens if apps include both gl.h and glext.h + */ +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, + GLenum attachment, GLuint texture, GLint level, GLint layer); +#endif + +#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 +#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D +#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 +#endif + +#endif + + +#ifndef GL_ATI_blend_equation_separate +#define GL_ATI_blend_equation_separate 1 + +#define GL_ALPHA_BLEND_EQUATION_ATI 0x883D + +GLAPI void GLAPIENTRY glBlendEquationSeparateATI( GLenum modeRGB, GLenum modeA ); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEATIPROC) (GLenum modeRGB, GLenum modeA); + +#endif /* GL_ATI_blend_equation_separate */ + + + +/** + ** NOTE!!!!! If you add new functions to this file, or update + ** glext.h be sure to regenerate the gl_mangle.h file. See comments + ** in that file for details. + **/ + + + +/********************************************************************** + * Begin system-specific stuff + */ +#if defined(PRAGMA_EXPORT_SUPPORTED) +#pragma export off +#endif + +#if defined(macintosh) && PRAGMA_IMPORT_SUPPORTED +#pragma import off +#endif +/* + * End system-specific stuff + **********************************************************************/ + + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ diff --git a/mesalib/include/GL/gl_mangle.h b/mesalib/include/GL/gl_mangle.h new file mode 100644 index 000000000..54147f733 --- /dev/null +++ b/mesalib/include/GL/gl_mangle.h @@ -0,0 +1,1898 @@ +#if 0 +#define GL_MANGLE_C1 "DO NOT EDIT!!! - TO REGENERATE from gl.h, EXECUTE THIS FILE IN SHELL (/bin/sh) and save the output" +#define GL_MANGLE_C2 "This file is used to create GL function protypes and aliases for the function names" + files="gl.h glext.h" +#define GL_MANGLE_C3 "get regeneration header - copy everything in this file above the 'REGENERATE_TO_END' line" + awk '!done; /^\/\*REGENERATE_TO_END/ {done=1}' $0 + echo "" +#define GL_MANGLE_C4 get aliases + grep '^GLAPI' $files | sed -e 's/.*ENTRY gl\([^( ]*\).*$/#define gl\1 MANGLE(\1)/' | sort | uniq + echo "" + echo "#endif /* GL_MANGLE_H */" + exit +#endif /* REGENERATION */ + +/* + * If you compile Mesa with USE_MGL_NAMESPACE defined then you can link + * your application both with OpenGL and Mesa. The Mesa functions will + * be redefined so they are prefixed with "mgl" instead of "gl". + * Mgl contributed by Randy Frank (rfrank@rsinc.com) + * Regneration code contributed by Ray Tice (rayt@ma.ultra.net) + */ + +#ifndef GL_MANGLE_H +#define GL_MANGLE_H + +#ifndef MANGLE +#define MANGLE(x) mgl##x +#endif /*MANGLE*/ + +/*REGENERATE_TO_END-----------ALL LINES BELOW HERE GET REPLACED ON REGENERATION */ + +#define glAccum MANGLE(Accum) +#define glActiveStencilFaceEXT MANGLE(ActiveStencilFaceEXT) +#define glActiveTextureARB MANGLE(ActiveTextureARB) +#define glActiveTexture MANGLE(ActiveTexture) +#define glActiveVaryingNV MANGLE(ActiveVaryingNV) +#define glAlphaFragmentOp1ATI MANGLE(AlphaFragmentOp1ATI) +#define glAlphaFragmentOp2ATI MANGLE(AlphaFragmentOp2ATI) +#define glAlphaFragmentOp3ATI MANGLE(AlphaFragmentOp3ATI) +#define glAlphaFunc MANGLE(AlphaFunc) +#define glApplyTextureEXT MANGLE(ApplyTextureEXT) +#define glAreProgramsResidentNV MANGLE(AreProgramsResidentNV) +#define glAreTexturesResidentEXT MANGLE(AreTexturesResidentEXT) +#define glAreTexturesResident MANGLE(AreTexturesResident) +#define glArrayElementEXT MANGLE(ArrayElementEXT) +#define glArrayElement MANGLE(ArrayElement) +#define glArrayObjectATI MANGLE(ArrayObjectATI) +#define glAsyncMarkerSGIX MANGLE(AsyncMarkerSGIX) +#define glAttachObjectARB MANGLE(AttachObjectARB) +#define glAttachShader MANGLE(AttachShader) +#define glBeginConditionalRender MANGLE(BeginConditionalRender) +#define glBeginConditionalRenderNV MANGLE(BeginConditionalRenderNV) +#define glBeginFragmentShaderATI MANGLE(BeginFragmentShaderATI) +#define glBegin MANGLE(Begin) +#define glBeginOcclusionQueryNV MANGLE(BeginOcclusionQueryNV) +#define glBeginPerfMonitorAMD MANGLE(BeginPerfMonitorAMD) +#define glBeginQueryARB MANGLE(BeginQueryARB) +#define glBeginQuery MANGLE(BeginQuery) +#define glBeginTransformFeedbackEXT MANGLE(BeginTransformFeedbackEXT) +#define glBeginTransformFeedback MANGLE(BeginTransformFeedback) +#define glBeginTransformFeedbackNV MANGLE(BeginTransformFeedbackNV) +#define glBeginVertexShaderEXT MANGLE(BeginVertexShaderEXT) +#define glBindAttribLocationARB MANGLE(BindAttribLocationARB) +#define glBindAttribLocation MANGLE(BindAttribLocation) +#define glBindBufferARB MANGLE(BindBufferARB) +#define glBindBufferBaseEXT MANGLE(BindBufferBaseEXT) +#define glBindBufferBase MANGLE(BindBufferBase) +#define glBindBufferBaseNV MANGLE(BindBufferBaseNV) +#define glBindBuffer MANGLE(BindBuffer) +#define glBindBufferOffsetEXT MANGLE(BindBufferOffsetEXT) +#define glBindBufferOffsetNV MANGLE(BindBufferOffsetNV) +#define glBindBufferRangeEXT MANGLE(BindBufferRangeEXT) +#define glBindBufferRange MANGLE(BindBufferRange) +#define glBindBufferRangeNV MANGLE(BindBufferRangeNV) +#define glBindFragDataLocationEXT MANGLE(BindFragDataLocationEXT) +#define glBindFragDataLocation MANGLE(BindFragDataLocation) +#define glBindFragmentShaderATI MANGLE(BindFragmentShaderATI) +#define glBindFramebufferEXT MANGLE(BindFramebufferEXT) +#define glBindFramebuffer MANGLE(BindFramebuffer) +#define glBindLightParameterEXT MANGLE(BindLightParameterEXT) +#define glBindMaterialParameterEXT MANGLE(BindMaterialParameterEXT) +#define glBindMultiTextureEXT MANGLE(BindMultiTextureEXT) +#define glBindParameterEXT MANGLE(BindParameterEXT) +#define glBindProgramARB MANGLE(BindProgramARB) +#define glBindProgramNV MANGLE(BindProgramNV) +#define glBindRenderbufferEXT MANGLE(BindRenderbufferEXT) +#define glBindRenderbuffer MANGLE(BindRenderbuffer) +#define glBindTexGenParameterEXT MANGLE(BindTexGenParameterEXT) +#define glBindTextureEXT MANGLE(BindTextureEXT) +#define glBindTexture MANGLE(BindTexture) +#define glBindTextureUnitParameterEXT MANGLE(BindTextureUnitParameterEXT) +#define glBindTransformFeedbackNV MANGLE(BindTransformFeedbackNV) +#define glBindVertexArrayAPPLE MANGLE(BindVertexArrayAPPLE) +#define glBindVertexArray MANGLE(BindVertexArray) +#define glBindVertexShaderEXT MANGLE(BindVertexShaderEXT) +#define glBinormal3bEXT MANGLE(Binormal3bEXT) +#define glBinormal3bvEXT MANGLE(Binormal3bvEXT) +#define glBinormal3dEXT MANGLE(Binormal3dEXT) +#define glBinormal3dvEXT MANGLE(Binormal3dvEXT) +#define glBinormal3fEXT MANGLE(Binormal3fEXT) +#define glBinormal3fvEXT MANGLE(Binormal3fvEXT) +#define glBinormal3iEXT MANGLE(Binormal3iEXT) +#define glBinormal3ivEXT MANGLE(Binormal3ivEXT) +#define glBinormal3sEXT MANGLE(Binormal3sEXT) +#define glBinormal3svEXT MANGLE(Binormal3svEXT) +#define glBinormalPointerEXT MANGLE(BinormalPointerEXT) +#define glBitmap MANGLE(Bitmap) +#define glBlendColorEXT MANGLE(BlendColorEXT) +#define glBlendColor MANGLE(BlendColor) +#define glBlendEquationEXT MANGLE(BlendEquationEXT) +#define glBlendEquation MANGLE(BlendEquation) +#define glBlendEquationSeparateATI MANGLE(BlendEquationSeparateATI) +#define glBlendEquationSeparateEXT MANGLE(BlendEquationSeparateEXT) +#define glBlendEquationSeparate MANGLE(BlendEquationSeparate) +#define glBlendFunc MANGLE(BlendFunc) +#define glBlendFuncSeparateEXT MANGLE(BlendFuncSeparateEXT) +#define glBlendFuncSeparateINGR MANGLE(BlendFuncSeparateINGR) +#define glBlendFuncSeparate MANGLE(BlendFuncSeparate) +#define glBlitFramebufferEXT MANGLE(BlitFramebufferEXT) +#define glBlitFramebuffer MANGLE(BlitFramebuffer) +#define glBufferDataARB MANGLE(BufferDataARB) +#define glBufferData MANGLE(BufferData) +#define glBufferParameteriAPPLE MANGLE(BufferParameteriAPPLE) +#define glBufferSubDataARB MANGLE(BufferSubDataARB) +#define glBufferSubData MANGLE(BufferSubData) +#define glCallList MANGLE(CallList) +#define glCallLists MANGLE(CallLists) +#define glCheckFramebufferStatusEXT MANGLE(CheckFramebufferStatusEXT) +#define glCheckFramebufferStatus MANGLE(CheckFramebufferStatus) +#define glCheckNamedFramebufferStatusEXT MANGLE(CheckNamedFramebufferStatusEXT) +#define glClampColorARB MANGLE(ClampColorARB) +#define glClampColor MANGLE(ClampColor) +#define glClearAccum MANGLE(ClearAccum) +#define glClearBufferfi MANGLE(ClearBufferfi) +#define glClearBufferfv MANGLE(ClearBufferfv) +#define glClearBufferiv MANGLE(ClearBufferiv) +#define glClearBufferuiv MANGLE(ClearBufferuiv) +#define glClearColorIiEXT MANGLE(ClearColorIiEXT) +#define glClearColorIuiEXT MANGLE(ClearColorIuiEXT) +#define glClearColor MANGLE(ClearColor) +#define glClearDebugLogMESA MANGLE(ClearDebugLogMESA) +#define glClearDepthdNV MANGLE(ClearDepthdNV) +#define glClearDepth MANGLE(ClearDepth) +#define glClearIndex MANGLE(ClearIndex) +#define glClear MANGLE(Clear) +#define glClearStencil MANGLE(ClearStencil) +#define glClientActiveTextureARB MANGLE(ClientActiveTextureARB) +#define glClientActiveTexture MANGLE(ClientActiveTexture) +#define glClientActiveVertexStreamATI MANGLE(ClientActiveVertexStreamATI) +#define glClientAttribDefaultEXT MANGLE(ClientAttribDefaultEXT) +#define glClipPlane MANGLE(ClipPlane) +#define glColor3b MANGLE(Color3b) +#define glColor3bv MANGLE(Color3bv) +#define glColor3d MANGLE(Color3d) +#define glColor3dv MANGLE(Color3dv) +#define glColor3f MANGLE(Color3f) +#define glColor3fVertex3fSUN MANGLE(Color3fVertex3fSUN) +#define glColor3fVertex3fvSUN MANGLE(Color3fVertex3fvSUN) +#define glColor3fv MANGLE(Color3fv) +#define glColor3hNV MANGLE(Color3hNV) +#define glColor3hvNV MANGLE(Color3hvNV) +#define glColor3i MANGLE(Color3i) +#define glColor3iv MANGLE(Color3iv) +#define glColor3s MANGLE(Color3s) +#define glColor3sv MANGLE(Color3sv) +#define glColor3ub MANGLE(Color3ub) +#define glColor3ubv MANGLE(Color3ubv) +#define glColor3ui MANGLE(Color3ui) +#define glColor3uiv MANGLE(Color3uiv) +#define glColor3us MANGLE(Color3us) +#define glColor3usv MANGLE(Color3usv) +#define glColor4b MANGLE(Color4b) +#define glColor4bv MANGLE(Color4bv) +#define glColor4d MANGLE(Color4d) +#define glColor4dv MANGLE(Color4dv) +#define glColor4f MANGLE(Color4f) +#define glColor4fNormal3fVertex3fSUN MANGLE(Color4fNormal3fVertex3fSUN) +#define glColor4fNormal3fVertex3fvSUN MANGLE(Color4fNormal3fVertex3fvSUN) +#define glColor4fv MANGLE(Color4fv) +#define glColor4hNV MANGLE(Color4hNV) +#define glColor4hvNV MANGLE(Color4hvNV) +#define glColor4i MANGLE(Color4i) +#define glColor4iv MANGLE(Color4iv) +#define glColor4s MANGLE(Color4s) +#define glColor4sv MANGLE(Color4sv) +#define glColor4ub MANGLE(Color4ub) +#define glColor4ubVertex2fSUN MANGLE(Color4ubVertex2fSUN) +#define glColor4ubVertex2fvSUN MANGLE(Color4ubVertex2fvSUN) +#define glColor4ubVertex3fSUN MANGLE(Color4ubVertex3fSUN) +#define glColor4ubVertex3fvSUN MANGLE(Color4ubVertex3fvSUN) +#define glColor4ubv MANGLE(Color4ubv) +#define glColor4ui MANGLE(Color4ui) +#define glColor4uiv MANGLE(Color4uiv) +#define glColor4us MANGLE(Color4us) +#define glColor4usv MANGLE(Color4usv) +#define glColorFragmentOp1ATI MANGLE(ColorFragmentOp1ATI) +#define glColorFragmentOp2ATI MANGLE(ColorFragmentOp2ATI) +#define glColorFragmentOp3ATI MANGLE(ColorFragmentOp3ATI) +#define glColorMaski MANGLE(ColorMaski) +#define glColorMaskIndexedEXT MANGLE(ColorMaskIndexedEXT) +#define glColorMask MANGLE(ColorMask) +#define glColorMaterial MANGLE(ColorMaterial) +#define glColorPointerEXT MANGLE(ColorPointerEXT) +#define glColorPointerListIBM MANGLE(ColorPointerListIBM) +#define glColorPointer MANGLE(ColorPointer) +#define glColorPointervINTEL MANGLE(ColorPointervINTEL) +#define glColorSubTableEXT MANGLE(ColorSubTableEXT) +#define glColorSubTable MANGLE(ColorSubTable) +#define glColorTableEXT MANGLE(ColorTableEXT) +#define glColorTable MANGLE(ColorTable) +#define glColorTableParameterfv MANGLE(ColorTableParameterfv) +#define glColorTableParameterfvSGI MANGLE(ColorTableParameterfvSGI) +#define glColorTableParameteriv MANGLE(ColorTableParameteriv) +#define glColorTableParameterivSGI MANGLE(ColorTableParameterivSGI) +#define glColorTableSGI MANGLE(ColorTableSGI) +#define glCombinerInputNV MANGLE(CombinerInputNV) +#define glCombinerOutputNV MANGLE(CombinerOutputNV) +#define glCombinerParameterfNV MANGLE(CombinerParameterfNV) +#define glCombinerParameterfvNV MANGLE(CombinerParameterfvNV) +#define glCombinerParameteriNV MANGLE(CombinerParameteriNV) +#define glCombinerParameterivNV MANGLE(CombinerParameterivNV) +#define glCombinerStageParameterfvNV MANGLE(CombinerStageParameterfvNV) +#define glCompileShaderARB MANGLE(CompileShaderARB) +#define glCompileShader MANGLE(CompileShader) +#define glCompressedMultiTexImage1DEXT MANGLE(CompressedMultiTexImage1DEXT) +#define glCompressedMultiTexImage2DEXT MANGLE(CompressedMultiTexImage2DEXT) +#define glCompressedMultiTexImage3DEXT MANGLE(CompressedMultiTexImage3DEXT) +#define glCompressedMultiTexSubImage1DEXT MANGLE(CompressedMultiTexSubImage1DEXT) +#define glCompressedMultiTexSubImage2DEXT MANGLE(CompressedMultiTexSubImage2DEXT) +#define glCompressedMultiTexSubImage3DEXT MANGLE(CompressedMultiTexSubImage3DEXT) +#define glCompressedTexImage1DARB MANGLE(CompressedTexImage1DARB) +#define glCompressedTexImage1D MANGLE(CompressedTexImage1D) +#define glCompressedTexImage2DARB MANGLE(CompressedTexImage2DARB) +#define glCompressedTexImage2D MANGLE(CompressedTexImage2D) +#define glCompressedTexImage3DARB MANGLE(CompressedTexImage3DARB) +#define glCompressedTexImage3D MANGLE(CompressedTexImage3D) +#define glCompressedTexSubImage1DARB MANGLE(CompressedTexSubImage1DARB) +#define glCompressedTexSubImage1D MANGLE(CompressedTexSubImage1D) +#define glCompressedTexSubImage2DARB MANGLE(CompressedTexSubImage2DARB) +#define glCompressedTexSubImage2D MANGLE(CompressedTexSubImage2D) +#define glCompressedTexSubImage3DARB MANGLE(CompressedTexSubImage3DARB) +#define glCompressedTexSubImage3D MANGLE(CompressedTexSubImage3D) +#define glCompressedTextureImage1DEXT MANGLE(CompressedTextureImage1DEXT) +#define glCompressedTextureImage2DEXT MANGLE(CompressedTextureImage2DEXT) +#define glCompressedTextureImage3DEXT MANGLE(CompressedTextureImage3DEXT) +#define glCompressedTextureSubImage1DEXT MANGLE(CompressedTextureSubImage1DEXT) +#define glCompressedTextureSubImage2DEXT MANGLE(CompressedTextureSubImage2DEXT) +#define glCompressedTextureSubImage3DEXT MANGLE(CompressedTextureSubImage3DEXT) +#define glConvolutionFilter1DEXT MANGLE(ConvolutionFilter1DEXT) +#define glConvolutionFilter1D MANGLE(ConvolutionFilter1D) +#define glConvolutionFilter2DEXT MANGLE(ConvolutionFilter2DEXT) +#define glConvolutionFilter2D MANGLE(ConvolutionFilter2D) +#define glConvolutionParameterfEXT MANGLE(ConvolutionParameterfEXT) +#define glConvolutionParameterf MANGLE(ConvolutionParameterf) +#define glConvolutionParameterfvEXT MANGLE(ConvolutionParameterfvEXT) +#define glConvolutionParameterfv MANGLE(ConvolutionParameterfv) +#define glConvolutionParameteriEXT MANGLE(ConvolutionParameteriEXT) +#define glConvolutionParameteri MANGLE(ConvolutionParameteri) +#define glConvolutionParameterivEXT MANGLE(ConvolutionParameterivEXT) +#define glConvolutionParameteriv MANGLE(ConvolutionParameteriv) +#define glCopyBufferSubData MANGLE(CopyBufferSubData) +#define glCopyColorSubTableEXT MANGLE(CopyColorSubTableEXT) +#define glCopyColorSubTable MANGLE(CopyColorSubTable) +#define glCopyColorTable MANGLE(CopyColorTable) +#define glCopyColorTableSGI MANGLE(CopyColorTableSGI) +#define glCopyConvolutionFilter1DEXT MANGLE(CopyConvolutionFilter1DEXT) +#define glCopyConvolutionFilter1D MANGLE(CopyConvolutionFilter1D) +#define glCopyConvolutionFilter2DEXT MANGLE(CopyConvolutionFilter2DEXT) +#define glCopyConvolutionFilter2D MANGLE(CopyConvolutionFilter2D) +#define glCopyMultiTexImage1DEXT MANGLE(CopyMultiTexImage1DEXT) +#define glCopyMultiTexImage2DEXT MANGLE(CopyMultiTexImage2DEXT) +#define glCopyMultiTexSubImage1DEXT MANGLE(CopyMultiTexSubImage1DEXT) +#define glCopyMultiTexSubImage2DEXT MANGLE(CopyMultiTexSubImage2DEXT) +#define glCopyMultiTexSubImage3DEXT MANGLE(CopyMultiTexSubImage3DEXT) +#define glCopyPixels MANGLE(CopyPixels) +#define glCopyTexImage1DEXT MANGLE(CopyTexImage1DEXT) +#define glCopyTexImage1D MANGLE(CopyTexImage1D) +#define glCopyTexImage2DEXT MANGLE(CopyTexImage2DEXT) +#define glCopyTexImage2D MANGLE(CopyTexImage2D) +#define glCopyTexSubImage1DEXT MANGLE(CopyTexSubImage1DEXT) +#define glCopyTexSubImage1D MANGLE(CopyTexSubImage1D) +#define glCopyTexSubImage2DEXT MANGLE(CopyTexSubImage2DEXT) +#define glCopyTexSubImage2D MANGLE(CopyTexSubImage2D) +#define glCopyTexSubImage3DEXT MANGLE(CopyTexSubImage3DEXT) +#define glCopyTexSubImage3D MANGLE(CopyTexSubImage3D) +#define glCopyTextureImage1DEXT MANGLE(CopyTextureImage1DEXT) +#define glCopyTextureImage2DEXT MANGLE(CopyTextureImage2DEXT) +#define glCopyTextureSubImage1DEXT MANGLE(CopyTextureSubImage1DEXT) +#define glCopyTextureSubImage2DEXT MANGLE(CopyTextureSubImage2DEXT) +#define glCopyTextureSubImage3DEXT MANGLE(CopyTextureSubImage3DEXT) +#define glCreateDebugObjectMESA MANGLE(CreateDebugObjectMESA) +#define glCreateProgram MANGLE(CreateProgram) +#define glCreateProgramObjectARB MANGLE(CreateProgramObjectARB) +#define glCreateShader MANGLE(CreateShader) +#define glCreateShaderObjectARB MANGLE(CreateShaderObjectARB) +#define glCullFace MANGLE(CullFace) +#define glCullParameterdvEXT MANGLE(CullParameterdvEXT) +#define glCullParameterfvEXT MANGLE(CullParameterfvEXT) +#define glCurrentPaletteMatrixARB MANGLE(CurrentPaletteMatrixARB) +#define glDeformationMap3dSGIX MANGLE(DeformationMap3dSGIX) +#define glDeformationMap3fSGIX MANGLE(DeformationMap3fSGIX) +#define glDeformSGIX MANGLE(DeformSGIX) +#define glDeleteAsyncMarkersSGIX MANGLE(DeleteAsyncMarkersSGIX) +#define glDeleteBuffersARB MANGLE(DeleteBuffersARB) +#define glDeleteBuffers MANGLE(DeleteBuffers) +#define glDeleteFencesAPPLE MANGLE(DeleteFencesAPPLE) +#define glDeleteFencesNV MANGLE(DeleteFencesNV) +#define glDeleteFragmentShaderATI MANGLE(DeleteFragmentShaderATI) +#define glDeleteFramebuffersEXT MANGLE(DeleteFramebuffersEXT) +#define glDeleteFramebuffers MANGLE(DeleteFramebuffers) +#define glDeleteLists MANGLE(DeleteLists) +#define glDeleteObjectARB MANGLE(DeleteObjectARB) +#define glDeleteOcclusionQueriesNV MANGLE(DeleteOcclusionQueriesNV) +#define glDeletePerfMonitorsAMD MANGLE(DeletePerfMonitorsAMD) +#define glDeleteProgram MANGLE(DeleteProgram) +#define glDeleteProgramsARB MANGLE(DeleteProgramsARB) +#define glDeleteProgramsNV MANGLE(DeleteProgramsNV) +#define glDeleteQueriesARB MANGLE(DeleteQueriesARB) +#define glDeleteQueries MANGLE(DeleteQueries) +#define glDeleteRenderbuffersEXT MANGLE(DeleteRenderbuffersEXT) +#define glDeleteRenderbuffers MANGLE(DeleteRenderbuffers) +#define glDeleteShader MANGLE(DeleteShader) +#define glDeleteTexturesEXT MANGLE(DeleteTexturesEXT) +#define glDeleteTextures MANGLE(DeleteTextures) +#define glDeleteTransformFeedbacksNV MANGLE(DeleteTransformFeedbacksNV) +#define glDeleteVertexArraysAPPLE MANGLE(DeleteVertexArraysAPPLE) +#define glDeleteVertexArrays MANGLE(DeleteVertexArrays) +#define glDeleteVertexShaderEXT MANGLE(DeleteVertexShaderEXT) +#define glDepthBoundsdNV MANGLE(DepthBoundsdNV) +#define glDepthBoundsEXT MANGLE(DepthBoundsEXT) +#define glDepthFunc MANGLE(DepthFunc) +#define glDepthMask MANGLE(DepthMask) +#define glDepthRangedNV MANGLE(DepthRangedNV) +#define glDepthRange MANGLE(DepthRange) +#define glDetachObjectARB MANGLE(DetachObjectARB) +#define glDetachShader MANGLE(DetachShader) +#define glDetailTexFuncSGIS MANGLE(DetailTexFuncSGIS) +#define glDisableClientStateIndexedEXT MANGLE(DisableClientStateIndexedEXT) +#define glDisableClientState MANGLE(DisableClientState) +#define glDisablei MANGLE(Disablei) +#define glDisableIndexedEXT MANGLE(DisableIndexedEXT) +#define glDisable MANGLE(Disable) +#define glDisableVariantClientStateEXT MANGLE(DisableVariantClientStateEXT) +#define glDisableVertexAttribArrayARB MANGLE(DisableVertexAttribArrayARB) +#define glDisableVertexAttribArray MANGLE(DisableVertexAttribArray) +#define glDrawArraysEXT MANGLE(DrawArraysEXT) +#define glDrawArraysInstancedARB MANGLE(DrawArraysInstancedARB) +#define glDrawArraysInstancedEXT MANGLE(DrawArraysInstancedEXT) +#define glDrawArraysInstanced MANGLE(DrawArraysInstanced) +#define glDrawArrays MANGLE(DrawArrays) +#define glDrawBuffer MANGLE(DrawBuffer) +#define glDrawBuffersARB MANGLE(DrawBuffersARB) +#define glDrawBuffersATI MANGLE(DrawBuffersATI) +#define glDrawBuffers MANGLE(DrawBuffers) +#define glDrawElementArrayAPPLE MANGLE(DrawElementArrayAPPLE) +#define glDrawElementArrayATI MANGLE(DrawElementArrayATI) +#define glDrawElementsInstancedARB MANGLE(DrawElementsInstancedARB) +#define glDrawElementsInstancedEXT MANGLE(DrawElementsInstancedEXT) +#define glDrawElementsInstanced MANGLE(DrawElementsInstanced) +#define glDrawElements MANGLE(DrawElements) +#define glDrawMeshArraysSUN MANGLE(DrawMeshArraysSUN) +#define glDrawPixels MANGLE(DrawPixels) +#define glDrawRangeElementArrayAPPLE MANGLE(DrawRangeElementArrayAPPLE) +#define glDrawRangeElementArrayATI MANGLE(DrawRangeElementArrayATI) +#define glDrawRangeElementsEXT MANGLE(DrawRangeElementsEXT) +#define glDrawRangeElements MANGLE(DrawRangeElements) +#define glDrawTransformFeedbackNV MANGLE(DrawTransformFeedbackNV) +#define glEdgeFlag MANGLE(EdgeFlag) +#define glEdgeFlagPointerEXT MANGLE(EdgeFlagPointerEXT) +#define glEdgeFlagPointerListIBM MANGLE(EdgeFlagPointerListIBM) +#define glEdgeFlagPointer MANGLE(EdgeFlagPointer) +#define glEdgeFlagv MANGLE(EdgeFlagv) +#define glElementPointerAPPLE MANGLE(ElementPointerAPPLE) +#define glElementPointerATI MANGLE(ElementPointerATI) +#define glEnableClientStateIndexedEXT MANGLE(EnableClientStateIndexedEXT) +#define glEnableClientState MANGLE(EnableClientState) +#define glEnablei MANGLE(Enablei) +#define glEnableIndexedEXT MANGLE(EnableIndexedEXT) +#define glEnable MANGLE(Enable) +#define glEnableVariantClientStateEXT MANGLE(EnableVariantClientStateEXT) +#define glEnableVertexAttribArrayARB MANGLE(EnableVertexAttribArrayARB) +#define glEnableVertexAttribArray MANGLE(EnableVertexAttribArray) +#define glEndConditionalRender MANGLE(EndConditionalRender) +#define glEndConditionalRenderNV MANGLE(EndConditionalRenderNV) +#define glEndFragmentShaderATI MANGLE(EndFragmentShaderATI) +#define glEndList MANGLE(EndList) +#define glEnd MANGLE(End) +#define glEndOcclusionQueryNV MANGLE(EndOcclusionQueryNV) +#define glEndPerfMonitorAMD MANGLE(EndPerfMonitorAMD) +#define glEndQueryARB MANGLE(EndQueryARB) +#define glEndQuery MANGLE(EndQuery) +#define glEndTransformFeedbackEXT MANGLE(EndTransformFeedbackEXT) +#define glEndTransformFeedback MANGLE(EndTransformFeedback) +#define glEndTransformFeedbackNV MANGLE(EndTransformFeedbackNV) +#define glEndVertexShaderEXT MANGLE(EndVertexShaderEXT) +#define glEvalCoord1d MANGLE(EvalCoord1d) +#define glEvalCoord1dv MANGLE(EvalCoord1dv) +#define glEvalCoord1f MANGLE(EvalCoord1f) +#define glEvalCoord1fv MANGLE(EvalCoord1fv) +#define glEvalCoord2d MANGLE(EvalCoord2d) +#define glEvalCoord2dv MANGLE(EvalCoord2dv) +#define glEvalCoord2f MANGLE(EvalCoord2f) +#define glEvalCoord2fv MANGLE(EvalCoord2fv) +#define glEvalMapsNV MANGLE(EvalMapsNV) +#define glEvalMesh1 MANGLE(EvalMesh1) +#define glEvalMesh2 MANGLE(EvalMesh2) +#define glEvalPoint1 MANGLE(EvalPoint1) +#define glEvalPoint2 MANGLE(EvalPoint2) +#define glExecuteProgramNV MANGLE(ExecuteProgramNV) +#define glExtractComponentEXT MANGLE(ExtractComponentEXT) +#define glFeedbackBuffer MANGLE(FeedbackBuffer) +#define glFinalCombinerInputNV MANGLE(FinalCombinerInputNV) +#define glFinishAsyncSGIX MANGLE(FinishAsyncSGIX) +#define glFinishFenceAPPLE MANGLE(FinishFenceAPPLE) +#define glFinishFenceNV MANGLE(FinishFenceNV) +#define glFinish MANGLE(Finish) +#define glFinishObjectAPPLE MANGLE(FinishObjectAPPLE) +#define glFinishTextureSUNX MANGLE(FinishTextureSUNX) +#define glFlush MANGLE(Flush) +#define glFlushMappedBufferRangeAPPLE MANGLE(FlushMappedBufferRangeAPPLE) +#define glFlushMappedBufferRange MANGLE(FlushMappedBufferRange) +#define glFlushPixelDataRangeNV MANGLE(FlushPixelDataRangeNV) +#define glFlushRasterSGIX MANGLE(FlushRasterSGIX) +#define glFlushVertexArrayRangeAPPLE MANGLE(FlushVertexArrayRangeAPPLE) +#define glFlushVertexArrayRangeNV MANGLE(FlushVertexArrayRangeNV) +#define glFogCoorddEXT MANGLE(FogCoorddEXT) +#define glFogCoordd MANGLE(FogCoordd) +#define glFogCoorddvEXT MANGLE(FogCoorddvEXT) +#define glFogCoorddv MANGLE(FogCoorddv) +#define glFogCoordfEXT MANGLE(FogCoordfEXT) +#define glFogCoordf MANGLE(FogCoordf) +#define glFogCoordfvEXT MANGLE(FogCoordfvEXT) +#define glFogCoordfv MANGLE(FogCoordfv) +#define glFogCoordhNV MANGLE(FogCoordhNV) +#define glFogCoordhvNV MANGLE(FogCoordhvNV) +#define glFogCoordPointerEXT MANGLE(FogCoordPointerEXT) +#define glFogCoordPointerListIBM MANGLE(FogCoordPointerListIBM) +#define glFogCoordPointer MANGLE(FogCoordPointer) +#define glFogf MANGLE(Fogf) +#define glFogFuncSGIS MANGLE(FogFuncSGIS) +#define glFogfv MANGLE(Fogfv) +#define glFogi MANGLE(Fogi) +#define glFogiv MANGLE(Fogiv) +#define glFragmentColorMaterialSGIX MANGLE(FragmentColorMaterialSGIX) +#define glFragmentLightfSGIX MANGLE(FragmentLightfSGIX) +#define glFragmentLightfvSGIX MANGLE(FragmentLightfvSGIX) +#define glFragmentLightiSGIX MANGLE(FragmentLightiSGIX) +#define glFragmentLightivSGIX MANGLE(FragmentLightivSGIX) +#define glFragmentLightModelfSGIX MANGLE(FragmentLightModelfSGIX) +#define glFragmentLightModelfvSGIX MANGLE(FragmentLightModelfvSGIX) +#define glFragmentLightModeliSGIX MANGLE(FragmentLightModeliSGIX) +#define glFragmentLightModelivSGIX MANGLE(FragmentLightModelivSGIX) +#define glFragmentMaterialfSGIX MANGLE(FragmentMaterialfSGIX) +#define glFragmentMaterialfvSGIX MANGLE(FragmentMaterialfvSGIX) +#define glFragmentMaterialiSGIX MANGLE(FragmentMaterialiSGIX) +#define glFragmentMaterialivSGIX MANGLE(FragmentMaterialivSGIX) +#define glFramebufferDrawBufferEXT MANGLE(FramebufferDrawBufferEXT) +#define glFramebufferDrawBuffersEXT MANGLE(FramebufferDrawBuffersEXT) +#define glFramebufferReadBufferEXT MANGLE(FramebufferReadBufferEXT) +#define glFramebufferRenderbufferEXT MANGLE(FramebufferRenderbufferEXT) +#define glFramebufferRenderbuffer MANGLE(FramebufferRenderbuffer) +#define glFramebufferTexture1DEXT MANGLE(FramebufferTexture1DEXT) +#define glFramebufferTexture1D MANGLE(FramebufferTexture1D) +#define glFramebufferTexture2DEXT MANGLE(FramebufferTexture2DEXT) +#define glFramebufferTexture2D MANGLE(FramebufferTexture2D) +#define glFramebufferTexture3DEXT MANGLE(FramebufferTexture3DEXT) +#define glFramebufferTexture3D MANGLE(FramebufferTexture3D) +#define glFramebufferTextureARB MANGLE(FramebufferTextureARB) +#define glFramebufferTextureEXT MANGLE(FramebufferTextureEXT) +#define glFramebufferTextureFaceARB MANGLE(FramebufferTextureFaceARB) +#define glFramebufferTextureFaceEXT MANGLE(FramebufferTextureFaceEXT) +#define glFramebufferTextureLayerARB MANGLE(FramebufferTextureLayerARB) +#define glFramebufferTextureLayerEXT MANGLE(FramebufferTextureLayerEXT) +#define glFramebufferTextureLayer MANGLE(FramebufferTextureLayer) +#define glFrameTerminatorGREMEDY MANGLE(FrameTerminatorGREMEDY) +#define glFrameZoomSGIX MANGLE(FrameZoomSGIX) +#define glFreeObjectBufferATI MANGLE(FreeObjectBufferATI) +#define glFrontFace MANGLE(FrontFace) +#define glFrustum MANGLE(Frustum) +#define glGenAsyncMarkersSGIX MANGLE(GenAsyncMarkersSGIX) +#define glGenBuffersARB MANGLE(GenBuffersARB) +#define glGenBuffers MANGLE(GenBuffers) +#define glGenerateMipmapEXT MANGLE(GenerateMipmapEXT) +#define glGenerateMipmap MANGLE(GenerateMipmap) +#define glGenerateMultiTexMipmapEXT MANGLE(GenerateMultiTexMipmapEXT) +#define glGenerateTextureMipmapEXT MANGLE(GenerateTextureMipmapEXT) +#define glGenFencesAPPLE MANGLE(GenFencesAPPLE) +#define glGenFencesNV MANGLE(GenFencesNV) +#define glGenFragmentShadersATI MANGLE(GenFragmentShadersATI) +#define glGenFramebuffersEXT MANGLE(GenFramebuffersEXT) +#define glGenFramebuffers MANGLE(GenFramebuffers) +#define glGenLists MANGLE(GenLists) +#define glGenOcclusionQueriesNV MANGLE(GenOcclusionQueriesNV) +#define glGenPerfMonitorsAMD MANGLE(GenPerfMonitorsAMD) +#define glGenProgramsARB MANGLE(GenProgramsARB) +#define glGenProgramsNV MANGLE(GenProgramsNV) +#define glGenQueriesARB MANGLE(GenQueriesARB) +#define glGenQueries MANGLE(GenQueries) +#define glGenRenderbuffersEXT MANGLE(GenRenderbuffersEXT) +#define glGenRenderbuffers MANGLE(GenRenderbuffers) +#define glGenSymbolsEXT MANGLE(GenSymbolsEXT) +#define glGenTexturesEXT MANGLE(GenTexturesEXT) +#define glGenTextures MANGLE(GenTextures) +#define glGenTransformFeedbacksNV MANGLE(GenTransformFeedbacksNV) +#define glGenVertexArraysAPPLE MANGLE(GenVertexArraysAPPLE) +#define glGenVertexArrays MANGLE(GenVertexArrays) +#define glGenVertexShadersEXT MANGLE(GenVertexShadersEXT) +#define glGetActiveAttribARB MANGLE(GetActiveAttribARB) +#define glGetActiveAttrib MANGLE(GetActiveAttrib) +#define glGetActiveUniformARB MANGLE(GetActiveUniformARB) +#define glGetActiveUniformBlockiv MANGLE(GetActiveUniformBlockiv) +#define glGetActiveUniformBlockName MANGLE(GetActiveUniformBlockName) +#define glGetActiveUniform MANGLE(GetActiveUniform) +#define glGetActiveUniformName MANGLE(GetActiveUniformName) +#define glGetActiveUniformsiv MANGLE(GetActiveUniformsiv) +#define glGetActiveVaryingNV MANGLE(GetActiveVaryingNV) +#define glGetArrayObjectfvATI MANGLE(GetArrayObjectfvATI) +#define glGetArrayObjectivATI MANGLE(GetArrayObjectivATI) +#define glGetAttachedObjectsARB MANGLE(GetAttachedObjectsARB) +#define glGetAttachedShaders MANGLE(GetAttachedShaders) +#define glGetAttribLocationARB MANGLE(GetAttribLocationARB) +#define glGetAttribLocation MANGLE(GetAttribLocation) +#define glGetBooleanIndexedvEXT MANGLE(GetBooleanIndexedvEXT) +#define glGetBooleani_v MANGLE(GetBooleani_v) +#define glGetBooleanv MANGLE(GetBooleanv) +#define glGetBufferParameterivARB MANGLE(GetBufferParameterivARB) +#define glGetBufferParameteriv MANGLE(GetBufferParameteriv) +#define glGetBufferPointervARB MANGLE(GetBufferPointervARB) +#define glGetBufferPointerv MANGLE(GetBufferPointerv) +#define glGetBufferSubDataARB MANGLE(GetBufferSubDataARB) +#define glGetBufferSubData MANGLE(GetBufferSubData) +#define glGetClipPlane MANGLE(GetClipPlane) +#define glGetColorTableEXT MANGLE(GetColorTableEXT) +#define glGetColorTable MANGLE(GetColorTable) +#define glGetColorTableParameterfvEXT MANGLE(GetColorTableParameterfvEXT) +#define glGetColorTableParameterfv MANGLE(GetColorTableParameterfv) +#define glGetColorTableParameterfvSGI MANGLE(GetColorTableParameterfvSGI) +#define glGetColorTableParameterivEXT MANGLE(GetColorTableParameterivEXT) +#define glGetColorTableParameteriv MANGLE(GetColorTableParameteriv) +#define glGetColorTableParameterivSGI MANGLE(GetColorTableParameterivSGI) +#define glGetColorTableSGI MANGLE(GetColorTableSGI) +#define glGetCombinerInputParameterfvNV MANGLE(GetCombinerInputParameterfvNV) +#define glGetCombinerInputParameterivNV MANGLE(GetCombinerInputParameterivNV) +#define glGetCombinerOutputParameterfvNV MANGLE(GetCombinerOutputParameterfvNV) +#define glGetCombinerOutputParameterivNV MANGLE(GetCombinerOutputParameterivNV) +#define glGetCombinerStageParameterfvNV MANGLE(GetCombinerStageParameterfvNV) +#define glGetCompressedMultiTexImageEXT MANGLE(GetCompressedMultiTexImageEXT) +#define glGetCompressedTexImageARB MANGLE(GetCompressedTexImageARB) +#define glGetCompressedTexImage MANGLE(GetCompressedTexImage) +#define glGetCompressedTextureImageEXT MANGLE(GetCompressedTextureImageEXT) +#define glGetConvolutionFilterEXT MANGLE(GetConvolutionFilterEXT) +#define glGetConvolutionFilter MANGLE(GetConvolutionFilter) +#define glGetConvolutionParameterfvEXT MANGLE(GetConvolutionParameterfvEXT) +#define glGetConvolutionParameterfv MANGLE(GetConvolutionParameterfv) +#define glGetConvolutionParameterivEXT MANGLE(GetConvolutionParameterivEXT) +#define glGetConvolutionParameteriv MANGLE(GetConvolutionParameteriv) +#define glGetDebugLogLengthMESA MANGLE(GetDebugLogLengthMESA) +#define glGetDebugLogMESA MANGLE(GetDebugLogMESA) +#define glGetDetailTexFuncSGIS MANGLE(GetDetailTexFuncSGIS) +#define glGetDoubleIndexedvEXT MANGLE(GetDoubleIndexedvEXT) +#define glGetDoublev MANGLE(GetDoublev) +#define glGetError MANGLE(GetError) +#define glGetFenceivNV MANGLE(GetFenceivNV) +#define glGetFinalCombinerInputParameterfvNV MANGLE(GetFinalCombinerInputParameterfvNV) +#define glGetFinalCombinerInputParameterivNV MANGLE(GetFinalCombinerInputParameterivNV) +#define glGetFloatIndexedvEXT MANGLE(GetFloatIndexedvEXT) +#define glGetFloatv MANGLE(GetFloatv) +#define glGetFogFuncSGIS MANGLE(GetFogFuncSGIS) +#define glGetFragDataLocationEXT MANGLE(GetFragDataLocationEXT) +#define glGetFragDataLocation MANGLE(GetFragDataLocation) +#define glGetFragmentLightfvSGIX MANGLE(GetFragmentLightfvSGIX) +#define glGetFragmentLightivSGIX MANGLE(GetFragmentLightivSGIX) +#define glGetFragmentMaterialfvSGIX MANGLE(GetFragmentMaterialfvSGIX) +#define glGetFragmentMaterialivSGIX MANGLE(GetFragmentMaterialivSGIX) +#define glGetFramebufferAttachmentParameterivEXT MANGLE(GetFramebufferAttachmentParameterivEXT) +#define glGetFramebufferAttachmentParameteriv MANGLE(GetFramebufferAttachmentParameteriv) +#define glGetFramebufferParameterivEXT MANGLE(GetFramebufferParameterivEXT) +#define glGetHandleARB MANGLE(GetHandleARB) +#define glGetHistogramEXT MANGLE(GetHistogramEXT) +#define glGetHistogram MANGLE(GetHistogram) +#define glGetHistogramParameterfvEXT MANGLE(GetHistogramParameterfvEXT) +#define glGetHistogramParameterfv MANGLE(GetHistogramParameterfv) +#define glGetHistogramParameterivEXT MANGLE(GetHistogramParameterivEXT) +#define glGetHistogramParameteriv MANGLE(GetHistogramParameteriv) +#define glGetImageTransformParameterfvHP MANGLE(GetImageTransformParameterfvHP) +#define glGetImageTransformParameterivHP MANGLE(GetImageTransformParameterivHP) +#define glGetInfoLogARB MANGLE(GetInfoLogARB) +#define glGetInstrumentsSGIX MANGLE(GetInstrumentsSGIX) +#define glGetIntegerIndexedvEXT MANGLE(GetIntegerIndexedvEXT) +#define glGetIntegeri_v MANGLE(GetIntegeri_v) +#define glGetIntegerv MANGLE(GetIntegerv) +#define glGetInvariantBooleanvEXT MANGLE(GetInvariantBooleanvEXT) +#define glGetInvariantFloatvEXT MANGLE(GetInvariantFloatvEXT) +#define glGetInvariantIntegervEXT MANGLE(GetInvariantIntegervEXT) +#define glGetLightfv MANGLE(GetLightfv) +#define glGetLightiv MANGLE(GetLightiv) +#define glGetListParameterfvSGIX MANGLE(GetListParameterfvSGIX) +#define glGetListParameterivSGIX MANGLE(GetListParameterivSGIX) +#define glGetLocalConstantBooleanvEXT MANGLE(GetLocalConstantBooleanvEXT) +#define glGetLocalConstantFloatvEXT MANGLE(GetLocalConstantFloatvEXT) +#define glGetLocalConstantIntegervEXT MANGLE(GetLocalConstantIntegervEXT) +#define glGetMapAttribParameterfvNV MANGLE(GetMapAttribParameterfvNV) +#define glGetMapAttribParameterivNV MANGLE(GetMapAttribParameterivNV) +#define glGetMapControlPointsNV MANGLE(GetMapControlPointsNV) +#define glGetMapdv MANGLE(GetMapdv) +#define glGetMapfv MANGLE(GetMapfv) +#define glGetMapiv MANGLE(GetMapiv) +#define glGetMapParameterfvNV MANGLE(GetMapParameterfvNV) +#define glGetMapParameterivNV MANGLE(GetMapParameterivNV) +#define glGetMaterialfv MANGLE(GetMaterialfv) +#define glGetMaterialiv MANGLE(GetMaterialiv) +#define glGetMinmaxEXT MANGLE(GetMinmaxEXT) +#define glGetMinmax MANGLE(GetMinmax) +#define glGetMinmaxParameterfvEXT MANGLE(GetMinmaxParameterfvEXT) +#define glGetMinmaxParameterfv MANGLE(GetMinmaxParameterfv) +#define glGetMinmaxParameterivEXT MANGLE(GetMinmaxParameterivEXT) +#define glGetMinmaxParameteriv MANGLE(GetMinmaxParameteriv) +#define glGetMultisamplefvNV MANGLE(GetMultisamplefvNV) +#define glGetMultiTexEnvfvEXT MANGLE(GetMultiTexEnvfvEXT) +#define glGetMultiTexEnvivEXT MANGLE(GetMultiTexEnvivEXT) +#define glGetMultiTexGendvEXT MANGLE(GetMultiTexGendvEXT) +#define glGetMultiTexGenfvEXT MANGLE(GetMultiTexGenfvEXT) +#define glGetMultiTexGenivEXT MANGLE(GetMultiTexGenivEXT) +#define glGetMultiTexImageEXT MANGLE(GetMultiTexImageEXT) +#define glGetMultiTexLevelParameterfvEXT MANGLE(GetMultiTexLevelParameterfvEXT) +#define glGetMultiTexLevelParameterivEXT MANGLE(GetMultiTexLevelParameterivEXT) +#define glGetMultiTexParameterfvEXT MANGLE(GetMultiTexParameterfvEXT) +#define glGetMultiTexParameterIivEXT MANGLE(GetMultiTexParameterIivEXT) +#define glGetMultiTexParameterIuivEXT MANGLE(GetMultiTexParameterIuivEXT) +#define glGetMultiTexParameterivEXT MANGLE(GetMultiTexParameterivEXT) +#define glGetNamedBufferParameterivEXT MANGLE(GetNamedBufferParameterivEXT) +#define glGetNamedBufferPointervEXT MANGLE(GetNamedBufferPointervEXT) +#define glGetNamedBufferSubDataEXT MANGLE(GetNamedBufferSubDataEXT) +#define glGetNamedFramebufferAttachmentParameterivEXT MANGLE(GetNamedFramebufferAttachmentParameterivEXT) +#define glGetNamedProgramivEXT MANGLE(GetNamedProgramivEXT) +#define glGetNamedProgramLocalParameterdvEXT MANGLE(GetNamedProgramLocalParameterdvEXT) +#define glGetNamedProgramLocalParameterfvEXT MANGLE(GetNamedProgramLocalParameterfvEXT) +#define glGetNamedProgramLocalParameterIivEXT MANGLE(GetNamedProgramLocalParameterIivEXT) +#define glGetNamedProgramLocalParameterIuivEXT MANGLE(GetNamedProgramLocalParameterIuivEXT) +#define glGetNamedProgramStringEXT MANGLE(GetNamedProgramStringEXT) +#define glGetNamedRenderbufferParameterivEXT MANGLE(GetNamedRenderbufferParameterivEXT) +#define glGetObjectBufferfvATI MANGLE(GetObjectBufferfvATI) +#define glGetObjectBufferivATI MANGLE(GetObjectBufferivATI) +#define glGetObjectParameterfvARB MANGLE(GetObjectParameterfvARB) +#define glGetObjectParameterivARB MANGLE(GetObjectParameterivARB) +#define glGetOcclusionQueryivNV MANGLE(GetOcclusionQueryivNV) +#define glGetOcclusionQueryuivNV MANGLE(GetOcclusionQueryuivNV) +#define glGetPerfMonitorCounterDataAMD MANGLE(GetPerfMonitorCounterDataAMD) +#define glGetPerfMonitorCounterInfoAMD MANGLE(GetPerfMonitorCounterInfoAMD) +#define glGetPerfMonitorCountersAMD MANGLE(GetPerfMonitorCountersAMD) +#define glGetPerfMonitorCounterStringAMD MANGLE(GetPerfMonitorCounterStringAMD) +#define glGetPerfMonitorGroupsAMD MANGLE(GetPerfMonitorGroupsAMD) +#define glGetPerfMonitorGroupStringAMD MANGLE(GetPerfMonitorGroupStringAMD) +#define glGetPixelMapfv MANGLE(GetPixelMapfv) +#define glGetPixelMapuiv MANGLE(GetPixelMapuiv) +#define glGetPixelMapusv MANGLE(GetPixelMapusv) +#define glGetPixelTexGenParameterfvSGIS MANGLE(GetPixelTexGenParameterfvSGIS) +#define glGetPixelTexGenParameterivSGIS MANGLE(GetPixelTexGenParameterivSGIS) +#define glGetPointerIndexedvEXT MANGLE(GetPointerIndexedvEXT) +#define glGetPointervEXT MANGLE(GetPointervEXT) +#define glGetPointerv MANGLE(GetPointerv) +#define glGetPolygonStipple MANGLE(GetPolygonStipple) +#define glGetProgramEnvParameterdvARB MANGLE(GetProgramEnvParameterdvARB) +#define glGetProgramEnvParameterfvARB MANGLE(GetProgramEnvParameterfvARB) +#define glGetProgramEnvParameterIivNV MANGLE(GetProgramEnvParameterIivNV) +#define glGetProgramEnvParameterIuivNV MANGLE(GetProgramEnvParameterIuivNV) +#define glGetProgramInfoLog MANGLE(GetProgramInfoLog) +#define glGetProgramivARB MANGLE(GetProgramivARB) +#define glGetProgramiv MANGLE(GetProgramiv) +#define glGetProgramivNV MANGLE(GetProgramivNV) +#define glGetProgramLocalParameterdvARB MANGLE(GetProgramLocalParameterdvARB) +#define glGetProgramLocalParameterfvARB MANGLE(GetProgramLocalParameterfvARB) +#define glGetProgramLocalParameterIivNV MANGLE(GetProgramLocalParameterIivNV) +#define glGetProgramLocalParameterIuivNV MANGLE(GetProgramLocalParameterIuivNV) +#define glGetProgramNamedParameterdvNV MANGLE(GetProgramNamedParameterdvNV) +#define glGetProgramNamedParameterfvNV MANGLE(GetProgramNamedParameterfvNV) +#define glGetProgramParameterdvNV MANGLE(GetProgramParameterdvNV) +#define glGetProgramParameterfvNV MANGLE(GetProgramParameterfvNV) +#define glGetProgramRegisterfvMESA MANGLE(GetProgramRegisterfvMESA) +#define glGetProgramStringARB MANGLE(GetProgramStringARB) +#define glGetProgramStringNV MANGLE(GetProgramStringNV) +#define glGetQueryivARB MANGLE(GetQueryivARB) +#define glGetQueryiv MANGLE(GetQueryiv) +#define glGetQueryObjecti64vEXT MANGLE(GetQueryObjecti64vEXT) +#define glGetQueryObjectivARB MANGLE(GetQueryObjectivARB) +#define glGetQueryObjectiv MANGLE(GetQueryObjectiv) +#define glGetQueryObjectui64vEXT MANGLE(GetQueryObjectui64vEXT) +#define glGetQueryObjectuivARB MANGLE(GetQueryObjectuivARB) +#define glGetQueryObjectuiv MANGLE(GetQueryObjectuiv) +#define glGetRenderbufferParameterivEXT MANGLE(GetRenderbufferParameterivEXT) +#define glGetRenderbufferParameteriv MANGLE(GetRenderbufferParameteriv) +#define glGetSeparableFilterEXT MANGLE(GetSeparableFilterEXT) +#define glGetSeparableFilter MANGLE(GetSeparableFilter) +#define glGetShaderInfoLog MANGLE(GetShaderInfoLog) +#define glGetShaderiv MANGLE(GetShaderiv) +#define glGetShaderSourceARB MANGLE(GetShaderSourceARB) +#define glGetShaderSource MANGLE(GetShaderSource) +#define glGetSharpenTexFuncSGIS MANGLE(GetSharpenTexFuncSGIS) +#define glGetStringi MANGLE(GetStringi) +#define glGetString MANGLE(GetString) +#define glGetTexBumpParameterfvATI MANGLE(GetTexBumpParameterfvATI) +#define glGetTexBumpParameterivATI MANGLE(GetTexBumpParameterivATI) +#define glGetTexEnvfv MANGLE(GetTexEnvfv) +#define glGetTexEnviv MANGLE(GetTexEnviv) +#define glGetTexFilterFuncSGIS MANGLE(GetTexFilterFuncSGIS) +#define glGetTexGendv MANGLE(GetTexGendv) +#define glGetTexGenfv MANGLE(GetTexGenfv) +#define glGetTexGeniv MANGLE(GetTexGeniv) +#define glGetTexImage MANGLE(GetTexImage) +#define glGetTexLevelParameterfv MANGLE(GetTexLevelParameterfv) +#define glGetTexLevelParameteriv MANGLE(GetTexLevelParameteriv) +#define glGetTexParameterfv MANGLE(GetTexParameterfv) +#define glGetTexParameterIivEXT MANGLE(GetTexParameterIivEXT) +#define glGetTexParameterIiv MANGLE(GetTexParameterIiv) +#define glGetTexParameterIuivEXT MANGLE(GetTexParameterIuivEXT) +#define glGetTexParameterIuiv MANGLE(GetTexParameterIuiv) +#define glGetTexParameteriv MANGLE(GetTexParameteriv) +#define glGetTextureImageEXT MANGLE(GetTextureImageEXT) +#define glGetTextureLevelParameterfvEXT MANGLE(GetTextureLevelParameterfvEXT) +#define glGetTextureLevelParameterivEXT MANGLE(GetTextureLevelParameterivEXT) +#define glGetTextureParameterfvEXT MANGLE(GetTextureParameterfvEXT) +#define glGetTextureParameterIivEXT MANGLE(GetTextureParameterIivEXT) +#define glGetTextureParameterIuivEXT MANGLE(GetTextureParameterIuivEXT) +#define glGetTextureParameterivEXT MANGLE(GetTextureParameterivEXT) +#define glGetTrackMatrixivNV MANGLE(GetTrackMatrixivNV) +#define glGetTransformFeedbackVaryingEXT MANGLE(GetTransformFeedbackVaryingEXT) +#define glGetTransformFeedbackVarying MANGLE(GetTransformFeedbackVarying) +#define glGetTransformFeedbackVaryingNV MANGLE(GetTransformFeedbackVaryingNV) +#define glGetUniformBlockIndex MANGLE(GetUniformBlockIndex) +#define glGetUniformBufferSizeEXT MANGLE(GetUniformBufferSizeEXT) +#define glGetUniformfvARB MANGLE(GetUniformfvARB) +#define glGetUniformfv MANGLE(GetUniformfv) +#define glGetUniformIndices MANGLE(GetUniformIndices) +#define glGetUniformivARB MANGLE(GetUniformivARB) +#define glGetUniformiv MANGLE(GetUniformiv) +#define glGetUniformLocationARB MANGLE(GetUniformLocationARB) +#define glGetUniformLocation MANGLE(GetUniformLocation) +#define glGetUniformOffsetEXT MANGLE(GetUniformOffsetEXT) +#define glGetUniformuivEXT MANGLE(GetUniformuivEXT) +#define glGetUniformuiv MANGLE(GetUniformuiv) +#define glGetVariantArrayObjectfvATI MANGLE(GetVariantArrayObjectfvATI) +#define glGetVariantArrayObjectivATI MANGLE(GetVariantArrayObjectivATI) +#define glGetVariantBooleanvEXT MANGLE(GetVariantBooleanvEXT) +#define glGetVariantFloatvEXT MANGLE(GetVariantFloatvEXT) +#define glGetVariantIntegervEXT MANGLE(GetVariantIntegervEXT) +#define glGetVariantPointervEXT MANGLE(GetVariantPointervEXT) +#define glGetVaryingLocationNV MANGLE(GetVaryingLocationNV) +#define glGetVertexAttribArrayObjectfvATI MANGLE(GetVertexAttribArrayObjectfvATI) +#define glGetVertexAttribArrayObjectivATI MANGLE(GetVertexAttribArrayObjectivATI) +#define glGetVertexAttribdvARB MANGLE(GetVertexAttribdvARB) +#define glGetVertexAttribdv MANGLE(GetVertexAttribdv) +#define glGetVertexAttribdvNV MANGLE(GetVertexAttribdvNV) +#define glGetVertexAttribfvARB MANGLE(GetVertexAttribfvARB) +#define glGetVertexAttribfv MANGLE(GetVertexAttribfv) +#define glGetVertexAttribfvNV MANGLE(GetVertexAttribfvNV) +#define glGetVertexAttribIivEXT MANGLE(GetVertexAttribIivEXT) +#define glGetVertexAttribIiv MANGLE(GetVertexAttribIiv) +#define glGetVertexAttribIuivEXT MANGLE(GetVertexAttribIuivEXT) +#define glGetVertexAttribIuiv MANGLE(GetVertexAttribIuiv) +#define glGetVertexAttribivARB MANGLE(GetVertexAttribivARB) +#define glGetVertexAttribiv MANGLE(GetVertexAttribiv) +#define glGetVertexAttribivNV MANGLE(GetVertexAttribivNV) +#define glGetVertexAttribPointervARB MANGLE(GetVertexAttribPointervARB) +#define glGetVertexAttribPointerv MANGLE(GetVertexAttribPointerv) +#define glGetVertexAttribPointervNV MANGLE(GetVertexAttribPointervNV) +#define glGetVideoi64vNV MANGLE(GetVideoi64vNV) +#define glGetVideoivNV MANGLE(GetVideoivNV) +#define glGetVideoui64vNV MANGLE(GetVideoui64vNV) +#define glGetVideouivNV MANGLE(GetVideouivNV) +#define glGlobalAlphaFactorbSUN MANGLE(GlobalAlphaFactorbSUN) +#define glGlobalAlphaFactordSUN MANGLE(GlobalAlphaFactordSUN) +#define glGlobalAlphaFactorfSUN MANGLE(GlobalAlphaFactorfSUN) +#define glGlobalAlphaFactoriSUN MANGLE(GlobalAlphaFactoriSUN) +#define glGlobalAlphaFactorsSUN MANGLE(GlobalAlphaFactorsSUN) +#define glGlobalAlphaFactorubSUN MANGLE(GlobalAlphaFactorubSUN) +#define glGlobalAlphaFactoruiSUN MANGLE(GlobalAlphaFactoruiSUN) +#define glGlobalAlphaFactorusSUN MANGLE(GlobalAlphaFactorusSUN) +#define glHint MANGLE(Hint) +#define glHintPGI MANGLE(HintPGI) +#define glHistogramEXT MANGLE(HistogramEXT) +#define glHistogram MANGLE(Histogram) +#define glIglooInterfaceSGIX MANGLE(IglooInterfaceSGIX) +#define glImageTransformParameterfHP MANGLE(ImageTransformParameterfHP) +#define glImageTransformParameterfvHP MANGLE(ImageTransformParameterfvHP) +#define glImageTransformParameteriHP MANGLE(ImageTransformParameteriHP) +#define glImageTransformParameterivHP MANGLE(ImageTransformParameterivHP) +#define glIndexd MANGLE(Indexd) +#define glIndexdv MANGLE(Indexdv) +#define glIndexf MANGLE(Indexf) +#define glIndexFuncEXT MANGLE(IndexFuncEXT) +#define glIndexfv MANGLE(Indexfv) +#define glIndexi MANGLE(Indexi) +#define glIndexiv MANGLE(Indexiv) +#define glIndexMask MANGLE(IndexMask) +#define glIndexMaterialEXT MANGLE(IndexMaterialEXT) +#define glIndexPointerEXT MANGLE(IndexPointerEXT) +#define glIndexPointerListIBM MANGLE(IndexPointerListIBM) +#define glIndexPointer MANGLE(IndexPointer) +#define glIndexs MANGLE(Indexs) +#define glIndexsv MANGLE(Indexsv) +#define glIndexub MANGLE(Indexub) +#define glIndexubv MANGLE(Indexubv) +#define glInitNames MANGLE(InitNames) +#define glInsertComponentEXT MANGLE(InsertComponentEXT) +#define glInstrumentsBufferSGIX MANGLE(InstrumentsBufferSGIX) +#define glInterleavedArrays MANGLE(InterleavedArrays) +#define glIsAsyncMarkerSGIX MANGLE(IsAsyncMarkerSGIX) +#define glIsBufferARB MANGLE(IsBufferARB) +#define glIsBuffer MANGLE(IsBuffer) +#define glIsEnabledi MANGLE(IsEnabledi) +#define glIsEnabledIndexedEXT MANGLE(IsEnabledIndexedEXT) +#define glIsEnabled MANGLE(IsEnabled) +#define glIsFenceAPPLE MANGLE(IsFenceAPPLE) +#define glIsFenceNV MANGLE(IsFenceNV) +#define glIsFramebufferEXT MANGLE(IsFramebufferEXT) +#define glIsFramebuffer MANGLE(IsFramebuffer) +#define glIsList MANGLE(IsList) +#define glIsObjectBufferATI MANGLE(IsObjectBufferATI) +#define glIsOcclusionQueryNV MANGLE(IsOcclusionQueryNV) +#define glIsProgramARB MANGLE(IsProgramARB) +#define glIsProgram MANGLE(IsProgram) +#define glIsProgramNV MANGLE(IsProgramNV) +#define glIsQueryARB MANGLE(IsQueryARB) +#define glIsQuery MANGLE(IsQuery) +#define glIsRenderbufferEXT MANGLE(IsRenderbufferEXT) +#define glIsRenderbuffer MANGLE(IsRenderbuffer) +#define glIsShader MANGLE(IsShader) +#define glIsTextureEXT MANGLE(IsTextureEXT) +#define glIsTexture MANGLE(IsTexture) +#define glIsTransformFeedbackNV MANGLE(IsTransformFeedbackNV) +#define glIsVariantEnabledEXT MANGLE(IsVariantEnabledEXT) +#define glIsVertexArrayAPPLE MANGLE(IsVertexArrayAPPLE) +#define glIsVertexArray MANGLE(IsVertexArray) +#define glLightEnviSGIX MANGLE(LightEnviSGIX) +#define glLightf MANGLE(Lightf) +#define glLightfv MANGLE(Lightfv) +#define glLighti MANGLE(Lighti) +#define glLightiv MANGLE(Lightiv) +#define glLightModelf MANGLE(LightModelf) +#define glLightModelfv MANGLE(LightModelfv) +#define glLightModeli MANGLE(LightModeli) +#define glLightModeliv MANGLE(LightModeliv) +#define glLineStipple MANGLE(LineStipple) +#define glLineWidth MANGLE(LineWidth) +#define glLinkProgramARB MANGLE(LinkProgramARB) +#define glLinkProgram MANGLE(LinkProgram) +#define glListBase MANGLE(ListBase) +#define glListParameterfSGIX MANGLE(ListParameterfSGIX) +#define glListParameterfvSGIX MANGLE(ListParameterfvSGIX) +#define glListParameteriSGIX MANGLE(ListParameteriSGIX) +#define glListParameterivSGIX MANGLE(ListParameterivSGIX) +#define glLoadIdentityDeformationMapSGIX MANGLE(LoadIdentityDeformationMapSGIX) +#define glLoadIdentity MANGLE(LoadIdentity) +#define glLoadMatrixd MANGLE(LoadMatrixd) +#define glLoadMatrixf MANGLE(LoadMatrixf) +#define glLoadName MANGLE(LoadName) +#define glLoadProgramNV MANGLE(LoadProgramNV) +#define glLoadTransposeMatrixdARB MANGLE(LoadTransposeMatrixdARB) +#define glLoadTransposeMatrixd MANGLE(LoadTransposeMatrixd) +#define glLoadTransposeMatrixfARB MANGLE(LoadTransposeMatrixfARB) +#define glLoadTransposeMatrixf MANGLE(LoadTransposeMatrixf) +#define glLockArraysEXT MANGLE(LockArraysEXT) +#define glLogicOp MANGLE(LogicOp) +#define glMap1d MANGLE(Map1d) +#define glMap1f MANGLE(Map1f) +#define glMap2d MANGLE(Map2d) +#define glMap2f MANGLE(Map2f) +#define glMapBufferARB MANGLE(MapBufferARB) +#define glMapBuffer MANGLE(MapBuffer) +#define glMapBufferRange MANGLE(MapBufferRange) +#define glMapControlPointsNV MANGLE(MapControlPointsNV) +#define glMapGrid1d MANGLE(MapGrid1d) +#define glMapGrid1f MANGLE(MapGrid1f) +#define glMapGrid2d MANGLE(MapGrid2d) +#define glMapGrid2f MANGLE(MapGrid2f) +#define glMapNamedBufferEXT MANGLE(MapNamedBufferEXT) +#define glMapObjectBufferATI MANGLE(MapObjectBufferATI) +#define glMapParameterfvNV MANGLE(MapParameterfvNV) +#define glMapParameterivNV MANGLE(MapParameterivNV) +#define glMaterialf MANGLE(Materialf) +#define glMaterialfv MANGLE(Materialfv) +#define glMateriali MANGLE(Materiali) +#define glMaterialiv MANGLE(Materialiv) +#define glMatrixFrustumEXT MANGLE(MatrixFrustumEXT) +#define glMatrixIndexPointerARB MANGLE(MatrixIndexPointerARB) +#define glMatrixIndexubvARB MANGLE(MatrixIndexubvARB) +#define glMatrixIndexuivARB MANGLE(MatrixIndexuivARB) +#define glMatrixIndexusvARB MANGLE(MatrixIndexusvARB) +#define glMatrixLoaddEXT MANGLE(MatrixLoaddEXT) +#define glMatrixLoadfEXT MANGLE(MatrixLoadfEXT) +#define glMatrixLoadIdentityEXT MANGLE(MatrixLoadIdentityEXT) +#define glMatrixLoadTransposedEXT MANGLE(MatrixLoadTransposedEXT) +#define glMatrixLoadTransposefEXT MANGLE(MatrixLoadTransposefEXT) +#define glMatrixMode MANGLE(MatrixMode) +#define glMatrixMultdEXT MANGLE(MatrixMultdEXT) +#define glMatrixMultfEXT MANGLE(MatrixMultfEXT) +#define glMatrixMultTransposedEXT MANGLE(MatrixMultTransposedEXT) +#define glMatrixMultTransposefEXT MANGLE(MatrixMultTransposefEXT) +#define glMatrixOrthoEXT MANGLE(MatrixOrthoEXT) +#define glMatrixPopEXT MANGLE(MatrixPopEXT) +#define glMatrixPushEXT MANGLE(MatrixPushEXT) +#define glMatrixRotatedEXT MANGLE(MatrixRotatedEXT) +#define glMatrixRotatefEXT MANGLE(MatrixRotatefEXT) +#define glMatrixScaledEXT MANGLE(MatrixScaledEXT) +#define glMatrixScalefEXT MANGLE(MatrixScalefEXT) +#define glMatrixTranslatedEXT MANGLE(MatrixTranslatedEXT) +#define glMatrixTranslatefEXT MANGLE(MatrixTranslatefEXT) +#define glMinmaxEXT MANGLE(MinmaxEXT) +#define glMinmax MANGLE(Minmax) +#define glMultiDrawArraysEXT MANGLE(MultiDrawArraysEXT) +#define glMultiDrawArrays MANGLE(MultiDrawArrays) +#define glMultiDrawElementArrayAPPLE MANGLE(MultiDrawElementArrayAPPLE) +#define glMultiDrawElementsEXT MANGLE(MultiDrawElementsEXT) +#define glMultiDrawElements MANGLE(MultiDrawElements) +#define glMultiDrawRangeElementArrayAPPLE MANGLE(MultiDrawRangeElementArrayAPPLE) +#define glMultiModeDrawArraysIBM MANGLE(MultiModeDrawArraysIBM) +#define glMultiModeDrawElementsIBM MANGLE(MultiModeDrawElementsIBM) +#define glMultiTexBufferEXT MANGLE(MultiTexBufferEXT) +#define glMultiTexCoord1dARB MANGLE(MultiTexCoord1dARB) +#define glMultiTexCoord1d MANGLE(MultiTexCoord1d) +#define glMultiTexCoord1dvARB MANGLE(MultiTexCoord1dvARB) +#define glMultiTexCoord1dv MANGLE(MultiTexCoord1dv) +#define glMultiTexCoord1fARB MANGLE(MultiTexCoord1fARB) +#define glMultiTexCoord1f MANGLE(MultiTexCoord1f) +#define glMultiTexCoord1fvARB MANGLE(MultiTexCoord1fvARB) +#define glMultiTexCoord1fv MANGLE(MultiTexCoord1fv) +#define glMultiTexCoord1hNV MANGLE(MultiTexCoord1hNV) +#define glMultiTexCoord1hvNV MANGLE(MultiTexCoord1hvNV) +#define glMultiTexCoord1iARB MANGLE(MultiTexCoord1iARB) +#define glMultiTexCoord1i MANGLE(MultiTexCoord1i) +#define glMultiTexCoord1ivARB MANGLE(MultiTexCoord1ivARB) +#define glMultiTexCoord1iv MANGLE(MultiTexCoord1iv) +#define glMultiTexCoord1sARB MANGLE(MultiTexCoord1sARB) +#define glMultiTexCoord1s MANGLE(MultiTexCoord1s) +#define glMultiTexCoord1svARB MANGLE(MultiTexCoord1svARB) +#define glMultiTexCoord1sv MANGLE(MultiTexCoord1sv) +#define glMultiTexCoord2dARB MANGLE(MultiTexCoord2dARB) +#define glMultiTexCoord2d MANGLE(MultiTexCoord2d) +#define glMultiTexCoord2dvARB MANGLE(MultiTexCoord2dvARB) +#define glMultiTexCoord2dv MANGLE(MultiTexCoord2dv) +#define glMultiTexCoord2fARB MANGLE(MultiTexCoord2fARB) +#define glMultiTexCoord2f MANGLE(MultiTexCoord2f) +#define glMultiTexCoord2fvARB MANGLE(MultiTexCoord2fvARB) +#define glMultiTexCoord2fv MANGLE(MultiTexCoord2fv) +#define glMultiTexCoord2hNV MANGLE(MultiTexCoord2hNV) +#define glMultiTexCoord2hvNV MANGLE(MultiTexCoord2hvNV) +#define glMultiTexCoord2iARB MANGLE(MultiTexCoord2iARB) +#define glMultiTexCoord2i MANGLE(MultiTexCoord2i) +#define glMultiTexCoord2ivARB MANGLE(MultiTexCoord2ivARB) +#define glMultiTexCoord2iv MANGLE(MultiTexCoord2iv) +#define glMultiTexCoord2sARB MANGLE(MultiTexCoord2sARB) +#define glMultiTexCoord2s MANGLE(MultiTexCoord2s) +#define glMultiTexCoord2svARB MANGLE(MultiTexCoord2svARB) +#define glMultiTexCoord2sv MANGLE(MultiTexCoord2sv) +#define glMultiTexCoord3dARB MANGLE(MultiTexCoord3dARB) +#define glMultiTexCoord3d MANGLE(MultiTexCoord3d) +#define glMultiTexCoord3dvARB MANGLE(MultiTexCoord3dvARB) +#define glMultiTexCoord3dv MANGLE(MultiTexCoord3dv) +#define glMultiTexCoord3fARB MANGLE(MultiTexCoord3fARB) +#define glMultiTexCoord3f MANGLE(MultiTexCoord3f) +#define glMultiTexCoord3fvARB MANGLE(MultiTexCoord3fvARB) +#define glMultiTexCoord3fv MANGLE(MultiTexCoord3fv) +#define glMultiTexCoord3hNV MANGLE(MultiTexCoord3hNV) +#define glMultiTexCoord3hvNV MANGLE(MultiTexCoord3hvNV) +#define glMultiTexCoord3iARB MANGLE(MultiTexCoord3iARB) +#define glMultiTexCoord3i MANGLE(MultiTexCoord3i) +#define glMultiTexCoord3ivARB MANGLE(MultiTexCoord3ivARB) +#define glMultiTexCoord3iv MANGLE(MultiTexCoord3iv) +#define glMultiTexCoord3sARB MANGLE(MultiTexCoord3sARB) +#define glMultiTexCoord3s MANGLE(MultiTexCoord3s) +#define glMultiTexCoord3svARB MANGLE(MultiTexCoord3svARB) +#define glMultiTexCoord3sv MANGLE(MultiTexCoord3sv) +#define glMultiTexCoord4dARB MANGLE(MultiTexCoord4dARB) +#define glMultiTexCoord4d MANGLE(MultiTexCoord4d) +#define glMultiTexCoord4dvARB MANGLE(MultiTexCoord4dvARB) +#define glMultiTexCoord4dv MANGLE(MultiTexCoord4dv) +#define glMultiTexCoord4fARB MANGLE(MultiTexCoord4fARB) +#define glMultiTexCoord4f MANGLE(MultiTexCoord4f) +#define glMultiTexCoord4fvARB MANGLE(MultiTexCoord4fvARB) +#define glMultiTexCoord4fv MANGLE(MultiTexCoord4fv) +#define glMultiTexCoord4hNV MANGLE(MultiTexCoord4hNV) +#define glMultiTexCoord4hvNV MANGLE(MultiTexCoord4hvNV) +#define glMultiTexCoord4iARB MANGLE(MultiTexCoord4iARB) +#define glMultiTexCoord4i MANGLE(MultiTexCoord4i) +#define glMultiTexCoord4ivARB MANGLE(MultiTexCoord4ivARB) +#define glMultiTexCoord4iv MANGLE(MultiTexCoord4iv) +#define glMultiTexCoord4sARB MANGLE(MultiTexCoord4sARB) +#define glMultiTexCoord4s MANGLE(MultiTexCoord4s) +#define glMultiTexCoord4svARB MANGLE(MultiTexCoord4svARB) +#define glMultiTexCoord4sv MANGLE(MultiTexCoord4sv) +#define glMultiTexCoordPointerEXT MANGLE(MultiTexCoordPointerEXT) +#define glMultiTexEnvfEXT MANGLE(MultiTexEnvfEXT) +#define glMultiTexEnvfvEXT MANGLE(MultiTexEnvfvEXT) +#define glMultiTexEnviEXT MANGLE(MultiTexEnviEXT) +#define glMultiTexEnvivEXT MANGLE(MultiTexEnvivEXT) +#define glMultiTexGendEXT MANGLE(MultiTexGendEXT) +#define glMultiTexGendvEXT MANGLE(MultiTexGendvEXT) +#define glMultiTexGenfEXT MANGLE(MultiTexGenfEXT) +#define glMultiTexGenfvEXT MANGLE(MultiTexGenfvEXT) +#define glMultiTexGeniEXT MANGLE(MultiTexGeniEXT) +#define glMultiTexGenivEXT MANGLE(MultiTexGenivEXT) +#define glMultiTexImage1DEXT MANGLE(MultiTexImage1DEXT) +#define glMultiTexImage2DEXT MANGLE(MultiTexImage2DEXT) +#define glMultiTexImage3DEXT MANGLE(MultiTexImage3DEXT) +#define glMultiTexParameterfEXT MANGLE(MultiTexParameterfEXT) +#define glMultiTexParameterfvEXT MANGLE(MultiTexParameterfvEXT) +#define glMultiTexParameteriEXT MANGLE(MultiTexParameteriEXT) +#define glMultiTexParameterIivEXT MANGLE(MultiTexParameterIivEXT) +#define glMultiTexParameterIuivEXT MANGLE(MultiTexParameterIuivEXT) +#define glMultiTexParameterivEXT MANGLE(MultiTexParameterivEXT) +#define glMultiTexRenderbufferEXT MANGLE(MultiTexRenderbufferEXT) +#define glMultiTexSubImage1DEXT MANGLE(MultiTexSubImage1DEXT) +#define glMultiTexSubImage2DEXT MANGLE(MultiTexSubImage2DEXT) +#define glMultiTexSubImage3DEXT MANGLE(MultiTexSubImage3DEXT) +#define glMultMatrixd MANGLE(MultMatrixd) +#define glMultMatrixf MANGLE(MultMatrixf) +#define glMultTransposeMatrixdARB MANGLE(MultTransposeMatrixdARB) +#define glMultTransposeMatrixd MANGLE(MultTransposeMatrixd) +#define glMultTransposeMatrixfARB MANGLE(MultTransposeMatrixfARB) +#define glMultTransposeMatrixf MANGLE(MultTransposeMatrixf) +#define glNamedBufferDataEXT MANGLE(NamedBufferDataEXT) +#define glNamedBufferSubDataEXT MANGLE(NamedBufferSubDataEXT) +#define glNamedFramebufferRenderbufferEXT MANGLE(NamedFramebufferRenderbufferEXT) +#define glNamedFramebufferTexture1DEXT MANGLE(NamedFramebufferTexture1DEXT) +#define glNamedFramebufferTexture2DEXT MANGLE(NamedFramebufferTexture2DEXT) +#define glNamedFramebufferTexture3DEXT MANGLE(NamedFramebufferTexture3DEXT) +#define glNamedFramebufferTextureEXT MANGLE(NamedFramebufferTextureEXT) +#define glNamedFramebufferTextureFaceEXT MANGLE(NamedFramebufferTextureFaceEXT) +#define glNamedFramebufferTextureLayerEXT MANGLE(NamedFramebufferTextureLayerEXT) +#define glNamedProgramLocalParameter4dEXT MANGLE(NamedProgramLocalParameter4dEXT) +#define glNamedProgramLocalParameter4dvEXT MANGLE(NamedProgramLocalParameter4dvEXT) +#define glNamedProgramLocalParameter4fEXT MANGLE(NamedProgramLocalParameter4fEXT) +#define glNamedProgramLocalParameter4fvEXT MANGLE(NamedProgramLocalParameter4fvEXT) +#define glNamedProgramLocalParameterI4iEXT MANGLE(NamedProgramLocalParameterI4iEXT) +#define glNamedProgramLocalParameterI4ivEXT MANGLE(NamedProgramLocalParameterI4ivEXT) +#define glNamedProgramLocalParameterI4uiEXT MANGLE(NamedProgramLocalParameterI4uiEXT) +#define glNamedProgramLocalParameterI4uivEXT MANGLE(NamedProgramLocalParameterI4uivEXT) +#define glNamedProgramLocalParameters4fvEXT MANGLE(NamedProgramLocalParameters4fvEXT) +#define glNamedProgramLocalParametersI4ivEXT MANGLE(NamedProgramLocalParametersI4ivEXT) +#define glNamedProgramLocalParametersI4uivEXT MANGLE(NamedProgramLocalParametersI4uivEXT) +#define glNamedProgramStringEXT MANGLE(NamedProgramStringEXT) +#define glNamedRenderbufferStorageEXT MANGLE(NamedRenderbufferStorageEXT) +#define glNamedRenderbufferStorageMultisampleCoverageEXT MANGLE(NamedRenderbufferStorageMultisampleCoverageEXT) +#define glNamedRenderbufferStorageMultisampleEXT MANGLE(NamedRenderbufferStorageMultisampleEXT) +#define glNewList MANGLE(NewList) +#define glNewObjectBufferATI MANGLE(NewObjectBufferATI) +#define glNormal3b MANGLE(Normal3b) +#define glNormal3bv MANGLE(Normal3bv) +#define glNormal3d MANGLE(Normal3d) +#define glNormal3dv MANGLE(Normal3dv) +#define glNormal3f MANGLE(Normal3f) +#define glNormal3fVertex3fSUN MANGLE(Normal3fVertex3fSUN) +#define glNormal3fVertex3fvSUN MANGLE(Normal3fVertex3fvSUN) +#define glNormal3fv MANGLE(Normal3fv) +#define glNormal3hNV MANGLE(Normal3hNV) +#define glNormal3hvNV MANGLE(Normal3hvNV) +#define glNormal3i MANGLE(Normal3i) +#define glNormal3iv MANGLE(Normal3iv) +#define glNormal3s MANGLE(Normal3s) +#define glNormal3sv MANGLE(Normal3sv) +#define glNormalPointerEXT MANGLE(NormalPointerEXT) +#define glNormalPointerListIBM MANGLE(NormalPointerListIBM) +#define glNormalPointer MANGLE(NormalPointer) +#define glNormalPointervINTEL MANGLE(NormalPointervINTEL) +#define glNormalStream3bATI MANGLE(NormalStream3bATI) +#define glNormalStream3bvATI MANGLE(NormalStream3bvATI) +#define glNormalStream3dATI MANGLE(NormalStream3dATI) +#define glNormalStream3dvATI MANGLE(NormalStream3dvATI) +#define glNormalStream3fATI MANGLE(NormalStream3fATI) +#define glNormalStream3fvATI MANGLE(NormalStream3fvATI) +#define glNormalStream3iATI MANGLE(NormalStream3iATI) +#define glNormalStream3ivATI MANGLE(NormalStream3ivATI) +#define glNormalStream3sATI MANGLE(NormalStream3sATI) +#define glNormalStream3svATI MANGLE(NormalStream3svATI) +#define glOrtho MANGLE(Ortho) +#define glPassTexCoordATI MANGLE(PassTexCoordATI) +#define glPassThrough MANGLE(PassThrough) +#define glPauseTransformFeedbackNV MANGLE(PauseTransformFeedbackNV) +#define glPixelDataRangeNV MANGLE(PixelDataRangeNV) +#define glPixelMapfv MANGLE(PixelMapfv) +#define glPixelMapuiv MANGLE(PixelMapuiv) +#define glPixelMapusv MANGLE(PixelMapusv) +#define glPixelStoref MANGLE(PixelStoref) +#define glPixelStorei MANGLE(PixelStorei) +#define glPixelTexGenParameterfSGIS MANGLE(PixelTexGenParameterfSGIS) +#define glPixelTexGenParameterfvSGIS MANGLE(PixelTexGenParameterfvSGIS) +#define glPixelTexGenParameteriSGIS MANGLE(PixelTexGenParameteriSGIS) +#define glPixelTexGenParameterivSGIS MANGLE(PixelTexGenParameterivSGIS) +#define glPixelTexGenSGIX MANGLE(PixelTexGenSGIX) +#define glPixelTransferf MANGLE(PixelTransferf) +#define glPixelTransferi MANGLE(PixelTransferi) +#define glPixelTransformParameterfEXT MANGLE(PixelTransformParameterfEXT) +#define glPixelTransformParameterfvEXT MANGLE(PixelTransformParameterfvEXT) +#define glPixelTransformParameteriEXT MANGLE(PixelTransformParameteriEXT) +#define glPixelTransformParameterivEXT MANGLE(PixelTransformParameterivEXT) +#define glPixelZoom MANGLE(PixelZoom) +#define glPNTrianglesfATI MANGLE(PNTrianglesfATI) +#define glPNTrianglesiATI MANGLE(PNTrianglesiATI) +#define glPointParameterfARB MANGLE(PointParameterfARB) +#define glPointParameterfEXT MANGLE(PointParameterfEXT) +#define glPointParameterf MANGLE(PointParameterf) +#define glPointParameterfSGIS MANGLE(PointParameterfSGIS) +#define glPointParameterfvARB MANGLE(PointParameterfvARB) +#define glPointParameterfvEXT MANGLE(PointParameterfvEXT) +#define glPointParameterfv MANGLE(PointParameterfv) +#define glPointParameterfvSGIS MANGLE(PointParameterfvSGIS) +#define glPointParameteri MANGLE(PointParameteri) +#define glPointParameteriNV MANGLE(PointParameteriNV) +#define glPointParameteriv MANGLE(PointParameteriv) +#define glPointParameterivNV MANGLE(PointParameterivNV) +#define glPointSize MANGLE(PointSize) +#define glPollAsyncSGIX MANGLE(PollAsyncSGIX) +#define glPollInstrumentsSGIX MANGLE(PollInstrumentsSGIX) +#define glPolygonMode MANGLE(PolygonMode) +#define glPolygonOffsetEXT MANGLE(PolygonOffsetEXT) +#define glPolygonOffset MANGLE(PolygonOffset) +#define glPolygonStipple MANGLE(PolygonStipple) +#define glPopAttrib MANGLE(PopAttrib) +#define glPopClientAttrib MANGLE(PopClientAttrib) +#define glPopMatrix MANGLE(PopMatrix) +#define glPopName MANGLE(PopName) +#define glPresentFrameDualFillNV MANGLE(PresentFrameDualFillNV) +#define glPresentFrameKeyedNV MANGLE(PresentFrameKeyedNV) +#define glPrimitiveRestartIndex MANGLE(PrimitiveRestartIndex) +#define glPrimitiveRestartIndexNV MANGLE(PrimitiveRestartIndexNV) +#define glPrimitiveRestartNV MANGLE(PrimitiveRestartNV) +#define glPrioritizeTexturesEXT MANGLE(PrioritizeTexturesEXT) +#define glPrioritizeTextures MANGLE(PrioritizeTextures) +#define glProgramBufferParametersfvNV MANGLE(ProgramBufferParametersfvNV) +#define glProgramBufferParametersIivNV MANGLE(ProgramBufferParametersIivNV) +#define glProgramBufferParametersIuivNV MANGLE(ProgramBufferParametersIuivNV) +#define glProgramCallbackMESA MANGLE(ProgramCallbackMESA) +#define glProgramEnvParameter4dARB MANGLE(ProgramEnvParameter4dARB) +#define glProgramEnvParameter4dvARB MANGLE(ProgramEnvParameter4dvARB) +#define glProgramEnvParameter4fARB MANGLE(ProgramEnvParameter4fARB) +#define glProgramEnvParameter4fvARB MANGLE(ProgramEnvParameter4fvARB) +#define glProgramEnvParameterI4iNV MANGLE(ProgramEnvParameterI4iNV) +#define glProgramEnvParameterI4ivNV MANGLE(ProgramEnvParameterI4ivNV) +#define glProgramEnvParameterI4uiNV MANGLE(ProgramEnvParameterI4uiNV) +#define glProgramEnvParameterI4uivNV MANGLE(ProgramEnvParameterI4uivNV) +#define glProgramEnvParameters4fvEXT MANGLE(ProgramEnvParameters4fvEXT) +#define glProgramEnvParametersI4ivNV MANGLE(ProgramEnvParametersI4ivNV) +#define glProgramEnvParametersI4uivNV MANGLE(ProgramEnvParametersI4uivNV) +#define glProgramLocalParameter4dARB MANGLE(ProgramLocalParameter4dARB) +#define glProgramLocalParameter4dvARB MANGLE(ProgramLocalParameter4dvARB) +#define glProgramLocalParameter4fARB MANGLE(ProgramLocalParameter4fARB) +#define glProgramLocalParameter4fvARB MANGLE(ProgramLocalParameter4fvARB) +#define glProgramLocalParameterI4iNV MANGLE(ProgramLocalParameterI4iNV) +#define glProgramLocalParameterI4ivNV MANGLE(ProgramLocalParameterI4ivNV) +#define glProgramLocalParameterI4uiNV MANGLE(ProgramLocalParameterI4uiNV) +#define glProgramLocalParameterI4uivNV MANGLE(ProgramLocalParameterI4uivNV) +#define glProgramLocalParameters4fvEXT MANGLE(ProgramLocalParameters4fvEXT) +#define glProgramLocalParametersI4ivNV MANGLE(ProgramLocalParametersI4ivNV) +#define glProgramLocalParametersI4uivNV MANGLE(ProgramLocalParametersI4uivNV) +#define glProgramNamedParameter4dNV MANGLE(ProgramNamedParameter4dNV) +#define glProgramNamedParameter4dvNV MANGLE(ProgramNamedParameter4dvNV) +#define glProgramNamedParameter4fNV MANGLE(ProgramNamedParameter4fNV) +#define glProgramNamedParameter4fvNV MANGLE(ProgramNamedParameter4fvNV) +#define glProgramParameter4dNV MANGLE(ProgramParameter4dNV) +#define glProgramParameter4dvNV MANGLE(ProgramParameter4dvNV) +#define glProgramParameter4fNV MANGLE(ProgramParameter4fNV) +#define glProgramParameter4fvNV MANGLE(ProgramParameter4fvNV) +#define glProgramParameteriARB MANGLE(ProgramParameteriARB) +#define glProgramParameteriEXT MANGLE(ProgramParameteriEXT) +#define glProgramParameters4dvNV MANGLE(ProgramParameters4dvNV) +#define glProgramParameters4fvNV MANGLE(ProgramParameters4fvNV) +#define glProgramStringARB MANGLE(ProgramStringARB) +#define glProgramUniform1fEXT MANGLE(ProgramUniform1fEXT) +#define glProgramUniform1fvEXT MANGLE(ProgramUniform1fvEXT) +#define glProgramUniform1iEXT MANGLE(ProgramUniform1iEXT) +#define glProgramUniform1ivEXT MANGLE(ProgramUniform1ivEXT) +#define glProgramUniform1uiEXT MANGLE(ProgramUniform1uiEXT) +#define glProgramUniform1uivEXT MANGLE(ProgramUniform1uivEXT) +#define glProgramUniform2fEXT MANGLE(ProgramUniform2fEXT) +#define glProgramUniform2fvEXT MANGLE(ProgramUniform2fvEXT) +#define glProgramUniform2iEXT MANGLE(ProgramUniform2iEXT) +#define glProgramUniform2ivEXT MANGLE(ProgramUniform2ivEXT) +#define glProgramUniform2uiEXT MANGLE(ProgramUniform2uiEXT) +#define glProgramUniform2uivEXT MANGLE(ProgramUniform2uivEXT) +#define glProgramUniform3fEXT MANGLE(ProgramUniform3fEXT) +#define glProgramUniform3fvEXT MANGLE(ProgramUniform3fvEXT) +#define glProgramUniform3iEXT MANGLE(ProgramUniform3iEXT) +#define glProgramUniform3ivEXT MANGLE(ProgramUniform3ivEXT) +#define glProgramUniform3uiEXT MANGLE(ProgramUniform3uiEXT) +#define glProgramUniform3uivEXT MANGLE(ProgramUniform3uivEXT) +#define glProgramUniform4fEXT MANGLE(ProgramUniform4fEXT) +#define glProgramUniform4fvEXT MANGLE(ProgramUniform4fvEXT) +#define glProgramUniform4iEXT MANGLE(ProgramUniform4iEXT) +#define glProgramUniform4ivEXT MANGLE(ProgramUniform4ivEXT) +#define glProgramUniform4uiEXT MANGLE(ProgramUniform4uiEXT) +#define glProgramUniform4uivEXT MANGLE(ProgramUniform4uivEXT) +#define glProgramUniformMatrix2fvEXT MANGLE(ProgramUniformMatrix2fvEXT) +#define glProgramUniformMatrix2x3fvEXT MANGLE(ProgramUniformMatrix2x3fvEXT) +#define glProgramUniformMatrix2x4fvEXT MANGLE(ProgramUniformMatrix2x4fvEXT) +#define glProgramUniformMatrix3fvEXT MANGLE(ProgramUniformMatrix3fvEXT) +#define glProgramUniformMatrix3x2fvEXT MANGLE(ProgramUniformMatrix3x2fvEXT) +#define glProgramUniformMatrix3x4fvEXT MANGLE(ProgramUniformMatrix3x4fvEXT) +#define glProgramUniformMatrix4fvEXT MANGLE(ProgramUniformMatrix4fvEXT) +#define glProgramUniformMatrix4x2fvEXT MANGLE(ProgramUniformMatrix4x2fvEXT) +#define glProgramUniformMatrix4x3fvEXT MANGLE(ProgramUniformMatrix4x3fvEXT) +#define glProgramVertexLimitNV MANGLE(ProgramVertexLimitNV) +#define glProvokingVertexEXT MANGLE(ProvokingVertexEXT) +#define glPushAttrib MANGLE(PushAttrib) +#define glPushClientAttribDefaultEXT MANGLE(PushClientAttribDefaultEXT) +#define glPushClientAttrib MANGLE(PushClientAttrib) +#define glPushMatrix MANGLE(PushMatrix) +#define glPushName MANGLE(PushName) +#define glRasterPos2d MANGLE(RasterPos2d) +#define glRasterPos2dv MANGLE(RasterPos2dv) +#define glRasterPos2f MANGLE(RasterPos2f) +#define glRasterPos2fv MANGLE(RasterPos2fv) +#define glRasterPos2i MANGLE(RasterPos2i) +#define glRasterPos2iv MANGLE(RasterPos2iv) +#define glRasterPos2s MANGLE(RasterPos2s) +#define glRasterPos2sv MANGLE(RasterPos2sv) +#define glRasterPos3d MANGLE(RasterPos3d) +#define glRasterPos3dv MANGLE(RasterPos3dv) +#define glRasterPos3f MANGLE(RasterPos3f) +#define glRasterPos3fv MANGLE(RasterPos3fv) +#define glRasterPos3i MANGLE(RasterPos3i) +#define glRasterPos3iv MANGLE(RasterPos3iv) +#define glRasterPos3s MANGLE(RasterPos3s) +#define glRasterPos3sv MANGLE(RasterPos3sv) +#define glRasterPos4d MANGLE(RasterPos4d) +#define glRasterPos4dv MANGLE(RasterPos4dv) +#define glRasterPos4f MANGLE(RasterPos4f) +#define glRasterPos4fv MANGLE(RasterPos4fv) +#define glRasterPos4i MANGLE(RasterPos4i) +#define glRasterPos4iv MANGLE(RasterPos4iv) +#define glRasterPos4s MANGLE(RasterPos4s) +#define glRasterPos4sv MANGLE(RasterPos4sv) +#define glReadBuffer MANGLE(ReadBuffer) +#define glReadInstrumentsSGIX MANGLE(ReadInstrumentsSGIX) +#define glReadPixels MANGLE(ReadPixels) +#define glRectd MANGLE(Rectd) +#define glRectdv MANGLE(Rectdv) +#define glRectf MANGLE(Rectf) +#define glRectfv MANGLE(Rectfv) +#define glRecti MANGLE(Recti) +#define glRectiv MANGLE(Rectiv) +#define glRects MANGLE(Rects) +#define glRectsv MANGLE(Rectsv) +#define glReferencePlaneSGIX MANGLE(ReferencePlaneSGIX) +#define glRenderbufferStorageEXT MANGLE(RenderbufferStorageEXT) +#define glRenderbufferStorage MANGLE(RenderbufferStorage) +#define glRenderbufferStorageMultisampleCoverageNV MANGLE(RenderbufferStorageMultisampleCoverageNV) +#define glRenderbufferStorageMultisampleEXT MANGLE(RenderbufferStorageMultisampleEXT) +#define glRenderbufferStorageMultisample MANGLE(RenderbufferStorageMultisample) +#define glRenderMode MANGLE(RenderMode) +#define glReplacementCodePointerSUN MANGLE(ReplacementCodePointerSUN) +#define glReplacementCodeubSUN MANGLE(ReplacementCodeubSUN) +#define glReplacementCodeubvSUN MANGLE(ReplacementCodeubvSUN) +#define glReplacementCodeuiColor3fVertex3fSUN MANGLE(ReplacementCodeuiColor3fVertex3fSUN) +#define glReplacementCodeuiColor3fVertex3fvSUN MANGLE(ReplacementCodeuiColor3fVertex3fvSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiColor4ubVertex3fSUN MANGLE(ReplacementCodeuiColor4ubVertex3fSUN) +#define glReplacementCodeuiColor4ubVertex3fvSUN MANGLE(ReplacementCodeuiColor4ubVertex3fvSUN) +#define glReplacementCodeuiNormal3fVertex3fSUN MANGLE(ReplacementCodeuiNormal3fVertex3fSUN) +#define glReplacementCodeuiNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiNormal3fVertex3fvSUN) +#define glReplacementCodeuiSUN MANGLE(ReplacementCodeuiSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN) +#define glReplacementCodeuiTexCoord2fVertex3fSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fSUN) +#define glReplacementCodeuiTexCoord2fVertex3fvSUN MANGLE(ReplacementCodeuiTexCoord2fVertex3fvSUN) +#define glReplacementCodeuiVertex3fSUN MANGLE(ReplacementCodeuiVertex3fSUN) +#define glReplacementCodeuiVertex3fvSUN MANGLE(ReplacementCodeuiVertex3fvSUN) +#define glReplacementCodeuivSUN MANGLE(ReplacementCodeuivSUN) +#define glReplacementCodeusSUN MANGLE(ReplacementCodeusSUN) +#define glReplacementCodeusvSUN MANGLE(ReplacementCodeusvSUN) +#define glRequestResidentProgramsNV MANGLE(RequestResidentProgramsNV) +#define glResetHistogramEXT MANGLE(ResetHistogramEXT) +#define glResetHistogram MANGLE(ResetHistogram) +#define glResetMinmaxEXT MANGLE(ResetMinmaxEXT) +#define glResetMinmax MANGLE(ResetMinmax) +#define glResizeBuffersMESA MANGLE(ResizeBuffersMESA) +#define glResumeTransformFeedbackNV MANGLE(ResumeTransformFeedbackNV) +#define glRotated MANGLE(Rotated) +#define glRotatef MANGLE(Rotatef) +#define glSampleCoverageARB MANGLE(SampleCoverageARB) +#define glSampleCoverage MANGLE(SampleCoverage) +#define glSampleMapATI MANGLE(SampleMapATI) +#define glSampleMaskEXT MANGLE(SampleMaskEXT) +#define glSampleMaskIndexedNV MANGLE(SampleMaskIndexedNV) +#define glSampleMaskSGIS MANGLE(SampleMaskSGIS) +#define glSamplePatternEXT MANGLE(SamplePatternEXT) +#define glSamplePatternSGIS MANGLE(SamplePatternSGIS) +#define glScaled MANGLE(Scaled) +#define glScalef MANGLE(Scalef) +#define glScissor MANGLE(Scissor) +#define glSecondaryColor3bEXT MANGLE(SecondaryColor3bEXT) +#define glSecondaryColor3b MANGLE(SecondaryColor3b) +#define glSecondaryColor3bvEXT MANGLE(SecondaryColor3bvEXT) +#define glSecondaryColor3bv MANGLE(SecondaryColor3bv) +#define glSecondaryColor3dEXT MANGLE(SecondaryColor3dEXT) +#define glSecondaryColor3d MANGLE(SecondaryColor3d) +#define glSecondaryColor3dvEXT MANGLE(SecondaryColor3dvEXT) +#define glSecondaryColor3dv MANGLE(SecondaryColor3dv) +#define glSecondaryColor3fEXT MANGLE(SecondaryColor3fEXT) +#define glSecondaryColor3f MANGLE(SecondaryColor3f) +#define glSecondaryColor3fvEXT MANGLE(SecondaryColor3fvEXT) +#define glSecondaryColor3fv MANGLE(SecondaryColor3fv) +#define glSecondaryColor3hNV MANGLE(SecondaryColor3hNV) +#define glSecondaryColor3hvNV MANGLE(SecondaryColor3hvNV) +#define glSecondaryColor3iEXT MANGLE(SecondaryColor3iEXT) +#define glSecondaryColor3i MANGLE(SecondaryColor3i) +#define glSecondaryColor3ivEXT MANGLE(SecondaryColor3ivEXT) +#define glSecondaryColor3iv MANGLE(SecondaryColor3iv) +#define glSecondaryColor3sEXT MANGLE(SecondaryColor3sEXT) +#define glSecondaryColor3s MANGLE(SecondaryColor3s) +#define glSecondaryColor3svEXT MANGLE(SecondaryColor3svEXT) +#define glSecondaryColor3sv MANGLE(SecondaryColor3sv) +#define glSecondaryColor3ubEXT MANGLE(SecondaryColor3ubEXT) +#define glSecondaryColor3ub MANGLE(SecondaryColor3ub) +#define glSecondaryColor3ubvEXT MANGLE(SecondaryColor3ubvEXT) +#define glSecondaryColor3ubv MANGLE(SecondaryColor3ubv) +#define glSecondaryColor3uiEXT MANGLE(SecondaryColor3uiEXT) +#define glSecondaryColor3ui MANGLE(SecondaryColor3ui) +#define glSecondaryColor3uivEXT MANGLE(SecondaryColor3uivEXT) +#define glSecondaryColor3uiv MANGLE(SecondaryColor3uiv) +#define glSecondaryColor3usEXT MANGLE(SecondaryColor3usEXT) +#define glSecondaryColor3us MANGLE(SecondaryColor3us) +#define glSecondaryColor3usvEXT MANGLE(SecondaryColor3usvEXT) +#define glSecondaryColor3usv MANGLE(SecondaryColor3usv) +#define glSecondaryColorPointerEXT MANGLE(SecondaryColorPointerEXT) +#define glSecondaryColorPointerListIBM MANGLE(SecondaryColorPointerListIBM) +#define glSecondaryColorPointer MANGLE(SecondaryColorPointer) +#define glSelectBuffer MANGLE(SelectBuffer) +#define glSelectPerfMonitorCountersAMD MANGLE(SelectPerfMonitorCountersAMD) +#define glSeparableFilter2DEXT MANGLE(SeparableFilter2DEXT) +#define glSeparableFilter2D MANGLE(SeparableFilter2D) +#define glSetFenceAPPLE MANGLE(SetFenceAPPLE) +#define glSetFenceNV MANGLE(SetFenceNV) +#define glSetFragmentShaderConstantATI MANGLE(SetFragmentShaderConstantATI) +#define glSetInvariantEXT MANGLE(SetInvariantEXT) +#define glSetLocalConstantEXT MANGLE(SetLocalConstantEXT) +#define glShadeModel MANGLE(ShadeModel) +#define glShaderOp1EXT MANGLE(ShaderOp1EXT) +#define glShaderOp2EXT MANGLE(ShaderOp2EXT) +#define glShaderOp3EXT MANGLE(ShaderOp3EXT) +#define glShaderSourceARB MANGLE(ShaderSourceARB) +#define glShaderSource MANGLE(ShaderSource) +#define glSharpenTexFuncSGIS MANGLE(SharpenTexFuncSGIS) +#define glSpriteParameterfSGIX MANGLE(SpriteParameterfSGIX) +#define glSpriteParameterfvSGIX MANGLE(SpriteParameterfvSGIX) +#define glSpriteParameteriSGIX MANGLE(SpriteParameteriSGIX) +#define glSpriteParameterivSGIX MANGLE(SpriteParameterivSGIX) +#define glStartInstrumentsSGIX MANGLE(StartInstrumentsSGIX) +#define glStencilClearTagEXT MANGLE(StencilClearTagEXT) +#define glStencilFunc MANGLE(StencilFunc) +#define glStencilFuncSeparateATI MANGLE(StencilFuncSeparateATI) +#define glStencilFuncSeparate MANGLE(StencilFuncSeparate) +#define glStencilMask MANGLE(StencilMask) +#define glStencilMaskSeparate MANGLE(StencilMaskSeparate) +#define glStencilOp MANGLE(StencilOp) +#define glStencilOpSeparateATI MANGLE(StencilOpSeparateATI) +#define glStencilOpSeparate MANGLE(StencilOpSeparate) +#define glStopInstrumentsSGIX MANGLE(StopInstrumentsSGIX) +#define glStringMarkerGREMEDY MANGLE(StringMarkerGREMEDY) +#define glSwizzleEXT MANGLE(SwizzleEXT) +#define glTagSampleBufferSGIX MANGLE(TagSampleBufferSGIX) +#define glTangent3bEXT MANGLE(Tangent3bEXT) +#define glTangent3bvEXT MANGLE(Tangent3bvEXT) +#define glTangent3dEXT MANGLE(Tangent3dEXT) +#define glTangent3dvEXT MANGLE(Tangent3dvEXT) +#define glTangent3fEXT MANGLE(Tangent3fEXT) +#define glTangent3fvEXT MANGLE(Tangent3fvEXT) +#define glTangent3iEXT MANGLE(Tangent3iEXT) +#define glTangent3ivEXT MANGLE(Tangent3ivEXT) +#define glTangent3sEXT MANGLE(Tangent3sEXT) +#define glTangent3svEXT MANGLE(Tangent3svEXT) +#define glTangentPointerEXT MANGLE(TangentPointerEXT) +#define glTbufferMask3DFX MANGLE(TbufferMask3DFX) +#define glTessellationFactorAMD MANGLE(TessellationFactorAMD) +#define glTessellationModeAMD MANGLE(TessellationModeAMD) +#define glTestFenceAPPLE MANGLE(TestFenceAPPLE) +#define glTestFenceNV MANGLE(TestFenceNV) +#define glTestObjectAPPLE MANGLE(TestObjectAPPLE) +#define glTexBufferARB MANGLE(TexBufferARB) +#define glTexBufferEXT MANGLE(TexBufferEXT) +#define glTexBuffer MANGLE(TexBuffer) +#define glTexBumpParameterfvATI MANGLE(TexBumpParameterfvATI) +#define glTexBumpParameterivATI MANGLE(TexBumpParameterivATI) +#define glTexCoord1d MANGLE(TexCoord1d) +#define glTexCoord1dv MANGLE(TexCoord1dv) +#define glTexCoord1f MANGLE(TexCoord1f) +#define glTexCoord1fv MANGLE(TexCoord1fv) +#define glTexCoord1hNV MANGLE(TexCoord1hNV) +#define glTexCoord1hvNV MANGLE(TexCoord1hvNV) +#define glTexCoord1i MANGLE(TexCoord1i) +#define glTexCoord1iv MANGLE(TexCoord1iv) +#define glTexCoord1s MANGLE(TexCoord1s) +#define glTexCoord1sv MANGLE(TexCoord1sv) +#define glTexCoord2d MANGLE(TexCoord2d) +#define glTexCoord2dv MANGLE(TexCoord2dv) +#define glTexCoord2fColor3fVertex3fSUN MANGLE(TexCoord2fColor3fVertex3fSUN) +#define glTexCoord2fColor3fVertex3fvSUN MANGLE(TexCoord2fColor3fVertex3fvSUN) +#define glTexCoord2fColor4fNormal3fVertex3fSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fSUN) +#define glTexCoord2fColor4fNormal3fVertex3fvSUN MANGLE(TexCoord2fColor4fNormal3fVertex3fvSUN) +#define glTexCoord2fColor4ubVertex3fSUN MANGLE(TexCoord2fColor4ubVertex3fSUN) +#define glTexCoord2fColor4ubVertex3fvSUN MANGLE(TexCoord2fColor4ubVertex3fvSUN) +#define glTexCoord2f MANGLE(TexCoord2f) +#define glTexCoord2fNormal3fVertex3fSUN MANGLE(TexCoord2fNormal3fVertex3fSUN) +#define glTexCoord2fNormal3fVertex3fvSUN MANGLE(TexCoord2fNormal3fVertex3fvSUN) +#define glTexCoord2fVertex3fSUN MANGLE(TexCoord2fVertex3fSUN) +#define glTexCoord2fVertex3fvSUN MANGLE(TexCoord2fVertex3fvSUN) +#define glTexCoord2fv MANGLE(TexCoord2fv) +#define glTexCoord2hNV MANGLE(TexCoord2hNV) +#define glTexCoord2hvNV MANGLE(TexCoord2hvNV) +#define glTexCoord2i MANGLE(TexCoord2i) +#define glTexCoord2iv MANGLE(TexCoord2iv) +#define glTexCoord2s MANGLE(TexCoord2s) +#define glTexCoord2sv MANGLE(TexCoord2sv) +#define glTexCoord3d MANGLE(TexCoord3d) +#define glTexCoord3dv MANGLE(TexCoord3dv) +#define glTexCoord3f MANGLE(TexCoord3f) +#define glTexCoord3fv MANGLE(TexCoord3fv) +#define glTexCoord3hNV MANGLE(TexCoord3hNV) +#define glTexCoord3hvNV MANGLE(TexCoord3hvNV) +#define glTexCoord3i MANGLE(TexCoord3i) +#define glTexCoord3iv MANGLE(TexCoord3iv) +#define glTexCoord3s MANGLE(TexCoord3s) +#define glTexCoord3sv MANGLE(TexCoord3sv) +#define glTexCoord4d MANGLE(TexCoord4d) +#define glTexCoord4dv MANGLE(TexCoord4dv) +#define glTexCoord4fColor4fNormal3fVertex4fSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fSUN) +#define glTexCoord4fColor4fNormal3fVertex4fvSUN MANGLE(TexCoord4fColor4fNormal3fVertex4fvSUN) +#define glTexCoord4f MANGLE(TexCoord4f) +#define glTexCoord4fVertex4fSUN MANGLE(TexCoord4fVertex4fSUN) +#define glTexCoord4fVertex4fvSUN MANGLE(TexCoord4fVertex4fvSUN) +#define glTexCoord4fv MANGLE(TexCoord4fv) +#define glTexCoord4hNV MANGLE(TexCoord4hNV) +#define glTexCoord4hvNV MANGLE(TexCoord4hvNV) +#define glTexCoord4i MANGLE(TexCoord4i) +#define glTexCoord4iv MANGLE(TexCoord4iv) +#define glTexCoord4s MANGLE(TexCoord4s) +#define glTexCoord4sv MANGLE(TexCoord4sv) +#define glTexCoordPointerEXT MANGLE(TexCoordPointerEXT) +#define glTexCoordPointerListIBM MANGLE(TexCoordPointerListIBM) +#define glTexCoordPointer MANGLE(TexCoordPointer) +#define glTexCoordPointervINTEL MANGLE(TexCoordPointervINTEL) +#define glTexEnvf MANGLE(TexEnvf) +#define glTexEnvfv MANGLE(TexEnvfv) +#define glTexEnvi MANGLE(TexEnvi) +#define glTexEnviv MANGLE(TexEnviv) +#define glTexFilterFuncSGIS MANGLE(TexFilterFuncSGIS) +#define glTexGend MANGLE(TexGend) +#define glTexGendv MANGLE(TexGendv) +#define glTexGenf MANGLE(TexGenf) +#define glTexGenfv MANGLE(TexGenfv) +#define glTexGeni MANGLE(TexGeni) +#define glTexGeniv MANGLE(TexGeniv) +#define glTexImage1D MANGLE(TexImage1D) +#define glTexImage2D MANGLE(TexImage2D) +#define glTexImage3DEXT MANGLE(TexImage3DEXT) +#define glTexImage3D MANGLE(TexImage3D) +#define glTexImage4DSGIS MANGLE(TexImage4DSGIS) +#define glTexParameterf MANGLE(TexParameterf) +#define glTexParameterfv MANGLE(TexParameterfv) +#define glTexParameterIivEXT MANGLE(TexParameterIivEXT) +#define glTexParameterIiv MANGLE(TexParameterIiv) +#define glTexParameteri MANGLE(TexParameteri) +#define glTexParameterIuivEXT MANGLE(TexParameterIuivEXT) +#define glTexParameterIuiv MANGLE(TexParameterIuiv) +#define glTexParameteriv MANGLE(TexParameteriv) +#define glTexRenderbufferNV MANGLE(TexRenderbufferNV) +#define glTexSubImage1DEXT MANGLE(TexSubImage1DEXT) +#define glTexSubImage1D MANGLE(TexSubImage1D) +#define glTexSubImage2DEXT MANGLE(TexSubImage2DEXT) +#define glTexSubImage2D MANGLE(TexSubImage2D) +#define glTexSubImage3DEXT MANGLE(TexSubImage3DEXT) +#define glTexSubImage3D MANGLE(TexSubImage3D) +#define glTexSubImage4DSGIS MANGLE(TexSubImage4DSGIS) +#define glTextureBufferEXT MANGLE(TextureBufferEXT) +#define glTextureColorMaskSGIS MANGLE(TextureColorMaskSGIS) +#define glTextureImage1DEXT MANGLE(TextureImage1DEXT) +#define glTextureImage2DEXT MANGLE(TextureImage2DEXT) +#define glTextureImage3DEXT MANGLE(TextureImage3DEXT) +#define glTextureLightEXT MANGLE(TextureLightEXT) +#define glTextureMaterialEXT MANGLE(TextureMaterialEXT) +#define glTextureNormalEXT MANGLE(TextureNormalEXT) +#define glTextureParameterfEXT MANGLE(TextureParameterfEXT) +#define glTextureParameterfvEXT MANGLE(TextureParameterfvEXT) +#define glTextureParameteriEXT MANGLE(TextureParameteriEXT) +#define glTextureParameterIivEXT MANGLE(TextureParameterIivEXT) +#define glTextureParameterIuivEXT MANGLE(TextureParameterIuivEXT) +#define glTextureParameterivEXT MANGLE(TextureParameterivEXT) +#define glTextureRenderbufferEXT MANGLE(TextureRenderbufferEXT) +#define glTextureSubImage1DEXT MANGLE(TextureSubImage1DEXT) +#define glTextureSubImage2DEXT MANGLE(TextureSubImage2DEXT) +#define glTextureSubImage3DEXT MANGLE(TextureSubImage3DEXT) +#define glTrackMatrixNV MANGLE(TrackMatrixNV) +#define glTransformFeedbackAttribsNV MANGLE(TransformFeedbackAttribsNV) +#define glTransformFeedbackVaryingsEXT MANGLE(TransformFeedbackVaryingsEXT) +#define glTransformFeedbackVaryings MANGLE(TransformFeedbackVaryings) +#define glTransformFeedbackVaryingsNV MANGLE(TransformFeedbackVaryingsNV) +#define glTranslated MANGLE(Translated) +#define glTranslatef MANGLE(Translatef) +#define glUniform1fARB MANGLE(Uniform1fARB) +#define glUniform1f MANGLE(Uniform1f) +#define glUniform1fvARB MANGLE(Uniform1fvARB) +#define glUniform1fv MANGLE(Uniform1fv) +#define glUniform1iARB MANGLE(Uniform1iARB) +#define glUniform1i MANGLE(Uniform1i) +#define glUniform1ivARB MANGLE(Uniform1ivARB) +#define glUniform1iv MANGLE(Uniform1iv) +#define glUniform1uiEXT MANGLE(Uniform1uiEXT) +#define glUniform1ui MANGLE(Uniform1ui) +#define glUniform1uivEXT MANGLE(Uniform1uivEXT) +#define glUniform1uiv MANGLE(Uniform1uiv) +#define glUniform2fARB MANGLE(Uniform2fARB) +#define glUniform2f MANGLE(Uniform2f) +#define glUniform2fvARB MANGLE(Uniform2fvARB) +#define glUniform2fv MANGLE(Uniform2fv) +#define glUniform2iARB MANGLE(Uniform2iARB) +#define glUniform2i MANGLE(Uniform2i) +#define glUniform2ivARB MANGLE(Uniform2ivARB) +#define glUniform2iv MANGLE(Uniform2iv) +#define glUniform2uiEXT MANGLE(Uniform2uiEXT) +#define glUniform2ui MANGLE(Uniform2ui) +#define glUniform2uivEXT MANGLE(Uniform2uivEXT) +#define glUniform2uiv MANGLE(Uniform2uiv) +#define glUniform3fARB MANGLE(Uniform3fARB) +#define glUniform3f MANGLE(Uniform3f) +#define glUniform3fvARB MANGLE(Uniform3fvARB) +#define glUniform3fv MANGLE(Uniform3fv) +#define glUniform3iARB MANGLE(Uniform3iARB) +#define glUniform3i MANGLE(Uniform3i) +#define glUniform3ivARB MANGLE(Uniform3ivARB) +#define glUniform3iv MANGLE(Uniform3iv) +#define glUniform3uiEXT MANGLE(Uniform3uiEXT) +#define glUniform3ui MANGLE(Uniform3ui) +#define glUniform3uivEXT MANGLE(Uniform3uivEXT) +#define glUniform3uiv MANGLE(Uniform3uiv) +#define glUniform4fARB MANGLE(Uniform4fARB) +#define glUniform4f MANGLE(Uniform4f) +#define glUniform4fvARB MANGLE(Uniform4fvARB) +#define glUniform4fv MANGLE(Uniform4fv) +#define glUniform4iARB MANGLE(Uniform4iARB) +#define glUniform4i MANGLE(Uniform4i) +#define glUniform4ivARB MANGLE(Uniform4ivARB) +#define glUniform4iv MANGLE(Uniform4iv) +#define glUniform4uiEXT MANGLE(Uniform4uiEXT) +#define glUniform4ui MANGLE(Uniform4ui) +#define glUniform4uivEXT MANGLE(Uniform4uivEXT) +#define glUniform4uiv MANGLE(Uniform4uiv) +#define glUniformBlockBinding MANGLE(UniformBlockBinding) +#define glUniformBufferEXT MANGLE(UniformBufferEXT) +#define glUniformMatrix2fvARB MANGLE(UniformMatrix2fvARB) +#define glUniformMatrix2fv MANGLE(UniformMatrix2fv) +#define glUniformMatrix2x3fv MANGLE(UniformMatrix2x3fv) +#define glUniformMatrix2x4fv MANGLE(UniformMatrix2x4fv) +#define glUniformMatrix3fvARB MANGLE(UniformMatrix3fvARB) +#define glUniformMatrix3fv MANGLE(UniformMatrix3fv) +#define glUniformMatrix3x2fv MANGLE(UniformMatrix3x2fv) +#define glUniformMatrix3x4fv MANGLE(UniformMatrix3x4fv) +#define glUniformMatrix4fvARB MANGLE(UniformMatrix4fvARB) +#define glUniformMatrix4fv MANGLE(UniformMatrix4fv) +#define glUniformMatrix4x2fv MANGLE(UniformMatrix4x2fv) +#define glUniformMatrix4x3fv MANGLE(UniformMatrix4x3fv) +#define glUnlockArraysEXT MANGLE(UnlockArraysEXT) +#define glUnmapBufferARB MANGLE(UnmapBufferARB) +#define glUnmapBuffer MANGLE(UnmapBuffer) +#define glUnmapNamedBufferEXT MANGLE(UnmapNamedBufferEXT) +#define glUnmapObjectBufferATI MANGLE(UnmapObjectBufferATI) +#define glUpdateObjectBufferATI MANGLE(UpdateObjectBufferATI) +#define glUseProgram MANGLE(UseProgram) +#define glUseProgramObjectARB MANGLE(UseProgramObjectARB) +#define glValidateProgramARB MANGLE(ValidateProgramARB) +#define glValidateProgram MANGLE(ValidateProgram) +#define glVariantArrayObjectATI MANGLE(VariantArrayObjectATI) +#define glVariantbvEXT MANGLE(VariantbvEXT) +#define glVariantdvEXT MANGLE(VariantdvEXT) +#define glVariantfvEXT MANGLE(VariantfvEXT) +#define glVariantivEXT MANGLE(VariantivEXT) +#define glVariantPointerEXT MANGLE(VariantPointerEXT) +#define glVariantsvEXT MANGLE(VariantsvEXT) +#define glVariantubvEXT MANGLE(VariantubvEXT) +#define glVariantuivEXT MANGLE(VariantuivEXT) +#define glVariantusvEXT MANGLE(VariantusvEXT) +#define glVertex2d MANGLE(Vertex2d) +#define glVertex2dv MANGLE(Vertex2dv) +#define glVertex2f MANGLE(Vertex2f) +#define glVertex2fv MANGLE(Vertex2fv) +#define glVertex2hNV MANGLE(Vertex2hNV) +#define glVertex2hvNV MANGLE(Vertex2hvNV) +#define glVertex2i MANGLE(Vertex2i) +#define glVertex2iv MANGLE(Vertex2iv) +#define glVertex2s MANGLE(Vertex2s) +#define glVertex2sv MANGLE(Vertex2sv) +#define glVertex3d MANGLE(Vertex3d) +#define glVertex3dv MANGLE(Vertex3dv) +#define glVertex3f MANGLE(Vertex3f) +#define glVertex3fv MANGLE(Vertex3fv) +#define glVertex3hNV MANGLE(Vertex3hNV) +#define glVertex3hvNV MANGLE(Vertex3hvNV) +#define glVertex3i MANGLE(Vertex3i) +#define glVertex3iv MANGLE(Vertex3iv) +#define glVertex3s MANGLE(Vertex3s) +#define glVertex3sv MANGLE(Vertex3sv) +#define glVertex4d MANGLE(Vertex4d) +#define glVertex4dv MANGLE(Vertex4dv) +#define glVertex4f MANGLE(Vertex4f) +#define glVertex4fv MANGLE(Vertex4fv) +#define glVertex4hNV MANGLE(Vertex4hNV) +#define glVertex4hvNV MANGLE(Vertex4hvNV) +#define glVertex4i MANGLE(Vertex4i) +#define glVertex4iv MANGLE(Vertex4iv) +#define glVertex4s MANGLE(Vertex4s) +#define glVertex4sv MANGLE(Vertex4sv) +#define glVertexArrayParameteriAPPLE MANGLE(VertexArrayParameteriAPPLE) +#define glVertexArrayRangeAPPLE MANGLE(VertexArrayRangeAPPLE) +#define glVertexArrayRangeNV MANGLE(VertexArrayRangeNV) +#define glVertexAttrib1dARB MANGLE(VertexAttrib1dARB) +#define glVertexAttrib1d MANGLE(VertexAttrib1d) +#define glVertexAttrib1dNV MANGLE(VertexAttrib1dNV) +#define glVertexAttrib1dvARB MANGLE(VertexAttrib1dvARB) +#define glVertexAttrib1dv MANGLE(VertexAttrib1dv) +#define glVertexAttrib1dvNV MANGLE(VertexAttrib1dvNV) +#define glVertexAttrib1fARB MANGLE(VertexAttrib1fARB) +#define glVertexAttrib1f MANGLE(VertexAttrib1f) +#define glVertexAttrib1fNV MANGLE(VertexAttrib1fNV) +#define glVertexAttrib1fvARB MANGLE(VertexAttrib1fvARB) +#define glVertexAttrib1fv MANGLE(VertexAttrib1fv) +#define glVertexAttrib1fvNV MANGLE(VertexAttrib1fvNV) +#define glVertexAttrib1hNV MANGLE(VertexAttrib1hNV) +#define glVertexAttrib1hvNV MANGLE(VertexAttrib1hvNV) +#define glVertexAttrib1sARB MANGLE(VertexAttrib1sARB) +#define glVertexAttrib1s MANGLE(VertexAttrib1s) +#define glVertexAttrib1sNV MANGLE(VertexAttrib1sNV) +#define glVertexAttrib1svARB MANGLE(VertexAttrib1svARB) +#define glVertexAttrib1sv MANGLE(VertexAttrib1sv) +#define glVertexAttrib1svNV MANGLE(VertexAttrib1svNV) +#define glVertexAttrib2dARB MANGLE(VertexAttrib2dARB) +#define glVertexAttrib2d MANGLE(VertexAttrib2d) +#define glVertexAttrib2dNV MANGLE(VertexAttrib2dNV) +#define glVertexAttrib2dvARB MANGLE(VertexAttrib2dvARB) +#define glVertexAttrib2dv MANGLE(VertexAttrib2dv) +#define glVertexAttrib2dvNV MANGLE(VertexAttrib2dvNV) +#define glVertexAttrib2fARB MANGLE(VertexAttrib2fARB) +#define glVertexAttrib2f MANGLE(VertexAttrib2f) +#define glVertexAttrib2fNV MANGLE(VertexAttrib2fNV) +#define glVertexAttrib2fvARB MANGLE(VertexAttrib2fvARB) +#define glVertexAttrib2fv MANGLE(VertexAttrib2fv) +#define glVertexAttrib2fvNV MANGLE(VertexAttrib2fvNV) +#define glVertexAttrib2hNV MANGLE(VertexAttrib2hNV) +#define glVertexAttrib2hvNV MANGLE(VertexAttrib2hvNV) +#define glVertexAttrib2sARB MANGLE(VertexAttrib2sARB) +#define glVertexAttrib2s MANGLE(VertexAttrib2s) +#define glVertexAttrib2sNV MANGLE(VertexAttrib2sNV) +#define glVertexAttrib2svARB MANGLE(VertexAttrib2svARB) +#define glVertexAttrib2sv MANGLE(VertexAttrib2sv) +#define glVertexAttrib2svNV MANGLE(VertexAttrib2svNV) +#define glVertexAttrib3dARB MANGLE(VertexAttrib3dARB) +#define glVertexAttrib3d MANGLE(VertexAttrib3d) +#define glVertexAttrib3dNV MANGLE(VertexAttrib3dNV) +#define glVertexAttrib3dvARB MANGLE(VertexAttrib3dvARB) +#define glVertexAttrib3dv MANGLE(VertexAttrib3dv) +#define glVertexAttrib3dvNV MANGLE(VertexAttrib3dvNV) +#define glVertexAttrib3fARB MANGLE(VertexAttrib3fARB) +#define glVertexAttrib3f MANGLE(VertexAttrib3f) +#define glVertexAttrib3fNV MANGLE(VertexAttrib3fNV) +#define glVertexAttrib3fvARB MANGLE(VertexAttrib3fvARB) +#define glVertexAttrib3fv MANGLE(VertexAttrib3fv) +#define glVertexAttrib3fvNV MANGLE(VertexAttrib3fvNV) +#define glVertexAttrib3hNV MANGLE(VertexAttrib3hNV) +#define glVertexAttrib3hvNV MANGLE(VertexAttrib3hvNV) +#define glVertexAttrib3sARB MANGLE(VertexAttrib3sARB) +#define glVertexAttrib3s MANGLE(VertexAttrib3s) +#define glVertexAttrib3sNV MANGLE(VertexAttrib3sNV) +#define glVertexAttrib3svARB MANGLE(VertexAttrib3svARB) +#define glVertexAttrib3sv MANGLE(VertexAttrib3sv) +#define glVertexAttrib3svNV MANGLE(VertexAttrib3svNV) +#define glVertexAttrib4bvARB MANGLE(VertexAttrib4bvARB) +#define glVertexAttrib4bv MANGLE(VertexAttrib4bv) +#define glVertexAttrib4dARB MANGLE(VertexAttrib4dARB) +#define glVertexAttrib4d MANGLE(VertexAttrib4d) +#define glVertexAttrib4dNV MANGLE(VertexAttrib4dNV) +#define glVertexAttrib4dvARB MANGLE(VertexAttrib4dvARB) +#define glVertexAttrib4dv MANGLE(VertexAttrib4dv) +#define glVertexAttrib4dvNV MANGLE(VertexAttrib4dvNV) +#define glVertexAttrib4fARB MANGLE(VertexAttrib4fARB) +#define glVertexAttrib4f MANGLE(VertexAttrib4f) +#define glVertexAttrib4fNV MANGLE(VertexAttrib4fNV) +#define glVertexAttrib4fvARB MANGLE(VertexAttrib4fvARB) +#define glVertexAttrib4fv MANGLE(VertexAttrib4fv) +#define glVertexAttrib4fvNV MANGLE(VertexAttrib4fvNV) +#define glVertexAttrib4hNV MANGLE(VertexAttrib4hNV) +#define glVertexAttrib4hvNV MANGLE(VertexAttrib4hvNV) +#define glVertexAttrib4ivARB MANGLE(VertexAttrib4ivARB) +#define glVertexAttrib4iv MANGLE(VertexAttrib4iv) +#define glVertexAttrib4NbvARB MANGLE(VertexAttrib4NbvARB) +#define glVertexAttrib4Nbv MANGLE(VertexAttrib4Nbv) +#define glVertexAttrib4NivARB MANGLE(VertexAttrib4NivARB) +#define glVertexAttrib4Niv MANGLE(VertexAttrib4Niv) +#define glVertexAttrib4NsvARB MANGLE(VertexAttrib4NsvARB) +#define glVertexAttrib4Nsv MANGLE(VertexAttrib4Nsv) +#define glVertexAttrib4NubARB MANGLE(VertexAttrib4NubARB) +#define glVertexAttrib4Nub MANGLE(VertexAttrib4Nub) +#define glVertexAttrib4NubvARB MANGLE(VertexAttrib4NubvARB) +#define glVertexAttrib4Nubv MANGLE(VertexAttrib4Nubv) +#define glVertexAttrib4NuivARB MANGLE(VertexAttrib4NuivARB) +#define glVertexAttrib4Nuiv MANGLE(VertexAttrib4Nuiv) +#define glVertexAttrib4NusvARB MANGLE(VertexAttrib4NusvARB) +#define glVertexAttrib4Nusv MANGLE(VertexAttrib4Nusv) +#define glVertexAttrib4sARB MANGLE(VertexAttrib4sARB) +#define glVertexAttrib4s MANGLE(VertexAttrib4s) +#define glVertexAttrib4sNV MANGLE(VertexAttrib4sNV) +#define glVertexAttrib4svARB MANGLE(VertexAttrib4svARB) +#define glVertexAttrib4sv MANGLE(VertexAttrib4sv) +#define glVertexAttrib4svNV MANGLE(VertexAttrib4svNV) +#define glVertexAttrib4ubNV MANGLE(VertexAttrib4ubNV) +#define glVertexAttrib4ubvARB MANGLE(VertexAttrib4ubvARB) +#define glVertexAttrib4ubv MANGLE(VertexAttrib4ubv) +#define glVertexAttrib4ubvNV MANGLE(VertexAttrib4ubvNV) +#define glVertexAttrib4uivARB MANGLE(VertexAttrib4uivARB) +#define glVertexAttrib4uiv MANGLE(VertexAttrib4uiv) +#define glVertexAttrib4usvARB MANGLE(VertexAttrib4usvARB) +#define glVertexAttrib4usv MANGLE(VertexAttrib4usv) +#define glVertexAttribArrayObjectATI MANGLE(VertexAttribArrayObjectATI) +#define glVertexAttribDivisorARB MANGLE(VertexAttribDivisorARB) +#define glVertexAttribI1iEXT MANGLE(VertexAttribI1iEXT) +#define glVertexAttribI1i MANGLE(VertexAttribI1i) +#define glVertexAttribI1ivEXT MANGLE(VertexAttribI1ivEXT) +#define glVertexAttribI1iv MANGLE(VertexAttribI1iv) +#define glVertexAttribI1uiEXT MANGLE(VertexAttribI1uiEXT) +#define glVertexAttribI1ui MANGLE(VertexAttribI1ui) +#define glVertexAttribI1uivEXT MANGLE(VertexAttribI1uivEXT) +#define glVertexAttribI1uiv MANGLE(VertexAttribI1uiv) +#define glVertexAttribI2iEXT MANGLE(VertexAttribI2iEXT) +#define glVertexAttribI2i MANGLE(VertexAttribI2i) +#define glVertexAttribI2ivEXT MANGLE(VertexAttribI2ivEXT) +#define glVertexAttribI2iv MANGLE(VertexAttribI2iv) +#define glVertexAttribI2uiEXT MANGLE(VertexAttribI2uiEXT) +#define glVertexAttribI2ui MANGLE(VertexAttribI2ui) +#define glVertexAttribI2uivEXT MANGLE(VertexAttribI2uivEXT) +#define glVertexAttribI2uiv MANGLE(VertexAttribI2uiv) +#define glVertexAttribI3iEXT MANGLE(VertexAttribI3iEXT) +#define glVertexAttribI3i MANGLE(VertexAttribI3i) +#define glVertexAttribI3ivEXT MANGLE(VertexAttribI3ivEXT) +#define glVertexAttribI3iv MANGLE(VertexAttribI3iv) +#define glVertexAttribI3uiEXT MANGLE(VertexAttribI3uiEXT) +#define glVertexAttribI3ui MANGLE(VertexAttribI3ui) +#define glVertexAttribI3uivEXT MANGLE(VertexAttribI3uivEXT) +#define glVertexAttribI3uiv MANGLE(VertexAttribI3uiv) +#define glVertexAttribI4bvEXT MANGLE(VertexAttribI4bvEXT) +#define glVertexAttribI4bv MANGLE(VertexAttribI4bv) +#define glVertexAttribI4iEXT MANGLE(VertexAttribI4iEXT) +#define glVertexAttribI4i MANGLE(VertexAttribI4i) +#define glVertexAttribI4ivEXT MANGLE(VertexAttribI4ivEXT) +#define glVertexAttribI4iv MANGLE(VertexAttribI4iv) +#define glVertexAttribI4svEXT MANGLE(VertexAttribI4svEXT) +#define glVertexAttribI4sv MANGLE(VertexAttribI4sv) +#define glVertexAttribI4ubvEXT MANGLE(VertexAttribI4ubvEXT) +#define glVertexAttribI4ubv MANGLE(VertexAttribI4ubv) +#define glVertexAttribI4uiEXT MANGLE(VertexAttribI4uiEXT) +#define glVertexAttribI4ui MANGLE(VertexAttribI4ui) +#define glVertexAttribI4uivEXT MANGLE(VertexAttribI4uivEXT) +#define glVertexAttribI4uiv MANGLE(VertexAttribI4uiv) +#define glVertexAttribI4usvEXT MANGLE(VertexAttribI4usvEXT) +#define glVertexAttribI4usv MANGLE(VertexAttribI4usv) +#define glVertexAttribIPointerEXT MANGLE(VertexAttribIPointerEXT) +#define glVertexAttribIPointer MANGLE(VertexAttribIPointer) +#define glVertexAttribPointerARB MANGLE(VertexAttribPointerARB) +#define glVertexAttribPointer MANGLE(VertexAttribPointer) +#define glVertexAttribPointerNV MANGLE(VertexAttribPointerNV) +#define glVertexAttribs1dvNV MANGLE(VertexAttribs1dvNV) +#define glVertexAttribs1fvNV MANGLE(VertexAttribs1fvNV) +#define glVertexAttribs1hvNV MANGLE(VertexAttribs1hvNV) +#define glVertexAttribs1svNV MANGLE(VertexAttribs1svNV) +#define glVertexAttribs2dvNV MANGLE(VertexAttribs2dvNV) +#define glVertexAttribs2fvNV MANGLE(VertexAttribs2fvNV) +#define glVertexAttribs2hvNV MANGLE(VertexAttribs2hvNV) +#define glVertexAttribs2svNV MANGLE(VertexAttribs2svNV) +#define glVertexAttribs3dvNV MANGLE(VertexAttribs3dvNV) +#define glVertexAttribs3fvNV MANGLE(VertexAttribs3fvNV) +#define glVertexAttribs3hvNV MANGLE(VertexAttribs3hvNV) +#define glVertexAttribs3svNV MANGLE(VertexAttribs3svNV) +#define glVertexAttribs4dvNV MANGLE(VertexAttribs4dvNV) +#define glVertexAttribs4fvNV MANGLE(VertexAttribs4fvNV) +#define glVertexAttribs4hvNV MANGLE(VertexAttribs4hvNV) +#define glVertexAttribs4svNV MANGLE(VertexAttribs4svNV) +#define glVertexAttribs4ubvNV MANGLE(VertexAttribs4ubvNV) +#define glVertexBlendARB MANGLE(VertexBlendARB) +#define glVertexBlendEnvfATI MANGLE(VertexBlendEnvfATI) +#define glVertexBlendEnviATI MANGLE(VertexBlendEnviATI) +#define glVertexPointerEXT MANGLE(VertexPointerEXT) +#define glVertexPointerListIBM MANGLE(VertexPointerListIBM) +#define glVertexPointer MANGLE(VertexPointer) +#define glVertexPointervINTEL MANGLE(VertexPointervINTEL) +#define glVertexStream1dATI MANGLE(VertexStream1dATI) +#define glVertexStream1dvATI MANGLE(VertexStream1dvATI) +#define glVertexStream1fATI MANGLE(VertexStream1fATI) +#define glVertexStream1fvATI MANGLE(VertexStream1fvATI) +#define glVertexStream1iATI MANGLE(VertexStream1iATI) +#define glVertexStream1ivATI MANGLE(VertexStream1ivATI) +#define glVertexStream1sATI MANGLE(VertexStream1sATI) +#define glVertexStream1svATI MANGLE(VertexStream1svATI) +#define glVertexStream2dATI MANGLE(VertexStream2dATI) +#define glVertexStream2dvATI MANGLE(VertexStream2dvATI) +#define glVertexStream2fATI MANGLE(VertexStream2fATI) +#define glVertexStream2fvATI MANGLE(VertexStream2fvATI) +#define glVertexStream2iATI MANGLE(VertexStream2iATI) +#define glVertexStream2ivATI MANGLE(VertexStream2ivATI) +#define glVertexStream2sATI MANGLE(VertexStream2sATI) +#define glVertexStream2svATI MANGLE(VertexStream2svATI) +#define glVertexStream3dATI MANGLE(VertexStream3dATI) +#define glVertexStream3dvATI MANGLE(VertexStream3dvATI) +#define glVertexStream3fATI MANGLE(VertexStream3fATI) +#define glVertexStream3fvATI MANGLE(VertexStream3fvATI) +#define glVertexStream3iATI MANGLE(VertexStream3iATI) +#define glVertexStream3ivATI MANGLE(VertexStream3ivATI) +#define glVertexStream3sATI MANGLE(VertexStream3sATI) +#define glVertexStream3svATI MANGLE(VertexStream3svATI) +#define glVertexStream4dATI MANGLE(VertexStream4dATI) +#define glVertexStream4dvATI MANGLE(VertexStream4dvATI) +#define glVertexStream4fATI MANGLE(VertexStream4fATI) +#define glVertexStream4fvATI MANGLE(VertexStream4fvATI) +#define glVertexStream4iATI MANGLE(VertexStream4iATI) +#define glVertexStream4ivATI MANGLE(VertexStream4ivATI) +#define glVertexStream4sATI MANGLE(VertexStream4sATI) +#define glVertexStream4svATI MANGLE(VertexStream4svATI) +#define glVertexWeightfEXT MANGLE(VertexWeightfEXT) +#define glVertexWeightfvEXT MANGLE(VertexWeightfvEXT) +#define glVertexWeighthNV MANGLE(VertexWeighthNV) +#define glVertexWeighthvNV MANGLE(VertexWeighthvNV) +#define glVertexWeightPointerEXT MANGLE(VertexWeightPointerEXT) +#define glViewport MANGLE(Viewport) +#define glWeightbvARB MANGLE(WeightbvARB) +#define glWeightdvARB MANGLE(WeightdvARB) +#define glWeightfvARB MANGLE(WeightfvARB) +#define glWeightivARB MANGLE(WeightivARB) +#define glWeightPointerARB MANGLE(WeightPointerARB) +#define glWeightsvARB MANGLE(WeightsvARB) +#define glWeightubvARB MANGLE(WeightubvARB) +#define glWeightuivARB MANGLE(WeightuivARB) +#define glWeightusvARB MANGLE(WeightusvARB) +#define glWindowPos2dARB MANGLE(WindowPos2dARB) +#define glWindowPos2d MANGLE(WindowPos2d) +#define glWindowPos2dMESA MANGLE(WindowPos2dMESA) +#define glWindowPos2dvARB MANGLE(WindowPos2dvARB) +#define glWindowPos2dv MANGLE(WindowPos2dv) +#define glWindowPos2dvMESA MANGLE(WindowPos2dvMESA) +#define glWindowPos2fARB MANGLE(WindowPos2fARB) +#define glWindowPos2f MANGLE(WindowPos2f) +#define glWindowPos2fMESA MANGLE(WindowPos2fMESA) +#define glWindowPos2fvARB MANGLE(WindowPos2fvARB) +#define glWindowPos2fv MANGLE(WindowPos2fv) +#define glWindowPos2fvMESA MANGLE(WindowPos2fvMESA) +#define glWindowPos2iARB MANGLE(WindowPos2iARB) +#define glWindowPos2i MANGLE(WindowPos2i) +#define glWindowPos2iMESA MANGLE(WindowPos2iMESA) +#define glWindowPos2ivARB MANGLE(WindowPos2ivARB) +#define glWindowPos2iv MANGLE(WindowPos2iv) +#define glWindowPos2ivMESA MANGLE(WindowPos2ivMESA) +#define glWindowPos2sARB MANGLE(WindowPos2sARB) +#define glWindowPos2s MANGLE(WindowPos2s) +#define glWindowPos2sMESA MANGLE(WindowPos2sMESA) +#define glWindowPos2svARB MANGLE(WindowPos2svARB) +#define glWindowPos2sv MANGLE(WindowPos2sv) +#define glWindowPos2svMESA MANGLE(WindowPos2svMESA) +#define glWindowPos3dARB MANGLE(WindowPos3dARB) +#define glWindowPos3d MANGLE(WindowPos3d) +#define glWindowPos3dMESA MANGLE(WindowPos3dMESA) +#define glWindowPos3dvARB MANGLE(WindowPos3dvARB) +#define glWindowPos3dv MANGLE(WindowPos3dv) +#define glWindowPos3dvMESA MANGLE(WindowPos3dvMESA) +#define glWindowPos3fARB MANGLE(WindowPos3fARB) +#define glWindowPos3f MANGLE(WindowPos3f) +#define glWindowPos3fMESA MANGLE(WindowPos3fMESA) +#define glWindowPos3fvARB MANGLE(WindowPos3fvARB) +#define glWindowPos3fv MANGLE(WindowPos3fv) +#define glWindowPos3fvMESA MANGLE(WindowPos3fvMESA) +#define glWindowPos3iARB MANGLE(WindowPos3iARB) +#define glWindowPos3i MANGLE(WindowPos3i) +#define glWindowPos3iMESA MANGLE(WindowPos3iMESA) +#define glWindowPos3ivARB MANGLE(WindowPos3ivARB) +#define glWindowPos3iv MANGLE(WindowPos3iv) +#define glWindowPos3ivMESA MANGLE(WindowPos3ivMESA) +#define glWindowPos3sARB MANGLE(WindowPos3sARB) +#define glWindowPos3s MANGLE(WindowPos3s) +#define glWindowPos3sMESA MANGLE(WindowPos3sMESA) +#define glWindowPos3svARB MANGLE(WindowPos3svARB) +#define glWindowPos3sv MANGLE(WindowPos3sv) +#define glWindowPos3svMESA MANGLE(WindowPos3svMESA) +#define glWindowPos4dMESA MANGLE(WindowPos4dMESA) +#define glWindowPos4dvMESA MANGLE(WindowPos4dvMESA) +#define glWindowPos4fMESA MANGLE(WindowPos4fMESA) +#define glWindowPos4fvMESA MANGLE(WindowPos4fvMESA) +#define glWindowPos4iMESA MANGLE(WindowPos4iMESA) +#define glWindowPos4ivMESA MANGLE(WindowPos4ivMESA) +#define glWindowPos4sMESA MANGLE(WindowPos4sMESA) +#define glWindowPos4svMESA MANGLE(WindowPos4svMESA) +#define glWriteMaskEXT MANGLE(WriteMaskEXT) + +#endif /* GL_MANGLE_H */ diff --git a/mesalib/include/GL/glext.h b/mesalib/include/GL/glext.h new file mode 100644 index 000000000..24e6c5dc8 --- /dev/null +++ b/mesalib/include/GL/glext.h @@ -0,0 +1,9253 @@ +#ifndef __glext_h_ +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glext.h last updated $Date: 2009-08-03 02:13:51 -0700 (Mon, 03 Aug 2009) $ */ +/* Current version at http://www.opengl.org/registry/ */ +#define GL_GLEXT_VERSION 54 + +/* Function declaration macros - to move into glplatform.h */ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +#ifndef GL_VERSION_1_2 +#define GL_UNSIGNED_BYTE_3_3_2 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2 0x8036 +#define GL_TEXTURE_BINDING_3D 0x806A +#define GL_PACK_SKIP_IMAGES 0x806B +#define GL_PACK_IMAGE_HEIGHT 0x806C +#define GL_UNPACK_SKIP_IMAGES 0x806D +#define GL_UNPACK_IMAGE_HEIGHT 0x806E +#define GL_TEXTURE_3D 0x806F +#define GL_PROXY_TEXTURE_3D 0x8070 +#define GL_TEXTURE_DEPTH 0x8071 +#define GL_TEXTURE_WRAP_R 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE 0x8073 +#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 +#define GL_BGR 0x80E0 +#define GL_BGRA 0x80E1 +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_TEXTURE_MIN_LOD 0x813A +#define GL_TEXTURE_MAX_LOD 0x813B +#define GL_TEXTURE_BASE_LEVEL 0x813C +#define GL_TEXTURE_MAX_LEVEL 0x813D +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#endif + +#ifndef GL_VERSION_1_2_DEPRECATED +#define GL_RESCALE_NORMAL 0x803A +#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 +#define GL_SINGLE_COLOR 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR 0x81FA +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#endif + +#ifndef GL_ARB_imaging +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_FUNC_ADD 0x8006 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +#define GL_BLEND_EQUATION 0x8009 +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#endif + +#ifndef GL_ARB_imaging_DEPRECATED +#define GL_CONVOLUTION_1D 0x8010 +#define GL_CONVOLUTION_2D 0x8011 +#define GL_SEPARABLE_2D 0x8012 +#define GL_CONVOLUTION_BORDER_MODE 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS 0x8015 +#define GL_REDUCE 0x8016 +#define GL_CONVOLUTION_FORMAT 0x8017 +#define GL_CONVOLUTION_WIDTH 0x8018 +#define GL_CONVOLUTION_HEIGHT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 +#define GL_HISTOGRAM 0x8024 +#define GL_PROXY_HISTOGRAM 0x8025 +#define GL_HISTOGRAM_WIDTH 0x8026 +#define GL_HISTOGRAM_FORMAT 0x8027 +#define GL_HISTOGRAM_RED_SIZE 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C +#define GL_HISTOGRAM_SINK 0x802D +#define GL_MINMAX 0x802E +#define GL_MINMAX_FORMAT 0x802F +#define GL_MINMAX_SINK 0x8030 +#define GL_TABLE_TOO_LARGE 0x8031 +#define GL_COLOR_MATRIX 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB +#define GL_COLOR_TABLE 0x80D0 +#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1 +#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2 +#define GL_PROXY_COLOR_TABLE 0x80D3 +#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4 +#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5 +#define GL_COLOR_TABLE_SCALE 0x80D6 +#define GL_COLOR_TABLE_BIAS 0x80D7 +#define GL_COLOR_TABLE_FORMAT 0x80D8 +#define GL_COLOR_TABLE_WIDTH 0x80D9 +#define GL_COLOR_TABLE_RED_SIZE 0x80DA +#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB +#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC +#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD +#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE +#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF +#define GL_CONSTANT_BORDER 0x8151 +#define GL_REPLICATE_BORDER 0x8153 +#define GL_CONVOLUTION_BORDER_COLOR 0x8154 +#endif + +#ifndef GL_VERSION_1_3 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_COMPRESSED_RGB 0x84ED +#define GL_COMPRESSED_RGBA 0x84EE +#define GL_TEXTURE_COMPRESSION_HINT 0x84EF +#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 +#define GL_TEXTURE_COMPRESSED 0x86A1 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CLAMP_TO_BORDER 0x812D +#endif + +#ifndef GL_VERSION_1_3_DEPRECATED +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 +#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 +#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 +#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 +#define GL_MULTISAMPLE_BIT 0x20000000 +#define GL_NORMAL_MAP 0x8511 +#define GL_REFLECTION_MAP 0x8512 +#define GL_COMPRESSED_ALPHA 0x84E9 +#define GL_COMPRESSED_LUMINANCE 0x84EA +#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB +#define GL_COMPRESSED_INTENSITY 0x84EC +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_SOURCE0_RGB 0x8580 +#define GL_SOURCE1_RGB 0x8581 +#define GL_SOURCE2_RGB 0x8582 +#define GL_SOURCE0_ALPHA 0x8588 +#define GL_SOURCE1_ALPHA 0x8589 +#define GL_SOURCE2_ALPHA 0x858A +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_SUBTRACT 0x84E7 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF +#endif + +#ifndef GL_VERSION_1_4 +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_COMPONENT24 0x81A6 +#define GL_DEPTH_COMPONENT32 0x81A7 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD +#define GL_TEXTURE_LOD_BIAS 0x8501 +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_TEXTURE_DEPTH_SIZE 0x884A +#define GL_TEXTURE_COMPARE_MODE 0x884C +#define GL_TEXTURE_COMPARE_FUNC 0x884D +#endif + +#ifndef GL_VERSION_1_4_DEPRECATED +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_GENERATE_MIPMAP 0x8191 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_FOG_COORDINATE_SOURCE 0x8450 +#define GL_FOG_COORDINATE 0x8451 +#define GL_FRAGMENT_DEPTH 0x8452 +#define GL_CURRENT_FOG_COORDINATE 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 +#define GL_FOG_COORDINATE_ARRAY 0x8457 +#define GL_COLOR_SUM 0x8458 +#define GL_CURRENT_SECONDARY_COLOR 0x8459 +#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A +#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B +#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C +#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D +#define GL_SECONDARY_COLOR_ARRAY 0x845E +#define GL_TEXTURE_FILTER_CONTROL 0x8500 +#define GL_DEPTH_TEXTURE_MODE 0x884B +#define GL_COMPARE_R_TO_TEXTURE 0x884E +#endif + +#ifndef GL_VERSION_1_5 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_QUERY_COUNTER_BITS 0x8864 +#define GL_CURRENT_QUERY 0x8865 +#define GL_QUERY_RESULT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE 0x8867 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_READ_ONLY 0x88B8 +#define GL_WRITE_ONLY 0x88B9 +#define GL_READ_WRITE 0x88BA +#define GL_BUFFER_ACCESS 0x88BB +#define GL_BUFFER_MAPPED 0x88BC +#define GL_BUFFER_MAP_POINTER 0x88BD +#define GL_STREAM_DRAW 0x88E0 +#define GL_STREAM_READ 0x88E1 +#define GL_STREAM_COPY 0x88E2 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STATIC_READ 0x88E5 +#define GL_STATIC_COPY 0x88E6 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_DYNAMIC_READ 0x88E9 +#define GL_DYNAMIC_COPY 0x88EA +#define GL_SAMPLES_PASSED 0x8914 +#endif + +#ifndef GL_VERSION_1_5_DEPRECATED +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E +#define GL_FOG_COORD_SRC 0x8450 +#define GL_FOG_COORD 0x8451 +#define GL_CURRENT_FOG_COORD 0x8453 +#define GL_FOG_COORD_ARRAY_TYPE 0x8454 +#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 +#define GL_FOG_COORD_ARRAY_POINTER 0x8456 +#define GL_FOG_COORD_ARRAY 0x8457 +#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC1_ALPHA 0x8589 +#define GL_SRC2_ALPHA 0x858A +#endif + +#ifndef GL_VERSION_2_0 +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_MAX_DRAW_BUFFERS 0x8824 +#define GL_DRAW_BUFFER0 0x8825 +#define GL_DRAW_BUFFER1 0x8826 +#define GL_DRAW_BUFFER2 0x8827 +#define GL_DRAW_BUFFER3 0x8828 +#define GL_DRAW_BUFFER4 0x8829 +#define GL_DRAW_BUFFER5 0x882A +#define GL_DRAW_BUFFER6 0x882B +#define GL_DRAW_BUFFER7 0x882C +#define GL_DRAW_BUFFER8 0x882D +#define GL_DRAW_BUFFER9 0x882E +#define GL_DRAW_BUFFER10 0x882F +#define GL_DRAW_BUFFER11 0x8830 +#define GL_DRAW_BUFFER12 0x8831 +#define GL_DRAW_BUFFER13 0x8832 +#define GL_DRAW_BUFFER14 0x8833 +#define GL_DRAW_BUFFER15 0x8834 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A +#define GL_MAX_VARYING_FLOATS 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_SHADER_TYPE 0x8B4F +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_1D 0x8B5D +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_3D 0x8B5F +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLER_1D_SHADOW 0x8B61 +#define GL_SAMPLER_2D_SHADOW 0x8B62 +#define GL_DELETE_STATUS 0x8B80 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 +#define GL_LOWER_LEFT 0x8CA1 +#define GL_UPPER_LEFT 0x8CA2 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#endif + +#ifndef GL_VERSION_2_0_DEPRECATED +#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 +#define GL_POINT_SPRITE 0x8861 +#define GL_COORD_REPLACE 0x8862 +#define GL_MAX_TEXTURE_COORDS 0x8871 +#endif + +#ifndef GL_VERSION_2_1 +#define GL_PIXEL_PACK_BUFFER 0x88EB +#define GL_PIXEL_UNPACK_BUFFER 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF +#define GL_FLOAT_MAT2x3 0x8B65 +#define GL_FLOAT_MAT2x4 0x8B66 +#define GL_FLOAT_MAT3x2 0x8B67 +#define GL_FLOAT_MAT3x4 0x8B68 +#define GL_FLOAT_MAT4x2 0x8B69 +#define GL_FLOAT_MAT4x3 0x8B6A +#define GL_SRGB 0x8C40 +#define GL_SRGB8 0x8C41 +#define GL_SRGB_ALPHA 0x8C42 +#define GL_SRGB8_ALPHA8 0x8C43 +#define GL_COMPRESSED_SRGB 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 +#endif + +#ifndef GL_VERSION_2_1_DEPRECATED +#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F +#define GL_SLUMINANCE_ALPHA 0x8C44 +#define GL_SLUMINANCE8_ALPHA8 0x8C45 +#define GL_SLUMINANCE 0x8C46 +#define GL_SLUMINANCE8 0x8C47 +#define GL_COMPRESSED_SLUMINANCE 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B +#endif + +#ifndef GL_VERSION_3_0 +#define GL_COMPARE_REF_TO_TEXTURE 0x884E +#define GL_CLIP_DISTANCE0 0x3000 +#define GL_CLIP_DISTANCE1 0x3001 +#define GL_CLIP_DISTANCE2 0x3002 +#define GL_CLIP_DISTANCE3 0x3003 +#define GL_CLIP_DISTANCE4 0x3004 +#define GL_CLIP_DISTANCE5 0x3005 +#define GL_CLIP_DISTANCE6 0x3006 +#define GL_CLIP_DISTANCE7 0x3007 +#define GL_MAX_CLIP_DISTANCES 0x0D32 +#define GL_MAJOR_VERSION 0x821B +#define GL_MINOR_VERSION 0x821C +#define GL_NUM_EXTENSIONS 0x821D +#define GL_CONTEXT_FLAGS 0x821E +#define GL_DEPTH_BUFFER 0x8223 +#define GL_STENCIL_BUFFER 0x8224 +#define GL_COMPRESSED_RED 0x8225 +#define GL_COMPRESSED_RG 0x8226 +#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 +#define GL_RGBA32F 0x8814 +#define GL_RGB32F 0x8815 +#define GL_RGBA16F 0x881A +#define GL_RGB16F 0x881B +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD +#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF +#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 +#define GL_CLAMP_READ_COLOR 0x891C +#define GL_FIXED_ONLY 0x891D +#define GL_MAX_VARYING_COMPONENTS 0x8B4B +#define GL_TEXTURE_1D_ARRAY 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D +#define GL_R11F_G11F_B10F 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B +#define GL_RGB9_E5 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E +#define GL_TEXTURE_SHARED_SIZE 0x8C3F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 +#define GL_PRIMITIVES_GENERATED 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 +#define GL_RASTERIZER_DISCARD 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B +#define GL_INTERLEAVED_ATTRIBS 0x8C8C +#define GL_SEPARATE_ATTRIBS 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F +#define GL_RGBA32UI 0x8D70 +#define GL_RGB32UI 0x8D71 +#define GL_RGBA16UI 0x8D76 +#define GL_RGB16UI 0x8D77 +#define GL_RGBA8UI 0x8D7C +#define GL_RGB8UI 0x8D7D +#define GL_RGBA32I 0x8D82 +#define GL_RGB32I 0x8D83 +#define GL_RGBA16I 0x8D88 +#define GL_RGB16I 0x8D89 +#define GL_RGBA8I 0x8D8E +#define GL_RGB8I 0x8D8F +#define GL_RED_INTEGER 0x8D94 +#define GL_GREEN_INTEGER 0x8D95 +#define GL_BLUE_INTEGER 0x8D96 +#define GL_RGB_INTEGER 0x8D98 +#define GL_RGBA_INTEGER 0x8D99 +#define GL_BGR_INTEGER 0x8D9A +#define GL_BGRA_INTEGER 0x8D9B +#define GL_SAMPLER_1D_ARRAY 0x8DC0 +#define GL_SAMPLER_2D_ARRAY 0x8DC1 +#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 +#define GL_UNSIGNED_INT_VEC2 0x8DC6 +#define GL_UNSIGNED_INT_VEC3 0x8DC7 +#define GL_UNSIGNED_INT_VEC4 0x8DC8 +#define GL_INT_SAMPLER_1D 0x8DC9 +#define GL_INT_SAMPLER_2D 0x8DCA +#define GL_INT_SAMPLER_3D 0x8DCB +#define GL_INT_SAMPLER_CUBE 0x8DCC +#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF +#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 +#define GL_QUERY_WAIT 0x8E13 +#define GL_QUERY_NO_WAIT 0x8E14 +#define GL_QUERY_BY_REGION_WAIT 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 +#define GL_BUFFER_ACCESS_FLAGS 0x911F +#define GL_BUFFER_MAP_LENGTH 0x9120 +#define GL_BUFFER_MAP_OFFSET 0x9121 +/* Reuse tokens from ARB_depth_buffer_float */ +/* reuse GL_DEPTH_COMPONENT32F */ +/* reuse GL_DEPTH32F_STENCIL8 */ +/* reuse GL_FLOAT_32_UNSIGNED_INT_24_8_REV */ +/* Reuse tokens from ARB_framebuffer_object */ +/* reuse GL_INVALID_FRAMEBUFFER_OPERATION */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ +/* reuse GL_FRAMEBUFFER_DEFAULT */ +/* reuse GL_FRAMEBUFFER_UNDEFINED */ +/* reuse GL_DEPTH_STENCIL_ATTACHMENT */ +/* reuse GL_INDEX */ +/* reuse GL_MAX_RENDERBUFFER_SIZE */ +/* reuse GL_DEPTH_STENCIL */ +/* reuse GL_UNSIGNED_INT_24_8 */ +/* reuse GL_DEPTH24_STENCIL8 */ +/* reuse GL_TEXTURE_STENCIL_SIZE */ +/* reuse GL_TEXTURE_RED_TYPE */ +/* reuse GL_TEXTURE_GREEN_TYPE */ +/* reuse GL_TEXTURE_BLUE_TYPE */ +/* reuse GL_TEXTURE_ALPHA_TYPE */ +/* reuse GL_TEXTURE_DEPTH_TYPE */ +/* reuse GL_UNSIGNED_NORMALIZED */ +/* reuse GL_FRAMEBUFFER_BINDING */ +/* reuse GL_DRAW_FRAMEBUFFER_BINDING */ +/* reuse GL_RENDERBUFFER_BINDING */ +/* reuse GL_READ_FRAMEBUFFER */ +/* reuse GL_DRAW_FRAMEBUFFER */ +/* reuse GL_READ_FRAMEBUFFER_BINDING */ +/* reuse GL_RENDERBUFFER_SAMPLES */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ +/* reuse GL_FRAMEBUFFER_COMPLETE */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ +/* reuse GL_FRAMEBUFFER_UNSUPPORTED */ +/* reuse GL_MAX_COLOR_ATTACHMENTS */ +/* reuse GL_COLOR_ATTACHMENT0 */ +/* reuse GL_COLOR_ATTACHMENT1 */ +/* reuse GL_COLOR_ATTACHMENT2 */ +/* reuse GL_COLOR_ATTACHMENT3 */ +/* reuse GL_COLOR_ATTACHMENT4 */ +/* reuse GL_COLOR_ATTACHMENT5 */ +/* reuse GL_COLOR_ATTACHMENT6 */ +/* reuse GL_COLOR_ATTACHMENT7 */ +/* reuse GL_COLOR_ATTACHMENT8 */ +/* reuse GL_COLOR_ATTACHMENT9 */ +/* reuse GL_COLOR_ATTACHMENT10 */ +/* reuse GL_COLOR_ATTACHMENT11 */ +/* reuse GL_COLOR_ATTACHMENT12 */ +/* reuse GL_COLOR_ATTACHMENT13 */ +/* reuse GL_COLOR_ATTACHMENT14 */ +/* reuse GL_COLOR_ATTACHMENT15 */ +/* reuse GL_DEPTH_ATTACHMENT */ +/* reuse GL_STENCIL_ATTACHMENT */ +/* reuse GL_FRAMEBUFFER */ +/* reuse GL_RENDERBUFFER */ +/* reuse GL_RENDERBUFFER_WIDTH */ +/* reuse GL_RENDERBUFFER_HEIGHT */ +/* reuse GL_RENDERBUFFER_INTERNAL_FORMAT */ +/* reuse GL_STENCIL_INDEX1 */ +/* reuse GL_STENCIL_INDEX4 */ +/* reuse GL_STENCIL_INDEX8 */ +/* reuse GL_STENCIL_INDEX16 */ +/* reuse GL_RENDERBUFFER_RED_SIZE */ +/* reuse GL_RENDERBUFFER_GREEN_SIZE */ +/* reuse GL_RENDERBUFFER_BLUE_SIZE */ +/* reuse GL_RENDERBUFFER_ALPHA_SIZE */ +/* reuse GL_RENDERBUFFER_DEPTH_SIZE */ +/* reuse GL_RENDERBUFFER_STENCIL_SIZE */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ +/* reuse GL_MAX_SAMPLES */ +/* Reuse tokens from ARB_framebuffer_sRGB */ +/* reuse GL_FRAMEBUFFER_SRGB */ +/* Reuse tokens from ARB_half_float_vertex */ +/* reuse GL_HALF_FLOAT */ +/* Reuse tokens from ARB_map_buffer_range */ +/* reuse GL_MAP_READ_BIT */ +/* reuse GL_MAP_WRITE_BIT */ +/* reuse GL_MAP_INVALIDATE_RANGE_BIT */ +/* reuse GL_MAP_INVALIDATE_BUFFER_BIT */ +/* reuse GL_MAP_FLUSH_EXPLICIT_BIT */ +/* reuse GL_MAP_UNSYNCHRONIZED_BIT */ +/* Reuse tokens from ARB_texture_compression_rgtc */ +/* reuse GL_COMPRESSED_RED_RGTC1 */ +/* reuse GL_COMPRESSED_SIGNED_RED_RGTC1 */ +/* reuse GL_COMPRESSED_RG_RGTC2 */ +/* reuse GL_COMPRESSED_SIGNED_RG_RGTC2 */ +/* Reuse tokens from ARB_texture_rg */ +/* reuse GL_RG */ +/* reuse GL_RG_INTEGER */ +/* reuse GL_R8 */ +/* reuse GL_R16 */ +/* reuse GL_RG8 */ +/* reuse GL_RG16 */ +/* reuse GL_R16F */ +/* reuse GL_R32F */ +/* reuse GL_RG16F */ +/* reuse GL_RG32F */ +/* reuse GL_R8I */ +/* reuse GL_R8UI */ +/* reuse GL_R16I */ +/* reuse GL_R16UI */ +/* reuse GL_R32I */ +/* reuse GL_R32UI */ +/* reuse GL_RG8I */ +/* reuse GL_RG8UI */ +/* reuse GL_RG16I */ +/* reuse GL_RG16UI */ +/* reuse GL_RG32I */ +/* reuse GL_RG32UI */ +/* Reuse tokens from ARB_vertex_array_object */ +/* reuse GL_VERTEX_ARRAY_BINDING */ +#endif + +#ifndef GL_VERSION_3_0_DEPRECATED +#define GL_CLAMP_VERTEX_COLOR 0x891A +#define GL_CLAMP_FRAGMENT_COLOR 0x891B +#define GL_ALPHA_INTEGER 0x8D97 +/* Reuse tokens from ARB_framebuffer_object */ +/* reuse GL_TEXTURE_LUMINANCE_TYPE */ +/* reuse GL_TEXTURE_INTENSITY_TYPE */ +#endif + +#ifndef GL_VERSION_3_1 +#define GL_SAMPLER_2D_RECT 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 +#define GL_SAMPLER_BUFFER 0x8DC2 +#define GL_INT_SAMPLER_2D_RECT 0x8DCD +#define GL_INT_SAMPLER_BUFFER 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 +#define GL_TEXTURE_BUFFER 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E +#define GL_TEXTURE_RECTANGLE 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 +#define GL_RED_SNORM 0x8F90 +#define GL_RG_SNORM 0x8F91 +#define GL_RGB_SNORM 0x8F92 +#define GL_RGBA_SNORM 0x8F93 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGB8_SNORM 0x8F96 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM 0x8F98 +#define GL_RG16_SNORM 0x8F99 +#define GL_RGB16_SNORM 0x8F9A +#define GL_RGBA16_SNORM 0x8F9B +#define GL_SIGNED_NORMALIZED 0x8F9C +#define GL_PRIMITIVE_RESTART 0x8F9D +#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E +/* Reuse tokens from ARB_copy_buffer */ +/* reuse GL_COPY_READ_BUFFER */ +/* reuse GL_COPY_WRITE_BUFFER */ +/* Would reuse tokens from ARB_draw_instanced, but it has none */ +/* Reuse tokens from ARB_uniform_buffer_object */ +/* reuse GL_UNIFORM_BUFFER */ +/* reuse GL_UNIFORM_BUFFER_BINDING */ +/* reuse GL_UNIFORM_BUFFER_START */ +/* reuse GL_UNIFORM_BUFFER_SIZE */ +/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */ +/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */ +/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */ +/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */ +/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */ +/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */ +/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */ +/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */ +/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */ +/* reuse GL_ACTIVE_UNIFORM_BLOCKS */ +/* reuse GL_UNIFORM_TYPE */ +/* reuse GL_UNIFORM_SIZE */ +/* reuse GL_UNIFORM_NAME_LENGTH */ +/* reuse GL_UNIFORM_BLOCK_INDEX */ +/* reuse GL_UNIFORM_OFFSET */ +/* reuse GL_UNIFORM_ARRAY_STRIDE */ +/* reuse GL_UNIFORM_MATRIX_STRIDE */ +/* reuse GL_UNIFORM_IS_ROW_MAJOR */ +/* reuse GL_UNIFORM_BLOCK_BINDING */ +/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */ +/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */ +/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */ +/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */ +/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */ +/* reuse GL_INVALID_INDEX */ +#endif + +#ifndef GL_VERSION_3_2 +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define GL_LINES_ADJACENCY 0x000A +#define GL_LINE_STRIP_ADJACENCY 0x000B +#define GL_TRIANGLES_ADJACENCY 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D +#define GL_PROGRAM_POINT_SIZE 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8 +#define GL_GEOMETRY_SHADER 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT 0x8916 +#define GL_GEOMETRY_INPUT_TYPE 0x8917 +#define GL_GEOMETRY_OUTPUT_TYPE 0x8918 +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1 +#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124 +#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +/* reuse GL_MAX_VARYING_COMPONENTS */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ +/* Reuse tokens from ARB_depth_clamp */ +/* reuse GL_DEPTH_CLAMP */ +/* Would reuse tokens from ARB_draw_elements_base_vertex, but it has none */ +/* Would reuse tokens from ARB_fragment_coord_conventions, but it has none */ +/* Reuse tokens from ARB_provoking_vertex */ +/* reuse GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ +/* reuse GL_FIRST_VERTEX_CONVENTION */ +/* reuse GL_LAST_VERTEX_CONVENTION */ +/* reuse GL_PROVOKING_VERTEX */ +/* Reuse tokens from ARB_seamless_cube_map */ +/* reuse GL_TEXTURE_CUBE_MAP_SEAMLESS */ +/* Reuse tokens from ARB_sync */ +/* reuse GL_MAX_SERVER_WAIT_TIMEOUT */ +/* reuse GL_OBJECT_TYPE */ +/* reuse GL_SYNC_CONDITION */ +/* reuse GL_SYNC_STATUS */ +/* reuse GL_SYNC_FLAGS */ +/* reuse GL_SYNC_FENCE */ +/* reuse GL_SYNC_GPU_COMMANDS_COMPLETE */ +/* reuse GL_UNSIGNALED */ +/* reuse GL_SIGNALED */ +/* reuse GL_ALREADY_SIGNALED */ +/* reuse GL_TIMEOUT_EXPIRED */ +/* reuse GL_CONDITION_SATISFIED */ +/* reuse GL_WAIT_FAILED */ +/* reuse GL_TIMEOUT_IGNORED */ +/* reuse GL_SYNC_FLUSH_COMMANDS_BIT */ +/* reuse GL_TIMEOUT_IGNORED */ +/* Reuse tokens from ARB_texture_multisample */ +/* reuse GL_SAMPLE_POSITION */ +/* reuse GL_SAMPLE_MASK */ +/* reuse GL_SAMPLE_MASK_VALUE */ +/* reuse GL_MAX_SAMPLE_MASK_WORDS */ +/* reuse GL_TEXTURE_2D_MULTISAMPLE */ +/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE */ +/* reuse GL_TEXTURE_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE */ +/* reuse GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_TEXTURE_SAMPLES */ +/* reuse GL_TEXTURE_FIXED_SAMPLE_LOCATIONS */ +/* reuse GL_SAMPLER_2D_MULTISAMPLE */ +/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE */ +/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE */ +/* reuse GL_SAMPLER_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY */ +/* reuse GL_MAX_COLOR_TEXTURE_SAMPLES */ +/* reuse GL_MAX_DEPTH_TEXTURE_SAMPLES */ +/* reuse GL_MAX_INTEGER_SAMPLES */ +/* Don't need to reuse tokens from ARB_vertex_array_bgra since they're already in 1.2 core */ +#endif + +#ifndef GL_ARB_multitexture +#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 +#endif + +#ifndef GL_ARB_transpose_matrix +#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 +#endif + +#ifndef GL_ARB_multisample +#define GL_MULTISAMPLE_ARB 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_SAMPLE_BUFFERS_ARB 0x80A8 +#define GL_SAMPLES_ARB 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB +#define GL_MULTISAMPLE_BIT_ARB 0x20000000 +#endif + +#ifndef GL_ARB_texture_env_add +#endif + +#ifndef GL_ARB_texture_cube_map +#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 + +#ifndef GL_ARB_texture_compression +#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 +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_CLAMP_TO_BORDER_ARB 0x812D +#endif + +#ifndef GL_ARB_point_parameters +#define GL_POINT_SIZE_MIN_ARB 0x8126 +#define GL_POINT_SIZE_MAX_ARB 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129 +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_MAX_VERTEX_UNITS_ARB 0x86A4 +#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5 +#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6 +#define GL_VERTEX_BLEND_ARB 0x86A7 +#define GL_CURRENT_WEIGHT_ARB 0x86A8 +#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA +#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB +#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC +#define GL_WEIGHT_ARRAY_ARB 0x86AD +#define GL_MODELVIEW0_ARB 0x1700 +#define GL_MODELVIEW1_ARB 0x850A +#define GL_MODELVIEW2_ARB 0x8722 +#define GL_MODELVIEW3_ARB 0x8723 +#define GL_MODELVIEW4_ARB 0x8724 +#define GL_MODELVIEW5_ARB 0x8725 +#define GL_MODELVIEW6_ARB 0x8726 +#define GL_MODELVIEW7_ARB 0x8727 +#define GL_MODELVIEW8_ARB 0x8728 +#define GL_MODELVIEW9_ARB 0x8729 +#define GL_MODELVIEW10_ARB 0x872A +#define GL_MODELVIEW11_ARB 0x872B +#define GL_MODELVIEW12_ARB 0x872C +#define GL_MODELVIEW13_ARB 0x872D +#define GL_MODELVIEW14_ARB 0x872E +#define GL_MODELVIEW15_ARB 0x872F +#define GL_MODELVIEW16_ARB 0x8730 +#define GL_MODELVIEW17_ARB 0x8731 +#define GL_MODELVIEW18_ARB 0x8732 +#define GL_MODELVIEW19_ARB 0x8733 +#define GL_MODELVIEW20_ARB 0x8734 +#define GL_MODELVIEW21_ARB 0x8735 +#define GL_MODELVIEW22_ARB 0x8736 +#define GL_MODELVIEW23_ARB 0x8737 +#define GL_MODELVIEW24_ARB 0x8738 +#define GL_MODELVIEW25_ARB 0x8739 +#define GL_MODELVIEW26_ARB 0x873A +#define GL_MODELVIEW27_ARB 0x873B +#define GL_MODELVIEW28_ARB 0x873C +#define GL_MODELVIEW29_ARB 0x873D +#define GL_MODELVIEW30_ARB 0x873E +#define GL_MODELVIEW31_ARB 0x873F +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_MATRIX_PALETTE_ARB 0x8840 +#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841 +#define GL_MAX_PALETTE_MATRICES_ARB 0x8842 +#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843 +#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844 +#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845 +#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849 +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_COMBINE_ARB 0x8570 +#define GL_COMBINE_RGB_ARB 0x8571 +#define GL_COMBINE_ALPHA_ARB 0x8572 +#define GL_SOURCE0_RGB_ARB 0x8580 +#define GL_SOURCE1_RGB_ARB 0x8581 +#define GL_SOURCE2_RGB_ARB 0x8582 +#define GL_SOURCE0_ALPHA_ARB 0x8588 +#define GL_SOURCE1_ALPHA_ARB 0x8589 +#define GL_SOURCE2_ALPHA_ARB 0x858A +#define GL_OPERAND0_RGB_ARB 0x8590 +#define GL_OPERAND1_RGB_ARB 0x8591 +#define GL_OPERAND2_RGB_ARB 0x8592 +#define GL_OPERAND0_ALPHA_ARB 0x8598 +#define GL_OPERAND1_ALPHA_ARB 0x8599 +#define GL_OPERAND2_ALPHA_ARB 0x859A +#define GL_RGB_SCALE_ARB 0x8573 +#define GL_ADD_SIGNED_ARB 0x8574 +#define GL_INTERPOLATE_ARB 0x8575 +#define GL_SUBTRACT_ARB 0x84E7 +#define GL_CONSTANT_ARB 0x8576 +#define GL_PRIMARY_COLOR_ARB 0x8577 +#define GL_PREVIOUS_ARB 0x8578 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_DOT3_RGB_ARB 0x86AE +#define GL_DOT3_RGBA_ARB 0x86AF +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_ARB 0x8370 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_DEPTH_COMPONENT16_ARB 0x81A5 +#define GL_DEPTH_COMPONENT24_ARB 0x81A6 +#define GL_DEPTH_COMPONENT32_ARB 0x81A7 +#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A +#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B +#endif + +#ifndef GL_ARB_shadow +#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C +#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D +#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF +#endif + +#ifndef GL_ARB_window_pos +#endif + +#ifndef GL_ARB_vertex_program +#define GL_COLOR_SUM_ARB 0x8458 +#define GL_VERTEX_PROGRAM_ARB 0x8620 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625 +#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626 +#define GL_PROGRAM_LENGTH_ARB 0x8627 +#define GL_PROGRAM_STRING_ARB 0x8628 +#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E +#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F +#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640 +#define GL_CURRENT_MATRIX_ARB 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643 +#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645 +#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B +#define GL_PROGRAM_BINDING_ARB 0x8677 +#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A +#define GL_PROGRAM_ERROR_STRING_ARB 0x8874 +#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875 +#define GL_PROGRAM_FORMAT_ARB 0x8876 +#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0 +#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1 +#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2 +#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3 +#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4 +#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5 +#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6 +#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7 +#define GL_PROGRAM_PARAMETERS_ARB 0x88A8 +#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9 +#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA +#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB +#define GL_PROGRAM_ATTRIBS_ARB 0x88AC +#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD +#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE +#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF +#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0 +#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1 +#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2 +#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3 +#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4 +#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5 +#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6 +#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7 +#define GL_MATRIX0_ARB 0x88C0 +#define GL_MATRIX1_ARB 0x88C1 +#define GL_MATRIX2_ARB 0x88C2 +#define GL_MATRIX3_ARB 0x88C3 +#define GL_MATRIX4_ARB 0x88C4 +#define GL_MATRIX5_ARB 0x88C5 +#define GL_MATRIX6_ARB 0x88C6 +#define GL_MATRIX7_ARB 0x88C7 +#define GL_MATRIX8_ARB 0x88C8 +#define GL_MATRIX9_ARB 0x88C9 +#define GL_MATRIX10_ARB 0x88CA +#define GL_MATRIX11_ARB 0x88CB +#define GL_MATRIX12_ARB 0x88CC +#define GL_MATRIX13_ARB 0x88CD +#define GL_MATRIX14_ARB 0x88CE +#define GL_MATRIX15_ARB 0x88CF +#define GL_MATRIX16_ARB 0x88D0 +#define GL_MATRIX17_ARB 0x88D1 +#define GL_MATRIX18_ARB 0x88D2 +#define GL_MATRIX19_ARB 0x88D3 +#define GL_MATRIX20_ARB 0x88D4 +#define GL_MATRIX21_ARB 0x88D5 +#define GL_MATRIX22_ARB 0x88D6 +#define GL_MATRIX23_ARB 0x88D7 +#define GL_MATRIX24_ARB 0x88D8 +#define GL_MATRIX25_ARB 0x88D9 +#define GL_MATRIX26_ARB 0x88DA +#define GL_MATRIX27_ARB 0x88DB +#define GL_MATRIX28_ARB 0x88DC +#define GL_MATRIX29_ARB 0x88DD +#define GL_MATRIX30_ARB 0x88DE +#define GL_MATRIX31_ARB 0x88DF +#endif + +#ifndef GL_ARB_fragment_program +#define GL_FRAGMENT_PROGRAM_ARB 0x8804 +#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805 +#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806 +#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807 +#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808 +#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809 +#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A +#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B +#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C +#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D +#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E +#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F +#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810 +#define GL_MAX_TEXTURE_COORDS_ARB 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872 +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_BUFFER_SIZE_ARB 0x8764 +#define GL_BUFFER_USAGE_ARB 0x8765 +#define GL_ARRAY_BUFFER_ARB 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 +#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898 +#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A +#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B +#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C +#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F +#define GL_READ_ONLY_ARB 0x88B8 +#define GL_WRITE_ONLY_ARB 0x88B9 +#define GL_READ_WRITE_ARB 0x88BA +#define GL_BUFFER_ACCESS_ARB 0x88BB +#define GL_BUFFER_MAPPED_ARB 0x88BC +#define GL_BUFFER_MAP_POINTER_ARB 0x88BD +#define GL_STREAM_DRAW_ARB 0x88E0 +#define GL_STREAM_READ_ARB 0x88E1 +#define GL_STREAM_COPY_ARB 0x88E2 +#define GL_STATIC_DRAW_ARB 0x88E4 +#define GL_STATIC_READ_ARB 0x88E5 +#define GL_STATIC_COPY_ARB 0x88E6 +#define GL_DYNAMIC_DRAW_ARB 0x88E8 +#define GL_DYNAMIC_READ_ARB 0x88E9 +#define GL_DYNAMIC_COPY_ARB 0x88EA +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_QUERY_COUNTER_BITS_ARB 0x8864 +#define GL_CURRENT_QUERY_ARB 0x8865 +#define GL_QUERY_RESULT_ARB 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867 +#define GL_SAMPLES_PASSED_ARB 0x8914 +#endif + +#ifndef GL_ARB_shader_objects +#define GL_PROGRAM_OBJECT_ARB 0x8B40 +#define GL_SHADER_OBJECT_ARB 0x8B48 +#define GL_OBJECT_TYPE_ARB 0x8B4E +#define GL_OBJECT_SUBTYPE_ARB 0x8B4F +#define GL_FLOAT_VEC2_ARB 0x8B50 +#define GL_FLOAT_VEC3_ARB 0x8B51 +#define GL_FLOAT_VEC4_ARB 0x8B52 +#define GL_INT_VEC2_ARB 0x8B53 +#define GL_INT_VEC3_ARB 0x8B54 +#define GL_INT_VEC4_ARB 0x8B55 +#define GL_BOOL_ARB 0x8B56 +#define GL_BOOL_VEC2_ARB 0x8B57 +#define GL_BOOL_VEC3_ARB 0x8B58 +#define GL_BOOL_VEC4_ARB 0x8B59 +#define GL_FLOAT_MAT2_ARB 0x8B5A +#define GL_FLOAT_MAT3_ARB 0x8B5B +#define GL_FLOAT_MAT4_ARB 0x8B5C +#define GL_SAMPLER_1D_ARB 0x8B5D +#define GL_SAMPLER_2D_ARB 0x8B5E +#define GL_SAMPLER_3D_ARB 0x8B5F +#define GL_SAMPLER_CUBE_ARB 0x8B60 +#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61 +#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62 +#define GL_SAMPLER_2D_RECT_ARB 0x8B63 +#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64 +#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80 +#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81 +#define GL_OBJECT_LINK_STATUS_ARB 0x8B82 +#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83 +#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84 +#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85 +#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86 +#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87 +#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88 +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_VERTEX_SHADER_ARB 0x8B31 +#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A +#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D +#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89 +#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_FRAGMENT_SHADER_ARB 0x8B30 +#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#endif + +#ifndef GL_ARB_point_sprite +#define GL_POINT_SPRITE_ARB 0x8861 +#define GL_COORD_REPLACE_ARB 0x8862 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ARB 0x8824 +#define GL_DRAW_BUFFER0_ARB 0x8825 +#define GL_DRAW_BUFFER1_ARB 0x8826 +#define GL_DRAW_BUFFER2_ARB 0x8827 +#define GL_DRAW_BUFFER3_ARB 0x8828 +#define GL_DRAW_BUFFER4_ARB 0x8829 +#define GL_DRAW_BUFFER5_ARB 0x882A +#define GL_DRAW_BUFFER6_ARB 0x882B +#define GL_DRAW_BUFFER7_ARB 0x882C +#define GL_DRAW_BUFFER8_ARB 0x882D +#define GL_DRAW_BUFFER9_ARB 0x882E +#define GL_DRAW_BUFFER10_ARB 0x882F +#define GL_DRAW_BUFFER11_ARB 0x8830 +#define GL_DRAW_BUFFER12_ARB 0x8831 +#define GL_DRAW_BUFFER13_ARB 0x8832 +#define GL_DRAW_BUFFER14_ARB 0x8833 +#define GL_DRAW_BUFFER15_ARB 0x8834 +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_TEXTURE_RECTANGLE_ARB 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_RGBA_FLOAT_MODE_ARB 0x8820 +#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A +#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B +#define GL_CLAMP_READ_COLOR_ARB 0x891C +#define GL_FIXED_ONLY_ARB 0x891D +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_HALF_FLOAT_ARB 0x140B +#endif + +#ifndef GL_ARB_texture_float +#define GL_TEXTURE_RED_TYPE_ARB 0x8C10 +#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11 +#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13 +#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15 +#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16 +#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17 +#define GL_RGBA32F_ARB 0x8814 +#define GL_RGB32F_ARB 0x8815 +#define GL_ALPHA32F_ARB 0x8816 +#define GL_INTENSITY32F_ARB 0x8817 +#define GL_LUMINANCE32F_ARB 0x8818 +#define GL_LUMINANCE_ALPHA32F_ARB 0x8819 +#define GL_RGBA16F_ARB 0x881A +#define GL_RGB16F_ARB 0x881B +#define GL_ALPHA16F_ARB 0x881C +#define GL_INTENSITY16F_ARB 0x881D +#define GL_LUMINANCE16F_ARB 0x881E +#define GL_LUMINANCE_ALPHA16F_ARB 0x881F +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF +#endif + +#ifndef GL_ARB_depth_buffer_float +#define GL_DEPTH_COMPONENT32F 0x8CAC +#define GL_DEPTH32F_STENCIL8 0x8CAD +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD +#endif + +#ifndef GL_ARB_draw_instanced +#endif + +#ifndef GL_ARB_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 +#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 +#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 +#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 +#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 +#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 +#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 +#define GL_FRAMEBUFFER_DEFAULT 0x8218 +#define GL_FRAMEBUFFER_UNDEFINED 0x8219 +#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_DEPTH_STENCIL 0x84F9 +#define GL_UNSIGNED_INT_24_8 0x84FA +#define GL_DEPTH24_STENCIL8 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE 0x88F1 +#define GL_TEXTURE_RED_TYPE 0x8C10 +#define GL_TEXTURE_GREEN_TYPE 0x8C11 +#define GL_TEXTURE_BLUE_TYPE 0x8C12 +#define GL_TEXTURE_ALPHA_TYPE 0x8C13 +#define GL_TEXTURE_DEPTH_TYPE 0x8C16 +#define GL_UNSIGNED_NORMALIZED 0x8C17 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_READ_FRAMEBUFFER 0x8CA8 +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA +#define GL_RENDERBUFFER_SAMPLES 0x8CAB +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_ATTACHMENT1 0x8CE1 +#define GL_COLOR_ATTACHMENT2 0x8CE2 +#define GL_COLOR_ATTACHMENT3 0x8CE3 +#define GL_COLOR_ATTACHMENT4 0x8CE4 +#define GL_COLOR_ATTACHMENT5 0x8CE5 +#define GL_COLOR_ATTACHMENT6 0x8CE6 +#define GL_COLOR_ATTACHMENT7 0x8CE7 +#define GL_COLOR_ATTACHMENT8 0x8CE8 +#define GL_COLOR_ATTACHMENT9 0x8CE9 +#define GL_COLOR_ATTACHMENT10 0x8CEA +#define GL_COLOR_ATTACHMENT11 0x8CEB +#define GL_COLOR_ATTACHMENT12 0x8CEC +#define GL_COLOR_ATTACHMENT13 0x8CED +#define GL_COLOR_ATTACHMENT14 0x8CEE +#define GL_COLOR_ATTACHMENT15 0x8CEF +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_STENCIL_INDEX1 0x8D46 +#define GL_STENCIL_INDEX4 0x8D47 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_INDEX16 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 +#define GL_MAX_SAMPLES 0x8D57 +#endif + +#ifndef GL_ARB_framebuffer_object_DEPRECATED +#define GL_INDEX 0x8222 +#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 +#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 +#endif + +#ifndef GL_ARB_framebuffer_sRGB +#define GL_FRAMEBUFFER_SRGB 0x8DB9 +#endif + +#ifndef GL_ARB_geometry_shader4 +#define GL_LINES_ADJACENCY_ARB 0x000A +#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B +#define GL_TRIANGLES_ADJACENCY_ARB 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D +#define GL_PROGRAM_POINT_SIZE_ARB 0x8642 +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9 +#define GL_GEOMETRY_SHADER_ARB 0x8DD9 +#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1 +/* reuse GL_MAX_VARYING_COMPONENTS */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ +#endif + +#ifndef GL_ARB_half_float_vertex +#define GL_HALF_FLOAT 0x140B +#endif + +#ifndef GL_ARB_instanced_arrays +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE +#endif + +#ifndef GL_ARB_map_buffer_range +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#endif + +#ifndef GL_ARB_texture_buffer_object +#define GL_TEXTURE_BUFFER_ARB 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E +#endif + +#ifndef GL_ARB_texture_compression_rgtc +#define GL_COMPRESSED_RED_RGTC1 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC +#define GL_COMPRESSED_RG_RGTC2 0x8DBD +#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE +#endif + +#ifndef GL_ARB_texture_rg +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_RG8 0x822B +#define GL_RG16 0x822C +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#endif + +#ifndef GL_ARB_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING 0x85B5 +#endif + +#ifndef GL_ARB_uniform_buffer_object +#define GL_UNIFORM_BUFFER 0x8A11 +#define GL_UNIFORM_BUFFER_BINDING 0x8A28 +#define GL_UNIFORM_BUFFER_START 0x8A29 +#define GL_UNIFORM_BUFFER_SIZE 0x8A2A +#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C +#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D +#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E +#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F +#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 +#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 +#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 +#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 +#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 +#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 +#define GL_UNIFORM_TYPE 0x8A37 +#define GL_UNIFORM_SIZE 0x8A38 +#define GL_UNIFORM_NAME_LENGTH 0x8A39 +#define GL_UNIFORM_BLOCK_INDEX 0x8A3A +#define GL_UNIFORM_OFFSET 0x8A3B +#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C +#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D +#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E +#define GL_UNIFORM_BLOCK_BINDING 0x8A3F +#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 +#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 +#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 +#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 +#define GL_INVALID_INDEX 0xFFFFFFFFu +#endif + +#ifndef GL_ARB_compatibility +/* ARB_compatibility just defines tokens from core 3.0 */ +#endif + +#ifndef GL_ARB_copy_buffer +#define GL_COPY_READ_BUFFER 0x8F36 +#define GL_COPY_WRITE_BUFFER 0x8F37 +#endif + +#ifndef GL_ARB_shader_texture_lod +#endif + +#ifndef GL_ARB_depth_clamp +#define GL_DEPTH_CLAMP 0x864F +#endif + +#ifndef GL_ARB_draw_elements_base_vertex +#endif + +#ifndef GL_ARB_fragment_coord_conventions +#endif + +#ifndef GL_ARB_provoking_vertex +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION 0x8E4D +#define GL_LAST_VERTEX_CONVENTION 0x8E4E +#define GL_PROVOKING_VERTEX 0x8E4F +#endif + +#ifndef GL_ARB_seamless_cube_map +#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F +#endif + +#ifndef GL_ARB_sync +#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 +#define GL_OBJECT_TYPE 0x9112 +#define GL_SYNC_CONDITION 0x9113 +#define GL_SYNC_STATUS 0x9114 +#define GL_SYNC_FLAGS 0x9115 +#define GL_SYNC_FENCE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 +#define GL_UNSIGNALED 0x9118 +#define GL_SIGNALED 0x9119 +#define GL_ALREADY_SIGNALED 0x911A +#define GL_TIMEOUT_EXPIRED 0x911B +#define GL_CONDITION_SATISFIED 0x911C +#define GL_WAIT_FAILED 0x911D +#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 +#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull +#endif + +#ifndef GL_ARB_texture_multisample +#define GL_SAMPLE_POSITION 0x8E50 +#define GL_SAMPLE_MASK 0x8E51 +#define GL_SAMPLE_MASK_VALUE 0x8E52 +#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105 +#define GL_TEXTURE_SAMPLES 0x9106 +#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 +#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 +#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D +#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E +#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F +#define GL_MAX_INTEGER_SAMPLES 0x9110 +#endif + +#ifndef GL_ARB_vertex_array_bgra +/* reuse GL_BGRA */ +#endif + +#ifndef GL_ARB_draw_buffers_blend +#endif + +#ifndef GL_ARB_sample_shading +#define GL_SAMPLE_SHADING 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37 +#endif + +#ifndef GL_ARB_texture_cube_map_array +#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A +#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B +#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F +#endif + +#ifndef GL_ARB_texture_gather +#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E +#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F +#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS 0x8F9F +#endif + +#ifndef GL_ARB_texture_query_lod +#endif + +#ifndef GL_EXT_abgr +#define GL_ABGR_EXT 0x8000 +#endif + +#ifndef GL_EXT_blend_color +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_POLYGON_OFFSET_EXT 0x8037 +#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038 +#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039 +#endif + +#ifndef GL_EXT_texture +#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 +#define GL_TEXTURE_TOO_LARGE_EXT 0x8065 +#endif + +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_FILTER4_SGIS 0x8146 +#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147 +#endif + +#ifndef GL_EXT_subtexture +#endif + +#ifndef GL_EXT_copy_texture +#endif + +#ifndef GL_EXT_histogram +#define GL_HISTOGRAM_EXT 0x8024 +#define GL_PROXY_HISTOGRAM_EXT 0x8025 +#define GL_HISTOGRAM_WIDTH_EXT 0x8026 +#define GL_HISTOGRAM_FORMAT_EXT 0x8027 +#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028 +#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029 +#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A +#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B +#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C +#define GL_HISTOGRAM_SINK_EXT 0x802D +#define GL_MINMAX_EXT 0x802E +#define GL_MINMAX_FORMAT_EXT 0x802F +#define GL_MINMAX_SINK_EXT 0x8030 +#define GL_TABLE_TOO_LARGE_EXT 0x8031 +#endif + +#ifndef GL_EXT_convolution +#define GL_CONVOLUTION_1D_EXT 0x8010 +#define GL_CONVOLUTION_2D_EXT 0x8011 +#define GL_SEPARABLE_2D_EXT 0x8012 +#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013 +#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014 +#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015 +#define GL_REDUCE_EXT 0x8016 +#define GL_CONVOLUTION_FORMAT_EXT 0x8017 +#define GL_CONVOLUTION_WIDTH_EXT 0x8018 +#define GL_CONVOLUTION_HEIGHT_EXT 0x8019 +#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A +#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B +#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C +#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D +#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E +#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F +#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020 +#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021 +#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022 +#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023 +#endif + +#ifndef GL_SGI_color_matrix +#define GL_COLOR_MATRIX_SGI 0x80B1 +#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2 +#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3 +#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4 +#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5 +#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6 +#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7 +#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8 +#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9 +#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA +#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB +#endif + +#ifndef GL_SGI_color_table +#define GL_COLOR_TABLE_SGI 0x80D0 +#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 +#endif + +#ifndef GL_SGIS_pixel_texture +#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 +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_PIXEL_TEX_GEN_SGIX 0x8139 +#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B +#endif + +#ifndef GL_SGIS_texture4D +#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 +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC +#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD +#endif + +#ifndef GL_EXT_cmyka +#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 + +#ifndef GL_EXT_texture_object +#define GL_TEXTURE_PRIORITY_EXT 0x8066 +#define GL_TEXTURE_RESIDENT_EXT 0x8067 +#define GL_TEXTURE_1D_BINDING_EXT 0x8068 +#define GL_TEXTURE_2D_BINDING_EXT 0x8069 +#define GL_TEXTURE_3D_BINDING_EXT 0x806A +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095 +#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096 +#define GL_LINEAR_DETAIL_SGIS 0x8097 +#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098 +#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099 +#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A +#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B +#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_LINEAR_SHARPEN_SGIS 0x80AD +#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE +#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF +#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0 +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032 +#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034 +#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035 +#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036 +#endif + +#ifndef GL_SGIS_texture_lod +#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 + +#ifndef GL_SGIS_multisample +#define GL_MULTISAMPLE_SGIS 0x809D +#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F +#define GL_SAMPLE_MASK_SGIS 0x80A0 +#define GL_1PASS_SGIS 0x80A1 +#define GL_2PASS_0_SGIS 0x80A2 +#define GL_2PASS_1_SGIS 0x80A3 +#define GL_4PASS_0_SGIS 0x80A4 +#define GL_4PASS_1_SGIS 0x80A5 +#define GL_4PASS_2_SGIS 0x80A6 +#define GL_4PASS_3_SGIS 0x80A7 +#define GL_SAMPLE_BUFFERS_SGIS 0x80A8 +#define GL_SAMPLES_SGIS 0x80A9 +#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA +#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB +#define GL_SAMPLE_PATTERN_SGIS 0x80AC +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_RESCALE_NORMAL_EXT 0x803A +#endif + +#ifndef GL_EXT_vertex_array +#define GL_VERTEX_ARRAY_EXT 0x8074 +#define GL_NORMAL_ARRAY_EXT 0x8075 +#define GL_COLOR_ARRAY_EXT 0x8076 +#define GL_INDEX_ARRAY_EXT 0x8077 +#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 +#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 +#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A +#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B +#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C +#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D +#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E +#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F +#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 +#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 +#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 +#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 +#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 +#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 +#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 +#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 +#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A +#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B +#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C +#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D +#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E +#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F +#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 +#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 +#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 +#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 +#endif + +#ifndef GL_EXT_misc_attribute +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_GENERATE_MIPMAP_SGIS 0x8191 +#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 +#endif + +#ifndef GL_SGIX_clipmap +#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 +#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D +#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E +#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F +#endif + +#ifndef GL_SGIX_shadow +#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 + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_CLAMP_TO_EDGE_SGIS 0x812F +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_CLAMP_TO_BORDER_SGIS 0x812D +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_FUNC_SUBTRACT_EXT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B +#endif + +#ifndef GL_EXT_blend_logic_op +#endif + +#ifndef GL_SGIX_interlace +#define GL_INTERLACE_SGIX 0x8094 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E +#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F +#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140 +#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141 +#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142 +#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143 +#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144 +#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145 +#endif + +#ifndef GL_SGIS_texture_select +#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_QUAD_ALPHA4_SGIS 0x811E +#define GL_QUAD_ALPHA8_SGIS 0x811F +#define GL_QUAD_LUMINANCE4_SGIS 0x8120 +#define GL_QUAD_LUMINANCE8_SGIS 0x8121 +#define GL_QUAD_INTENSITY4_SGIS 0x8122 +#define GL_QUAD_INTENSITY8_SGIS 0x8123 +#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124 +#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SPRITE_SGIX 0x8148 +#define GL_SPRITE_MODE_SGIX 0x8149 +#define GL_SPRITE_AXIS_SGIX 0x814A +#define GL_SPRITE_TRANSLATION_SGIX 0x814B +#define GL_SPRITE_AXIAL_SGIX 0x814C +#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D +#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E +#endif + +#ifndef GL_EXT_point_parameters +#define GL_POINT_SIZE_MIN_EXT 0x8126 +#define GL_POINT_SIZE_MAX_EXT 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +#define GL_DISTANCE_ATTENUATION_EXT 0x8129 +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_POINT_SIZE_MIN_SGIS 0x8126 +#define GL_POINT_SIZE_MAX_SGIS 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128 +#define GL_DISTANCE_ATTENUATION_SGIS 0x8129 +#endif + +#ifndef GL_SGIX_instruments +#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180 +#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181 +#endif + +#ifndef GL_SGIX_texture_scale_bias +#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 + +#ifndef GL_SGIX_framezoom +#define GL_FRAMEZOOM_SGIX 0x818B +#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C +#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#endif + +#ifndef GL_FfdMaskSGIX +#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001 +#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002 +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194 +#define GL_TEXTURE_DEFORMATION_SGIX 0x8195 +#define GL_DEFORMATIONS_MASK_SGIX 0x8196 +#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197 +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_REFERENCE_PLANE_SGIX 0x817D +#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E +#endif + +#ifndef GL_SGIX_flush_raster +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_DEPTH_COMPONENT16_SGIX 0x81A5 +#define GL_DEPTH_COMPONENT24_SGIX 0x81A6 +#define GL_DEPTH_COMPONENT32_SGIX 0x81A7 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_FOG_FUNC_SGIS 0x812A +#define GL_FOG_FUNC_POINTS_SGIS 0x812B +#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_FOG_OFFSET_SGIX 0x8198 +#define GL_FOG_OFFSET_VALUE_SGIX 0x8199 +#endif + +#ifndef GL_HP_image_transform +#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 +#endif + +#ifndef GL_HP_convolution_border_modes +#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 + +#ifndef GL_INGR_palette_buffer +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE +#endif + +#ifndef GL_EXT_color_subtable +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_VERTEX_DATA_HINT_PGI 0x1A22A +#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B +#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C +#define GL_MAX_VERTEX_HINT_PGI 0x1A22D +#define GL_COLOR3_BIT_PGI 0x00010000 +#define GL_COLOR4_BIT_PGI 0x00020000 +#define GL_EDGEFLAG_BIT_PGI 0x00040000 +#define GL_INDEX_BIT_PGI 0x00080000 +#define GL_MAT_AMBIENT_BIT_PGI 0x00100000 +#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000 +#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000 +#define GL_MAT_EMISSION_BIT_PGI 0x00800000 +#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000 +#define GL_MAT_SHININESS_BIT_PGI 0x02000000 +#define GL_MAT_SPECULAR_BIT_PGI 0x04000000 +#define GL_NORMAL_BIT_PGI 0x08000000 +#define GL_TEXCOORD1_BIT_PGI 0x10000000 +#define GL_TEXCOORD2_BIT_PGI 0x20000000 +#define GL_TEXCOORD3_BIT_PGI 0x40000000 +#define GL_TEXCOORD4_BIT_PGI 0x80000000 +#define GL_VERTEX23_BIT_PGI 0x00000004 +#define GL_VERTEX4_BIT_PGI 0x00000008 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8 +#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD +#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE +#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202 +#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203 +#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204 +#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C +#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D +#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E +#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F +#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210 +#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211 +#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216 +#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217 +#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218 +#define GL_FULL_STIPPLE_HINT_PGI 0x1A219 +#define GL_CLIP_NEAR_HINT_PGI 0x1A220 +#define GL_CLIP_FAR_HINT_PGI 0x1A221 +#define GL_WIDE_LINE_HINT_PGI 0x1A222 +#define GL_BACK_NORMALS_HINT_PGI 0x1A223 +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_COLOR_INDEX1_EXT 0x80E2 +#define GL_COLOR_INDEX2_EXT 0x80E3 +#define GL_COLOR_INDEX4_EXT 0x80E4 +#define GL_COLOR_INDEX8_EXT 0x80E5 +#define GL_COLOR_INDEX12_EXT 0x80E6 +#define GL_COLOR_INDEX16_EXT 0x80E7 +#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_LIST_PRIORITY_SGIX 0x8182 +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_IR_INSTRUMENT1_SGIX 0x817F +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#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 + +#ifndef GL_SGIX_shadow_ambient +#define GL_SHADOW_AMBIENT_SGIX 0x80BF +#endif + +#ifndef GL_EXT_index_texture +#endif + +#ifndef GL_EXT_index_material +#define GL_INDEX_MATERIAL_EXT 0x81B8 +#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9 +#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA +#endif + +#ifndef GL_EXT_index_func +#define GL_INDEX_TEST_EXT 0x81B5 +#define GL_INDEX_TEST_FUNC_EXT 0x81B6 +#define GL_INDEX_TEST_REF_EXT 0x81B7 +#endif + +#ifndef GL_EXT_index_array_formats +#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 + +#ifndef GL_EXT_compiled_vertex_array +#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8 +#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9 +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_CULL_VERTEX_EXT 0x81AA +#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB +#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_YCRCB_422_SGIX 0x81BB +#define GL_YCRCB_444_SGIX 0x81BC +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_FRAGMENT_LIGHTING_SGIX 0x8400 +#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401 +#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402 +#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403 +#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404 +#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405 +#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406 +#define GL_LIGHT_ENV_MODE_SGIX 0x8407 +#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408 +#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409 +#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A +#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B +#define GL_FRAGMENT_LIGHT0_SGIX 0x840C +#define GL_FRAGMENT_LIGHT1_SGIX 0x840D +#define GL_FRAGMENT_LIGHT2_SGIX 0x840E +#define GL_FRAGMENT_LIGHT3_SGIX 0x840F +#define GL_FRAGMENT_LIGHT4_SGIX 0x8410 +#define GL_FRAGMENT_LIGHT5_SGIX 0x8411 +#define GL_FRAGMENT_LIGHT6_SGIX 0x8412 +#define GL_FRAGMENT_LIGHT7_SGIX 0x8413 +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167 +#define GL_TEXTURE_POST_SPECULAR_HP 0x8168 +#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8 +#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9 +#endif + +#ifndef GL_WIN_phong_shading +#define GL_PHONG_WIN 0x80EA +#define GL_PHONG_HINT_WIN 0x80EB +#endif + +#ifndef GL_WIN_specular_fog +#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC +#endif + +#ifndef GL_EXT_light_texture +#define GL_FRAGMENT_MATERIAL_EXT 0x8349 +#define GL_FRAGMENT_NORMAL_EXT 0x834A +#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 +/* reuse GL_FRAGMENT_DEPTH_EXT */ +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_ALPHA_MIN_SGIX 0x8320 +#define GL_ALPHA_MAX_SGIX 0x8321 +#endif + +#ifndef GL_SGIX_impact_pixel_texture +#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184 +#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185 +#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186 +#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187 +#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188 +#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189 +#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A +#endif + +#ifndef GL_EXT_bgra +#define GL_BGR_EXT 0x80E0 +#define GL_BGRA_EXT 0x80E1 +#endif + +#ifndef GL_SGIX_async +#define GL_ASYNC_MARKER_SGIX 0x8329 +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C +#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D +#define GL_ASYNC_READ_PIXELS_SGIX 0x835E +#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F +#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360 +#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_ASYNC_HISTOGRAM_SGIX 0x832C +#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D +#endif + +#ifndef GL_INTEL_texture_scissor +#endif + +#ifndef GL_INTEL_parallel_arrays +#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 +#endif + +#ifndef GL_HP_occlusion_test +#define GL_OCCLUSION_TEST_HP 0x8165 +#define GL_OCCLUSION_TEST_RESULT_HP 0x8166 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330 +#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_STACK_DEPTH_EXT 0x8336 +#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337 +#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338 +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8 +#define GL_SINGLE_COLOR_EXT 0x81F9 +#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA +#endif + +#ifndef GL_EXT_secondary_color +#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 +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_PERTURB_EXT 0x85AE +#define GL_TEXTURE_NORMAL_EXT 0x85AF +#endif + +#ifndef GL_EXT_multi_draw_arrays +#endif + +#ifndef GL_EXT_fog_coord +#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450 +#define GL_FOG_COORDINATE_EXT 0x8451 +#define GL_FRAGMENT_DEPTH_EXT 0x8452 +#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453 +#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454 +#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455 +#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 +#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_SCREEN_COORDINATES_REND 0x8490 +#define GL_INVERTED_SCREEN_W_REND 0x8491 +#endif + +#ifndef GL_EXT_coordinate_frame +#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 +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_COMBINE_EXT 0x8570 +#define GL_COMBINE_RGB_EXT 0x8571 +#define GL_COMBINE_ALPHA_EXT 0x8572 +#define GL_RGB_SCALE_EXT 0x8573 +#define GL_ADD_SIGNED_EXT 0x8574 +#define GL_INTERPOLATE_EXT 0x8575 +#define GL_CONSTANT_EXT 0x8576 +#define GL_PRIMARY_COLOR_EXT 0x8577 +#define GL_PREVIOUS_EXT 0x8578 +#define GL_SOURCE0_RGB_EXT 0x8580 +#define GL_SOURCE1_RGB_EXT 0x8581 +#define GL_SOURCE2_RGB_EXT 0x8582 +#define GL_SOURCE0_ALPHA_EXT 0x8588 +#define GL_SOURCE1_ALPHA_EXT 0x8589 +#define GL_SOURCE2_ALPHA_EXT 0x858A +#define GL_OPERAND0_RGB_EXT 0x8590 +#define GL_OPERAND1_RGB_EXT 0x8591 +#define GL_OPERAND2_RGB_EXT 0x8592 +#define GL_OPERAND0_ALPHA_EXT 0x8598 +#define GL_OPERAND1_ALPHA_EXT 0x8599 +#define GL_OPERAND2_ALPHA_EXT 0x859A +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_TRANSFORM_HINT_APPLE 0x85B1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_FOG_SCALE_SGIX 0x81FC +#define GL_FOG_SCALE_VALUE_SGIX 0x81FD +#endif + +#ifndef GL_SUNX_constant_data +#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5 +#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6 +#endif + +#ifndef GL_SUN_global_alpha +#define GL_GLOBAL_ALPHA_SUN 0x81D9 +#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA +#endif + +#ifndef GL_SUN_triangle_list +#define GL_RESTART_SUN 0x0001 +#define GL_REPLACE_MIDDLE_SUN 0x0002 +#define GL_REPLACE_OLDEST_SUN 0x0003 +#define GL_TRIANGLE_LIST_SUN 0x81D7 +#define GL_REPLACEMENT_CODE_SUN 0x81D8 +#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 +#endif + +#ifndef GL_SUN_vertex +#endif + +#ifndef GL_EXT_blend_func_separate +#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 +#endif + +#ifndef GL_INGR_color_clamp +#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 + +#ifndef GL_INGR_interlace_read +#define GL_INTERLACE_READ_INGR 0x8568 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_INCR_WRAP_EXT 0x8507 +#define GL_DECR_WRAP_EXT 0x8508 +#endif + +#ifndef GL_EXT_422_pixels +#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 + +#ifndef GL_NV_texgen_reflection +#define GL_NORMAL_MAP_NV 0x8511 +#define GL_REFLECTION_MAP_NV 0x8512 +#endif + +#ifndef GL_EXT_texture_cube_map +#define GL_NORMAL_MAP_EXT 0x8511 +#define GL_REFLECTION_MAP_EXT 0x8512 +#define GL_TEXTURE_CUBE_MAP_EXT 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A +#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_WRAP_BORDER_SUN 0x81D4 +#endif + +#ifndef GL_EXT_texture_env_add +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD +#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500 +#define GL_TEXTURE_LOD_BIAS_EXT 0x8501 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH +#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502 +#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX +#define GL_MODELVIEW1_MATRIX_EXT 0x8506 +#define GL_VERTEX_WEIGHTING_EXT 0x8509 +#define GL_MODELVIEW0_EXT GL_MODELVIEW +#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_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510 +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_MAX_SHININESS_NV 0x8504 +#define GL_MAX_SPOT_EXPONENT_NV 0x8505 +#endif + +#ifndef GL_NV_vertex_array_range +#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 +#endif + +#ifndef GL_NV_register_combiners +#define GL_REGISTER_COMBINERS_NV 0x8522 +#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_DISCARD_NV 0x8530 +#define GL_E_TIMES_F_NV 0x8531 +#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532 +#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_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_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_MAX_GENERAL_COMBINERS_NV 0x854D +#define GL_NUM_GENERAL_COMBINERS_NV 0x854E +#define GL_COLOR_SUM_CLAMP_NV 0x854F +#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 +/* reuse GL_TEXTURE0_ARB */ +/* reuse GL_TEXTURE1_ARB */ +/* reuse GL_ZERO */ +/* reuse GL_NONE */ +/* reuse GL_FOG */ +#endif + +#ifndef GL_NV_fog_distance +#define GL_FOG_DISTANCE_MODE_NV 0x855A +#define GL_EYE_RADIAL_NV 0x855B +#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C +/* reuse GL_EYE_PLANE */ +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_EMBOSS_LIGHT_NV 0x855D +#define GL_EMBOSS_CONSTANT_NV 0x855E +#define GL_EMBOSS_MAP_NV 0x855F +#endif + +#ifndef GL_NV_blend_square +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_COMBINE4_NV 0x8503 +#define GL_SOURCE3_RGB_NV 0x8583 +#define GL_SOURCE3_ALPHA_NV 0x858B +#define GL_OPERAND3_RGB_NV 0x8593 +#define GL_OPERAND3_ALPHA_NV 0x859B +#endif + +#ifndef GL_MESA_resize_buffers +#endif + +#ifndef GL_MESA_window_pos +#endif + +#ifndef GL_EXT_texture_compression_s3tc +#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 + +#ifndef GL_IBM_cull_vertex +#define GL_CULL_VERTEX_IBM 103050 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#endif + +#ifndef GL_IBM_vertex_array_lists +#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 +#endif + +#ifndef GL_SGIX_subsample +#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0 +#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 +#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 +#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 +#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_YCRCB_SGIX 0x8318 +#define GL_YCRCBA_SGIX 0x8319 +#endif + +#ifndef GL_SGI_depth_pass_instrument +#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310 +#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311 +#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0 +#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_MULTISAMPLE_3DFX 0x86B2 +#define GL_SAMPLE_BUFFERS_3DFX 0x86B3 +#define GL_SAMPLES_3DFX 0x86B4 +#define GL_MULTISAMPLE_BIT_3DFX 0x20000000 +#endif + +#ifndef GL_3DFX_tbuffer +#endif + +#ifndef GL_EXT_multisample +#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 +#define GL_1PASS_EXT 0x80A1 +#define GL_2PASS_0_EXT 0x80A2 +#define GL_2PASS_1_EXT 0x80A3 +#define GL_4PASS_0_EXT 0x80A4 +#define GL_4PASS_1_EXT 0x80A5 +#define GL_4PASS_2_EXT 0x80A6 +#define GL_4PASS_3_EXT 0x80A7 +#define GL_SAMPLE_BUFFERS_EXT 0x80A8 +#define GL_SAMPLES_EXT 0x80A9 +#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA +#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB +#define GL_SAMPLE_PATTERN_EXT 0x80AC +#define GL_MULTISAMPLE_BIT_EXT 0x20000000 +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_VERTEX_PRECLIP_SGIX 0x83EE +#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_CONVOLUTION_HINT_SGIX 0x8316 +#endif + +#ifndef GL_SGIX_resample +#define GL_PACK_RESAMPLE_SGIX 0x842C +#define GL_UNPACK_RESAMPLE_SGIX 0x842D +#define GL_RESAMPLE_REPLICATE_SGIX 0x842E +#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F +#define GL_RESAMPLE_DECIMATE_SGIX 0x8430 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0 +#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1 +#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2 +#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3 +#define GL_EYE_POINT_SGIS 0x81F4 +#define GL_OBJECT_POINT_SGIS 0x81F5 +#define GL_EYE_LINE_SGIS 0x81F6 +#define GL_OBJECT_LINE_SGIS 0x81F7 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_DOT3_RGB_EXT 0x8740 +#define GL_DOT3_RGBA_EXT 0x8741 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_MIRROR_CLAMP_ATI 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 +#endif + +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +#ifndef GL_IBM_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_IBM 0x8370 +#endif + +#ifndef GL_NV_evaluators +#define GL_EVAL_2D_NV 0x86C0 +#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1 +#define GL_MAP_TESSELLATION_NV 0x86C2 +#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3 +#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4 +#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5 +#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6 +#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7 +#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8 +#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9 +#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA +#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB +#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC +#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD +#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE +#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF +#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0 +#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1 +#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2 +#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3 +#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4 +#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5 +#define GL_MAX_MAP_TESSELLATION_NV 0x86D6 +#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7 +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_DEPTH_STENCIL_NV 0x84F9 +#define GL_UNSIGNED_INT_24_8_NV 0x84FA +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_PER_STAGE_CONSTANTS_NV 0x8535 +#endif + +#ifndef GL_NV_texture_compression_vtc +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_TEXTURE_RECTANGLE_NV 0x84F5 +#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6 +#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7 +#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8 +#endif + +#ifndef GL_NV_texture_shader +#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C +#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D +#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E +#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9 +#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA +#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB +#define GL_DSDT_MAG_INTENSITY_NV 0x86DC +#define GL_SHADER_CONSISTENT_NV 0x86DD +#define GL_TEXTURE_SHADER_NV 0x86DE +#define GL_SHADER_OPERATION_NV 0x86DF +#define GL_CULL_MODES_NV 0x86E0 +#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1 +#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2 +#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3 +#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV +#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV +#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV +#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4 +#define GL_CONST_EYE_NV 0x86E5 +#define GL_PASS_THROUGH_NV 0x86E6 +#define GL_CULL_FRAGMENT_NV 0x86E7 +#define GL_OFFSET_TEXTURE_2D_NV 0x86E8 +#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9 +#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA +#define GL_DOT_PRODUCT_NV 0x86EC +#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED +#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE +#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0 +#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1 +#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2 +#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3 +#define GL_HILO_NV 0x86F4 +#define GL_DSDT_NV 0x86F5 +#define GL_DSDT_MAG_NV 0x86F6 +#define GL_DSDT_MAG_VIB_NV 0x86F7 +#define GL_HILO16_NV 0x86F8 +#define GL_SIGNED_HILO_NV 0x86F9 +#define GL_SIGNED_HILO16_NV 0x86FA +#define GL_SIGNED_RGBA_NV 0x86FB +#define GL_SIGNED_RGBA8_NV 0x86FC +#define GL_SIGNED_RGB_NV 0x86FE +#define GL_SIGNED_RGB8_NV 0x86FF +#define GL_SIGNED_LUMINANCE_NV 0x8701 +#define GL_SIGNED_LUMINANCE8_NV 0x8702 +#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703 +#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704 +#define GL_SIGNED_ALPHA_NV 0x8705 +#define GL_SIGNED_ALPHA8_NV 0x8706 +#define GL_SIGNED_INTENSITY_NV 0x8707 +#define GL_SIGNED_INTENSITY8_NV 0x8708 +#define GL_DSDT8_NV 0x8709 +#define GL_DSDT8_MAG8_NV 0x870A +#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B +#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C +#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D +#define GL_HI_SCALE_NV 0x870E +#define GL_LO_SCALE_NV 0x870F +#define GL_DS_SCALE_NV 0x8710 +#define GL_DT_SCALE_NV 0x8711 +#define GL_MAGNITUDE_SCALE_NV 0x8712 +#define GL_VIBRANCE_SCALE_NV 0x8713 +#define GL_HI_BIAS_NV 0x8714 +#define GL_LO_BIAS_NV 0x8715 +#define GL_DS_BIAS_NV 0x8716 +#define GL_DT_BIAS_NV 0x8717 +#define GL_MAGNITUDE_BIAS_NV 0x8718 +#define GL_VIBRANCE_BIAS_NV 0x8719 +#define GL_TEXTURE_BORDER_VALUES_NV 0x871A +#define GL_TEXTURE_HI_SIZE_NV 0x871B +#define GL_TEXTURE_LO_SIZE_NV 0x871C +#define GL_TEXTURE_DS_SIZE_NV 0x871D +#define GL_TEXTURE_DT_SIZE_NV 0x871E +#define GL_TEXTURE_MAG_SIZE_NV 0x871F +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533 +#endif + +#ifndef GL_NV_vertex_program +#define GL_VERTEX_PROGRAM_NV 0x8620 +#define GL_VERTEX_STATE_PROGRAM_NV 0x8621 +#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623 +#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624 +#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625 +#define GL_CURRENT_ATTRIB_NV 0x8626 +#define GL_PROGRAM_LENGTH_NV 0x8627 +#define GL_PROGRAM_STRING_NV 0x8628 +#define GL_MODELVIEW_PROJECTION_NV 0x8629 +#define GL_IDENTITY_NV 0x862A +#define GL_INVERSE_NV 0x862B +#define GL_TRANSPOSE_NV 0x862C +#define GL_INVERSE_TRANSPOSE_NV 0x862D +#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E +#define GL_MAX_TRACK_MATRICES_NV 0x862F +#define GL_MATRIX0_NV 0x8630 +#define GL_MATRIX1_NV 0x8631 +#define GL_MATRIX2_NV 0x8632 +#define GL_MATRIX3_NV 0x8633 +#define GL_MATRIX4_NV 0x8634 +#define GL_MATRIX5_NV 0x8635 +#define GL_MATRIX6_NV 0x8636 +#define GL_MATRIX7_NV 0x8637 +#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640 +#define GL_CURRENT_MATRIX_NV 0x8641 +#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642 +#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643 +#define GL_PROGRAM_PARAMETER_NV 0x8644 +#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645 +#define GL_PROGRAM_TARGET_NV 0x8646 +#define GL_PROGRAM_RESIDENT_NV 0x8647 +#define GL_TRACK_MATRIX_NV 0x8648 +#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649 +#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A +#define GL_PROGRAM_ERROR_POSITION_NV 0x864B +#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650 +#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651 +#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652 +#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653 +#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654 +#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655 +#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656 +#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657 +#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658 +#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659 +#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A +#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B +#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C +#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D +#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E +#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F +#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660 +#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661 +#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662 +#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663 +#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664 +#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665 +#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666 +#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667 +#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668 +#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669 +#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A +#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B +#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C +#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D +#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E +#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F +#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670 +#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671 +#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672 +#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673 +#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674 +#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675 +#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676 +#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677 +#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678 +#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679 +#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A +#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B +#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C +#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D +#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E +#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369 +#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A +#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SCALEBIAS_HINT_SGIX 0x8322 +#endif + +#ifndef GL_OML_interlace +#define GL_INTERLACE_OML 0x8980 +#define GL_INTERLACE_READ_OML 0x8981 +#endif + +#ifndef GL_OML_subsample +#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982 +#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983 +#endif + +#ifndef GL_OML_resample +#define GL_PACK_RESAMPLE_OML 0x8984 +#define GL_UNPACK_RESAMPLE_OML 0x8985 +#define GL_RESAMPLE_REPLICATE_OML 0x8986 +#define GL_RESAMPLE_ZERO_FILL_OML 0x8987 +#define GL_RESAMPLE_AVERAGE_OML 0x8988 +#define GL_RESAMPLE_DECIMATE_OML 0x8989 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E +#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_BUMP_ROT_MATRIX_ATI 0x8775 +#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776 +#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777 +#define GL_BUMP_TEX_UNITS_ATI 0x8778 +#define GL_DUDV_ATI 0x8779 +#define GL_DU8DV8_ATI 0x877A +#define GL_BUMP_ENVMAP_ATI 0x877B +#define GL_BUMP_TARGET_ATI 0x877C +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_FRAGMENT_SHADER_ATI 0x8920 +#define GL_REG_0_ATI 0x8921 +#define GL_REG_1_ATI 0x8922 +#define GL_REG_2_ATI 0x8923 +#define GL_REG_3_ATI 0x8924 +#define GL_REG_4_ATI 0x8925 +#define GL_REG_5_ATI 0x8926 +#define GL_REG_6_ATI 0x8927 +#define GL_REG_7_ATI 0x8928 +#define GL_REG_8_ATI 0x8929 +#define GL_REG_9_ATI 0x892A +#define GL_REG_10_ATI 0x892B +#define GL_REG_11_ATI 0x892C +#define GL_REG_12_ATI 0x892D +#define GL_REG_13_ATI 0x892E +#define GL_REG_14_ATI 0x892F +#define GL_REG_15_ATI 0x8930 +#define GL_REG_16_ATI 0x8931 +#define GL_REG_17_ATI 0x8932 +#define GL_REG_18_ATI 0x8933 +#define GL_REG_19_ATI 0x8934 +#define GL_REG_20_ATI 0x8935 +#define GL_REG_21_ATI 0x8936 +#define GL_REG_22_ATI 0x8937 +#define GL_REG_23_ATI 0x8938 +#define GL_REG_24_ATI 0x8939 +#define GL_REG_25_ATI 0x893A +#define GL_REG_26_ATI 0x893B +#define GL_REG_27_ATI 0x893C +#define GL_REG_28_ATI 0x893D +#define GL_REG_29_ATI 0x893E +#define GL_REG_30_ATI 0x893F +#define GL_REG_31_ATI 0x8940 +#define GL_CON_0_ATI 0x8941 +#define GL_CON_1_ATI 0x8942 +#define GL_CON_2_ATI 0x8943 +#define GL_CON_3_ATI 0x8944 +#define GL_CON_4_ATI 0x8945 +#define GL_CON_5_ATI 0x8946 +#define GL_CON_6_ATI 0x8947 +#define GL_CON_7_ATI 0x8948 +#define GL_CON_8_ATI 0x8949 +#define GL_CON_9_ATI 0x894A +#define GL_CON_10_ATI 0x894B +#define GL_CON_11_ATI 0x894C +#define GL_CON_12_ATI 0x894D +#define GL_CON_13_ATI 0x894E +#define GL_CON_14_ATI 0x894F +#define GL_CON_15_ATI 0x8950 +#define GL_CON_16_ATI 0x8951 +#define GL_CON_17_ATI 0x8952 +#define GL_CON_18_ATI 0x8953 +#define GL_CON_19_ATI 0x8954 +#define GL_CON_20_ATI 0x8955 +#define GL_CON_21_ATI 0x8956 +#define GL_CON_22_ATI 0x8957 +#define GL_CON_23_ATI 0x8958 +#define GL_CON_24_ATI 0x8959 +#define GL_CON_25_ATI 0x895A +#define GL_CON_26_ATI 0x895B +#define GL_CON_27_ATI 0x895C +#define GL_CON_28_ATI 0x895D +#define GL_CON_29_ATI 0x895E +#define GL_CON_30_ATI 0x895F +#define GL_CON_31_ATI 0x8960 +#define GL_MOV_ATI 0x8961 +#define GL_ADD_ATI 0x8963 +#define GL_MUL_ATI 0x8964 +#define GL_SUB_ATI 0x8965 +#define GL_DOT3_ATI 0x8966 +#define GL_DOT4_ATI 0x8967 +#define GL_MAD_ATI 0x8968 +#define GL_LERP_ATI 0x8969 +#define GL_CND_ATI 0x896A +#define GL_CND0_ATI 0x896B +#define GL_DOT2_ADD_ATI 0x896C +#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D +#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E +#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F +#define GL_NUM_PASSES_ATI 0x8970 +#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971 +#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972 +#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973 +#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974 +#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975 +#define GL_SWIZZLE_STR_ATI 0x8976 +#define GL_SWIZZLE_STQ_ATI 0x8977 +#define GL_SWIZZLE_STR_DR_ATI 0x8978 +#define GL_SWIZZLE_STQ_DQ_ATI 0x8979 +#define GL_SWIZZLE_STRQ_ATI 0x897A +#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B +#define GL_RED_BIT_ATI 0x00000001 +#define GL_GREEN_BIT_ATI 0x00000002 +#define GL_BLUE_BIT_ATI 0x00000004 +#define GL_2X_BIT_ATI 0x00000001 +#define GL_4X_BIT_ATI 0x00000002 +#define GL_8X_BIT_ATI 0x00000004 +#define GL_HALF_BIT_ATI 0x00000008 +#define GL_QUARTER_BIT_ATI 0x00000010 +#define GL_EIGHTH_BIT_ATI 0x00000020 +#define GL_SATURATE_BIT_ATI 0x00000040 +#define GL_COMP_BIT_ATI 0x00000002 +#define GL_NEGATE_BIT_ATI 0x00000004 +#define GL_BIAS_BIT_ATI 0x00000008 +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_PN_TRIANGLES_ATI 0x87F0 +#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1 +#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2 +#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3 +#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4 +#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5 +#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6 +#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7 +#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8 +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_STATIC_ATI 0x8760 +#define GL_DYNAMIC_ATI 0x8761 +#define GL_PRESERVE_ATI 0x8762 +#define GL_DISCARD_ATI 0x8763 +#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764 +#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765 +#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766 +#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767 +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_VERTEX_SHADER_EXT 0x8780 +#define GL_VERTEX_SHADER_BINDING_EXT 0x8781 +#define GL_OP_INDEX_EXT 0x8782 +#define GL_OP_NEGATE_EXT 0x8783 +#define GL_OP_DOT3_EXT 0x8784 +#define GL_OP_DOT4_EXT 0x8785 +#define GL_OP_MUL_EXT 0x8786 +#define GL_OP_ADD_EXT 0x8787 +#define GL_OP_MADD_EXT 0x8788 +#define GL_OP_FRAC_EXT 0x8789 +#define GL_OP_MAX_EXT 0x878A +#define GL_OP_MIN_EXT 0x878B +#define GL_OP_SET_GE_EXT 0x878C +#define GL_OP_SET_LT_EXT 0x878D +#define GL_OP_CLAMP_EXT 0x878E +#define GL_OP_FLOOR_EXT 0x878F +#define GL_OP_ROUND_EXT 0x8790 +#define GL_OP_EXP_BASE_2_EXT 0x8791 +#define GL_OP_LOG_BASE_2_EXT 0x8792 +#define GL_OP_POWER_EXT 0x8793 +#define GL_OP_RECIP_EXT 0x8794 +#define GL_OP_RECIP_SQRT_EXT 0x8795 +#define GL_OP_SUB_EXT 0x8796 +#define GL_OP_CROSS_PRODUCT_EXT 0x8797 +#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798 +#define GL_OP_MOV_EXT 0x8799 +#define GL_OUTPUT_VERTEX_EXT 0x879A +#define GL_OUTPUT_COLOR0_EXT 0x879B +#define GL_OUTPUT_COLOR1_EXT 0x879C +#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D +#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E +#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F +#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0 +#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1 +#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2 +#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3 +#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4 +#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5 +#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6 +#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7 +#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8 +#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9 +#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA +#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB +#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC +#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD +#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE +#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF +#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0 +#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1 +#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2 +#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3 +#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4 +#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5 +#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6 +#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7 +#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8 +#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9 +#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA +#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB +#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC +#define GL_OUTPUT_FOG_EXT 0x87BD +#define GL_SCALAR_EXT 0x87BE +#define GL_VECTOR_EXT 0x87BF +#define GL_MATRIX_EXT 0x87C0 +#define GL_VARIANT_EXT 0x87C1 +#define GL_INVARIANT_EXT 0x87C2 +#define GL_LOCAL_CONSTANT_EXT 0x87C3 +#define GL_LOCAL_EXT 0x87C4 +#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5 +#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6 +#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7 +#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8 +#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9 +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD +#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE +#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF +#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0 +#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1 +#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2 +#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3 +#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4 +#define GL_X_EXT 0x87D5 +#define GL_Y_EXT 0x87D6 +#define GL_Z_EXT 0x87D7 +#define GL_W_EXT 0x87D8 +#define GL_NEGATIVE_X_EXT 0x87D9 +#define GL_NEGATIVE_Y_EXT 0x87DA +#define GL_NEGATIVE_Z_EXT 0x87DB +#define GL_NEGATIVE_W_EXT 0x87DC +#define GL_ZERO_EXT 0x87DD +#define GL_ONE_EXT 0x87DE +#define GL_NEGATIVE_ONE_EXT 0x87DF +#define GL_NORMALIZED_RANGE_EXT 0x87E0 +#define GL_FULL_RANGE_EXT 0x87E1 +#define GL_CURRENT_VERTEX_EXT 0x87E2 +#define GL_MVP_MATRIX_EXT 0x87E3 +#define GL_VARIANT_VALUE_EXT 0x87E4 +#define GL_VARIANT_DATATYPE_EXT 0x87E5 +#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6 +#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7 +#define GL_VARIANT_ARRAY_EXT 0x87E8 +#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9 +#define GL_INVARIANT_VALUE_EXT 0x87EA +#define GL_INVARIANT_DATATYPE_EXT 0x87EB +#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC +#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_MAX_VERTEX_STREAMS_ATI 0x876B +#define GL_VERTEX_STREAM0_ATI 0x876C +#define GL_VERTEX_STREAM1_ATI 0x876D +#define GL_VERTEX_STREAM2_ATI 0x876E +#define GL_VERTEX_STREAM3_ATI 0x876F +#define GL_VERTEX_STREAM4_ATI 0x8770 +#define GL_VERTEX_STREAM5_ATI 0x8771 +#define GL_VERTEX_STREAM6_ATI 0x8772 +#define GL_VERTEX_STREAM7_ATI 0x8773 +#define GL_VERTEX_SOURCE_ATI 0x8774 +#endif + +#ifndef GL_ATI_element_array +#define GL_ELEMENT_ARRAY_ATI 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A +#endif + +#ifndef GL_SUN_mesh_array +#define GL_QUAD_MESH_SUN 0x8614 +#define GL_TRIANGLE_MESH_SUN 0x8615 +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SLICE_ACCUM_SUN 0x85CC +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_DEPTH_CLAMP_NV 0x864F +#endif + +#ifndef GL_NV_occlusion_query +#define GL_PIXEL_COUNTER_BITS_NV 0x8864 +#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865 +#define GL_PIXEL_COUNT_NV 0x8866 +#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 +#endif + +#ifndef GL_NV_point_sprite +#define GL_POINT_SPRITE_NV 0x8861 +#define GL_COORD_REPLACE_NV 0x8862 +#define GL_POINT_SPRITE_R_MODE_NV 0x8863 +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850 +#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852 +#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853 +#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854 +#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856 +#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857 +#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858 +#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859 +#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A +#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B +#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C +#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D +#define GL_HILO8_NV 0x885E +#define GL_SIGNED_HILO8_NV 0x885F +#define GL_FORCE_BLUE_TO_ONE_NV 0x8860 +#endif + +#ifndef GL_NV_vertex_program1_1 +#endif + +#ifndef GL_EXT_shadow_funcs +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910 +#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911 +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2 +#endif + +#ifndef GL_APPLE_element_array +#define GL_ELEMENT_ARRAY_APPLE 0x8768 +#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769 +#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A +#endif + +#ifndef GL_APPLE_fence +#define GL_DRAW_PIXELS_APPLE 0x8A0A +#define GL_FENCE_APPLE 0x8A0B +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5 +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D +#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E +#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F +#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521 +#define GL_STORAGE_CACHED_APPLE 0x85BE +#define GL_STORAGE_SHARED_APPLE 0x85BF +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_YCBCR_422_APPLE 0x85B9 +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +#ifndef GL_S3_s3tc +#define GL_RGB_S3TC 0x83A0 +#define GL_RGB4_S3TC 0x83A1 +#define GL_RGBA_S3TC 0x83A2 +#define GL_RGBA4_S3TC 0x83A3 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_MAX_DRAW_BUFFERS_ATI 0x8824 +#define GL_DRAW_BUFFER0_ATI 0x8825 +#define GL_DRAW_BUFFER1_ATI 0x8826 +#define GL_DRAW_BUFFER2_ATI 0x8827 +#define GL_DRAW_BUFFER3_ATI 0x8828 +#define GL_DRAW_BUFFER4_ATI 0x8829 +#define GL_DRAW_BUFFER5_ATI 0x882A +#define GL_DRAW_BUFFER6_ATI 0x882B +#define GL_DRAW_BUFFER7_ATI 0x882C +#define GL_DRAW_BUFFER8_ATI 0x882D +#define GL_DRAW_BUFFER9_ATI 0x882E +#define GL_DRAW_BUFFER10_ATI 0x882F +#define GL_DRAW_BUFFER11_ATI 0x8830 +#define GL_DRAW_BUFFER12_ATI 0x8831 +#define GL_DRAW_BUFFER13_ATI 0x8832 +#define GL_DRAW_BUFFER14_ATI 0x8833 +#define GL_DRAW_BUFFER15_ATI 0x8834 +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_TYPE_RGBA_FLOAT_ATI 0x8820 +#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835 +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_MODULATE_ADD_ATI 0x8744 +#define GL_MODULATE_SIGNED_ADD_ATI 0x8745 +#define GL_MODULATE_SUBTRACT_ATI 0x8746 +#endif + +#ifndef GL_ATI_texture_float +#define GL_RGBA_FLOAT32_ATI 0x8814 +#define GL_RGB_FLOAT32_ATI 0x8815 +#define GL_ALPHA_FLOAT32_ATI 0x8816 +#define GL_INTENSITY_FLOAT32_ATI 0x8817 +#define GL_LUMINANCE_FLOAT32_ATI 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819 +#define GL_RGBA_FLOAT16_ATI 0x881A +#define GL_RGB_FLOAT16_ATI 0x881B +#define GL_ALPHA_FLOAT16_ATI 0x881C +#define GL_INTENSITY_FLOAT16_ATI 0x881D +#define GL_LUMINANCE_FLOAT16_ATI 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F +#endif + +#ifndef GL_NV_float_buffer +#define GL_FLOAT_R_NV 0x8880 +#define GL_FLOAT_RG_NV 0x8881 +#define GL_FLOAT_RGB_NV 0x8882 +#define GL_FLOAT_RGBA_NV 0x8883 +#define GL_FLOAT_R16_NV 0x8884 +#define GL_FLOAT_R32_NV 0x8885 +#define GL_FLOAT_RG16_NV 0x8886 +#define GL_FLOAT_RG32_NV 0x8887 +#define GL_FLOAT_RGB16_NV 0x8888 +#define GL_FLOAT_RGB32_NV 0x8889 +#define GL_FLOAT_RGBA16_NV 0x888A +#define GL_FLOAT_RGBA32_NV 0x888B +#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C +#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D +#define GL_FLOAT_RGBA_MODE_NV 0x888E +#endif + +#ifndef GL_NV_fragment_program +#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868 +#define GL_FRAGMENT_PROGRAM_NV 0x8870 +#define GL_MAX_TEXTURE_COORDS_NV 0x8871 +#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872 +#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873 +#define GL_PROGRAM_ERROR_STRING_NV 0x8874 +#endif + +#ifndef GL_NV_half_float +#define GL_HALF_FLOAT_NV 0x140B +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A +#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B +#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C +#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D +#endif + +#ifndef GL_NV_primitive_restart +#define GL_PRIMITIVE_RESTART_NV 0x8558 +#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F +#endif + +#ifndef GL_NV_vertex_program2 +#endif + +#ifndef GL_ATI_map_object_buffer +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_STENCIL_BACK_FUNC_ATI 0x8800 +#define GL_STENCIL_BACK_FAIL_ATI 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803 +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#endif + +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890 +#define GL_DEPTH_BOUNDS_EXT 0x8891 +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_MIRROR_CLAMP_EXT 0x8742 +#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743 +#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_BLEND_EQUATION_RGB_EXT 0x8009 +#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D +#endif + +#ifndef GL_MESA_pack_invert +#define GL_PACK_INVERT_MESA 0x8758 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB +#define GL_YCBCR_MESA 0x8757 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF +#endif + +#ifndef GL_NV_fragment_program_option +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4 +#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5 +#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6 +#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7 +#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8 +#endif + +#ifndef GL_NV_vertex_program2_option +/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ +/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */ +#endif + +#ifndef GL_NV_vertex_program3 +/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506 +#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8 +#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6 +#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4 +#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA +#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB +#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC +#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +#define GL_DEPTH_ATTACHMENT_EXT 0x8D00 +#define GL_STENCIL_ATTACHMENT_EXT 0x8D20 +#define GL_FRAMEBUFFER_EXT 0x8D40 +#define GL_RENDERBUFFER_EXT 0x8D41 +#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44 +#define GL_STENCIL_INDEX1_EXT 0x8D46 +#define GL_STENCIL_INDEX4_EXT 0x8D47 +#define GL_STENCIL_INDEX8_EXT 0x8D48 +#define GL_STENCIL_INDEX16_EXT 0x8D49 +#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55 +#endif + +#ifndef GL_GREMEDY_string_marker +#endif + +#ifndef GL_EXT_packed_depth_stencil +#define GL_DEPTH_STENCIL_EXT 0x84F9 +#define GL_UNSIGNED_INT_24_8_EXT 0x84FA +#define GL_DEPTH24_STENCIL8_EXT 0x88F0 +#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1 +#endif + +#ifndef GL_EXT_stencil_clear_tag +#define GL_STENCIL_TAG_BITS_EXT 0x88F2 +#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3 +#endif + +#ifndef GL_EXT_texture_sRGB +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB8_EXT 0x8C41 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_SLUMINANCE_ALPHA_EXT 0x8C44 +#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45 +#define GL_SLUMINANCE_EXT 0x8C46 +#define GL_SLUMINANCE8_EXT 0x8C47 +#define GL_COMPRESSED_SRGB_EXT 0x8C48 +#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49 +#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A +#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#endif + +#ifndef GL_EXT_framebuffer_blit +#define GL_READ_FRAMEBUFFER_EXT 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_EXT GL_FRAMEBUFFER_BINDING_EXT +#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA +#endif + +#ifndef GL_EXT_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +#endif + +#ifndef GL_MESAX_texture_stack +#define GL_TEXTURE_1D_STACK_MESAX 0x8759 +#define GL_TEXTURE_2D_STACK_MESAX 0x875A +#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B +#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C +#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D +#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E +#endif + +#ifndef GL_EXT_timer_query +#define GL_TIME_ELAPSED_EXT 0x88BF +#endif + +#ifndef GL_EXT_gpu_program_parameters +#endif + +#ifndef GL_APPLE_flush_buffer_range +#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12 +#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13 +#endif + +#ifndef GL_NV_gpu_program4 +#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904 +#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905 +#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906 +#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907 +#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908 +#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909 +#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5 +#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6 +#endif + +#ifndef GL_NV_geometry_program4 +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_GEOMETRY_PROGRAM_NV 0x8C26 +#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27 +#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28 +#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA +#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB +#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4 +#define GL_PROGRAM_POINT_SIZE_EXT 0x8642 +#endif + +#ifndef GL_EXT_geometry_shader4 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +/* reuse GL_GEOMETRY_VERTICES_OUT_EXT */ +/* reuse GL_GEOMETRY_INPUT_TYPE_EXT */ +/* reuse GL_GEOMETRY_OUTPUT_TYPE_EXT */ +/* reuse GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT */ +#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD +#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE +#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +/* reuse GL_LINES_ADJACENCY_EXT */ +/* reuse GL_LINE_STRIP_ADJACENCY_EXT */ +/* reuse GL_TRIANGLES_ADJACENCY_EXT */ +/* reuse GL_TRIANGLE_STRIP_ADJACENCY_EXT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT */ +/* reuse GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT */ +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ +/* reuse GL_PROGRAM_POINT_SIZE_EXT */ +#endif + +#ifndef GL_NV_vertex_program4 +#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD +#endif + +#ifndef GL_EXT_gpu_shader4 +#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0 +#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1 +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3 +#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4 +#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5 +#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6 +#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7 +#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8 +#define GL_INT_SAMPLER_1D_EXT 0x8DC9 +#define GL_INT_SAMPLER_2D_EXT 0x8DCA +#define GL_INT_SAMPLER_3D_EXT 0x8DCB +#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC +#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD +#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE +#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1 +#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2 +#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3 +#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4 +#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5 +#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6 +#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#endif + +#ifndef GL_EXT_draw_instanced +#endif + +#ifndef GL_EXT_packed_float +#define GL_R11F_G11F_B10F_EXT 0x8C3A +#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B +#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C +#endif + +#ifndef GL_EXT_texture_array +#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18 +#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19 +#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A +#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B +#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C +#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D +#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF +#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E +/* reuse GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ +#endif + +#ifndef GL_EXT_texture_buffer_object +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E +#endif + +#ifndef GL_EXT_texture_compression_latc +#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70 +#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71 +#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72 +#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73 +#endif + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#endif + +#ifndef GL_EXT_texture_shared_exponent +#define GL_RGB9_E5_EXT 0x8C3D +#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E +#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F +#endif + +#ifndef GL_NV_depth_buffer_float +#define GL_DEPTH_COMPONENT32F_NV 0x8DAB +#define GL_DEPTH32F_STENCIL8_NV 0x8DAC +#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD +#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF +#endif + +#ifndef GL_NV_fragment_program4 +#endif + +#ifndef GL_NV_framebuffer_multisample_coverage +#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB +#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10 +#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11 +#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12 +#endif + +#ifndef GL_EXT_framebuffer_sRGB +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA +#endif + +#ifndef GL_NV_geometry_shader4 +#endif + +#ifndef GL_NV_parameter_buffer_object +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0 +#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1 +#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2 +#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3 +#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4 +#endif + +#ifndef GL_EXT_draw_buffers2 +#endif + +#ifndef GL_NV_transform_feedback +#define GL_BACK_PRIMARY_COLOR_NV 0x8C77 +#define GL_BACK_SECONDARY_COLOR_NV 0x8C78 +#define GL_TEXTURE_COORD_NV 0x8C79 +#define GL_CLIP_DISTANCE_NV 0x8C7A +#define GL_VERTEX_ID_NV 0x8C7B +#define GL_PRIMITIVE_ID_NV 0x8C7C +#define GL_GENERIC_ATTRIB_NV 0x8C7D +#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80 +#define GL_ACTIVE_VARYINGS_NV 0x8C81 +#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85 +#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86 +#define GL_PRIMITIVES_GENERATED_NV 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88 +#define GL_RASTERIZER_DISCARD_NV 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_ATTRIBS_NV 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B +#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C +#define GL_SEPARATE_ATTRIBS_NV 0x8C8D +#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F +#endif + +#ifndef GL_EXT_bindable_uniform +#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2 +#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3 +#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4 +#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED +#define GL_UNIFORM_BUFFER_EXT 0x8DEE +#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF +#endif + +#ifndef GL_EXT_texture_integer +#define GL_RGBA32UI_EXT 0x8D70 +#define GL_RGB32UI_EXT 0x8D71 +#define GL_ALPHA32UI_EXT 0x8D72 +#define GL_INTENSITY32UI_EXT 0x8D73 +#define GL_LUMINANCE32UI_EXT 0x8D74 +#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75 +#define GL_RGBA16UI_EXT 0x8D76 +#define GL_RGB16UI_EXT 0x8D77 +#define GL_ALPHA16UI_EXT 0x8D78 +#define GL_INTENSITY16UI_EXT 0x8D79 +#define GL_LUMINANCE16UI_EXT 0x8D7A +#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B +#define GL_RGBA8UI_EXT 0x8D7C +#define GL_RGB8UI_EXT 0x8D7D +#define GL_ALPHA8UI_EXT 0x8D7E +#define GL_INTENSITY8UI_EXT 0x8D7F +#define GL_LUMINANCE8UI_EXT 0x8D80 +#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81 +#define GL_RGBA32I_EXT 0x8D82 +#define GL_RGB32I_EXT 0x8D83 +#define GL_ALPHA32I_EXT 0x8D84 +#define GL_INTENSITY32I_EXT 0x8D85 +#define GL_LUMINANCE32I_EXT 0x8D86 +#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87 +#define GL_RGBA16I_EXT 0x8D88 +#define GL_RGB16I_EXT 0x8D89 +#define GL_ALPHA16I_EXT 0x8D8A +#define GL_INTENSITY16I_EXT 0x8D8B +#define GL_LUMINANCE16I_EXT 0x8D8C +#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D +#define GL_RGBA8I_EXT 0x8D8E +#define GL_RGB8I_EXT 0x8D8F +#define GL_ALPHA8I_EXT 0x8D90 +#define GL_INTENSITY8I_EXT 0x8D91 +#define GL_LUMINANCE8I_EXT 0x8D92 +#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93 +#define GL_RED_INTEGER_EXT 0x8D94 +#define GL_GREEN_INTEGER_EXT 0x8D95 +#define GL_BLUE_INTEGER_EXT 0x8D96 +#define GL_ALPHA_INTEGER_EXT 0x8D97 +#define GL_RGB_INTEGER_EXT 0x8D98 +#define GL_RGBA_INTEGER_EXT 0x8D99 +#define GL_BGR_INTEGER_EXT 0x8D9A +#define GL_BGRA_INTEGER_EXT 0x8D9B +#define GL_LUMINANCE_INTEGER_EXT 0x8D9C +#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D +#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E +#endif + +#ifndef GL_GREMEDY_frame_terminator +#endif + +#ifndef GL_NV_conditional_render +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 +#endif + +#ifndef GL_NV_present_video +#define GL_FRAME_NV 0x8E26 +#define GL_FIELDS_NV 0x8E27 +#define GL_CURRENT_TIME_NV 0x8E28 +#define GL_NUM_FILL_STREAMS_NV 0x8E29 +#define GL_PRESENT_TIME_NV 0x8E2A +#define GL_PRESENT_DURATION_NV 0x8E2B +#endif + +#ifndef GL_EXT_transform_feedback +#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E +#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84 +#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85 +#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F +#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C +#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88 +#define GL_RASTERIZER_DISCARD_EXT 0x8C89 +#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B +#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80 +#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83 +#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F +#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76 +#endif + +#ifndef GL_EXT_direct_state_access +#define GL_PROGRAM_MATRIX_EXT 0x8E2D +#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E +#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F +#endif + +#ifndef GL_EXT_vertex_array_bgra +/* reuse GL_BGRA */ +#endif + +#ifndef GL_EXT_texture_swizzle +#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 +#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 +#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 +#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 +#endif + +#ifndef GL_NV_explicit_multisample +#define GL_SAMPLE_POSITION_NV 0x8E50 +#define GL_SAMPLE_MASK_NV 0x8E51 +#define GL_SAMPLE_MASK_VALUE_NV 0x8E52 +#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53 +#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54 +#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55 +#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56 +#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57 +#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58 +#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59 +#endif + +#ifndef GL_NV_transform_feedback2 +#define GL_TRANSFORM_FEEDBACK_NV 0x8E22 +#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23 +#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24 +#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25 +#endif + +#ifndef GL_ATI_meminfo +#define GL_VBO_FREE_MEMORY_ATI 0x87FB +#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC +#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD +#endif + +#ifndef GL_AMD_performance_monitor +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +#endif + +#ifndef GL_AMD_texture_texture4 +#endif + +#ifndef GL_AMD_vertex_shader_tesselator +#define GL_SAMPLER_BUFFER_AMD 0x9001 +#define GL_INT_SAMPLER_BUFFER_AMD 0x9002 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003 +#define GL_TESSELLATION_MODE_AMD 0x9004 +#define GL_TESSELLATION_FACTOR_AMD 0x9005 +#define GL_DISCRETE_AMD 0x9006 +#define GL_CONTINUOUS_AMD 0x9007 +#endif + +#ifndef GL_EXT_provoking_vertex +#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_PROVOKING_VERTEX_EXT 0x8E4F +#endif + +#ifndef GL_EXT_texture_snorm +#define GL_ALPHA_SNORM 0x9010 +#define GL_LUMINANCE_SNORM 0x9011 +#define GL_LUMINANCE_ALPHA_SNORM 0x9012 +#define GL_INTENSITY_SNORM 0x9013 +#define GL_ALPHA8_SNORM 0x9014 +#define GL_LUMINANCE8_SNORM 0x9015 +#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016 +#define GL_INTENSITY8_SNORM 0x9017 +#define GL_ALPHA16_SNORM 0x9018 +#define GL_LUMINANCE16_SNORM 0x9019 +#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A +#define GL_INTENSITY16_SNORM 0x901B +/* reuse GL_R_SNORM */ +/* reuse GL_RG_SNORM */ +/* reuse GL_RGB_SNORM */ +/* reuse GL_RGBA_SNORM */ +/* reuse GL_R8_SNORM */ +/* reuse GL_RG8_SNORM */ +/* reuse GL_RGB8_SNORM */ +/* reuse GL_RGBA8_SNORM */ +/* reuse GL_R16_SNORM */ +/* reuse GL_RG16_SNORM */ +/* reuse GL_RGB16_SNORM */ +/* reuse GL_RGBA16_SNORM */ +/* reuse GL_SIGNED_NORMALIZED */ +#endif + +#ifndef GL_AMD_draw_buffers_blend +#endif + +#ifndef GL_APPLE_texture_range +#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7 +#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8 +#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC +#define GL_STORAGE_PRIVATE_APPLE 0x85BD +/* reuse GL_STORAGE_CACHED_APPLE */ +/* reuse GL_STORAGE_SHARED_APPLE */ +#endif + +#ifndef GL_APPLE_float_pixels +#define GL_HALF_APPLE 0x140B +#define GL_RGBA_FLOAT32_APPLE 0x8814 +#define GL_RGB_FLOAT32_APPLE 0x8815 +#define GL_ALPHA_FLOAT32_APPLE 0x8816 +#define GL_INTENSITY_FLOAT32_APPLE 0x8817 +#define GL_LUMINANCE_FLOAT32_APPLE 0x8818 +#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819 +#define GL_RGBA_FLOAT16_APPLE 0x881A +#define GL_RGB_FLOAT16_APPLE 0x881B +#define GL_ALPHA_FLOAT16_APPLE 0x881C +#define GL_INTENSITY_FLOAT16_APPLE 0x881D +#define GL_LUMINANCE_FLOAT16_APPLE 0x881E +#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F +#define GL_COLOR_FLOAT_APPLE 0x8A0F +#endif + +#ifndef GL_APPLE_vertex_program_evaluators +#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00 +#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01 +#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02 +#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03 +#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04 +#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05 +#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06 +#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07 +#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08 +#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09 +#endif + +#ifndef GL_APPLE_aux_depth_stencil +#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14 +#endif + +#ifndef GL_APPLE_object_purgeable +#define GL_BUFFER_OBJECT_APPLE 0x85B3 +#define GL_RELEASED_APPLE 0x8A19 +#define GL_VOLATILE_APPLE 0x8A1A +#define GL_RETAINED_APPLE 0x8A1B +#define GL_UNDEFINED_APPLE 0x8A1C +#define GL_PURGEABLE_APPLE 0x8A1D +#endif + +#ifndef GL_APPLE_row_bytes +#define GL_PACK_ROW_BYTES_APPLE 0x8A15 +#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16 +#endif + + +/*************************************************************/ + +#include +#ifndef GL_VERSION_2_0 +/* GL type for program/shader text */ +typedef char GLchar; +#endif + +#ifndef GL_VERSION_1_5 +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptr; +typedef ptrdiff_t GLsizeiptr; +#endif + +#ifndef GL_ARB_vertex_buffer_object +/* GL types for handling large vertex buffer objects */ +typedef ptrdiff_t GLintptrARB; +typedef ptrdiff_t GLsizeiptrARB; +#endif + +#ifndef GL_ARB_shader_objects +/* GL types for program/shader text and shader object handles */ +typedef char GLcharARB; +typedef unsigned int GLhandleARB; +#endif + +/* GL type for "half" precision (s10e5) float data in host memory */ +#ifndef GL_ARB_half_float_pixel +typedef unsigned short GLhalfARB; +#endif + +#ifndef GL_NV_half_float +typedef unsigned short GLhalfNV; +#endif + +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glxext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GL_EXT_timer_query extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +/* Fallback if nothing above works */ +#include +#endif +#endif + +#ifndef GL_EXT_timer_query +typedef int64_t GLint64EXT; +typedef uint64_t GLuint64EXT; +#endif + +#ifndef ARB_sync +typedef int64_t GLint64; +typedef uint64_t GLuint64; +typedef struct __GLsync *GLsync; +#endif + +#ifndef GL_VERSION_1_2 +#define GL_VERSION_1_2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf); +GLAPI void APIENTRY glBlendEquation (GLenum); +GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_VERSION_1_2_DEPRECATED +#define GL_VERSION_1_2_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei); +GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogram (GLenum); +GLAPI void APIENTRY glResetMinmax (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target); +#endif + +#ifndef GL_VERSION_1_3 +#define GL_VERSION_1_3 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTexture (GLenum); +GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean); +GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (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 (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_VERSION_1_3_DEPRECATED +#define GL_VERSION_1_3_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClientActiveTexture (GLenum); +GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *); +GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +#endif + +#ifndef GL_VERSION_1_4 +#define GL_VERSION_1_4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *); +GLAPI void APIENTRY glPointParameteri (GLenum, GLint); +GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_VERSION_1_4_DEPRECATED +#define GL_VERSION_1_4_DEPRECATED 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordf (GLfloat); +GLAPI void APIENTRY glFogCoordfv (const GLfloat *); +GLAPI void APIENTRY glFogCoordd (GLdouble); +GLAPI void APIENTRY glFogCoorddv (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3iv (const GLint *); +GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos2i (GLint, GLint); +GLAPI void APIENTRY glWindowPos2iv (const GLint *); +GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2sv (const GLshort *); +GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dv (const GLdouble *); +GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fv (const GLfloat *); +GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3iv (const GLint *); +GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3sv (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v); +#endif + +#ifndef GL_VERSION_1_5 +#define GL_VERSION_1_5 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQuery (GLuint); +GLAPI void APIENTRY glBeginQuery (GLenum, GLuint); +GLAPI void APIENTRY glEndQuery (GLenum); +GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *); +GLAPI void APIENTRY glBindBuffer (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBuffer (GLuint); +GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum); +GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_VERSION_2_0 +#define GL_VERSION_2_0 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum); +GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *); +GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint); +GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint); +GLAPI void APIENTRY glAttachShader (GLuint, GLuint); +GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *); +GLAPI void APIENTRY glCompileShader (GLuint); +GLAPI GLuint APIENTRY glCreateProgram (void); +GLAPI GLuint APIENTRY glCreateShader (GLenum); +GLAPI void APIENTRY glDeleteProgram (GLuint); +GLAPI void APIENTRY glDeleteShader (GLuint); +GLAPI void APIENTRY glDetachShader (GLuint, GLuint); +GLAPI void APIENTRY glDisableVertexAttribArray (GLuint); +GLAPI void APIENTRY glEnableVertexAttribArray (GLuint); +GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *); +GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *); +GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgram (GLuint); +GLAPI GLboolean APIENTRY glIsShader (GLuint); +GLAPI void APIENTRY glLinkProgram (GLuint); +GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *); +GLAPI void APIENTRY glUseProgram (GLuint); +GLAPI void APIENTRY glUniform1f (GLint, GLfloat); +GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1i (GLint, GLint); +GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glValidateProgram (GLuint); +GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length); +typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_VERSION_2_1 +#define GL_VERSION_2_1 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformMatrix2x3fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3x2fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix2x4fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4x2fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3x4fv (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4x3fv (GLint, GLsizei, GLboolean, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif + +#ifndef GL_VERSION_3_0 +#define GL_VERSION_3_0 1 +/* OpenGL 3.0 also reuses entry points from these extensions: */ +/* ARB_framebuffer_object */ +/* ARB_map_buffer_range */ +/* ARB_vertex_array_object */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaski (GLuint, GLboolean, GLboolean, GLboolean, GLboolean); +GLAPI void APIENTRY glGetBooleani_v (GLenum, GLuint, GLboolean *); +GLAPI void APIENTRY glGetIntegeri_v (GLenum, GLuint, GLint *); +GLAPI void APIENTRY glEnablei (GLenum, GLuint); +GLAPI void APIENTRY glDisablei (GLenum, GLuint); +GLAPI GLboolean APIENTRY glIsEnabledi (GLenum, GLuint); +GLAPI void APIENTRY glBeginTransformFeedback (GLenum); +GLAPI void APIENTRY glEndTransformFeedback (void); +GLAPI void APIENTRY glBindBufferRange (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); +GLAPI void APIENTRY glBindBufferBase (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLchar* *, GLenum); +GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); +GLAPI void APIENTRY glClampColor (GLenum, GLenum); +GLAPI void APIENTRY glBeginConditionalRender (GLuint, GLenum); +GLAPI void APIENTRY glEndConditionalRender (void); +GLAPI void APIENTRY glVertexAttribIPointer (GLuint, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetVertexAttribIiv (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint, GLenum, GLuint *); +GLAPI void APIENTRY glVertexAttribI1i (GLuint, GLint); +GLAPI void APIENTRY glVertexAttribI2i (GLuint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI3i (GLuint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI4i (GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI1ui (GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI2ui (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI3ui (GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI4ui (GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI1iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI2iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI3iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI4iv (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI1uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI2uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI3uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI4uiv (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI4bv (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttribI4sv (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttribI4ubv (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribI4usv (GLuint, const GLushort *); +GLAPI void APIENTRY glGetUniformuiv (GLuint, GLint, GLuint *); +GLAPI void APIENTRY glBindFragDataLocation (GLuint, GLuint, const GLchar *); +GLAPI GLint APIENTRY glGetFragDataLocation (GLuint, const GLchar *); +GLAPI void APIENTRY glUniform1ui (GLint, GLuint); +GLAPI void APIENTRY glUniform2ui (GLint, GLuint, GLuint); +GLAPI void APIENTRY glUniform3ui (GLint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glUniform4ui (GLint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glUniform1uiv (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glUniform2uiv (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glUniform3uiv (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glUniform4uiv (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glTexParameterIiv (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glTexParameterIuiv (GLenum, GLenum, const GLuint *); +GLAPI void APIENTRY glGetTexParameterIiv (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetTexParameterIuiv (GLenum, GLenum, GLuint *); +GLAPI void APIENTRY glClearBufferiv (GLenum, GLint, const GLint *); +GLAPI void APIENTRY glClearBufferuiv (GLenum, GLint, const GLuint *); +GLAPI void APIENTRY glClearBufferfv (GLenum, GLint, const GLfloat *); +GLAPI void APIENTRY glClearBufferfi (GLenum, GLint, GLfloat, GLint); +GLAPI const GLubyte * APIENTRY glGetStringi (GLenum, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index); +#endif + +#ifndef GL_VERSION_3_1 +#define GL_VERSION_3_1 1 +/* OpenGL 3.1 also reuses entry points from these extensions: */ +/* ARB_copy_buffer */ +/* ARB_uniform_buffer_object */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstanced (GLenum, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glDrawElementsInstanced (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei); +GLAPI void APIENTRY glTexBuffer (GLenum, GLenum, GLuint); +GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index); +#endif + +#ifndef GL_VERSION_3_2 +#define GL_VERSION_3_2 1 +/* OpenGL 3.2 also reuses entry points from these extensions: */ +/* ARB_draw_elements_base_vertex */ +/* ARB_provoking_vertex */ +/* ARB_sync */ +/* ARB_texture_multisample */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetInteger64i_v (GLenum, GLuint, GLint64 *); +GLAPI void APIENTRY glGetBufferParameteri64v (GLenum, GLenum, GLint64 *); +GLAPI void APIENTRY glProgramParameteri (GLuint, GLenum, GLint); +GLAPI void APIENTRY glFramebufferTexture (GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTextureFace (GLenum, GLenum, GLuint, GLint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif + +#ifndef GL_ARB_multitexture +#define GL_ARB_multitexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveTextureARB (GLenum); +GLAPI void APIENTRY glClientActiveTextureARB (GLenum); +GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint); +GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort); +GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *); +GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +#endif + +#ifndef GL_ARB_transpose_matrix +#define GL_ARB_transpose_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *); +GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *); +GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +#endif + +#ifndef GL_ARB_multisample +#define GL_ARB_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert); +#endif + +#ifndef GL_ARB_texture_env_add +#define GL_ARB_texture_env_add 1 +#endif + +#ifndef GL_ARB_texture_cube_map +#define GL_ARB_texture_cube_map 1 +#endif + +#ifndef GL_ARB_texture_compression +#define GL_ARB_texture_compression 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP 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 (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img); +#endif + +#ifndef GL_ARB_texture_border_clamp +#define GL_ARB_texture_border_clamp 1 +#endif + +#ifndef GL_ARB_point_parameters +#define GL_ARB_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_ARB_vertex_blend +#define GL_ARB_vertex_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *); +GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *); +GLAPI void APIENTRY glWeightivARB (GLint, const GLint *); +GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *); +GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *); +GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexBlendARB (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count); +#endif + +#ifndef GL_ARB_matrix_palette +#define GL_ARB_matrix_palette 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint); +GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *); +GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *); +GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *); +GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_ARB_texture_env_combine +#define GL_ARB_texture_env_combine 1 +#endif + +#ifndef GL_ARB_texture_env_crossbar +#define GL_ARB_texture_env_crossbar 1 +#endif + +#ifndef GL_ARB_texture_env_dot3 +#define GL_ARB_texture_env_dot3 1 +#endif + +#ifndef GL_ARB_texture_mirrored_repeat +#define GL_ARB_texture_mirrored_repeat 1 +#endif + +#ifndef GL_ARB_depth_texture +#define GL_ARB_depth_texture 1 +#endif + +#ifndef GL_ARB_shadow +#define GL_ARB_shadow 1 +#endif + +#ifndef GL_ARB_shadow_ambient +#define GL_ARB_shadow_ambient 1 +#endif + +#ifndef GL_ARB_window_pos +#define GL_ARB_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svARB (const GLshort *); +GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivARB (const GLint *); +GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svARB (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v); +#endif + +#ifndef GL_ARB_vertex_program +#define GL_ARB_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *); +GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint); +GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *); +GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramARB (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program); +#endif + +#ifndef GL_ARB_fragment_program +#define GL_ARB_fragment_program 1 +/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */ +#endif + +#ifndef GL_ARB_vertex_buffer_object +#define GL_ARB_vertex_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint); +GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsBufferARB (GLuint); +GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum); +GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *); +GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *); +GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum); +GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum); +GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data); +typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_ARB_occlusion_query +#define GL_ARB_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsQueryARB (GLuint); +GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint); +GLAPI void APIENTRY glEndQueryARB (GLenum); +GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_ARB_shader_objects +#define GL_ARB_shader_objects 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum); +GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum); +GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *); +GLAPI void APIENTRY glCompileShaderARB (GLhandleARB); +GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void); +GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB); +GLAPI void APIENTRY glLinkProgramARB (GLhandleARB); +GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB); +GLAPI void APIENTRY glValidateProgramARB (GLhandleARB); +GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat); +GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glUniform1iARB (GLint, GLint); +GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint); +GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *); +GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); +GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *); +GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *); +GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *); +GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length); +typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +#endif + +#ifndef GL_ARB_vertex_shader +#define GL_ARB_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *); +GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *); +GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +#endif + +#ifndef GL_ARB_fragment_shader +#define GL_ARB_fragment_shader 1 +#endif + +#ifndef GL_ARB_shading_language_100 +#define GL_ARB_shading_language_100 1 +#endif + +#ifndef GL_ARB_texture_non_power_of_two +#define GL_ARB_texture_non_power_of_two 1 +#endif + +#ifndef GL_ARB_point_sprite +#define GL_ARB_point_sprite 1 +#endif + +#ifndef GL_ARB_fragment_program_shadow +#define GL_ARB_fragment_program_shadow 1 +#endif + +#ifndef GL_ARB_draw_buffers +#define GL_ARB_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ARB_texture_rectangle +#define GL_ARB_texture_rectangle 1 +#endif + +#ifndef GL_ARB_color_buffer_float +#define GL_ARB_color_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClampColorARB (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +#endif + +#ifndef GL_ARB_half_float_pixel +#define GL_ARB_half_float_pixel 1 +#endif + +#ifndef GL_ARB_texture_float +#define GL_ARB_texture_float 1 +#endif + +#ifndef GL_ARB_pixel_buffer_object +#define GL_ARB_pixel_buffer_object 1 +#endif + +#ifndef GL_ARB_depth_buffer_float +#define GL_ARB_depth_buffer_float 1 +#endif + +#ifndef GL_ARB_draw_instanced +#define GL_ARB_draw_instanced 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif + +#ifndef GL_ARB_framebuffer_object +#define GL_ARB_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint); +GLAPI void APIENTRY glBindRenderbuffer (GLenum, GLuint); +GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenRenderbuffers (GLsizei, GLuint *); +GLAPI void APIENTRY glRenderbufferStorage (GLenum, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum, GLenum, GLint *); +GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint); +GLAPI void APIENTRY glBindFramebuffer (GLenum, GLuint); +GLAPI void APIENTRY glDeleteFramebuffers (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFramebuffers (GLsizei, GLuint *); +GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum); +GLAPI void APIENTRY glFramebufferTexture1D (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture2D (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture3D (GLenum, GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGenerateMipmap (GLenum); +GLAPI void APIENTRY glBlitFramebuffer (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); +GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glFramebufferTextureLayer (GLenum, GLenum, GLuint, GLint, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +#endif + +#ifndef GL_ARB_framebuffer_sRGB +#define GL_ARB_framebuffer_sRGB 1 +#endif + +#ifndef GL_ARB_geometry_shader4 +#define GL_ARB_geometry_shader4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramParameteriARB (GLuint, GLenum, GLint); +GLAPI void APIENTRY glFramebufferTextureARB (GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum, GLenum, GLuint, GLint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif + +#ifndef GL_ARB_half_float_vertex +#define GL_ARB_half_float_vertex 1 +#endif + +#ifndef GL_ARB_instanced_arrays +#define GL_ARB_instanced_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); +#endif + +#ifndef GL_ARB_map_buffer_range +#define GL_ARB_map_buffer_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvoid* APIENTRY glMapBufferRange (GLenum, GLintptr, GLsizeiptr, GLbitfield); +GLAPI void APIENTRY glFlushMappedBufferRange (GLenum, GLintptr, GLsizeiptr); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +#endif + +#ifndef GL_ARB_texture_buffer_object +#define GL_ARB_texture_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferARB (GLenum, GLenum, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer); +#endif + +#ifndef GL_ARB_texture_compression_rgtc +#define GL_ARB_texture_compression_rgtc 1 +#endif + +#ifndef GL_ARB_texture_rg +#define GL_ARB_texture_rg 1 +#endif + +#ifndef GL_ARB_vertex_array_object +#define GL_ARB_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArray (GLuint); +GLAPI void APIENTRY glDeleteVertexArrays (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenVertexArrays (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsVertexArray (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array); +#endif + +#ifndef GL_ARB_uniform_buffer_object +#define GL_ARB_uniform_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetUniformIndices (GLuint, GLsizei, const GLchar* *, GLuint *); +GLAPI void APIENTRY glGetActiveUniformsiv (GLuint, GLsizei, const GLuint *, GLenum, GLint *); +GLAPI void APIENTRY glGetActiveUniformName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint, const GLchar *); +GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glUniformBlockBinding (GLuint, GLuint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +#endif + +#ifndef GL_ARB_compatibility +#define GL_ARB_compatibility 1 +#endif + +#ifndef GL_ARB_copy_buffer +#define GL_ARB_copy_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyBufferSubData (GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif + +#ifndef GL_ARB_shader_texture_lod +#define GL_ARB_shader_texture_lod 1 +#endif + +#ifndef GL_ARB_depth_clamp +#define GL_ARB_depth_clamp 1 +#endif + +#ifndef GL_ARB_draw_elements_base_vertex +#define GL_ARB_draw_elements_base_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum, GLsizei, GLenum, const GLvoid *, GLint); +GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint); +GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei, GLint); +GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount, GLint basevertex); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount, const GLint *basevertex); +#endif + +#ifndef GL_ARB_fragment_coord_conventions +#define GL_ARB_fragment_coord_conventions 1 +#endif + +#ifndef GL_ARB_provoking_vertex +#define GL_ARB_provoking_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProvokingVertex (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode); +#endif + +#ifndef GL_ARB_seamless_cube_map +#define GL_ARB_seamless_cube_map 1 +#endif + +#ifndef GL_ARB_sync +#define GL_ARB_sync 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLsync APIENTRY glFenceSync (GLenum, GLbitfield); +GLAPI GLboolean APIENTRY glIsSync (GLsync); +GLAPI void APIENTRY glDeleteSync (GLsync); +GLAPI GLenum APIENTRY glClientWaitSync (GLsync, GLbitfield, GLuint64); +GLAPI void APIENTRY glWaitSync (GLsync, GLbitfield, GLuint64); +GLAPI void APIENTRY glGetInteger64v (GLenum, GLint64 *); +GLAPI void APIENTRY glGetSynciv (GLsync, GLenum, GLsizei, GLsizei *, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync); +typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync); +typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params); +typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif + +#ifndef GL_ARB_texture_multisample +#define GL_ARB_texture_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage2DMultisample (GLenum, GLsizei, GLint, GLsizei, GLsizei, GLboolean); +GLAPI void APIENTRY glTexImage3DMultisample (GLenum, GLsizei, GLint, GLsizei, GLsizei, GLsizei, GLboolean); +GLAPI void APIENTRY glGetMultisamplefv (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glSampleMaski (GLuint, GLbitfield); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); +#endif + +#ifndef GL_ARB_vertex_array_bgra +#define GL_ARB_vertex_array_bgra 1 +#endif + +#ifndef GL_ARB_draw_buffers_blend +#define GL_ARB_draw_buffers_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationi (GLuint, GLenum); +GLAPI void APIENTRY glBlendEquationSeparatei (GLuint, GLenum, GLenum); +GLAPI void APIENTRY glBlendFunci (GLuint, GLenum, GLenum); +GLAPI void APIENTRY glBlendFuncSeparatei (GLuint, GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif + +#ifndef GL_ARB_sample_shading +#define GL_ARB_sample_shading 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMinSampleShading (GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLclampf value); +#endif + +#ifndef GL_ARB_texture_cube_map_array +#define GL_ARB_texture_cube_map_array 1 +#endif + +#ifndef GL_ARB_texture_gather +#define GL_ARB_texture_gather 1 +#endif + +#ifndef GL_ARB_texture_query_lod +#define GL_ARB_texture_query_lod 1 +#endif + +#ifndef GL_EXT_abgr +#define GL_EXT_abgr 1 +#endif + +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +#endif + +#ifndef GL_EXT_polygon_offset +#define GL_EXT_polygon_offset 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias); +#endif + +#ifndef GL_EXT_texture +#define GL_EXT_texture 1 +#endif + +#ifndef GL_EXT_texture3D +#define GL_EXT_texture3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_SGIS_texture_filter4 +#define GL_SGIS_texture_filter4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights); +typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights); +#endif + +#ifndef GL_EXT_subtexture +#define GL_EXT_subtexture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +#endif + +#ifndef GL_EXT_copy_texture +#define GL_EXT_copy_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_histogram +#define GL_EXT_histogram 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean); +GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean); +GLAPI void APIENTRY glResetHistogramEXT (GLenum); +GLAPI void APIENTRY glResetMinmaxEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target); +#endif + +#ifndef GL_EXT_convolution +#define GL_EXT_convolution 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *); +GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span); +typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column); +#endif + +#ifndef GL_SGI_color_matrix +#define GL_SGI_color_matrix 1 +#endif + +#ifndef GL_SGI_color_table +#define GL_SGI_color_table 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei); +GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params); +#endif + +#ifndef GL_SGIX_pixel_texture +#define GL_SGIX_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenSGIX (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode); +#endif + +#ifndef GL_SGIS_pixel_texture +#define GL_SGIS_pixel_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint); +GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *); +GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *); +GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIS_texture4D +#define GL_SGIS_texture4D 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (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); +#endif + +#ifndef GL_SGI_texture_color_table +#define GL_SGI_texture_color_table 1 +#endif + +#ifndef GL_EXT_cmyka +#define GL_EXT_cmyka 1 +#endif + +#ifndef GL_EXT_texture_object +#define GL_EXT_texture_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint); +GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures); +typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures); +typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture); +typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities); +#endif + +#ifndef GL_SGIS_detail_texture +#define GL_SGIS_detail_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_SGIS_sharpen_texture +#define GL_SGIS_sharpen_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points); +#endif + +#ifndef GL_EXT_packed_pixels +#define GL_EXT_packed_pixels 1 +#endif + +#ifndef GL_SGIS_texture_lod +#define GL_SGIS_texture_lod 1 +#endif + +#ifndef GL_SGIS_multisample +#define GL_SGIS_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternSGIS (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern); +#endif + +#ifndef GL_EXT_rescale_normal +#define GL_EXT_rescale_normal 1 +#endif + +#ifndef GL_EXT_vertex_array +#define GL_EXT_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glArrayElementEXT (GLint); +GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *); +GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *); +GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i); +typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer); +typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); +typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_misc_attribute +#define GL_EXT_misc_attribute 1 +#endif + +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 +#endif + +#ifndef GL_SGIX_clipmap +#define GL_SGIX_clipmap 1 +#endif + +#ifndef GL_SGIX_shadow +#define GL_SGIX_shadow 1 +#endif + +#ifndef GL_SGIS_texture_edge_clamp +#define GL_SGIS_texture_edge_clamp 1 +#endif + +#ifndef GL_SGIS_texture_border_clamp +#define GL_SGIS_texture_border_clamp 1 +#endif + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#endif + +#ifndef GL_EXT_blend_logic_op +#define GL_EXT_blend_logic_op 1 +#endif + +#ifndef GL_SGIX_interlace +#define GL_SGIX_interlace 1 +#endif + +#ifndef GL_SGIX_pixel_tiles +#define GL_SGIX_pixel_tiles 1 +#endif + +#ifndef GL_SGIX_texture_select +#define GL_SGIX_texture_select 1 +#endif + +#ifndef GL_SGIX_sprite +#define GL_SGIX_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint); +GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_texture_multi_buffer +#define GL_SGIX_texture_multi_buffer 1 +#endif + +#ifndef GL_EXT_point_parameters +#define GL_EXT_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIS_point_parameters +#define GL_SGIS_point_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat); +GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_SGIX_instruments +#define GL_SGIX_instruments 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLint APIENTRY glGetInstrumentsSGIX (void); +GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *); +GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *); +GLAPI void APIENTRY glReadInstrumentsSGIX (GLint); +GLAPI void APIENTRY glStartInstrumentsSGIX (void); +GLAPI void APIENTRY glStopInstrumentsSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer); +typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p); +typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker); +typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void); +typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker); +#endif + +#ifndef GL_SGIX_texture_scale_bias +#define GL_SGIX_texture_scale_bias 1 +#endif + +#ifndef GL_SGIX_framezoom +#define GL_SGIX_framezoom 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameZoomSGIX (GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor); +#endif + +#ifndef GL_SGIX_tag_sample_buffer +#define GL_SGIX_tag_sample_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTagSampleBufferSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_polynomial_ffd +#define GL_SGIX_polynomial_ffd 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +GLAPI void APIENTRY glDeformSGIX (GLbitfield); +GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points); +typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points); +typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask); +#endif + +#ifndef GL_SGIX_reference_plane +#define GL_SGIX_reference_plane 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation); +#endif + +#ifndef GL_SGIX_flush_raster +#define GL_SGIX_flush_raster 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushRasterSGIX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void); +#endif + +#ifndef GL_SGIX_depth_texture +#define GL_SGIX_depth_texture 1 +#endif + +#ifndef GL_SGIS_fog_function +#define GL_SGIS_fog_function 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *); +GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points); +typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points); +#endif + +#ifndef GL_SGIX_fog_offset +#define GL_SGIX_fog_offset 1 +#endif + +#ifndef GL_HP_image_transform +#define GL_HP_image_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint); +GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_HP_convolution_border_modes +#define GL_HP_convolution_border_modes 1 +#endif + +#ifndef GL_SGIX_texture_add_env +#define GL_SGIX_texture_add_env 1 +#endif + +#ifndef GL_EXT_color_subtable +#define GL_EXT_color_subtable 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data); +typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +#endif + +#ifndef GL_PGI_vertex_hints +#define GL_PGI_vertex_hints 1 +#endif + +#ifndef GL_PGI_misc_hints +#define GL_PGI_misc_hints 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glHintPGI (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode); +#endif + +#ifndef GL_EXT_paletted_texture +#define GL_EXT_paletted_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table); +typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_EXT_clip_volume_hint +#define GL_EXT_clip_volume_hint 1 +#endif + +#ifndef GL_SGIX_list_priority +#define GL_SGIX_list_priority 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat); +GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *); +GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint); +GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params); +#endif + +#ifndef GL_SGIX_ir_instrument1 +#define GL_SGIX_ir_instrument1 1 +#endif + +#ifndef GL_SGIX_calligraphic_fragment +#define GL_SGIX_calligraphic_fragment 1 +#endif + +#ifndef GL_SGIX_texture_lod_bias +#define GL_SGIX_texture_lod_bias 1 +#endif + +#ifndef GL_SGIX_shadow_ambient +#define GL_SGIX_shadow_ambient 1 +#endif + +#ifndef GL_EXT_index_texture +#define GL_EXT_index_texture 1 +#endif + +#ifndef GL_EXT_index_material +#define GL_EXT_index_material 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_EXT_index_func +#define GL_EXT_index_func 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref); +#endif + +#ifndef GL_EXT_index_array_formats +#define GL_EXT_index_array_formats 1 +#endif + +#ifndef GL_EXT_compiled_vertex_array +#define GL_EXT_compiled_vertex_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei); +GLAPI void APIENTRY glUnlockArraysEXT (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void); +#endif + +#ifndef GL_EXT_cull_vertex +#define GL_EXT_cull_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *); +GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params); +#endif + +#ifndef GL_SGIX_ycrcb +#define GL_SGIX_ycrcb 1 +#endif + +#ifndef GL_SGIX_fragment_lighting +#define GL_SGIX_fragment_lighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum); +GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat); +GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint); +GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *); +GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_IBM_rasterpos_clip +#define GL_IBM_rasterpos_clip 1 +#endif + +#ifndef GL_HP_texture_lighting +#define GL_HP_texture_lighting 1 +#endif + +#ifndef GL_EXT_draw_range_elements +#define GL_EXT_draw_range_elements 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); +#endif + +#ifndef GL_WIN_phong_shading +#define GL_WIN_phong_shading 1 +#endif + +#ifndef GL_WIN_specular_fog +#define GL_WIN_specular_fog 1 +#endif + +#ifndef GL_EXT_light_texture +#define GL_EXT_light_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glApplyTextureEXT (GLenum); +GLAPI void APIENTRY glTextureLightEXT (GLenum); +GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname); +typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode); +#endif + +#ifndef GL_SGIX_blend_alpha_minmax +#define GL_SGIX_blend_alpha_minmax 1 +#endif + +#ifndef GL_EXT_bgra +#define GL_EXT_bgra 1 +#endif + +#ifndef GL_SGIX_async +#define GL_SGIX_async 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint); +GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *); +GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *); +GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei); +GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei); +GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker); +typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp); +typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp); +typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range); +typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range); +typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker); +#endif + +#ifndef GL_SGIX_async_pixel +#define GL_SGIX_async_pixel 1 +#endif + +#ifndef GL_SGIX_async_histogram +#define GL_SGIX_async_histogram 1 +#endif + +#ifndef GL_INTEL_parallel_arrays +#define GL_INTEL_parallel_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *); +GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *); +GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer); +#endif + +#ifndef GL_HP_occlusion_test +#define GL_HP_occlusion_test 1 +#endif + +#ifndef GL_EXT_pixel_transform +#define GL_EXT_pixel_transform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint); +GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params); +#endif + +#ifndef GL_EXT_pixel_transform_color_table +#define GL_EXT_pixel_transform_color_table 1 +#endif + +#ifndef GL_EXT_shared_texture_palette +#define GL_EXT_shared_texture_palette 1 +#endif + +#ifndef GL_EXT_separate_specular_color +#define GL_EXT_separate_specular_color 1 +#endif + +#ifndef GL_EXT_secondary_color +#define GL_EXT_secondary_color 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *); +GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *); +GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *); +GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *); +GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *); +GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *); +GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *); +GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort); +GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *); +GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_perturb_normal +#define GL_EXT_texture_perturb_normal 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureNormalEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_fog_coord +#define GL_EXT_fog_coord 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFogCoordfEXT (GLfloat); +GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *); +GLAPI void APIENTRY glFogCoorddEXT (GLdouble); +GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *); +GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_REND_screen_coordinates +#define GL_REND_screen_coordinates 1 +#endif + +#ifndef GL_EXT_coordinate_frame +#define GL_EXT_coordinate_frame 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *); +GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *); +GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *); +GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glTangent3ivEXT (const GLint *); +GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glTangent3svEXT (const GLshort *); +GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *); +GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *); +GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *); +GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint); +GLAPI void APIENTRY glBinormal3ivEXT (const GLint *); +GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glBinormal3svEXT (const GLshort *); +GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz); +typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz); +typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz); +typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz); +typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz); +typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz); +typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v); +typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz); +typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz); +typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz); +typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz); +typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_EXT_texture_env_combine +#define GL_EXT_texture_env_combine 1 +#endif + +#ifndef GL_APPLE_specular_vector +#define GL_APPLE_specular_vector 1 +#endif + +#ifndef GL_APPLE_transform_hint +#define GL_APPLE_transform_hint 1 +#endif + +#ifndef GL_SGIX_fog_scale +#define GL_SGIX_fog_scale 1 +#endif + +#ifndef GL_SUNX_constant_data +#define GL_SUNX_constant_data 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFinishTextureSUNX (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void); +#endif + +#ifndef GL_SUN_global_alpha +#define GL_SUN_global_alpha 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte); +GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort); +GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint); +GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat); +GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble); +GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte); +GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort); +GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor); +typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor); +#endif + +#ifndef GL_SUN_triangle_list +#define GL_SUN_triangle_list 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint); +GLAPI void APIENTRY glReplacementCodeusSUN (GLushort); +GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte); +GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *); +GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *); +GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *); +GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer); +#endif + +#ifndef GL_SUN_vertex +#define GL_SUN_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (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 (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (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 (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v); +typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (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 (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v); +#endif + +#ifndef GL_EXT_blend_func_separate +#define GL_EXT_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_blend_func_separate +#define GL_INGR_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +#endif + +#ifndef GL_INGR_color_clamp +#define GL_INGR_color_clamp 1 +#endif + +#ifndef GL_INGR_interlace_read +#define GL_INGR_interlace_read 1 +#endif + +#ifndef GL_EXT_stencil_wrap +#define GL_EXT_stencil_wrap 1 +#endif + +#ifndef GL_EXT_422_pixels +#define GL_EXT_422_pixels 1 +#endif + +#ifndef GL_NV_texgen_reflection +#define GL_NV_texgen_reflection 1 +#endif + +#ifndef GL_SUN_convolution_border_modes +#define GL_SUN_convolution_border_modes 1 +#endif + +#ifndef GL_EXT_texture_env_add +#define GL_EXT_texture_env_add 1 +#endif + +#ifndef GL_EXT_texture_lod_bias +#define GL_EXT_texture_lod_bias 1 +#endif + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifndef GL_EXT_vertex_weighting +#define GL_EXT_vertex_weighting 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexWeightfEXT (GLfloat); +GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *); +GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +#ifndef GL_NV_light_max_exponent +#define GL_NV_light_max_exponent 1 +#endif + +#ifndef GL_NV_vertex_array_range +#define GL_NV_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFlushVertexArrayRangeNV (void); +GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void); +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer); +#endif + +#ifndef GL_NV_register_combiners +#define GL_NV_register_combiners 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *); +GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat); +GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *); +GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean); +GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum); +typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params); +#endif + +#ifndef GL_NV_fog_distance +#define GL_NV_fog_distance 1 +#endif + +#ifndef GL_NV_texgen_emboss +#define GL_NV_texgen_emboss 1 +#endif + +#ifndef GL_NV_blend_square +#define GL_NV_blend_square 1 +#endif + +#ifndef GL_NV_texture_env_combine4 +#define GL_NV_texture_env_combine4 1 +#endif + +#ifndef GL_MESA_resize_buffers +#define GL_MESA_resize_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glResizeBuffersMESA (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void); +#endif + +#ifndef GL_MESA_window_pos +#define GL_MESA_window_pos 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint); +GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort); +GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *); +GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *); +GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *); +GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *); +GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y); +typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v); +typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v); +#endif + +#ifndef GL_IBM_cull_vertex +#define GL_IBM_cull_vertex 1 +#endif + +#ifndef GL_IBM_multimode_draw_arrays +#define GL_IBM_multimode_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint); +GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride); +typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride); +#endif + +#ifndef GL_IBM_vertex_array_lists +#define GL_IBM_vertex_array_lists 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint); +GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride); +#endif + +#ifndef GL_SGIX_subsample +#define GL_SGIX_subsample 1 +#endif + +#ifndef GL_SGIX_ycrcba +#define GL_SGIX_ycrcba 1 +#endif + +#ifndef GL_SGIX_ycrcb_subsample +#define GL_SGIX_ycrcb_subsample 1 +#endif + +#ifndef GL_SGIX_depth_pass_instrument +#define GL_SGIX_depth_pass_instrument 1 +#endif + +#ifndef GL_3DFX_texture_compression_FXT1 +#define GL_3DFX_texture_compression_FXT1 1 +#endif + +#ifndef GL_3DFX_multisample +#define GL_3DFX_multisample 1 +#endif + +#ifndef GL_3DFX_tbuffer +#define GL_3DFX_tbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTbufferMask3DFX (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask); +#endif + +#ifndef GL_EXT_multisample +#define GL_EXT_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean); +GLAPI void APIENTRY glSamplePatternEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert); +typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern); +#endif + +#ifndef GL_SGIX_vertex_preclip +#define GL_SGIX_vertex_preclip 1 +#endif + +#ifndef GL_SGIX_convolution_accuracy +#define GL_SGIX_convolution_accuracy 1 +#endif + +#ifndef GL_SGIX_resample +#define GL_SGIX_resample 1 +#endif + +#ifndef GL_SGIS_point_line_texgen +#define GL_SGIS_point_line_texgen 1 +#endif + +#ifndef GL_SGIS_texture_color_mask +#define GL_SGIS_texture_color_mask 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +#endif + +#ifndef GL_SGIX_igloo_interface +#define GL_SGIX_igloo_interface 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params); +#endif + +#ifndef GL_EXT_texture_env_dot3 +#define GL_EXT_texture_env_dot3 1 +#endif + +#ifndef GL_ATI_texture_mirror_once +#define GL_ATI_texture_mirror_once 1 +#endif + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsFenceNV (GLuint); +GLAPI GLboolean APIENTRY glTestFenceNV (GLuint); +GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFinishFenceNV (GLuint); +GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#endif + +#ifndef GL_NV_evaluators +#define GL_NV_evaluators 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *); +GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *); +GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points); +typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode); +#endif + +#ifndef GL_NV_packed_depth_stencil +#define GL_NV_packed_depth_stencil 1 +#endif + +#ifndef GL_NV_register_combiners2 +#define GL_NV_register_combiners2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params); +#endif + +#ifndef GL_NV_texture_compression_vtc +#define GL_NV_texture_compression_vtc 1 +#endif + +#ifndef GL_NV_texture_rectangle +#define GL_NV_texture_rectangle 1 +#endif + +#ifndef GL_NV_texture_shader +#define GL_NV_texture_shader 1 +#endif + +#ifndef GL_NV_texture_shader2 +#define GL_NV_texture_shader2 1 +#endif + +#ifndef GL_NV_vertex_array_range2 +#define GL_NV_vertex_array_range2 1 +#endif + +#ifndef GL_NV_vertex_program +#define GL_NV_vertex_program 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *); +GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint); +GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *); +GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *); +GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *); +GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *); +GLAPI GLboolean APIENTRY glIsProgramNV (GLuint); +GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *); +GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *); +GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *); +GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum); +GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble); +GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat); +GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort); +GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *); +GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *); +GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte); +GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *); +GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *); +GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences); +typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params); +typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program); +typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer); +typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v); +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v); +typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform); +typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v); +#endif + +#ifndef GL_SGIX_texture_coordinate_clamp +#define GL_SGIX_texture_coordinate_clamp 1 +#endif + +#ifndef GL_SGIX_scalebias_hint +#define GL_SGIX_scalebias_hint 1 +#endif + +#ifndef GL_OML_interlace +#define GL_OML_interlace 1 +#endif + +#ifndef GL_OML_subsample +#define GL_OML_subsample 1 +#endif + +#ifndef GL_OML_resample +#define GL_OML_resample 1 +#endif + +#ifndef GL_NV_copy_depth_to_color +#define GL_NV_copy_depth_to_color 1 +#endif + +#ifndef GL_ATI_envmap_bumpmap +#define GL_ATI_envmap_bumpmap 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *); +GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *); +GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param); +typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param); +typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param); +#endif + +#ifndef GL_ATI_fragment_shader +#define GL_ATI_fragment_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint); +GLAPI void APIENTRY glBindFragmentShaderATI (GLuint); +GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint); +GLAPI void APIENTRY glBeginFragmentShaderATI (void); +GLAPI void APIENTRY glEndFragmentShaderATI (void); +GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum); +GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range); +typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void); +typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle); +typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod); +typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod); +typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value); +#endif + +#ifndef GL_ATI_pn_triangles +#define GL_ATI_pn_triangles 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint); +GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_vertex_array_object +#define GL_ATI_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum); +GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint); +GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum); +GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glFreeObjectBufferATI (GLuint); +GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage); +typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params); +#endif + +#ifndef GL_EXT_vertex_shader +#define GL_EXT_vertex_shader 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginVertexShaderEXT (void); +GLAPI void APIENTRY glEndVertexShaderEXT (void); +GLAPI void APIENTRY glBindVertexShaderEXT (GLuint); +GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint); +GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint); +GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint); +GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *); +GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *); +GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *); +GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *); +GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *); +GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *); +GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *); +GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *); +GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint); +GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint); +GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum); +GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum); +GLAPI GLuint APIENTRY glBindParameterEXT (GLenum); +GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum); +GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *); +GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *); +GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range); +typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1); +typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2); +typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3); +typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW); +typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num); +typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components); +typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr); +typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr); +typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr); +typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr); +typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr); +typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr); +typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr); +typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr); +typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr); +typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr); +typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id); +typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value); +typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value); +typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap); +typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data); +typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data); +typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data); +#endif + +#ifndef GL_ATI_vertex_streams +#define GL_ATI_vertex_streams 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort); +GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint); +GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat); +GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble); +GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint); +GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte); +GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *); +GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort); +GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *); +GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint); +GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *); +GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *); +GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *); +GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum); +GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint); +GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x); +typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y); +typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords); +typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param); +#endif + +#ifndef GL_ATI_element_array +#define GL_ATI_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count); +#endif + +#ifndef GL_SUN_mesh_array +#define GL_SUN_mesh_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width); +#endif + +#ifndef GL_SUN_slice_accum +#define GL_SUN_slice_accum 1 +#endif + +#ifndef GL_NV_multisample_filter_hint +#define GL_NV_multisample_filter_hint 1 +#endif + +#ifndef GL_NV_depth_clamp +#define GL_NV_depth_clamp 1 +#endif + +#ifndef GL_NV_occlusion_query +#define GL_NV_occlusion_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *); +GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint); +GLAPI void APIENTRY glEndOcclusionQueryNV (void); +GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); +#endif + +#ifndef GL_NV_point_sprite +#define GL_NV_point_sprite 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint); +GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params); +#endif + +#ifndef GL_NV_texture_shader3 +#define GL_NV_texture_shader3 1 +#endif + +#ifndef GL_NV_vertex_program1_1 +#define GL_NV_vertex_program1_1 1 +#endif + +#ifndef GL_EXT_shadow_funcs +#define GL_EXT_shadow_funcs 1 +#endif + +#ifndef GL_EXT_stencil_two_side +#define GL_EXT_stencil_two_side 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face); +#endif + +#ifndef GL_ATI_text_fragment_shader +#define GL_ATI_text_fragment_shader 1 +#endif + +#ifndef GL_APPLE_client_storage +#define GL_APPLE_client_storage 1 +#endif + +#ifndef GL_APPLE_element_array +#define GL_APPLE_element_array 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *); +GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei); +GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei); +GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei); +GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count); +typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount); +#endif + +#ifndef GL_APPLE_fence +#define GL_APPLE_fence 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *); +GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glSetFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint); +GLAPI void APIENTRY glFinishFenceAPPLE (GLuint); +GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint); +GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences); +typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences); +typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence); +typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence); +typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name); +typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name); +#endif + +#ifndef GL_APPLE_vertex_array_object +#define GL_APPLE_vertex_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint); +GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array); +typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array); +#endif + +#ifndef GL_APPLE_vertex_array_range +#define GL_APPLE_vertex_array_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *); +GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param); +#endif + +#ifndef GL_APPLE_ycbcr_422 +#define GL_APPLE_ycbcr_422 1 +#endif + +#ifndef GL_S3_s3tc +#define GL_S3_s3tc 1 +#endif + +#ifndef GL_ATI_draw_buffers +#define GL_ATI_draw_buffers 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs); +#endif + +#ifndef GL_ATI_pixel_format_float +#define GL_ATI_pixel_format_float 1 +/* This is really a WGL extension, but defines some associated GL enums. + * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string. + */ +#endif + +#ifndef GL_ATI_texture_env_combine3 +#define GL_ATI_texture_env_combine3 1 +#endif + +#ifndef GL_ATI_texture_float +#define GL_ATI_texture_float 1 +#endif + +#ifndef GL_NV_float_buffer +#define GL_NV_float_buffer 1 +#endif + +#ifndef GL_NV_fragment_program +#define GL_NV_fragment_program 1 +/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */ +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *); +GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *); +GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *); +GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v); +typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params); +typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +#endif + +#ifndef GL_NV_half_float +#define GL_NV_half_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV); +GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *); +GLAPI void APIENTRY glFogCoordhNV (GLhalfNV); +GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *); +GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV); +GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV); +GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *); +GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz); +typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha); +typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s); +typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s); +typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t); +typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r); +typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q); +typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog); +typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue); +typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight); +typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x); +typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y); +typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z); +typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v); +#endif + +#ifndef GL_NV_pixel_data_range +#define GL_NV_pixel_data_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *); +GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer); +typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target); +#endif + +#ifndef GL_NV_primitive_restart +#define GL_NV_primitive_restart 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPrimitiveRestartNV (void); +GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void); +typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); +#endif + +#ifndef GL_NV_texture_expand_normal +#define GL_NV_texture_expand_normal 1 +#endif + +#ifndef GL_NV_vertex_program2 +#define GL_NV_vertex_program2 1 +#endif + +#ifndef GL_ATI_map_object_buffer +#define GL_ATI_map_object_buffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint); +GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer); +#endif + +#ifndef GL_ATI_separate_stencil +#define GL_ATI_separate_stencil 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask); +#endif + +#ifndef GL_ATI_vertex_attrib_array_object +#define GL_ATI_vertex_attrib_array_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint); +GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params); +#endif + +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +#ifndef GL_EXT_depth_bounds_test +#define GL_EXT_depth_bounds_test 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax); +#endif + +#ifndef GL_EXT_texture_mirror_clamp +#define GL_EXT_texture_mirror_clamp 1 +#endif + +#ifndef GL_EXT_blend_equation_separate +#define GL_EXT_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +#ifndef GL_MESA_pack_invert +#define GL_MESA_pack_invert 1 +#endif + +#ifndef GL_MESA_ycbcr_texture +#define GL_MESA_ycbcr_texture 1 +#endif + +#ifndef GL_EXT_pixel_buffer_object +#define GL_EXT_pixel_buffer_object 1 +#endif + +#ifndef GL_NV_fragment_program_option +#define GL_NV_fragment_program_option 1 +#endif + +#ifndef GL_NV_fragment_program2 +#define GL_NV_fragment_program2 1 +#endif + +#ifndef GL_NV_vertex_program2_option +#define GL_NV_vertex_program2_option 1 +#endif + +#ifndef GL_NV_vertex_program3 +#define GL_NV_vertex_program3 1 +#endif + +#ifndef GL_EXT_framebuffer_object +#define GL_EXT_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint); +GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *); +GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *); +GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint); +GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint); +GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *); +GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum); +GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGenerateMipmapEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer); +typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer); +typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target); +#endif + +#ifndef GL_GREMEDY_string_marker +#define GL_GREMEDY_string_marker 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string); +#endif + +#ifndef GL_EXT_packed_depth_stencil +#define GL_EXT_packed_depth_stencil 1 +#endif + +#ifndef GL_EXT_stencil_clear_tag +#define GL_EXT_stencil_clear_tag 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glStencilClearTagEXT (GLsizei, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag); +#endif + +#ifndef GL_EXT_texture_sRGB +#define GL_EXT_texture_sRGB 1 +#endif + +#ifndef GL_EXT_framebuffer_blit +#define GL_EXT_framebuffer_blit 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlitFramebufferEXT (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + +#ifndef GL_EXT_framebuffer_multisample +#define GL_EXT_framebuffer_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +#ifndef GL_MESAX_texture_stack +#define GL_MESAX_texture_stack 1 +#endif + +#ifndef GL_EXT_timer_query +#define GL_EXT_timer_query 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint, GLenum, GLint64EXT *); +GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint, GLenum, GLuint64EXT *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64EXT *params); +#endif + +#ifndef GL_EXT_gpu_program_parameters +#define GL_EXT_gpu_program_parameters 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum, GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum, GLuint, GLsizei, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params); +#endif + +#ifndef GL_APPLE_flush_buffer_range +#define GL_APPLE_flush_buffer_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum, GLenum, GLint); +GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum, GLintptr, GLsizeiptr); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size); +#endif + +#ifndef GL_NV_gpu_program4 +#define GL_NV_gpu_program4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum, GLuint, const GLint *); +GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum, GLuint, const GLuint *); +GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *); +GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum, GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum, GLuint, const GLint *); +GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum, GLuint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum, GLuint, const GLuint *); +GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum, GLuint, GLsizei, const GLuint *); +GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum, GLuint, GLint *); +GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum, GLuint, GLuint *); +GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum, GLuint, GLint *); +GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum, GLuint, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params); +#endif + +#ifndef GL_NV_geometry_program4 +#define GL_NV_geometry_program4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramVertexLimitNV (GLenum, GLint); +GLAPI void APIENTRY glFramebufferTextureEXT (GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum, GLenum, GLuint, GLint, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +#endif + +#ifndef GL_EXT_geometry_shader4 +#define GL_EXT_geometry_shader4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramParameteriEXT (GLuint, GLenum, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +#endif + +#ifndef GL_NV_vertex_program4 +#define GL_NV_vertex_program4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint, GLint); +GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint, const GLint *); +GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint, const GLuint *); +GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint, const GLbyte *); +GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint, const GLshort *); +GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint, const GLubyte *); +GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint, const GLushort *); +GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint, GLenum, GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params); +#endif + +#ifndef GL_EXT_gpu_shader4 +#define GL_EXT_gpu_shader4 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetUniformuivEXT (GLuint, GLint, GLuint *); +GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint, GLuint, const GLchar *); +GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint, const GLchar *); +GLAPI void APIENTRY glUniform1uiEXT (GLint, GLuint); +GLAPI void APIENTRY glUniform2uiEXT (GLint, GLuint, GLuint); +GLAPI void APIENTRY glUniform3uiEXT (GLint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glUniform4uiEXT (GLint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glUniform1uivEXT (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glUniform2uivEXT (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glUniform3uivEXT (GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glUniform4uivEXT (GLint, GLsizei, const GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value); +#endif + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); +#endif + +#ifndef GL_EXT_packed_float +#define GL_EXT_packed_float 1 +#endif + +#ifndef GL_EXT_texture_array +#define GL_EXT_texture_array 1 +#endif + +#ifndef GL_EXT_texture_buffer_object +#define GL_EXT_texture_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexBufferEXT (GLenum, GLenum, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +#endif + +#ifndef GL_EXT_texture_compression_latc +#define GL_EXT_texture_compression_latc 1 +#endif + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 +#endif + +#ifndef GL_EXT_texture_shared_exponent +#define GL_EXT_texture_shared_exponent 1 +#endif + +#ifndef GL_NV_depth_buffer_float +#define GL_NV_depth_buffer_float 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glDepthRangedNV (GLdouble, GLdouble); +GLAPI void APIENTRY glClearDepthdNV (GLdouble); +GLAPI void APIENTRY glDepthBoundsdNV (GLdouble, GLdouble); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth); +typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax); +#endif + +#ifndef GL_NV_fragment_program4 +#define GL_NV_fragment_program4 1 +#endif + +#ifndef GL_NV_framebuffer_multisample_coverage +#define GL_NV_framebuffer_multisample_coverage 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +#endif + +#ifndef GL_EXT_framebuffer_sRGB +#define GL_EXT_framebuffer_sRGB 1 +#endif + +#ifndef GL_NV_geometry_shader4 +#define GL_NV_geometry_shader4 1 +#endif + +#ifndef GL_NV_parameter_buffer_object +#define GL_NV_parameter_buffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum, GLuint, GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum, GLuint, GLuint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum, GLuint, GLuint, GLsizei, const GLuint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params); +#endif + +#ifndef GL_EXT_draw_buffers2 +#define GL_EXT_draw_buffers2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint, GLboolean, GLboolean, GLboolean, GLboolean); +GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum, GLuint, GLboolean *); +GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum, GLuint, GLint *); +GLAPI void APIENTRY glEnableIndexedEXT (GLenum, GLuint); +GLAPI void APIENTRY glDisableIndexedEXT (GLenum, GLuint); +GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index); +#endif + +#ifndef GL_NV_transform_feedback +#define GL_NV_transform_feedback 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum); +GLAPI void APIENTRY glEndTransformFeedbackNV (void); +GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint, const GLint *, GLenum); +GLAPI void APIENTRY glBindBufferRangeNV (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); +GLAPI void APIENTRY glBindBufferOffsetNV (GLenum, GLuint, GLuint, GLintptr); +GLAPI void APIENTRY glBindBufferBaseNV (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint, GLsizei, const GLchar* *, GLenum); +GLAPI void APIENTRY glActiveVaryingNV (GLuint, const GLchar *); +GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint, const GLchar *); +GLAPI void APIENTRY glGetActiveVaryingNV (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); +GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint, GLuint, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name); +typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location); +#endif + +#ifndef GL_EXT_bindable_uniform +#define GL_EXT_bindable_uniform 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glUniformBufferEXT (GLuint, GLint, GLuint); +GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint, GLint); +GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint, GLint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer); +typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location); +typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location); +#endif + +#ifndef GL_EXT_texture_integer +#define GL_EXT_texture_integer 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTexParameterIivEXT (GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glTexParameterIuivEXT (GLenum, GLenum, const GLuint *); +GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum, GLenum, GLuint *); +GLAPI void APIENTRY glClearColorIiEXT (GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glClearColorIuiEXT (GLuint, GLuint, GLuint, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha); +typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha); +#endif + +#ifndef GL_GREMEDY_frame_terminator +#define GL_GREMEDY_frame_terminator 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glFrameTerminatorGREMEDY (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void); +#endif + +#ifndef GL_NV_conditional_render +#define GL_NV_conditional_render 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint, GLenum); +GLAPI void APIENTRY glEndConditionalRenderNV (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); +#endif + +#ifndef GL_NV_present_video +#define GL_NV_present_video 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLuint, GLenum, GLuint, GLuint); +GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint, GLuint64EXT, GLuint, GLuint, GLenum, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint, GLenum, GLuint); +GLAPI void APIENTRY glGetVideoivNV (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetVideouivNV (GLuint, GLenum, GLuint *); +GLAPI void APIENTRY glGetVideoi64vNV (GLuint, GLenum, GLint64EXT *); +GLAPI void APIENTRY glGetVideoui64vNV (GLuint, GLenum, GLuint64EXT *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1); +typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3); +typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params); +typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params); +#endif + +#ifndef GL_EXT_transform_feedback +#define GL_EXT_transform_feedback 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum); +GLAPI void APIENTRY glEndTransformFeedbackEXT (void); +GLAPI void APIENTRY glBindBufferRangeEXT (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr); +GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum, GLuint, GLuint, GLintptr); +GLAPI void APIENTRY glBindBufferBaseEXT (GLenum, GLuint, GLuint); +GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLchar* *, GLenum); +GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode); +typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void); +typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset); +typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode); +typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +#endif + +#ifndef GL_EXT_direct_state_access +#define GL_EXT_direct_state_access 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield); +GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield); +GLAPI void APIENTRY glMatrixLoadfEXT (GLenum, const GLfloat *); +GLAPI void APIENTRY glMatrixLoaddEXT (GLenum, const GLdouble *); +GLAPI void APIENTRY glMatrixMultfEXT (GLenum, const GLfloat *); +GLAPI void APIENTRY glMatrixMultdEXT (GLenum, const GLdouble *); +GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum); +GLAPI void APIENTRY glMatrixRotatefEXT (GLenum, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMatrixRotatedEXT (GLenum, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMatrixScalefEXT (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMatrixScaledEXT (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMatrixFrustumEXT (GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMatrixOrthoEXT (GLenum, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glMatrixPopEXT (GLenum); +GLAPI void APIENTRY glMatrixPushEXT (GLenum); +GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum, const GLfloat *); +GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum, const GLdouble *); +GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum, const GLfloat *); +GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum, const GLdouble *); +GLAPI void APIENTRY glTextureParameterfEXT (GLuint, GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glTextureParameterfvEXT (GLuint, GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glTextureParameteriEXT (GLuint, GLenum, GLenum, GLint); +GLAPI void APIENTRY glTextureParameterivEXT (GLuint, GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glTextureImage1DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTextureImage2DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetTextureImageEXT (GLuint, GLenum, GLint, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint, GLenum, GLint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint, GLenum, GLint, GLenum, GLint *); +GLAPI void APIENTRY glTextureImage3DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum, GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum, GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum, GLenum, GLenum, GLint); +GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum, GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); +GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); +GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei); +GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum, GLenum, GLint, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum, GLenum, GLint, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum, GLenum, GLint, GLenum, GLint *); +GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); +GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); +GLAPI void APIENTRY glBindMultiTextureEXT (GLenum, GLenum, GLuint); +GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum, GLuint); +GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum, GLuint); +GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum, GLint, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum, GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum, GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexEnviEXT (GLenum, GLenum, GLenum, GLint); +GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum, GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexGendEXT (GLenum, GLenum, GLenum, GLdouble); +GLAPI void APIENTRY glMultiTexGendvEXT (GLenum, GLenum, GLenum, const GLdouble *); +GLAPI void APIENTRY glMultiTexGenfEXT (GLenum, GLenum, GLenum, GLfloat); +GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum, GLenum, GLenum, const GLfloat *); +GLAPI void APIENTRY glMultiTexGeniEXT (GLenum, GLenum, GLenum, GLint); +GLAPI void APIENTRY glMultiTexGenivEXT (GLenum, GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum, GLenum, GLenum, GLdouble *); +GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum, GLenum, GLenum, GLfloat *); +GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum, GLuint, GLvoid* *); +GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint, GLenum, GLint, GLvoid *); +GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum, GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum, GLenum, GLint, GLvoid *); +GLAPI void APIENTRY glNamedProgramStringEXT (GLuint, GLenum, GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint, GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble); +GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint, GLenum, GLuint, const GLdouble *); +GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint, GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint, GLenum, GLuint, const GLfloat *); +GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint, GLenum, GLuint, GLdouble *); +GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint, GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint, GLenum, GLenum, GLvoid *); +GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint, GLenum, GLuint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint, GLenum, GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint, GLenum, GLuint, const GLint *); +GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint, GLenum, GLuint, GLsizei, const GLint *); +GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint, GLenum, GLuint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint, GLenum, GLuint, const GLuint *); +GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint, GLenum, GLuint, GLsizei, const GLuint *); +GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint, GLenum, GLuint, GLint *); +GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint, GLenum, GLuint, GLuint *); +GLAPI void APIENTRY glTextureParameterIivEXT (GLuint, GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint, GLenum, GLenum, const GLuint *); +GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint, GLenum, GLenum, GLuint *); +GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum, GLenum, GLenum, const GLint *); +GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum, GLenum, GLenum, const GLuint *); +GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum, GLenum, GLenum, GLuint *); +GLAPI void APIENTRY glProgramUniform1fEXT (GLuint, GLint, GLfloat); +GLAPI void APIENTRY glProgramUniform2fEXT (GLuint, GLint, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramUniform3fEXT (GLuint, GLint, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramUniform4fEXT (GLuint, GLint, GLfloat, GLfloat, GLfloat, GLfloat); +GLAPI void APIENTRY glProgramUniform1iEXT (GLuint, GLint, GLint); +GLAPI void APIENTRY glProgramUniform2iEXT (GLuint, GLint, GLint, GLint); +GLAPI void APIENTRY glProgramUniform3iEXT (GLuint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glProgramUniform4iEXT (GLuint, GLint, GLint, GLint, GLint, GLint); +GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint, GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint, GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint, GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint, GLint, GLsizei, const GLfloat *); +GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint, GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint, GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint, GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint, GLint, GLsizei, const GLint *); +GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint, GLint, GLsizei, GLboolean, const GLfloat *); +GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint, GLint, GLuint); +GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint, GLint, GLuint, GLuint); +GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint, GLint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint, GLint, GLuint, GLuint, GLuint, GLuint); +GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint, GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint, GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint, GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint, GLint, GLsizei, const GLuint *); +GLAPI void APIENTRY glNamedBufferDataEXT (GLuint, GLsizeiptr, const GLvoid *, GLenum); +GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint, GLintptr, GLsizeiptr, const GLvoid *); +GLAPI GLvoid* APIENTRY glMapNamedBufferEXT (GLuint, GLenum); +GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint); +GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint, GLenum, GLvoid* *); +GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint, GLintptr, GLsizeiptr, GLvoid *); +GLAPI void APIENTRY glTextureBufferEXT (GLuint, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glMultiTexBufferEXT (GLenum, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint, GLenum, GLint *); +GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint, GLenum); +GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint, GLenum, GLenum, GLuint, GLint); +GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint, GLenum, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint, GLenum, GLenum, GLuint); +GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint, GLenum, GLenum, GLint *); +GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint, GLenum); +GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum, GLenum); +GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint, GLenum); +GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint, GLsizei, const GLenum *); +GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint, GLenum); +GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint, GLenum, GLint *); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint, GLsizei, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint, GLsizei, GLsizei, GLenum, GLsizei, GLsizei); +GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint, GLenum, GLuint, GLint); +GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint, GLenum, GLuint, GLint, GLint); +GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint, GLenum, GLuint, GLint, GLenum); +GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint, GLenum, GLuint); +GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum, GLenum, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask); +typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m); +typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture); +typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index); +typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param); +typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params); +typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param); +typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param); +typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params); +typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data); +typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLvoid* *data); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, GLvoid *img); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *bits); +typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, GLvoid *img); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const GLvoid *string); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, GLvoid *string); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params); +typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const GLvoid *data, GLenum usage); +typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const GLvoid *data); +typedef GLvoid* (APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access); +typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, GLvoid* *params); +typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLvoid *data); +typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params); +typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target); +typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target); +typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode); +typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face); +typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer); +#endif + +#ifndef GL_EXT_vertex_array_bgra +#define GL_EXT_vertex_array_bgra 1 +#endif + +#ifndef GL_EXT_texture_swizzle +#define GL_EXT_texture_swizzle 1 +#endif + +#ifndef GL_NV_explicit_multisample +#define GL_NV_explicit_multisample 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetMultisamplefvNV (GLenum, GLuint, GLfloat *); +GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint, GLbitfield); +GLAPI void APIENTRY glTexRenderbufferNV (GLenum, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask); +typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer); +#endif + +#ifndef GL_NV_transform_feedback2 +#define GL_NV_transform_feedback2 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum, GLuint); +GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei, const GLuint *); +GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei, GLuint *); +GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint); +GLAPI void APIENTRY glPauseTransformFeedbackNV (void); +GLAPI void APIENTRY glResumeTransformFeedbackNV (void); +GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum, GLuint); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id); +typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void); +typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id); +#endif + +#ifndef GL_ATI_meminfo +#define GL_ATI_meminfo 1 +#endif + +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *, GLsizei, GLuint *); +GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint, GLint *, GLint *, GLsizei, GLuint *); +GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint, GLuint, GLsizei, GLsizei *, GLchar *); +GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint, GLuint, GLenum, void *); +GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei, GLuint *); +GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei, GLuint *); +GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint, GLboolean, GLuint, GLint, GLuint *); +GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint); +GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint); +GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint, GLenum, GLsizei, GLuint *, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); +typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif + +#ifndef GL_AMD_texture_texture4 +#define GL_AMD_texture_texture4 1 +#endif + +#ifndef GL_AMD_vertex_shader_tesselator +#define GL_AMD_vertex_shader_tesselator 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTessellationFactorAMD (GLfloat); +GLAPI void APIENTRY glTessellationModeAMD (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor); +typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_provoking_vertex +#define GL_EXT_provoking_vertex 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glProvokingVertexEXT (GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode); +#endif + +#ifndef GL_EXT_texture_snorm +#define GL_EXT_texture_snorm 1 +#endif + +#ifndef GL_AMD_draw_buffers_blend +#define GL_AMD_draw_buffers_blend 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint, GLenum, GLenum); +GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint, GLenum, GLenum, GLenum, GLenum); +GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint, GLenum); +GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint, GLenum, GLenum); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +#endif + +#ifndef GL_APPLE_texture_range +#define GL_APPLE_texture_range 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glTextureRangeAPPLE (GLenum, GLsizei, const GLvoid *); +GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum, GLenum, GLvoid* *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const GLvoid *pointer); +typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, GLvoid* *params); +#endif + +#ifndef GL_APPLE_float_pixels +#define GL_APPLE_float_pixels 1 +#endif + +#ifndef GL_APPLE_vertex_program_evaluators +#define GL_APPLE_vertex_program_evaluators 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint, GLenum); +GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint, GLenum); +GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint, GLenum); +GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint, GLuint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); +GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint, GLuint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname); +typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); +typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); +#endif + +#ifndef GL_APPLE_aux_depth_stencil +#define GL_APPLE_aux_depth_stencil 1 +#endif + +#ifndef GL_APPLE_object_purgeable +#define GL_APPLE_object_purgeable 1 +#ifdef GL_GLEXT_PROTOTYPES +GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum, GLuint, GLenum); +GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum, GLuint, GLenum); +GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum, GLuint, GLenum, GLint *); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); +typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option); +typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params); +#endif + +#ifndef GL_APPLE_row_bytes +#define GL_APPLE_row_bytes 1 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/include/GL/glfbdev.h b/mesalib/include/GL/glfbdev.h new file mode 100644 index 000000000..4e25e7b05 --- /dev/null +++ b/mesalib/include/GL/glfbdev.h @@ -0,0 +1,149 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef GLFBDEV_H +#define GLFBDEV_H + + +/* avoid including linux/fb.h */ +struct fb_fix_screeninfo; +struct fb_var_screeninfo; + + +/* public types */ +typedef struct GLFBDevVisualRec *GLFBDevVisualPtr; +typedef struct GLFBDevBufferRec *GLFBDevBufferPtr; +typedef struct GLFBDevContextRec *GLFBDevContextPtr; + + +/* API version */ +#define GLFBDEV_VERSION_1_0 1 + + +/* For glFBDevCreateVisual */ +#define GLFBDEV_DOUBLE_BUFFER 100 +#define GLFBDEV_COLOR_INDEX 101 +#define GLFBDEV_DEPTH_SIZE 102 +#define GLFBDEV_STENCIL_SIZE 103 +#define GLFBDEV_ACCUM_SIZE 104 +#define GLFBDEV_LEVEL 105 +#define GLFBDEV_MULTISAMPLE 106 +#define GLFBDEV_NONE 0 + +/* For glFBDevGetString */ +#define GLFBDEV_VERSION 200 +#define GLFBDEV_VENDOR 201 + + +/* Misc functions */ + +extern const char * +glFBDevGetString( int str ); + + +typedef void (*GLFBDevProc)(); + + +extern GLFBDevProc +glFBDevGetProcAddress( const char *procName ); + + + +/** + * Create a GLFBDevVisual. + * \param fixInfo - needed to get the visual types, etc. + * \param varInfo - needed to get the bits_per_pixel, etc. + * \param attribs - for requesting depth, stencil, accum buffers, etc. + */ +extern GLFBDevVisualPtr +glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo, + const struct fb_var_screeninfo *varInfo, + const int *attribs ); + +extern void +glFBDevDestroyVisual( GLFBDevVisualPtr visual ); + +extern int +glFBDevGetVisualAttrib( const GLFBDevVisualPtr visual, int attrib); + + + +/** + * Create a GLFBDevBuffer. + * \param fixInfo, varInfo - needed in order to get the screen size + * (resolution), etc. + * \param visual - as returned by glFBDevCreateVisual() + * \param frontBuffer - address of front color buffer + * \param backBuffer - address of back color buffer (may be NULL) + * \param size - size of the color buffer(s) in bytes. + */ +extern GLFBDevBufferPtr +glFBDevCreateBuffer( const struct fb_fix_screeninfo *fixInfo, + const struct fb_var_screeninfo *varInfo, + const GLFBDevVisualPtr visual, + void *frontBuffer, void *backBuffer, size_t size ); + +extern void +glFBDevDestroyBuffer( GLFBDevBufferPtr buffer ); + +extern int +glFBDevGetBufferAttrib( const GLFBDevBufferPtr buffer, int attrib); + +extern GLFBDevBufferPtr +glFBDevGetCurrentDrawBuffer( void ); + +extern GLFBDevBufferPtr +glFBDevGetCurrentReadBuffer( void ); + +extern void +glFBDevSwapBuffers( GLFBDevBufferPtr buffer ); + + + +/** + * Create a GLFBDevContext. + * \param visual - as created by glFBDevCreateVisual. + * \param share - specifies another context with which to share textures, + * display lists, etc. (may be NULL). + */ +extern GLFBDevContextPtr +glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share ); + +extern void +glFBDevDestroyContext( GLFBDevContextPtr context ); + +extern int +glFBDevGetContextAttrib( const GLFBDevContextPtr context, int attrib); + +extern GLFBDevContextPtr +glFBDevGetCurrentContext( void ); + +extern int +glFBDevMakeCurrent( GLFBDevContextPtr context, + GLFBDevBufferPtr drawBuffer, + GLFBDevBufferPtr readBuffer ); + + +#endif /* GLFBDEV_H */ diff --git a/mesalib/include/GL/glu.h b/mesalib/include/GL/glu.h new file mode 100644 index 000000000..cd967ac5e --- /dev/null +++ b/mesalib/include/GL/glu.h @@ -0,0 +1,353 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#ifndef __glu_h__ +#define __glu_h__ + +#if defined(USE_MGL_NAMESPACE) +#include "glu_mangle.h" +#endif + +#include + +#ifndef GLAPIENTRY +#if defined(_MSC_VER) || defined(__MINGW32__) +#define GLAPIENTRY __stdcall +#else +#define GLAPIENTRY +#endif +#endif + +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GLAPIENTRY * +#endif + +#if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GLU32) +# undef GLAPI +# define GLAPI __declspec(dllexport) +#elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) +/* tag specifying we're building for DLL runtime support */ +# undef GLAPI +# define GLAPI __declspec(dllimport) +#elif !defined(GLAPI) +/* for use with static link lib build of Win32 edition only */ +# define GLAPI extern +#endif /* _STATIC_MESA support */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*************************************************************/ + +/* Extensions */ +#define GLU_EXT_object_space_tess 1 +#define GLU_EXT_nurbs_tessellator 1 + +/* Boolean */ +#define GLU_FALSE 0 +#define GLU_TRUE 1 + +/* Version */ +#define GLU_VERSION_1_1 1 +#define GLU_VERSION_1_2 1 +#define GLU_VERSION_1_3 1 + +/* StringName */ +#define GLU_VERSION 100800 +#define GLU_EXTENSIONS 100801 + +/* ErrorCode */ +#define GLU_INVALID_ENUM 100900 +#define GLU_INVALID_VALUE 100901 +#define GLU_OUT_OF_MEMORY 100902 +#define GLU_INCOMPATIBLE_GL_VERSION 100903 +#define GLU_INVALID_OPERATION 100904 + +/* NurbsDisplay */ +/* GLU_FILL */ +#define GLU_OUTLINE_POLYGON 100240 +#define GLU_OUTLINE_PATCH 100241 + +/* NurbsCallback */ +#define GLU_NURBS_ERROR 100103 +#define GLU_ERROR 100103 +#define GLU_NURBS_BEGIN 100164 +#define GLU_NURBS_BEGIN_EXT 100164 +#define GLU_NURBS_VERTEX 100165 +#define GLU_NURBS_VERTEX_EXT 100165 +#define GLU_NURBS_NORMAL 100166 +#define GLU_NURBS_NORMAL_EXT 100166 +#define GLU_NURBS_COLOR 100167 +#define GLU_NURBS_COLOR_EXT 100167 +#define GLU_NURBS_TEXTURE_COORD 100168 +#define GLU_NURBS_TEX_COORD_EXT 100168 +#define GLU_NURBS_END 100169 +#define GLU_NURBS_END_EXT 100169 +#define GLU_NURBS_BEGIN_DATA 100170 +#define GLU_NURBS_BEGIN_DATA_EXT 100170 +#define GLU_NURBS_VERTEX_DATA 100171 +#define GLU_NURBS_VERTEX_DATA_EXT 100171 +#define GLU_NURBS_NORMAL_DATA 100172 +#define GLU_NURBS_NORMAL_DATA_EXT 100172 +#define GLU_NURBS_COLOR_DATA 100173 +#define GLU_NURBS_COLOR_DATA_EXT 100173 +#define GLU_NURBS_TEXTURE_COORD_DATA 100174 +#define GLU_NURBS_TEX_COORD_DATA_EXT 100174 +#define GLU_NURBS_END_DATA 100175 +#define GLU_NURBS_END_DATA_EXT 100175 + +/* NurbsError */ +#define GLU_NURBS_ERROR1 100251 +#define GLU_NURBS_ERROR2 100252 +#define GLU_NURBS_ERROR3 100253 +#define GLU_NURBS_ERROR4 100254 +#define GLU_NURBS_ERROR5 100255 +#define GLU_NURBS_ERROR6 100256 +#define GLU_NURBS_ERROR7 100257 +#define GLU_NURBS_ERROR8 100258 +#define GLU_NURBS_ERROR9 100259 +#define GLU_NURBS_ERROR10 100260 +#define GLU_NURBS_ERROR11 100261 +#define GLU_NURBS_ERROR12 100262 +#define GLU_NURBS_ERROR13 100263 +#define GLU_NURBS_ERROR14 100264 +#define GLU_NURBS_ERROR15 100265 +#define GLU_NURBS_ERROR16 100266 +#define GLU_NURBS_ERROR17 100267 +#define GLU_NURBS_ERROR18 100268 +#define GLU_NURBS_ERROR19 100269 +#define GLU_NURBS_ERROR20 100270 +#define GLU_NURBS_ERROR21 100271 +#define GLU_NURBS_ERROR22 100272 +#define GLU_NURBS_ERROR23 100273 +#define GLU_NURBS_ERROR24 100274 +#define GLU_NURBS_ERROR25 100275 +#define GLU_NURBS_ERROR26 100276 +#define GLU_NURBS_ERROR27 100277 +#define GLU_NURBS_ERROR28 100278 +#define GLU_NURBS_ERROR29 100279 +#define GLU_NURBS_ERROR30 100280 +#define GLU_NURBS_ERROR31 100281 +#define GLU_NURBS_ERROR32 100282 +#define GLU_NURBS_ERROR33 100283 +#define GLU_NURBS_ERROR34 100284 +#define GLU_NURBS_ERROR35 100285 +#define GLU_NURBS_ERROR36 100286 +#define GLU_NURBS_ERROR37 100287 + +/* NurbsProperty */ +#define GLU_AUTO_LOAD_MATRIX 100200 +#define GLU_CULLING 100201 +#define GLU_SAMPLING_TOLERANCE 100203 +#define GLU_DISPLAY_MODE 100204 +#define GLU_PARAMETRIC_TOLERANCE 100202 +#define GLU_SAMPLING_METHOD 100205 +#define GLU_U_STEP 100206 +#define GLU_V_STEP 100207 +#define GLU_NURBS_MODE 100160 +#define GLU_NURBS_MODE_EXT 100160 +#define GLU_NURBS_TESSELLATOR 100161 +#define GLU_NURBS_TESSELLATOR_EXT 100161 +#define GLU_NURBS_RENDERER 100162 +#define GLU_NURBS_RENDERER_EXT 100162 + +/* NurbsSampling */ +#define GLU_OBJECT_PARAMETRIC_ERROR 100208 +#define GLU_OBJECT_PARAMETRIC_ERROR_EXT 100208 +#define GLU_OBJECT_PATH_LENGTH 100209 +#define GLU_OBJECT_PATH_LENGTH_EXT 100209 +#define GLU_PATH_LENGTH 100215 +#define GLU_PARAMETRIC_ERROR 100216 +#define GLU_DOMAIN_DISTANCE 100217 + +/* NurbsTrim */ +#define GLU_MAP1_TRIM_2 100210 +#define GLU_MAP1_TRIM_3 100211 + +/* QuadricDrawStyle */ +#define GLU_POINT 100010 +#define GLU_LINE 100011 +#define GLU_FILL 100012 +#define GLU_SILHOUETTE 100013 + +/* QuadricCallback */ +/* GLU_ERROR */ + +/* QuadricNormal */ +#define GLU_SMOOTH 100000 +#define GLU_FLAT 100001 +#define GLU_NONE 100002 + +/* QuadricOrientation */ +#define GLU_OUTSIDE 100020 +#define GLU_INSIDE 100021 + +/* TessCallback */ +#define GLU_TESS_BEGIN 100100 +#define GLU_BEGIN 100100 +#define GLU_TESS_VERTEX 100101 +#define GLU_VERTEX 100101 +#define GLU_TESS_END 100102 +#define GLU_END 100102 +#define GLU_TESS_ERROR 100103 +#define GLU_TESS_EDGE_FLAG 100104 +#define GLU_EDGE_FLAG 100104 +#define GLU_TESS_COMBINE 100105 +#define GLU_TESS_BEGIN_DATA 100106 +#define GLU_TESS_VERTEX_DATA 100107 +#define GLU_TESS_END_DATA 100108 +#define GLU_TESS_ERROR_DATA 100109 +#define GLU_TESS_EDGE_FLAG_DATA 100110 +#define GLU_TESS_COMBINE_DATA 100111 + +/* TessContour */ +#define GLU_CW 100120 +#define GLU_CCW 100121 +#define GLU_INTERIOR 100122 +#define GLU_EXTERIOR 100123 +#define GLU_UNKNOWN 100124 + +/* TessProperty */ +#define GLU_TESS_WINDING_RULE 100140 +#define GLU_TESS_BOUNDARY_ONLY 100141 +#define GLU_TESS_TOLERANCE 100142 + +/* TessError */ +#define GLU_TESS_ERROR1 100151 +#define GLU_TESS_ERROR2 100152 +#define GLU_TESS_ERROR3 100153 +#define GLU_TESS_ERROR4 100154 +#define GLU_TESS_ERROR5 100155 +#define GLU_TESS_ERROR6 100156 +#define GLU_TESS_ERROR7 100157 +#define GLU_TESS_ERROR8 100158 +#define GLU_TESS_MISSING_BEGIN_POLYGON 100151 +#define GLU_TESS_MISSING_BEGIN_CONTOUR 100152 +#define GLU_TESS_MISSING_END_POLYGON 100153 +#define GLU_TESS_MISSING_END_CONTOUR 100154 +#define GLU_TESS_COORD_TOO_LARGE 100155 +#define GLU_TESS_NEED_COMBINE_CALLBACK 100156 + +/* TessWinding */ +#define GLU_TESS_WINDING_ODD 100130 +#define GLU_TESS_WINDING_NONZERO 100131 +#define GLU_TESS_WINDING_POSITIVE 100132 +#define GLU_TESS_WINDING_NEGATIVE 100133 +#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134 + +/*************************************************************/ + + +#ifdef __cplusplus +class GLUnurbs; +class GLUquadric; +class GLUtesselator; +#else +typedef struct GLUnurbs GLUnurbs; +typedef struct GLUquadric GLUquadric; +typedef struct GLUtesselator GLUtesselator; +#endif + +typedef GLUnurbs GLUnurbsObj; +typedef GLUquadric GLUquadricObj; +typedef GLUtesselator GLUtesselatorObj; +typedef GLUtesselator GLUtriangulatorObj; + +#define GLU_TESS_MAX_COORD 1.0e150 + +/* Internal convenience typedefs */ +typedef void (GLAPIENTRYP _GLUfuncptr)(); + +GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluBeginSurface (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluBeginTrim (GLUnurbs* nurb); +GLAPI GLint GLAPIENTRY gluBuild1DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); +GLAPI GLint GLAPIENTRY gluBuild1DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLenum format, GLenum type, const void *data); +GLAPI GLint GLAPIENTRY gluBuild2DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); +GLAPI GLint GLAPIENTRY gluBuild2DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data); +GLAPI GLint GLAPIENTRY gluBuild3DMipmapLevels (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLint level, GLint base, GLint max, const void *data); +GLAPI GLint GLAPIENTRY gluBuild3DMipmaps (GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +GLAPI GLboolean GLAPIENTRY gluCheckExtension (const GLubyte *extName, const GLubyte *extString); +GLAPI void GLAPIENTRY gluCylinder (GLUquadric* quad, GLdouble base, GLdouble top, GLdouble height, GLint slices, GLint stacks); +GLAPI void GLAPIENTRY gluDeleteNurbsRenderer (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluDeleteQuadric (GLUquadric* quad); +GLAPI void GLAPIENTRY gluDeleteTess (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops); +GLAPI void GLAPIENTRY gluEndCurve (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluEndPolygon (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluEndSurface (GLUnurbs* nurb); +GLAPI void GLAPIENTRY gluEndTrim (GLUnurbs* nurb); +GLAPI const GLubyte * GLAPIENTRY gluErrorString (GLenum error); +GLAPI void GLAPIENTRY gluGetNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat* data); +GLAPI const GLubyte * GLAPIENTRY gluGetString (GLenum name); +GLAPI void GLAPIENTRY gluGetTessProperty (GLUtesselator* tess, GLenum which, GLdouble* data); +GLAPI void GLAPIENTRY gluLoadSamplingMatrices (GLUnurbs* nurb, const GLfloat *model, const GLfloat *perspective, const GLint *view); +GLAPI void GLAPIENTRY gluLookAt (GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX, GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY, GLdouble upZ); +GLAPI GLUnurbs* GLAPIENTRY gluNewNurbsRenderer (void); +GLAPI GLUquadric* GLAPIENTRY gluNewQuadric (void); +GLAPI GLUtesselator* GLAPIENTRY gluNewTess (void); +GLAPI void GLAPIENTRY gluNextContour (GLUtesselator* tess, GLenum type); +GLAPI void GLAPIENTRY gluNurbsCallback (GLUnurbs* nurb, GLenum which, _GLUfuncptr CallBackFunc); +GLAPI void GLAPIENTRY gluNurbsCallbackData (GLUnurbs* nurb, GLvoid* userData); +GLAPI void GLAPIENTRY gluNurbsCallbackDataEXT (GLUnurbs* nurb, GLvoid* userData); +GLAPI void GLAPIENTRY gluNurbsCurve (GLUnurbs* nurb, GLint knotCount, GLfloat *knots, GLint stride, GLfloat *control, GLint order, GLenum type); +GLAPI void GLAPIENTRY gluNurbsProperty (GLUnurbs* nurb, GLenum property, GLfloat value); +GLAPI void GLAPIENTRY gluNurbsSurface (GLUnurbs* nurb, GLint sKnotCount, GLfloat* sKnots, GLint tKnotCount, GLfloat* tKnots, GLint sStride, GLint tStride, GLfloat* control, GLint sOrder, GLint tOrder, GLenum type); +GLAPI void GLAPIENTRY gluOrtho2D (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top); +GLAPI void GLAPIENTRY gluPartialDisk (GLUquadric* quad, GLdouble inner, GLdouble outer, GLint slices, GLint loops, GLdouble start, GLdouble sweep); +GLAPI void GLAPIENTRY gluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar); +GLAPI void GLAPIENTRY gluPickMatrix (GLdouble x, GLdouble y, GLdouble delX, GLdouble delY, GLint *viewport); +GLAPI GLint GLAPIENTRY gluProject (GLdouble objX, GLdouble objY, GLdouble objZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* winX, GLdouble* winY, GLdouble* winZ); +GLAPI void GLAPIENTRY gluPwlCurve (GLUnurbs* nurb, GLint count, GLfloat* data, GLint stride, GLenum type); +GLAPI void GLAPIENTRY gluQuadricCallback (GLUquadric* quad, GLenum which, _GLUfuncptr CallBackFunc); +GLAPI void GLAPIENTRY gluQuadricDrawStyle (GLUquadric* quad, GLenum draw); +GLAPI void GLAPIENTRY gluQuadricNormals (GLUquadric* quad, GLenum normal); +GLAPI void GLAPIENTRY gluQuadricOrientation (GLUquadric* quad, GLenum orientation); +GLAPI void GLAPIENTRY gluQuadricTexture (GLUquadric* quad, GLboolean texture); +GLAPI GLint GLAPIENTRY gluScaleImage (GLenum format, GLsizei wIn, GLsizei hIn, GLenum typeIn, const void *dataIn, GLsizei wOut, GLsizei hOut, GLenum typeOut, GLvoid* dataOut); +GLAPI void GLAPIENTRY gluSphere (GLUquadric* quad, GLdouble radius, GLint slices, GLint stacks); +GLAPI void GLAPIENTRY gluTessBeginContour (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluTessBeginPolygon (GLUtesselator* tess, GLvoid* data); +GLAPI void GLAPIENTRY gluTessCallback (GLUtesselator* tess, GLenum which, _GLUfuncptr CallBackFunc); +GLAPI void GLAPIENTRY gluTessEndContour (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluTessEndPolygon (GLUtesselator* tess); +GLAPI void GLAPIENTRY gluTessNormal (GLUtesselator* tess, GLdouble valueX, GLdouble valueY, GLdouble valueZ); +GLAPI void GLAPIENTRY gluTessProperty (GLUtesselator* tess, GLenum which, GLdouble data); +GLAPI void GLAPIENTRY gluTessVertex (GLUtesselator* tess, GLdouble *location, GLvoid* data); +GLAPI GLint GLAPIENTRY gluUnProject (GLdouble winX, GLdouble winY, GLdouble winZ, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble* objX, GLdouble* objY, GLdouble* objZ); +GLAPI GLint GLAPIENTRY gluUnProject4 (GLdouble winX, GLdouble winY, GLdouble winZ, GLdouble clipW, const GLdouble *model, const GLdouble *proj, const GLint *view, GLdouble nearVal, GLdouble farVal, GLdouble* objX, GLdouble* objY, GLdouble* objZ, GLdouble* objW); + +#ifdef __cplusplus +} +#endif + +#endif /* __glu_h__ */ diff --git a/mesalib/include/GL/glu_mangle.h b/mesalib/include/GL/glu_mangle.h new file mode 100644 index 000000000..9c25aa864 --- /dev/null +++ b/mesalib/include/GL/glu_mangle.h @@ -0,0 +1,86 @@ +/* + * Mesa 3-D graphics library + * Version: 3.0 + * Copyright (C) 1995-1998 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef GLU_MANGLE_H +#define GLU_MANGLE_H + + +#define gluLookAt mgluLookAt +#define gluOrtho2D mgluOrtho2D +#define gluPerspective mgluPerspective +#define gluPickMatrix mgluPickMatrix +#define gluProject mgluProject +#define gluUnProject mgluUnProject +#define gluErrorString mgluErrorString +#define gluScaleImage mgluScaleImage +#define gluBuild1DMipmaps mgluBuild1DMipmaps +#define gluBuild2DMipmaps mgluBuild2DMipmaps +#define gluNewQuadric mgluNewQuadric +#define gluDeleteQuadric mgluDeleteQuadric +#define gluQuadricDrawStyle mgluQuadricDrawStyle +#define gluQuadricOrientation mgluQuadricOrientation +#define gluQuadricNormals mgluQuadricNormals +#define gluQuadricTexture mgluQuadricTexture +#define gluQuadricCallback mgluQuadricCallback +#define gluCylinder mgluCylinder +#define gluSphere mgluSphere +#define gluDisk mgluDisk +#define gluPartialDisk mgluPartialDisk +#define gluNewNurbsRenderer mgluNewNurbsRenderer +#define gluDeleteNurbsRenderer mgluDeleteNurbsRenderer +#define gluLoadSamplingMatrices mgluLoadSamplingMatrices +#define gluNurbsProperty mgluNurbsProperty +#define gluGetNurbsProperty mgluGetNurbsProperty +#define gluBeginCurve mgluBeginCurve +#define gluEndCurve mgluEndCurve +#define gluNurbsCurve mgluNurbsCurve +#define gluBeginSurface mgluBeginSurface +#define gluEndSurface mgluEndSurface +#define gluNurbsSurface mgluNurbsSurface +#define gluBeginTrim mgluBeginTrim +#define gluEndTrim mgluEndTrim +#define gluPwlCurve mgluPwlCurve +#define gluNurbsCallback mgluNurbsCallback +#define gluNewTess mgluNewTess +#define gluDeleteTess mgluDeleteTess +#define gluTessBeginPolygon mgluTessBeginPolygon +#define gluTessBeginContour mgluTessBeginContour +#define gluTessVertex mgluTessVertex +#define gluTessEndPolygon mgluTessEndPolygon +#define gluTessEndContour mgluTessEndContour +#define gluTessProperty mgluTessProperty +#define gluTessNormal mgluTessNormal +#define gluTessCallback mgluTessCallback +#define gluGetTessProperty mgluGetTessProperty +#define gluBeginPolygon mgluBeginPolygon +#define gluNextContour mgluNextContour +#define gluEndPolygon mgluEndPolygon +#define gluGetString mgluGetString +#define gluBuild1DMipmapLevels mgluBuild1DMipmapLevels +#define gluBuild2DMipmapLevels mgluBuild2DMipmapLevels +#define gluBuild3DMipmapLevels mgluBuild3DMipmapLevels +#define gluBuild3DMipmaps mgluBuild3DMipmaps +#define gluCheckExtension mgluCheckExtension +#define gluUnProject4 mgluUnProject4 +#define gluNurbsCallbackData mgluNurbsCallbackData +#define gluNurbsCallbackDataEXT mgluNurbsCallbackDataEXT + +#endif diff --git a/mesalib/include/GL/glx.h b/mesalib/include/GL/glx.h new file mode 100644 index 000000000..288440140 --- /dev/null +++ b/mesalib/include/GL/glx.h @@ -0,0 +1,519 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef GLX_H +#define GLX_H + + +#ifdef __VMS +#include +# ifdef __cplusplus +/* VMS Xlib.h gives problems with C++. + * this avoids a bunch of trivial warnings */ +#pragma message disable nosimpint +#endif +#endif +#include +#include +#ifdef __VMS +# ifdef __cplusplus +#pragma message enable nosimpint +#endif +#endif +#include + + +#if defined(USE_MGL_NAMESPACE) +#include "glx_mangle.h" +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +#define GLX_VERSION_1_1 1 +#define GLX_VERSION_1_2 1 +#define GLX_VERSION_1_3 1 +#define GLX_VERSION_1_4 1 + +#define GLX_EXTENSION_NAME "GLX" + + + +/* + * Tokens for glXChooseVisual and glXGetConfig: + */ +#define GLX_USE_GL 1 +#define GLX_BUFFER_SIZE 2 +#define GLX_LEVEL 3 +#define GLX_RGBA 4 +#define GLX_DOUBLEBUFFER 5 +#define GLX_STEREO 6 +#define GLX_AUX_BUFFERS 7 +#define GLX_RED_SIZE 8 +#define GLX_GREEN_SIZE 9 +#define GLX_BLUE_SIZE 10 +#define GLX_ALPHA_SIZE 11 +#define GLX_DEPTH_SIZE 12 +#define GLX_STENCIL_SIZE 13 +#define GLX_ACCUM_RED_SIZE 14 +#define GLX_ACCUM_GREEN_SIZE 15 +#define GLX_ACCUM_BLUE_SIZE 16 +#define GLX_ACCUM_ALPHA_SIZE 17 + + +/* + * Error codes returned by glXGetConfig: + */ +#define GLX_BAD_SCREEN 1 +#define GLX_BAD_ATTRIBUTE 2 +#define GLX_NO_EXTENSION 3 +#define GLX_BAD_VISUAL 4 +#define GLX_BAD_CONTEXT 5 +#define GLX_BAD_VALUE 6 +#define GLX_BAD_ENUM 7 + + +/* + * GLX 1.1 and later: + */ +#define GLX_VENDOR 1 +#define GLX_VERSION 2 +#define GLX_EXTENSIONS 3 + + +/* + * GLX 1.3 and later: + */ +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 + + +/* + * GLX 1.4 and later: + */ +#define GLX_SAMPLE_BUFFERS 0x186a0 /*100000*/ +#define GLX_SAMPLES 0x186a1 /*100001*/ + + + +typedef struct __GLXcontextRec *GLXContext; +typedef XID GLXPixmap; +typedef XID GLXDrawable; +/* GLX 1.3 and later */ +typedef struct __GLXFBConfigRec *GLXFBConfig; +typedef XID GLXFBConfigID; +typedef XID GLXContextID; +typedef XID GLXWindow; +typedef XID GLXPbuffer; + + + +extern XVisualInfo* glXChooseVisual( Display *dpy, int screen, + int *attribList ); + +extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis, + GLXContext shareList, Bool direct ); + +extern void glXDestroyContext( Display *dpy, GLXContext ctx ); + +extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable, + GLXContext ctx); + +extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, + unsigned long mask ); + +extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable ); + +extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual, + Pixmap pixmap ); + +extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ); + +extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event ); + +extern Bool glXQueryVersion( Display *dpy, int *maj, int *min ); + +extern Bool glXIsDirect( Display *dpy, GLXContext ctx ); + +extern int glXGetConfig( Display *dpy, XVisualInfo *visual, + int attrib, int *value ); + +extern GLXContext glXGetCurrentContext( void ); + +extern GLXDrawable glXGetCurrentDrawable( void ); + +extern void glXWaitGL( void ); + +extern void glXWaitX( void ); + +extern void glXUseXFont( Font font, int first, int count, int list ); + + + +/* GLX 1.1 and later */ +extern const char *glXQueryExtensionsString( Display *dpy, int screen ); + +extern const char *glXQueryServerString( Display *dpy, int screen, int name ); + +extern const char *glXGetClientString( Display *dpy, int name ); + + +/* GLX 1.2 and later */ +extern Display *glXGetCurrentDisplay( void ); + + +/* GLX 1.3 and later */ +extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen, + const int *attribList, int *nitems ); + +extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, + int attribute, int *value ); + +extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen, + int *nelements ); + +extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy, + GLXFBConfig config ); + +extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config, + Window win, const int *attribList ); + +extern void glXDestroyWindow( Display *dpy, GLXWindow window ); + +extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config, + Pixmap pixmap, const int *attribList ); + +extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap ); + +extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config, + const int *attribList ); + +extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ); + +extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, + unsigned int *value ); + +extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config, + int renderType, GLXContext shareList, + Bool direct ); + +extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw, + GLXDrawable read, GLXContext ctx ); + +extern GLXDrawable glXGetCurrentReadDrawable( void ); + +extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute, + int *value ); + +extern void glXSelectEvent( Display *dpy, GLXDrawable drawable, + unsigned long mask ); + +extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, + unsigned long *mask ); + +/* GLX 1.3 function pointer typedefs */ +typedef GLXFBConfig * (* PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef GLXWindow (* PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void (* PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef void (* PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef void (* PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void (* PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef Bool (* PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable (* PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef Display * (* PFNGLXGETCURRENTDISPLAYPROC) (void); +typedef int (* PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void (* PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); +typedef void (* PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); + + +/* + * ARB 2. GLX_ARB_get_proc_address + */ +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 + +typedef void (*__GLXextFuncPtr)(void); +extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); + +#endif /* GLX_ARB_get_proc_address */ + + + +/* GLX 1.4 and later */ +extern void (*glXGetProcAddress(const GLubyte *procname))( void ); + +/* GLX 1.4 function pointer typedefs */ +typedef __GLXextFuncPtr (* PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); + + +#ifndef GLX_GLXEXT_LEGACY + +#include + +#endif /* GLX_GLXEXT_LEGACY */ + + +/** + ** The following aren't in glxext.h yet. + **/ + + +/* + * ???. GLX_NV_vertex_array_range + */ +#ifndef GLX_NV_vertex_array_range +#define GLX_NV_vertex_array_range + +extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +extern void glXFreeMemoryNV(GLvoid *pointer); +typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer); + +#endif /* GLX_NV_vertex_array_range */ + + +/* + * ???. GLX_MESA_allocate_memory + */ +#ifndef GLX_MESA_allocate_memory +#define GLX_MESA_allocate_memory 1 + +extern void *glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority); +extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer); +extern GLuint glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer); +typedef void * ( * PFNGLXALLOCATEMEMORYMESAPROC) (Display *dpy, int scrn, size_t size, float readfreq, float writefreq, float priority); +typedef void ( * PFNGLXFREEMEMORYMESAPROC) (Display *dpy, int scrn, void *pointer); +typedef GLuint (* PFNGLXGETMEMORYOFFSETMESAPROC) (Display *dpy, int scrn, const void *pointer); + +#endif /* GLX_MESA_allocate_memory */ + + +/* + * ARB ?. GLX_ARB_render_texture + * XXX This was never finalized! + */ +#ifndef GLX_ARB_render_texture +#define GLX_ARB_render_texture 1 + +extern Bool glXBindTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer); +extern Bool glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer); +extern Bool glXDrawableAttribARB(Display *dpy, GLXDrawable draw, const int *attribList); + +#endif /* GLX_ARB_render_texture */ + + +/* + * Remove this when glxext.h is updated. + */ +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 + +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 + +#endif /* GLX_NV_float_buffer */ + + + +/* + * #?. GLX_MESA_swap_frame_usage + */ +#ifndef GLX_MESA_swap_frame_usage +#define GLX_MESA_swap_frame_usage 1 + +extern int glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, float *usage); +extern int glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable); +extern int glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable); +extern int glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage); + +typedef int (*PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, float *usage); +typedef int (*PFNGLXBEGINFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable); +typedef int (*PFNGLXENDFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable); +typedef int (*PFNGLXQUERYFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage); + +#endif /* GLX_MESA_swap_frame_usage */ + + + +/* + * #?. GLX_MESA_swap_control + */ +#ifndef GLX_MESA_swap_control +#define GLX_MESA_swap_control 1 + +extern int glXSwapIntervalMESA(unsigned int interval); +extern int glXGetSwapIntervalMESA(void); + +typedef int (*PFNGLXSWAPINTERVALMESAPROC)(unsigned int interval); +typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void); + +#endif /* GLX_MESA_swap_control */ + + + +/* + * #?. GLX_EXT_texture_from_pixmap + * XXX not finished? + */ +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_EXT_texture_from_pixmap 1 + +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 + +#define GLX_TEXTURE_FORMAT_EXT 0x20D5 +#define GLX_TEXTURE_TARGET_EXT 0x20D6 +#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 + +#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 +#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 +#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA + +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 + +#define GLX_TEXTURE_1D_EXT 0x20DB +#define GLX_TEXTURE_2D_EXT 0x20DC +#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD + +#define GLX_FRONT_LEFT_EXT 0x20DE +#define GLX_FRONT_RIGHT_EXT 0x20DF +#define GLX_BACK_LEFT_EXT 0x20E0 +#define GLX_BACK_RIGHT_EXT 0x20E1 +#define GLX_FRONT_EXT GLX_FRONT_LEFT_EXT +#define GLX_BACK_EXT GLX_BACK_LEFT_EXT +#define GLX_AUX0_EXT 0x20E2 +#define GLX_AUX1_EXT 0x20E3 +#define GLX_AUX2_EXT 0x20E4 +#define GLX_AUX3_EXT 0x20E5 +#define GLX_AUX4_EXT 0x20E6 +#define GLX_AUX5_EXT 0x20E7 +#define GLX_AUX6_EXT 0x20E8 +#define GLX_AUX7_EXT 0x20E9 +#define GLX_AUX8_EXT 0x20EA +#define GLX_AUX9_EXT 0x20EB + +extern void glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); +extern void glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer); + +#endif /* GLX_EXT_texture_from_pixmap */ + + + + +/*** Should these go here, or in another header? */ +/* +** GLX Events +*/ +typedef struct { + int event_type; /* GLX_DAMAGED or GLX_SAVED */ + int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* XID of Drawable */ + unsigned int buffer_mask; /* mask indicating which buffers are affected */ + unsigned int aux_buffer; /* which aux buffer was affected */ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXPbufferClobberEvent; + +typedef union __GLXEvent { + GLXPbufferClobberEvent glxpbufferclobber; + long pad[24]; +} GLXEvent; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/include/GL/glx_mangle.h b/mesalib/include/GL/glx_mangle.h new file mode 100644 index 000000000..4439a96b5 --- /dev/null +++ b/mesalib/include/GL/glx_mangle.h @@ -0,0 +1,81 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef GLX_MANGLE_H +#define GLX_MANGLE_H + +#define glXChooseVisual mglXChooseVisual +#define glXCreateContext mglXCreateContext +#define glXDestroyContext mglXDestroyContext +#define glXMakeCurrent mglXMakeCurrent +#define glXCopyContext mglXCopyContext +#define glXSwapBuffers mglXSwapBuffers +#define glXCreateGLXPixmap mglXCreateGLXPixmap +#define glXDestroyGLXPixmap mglXDestroyGLXPixmap +#define glXQueryExtension mglXQueryExtension +#define glXQueryVersion mglXQueryVersion +#define glXIsDirect mglXIsDirect +#define glXGetConfig mglXGetConfig +#define glXGetCurrentContext mglXGetCurrentContext +#define glXGetCurrentDrawable mglXGetCurrentDrawable +#define glXWaitGL mglXWaitGL +#define glXWaitX mglXWaitX +#define glXUseXFont mglXUseXFont +#define glXQueryExtensionsString mglXQueryExtensionsString +#define glXQueryServerString mglXQueryServerString +#define glXGetClientString mglXGetClientString +#define glXCreateGLXPixmapMESA mglXCreateGLXPixmapMESA +#define glXReleaseBuffersMESA mglXReleaseBuffersMESA +#define glXCopySubBufferMESA mglXCopySubBufferMESA +#define glXGetVideoSyncSGI mglXGetVideoSyncSGI +#define glXWaitVideoSyncSGI mglXWaitVideoSyncSGI + +/* GLX 1.2 */ +#define glXGetCurrentDisplay mglXGetCurrentDisplay + +/* GLX 1.3 */ +#define glXChooseFBConfig mglXChooseFBConfig +#define glXGetFBConfigAttrib mglXGetFBConfigAttrib +#define glXGetFBConfigs mglXGetFBConfigs +#define glXGetVisualFromFBConfig mglXGetVisualFromFBConfig +#define glXCreateWindow mglXCreateWindow +#define glXDestroyWindow mglXDestroyWindow +#define glXCreatePixmap mglXCreatePixmap +#define glXDestroyPixmap mglXDestroyPixmap +#define glXCreatePbuffer mglXCreatePbuffer +#define glXDestroyPbuffer mglXDestroyPbuffer +#define glXQueryDrawable mglXQueryDrawable +#define glXCreateNewContext mglXCreateNewContext +#define glXMakeContextCurrent mglXMakeContextCurrent +#define glXGetCurrentReadDrawable mglXGetCurrentReadDrawable +#define glXQueryContext mglXQueryContext +#define glXSelectEvent mglXSelectEvent +#define glXGetSelectedEvent mglXGetSelectedEvent + +/* GLX 1.4 */ +#define glXGetProcAddress mglXGetProcAddress + + +#endif diff --git a/mesalib/include/GL/glxext.h b/mesalib/include/GL/glxext.h new file mode 100644 index 000000000..eac09f94f --- /dev/null +++ b/mesalib/include/GL/glxext.h @@ -0,0 +1,845 @@ +#ifndef __glxext_h_ +#define __glxext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Function declaration macros - to move into glplatform.h */ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number, required by OpenGL ABI for Linux */ +/* glxext.h last updated 2009/08/03 */ +/* Current version at http://www.opengl.org/registry/ */ +#define GLX_GLXEXT_VERSION 23 + +#ifndef GLX_VERSION_1_3 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_CONFIG_CAVEAT 0x20 +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DONT_CARE 0xFFFFFFFF +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_VISUAL_ID 0x800B +#define GLX_SCREEN 0x800C +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_PBUFFER_HEIGHT 0x8040 +#define GLX_PBUFFER_WIDTH 0x8041 +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_SAMPLE_BUFFERS 100000 +#define GLX_SAMPLES 100001 +#endif + +#ifndef GLX_ARB_get_proc_address +#endif + +#ifndef GLX_ARB_multisample +#define GLX_SAMPLE_BUFFERS_ARB 100000 +#define GLX_SAMPLES_ARB 100001 +#endif + +#ifndef GLX_ARB_fbconfig_float +#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9 +#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004 +#endif + +#ifndef GLX_ARB_create_context +#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define GLX_CONTEXT_FLAGS_ARB 0x2094 +#endif + +#ifndef GLX_ARB_create_context_profile +#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SAMPLE_BUFFERS_SGIS 100000 +#define GLX_SAMPLES_SGIS 100001 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_X_VISUAL_TYPE_EXT 0x22 +#define GLX_TRANSPARENT_TYPE_EXT 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 +#define GLX_NONE_EXT 0x8000 +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 +#endif + +#ifndef GLX_SGI_swap_control +#endif + +#ifndef GLX_SGI_video_sync +#endif + +#ifndef GLX_SGI_make_current_read +#endif + +#ifndef GLX_SGIX_video_source +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_VISUAL_CAVEAT_EXT 0x20 +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D +/* reuse GLX_NONE_EXT */ +#endif + +#ifndef GLX_EXT_import_context +#define GLX_SHARE_CONTEXT_EXT 0x800A +#define GLX_VISUAL_ID_EXT 0x800B +#define GLX_SCREEN_EXT 0x800C +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_WINDOW_BIT_SGIX 0x00000001 +#define GLX_PIXMAP_BIT_SGIX 0x00000002 +#define GLX_RGBA_BIT_SGIX 0x00000001 +#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002 +#define GLX_DRAWABLE_TYPE_SGIX 0x8010 +#define GLX_RENDER_TYPE_SGIX 0x8011 +#define GLX_X_RENDERABLE_SGIX 0x8012 +#define GLX_FBCONFIG_ID_SGIX 0x8013 +#define GLX_RGBA_TYPE_SGIX 0x8014 +#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015 +/* reuse GLX_SCREEN_EXT */ +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_PBUFFER_BIT_SGIX 0x00000004 +#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008 +#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010 +#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020 +#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040 +#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080 +#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100 +#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017 +#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018 +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A +#define GLX_PRESERVED_CONTENTS_SGIX 0x801B +#define GLX_LARGEST_PBUFFER_SGIX 0x801C +#define GLX_WIDTH_SGIX 0x801D +#define GLX_HEIGHT_SGIX 0x801E +#define GLX_EVENT_MASK_SGIX 0x801F +#define GLX_DAMAGED_SGIX 0x8020 +#define GLX_SAVED_SGIX 0x8021 +#define GLX_WINDOW_SGIX 0x8022 +#define GLX_PBUFFER_SGIX 0x8023 +#endif + +#ifndef GLX_SGI_cushion +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SYNC_FRAME_SGIX 0x00000000 +#define GLX_SYNC_SWAP_SGIX 0x00000001 +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024 +#endif + +#ifndef GLX_SGIX_swap_group +#endif + +#ifndef GLX_SGIX_swap_barrier +#endif + +#ifndef GLX_SGIS_blended_overlay +#define GLX_BLENDED_RGBA_SGIS 0x8025 +#endif + +#ifndef GLX_SGIS_shared_multisample +#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026 +#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027 +#endif + +#ifndef GLX_SUN_get_transparent_index +#endif + +#ifndef GLX_3DFX_multisample +#define GLX_SAMPLE_BUFFERS_3DFX 0x8050 +#define GLX_SAMPLES_3DFX 0x8051 +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#endif + +#ifndef GLX_MESA_pixmap_colormap +#endif + +#ifndef GLX_MESA_release_buffers +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_3DFX_WINDOW_MODE_MESA 0x1 +#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2 +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 +#endif + +#ifndef GLX_OML_sync_control +#endif + +#ifndef GLX_NV_float_buffer +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 +#endif + +#ifndef GLX_SGIX_hyperpipe +#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80 +#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91 +#define GLX_BAD_HYPERPIPE_SGIX 92 +#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001 +#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002 +#define GLX_PIPE_RECT_SGIX 0x00000001 +#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002 +#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003 +#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004 +#define GLX_HYPERPIPE_ID_SGIX 0x8030 +#endif + +#ifndef GLX_MESA_agp_offset +#endif + +#ifndef GLX_EXT_fbconfig_packed_float +#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1 +#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008 +#endif + +#ifndef GLX_EXT_framebuffer_sRGB +#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2 +#endif + +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 +#define GLX_TEXTURE_FORMAT_EXT 0x20D5 +#define GLX_TEXTURE_TARGET_EXT 0x20D6 +#define GLX_MIPMAP_TEXTURE_EXT 0x20D7 +#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 +#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 +#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA +#define GLX_TEXTURE_1D_EXT 0x20DB +#define GLX_TEXTURE_2D_EXT 0x20DC +#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD +#define GLX_FRONT_LEFT_EXT 0x20DE +#define GLX_FRONT_RIGHT_EXT 0x20DF +#define GLX_BACK_LEFT_EXT 0x20E0 +#define GLX_BACK_RIGHT_EXT 0x20E1 +#define GLX_FRONT_EXT GLX_FRONT_LEFT_EXT +#define GLX_BACK_EXT GLX_BACK_LEFT_EXT +#define GLX_AUX0_EXT 0x20E2 +#define GLX_AUX1_EXT 0x20E3 +#define GLX_AUX2_EXT 0x20E4 +#define GLX_AUX3_EXT 0x20E5 +#define GLX_AUX4_EXT 0x20E6 +#define GLX_AUX5_EXT 0x20E7 +#define GLX_AUX6_EXT 0x20E8 +#define GLX_AUX7_EXT 0x20E9 +#define GLX_AUX8_EXT 0x20EA +#define GLX_AUX9_EXT 0x20EB +#endif + +#ifndef GLX_NV_present_video +#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0 +#endif + +#ifndef GLX_NV_video_out +#define GLX_VIDEO_OUT_COLOR_NV 0x20C3 +#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4 +#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5 +#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define GLX_VIDEO_OUT_FRAME_NV 0x20C8 +#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9 +#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA +#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB +#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC +#endif + +#ifndef GLX_NV_swap_group +#endif + + +/*************************************************************/ + +#ifndef GLX_ARB_get_proc_address +typedef void (*__GLXextFuncPtr)(void); +#endif + +#ifndef GLX_SGIX_video_source +typedef XID GLXVideoSourceSGIX; +#endif + +#ifndef GLX_SGIX_fbconfig +typedef XID GLXFBConfigIDSGIX; +typedef struct __GLXFBConfigRec *GLXFBConfigSGIX; +#endif + +#ifndef GLX_SGIX_pbuffer +typedef XID GLXPbufferSGIX; +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came for SendEvent request */ + Display *display; /* display the event was read from */ + GLXDrawable drawable; /* i.d. of Drawable */ + int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */ + int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */ + unsigned int mask; /* mask indicating which buffers are affected*/ + int x, y; + int width, height; + int count; /* if nonzero, at least this many more */ +} GLXBufferClobberEventSGIX; +#endif + +#ifndef GLEXT_64_TYPES_DEFINED +/* This code block is duplicated in glext.h, so must be protected */ +#define GLEXT_64_TYPES_DEFINED +/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ +/* (as used in the GLX_OML_sync_control extension). */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#include +#elif defined(__sun__) || defined(__digital__) +#include +#if defined(__STDC__) +#if defined(__arch64__) || defined(_LP64) +typedef long int int64_t; +typedef unsigned long int uint64_t; +#else +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#endif /* __arch64__ */ +#endif /* __STDC__ */ +#elif defined( __VMS ) || defined(__sgi) +#include +#elif defined(__SCO__) || defined(__USLC__) +#include +#elif defined(__UNIXOS2__) || defined(__SOL64__) +typedef long int int32_t; +typedef long long int int64_t; +typedef unsigned long long int uint64_t; +#elif defined(_WIN32) && defined(__GNUC__) +#include +#elif defined(_WIN32) +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; +#else +#include /* Fallback option */ +#endif +#endif + +#ifndef GLX_VERSION_1_3 +#define GLX_VERSION_1_3 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXFBConfig * glXGetFBConfigs (Display *, int, int *); +extern GLXFBConfig * glXChooseFBConfig (Display *, int, const int *, int *); +extern int glXGetFBConfigAttrib (Display *, GLXFBConfig, int, int *); +extern XVisualInfo * glXGetVisualFromFBConfig (Display *, GLXFBConfig); +extern GLXWindow glXCreateWindow (Display *, GLXFBConfig, Window, const int *); +extern void glXDestroyWindow (Display *, GLXWindow); +extern GLXPixmap glXCreatePixmap (Display *, GLXFBConfig, Pixmap, const int *); +extern void glXDestroyPixmap (Display *, GLXPixmap); +extern GLXPbuffer glXCreatePbuffer (Display *, GLXFBConfig, const int *); +extern void glXDestroyPbuffer (Display *, GLXPbuffer); +extern void glXQueryDrawable (Display *, GLXDrawable, int, unsigned int *); +extern GLXContext glXCreateNewContext (Display *, GLXFBConfig, int, GLXContext, Bool); +extern Bool glXMakeContextCurrent (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawable (void); +extern Display * glXGetCurrentDisplay (void); +extern int glXQueryContext (Display *, GLXContext, int, int *); +extern void glXSelectEvent (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEvent (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXFBConfig * ( * PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); +typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); +typedef int ( * PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); +typedef GLXWindow ( * PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); +typedef void ( * PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); +typedef GLXPixmap ( * PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); +typedef GLXPbuffer ( * PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); +typedef void ( * PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); +typedef void ( * PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); +typedef GLXContext ( * PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); +typedef Bool ( * PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLEPROC) (void); +typedef Display * ( * PFNGLXGETCURRENTDISPLAYPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); +typedef void ( * PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); +typedef void ( * PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); +#endif + +#ifndef GLX_VERSION_1_4 +#define GLX_VERSION_1_4 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_get_proc_address +#define GLX_ARB_get_proc_address 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName); +#endif + +#ifndef GLX_ARB_multisample +#define GLX_ARB_multisample 1 +#endif + +#ifndef GLX_ARB_fbconfig_float +#define GLX_ARB_fbconfig_float 1 +#endif + +#ifndef GLX_ARB_create_context +#define GLX_ARB_create_context 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXContext glXCreateContextAttribsARB (Display *, GLXFBConfig, GLXContext, Bool, const int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXContext ( * PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list); +#endif + +#ifndef GLX_ARB_create_context_profile +#define GLX_ARB_create_context_profile 1 +#endif + +#ifndef GLX_SGIS_multisample +#define GLX_SGIS_multisample 1 +#endif + +#ifndef GLX_EXT_visual_info +#define GLX_EXT_visual_info 1 +#endif + +#ifndef GLX_SGI_swap_control +#define GLX_SGI_swap_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXSwapIntervalSGI (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval); +#endif + +#ifndef GLX_SGI_video_sync +#define GLX_SGI_video_sync 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetVideoSyncSGI (unsigned int *); +extern int glXWaitVideoSyncSGI (int, int, unsigned int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count); +typedef int ( * PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count); +#endif + +#ifndef GLX_SGI_make_current_read +#define GLX_SGI_make_current_read 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXMakeCurrentReadSGI (Display *, GLXDrawable, GLXDrawable, GLXContext); +extern GLXDrawable glXGetCurrentReadDrawableSGI (void); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); +typedef GLXDrawable ( * PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void); +#endif + +#ifndef GLX_SGIX_video_source +#define GLX_SGIX_video_source 1 +#ifdef _VL_H +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *, int, VLServer, VLPath, int, VLNode); +extern void glXDestroyGLXVideoSourceSGIX (Display *, GLXVideoSourceSGIX); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXVideoSourceSGIX ( * PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode); +typedef void ( * PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource); +#endif /* _VL_H */ +#endif + +#ifndef GLX_EXT_visual_rating +#define GLX_EXT_visual_rating 1 +#endif + +#ifndef GLX_EXT_import_context +#define GLX_EXT_import_context 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Display * glXGetCurrentDisplayEXT (void); +extern int glXQueryContextInfoEXT (Display *, GLXContext, int, int *); +extern GLXContextID glXGetContextIDEXT (const GLXContext); +extern GLXContext glXImportContextEXT (Display *, GLXContextID); +extern void glXFreeContextEXT (Display *, GLXContext); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Display * ( * PFNGLXGETCURRENTDISPLAYEXTPROC) (void); +typedef int ( * PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value); +typedef GLXContextID ( * PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context); +typedef GLXContext ( * PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID); +typedef void ( * PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context); +#endif + +#ifndef GLX_SGIX_fbconfig +#define GLX_SGIX_fbconfig 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXGetFBConfigAttribSGIX (Display *, GLXFBConfigSGIX, int, int *); +extern GLXFBConfigSGIX * glXChooseFBConfigSGIX (Display *, int, int *, int *); +extern GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *, GLXFBConfigSGIX, Pixmap); +extern GLXContext glXCreateContextWithConfigSGIX (Display *, GLXFBConfigSGIX, int, GLXContext, Bool); +extern XVisualInfo * glXGetVisualFromFBConfigSGIX (Display *, GLXFBConfigSGIX); +extern GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *, XVisualInfo *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value); +typedef GLXFBConfigSGIX * ( * PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements); +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap); +typedef GLXContext ( * PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct); +typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config); +typedef GLXFBConfigSGIX ( * PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis); +#endif + +#ifndef GLX_SGIX_pbuffer +#define GLX_SGIX_pbuffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *); +extern void glXDestroyGLXPbufferSGIX (Display *, GLXPbufferSGIX); +extern int glXQueryGLXPbufferSGIX (Display *, GLXPbufferSGIX, int, unsigned int *); +extern void glXSelectEventSGIX (Display *, GLXDrawable, unsigned long); +extern void glXGetSelectedEventSGIX (Display *, GLXDrawable, unsigned long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPbufferSGIX ( * PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list); +typedef void ( * PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf); +typedef int ( * PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value); +typedef void ( * PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask); +typedef void ( * PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask); +#endif + +#ifndef GLX_SGI_cushion +#define GLX_SGI_cushion 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCushionSGI (Display *, Window, float); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion); +#endif + +#ifndef GLX_SGIX_video_resize +#define GLX_SGIX_video_resize 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern int glXBindChannelToWindowSGIX (Display *, int, int, Window); +extern int glXChannelRectSGIX (Display *, int, int, int, int, int, int); +extern int glXQueryChannelRectSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXQueryChannelDeltasSGIX (Display *, int, int, int *, int *, int *, int *); +extern int glXChannelRectSyncSGIX (Display *, int, int, GLenum); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef int ( * PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window); +typedef int ( * PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h); +typedef int ( * PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh); +typedef int ( * PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h); +typedef int ( * PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype); +#endif + +#ifndef GLX_SGIX_dmbuffer +#define GLX_SGIX_dmbuffer 1 +#ifdef _DM_BUFFER_H_ +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXAssociateDMPbufferSGIX (Display *, GLXPbufferSGIX, DMparams *, DMbuffer); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer); +#endif /* _DM_BUFFER_H_ */ +#endif + +#ifndef GLX_SGIX_swap_group +#define GLX_SGIX_swap_group 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXJoinSwapGroupSGIX (Display *, GLXDrawable, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member); +#endif + +#ifndef GLX_SGIX_swap_barrier +#define GLX_SGIX_swap_barrier 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXBindSwapBarrierSGIX (Display *, GLXDrawable, int); +extern Bool glXQueryMaxSwapBarriersSGIX (Display *, int, int *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier); +typedef Bool ( * PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max); +#endif + +#ifndef GLX_SUN_get_transparent_index +#define GLX_SUN_get_transparent_index 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Status glXGetTransparentIndexSUN (Display *, Window, Window, long *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Status ( * PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex); +#endif + +#ifndef GLX_MESA_copy_sub_buffer +#define GLX_MESA_copy_sub_buffer 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXCopySubBufferMESA (Display *, GLXDrawable, int, int, int, int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height); +#endif + +#ifndef GLX_MESA_pixmap_colormap +#define GLX_MESA_pixmap_colormap 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXPixmap glXCreateGLXPixmapMESA (Display *, XVisualInfo *, Pixmap, Colormap); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXPixmap ( * PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap); +#endif + +#ifndef GLX_MESA_release_buffers +#define GLX_MESA_release_buffers 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXReleaseBuffersMESA (Display *, GLXDrawable); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable); +#endif + +#ifndef GLX_MESA_set_3dfx_mode +#define GLX_MESA_set_3dfx_mode 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXSet3DfxModeMESA (int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXSET3DFXMODEMESAPROC) (int mode); +#endif + +#ifndef GLX_SGIX_visual_select_group +#define GLX_SGIX_visual_select_group 1 +#endif + +#ifndef GLX_OML_swap_method +#define GLX_OML_swap_method 1 +#endif + +#ifndef GLX_OML_sync_control +#define GLX_OML_sync_control 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern Bool glXGetSyncValuesOML (Display *, GLXDrawable, int64_t *, int64_t *, int64_t *); +extern Bool glXGetMscRateOML (Display *, GLXDrawable, int32_t *, int32_t *); +extern int64_t glXSwapBuffersMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t); +extern Bool glXWaitForMscOML (Display *, GLXDrawable, int64_t, int64_t, int64_t, int64_t *, int64_t *, int64_t *); +extern Bool glXWaitForSbcOML (Display *, GLXDrawable, int64_t, int64_t *, int64_t *, int64_t *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef Bool ( * PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator); +typedef int64_t ( * PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder); +typedef Bool ( * PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc); +typedef Bool ( * PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc); +#endif + +#ifndef GLX_NV_float_buffer +#define GLX_NV_float_buffer 1 +#endif + +#ifndef GLX_SGIX_hyperpipe +#define GLX_SGIX_hyperpipe 1 + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int networkId; +} GLXHyperpipeNetworkSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int channel; + unsigned int + participationType; + int timeSlice; +} GLXHyperpipeConfigSGIX; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int srcXOrigin, srcYOrigin, srcWidth, srcHeight; + int destXOrigin, destYOrigin, destWidth, destHeight; +} GLXPipeRect; + +typedef struct { + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int XOrigin, YOrigin, maxHeight, maxWidth; +} GLXPipeRectLimits; + +#ifdef GLX_GLXEXT_PROTOTYPES +extern GLXHyperpipeNetworkSGIX * glXQueryHyperpipeNetworkSGIX (Display *, int *); +extern int glXHyperpipeConfigSGIX (Display *, int, int, GLXHyperpipeConfigSGIX *, int *); +extern GLXHyperpipeConfigSGIX * glXQueryHyperpipeConfigSGIX (Display *, int, int *); +extern int glXDestroyHyperpipeConfigSGIX (Display *, int); +extern int glXBindHyperpipeSGIX (Display *, int); +extern int glXQueryHyperpipeBestAttribSGIX (Display *, int, int, int, void *, void *); +extern int glXHyperpipeAttribSGIX (Display *, int, int, int, void *); +extern int glXQueryHyperpipeAttribSGIX (Display *, int, int, int, void *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef GLXHyperpipeNetworkSGIX * ( * PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes); +typedef int ( * PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId); +typedef GLXHyperpipeConfigSGIX * ( * PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes); +typedef int ( * PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); +typedef int ( * PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList); +typedef int ( * PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList); +typedef int ( * PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList); +#endif + +#ifndef GLX_MESA_agp_offset +#define GLX_MESA_agp_offset 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern unsigned int glXGetAGPOffsetMESA (const void *); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer); +#endif + +#ifndef GLX_EXT_fbconfig_packed_float +#define GLX_EXT_fbconfig_packed_float 1 +#endif + +#ifndef GLX_EXT_framebuffer_sRGB +#define GLX_EXT_framebuffer_sRGB 1 +#endif + +#ifndef GLX_EXT_texture_from_pixmap +#define GLX_EXT_texture_from_pixmap 1 +#ifdef GLX_GLXEXT_PROTOTYPES +extern void glXBindTexImageEXT (Display *, GLXDrawable, int, const int *); +extern void glXReleaseTexImageEXT (Display *, GLXDrawable, int); +#endif /* GLX_GLXEXT_PROTOTYPES */ +typedef void ( * PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list); +typedef void ( * PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer); +#endif + +#ifndef GLX_NV_present_video +#define GLX_NV_present_video 1 +#endif + +#ifndef GLX_NV_video_out +#define GLX_NV_video_out 1 +#endif + +#ifndef GLX_NV_swap_group +#define GLX_NV_swap_group 1 +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/include/GL/internal/dri_interface.h b/mesalib/include/GL/internal/dri_interface.h new file mode 100644 index 000000000..910c9166b --- /dev/null +++ b/mesalib/include/GL/internal/dri_interface.h @@ -0,0 +1,737 @@ +/* + * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2007-2008 Red Hat, Inc. + * (C) Copyright IBM Corporation 2004 + * 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 + * on 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 + * THE COPYRIGHT HOLDERS AND/OR THEIR 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. + */ + +/** + * \file dri_interface.h + * + * This file contains all the types and functions that define the interface + * between a DRI driver and driver loader. Currently, the most common driver + * loader is the XFree86 libGL.so. However, other loaders do exist, and in + * the future the server-side libglx.a will also be a loader. + * + * \author Kevin E. Martin + * \author Ian Romanick + * \author Kristian Høgsberg + */ + +#ifndef DRI_INTERFACE_H +#define DRI_INTERFACE_H + +/* For archs with no drm.h */ +#if !defined(__APPLE__) && !defined(__CYGWIN__) && !defined(__GNU__) +#include +#else +typedef unsigned int drm_context_t; +typedef unsigned int drm_drawable_t; +typedef struct drm_clip_rect drm_clip_rect_t; +#endif + +/** + * \name DRI interface structures + * + * The following structures define the interface between the GLX client + * side library and the DRI (direct rendering infrastructure). + */ +/*@{*/ +typedef struct __DRIdisplayRec __DRIdisplay; +typedef struct __DRIscreenRec __DRIscreen; +typedef struct __DRIcontextRec __DRIcontext; +typedef struct __DRIdrawableRec __DRIdrawable; +typedef struct __DRIconfigRec __DRIconfig; +typedef struct __DRIframebufferRec __DRIframebuffer; +typedef struct __DRIversionRec __DRIversion; + +typedef struct __DRIcoreExtensionRec __DRIcoreExtension; +typedef struct __DRIextensionRec __DRIextension; +typedef struct __DRIcopySubBufferExtensionRec __DRIcopySubBufferExtension; +typedef struct __DRIswapControlExtensionRec __DRIswapControlExtension; +typedef struct __DRIallocateExtensionRec __DRIallocateExtension; +typedef struct __DRIframeTrackingExtensionRec __DRIframeTrackingExtension; +typedef struct __DRImediaStreamCounterExtensionRec __DRImediaStreamCounterExtension; +typedef struct __DRItexOffsetExtensionRec __DRItexOffsetExtension; +typedef struct __DRItexBufferExtensionRec __DRItexBufferExtension; +typedef struct __DRIlegacyExtensionRec __DRIlegacyExtension; +typedef struct __DRIswrastExtensionRec __DRIswrastExtension; +typedef struct __DRIbufferRec __DRIbuffer; +typedef struct __DRIdri2ExtensionRec __DRIdri2Extension; +typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension; +typedef struct __DRI2flushExtensionRec __DRI2flushExtension; + +/*@}*/ + + +/** + * Extension struct. Drivers 'inherit' from this struct by embedding + * it as the first element in the extension struct. + * + * We never break API in for a DRI extension. If we need to change + * the way things work in a non-backwards compatible manner, we + * introduce a new extension. During a transition period, we can + * leave both the old and the new extension in the driver, which + * allows us to move to the new interface without having to update the + * loader(s) in lock step. + * + * However, we can add entry points to an extension over time as long + * as we don't break the old ones. As we add entry points to an + * extension, we increase the version number. The corresponding + * #define can be used to guard code that accesses the new entry + * points at compile time and the version field in the extension + * struct can be used at run-time to determine how to use the + * extension. + */ +struct __DRIextensionRec { + const char *name; + int version; +}; + +/** + * The first set of extension are the screen extensions, returned by + * __DRIcore::getExtensions(). This entry point will return a list of + * extensions and the loader can use the ones it knows about by + * casting them to more specific extensions and advertising any GLX + * extensions the DRI extensions enables. + */ + +/** + * Used by drivers to indicate support for setting the read drawable. + */ +#define __DRI_READ_DRAWABLE "DRI_ReadDrawable" +#define __DRI_READ_DRAWABLE_VERSION 1 + +/** + * Used by drivers that implement the GLX_MESA_copy_sub_buffer extension. + */ +#define __DRI_COPY_SUB_BUFFER "DRI_CopySubBuffer" +#define __DRI_COPY_SUB_BUFFER_VERSION 1 +struct __DRIcopySubBufferExtensionRec { + __DRIextension base; + void (*copySubBuffer)(__DRIdrawable *drawable, int x, int y, int w, int h); +}; + +/** + * Used by drivers that implement the GLX_SGI_swap_control or + * GLX_MESA_swap_control extension. + */ +#define __DRI_SWAP_CONTROL "DRI_SwapControl" +#define __DRI_SWAP_CONTROL_VERSION 1 +struct __DRIswapControlExtensionRec { + __DRIextension base; + void (*setSwapInterval)(__DRIdrawable *drawable, unsigned int inteval); + unsigned int (*getSwapInterval)(__DRIdrawable *drawable); +}; + +/** + * Used by drivers that implement the GLX_MESA_allocate_memory. + */ +#define __DRI_ALLOCATE "DRI_Allocate" +#define __DRI_ALLOCATE_VERSION 1 +struct __DRIallocateExtensionRec { + __DRIextension base; + + void *(*allocateMemory)(__DRIscreen *screen, GLsizei size, + GLfloat readfreq, GLfloat writefreq, + GLfloat priority); + + void (*freeMemory)(__DRIscreen *screen, GLvoid *pointer); + + GLuint (*memoryOffset)(__DRIscreen *screen, const GLvoid *pointer); +}; + +/** + * Used by drivers that implement the GLX_MESA_swap_frame_usage extension. + */ +#define __DRI_FRAME_TRACKING "DRI_FrameTracking" +#define __DRI_FRAME_TRACKING_VERSION 1 +struct __DRIframeTrackingExtensionRec { + __DRIextension base; + + /** + * Enable or disable frame usage tracking. + * + * \since Internal API version 20030317. + */ + int (*frameTracking)(__DRIdrawable *drawable, GLboolean enable); + + /** + * Retrieve frame usage information. + * + * \since Internal API version 20030317. + */ + int (*queryFrameTracking)(__DRIdrawable *drawable, + int64_t * sbc, int64_t * missedFrames, + float * lastMissedUsage, float * usage); +}; + + +/** + * Used by drivers that implement the GLX_SGI_video_sync extension. + */ +#define __DRI_MEDIA_STREAM_COUNTER "DRI_MediaStreamCounter" +#define __DRI_MEDIA_STREAM_COUNTER_VERSION 1 +struct __DRImediaStreamCounterExtensionRec { + __DRIextension base; + + /** + * Wait for the MSC to equal target_msc, or, if that has already passed, + * the next time (MSC % divisor) is equal to remainder. If divisor is + * zero, the function will return as soon as MSC is greater than or equal + * to target_msc. + */ + int (*waitForMSC)(__DRIdrawable *drawable, + int64_t target_msc, int64_t divisor, int64_t remainder, + int64_t * msc, int64_t * sbc); + + /** + * Get the number of vertical refreshes since some point in time before + * this function was first called (i.e., system start up). + */ + int (*getDrawableMSC)(__DRIscreen *screen, __DRIdrawable *drawable, + int64_t *msc); +}; + + +#define __DRI_TEX_OFFSET "DRI_TexOffset" +#define __DRI_TEX_OFFSET_VERSION 1 +struct __DRItexOffsetExtensionRec { + __DRIextension base; + + /** + * Method to override base texture image with a driver specific 'offset'. + * The depth passed in allows e.g. to ignore the alpha channel of texture + * images where the non-alpha components don't occupy a whole texel. + * + * For GLX_EXT_texture_from_pixmap with AIGLX. + */ + void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname, + unsigned long long offset, GLint depth, GLuint pitch); +}; + + +#define __DRI_TEX_BUFFER "DRI_TexBuffer" +#define __DRI_TEX_BUFFER_VERSION 2 +struct __DRItexBufferExtensionRec { + __DRIextension base; + + /** + * Method to override base texture image with the contents of a + * __DRIdrawable. + * + * For GLX_EXT_texture_from_pixmap with AIGLX. Deprecated in favor of + * setTexBuffer2 in version 2 of this interface + */ + void (*setTexBuffer)(__DRIcontext *pDRICtx, + GLint target, + __DRIdrawable *pDraw); + + /** + * Method to override base texture image with the contents of a + * __DRIdrawable, including the required texture format attribute. + * + * For GLX_EXT_texture_from_pixmap with AIGLX. + */ + void (*setTexBuffer2)(__DRIcontext *pDRICtx, + GLint target, + GLint format, + __DRIdrawable *pDraw); +}; + +/** + * Used by drivers that implement DRI2 + */ +#define __DRI2_FLUSH "DRI2_Flush" +#define __DRI2_FLUSH_VERSION 1 +struct __DRI2flushExtensionRec { + __DRIextension base; + void (*flush)(__DRIdrawable *drawable); +}; + + +/** + * XML document describing the configuration options supported by the + * driver. + */ +extern const char __driConfigOptions[]; + +/*@}*/ + +/** + * The following extensions describe loader features that the DRI + * driver can make use of. Some of these are mandatory, such as the + * getDrawableInfo extension for DRI and the DRI Loader extensions for + * DRI2, while others are optional, and if present allow the driver to + * expose certain features. The loader pass in a NULL terminated + * array of these extensions to the driver in the createNewScreen + * constructor. + */ + +typedef struct __DRIgetDrawableInfoExtensionRec __DRIgetDrawableInfoExtension; +typedef struct __DRIsystemTimeExtensionRec __DRIsystemTimeExtension; +typedef struct __DRIdamageExtensionRec __DRIdamageExtension; +typedef struct __DRIloaderExtensionRec __DRIloaderExtension; +typedef struct __DRIswrastLoaderExtensionRec __DRIswrastLoaderExtension; + + +/** + * Callback to getDrawableInfo protocol + */ +#define __DRI_GET_DRAWABLE_INFO "DRI_GetDrawableInfo" +#define __DRI_GET_DRAWABLE_INFO_VERSION 1 +struct __DRIgetDrawableInfoExtensionRec { + __DRIextension base; + + /** + * This function is used to get information about the position, size, and + * clip rects of a drawable. + */ + GLboolean (* getDrawableInfo) ( __DRIdrawable *drawable, + unsigned int * index, unsigned int * stamp, + int * x, int * y, int * width, int * height, + int * numClipRects, drm_clip_rect_t ** pClipRects, + int * backX, int * backY, + int * numBackClipRects, drm_clip_rect_t ** pBackClipRects, + void *loaderPrivate); +}; + +/** + * Callback to get system time for media stream counter extensions. + */ +#define __DRI_SYSTEM_TIME "DRI_SystemTime" +#define __DRI_SYSTEM_TIME_VERSION 1 +struct __DRIsystemTimeExtensionRec { + __DRIextension base; + + /** + * Get the 64-bit unadjusted system time (UST). + */ + int (*getUST)(int64_t * ust); + + /** + * Get the media stream counter (MSC) rate. + * + * Matching the definition in GLX_OML_sync_control, this function returns + * the rate of the "media stream counter". In practical terms, this is + * the frame refresh rate of the display. + */ + GLboolean (*getMSCRate)(__DRIdrawable *draw, + int32_t * numerator, int32_t * denominator, + void *loaderPrivate); +}; + +/** + * Damage reporting + */ +#define __DRI_DAMAGE "DRI_Damage" +#define __DRI_DAMAGE_VERSION 1 +struct __DRIdamageExtensionRec { + __DRIextension base; + + /** + * Reports areas of the given drawable which have been modified by the + * driver. + * + * \param drawable which the drawing was done to. + * \param rects rectangles affected, with the drawable origin as the + * origin. + * \param x X offset of the drawable within the screen (used in the + * front_buffer case) + * \param y Y offset of the drawable within the screen. + * \param front_buffer boolean flag for whether the drawing to the + * drawable was actually done directly to the front buffer (instead + * of backing storage, for example) + * \param loaderPrivate the data passed in at createNewDrawable time + */ + void (*reportDamage)(__DRIdrawable *draw, + int x, int y, + drm_clip_rect_t *rects, int num_rects, + GLboolean front_buffer, + void *loaderPrivate); +}; + +#define __DRI_SWRAST_IMAGE_OP_DRAW 1 +#define __DRI_SWRAST_IMAGE_OP_CLEAR 2 +#define __DRI_SWRAST_IMAGE_OP_SWAP 3 + +/** + * SWRast Loader extension. + */ +#define __DRI_SWRAST_LOADER "DRI_SWRastLoader" +#define __DRI_SWRAST_LOADER_VERSION 1 +struct __DRIswrastLoaderExtensionRec { + __DRIextension base; + + /* + * Drawable position and size + */ + void (*getDrawableInfo)(__DRIdrawable *drawable, + int *x, int *y, int *width, int *height, + void *loaderPrivate); + + /** + * Put image to drawable + */ + void (*putImage)(__DRIdrawable *drawable, int op, + int x, int y, int width, int height, char *data, + void *loaderPrivate); + + /** + * Get image from drawable + */ + void (*getImage)(__DRIdrawable *drawable, + int x, int y, int width, int height, char *data, + void *loaderPrivate); +}; + +/** + * The remaining extensions describe driver extensions, immediately + * available interfaces provided by the driver. To start using the + * driver, dlsym() for the __DRI_DRIVER_EXTENSIONS symbol and look for + * the extension you need in the array. + */ +#define __DRI_DRIVER_EXTENSIONS "__driDriverExtensions" + +/** + * Tokens for __DRIconfig attribs. A number of attributes defined by + * GLX or EGL standards are not in the table, as they must be provided + * by the loader. For example, FBConfig ID or visual ID, drawable type. + */ + +#define __DRI_ATTRIB_BUFFER_SIZE 1 +#define __DRI_ATTRIB_LEVEL 2 +#define __DRI_ATTRIB_RED_SIZE 3 +#define __DRI_ATTRIB_GREEN_SIZE 4 +#define __DRI_ATTRIB_BLUE_SIZE 5 +#define __DRI_ATTRIB_LUMINANCE_SIZE 6 +#define __DRI_ATTRIB_ALPHA_SIZE 7 +#define __DRI_ATTRIB_ALPHA_MASK_SIZE 8 +#define __DRI_ATTRIB_DEPTH_SIZE 9 +#define __DRI_ATTRIB_STENCIL_SIZE 10 +#define __DRI_ATTRIB_ACCUM_RED_SIZE 11 +#define __DRI_ATTRIB_ACCUM_GREEN_SIZE 12 +#define __DRI_ATTRIB_ACCUM_BLUE_SIZE 13 +#define __DRI_ATTRIB_ACCUM_ALPHA_SIZE 14 +#define __DRI_ATTRIB_SAMPLE_BUFFERS 15 +#define __DRI_ATTRIB_SAMPLES 16 +#define __DRI_ATTRIB_RENDER_TYPE 17 +#define __DRI_ATTRIB_CONFIG_CAVEAT 18 +#define __DRI_ATTRIB_CONFORMANT 19 +#define __DRI_ATTRIB_DOUBLE_BUFFER 20 +#define __DRI_ATTRIB_STEREO 21 +#define __DRI_ATTRIB_AUX_BUFFERS 22 +#define __DRI_ATTRIB_TRANSPARENT_TYPE 23 +#define __DRI_ATTRIB_TRANSPARENT_INDEX_VALUE 24 +#define __DRI_ATTRIB_TRANSPARENT_RED_VALUE 25 +#define __DRI_ATTRIB_TRANSPARENT_GREEN_VALUE 26 +#define __DRI_ATTRIB_TRANSPARENT_BLUE_VALUE 27 +#define __DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE 28 +#define __DRI_ATTRIB_FLOAT_MODE 29 +#define __DRI_ATTRIB_RED_MASK 30 +#define __DRI_ATTRIB_GREEN_MASK 31 +#define __DRI_ATTRIB_BLUE_MASK 32 +#define __DRI_ATTRIB_ALPHA_MASK 33 +#define __DRI_ATTRIB_MAX_PBUFFER_WIDTH 34 +#define __DRI_ATTRIB_MAX_PBUFFER_HEIGHT 35 +#define __DRI_ATTRIB_MAX_PBUFFER_PIXELS 36 +#define __DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH 37 +#define __DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT 38 +#define __DRI_ATTRIB_VISUAL_SELECT_GROUP 39 +#define __DRI_ATTRIB_SWAP_METHOD 40 +#define __DRI_ATTRIB_MAX_SWAP_INTERVAL 41 +#define __DRI_ATTRIB_MIN_SWAP_INTERVAL 42 +#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGB 43 +#define __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA 44 +#define __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE 45 +#define __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS 46 +#define __DRI_ATTRIB_YINVERTED 47 + +/* __DRI_ATTRIB_RENDER_TYPE */ +#define __DRI_ATTRIB_RGBA_BIT 0x01 +#define __DRI_ATTRIB_COLOR_INDEX_BIT 0x02 +#define __DRI_ATTRIB_LUMINANCE_BIT 0x04 + +/* __DRI_ATTRIB_CONFIG_CAVEAT */ +#define __DRI_ATTRIB_SLOW_BIT 0x01 +#define __DRI_ATTRIB_NON_CONFORMANT_CONFIG 0x02 + +/* __DRI_ATTRIB_TRANSPARENT_TYPE */ +#define __DRI_ATTRIB_TRANSPARENT_RGB 0x00 +#define __DRI_ATTRIB_TRANSPARENT_INDEX 0x01 + +/* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */ +#define __DRI_ATTRIB_TEXTURE_1D_BIT 0x01 +#define __DRI_ATTRIB_TEXTURE_2D_BIT 0x02 +#define __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT 0x04 + +/** + * This extension defines the core DRI functionality. + */ +#define __DRI_CORE "DRI_Core" +#define __DRI_CORE_VERSION 1 + +struct __DRIcoreExtensionRec { + __DRIextension base; + + __DRIscreen *(*createNewScreen)(int screen, int fd, + unsigned int sarea_handle, + const __DRIextension **extensions, + const __DRIconfig ***driverConfigs, + void *loaderPrivate); + + void (*destroyScreen)(__DRIscreen *screen); + + const __DRIextension **(*getExtensions)(__DRIscreen *screen); + + int (*getConfigAttrib)(const __DRIconfig *config, + unsigned int attrib, + unsigned int *value); + + int (*indexConfigAttrib)(const __DRIconfig *config, int index, + unsigned int *attrib, unsigned int *value); + + __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, + const __DRIconfig *config, + unsigned int drawable_id, + unsigned int head, + void *loaderPrivate); + + void (*destroyDrawable)(__DRIdrawable *drawable); + + void (*swapBuffers)(__DRIdrawable *drawable); + + __DRIcontext *(*createNewContext)(__DRIscreen *screen, + const __DRIconfig *config, + __DRIcontext *shared, + void *loaderPrivate); + + int (*copyContext)(__DRIcontext *dest, + __DRIcontext *src, + unsigned long mask); + + void (*destroyContext)(__DRIcontext *context); + + int (*bindContext)(__DRIcontext *ctx, + __DRIdrawable *pdraw, + __DRIdrawable *pread); + + int (*unbindContext)(__DRIcontext *ctx); +}; + +/** + * Stored version of some component (i.e., server-side DRI module, kernel-side + * DRM, etc.). + * + * \todo + * There are several data structures that explicitly store a major version, + * minor version, and patch level. These structures should be modified to + * have a \c __DRIversionRec instead. + */ +struct __DRIversionRec { + int major; /**< Major version number. */ + int minor; /**< Minor version number. */ + int patch; /**< Patch-level. */ +}; + +/** + * Framebuffer information record. Used by libGL to communicate information + * about the framebuffer to the driver's \c __driCreateNewScreen function. + * + * In XFree86, most of this information is derrived from data returned by + * calling \c XF86DRIGetDeviceInfo. + * + * \sa XF86DRIGetDeviceInfo __DRIdisplayRec::createNewScreen + * __driUtilCreateNewScreen CallCreateNewScreen + * + * \bug This structure could be better named. + */ +struct __DRIframebufferRec { + unsigned char *base; /**< Framebuffer base address in the CPU's + * address space. This value is calculated by + * calling \c drmMap on the framebuffer handle + * returned by \c XF86DRIGetDeviceInfo (or a + * similar function). + */ + int size; /**< Framebuffer size, in bytes. */ + int stride; /**< Number of bytes from one line to the next. */ + int width; /**< Pixel width of the framebuffer. */ + int height; /**< Pixel height of the framebuffer. */ + int dev_priv_size; /**< Size of the driver's dev-priv structure. */ + void *dev_priv; /**< Pointer to the driver's dev-priv structure. */ +}; + + +/** + * This extension provides alternative screen, drawable and context + * constructors for legacy DRI functionality. This is used in + * conjunction with the core extension. + */ +#define __DRI_LEGACY "DRI_Legacy" +#define __DRI_LEGACY_VERSION 1 + +struct __DRIlegacyExtensionRec { + __DRIextension base; + + __DRIscreen *(*createNewScreen)(int screen, + const __DRIversion *ddx_version, + const __DRIversion *dri_version, + const __DRIversion *drm_version, + const __DRIframebuffer *frame_buffer, + void *pSAREA, int fd, + const __DRIextension **extensions, + const __DRIconfig ***driver_configs, + void *loaderPrivate); + + __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, + const __DRIconfig *config, + drm_drawable_t hwDrawable, + int renderType, const int *attrs, + void *loaderPrivate); + + __DRIcontext *(*createNewContext)(__DRIscreen *screen, + const __DRIconfig *config, + int render_type, + __DRIcontext *shared, + drm_context_t hwContext, + void *loaderPrivate); +}; + +/** + * This extension provides alternative screen, drawable and context + * constructors for swrast DRI functionality. This is used in + * conjunction with the core extension. + */ +#define __DRI_SWRAST "DRI_SWRast" +#define __DRI_SWRAST_VERSION 1 + +struct __DRIswrastExtensionRec { + __DRIextension base; + + __DRIscreen *(*createNewScreen)(int screen, + const __DRIextension **extensions, + const __DRIconfig ***driver_configs, + void *loaderPrivate); + + __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, + const __DRIconfig *config, + void *loaderPrivate); +}; + +/** + * DRI2 Loader extension. + */ +#define __DRI_BUFFER_FRONT_LEFT 0 +#define __DRI_BUFFER_BACK_LEFT 1 +#define __DRI_BUFFER_FRONT_RIGHT 2 +#define __DRI_BUFFER_BACK_RIGHT 3 +#define __DRI_BUFFER_DEPTH 4 +#define __DRI_BUFFER_STENCIL 5 +#define __DRI_BUFFER_ACCUM 6 +#define __DRI_BUFFER_FAKE_FRONT_LEFT 7 +#define __DRI_BUFFER_FAKE_FRONT_RIGHT 8 +#define __DRI_BUFFER_DEPTH_STENCIL 9 /**< Only available with DRI2 1.1 */ + +struct __DRIbufferRec { + unsigned int attachment; + unsigned int name; + unsigned int pitch; + unsigned int cpp; + unsigned int flags; +}; + +#define __DRI_DRI2_LOADER "DRI_DRI2Loader" +#define __DRI_DRI2_LOADER_VERSION 3 +struct __DRIdri2LoaderExtensionRec { + __DRIextension base; + + __DRIbuffer *(*getBuffers)(__DRIdrawable *driDrawable, + int *width, int *height, + unsigned int *attachments, int count, + int *out_count, void *loaderPrivate); + + /** + * Flush pending front-buffer rendering + * + * Any rendering that has been performed to the + * \c __DRI_BUFFER_FAKE_FRONT_LEFT will be flushed to the + * \c __DRI_BUFFER_FRONT_LEFT. + * + * \param driDrawable Drawable whose front-buffer is to be flushed + * \param loaderPrivate Loader's private data that was previously passed + * into __DRIdri2ExtensionRec::createNewDrawable + */ + void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate); + + + /** + * Get list of buffers from the server + * + * Gets a list of buffer for the specified set of attachments. Unlike + * \c ::getBuffers, this function takes a list of attachments paired with + * opaque \c unsigned \c int value describing the format of the buffer. + * It is the responsibility of the caller to know what the service that + * allocates the buffers will expect to receive for the format. + * + * \param driDrawable Drawable whose buffers are being queried. + * \param width Output where the width of the buffers is stored. + * \param height Output where the height of the buffers is stored. + * \param attachments List of pairs of attachment ID and opaque format + * requested for the drawable. + * \param count Number of attachment / format pairs stored in + * \c attachments. + * \param loaderPrivate Loader's private data that was previously passed + * into __DRIdri2ExtensionRec::createNewDrawable. + */ + __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable, + int *width, int *height, + unsigned int *attachments, int count, + int *out_count, void *loaderPrivate); +}; + +/** + * This extension provides alternative screen, drawable and context + * constructors for DRI2. + */ +#define __DRI_DRI2 "DRI_DRI2" +#define __DRI_DRI2_VERSION 1 + +struct __DRIdri2ExtensionRec { + __DRIextension base; + + __DRIscreen *(*createNewScreen)(int screen, int fd, + const __DRIextension **extensions, + const __DRIconfig ***driver_configs, + void *loaderPrivate); + + __DRIdrawable *(*createNewDrawable)(__DRIscreen *screen, + const __DRIconfig *config, + void *loaderPrivate); + + __DRIcontext *(*createNewContext)(__DRIscreen *screen, + const __DRIconfig *config, + __DRIcontext *shared, + void *loaderPrivate); + +}; + +#endif diff --git a/mesalib/include/GL/internal/glcore.h b/mesalib/include/GL/internal/glcore.h new file mode 100644 index 000000000..18f657662 --- /dev/null +++ b/mesalib/include/GL/internal/glcore.h @@ -0,0 +1,185 @@ +#ifndef __gl_core_h_ +#define __gl_core_h_ + +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#if !defined(_WIN32_WCE) +#include +#endif + +#define GL_CORE_SGI 1 +#define GL_CORE_MESA 2 +#define GL_CORE_APPLE 4 +#define GL_CORE_WINDOWS 8 + +typedef struct __GLcontextRec __GLcontext; + +/* +** This file defines the interface between the GL core and the surrounding +** "operating system" that supports it (currently the GLX or WGL extensions). +** +** Members (data and function pointers) are documented as imported or +** exported according to how they are used by the core rendering functions. +** Imported members are initialized by the "operating system" and used by +** the core functions. Exported members are initialized by the core functions +** and used by the "operating system". +*/ + +/** + * Mode and limit information for a context. This information is + * kept around in the context so that values can be used during + * command execution, and for returning information about the + * context to the application. + * + * Instances of this structure are shared by the driver and the loader. To + * maintain binary compatability, new fields \b must be added only to the + * end of the structure. + * + * \sa _gl_context_modes_create + */ +typedef struct __GLcontextModesRec { + struct __GLcontextModesRec * next; + + GLboolean rgbMode; + GLboolean floatMode; + GLboolean colorIndexMode; + GLuint doubleBufferMode; + GLuint stereoMode; + + GLboolean haveAccumBuffer; + GLboolean haveDepthBuffer; + GLboolean haveStencilBuffer; + + GLint redBits, greenBits, blueBits, alphaBits; /* bits per comp */ + GLuint redMask, greenMask, blueMask, alphaMask; + GLint rgbBits; /* total bits for rgb */ + GLint indexBits; /* total bits for colorindex */ + + GLint accumRedBits, accumGreenBits, accumBlueBits, accumAlphaBits; + GLint depthBits; + GLint stencilBits; + + GLint numAuxBuffers; + + GLint level; + + GLint pixmapMode; + + /* GLX */ + GLint visualID; + GLint visualType; /**< One of the GLX X visual types. (i.e., + * \c GLX_TRUE_COLOR, etc.) + */ + + /* EXT_visual_rating / GLX 1.2 */ + GLint visualRating; + + /* EXT_visual_info / GLX 1.2 */ + GLint transparentPixel; + /* colors are floats scaled to ints */ + GLint transparentRed, transparentGreen, transparentBlue, transparentAlpha; + GLint transparentIndex; + + /* ARB_multisample / SGIS_multisample */ + GLint sampleBuffers; + GLint samples; + + /* SGIX_fbconfig / GLX 1.3 */ + GLint drawableType; + GLint renderType; + GLint xRenderable; + GLint fbconfigID; + + /* SGIX_pbuffer / GLX 1.3 */ + GLint maxPbufferWidth; + GLint maxPbufferHeight; + GLint maxPbufferPixels; + GLint optimalPbufferWidth; /* Only for SGIX_pbuffer. */ + GLint optimalPbufferHeight; /* Only for SGIX_pbuffer. */ + + /* SGIX_visual_select_group */ + GLint visualSelectGroup; + + /* OML_swap_method */ + GLint swapMethod; + + GLint screen; + + /* EXT_texture_from_pixmap */ + GLint bindToTextureRgb; + GLint bindToTextureRgba; + GLint bindToMipmapTexture; + GLint bindToTextureTargets; + GLint yInverted; +} __GLcontextModes; + +/* Several fields of __GLcontextModes can take these as values. Since + * GLX header files may not be available everywhere they need to be used, + * redefine them here. + */ +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 +#define GLX_NON_CONFORMANT_CONFIG 0x800D +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 + +#define GLX_DONT_CARE 0xFFFFFFFF + +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 + +#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0 +#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1 +#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2 +#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3 +#define GLX_Y_INVERTED_EXT 0x20D4 + +#define GLX_TEXTURE_1D_BIT_EXT 0x00000001 +#define GLX_TEXTURE_2D_BIT_EXT 0x00000002 +#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004 + +#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8 +#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9 +#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA + +#endif /* __gl_core_h_ */ diff --git a/mesalib/include/GL/internal/sarea.h b/mesalib/include/GL/internal/sarea.h new file mode 100644 index 000000000..a0d6084f3 --- /dev/null +++ b/mesalib/include/GL/internal/sarea.h @@ -0,0 +1,92 @@ +/** + * \file sarea.h + * SAREA definitions. + * + * \author Kevin E. Martin + * \author Jens Owen + * \author Rickard E. (Rik) Faith + */ + +/* + * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc. + * 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. + */ + + +#ifndef _SAREA_H_ +#define _SAREA_H_ + +#include "xf86drm.h" + +/* SAREA area needs to be at least a page */ +#if defined(__alpha__) +#define SAREA_MAX 0x2000 +#elif defined(__ia64__) +#define SAREA_MAX 0x10000 /* 64kB */ +#else +/* Intel 830M driver needs at least 8k SAREA */ +#define SAREA_MAX 0x2000 +#endif + +#define SAREA_MAX_DRAWABLES 256 + +#define SAREA_DRAWABLE_CLAIMED_ENTRY 0x80000000 + +/** + * SAREA per drawable information. + * + * \sa _XF86DRISAREA. + */ +typedef struct _XF86DRISAREADrawable { + unsigned int stamp; + unsigned int flags; +} XF86DRISAREADrawableRec, *XF86DRISAREADrawablePtr; + +/** + * SAREA frame information. + * + * \sa _XF86DRISAREA. + */ +typedef struct _XF86DRISAREAFrame { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + unsigned int fullscreen; +} XF86DRISAREAFrameRec, *XF86DRISAREAFramePtr; + +/** + * SAREA definition. + */ +typedef struct _XF86DRISAREA { + /** first thing is always the DRM locking structure */ + drmLock lock; + /** \todo Use readers/writer lock for drawable_lock */ + drmLock drawable_lock; + XF86DRISAREADrawableRec drawableTable[SAREA_MAX_DRAWABLES]; + XF86DRISAREAFrameRec frame; + drm_context_t dummy_context; +} XF86DRISAREARec, *XF86DRISAREAPtr; + +#endif diff --git a/mesalib/include/GL/mesa_wgl.h b/mesalib/include/GL/mesa_wgl.h new file mode 100644 index 000000000..ca2e1b875 --- /dev/null +++ b/mesalib/include/GL/mesa_wgl.h @@ -0,0 +1,121 @@ +/* + * Mesa 3-D graphics library + * Version: 3.1 + * + * Copyright (C) 1999 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* prototypes for the Mesa WGL functions */ +/* relocated here so that I could make GLUT get them properly */ + +#ifndef _mesa_wgl_h_ +#define _mesa_wgl_h_ + +#if defined(__MINGW32__) +# define __W32API_USE_DLLIMPORT__ +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef WGLAPI +#define WGLAPI GLAPI +#endif + +#if defined(__MINGW32__) +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif +# include +#endif + + +#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) +#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; +#endif + + +#ifdef _MSC_VER +# pragma warning( disable : 4615 ) /* pragma warning : unknown user warning type*/ +# pragma warning( push ) +# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */ +#endif + + +WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *); +WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc); +WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *); +WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR); +WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc); + +WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int); +WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC); +WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int); +WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC); +WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR); +WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void); +WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void); +WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *); +WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*); +WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC); +WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int); +WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *); +WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC); +WGLAPI int GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int); +WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long); +WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long); +WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); +WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); + +#ifndef __MINGW32__ +WGLAPI int GLAPIENTRY SwapBuffers(HDC); +WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *); +WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR); +WGLAPI int GLAPIENTRY GetPixelFormat(HDC); +WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *); +#endif + + +#ifdef _MSC_VER +# pragma warning( pop ) +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* _mesa_wgl_h_ */ diff --git a/mesalib/include/GL/mglmesa.h b/mesalib/include/GL/mglmesa.h new file mode 100644 index 000000000..0f9f78957 --- /dev/null +++ b/mesalib/include/GL/mglmesa.h @@ -0,0 +1,79 @@ +/**************************************************************************** +* +* Mesa bindings for SciTech MGL +* +* Copyright (C) 1996 SciTech Software. +* All rights reserved. +* +* Filename: mglmesa.h +* Version: Revision: 1.1.1.1 +* +* Language: ANSI C +* Environment: Any +* +* Description: Header file for the Mesa/OpenGL interface bindings for the +* SciTech MGL graphics library. Uses the MGL internal +* device context structures to get direct access to the +* high performance MGL rasterization functions for maximum +* performance. Utilizes the VESA VBE/AF Accelerator Functions +* via the MGL's accelerated device driver functions, as well +* as basic DirectDraw accelerated functions provided by the +* MGL. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Library General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Library General Public License for more details. +* +* You should have received a copy of the GNU Library General Public +* License along with this library; if not, write to the Free +* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +* +* +****************************************************************************/ + +#ifndef __MGLMESA_H +#define __MGLMESA_H + +#include "mgraph.h" + +/*------------------------- Function Prototypes ---------------------------*/ + +#ifdef __cplusplus +extern "C" { /* Use "C" linkage when in C++ mode */ +#endif + +#ifndef __WINDOWS__ +#define GLAPIENTRY +#endif + +#ifdef __WINDOWS__ +bool GLAPIENTRY MGLMesaInitDLL(MGLCallbacks *cb,char *version); +#endif +void GLAPIENTRY MGLMesaChooseVisual(MGLDC *dc,MGLVisual *visual); +bool GLAPIENTRY MGLMesaSetVisual(MGLDC *dc,MGLVisual *visual); +bool GLAPIENTRY MGLMesaCreateContext(MGLDC *dc,bool forceMemDC); +void GLAPIENTRY MGLMesaDestroyContext(MGLDC *dc); +void GLAPIENTRY MGLMesaMakeCurrent(MGLDC *dc); +void GLAPIENTRY MGLMesaSwapBuffers(MGLDC *dc,bool waitVRT); + +/* Palette manipulation support. The reason we provide palette manipulation + * routines is so that when rendering in double buffered modes with a + * software backbuffer, the palette for the backbuffer is kept consistent + * with the hardware front buffer. + */ + +void GLAPIENTRY MGLMesaSetPaletteEntry(MGLDC *dc,int entry,uchar red,uchar green,uchar blue); +void GLAPIENTRY MGLMesaSetPalette(MGLDC *dc,palette_t *pal,int numColors,int startIndex); +void GLAPIENTRY MGLMesaRealizePalette(MGLDC *dc,int numColors,int startIndex,int waitVRT); + +#ifdef __cplusplus +} /* End of "C" linkage for C++ */ +#endif /* __cplusplus */ + +#endif /* __MGLMESA_H */ diff --git a/mesalib/include/GL/osmesa.h b/mesalib/include/GL/osmesa.h new file mode 100644 index 000000000..56fa23ce8 --- /dev/null +++ b/mesalib/include/GL/osmesa.h @@ -0,0 +1,289 @@ +/* + * Mesa 3-D graphics library + * Version: 6.5 + * + * Copyright (C) 1999-2005 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 + + +#define OSMESA_MAJOR_VERSION 6 +#define OSMESA_MINOR_VERSION 5 +#define OSMESA_PATCH_VERSION 0 + + + +/* + * 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 +#define OSMESA_RGB_565 0x5 + + +/* + * 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 +#define OSMESA_MAX_WIDTH 0x24 /* new in 4.0 */ +#define OSMESA_MAX_HEIGHT 0x25 /* new in 4.0 */ + + +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 ); + + + +/* + * Create an Off-Screen Mesa rendering context and specify desired + * size of depth buffer, stencil buffer and accumulation buffer. + * If you specify zero for depthBits, stencilBits, accumBits you + * can save some memory. + * + * New in Mesa 3.5 + */ +GLAPI OSMesaContext GLAPIENTRY +OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, + GLint accumBits, 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 ); + + + +/** + * This typedef is new in Mesa 6.3. + */ +typedef void (*OSMESAproc)(); + + +/* + * Return pointer to the named function. + * New in Mesa 4.1 + * Return OSMESAproc in 6.3. + */ +GLAPI OSMESAproc GLAPIENTRY +OSMesaGetProcAddress( const char *funcName ); + + + +/** + * Enable/disable color clamping, off by default. + * New in Mesa 6.4.2 + */ +GLAPI void GLAPIENTRY +OSMesaColorClamp(GLboolean enable); + + +#if defined(__BEOS__) || defined(__QUICKDRAW__) +#pragma export off +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/mesalib/include/GL/svgamesa.h b/mesalib/include/GL/svgamesa.h new file mode 100644 index 000000000..67c0e4c5c --- /dev/null +++ b/mesalib/include/GL/svgamesa.h @@ -0,0 +1,97 @@ +/* + * Mesa 3-D graphics library + * Version: 4.0 + * Copyright (C) 1995-2001 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* + * SVGA/Mesa interface for Linux. + */ + + +/* + * Intro to using the VGA/Mesa interface + * + * 1. #include the file + * 2. Call vga_init() to initialize the SVGA library. + * 3. Call vga_setmode() to specify the screen size and color depth. + * 4. Call SVGAMesaCreateContext() to setup a Mesa context. If using 8-bit + * color Mesa assumes color index mode, if using 16-bit or deeper color + * Mesa assumes RGB mode. + * 5. Call SVGAMesaMakeCurrent() to activate the Mesa context. + * 6. You can now use the Mesa API functions. + * 7. Before exiting, call SVGAMesaDestroyContext() then vga_setmode(TEXT) + * to restore the original text screen. + * + * Notes + * 1. You must run your executable as root (or use the set UID-bit) because + * the SVGA library requires it. + * 2. The SVGA driver is not fully implemented yet. See svgamesa.c for what + * has to be done yet. + */ + + +#ifndef SVGAMESA_H +#define SVGAMESA_H + + +#define SVGAMESA_MAJOR_VERSION 4 +#define SVGAMESA_MINOR_VERSION 0 + + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "GL/gl.h" + + + +/* + * This is the SVGAMesa context 'handle': + */ +typedef struct svgamesa_context *SVGAMesaContext; + + + +/* + * doubleBuffer flag new in version 2.4 + */ +extern int SVGAMesaInit( int GraphMode ); + +extern int SVGAMesaClose( void ); + +extern SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer ); + +extern void SVGAMesaDestroyContext( SVGAMesaContext ctx ); + +extern void SVGAMesaMakeCurrent( SVGAMesaContext ctx ); + +extern void SVGAMesaSwapBuffers( void ); + +extern void SVGAMesaSetCI(int ndx, GLubyte red, GLubyte green, GLubyte blue); + +extern SVGAMesaContext SVGAMesaGetCurrentContext( void ); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/mesalib/include/GL/vms_x_fix.h b/mesalib/include/GL/vms_x_fix.h new file mode 100644 index 000000000..24cba473d --- /dev/null +++ b/mesalib/include/GL/vms_x_fix.h @@ -0,0 +1,1224 @@ +/*************************************************************************** + * * + * Author : Jouk Jansen (joukj@hrem.nano.tudelft.nl) * + * * + * Last revision : 31 August 2006 * + * * + * Repair definitions of Runtime library functions when compiling with * + * /name=(as_is) on OpenVMS * + * * + ***************************************************************************/ + +#ifndef VMS_X_FIX +#define VMS_X_FIX + +#define decw$_select DECW$_SELECT +#define DtSaverGetWindows DTSAVERGETWINDOWS +#define MrmFetchWidget MRMFETCHWIDGET +#define MrmInitialize MRMINITIALIZE +#define MrmOpenHierarchy MRMOPENHIERARCHY +#define MrmRegisterNames MRMREGISTERNAMES +#define XAddExtension XADDEXTENSION +#define XAddHosts XADDHOSTS +#define XAllocClassHint XALLOCCLASSHINT +#define XAllocColor XALLOCCOLOR +#define XAllocColorCells XALLOCCOLORCELLS +#define XAllocIconSize XALLOCICONSIZE +#define XAllocNamedColor XALLOCNAMEDCOLOR +#define XAllocSizeHints XALLOCSIZEHINTS +#define XAllocStandardColormap XALLOCSTANDARDCOLORMAP +#define XAllocWMHints XALLOCWMHINTS +#define XAllowEvents XALLOWEVENTS +#define XAutoRepeatOff XAUTOREPEATOFF +#define XAutoRepeatOn XAUTOREPEATON +#define XBaseFontNameListOfFontSet XBASEFONTNAMELISTOFFONTSET +#define XBell XBELL +#define XBitmapPad XBITMAPPAD +#define XBlackPixel XBLACKPIXEL +#define XBlackPixelOfScreen XBLACKPIXELOFSCREEN +#define XCellsOfScreen XCELLSOFSCREEN +#define XChangeActivePointerGrab XCHANGEACTIVEPOINTERGRAB +#define XChangeGC XCHANGEGC +#define XChangeKeyboardControl XCHANGEKEYBOARDCONTROL +#define XChangePointerControl XCHANGEPOINTERCONTROL +#define XChangeProperty XCHANGEPROPERTY +#define XChangeWindowAttributes XCHANGEWINDOWATTRIBUTES +#define XCheckIfEvent XCHECKIFEVENT +#define XCheckMaskEvent XCHECKMASKEVENT +#define XCheckTypedEvent XCHECKTYPEDEVENT +#define XCheckTypedWindowEvent XCHECKTYPEDWINDOWEVENT +#define XCheckWindowEvent XCHECKWINDOWEVENT +#define XClearArea XCLEARAREA +#define XClearWindow XCLEARWINDOW +#define XClipBox XCLIPBOX +#define XCloseDisplay XCLOSEDISPLAY +#define XCloseIM XCLOSEIM +#define XConfigureWindow XCONFIGUREWINDOW +#define XConvertSelection XCONVERTSELECTION +#define XCopyArea XCOPYAREA +#define XCopyColormapAndFree XCOPYCOLORMAPANDFREE +#define XCopyGC XCOPYGC +#define XCopyPlane XCOPYPLANE +#define XCreateBitmapFromData XCREATEBITMAPFROMDATA +#define XCreateColormap XCREATECOLORMAP +#define XCreateFontCursor XCREATEFONTCURSOR +#define XCreateFontSet XCREATEFONTSET +#define XCreateGC XCREATEGC +#define XCreateGlyphCursor XCREATEGLYPHCURSOR +#define XCreateIC XCREATEIC +#define XCreateImage XCREATEIMAGE +#define XCreatePixmap XCREATEPIXMAP +#define XCreatePixmapCursor XCREATEPIXMAPCURSOR +#define XCreatePixmapFromBitmapData XCREATEPIXMAPFROMBITMAPDATA +#define XCreateRegion XCREATEREGION +#define XCreateSimpleWindow XCREATESIMPLEWINDOW +#define XCreateWindow XCREATEWINDOW +#define XDefaultColormap XDEFAULTCOLORMAP +#define XDefaultColormapOfScreen XDEFAULTCOLORMAPOFSCREEN +#define XDefaultDepth XDEFAULTDEPTH +#define XDefaultDepthOfScreen XDEFAULTDEPTHOFSCREEN +#define XDefaultGC XDEFAULTGC +#define XDefaultRootWindow XDEFAULTROOTWINDOW +#define XDefaultScreen XDEFAULTSCREEN +#define XDefaultScreenOfDisplay XDEFAULTSCREENOFDISPLAY +#define XDefaultVisual XDEFAULTVISUAL +#define XDefaultVisualOfScreen XDEFAULTVISUALOFSCREEN +#define XDefineCursor XDEFINECURSOR +#define XDeleteContext XDELETECONTEXT +#define XDeleteProperty XDELETEPROPERTY +#define XDestroyIC XDESTROYIC +#define XDestroyRegion XDESTROYREGION +#define XDestroySubwindows XDESTROYSUBWINDOWS +#define XDestroyWindow XDESTROYWINDOW +#define XDisableAccessControl XDISABLEACCESSCONTROL +#define XDisplayCells XDISPLAYCELLS +#define XDisplayHeight XDISPLAYHEIGHT +#define XDisplayKeycodes XDISPLAYKEYCODES +#define XDisplayName XDISPLAYNAME +#define XDisplayOfIM XDISPLAYOFIM +#define XDisplayOfScreen XDISPLAYOFSCREEN +#define XDisplayString XDISPLAYSTRING +#define XDisplayWidth XDISPLAYWIDTH +#define XDoesBackingStore XDOESBACKINGSTORE +#define XDrawArc XDRAWARC +#define XDrawArcs XDRAWARCS +#define XDrawImageString XDRAWIMAGESTRING +#define XDrawImageString16 XDRAWIMAGESTRING16 +#define XDrawLine XDRAWLINE +#define XDrawLines XDRAWLINES +#define XDrawPoint XDRAWPOINT +#define XDrawPoints XDRAWPOINTS +#define XDrawRectangle XDRAWRECTANGLE +#define XDrawRectangles XDRAWRECTANGLES +#define XDrawSegments XDRAWSEGMENTS +#define XDrawString XDRAWSTRING +#define XDrawString16 XDRAWSTRING16 +#define XDrawText XDRAWTEXT +#define XDrawText16 XDRAWTEXT16 +#define XESetCloseDisplay XESETCLOSEDISPLAY +#define XEmptyRegion XEMPTYREGION +#define XEnableAccessControl XENABLEACCESSCONTROL +#define XEqualRegion XEQUALREGION +#define XEventsQueued XEVENTSQUEUED +#define XExtendedMaxRequestSize XEXTENDEDMAXREQUESTSIZE +#define XExtentsOfFontSet XEXTENTSOFFONTSET +#define XFetchBuffer XFETCHBUFFER +#define XFetchBytes XFETCHBYTES +#define XFetchName XFETCHNAME +#define XFillArc XFILLARC +#define XFillArcs XFILLARCS +#define XFillPolygon XFILLPOLYGON +#define XFillRectangle XFILLRECTANGLE +#define XFillRectangles XFILLRECTANGLES +#define XFilterEvent XFILTEREVENT +#define XFindContext XFINDCONTEXT +#define XFlush XFLUSH +#define XFontsOfFontSet XFONTSOFFONTSET +#define XForceScreenSaver XFORCESCREENSAVER +#define XFree XFREE +#define XFreeColormap XFREECOLORMAP +#define XFreeColors XFREECOLORS +#define XFreeCursor XFREECURSOR +#define XFreeDeviceList XFREEDEVICELIST +#define XFreeDeviceState XFREEDEVICESTATE +#define XFreeFont XFREEFONT +#define XFreeFontInfo XFREEFONTINFO +#define XFreeFontNames XFREEFONTNAMES +#define XFreeFontSet XFREEFONTSET +#define XFreeGC XFREEGC +#define XFreeModifiermap XFREEMODIFIERMAP +#define XFreePixmap XFREEPIXMAP +#define XFreeStringList XFREESTRINGLIST +#define XGContextFromGC XGCONTEXTFROMGC +#define XGeometry XGEOMETRY +#define XGetAtomName XGETATOMNAME +#define XGetClassHint XGETCLASSHINT +#define XGetCommand XGETCOMMAND +#define XGetDefault XGETDEFAULT +#define XGetErrorDatabaseText XGETERRORDATABASETEXT +#define XGetErrorText XGETERRORTEXT +#define XGetExtensionVersion XGETEXTENSIONVERSION +#define XGetFontProperty XGETFONTPROPERTY +#define XGetGCValues XGETGCVALUES +#define XGetGeometry XGETGEOMETRY +#define XGetICValues XGETICVALUES +#define XGetIMValues XGETIMVALUES +#define XGetIconName XGETICONNAME +#define XGetIconSizes XGETICONSIZES +#define XGetImage XGETIMAGE +#define XGetInputFocus XGETINPUTFOCUS +#define XGetKeyboardControl XGETKEYBOARDCONTROL +#define XGetKeyboardMapping XGETKEYBOARDMAPPING +#define XGetModifierMapping XGETMODIFIERMAPPING +#define XGetMotionEvents XGETMOTIONEVENTS +#define XGetNormalHints XGETNORMALHINTS +#define XGetPointerControl XGETPOINTERCONTROL +#define XGetPointerMapping XGETPOINTERMAPPING +#define XGetRGBColormaps XGETRGBCOLORMAPS +#define XGetScreenSaver XGETSCREENSAVER +#define XGetSelectionOwner XGETSELECTIONOWNER +#define XGetStandardColormap XGETSTANDARDCOLORMAP +#define XGetSubImage XGETSUBIMAGE +#define XGetTextProperty XGETTEXTPROPERTY +#define XGetVisualInfo XGETVISUALINFO +#define XGetWMColormapWindows XGETWMCOLORMAPWINDOWS +#define XGetWMHints XGETWMHINTS +#define XGetWMIconName XGETWMICONNAME +#define XGetWMName XGETWMNAME +#define XGetWMNormalHints XGETWMNORMALHINTS +#define XGetWindowAttributes XGETWINDOWATTRIBUTES +#define XGetWindowProperty XGETWINDOWPROPERTY +#define XGrabButton XGRABBUTTON +#define XGrabKeyboard XGRABKEYBOARD +#define XGrabPointer XGRABPOINTER +#define XGrabServer XGRABSERVER +#define XHeightMMOfScreen XHEIGHTMMOFSCREEN +#define XHeightOfScreen XHEIGHTOFSCREEN +#define XIconifyWindow XICONIFYWINDOW +#define XIfEvent XIFEVENT +#define XInitExtension XINITEXTENSION +#define XInitImage XINITIMAGE +#define XInstallColormap XINSTALLCOLORMAP +#define XInternAtom XINTERNATOM +#define XInternAtoms XINTERNATOMS +#define XIntersectRegion XINTERSECTREGION +#define XKeycodeToKeysym XKEYCODETOKEYSYM +#define XKeysymToKeycode XKEYSYMTOKEYCODE +#define XKeysymToString XKEYSYMTOSTRING +#define XKillClient XKILLCLIENT +#define XListDepths XLISTDEPTHS +#define XListFonts XLISTFONTS +#define XListFontsWithInfo XLISTFONTSWITHINFO +#define XListHosts XLISTHOSTS +#define XListInputDevices XLISTINPUTDEVICES +#define XListInstalledColormaps XLISTINSTALLEDCOLORMAPS +#define XListPixmapFormats XLISTPIXMAPFORMATS +#define XListProperties XLISTPROPERTIES +#define XLoadFont XLOADFONT +#define XLoadQueryFont XLOADQUERYFONT +#define XLookupColor XLOOKUPCOLOR +#define XLookupKeysym XLOOKUPKEYSYM +#define XLookupString XLOOKUPSTRING +#define XLowerWindow XLOWERWINDOW +#define XMapRaised XMAPRAISED +#define XMapSubwindows XMAPSUBWINDOWS +#define XMapWindow XMAPWINDOW +#define XMaskEvent XMASKEVENT +#define XMatchVisualInfo XMATCHVISUALINFO +#define XMaxRequestSize XMAXREQUESTSIZE +#define XMissingExtension XMISSINGEXTENSION +#define XMoveResizeWindow XMOVERESIZEWINDOW +#define XMoveWindow XMOVEWINDOW +#define XNextEvent XNEXTEVENT +#define XNextRequest XNEXTREQUEST +#define XNoOp XNOOP +#define XOffsetRegion XOFFSETREGION +#define XOpenDevice XOPENDEVICE +#define XOpenDisplay XOPENDISPLAY +#define XOpenIM XOPENIM +#define XParseColor XPARSECOLOR +#define XParseGeometry XPARSEGEOMETRY +#define XPeekEvent XPEEKEVENT +#define XPeekIfEvent XPEEKIFEVENT +#define XPending XPENDING +#define XPointInRegion XPOINTINREGION +#define XPolygonRegion XPOLYGONREGION +#define XPutBackEvent XPUTBACKEVENT +#define XPutImage XPUTIMAGE +#define XQLength XQLENGTH +#define XQueryBestCursor XQUERYBESTCURSOR +#define XQueryBestStipple XQUERYBESTSTIPPLE +#define XQueryColor XQUERYCOLOR +#define XQueryColors XQUERYCOLORS +#define XQueryDeviceState XQUERYDEVICESTATE +#define XQueryExtension XQUERYEXTENSION +#define XQueryFont XQUERYFONT +#define XQueryKeymap XQUERYKEYMAP +#define XQueryPointer XQUERYPOINTER +#define XQueryTree XQUERYTREE +#define XRaiseWindow XRAISEWINDOW +#define XReadBitmapFile XREADBITMAPFILE +#define XRecolorCursor XRECOLORCURSOR +#define XReconfigureWMWindow XRECONFIGUREWMWINDOW +#define XRectInRegion XRECTINREGION +#define XRefreshKeyboardMapping XREFRESHKEYBOARDMAPPING +#define XRemoveHosts XREMOVEHOSTS +#define XReparentWindow XREPARENTWINDOW +#define XResetScreenSaver XRESETSCREENSAVER +#define XResizeWindow XRESIZEWINDOW +#define XResourceManagerString XRESOURCEMANAGERSTRING +#define XRestackWindows XRESTACKWINDOWS +#define XRotateBuffers XROTATEBUFFERS +#define XRootWindow XROOTWINDOW +#define XRootWindowOfScreen XROOTWINDOWOFSCREEN +#define XSaveContext XSAVECONTEXT +#define XScreenNumberOfScreen XSCREENNUMBEROFSCREEN +#define XScreenOfDisplay XSCREENOFDISPLAY +#define XSelectAsyncEvent XSELECTASYNCEVENT +#define XSelectAsyncInput XSELECTASYNCINPUT +#define XSelectExtensionEvent XSELECTEXTENSIONEVENT +#define XSelectInput XSELECTINPUT +#define XSendEvent XSENDEVENT +#define XServerVendor XSERVERVENDOR +#define XSetArcMode XSETARCMODE +#define XSetBackground XSETBACKGROUND +#define XSetClassHint XSETCLASSHINT +#define XSetClipMask XSETCLIPMASK +#define XSetClipOrigin XSETCLIPORIGIN +#define XSetClipRectangles XSETCLIPRECTANGLES +#define XSetCloseDownMode XSETCLOSEDOWNMODE +#define XSetCommand XSETCOMMAND +#define XSetDashes XSETDASHES +#define XSetErrorHandler XSETERRORHANDLER +#define XSetExtensionErrorHandler XSETEXTENSIONERRORHANDLER +#define XSetFillRule XSETFILLRULE +#define XSetFillStyle XSETFILLSTYLE +#define XSetFont XSETFONT +#define XSetForeground XSETFOREGROUND +#define XSetFunction XSETFUNCTION +#define XSetGraphicsExposures XSETGRAPHICSEXPOSURES +#define XSetICFocus XSETICFOCUS +#define XSetICValues XSETICVALUES +#define XSetIOErrorHandler XSETIOERRORHANDLER +#define XSetIconName XSETICONNAME +#define XSetInputFocus XSETINPUTFOCUS +#define XSetLineAttributes XSETLINEATTRIBUTES +#define XSetLocaleModifiers XSETLOCALEMODIFIERS +#define XSetNormalHints XSETNORMALHINTS +#define XSetPlaneMask XSETPLANEMASK +#define XSetRegion XSETREGION +#define XSetRGBColormaps XSETRGBCOLORMAPS +#define XSetScreenSaver XSETSCREENSAVER +#define XSetSelectionOwner XSETSELECTIONOWNER +#define XSetStandardProperties XSETSTANDARDPROPERTIES +#define XSetState XSETSTATE +#define XSetStipple XSETSTIPPLE +#define XSetSubwindowMode XSETSUBWINDOWMODE +#define XSetTSOrigin XSETTSORIGIN +#define XSetTextProperty XSETTEXTPROPERTY +#define XSetTile XSETTILE +#define XSetTransientForHint XSETTRANSIENTFORHINT +#define XSetWMClientMachine XSETWMCLIENTMACHINE +#define XSetWMColormapWindows XSETWMCOLORMAPWINDOWS +#define XSetWMHints XSETWMHINTS +#define XSetWMIconName XSETWMICONNAME +#define XSetWMName XSETWMNAME +#define XSetWMNormalHints XSETWMNORMALHINTS +#define XSetWMProperties XSETWMPROPERTIES +#define XSetWMProtocols XSETWMPROTOCOLS +#define XSetWMSizeHints XSETWMSIZEHINTS +#define XSetWindowBackground XSETWINDOWBACKGROUND +#define XSetWindowBackgroundPixmap XSETWINDOWBACKGROUNDPIXMAP +#define XSetWindowBorder XSETWINDOWBORDER +#define XSetWindowBorderPixmap XSETWINDOWBORDERPIXMAP +#define XSetWindowBorderWidth XSETWINDOWBORDERWIDTH +#define XSetWindowColormap XSETWINDOWCOLORMAP +#define XShapeCombineMask XSHAPECOMBINEMASK +#define XShapeCombineRectangles XSHAPECOMBINERECTANGLES +#define XShapeGetRectangles XSHAPEGETRECTANGLES +#define XShapeQueryExtension XSHAPEQUERYEXTENSION +#define XShmAttach XSHMATTACH +#define XShmCreateImage XSHMCREATEIMAGE +#define XShmCreatePixmap XSHMCREATEPIXMAP +#define XShmDetach XSHMDETACH +#define XShmGetEventBase XSHMGETEVENTBASE +#define XShmPutImage XSHMPUTIMAGE +#define XShmQueryExtension XSHMQUERYEXTENSION +#define XShmQueryVersion XSHMQUERYVERSION +#define XShrinkRegion XSHRINKREGION +#define XStoreBuffer XSTOREBUFFER +#define XStoreBytes XSTOREBYTES +#define XStoreColor XSTORECOLOR +#define XStoreColors XSTORECOLORS +#define XStoreName XSTORENAME +#define XStringListToTextProperty XSTRINGLISTTOTEXTPROPERTY +#define XStringToKeysym XSTRINGTOKEYSYM +#define XSubtractRegion XSUBTRACTREGION +#define XSupportsLocale XSUPPORTSLOCALE +#define XSync XSYNC +#define XSynchronize XSYNCHRONIZE +#define XTextExtents XTEXTEXTENTS +#define XTextExtents16 XTEXTEXTENTS16 +#define XTextPropertyToStringList XTEXTPROPERTYTOSTRINGLIST +#define XTextWidth XTEXTWIDTH +#define XTextWidth16 XTEXTWIDTH16 +#define XTranslateCoordinates XTRANSLATECOORDINATES +#define XUndefineCursor XUNDEFINECURSOR +#define XUngrabButton XUNGRABBUTTON +#define XUngrabKeyboard XUNGRABKEYBOARD +#define XUngrabPointer XUNGRABPOINTER +#define XUngrabServer XUNGRABSERVER +#define XUninstallColormap XUNINSTALLCOLORMAP +#define XUnionRectWithRegion XUNIONRECTWITHREGION +#define XUnionRegion XUNIONREGION +#define XUniqueContext XUNIQUECONTEXT +#define XUnloadFont XUNLOADFONT +#define XUnmapWindow XUNMAPWINDOW +#define XUnsetICFocus XUNSETICFOCUS +#define XVaCreateNestedList XVACREATENESTEDLIST +#define XVisualIDFromVisual XVISUALIDFROMVISUAL +#define XWMGeometry XWMGEOMETRY +#define XWarpPointer XWARPPOINTER +#define XWhitePixel XWHITEPIXEL +#define XWhitePixelOfScreen XWHITEPIXELOFSCREEN +#define XWidthMMOfScreen XWIDTHMMOFSCREEN +#define XWidthOfScreen XWIDTHOFSCREEN +#define XWindowEvent XWINDOWEVENT +#define XWithdrawWindow XWITHDRAWWINDOW +#define XXorRegion XXORREGION +#define XcmsQueryColor XCMSQUERYCOLOR +#define XdbeAllocateBackBufferName XDBEALLOCATEBACKBUFFERNAME +#define XdbeFreeVisualInfo XDBEFREEVISUALINFO +#define XdbeGetVisualInfo XDBEGETVISUALINFO +#define XdbeQueryExtension XDBEQUERYEXTENSION +#define XdbeSwapBuffers XDBESWAPBUFFERS +#define XextAddDisplay XEXTADDDISPLAY +#define XextFindDisplay XEXTFINDDISPLAY +#define XextRemoveDisplay XEXTREMOVEDISPLAY +#define XkbSetDetectableAutoRepeat XKBSETDETECTABLEAUTOREPEAT +#define XmActivateProtocol XMACTIVATEPROTOCOL +#define XmAddProtocolCallback XMADDPROTOCOLCALLBACK +#define XmAddProtocols XMADDPROTOCOLS +#define XmChangeColor XMCHANGECOLOR +#define XmClipboardCopy XMCLIPBOARDCOPY +#define XmClipboardCopyByName XMCLIPBOARDCOPYBYNAME +#define XmClipboardEndCopy XMCLIPBOARDENDCOPY +#define XmClipboardEndRetrieve XMCLIPBOARDENDRETRIEVE +#define XmClipboardInquireCount XMCLIPBOARDINQUIRECOUNT +#define XmClipboardInquireFormat XMCLIPBOARDINQUIREFORMAT +#define XmClipboardInquireLength XMCLIPBOARDINQUIRELENGTH +#define XmClipboardLock XMCLIPBOARDLOCK +#define XmClipboardRetrieve XMCLIPBOARDRETRIEVE +#define XmClipboardStartCopy XMCLIPBOARDSTARTCOPY +#define XmClipboardStartRetrieve XMCLIPBOARDSTARTRETRIEVE +#define XmClipboardUnlock XMCLIPBOARDUNLOCK +#define XmCommandError XMCOMMANDERROR +#define XmCommandGetChild XMCOMMANDGETCHILD +#define XmCommandSetValue XMCOMMANDSETVALUE +#define XmCreateArrowButton XMCREATEARROWBUTTON +#define XmCreateArrowButtonGadget XMCREATEARROWBUTTONGADGET +#define XmCreateBulletinBoardDialog XMCREATEBULLETINBOARDDIALOG +#define XmCreateCascadeButton XMCREATECASCADEBUTTON +#define XmCreateCascadeButtonGadget XMCREATECASCADEBUTTONGADGET +#define XmCreateDialogShell XMCREATEDIALOGSHELL +#define XmCreateDragIcon XMCREATEDRAGICON +#define XmCreateDrawingArea XMCREATEDRAWINGAREA +#define XmCreateDrawnButton XMCREATEDRAWNBUTTON +#define XmCreateErrorDialog XMCREATEERRORDIALOG +#define XmCreateFileSelectionBox XMCREATEFILESELECTIONBOX +#define XmCreateFileSelectionDialog XMCREATEFILESELECTIONDIALOG +#define XmCreateForm XMCREATEFORM +#define XmCreateFormDialog XMCREATEFORMDIALOG +#define XmCreateFrame XMCREATEFRAME +#define XmCreateInformationDialog XMCREATEINFORMATIONDIALOG +#define XmCreateLabel XMCREATELABEL +#define XmCreateLabelGadget XMCREATELABELGADGET +#define XmCreateList XMCREATELIST +#define XmCreateMainWindow XMCREATEMAINWINDOW +#define XmCreateMenuBar XMCREATEMENUBAR +#define XmCreateMessageBox XMCREATEMESSAGEBOX +#define XmCreateMessageDialog XMCREATEMESSAGEDIALOG +#define XmCreateOptionMenu XMCREATEOPTIONMENU +#define XmCreatePanedWindow XMCREATEPANEDWINDOW +#define XmCreatePopupMenu XMCREATEPOPUPMENU +#define XmCreatePromptDialog XMCREATEPROMPTDIALOG +#define XmCreatePulldownMenu XMCREATEPULLDOWNMENU +#define XmCreatePushButton XMCREATEPUSHBUTTON +#define XmCreatePushButtonGadget XMCREATEPUSHBUTTONGADGET +#define XmCreateQuestionDialog XMCREATEQUESTIONDIALOG +#define XmCreateRadioBox XMCREATERADIOBOX +#define XmCreateRowColumn XMCREATEROWCOLUMN +#define XmCreateScale XMCREATESCALE +#define XmCreateScrollBar XMCREATESCROLLBAR +#define XmCreateScrolledList XMCREATESCROLLEDLIST +#define XmCreateScrolledText XMCREATESCROLLEDTEXT +#define XmCreateScrolledWindow XMCREATESCROLLEDWINDOW +#define XmCreateSelectionDialog XMCREATESELECTIONDIALOG +#define XmCreateSeparator XMCREATESEPARATOR +#define XmCreateSeparatorGadget XMCREATESEPARATORGADGET +#define XmCreateSimpleMenuBar XMCREATESIMPLEMENUBAR +#define XmCreateTemplateDialog XMCREATETEMPLATEDIALOG +#define XmCreateText XMCREATETEXT +#define XmCreateTextField XMCREATETEXTFIELD +#define XmCreateToggleButton XMCREATETOGGLEBUTTON +#define XmCreateToggleButtonGadget XMCREATETOGGLEBUTTONGADGET +#define XmCreateWarningDialog XMCREATEWARNINGDIALOG +#define XmCvtCTToXmString XMCVTCTTOXMSTRING +#define XmDestroyPixmap XMDESTROYPIXMAP +#define XmDragStart XMDRAGSTART +#define XmDropSiteRegister XMDROPSITEREGISTER +#define XmDropSiteUnregister XMDROPSITEUNREGISTER +#define XmDropSiteUpdate XMDROPSITEUPDATE +#define XmDropTransferStart XMDROPTRANSFERSTART +#define XmFileSelectionBoxGetChild XMFILESELECTIONBOXGETCHILD +#define XmFileSelectionDoSearch XMFILESELECTIONDOSEARCH +#define XmFontListAppendEntry XMFONTLISTAPPENDENTRY +#define XmFontListCopy XMFONTLISTCOPY +#define XmFontListCreate XMFONTLISTCREATE +#define XmFontListEntryCreate XMFONTLISTENTRYCREATE +#define XmFontListEntryFree XMFONTLISTENTRYFREE +#define XmFontListEntryGetFont XMFONTLISTENTRYGETFONT +#define XmFontListEntryGetTag XMFONTLISTENTRYGETTAG +#define XmFontListEntryLoad XMFONTLISTENTRYLOAD +#define XmFontListFree XMFONTLISTFREE +#define XmFontListFreeFontContext XMFONTLISTFREEFONTCONTEXT +#define XmFontListGetNextFont XMFONTLISTGETNEXTFONT +#define XmFontListInitFontContext XMFONTLISTINITFONTCONTEXT +#define XmFontListNextEntry XMFONTLISTNEXTENTRY +#define XmGetColors XMGETCOLORS +#define XmGetColorCalculation XMGETCOLORCALCULATION +#define XmGetFocusWidget XMGETFOCUSWIDGET +#define XmGetMenuCursor XMGETMENUCURSOR +#define XmGetPixmap XMGETPIXMAP +#define XmGetPixmapByDepth XMGETPIXMAPBYDEPTH +#define XmGetTearOffControl XMGETTEAROFFCONTROL +#define XmGetXmDisplay XMGETXMDISPLAY +#define XmImMbLookupString XMIMMBLOOKUPSTRING +#define XmImRegister XMIMREGISTER +#define XmImSetFocusValues XMIMSETFOCUSVALUES +#define XmImSetValues XMIMSETVALUES +#define XmImUnregister XMIMUNREGISTER +#define XmImUnsetFocus XMIMUNSETFOCUS +#define XmInstallImage XMINSTALLIMAGE +#define XmInternAtom XMINTERNATOM +#define XmIsMotifWMRunning XMISMOTIFWMRUNNING +#define XmListAddItem XMLISTADDITEM +#define XmListAddItemUnselected XMLISTADDITEMUNSELECTED +#define XmListAddItems XMLISTADDITEMS +#define XmListAddItemsUnselected XMLISTADDITEMSUNSELECTED +#define XmListDeleteAllItems XMLISTDELETEALLITEMS +#define XmListDeleteItem XMLISTDELETEITEM +#define XmListDeleteItemsPos XMLISTDELETEITEMSPOS +#define XmListDeletePos XMLISTDELETEPOS +#define XmListDeselectAllItems XMLISTDESELECTALLITEMS +#define XmListDeselectPos XMLISTDESELECTPOS +#define XmListGetKbdItemPos XMLISTGETKBDITEMPOS +#define XmListGetMatchPos XMLISTGETMATCHPOS +#define XmListGetSelectedPos XMLISTGETSELECTEDPOS +#define XmListItemExists XMLISTITEMEXISTS +#define XmListItemPos XMLISTITEMPOS +#define XmListPosSelected XMLISTPOSSELECTED +#define XmListReplaceItems XMLISTREPLACEITEMS +#define XmListReplaceItemsPos XMLISTREPLACEITEMSPOS +#define XmListSelectItem XMLISTSELECTITEM +#define XmListSelectPos XMLISTSELECTPOS +#define XmListSetBottomPos XMLISTSETBOTTOMPOS +#define XmListSetItem XMLISTSETITEM +#define XmListSetKbdItemPos XMLISTSETKBDITEMPOS +#define XmListSetPos XMLISTSETPOS +#define XmMainWindowSetAreas XMMAINWINDOWSETAREAS +#define XmMenuPosition XMMENUPOSITION +#define XmMessageBoxGetChild XMMESSAGEBOXGETCHILD +#define XmOptionButtonGadget XMOPTIONBUTTONGADGET +#define XmOptionLabelGadget XMOPTIONLABELGADGET +#define XmProcessTraversal XMPROCESSTRAVERSAL +#define XmQmotif XMQMOTIF +#define XmRemoveProtocolCallback XMREMOVEPROTOCOLCALLBACK +#define XmRemoveProtocols XMREMOVEPROTOCOLS +#define XmRemoveTabGroup XMREMOVETABGROUP +#define XmRepTypeGetId XMREPTYPEGETID +#define XmRepTypeGetRecord XMREPTYPEGETRECORD +#define XmRepTypeInstallTearOffModelCon XMREPTYPEINSTALLTEAROFFMODELCON +#define XmRepTypeRegister XMREPTYPEREGISTER +#define XmRepTypeValidValue XMREPTYPEVALIDVALUE +#define XmScrollBarGetValues XMSCROLLBARGETVALUES +#define XmScrollBarSetValues XMSCROLLBARSETVALUES +#define XmScrolledWindowSetAreas XMSCROLLEDWINDOWSETAREAS +#define XmSelectionBoxGetChild XMSELECTIONBOXGETCHILD +#define XmSetColorCalculation XMSETCOLORCALCULATION +#define XmStringByteCompare XMSTRINGBYTECOMPARE +#define XmStringCompare XMSTRINGCOMPARE +#define XmStringConcat XMSTRINGCONCAT +#define XmStringCopy XMSTRINGCOPY +#define XmStringCreate XMSTRINGCREATE +#define XmStringCreateLocalized XMSTRINGCREATELOCALIZED +#define XmStringCreateLtoR XMSTRINGCREATELTOR +#define XmStringCreateSimple XMSTRINGCREATESIMPLE +#define XmStringDraw XMSTRINGDRAW +#define XmStringDrawUnderline XMSTRINGDRAWUNDERLINE +#define XmStringExtent XMSTRINGEXTENT +#define XmStringFree XMSTRINGFREE +#define XmStringFreeContext XMSTRINGFREECONTEXT +#define XmStringGetLtoR XMSTRINGGETLTOR +#define XmStringGetNextComponent XMSTRINGGETNEXTCOMPONENT +#define XmStringGetNextSegment XMSTRINGGETNEXTSEGMENT +#define XmStringInitContext XMSTRINGINITCONTEXT +#define XmStringLength XMSTRINGLENGTH +#define XmStringLtoRCreate XMSTRINGLTORCREATE +#define XmStringNConcat XMSTRINGNCONCAT +#define XmStringSegmentCreate XMSTRINGSEGMENTCREATE +#define XmStringSeparatorCreate XMSTRINGSEPARATORCREATE +#define XmStringWidth XMSTRINGWIDTH +#define XmTextClearSelection XMTEXTCLEARSELECTION +#define XmTextCopy XMTEXTCOPY +#define XmTextCut XMTEXTCUT +#define XmTextFieldClearSelection XMTEXTFIELDCLEARSELECTION +#define XmTextFieldCopy XMTEXTFIELDCOPY +#define XmTextFieldCut XMTEXTFIELDCUT +#define XmTextFieldGetEditable XMTEXTFIELDGETEDITABLE +#define XmTextFieldGetInsertionPosition XMTEXTFIELDGETINSERTIONPOSITION +#define XmTextFieldGetLastPosition XMTEXTFIELDGETLASTPOSITION +#define XmTextFieldGetMaxLength XMTEXTFIELDGETMAXLENGTH +#define XmTextFieldGetSelection XMTEXTFIELDGETSELECTION +#define XmTextFieldGetSelectionPosition XMTEXTFIELDGETSELECTIONPOSITION +#define XmTextFieldGetString XMTEXTFIELDGETSTRING +#define XmTextFieldInsert XMTEXTFIELDINSERT +#define XmTextFieldPaste XMTEXTFIELDPASTE +#define XmTextFieldRemove XMTEXTFIELDREMOVE +#define XmTextFieldReplace XMTEXTFIELDREPLACE +#define XmTextFieldSetAddMode XMTEXTFIELDSETADDMODE +#define XmTextFieldSetHighlight XMTEXTFIELDSETHIGHLIGHT +#define XmTextFieldSetInsertionPosition XMTEXTFIELDSETINSERTIONPOSITION +#define XmTextFieldSetMaxLength XMTEXTFIELDSETMAXLENGTH +#define XmTextFieldSetSelection XMTEXTFIELDSETSELECTION +#define XmTextFieldSetString XMTEXTFIELDSETSTRING +#define XmTextFieldShowPosition XMTEXTFIELDSHOWPOSITION +#define XmTextGetCursorPosition XMTEXTGETCURSORPOSITION +#define XmTextGetEditable XMTEXTGETEDITABLE +#define XmTextGetInsertionPosition XMTEXTGETINSERTIONPOSITION +#define XmTextGetLastPosition XMTEXTGETLASTPOSITION +#define XmTextGetMaxLength XMTEXTGETMAXLENGTH +#define XmTextGetSelection XMTEXTGETSELECTION +#define XmTextGetSelectionPosition XMTEXTGETSELECTIONPOSITION +#define XmTextGetString XMTEXTGETSTRING +#define XmTextInsert XMTEXTINSERT +#define XmTextPaste XMTEXTPASTE +#define XmTextPosToXY XMTEXTPOSTOXY +#define XmTextRemove XMTEXTREMOVE +#define XmTextReplace XMTEXTREPLACE +#define XmTextSetCursorPosition XMTEXTSETCURSORPOSITION +#define XmTextSetEditable XMTEXTSETEDITABLE +#define XmTextSetHighlight XMTEXTSETHIGHLIGHT +#define XmTextSetInsertionPosition XMTEXTSETINSERTIONPOSITION +#define XmTextSetSelection XMTEXTSETSELECTION +#define XmTextSetString XMTEXTSETSTRING +#define XmTextSetTopCharacter XMTEXTSETTOPCHARACTER +#define XmTextShowPosition XMTEXTSHOWPOSITION +#define XmToggleButtonGadgetGetState XMTOGGLEBUTTONGADGETGETSTATE +#define XmToggleButtonGadgetSetState XMTOGGLEBUTTONGADGETSETSTATE +#define XmToggleButtonGetState XMTOGGLEBUTTONGETSTATE +#define XmToggleButtonSetState XMTOGGLEBUTTONSETSTATE +#define XmUninstallImage XMUNINSTALLIMAGE +#define XmUpdateDisplay XMUPDATEDISPLAY +#define XmVaCreateSimpleRadioBox XMVACREATESIMPLERADIOBOX +#define XmbDrawString XMBDRAWSTRING +#define XmbLookupString XMBLOOKUPSTRING +#define XmbResetIC XMBRESETIC +#define XmbSetWMProperties XMBSETWMPROPERTIES +#define XmbTextEscapement XMBTEXTESCAPEMENT +#define XmbTextExtents XMBTEXTEXTENTS +#define XmbTextListToTextProperty XMBTEXTLISTTOTEXTPROPERTY +#define XmbTextPropertyToTextList XMBTEXTPROPERTYTOTEXTLIST +#define XmbufCreateBuffers XMBUFCREATEBUFFERS +#define XmbufDestroyBuffers XMBUFDESTROYBUFFERS +#define XmbufDisplayBuffers XMBUFDISPLAYBUFFERS +#define XmbufQueryExtension XMBUFQUERYEXTENSION +#define Xmemory_free XMEMORY_FREE +#define Xmemory_malloc XMEMORY_MALLOC +#define XmuClientWindow XMUCLIENTWINDOW +#define XmuConvertStandardSelection XMUCONVERTSTANDARDSELECTION +#define XmuCvtStringToBitmap XMUCVTSTRINGTOBITMAP +#define XmuInternAtom XMUINTERNATOM +#define XmuInternStrings XMUINTERNSTRINGS +#define XmuLookupStandardColormap XMULOOKUPSTANDARDCOLORMAP +#define XmuPrintDefaultErrorMessage XMUPRINTDEFAULTERRORMESSAGE +#define XrmCombineDatabase XRMCOMBINEDATABASE +#define XrmCombineFileDatabase XRMCOMBINEFILEDATABASE +#define XrmDestroyDatabase XRMDESTROYDATABASE +#define XrmGetDatabase XRMGETDATABASE +#define XrmGetFileDatabase XRMGETFILEDATABASE +#define XrmGetResource XRMGETRESOURCE +#define XrmGetStringDatabase XRMGETSTRINGDATABASE +#define XrmInitialize XRMINITIALIZE +#define XrmMergeDatabases XRMMERGEDATABASES +#define XrmParseCommand XRMPARSECOMMAND +#define XrmPermStringToQuark XRMPERMSTRINGTOQUARK +#define XrmPutFileDatabase XRMPUTFILEDATABASE +#define XrmPutLineResource XRMPUTLINERESOURCE +#define XrmPutStringResource XRMPUTSTRINGRESOURCE +#define XrmQGetResource XRMQGETRESOURCE +#define XrmQPutStringResource XRMQPUTSTRINGRESOURCE +#define XrmQuarkToString XRMQUARKTOSTRING +#define XrmSetDatabase XRMSETDATABASE +#define XrmStringToBindingQuarkList XRMSTRINGTOBINDINGQUARKLIST +#define XrmStringToQuark XRMSTRINGTOQUARK +#define XtAddCallback XTADDCALLBACK +#define XtAddCallbacks XTADDCALLBACKS +#define XtAddConverter XTADDCONVERTER +#define XtAddEventHandler XTADDEVENTHANDLER +#define XtAddExposureToRegion XTADDEXPOSURETOREGION +#define XtAddGrab XTADDGRAB +#define XtAddRawEventHandler XTADDRAWEVENTHANDLER +#define XtAllocateGC XTALLOCATEGC +#define XtAppAddActions XTAPPADDACTIONS +#define XtAppAddInput XTAPPADDINPUT +#define XtAppAddTimeOut XTAPPADDTIMEOUT +#define XtAppAddWorkProc XTAPPADDWORKPROC +#define XtAppCreateShell XTAPPCREATESHELL +#define XtAppError XTAPPERROR +#define XtAppErrorMsg XTAPPERRORMSG +#define XtAppGetErrorDatabase XTAPPGETERRORDATABASE +#define XtAppGetErrorDatabaseText XTAPPGETERRORDATABASETEXT +#define XtAppSetErrorMsgHandler XTAPPSETERRORMSGHANDLER +#define XtAppInitialize XTAPPINITIALIZE +#define XtAppMainLoop XTAPPMAINLOOP +#define XtAppNextEvent XTAPPNEXTEVENT +#define XtAppPeekEvent XTAPPPEEKEVENT +#define XtAppPending XTAPPPENDING +#define XtAppProcessEvent XTAPPPROCESSEVENT +#define XtAppSetErrorHandler XTAPPSETERRORHANDLER +#define XtAppSetFallbackResources XTAPPSETFALLBACKRESOURCES +#define XtAppSetTypeConverter XTAPPSETTYPECONVERTER +#define XtAppSetWarningHandler XTAPPSETWARNINGHANDLER +#define XtAppWarningMsg XTAPPWARNINGMSG +#define XtAppSetWarningMsgHandler XTAPPSETWARNINGMSGHANDLER +#define XtAppWarning XTAPPWARNING +#define XtAugmentTranslations XTAUGMENTTRANSLATIONS +#define XtCallActionProc XTCALLACTIONPROC +#define XtCallCallbackList XTCALLCALLBACKLIST +#define XtCallCallbacks XTCALLCALLBACKS +#define XtCallConverter XTCALLCONVERTER +#define XtCalloc XTCALLOC +#ifndef NOXTDISPLAY +#define XtClass XTCLASS +#endif +#define XtCloseDisplay XTCLOSEDISPLAY +#define XtConfigureWidget XTCONFIGUREWIDGET +#define XtConvert XTCONVERT +#define XtConvertAndStore XTCONVERTANDSTORE +#define XtCreateApplicationContext XTCREATEAPPLICATIONCONTEXT +#define XtCreateManagedWidget XTCREATEMANAGEDWIDGET +#define XtCreatePopupShell XTCREATEPOPUPSHELL +#define XtCreateWidget XTCREATEWIDGET +#define XtCreateWindow XTCREATEWINDOW +#define XtCvtStringToFont XTCVTSTRINGTOFONT +#define XtDatabase XTDATABASE +#define XtDestroyApplicationContext XTDESTROYAPPLICATIONCONTEXT +#define XtDestroyWidget XTDESTROYWIDGET +#define XtDisownSelection XTDISOWNSELECTION +#define XtDispatchEvent XTDISPATCHEVENT +#ifndef NOXTDISPLAY +#define XtDisplay XTDISPLAY +#endif +#define XtDisplayInitialize XTDISPLAYINITIALIZE +#define XtDisplayOfObject XTDISPLAYOFOBJECT +#define XtDisplayStringConvWarning XTDISPLAYSTRINGCONVWARNING +#define XtDisplayToApplicationContext XTDISPLAYTOAPPLICATIONCONTEXT +#define XtError XTERROR +#define XtErrorMsg XTERRORMSG +#define XtFree XTFREE +#define XtGetActionKeysym XTGETACTIONKEYSYM +#define XtGetActionList XTGETACTIONLIST +#define XtGetApplicationNameAndClass XTGETAPPLICATIONNAMEANDCLASS +#define XtGetApplicationResources XTGETAPPLICATIONRESOURCES +#define XtGetClassExtension XTGETCLASSEXTENSION +#define XtGetConstraintResourceList XTGETCONSTRAINTRESOURCELIST +#define XtGetGC XTGETGC +#define XtGetMultiClickTime XTGETMULTICLICKTIME +#define XtGetResourceList XTGETRESOURCELIST +#define XtGetSelectionValue XTGETSELECTIONVALUE +#define XtGetSelectionValues XTGETSELECTIONVALUES +#define XtGetSubresources XTGETSUBRESOURCES +#define XtGetValues XTGETVALUES +#define XtGrabButton XTGRABBUTTON +#define XtGrabKeyboard XTGRABKEYBOARD +#define XtGrabPointer XTGRABPOINTER +#define XtHasCallbacks XTHASCALLBACKS +#define XtInitialize XTINITIALIZE +#define XtInitializeWidgetClass XTINITIALIZEWIDGETCLASS +#define XtInsertEventHandler XTINSERTEVENTHANDLER +#define XtInsertRawEventHandler XTINSERTRAWEVENTHANDLER +#define XtInstallAccelerators XTINSTALLACCELERATORS +#define XtIsManaged XTISMANAGED +#define XtIsObject XTISOBJECT +#ifndef NOXTDISPLAY +#define XtIsRealized XTISREALIZED +#endif +#define XtIsSensitive XTISSENSITIVE +#define XtIsSubclass XTISSUBCLASS +#define XtLastTimestampProcessed XTLASTTIMESTAMPPROCESSED +#define XtMainLoop XTMAINLOOP +#define XtMakeGeometryRequest XTMAKEGEOMETRYREQUEST +#define XtMakeResizeRequest XTMAKERESIZEREQUEST +#define XtMalloc XTMALLOC +#define XtManageChild XTMANAGECHILD +#define XtManageChildren XTMANAGECHILDREN +#define XtMergeArgLists XTMERGEARGLISTS +#define XtMoveWidget XTMOVEWIDGET +#define XtName XTNAME +#define XtNameToWidget XTNAMETOWIDGET +#define XtOpenApplication XTOPENAPPLICATION +#define XtOpenDisplay XTOPENDISPLAY +#define XtOverrideTranslations XTOVERRIDETRANSLATIONS +#define XtOwnSelection XTOWNSELECTION +#ifndef NOXTDISPLAY +#define XtParent XTPARENT +#endif +#define XtParseAcceleratorTable XTPARSEACCELERATORTABLE +#define XtParseTranslationTable XTPARSETRANSLATIONTABLE +#define XtPopdown XTPOPDOWN +#define XtPopup XTPOPUP +#define XtPopupSpringLoaded XTPOPUPSPRINGLOADED +#define XtQueryGeometry XTQUERYGEOMETRY +#define XtRealizeWidget XTREALIZEWIDGET +#define XtRealloc XTREALLOC +#define XtRegisterDrawable _XTREGISTERWINDOW +#define XtRegisterGrabAction XTREGISTERGRABACTION +#define XtReleaseGC XTRELEASEGC +#define XtRemoveAllCallbacks XTREMOVEALLCALLBACKS +#define XtRemoveCallback XTREMOVECALLBACK +#define XtRemoveEventHandler XTREMOVEEVENTHANDLER +#define XtRemoveGrab XTREMOVEGRAB +#define XtRemoveInput XTREMOVEINPUT +#define XtRemoveTimeOut XTREMOVETIMEOUT +#define XtRemoveWorkProc XTREMOVEWORKPROC +#define XtResizeWidget XTRESIZEWIDGET +#define XtResolvePathname XTRESOLVEPATHNAME +#ifndef NOXTDISPLAY +#define XtScreen XTSCREEN +#endif +#define XtScreenDatabase XTSCREENDATABASE +#define XtScreenOfObject XTSCREENOFOBJECT +#define XtSessionReturnToken XTSESSIONRETURNTOKEN +#define XtSetErrorHandler XTSETERRORHANDLER +#define XtSetKeyboardFocus XTSETKEYBOARDFOCUS +#define XtSetLanguageProc XTSETLANGUAGEPROC +#define XtSetMappedWhenManaged XTSETMAPPEDWHENMANAGED +#define XtSetSensitive XTSETSENSITIVE +#define XtSetTypeConverter XTSETTYPECONVERTER +#define XtSetValues XTSETVALUES +#define XtShellStrings XTSHELLSTRINGS +#define XtStringConversionWarning XTSTRINGCONVERSIONWARNING +#define XtStrings XTSTRINGS +#define XtToolkitInitialize XTTOOLKITINITIALIZE +#define XtTranslateCoords XTTRANSLATECOORDS +#define XtTranslateKeycode XTTRANSLATEKEYCODE +#define XtUngrabButton XTUNGRABBUTTON +#define XtUngrabKeyboard XTUNGRABKEYBOARD +#define XtUngrabPointer XTUNGRABPOINTER +#define XtUnmanageChild XTUNMANAGECHILD +#define XtUnmanageChildren XTUNMANAGECHILDREN +#define XtUnrealizeWidget XTUNREALIZEWIDGET +#define XtUnregisterDrawable _XTUNREGISTERWINDOW +#define XtVaAppCreateShell XTVAAPPCREATESHELL +#define XtVaCreateManagedWidget XTVACREATEMANAGEDWIDGET +#define XtVaCreatePopupShell XTVACREATEPOPUPSHELL +#define XtVaCreateWidget XTVACREATEWIDGET +#define XtVaGetApplicationResources XTVAGETAPPLICATIONRESOURCES +#define XtVaGetValues XTVAGETVALUES +#define XtVaSetValues XTVASETVALUES +#define XtWarning XTWARNING +#define XtWarningMsg XTWARNINGMSG +#define XtWidgetToApplicationContext XTWIDGETTOAPPLICATIONCONTEXT +#ifndef NOXTDISPLAY +#define XtWindow XTWINDOW +#endif +#define XtWindowOfObject XTWINDOWOFOBJECT +#define XtWindowToWidget XTWINDOWTOWIDGET +#define XwcDrawImageString XWCDRAWIMAGESTRING +#define XwcDrawString XWCDRAWSTRING +#define XwcFreeStringList XWCFREESTRINGLIST +#define XwcTextEscapement XWCTEXTESCAPEMENT +#define XwcTextExtents XWCTEXTEXTENTS +#define XwcTextListToTextProperty XWCTEXTLISTTOTEXTPROPERTY +#define XwcLookupString XWCLOOKUPSTRING +#define XwcTextPropertyToTextList XWCTEXTPROPERTYTOTEXTLIST +#define _XAllocTemp _XALLOCTEMP +#define _XDeqAsyncHandler _XDEQASYNCHANDLER +#define _XEatData _XEATDATA +#define _XFlush _XFLUSH +#define _XFreeTemp _XFREETEMP +#define _XGetAsyncReply _XGETASYNCREPLY +#define _XInitImageFuncPtrs _XINITIMAGEFUNCPTRS +#define _XRead _XREAD +#define _XReadPad _XREADPAD +#define _XRegisterFilterByType _XREGISTERFILTERBYTYPE +#define _XReply _XREPLY +#define _XSend _XSEND +#define _XUnregisterFilter _XUNREGISTERFILTER +#define _XVIDtoVisual _XVIDTOVISUAL +#define _XmBottomShadowColorDefault _XMBOTTOMSHADOWCOLORDEFAULT +#define _XmClearBorder _XMCLEARBORDER +#define _XmConfigureObject _XMCONFIGUREOBJECT +#define _XmDestroyParentCallback _XMDESTROYPARENTCALLBACK +#define _XmDrawArrow _XMDRAWARROW +#define _XmDrawShadows _XMDRAWSHADOWS +#define _XmFontListGetDefaultFont _XMFONTLISTGETDEFAULTFONT +#define _XmFromHorizontalPixels _XMFROMHORIZONTALPIXELS +#define _XmFromVerticalPixels _XMFROMVERTICALPIXELS +#define _XmGetClassExtensionPtr _XMGETCLASSEXTENSIONPTR +#define _XmGetDefaultFontList _XMGETDEFAULTFONTLIST +#define _XmGetTextualDragIcon _XMGETTEXTUALDRAGICON +#define _XmGetWidgetExtData _XMGETWIDGETEXTDATA +#define _XmGrabKeyboard _XMGRABKEYBOARD +#define _XmGrabPointer _XMGRABPOINTER +#define _XmInheritClass _XMINHERITCLASS +#define _XmInputForGadget _XMINPUTFORGADGET +#define _XmInputInGadget _XMINPUTINGADGET +#define _XmMakeGeometryRequest _XMMAKEGEOMETRYREQUEST +#define _XmMenuPopDown _XMMENUPOPDOWN +#define _XmMoveObject _XMMOVEOBJECT +#define _XmNavigChangeManaged _XMNAVIGCHANGEMANAGED +#define _XmOSBuildFileList _XMOSBUILDFILELIST +#define _XmOSFileCompare _XMOSFILECOMPARE +#define _XmOSFindPatternPart _XMOSFINDPATTERNPART +#define _XmOSQualifyFileSpec _XMOSQUALIFYFILESPEC +#define _XmPostPopupMenu _XMPOSTPOPUPMENU +#define _XmPrimitiveEnter _XMPRIMITIVEENTER +#define _XmPrimitiveLeave _XMPRIMITIVELEAVE +#define _XmRedisplayGadgets _XMREDISPLAYGADGETS +#define _XmShellIsExclusive _XMSHELLISEXCLUSIVE +#define _XmStringDraw _XMSTRINGDRAW +#define _XmStringGetTextConcat _XMSTRINGGETTEXTCONCAT +#define _XmStrings _XMSTRINGS +#define _XmToHorizontalPixels _XMTOHORIZONTALPIXELS +#define _XmToVerticalPixels _XMTOVERTICALPIXELS +#define _XmTopShadowColorDefault _XMTOPSHADOWCOLORDEFAULT +#define _Xm_fastPtr _XM_FASTPTR +#define _XtCheckSubclassFlag _XTCHECKSUBCLASSFLAG +#define _XtCopyFromArg _XTCOPYFROMARG +#define _XtCountVaList _XTCOUNTVALIST +#define _XtInherit _XTINHERIT +#define _XtInheritTranslations _XTINHERITTRANSLATIONS +#define _XtIsSubclassOf _XTISSUBCLASSOF +#define _XtVaToArgList _XTVATOARGLIST +#define applicationShellWidgetClass APPLICATIONSHELLWIDGETCLASS +#define cli$dcl_parse CLI$DCL_PARSE +#define cli$get_value CLI$GET_VALUE +#define cli$present CLI$PRESENT +#define compositeClassRec COMPOSITECLASSREC +#define compositeWidgetClass COMPOSITEWIDGETCLASS +#define constraintClassRec CONSTRAINTCLASSREC +#define constraintWidgetClass CONSTRAINTWIDGETCLASS +#define coreWidgetClass COREWIDGETCLASS +#define exe$getspi EXE$GETSPI +#define lbr$close LBR$CLOSE +#define lbr$get_header LBR$GET_HEADER +#define lbr$get_index LBR$GET_INDEX +#define lbr$get_record LBR$GET_RECORD +#define lbr$ini_control LBR$INI_CONTROL +#define lbr$lookup_key LBR$LOOKUP_KEY +#define lbr$open LBR$OPEN +#define lbr$output_help LBR$OUTPUT_HELP +#define lib$add_times LIB$ADD_TIMES +#define lib$addx LIB$ADDX +#define lib$create_dir LIB$CREATE_DIR +#define lib$create_vm_zone LIB$CREATE_VM_ZONE +#define lib$cvt_from_internal_time LIB$CVT_FROM_INTERNAL_TIME +#define lib$cvt_htb LIB$CVT_HTB +#define lib$cvt_vectim LIB$CVT_VECTIM +#define lib$day LIB$DAY +#define lib$day_of_week LIB$DAY_OF_WEEK +#define lib$delete_symbol LIB$DELETE_SYMBOL +#define lib$delete_vm_zone LIB$DELETE_VM_ZONE +#define lib$disable_ctrl LIB$DISABLE_CTRL +#define lib$ediv LIB$EDIV +#define lib$emul LIB$EMUL +#define lib$enable_ctrl LIB$ENABLE_CTRL +#define lib$find_vm_zone LIB$FIND_VM_ZONE +#define lib$format_date_time LIB$FORMAT_DATE_TIME +#define lib$free_timer LIB$FREE_TIMER +#define lib$free_vm LIB$FREE_VM +#define lib$get_ef LIB$GET_EF +#define lib$get_foreign LIB$GET_FOREIGN +#define lib$get_input LIB$GET_INPUT +#define lib$get_users_language LIB$GET_USERS_LANGUAGE +#define lib$get_vm LIB$GET_VM +#define lib$get_symbol LIB$GET_SYMBOL +#define lib$getdvi LIB$GETDVI +#define lib$init_date_time_context LIB$INIT_DATE_TIME_CONTEXT +#define lib$init_timer LIB$INIT_TIMER +#define lib$find_file LIB$FIND_FILE +#define lib$find_file_end LIB$FIND_FILE_END +#define lib$find_image_symbol LIB$FIND_IMAGE_SYMBOL +#define lib$mult_delta_time LIB$MULT_DELTA_TIME +#define lib$put_output LIB$PUT_OUTPUT +#define lib$rename_file LIB$RENAME_FILE +#define lib$reset_vm_zone LIB$RESET_VM_ZONE +#define lib$set_symbol LIB$SET_SYMBOL +#define lib$sfree1_dd LIB$SFREE1_DD +#define lib$show_vm LIB$SHOW_VM +#define lib$show_vm_zone LIB$SHOW_VM_ZONE +#define lib$spawn LIB$SPAWN +#define lib$stat_timer LIB$STAT_TIMER +#define lib$subx LIB$SUBX +#define lib$sub_times LIB$SUB_TIMES +#define lib$wait LIB$WAIT +#define mail$send_add_address MAIL$SEND_ADD_ADDRESS +#define mail$send_add_attribute MAIL$SEND_ADD_ATTRIBUTE +#define mail$send_add_bodypart MAIL$SEND_ADD_BODYPART +#define mail$send_begin MAIL$SEND_BEGIN +#define mail$send_end MAIL$SEND_END +#define mail$send_message MAIL$SEND_MESSAGE +#define ncs$convert NCS$CONVERT +#define ncs$get_cf NCS$GET_CF +#define objectClass OBJECTCLASS +#define objectClassRec OBJECTCLASSREC +#define overrideShellClassRec OVERRIDESHELLCLASSREC +#define overrideShellWidgetClass OVERRIDESHELLWIDGETCLASS +#define pthread_attr_create PTHREAD_ATTR_CREATE +#define pthread_attr_delete PTHREAD_ATTR_DELETE +#define pthread_attr_destroy PTHREAD_ATTR_DESTROY +#define pthread_attr_getdetach_np PTHREAD_ATTR_GETDETACH_NP +#define pthread_attr_getguardsize_np PTHREAD_ATTR_GETGUARDSIZE_NP +#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED +#define pthread_attr_getprio PTHREAD_ATTR_GETPRIO +#define pthread_attr_getsched PTHREAD_ATTR_GETSCHED +#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM +#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY +#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE +#define pthread_attr_init PTHREAD_ATTR_INIT +#define pthread_attr_setdetach_np PTHREAD_ATTR_SETDETACH_NP +#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE +#define pthread_attr_setguardsize_np PTHREAD_ATTR_SETGUARDSIZE_NP +#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED +#define pthread_attr_setprio PTHREAD_ATTR_SETPRIO +#define pthread_attr_setsched PTHREAD_ATTR_SETSCHED +#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM +#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY +#ifndef pthread_attr_setscope +# define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE +#endif +#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE +#define pthread_cancel PTHREAD_CANCEL +#define pthread_cancel_e PTHREAD_CANCEL_E +#define pthread_cond_broadcast PTHREAD_COND_BROADCAST +#define pthread_cond_destroy PTHREAD_COND_DESTROY +#define pthread_cond_init PTHREAD_COND_INIT +#define pthread_cond_sig_preempt_int_np PTHREAD_COND_SIG_PREEMPT_INT_NP +#define pthread_cond_signal PTHREAD_COND_SIGNAL +#define pthread_cond_signal_int_np PTHREAD_COND_SIGNAL_INT_NP +#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT +#define pthread_cond_wait PTHREAD_COND_WAIT +#define pthread_condattr_create PTHREAD_CONDATTR_CREATE +#define pthread_condattr_delete PTHREAD_CONDATTR_DELETE +#define pthread_condattr_init PTHREAD_CONDATTR_INIT +#define pthread_create PTHREAD_CREATE +#define pthread_delay_np PTHREAD_DELAY_NP +#define pthread_detach PTHREAD_DETACH +#define pthread_equal PTHREAD_EQUAL +#define pthread_exc_fetch_fp_np PTHREAD_EXC_FETCH_FP_NP +#define pthread_exc_handler_np PTHREAD_EXC_HANDLER_NP +#define pthread_exc_matches_np PTHREAD_EXC_MATCHES_NP +#define pthread_exc_pop_ctx_np PTHREAD_EXC_POP_CTX_NP +#define pthread_exc_push_ctx_np PTHREAD_EXC_PUSH_CTX_NP +#define pthread_exc_raise_np PTHREAD_EXC_RAISE_NP +#define pthread_exc_savecontext_np PTHREAD_EXC_SAVECONTEXT_NP +#define pthread_exit PTHREAD_EXIT +#define pthread_get_expiration_np PTHREAD_GET_EXPIRATION_NP +#define pthread_getprio PTHREAD_GETPRIO +#define pthread_getschedparam PTHREAD_GETSCHEDPARAM +#define pthread_getscheduler PTHREAD_GETSCHEDULER +#define pthread_getspecific PTHREAD_GETSPECIFIC +#define pthread_getunique_np PTHREAD_GETUNIQUE_NP +#define pthread_join PTHREAD_JOIN +#define pthread_join32 PTHREAD_JOIN32 +#define pthread_key_create PTHREAD_KEY_CREATE +#define pthread_key_delete PTHREAD_KEY_DELETE +#define pthread_keycreate PTHREAD_KEYCREATE +#define pthread_kill PTHREAD_KILL +#define pthread_lock_global_np PTHREAD_LOCK_GLOBAL_NP +#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY +#define pthread_mutex_init PTHREAD_MUTEX_INIT +#define pthread_mutex_lock PTHREAD_MUTEX_LOCK +#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK +#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK +#define pthread_mutexattr_create PTHREAD_MUTEXATTR_CREATE +#define pthread_mutexattr_delete PTHREAD_MUTEXATTR_DELETE +#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY +#define pthread_mutexattr_getkind_np PTHREAD_MUTEXATTR_GETKIND_NP +#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT +#define pthread_mutexattr_setkind_np PTHREAD_MUTEXATTR_SETKIND_NP +#define pthread_mutexattr_settype_np PTHREAD_MUTEXATTR_SETTYPE_NP +#define pthread_once PTHREAD_ONCE +#define pthread_resume_np PTHREAD_RESUME_NP +#define pthread_self PTHREAD_SELF +#define pthread_setasynccancel PTHREAD_SETASYNCCANCEL +#define pthread_setcancel PTHREAD_SETCANCEL +#define pthread_setcancelstate PTHREAD_SETCANCELSTATE +#define pthread_setcanceltype PTHREAD_SETCANCELTYPE +#define pthread_setprio PTHREAD_SETPRIO +#define pthread_setschedparam PTHREAD_SETSCHEDPARAM +#define pthread_setscheduler PTHREAD_SETSCHEDULER +#define pthread_setspecific PTHREAD_SETSPECIFIC +#define pthread_suspend_np PTHREAD_SUSPEND_NP +#define pthread_testcancel PTHREAD_TESTCANCEL +#define pthread_unlock_global_np PTHREAD_UNLOCK_GLOBAL_NP +#define pthread_yield PTHREAD_YIELD +#define pthread_yield_np PTHREAD_YIELD_NP +#define rectObjClass RECTOBJCLASS +#define rectObjClassRec RECTOBJCLASSREC +#define sessionShellWidgetClass SESSIONSHELLWIDGETCLASS +#define shellWidgetClass SHELLWIDGETCLASS +#define shmat SHMAT +#define shmctl SHMCTL +#define shmdt SHMDT +#define shmget SHMGET +#define smg$create_key_table SMG$CREATE_KEY_TABLE +#define smg$create_virtual_keyboard SMG$CREATE_VIRTUAL_KEYBOARD +#define smg$read_composed_line SMG$READ_COMPOSED_LINE +#define sys$add_ident SYS$ADD_IDENT +#define sys$asctoid SYS$ASCTOID +#define sys$assign SYS$ASSIGN +#define sys$bintim SYS$BINTIM +#define sys$cancel SYS$CANCEL +#define sys$cantim SYS$CANTIM +#define sys$check_access SYS$CHECK_ACCESS +#define sys$close SYS$CLOSE +#define sys$connect SYS$CONNECT +#define sys$create SYS$CREATE +#define sys$create_user_profile SYS$CREATE_USER_PROFILE +#define sys$crembx SYS$CREMBX +#define sys$creprc SYS$CREPRC +#define sys$crmpsc SYS$CRMPSC +#define sys$dassgn SYS$DASSGN +#define sys$dclast SYS$DCLAST +#define sys$dclexh SYS$DCLEXH +#define sys$delprc SYS$DELPRC +#define sys$deq SYS$DEQ +#define sys$dgblsc SYS$DGBLSC +#define sys$display SYS$DISPLAY +#define sys$enq SYS$ENQ +#define sys$enqw SYS$ENQW +#define sys$erase SYS$ERASE +#define sys$fao SYS$FAO +#define sys$faol SYS$FAOL +#define sys$find_held SYS$FIND_HELD +#define sys$finish_rdb SYS$FINISH_RDB +#define sys$flush SYS$FLUSH +#define sys$forcex SYS$FORCEX +#define sys$get SYS$GET +#define sys$get_security SYS$GET_SECURITY +#define sys$getdviw SYS$GETDVIW +#define sys$getjpi SYS$GETJPI +#define sys$getjpiw SYS$GETJPIW +#define sys$getlkiw SYS$GETLKIW +#define sys$getmsg SYS$GETMSG +#define sys$getsyi SYS$GETSYI +#define sys$getsyiw SYS$GETSYIW +#define sys$gettim SYS$GETTIM +#define sys$getuai SYS$GETUAI +#define sys$grantid SYS$GRANTID +#define sys$hash_password SYS$HASH_PASSWORD +#define sys$hiber SYS$HIBER +#define sys$mgblsc SYS$MGBLSC +#define sys$numtim SYS$NUMTIM +#define sys$open SYS$OPEN +#define sys$parse SYS$PARSE +#define sys$parse_acl SYS$PARSE_ACL +#define sys$parse_acl SYS$PARSE_ACL +#define sys$persona_assume SYS$PERSONA_ASSUME +#define sys$persona_create SYS$PERSONA_CREATE +#define sys$persona_delete SYS$PERSONA_DELETE +#define sys$process_scan SYS$PROCESS_SCAN +#define sys$put SYS$PUT +#define sys$qio SYS$QIO +#define sys$qiow SYS$QIOW +#define sys$read SYS$READ +#define sys$resched SYS$RESCHED +#define sys$rewind SYS$REWIND +#define sys$search SYS$SEARCH +#define sys$set_security SYS$SET_SECURITY +#define sys$setast SYS$SETAST +#define sys$setef SYS$SETEF +#define sys$setimr SYS$SETIMR +#define sys$setpri SYS$SETPRI +#define sys$setprn SYS$SETPRN +#define sys$setprv SYS$SETPRV +#define sys$setswm SYS$SETSWM +#define sys$setuai SYS$SETUAI +#define sys$sndopr SYS$SNDOPR +#define sys$synch SYS$SYNCH +#define sys$trnlnm SYS$TRNLNM +#define sys$update SYS$UPDATE +#define sys$wake SYS$WAKE +#define sys$write SYS$WRITE +#define topLevelShellClassRec TOPLEVELSHELLCLASSREC +#define topLevelShellWidgetClass TOPLEVELSHELLWIDGETCLASS +#define transientShellWidgetClass TRANSIENTSHELLWIDGETCLASS +#define vendorShellClassRec VENDORSHELLCLASSREC +#define vendorShellWidgetClass VENDORSHELLWIDGETCLASS +#define widgetClass WIDGETCLASS +#define widgetClassRec WIDGETCLASSREC +#define wmShellClassRec WMSHELLCLASSREC +#define wmShellWidgetClass WMSHELLWIDGETCLASS +#define x$soft_ast_lib_lock X$SOFT_AST_LIB_LOCK +#define x$soft_ast_lock_depth X$SOFT_AST_LOCK_DEPTH +#define x$soft_reenable_asts X$SOFT_REENABLE_ASTS +#define xmArrowButtonWidgetClass XMARROWBUTTONWIDGETCLASS +#define xmBulletinBoardWidgetClass XMBULLETINBOARDWIDGETCLASS +#define xmCascadeButtonClassRec XMCASCADEBUTTONCLASSREC +#define xmCascadeButtonGadgetClass XMCASCADEBUTTONGADGETCLASS +#define xmCascadeButtonWidgetClass XMCASCADEBUTTONWIDGETCLASS +#define xmCommandWidgetClass XMCOMMANDWIDGETCLASS +#define xmDialogShellWidgetClass XMDIALOGSHELLWIDGETCLASS +#define xmDrawingAreaWidgetClass XMDRAWINGAREAWIDGETCLASS +#define xmDrawnButtonWidgetClass XMDRAWNBUTTONWIDGETCLASS +#define xmFileSelectionBoxWidgetClass XMFILESELECTIONBOXWIDGETCLASS +#define xmFormWidgetClass XMFORMWIDGETCLASS +#define xmFrameWidgetClass XMFRAMEWIDGETCLASS +#define xmGadgetClass XMGADGETCLASS +#define xmLabelGadgetClass XMLABELGADGETCLASS +#define xmLabelWidgetClass XMLABELWIDGETCLASS +#define xmListWidgetClass XMLISTWIDGETCLASS +#define xmMainWindowWidgetClass XMMAINWINDOWWIDGETCLASS +#define xmManagerClassRec XMMANAGERCLASSREC +#define xmManagerWidgetClass XMMANAGERWIDGETCLASS +#define xmMenuShellWidgetClass XMMENUSHELLWIDGETCLASS +#define xmMessageBoxWidgetClass XMMESSAGEBOXWIDGETCLASS +#define xmPrimitiveClassRec XMPRIMITIVECLASSREC +#define xmPrimitiveWidgetClass XMPRIMITIVEWIDGETCLASS +#define xmPushButtonClassRec XMPUSHBUTTONCLASSREC +#define xmPushButtonGadgetClass XMPUSHBUTTONGADGETCLASS +#define xmPushButtonWidgetClass XMPUSHBUTTONWIDGETCLASS +#define xmRowColumnWidgetClass XMROWCOLUMNWIDGETCLASS +#define xmSashWidgetClass XMSASHWIDGETCLASS +#define xmScaleWidgetClass XMSCALEWIDGETCLASS +#define xmScrollBarWidgetClass XMSCROLLBARWIDGETCLASS +#define xmScrolledWindowClassRec XMSCROLLEDWINDOWCLASSREC +#define xmScrolledWindowWidgetClass XMSCROLLEDWINDOWWIDGETCLASS +#define xmSeparatorGadgetClass XMSEPARATORGADGETCLASS +#define xmSeparatorWidgetClass XMSEPARATORWIDGETCLASS +#define xmTextFieldWidgetClass XMTEXTFIELDWIDGETCLASS +#define xmTextWidgetClass XMTEXTWIDGETCLASS +#define xmToggleButtonGadgetClass XMTOGGLEBUTTONGADGETCLASS +#define xmToggleButtonWidgetClass XMTOGGLEBUTTONWIDGETCLASS + +#if (__VMS_VER < 80200000) +# define SetReqLen(req,n,badlen) \ + if ((req->length + n) > (unsigned)65535) { \ + n = badlen; \ + req->length += n; \ + } else \ + req->length += n +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern void XtFree(char*); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/include/GL/wglext.h b/mesalib/include/GL/wglext.h new file mode 100644 index 000000000..1f096fb91 --- /dev/null +++ b/mesalib/include/GL/wglext.h @@ -0,0 +1,834 @@ +#ifndef __wglext_h_ +#define __wglext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2007-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are 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 Materials. +** +** THE MATERIALS ARE 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 THE AUTHORS OR COPYRIGHT HOLDERS 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 +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Function declaration macros - to move into glplatform.h */ + +#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) +#define WIN32_LEAN_AND_MEAN 1 +#include +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +#ifndef GLAPI +#define GLAPI extern +#endif + +/*************************************************************/ + +/* Header file version number */ +/* wglext.h last updated 2009/08/03 */ +/* Current version at http://www.opengl.org/registry/ */ +#define WGL_WGLEXT_VERSION 15 + +#ifndef WGL_ARB_buffer_region +#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001 +#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002 +#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004 +#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008 +#endif + +#ifndef WGL_ARB_multisample +#define WGL_SAMPLE_BUFFERS_ARB 0x2041 +#define WGL_SAMPLES_ARB 0x2042 +#endif + +#ifndef WGL_ARB_extensions_string +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 +#define WGL_DRAW_TO_WINDOW_ARB 0x2001 +#define WGL_DRAW_TO_BITMAP_ARB 0x2002 +#define WGL_ACCELERATION_ARB 0x2003 +#define WGL_NEED_PALETTE_ARB 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006 +#define WGL_SWAP_METHOD_ARB 0x2007 +#define WGL_NUMBER_OVERLAYS_ARB 0x2008 +#define WGL_NUMBER_UNDERLAYS_ARB 0x2009 +#define WGL_TRANSPARENT_ARB 0x200A +#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037 +#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038 +#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039 +#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A +#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B +#define WGL_SHARE_DEPTH_ARB 0x200C +#define WGL_SHARE_STENCIL_ARB 0x200D +#define WGL_SHARE_ACCUM_ARB 0x200E +#define WGL_SUPPORT_GDI_ARB 0x200F +#define WGL_SUPPORT_OPENGL_ARB 0x2010 +#define WGL_DOUBLE_BUFFER_ARB 0x2011 +#define WGL_STEREO_ARB 0x2012 +#define WGL_PIXEL_TYPE_ARB 0x2013 +#define WGL_COLOR_BITS_ARB 0x2014 +#define WGL_RED_BITS_ARB 0x2015 +#define WGL_RED_SHIFT_ARB 0x2016 +#define WGL_GREEN_BITS_ARB 0x2017 +#define WGL_GREEN_SHIFT_ARB 0x2018 +#define WGL_BLUE_BITS_ARB 0x2019 +#define WGL_BLUE_SHIFT_ARB 0x201A +#define WGL_ALPHA_BITS_ARB 0x201B +#define WGL_ALPHA_SHIFT_ARB 0x201C +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_DEPTH_BITS_ARB 0x2022 +#define WGL_STENCIL_BITS_ARB 0x2023 +#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_NO_ACCELERATION_ARB 0x2025 +#define WGL_GENERIC_ACCELERATION_ARB 0x2026 +#define WGL_FULL_ACCELERATION_ARB 0x2027 +#define WGL_SWAP_EXCHANGE_ARB 0x2028 +#define WGL_SWAP_COPY_ARB 0x2029 +#define WGL_SWAP_UNDEFINED_ARB 0x202A +#define WGL_TYPE_RGBA_ARB 0x202B +#define WGL_TYPE_COLORINDEX_ARB 0x202C +#endif + +#ifndef WGL_ARB_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043 +#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054 +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_DRAW_TO_PBUFFER_ARB 0x202D +#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E +#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030 +#define WGL_PBUFFER_LARGEST_ARB 0x2033 +#define WGL_PBUFFER_WIDTH_ARB 0x2034 +#define WGL_PBUFFER_HEIGHT_ARB 0x2035 +#define WGL_PBUFFER_LOST_ARB 0x2036 +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070 +#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071 +#define WGL_TEXTURE_FORMAT_ARB 0x2072 +#define WGL_TEXTURE_TARGET_ARB 0x2073 +#define WGL_MIPMAP_TEXTURE_ARB 0x2074 +#define WGL_TEXTURE_RGB_ARB 0x2075 +#define WGL_TEXTURE_RGBA_ARB 0x2076 +#define WGL_NO_TEXTURE_ARB 0x2077 +#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078 +#define WGL_TEXTURE_1D_ARB 0x2079 +#define WGL_TEXTURE_2D_ARB 0x207A +#define WGL_MIPMAP_LEVEL_ARB 0x207B +#define WGL_CUBE_MAP_FACE_ARB 0x207C +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080 +#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081 +#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082 +#define WGL_FRONT_LEFT_ARB 0x2083 +#define WGL_FRONT_RIGHT_ARB 0x2084 +#define WGL_BACK_LEFT_ARB 0x2085 +#define WGL_BACK_RIGHT_ARB 0x2086 +#define WGL_AUX0_ARB 0x2087 +#define WGL_AUX1_ARB 0x2088 +#define WGL_AUX2_ARB 0x2089 +#define WGL_AUX3_ARB 0x208A +#define WGL_AUX4_ARB 0x208B +#define WGL_AUX5_ARB 0x208C +#define WGL_AUX6_ARB 0x208D +#define WGL_AUX7_ARB 0x208E +#define WGL_AUX8_ARB 0x208F +#define WGL_AUX9_ARB 0x2090 +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001 +#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002 +#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091 +#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092 +#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093 +#define WGL_CONTEXT_FLAGS_ARB 0x2094 +#define ERROR_INVALID_VERSION_ARB 0x2095 +#endif + +#ifndef WGL_ARB_create_context_profile +#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126 +#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001 +#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002 +#define ERROR_INVALID_PROFILE_ARB 0x2096 +#endif + +#ifndef WGL_EXT_make_current_read +#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043 +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000 +#define WGL_DRAW_TO_WINDOW_EXT 0x2001 +#define WGL_DRAW_TO_BITMAP_EXT 0x2002 +#define WGL_ACCELERATION_EXT 0x2003 +#define WGL_NEED_PALETTE_EXT 0x2004 +#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005 +#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006 +#define WGL_SWAP_METHOD_EXT 0x2007 +#define WGL_NUMBER_OVERLAYS_EXT 0x2008 +#define WGL_NUMBER_UNDERLAYS_EXT 0x2009 +#define WGL_TRANSPARENT_EXT 0x200A +#define WGL_TRANSPARENT_VALUE_EXT 0x200B +#define WGL_SHARE_DEPTH_EXT 0x200C +#define WGL_SHARE_STENCIL_EXT 0x200D +#define WGL_SHARE_ACCUM_EXT 0x200E +#define WGL_SUPPORT_GDI_EXT 0x200F +#define WGL_SUPPORT_OPENGL_EXT 0x2010 +#define WGL_DOUBLE_BUFFER_EXT 0x2011 +#define WGL_STEREO_EXT 0x2012 +#define WGL_PIXEL_TYPE_EXT 0x2013 +#define WGL_COLOR_BITS_EXT 0x2014 +#define WGL_RED_BITS_EXT 0x2015 +#define WGL_RED_SHIFT_EXT 0x2016 +#define WGL_GREEN_BITS_EXT 0x2017 +#define WGL_GREEN_SHIFT_EXT 0x2018 +#define WGL_BLUE_BITS_EXT 0x2019 +#define WGL_BLUE_SHIFT_EXT 0x201A +#define WGL_ALPHA_BITS_EXT 0x201B +#define WGL_ALPHA_SHIFT_EXT 0x201C +#define WGL_ACCUM_BITS_EXT 0x201D +#define WGL_ACCUM_RED_BITS_EXT 0x201E +#define WGL_ACCUM_GREEN_BITS_EXT 0x201F +#define WGL_ACCUM_BLUE_BITS_EXT 0x2020 +#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021 +#define WGL_DEPTH_BITS_EXT 0x2022 +#define WGL_STENCIL_BITS_EXT 0x2023 +#define WGL_AUX_BUFFERS_EXT 0x2024 +#define WGL_NO_ACCELERATION_EXT 0x2025 +#define WGL_GENERIC_ACCELERATION_EXT 0x2026 +#define WGL_FULL_ACCELERATION_EXT 0x2027 +#define WGL_SWAP_EXCHANGE_EXT 0x2028 +#define WGL_SWAP_COPY_EXT 0x2029 +#define WGL_SWAP_UNDEFINED_EXT 0x202A +#define WGL_TYPE_RGBA_EXT 0x202B +#define WGL_TYPE_COLORINDEX_EXT 0x202C +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_DRAW_TO_PBUFFER_EXT 0x202D +#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E +#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F +#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030 +#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031 +#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032 +#define WGL_PBUFFER_LARGEST_EXT 0x2033 +#define WGL_PBUFFER_WIDTH_EXT 0x2034 +#define WGL_PBUFFER_HEIGHT_EXT 0x2035 +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_DEPTH_FLOAT_EXT 0x2040 +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_SAMPLE_BUFFERS_3DFX 0x2060 +#define WGL_SAMPLES_3DFX 0x2061 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_SAMPLE_BUFFERS_EXT 0x2041 +#define WGL_SAMPLES_EXT 0x2042 +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050 +#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051 +#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052 +#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053 +#endif + +#ifndef WGL_I3D_gamma +#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E +#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F +#endif + +#ifndef WGL_I3D_genlock +#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044 +#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045 +#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046 +#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047 +#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048 +#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049 +#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A +#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B +#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001 +#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002 +#endif + +#ifndef WGL_I3D_swap_frame_lock +#endif + +#ifndef WGL_NV_render_depth_texture +#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4 +#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5 +#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6 +#define WGL_DEPTH_COMPONENT_NV 0x20A7 +#endif + +#ifndef WGL_NV_render_texture_rectangle +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1 +#define WGL_TEXTURE_RECTANGLE_NV 0x20A2 +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_FLOAT_COMPONENTS_NV 0x20B0 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3 +#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4 +#define WGL_TEXTURE_FLOAT_R_NV 0x20B5 +#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6 +#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7 +#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8 +#endif + +#ifndef WGL_3DL_stereo_control +#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055 +#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056 +#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057 +#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058 +#endif + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8 +#endif + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9 +#endif + +#ifndef WGL_NV_present_video +#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0 +#endif + +#ifndef WGL_NV_video_out +#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0 +#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1 +#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2 +#define WGL_VIDEO_OUT_COLOR_NV 0x20C3 +#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4 +#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5 +#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6 +#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7 +#define WGL_VIDEO_OUT_FRAME 0x20C8 +#define WGL_VIDEO_OUT_FIELD_1 0x20C9 +#define WGL_VIDEO_OUT_FIELD_2 0x20CA +#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB +#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC +#endif + +#ifndef WGL_NV_swap_group +#endif + +#ifndef WGL_NV_gpu_affinity +#define WGL_ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0 +#define WGL_ERROR_MISSING_AFFINITY_MASK_NV 0x20D1 +#endif + +#ifndef WGL_AMD_gpu_association +#define WGL_GPU_VENDOR_AMD 0x1F00 +#define WGL_GPU_RENDERER_STRING_AMD 0x1F01 +#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02 +#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2 +#define WGL_GPU_RAM_AMD 0x21A3 +#define WGL_GPU_CLOCK_AMD 0x21A4 +#define WGL_GPU_NUM_PIPES_AMD 0x21A5 +#define WGL_GPU_NUM_SIMD_AMD 0x21A6 +#define WGL_GPU_NUM_RB_AMD 0x21A7 +#define WGL_GPU_NUM_SPI_AMD 0x21A8 +#endif + + +/*************************************************************/ + +#ifndef WGL_ARB_pbuffer +DECLARE_HANDLE(HPBUFFERARB); +#endif +#ifndef WGL_EXT_pbuffer +DECLARE_HANDLE(HPBUFFEREXT); +#endif +#ifndef WGL_NV_present_video +DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV); +#endif +#ifndef WGL_NV_video_out +DECLARE_HANDLE(HPVIDEODEV); +#endif +#ifndef WGL_NV_gpu_affinity +DECLARE_HANDLE(HPGPUNV); +DECLARE_HANDLE(HGPUNV); + +typedef struct _GPU_DEVICE { + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD Flags; + RECT rcVirtualScreen; +} GPU_DEVICE, *PGPU_DEVICE; +#endif + +#ifndef WGL_ARB_buffer_region +#define WGL_ARB_buffer_region 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HANDLE WINAPI wglCreateBufferRegionARB (HDC, int, UINT); +extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE); +extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE, int, int, int, int); +extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE, int, int, int, int, int, int); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType); +typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion); +typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height); +typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc); +#endif + +#ifndef WGL_ARB_multisample +#define WGL_ARB_multisample 1 +#endif + +#ifndef WGL_ARB_extensions_string +#define WGL_ARB_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringARB (HDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc); +#endif + +#ifndef WGL_ARB_pixel_format +#define WGL_ARB_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC, int, int, UINT, const int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC, int, int, UINT, const int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatARB (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_ARB_make_current_read +#define WGL_ARB_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentARB (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCARB (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void); +#endif + +#ifndef WGL_ARB_pbuffer +#define WGL_ARB_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB); +extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB, HDC); +extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB); +extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_ARB_render_texture +#define WGL_ARB_render_texture 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB, int); +extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer); +typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList); +#endif + +#ifndef WGL_ARB_pixel_format_float +#define WGL_ARB_pixel_format_float 1 +#endif + +#ifndef WGL_ARB_create_context +#define WGL_ARB_create_context 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HGLRC WINAPI wglCreateContextAttribsARB (HDC, HGLRC, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList); +#endif + +#ifndef WGL_ARB_create_context_profile +#define WGL_ARB_create_context_profile 1 +#endif + +#ifndef WGL_EXT_display_color_table +#define WGL_EXT_display_color_table 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort); +extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *, GLuint); +extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort); +extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length); +typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id); +typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id); +#endif + +#ifndef WGL_EXT_extensions_string +#define WGL_EXT_extensions_string 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern const char * WINAPI wglGetExtensionsStringEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void); +#endif + +#ifndef WGL_EXT_make_current_read +#define WGL_EXT_make_current_read 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglMakeContextCurrentEXT (HDC, HDC, HGLRC); +extern HDC WINAPI wglGetCurrentReadDCEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc); +typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void); +#endif + +#ifndef WGL_EXT_pbuffer +#define WGL_EXT_pbuffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC, int, int, int, const int *); +extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT); +extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT, HDC); +extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT); +extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT, int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList); +typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer); +typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC); +typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer); +typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue); +#endif + +#ifndef WGL_EXT_pixel_format +#define WGL_EXT_pixel_format 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC, int, int, UINT, int *, int *); +extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC, int, int, UINT, int *, FLOAT *); +extern BOOL WINAPI wglChoosePixelFormatEXT (HDC, const int *, const FLOAT *, UINT, int *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues); +typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues); +typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats); +#endif + +#ifndef WGL_EXT_swap_control +#define WGL_EXT_swap_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglSwapIntervalEXT (int); +extern int WINAPI wglGetSwapIntervalEXT (void); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval); +typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void); +#endif + +#ifndef WGL_EXT_depth_float +#define WGL_EXT_depth_float 1 +#endif + +#ifndef WGL_NV_vertex_array_range +#define WGL_NV_vertex_array_range 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern void* WINAPI wglAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat); +extern void WINAPI wglFreeMemoryNV (void *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); +typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer); +#endif + +#ifndef WGL_3DFX_multisample +#define WGL_3DFX_multisample 1 +#endif + +#ifndef WGL_EXT_multisample +#define WGL_EXT_multisample 1 +#endif + +#ifndef WGL_OML_sync_control +#define WGL_OML_sync_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetSyncValuesOML (HDC, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglGetMscRateOML (HDC, INT32 *, INT32 *); +extern INT64 WINAPI wglSwapBuffersMscOML (HDC, INT64, INT64, INT64); +extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC, int, INT64, INT64, INT64); +extern BOOL WINAPI wglWaitForMscOML (HDC, INT64, INT64, INT64, INT64 *, INT64 *, INT64 *); +extern BOOL WINAPI wglWaitForSbcOML (HDC, INT64, INT64 *, INT64 *, INT64 *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator); +typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder); +typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc); +typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc); +#endif + +#ifndef WGL_I3D_digital_video_control +#define WGL_I3D_digital_video_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC, int, const int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +#endif + +#ifndef WGL_I3D_gamma +#define WGL_I3D_gamma 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC, int, int *); +extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC, int, const int *); +extern BOOL WINAPI wglGetGammaTableI3D (HDC, int, USHORT *, USHORT *, USHORT *); +extern BOOL WINAPI wglSetGammaTableI3D (HDC, int, const USHORT *, const USHORT *, const USHORT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue); +typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue); +typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue); +#endif + +#ifndef WGL_I3D_genlock +#define WGL_I3D_genlock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableGenlockI3D (HDC); +extern BOOL WINAPI wglDisableGenlockI3D (HDC); +extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC, BOOL *); +extern BOOL WINAPI wglGenlockSourceI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSampleRateI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC, UINT *); +extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC, UINT); +extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC, UINT *); +extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC, UINT *, UINT *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC); +typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge); +typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate); +typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay); +typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay); +typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay); +#endif + +#ifndef WGL_I3D_image_buffer +#define WGL_I3D_image_buffer 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern LPVOID WINAPI wglCreateImageBufferI3D (HDC, DWORD, UINT); +extern BOOL WINAPI wglDestroyImageBufferI3D (HDC, LPVOID); +extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC, const HANDLE *, const LPVOID *, const DWORD *, UINT); +extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC, const LPVOID *, UINT); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags); +typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress); +typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count); +typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count); +#endif + +#ifndef WGL_I3D_swap_frame_lock +#define WGL_I3D_swap_frame_lock 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnableFrameLockI3D (void); +extern BOOL WINAPI wglDisableFrameLockI3D (void); +extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *); +extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag); +#endif + +#ifndef WGL_I3D_swap_frame_usage +#define WGL_I3D_swap_frame_usage 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetFrameUsageI3D (float *); +extern BOOL WINAPI wglBeginFrameTrackingI3D (void); +extern BOOL WINAPI wglEndFrameTrackingI3D (void); +extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *, DWORD *, float *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage); +typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage); +#endif + +#ifndef WGL_ATI_pixel_format_float +#define WGL_ATI_pixel_format_float 1 +#endif + +#ifndef WGL_NV_float_buffer +#define WGL_NV_float_buffer 1 +#endif + +#ifndef WGL_3DL_stereo_control +#define WGL_3DL_stereo_control 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC, UINT); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState); +#endif + +#ifndef WGL_EXT_pixel_format_packed_float +#define WGL_EXT_pixel_format_packed_float 1 +#endif + +#ifndef WGL_EXT_framebuffer_sRGB +#define WGL_EXT_framebuffer_sRGB 1 +#endif + +#ifndef WGL_NV_present_video +#define WGL_NV_present_video 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern int WINAPI wglEnumerateVideoDevicesNV (HDC, HVIDEOOUTPUTDEVICENV *); +extern BOOL WINAPI wglBindVideoDeviceNV (HDC, unsigned int, HVIDEOOUTPUTDEVICENV, const int *); +extern BOOL WINAPI wglQueryCurrentContextNV (int, int *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList); +typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList); +typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue); +#endif + +#ifndef WGL_NV_video_out +#define WGL_NV_video_out 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglGetVideoDeviceNV (HDC, int, HPVIDEODEV *); +extern BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV); +extern BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV, HPBUFFERARB, int); +extern BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB, int); +extern BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB, int, unsigned long *, BOOL); +extern BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV, unsigned long *, unsigned long *); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice); +typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer); +typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock); +typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo); +#endif + +#ifndef WGL_NV_swap_group +#define WGL_NV_swap_group 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglJoinSwapGroupNV (HDC, GLuint); +extern BOOL WINAPI wglBindSwapBarrierNV (GLuint, GLuint); +extern BOOL WINAPI wglQuerySwapGroupNV (HDC, GLuint *, GLuint *); +extern BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC, GLuint *, GLuint *); +extern BOOL WINAPI wglQueryFrameCountNV (HDC, GLuint *); +extern BOOL WINAPI wglResetFrameCountNV (HDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group); +typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier); +typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier); +typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers); +typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count); +typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC); +#endif + +#ifndef WGL_NV_gpu_affinity +#define WGL_NV_gpu_affinity 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern BOOL WINAPI wglEnumGpusNV (UINT, HGPUNV *); +extern BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV, UINT, PGPU_DEVICE); +extern HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *); +extern BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC, UINT, HGPUNV *); +extern BOOL WINAPI wglDeleteDCNV (HDC); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu); +typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice); +typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); +typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu); +typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc); +#endif + +#ifndef WGL_AMD_gpu_association +#define WGL_AMD_gpu_association 1 +#ifdef WGL_WGLEXT_PROTOTYPES +extern UINT WINAPI wglGetGPUIDsAMD (UINT, UINT *); +extern INT WINAPI wglGetGPUInfoAMD (UINT, int, GLenum, UINT, void *); +extern UINT WINAPI wglGetContextGPUIDAMD (HGLRC); +extern HGLRC WINAPI wglCreateAssociatedContextAMD (UINT); +extern HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT, HGLRC, const int *); +extern BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC); +extern BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC); +extern HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void); +extern VOID WINAPI wglBlitContextFramebufferAMD (HGLRC, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum); +#endif /* WGL_WGLEXT_PROTOTYPES */ +typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids); +typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data); +typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id); +typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList); +typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc); +typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc); +typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void); +typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/include/GL/wmesa.h b/mesalib/include/GL/wmesa.h new file mode 100644 index 000000000..f5f4f273b --- /dev/null +++ b/mesalib/include/GL/wmesa.h @@ -0,0 +1,141 @@ +/* + * Mesa 3-D graphics library + * Version: 3.0 + * Copyright (C) 1995-1998 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +/* + * Windows driver by: Mark E. Peterson (markp@ic.mankato.mn.us) + * Updated by Li Wei (liwei@aiar.xjtu.edu.cn) + * + * + *************************************************************** + * WMesa * + * version 2.3 * + * * + * By * + * Li Wei * + * Institute of Artificial Intelligence & Robotics * + * Xi'an Jiaotong University * + * Email: liwei@aiar.xjtu.edu.cn * + * Web page: http://sun.aiar.xjtu.edu.cn * + * * + * July 7th, 1997 * + *************************************************************** + */ + + +#ifndef WMESA_H +#define WMESA_H + + +#ifdef __cplusplus +extern "C" { +#endif + + +#include "GL/gl.h" + +#if defined(_MSV_VER) && !defined(__GNUC__) +# pragma warning (disable:4273) +# 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 : 4013 ) /* 'function' undefined; assuming extern returning int */ +# pragma warning( disable : 4761 ) /* integral size mismatch in argument; conversion supplied */ +# pragma warning( disable : 4273 ) /* 'identifier' : inconsistent DLL linkage. dllexport assumed */ +# if (MESA_WARNQUIET>1) +# pragma warning( disable : 4146 ) /* unary minus operator applied to unsigned type, result still unsigned */ +# endif +#endif + +/* + * This is the WMesa context 'handle': + */ +typedef struct wmesa_context *WMesaContext; + + + +/* + * Create a new WMesaContext for rendering into a window. You must + * have already created the window of correct visual type and with an + * appropriate colormap. + * + * Input: + * hDC - Windows device or memory context + * Pal - Palette to use + * rgb_flag - GL_TRUE = RGB mode, + * GL_FALSE = color index mode + * db_flag - GL_TRUE = double-buffered, + * GL_FALSE = single buffered + * alpha_flag - GL_TRUE = create software alpha buffer, + * GL_FALSE = no software alpha buffer + * + * Note: Indexed mode requires double buffering under Windows. + * + * Return: a WMesa_context or NULL if error. + */ +extern WMesaContext WMesaCreateContext(HDC hDC,HPALETTE* pPal, + GLboolean rgb_flag, + GLboolean db_flag, + GLboolean alpha_flag); + + +/* + * Destroy a rendering context as returned by WMesaCreateContext() + */ +extern void WMesaDestroyContext( WMesaContext ctx ); + + + +/* + * Make the specified context the current one. + */ +extern void WMesaMakeCurrent( WMesaContext ctx, HDC hdc ); + + +/* + * Return a handle to the current context. + */ +extern WMesaContext WMesaGetCurrentContext( void ); + + +/* + * Swap the front and back buffers for the current context. No action + * taken if the context is not double buffered. + */ +extern void WMesaSwapBuffers(HDC hdc); + + +/* + * In indexed color mode we need to know when the palette changes. + */ +extern void WMesaPaletteChange(HPALETTE Pal); + +extern void WMesaMove(void); + +void WMesaShareLists(WMesaContext ctx_to_share, WMesaContext ctx); + +#ifdef __cplusplus +} +#endif + + +#endif + diff --git a/mesalib/include/GLES/egl.h b/mesalib/include/GLES/egl.h new file mode 100644 index 000000000..eb2e046ba --- /dev/null +++ b/mesalib/include/GLES/egl.h @@ -0,0 +1,6 @@ +/* For compatibility with early OpenGL ES 1.0 implementations that + * included gl.h in egl.h (and apps that only included egl.h) + * See: http://www.khronos.org/registry/implementers_guide.html + */ +#include +#include diff --git a/mesalib/include/GLES/egltypes.h b/mesalib/include/GLES/egltypes.h new file mode 100644 index 000000000..6e9826504 --- /dev/null +++ b/mesalib/include/GLES/egltypes.h @@ -0,0 +1,45 @@ +/* +** egltypes.h for Mesa +** +** ONLY egl.h SHOULD INCLUDE THIS FILE! +** +** See comments about egltypes.h in the standard egl.h file. +*/ + + +#include + + +/* +** These opaque EGL types are implemented as unsigned 32-bit integers: +*/ +typedef uint32_t EGLDisplay; +typedef uint32_t EGLConfig; +typedef uint32_t EGLSurface; +typedef uint32_t EGLContext; + +/* EGL_MESA_screen_surface */ +typedef uint32_t EGLModeMESA; +typedef uint32_t EGLScreenMESA; + + +/* +** Other basic EGL types: +*/ +typedef uint8_t EGLBoolean; +typedef int32_t EGLint; + +typedef void * NativeDisplayType; +typedef int NativePixmapType; +typedef int NativeWindowType; + +/* +** EGL and native handle null values: +*/ +#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0) +#define EGL_NO_CONTEXT ((EGLContext) 0) +#define EGL_NO_DISPLAY ((EGLDisplay) 0) +#define EGL_NO_SURFACE ((EGLSurface) 0) + +/* EGL_MESA_screen_surface */ +#define EGL_NO_MODE_MESA ((EGLModeMESA) 0) diff --git a/mesalib/include/GLES/gl.h b/mesalib/include/GLES/gl.h new file mode 100644 index 000000000..8ffcdc1db --- /dev/null +++ b/mesalib/include/GLES/gl.h @@ -0,0 +1,797 @@ +#ifndef __gl_h_ +#define __gl_h_ + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef signed char GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef unsigned char GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef float GLfloat; +typedef float GLclampf; +typedef void GLvoid; +typedef int GLfixed; +typedef int GLclampx; + +typedef int GLintptr; +typedef int GLsizeiptr; + + +/*************************************************************/ + +/* OpenGL ES core versions */ +#define GL_VERSION_ES_CM_1_0 1 +#define GL_VERSION_ES_CL_1_0 1 +#define GL_VERSION_ES_CM_1_1 1 +#define GL_VERSION_ES_CL_1_1 1 + +/* ClearBufferMask */ +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* ClipPlaneName */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* ColorMaterialFace */ +/* GL_FRONT_AND_BACK */ + +/* ColorMaterialParameter */ +/* GL_AMBIENT_AND_DIFFUSE */ + +/* ColorPointerType */ +/* GL_UNSIGNED_BYTE */ +/* GL_FLOAT */ +/* GL_FIXED */ + +/* CullFaceMode */ +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ +#define GL_FOG 0x0B60 +#define GL_LIGHTING 0x0B50 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_BLEND 0x0BE2 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +/* GL_LIGHT0 */ +/* GL_LIGHT1 */ +/* GL_LIGHT2 */ +/* GL_LIGHT3 */ +/* GL_LIGHT4 */ +/* GL_LIGHT5 */ +/* GL_LIGHT6 */ +/* GL_LIGHT7 */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_NORMALIZE 0x0BA1 +#define GL_RESCALE_NORMAL 0x803A +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FogMode */ +/* GL_LINEAR */ +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* FogParameter */ +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_LINE_WIDTH 0x0B21 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_SHADE_MODEL 0x0B54 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_VIEWPORT 0x0BA2 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_FOG_HINT 0x0C54 +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* LightModelParameter */ +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 + +/* LightParameter */ +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C + +/* LogicOp */ +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F + +/* MaterialFace */ +/* GL_FRONT_AND_BACK */ + +/* MaterialParameter */ +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +/* GL_AMBIENT */ +/* GL_DIFFUSE */ +/* GL_SPECULAR */ + +/* MatrixMode */ +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* NormalPointerType */ +/* GL_BYTE */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ + +/* PixelFormat */ +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelStoreParameter */ +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 + +/* PixelType */ +/* GL_UNSIGNED_BYTE */ +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 + +/* ShadingModel */ +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 + +/* StencilFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +/* GL_INVERT */ + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TexCoordPointerType */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ +/* GL_BYTE */ + +/* TextureEnvMode */ +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +/* GL_BLEND */ +#define GL_ADD 0x0104 +/* GL_REPLACE */ + +/* TextureEnvParameter */ +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 + +/* TextureEnvTarget */ +#define GL_TEXTURE_ENV 0x2300 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_GENERATE_MIPMAP 0x8191 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ + +/* TextureUnit */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 + +/* TextureWrapMode */ +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F + +/* VertexPointerType */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ +/* GL_BYTE */ + +/* LightName */ +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 + +/* Buffer Objects */ +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 + +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A + +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 + +/* Texture combine + dot3 */ +#define GL_SUBTRACT 0x84E7 +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A + +#define GL_ALPHA_SCALE 0x0D1C + +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC1_ALPHA 0x8589 +#define GL_SRC2_ALPHA 0x858A + +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF + +/*------------------------------------------------------------------------* + * required OES extension tokens + *------------------------------------------------------------------------*/ + +/* OES_read_format */ +#ifndef GL_OES_read_format +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif + +/* OES_point_size_array */ +#ifndef GL_OES_point_size_array +#define GL_POINT_SIZE_ARRAY_OES 0x8B9C +#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A +#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B +#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C +#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F +#endif + +/* GL_OES_point_sprite */ +#ifndef GL_OES_point_sprite +#define GL_POINT_SPRITE_OES 0x8861 +#define GL_COORD_REPLACE_OES 0x8862 +#endif + +/*************************************************************/ + +/* Available only in Common profile */ +GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref); +GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_API void GL_APIENTRY glClearDepthf (GLclampf depth); +GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation); +GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]); +GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glLineWidth (GLfloat width); +GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m); +GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m); +GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); +GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glPointSize (GLfloat size); +GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); +GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); + +/* Available in both Common and Common-Lite profiles */ +GL_API void GL_APIENTRY glActiveTexture (GLenum texture); +GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref); +GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GL_API void GL_APIENTRY glClear (GLbitfield mask); +GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +GL_API void GL_APIENTRY glClearDepthx (GLclampx depth); +GL_API void GL_APIENTRY glClearStencil (GLint s); +GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture); +GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation); +GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glCullFace (GLenum mode); +GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GL_API void GL_APIENTRY glDepthFunc (GLenum func); +GL_API void GL_APIENTRY glDepthMask (GLboolean flag); +GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar); +GL_API void GL_APIENTRY glDisable (GLenum cap); +GL_API void GL_APIENTRY glDisableClientState (GLenum array); +GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +GL_API void GL_APIENTRY glEnable (GLenum cap); +GL_API void GL_APIENTRY glEnableClientState (GLenum array); +GL_API void GL_APIENTRY glFinish (void); +GL_API void GL_APIENTRY glFlush (void); +GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glFrontFace (GLenum mode); +GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params); +GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]); +GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GL_API GLenum GL_APIENTRY glGetError (void); +GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetPointerv (GLenum pname, void **params); +GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name); +GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLineWidthx (GLfixed width); +GL_API void GL_APIENTRY glLoadIdentity (void); +GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m); +GL_API void GL_APIENTRY glLogicOp (GLenum opcode); +GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glMatrixMode (GLenum mode); +GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m); +GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz); +GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glPointSizex (GLfixed size); +GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units); +GL_API void GL_APIENTRY glPopMatrix (void); +GL_API void GL_APIENTRY glPushMatrix (void); +GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert); +GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glShadeModel (GLenum mode); +GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_API void GL_APIENTRY glStencilMask (GLuint mask); +GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param); +GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params); +GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +/*------------------------------------------------------------------------* + * Required OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_read_format */ +#ifndef GL_OES_read_format +#define GL_OES_read_format 1 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#endif + +/* GL_OES_point_size_array */ +#ifndef GL_OES_point_size_array +#define GL_OES_point_size_array 1 +GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +/* GL_OES_point_sprite */ +#ifndef GL_OES_point_sprite +#define GL_OES_point_sprite 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ + diff --git a/mesalib/include/GLES/glext.h b/mesalib/include/GLES/glext.h new file mode 100644 index 000000000..a55829489 --- /dev/null +++ b/mesalib/include/GLES/glext.h @@ -0,0 +1,607 @@ +#ifndef __glext_h_ +#define __glext_h_ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +#ifndef GL_APIENTRYP +# define GL_APIENTRYP GL_APIENTRY* +#endif + +/*------------------------------------------------------------------------* + * OES extension tokens + *------------------------------------------------------------------------*/ + +/* GL_OES_blend_equation_separate */ +#ifndef GL_OES_blend_equation_separate +/* BLEND_EQUATION_RGB_OES same as BLEND_EQUATION_OES */ +#define GL_BLEND_EQUATION_RGB_OES 0x8009 +#define GL_BLEND_EQUATION_ALPHA_OES 0x883D +#endif + +/* GL_OES_blend_func_separate */ +#ifndef GL_OES_blend_func_separate +#define GL_BLEND_DST_RGB_OES 0x80C8 +#define GL_BLEND_SRC_RGB_OES 0x80C9 +#define GL_BLEND_DST_ALPHA_OES 0x80CA +#define GL_BLEND_SRC_ALPHA_OES 0x80CB +#endif + +/* GL_OES_blend_subtract */ +#ifndef GL_OES_blend_subtract +#define GL_BLEND_EQUATION_OES 0x8009 +#define GL_FUNC_ADD_OES 0x8006 +#define GL_FUNC_SUBTRACT_OES 0x800A +#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B +#endif + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_ETC1_RGB8_OES 0x8D64 +#endif + +/* OES_draw_texture */ +#ifndef GL_OES_draw_texture +#define GL_TEXTURE_CROP_RECT_OES 0x8B9D +#endif + +/* OES_fixed_point */ +#ifndef GL_OES_fixed_point +#define GL_FIXED_OES 0x140C +#endif + +/* OES_framebuffer_object */ +#ifndef GL_OES_framebuffer_object +#define GL_NONE_OES 0 +#define GL_FRAMEBUFFER_OES 0x8D40 +#define GL_RENDERBUFFER_OES 0x8D41 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGB565_OES 0x8D62 +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_RENDERBUFFER_WIDTH_OES 0x8D42 +#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3 +#define GL_COLOR_ATTACHMENT0_OES 0x8CE0 +#define GL_DEPTH_ATTACHMENT_OES 0x8D00 +#define GL_STENCIL_ATTACHMENT_OES 0x8D20 +#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA +#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD +#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6 +#define GL_RENDERBUFFER_BINDING_OES 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8 +#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506 +#endif + +/* OES_matrix_get */ +#ifndef GL_OES_matrix_get +#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D +#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E +#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F +#endif + +/* OES_matrix_palette */ +#ifndef GL_OES_matrix_palette +#define GL_MAX_VERTEX_UNITS_OES 0x86A4 +#define GL_MAX_PALETTE_MATRICES_OES 0x8842 +#define GL_MATRIX_PALETTE_OES 0x8840 +#define GL_MATRIX_INDEX_ARRAY_OES 0x8844 +#define GL_WEIGHT_ARRAY_OES 0x86AD +#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843 +#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849 +#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E +#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB +#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA +#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E +#endif + +/* GL_OES_stencil_wrap */ +#ifndef GL_OES_stencil_wrap +#define GL_INCR_WRAP_OES 0x8507 +#define GL_DECR_WRAP_OES 0x8508 +#endif + +/* GL_OES_texture_cube_map */ +#ifndef GL_OES_texture_cube_map +#define GL_NORMAL_MAP_OES 0x8511 +#define GL_REFLECTION_MAP_OES 0x8512 +#define GL_TEXTURE_CUBE_MAP_OES 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C +#define GL_TEXTURE_GEN_MODE_OES 0x2500 +#define GL_TEXTURE_GEN_STR_OES 0x8D60 +#endif + +/* GL_OES_texture_mirrored_repeat */ +#ifndef GL_OES_texture_mirrored_repeat +#define GL_MIRRORED_REPEAT_OES 0x8370 +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +typedef void* GLeglImageOES; +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif + +/* GL_OES_stencil8 */ +#ifndef GL_OES_stencil8 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#endif + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +/*------------------------------------------------------------------------* + * OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_blend_equation_separate */ +#ifndef GL_OES_blend_equation_separate +#define GL_OES_blend_equation_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha); +#endif +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha); +#endif + +/* GL_OES_blend_func_separate */ +#ifndef GL_OES_blend_func_separate +#define GL_OES_blend_func_separate 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +#endif + +/* GL_OES_blend_subtract */ +#ifndef GL_OES_blend_subtract +#define GL_OES_blend_subtract 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode); +#endif +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode); +#endif + +/* GL_OES_byte_coordinates */ +#ifndef GL_OES_byte_coordinates +#define GL_OES_byte_coordinates 1 +#endif + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#endif + +/* GL_OES_draw_texture */ +#ifndef GL_OES_draw_texture +#define GL_OES_draw_texture 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); +GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height); +GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); +GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords); +GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords); +GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords); +GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); +GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords); +#endif +typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); +typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height); +typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); +typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords); +typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords); +typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords); +typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); +typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords); +#endif + +/* GL_OES_extended_matrix_palette */ +#ifndef GL_OES_extended_matrix_palette +#define GL_OES_extended_matrix_palette 1 +#endif + +/* GL_OES_fixed_point */ +#ifndef GL_OES_fixed_point +#define GL_OES_fixed_point 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLclampx ref); +GL_API void GL_APIENTRY glClearColorxOES (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +GL_API void GL_APIENTRY glClearDepthxOES (GLclampx depth); +GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation); +GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GL_API void GL_APIENTRY glDepthRangexOES (GLclampx zNear, GLclampx zFar); +GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glFrustumxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum pname, GLfixed eqn[4]); +GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum env, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params); +GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width); +GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m); +GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m); +GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz); +GL_API void GL_APIENTRY glOrthoxOES (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glPointSizexOES (GLfixed size); +GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units); +GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert); +GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z); +GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z); +#endif +typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLclampx ref); +typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLclampx depth); +typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation); +typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLclampx zNear, GLclampx zFar); +typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum pname, GLfixed eqn[4]); +typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum env, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width); +typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m); +typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m); +typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz); +typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size); +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); +typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert); +typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +#endif + +/* GL_OES_framebuffer_object */ +#ifndef GL_OES_framebuffer_object +#define GL_OES_framebuffer_object 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer); +GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer); +GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint* renderbuffers); +GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint* renderbuffers); +GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint* params); +GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer); +GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer); +GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint* framebuffers); +GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint* framebuffers); +GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target); +GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint* params); +GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target); +#endif +typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint* renderbuffers); +typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint* renderbuffers); +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint* params); +typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint* framebuffers); +typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint* framebuffers); +typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint* params); +typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target); +#endif + +/* GL_OES_matrix_get */ +#ifndef GL_OES_matrix_get +#define GL_OES_matrix_get 1 +#endif + +/* GL_OES_matrix_palette */ +#ifndef GL_OES_matrix_palette +#define GL_OES_matrix_palette 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex); +GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void); +GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif +typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex); +typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void); +typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +#endif + +/* GL_OES_query_matrix */ +#ifndef GL_OES_query_matrix +#define GL_OES_query_matrix 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed mantissa[16], GLint exponent[16]); +#endif +typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed mantissa[16], GLint exponent[16]); +#endif + +/* GL_OES_single_precision */ +#ifndef GL_OES_single_precision +#define GL_OES_single_precision 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glDepthRangefOES (GLclampf zNear, GLclampf zFar); +GL_API void GL_APIENTRY glFrustumfOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glOrthofOES (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation); +GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum pname, GLfloat eqn[4]); +GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth); +#endif +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf zNear, GLclampf zFar); +typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation); +typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum pname, GLfloat eqn[4]); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth); +#endif + +/* GL_OES_stencil_wrap */ +#ifndef GL_OES_stencil_wrap +#define GL_OES_stencil_wrap 1 +#endif + +/* GL_OES_texture_cube_map */ +#ifndef GL_OES_texture_cube_map +#define GL_OES_texture_cube_map 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param); +GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params); +GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param); +GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params); +GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param); +GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params); +GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params); +GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params); +#endif +typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param); +typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params); +typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); +typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params); +typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); +#endif + +/* GL_OES_texture_env_crossbar */ +#ifndef GL_OES_texture_env_crossbar +#define GL_OES_texture_env_crossbar 1 +#endif + +/* GL_OES_texture_mirrored_repeat */ +#ifndef GL_OES_texture_mirrored_repeat +#define GL_OES_texture_mirrored_repeat 1 +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif + +/* GL_OES_fbo_render_mipmap */ +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_API void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_API void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void** params); +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params); +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#endif + +/* GL_OES_stencil8 */ +#ifndef GL_OES_stencil8 +#define GL_OES_stencil8 1 +#endif + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __glext_h_ */ + diff --git a/mesalib/include/GLES/glplatform.h b/mesalib/include/GLES/glplatform.h new file mode 100644 index 000000000..7c8392bfc --- /dev/null +++ b/mesalib/include/GLES/glplatform.h @@ -0,0 +1,76 @@ +#ifndef __glplatform_h_ +#define __glplatform_h_ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/*------------------------------------------------------------------------- + * Definition of GL_API and GL_APIENTRY + *-----------------------------------------------------------------------*/ + +#ifdef _WIN32 +# ifdef __GL_EXPORTS +# define GL_API __declspec(dllexport) +# else +# define GL_API __declspec(dllimport) +# endif +# ifdef UNDER_CE +# define GL_APIENTRY +# else +# define GL_APIENTRY __stdcall +# endif +#else +# ifdef __GL_EXPORTS +# define GL_API +# else +# define GL_API extern +# endif +# define GL_APIENTRY +#endif + + +#ifndef APIENTRY +# define APIENTRY GL_APIENTRY +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __glplatform_h_ */ diff --git a/mesalib/include/GLES2/gl2.h b/mesalib/include/GLES2/gl2.h new file mode 100644 index 000000000..5ce939c7b --- /dev/null +++ b/mesalib/include/GLES2/gl2.h @@ -0,0 +1,652 @@ +#ifndef __gl2_h_ +#define __gl2_h_ + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/*------------------------------------------------------------------------- + * Data type definitions + *-----------------------------------------------------------------------*/ + +typedef void GLvoid; +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef signed char GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef unsigned char GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef float GLfloat; +typedef float GLclampf; +typedef int GLfixed; +typedef int GLclampx; + +/* GL types for handling large vertex buffer objects */ +typedef int GLintptr; +typedef int GLsizeiptr; + +/* OpenGL ES core versions */ +#define GL_ES_VERSION_2_0 1 + +/* ClearBufferMask */ +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* \todo check that this should be in core. */ +#define GL_NONE 0 + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction (not supported in ES20) */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* BlendEquationSeparate */ +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ +#define GL_BLEND_EQUATION_ALPHA 0x883D + +/* BlendSubtract */ +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B + +/* Separate Blend Functions */ +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 + +/* Buffer Objects */ +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 + +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 + +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 + +/* CullFaceMode */ +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_LINE_WIDTH 0x0B21 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +/* GL_SCISSOR_TEST */ +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +/* GL_POLYGON_OFFSET_FILL */ +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C + +/* PixelFormat */ +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelType */ +/* GL_UNSIGNED_BYTE */ +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 + +/* Shaders */ +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D + +/* StencilFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ +#define GL_TEXTURE 0x1702 + +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C + +/* TextureUnit */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 + +/* TextureWrapMode */ +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 + +/* Uniform Types */ +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 + +/* Vertex Arrays */ +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F + +/* Read Format */ +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B + +/* Shader Source */ +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA + +/* Shader Binary */ +#define GL_PLATFORM_BINARY 0x8D63 +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 + +/* Shader Precision-Specified Types */ +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 + +/* Framebuffer Object. */ +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 + +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGB565 0x8D62 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX 0x1901 +#define GL_STENCIL_INDEX8 0x8D48 + +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 + +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 + +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 + +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS 0x8CDA +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD + +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 + +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 + +/*------------------------------------------------------------------------- + * GL core functions. + *-----------------------------------------------------------------------*/ + +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const char* name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glBlendEquation( GLenum mode ); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void* indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const char* name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, char* source); +GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); +GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const char* name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLint n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLint length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const char** string, const GLint* length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2_h_ */ diff --git a/mesalib/include/GLES2/gl2ext.h b/mesalib/include/GLES2/gl2ext.h new file mode 100644 index 000000000..305b29b63 --- /dev/null +++ b/mesalib/include/GLES2/gl2ext.h @@ -0,0 +1,388 @@ +#ifndef __gl2ext_h_ +#define __gl2ext_h_ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +#ifndef GL_APIENTRYP +# define GL_APIENTRYP GL_APIENTRY* +#endif + +/*------------------------------------------------------------------------* + * OES extension tokens + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_ETC1_RGB8_OES 0x8D64 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +typedef void* GLeglImageOES; +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif + +/* GL_OES_depth_texture */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +/* GL_READ_ONLY and GL_READ_WRITE not supported */ +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif + +/* GL_OES_texture3D */ +#ifndef GL_OES_texture3D +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +#endif + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_HALF_FLOAT_OES 0x8D61 +#endif + +/* GL_OES_vertex_half_float */ +/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_Z400_BINARY_AMD 0x8740 +#endif + +/*------------------------------------------------------------------------* + * AMD extension tokens + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif + +/*------------------------------------------------------------------------* + * EXT extension tokens + *------------------------------------------------------------------------*/ + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif + +/*------------------------------------------------------------------------* + * OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#endif + +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#endif + +/* GL_OES_depth_texture */ +#ifndef GL_OES_depth_texture +#define GL_OES_depth_texture 1 +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif + +/* GL_OES_fbo_render_mipmap */ +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif + +/* GL_OES_fragment_precision_high */ +#ifndef GL_OES_fragment_precision_high +#define GL_OES_fragment_precision_high 1 +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void** params); +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void** params); +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_OES_standard_derivatives 1 +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_OES_texture_3D 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void* pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels); +GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data); +GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void* data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void* data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif + +/* GL_OES_texture_float_linear */ +#ifndef GL_OES_texture_float_linear +#define GL_OES_texture_float_linear 1 +#endif + +/* GL_OES_texture_half_float_linear */ +#ifndef GL_OES_texture_half_float_linear +#define GL_OES_texture_half_float_linear 1 +#endif + +/* GL_OES_texture_float */ +#ifndef GL_OES_texture_float +#define GL_OES_texture_float 1 +#endif + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_OES_texture_half_float 1 +#endif + +/* GL_OES_texture_npot */ +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 +#endif + +/* GL_OES_vertex_half_float */ +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 +#endif + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_OES_get_program_binary 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +#endif +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +#endif + +/*------------------------------------------------------------------------* + * AMD extension functions + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_AMD_program_binary_Z400 1 +#endif + +/*------------------------------------------------------------------------* + * EXT extension functions + *------------------------------------------------------------------------*/ + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_EXT_texture_type_2_10_10_10_REV 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2ext_h_ */ diff --git a/mesalib/include/GLES2/gl2platform.h b/mesalib/include/GLES2/gl2platform.h new file mode 100644 index 000000000..7e3dbc64b --- /dev/null +++ b/mesalib/include/GLES2/gl2platform.h @@ -0,0 +1,72 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/*------------------------------------------------------------------------- + * Definition of GL_APICALL and GL_APIENTRY + *-----------------------------------------------------------------------*/ + +#ifdef _WIN32 +# ifdef __GL_EXPORTS +# define GL_APICALL __declspec(dllexport) +# else +# define GL_APICALL __declspec(dllimport) +# endif +# ifdef UNDER_CE +# define GL_APIENTRY +# else +# define GL_APIENTRY __stdcall +# endif +#else +# ifdef __GL_EXPORTS +# define GL_APICALL +# else +# define GL_APICALL extern +# endif +# define GL_APIENTRY +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* __gl2platform_h_ */ diff --git a/mesalib/progs/Makefile b/mesalib/progs/Makefile new file mode 100644 index 000000000..c99f4eebc --- /dev/null +++ b/mesalib/progs/Makefile @@ -0,0 +1,32 @@ +# progs/Makefile + +TOP = .. + +include $(TOP)/configs/current + +SUBDIRS = $(PROGRAM_DIRS) + + +default: message subdirs + + +message: + @echo "Making programs for" $(CONFIG_NAME) + + +subdirs: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done + +# Dummy install target +install: + +clean: + -@for dir in $(SUBDIRS) tests ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) ; \ + fi \ + done diff --git a/mesalib/progs/util/README b/mesalib/progs/util/README new file mode 100644 index 000000000..ea71ebd2b --- /dev/null +++ b/mesalib/progs/util/README @@ -0,0 +1,21 @@ + +This directory is a collection of function which may be useful to +OpenGL/Mesa programmers. + + +errcheck.c - an OpenGL error check/report function +glutskel.c - handy skeleton for GLUT programs +idproj.c - setup an identity projection +mwmborder.c - remove Motif window decoration/border +winpos.c - set absolute window raster position +readtex.c - load textures/mipmaps from an .rgb file +showbuffer.[ch] - show depth, alpha, or stencil buffer contents +glstate.[ch] - query/print GL state variables, for debugging, etc. +sampleMakefile - example Makefile for making OpenGL/Mesa apps on Unix +dumpsate.c - dump all OpenGL state, from Stephane Rehel +imagesgi.cpp,.h - read SGI image files + + +more to come... + +---------------------------------------------------------------------- diff --git a/mesalib/progs/util/dumpstate.c b/mesalib/progs/util/dumpstate.c new file mode 100644 index 000000000..4c039a40f --- /dev/null +++ b/mesalib/progs/util/dumpstate.c @@ -0,0 +1,1959 @@ + +/* + * + * From: Stephane Rehel + * Date: Mon, 31 May 1999 18:40:54 -0400 + * To: Paul Brian + * Subject: OpenGL State Dump Function + * + * Here is a function that dumps the current OpenGL state. I wrote it + * some time ago. + * + * In the attachment: + * + the code itself + * + its output + * + * I think Mesa is wrong on some getBooleanv(). For example, GL_VERTEX_ARRAY + * is queried by IsEnabled() (cf. p. 196 of the spec). But on page 193 + * we can read that all the boolean attribs that can be queried by IsEnabled() + * can also be queried by IsEnabled(). + * + * I had duplicated all the enums (LOCAL_*) so that the code can run on any + * OpenGL version, even if an enum is not recognized. + * + * The code can be shipped in the public domain. + * + * Stephane. + */ + + +/* + * Stephane Rehel + * Creation: February 5 1999 + */ + +#include +#include + +/***************************************************************************/ + +enum { + /* Data types */ + LOCAL_GL_BYTE = 0x1400, + LOCAL_GL_UNSIGNED_BYTE = 0x1401, + LOCAL_GL_SHORT = 0x1402, + LOCAL_GL_UNSIGNED_SHORT = 0x1403, + LOCAL_GL_INT = 0x1404, + LOCAL_GL_UNSIGNED_INT = 0x1405, + LOCAL_GL_FLOAT = 0x1406, + LOCAL_GL_DOUBLE = 0x140A, + LOCAL_GL_2_BYTES = 0x1407, + LOCAL_GL_3_BYTES = 0x1408, + LOCAL_GL_4_BYTES = 0x1409, + + /* Primitives */ + LOCAL_GL_LINES = 0x0001, + LOCAL_GL_POINTS = 0x0000, + LOCAL_GL_LINE_STRIP = 0x0003, + LOCAL_GL_LINE_LOOP = 0x0002, + LOCAL_GL_TRIANGLES = 0x0004, + LOCAL_GL_TRIANGLE_STRIP = 0x0005, + LOCAL_GL_TRIANGLE_FAN = 0x0006, + LOCAL_GL_QUADS = 0x0007, + LOCAL_GL_QUAD_STRIP = 0x0008, + LOCAL_GL_POLYGON = 0x0009, + LOCAL_GL_EDGE_FLAG = 0x0B43, + + /* Vertex Arrays */ + LOCAL_GL_VERTEX_ARRAY = 0x8074, + LOCAL_GL_NORMAL_ARRAY = 0x8075, + LOCAL_GL_COLOR_ARRAY = 0x8076, + LOCAL_GL_INDEX_ARRAY = 0x8077, + LOCAL_GL_TEXTURE_COORD_ARRAY = 0x8078, + LOCAL_GL_EDGE_FLAG_ARRAY = 0x8079, + LOCAL_GL_VERTEX_ARRAY_SIZE = 0x807A, + LOCAL_GL_VERTEX_ARRAY_TYPE = 0x807B, + LOCAL_GL_VERTEX_ARRAY_STRIDE = 0x807C, + LOCAL_GL_NORMAL_ARRAY_TYPE = 0x807E, + LOCAL_GL_NORMAL_ARRAY_STRIDE = 0x807F, + LOCAL_GL_COLOR_ARRAY_SIZE = 0x8081, + LOCAL_GL_COLOR_ARRAY_TYPE = 0x8082, + LOCAL_GL_COLOR_ARRAY_STRIDE = 0x8083, + LOCAL_GL_INDEX_ARRAY_TYPE = 0x8085, + LOCAL_GL_INDEX_ARRAY_STRIDE = 0x8086, + LOCAL_GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088, + LOCAL_GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089, + LOCAL_GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A, + LOCAL_GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C, + LOCAL_GL_VERTEX_ARRAY_POINTER = 0x808E, + LOCAL_GL_NORMAL_ARRAY_POINTER = 0x808F, + LOCAL_GL_COLOR_ARRAY_POINTER = 0x8090, + LOCAL_GL_INDEX_ARRAY_POINTER = 0x8091, + LOCAL_GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092, + LOCAL_GL_EDGE_FLAG_ARRAY_POINTER = 0x8093, + LOCAL_GL_V2F = 0x2A20, + LOCAL_GL_V3F = 0x2A21, + LOCAL_GL_C4UB_V2F = 0x2A22, + LOCAL_GL_C4UB_V3F = 0x2A23, + LOCAL_GL_C3F_V3F = 0x2A24, + LOCAL_GL_N3F_V3F = 0x2A25, + LOCAL_GL_C4F_N3F_V3F = 0x2A26, + LOCAL_GL_T2F_V3F = 0x2A27, + LOCAL_GL_T4F_V4F = 0x2A28, + LOCAL_GL_T2F_C4UB_V3F = 0x2A29, + LOCAL_GL_T2F_C3F_V3F = 0x2A2A, + LOCAL_GL_T2F_N3F_V3F = 0x2A2B, + LOCAL_GL_T2F_C4F_N3F_V3F = 0x2A2C, + LOCAL_GL_T4F_C4F_N3F_V4F = 0x2A2D, + + /* Matrix Mode */ + LOCAL_GL_MATRIX_MODE = 0x0BA0, + LOCAL_GL_MODELVIEW = 0x1700, + LOCAL_GL_PROJECTION = 0x1701, + LOCAL_GL_TEXTURE = 0x1702, + + /* Points */ + LOCAL_GL_POINT_SMOOTH = 0x0B10, + LOCAL_GL_POINT_SIZE = 0x0B11, + LOCAL_GL_POINT_SIZE_GRANULARITY = 0x0B13, + LOCAL_GL_POINT_SIZE_RANGE = 0x0B12, + + /* Lines */ + LOCAL_GL_LINE_SMOOTH = 0x0B20, + LOCAL_GL_LINE_STIPPLE = 0x0B24, + LOCAL_GL_LINE_STIPPLE_PATTERN = 0x0B25, + LOCAL_GL_LINE_STIPPLE_REPEAT = 0x0B26, + LOCAL_GL_LINE_WIDTH = 0x0B21, + LOCAL_GL_LINE_WIDTH_GRANULARITY = 0x0B23, + LOCAL_GL_LINE_WIDTH_RANGE = 0x0B22, + + /* Polygons */ + LOCAL_GL_POINT = 0x1B00, + LOCAL_GL_LINE = 0x1B01, + LOCAL_GL_FILL = 0x1B02, + LOCAL_GL_CCW = 0x0901, + LOCAL_GL_CW = 0x0900, + LOCAL_GL_FRONT = 0x0404, + LOCAL_GL_BACK = 0x0405, + LOCAL_GL_CULL_FACE = 0x0B44, + LOCAL_GL_CULL_FACE_MODE = 0x0B45, + LOCAL_GL_POLYGON_SMOOTH = 0x0B41, + LOCAL_GL_POLYGON_STIPPLE = 0x0B42, + LOCAL_GL_FRONT_FACE = 0x0B46, + LOCAL_GL_POLYGON_MODE = 0x0B40, + LOCAL_GL_POLYGON_OFFSET_FACTOR = 0x8038, + LOCAL_GL_POLYGON_OFFSET_UNITS = 0x2A00, + LOCAL_GL_POLYGON_OFFSET_POINT = 0x2A01, + LOCAL_GL_POLYGON_OFFSET_LINE = 0x2A02, + LOCAL_GL_POLYGON_OFFSET_FILL = 0x8037, + + /* Display Lists */ + LOCAL_GL_COMPILE = 0x1300, + LOCAL_GL_COMPILE_AND_EXECUTE = 0x1301, + LOCAL_GL_LIST_BASE = 0x0B32, + LOCAL_GL_LIST_INDEX = 0x0B33, + LOCAL_GL_LIST_MODE = 0x0B30, + + /* Depth buffer */ + LOCAL_GL_NEVER = 0x0200, + LOCAL_GL_LESS = 0x0201, + LOCAL_GL_GEQUAL = 0x0206, + LOCAL_GL_LEQUAL = 0x0203, + LOCAL_GL_GREATER = 0x0204, + LOCAL_GL_NOTEQUAL = 0x0205, + LOCAL_GL_EQUAL = 0x0202, + LOCAL_GL_ALWAYS = 0x0207, + LOCAL_GL_DEPTH_TEST = 0x0B71, + LOCAL_GL_DEPTH_BITS = 0x0D56, + LOCAL_GL_DEPTH_CLEAR_VALUE = 0x0B73, + LOCAL_GL_DEPTH_FUNC = 0x0B74, + LOCAL_GL_DEPTH_RANGE = 0x0B70, + LOCAL_GL_DEPTH_WRITEMASK = 0x0B72, + LOCAL_GL_DEPTH_COMPONENT = 0x1902, + + /* Lighting */ + LOCAL_GL_LIGHTING = 0x0B50, + LOCAL_GL_LIGHT0 = 0x4000, + LOCAL_GL_LIGHT1 = 0x4001, + LOCAL_GL_LIGHT2 = 0x4002, + LOCAL_GL_LIGHT3 = 0x4003, + LOCAL_GL_LIGHT4 = 0x4004, + LOCAL_GL_LIGHT5 = 0x4005, + LOCAL_GL_LIGHT6 = 0x4006, + LOCAL_GL_LIGHT7 = 0x4007, + LOCAL_GL_SPOT_EXPONENT = 0x1205, + LOCAL_GL_SPOT_CUTOFF = 0x1206, + LOCAL_GL_CONSTANT_ATTENUATION = 0x1207, + LOCAL_GL_LINEAR_ATTENUATION = 0x1208, + LOCAL_GL_QUADRATIC_ATTENUATION = 0x1209, + LOCAL_GL_AMBIENT = 0x1200, + LOCAL_GL_DIFFUSE = 0x1201, + LOCAL_GL_SPECULAR = 0x1202, + LOCAL_GL_SHININESS = 0x1601, + LOCAL_GL_EMISSION = 0x1600, + LOCAL_GL_POSITION = 0x1203, + LOCAL_GL_SPOT_DIRECTION = 0x1204, + LOCAL_GL_AMBIENT_AND_DIFFUSE = 0x1602, + LOCAL_GL_COLOR_INDEXES = 0x1603, + LOCAL_GL_LIGHT_MODEL_TWO_SIDE = 0x0B52, + LOCAL_GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51, + LOCAL_GL_LIGHT_MODEL_AMBIENT = 0x0B53, + LOCAL_GL_FRONT_AND_BACK = 0x0408, + LOCAL_GL_SHADE_MODEL = 0x0B54, + LOCAL_GL_FLAT = 0x1D00, + LOCAL_GL_SMOOTH = 0x1D01, + LOCAL_GL_COLOR_MATERIAL = 0x0B57, + LOCAL_GL_COLOR_MATERIAL_FACE = 0x0B55, + LOCAL_GL_COLOR_MATERIAL_PARAMETER = 0x0B56, + LOCAL_GL_NORMALIZE = 0x0BA1, + + /* User clipping planes */ + LOCAL_GL_CLIP_PLANE0 = 0x3000, + LOCAL_GL_CLIP_PLANE1 = 0x3001, + LOCAL_GL_CLIP_PLANE2 = 0x3002, + LOCAL_GL_CLIP_PLANE3 = 0x3003, + LOCAL_GL_CLIP_PLANE4 = 0x3004, + LOCAL_GL_CLIP_PLANE5 = 0x3005, + + /* Accumulation buffer */ + LOCAL_GL_ACCUM_RED_BITS = 0x0D58, + LOCAL_GL_ACCUM_GREEN_BITS = 0x0D59, + LOCAL_GL_ACCUM_BLUE_BITS = 0x0D5A, + LOCAL_GL_ACCUM_ALPHA_BITS = 0x0D5B, + LOCAL_GL_ACCUM_CLEAR_VALUE = 0x0B80, + LOCAL_GL_ACCUM = 0x0100, + LOCAL_GL_ADD = 0x0104, + LOCAL_GL_LOAD = 0x0101, + LOCAL_GL_MULT = 0x0103, + LOCAL_GL_RETURN = 0x0102, + + /* Alpha testing */ + LOCAL_GL_ALPHA_TEST = 0x0BC0, + LOCAL_GL_ALPHA_TEST_REF = 0x0BC2, + LOCAL_GL_ALPHA_TEST_FUNC = 0x0BC1, + + /* Blending */ + LOCAL_GL_BLEND = 0x0BE2, + LOCAL_GL_BLEND_SRC = 0x0BE1, + LOCAL_GL_BLEND_DST = 0x0BE0, + LOCAL_GL_ZERO = 0, + LOCAL_GL_ONE = 1, + LOCAL_GL_SRC_COLOR = 0x0300, + LOCAL_GL_ONE_MINUS_SRC_COLOR = 0x0301, + LOCAL_GL_DST_COLOR = 0x0306, + LOCAL_GL_ONE_MINUS_DST_COLOR = 0x0307, + LOCAL_GL_SRC_ALPHA = 0x0302, + LOCAL_GL_ONE_MINUS_SRC_ALPHA = 0x0303, + LOCAL_GL_DST_ALPHA = 0x0304, + LOCAL_GL_ONE_MINUS_DST_ALPHA = 0x0305, + LOCAL_GL_SRC_ALPHA_SATURATE = 0x0308, + LOCAL_GL_CONSTANT_COLOR = 0x8001, + LOCAL_GL_ONE_MINUS_CONSTANT_COLOR = 0x8002, + LOCAL_GL_CONSTANT_ALPHA = 0x8003, + LOCAL_GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004, + + /* Render Mode */ + LOCAL_GL_FEEDBACK = 0x1C01, + LOCAL_GL_RENDER = 0x1C00, + LOCAL_GL_SELECT = 0x1C02, + + /* Feedback */ + LOCAL_GL_2D = 0x0600, + LOCAL_GL_3D = 0x0601, + LOCAL_GL_3D_COLOR = 0x0602, + LOCAL_GL_3D_COLOR_TEXTURE = 0x0603, + LOCAL_GL_4D_COLOR_TEXTURE = 0x0604, + LOCAL_GL_POINT_TOKEN = 0x0701, + LOCAL_GL_LINE_TOKEN = 0x0702, + LOCAL_GL_LINE_RESET_TOKEN = 0x0707, + LOCAL_GL_POLYGON_TOKEN = 0x0703, + LOCAL_GL_BITMAP_TOKEN = 0x0704, + LOCAL_GL_DRAW_PIXEL_TOKEN = 0x0705, + LOCAL_GL_COPY_PIXEL_TOKEN = 0x0706, + LOCAL_GL_PASS_THROUGH_TOKEN = 0x0700, + LOCAL_GL_FEEDBACK_BUFFER_POINTER = 0x0DF0, + LOCAL_GL_FEEDBACK_BUFFER_SIZE = 0x0DF1, + LOCAL_GL_FEEDBACK_BUFFER_TYPE = 0x0DF2, + + /* Selection */ + LOCAL_GL_SELECTION_BUFFER_POINTER = 0x0DF3, + LOCAL_GL_SELECTION_BUFFER_SIZE = 0x0DF4, + + /* Fog */ + LOCAL_GL_FOG = 0x0B60, + LOCAL_GL_FOG_MODE = 0x0B65, + LOCAL_GL_FOG_DENSITY = 0x0B62, + LOCAL_GL_FOG_COLOR = 0x0B66, + LOCAL_GL_FOG_INDEX = 0x0B61, + LOCAL_GL_FOG_START = 0x0B63, + LOCAL_GL_FOG_END = 0x0B64, + LOCAL_GL_LINEAR = 0x2601, + LOCAL_GL_EXP = 0x0800, + LOCAL_GL_EXP2 = 0x0801, + + /* Logic Ops */ + LOCAL_GL_LOGIC_OP = 0x0BF1, + LOCAL_GL_INDEX_LOGIC_OP = 0x0BF1, + LOCAL_GL_COLOR_LOGIC_OP = 0x0BF2, + LOCAL_GL_LOGIC_OP_MODE = 0x0BF0, + LOCAL_GL_CLEAR = 0x1500, + LOCAL_GL_SET = 0x150F, + LOCAL_GL_COPY = 0x1503, + LOCAL_GL_COPY_INVERTED = 0x150C, + LOCAL_GL_NOOP = 0x1505, + LOCAL_GL_INVERT = 0x150A, + LOCAL_GL_AND = 0x1501, + LOCAL_GL_NAND = 0x150E, + LOCAL_GL_OR = 0x1507, + LOCAL_GL_NOR = 0x1508, + LOCAL_GL_XOR = 0x1506, + LOCAL_GL_EQUIV = 0x1509, + LOCAL_GL_AND_REVERSE = 0x1502, + LOCAL_GL_AND_INVERTED = 0x1504, + LOCAL_GL_OR_REVERSE = 0x150B, + LOCAL_GL_OR_INVERTED = 0x150D, + + /* Stencil */ + LOCAL_GL_STENCIL_TEST = 0x0B90, + LOCAL_GL_STENCIL_WRITEMASK = 0x0B98, + LOCAL_GL_STENCIL_BITS = 0x0D57, + LOCAL_GL_STENCIL_FUNC = 0x0B92, + LOCAL_GL_STENCIL_VALUE_MASK = 0x0B93, + LOCAL_GL_STENCIL_REF = 0x0B97, + LOCAL_GL_STENCIL_FAIL = 0x0B94, + LOCAL_GL_STENCIL_PASS_DEPTH_PASS = 0x0B96, + LOCAL_GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95, + LOCAL_GL_STENCIL_CLEAR_VALUE = 0x0B91, + LOCAL_GL_STENCIL_INDEX = 0x1901, + LOCAL_GL_KEEP = 0x1E00, + LOCAL_GL_REPLACE = 0x1E01, + LOCAL_GL_INCR = 0x1E02, + LOCAL_GL_DECR = 0x1E03, + + /* Buffers, Pixel Drawing/Reading */ + LOCAL_GL_NONE = 0, + LOCAL_GL_LEFT = 0x0406, + LOCAL_GL_RIGHT = 0x0407, + /*LOCAL_GL_FRONT = 0x0404, */ + /*LOCAL_GL_BACK = 0x0405, */ + /*LOCAL_GL_FRONT_AND_BACK = 0x0408, */ + LOCAL_GL_FRONT_LEFT = 0x0400, + LOCAL_GL_FRONT_RIGHT = 0x0401, + LOCAL_GL_BACK_LEFT = 0x0402, + LOCAL_GL_BACK_RIGHT = 0x0403, + LOCAL_GL_AUX0 = 0x0409, + LOCAL_GL_AUX1 = 0x040A, + LOCAL_GL_AUX2 = 0x040B, + LOCAL_GL_AUX3 = 0x040C, + LOCAL_GL_COLOR_INDEX = 0x1900, + LOCAL_GL_RED = 0x1903, + LOCAL_GL_GREEN = 0x1904, + LOCAL_GL_BLUE = 0x1905, + LOCAL_GL_ALPHA = 0x1906, + LOCAL_GL_LUMINANCE = 0x1909, + LOCAL_GL_LUMINANCE_ALPHA = 0x190A, + LOCAL_GL_ALPHA_BITS = 0x0D55, + LOCAL_GL_RED_BITS = 0x0D52, + LOCAL_GL_GREEN_BITS = 0x0D53, + LOCAL_GL_BLUE_BITS = 0x0D54, + LOCAL_GL_INDEX_BITS = 0x0D51, + LOCAL_GL_SUBPIXEL_BITS = 0x0D50, + LOCAL_GL_AUX_BUFFERS = 0x0C00, + LOCAL_GL_READ_BUFFER = 0x0C02, + LOCAL_GL_DRAW_BUFFER = 0x0C01, + LOCAL_GL_DOUBLEBUFFER = 0x0C32, + LOCAL_GL_STEREO = 0x0C33, + LOCAL_GL_BITMAP = 0x1A00, + LOCAL_GL_COLOR = 0x1800, + LOCAL_GL_DEPTH = 0x1801, + LOCAL_GL_STENCIL = 0x1802, + LOCAL_GL_DITHER = 0x0BD0, + LOCAL_GL_RGB = 0x1907, + LOCAL_GL_RGBA = 0x1908, + + /* Implementation limits */ + LOCAL_GL_MAX_LIST_NESTING = 0x0B31, + LOCAL_GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35, + LOCAL_GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36, + LOCAL_GL_MAX_NAME_STACK_DEPTH = 0x0D37, + LOCAL_GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38, + LOCAL_GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39, + LOCAL_GL_MAX_EVAL_ORDER = 0x0D30, + LOCAL_GL_MAX_LIGHTS = 0x0D31, + LOCAL_GL_MAX_CLIP_PLANES = 0x0D32, + LOCAL_GL_MAX_TEXTURE_SIZE = 0x0D33, + LOCAL_GL_MAX_PIXEL_MAP_TABLE = 0x0D34, + LOCAL_GL_MAX_VIEWPORT_DIMS = 0x0D3A, + LOCAL_GL_MAX_CLIENT_ATTRIB_STACK_DEPTH= 0x0D3B, + + /* Gets */ + LOCAL_GL_ATTRIB_STACK_DEPTH = 0x0BB0, + LOCAL_GL_CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1, + LOCAL_GL_COLOR_CLEAR_VALUE = 0x0C22, + LOCAL_GL_COLOR_WRITEMASK = 0x0C23, + LOCAL_GL_CURRENT_INDEX = 0x0B01, + LOCAL_GL_CURRENT_COLOR = 0x0B00, + LOCAL_GL_CURRENT_NORMAL = 0x0B02, + LOCAL_GL_CURRENT_RASTER_COLOR = 0x0B04, + LOCAL_GL_CURRENT_RASTER_DISTANCE = 0x0B09, + LOCAL_GL_CURRENT_RASTER_INDEX = 0x0B05, + LOCAL_GL_CURRENT_RASTER_POSITION = 0x0B07, + LOCAL_GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06, + LOCAL_GL_CURRENT_RASTER_POSITION_VALID = 0x0B08, + LOCAL_GL_CURRENT_TEXTURE_COORDS = 0x0B03, + LOCAL_GL_INDEX_CLEAR_VALUE = 0x0C20, + LOCAL_GL_INDEX_MODE = 0x0C30, + LOCAL_GL_INDEX_WRITEMASK = 0x0C21, + LOCAL_GL_MODELVIEW_MATRIX = 0x0BA6, + LOCAL_GL_MODELVIEW_STACK_DEPTH = 0x0BA3, + LOCAL_GL_NAME_STACK_DEPTH = 0x0D70, + LOCAL_GL_PROJECTION_MATRIX = 0x0BA7, + LOCAL_GL_PROJECTION_STACK_DEPTH = 0x0BA4, + LOCAL_GL_RENDER_MODE = 0x0C40, + LOCAL_GL_RGBA_MODE = 0x0C31, + LOCAL_GL_TEXTURE_MATRIX = 0x0BA8, + LOCAL_GL_TEXTURE_STACK_DEPTH = 0x0BA5, + LOCAL_GL_VIEWPORT = 0x0BA2, + + + /* Evaluators */ + LOCAL_GL_AUTO_NORMAL = 0x0D80, + LOCAL_GL_MAP1_COLOR_4 = 0x0D90, + LOCAL_GL_MAP1_GRID_DOMAIN = 0x0DD0, + LOCAL_GL_MAP1_GRID_SEGMENTS = 0x0DD1, + LOCAL_GL_MAP1_INDEX = 0x0D91, + LOCAL_GL_MAP1_NORMAL = 0x0D92, + LOCAL_GL_MAP1_TEXTURE_COORD_1 = 0x0D93, + LOCAL_GL_MAP1_TEXTURE_COORD_2 = 0x0D94, + LOCAL_GL_MAP1_TEXTURE_COORD_3 = 0x0D95, + LOCAL_GL_MAP1_TEXTURE_COORD_4 = 0x0D96, + LOCAL_GL_MAP1_VERTEX_3 = 0x0D97, + LOCAL_GL_MAP1_VERTEX_4 = 0x0D98, + LOCAL_GL_MAP2_COLOR_4 = 0x0DB0, + LOCAL_GL_MAP2_GRID_DOMAIN = 0x0DD2, + LOCAL_GL_MAP2_GRID_SEGMENTS = 0x0DD3, + LOCAL_GL_MAP2_INDEX = 0x0DB1, + LOCAL_GL_MAP2_NORMAL = 0x0DB2, + LOCAL_GL_MAP2_TEXTURE_COORD_1 = 0x0DB3, + LOCAL_GL_MAP2_TEXTURE_COORD_2 = 0x0DB4, + LOCAL_GL_MAP2_TEXTURE_COORD_3 = 0x0DB5, + LOCAL_GL_MAP2_TEXTURE_COORD_4 = 0x0DB6, + LOCAL_GL_MAP2_VERTEX_3 = 0x0DB7, + LOCAL_GL_MAP2_VERTEX_4 = 0x0DB8, + LOCAL_GL_COEFF = 0x0A00, + LOCAL_GL_DOMAIN = 0x0A02, + LOCAL_GL_ORDER = 0x0A01, + + /* Hints */ + LOCAL_GL_FOG_HINT = 0x0C54, + LOCAL_GL_LINE_SMOOTH_HINT = 0x0C52, + LOCAL_GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50, + LOCAL_GL_POINT_SMOOTH_HINT = 0x0C51, + LOCAL_GL_POLYGON_SMOOTH_HINT = 0x0C53, + LOCAL_GL_DONT_CARE = 0x1100, + LOCAL_GL_FASTEST = 0x1101, + LOCAL_GL_NICEST = 0x1102, + + /* Scissor box */ + LOCAL_GL_SCISSOR_TEST = 0x0C11, + LOCAL_GL_SCISSOR_BOX = 0x0C10, + + /* Pixel Mode / Transfer */ + LOCAL_GL_MAP_COLOR = 0x0D10, + LOCAL_GL_MAP_STENCIL = 0x0D11, + LOCAL_GL_INDEX_SHIFT = 0x0D12, + LOCAL_GL_INDEX_OFFSET = 0x0D13, + LOCAL_GL_RED_SCALE = 0x0D14, + LOCAL_GL_RED_BIAS = 0x0D15, + LOCAL_GL_GREEN_SCALE = 0x0D18, + LOCAL_GL_GREEN_BIAS = 0x0D19, + LOCAL_GL_BLUE_SCALE = 0x0D1A, + LOCAL_GL_BLUE_BIAS = 0x0D1B, + LOCAL_GL_ALPHA_SCALE = 0x0D1C, + LOCAL_GL_ALPHA_BIAS = 0x0D1D, + LOCAL_GL_DEPTH_SCALE = 0x0D1E, + LOCAL_GL_DEPTH_BIAS = 0x0D1F, + LOCAL_GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1, + LOCAL_GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0, + LOCAL_GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2, + LOCAL_GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3, + LOCAL_GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4, + LOCAL_GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5, + LOCAL_GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6, + LOCAL_GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7, + LOCAL_GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8, + LOCAL_GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9, + LOCAL_GL_PIXEL_MAP_S_TO_S = 0x0C71, + LOCAL_GL_PIXEL_MAP_I_TO_I = 0x0C70, + LOCAL_GL_PIXEL_MAP_I_TO_R = 0x0C72, + LOCAL_GL_PIXEL_MAP_I_TO_G = 0x0C73, + LOCAL_GL_PIXEL_MAP_I_TO_B = 0x0C74, + LOCAL_GL_PIXEL_MAP_I_TO_A = 0x0C75, + LOCAL_GL_PIXEL_MAP_R_TO_R = 0x0C76, + LOCAL_GL_PIXEL_MAP_G_TO_G = 0x0C77, + LOCAL_GL_PIXEL_MAP_B_TO_B = 0x0C78, + LOCAL_GL_PIXEL_MAP_A_TO_A = 0x0C79, + LOCAL_GL_PACK_ALIGNMENT = 0x0D05, + LOCAL_GL_PACK_LSB_FIRST = 0x0D01, + LOCAL_GL_PACK_ROW_LENGTH = 0x0D02, + LOCAL_GL_PACK_SKIP_PIXELS = 0x0D04, + LOCAL_GL_PACK_SKIP_ROWS = 0x0D03, + LOCAL_GL_PACK_SWAP_BYTES = 0x0D00, + LOCAL_GL_UNPACK_ALIGNMENT = 0x0CF5, + LOCAL_GL_UNPACK_LSB_FIRST = 0x0CF1, + LOCAL_GL_UNPACK_ROW_LENGTH = 0x0CF2, + LOCAL_GL_UNPACK_SKIP_PIXELS = 0x0CF4, + LOCAL_GL_UNPACK_SKIP_ROWS = 0x0CF3, + LOCAL_GL_UNPACK_SWAP_BYTES = 0x0CF0, + LOCAL_GL_ZOOM_X = 0x0D16, + LOCAL_GL_ZOOM_Y = 0x0D17, + + /* Texture mapping */ + LOCAL_GL_TEXTURE_ENV = 0x2300, + LOCAL_GL_TEXTURE_ENV_MODE = 0x2200, + LOCAL_GL_TEXTURE_1D = 0x0DE0, + LOCAL_GL_TEXTURE_2D = 0x0DE1, + LOCAL_GL_TEXTURE_WRAP_S = 0x2802, + LOCAL_GL_TEXTURE_WRAP_T = 0x2803, + LOCAL_GL_TEXTURE_MAG_FILTER = 0x2800, + LOCAL_GL_TEXTURE_MIN_FILTER = 0x2801, + LOCAL_GL_TEXTURE_ENV_COLOR = 0x2201, + LOCAL_GL_TEXTURE_GEN_S = 0x0C60, + LOCAL_GL_TEXTURE_GEN_T = 0x0C61, + LOCAL_GL_TEXTURE_GEN_MODE = 0x2500, + LOCAL_GL_TEXTURE_BORDER_COLOR = 0x1004, + LOCAL_GL_TEXTURE_WIDTH = 0x1000, + LOCAL_GL_TEXTURE_HEIGHT = 0x1001, + LOCAL_GL_TEXTURE_BORDER = 0x1005, + LOCAL_GL_TEXTURE_COMPONENTS = 0x1003, + LOCAL_GL_TEXTURE_RED_SIZE = 0x805C, + LOCAL_GL_TEXTURE_GREEN_SIZE = 0x805D, + LOCAL_GL_TEXTURE_BLUE_SIZE = 0x805E, + LOCAL_GL_TEXTURE_ALPHA_SIZE = 0x805F, + LOCAL_GL_TEXTURE_LUMINANCE_SIZE = 0x8060, + LOCAL_GL_TEXTURE_INTENSITY_SIZE = 0x8061, + LOCAL_GL_NEAREST_MIPMAP_NEAREST = 0x2700, + LOCAL_GL_NEAREST_MIPMAP_LINEAR = 0x2702, + LOCAL_GL_LINEAR_MIPMAP_NEAREST = 0x2701, + LOCAL_GL_LINEAR_MIPMAP_LINEAR = 0x2703, + LOCAL_GL_OBJECT_LINEAR = 0x2401, + LOCAL_GL_OBJECT_PLANE = 0x2501, + LOCAL_GL_EYE_LINEAR = 0x2400, + LOCAL_GL_EYE_PLANE = 0x2502, + LOCAL_GL_SPHERE_MAP = 0x2402, + LOCAL_GL_DECAL = 0x2101, + LOCAL_GL_MODULATE = 0x2100, + LOCAL_GL_NEAREST = 0x2600, + LOCAL_GL_REPEAT = 0x2901, + LOCAL_GL_CLAMP = 0x2900, + LOCAL_GL_S = 0x2000, + LOCAL_GL_T = 0x2001, + LOCAL_GL_R = 0x2002, + LOCAL_GL_Q = 0x2003, + LOCAL_GL_TEXTURE_GEN_R = 0x0C62, + LOCAL_GL_TEXTURE_GEN_Q = 0x0C63, + + /* GL 1.1 texturing */ + LOCAL_GL_PROXY_TEXTURE_1D = 0x8063, + LOCAL_GL_PROXY_TEXTURE_2D = 0x8064, + LOCAL_GL_TEXTURE_PRIORITY = 0x8066, + LOCAL_GL_TEXTURE_RESIDENT = 0x8067, + LOCAL_GL_TEXTURE_BINDING_1D = 0x8068, + LOCAL_GL_TEXTURE_BINDING_2D = 0x8069, + LOCAL_GL_TEXTURE_INTERNAL_FORMAT = 0x1003, + + /* GL 1.2 texturing */ + LOCAL_GL_PACK_SKIP_IMAGES = 0x806B, + LOCAL_GL_PACK_IMAGE_HEIGHT = 0x806C, + LOCAL_GL_UNPACK_SKIP_IMAGES = 0x806D, + LOCAL_GL_UNPACK_IMAGE_HEIGHT = 0x806E, + LOCAL_GL_TEXTURE_3D = 0x806F, + LOCAL_GL_PROXY_TEXTURE_3D = 0x8070, + LOCAL_GL_TEXTURE_DEPTH = 0x8071, + LOCAL_GL_TEXTURE_WRAP_R = 0x8072, + LOCAL_GL_MAX_3D_TEXTURE_SIZE = 0x8073, + LOCAL_GL_TEXTURE_BINDING_3D = 0x806A, + + /* Internal texture formats (GL 1.1) */ + LOCAL_GL_ALPHA4 = 0x803B, + LOCAL_GL_ALPHA8 = 0x803C, + LOCAL_GL_ALPHA12 = 0x803D, + LOCAL_GL_ALPHA16 = 0x803E, + LOCAL_GL_LUMINANCE4 = 0x803F, + LOCAL_GL_LUMINANCE8 = 0x8040, + LOCAL_GL_LUMINANCE12 = 0x8041, + LOCAL_GL_LUMINANCE16 = 0x8042, + LOCAL_GL_LUMINANCE4_ALPHA4 = 0x8043, + LOCAL_GL_LUMINANCE6_ALPHA2 = 0x8044, + LOCAL_GL_LUMINANCE8_ALPHA8 = 0x8045, + LOCAL_GL_LUMINANCE12_ALPHA4 = 0x8046, + LOCAL_GL_LUMINANCE12_ALPHA12 = 0x8047, + LOCAL_GL_LUMINANCE16_ALPHA16 = 0x8048, + LOCAL_GL_INTENSITY = 0x8049, + LOCAL_GL_INTENSITY4 = 0x804A, + LOCAL_GL_INTENSITY8 = 0x804B, + LOCAL_GL_INTENSITY12 = 0x804C, + LOCAL_GL_INTENSITY16 = 0x804D, + LOCAL_GL_R3_G3_B2 = 0x2A10, + LOCAL_GL_RGB4 = 0x804F, + LOCAL_GL_RGB5 = 0x8050, + LOCAL_GL_RGB8 = 0x8051, + LOCAL_GL_RGB10 = 0x8052, + LOCAL_GL_RGB12 = 0x8053, + LOCAL_GL_RGB16 = 0x8054, + LOCAL_GL_RGBA2 = 0x8055, + LOCAL_GL_RGBA4 = 0x8056, + LOCAL_GL_RGB5_A1 = 0x8057, + LOCAL_GL_RGBA8 = 0x8058, + LOCAL_GL_RGB10_A2 = 0x8059, + LOCAL_GL_RGBA12 = 0x805A, + LOCAL_GL_RGBA16 = 0x805B, + + /* Utility */ + LOCAL_GL_VENDOR = 0x1F00, + LOCAL_GL_RENDERER = 0x1F01, + LOCAL_GL_VERSION = 0x1F02, + LOCAL_GL_EXTENSIONS = 0x1F03, + + /* Errors */ + LOCAL_GL_INVALID_VALUE = 0x0501, + LOCAL_GL_INVALID_ENUM = 0x0500, + LOCAL_GL_INVALID_OPERATION = 0x0502, + LOCAL_GL_STACK_OVERFLOW = 0x0503, + LOCAL_GL_STACK_UNDERFLOW = 0x0504, + LOCAL_GL_OUT_OF_MEMORY = 0x0505, + + /* + * Extensions + */ + + /* LOCAL_GL_EXT_blend_minmax and LOCAL_GL_EXT_blend_color */ + LOCAL_GL_CONSTANT_COLOR_EXT = 0x8001, + LOCAL_GL_ONE_MINUS_CONSTANT_COLOR_EXT = 0x8002, + LOCAL_GL_CONSTANT_ALPHA_EXT = 0x8003, + LOCAL_GL_ONE_MINUS_CONSTANT_ALPHA_EXT = 0x8004, + LOCAL_GL_BLEND_EQUATION_EXT = 0x8009, + LOCAL_GL_MIN_EXT = 0x8007, + LOCAL_GL_MAX_EXT = 0x8008, + LOCAL_GL_FUNC_ADD_EXT = 0x8006, + LOCAL_GL_FUNC_SUBTRACT_EXT = 0x800A, + LOCAL_GL_FUNC_REVERSE_SUBTRACT_EXT = 0x800B, + LOCAL_GL_BLEND_COLOR_EXT = 0x8005, + + /* LOCAL_GL_EXT_polygon_offset */ + LOCAL_GL_POLYGON_OFFSET_EXT = 0x8037, + LOCAL_GL_POLYGON_OFFSET_FACTOR_EXT = 0x8038, + LOCAL_GL_POLYGON_OFFSET_BIAS_EXT = 0x8039, + + /* LOCAL_GL_EXT_vertex_array */ + LOCAL_GL_VERTEX_ARRAY_EXT = 0x8074, + LOCAL_GL_NORMAL_ARRAY_EXT = 0x8075, + LOCAL_GL_COLOR_ARRAY_EXT = 0x8076, + LOCAL_GL_INDEX_ARRAY_EXT = 0x8077, + LOCAL_GL_TEXTURE_COORD_ARRAY_EXT = 0x8078, + LOCAL_GL_EDGE_FLAG_ARRAY_EXT = 0x8079, + LOCAL_GL_VERTEX_ARRAY_SIZE_EXT = 0x807A, + LOCAL_GL_VERTEX_ARRAY_TYPE_EXT = 0x807B, + LOCAL_GL_VERTEX_ARRAY_STRIDE_EXT = 0x807C, + LOCAL_GL_VERTEX_ARRAY_COUNT_EXT = 0x807D, + LOCAL_GL_NORMAL_ARRAY_TYPE_EXT = 0x807E, + LOCAL_GL_NORMAL_ARRAY_STRIDE_EXT = 0x807F, + LOCAL_GL_NORMAL_ARRAY_COUNT_EXT = 0x8080, + LOCAL_GL_COLOR_ARRAY_SIZE_EXT = 0x8081, + LOCAL_GL_COLOR_ARRAY_TYPE_EXT = 0x8082, + LOCAL_GL_COLOR_ARRAY_STRIDE_EXT = 0x8083, + LOCAL_GL_COLOR_ARRAY_COUNT_EXT = 0x8084, + LOCAL_GL_INDEX_ARRAY_TYPE_EXT = 0x8085, + LOCAL_GL_INDEX_ARRAY_STRIDE_EXT = 0x8086, + LOCAL_GL_INDEX_ARRAY_COUNT_EXT = 0x8087, + LOCAL_GL_TEXTURE_COORD_ARRAY_SIZE_EXT = 0x8088, + LOCAL_GL_TEXTURE_COORD_ARRAY_TYPE_EXT = 0x8089, + LOCAL_GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = 0x808A, + LOCAL_GL_TEXTURE_COORD_ARRAY_COUNT_EXT = 0x808B, + LOCAL_GL_EDGE_FLAG_ARRAY_STRIDE_EXT = 0x808C, + LOCAL_GL_EDGE_FLAG_ARRAY_COUNT_EXT = 0x808D, + LOCAL_GL_VERTEX_ARRAY_POINTER_EXT = 0x808E, + LOCAL_GL_NORMAL_ARRAY_POINTER_EXT = 0x808F, + LOCAL_GL_COLOR_ARRAY_POINTER_EXT = 0x8090, + LOCAL_GL_INDEX_ARRAY_POINTER_EXT = 0x8091, + LOCAL_GL_TEXTURE_COORD_ARRAY_POINTER_EXT = 0x8092, + LOCAL_GL_EDGE_FLAG_ARRAY_POINTER_EXT = 0x8093, + + /* LOCAL_GL_EXT_texture_object */ + LOCAL_GL_TEXTURE_PRIORITY_EXT = 0x8066, + LOCAL_GL_TEXTURE_RESIDENT_EXT = 0x8067, + LOCAL_GL_TEXTURE_1D_BINDING_EXT = 0x8068, + LOCAL_GL_TEXTURE_2D_BINDING_EXT = 0x8069, + + /* LOCAL_GL_EXT_texture3D */ + LOCAL_GL_PACK_SKIP_IMAGES_EXT = 0x806B, + LOCAL_GL_PACK_IMAGE_HEIGHT_EXT = 0x806C, + LOCAL_GL_UNPACK_SKIP_IMAGES_EXT = 0x806D, + LOCAL_GL_UNPACK_IMAGE_HEIGHT_EXT = 0x806E, + LOCAL_GL_TEXTURE_3D_EXT = 0x806F, + LOCAL_GL_PROXY_TEXTURE_3D_EXT = 0x8070, + LOCAL_GL_TEXTURE_DEPTH_EXT = 0x8071, + LOCAL_GL_TEXTURE_WRAP_R_EXT = 0x8072, + LOCAL_GL_MAX_3D_TEXTURE_SIZE_EXT = 0x8073, + LOCAL_GL_TEXTURE_3D_BINDING_EXT = 0x806A, + + /* LOCAL_GL_EXT_paletted_texture */ + LOCAL_GL_TABLE_TOO_LARGE_EXT = 0x8031, + LOCAL_GL_COLOR_TABLE_FORMAT_EXT = 0x80D8, + LOCAL_GL_COLOR_TABLE_WIDTH_EXT = 0x80D9, + LOCAL_GL_COLOR_TABLE_RED_SIZE_EXT = 0x80DA, + LOCAL_GL_COLOR_TABLE_GREEN_SIZE_EXT = 0x80DB, + LOCAL_GL_COLOR_TABLE_BLUE_SIZE_EXT = 0x80DC, + LOCAL_GL_COLOR_TABLE_ALPHA_SIZE_EXT = 0x80DD, + LOCAL_GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = 0x80DE, + LOCAL_GL_COLOR_TABLE_INTENSITY_SIZE_EXT = 0x80DF, + LOCAL_GL_TEXTURE_INDEX_SIZE_EXT = 0x80ED, + LOCAL_GL_COLOR_INDEX1_EXT = 0x80E2, + LOCAL_GL_COLOR_INDEX2_EXT = 0x80E3, + LOCAL_GL_COLOR_INDEX4_EXT = 0x80E4, + LOCAL_GL_COLOR_INDEX8_EXT = 0x80E5, + LOCAL_GL_COLOR_INDEX12_EXT = 0x80E6, + LOCAL_GL_COLOR_INDEX16_EXT = 0x80E7, + + /* LOCAL_GL_EXT_shared_texture_palette */ + LOCAL_GL_SHARED_TEXTURE_PALETTE_EXT = 0x81FB, + + /* LOCAL_GL_EXT_point_parameters */ + LOCAL_GL_POINT_SIZE_MIN_EXT = 0x8126, + LOCAL_GL_POINT_SIZE_MAX_EXT = 0x8127, + LOCAL_GL_POINT_FADE_THRESHOLD_SIZE_EXT = 0x8128, + LOCAL_GL_DISTANCE_ATTENUATION_EXT = 0x8129, + + /* LOCAL_GL_EXT_rescale_normal */ + LOCAL_GL_RESCALE_NORMAL_EXT = 0x803A, + + /* LOCAL_GL_EXT_abgr */ + LOCAL_GL_ABGR_EXT = 0x8000, + + /* LOCAL_GL_SGIS_multitexture */ + LOCAL_GL_SELECTED_TEXTURE_SGIS = 0x835C, + LOCAL_GL_SELECTED_TEXTURE_COORD_SET_SGIS = 0x835D, + LOCAL_GL_MAX_TEXTURES_SGIS = 0x835E, + LOCAL_GL_TEXTURE0_SGIS = 0x835F, + LOCAL_GL_TEXTURE1_SGIS = 0x8360, + LOCAL_GL_TEXTURE2_SGIS = 0x8361, + LOCAL_GL_TEXTURE3_SGIS = 0x8362, + LOCAL_GL_TEXTURE_COORD_SET_SOURCE_SGIS = 0x8363, + + /* LOCAL_GL_EXT_multitexture */ + LOCAL_GL_SELECTED_TEXTURE_EXT = 0x83C0, + LOCAL_GL_SELECTED_TEXTURE_COORD_SET_EXT = 0x83C1, + LOCAL_GL_SELECTED_TEXTURE_TRANSFORM_EXT = 0x83C2, + LOCAL_GL_MAX_TEXTURES_EXT = 0x83C3, + LOCAL_GL_MAX_TEXTURE_COORD_SETS_EXT = 0x83C4, + LOCAL_GL_TEXTURE_ENV_COORD_SET_EXT = 0x83C5, + LOCAL_GL_TEXTURE0_EXT = 0x83C6, + LOCAL_GL_TEXTURE1_EXT = 0x83C7, + LOCAL_GL_TEXTURE2_EXT = 0x83C8, + LOCAL_GL_TEXTURE3_EXT = 0x83C9, + + /* LOCAL_GL_SGIS_texture_edge_clamp */ + LOCAL_GL_CLAMP_TO_EDGE_SGIS = 0x812F, + + /* OpenGL 1.2 */ + LOCAL_GL_RESCALE_NORMAL = 0x803A, + LOCAL_GL_CLAMP_TO_EDGE = 0x812F, + LOCAL_GL_MAX_ELEMENTS_VERTICES = 0xF0E8, + LOCAL_GL_MAX_ELEMENTS_INDICES = 0xF0E9, + LOCAL_GL_BGR = 0x80E0, + LOCAL_GL_BGRA = 0x80E1, + LOCAL_GL_UNSIGNED_BYTE_3_3_2 = 0x8032, + LOCAL_GL_UNSIGNED_BYTE_2_3_3_REV = 0x8362, + LOCAL_GL_UNSIGNED_SHORT_5_6_5 = 0x8363, + LOCAL_GL_UNSIGNED_SHORT_5_6_5_REV = 0x8364, + LOCAL_GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033, + LOCAL_GL_UNSIGNED_SHORT_4_4_4_4_REV = 0x8365, + LOCAL_GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034, + LOCAL_GL_UNSIGNED_SHORT_1_5_5_5_REV = 0x8366, + LOCAL_GL_UNSIGNED_INT_8_8_8_8 = 0x8035, + LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367, + LOCAL_GL_UNSIGNED_INT_10_10_10_2 = 0x8036, + LOCAL_GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368, + LOCAL_GL_LIGHT_MODEL_COLOR_CONTROL = 0x81F8, + LOCAL_GL_SINGLE_COLOR = 0x81F9, + LOCAL_GL_SEPARATE_SPECULAR_COLOR = 0x81FA, + LOCAL_GL_TEXTURE_MIN_LOD = 0x813A, + LOCAL_GL_TEXTURE_MAX_LOD = 0x813B, + LOCAL_GL_TEXTURE_BASE_LEVEL = 0x813C, + LOCAL_GL_TEXTURE_MAX_LEVEL = 0x813D +}; + +typedef struct { GLenum e; const char* name; } ENUM; +#define EDEF(VAR) { (GLenum)(LOCAL_GL_##VAR), #VAR } + +static ENUM enums[] = + { + EDEF(BYTE), + EDEF(UNSIGNED_BYTE), + EDEF(SHORT), + EDEF(UNSIGNED_SHORT), + EDEF(INT), + EDEF(UNSIGNED_INT), + EDEF(FLOAT), + EDEF(DOUBLE), + EDEF(2_BYTES), + EDEF(3_BYTES), + EDEF(4_BYTES), +/* + EDEF(LINES), + EDEF(POINTS), + EDEF(LINE_STRIP), + EDEF(LINE_LOOP), + EDEF(TRIANGLES), + EDEF(TRIANGLE_STRIP), + EDEF(TRIANGLE_FAN), + EDEF(QUADS), + EDEF(QUAD_STRIP), + EDEF(POLYGON), + EDEF(EDGE_FLAG), +*/ + EDEF(VERTEX_ARRAY), + EDEF(NORMAL_ARRAY), + EDEF(COLOR_ARRAY), + EDEF(INDEX_ARRAY), + EDEF(TEXTURE_COORD_ARRAY), + EDEF(EDGE_FLAG_ARRAY), + EDEF(VERTEX_ARRAY_SIZE), + EDEF(VERTEX_ARRAY_TYPE), + EDEF(VERTEX_ARRAY_STRIDE), + EDEF(NORMAL_ARRAY_TYPE), + EDEF(NORMAL_ARRAY_STRIDE), + EDEF(COLOR_ARRAY_SIZE), + EDEF(COLOR_ARRAY_TYPE), + EDEF(COLOR_ARRAY_STRIDE), + EDEF(INDEX_ARRAY_TYPE), + EDEF(INDEX_ARRAY_STRIDE), + EDEF(TEXTURE_COORD_ARRAY_SIZE), + EDEF(TEXTURE_COORD_ARRAY_TYPE), + EDEF(TEXTURE_COORD_ARRAY_STRIDE), + EDEF(EDGE_FLAG_ARRAY_STRIDE), + EDEF(VERTEX_ARRAY_POINTER), + EDEF(NORMAL_ARRAY_POINTER), + EDEF(COLOR_ARRAY_POINTER), + EDEF(INDEX_ARRAY_POINTER), + EDEF(TEXTURE_COORD_ARRAY_POINTER), + EDEF(EDGE_FLAG_ARRAY_POINTER), + EDEF(V2F), + EDEF(V3F), + EDEF(C4UB_V2F), + EDEF(C4UB_V3F), + EDEF(C3F_V3F), + EDEF(N3F_V3F), + EDEF(C4F_N3F_V3F), + EDEF(T2F_V3F), + EDEF(T4F_V4F), + EDEF(T2F_C4UB_V3F), + EDEF(T2F_C3F_V3F), + EDEF(T2F_N3F_V3F), + EDEF(T2F_C4F_N3F_V3F), + EDEF(T4F_C4F_N3F_V4F), + EDEF(MATRIX_MODE), + EDEF(MODELVIEW), + EDEF(PROJECTION), + EDEF(TEXTURE), + EDEF(POINT_SMOOTH), + EDEF(POINT_SIZE), + EDEF(POINT_SIZE_GRANULARITY), + EDEF(POINT_SIZE_RANGE), + EDEF(LINE_SMOOTH), + EDEF(LINE_STIPPLE), + EDEF(LINE_STIPPLE_PATTERN), + EDEF(LINE_STIPPLE_REPEAT), + EDEF(LINE_WIDTH), + EDEF(LINE_WIDTH_GRANULARITY), + EDEF(LINE_WIDTH_RANGE), + EDEF(POINT), + EDEF(LINE), + EDEF(FILL), + EDEF(CCW), + EDEF(CW), + EDEF(FRONT), + EDEF(BACK), + EDEF(CULL_FACE), + EDEF(CULL_FACE_MODE), + EDEF(POLYGON_SMOOTH), + EDEF(POLYGON_STIPPLE), + EDEF(FRONT_FACE), + EDEF(POLYGON_MODE), + EDEF(POLYGON_OFFSET_FACTOR), + EDEF(POLYGON_OFFSET_UNITS), + EDEF(POLYGON_OFFSET_POINT), + EDEF(POLYGON_OFFSET_LINE), + EDEF(POLYGON_OFFSET_FILL), + EDEF(COMPILE), + EDEF(COMPILE_AND_EXECUTE), + EDEF(LIST_BASE), + EDEF(LIST_INDEX), + EDEF(LIST_MODE), + EDEF(NEVER), + EDEF(LESS), + EDEF(GEQUAL), + EDEF(LEQUAL), + EDEF(GREATER), + EDEF(NOTEQUAL), + EDEF(EQUAL), + EDEF(ALWAYS), + EDEF(DEPTH_TEST), + EDEF(DEPTH_BITS), + EDEF(DEPTH_CLEAR_VALUE), + EDEF(DEPTH_FUNC), + EDEF(DEPTH_RANGE), + EDEF(DEPTH_WRITEMASK), + EDEF(DEPTH_COMPONENT), + EDEF(LIGHTING), + EDEF(LIGHT0), + EDEF(LIGHT1), + EDEF(LIGHT2), + EDEF(LIGHT3), + EDEF(LIGHT4), + EDEF(LIGHT5), + EDEF(LIGHT6), + EDEF(LIGHT7), + EDEF(SPOT_EXPONENT), + EDEF(SPOT_CUTOFF), + EDEF(CONSTANT_ATTENUATION), + EDEF(LINEAR_ATTENUATION), + EDEF(QUADRATIC_ATTENUATION), + EDEF(AMBIENT), + EDEF(DIFFUSE), + EDEF(SPECULAR), + EDEF(SHININESS), + EDEF(EMISSION), + EDEF(POSITION), + EDEF(SPOT_DIRECTION), + EDEF(AMBIENT_AND_DIFFUSE), + EDEF(COLOR_INDEXES), + EDEF(LIGHT_MODEL_TWO_SIDE), + EDEF(LIGHT_MODEL_LOCAL_VIEWER), + EDEF(LIGHT_MODEL_AMBIENT), + EDEF(FRONT_AND_BACK), + EDEF(SHADE_MODEL), + EDEF(FLAT), + EDEF(SMOOTH), + EDEF(COLOR_MATERIAL), + EDEF(COLOR_MATERIAL_FACE), + EDEF(COLOR_MATERIAL_PARAMETER), + EDEF(NORMALIZE), + EDEF(CLIP_PLANE0), + EDEF(CLIP_PLANE1), + EDEF(CLIP_PLANE2), + EDEF(CLIP_PLANE3), + EDEF(CLIP_PLANE4), + EDEF(CLIP_PLANE5), + EDEF(ACCUM_RED_BITS), + EDEF(ACCUM_GREEN_BITS), + EDEF(ACCUM_BLUE_BITS), + EDEF(ACCUM_ALPHA_BITS), + EDEF(ACCUM_CLEAR_VALUE), + EDEF(ACCUM), + EDEF(ADD), + EDEF(LOAD), + EDEF(MULT), + EDEF(RETURN), + EDEF(ALPHA_TEST), + EDEF(ALPHA_TEST_REF), + EDEF(ALPHA_TEST_FUNC), + EDEF(BLEND), + EDEF(BLEND_SRC), + EDEF(BLEND_DST), + EDEF(ZERO), + EDEF(ONE), + EDEF(SRC_COLOR), + EDEF(ONE_MINUS_SRC_COLOR), + EDEF(DST_COLOR), + EDEF(ONE_MINUS_DST_COLOR), + EDEF(SRC_ALPHA), + EDEF(ONE_MINUS_SRC_ALPHA), + EDEF(DST_ALPHA), + EDEF(ONE_MINUS_DST_ALPHA), + EDEF(SRC_ALPHA_SATURATE), + EDEF(CONSTANT_COLOR), + EDEF(ONE_MINUS_CONSTANT_COLOR), + EDEF(CONSTANT_ALPHA), + EDEF(ONE_MINUS_CONSTANT_ALPHA), + EDEF(FEEDBACK), + EDEF(RENDER), + EDEF(SELECT), + EDEF(2D), + EDEF(3D), + EDEF(3D_COLOR), + EDEF(3D_COLOR_TEXTURE), + EDEF(4D_COLOR_TEXTURE), + EDEF(POINT_TOKEN), + EDEF(LINE_TOKEN), + EDEF(LINE_RESET_TOKEN), + EDEF(POLYGON_TOKEN), + EDEF(BITMAP_TOKEN), + EDEF(DRAW_PIXEL_TOKEN), + EDEF(COPY_PIXEL_TOKEN), + EDEF(PASS_THROUGH_TOKEN), + EDEF(FEEDBACK_BUFFER_POINTER), + EDEF(FEEDBACK_BUFFER_SIZE), + EDEF(FEEDBACK_BUFFER_TYPE), + EDEF(SELECTION_BUFFER_POINTER), + EDEF(SELECTION_BUFFER_SIZE), + EDEF(FOG), + EDEF(FOG_MODE), + EDEF(FOG_DENSITY), + EDEF(FOG_COLOR), + EDEF(FOG_INDEX), + EDEF(FOG_START), + EDEF(FOG_END), + EDEF(LINEAR), + EDEF(EXP), + EDEF(EXP2), + EDEF(LOGIC_OP), + EDEF(INDEX_LOGIC_OP), + EDEF(COLOR_LOGIC_OP), + EDEF(LOGIC_OP_MODE), + EDEF(CLEAR), + EDEF(SET), + EDEF(COPY), + EDEF(COPY_INVERTED), + EDEF(NOOP), + EDEF(INVERT), + EDEF(AND), + EDEF(NAND), + EDEF(OR), + EDEF(NOR), + EDEF(XOR), + EDEF(EQUIV), + EDEF(AND_REVERSE), + EDEF(AND_INVERTED), + EDEF(OR_REVERSE), + EDEF(OR_INVERTED), + EDEF(STENCIL_TEST), + EDEF(STENCIL_WRITEMASK), + EDEF(STENCIL_BITS), + EDEF(STENCIL_FUNC), + EDEF(STENCIL_VALUE_MASK), + EDEF(STENCIL_REF), + EDEF(STENCIL_FAIL), + EDEF(STENCIL_PASS_DEPTH_PASS), + EDEF(STENCIL_PASS_DEPTH_FAIL), + EDEF(STENCIL_CLEAR_VALUE), + EDEF(STENCIL_INDEX), + EDEF(KEEP), + EDEF(REPLACE), + EDEF(INCR), + EDEF(DECR), + EDEF(NONE), + EDEF(LEFT), + EDEF(RIGHT), + EDEF(FRONT_LEFT), + EDEF(FRONT_RIGHT), + EDEF(BACK_LEFT), + EDEF(BACK_RIGHT), + EDEF(AUX0), + EDEF(AUX1), + EDEF(AUX2), + EDEF(AUX3), + EDEF(COLOR_INDEX), + EDEF(RED), + EDEF(GREEN), + EDEF(BLUE), + EDEF(ALPHA), + EDEF(LUMINANCE), + EDEF(LUMINANCE_ALPHA), + EDEF(ALPHA_BITS), + EDEF(RED_BITS), + EDEF(GREEN_BITS), + EDEF(BLUE_BITS), + EDEF(INDEX_BITS), + EDEF(SUBPIXEL_BITS), + EDEF(AUX_BUFFERS), + EDEF(READ_BUFFER), + EDEF(DRAW_BUFFER), + EDEF(DOUBLEBUFFER), + EDEF(STEREO), + EDEF(BITMAP), + EDEF(COLOR), + EDEF(DEPTH), + EDEF(STENCIL), + EDEF(DITHER), + EDEF(RGB), + EDEF(RGBA), + EDEF(MAX_LIST_NESTING), + EDEF(MAX_ATTRIB_STACK_DEPTH), + EDEF(MAX_MODELVIEW_STACK_DEPTH), + EDEF(MAX_NAME_STACK_DEPTH), + EDEF(MAX_PROJECTION_STACK_DEPTH), + EDEF(MAX_TEXTURE_STACK_DEPTH), + EDEF(MAX_EVAL_ORDER), + EDEF(MAX_LIGHTS), + EDEF(MAX_CLIP_PLANES), + EDEF(MAX_TEXTURE_SIZE), + EDEF(MAX_PIXEL_MAP_TABLE), + EDEF(MAX_VIEWPORT_DIMS), + EDEF(MAX_CLIENT_ATTRIB_STACK_DEPTH), + EDEF(ATTRIB_STACK_DEPTH), + EDEF(CLIENT_ATTRIB_STACK_DEPTH), + EDEF(COLOR_CLEAR_VALUE), + EDEF(COLOR_WRITEMASK), + EDEF(CURRENT_INDEX), + EDEF(CURRENT_COLOR), + EDEF(CURRENT_NORMAL), + EDEF(CURRENT_RASTER_COLOR), + EDEF(CURRENT_RASTER_DISTANCE), + EDEF(CURRENT_RASTER_INDEX), + EDEF(CURRENT_RASTER_POSITION), + EDEF(CURRENT_RASTER_TEXTURE_COORDS), + EDEF(CURRENT_RASTER_POSITION_VALID), + EDEF(CURRENT_TEXTURE_COORDS), + EDEF(INDEX_CLEAR_VALUE), + EDEF(INDEX_MODE), + EDEF(INDEX_WRITEMASK), + EDEF(MODELVIEW_MATRIX), + EDEF(MODELVIEW_STACK_DEPTH), + EDEF(NAME_STACK_DEPTH), + EDEF(PROJECTION_MATRIX), + EDEF(PROJECTION_STACK_DEPTH), + EDEF(RENDER_MODE), + EDEF(RGBA_MODE), + EDEF(TEXTURE_MATRIX), + EDEF(TEXTURE_STACK_DEPTH), + EDEF(VIEWPORT), + EDEF(AUTO_NORMAL), + EDEF(MAP1_COLOR_4), + EDEF(MAP1_GRID_DOMAIN), + EDEF(MAP1_GRID_SEGMENTS), + EDEF(MAP1_INDEX), + EDEF(MAP1_NORMAL), + EDEF(MAP1_TEXTURE_COORD_1), + EDEF(MAP1_TEXTURE_COORD_2), + EDEF(MAP1_TEXTURE_COORD_3), + EDEF(MAP1_TEXTURE_COORD_4), + EDEF(MAP1_VERTEX_3), + EDEF(MAP1_VERTEX_4), + EDEF(MAP2_COLOR_4), + EDEF(MAP2_GRID_DOMAIN), + EDEF(MAP2_GRID_SEGMENTS), + EDEF(MAP2_INDEX), + EDEF(MAP2_NORMAL), + EDEF(MAP2_TEXTURE_COORD_1), + EDEF(MAP2_TEXTURE_COORD_2), + EDEF(MAP2_TEXTURE_COORD_3), + EDEF(MAP2_TEXTURE_COORD_4), + EDEF(MAP2_VERTEX_3), + EDEF(MAP2_VERTEX_4), + EDEF(COEFF), + EDEF(DOMAIN), + EDEF(ORDER), + EDEF(FOG_HINT), + EDEF(LINE_SMOOTH_HINT), + EDEF(PERSPECTIVE_CORRECTION_HINT), + EDEF(POINT_SMOOTH_HINT), + EDEF(POLYGON_SMOOTH_HINT), + EDEF(DONT_CARE), + EDEF(FASTEST), + EDEF(NICEST), + EDEF(SCISSOR_TEST), + EDEF(SCISSOR_BOX), + EDEF(MAP_COLOR), + EDEF(MAP_STENCIL), + EDEF(INDEX_SHIFT), + EDEF(INDEX_OFFSET), + EDEF(RED_SCALE), + EDEF(RED_BIAS), + EDEF(GREEN_SCALE), + EDEF(GREEN_BIAS), + EDEF(BLUE_SCALE), + EDEF(BLUE_BIAS), + EDEF(ALPHA_SCALE), + EDEF(ALPHA_BIAS), + EDEF(DEPTH_SCALE), + EDEF(DEPTH_BIAS), + EDEF(PIXEL_MAP_S_TO_S_SIZE), + EDEF(PIXEL_MAP_I_TO_I_SIZE), + EDEF(PIXEL_MAP_I_TO_R_SIZE), + EDEF(PIXEL_MAP_I_TO_G_SIZE), + EDEF(PIXEL_MAP_I_TO_B_SIZE), + EDEF(PIXEL_MAP_I_TO_A_SIZE), + EDEF(PIXEL_MAP_R_TO_R_SIZE), + EDEF(PIXEL_MAP_G_TO_G_SIZE), + EDEF(PIXEL_MAP_B_TO_B_SIZE), + EDEF(PIXEL_MAP_A_TO_A_SIZE), + EDEF(PIXEL_MAP_S_TO_S), + EDEF(PIXEL_MAP_I_TO_I), + EDEF(PIXEL_MAP_I_TO_R), + EDEF(PIXEL_MAP_I_TO_G), + EDEF(PIXEL_MAP_I_TO_B), + EDEF(PIXEL_MAP_I_TO_A), + EDEF(PIXEL_MAP_R_TO_R), + EDEF(PIXEL_MAP_G_TO_G), + EDEF(PIXEL_MAP_B_TO_B), + EDEF(PIXEL_MAP_A_TO_A), + EDEF(PACK_ALIGNMENT), + EDEF(PACK_LSB_FIRST), + EDEF(PACK_ROW_LENGTH), + EDEF(PACK_SKIP_PIXELS), + EDEF(PACK_SKIP_ROWS), + EDEF(PACK_SWAP_BYTES), + EDEF(UNPACK_ALIGNMENT), + EDEF(UNPACK_LSB_FIRST), + EDEF(UNPACK_ROW_LENGTH), + EDEF(UNPACK_SKIP_PIXELS), + EDEF(UNPACK_SKIP_ROWS), + EDEF(UNPACK_SWAP_BYTES), + EDEF(ZOOM_X), + EDEF(ZOOM_Y), + EDEF(TEXTURE_ENV), + EDEF(TEXTURE_ENV_MODE), + EDEF(TEXTURE_1D), + EDEF(TEXTURE_2D), + EDEF(TEXTURE_WRAP_S), + EDEF(TEXTURE_WRAP_T), + EDEF(TEXTURE_MAG_FILTER), + EDEF(TEXTURE_MIN_FILTER), + EDEF(TEXTURE_ENV_COLOR), + EDEF(TEXTURE_GEN_S), + EDEF(TEXTURE_GEN_T), + EDEF(TEXTURE_GEN_MODE), + EDEF(TEXTURE_BORDER_COLOR), + EDEF(TEXTURE_WIDTH), + EDEF(TEXTURE_HEIGHT), + EDEF(TEXTURE_BORDER), + EDEF(TEXTURE_COMPONENTS), + EDEF(TEXTURE_RED_SIZE), + EDEF(TEXTURE_GREEN_SIZE), + EDEF(TEXTURE_BLUE_SIZE), + EDEF(TEXTURE_ALPHA_SIZE), + EDEF(TEXTURE_LUMINANCE_SIZE), + EDEF(TEXTURE_INTENSITY_SIZE), + EDEF(NEAREST_MIPMAP_NEAREST), + EDEF(NEAREST_MIPMAP_LINEAR), + EDEF(LINEAR_MIPMAP_NEAREST), + EDEF(LINEAR_MIPMAP_LINEAR), + EDEF(OBJECT_LINEAR), + EDEF(OBJECT_PLANE), + EDEF(EYE_LINEAR), + EDEF(EYE_PLANE), + EDEF(SPHERE_MAP), + EDEF(DECAL), + EDEF(MODULATE), + EDEF(NEAREST), + EDEF(REPEAT), + EDEF(CLAMP), + EDEF(S), + EDEF(T), + EDEF(R), + EDEF(Q), + EDEF(TEXTURE_GEN_R), + EDEF(TEXTURE_GEN_Q), + EDEF(PROXY_TEXTURE_1D), + EDEF(PROXY_TEXTURE_2D), + EDEF(TEXTURE_PRIORITY), + EDEF(TEXTURE_RESIDENT), + EDEF(TEXTURE_BINDING_1D), + EDEF(TEXTURE_BINDING_2D), + EDEF(TEXTURE_INTERNAL_FORMAT), + EDEF(PACK_SKIP_IMAGES), + EDEF(PACK_IMAGE_HEIGHT), + EDEF(UNPACK_SKIP_IMAGES), + EDEF(UNPACK_IMAGE_HEIGHT), + EDEF(TEXTURE_3D), + EDEF(PROXY_TEXTURE_3D), + EDEF(TEXTURE_DEPTH), + EDEF(TEXTURE_WRAP_R), + EDEF(MAX_3D_TEXTURE_SIZE), + EDEF(TEXTURE_BINDING_3D), + EDEF(ALPHA4), + EDEF(ALPHA8), + EDEF(ALPHA12), + EDEF(ALPHA16), + EDEF(LUMINANCE4), + EDEF(LUMINANCE8), + EDEF(LUMINANCE12), + EDEF(LUMINANCE16), + EDEF(LUMINANCE4_ALPHA4), + EDEF(LUMINANCE6_ALPHA2), + EDEF(LUMINANCE8_ALPHA8), + EDEF(LUMINANCE12_ALPHA4), + EDEF(LUMINANCE12_ALPHA12), + EDEF(LUMINANCE16_ALPHA16), + EDEF(INTENSITY), + EDEF(INTENSITY4), + EDEF(INTENSITY8), + EDEF(INTENSITY12), + EDEF(INTENSITY16), + EDEF(R3_G3_B2), + EDEF(RGB4), + EDEF(RGB5), + EDEF(RGB8), + EDEF(RGB10), + EDEF(RGB12), + EDEF(RGB16), + EDEF(RGBA2), + EDEF(RGBA4), + EDEF(RGB5_A1), + EDEF(RGBA8), + EDEF(RGB10_A2), + EDEF(RGBA12), + EDEF(RGBA16), + EDEF(VENDOR), + EDEF(RENDERER), + EDEF(VERSION), + EDEF(EXTENSIONS), + EDEF(INVALID_VALUE), + EDEF(INVALID_ENUM), + EDEF(INVALID_OPERATION), + EDEF(STACK_OVERFLOW), + EDEF(STACK_UNDERFLOW), + EDEF(OUT_OF_MEMORY), + + /* extensions */ + EDEF(CONSTANT_COLOR_EXT), + EDEF(ONE_MINUS_CONSTANT_COLOR_EXT), + EDEF(CONSTANT_ALPHA_EXT), + EDEF(ONE_MINUS_CONSTANT_ALPHA_EXT), + EDEF(BLEND_EQUATION_EXT), + EDEF(MIN_EXT), + EDEF(MAX_EXT), + EDEF(FUNC_ADD_EXT), + EDEF(FUNC_SUBTRACT_EXT), + EDEF(FUNC_REVERSE_SUBTRACT_EXT), + EDEF(BLEND_COLOR_EXT), + EDEF(POLYGON_OFFSET_EXT), + EDEF(POLYGON_OFFSET_FACTOR_EXT), + EDEF(POLYGON_OFFSET_BIAS_EXT), + EDEF(VERTEX_ARRAY_EXT), + EDEF(NORMAL_ARRAY_EXT), + EDEF(COLOR_ARRAY_EXT), + EDEF(INDEX_ARRAY_EXT), + EDEF(TEXTURE_COORD_ARRAY_EXT), + EDEF(EDGE_FLAG_ARRAY_EXT), + EDEF(VERTEX_ARRAY_SIZE_EXT), + EDEF(VERTEX_ARRAY_TYPE_EXT), + EDEF(VERTEX_ARRAY_STRIDE_EXT), + EDEF(VERTEX_ARRAY_COUNT_EXT), + EDEF(NORMAL_ARRAY_TYPE_EXT), + EDEF(NORMAL_ARRAY_STRIDE_EXT), + EDEF(NORMAL_ARRAY_COUNT_EXT), + EDEF(COLOR_ARRAY_SIZE_EXT), + EDEF(COLOR_ARRAY_TYPE_EXT), + EDEF(COLOR_ARRAY_STRIDE_EXT), + EDEF(COLOR_ARRAY_COUNT_EXT), + EDEF(INDEX_ARRAY_TYPE_EXT), + EDEF(INDEX_ARRAY_STRIDE_EXT), + EDEF(INDEX_ARRAY_COUNT_EXT), + EDEF(TEXTURE_COORD_ARRAY_SIZE_EXT), + EDEF(TEXTURE_COORD_ARRAY_TYPE_EXT), + EDEF(TEXTURE_COORD_ARRAY_STRIDE_EXT), + EDEF(TEXTURE_COORD_ARRAY_COUNT_EXT), + EDEF(EDGE_FLAG_ARRAY_STRIDE_EXT), + EDEF(EDGE_FLAG_ARRAY_COUNT_EXT), + EDEF(VERTEX_ARRAY_POINTER_EXT), + EDEF(NORMAL_ARRAY_POINTER_EXT), + EDEF(COLOR_ARRAY_POINTER_EXT), + EDEF(INDEX_ARRAY_POINTER_EXT), + EDEF(TEXTURE_COORD_ARRAY_POINTER_EXT), + EDEF(EDGE_FLAG_ARRAY_POINTER_EXT), + EDEF(TEXTURE_PRIORITY_EXT), + EDEF(TEXTURE_RESIDENT_EXT), + EDEF(TEXTURE_1D_BINDING_EXT), + EDEF(TEXTURE_2D_BINDING_EXT), + EDEF(PACK_SKIP_IMAGES_EXT), + EDEF(PACK_IMAGE_HEIGHT_EXT), + EDEF(UNPACK_SKIP_IMAGES_EXT), + EDEF(UNPACK_IMAGE_HEIGHT_EXT), + EDEF(TEXTURE_3D_EXT), + EDEF(PROXY_TEXTURE_3D_EXT), + EDEF(TEXTURE_DEPTH_EXT), + EDEF(TEXTURE_WRAP_R_EXT), + EDEF(MAX_3D_TEXTURE_SIZE_EXT), + EDEF(TEXTURE_3D_BINDING_EXT), + EDEF(TABLE_TOO_LARGE_EXT), + EDEF(COLOR_TABLE_FORMAT_EXT), + EDEF(COLOR_TABLE_WIDTH_EXT), + EDEF(COLOR_TABLE_RED_SIZE_EXT), + EDEF(COLOR_TABLE_GREEN_SIZE_EXT), + EDEF(COLOR_TABLE_BLUE_SIZE_EXT), + EDEF(COLOR_TABLE_ALPHA_SIZE_EXT), + EDEF(COLOR_TABLE_LUMINANCE_SIZE_EXT), + EDEF(COLOR_TABLE_INTENSITY_SIZE_EXT), + EDEF(TEXTURE_INDEX_SIZE_EXT), + EDEF(COLOR_INDEX1_EXT), + EDEF(COLOR_INDEX2_EXT), + EDEF(COLOR_INDEX4_EXT), + EDEF(COLOR_INDEX8_EXT), + EDEF(COLOR_INDEX12_EXT), + EDEF(COLOR_INDEX16_EXT), + EDEF(SHARED_TEXTURE_PALETTE_EXT), + EDEF(POINT_SIZE_MIN_EXT), + EDEF(POINT_SIZE_MAX_EXT), + EDEF(POINT_FADE_THRESHOLD_SIZE_EXT), + EDEF(DISTANCE_ATTENUATION_EXT), + EDEF(RESCALE_NORMAL_EXT), + EDEF(ABGR_EXT), + EDEF(SELECTED_TEXTURE_SGIS), + EDEF(SELECTED_TEXTURE_COORD_SET_SGIS), + EDEF(MAX_TEXTURES_SGIS), + EDEF(TEXTURE0_SGIS), + EDEF(TEXTURE1_SGIS), + EDEF(TEXTURE2_SGIS), + EDEF(TEXTURE3_SGIS), + EDEF(TEXTURE_COORD_SET_SOURCE_SGIS), + EDEF(SELECTED_TEXTURE_EXT), + EDEF(SELECTED_TEXTURE_COORD_SET_EXT), + EDEF(SELECTED_TEXTURE_TRANSFORM_EXT), + EDEF(MAX_TEXTURES_EXT), + EDEF(MAX_TEXTURE_COORD_SETS_EXT), + EDEF(TEXTURE_ENV_COORD_SET_EXT), + EDEF(TEXTURE0_EXT), + EDEF(TEXTURE1_EXT), + EDEF(TEXTURE2_EXT), + EDEF(TEXTURE3_EXT), + EDEF(CLAMP_TO_EDGE_SGIS), + EDEF(RESCALE_NORMAL), + EDEF(CLAMP_TO_EDGE), + EDEF(MAX_ELEMENTS_VERTICES), + EDEF(MAX_ELEMENTS_INDICES), + EDEF(BGR), + EDEF(BGRA), + EDEF(UNSIGNED_BYTE_3_3_2), + EDEF(UNSIGNED_BYTE_2_3_3_REV), + EDEF(UNSIGNED_SHORT_5_6_5), + EDEF(UNSIGNED_SHORT_5_6_5_REV), + EDEF(UNSIGNED_SHORT_4_4_4_4), + EDEF(UNSIGNED_SHORT_4_4_4_4_REV), + EDEF(UNSIGNED_SHORT_5_5_5_1), + EDEF(UNSIGNED_SHORT_1_5_5_5_REV), + EDEF(UNSIGNED_INT_8_8_8_8), + EDEF(UNSIGNED_INT_8_8_8_8_REV), + EDEF(UNSIGNED_INT_10_10_10_2), + EDEF(UNSIGNED_INT_2_10_10_10_REV), + EDEF(LIGHT_MODEL_COLOR_CONTROL), + EDEF(SINGLE_COLOR), + EDEF(SEPARATE_SPECULAR_COLOR), + EDEF(TEXTURE_MIN_LOD), + EDEF(TEXTURE_MAX_LOD), + EDEF(TEXTURE_BASE_LEVEL), + EDEF(TEXTURE_MAX_LEVEL) +}; + +#undef EDEF + +#define N_ENUMS (sizeof(enums) / sizeof(ENUM)) + +/***************************************************************************/ + +static void print_enum_name( FILE* OUT, GLenum e ) +{ + int i, found= 0; + for( i= 0; i < N_ENUMS; ++i ) + { + if( enums[i].e == e ) + { + if( found ) + fprintf( OUT, "/" ); + found= 1; + fprintf( OUT, "%s", enums[i].name ); + } + } + if( ! found ) + fprintf( OUT, "*UNKNOWN* [%04x]", (int)e ); + fprintf( OUT, "\n" ); +} + +#define BOOL_STRING(b) (b ? "true" : "false") + +#define VAR_ENUM(VAR) \ + { \ + GLint e= 0; \ + glGetIntegerv(GL_##VAR,&e); \ + fprintf( OUT, "%s: ", #VAR ); \ + print_enum_name( OUT, (GLenum) e ); \ + } + +#define VAR_FLOAT4(VAR) \ + { \ + GLfloat f[4]; \ + f[0]= f[1]= f[2]= f[3]= 0.0; \ + glGetFloatv(GL_##VAR,f); \ + fprintf( OUT, "%s: [%f %f %f %f]\n", \ + #VAR, f[0], f[1], f[2], f[3] ); \ + } + +#define VAR_MAT_FLOAT4(VAR) \ + { \ + GLfloat f[4]; \ + f[0]= f[1]= f[2]= f[3]= 0.0; \ + glGetMaterialfv(GL_FRONT,GL_##VAR,f); \ + fprintf( OUT, "FRONT_%s: [%f %f %f %f]\n", \ + #VAR, f[0], f[1], f[2], f[3] ); \ + glGetMaterialfv(GL_BACK,GL_##VAR,f); \ + fprintf( OUT, " BACK_%s: [%f %f %f %f]\n", \ + #VAR, f[0], f[1], f[2], f[3] ); \ + } + +#define VAR_LIGHT_FLOAT4(LIGHT,VAR) \ + { \ + GLfloat f[4]; \ + f[0]= f[1]= f[2]= f[3]= 0.0; \ + glGetLightfv(GL_LIGHT0+LIGHT,GL_##VAR,f); \ + fprintf( OUT, "LIGHT%d.%s: [%f %f %f %f]\n", \ + LIGHT, #VAR, f[0], f[1], f[2], f[3] ); \ + } + +#define VAR_LIGHT_FLOAT3(LIGHT,VAR) \ + { \ + GLfloat f[3]; \ + f[0]= f[1]= f[2]= 0.0; \ + glGetLightfv(GL_LIGHT0+LIGHT,GL_##VAR,f); \ + fprintf( OUT, "LIGHT%d.%s: [%f %f %f]\n", \ + LIGHT, #VAR, f[0], f[1], f[2] ); \ + } + +#define VAR_FLOAT3(VAR) \ + { \ + GLfloat f[3]; \ + f[0]= f[1]= f[2]= 0.0; \ + glGetFloatv(GL_##VAR,f) ; \ + fprintf( OUT, "%s: [%f %f %f]\n", \ + #VAR, f[0], f[1], f[2] ); \ + } +#define VAR_FLOAT2(VAR) \ + { \ + GLfloat f[2]; \ + f[0]= f[1]= 0.0; \ + glGetFloatv(GL_##VAR,f); \ + fprintf( OUT, "%s: [%f %f]\n", \ + #VAR, f[0], f[1] ); \ + } + +#define VAR_COLOR(VAR) VAR_FLOAT4(VAR) +#define VAR_TEXCOORD(VAR) VAR_FLOAT4(VAR) +#define VAR_NORMAL(VAR) VAR_FLOAT3(VAR) + +#define VAR_MAT_COLOR(VAR) VAR_MAT_FLOAT4(VAR) +#define VAR_LIGHT_COLOR(LIGHT,VAR) VAR_LIGHT_FLOAT4(LIGHT,VAR) + +#define VAR_FLOAT(VAR) \ + { \ + GLfloat f= 0.0; \ + glGetFloatv(GL_##VAR,&f); \ + fprintf( OUT, "%s: %f\n", #VAR, f ); \ + } + +#define VAR_MAT_FLOAT(VAR) \ + { \ + GLfloat f= 0.0; \ + glGetMaterialfv(GL_FRONT,GL_##VAR,&f); \ + fprintf( OUT, "FRONT_%s: %f\n", #VAR, f ); \ + glGetMaterialfv(GL_BACK,GL_##VAR,&f); \ + fprintf( OUT, " BACK_%s: %f\n", #VAR, f ); \ + } + +#define VAR_LIGHT_FLOAT(LIGHT,VAR) \ + { \ + GLfloat f= 0.0; \ + glGetLightfv(GL_LIGHT0+LIGHT,GL_##VAR,&f); \ + fprintf( OUT, "LIGHT%d.%s: %f\n", \ + LIGHT, #VAR, f ); \ + } + +#define VAR_INT(VAR) \ + { \ + GLint i= 0; \ + glGetIntegerv(GL_##VAR,&i); \ + fprintf( OUT, "%s: %d\n", #VAR, (int)i ); \ + } +#define VAR_INTEGER(VAR) VAR_INT(VAR) +#define VAR_INDEX(VAR) VAR_INT(VAR) +#define VAR_HEXINT(VAR) \ + { \ + GLint i= 0; \ + glGetIntegerv(GL_##VAR,&i); \ + fprintf( OUT, "%s: 0x%04x\n", #VAR, (int)i ); \ + } +#define VAR_INT4(VAR) \ + { \ + GLint i[4]; \ + i[0]= i[1]= i[2]= i[3]= 0; \ + glGetIntegerv(GL_##VAR,i); \ + fprintf( OUT, "%s: [%d %d %d %d]\n", \ + #VAR, (int)i[0], (int)i[1], (int)i[2], (int)i[3] ); \ + } +#define VAR_BOOL(VAR) \ + { \ + GLboolean b= 0; \ + glGetBooleanv(GL_##VAR,&b); \ + fprintf( OUT, "%s: %s\n", #VAR, BOOL_STRING(b) ); \ + } +#define VAR_BOOL4(VAR) \ + { \ + GLboolean b[4]; \ + b[0]= b[1]= b[2]= b[3]= 0; \ + glGetBooleanv(GL_##VAR,b); \ + fprintf( OUT, "%s: [%s %s %s %s]\n", \ + #VAR, \ + BOOL_STRING(b[0]), \ + BOOL_STRING(b[1]), \ + BOOL_STRING(b[2]), \ + BOOL_STRING(b[3]) ); \ + } +#define VAR_PTR(VAR) \ + { \ + GLvoid* p= 0; \ + glGetPointerv(GL_##VAR,&p); \ + fprintf( OUT, "%s: %p\n", #VAR, p ); \ + } +#define VAR_MATRIX(VAR) \ + { \ + GLfloat m[16]; \ + int i; \ + for( i= 0; i < 16; ++i ) m[i]= 0.0; \ + glGetFloatv(GL_##VAR,m); \ + fprintf( OUT, \ + "%s:\n\t[%+.6f %+.6f %+.6f %+.6f]\n\t[%+.6f %+.6f %+.6f +%+.6f]\n\t[%+.6f %+.6f %+.6f %+.6f]\n\t[%+.6f %+.6f %+.6f %+.6f]\n", \ + #VAR, \ + m[0+0*4], m[0+1*4], m[0+2*4], m[0+3*4], \ + m[1+0*4], m[1+1*4], m[1+2*4], m[1+3*4], \ + m[2+0*4], m[2+1*4], m[2+2*4], m[2+3*4], \ + m[3+0*4], m[3+1*4], m[3+2*4], m[3+3*4] ); \ + } + +/***************************************************************************/ + +/* +#define OUT stderr +*/ +void dump_opengl_state( FILE* OUT ) +{ + int i; + GLint n_lights= 0; + + glGetIntegerv( GL_MAX_LIGHTS, &n_lights ); + + VAR_COLOR(CURRENT_COLOR) + VAR_INDEX(CURRENT_INDEX) + VAR_TEXCOORD(CURRENT_TEXTURE_COORDS) + VAR_NORMAL(CURRENT_NORMAL) + VAR_FLOAT4(CURRENT_RASTER_POSITION) + VAR_FLOAT(CURRENT_RASTER_DISTANCE) + VAR_COLOR(CURRENT_RASTER_COLOR) + VAR_INDEX(CURRENT_RASTER_INDEX) + VAR_TEXCOORD(CURRENT_RASTER_TEXTURE_COORDS) + VAR_BOOL(CURRENT_RASTER_POSITION_VALID) + VAR_BOOL(EDGE_FLAG) + + VAR_BOOL (VERTEX_ARRAY) + VAR_INTEGER(VERTEX_ARRAY_SIZE) + VAR_ENUM (VERTEX_ARRAY_TYPE) + VAR_INTEGER(VERTEX_ARRAY_STRIDE) + VAR_PTR (VERTEX_ARRAY_POINTER) + + VAR_BOOL (NORMAL_ARRAY) + VAR_ENUM (NORMAL_ARRAY_TYPE) + VAR_INTEGER(NORMAL_ARRAY_STRIDE) + VAR_PTR (NORMAL_ARRAY_POINTER) + + VAR_BOOL (COLOR_ARRAY) + VAR_INTEGER(COLOR_ARRAY_SIZE) + VAR_ENUM (COLOR_ARRAY_TYPE) + VAR_INTEGER(COLOR_ARRAY_STRIDE) + VAR_PTR (COLOR_ARRAY_POINTER) + + VAR_BOOL (INDEX_ARRAY) + VAR_ENUM (INDEX_ARRAY_TYPE) + VAR_INTEGER(INDEX_ARRAY_STRIDE) + VAR_PTR (INDEX_ARRAY_POINTER) + + VAR_BOOL (TEXTURE_COORD_ARRAY) + VAR_INTEGER(TEXTURE_COORD_ARRAY_SIZE) + VAR_ENUM (TEXTURE_COORD_ARRAY_TYPE) + VAR_INTEGER(TEXTURE_COORD_ARRAY_STRIDE) + VAR_PTR (TEXTURE_COORD_ARRAY_POINTER) + + VAR_BOOL (EDGE_FLAG_ARRAY) + VAR_INTEGER(EDGE_FLAG_ARRAY_STRIDE) + VAR_PTR (EDGE_FLAG_ARRAY_POINTER) + + VAR_MATRIX(MODELVIEW_MATRIX) + VAR_MATRIX(PROJECTION_MATRIX) + VAR_MATRIX(TEXTURE_MATRIX) + VAR_INT4(VIEWPORT) + VAR_FLOAT2(DEPTH_RANGE) + VAR_INT(MODELVIEW_STACK_DEPTH) + VAR_INT(PROJECTION_STACK_DEPTH) + VAR_INT(TEXTURE_STACK_DEPTH) + VAR_ENUM(MATRIX_MODE) + VAR_BOOL(NORMALIZE) + VAR_BOOL(RESCALE_NORMAL_EXT) + VAR_BOOL(CLIP_PLANE0) + VAR_BOOL(CLIP_PLANE1) + VAR_BOOL(CLIP_PLANE2) + VAR_BOOL(CLIP_PLANE3) + VAR_BOOL(CLIP_PLANE4) + VAR_BOOL(CLIP_PLANE5) + /* + glGetClipPlane() */ + + VAR_COLOR(FOG_COLOR) + VAR_INDEX(FOG_INDEX) + VAR_FLOAT(FOG_DENSITY) + VAR_FLOAT(FOG_START) + VAR_FLOAT(FOG_END) + VAR_ENUM(FOG_MODE) + VAR_BOOL(FOG) + VAR_ENUM(SHADE_MODEL) + + VAR_BOOL(LIGHTING) + VAR_BOOL(COLOR_MATERIAL) + VAR_ENUM(COLOR_MATERIAL_PARAMETER) + VAR_ENUM(COLOR_MATERIAL_FACE) + + VAR_MAT_COLOR(AMBIENT) + VAR_MAT_COLOR(DIFFUSE) + VAR_MAT_COLOR(SPECULAR) + VAR_MAT_COLOR(EMISSION) + VAR_MAT_FLOAT(SHININESS) + + VAR_COLOR(LIGHT_MODEL_AMBIENT) + VAR_BOOL(LIGHT_MODEL_LOCAL_VIEWER) + VAR_BOOL(LIGHT_MODEL_TWO_SIDE) +/* VAR_ENUM(LIGHT_MODEL_COLOR_CONTROL)*/ + + for( i= 0; i < n_lights; ++i ) + { + GLboolean b= 0; + + glGetBooleanv( GL_LIGHT0 + i, &b ); + fprintf( OUT, "LIGHT%d: %s\n", i, BOOL_STRING(b) ); + + if( ! b ) + continue; + + VAR_LIGHT_COLOR(i,AMBIENT) + VAR_LIGHT_COLOR(i,DIFFUSE) + VAR_LIGHT_COLOR(i,SPECULAR) + VAR_LIGHT_FLOAT4(i,POSITION) + VAR_LIGHT_FLOAT(i,CONSTANT_ATTENUATION) + VAR_LIGHT_FLOAT(i,LINEAR_ATTENUATION) + VAR_LIGHT_FLOAT(i,QUADRATIC_ATTENUATION) + VAR_LIGHT_FLOAT3(i,SPOT_DIRECTION) + VAR_LIGHT_FLOAT(i,SPOT_EXPONENT) + VAR_LIGHT_FLOAT(i,SPOT_CUTOFF) + /* COLOR_INDEXES */ + } + + VAR_FLOAT(POINT_SIZE) + VAR_BOOL(POINT_SMOOTH) + VAR_FLOAT(LINE_WIDTH) + VAR_BOOL(LINE_SMOOTH) + VAR_HEXINT(LINE_STIPPLE_PATTERN) + VAR_INT(LINE_STIPPLE_REPEAT) + VAR_BOOL(LINE_STIPPLE) + VAR_BOOL(CULL_FACE) + VAR_ENUM(CULL_FACE_MODE) + VAR_ENUM(FRONT_FACE) + VAR_BOOL(POLYGON_SMOOTH) + VAR_ENUM(POLYGON_MODE) + VAR_FLOAT(POLYGON_OFFSET_FACTOR) + VAR_FLOAT(POLYGON_OFFSET_UNITS) + VAR_BOOL(POLYGON_OFFSET_POINT) + VAR_BOOL(POLYGON_OFFSET_LINE) + VAR_BOOL(POLYGON_OFFSET_FILL) + /* GetPolygonStipple */ + VAR_BOOL(POLYGON_STIPPLE) + + VAR_BOOL(TEXTURE_1D) + VAR_BOOL(TEXTURE_2D) +/* VAR_BOOL(TEXTURE_3D)*/ + + VAR_INT(TEXTURE_BINDING_1D) + VAR_INT(TEXTURE_BINDING_2D) +/* VAR_INT(TEXTURE_BINDING_3D)*/ + + /* GetTexImage() */ + /* GetTexLevelParameter() */ + /* GetTexEnv() */ + + VAR_BOOL(TEXTURE_GEN_S) + VAR_BOOL(TEXTURE_GEN_T) + VAR_BOOL(TEXTURE_GEN_R) + VAR_BOOL(TEXTURE_GEN_Q) + + /* GetTexGen() */ + + VAR_BOOL(SCISSOR_TEST) + VAR_INT4(SCISSOR_BOX) + VAR_BOOL(ALPHA_TEST) + VAR_ENUM(ALPHA_TEST_FUNC) + VAR_FLOAT(ALPHA_TEST_REF) + VAR_BOOL(STENCIL_TEST) + VAR_ENUM(STENCIL_FUNC) + VAR_HEXINT(STENCIL_VALUE_MASK) + VAR_INT(STENCIL_REF) + VAR_ENUM(STENCIL_FAIL) + VAR_ENUM(STENCIL_PASS_DEPTH_FAIL) + VAR_ENUM(STENCIL_PASS_DEPTH_PASS) + VAR_BOOL(DEPTH_TEST) + VAR_ENUM(DEPTH_FUNC) + VAR_BOOL(BLEND) + VAR_ENUM(BLEND_SRC) + VAR_ENUM(BLEND_DST) + + VAR_BOOL(DITHER) + VAR_BOOL(LOGIC_OP) /* INDEX_LOGIC_OP */ + VAR_BOOL(COLOR_LOGIC_OP) + + VAR_ENUM(DRAW_BUFFER) + VAR_INT(INDEX_WRITEMASK) + VAR_BOOL4(COLOR_WRITEMASK) + VAR_BOOL(DEPTH_WRITEMASK) + VAR_HEXINT(STENCIL_WRITEMASK) + VAR_COLOR(COLOR_CLEAR_VALUE) + VAR_INDEX(INDEX_CLEAR_VALUE) + VAR_FLOAT(DEPTH_CLEAR_VALUE) + VAR_INT(STENCIL_CLEAR_VALUE) + VAR_FLOAT(ACCUM_CLEAR_VALUE) + + VAR_BOOL(UNPACK_SWAP_BYTES) + VAR_BOOL(UNPACK_LSB_FIRST) +#ifdef UNPACK_IMAGE_HEIGHT + VAR_INT(UNPACK_IMAGE_HEIGHT) +#endif +#ifdef UNPACK_SKIP_IMAGES + VAR_INT(UNPACK_SKIP_IMAGES) +#endif + VAR_INT(UNPACK_ROW_LENGTH) + VAR_INT(UNPACK_SKIP_ROWS) + VAR_INT(UNPACK_SKIP_PIXELS) + VAR_INT(UNPACK_ALIGNMENT) + + VAR_BOOL(PACK_SWAP_BYTES) + VAR_BOOL(PACK_LSB_FIRST) +#ifdef PACK_IMAGE_HEIGHT + VAR_INT(PACK_IMAGE_HEIGHT) +#endif +#ifdef PACK_SKIP_IMAGES + VAR_INT(PACK_SKIP_IMAGES) +#endif + VAR_INT(PACK_ROW_LENGTH) + VAR_INT(PACK_SKIP_ROWS) + VAR_INT(PACK_SKIP_PIXELS) + VAR_INT(PACK_ALIGNMENT) + + VAR_BOOL(MAP_COLOR) + VAR_BOOL(MAP_STENCIL) + VAR_INT(INDEX_SHIFT) + VAR_INT(INDEX_OFFSET) + VAR_FLOAT(RED_SCALE) + VAR_FLOAT(GREEN_SCALE) + VAR_FLOAT(BLUE_SCALE) + VAR_FLOAT(ALPHA_SCALE) + VAR_FLOAT(DEPTH_SCALE) + VAR_FLOAT(RED_BIAS) + VAR_FLOAT(GREEN_BIAS) + VAR_FLOAT(BLUE_BIAS) + VAR_FLOAT(ALPHA_BIAS) + VAR_FLOAT(DEPTH_BIAS) + + VAR_FLOAT(ZOOM_X) + VAR_FLOAT(ZOOM_Y) + + VAR_ENUM(READ_BUFFER) + + VAR_BOOL(AUTO_NORMAL) + + VAR_ENUM(PERSPECTIVE_CORRECTION_HINT) + VAR_ENUM(POINT_SMOOTH_HINT) + VAR_ENUM(LINE_SMOOTH_HINT) + VAR_ENUM(POLYGON_SMOOTH_HINT) + VAR_ENUM(FOG_HINT) + + VAR_INT(MAX_LIGHTS) + VAR_INT(MAX_CLIP_PLANES) + VAR_INT(MAX_MODELVIEW_STACK_DEPTH) + VAR_INT(MAX_PROJECTION_STACK_DEPTH) + VAR_INT(MAX_TEXTURE_STACK_DEPTH) + VAR_INT(SUBPIXEL_BITS) +#ifdef GL_MAX_3D_TEXTURE_SIZE + VAR_INT(MAX_3D_TEXTURE_SIZE) +#endif + VAR_INT(MAX_TEXTURE_SIZE) + VAR_INT(MAX_PIXEL_MAP_TABLE) + VAR_INT(MAX_NAME_STACK_DEPTH) + VAR_INT(MAX_LIST_NESTING) + VAR_INT(MAX_EVAL_ORDER) + VAR_INT(MAX_VIEWPORT_DIMS) + VAR_INT(MAX_ATTRIB_STACK_DEPTH) + VAR_INT(MAX_CLIENT_ATTRIB_STACK_DEPTH) + VAR_INT(AUX_BUFFERS) + VAR_BOOL(RGBA_MODE) + VAR_BOOL(INDEX_MODE) + VAR_BOOL(DOUBLEBUFFER) + VAR_BOOL(STEREO) +#ifdef GL_ALIASED_POINT_SIZE_RANGE + VAR_FLOAT2(ALIASED_POINT_SIZE_RANGE) +#endif +#ifdef GL_POINT_SIZE_RANGE + VAR_FLOAT2(POINT_SIZE_RANGE) /* SMOOTH_POINT_SIZE_RANGE */ +#endif + VAR_FLOAT(POINT_SIZE_GRANULARITY) /* SMOOTH_POINT_SIZE_GRANULARITY */ +#ifdef GL_ALIASED_LINE_WIDTH_RANGE + VAR_FLOAT2(ALIASED_LINE_WIDTH_RANGE) +#endif + VAR_FLOAT2(LINE_WIDTH_RANGE) /* SMOOTH_LINE_WIDTH_RANGE */ + VAR_FLOAT(LINE_WIDTH_GRANULARITY) /* SMOOTH_LINE_WIDTH_GRANULARITY */ + +#ifdef GL_MAX_ELEMENTS_INDICES + VAR_INT(MAX_ELEMENTS_INDICES) +#endif +#ifdef GL_MAX_ELEMENTS_VERTICES + VAR_INT(MAX_ELEMENTS_VERTICES) +#endif + VAR_INT(RED_BITS) + VAR_INT(GREEN_BITS) + VAR_INT(BLUE_BITS) + VAR_INT(ALPHA_BITS) + VAR_INT(INDEX_BITS) + VAR_INT(DEPTH_BITS) + VAR_INT(STENCIL_BITS) + VAR_INT(ACCUM_RED_BITS) + VAR_INT(ACCUM_GREEN_BITS) + VAR_INT(ACCUM_BLUE_BITS) + VAR_INT(ACCUM_ALPHA_BITS) + + VAR_INT(LIST_BASE) + VAR_INT(LIST_INDEX) + VAR_ENUM(LIST_MODE) + VAR_INT(ATTRIB_STACK_DEPTH) + VAR_INT(CLIENT_ATTRIB_STACK_DEPTH) + VAR_INT(NAME_STACK_DEPTH) + VAR_ENUM(RENDER_MODE) + VAR_PTR(SELECTION_BUFFER_POINTER) + VAR_INT(SELECTION_BUFFER_SIZE) + VAR_PTR(FEEDBACK_BUFFER_POINTER) + VAR_INT(FEEDBACK_BUFFER_SIZE) + VAR_ENUM(FEEDBACK_BUFFER_TYPE) + + /* glGetError() */ +} + +/***************************************************************************/ + +/*#define TEST*/ +#ifdef TEST + +#include + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowPosition(0, 0); + glutInitWindowSize(400, 300); + glutInitDisplayMode(GLUT_RGB); + glutCreateWindow(argv[0]); + dump_opengl_state(stdout); + return 0; +} + +#endif + diff --git a/mesalib/progs/util/errcheck.c b/mesalib/progs/util/errcheck.c new file mode 100644 index 000000000..fe9c2973c --- /dev/null +++ b/mesalib/progs/util/errcheck.c @@ -0,0 +1,27 @@ +/* errcheck.c */ + + +/* + * Call this function in your rendering loop to check for GL errors + * during development. Remove from release code. + * + * Written by Brian Paul and in the public domain. + */ + + +#include +#include +#incldue + + + +GLboolean CheckError( const char *message ) +{ + GLenum error = glGetError(); + if (error) { + char *err = (char *) gluErrorString( error ); + fprintf( stderr, "GL Error: %s at %s\n", err, message ); + return GL_TRUE; + } + return GL_FALSE; +} diff --git a/mesalib/progs/util/extfuncs.h b/mesalib/progs/util/extfuncs.h new file mode 100644 index 000000000..2bb57030a --- /dev/null +++ b/mesalib/progs/util/extfuncs.h @@ -0,0 +1,277 @@ +/** + * Utility for getting OpenGL extension function pointers + * Meant to be #included. + */ + +/* OpenGL 2.0 */ +static PFNGLATTACHSHADERPROC glAttachShader_func = NULL; +static PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation_func = NULL; +static PFNGLCOMPILESHADERPROC glCompileShader_func = NULL; +static PFNGLCREATEPROGRAMPROC glCreateProgram_func = NULL; +static PFNGLCREATESHADERPROC glCreateShader_func = NULL; +static PFNGLDELETEPROGRAMPROC glDeleteProgram_func = NULL; +static PFNGLDELETESHADERPROC glDeleteShader_func = NULL; +static PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib_func = NULL; +static PFNGLGETACTIVEUNIFORMPROC glGetActiveUniform_func = NULL; +static PFNGLGETATTACHEDSHADERSPROC glGetAttachedShaders_func = NULL; +static PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation_func = NULL; +static PFNGLGETPROGRAMINFOLOGPROC glGetProgramInfoLog_func = NULL; +static PFNGLGETSHADERINFOLOGPROC glGetShaderInfoLog_func = NULL; +static PFNGLGETSHADERIVPROC glGetShaderiv_func = NULL; +static PFNGLGETPROGRAMIVPROC glGetProgramiv_func = NULL; +static PFNGLGETSHADERSOURCEPROC glGetShaderSource_func = NULL; +static PFNGLGETUNIFORMFVPROC glGetUniformfv_func = NULL; +static PFNGLGETUNIFORMLOCATIONPROC glGetUniformLocation_func = NULL; +static PFNGLISPROGRAMPROC glIsProgram_func = NULL; +static PFNGLISSHADERPROC glIsShader_func = NULL; +static PFNGLLINKPROGRAMPROC glLinkProgram_func = NULL; +static PFNGLSHADERSOURCEPROC glShaderSource_func = NULL; +static PFNGLUNIFORM1IPROC glUniform1i_func = NULL; +static PFNGLUNIFORM2IPROC glUniform2i_func = NULL; +static PFNGLUNIFORM3IPROC glUniform3i_func = NULL; +static PFNGLUNIFORM4IPROC glUniform4i_func = NULL; +static PFNGLUNIFORM1FPROC glUniform1f_func = NULL; +static PFNGLUNIFORM2FPROC glUniform2f_func = NULL; +static PFNGLUNIFORM3FPROC glUniform3f_func = NULL; +static PFNGLUNIFORM4FPROC glUniform4f_func = NULL; +static PFNGLUNIFORM1FVPROC glUniform1fv_func = NULL; +static PFNGLUNIFORM2FVPROC glUniform2fv_func = NULL; +static PFNGLUNIFORM3FVPROC glUniform3fv_func = NULL; +static PFNGLUNIFORM4FVPROC glUniform4fv_func = NULL; +static PFNGLUNIFORMMATRIX2FVPROC glUniformMatrix2fv_func = NULL; +static PFNGLUNIFORMMATRIX3FVPROC glUniformMatrix3fv_func = NULL; +static PFNGLUNIFORMMATRIX4FVPROC glUniformMatrix4fv_func = NULL; +static PFNGLUSEPROGRAMPROC glUseProgram_func = NULL; +static PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f_func = NULL; +static PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f_func = NULL; +static PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f_func = NULL; +static PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f_func = NULL; +static PFNGLVERTEXATTRIB1FVPROC glVertexAttrib1fv_func = NULL; +static PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv_func = NULL; +static PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv_func = NULL; +static PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv_func = NULL; +static PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer_func = NULL; +static PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray_func = NULL; +static PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray_func = NULL; + +/* OpenGL 2.1 */ +static PFNGLUNIFORMMATRIX2X3FVPROC glUniformMatrix2x3fv_func = NULL; +static PFNGLUNIFORMMATRIX3X2FVPROC glUniformMatrix3x2fv_func = NULL; +static PFNGLUNIFORMMATRIX2X4FVPROC glUniformMatrix2x4fv_func = NULL; +static PFNGLUNIFORMMATRIX4X2FVPROC glUniformMatrix4x2fv_func = NULL; +static PFNGLUNIFORMMATRIX3X4FVPROC glUniformMatrix3x4fv_func = NULL; +static PFNGLUNIFORMMATRIX4X3FVPROC glUniformMatrix4x3fv_func = NULL; + +/* OpenGL 1.4 */ +static PFNGLPOINTPARAMETERFVPROC glPointParameterfv_func = NULL; +static PFNGLSECONDARYCOLOR3FVPROC glSecondaryColor3fv_func = NULL; + +/* GL_ARB_vertex/fragment_program */ +static PFNGLBINDPROGRAMARBPROC glBindProgramARB_func = NULL; +static PFNGLDELETEPROGRAMSARBPROC glDeleteProgramsARB_func = NULL; +static PFNGLGENPROGRAMSARBPROC glGenProgramsARB_func = NULL; +static PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC glGetProgramLocalParameterdvARB_func = NULL; +static PFNGLISPROGRAMARBPROC glIsProgramARB_func = NULL; +static PFNGLPROGRAMLOCALPARAMETER4DARBPROC glProgramLocalParameter4dARB_func = NULL; +static PFNGLPROGRAMLOCALPARAMETER4FVARBPROC glProgramLocalParameter4fvARB_func = NULL; +static PFNGLPROGRAMSTRINGARBPROC glProgramStringARB_func = NULL; +static PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1fARB_func = NULL; + +/* GL_APPLE_vertex_array_object */ +static PFNGLBINDVERTEXARRAYAPPLEPROC glBindVertexArrayAPPLE_func = NULL; +static PFNGLDELETEVERTEXARRAYSAPPLEPROC glDeleteVertexArraysAPPLE_func = NULL; +static PFNGLGENVERTEXARRAYSAPPLEPROC glGenVertexArraysAPPLE_func = NULL; +static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL; + +/* GL_EXT_stencil_two_side */ +static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL; + +/* GL_ARB_buffer_object */ +static PFNGLGENBUFFERSARBPROC glGenBuffersARB_func = NULL; +static PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB_func = NULL; +static PFNGLBINDBUFFERARBPROC glBindBufferARB_func = NULL; +static PFNGLBUFFERDATAARBPROC glBufferDataARB_func = NULL; +static PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB_func = NULL; +static PFNGLMAPBUFFERARBPROC glMapBufferARB_func = NULL; +static PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB_func = NULL; + +/* GL_EXT_framebuffer_object */ +static PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXT_func = NULL; +static PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXT_func = NULL; +static PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXT_func = NULL; +static PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXT_func = NULL; +static PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXT_func = NULL; +static PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXT_func = NULL; +static PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXT_func = NULL; +static PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXT_func = NULL; +static PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXT_func = NULL; +static PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXT_func = NULL; +static PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXT_func = NULL; +static PFNGLFRAMEBUFFERTEXTURE1DEXTPROC glFramebufferTexture1DEXT_func = NULL; +static PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXT_func = NULL; +static PFNGLFRAMEBUFFERTEXTURE3DEXTPROC glFramebufferTexture3DEXT_func = NULL; +static PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXT_func = NULL; +static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXT_func = NULL; +static PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXT_func = NULL; + +/* GL_ARB_framebuffer_object */ +static PFNGLISRENDERBUFFERPROC glIsRenderbuffer_func = NULL; +static PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer_func = NULL; +static PFNGLDELETERENDERBUFFERSPROC glDeleteRenderbuffers_func = NULL; +static PFNGLGENRENDERBUFFERSPROC glGenRenderbuffers_func = NULL; +static PFNGLRENDERBUFFERSTORAGEPROC glRenderbufferStorage_func = NULL; +static PFNGLGETRENDERBUFFERPARAMETERIVPROC glGetRenderbufferParameteriv_func = NULL; +static PFNGLISFRAMEBUFFERPROC glIsFramebuffer_func = NULL; +static PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer_func = NULL; +static PFNGLDELETEFRAMEBUFFERSPROC glDeleteFramebuffers_func = NULL; +static PFNGLGENFRAMEBUFFERSPROC glGenFramebuffers_func = NULL; +static PFNGLCHECKFRAMEBUFFERSTATUSPROC glCheckFramebufferStatus_func = NULL; +static PFNGLFRAMEBUFFERTEXTURE1DPROC glFramebufferTexture1D_func = NULL; +static PFNGLFRAMEBUFFERTEXTURE2DPROC glFramebufferTexture2D_func = NULL; +static PFNGLFRAMEBUFFERTEXTURE3DPROC glFramebufferTexture3D_func = NULL; +static PFNGLFRAMEBUFFERRENDERBUFFERPROC glFramebufferRenderbuffer_func = NULL; +static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glGetFramebufferAttachmentParameteriv_func = NULL; +static PFNGLGENERATEMIPMAPPROC glGenerateMipmap_func = NULL; +static PFNGLBLITFRAMEBUFFERPROC glBlitFramebuffer_func = NULL; +static PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glRenderbufferStorageMultisample_func = NULL; +static PFNGLFRAMEBUFFERTEXTURELAYERPROC glFramebufferTextureLayer_func = NULL; + + +static void +GetExtensionFuncs(void) +{ + /* OpenGL 2.0 */ + glAttachShader_func = (PFNGLATTACHSHADERPROC) glutGetProcAddress("glAttachShader"); + glBindAttribLocation_func = (PFNGLBINDATTRIBLOCATIONPROC) glutGetProcAddress("glBindAttribLocation"); + glCompileShader_func = (PFNGLCOMPILESHADERPROC) glutGetProcAddress("glCompileShader"); + glCreateProgram_func = (PFNGLCREATEPROGRAMPROC) glutGetProcAddress("glCreateProgram"); + glCreateShader_func = (PFNGLCREATESHADERPROC) glutGetProcAddress("glCreateShader"); + glDeleteProgram_func = (PFNGLDELETEPROGRAMPROC) glutGetProcAddress("glDeleteProgram"); + glDeleteShader_func = (PFNGLDELETESHADERPROC) glutGetProcAddress("glDeleteShader"); + glGetActiveAttrib_func = (PFNGLGETACTIVEATTRIBPROC) glutGetProcAddress("glGetActiveAttrib"); + glGetActiveUniform_func = (PFNGLGETACTIVEUNIFORMPROC) glutGetProcAddress("glGetActiveUniform"); + glGetAttachedShaders_func = (PFNGLGETATTACHEDSHADERSPROC) glutGetProcAddress("glGetAttachedShaders"); + glGetAttribLocation_func = (PFNGLGETATTRIBLOCATIONPROC) glutGetProcAddress("glGetAttribLocation"); + glGetProgramInfoLog_func = (PFNGLGETPROGRAMINFOLOGPROC) glutGetProcAddress("glGetProgramInfoLog"); + glGetShaderInfoLog_func = (PFNGLGETSHADERINFOLOGPROC) glutGetProcAddress("glGetShaderInfoLog"); + glGetProgramiv_func = (PFNGLGETPROGRAMIVPROC) glutGetProcAddress("glGetProgramiv"); + glGetShaderiv_func = (PFNGLGETSHADERIVPROC) glutGetProcAddress("glGetShaderiv"); + glGetShaderSource_func = (PFNGLGETSHADERSOURCEPROC) glutGetProcAddress("glGetShaderSource"); + glGetUniformLocation_func = (PFNGLGETUNIFORMLOCATIONPROC) glutGetProcAddress("glGetUniformLocation"); + glGetUniformfv_func = (PFNGLGETUNIFORMFVPROC) glutGetProcAddress("glGetUniformfv"); + glIsProgram_func = (PFNGLISPROGRAMPROC) glutGetProcAddress("glIsProgram"); + glIsShader_func = (PFNGLISSHADERPROC) glutGetProcAddress("glIsShader"); + glLinkProgram_func = (PFNGLLINKPROGRAMPROC) glutGetProcAddress("glLinkProgram"); + glShaderSource_func = (PFNGLSHADERSOURCEPROC) glutGetProcAddress("glShaderSource"); + glUniform1i_func = (PFNGLUNIFORM1IPROC) glutGetProcAddress("glUniform1i"); + glUniform2i_func = (PFNGLUNIFORM2IPROC) glutGetProcAddress("glUniform2i"); + glUniform3i_func = (PFNGLUNIFORM3IPROC) glutGetProcAddress("glUniform3i"); + glUniform4i_func = (PFNGLUNIFORM4IPROC) glutGetProcAddress("glUniform3i"); + glUniform1f_func = (PFNGLUNIFORM1FPROC) glutGetProcAddress("glUniform1f"); + glUniform2f_func = (PFNGLUNIFORM2FPROC) glutGetProcAddress("glUniform2f"); + glUniform3f_func = (PFNGLUNIFORM3FPROC) glutGetProcAddress("glUniform3f"); + glUniform4f_func = (PFNGLUNIFORM4FPROC) glutGetProcAddress("glUniform4f"); + glUniform1fv_func = (PFNGLUNIFORM1FVPROC) glutGetProcAddress("glUniform1fv"); + glUniform2fv_func = (PFNGLUNIFORM2FVPROC) glutGetProcAddress("glUniform2fv"); + glUniform3fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform3fv"); + glUniform4fv_func = (PFNGLUNIFORM3FVPROC) glutGetProcAddress("glUniform4fv"); + glUniformMatrix2fv_func = (PFNGLUNIFORMMATRIX2FVPROC) glutGetProcAddress("glUniformMatrix2fv"); + glUniformMatrix3fv_func = (PFNGLUNIFORMMATRIX3FVPROC) glutGetProcAddress("glUniformMatrix3fv"); + glUniformMatrix4fv_func = (PFNGLUNIFORMMATRIX4FVPROC) glutGetProcAddress("glUniformMatrix4fv"); + glUseProgram_func = (PFNGLUSEPROGRAMPROC) glutGetProcAddress("glUseProgram"); + glVertexAttrib1f_func = (PFNGLVERTEXATTRIB1FPROC) glutGetProcAddress("glVertexAttrib1f"); + glVertexAttrib2f_func = (PFNGLVERTEXATTRIB2FPROC) glutGetProcAddress("glVertexAttrib2f"); + glVertexAttrib3f_func = (PFNGLVERTEXATTRIB3FPROC) glutGetProcAddress("glVertexAttrib3f"); + glVertexAttrib4f_func = (PFNGLVERTEXATTRIB4FPROC) glutGetProcAddress("glVertexAttrib4f"); + glVertexAttrib1fv_func = (PFNGLVERTEXATTRIB1FVPROC) glutGetProcAddress("glVertexAttrib1fv"); + glVertexAttrib2fv_func = (PFNGLVERTEXATTRIB2FVPROC) glutGetProcAddress("glVertexAttrib2fv"); + glVertexAttrib3fv_func = (PFNGLVERTEXATTRIB3FVPROC) glutGetProcAddress("glVertexAttrib3fv"); + glVertexAttrib4fv_func = (PFNGLVERTEXATTRIB4FVPROC) glutGetProcAddress("glVertexAttrib4fv"); + + glVertexAttribPointer_func = (PFNGLVERTEXATTRIBPOINTERPROC) glutGetProcAddress("glVertexAttribPointer"); + glEnableVertexAttribArray_func = (PFNGLENABLEVERTEXATTRIBARRAYPROC) glutGetProcAddress("glEnableVertexAttribArray"); + glDisableVertexAttribArray_func = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) glutGetProcAddress("glDisableVertexAttribArray"); + + /* OpenGL 2.1 */ + glUniformMatrix2x3fv_func = (PFNGLUNIFORMMATRIX2X3FVPROC) glutGetProcAddress("glUniformMatrix2x3fv"); + glUniformMatrix3x2fv_func = (PFNGLUNIFORMMATRIX3X2FVPROC) glutGetProcAddress("glUniformMatrix3x2fv"); + glUniformMatrix2x4fv_func = (PFNGLUNIFORMMATRIX2X4FVPROC) glutGetProcAddress("glUniformMatrix2x4fv"); + glUniformMatrix4x2fv_func = (PFNGLUNIFORMMATRIX4X2FVPROC) glutGetProcAddress("glUniformMatrix4x2fv"); + glUniformMatrix3x4fv_func = (PFNGLUNIFORMMATRIX3X4FVPROC) glutGetProcAddress("glUniformMatrix3x4fv"); + glUniformMatrix4x3fv_func = (PFNGLUNIFORMMATRIX4X3FVPROC) glutGetProcAddress("glUniformMatrix4x3fv"); + + /* OpenGL 1.4 */ + glPointParameterfv_func = (PFNGLPOINTPARAMETERFVPROC) glutGetProcAddress("glPointParameterfv"); + glSecondaryColor3fv_func = (PFNGLSECONDARYCOLOR3FVPROC) glutGetProcAddress("glSecondaryColor3fv"); + + /* GL_ARB_vertex/fragment_program */ + glBindProgramARB_func = (PFNGLBINDPROGRAMARBPROC) glutGetProcAddress("glBindProgramARB"); + glDeleteProgramsARB_func = (PFNGLDELETEPROGRAMSARBPROC) glutGetProcAddress("glDeleteProgramsARB"); + glGenProgramsARB_func = (PFNGLGENPROGRAMSARBPROC) glutGetProcAddress("glGenProgramsARB"); + glGetProgramLocalParameterdvARB_func = (PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) glutGetProcAddress("glGetProgramLocalParameterdvARB"); + glIsProgramARB_func = (PFNGLISPROGRAMARBPROC) glutGetProcAddress("glIsProgramARB"); + glProgramLocalParameter4dARB_func = (PFNGLPROGRAMLOCALPARAMETER4DARBPROC) glutGetProcAddress("glProgramLocalParameter4dARB"); + glProgramLocalParameter4fvARB_func = (PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) glutGetProcAddress("glProgramLocalParameter4fvARB"); + glProgramStringARB_func = (PFNGLPROGRAMSTRINGARBPROC) glutGetProcAddress("glProgramStringARB"); + glVertexAttrib1fARB_func = (PFNGLVERTEXATTRIB1FARBPROC) glutGetProcAddress("glVertexAttrib1fARB"); + + /* GL_APPLE_vertex_array_object */ + glBindVertexArrayAPPLE_func = (PFNGLBINDVERTEXARRAYAPPLEPROC) glutGetProcAddress("glBindVertexArrayAPPLE"); + glDeleteVertexArraysAPPLE_func = (PFNGLDELETEVERTEXARRAYSAPPLEPROC) glutGetProcAddress("glDeleteVertexArraysAPPLE"); + glGenVertexArraysAPPLE_func = (PFNGLGENVERTEXARRAYSAPPLEPROC) glutGetProcAddress("glGenVertexArraysAPPLE"); + glIsVertexArrayAPPLE_func = (PFNGLISVERTEXARRAYAPPLEPROC) glutGetProcAddress("glIsVertexArrayAPPLE"); + + /* GL_EXT_stencil_two_side */ + glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT"); + + /* GL_ARB_vertex_buffer_object */ + glGenBuffersARB_func = (PFNGLGENBUFFERSARBPROC) glutGetProcAddress("glGenBuffersARB"); + glDeleteBuffersARB_func = (PFNGLDELETEBUFFERSARBPROC) glutGetProcAddress("glDeleteBuffersARB"); + glBindBufferARB_func = (PFNGLBINDBUFFERARBPROC) glutGetProcAddress("glBindBufferARB"); + glBufferDataARB_func = (PFNGLBUFFERDATAARBPROC) glutGetProcAddress("glBufferDataARB"); + glBufferSubDataARB_func = (PFNGLBUFFERSUBDATAARBPROC) glutGetProcAddress("glBufferSubDataARB"); + glMapBufferARB_func = (PFNGLMAPBUFFERARBPROC) glutGetProcAddress("glMapBufferARB"); + glUnmapBufferARB_func = (PFNGLUNMAPBUFFERARBPROC) glutGetProcAddress("glUnmapBufferARB"); + + /* GL_EXT_framebuffer_object */ + glIsRenderbufferEXT_func = (PFNGLISRENDERBUFFEREXTPROC) glutGetProcAddress("glIsRenderbufferEXT"); + glBindRenderbufferEXT_func = (PFNGLBINDRENDERBUFFEREXTPROC) glutGetProcAddress("glBindRenderbufferEXT"); + glDeleteRenderbuffersEXT_func = (PFNGLDELETERENDERBUFFERSEXTPROC) glutGetProcAddress("glDeleteRenderbuffersEXT"); + glGenRenderbuffersEXT_func = (PFNGLGENRENDERBUFFERSEXTPROC) glutGetProcAddress("glGenRenderbuffersEXT"); + glRenderbufferStorageEXT_func = (PFNGLRENDERBUFFERSTORAGEEXTPROC) glutGetProcAddress("glRenderbufferStorageEXT"); + glGetRenderbufferParameterivEXT_func = (PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) glutGetProcAddress("glGetRenderbufferParameterivEXT"); + glIsFramebufferEXT_func = (PFNGLISFRAMEBUFFEREXTPROC) glutGetProcAddress("glIsFramebufferEXT"); + glBindFramebufferEXT_func = (PFNGLBINDFRAMEBUFFEREXTPROC) glutGetProcAddress("glBindFramebufferEXT"); + glDeleteFramebuffersEXT_func = (PFNGLDELETEFRAMEBUFFERSEXTPROC) glutGetProcAddress("glDeleteFramebuffersEXT"); + glGenFramebuffersEXT_func = (PFNGLGENFRAMEBUFFERSEXTPROC) glutGetProcAddress("glGenFramebuffersEXT"); + glCheckFramebufferStatusEXT_func = (PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) glutGetProcAddress("glCheckFramebufferStatusEXT"); + glFramebufferTexture1DEXT_func = (PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) glutGetProcAddress("glFramebufferTexture1DEXT"); + glFramebufferTexture2DEXT_func = (PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) glutGetProcAddress("glFramebufferTexture2DEXT"); + glFramebufferTexture3DEXT_func = (PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) glutGetProcAddress("glFramebufferTexture3DEXT"); + glFramebufferRenderbufferEXT_func = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) glutGetProcAddress("glFramebufferRenderbufferEXT"); + glGetFramebufferAttachmentParameterivEXT_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) glutGetProcAddress("glGetFramebufferAttachmentParameterivEXT"); + glGenerateMipmapEXT_func = (PFNGLGENERATEMIPMAPEXTPROC) glutGetProcAddress("glGenerateMipmapEXT"); + + /* GL_ARB_framebuffer_object */ + glIsRenderbuffer_func = (PFNGLISRENDERBUFFERPROC) glutGetProcAddress("glIsRenderbuffer"); + glBindRenderbuffer_func = (PFNGLBINDRENDERBUFFERPROC) glutGetProcAddress("glBindRenderbuffer"); + glDeleteRenderbuffers_func = (PFNGLDELETERENDERBUFFERSPROC) glutGetProcAddress("glDeleteRenderbuffers"); + glGenRenderbuffers_func = (PFNGLGENRENDERBUFFERSPROC) glutGetProcAddress("glGenRenderbuffers"); + glRenderbufferStorage_func = (PFNGLRENDERBUFFERSTORAGEPROC) glutGetProcAddress("glRenderbufferStorage"); + glGetRenderbufferParameteriv_func = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) glutGetProcAddress("glGetRenderbufferParameteriv"); + glIsFramebuffer_func = (PFNGLISFRAMEBUFFERPROC) glutGetProcAddress("glIsFramebuffer"); + glBindFramebuffer_func = (PFNGLBINDFRAMEBUFFERPROC) glutGetProcAddress("glBindFramebuffer"); + glDeleteFramebuffers_func = (PFNGLDELETEFRAMEBUFFERSPROC) glutGetProcAddress("glDeleteFramebuffers"); + glGenFramebuffers_func = (PFNGLGENFRAMEBUFFERSPROC) glutGetProcAddress("glGenFramebuffers"); + glCheckFramebufferStatus_func = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) glutGetProcAddress("glCheckFramebufferStatus"); + glFramebufferTexture1D_func = (PFNGLFRAMEBUFFERTEXTURE1DPROC) glutGetProcAddress("glFramebufferTexture1D"); + glFramebufferTexture2D_func = (PFNGLFRAMEBUFFERTEXTURE2DPROC) glutGetProcAddress("glFramebufferTexture2D"); + glFramebufferTexture3D_func = (PFNGLFRAMEBUFFERTEXTURE3DPROC) glutGetProcAddress("glFramebufferTexture3D"); + glFramebufferRenderbuffer_func = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) glutGetProcAddress("glFramebufferRenderbuffer"); + glGetFramebufferAttachmentParameteriv_func = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) glutGetProcAddress("glGetFramebufferAttachmentParameteriv"); + glGenerateMipmap_func = (PFNGLGENERATEMIPMAPPROC) glutGetProcAddress("glGenerateMipmap"); + glBlitFramebuffer_func = (PFNGLBLITFRAMEBUFFERPROC) glutGetProcAddress("glBlitFramebuffer"); + glRenderbufferStorageMultisample_func = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) glutGetProcAddress("glRenderbufferStorageMultisample"); + glFramebufferTextureLayer_func = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) glutGetProcAddress("glFramebufferTextureLayer"); +} + diff --git a/mesalib/progs/util/glstate.c b/mesalib/progs/util/glstate.c new file mode 100644 index 000000000..21d7e4552 --- /dev/null +++ b/mesalib/progs/util/glstate.c @@ -0,0 +1,502 @@ + +/* + * Print GL state information (for debugging) + * Copyright (C) 1998 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* + * Revision 1.1 1999/08/19 00:55:42 jtg + * Initial revision + * + * Revision 1.4 1999/06/19 01:36:43 brianp + * more features added + * + * Revision 1.3 1999/02/24 05:16:20 brianp + * added still more records to EnumTable + * + * Revision 1.2 1998/11/24 03:47:54 brianp + * added more records to EnumTable + * + * Revision 1.1 1998/11/24 03:41:16 brianp + * Initial revision + * + */ + + + +#include +#include +#include +#include +#include "glstate.h" + + +#define FLOAT 1 +#define INT 2 +#define DOUBLE 3 +#define BOOLEAN 4 +#define ENUM 5 +#define VOID 6 +#define LAST_TOKEN ~0 + + +struct EnumRecord { + GLenum enumerator; /* GLenum constant */ + const char *string; /* string name */ + int getType; /* INT, FLOAT, DOUBLE, BOOLEAN, ENUM, or VOID */ + int getCount; /* number of values returned by the glGet*v() call */ +}; + + +/* XXX Lots more records to add here! Help, anyone? */ + +static struct EnumRecord EnumTable[] = { + { GL_ACCUM_RED_BITS, "GL_ACCUM_RED_BITS", INT, 1 }, + { GL_ACCUM_GREEN_BITS, "GL_ACCUM_GREEN_BITS", INT, 1 }, + { GL_ACCUM_BLUE_BITS, "GL_ACCUM_BLUE_BITS", INT, 1 }, + { GL_ACCUM_ALPHA_BITS, "GL_ACCUM_ALPHA_BITS", INT, 1 }, + { GL_ACCUM_CLEAR_VALUE, "GL_ACCUM_CLEAR_VALUE", FLOAT, 4 }, + { GL_ALPHA_BIAS, "GL_ALPHA_BIAS", FLOAT, 1 }, + { GL_ALPHA_BITS, "GL_ALPHA_BITS", INT, 1 }, + { GL_ALPHA_SCALE, "GL_ALPHA_SCALE", FLOAT, 1 }, + { GL_ALPHA_TEST, "GL_ALPHA_TEST", BOOLEAN, 1 }, + { GL_ALPHA_TEST_FUNC, "GL_ALPHA_TEST_FUNC", ENUM, 1 }, + { GL_ALWAYS, "GL_ALWAYS", ENUM, 0 }, + { GL_ALPHA_TEST_REF, "GL_ALPHA_TEST_REF", FLOAT, 1 }, + { GL_ATTRIB_STACK_DEPTH, "GL_ATTRIB_STACK_DEPTH", INT, 1 }, + { GL_AUTO_NORMAL, "GL_AUTO_NORMAL", BOOLEAN, 1 }, + { GL_AUX_BUFFERS, "GL_AUX_BUFFERS", INT, 1 }, + { GL_BLEND, "GL_BLEND", BOOLEAN, 1 }, + { GL_BLEND_DST, "GL_BLEND_DST", ENUM, 1 }, + { GL_BLEND_SRC, "GL_BLEND_SRC", ENUM, 1 }, + { GL_BLUE_BIAS, "GL_BLUE_BIAS", FLOAT, 1 }, + { GL_BLUE_BITS, "GL_BLUE_BITS", INT, 1 }, + { GL_BLUE_SCALE, "GL_BLUE_SCALE", FLOAT, 1 }, + + { GL_CLAMP_TO_EDGE, "GL_CLAMP_TO_EDGE", ENUM, 0 }, + { GL_CLEAR, "GL_CLEAR", ENUM, 0 }, + { GL_CLIENT_ATTRIB_STACK_DEPTH, "GL_CLIENT_ATTRIB_STACK_DEPTH", INT, 1 }, + { GL_CLIP_PLANE0, "GL_CLIP_PLANE0", BOOLEAN, 1 }, + { GL_CLIP_PLANE1, "GL_CLIP_PLANE1", BOOLEAN, 1 }, + { GL_CLIP_PLANE2, "GL_CLIP_PLANE2", BOOLEAN, 1 }, + { GL_CLIP_PLANE3, "GL_CLIP_PLANE3", BOOLEAN, 1 }, + { GL_CLIP_PLANE4, "GL_CLIP_PLANE4", BOOLEAN, 1 }, + { GL_CLIP_PLANE5, "GL_CLIP_PLANE5", BOOLEAN, 1 }, + { GL_COEFF, "GL_COEEF", ENUM, 0 }, + { GL_COLOR, "GL_COLOR", ENUM, 0 }, + { GL_COLOR_BUFFER_BIT, "GL_COLOR_BUFFER_BIT", ENUM, 0 }, + { GL_COLOR_CLEAR_VALUE, "GL_COLOR_CLEAR_VALUE", FLOAT, 4 }, + { GL_COLOR_INDEX, "GL_COLOR_INDEX", ENUM, 0 }, + { GL_COLOR_MATERIAL, "GL_COLOR_MATERIAL", BOOLEAN, 1 }, + { GL_COLOR_MATERIAL_FACE, "GL_COLOR_MATERIAL_FACE", ENUM, 1 }, + { GL_COLOR_MATERIAL_PARAMETER, "GL_COLOR_MATERIAL_PARAMETER", ENUM, 1 }, + { GL_COLOR_WRITEMASK, "GL_COLOR_WRITEMASK", BOOLEAN, 4 }, + { GL_COMPILE, "GL_COMPILE", ENUM, 0 }, + { GL_COMPILE_AND_EXECUTE, "GL_COMPILE_AND_EXECUTE", ENUM, 0 }, + { GL_COPY, "GL_COPY", ENUM, 0 }, + { GL_COPY_INVERTED, "GL_COPY_INVERTED", ENUM, 0 }, + { GL_COPY_PIXEL_TOKEN, "GL_COPY_PIXEL_TOKEN", ENUM, 0 }, + { GL_CULL_FACE, "GL_CULL_FACE", BOOLEAN, 1 }, + { GL_CULL_FACE_MODE, "GL_CULL_FACE_MODE", ENUM, 1 }, + { GL_CURRENT_BIT, "GL_CURRENT_BIT", ENUM, 0 }, + { GL_CURRENT_COLOR, "GL_CURRENT_COLOR", FLOAT, 4 }, + { GL_CURRENT_INDEX, "GL_CURRENT_INDEX", INT, 1 }, + { GL_CURRENT_NORMAL, "GL_CURRENT_NORMAL", FLOAT, 3 }, + { GL_CURRENT_RASTER_COLOR, "GL_CURRENT_RASTER_COLOR", FLOAT, 4 }, + { GL_CURRENT_RASTER_DISTANCE, "GL_CURRENT_RASTER_DISTANCE", FLOAT, 1 }, + { GL_CURRENT_RASTER_INDEX, "GL_CURRENT_RASTER_INDEX", INT, 1 }, + { GL_CURRENT_RASTER_POSITION, "GL_CURRENT_RASTER_POSITION", FLOAT, 4 }, + { GL_CURRENT_RASTER_TEXTURE_COORDS, "GL_CURRENT_RASTER_TEXTURE_COORDS", FLOAT, 4 }, + { GL_CURRENT_RASTER_POSITION_VALID, "GL_CURRENT_RASTER_POSITION_VALID", BOOLEAN, 1 }, + { GL_CURRENT_TEXTURE_COORDS, "GL_CURRENT_TEXTURE_COORDS", FLOAT, 4 }, + { GL_CW, "GL_CW", ENUM, 0 }, + { GL_CCW, "GL_CCW", ENUM, 0 }, + + { GL_DECAL, "GL_DECAL", ENUM, 0 }, + { GL_DECR, "GL_DECR", ENUM, 0 }, + { GL_DEPTH, "GL_DEPTH", ENUM, 0 }, + { GL_DEPTH_BIAS, "GL_DEPTH_BIAS", FLOAT, 1 }, + { GL_DEPTH_BITS, "GL_DEPTH_BITS", INT, 1 }, + { GL_DEPTH_BUFFER_BIT, "GL_DEPTH_BUFFER_BIT", ENUM, 0 }, + { GL_DEPTH_CLEAR_VALUE, "GL_DEPTH_CLEAR_VALUE", FLOAT, 1 }, + { GL_DEPTH_COMPONENT, "GL_DEPTH_COMPONENT", ENUM, 0 }, + { GL_DEPTH_FUNC, "GL_DEPTH_FUNC", ENUM, 1 }, + { GL_DEPTH_RANGE, "GL_DEPTH_RANGE", FLOAT, 2 }, + { GL_DEPTH_SCALE, "GL_DEPTH_SCALE", FLOAT, 1 }, + { GL_DEPTH_TEST, "GL_DEPTH_TEST", ENUM, 1 }, + { GL_DEPTH_WRITEMASK, "GL_DEPTH_WRITEMASK", BOOLEAN, 1 }, + { GL_DIFFUSE, "GL_DIFFUSE", ENUM, 0 }, /*XXX*/ + { GL_DITHER, "GL_DITHER", BOOLEAN, 1 }, + { GL_DOMAIN, "GL_DOMAIN", ENUM, 0 }, + { GL_DONT_CARE, "GL_DONT_CARE", ENUM, 0 }, + { GL_DOUBLE, "GL_DOUBLE", ENUM, 0 }, + { GL_DOUBLEBUFFER, "GL_DOUBLEBUFFER", BOOLEAN, 1}, + { GL_DRAW_BUFFER, "GL_DRAW_BUFFER", ENUM, 1 }, + { GL_DRAW_PIXEL_TOKEN, "GL_DRAW_PIXEL_TOKEN", ENUM, 0 }, + { GL_DST_ALPHA, "GL_DST_ALPHA", ENUM, 0 }, + { GL_DST_COLOR, "GL_DST_COLOR", ENUM, 0 }, + + { GL_EDGE_FLAG, "GL_EDGE_FLAG", BOOLEAN, 1 }, + /* XXX GL_EDGE_FLAG_ARRAY_* */ + { GL_EMISSION, "GL_EMISSION", ENUM, 0 }, /* XXX */ + { GL_ENABLE_BIT, "GL_ENABLE_BIT", ENUM, 0 }, + { GL_EQUAL, "GL_EQUAL", ENUM, 0 }, + { GL_EQUIV, "GL_EQUIV", ENUM, 0 }, + { GL_EVAL_BIT, "GL_EVAL_BIT", ENUM, 0 }, + { GL_EXP, "GL_EXP", ENUM, 0 }, + { GL_EXP2, "GL_EXP2", ENUM, 0 }, + { GL_EXTENSIONS, "GL_EXTENSIONS", ENUM, 0 }, + { GL_EYE_LINEAR, "GL_EYE_LINEAR", ENUM, 0 }, + { GL_EYE_PLANE, "GL_EYE_PLANE", ENUM, 0 }, + + { GL_FALSE, "GL_FALSE", ENUM, 0 }, + { GL_FASTEST, "GL_FASTEST", ENUM, 0 }, + { GL_FEEDBACK, "GL_FEEDBACK", ENUM, 0 }, + { GL_FEEDBACK_BUFFER_POINTER, "GL_FEEDBACK_BUFFER_POINTER", VOID, 0 }, + { GL_FEEDBACK_BUFFER_SIZE, "GL_FEEDBACK_BUFFER_SIZE", INT, 1 }, + { GL_FEEDBACK_BUFFER_TYPE, "GL_FEEDBACK_BUFFER_TYPE", INT, 1 }, + { GL_FILL, "GL_FILL", ENUM, 0 }, + { GL_FLAT, "GL_FLAT", ENUM, 0 }, + { GL_FLOAT, "GL_FLOAT", ENUM, 0 }, + { GL_FOG, "GL_FOG", BOOLEAN, 1 }, + { GL_FOG_BIT, "GL_FOG_BIT", ENUM, 0 }, + { GL_FOG_COLOR, "GL_FOG_COLOR", FLOAT, 4 }, + { GL_FOG_DENSITY, "GL_FOG_DENSITY", FLOAT, 1 }, + { GL_FOG_END, "GL_FOG_END", FLOAT, 1 }, + { GL_FOG_HINT, "GL_FOG_HINT", ENUM, 1 }, + { GL_FOG_INDEX, "GL_FOG_INDEX", INT, 1 }, + { GL_FOG_MODE, "GL_FOG_MODE", ENUM, 1 }, + { GL_FOG_START, "GL_FOG_START", FLOAT, 1 }, + { GL_FRONT, "GL_FRONT", ENUM, 0 }, + { GL_FRONT_AND_BACK, "GL_FRONT_AND_BACK", ENUM, 0 }, + { GL_FRONT_FACE, "GL_FRONT_FACE", ENUM, 1 }, + { GL_FRONT_LEFT, "GL_FRONT_LEFT", ENUM, 0 }, + { GL_FRONT_RIGHT, "GL_FRONT_RIGHT", ENUM, 0 }, + + { GL_GEQUAL, "GL_GEQUAL", ENUM, 0 }, + { GL_GREATER, "GL_GREATER", ENUM, 0 }, + { GL_GREEN, "GL_GREEN", ENUM, 0 }, + { GL_GREEN_BIAS, "GL_GREEN_BIAS", FLOAT, 1 }, + { GL_GREEN_BITS, "GL_GREEN_BITS", INT, 1 }, + { GL_GREEN_SCALE, "GL_GREEN_SCALE", FLOAT, 1 }, + + + + { GL_LESS, "GL_LESS", ENUM, 0 }, + { GL_LEQUAL, "GL_LEQUAL", ENUM, 0 }, + { GL_LIGHTING, "GL_LIGHTING", BOOLEAN, 1 }, + { GL_LINE_SMOOTH, "GL_LINE_SMOOTH", BOOLEAN, 1 }, + { GL_LINE_STIPPLE, "GL_LINE_STIPPLE", BOOLEAN, 1 }, + { GL_LINE_STIPPLE_PATTERN, "GL_LINE_STIPPLE_PATTERN", INT, 1 }, + { GL_LINE_STIPPLE_REPEAT, "GL_LINE_STIPPLE_REPEAT", INT, 1 }, + { GL_LINE_WIDTH, "GL_LINE_WIDTH", FLOAT, 1 }, + + { GL_MODELVIEW_MATRIX, "GL_MODELVIEW_MATRIX", DOUBLE, 16 }, + + { GL_NEVER, "GL_NEVER", ENUM, 0 }, + { GL_NOTEQUAL, "GL_NOTEQUAL", ENUM, 0 }, + + { GL_PROJECTION_MATRIX, "GL_PROJECTION_MATRIX", FLOAT, 16 }, + + { GL_PACK_SWAP_BYTES, "GL_PACK_SWAP_BYTES", INT, 1 }, + { GL_PACK_LSB_FIRST, "GL_PACK_LSB_FIRST", INT, 1 }, + { GL_PACK_ROW_LENGTH, "GL_PACK_ROW_LENGTH", INT, 1 }, + { GL_PACK_SKIP_PIXELS, "GL_PACK_SKIP_PIXELS", INT, 1 }, + { GL_PACK_SKIP_ROWS, "GL_PACK_SKIP_ROWS", INT, 1 }, + { GL_PACK_ALIGNMENT, "GL_PACK_ALIGNMENT", INT, 1 }, + + { GL_TRUE, "GL_TRUE", ENUM, 0 }, + + { GL_UNPACK_SWAP_BYTES, "GL_UNPACK_SWAP_BYTES", INT, 1 }, + { GL_UNPACK_LSB_FIRST, "GL_UNPACK_LSB_FIRST", INT, 1 }, + { GL_UNPACK_ROW_LENGTH, "GL_UNPACK_ROW_LENGTH", INT, 1 }, + { GL_UNPACK_SKIP_PIXELS, "GL_UNPACK_SKIP_PIXELS", INT, 1 }, + { GL_UNPACK_SKIP_ROWS, "GL_UNPACK_SKIP_ROWS", INT, 1 }, + { GL_UNPACK_ALIGNMENT, "GL_UNPACK_ALIGNMENT", INT, 1 }, + + { GL_VIEWPORT, "GL_VIEWPORT", INT, 4 }, + + + /* + * Extensions + */ + +#if defined(GL_EXT_blend_minmax) + { GL_BLEND_EQUATION_EXT, "GL_BLEND_EQUATION_EXT", ENUM, 1 }, +#endif +#if defined(GL_EXT_blend_color) + { GL_BLEND_COLOR_EXT, "GL_BLEND_COLOR_EXT", FLOAT, 4 }, +#endif +#if defined(GL_EXT_point_parameters) + { GL_DISTANCE_ATTENUATION_EXT, "GL_DISTANCE_ATTENUATION_EXT", FLOAT, 1 }, +#endif +#if defined(GL_INGR_blend_func_separate) + { GL_BLEND_SRC_RGB_INGR, "GL_BLEND_SRC_RGB_INGR", ENUM, 1 }, + { GL_BLEND_DST_RGB_INGR, "GL_BLEND_DST_RGB_INGR", ENUM, 1 }, + { GL_BLEND_SRC_ALPHA_INGR, "GL_BLEND_SRC_ALPHA_INGR", ENUM, 1 }, + { GL_BLEND_DST_ALPHA_INGR, "GL_BLEND_DST_ALPHA_INGR", ENUM, 1 }, +#endif + + + { LAST_TOKEN, "", 0, 0 } +}; + + +static const struct EnumRecord *FindRecord( GLenum var ) +{ + int i; + for (i = 0; EnumTable[i].enumerator != LAST_TOKEN; i++) { + if (EnumTable[i].enumerator == var) { + return &EnumTable[i]; + } + } + return NULL; +} + + + +/* + * Return the string label for the given enum. + */ +const char *GetEnumString( GLenum var ) +{ + const struct EnumRecord *rec = FindRecord(var); + if (rec) + return rec->string; + else + return NULL; +} + + + +/* + * Print current value of the given state variable. + */ +void PrintState( int indent, GLenum var ) +{ + const struct EnumRecord *rec = FindRecord(var); + + while (indent-- > 0) + putchar(' '); + + if (rec) { + if (rec->getCount <= 0) { + assert(rec->getType == ENUM); + printf("%s is not a state variable\n", rec->string); + } + else { + switch (rec->getType) { + case INT: + { + GLint values[100]; + int i; + glGetIntegerv(rec->enumerator, values); + printf("%s = ", rec->string); + for (i = 0; i < rec->getCount; i++) + printf("%d ", values[i]); + printf("\n"); + } + break; + case FLOAT: + { + GLfloat values[100]; + int i; + glGetFloatv(rec->enumerator, values); + printf("%s = ", rec->string); + for (i = 0; i < rec->getCount; i++) + printf("%f ", values[i]); + printf("\n"); + } + break; + case DOUBLE: + { + GLdouble values[100]; + int i; + glGetDoublev(rec->enumerator, values); + printf("%s = ", rec->string); + for (i = 0; i < rec->getCount; i++) + printf("%f ", (float) values[i]); + printf("\n"); + } + break; + case BOOLEAN: + { + GLboolean values[100]; + int i; + glGetBooleanv(rec->enumerator, values); + printf("%s = ", rec->string); + for (i = 0; i < rec->getCount; i++) + printf("%s ", values[i] ? "GL_TRUE" : "GL_FALSE"); + printf("\n"); + } + break; + case ENUM: + { + GLint values[100]; + int i; + glGetIntegerv(rec->enumerator, values); + printf("%s = ", rec->string); + for (i = 0; i < rec->getCount; i++) { + const char *str = GetEnumString((GLenum) values[i]); + if (str) + printf("%s ", str); + else + printf("??? "); + } + printf("\n"); + } + break; + case VOID: + { + GLvoid *values[100]; + int i; + glGetPointerv(rec->enumerator, values); + printf("%s = ", rec->string); + for (i = 0; i < rec->getCount; i++) { + printf("%p ", values[i]); + } + printf("\n"); + } + break; + default: + printf("fatal error in PrintState()\n"); + abort(); + } + } + } + else { + printf("Unknown GLenum passed to PrintState()\n"); + } +} + + + +/* + * Print all glPixelStore-related state. + * NOTE: Should write similar functions for lighting, texturing, etc. + */ +void PrintPixelStoreState( void ) +{ + const GLenum enums[] = { + GL_PACK_SWAP_BYTES, + GL_PACK_LSB_FIRST, + GL_PACK_ROW_LENGTH, + GL_PACK_SKIP_PIXELS, + GL_PACK_SKIP_ROWS, + GL_PACK_ALIGNMENT, + GL_UNPACK_SWAP_BYTES, + GL_UNPACK_LSB_FIRST, + GL_UNPACK_ROW_LENGTH, + GL_UNPACK_SKIP_PIXELS, + GL_UNPACK_SKIP_ROWS, + GL_UNPACK_ALIGNMENT, + 0 + }; + int i; + printf("Pixel pack/unpack state:\n"); + for (i = 0; enums[i]; i++) { + PrintState(3, enums[i]); + } +} + + + + +/* + * Print all state for the given attribute group. + */ +void PrintAttribState( GLbitfield attrib ) +{ + static const GLenum depth_buffer_enums[] = { + GL_DEPTH_FUNC, + GL_DEPTH_CLEAR_VALUE, + GL_DEPTH_TEST, + GL_DEPTH_WRITEMASK, + 0 + }; + static const GLenum fog_enums[] = { + GL_FOG, + GL_FOG_COLOR, + GL_FOG_DENSITY, + GL_FOG_START, + GL_FOG_END, + GL_FOG_INDEX, + GL_FOG_MODE, + 0 + }; + static const GLenum line_enums[] = { + GL_LINE_SMOOTH, + GL_LINE_STIPPLE, + GL_LINE_STIPPLE_PATTERN, + GL_LINE_STIPPLE_REPEAT, + GL_LINE_WIDTH, + 0 + }; + + const GLenum *enumList = NULL; + + switch (attrib) { + case GL_DEPTH_BUFFER_BIT: + enumList = depth_buffer_enums; + printf("GL_DEPTH_BUFFER_BIT state:\n"); + break; + case GL_FOG_BIT: + enumList = fog_enums; + printf("GL_FOG_BIT state:\n"); + break; + case GL_LINE_BIT: + enumList = line_enums; + printf("GL_LINE_BIT state:\n"); + break; + default: + printf("Bad value in PrintAttribState()\n"); + } + + if (enumList) { + int i; + for (i = 0; enumList[i]; i++) + PrintState(3, enumList[i]); + } +} + + +/*#define TEST*/ +#ifdef TEST + +#include + +int main( int argc, char *argv[] ) +{ + glutInit( &argc, argv ); + glutInitWindowPosition(0, 0); + glutInitWindowSize(400, 300); + glutInitDisplayMode(GLUT_RGB); + glutCreateWindow(argv[0]); + PrintAttribState(GL_DEPTH_BUFFER_BIT); + PrintAttribState(GL_FOG_BIT); + PrintAttribState(GL_LINE_BIT); + PrintState(0, GL_ALPHA_BITS); + PrintState(0, GL_VIEWPORT); + PrintState(0, GL_ALPHA_TEST_FUNC); + PrintState(0, GL_MODELVIEW_MATRIX); + PrintState(0, GL_ALWAYS); + PrintPixelStoreState(); + return 0; +} + +#endif diff --git a/mesalib/progs/util/glstate.h b/mesalib/progs/util/glstate.h new file mode 100644 index 000000000..9216382b7 --- /dev/null +++ b/mesalib/progs/util/glstate.h @@ -0,0 +1,51 @@ + +/* + * Print GL state information (for debugging) + * Copyright (C) 1998 Brian Paul + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +/* + * Revision 1.1 1999/08/19 00:55:42 jtg + * Initial revision + * + * Revision 1.2 1999/06/19 01:36:43 brianp + * more features added + * + * Revision 1.1 1998/11/24 03:41:16 brianp + * Initial revision + * + */ + + +#ifndef GLSTATE_H +#define GLSTATE_H + + +#include + + +extern const char *GetNameString( GLenum var ); + +extern void PrintState( int indent, GLenum var ); + +extern void PrintAttribState( GLbitfield attrib ); + +extern void PrintPixelStoreState( void ); + + +#endif diff --git a/mesalib/progs/util/glutskel.c b/mesalib/progs/util/glutskel.c new file mode 100644 index 000000000..8499e12a9 --- /dev/null +++ b/mesalib/progs/util/glutskel.c @@ -0,0 +1,141 @@ +/** + * A skeleton/template GLUT program + * + * Written by Brian Paul and in the public domain. + */ + + +#include +#include +#include +#include + +static int Win; +static int WinWidth = 400, WinHeight = 400; +static GLfloat Xrot = 0, Yrot = 0, Zrot = 0; +static GLboolean Anim = GL_FALSE; + + +static void +Idle(void) +{ + Xrot += 3.0; + Yrot += 4.0; + Zrot += 2.0; + glutPostRedisplay(); +} + + +static void +Draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + glRotatef(Xrot, 1, 0, 0); + glRotatef(Yrot, 0, 1, 0); + glRotatef(Zrot, 0, 0, 1); + + glutSolidCube(2.0); + + glPopMatrix(); + + glutSwapBuffers(); +} + + +static void +Reshape(int width, int height) +{ + WinWidth = width; + WinHeight = height; + glViewport(0, 0, width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -15.0); +} + + +static void +Key(unsigned char key, int x, int y) +{ + const GLfloat step = 3.0; + (void) x; + (void) y; + switch (key) { + case 'a': + Anim = !Anim; + if (Anim) + glutIdleFunc(Idle); + else + glutIdleFunc(NULL); + break; + case 'z': + Zrot -= step; + break; + case 'Z': + Zrot += step; + break; + case 27: + glutDestroyWindow(Win); + exit(0); + break; + } + glutPostRedisplay(); +} + + +static void +SpecialKey(int key, int x, int y) +{ + const GLfloat step = 3.0; + (void) x; + (void) y; + switch (key) { + case GLUT_KEY_UP: + Xrot -= step; + break; + case GLUT_KEY_DOWN: + Xrot += step; + break; + case GLUT_KEY_LEFT: + Yrot -= step; + break; + case GLUT_KEY_RIGHT: + Yrot += step; + break; + } + glutPostRedisplay(); +} + + +static void +Init(void) +{ + /* setup lighting, etc */ + glEnable(GL_DEPTH_TEST); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); +} + + +int +main(int argc, char *argv[]) +{ + glutInit(&argc, argv); + glutInitWindowSize(WinWidth, WinHeight); + glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); + Win = glutCreateWindow(argv[0]); + glutReshapeFunc(Reshape); + glutKeyboardFunc(Key); + glutSpecialFunc(SpecialKey); + glutDisplayFunc(Draw); + if (Anim) + glutIdleFunc(Idle); + Init(); + glutMainLoop(); + return 0; +} diff --git a/mesalib/progs/util/idproj.c b/mesalib/progs/util/idproj.c new file mode 100644 index 000000000..d5ee3409f --- /dev/null +++ b/mesalib/progs/util/idproj.c @@ -0,0 +1,26 @@ +/* idproj.c */ + + +/* + * Setup an identity projection such that glVertex(x,y) maps to + * window coordinate (x,y). + * + * Written by Brian Paul and in the public domain. + */ + + + + + +void IdentityProjection( GLint x, GLint y, GLsizei width, GLsizei height ) +{ + glViewport( x, y, width, height ); + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( (GLdouble) x, (GLdouble) y, + (GLdouble) width, (GLdouble) height, + -1.0, 1.0 ); + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); +} + diff --git a/mesalib/progs/util/imagesgi.h b/mesalib/progs/util/imagesgi.h new file mode 100644 index 000000000..e5ecece49 --- /dev/null +++ b/mesalib/progs/util/imagesgi.h @@ -0,0 +1,55 @@ +/****************************************************************************** +** Filename : imageSgi.h +** UNCLASSIFIED +** +** Description : Utility to read SGI image format files. This code was +** originally a SGI image loading utility provided with the +** Mesa 3D library @ http://www.mesa3d.org by Brain Paul. +** This has been extended to read all SGI image formats +** (e.g. INT, INTA, RGB, RGBA). +** +** Revision History: +** Date Name Description +** 06/08/99 BRC Initial Release +** +******************************************************************************/ + +#ifndef __IMAGESGI_H +#define __IMAGESGI_H + +#define IMAGE_SGI_TYPE_VERBATIM 0 +#define IMAGE_SGI_TYPE_RLE 1 + +struct sImageSgiHeader // 512 bytes +{ + short magic; // IRIS image file magic number (474) + char type; // Storage format (e.g. RLE or VERBATIM) + char numBytesPerPixelChannel; // Number of bytes per pixel channel + unsigned short dim; // Number of dimensions (1 to 3) + unsigned short xsize; // Width (in pixels) + unsigned short ysize; // Height (in pixels) + unsigned short zsize; // Number of channels (1 to 4) + int minimumPixelValue; // Minimum pixel value (0 to 255) + int maximumPixelValue; // Maximum pixel value (0 to 255) + char padding1[4]; // (ignored) + char imageName[80]; // Image name + int colormap; // colormap ID (0=normal, 0=dithered, + // 2=screen, 3=colormap) + char padding2[404]; // (ignored) +}; + +struct sImageSgi +{ + struct sImageSgiHeader header; + unsigned char *data; +}; + +#ifndef __IMAGESGI_CPP + +// RGB image load utility +extern struct sImageSgi *ImageSgiOpen(char const * const fileName); +extern void ImageSgiClose(struct sImageSgi *image); + +#endif + +#endif /* __IMAGESGI_H */ diff --git a/mesalib/progs/util/matrix.c b/mesalib/progs/util/matrix.c new file mode 100644 index 000000000..8be2c3111 --- /dev/null +++ b/mesalib/progs/util/matrix.c @@ -0,0 +1,181 @@ +/* + * matrix.c + * + * Some useful matrix functions. + * + * Brian Paul + * 10 Feb 2004 + */ + + + +#include +#include +#include + + +/** + * Pretty-print the given matrix. + */ +void +PrintMatrix(const float p[16]) +{ + printf("[ %6.3f %6.3f %6.3f %6.3f ]\n", p[0], p[4], p[8], p[12]); + printf("[ %6.3f %6.3f %6.3f %6.3f ]\n", p[1], p[5], p[9], p[13]); + printf("[ %6.3f %6.3f %6.3f %6.3f ]\n", p[2], p[6], p[10], p[14]); + printf("[ %6.3f %6.3f %6.3f %6.3f ]\n", p[3], p[7], p[11], p[15]); +} + + +/** + * Build a glFrustum matrix. + */ +void +Frustum(float left, float right, float bottom, float top, float nearZ, float farZ, float *m) +{ + float x = (2.0F*nearZ) / (right-left); + float y = (2.0F*nearZ) / (top-bottom); + float a = (right+left) / (right-left); + float b = (top+bottom) / (top-bottom); + float c = -(farZ+nearZ) / ( farZ-nearZ); + float d = -(2.0F*farZ*nearZ) / (farZ-nearZ); + +#define M(row,col) m[col*4+row] + M(0,0) = x; M(0,1) = 0.0F; M(0,2) = a; M(0,3) = 0.0F; + M(1,0) = 0.0F; M(1,1) = y; M(1,2) = b; M(1,3) = 0.0F; + M(2,0) = 0.0F; M(2,1) = 0.0F; M(2,2) = c; M(2,3) = d; + M(3,0) = 0.0F; M(3,1) = 0.0F; M(3,2) = -1.0F; M(3,3) = 0.0F; +#undef M +} + + +/** + * Build a glOrtho marix. + */ +void +Ortho(float left, float right, float bottom, float top, float nearZ, float farZ, float *m) +{ +#define M(row,col) m[col*4+row] + M(0,0) = 2.0F / (right-left); + M(0,1) = 0.0F; + M(0,2) = 0.0F; + M(0,3) = -(right+left) / (right-left); + + M(1,0) = 0.0F; + M(1,1) = 2.0F / (top-bottom); + M(1,2) = 0.0F; + M(1,3) = -(top+bottom) / (top-bottom); + + M(2,0) = 0.0F; + M(2,1) = 0.0F; + M(2,2) = -2.0F / (farZ-nearZ); + M(2,3) = -(farZ+nearZ) / (farZ-nearZ); + + M(3,0) = 0.0F; + M(3,1) = 0.0F; + M(3,2) = 0.0F; + M(3,3) = 1.0F; +#undef M +} + + +/** + * Decompose a projection matrix to determine original glFrustum or + * glOrtho parameters. + */ +void +DecomposeProjection( const float *m, + int *isPerspective, + float *leftOut, float *rightOut, + float *botOut, float *topOut, + float *nearOut, float *farOut) +{ + if (m[15] == 0.0) { + /* perspective */ + float p[16]; + const float x = m[0]; /* 2N / (R-L) */ + const float y = m[5]; /* 2N / (T-B) */ + const float a = m[8]; /* (R+L) / (R-L) */ + const float b = m[9]; /* (T+B) / (T-B) */ + const float c = m[10]; /* -(F+N) / (F-N) */ + const float d = m[14]; /* -2FN / (F-N) */ + + /* These equations found with simple algebra, knowing the arithmetic + * use to set up a typical perspective projection matrix in OpenGL. + */ + const float nearZ = -d / (1.0 - c); + const float farZ = (c - 1.0) * nearZ / (c + 1.0); + const float left = nearZ * (a - 1.0) / x; + const float right = 2.0 * nearZ / x + left; + const float bottom = nearZ * (b - 1.0) / y; + const float top = 2.0 * nearZ / y + bottom; + + *isPerspective = 1; + *leftOut = left; + *rightOut = right; + *botOut = bottom; + *topOut = top; + *nearOut = nearZ; + *farOut = farZ; + } + else { + /* orthographic */ + const float x = m[0]; /* 2 / (R-L) */ + const float y = m[5]; /* 2 / (T-B) */ + const float z = m[10]; /* -2 / (F-N) */ + const float a = m[12]; /* -(R+L) / (R-L) */ + const float b = m[13]; /* -(T+B) / (T-B) */ + const float c = m[14]; /* -(F+N) / (F-N) */ + /* again, simple algebra */ + const float right = -(a - 1.0) / x; + const float left = right - 2.0 / x; + const float top = -(b - 1.0) / y; + const float bottom = top - 2.0 / y; + const float farZ = (c - 1.0) / z; + const float nearZ = farZ + 2.0 / z; + + *isPerspective = 0; + *leftOut = left; + *rightOut = right; + *botOut = bottom; + *topOut = top; + *nearOut = nearZ; + *farOut = farZ; + } +} + + +#if 0 +/* test harness */ +int +main(int argc, char *argv[]) +{ + float m[16], p[16]; + float l, r, b, t, n, f; + int persp; + int i; + +#if 0 + l = -.9; + r = 1.2; + b = -0.5; + t = 1.4; + n = 30; + f = 84; + printf(" Frustum(%f, %f, %f, %f, %f, %f\n",l+1, r+1.2, b+.5, t+.3, n, f); + Frustum(l+1, r+1.2, b+.5, t+.3, n, f, p); + DecomposeProjection(p, &persp, &l, &r, &b, &t, &n, &f); + printf("glFrustum(%f, %f, %f, %f, %f, %f)\n", + l, r, b, t, n, f); + PrintMatrix(p); +#else + printf("Ortho(-1, 1, -1, 1, 10, 84)\n"); + Ortho(-1, 1, -1, 1, 10, 84, m); + PrintMatrix(m); + DecomposeProjection(m, &persp, &l, &r, &b, &t, &n, &f); + printf("Ortho(%f, %f, %f, %f, %f, %f) %d\n", l, r, b, t, n, f, persp); +#endif + + return 0; +} +#endif diff --git a/mesalib/progs/util/mwmborder.c b/mesalib/progs/util/mwmborder.c new file mode 100644 index 000000000..b61ffb50b --- /dev/null +++ b/mesalib/progs/util/mwmborder.c @@ -0,0 +1,91 @@ +/* mwmborder.c */ + + +/* + * This function shows how to remove the border, title bar, resize button, + * etc from a Motif window frame from inside an Xlib-based application. + * + * Brian Paul 19 Sep 1995 brianp@ssec.wisc.edu + * + * This code is in the public domain. + */ + + +#include +#include + +#define HAVE_MOTIF +#ifdef HAVE_MOTIF + +#include + +#else + +/* bit definitions for MwmHints.flags */ +#define MWM_HINTS_FUNCTIONS (1L << 0) +#define MWM_HINTS_DECORATIONS (1L << 1) +#define MWM_HINTS_INPUT_MODE (1L << 2) +#define MWM_HINTS_STATUS (1L << 3) + +/* bit definitions for MwmHints.decorations */ +#define MWM_DECOR_ALL (1L << 0) +#define MWM_DECOR_BORDER (1L << 1) +#define MWM_DECOR_RESIZEH (1L << 2) +#define MWM_DECOR_TITLE (1L << 3) +#define MWM_DECOR_MENU (1L << 4) +#define MWM_DECOR_MINIMIZE (1L << 5) +#define MWM_DECOR_MAXIMIZE (1L << 6) + +typedef struct +{ + unsigned long flags; + unsigned long functions; + unsigned long decorations; + long inputMode; + unsigned long status; +} PropMotifWmHints; + +#define PROP_MOTIF_WM_HINTS_ELEMENTS 5 + +#endif + + + +/* + * Specify which Motif window manager border decorations to put on a + * top-level window. For example, you can specify that a window is not + * resizabe, or omit the titlebar, or completely remove all decorations. + * Input: dpy - the X display + * w - the X window + * flags - bitwise-OR of the MWM_DECOR_xxx symbols in X11/Xm/MwmUtil.h + * indicating what decoration elements to enable. Zero would + * be no decoration. + */ +void set_mwm_border( Display *dpy, Window w, unsigned long flags ) +{ + PropMotifWmHints motif_hints; + Atom prop, proptype; + + /* setup the property */ + motif_hints.flags = MWM_HINTS_DECORATIONS; + motif_hints.decorations = flags; + + /* get the atom for the property */ + prop = XInternAtom( dpy, "_MOTIF_WM_HINTS", True ); + if (!prop) { + /* something went wrong! */ + return; + } + + /* not sure this is correct, seems to work, XA_WM_HINTS didn't work */ + proptype = prop; + + XChangeProperty( dpy, w, /* display, window */ + prop, proptype, /* property, type */ + 32, /* format: 32-bit datums */ + PropModeReplace, /* mode */ + (unsigned char *) &motif_hints, /* data */ + PROP_MOTIF_WM_HINTS_ELEMENTS /* nelements */ + ); +} + diff --git a/mesalib/progs/util/readtex.c b/mesalib/progs/util/readtex.c new file mode 100644 index 000000000..8e923b6eb --- /dev/null +++ b/mesalib/progs/util/readtex.c @@ -0,0 +1,460 @@ +/* readtex.c */ + +/* + * Read an SGI .rgb image file and generate a mipmap texture set. + * Much of this code was borrowed from SGI's tk OpenGL toolkit. + */ + + + +#include +#include +#include +#include +#include +#include "readtex.h" + + +#ifndef SEEK_SET +# define SEEK_SET 0 +#endif + + +/* +** RGB Image Structure +*/ + +typedef struct _TK_RGBImageRec { + GLint sizeX, sizeY; + GLint components; + unsigned char *data; +} TK_RGBImageRec; + + + +/******************************************************************************/ + +typedef struct _rawImageRec { + unsigned short imagic; + unsigned short type; + unsigned short dim; + unsigned short sizeX, sizeY, sizeZ; + unsigned long min, max; + unsigned long wasteBytes; + char name[80]; + unsigned long colorMap; + FILE *file; + unsigned char *tmp, *tmpR, *tmpG, *tmpB, *tmpA; + unsigned long rleEnd; + GLuint *rowStart; + GLint *rowSize; +} rawImageRec; + +/******************************************************************************/ + +static void ConvertShort(unsigned short *array, long length) +{ + unsigned long b1, b2; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + *array++ = (unsigned short) ((b1 << 8) | (b2)); + } +} + +static void ConvertLong(GLuint *array, long length) +{ + unsigned long b1, b2, b3, b4; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) { + b1 = *ptr++; + b2 = *ptr++; + b3 = *ptr++; + b4 = *ptr++; + *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4); + } +} + +static rawImageRec *RawImageOpen(const char *fileName) +{ + union { + int testWord; + char testByte[4]; + } endianTest; + rawImageRec *raw; + GLenum swapFlag; + int x; + + endianTest.testWord = 1; + if (endianTest.testByte[0] == 1) { + swapFlag = GL_TRUE; + } else { + swapFlag = GL_FALSE; + } + + raw = (rawImageRec *)calloc(1, sizeof(rawImageRec)); + if (raw == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + raw->file = fopen(fileName, "rb"); + if (raw->file == NULL) { + const char *baseName = strrchr(fileName, '/'); + if(baseName) + raw->file = fopen(baseName + 1, "rb"); + if(raw->file == NULL) { + perror(fileName); + return NULL; + } + } + + fread(raw, 1, 12, raw->file); + + if (swapFlag) { + ConvertShort(&raw->imagic, 6); + } + + raw->tmp = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpR = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpG = (unsigned char *)malloc(raw->sizeX*256); + raw->tmpB = (unsigned char *)malloc(raw->sizeX*256); + if (raw->sizeZ==4) { + raw->tmpA = (unsigned char *)malloc(raw->sizeX*256); + } + if (raw->tmp == NULL || raw->tmpR == NULL || raw->tmpG == NULL || + raw->tmpB == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + + if ((raw->type & 0xFF00) == 0x0100) { + x = raw->sizeY * raw->sizeZ * sizeof(GLuint); + raw->rowStart = (GLuint *)malloc(x); + raw->rowSize = (GLint *)malloc(x); + if (raw->rowStart == NULL || raw->rowSize == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + raw->rleEnd = 512 + (2 * x); + fseek(raw->file, 512, SEEK_SET); + fread(raw->rowStart, 1, x, raw->file); + fread(raw->rowSize, 1, x, raw->file); + if (swapFlag) { + ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint))); + ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint))); + } + } + return raw; +} + +static void RawImageClose(rawImageRec *raw) +{ + fclose(raw->file); + free(raw->tmp); + free(raw->tmpR); + free(raw->tmpG); + free(raw->tmpB); + if (raw->rowStart) + free(raw->rowStart); + if (raw->rowSize) + free(raw->rowSize); + if (raw->sizeZ>3) { + free(raw->tmpA); + } + free(raw); +} + +static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) +{ + unsigned char *iPtr, *oPtr, pixel; + int count, done = 0; + + if ((raw->type & 0xFF00) == 0x0100) { + fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET); + fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], + raw->file); + + iPtr = raw->tmp; + oPtr = buf; + while (!done) { + pixel = *iPtr++; + count = (int)(pixel & 0x7F); + if (!count) { + done = 1; + return; + } + if (pixel & 0x80) { + while (count--) { + *oPtr++ = *iPtr++; + } + } else { + pixel = *iPtr++; + while (count--) { + *oPtr++ = pixel; + } + } + } + } else { + fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY), + SEEK_SET); + fread(buf, 1, raw->sizeX, raw->file); + } +} + + +static void RawImageGetData(rawImageRec *raw, TK_RGBImageRec *final) +{ + unsigned char *ptr; + int i, j; + + final->data = (unsigned char *)malloc((raw->sizeX+1)*(raw->sizeY+1)*4); + if (final->data == NULL) { + fprintf(stderr, "Out of memory!\n"); + } + + ptr = final->data; + for (i = 0; i < (int)(raw->sizeY); i++) { + RawImageGetRow(raw, raw->tmpR, i, 0); + RawImageGetRow(raw, raw->tmpG, i, 1); + RawImageGetRow(raw, raw->tmpB, i, 2); + if (raw->sizeZ>3) { + RawImageGetRow(raw, raw->tmpA, i, 3); + } + for (j = 0; j < (int)(raw->sizeX); j++) { + *ptr++ = *(raw->tmpR + j); + *ptr++ = *(raw->tmpG + j); + *ptr++ = *(raw->tmpB + j); + if (raw->sizeZ>3) { + *ptr++ = *(raw->tmpA + j); + } + } + } +} + + +static TK_RGBImageRec *tkRGBImageLoad(const char *fileName) +{ + rawImageRec *raw; + TK_RGBImageRec *final; + + raw = RawImageOpen(fileName); + if (!raw) { + fprintf(stderr, "File not found\n"); + return NULL; + } + final = (TK_RGBImageRec *)malloc(sizeof(TK_RGBImageRec)); + if (final == NULL) { + fprintf(stderr, "Out of memory!\n"); + return NULL; + } + final->sizeX = raw->sizeX; + final->sizeY = raw->sizeY; + final->components = raw->sizeZ; + RawImageGetData(raw, final); + RawImageClose(raw); + return final; +} + + +static void FreeImage( TK_RGBImageRec *image ) +{ + free(image->data); + free(image); +} + + +/* + * Load an SGI .rgb file and generate a set of 2-D mipmaps from it. + * Input: imageFile - name of .rgb to read + * intFormat - internal texture format to use, or number of components + * Return: GL_TRUE if success, GL_FALSE if error. + */ +GLboolean LoadRGBMipmaps( const char *imageFile, GLint intFormat ) +{ + GLint w, h; + return LoadRGBMipmaps2( imageFile, GL_TEXTURE_2D, intFormat, &w, &h ); +} + + + +GLboolean LoadRGBMipmaps2( const char *imageFile, GLenum target, + GLint intFormat, GLint *width, GLint *height ) +{ + GLint error; + GLenum format; + TK_RGBImageRec *image; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return GL_FALSE; + } + + if (image->components==3) { + format = GL_RGB; + } + else if (image->components==4) { + format = GL_RGBA; + } + else { + /* not implemented */ + fprintf(stderr, + "Error in LoadRGBMipmaps %d-component images not implemented\n", + image->components ); + return GL_FALSE; + } + + error = gluBuild2DMipmaps( target, + intFormat, + image->sizeX, image->sizeY, + format, + GL_UNSIGNED_BYTE, + image->data ); + + *width = image->sizeX; + *height = image->sizeY; + + FreeImage(image); + + return error ? GL_FALSE : GL_TRUE; +} + + + +/* + * Load an SGI .rgb file and return a pointer to the image data. + * Input: imageFile - name of .rgb to read + * Output: width - width of image + * height - height of image + * format - format of image (GL_RGB or GL_RGBA) + * Return: pointer to image data or NULL if error + */ +GLubyte *LoadRGBImage( const char *imageFile, GLint *width, GLint *height, + GLenum *format ) +{ + TK_RGBImageRec *image; + GLint bytes; + GLubyte *buffer; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return NULL; + } + + if (image->components==3) { + *format = GL_RGB; + } + else if (image->components==4) { + *format = GL_RGBA; + } + else { + /* not implemented */ + fprintf(stderr, + "Error in LoadRGBImage %d-component images not implemented\n", + image->components ); + return NULL; + } + + *width = image->sizeX; + *height = image->sizeY; + + bytes = image->sizeX * image->sizeY * image->components; + buffer = (GLubyte *) malloc(bytes); + if (!buffer) + return NULL; + + memcpy( (void *) buffer, (void *) image->data, bytes ); + + FreeImage(image); + + return buffer; +} + +#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) + + +static void ConvertRGBtoYUV(GLint w, GLint h, GLint texel_bytes, + const GLubyte *src, + GLushort *dest) +{ + GLint i, j; + + for (i = 0; i < h; i++) { + for (j = 0; j < w; j++) { + const GLfloat r = (src[0]) / 255.0; + const GLfloat g = (src[1]) / 255.0; + const GLfloat b = (src[2]) / 255.0; + GLfloat y, cr, cb; + GLint iy, icr, icb; + + y = r * 65.481 + g * 128.553 + b * 24.966 + 16; + cb = r * -37.797 + g * -74.203 + b * 112.0 + 128; + cr = r * 112.0 + g * -93.786 + b * -18.214 + 128; + /*printf("%f %f %f -> %f %f %f\n", r, g, b, y, cb, cr);*/ + iy = (GLint) CLAMP(y, 0, 254); + icb = (GLint) CLAMP(cb, 0, 254); + icr = (GLint) CLAMP(cr, 0, 254); + + if (j & 1) { + /* odd */ + *dest = (iy << 8) | icr; + } + else { + /* even */ + *dest = (iy << 8) | icb; + } + dest++; + src += texel_bytes; + } + } +} + + +/* + * Load an SGI .rgb file and return a pointer to the image data, converted + * to 422 yuv. + * + * Input: imageFile - name of .rgb to read + * Output: width - width of image + * height - height of image + * Return: pointer to image data or NULL if error + */ +GLushort *LoadYUVImage( const char *imageFile, GLint *width, GLint *height ) +{ + TK_RGBImageRec *image; + GLushort *buffer; + + image = tkRGBImageLoad( imageFile ); + if (!image) { + return NULL; + } + + if (image->components != 3 && image->components !=4 ) { + /* not implemented */ + fprintf(stderr, + "Error in LoadYUVImage %d-component images not implemented\n", + image->components ); + return NULL; + } + + *width = image->sizeX; + *height = image->sizeY; + + buffer = (GLushort *) malloc( image->sizeX * image->sizeY * 2 ); + + if (buffer) + ConvertRGBtoYUV( image->sizeX, + image->sizeY, + image->components, + image->data, + buffer ); + + + FreeImage(image); + return buffer; +} + diff --git a/mesalib/progs/util/readtex.h b/mesalib/progs/util/readtex.h new file mode 100644 index 000000000..6c9a3828d --- /dev/null +++ b/mesalib/progs/util/readtex.h @@ -0,0 +1,26 @@ +/* readtex.h */ + +#ifndef READTEX_H +#define READTEX_H + + +#include + + +extern GLboolean +LoadRGBMipmaps( const char *imageFile, GLint intFormat ); + + +extern GLboolean +LoadRGBMipmaps2( const char *imageFile, GLenum target, + GLint intFormat, GLint *width, GLint *height ); + + +extern GLubyte * +LoadRGBImage( const char *imageFile, + GLint *width, GLint *height, GLenum *format ); + +extern GLushort * +LoadYUVImage( const char *imageFile, GLint *width, GLint *height ); + +#endif diff --git a/mesalib/progs/util/sampleMakefile b/mesalib/progs/util/sampleMakefile new file mode 100644 index 000000000..71ec150b8 --- /dev/null +++ b/mesalib/progs/util/sampleMakefile @@ -0,0 +1,47 @@ + +# Sample makefile for compiling OpenGL/Mesa applications on Unix. +# This example assumes Linux with gcc. + +# This makefile is in the public domain + +# Revision 1.1 1999/08/19 00:55:42 jtg +# Initial revision +# +# Revision 1.1 1999/02/24 05:20:45 brianp +# Initial revision +# + + +CC = gcc + +CFLAGS = -c -g -ansi -pedantic -Wall + +INCDIRS = -I. -I../include + +LIBDIRS = -L../lib -L/usr/X11/lib + +LIBS = -lglut -lMesaGLU -lMesaGL -lX11 -lXext -lXmu -lXt -lXi -lSM -lICE -lm + +OBJECTS = main.o \ + file1.o \ + file2.o \ + file3.o + + +PROGRAMS = myprogram + + +.c.o: + $(CC) $(CFLAGS) $(INCDIRS) $< -o $@ + + + +default: $(PROGRAMS) + + +dtenvmap: $(OBJECTS) + $(CC) $(OBJECTS) $(LIBDIRS) $(LIBS) -o $@ + + +clean: + rm -f *.o diff --git a/mesalib/progs/util/shaderutil.c b/mesalib/progs/util/shaderutil.c new file mode 100644 index 000000000..4db950016 --- /dev/null +++ b/mesalib/progs/util/shaderutil.c @@ -0,0 +1,315 @@ +/** + * Utilities for OpenGL shading language + * + * Brian Paul + * 9 April 2008 + */ + + +#include +#include +#include +#include +#include +#include +#include "shaderutil.h" + +/** time to compile previous shader */ +static GLdouble CompileTime = 0.0; + +/** time to linke previous program */ +static GLdouble LinkTime = 0.0; + + +GLboolean +ShadersSupported(void) +{ + const char *version = (const char *) glGetString(GL_VERSION); + if (version[0] == '2' && version[1] == '.') { + return GL_TRUE; + } + else if (glutExtensionSupported("GL_ARB_vertex_shader") + && glutExtensionSupported("GL_ARB_fragment_shader") + && glutExtensionSupported("GL_ARB_shader_objects")) { + fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x. This may not work.\n"); + return GL_TRUE; + } + return GL_TRUE; +} + + +GLuint +CompileShaderText(GLenum shaderType, const char *text) +{ + GLuint shader; + GLint stat; + GLdouble t0, t1; + + shader = glCreateShader(shaderType); + glShaderSource(shader, 1, (const GLchar **) &text, NULL); + + t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + glCompileShader(shader); + t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + + CompileTime = t1 - t0; + + glGetShaderiv(shader, GL_COMPILE_STATUS, &stat); + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetShaderInfoLog(shader, 1000, &len, log); + fprintf(stderr, "Error: problem compiling shader: %s\n", log); + exit(1); + } + else { + /*printf("Shader compiled OK\n");*/ + } + return shader; +} + + +/** + * Read a shader from a file. + */ +GLuint +CompileShaderFile(GLenum shaderType, const char *filename) +{ + const int max = 100*1000; + int n; + char *buffer = (char*) malloc(max); + GLuint shader; + FILE *f; + + f = fopen(filename, "r"); + if (!f) { + fprintf(stderr, "Unable to open shader file %s\n", filename); + return 0; + } + + n = fread(buffer, 1, max, f); + /*printf("read %d bytes from shader file %s\n", n, filename);*/ + if (n > 0) { + buffer[n] = 0; + shader = CompileShaderText(shaderType, buffer); + } + else { + return 0; + } + + fclose(f); + free(buffer); + + return shader; +} + + +GLuint +LinkShaders(GLuint vertShader, GLuint fragShader) +{ + GLuint program = glCreateProgram(); + GLdouble t0, t1; + + assert(vertShader || fragShader); + + if (fragShader) + glAttachShader(program, fragShader); + if (vertShader) + glAttachShader(program, vertShader); + + t0 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + glLinkProgram(program); + t1 = glutGet(GLUT_ELAPSED_TIME) * 0.001; + + LinkTime = t1 - t0; + + /* check link */ + { + GLint stat; + glGetProgramiv(program, GL_LINK_STATUS, &stat); + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetProgramInfoLog(program, 1000, &len, log); + fprintf(stderr, "Shader link error:\n%s\n", log); + return 0; + } + } + + return program; +} + + +GLboolean +ValidateShaderProgram(GLuint program) +{ + GLint stat; + glValidateProgramARB(program); + glGetProgramiv(program, GL_VALIDATE_STATUS, &stat); + + if (!stat) { + GLchar log[1000]; + GLsizei len; + glGetProgramInfoLog(program, 1000, &len, log); + fprintf(stderr, "Program validation error:\n%s\n", log); + return 0; + } + + return (GLboolean) stat; +} + + +GLdouble +GetShaderCompileTime(void) +{ + return CompileTime; +} + + +GLdouble +GetShaderLinkTime(void) +{ + return LinkTime; +} + + +void +SetUniformValues(GLuint program, struct uniform_info uniforms[]) +{ + GLuint i; + + for (i = 0; uniforms[i].name; i++) { + uniforms[i].location + = glGetUniformLocation(program, uniforms[i].name); + + switch (uniforms[i].type) { + case GL_INT: + case GL_SAMPLER_1D: + case GL_SAMPLER_2D: + case GL_SAMPLER_3D: + case GL_SAMPLER_CUBE: + case GL_SAMPLER_2D_RECT_ARB: + assert(uniforms[i].value[0] >= 0.0F); + glUniform1i(uniforms[i].location, + (GLint) uniforms[i].value[0]); + break; + case GL_FLOAT: + glUniform1fv(uniforms[i].location, 1, uniforms[i].value); + break; + case GL_FLOAT_VEC2: + glUniform2fv(uniforms[i].location, 1, uniforms[i].value); + break; + case GL_FLOAT_VEC3: + glUniform3fv(uniforms[i].location, 1, uniforms[i].value); + break; + case GL_FLOAT_VEC4: + glUniform4fv(uniforms[i].location, 1, uniforms[i].value); + break; + default: + if (strncmp(uniforms[i].name, "gl_", 3) == 0) { + /* built-in uniform: ignore */ + } + else { + fprintf(stderr, + "Unexpected uniform data type in SetUniformValues\n"); + abort(); + } + } + } +} + + +/** Get list of uniforms used in the program */ +GLuint +GetUniforms(GLuint program, struct uniform_info uniforms[]) +{ + GLint n, max, i; + + glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &n); + glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max); + + for (i = 0; i < n; i++) { + GLint size, len; + GLenum type; + char name[100]; + + glGetActiveUniform(program, i, 100, &len, &size, &type, name); + + uniforms[i].name = strdup(name); + uniforms[i].size = size; + uniforms[i].type = type; + uniforms[i].location = glGetUniformLocation(program, name); + } + + uniforms[i].name = NULL; /* end of list */ + + return n; +} + + +void +PrintUniforms(const struct uniform_info uniforms[]) +{ + GLint i; + + printf("Uniforms:\n"); + + for (i = 0; uniforms[i].name; i++) { + printf(" %d: %s size=%d type=0x%x loc=%d value=%g, %g, %g, %g\n", + i, + uniforms[i].name, + uniforms[i].size, + uniforms[i].type, + uniforms[i].location, + uniforms[i].value[0], + uniforms[i].value[1], + uniforms[i].value[2], + uniforms[i].value[3]); + } +} + + +/** Get list of attribs used in the program */ +GLuint +GetAttribs(GLuint program, struct attrib_info attribs[]) +{ + GLint n, max, i; + + glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &n); + glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max); + + for (i = 0; i < n; i++) { + GLint size, len; + GLenum type; + char name[100]; + + glGetActiveAttrib(program, i, 100, &len, &size, &type, name); + + attribs[i].name = strdup(name); + attribs[i].size = size; + attribs[i].type = type; + attribs[i].location = glGetAttribLocation(program, name); + } + + attribs[i].name = NULL; /* end of list */ + + return n; +} + + +void +PrintAttribs(const struct attrib_info attribs[]) +{ + GLint i; + + printf("Attribs:\n"); + + for (i = 0; attribs[i].name; i++) { + printf(" %d: %s size=%d type=0x%x loc=%d\n", + i, + attribs[i].name, + attribs[i].size, + attribs[i].type, + attribs[i].location); + } +} diff --git a/mesalib/progs/util/shaderutil.h b/mesalib/progs/util/shaderutil.h new file mode 100644 index 000000000..98c718115 --- /dev/null +++ b/mesalib/progs/util/shaderutil.h @@ -0,0 +1,63 @@ +#ifndef SHADER_UTIL_H +#define SHADER_UTIL_H + + + +struct uniform_info +{ + const char *name; + GLuint size; /**< number of value[] elements: 1, 2, 3 or 4 */ + GLenum type; /**< GL_FLOAT, GL_FLOAT_VEC4, GL_INT, etc */ + GLfloat value[4]; + GLint location; /**< filled in by InitUniforms() */ +}; + +#define END_OF_UNIFORMS { NULL, 0, GL_NONE, { 0, 0, 0, 0 }, -1 } + + +struct attrib_info +{ + const char *name; + GLuint size; /**< number of value[] elements: 1, 2, 3 or 4 */ + GLenum type; /**< GL_FLOAT, GL_FLOAT_VEC4, GL_INT, etc */ + GLint location; +}; + + +extern GLboolean +ShadersSupported(void); + +extern GLuint +CompileShaderText(GLenum shaderType, const char *text); + +extern GLuint +CompileShaderFile(GLenum shaderType, const char *filename); + +extern GLuint +LinkShaders(GLuint vertShader, GLuint fragShader); + +extern GLboolean +ValidateShaderProgram(GLuint program); + +extern GLdouble +GetShaderCompileTime(void); + +extern GLdouble +GetShaderLinkTime(void); + +extern void +SetUniformValues(GLuint program, struct uniform_info uniforms[]); + +extern GLuint +GetUniforms(GLuint program, struct uniform_info uniforms[]); + +extern void +PrintUniforms(const struct uniform_info uniforms[]); + +extern GLuint +GetAttribs(GLuint program, struct attrib_info attribs[]); + +extern void +PrintAttribs(const struct attrib_info attribs[]); + +#endif /* SHADER_UTIL_H */ diff --git a/mesalib/progs/util/showbuffer.c b/mesalib/progs/util/showbuffer.c new file mode 100644 index 000000000..b0cedea21 --- /dev/null +++ b/mesalib/progs/util/showbuffer.c @@ -0,0 +1,198 @@ +/* showbuffer.c */ + + +/* + * Copy the depth buffer to the color buffer as a grayscale image. + * Useful for inspecting the depth buffer values. + * + * This program is in the public domain. + * + * Brian Paul November 4, 1998 + */ + + +#include +#include +#include +#include "showbuffer.h" + + + +/* + * Copy the depth buffer values into the current color buffer as a + * grayscale image. + * Input: winWidth, winHeight - size of the window + * zBlack - the Z value which should map to black (usually 1) + * zWhite - the Z value which should map to white (usually 0) + */ +void +ShowDepthBuffer( GLsizei winWidth, GLsizei winHeight, + GLfloat zBlack, GLfloat zWhite ) +{ + GLfloat *depthValues; + + assert(zBlack >= 0.0); + assert(zBlack <= 1.0); + assert(zWhite >= 0.0); + assert(zWhite <= 1.0); + assert(zBlack != zWhite); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + /* Read depth values */ + depthValues = (GLfloat *) malloc(winWidth * winHeight * sizeof(GLfloat)); + assert(depthValues); + glReadPixels(0, 0, winWidth, winHeight, GL_DEPTH_COMPONENT, + GL_FLOAT, depthValues); + + /* Map Z values from [zBlack, zWhite] to gray levels in [0, 1] */ + /* Not using glPixelTransfer() because it's broke on some systems! */ + if (zBlack != 0.0 || zWhite != 1.0) { + GLfloat scale = 1.0 / (zWhite - zBlack); + GLfloat bias = -zBlack * scale; + int n = winWidth * winHeight; + int i; + for (i = 0; i < n; i++) + depthValues[i] = depthValues[i] * scale + bias; + } + + /* save GL state */ + glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | + GL_TRANSFORM_BIT | GL_VIEWPORT_BIT); + + /* setup raster pos for glDrawPixels */ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + glOrtho(0.0, (GLdouble) winWidth, 0.0, (GLdouble) winHeight, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glViewport(0, 0, winWidth, winHeight); + + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glRasterPos2f(0, 0); + + glDrawPixels(winWidth, winHeight, GL_LUMINANCE, GL_FLOAT, depthValues); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + free(depthValues); + + glPopAttrib(); +} + + + + +/* + * Copy the alpha channel values into the current color buffer as a + * grayscale image. + * Input: winWidth, winHeight - size of the window + */ +void +ShowAlphaBuffer( GLsizei winWidth, GLsizei winHeight ) +{ + GLubyte *alphaValues; + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + /* Read alpha values */ + alphaValues = (GLubyte *) malloc(winWidth * winHeight * sizeof(GLubyte)); + assert(alphaValues); + glReadPixels(0, 0, winWidth, winHeight, GL_ALPHA, GL_UNSIGNED_BYTE, alphaValues); + + /* save GL state */ + glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL | + GL_TRANSFORM_BIT | GL_VIEWPORT_BIT); + + /* setup raster pos for glDrawPixels */ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + glOrtho(0.0, (GLdouble) winWidth, 0.0, (GLdouble) winHeight, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glViewport(0, 0, winWidth, winHeight); + + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glRasterPos2f(0, 0); + + glDrawPixels(winWidth, winHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, alphaValues); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + free(alphaValues); + + glPopAttrib(); +} + + + +/* + * Copy the stencil buffer values into the current color buffer as a + * grayscale image. + * Input: winWidth, winHeight - size of the window + * scale, bias - scale and bias to apply to stencil values for display + */ +void +ShowStencilBuffer( GLsizei winWidth, GLsizei winHeight, + GLfloat scale, GLfloat bias ) +{ + GLubyte *stencilValues; + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + + /* Read stencil values */ + stencilValues = (GLubyte *) malloc(winWidth * winHeight * sizeof(GLubyte)); + assert(stencilValues); + glReadPixels(0, 0, winWidth, winHeight, GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, stencilValues); + + /* save GL state */ + glPushAttrib(GL_CURRENT_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | + GL_PIXEL_MODE_BIT | GL_TRANSFORM_BIT | GL_VIEWPORT_BIT); + + /* setup raster pos for glDrawPixels */ + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + + glOrtho(0.0, (GLdouble) winWidth, 0.0, (GLdouble) winHeight, -1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + glLoadIdentity(); + + glViewport(0, 0, winWidth, winHeight); + + glDisable(GL_STENCIL_TEST); + glDisable(GL_DEPTH_TEST); + glRasterPos2f(0, 0); + + glPixelTransferf(GL_RED_SCALE, scale); + glPixelTransferf(GL_RED_BIAS, bias); + glPixelTransferf(GL_GREEN_SCALE, scale); + glPixelTransferf(GL_GREEN_BIAS, bias); + glPixelTransferf(GL_BLUE_SCALE, scale); + glPixelTransferf(GL_BLUE_BIAS, bias); + + glDrawPixels(winWidth, winHeight, GL_LUMINANCE, GL_UNSIGNED_BYTE, stencilValues); + + glPopMatrix(); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + free(stencilValues); + + glPopAttrib(); +} diff --git a/mesalib/progs/util/showbuffer.h b/mesalib/progs/util/showbuffer.h new file mode 100644 index 000000000..63533d8e9 --- /dev/null +++ b/mesalib/progs/util/showbuffer.h @@ -0,0 +1,36 @@ +/* showbuffer. h*/ + +/* + * Copy the depth buffer to the color buffer as a grayscale image. + * Useful for inspecting the depth buffer values. + * + * This program is in the public domain. + * + * Brian Paul November 4, 1998 + */ + + +#ifndef SHOWBUFFER_H +#define SHOWBUFFER_H + + +#include + + + +extern void +ShowDepthBuffer( GLsizei winWidth, GLsizei winHeight, + GLfloat zBlack, GLfloat zWhite ); + + +extern void +ShowAlphaBuffer( GLsizei winWidth, GLsizei winHeight ); + + +extern void +ShowStencilBuffer( GLsizei winWidth, GLsizei winHeight, + GLfloat scale, GLfloat bias ); + + + +#endif diff --git a/mesalib/progs/util/trackball.c b/mesalib/progs/util/trackball.c new file mode 100644 index 000000000..a6c4c60d0 --- /dev/null +++ b/mesalib/progs/util/trackball.c @@ -0,0 +1,338 @@ +#include +/* + * (c) Copyright 1993, 1994, Silicon Graphics, Inc. + * ALL RIGHTS RESERVED + * Permission to use, copy, modify, and distribute this software for + * any purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation, and that + * the name of Silicon Graphics, Inc. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. + * + * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" + * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR + * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON + * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, + * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY + * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, + * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF + * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN + * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE + * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. + * + * US Government Users Restricted Rights + * Use, duplication, or disclosure by the Government is subject to + * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph + * (c)(1)(ii) of the Rights in Technical Data and Computer Software + * clause at DFARS 252.227-7013 and/or in similar or successor + * clauses in the FAR or the DOD or NASA FAR Supplement. + * Unpublished-- rights reserved under the copyright laws of the + * United States. Contractor/manufacturer is Silicon Graphics, + * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. + * + * OpenGL(TM) is a trademark of Silicon Graphics, Inc. + */ +/* + * Trackball code: + * + * Implementation of a virtual trackball. + * Implemented by Gavin Bell, lots of ideas from Thant Tessman and + * the August '88 issue of Siggraph's "Computer Graphics," pp. 121-129. + * + * Vector manip code: + * + * Original code from: + * David M. Ciemiewicz, Mark Grossman, Henry Moreton, and Paul Haeberli + * + * Much mucking with by: + * Gavin Bell + */ +#if defined(_WIN32) +#pragma warning (disable:4244) /* disable bogus conversion warnings */ +#endif +#include +#include "trackball.h" + +/* + * This size should really be based on the distance from the center of + * rotation to the point on the object underneath the mouse. That + * point would then track the mouse as closely as possible. This is a + * simple example, though, so that is left as an Exercise for the + * Programmer. + */ +#define TRACKBALLSIZE (0.8f) + +/* + * Local function prototypes (not defined in trackball.h) + */ +static float tb_project_to_sphere(float, float, float); +static void normalize_quat(float [4]); + +static void +vzero(float v[3]) +{ + v[0] = 0.0; + v[1] = 0.0; + v[2] = 0.0; +} + +static void +vset(float v[3], float x, float y, float z) +{ + v[0] = x; + v[1] = y; + v[2] = z; +} + +static void +vsub(const float src1[3], const float src2[3], float dst[3]) +{ + dst[0] = src1[0] - src2[0]; + dst[1] = src1[1] - src2[1]; + dst[2] = src1[2] - src2[2]; +} + +static void +vcopy(const float v1[3], float v2[3]) +{ + register int i; + for (i = 0 ; i < 3 ; i++) + v2[i] = v1[i]; +} + +static void +vcross(const float v1[3], const float v2[3], float cross[3]) +{ + float temp[3]; + + temp[0] = (v1[1] * v2[2]) - (v1[2] * v2[1]); + temp[1] = (v1[2] * v2[0]) - (v1[0] * v2[2]); + temp[2] = (v1[0] * v2[1]) - (v1[1] * v2[0]); + vcopy(temp, cross); +} + +static float +vlength(const float v[3]) +{ + return sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); +} + +static void +vscale(float v[3], float div) +{ + v[0] *= div; + v[1] *= div; + v[2] *= div; +} + +static void +vnormal(float v[3]) +{ + vscale(v,1.0/vlength(v)); +} + +static float +vdot(const float v1[3], const float v2[3]) +{ + return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; +} + +static void +vadd(const float src1[3], const float src2[3], float dst[3]) +{ + dst[0] = src1[0] + src2[0]; + dst[1] = src1[1] + src2[1]; + dst[2] = src1[2] + src2[2]; +} + +/* + * Ok, simulate a track-ball. Project the points onto the virtual + * trackball, then figure out the axis of rotation, which is the cross + * product of P1 P2 and O P1 (O is the center of the ball, 0,0,0) + * Note: This is a deformed trackball-- is a trackball in the center, + * but is deformed into a hyperbolic sheet of rotation away from the + * center. This particular function was chosen after trying out + * several variations. + * + * It is assumed that the arguments to this routine are in the range + * (-1.0 ... 1.0) + */ +void +trackball(float q[4], float p1x, float p1y, float p2x, float p2y) +{ + float a[3]; /* Axis of rotation */ + float phi; /* how much to rotate about axis */ + float p1[3], p2[3], d[3]; + float t; + + if (p1x == p2x && p1y == p2y) { + /* Zero rotation */ + vzero(q); + q[3] = 1.0; + return; + } + + /* + * First, figure out z-coordinates for projection of P1 and P2 to + * deformed sphere + */ + vset(p1,p1x,p1y,tb_project_to_sphere(TRACKBALLSIZE,p1x,p1y)); + vset(p2,p2x,p2y,tb_project_to_sphere(TRACKBALLSIZE,p2x,p2y)); + + /* + * Now, we want the cross product of P1 and P2 + */ + vcross(p2,p1,a); + + /* + * Figure out how much to rotate around that axis. + */ + vsub(p1,p2,d); + t = vlength(d) / (2.0*TRACKBALLSIZE); + + /* + * Avoid problems with out-of-control values... + */ + if (t > 1.0) t = 1.0; + if (t < -1.0) t = -1.0; + phi = 2.0 * asin(t); + + axis_to_quat(a,phi,q); +} + +/* + * Given an axis and angle, compute quaternion. + */ +void +axis_to_quat(const float a[3], float phi, float q[4]) +{ + vcopy(a,q); + vnormal(q); + vscale(q, sin(phi/2.0)); + q[3] = cos(phi/2.0); +} + +/* + * Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet + * if we are away from the center of the sphere. + */ +static float +tb_project_to_sphere(float r, float x, float y) +{ + float d, t, z; + + d = sqrt(x*x + y*y); + if (d < r * 0.70710678118654752440) { /* Inside sphere */ + z = sqrt(r*r - d*d); + } else { /* On hyperbola */ + t = r / 1.41421356237309504880; + z = t*t / d; + } + return z; +} + +/* + * Given two rotations, e1 and e2, expressed as quaternion rotations, + * figure out the equivalent single rotation and stuff it into dest. + * + * This routine also normalizes the result every RENORMCOUNT times it is + * called, to keep error from creeping in. + * + * NOTE: This routine is written so that q1 or q2 may be the same + * as dest (or each other). + */ + +#define RENORMCOUNT 97 + +void +add_quats(const float q1[4], const float q2[4], float dest[4]) +{ + static int count=0; + float t1[4], t2[4], t3[4]; + float tf[4]; + +#if 0 +printf("q1 = %f %f %f %f\n", q1[0], q1[1], q1[2], q1[3]); +printf("q2 = %f %f %f %f\n", q2[0], q2[1], q2[2], q2[3]); +#endif + + vcopy(q1,t1); + vscale(t1,q2[3]); + + vcopy(q2,t2); + vscale(t2,q1[3]); + + vcross(q2,q1,t3); + vadd(t1,t2,tf); + vadd(t3,tf,tf); + tf[3] = q1[3] * q2[3] - vdot(q1,q2); + +#if 0 +printf("tf = %f %f %f %f\n", tf[0], tf[1], tf[2], tf[3]); +#endif + + dest[0] = tf[0]; + dest[1] = tf[1]; + dest[2] = tf[2]; + dest[3] = tf[3]; + + if (++count > RENORMCOUNT) { + count = 0; + normalize_quat(dest); + } +} + +/* + * Quaternions always obey: a^2 + b^2 + c^2 + d^2 = 1.0 + * If they don't add up to 1.0, dividing by their magnitued will + * renormalize them. + * + * Note: See the following for more information on quaternions: + * + * - Shoemake, K., Animating rotation with quaternion curves, Computer + * Graphics 19, No 3 (Proc. SIGGRAPH'85), 245-254, 1985. + * - Pletinckx, D., Quaternion calculus as a basic tool in computer + * graphics, The Visual Computer 5, 2-13, 1989. + */ +static void +normalize_quat(float q[4]) +{ + int i; + float mag; + + mag = sqrt(q[0]*q[0] + q[1]*q[1] + q[2]*q[2] + q[3]*q[3]); + for (i = 0; i < 4; i++) + q[i] /= mag; +} + +/* + * Build a rotation matrix, given a quaternion rotation. + * + */ +void +build_rotmatrix(float m[4][4], const float q[4]) +{ + m[0][0] = 1.0 - 2.0 * (q[1] * q[1] + q[2] * q[2]); + m[0][1] = 2.0 * (q[0] * q[1] - q[2] * q[3]); + m[0][2] = 2.0 * (q[2] * q[0] + q[1] * q[3]); + m[0][3] = 0.0; + + m[1][0] = 2.0 * (q[0] * q[1] + q[2] * q[3]); + m[1][1]= 1.0 - 2.0 * (q[2] * q[2] + q[0] * q[0]); + m[1][2] = 2.0 * (q[1] * q[2] - q[0] * q[3]); + m[1][3] = 0.0; + + m[2][0] = 2.0 * (q[2] * q[0] - q[1] * q[3]); + m[2][1] = 2.0 * (q[1] * q[2] + q[0] * q[3]); + m[2][2] = 1.0 - 2.0 * (q[1] * q[1] + q[0] * q[0]); + m[2][3] = 0.0; + + m[3][0] = 0.0; + m[3][1] = 0.0; + m[3][2] = 0.0; + m[3][3] = 1.0; +} + diff --git a/mesalib/progs/util/trackball.h b/mesalib/progs/util/trackball.h new file mode 100644 index 000000000..9b278640e --- /dev/null +++ b/mesalib/progs/util/trackball.h @@ -0,0 +1,84 @@ +/* + * (c) Copyright 1993, 1994, Silicon Graphics, Inc. + * ALL RIGHTS RESERVED + * Permission to use, copy, modify, and distribute this software for + * any purpose and without fee is hereby granted, provided that the above + * copyright notice appear in all copies and that both the copyright notice + * and this permission notice appear in supporting documentation, and that + * the name of Silicon Graphics, Inc. not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. + * + * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" + * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR + * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON + * GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, + * SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY + * KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, + * LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF + * THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN + * ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE + * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. + * + * US Government Users Restricted Rights + * Use, duplication, or disclosure by the Government is subject to + * restrictions set forth in FAR 52.227.19(c)(2) or subparagraph + * (c)(1)(ii) of the Rights in Technical Data and Computer Software + * clause at DFARS 252.227-7013 and/or in similar or successor + * clauses in the FAR or the DOD or NASA FAR Supplement. + * Unpublished-- rights reserved under the copyright laws of the + * United States. Contractor/manufacturer is Silicon Graphics, + * Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311. + * + * OpenGL(TM) is a trademark of Silicon Graphics, Inc. + */ +/* + * trackball.h + * A virtual trackball implementation + * Written by Gavin Bell for Silicon Graphics, November 1988. + */ + +#ifndef TRACKBALL_H +#define TRACKBALL_H + + +/* + * Pass the x and y coordinates of the last and current positions of + * the mouse, scaled so they are from (-1.0 ... 1.0). + * + * The resulting rotation is returned as a quaternion rotation in the + * first paramater. + */ +void +trackball(float q[4], float p1x, float p1y, float p2x, float p2y); + +/* + * Given two quaternions, add them together to get a third quaternion. + * Adding quaternions to get a compound rotation is analagous to adding + * translations to get a compound translation. When incrementally + * adding rotations, the first argument here should be the new + * rotation, the second and third the total rotation (which will be + * over-written with the resulting new total rotation). + */ +void +add_quats(const float q1[4], const float q2[4], float dest[4]); + +/* + * A useful function, builds a rotation matrix in Matrix based on + * given quaternion. + */ +void +build_rotmatrix(float m[4][4], const float q[4]); + +/* + * This function computes a quaternion based on an axis (defined by + * the given vector) and an angle about which to rotate. The angle is + * expressed in radians. The result is put into the third argument. + */ +void +axis_to_quat(const float a[3], float phi, float q[4]); + + +#endif /* TRACKBALL_H */ diff --git a/mesalib/progs/util/winpos.c b/mesalib/progs/util/winpos.c new file mode 100644 index 000000000..5ad98fd27 --- /dev/null +++ b/mesalib/progs/util/winpos.c @@ -0,0 +1,42 @@ +/* winpos.c */ + + +/* + * Set the current raster position to a specific window + * coordinate. Also see the GL_MESA_window_pos extension. + * + * Written by Brian Paul and in the public domain. + */ + + +void WindowPos( GLfloat x, GLfloat y, GLfloat z ) +{ + GLfloat fx, fy; + + /* Push current matrix mode and viewport attributes */ + glPushAttrib( GL_TRANSFORM_BIT | GL_VIEWPORT_BIT ); + + /* Setup projection parameters */ + glMatrixMode( GL_PROJECTION ); + glPushMatrix(); + glLoadIdentity(); + glMatrixMode( GL_MODELVIEW ); + glPushMatrix(); + glLoadIdentity(); + + glDepthRange( z, z ); + glViewport( (int) x - 1, (int) y - 1, 2, 2 ); + + /* set the raster (window) position */ + fx = x - (int) x; + fy = y - (int) y; + glRasterPos3f( fx, fy, 0.0 ); + + /* restore matrices, viewport and matrix mode */ + glPopMatrix(); + glMatrixMode( GL_PROJECTION ); + glPopMatrix(); + + glPopAttrib(); +} + diff --git a/mesalib/src/Makefile b/mesalib/src/Makefile new file mode 100644 index 000000000..4f65da0e3 --- /dev/null +++ b/mesalib/src/Makefile @@ -0,0 +1,40 @@ +# src/Makefile + +TOP = .. + +include $(TOP)/configs/current + +SUBDIRS = $(SRC_DIRS) + + +default: message $(TOP)/$(LIB_DIR) subdirs + + +message: + @echo "Making sources for" $(CONFIG_NAME) + + +subdirs: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1; \ + fi \ + done + +install: $(TOP)/$(LIB_DIR) + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) install) || exit 1 ; \ + fi \ + done + +$(TOP)/$(LIB_DIR): + -@test -d $(TOP)/$(LIB_DIR) || mkdir -p $(TOP)/$(LIB_DIR) + + +clean: + -@for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) ; \ + fi \ + done diff --git a/mesalib/src/glu/Makefile b/mesalib/src/glu/Makefile new file mode 100644 index 000000000..b26826597 --- /dev/null +++ b/mesalib/src/glu/Makefile @@ -0,0 +1,40 @@ +# src/glu/Makefile + +TOP = ../.. + +include $(TOP)/configs/current + + +SUBDIRS = $(GLU_DIRS) + + +default: $(TOP)/configs/current + @for dir in $(SUBDIRS) ; do \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + done + +# GLU pkg-config file +pcedit = sed \ + -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ + -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ + -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ + -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + -e 's,@GLU_PC_REQ@,$(GLU_PC_REQ),' \ + -e 's,@GLU_PC_REQ_PRIV@,$(GLU_PC_REQ_PRIV),' \ + -e 's,@GLU_PC_LIB_PRIV@,$(GLU_PC_LIB_PRIV),' \ + -e 's,@GLU_PC_CFLAGS@,$(GLU_PC_CFLAGS),' \ + -e 's,@GLU_LIB@,$(GLU_LIB),' +glu.pc: glu.pc.in + $(pcedit) $< > $@ + +install: glu.pc + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLU_LIB_GLOB) $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -m 644 glu.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + +clean: + -@for dir in $(SUBDIRS) ; do \ + (cd $$dir && $(MAKE) clean) ; \ + done + -rm -f *.pc diff --git a/mesalib/src/glu/glu.pc.in b/mesalib/src/glu/glu.pc.in new file mode 100644 index 000000000..f7d910982 --- /dev/null +++ b/mesalib/src/glu/glu.pc.in @@ -0,0 +1,13 @@ +prefix=@INSTALL_DIR@ +exec_prefix=${prefix} +libdir=@INSTALL_LIB_DIR@ +includedir=@INSTALL_INC_DIR@ + +Name: glu +Description: Mesa OpenGL Utility library +Requires: @GLU_PC_REQ@ +Requires.private: @GLU_PC_REQ_PRIV@ +Version: @VERSION@ +Libs: -L${libdir} -l@GLU_LIB@ +Libs.private: @GLU_PC_LIB_PRIV@ +Cflags: -I${includedir} @GLU_PC_CFLAGS@ diff --git a/mesalib/src/glu/sgi/Makefile b/mesalib/src/glu/sgi/Makefile new file mode 100644 index 000000000..20c3bed0c --- /dev/null +++ b/mesalib/src/glu/sgi/Makefile @@ -0,0 +1,149 @@ +# src/glu/sgi/Makefile + +.SUFFIXES : .cc + +TOP = ../../.. + +include $(TOP)/configs/current + +GLU_MAJOR = 1 +GLU_MINOR = 3 +GLU_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY) + +INCDIRS = -I$(TOP)/include -Iinclude -Iinternals -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess + +C_SOURCES = \ + libutil/error.c \ + libutil/glue.c \ + libutil/mipmap.c \ + libutil/project.c \ + libutil/quad.c \ + libutil/registry.c \ + libtess/dict.c \ + libtess/geom.c \ + libtess/memalloc.c \ + libtess/mesh.c \ + libtess/normal.c \ + libtess/priorityq.c \ + libtess/render.c \ + libtess/sweep.c \ + libtess/tess.c \ + libtess/tessmono.c + +CC_SOURCES = \ + libnurbs/interface/bezierEval.cc \ + libnurbs/interface/bezierPatch.cc \ + libnurbs/interface/bezierPatchMesh.cc \ + libnurbs/interface/glcurveval.cc \ + libnurbs/interface/glinterface.cc \ + libnurbs/interface/glrenderer.cc \ + libnurbs/interface/glsurfeval.cc \ + libnurbs/interface/incurveeval.cc \ + libnurbs/interface/insurfeval.cc \ + libnurbs/internals/arc.cc \ + libnurbs/internals/arcsorter.cc \ + libnurbs/internals/arctess.cc \ + libnurbs/internals/backend.cc \ + libnurbs/internals/basiccrveval.cc \ + libnurbs/internals/basicsurfeval.cc \ + libnurbs/internals/bin.cc \ + libnurbs/internals/bufpool.cc \ + libnurbs/internals/cachingeval.cc \ + libnurbs/internals/ccw.cc \ + libnurbs/internals/coveandtiler.cc \ + libnurbs/internals/curve.cc \ + libnurbs/internals/curvelist.cc \ + libnurbs/internals/curvesub.cc \ + libnurbs/internals/dataTransform.cc \ + libnurbs/internals/displaylist.cc \ + libnurbs/internals/flist.cc \ + libnurbs/internals/flistsorter.cc \ + libnurbs/internals/hull.cc \ + libnurbs/internals/intersect.cc \ + libnurbs/internals/knotvector.cc \ + libnurbs/internals/mapdesc.cc \ + libnurbs/internals/mapdescv.cc \ + libnurbs/internals/maplist.cc \ + libnurbs/internals/mesher.cc \ + libnurbs/internals/monoTriangulationBackend.cc \ + libnurbs/internals/monotonizer.cc \ + libnurbs/internals/mycode.cc \ + libnurbs/internals/nurbsinterfac.cc \ + libnurbs/internals/nurbstess.cc \ + libnurbs/internals/patch.cc \ + libnurbs/internals/patchlist.cc \ + libnurbs/internals/quilt.cc \ + libnurbs/internals/reader.cc \ + libnurbs/internals/renderhints.cc \ + libnurbs/internals/slicer.cc \ + libnurbs/internals/sorter.cc \ + libnurbs/internals/splitarcs.cc \ + libnurbs/internals/subdivider.cc \ + libnurbs/internals/tobezier.cc \ + libnurbs/internals/trimline.cc \ + libnurbs/internals/trimregion.cc \ + libnurbs/internals/trimvertpool.cc \ + libnurbs/internals/uarray.cc \ + libnurbs/internals/varray.cc \ + libnurbs/nurbtess/directedLine.cc \ + libnurbs/nurbtess/gridWrap.cc \ + libnurbs/nurbtess/monoChain.cc \ + libnurbs/nurbtess/monoPolyPart.cc \ + libnurbs/nurbtess/monoTriangulation.cc \ + libnurbs/nurbtess/partitionX.cc \ + libnurbs/nurbtess/partitionY.cc \ + libnurbs/nurbtess/polyDBG.cc \ + libnurbs/nurbtess/polyUtil.cc \ + libnurbs/nurbtess/primitiveStream.cc \ + libnurbs/nurbtess/quicksort.cc \ + libnurbs/nurbtess/rectBlock.cc \ + libnurbs/nurbtess/sampleComp.cc \ + libnurbs/nurbtess/sampleCompBot.cc \ + libnurbs/nurbtess/sampleCompRight.cc \ + libnurbs/nurbtess/sampleCompTop.cc \ + libnurbs/nurbtess/sampleMonoPoly.cc \ + libnurbs/nurbtess/sampledLine.cc \ + libnurbs/nurbtess/searchTree.cc + +SOURCES = $(C_SOURCES) $(CC_SOURCES) + +C_OBJECTS = $(C_SOURCES:.c=.o) +CC_OBJECTS = $(CC_SOURCES:.cc=.o) +OBJECTS = $(C_OBJECTS) $(CC_OBJECTS) + + +##### RULES ##### + +.c.o: + $(CC) -c $(INCDIRS) $(CFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@ + +.cc.o: + $(CXX) -c $(INCDIRS) $(CXXFLAGS) -DNDEBUG -DLIBRARYBUILD $< -o $@ + + +##### TARGETS ##### + +default: + @if [ "${CONFIG_NAME}" = "beos" ] ; then \ + echo "$(GLU_LIB_NAME) not build under BeOS, but integrated into ${GL_LIB_NAME}." ; \ + exit 0 ; \ + else \ + $(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) || exit 1 ; \ + fi + +$(TOP)/$(LIB_DIR): + -mkdir $(TOP)/$(LIB_DIR) + +# Make the library: +$(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME): $(OBJECTS) + $(MKLIB) -o $(GLU_LIB) -linker '$(CXX)' -ldflags '$(LDFLAGS)' \ + -major $(GLU_MAJOR) -minor $(GLU_MINOR) -patch $(GLU_TINY) \ + -cplusplus $(MKLIB_OPTIONS) -install $(TOP)/$(LIB_DIR) \ + -exports glu.exports -id $(INSTALL_LIB_DIR)/lib$(GLU_LIB).$(GLU_MAJOR).dylib \ + $(GLU_LIB_DEPS) $(OBJECTS) + + +clean: + -rm -f *.o */*.o */*/*.o + -rm -f *.lo */*.lo */*/*.lo + -rm -f *.la */*.la */*/*.la diff --git a/mesalib/src/glu/sgi/Makefile.mgw b/mesalib/src/glu/sgi/Makefile.mgw new file mode 100644 index 000000000..d00d97a3b --- /dev/null +++ b/mesalib/src/glu/sgi/Makefile.mgw @@ -0,0 +1,230 @@ +# Mesa 3-D graphics library +# Version: 5.1 +# +# Copyright (C) 1999-2003 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. + +# MinGW core makefile v1.4 for Mesa +# +# Copyright (C) 2002 - Daniel Borca +# Email : dborca@users.sourceforge.net +# Web : http://www.geocities.com/dborca + +# MinGW core-glu makefile updated for Mesa 7.0 +# +# Updated : by Heromyth, on 2007-7-21 +# Email : zxpmyth@yahoo.com.cn +# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. +# The others havn't been tested yet. +# 2) The generated DLLs are *not* compatible with the ones built +# with the other compilers like VC8, especially for GLUT. +# 3) Although more tests are needed, it can be used individually! + +# +# Available options: +# +# Environment variables: +# CFLAGS +# +# GLIDE path to Glide3 SDK; used with FX. +# default = $(TOP)/glide3 +# FX=1 build for 3dfx Glide3. Note that this disables +# compilation of most WMesa code and requires fxMesa. +# As a consequence, you'll need the Win32 Glide3 +# library to build any application. +# default = no +# ICD=1 build the installable client driver interface +# (windows opengl driver interface) +# default = no +# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). +# default = no +# +# Targets: +# all: build GL +# clean: remove object files +# + + + +.PHONY: all clean +.INTERMEDIATE: x86/gen_matypes.exe +.SUFFIXES: .rc .res + +# Set this to the prefix of your build tools, i.e. mingw32- +TOOLS_PREFIX = mingw32- + +TOP = ../../.. +LIBDIR = $(TOP)/lib + +LIB_NAME = glu32 +DLL_EXT = .dll +IMP_EXT = .a +LIB_PRE = lib +STRIP = -s + +AR = ar +ARFLAGS = crus +DLLTOOL = dlltool + +GLU_DLL = $(LIB_NAME)$(DLL_EXT) +GLU_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT) +GLU_DEF = $(LIB_NAME).def + +LDLIBS = -L$(LIBDIR) -lopengl32 +LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at + +CFLAGS += -DBUILD_GLU32 -D_DLL + + +CC = $(TOOLS_PREFIX)gcc +CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude +CXX = $(TOOLS_PREFIX)g++ +CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess + +AR = ar +ARFLAGS = crus + +UNLINK = del $(subst /,\,$(1)) +ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif +ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif + +C_SOURCES = \ + libutil/error.c \ + libutil/glue.c \ + libutil/mipmap.c \ + libutil/project.c \ + libutil/quad.c \ + libutil/registry.c \ + libtess/dict.c \ + libtess/geom.c \ + libtess/memalloc.c \ + libtess/mesh.c \ + libtess/normal.c \ + libtess/priorityq.c \ + libtess/render.c \ + libtess/sweep.c \ + libtess/tess.c \ + libtess/tessmono.c + +CC_SOURCES = \ + libnurbs/interface/bezierEval.cc \ + libnurbs/interface/bezierPatch.cc \ + libnurbs/interface/bezierPatchMesh.cc \ + libnurbs/interface/glcurveval.cc \ + libnurbs/interface/glinterface.cc \ + libnurbs/interface/glrenderer.cc \ + libnurbs/interface/glsurfeval.cc \ + libnurbs/interface/incurveeval.cc \ + libnurbs/interface/insurfeval.cc \ + libnurbs/internals/arc.cc \ + libnurbs/internals/arcsorter.cc \ + libnurbs/internals/arctess.cc \ + libnurbs/internals/backend.cc \ + libnurbs/internals/basiccrveval.cc \ + libnurbs/internals/basicsurfeval.cc \ + libnurbs/internals/bin.cc \ + libnurbs/internals/bufpool.cc \ + libnurbs/internals/cachingeval.cc \ + libnurbs/internals/ccw.cc \ + libnurbs/internals/coveandtiler.cc \ + libnurbs/internals/curve.cc \ + libnurbs/internals/curvelist.cc \ + libnurbs/internals/curvesub.cc \ + libnurbs/internals/dataTransform.cc \ + libnurbs/internals/displaylist.cc \ + libnurbs/internals/flist.cc \ + libnurbs/internals/flistsorter.cc \ + libnurbs/internals/hull.cc \ + libnurbs/internals/intersect.cc \ + libnurbs/internals/knotvector.cc \ + libnurbs/internals/mapdesc.cc \ + libnurbs/internals/mapdescv.cc \ + libnurbs/internals/maplist.cc \ + libnurbs/internals/mesher.cc \ + libnurbs/internals/monoTriangulationBackend.cc \ + libnurbs/internals/monotonizer.cc \ + libnurbs/internals/mycode.cc \ + libnurbs/internals/nurbsinterfac.cc \ + libnurbs/internals/nurbstess.cc \ + libnurbs/internals/patch.cc \ + libnurbs/internals/patchlist.cc \ + libnurbs/internals/quilt.cc \ + libnurbs/internals/reader.cc \ + libnurbs/internals/renderhints.cc \ + libnurbs/internals/slicer.cc \ + libnurbs/internals/sorter.cc \ + libnurbs/internals/splitarcs.cc \ + libnurbs/internals/subdivider.cc \ + libnurbs/internals/tobezier.cc \ + libnurbs/internals/trimline.cc \ + libnurbs/internals/trimregion.cc \ + libnurbs/internals/trimvertpool.cc \ + libnurbs/internals/uarray.cc \ + libnurbs/internals/varray.cc \ + libnurbs/nurbtess/directedLine.cc \ + libnurbs/nurbtess/gridWrap.cc \ + libnurbs/nurbtess/monoChain.cc \ + libnurbs/nurbtess/monoPolyPart.cc \ + libnurbs/nurbtess/monoTriangulation.cc \ + libnurbs/nurbtess/partitionX.cc \ + libnurbs/nurbtess/partitionY.cc \ + libnurbs/nurbtess/polyDBG.cc \ + libnurbs/nurbtess/polyUtil.cc \ + libnurbs/nurbtess/primitiveStream.cc \ + libnurbs/nurbtess/quicksort.cc \ + libnurbs/nurbtess/rectBlock.cc \ + libnurbs/nurbtess/sampleComp.cc \ + libnurbs/nurbtess/sampleCompBot.cc \ + libnurbs/nurbtess/sampleCompRight.cc \ + libnurbs/nurbtess/sampleCompTop.cc \ + libnurbs/nurbtess/sampleMonoPoly.cc \ + libnurbs/nurbtess/sampledLine.cc \ + libnurbs/nurbtess/searchTree.cc + +SOURCES = $(C_SOURCES) $(CC_SOURCES) + +OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) + +.c.o: + $(CC) -o $@ $(CFLAGS) -c $< +.cc.o: + $(CXX) -o $@ $(CXXFLAGS) -c $< + + +all: $(LIBDIR) $(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP) + +$(LIBDIR): + mkdir -p $(LIBDIR) + +$(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) + $(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLU_DLL) $^ $(LDLIBS) + $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLU_DEF) $^ + $(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLU_IMP) --def $(LIBDIR)/$(GLU_DEF) + + +clean: + -$(call UNLINK,libutil/*.o) + -$(call UNLINK,libtess/*.o) + -$(call UNLINK,libnurbs/interface/*.o) + -$(call UNLINK,libnurbs/internals/*.o) + -$(call UNLINK,libnurbs/nurbtess/*.o) diff --git a/mesalib/src/glu/sgi/Makefile.win b/mesalib/src/glu/sgi/Makefile.win new file mode 100644 index 000000000..9321732ef --- /dev/null +++ b/mesalib/src/glu/sgi/Makefile.win @@ -0,0 +1,149 @@ +# Makefile for Win32 + +!include + +.SUFFIXES : .cc + +TOP = .. + +GLU_SRCS_CC = \ + libnurbs\interface\bezierEval.cc \ + libnurbs\interface\bezierPatch.cc \ + libnurbs\interface\bezierPatchMesh.cc \ + libnurbs\interface\glcurveval.cc \ + libnurbs\interface\glinterface.cc \ + libnurbs\interface\glrenderer.cc \ + libnurbs\interface\glsurfeval.cc \ + libnurbs\interface\incurveeval.cc \ + libnurbs\interface\insurfeval.cc \ + libnurbs\internals\arc.cc \ + libnurbs\internals\arcsorter.cc \ + libnurbs\internals\arctess.cc \ + libnurbs\internals\backend.cc \ + libnurbs\internals\basiccrveval.cc \ + libnurbs\internals\basicsurfeval.cc \ + libnurbs\internals\bin.cc \ + libnurbs\internals\bufpool.cc \ + libnurbs\internals\cachingeval.cc \ + libnurbs\internals\ccw.cc \ + libnurbs\internals\coveandtiler.cc \ + libnurbs\internals\curve.cc \ + libnurbs\internals\curvelist.cc \ + libnurbs\internals\curvesub.cc \ + libnurbs\internals\dataTransform.cc \ + libnurbs\internals\displaylist.cc \ + libnurbs\internals\flist.cc \ + libnurbs\internals\flistsorter.cc \ + libnurbs\internals\hull.cc \ + libnurbs\internals\intersect.cc \ + libnurbs\internals\knotvector.cc \ + libnurbs\internals\mapdesc.cc \ + libnurbs\internals\mapdescv.cc \ + libnurbs\internals\maplist.cc \ + libnurbs\internals\mesher.cc \ + libnurbs\internals\monoTriangulationBackend.cc \ + libnurbs\internals\monotonizer.cc \ + libnurbs\internals\mycode.cc \ + libnurbs\internals\nurbsinterfac.cc \ + libnurbs\internals\nurbstess.cc \ + libnurbs\internals\patch.cc \ + libnurbs\internals\patchlist.cc \ + libnurbs\internals\quilt.cc \ + libnurbs\internals\reader.cc \ + libnurbs\internals\renderhints.cc \ + libnurbs\internals\slicer.cc \ + libnurbs\internals\sorter.cc \ + libnurbs\internals\splitarcs.cc \ + libnurbs\internals\subdivider.cc \ + libnurbs\internals\tobezier.cc \ + libnurbs\internals\trimline.cc \ + libnurbs\internals\trimregion.cc \ + libnurbs\internals\trimvertpool.cc \ + libnurbs\internals\uarray.cc \ + libnurbs\internals\varray.cc \ + libnurbs\nurbtess\directedLine.cc \ + libnurbs\nurbtess\gridWrap.cc \ + libnurbs\nurbtess\monoChain.cc \ + libnurbs\nurbtess\monoPolyPart.cc \ + libnurbs\nurbtess\monoTriangulation.cc \ + libnurbs\nurbtess\partitionX.cc \ + libnurbs\nurbtess\partitionY.cc \ + libnurbs\nurbtess\polyDBG.cc \ + libnurbs\nurbtess\polyUtil.cc \ + libnurbs\nurbtess\primitiveStream.cc \ + libnurbs\nurbtess\quicksort.cc \ + libnurbs\nurbtess\rectBlock.cc \ + libnurbs\nurbtess\sampleComp.cc \ + libnurbs\nurbtess\sampleCompBot.cc \ + libnurbs\nurbtess\sampleCompRight.cc \ + libnurbs\nurbtess\sampleCompTop.cc \ + libnurbs\nurbtess\sampleMonoPoly.cc \ + libnurbs\nurbtess\sampledLine.cc \ + libnurbs\nurbtess\searchTree.cc + +GLU_SRCS = \ + libtess\dict.c \ + libtess\geom.c \ + libtess\memalloc.c \ + libtess\mesh.c \ + libtess\normal.c \ + libtess\priorityq.c \ + libtess\render.c \ + libtess\sweep.c \ + libtess\tess.c \ + libtess\tessmono.c \ + libutil\error.c \ + libutil\glue.c \ + libutil\mipmap.c \ + libutil\project.c \ + libutil\quad.c \ + libutil\registry.c + +SRCS = $(GLU_SRCS) + +all : gludll + +!include "$(TOP)/mesawin32.mak" + +gludll : $(GLUDLL) + +CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -Iinclude -DBUILD_GL32 -DLIBRARYBUILD +LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS) + +LIBS = ../lib/$(MESALIB) winmm.lib $(guilibsdll) + +OBJS = $(GLU_SRCS_CC:.cc=.obj) $(GLU_SRCS:.c=.obj) +NURBSINC = -Ilibnurbs\interface -Ilibnurbs\internals -Ilibnurbs\nurbtess +CFLAGS = $(CFLAGS) $(NURBSINC) + +$(GLUDLL): $(OBJS) glu.def + $(link) $(LFLAGS) -out:$(GLUDLL) -def:glu.def $(OBJS) $(LIBS) + @echo "copying Mesa GLU dynamic link library to library directory..." + -copy $(GLUDLL) $(TOP)\lib + @echo "copying Mesa GLU import library to library directory..." + -copy $(GLULIB) $(TOP)\lib + +install : $(GLUDLL) $(GLULIB) + @echo "copying Mesa GLU dynamic link library to system directory..." + -copy $(GLUDLL) $(DLLINSTALL) + @echo "copying Mesa GLU header files to include directory..." + -copy ..\..\include\GL\glu.h $(INCLUDEINSTALL) + @echo "copying Mesa GLU import library to system library directory..." + -copy $(GLULIB) $(LIBINSTALL) + +clean :: + @del /f libtess\*.obj libutil\*.obj + @del /f libnurbs\interface\*.obj libnurbs\internals\*.obj + @del /f libnurbs\nurbtess\*.obj + +# override default inference rule with one that writes the object to +# the same subdir as the c file. + +.c.obj : + $(cc) $(CFLAGS) -I. $< /Fo$*.obj + +# /TP is needed for C++ files because MS compiler +# does not recognize .cc as a C++ file. + +.cc.obj : + $(cc) $(CFLAGS) -I. $< /TP /Fo$*.obj diff --git a/mesalib/src/glu/sgi/dummy.cc b/mesalib/src/glu/sgi/dummy.cc new file mode 100644 index 000000000..bd905a260 --- /dev/null +++ b/mesalib/src/glu/sgi/dummy.cc @@ -0,0 +1,4 @@ +/* + * This file contains nothing. It's just there so there's at least a single + * source file for libGLU.la in this directory. + */ diff --git a/mesalib/src/glu/sgi/glu.def b/mesalib/src/glu/sgi/glu.def new file mode 100644 index 000000000..0c8b02176 --- /dev/null +++ b/mesalib/src/glu/sgi/glu.def @@ -0,0 +1,88 @@ +;DESCRIPTION 'Mesa GLU (OpenGL work-alike) for Win32' +VERSION 5.1 +; +; Module definition file for GLU (GLU32.DLL) +; +; Note: The GLU functions use the STDCALL +; function calling convention. Microsoft's +; GLU32 uses this convention and so must the +; Mesa GLU32 so that the Mesa DLL can be used +; as a drop-in replacement. +; +; The linker exports STDCALL entry points with +; 'decorated' names; e.g., _glBegin@0, where the +; trailing number is the number of bytes of +; parameter data pushed onto the stack. The +; callee is responsible for popping this data +; off the stack, usually via a RETF n instruction. +; +; However, the Microsoft GLU32.DLL does not export +; the decorated names, even though the calling convention +; is STDCALL. So, this module definition file is +; needed to force the Mesa GLU32.DLL to export the +; symbols in the same manner as the Microsoft DLL. +; Were it not for this problem, this file would not +; be needed (for the glu* functions) since the entry +; points are compiled with dllexport declspec. +; + +EXPORTS + gluBeginCurve + gluBeginPolygon + gluBeginSurface + gluBeginTrim + gluBuild1DMipmapLevels + gluBuild1DMipmaps + gluBuild2DMipmapLevels + gluBuild2DMipmaps + gluBuild3DMipmapLevels + gluBuild3DMipmaps + gluCheckExtension + gluCylinder + gluDeleteNurbsRenderer + gluDeleteQuadric + gluDeleteTess + gluDisk + gluEndCurve + gluEndPolygon + gluEndSurface + gluEndTrim + gluErrorString + gluGetNurbsProperty + gluGetString + gluGetTessProperty + gluLoadSamplingMatrices + gluLookAt + gluNewNurbsRenderer + gluNewQuadric + gluNewTess + gluNextContour + gluNurbsCallback + gluNurbsCallbackData + gluNurbsCallbackDataEXT + gluNurbsCurve + gluNurbsProperty + gluNurbsSurface + gluOrtho2D + gluPartialDisk + gluPerspective + gluPickMatrix + gluProject + gluPwlCurve + gluQuadricCallback + gluQuadricDrawStyle + gluQuadricNormals + gluQuadricOrientation + gluQuadricTexture + gluScaleImage + gluSphere + gluTessBeginContour + gluTessBeginPolygon + gluTessCallback + gluTessEndContour + gluTessEndPolygon + gluTessNormal + gluTessProperty + gluTessVertex + gluUnProject + gluUnProject4 diff --git a/mesalib/src/glu/sgi/glu.exports b/mesalib/src/glu/sgi/glu.exports new file mode 100644 index 000000000..aeb727291 --- /dev/null +++ b/mesalib/src/glu/sgi/glu.exports @@ -0,0 +1,118 @@ + gluBeginCurve + gluBeginPolygon + gluBeginSurface + gluBeginTrim + gluBuild1DMipmapLevels + gluBuild1DMipmaps + gluBuild2DMipmapLevels + gluBuild2DMipmaps + gluBuild3DMipmapLevels + gluBuild3DMipmaps + gluCheckExtension + gluCylinder + gluDeleteNurbsRenderer + gluDeleteQuadric + gluDeleteTess + gluDisk + gluEndCurve + gluEndPolygon + gluEndSurface + gluEndTrim + gluErrorString + gluGetNurbsProperty + gluGetString + gluGetTessProperty + gluLoadSamplingMatrices + gluLookAt + gluNewNurbsRenderer + gluNewQuadric + gluNewTess + gluNextContour + gluNurbsCallback + gluNurbsCallbackData + gluNurbsCallbackDataEXT + gluNurbsCurve + gluNurbsProperty + gluNurbsSurface + gluOrtho2D + gluPartialDisk + gluPerspective + gluPickMatrix + gluProject + gluPwlCurve + gluQuadricCallback + gluQuadricDrawStyle + gluQuadricNormals + gluQuadricOrientation + gluQuadricTexture + gluScaleImage + gluSphere + gluTessBeginContour + gluTessBeginPolygon + gluTessCallback + gluTessEndContour + gluTessEndPolygon + gluTessNormal + gluTessProperty + gluTessVertex + gluUnProject + gluUnProject4 + mgluBeginCurve + mgluBeginPolygon + mgluBeginSurface + mgluBeginTrim + mgluBuild1DMipmapLevels + mgluBuild1DMipmaps + mgluBuild2DMipmapLevels + mgluBuild2DMipmaps + mgluBuild3DMipmapLevels + mgluBuild3DMipmaps + mgluCheckExtension + mgluCylinder + mgluDeleteNurbsRenderer + mgluDeleteQuadric + mgluDeleteTess + mgluDisk + mgluEndCurve + mgluEndPolygon + mgluEndSurface + mgluEndTrim + mgluErrorString + mgluGetNurbsProperty + mgluGetString + mgluGetTessProperty + mgluLoadSamplingMatrices + mgluLookAt + mgluNewNurbsRenderer + mgluNewQuadric + mgluNewTess + mgluNextContour + mgluNurbsCallback + mgluNurbsCallbackData + mgluNurbsCallbackDataEXT + mgluNurbsCurve + mgluNurbsProperty + mgluNurbsSurface + mgluOrtho2D + mgluPartialDisk + mgluPerspective + mgluPickMatrix + mgluProject + mgluPwlCurve + mgluQuadricCallback + mgluQuadricDrawStyle + mgluQuadricNormals + mgluQuadricOrientation + mgluQuadricTexture + mgluScaleImage + mgluSphere + mgluTessBeginContour + mgluTessBeginPolygon + mgluTessCallback + mgluTessEndContour + mgluTessEndPolygon + mgluTessNormal + mgluTessProperty + mgluTessVertex + mgluUnProject + mgluUnProject4 diff --git a/mesalib/src/glu/sgi/glu.exports.darwin b/mesalib/src/glu/sgi/glu.exports.darwin new file mode 100644 index 000000000..4f56e36f3 --- /dev/null +++ b/mesalib/src/glu/sgi/glu.exports.darwin @@ -0,0 +1,59 @@ +_*gluBeginCurve +_*gluBeginPolygon +_*gluBeginSurface +_*gluBeginTrim +_*gluBuild1DMipmapLevels +_*gluBuild1DMipmaps +_*gluBuild2DMipmapLevels +_*gluBuild2DMipmaps +_*gluBuild3DMipmapLevels +_*gluBuild3DMipmaps +_*gluCheckExtension +_*gluCylinder +_*gluDeleteNurbsRenderer +_*gluDeleteQuadric +_*gluDeleteTess +_*gluDisk +_*gluEndCurve +_*gluEndPolygon +_*gluEndSurface +_*gluEndTrim +_*gluErrorString +_*gluGetNurbsProperty +_*gluGetString +_*gluGetTessProperty +_*gluLoadSamplingMatrices +_*gluLookAt +_*gluNewNurbsRenderer +_*gluNewQuadric +_*gluNewTess +_*gluNextContour +_*gluNurbsCallback +_*gluNurbsCallbackData +_*gluNurbsCallbackDataEXT +_*gluNurbsCurve +_*gluNurbsProperty +_*gluNurbsSurface +_*gluOrtho2D +_*gluPartialDisk +_*gluPerspective +_*gluPickMatrix +_*gluProject +_*gluPwlCurve +_*gluQuadricCallback +_*gluQuadricDrawStyle +_*gluQuadricNormals +_*gluQuadricOrientation +_*gluQuadricTexture +_*gluScaleImage +_*gluSphere +_*gluTessBeginContour +_*gluTessBeginPolygon +_*gluTessCallback +_*gluTessEndContour +_*gluTessEndPolygon +_*gluTessNormal +_*gluTessProperty +_*gluTessVertex +_*gluUnProject +_*gluUnProject4 diff --git a/mesalib/src/glu/sgi/include/gluos.h b/mesalib/src/glu/sgi/include/gluos.h new file mode 100644 index 000000000..8eaa7a153 --- /dev/null +++ b/mesalib/src/glu/sgi/include/gluos.h @@ -0,0 +1,72 @@ +/* +** gluos.h - operating system dependencies for GLU +** +*/ +#ifdef __VMS +#ifdef __cplusplus +#pragma message disable nocordel +#pragma message disable codeunreachable +#pragma message disable codcauunr +#endif +#endif + +#ifdef __WATCOMC__ +/* Disable *lots* of warnings to get a clean build. I can't be bothered fixing the + * code at the moment, as it is pretty ugly. + */ +#pragma warning 7 10 +#pragma warning 13 10 +#pragma warning 14 10 +#pragma warning 367 10 +#pragma warning 379 10 +#pragma warning 726 10 +#pragma warning 836 10 +#endif + +#ifdef BUILD_FOR_SNAP + +#include +#include +#include + +#elif defined(_WIN32) + +#include /* For _MAX_PATH definition */ +#include +#include + +#define WIN32_LEAN_AND_MEAN +#define NOGDI +#define NOIME +#define NOMINMAX + +#define _WIN32_WINNT 0x0400 +#ifndef STRICT + #define STRICT 1 +#endif + +#include + +/* Disable warnings */ +#pragma warning(disable : 4101) +#pragma warning(disable : 4244) +#pragma warning(disable : 4761) + +#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1300 +#pragma comment(linker, "/OPT:NOWIN98") +#endif + +#elif defined(__OS2__) + +#include +#include +#include +#define WINGDIAPI + +#else + +/* Disable Microsoft-specific keywords */ +#define GLAPIENTRY +#define WINGDIAPI + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/interface/bezierEval.cc b/mesalib/src/glu/sgi/libnurbs/interface/bezierEval.cc new file mode 100644 index 000000000..b414f535f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/bezierEval.cc @@ -0,0 +1,260 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include +#include +#include "bezierEval.h" + +#ifdef __WATCOMC__ +#pragma warning 14 10 +#endif + +#define TOLERANCE 0.0001 + +#ifndef MAX_ORDER +#define MAX_ORDER 16 +#endif + +#ifndef MAX_DIMENSION +#define MAX_DIMENSION 4 +#endif + +static void normalize(float vec[3]); +static void crossProduct(float x[3], float y[3], float ret[3]); +#if 0 // UNUSED +static void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retpoint[]); +#endif + +static float binomialCoefficients[8][8] = { + {1,0,0,0,0,0,0,0}, + {1,1,0,0,0,0,0,0}, + {1,2,1,0,0,0,0,0}, + {1,3,3,1,0,0,0,0}, + {1,4,6,4,1,0,0,0}, + {1,5,10,10,5,1,0,0}, + {1,6,15,20,15,6,1,0}, + {1,7,21,35,35,21,7,1} +}; + +void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retpoint[]) +{ + float uprime = (u-u0)/(u1-u0); + float *ctlptr = ctlpoints; + float oneMinusX = 1.0f-uprime; + float XPower = 1.0f; + + int i,k; + for(k=0; k=1. + */ +void bezierCurveEvalfast(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retpoint[]) +{ + float uprime = (u-u0)/(u1-u0); + float buf[MAX_ORDER][MAX_ORDER][MAX_DIMENSION]; + float* ctlptr = ctlpoints; + int r, i,j; + for(i=0; i=1. + */ +void bezierCurveEvalDer(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retDer[]) +{ + int i,k; + float width = u1-u0; + float *ctlptr = ctlpoints; + + float buf[MAX_ORDER][MAX_DIMENSION]; + if(order == 1){ + for(k=0; k=3 && dimension <=4); + bezierSurfEvalDerGen(1,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialU); + bezierSurfEvalDerGen(0,1, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, partialV); + + if(dimension == 3){/*inhomogeneous*/ + crossProduct(partialU, partialV, retNormal); + + normalize(retNormal); + + return; + } + else { /*homogeneous*/ + float val[4]; /*the point coordinates (without derivative)*/ + float newPartialU[MAX_DIMENSION]; + float newPartialV[MAX_DIMENSION]; + int i; + bezierSurfEvalDerGen(0,0, u0, u1, uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u, v, val); + + for(i=0; i<=2; i++){ + newPartialU[i] = partialU[i] * val[3] - val[i] * partialU[3]; + newPartialV[i] = partialV[i] * val[3] - val[i] * partialV[3]; + } + crossProduct(newPartialU, newPartialV, retNormal); + normalize(retNormal); + } +} + +/*if size is 0, then nothing is done*/ +static void normalize(float vec[3]) +{ + float size = (float)sqrt(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); + + if(size < TOLERANCE) + { +#ifdef DEBUG + fprintf(stderr, "Warning: in oglBSpline.c normal is 0\n"); +#endif + return; + } + else { + vec[0] = vec[0]/size; + vec[1] = vec[1]/size; + vec[2] = vec[2]/size; + } +} + + +static void crossProduct(float x[3], float y[3], float ret[3]) +{ + ret[0] = x[1]*y[2] - y[1]*x[2]; + ret[1] = x[2]*y[0] - y[2]*x[0]; + ret[2] = x[0]*y[1] - y[0]*x[1]; + +} + diff --git a/mesalib/src/glu/sgi/libnurbs/interface/bezierEval.h b/mesalib/src/glu/sgi/libnurbs/interface/bezierEval.h new file mode 100644 index 000000000..93e8c69d1 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/bezierEval.h @@ -0,0 +1,48 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _BEZIEREVAL_H +#define _BEZIEREVAL_H + +void bezierCurveEval(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retpoint[]); +void bezierCurveEvalDer(float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retDer[]); +void bezierCurveEvalDerGen(int der, float u0, float u1, int order, float *ctlpoints, int stride, int dimension, float u, float retDer[]); + + +void bezierSurfEvalDerGen(int uder, int vder, float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[]); + +void bezierSurfEval(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float ret[]); + +void bezierSurfEvalNormal(float u0, float u1, int uorder, float v0, float v1, int vorder, int dimension, float *ctlpoints, int ustride, int vstride, float u, float v, float retNormal[]); + + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/interface/bezierPatch.cc b/mesalib/src/glu/sgi/libnurbs/interface/bezierPatch.cc new file mode 100644 index 000000000..dbab3a1a2 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/bezierPatch.cc @@ -0,0 +1,206 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include +#include +#include +#include /*for drawing bzier patch*/ +#include "bezierPatch.h" +#include "bezierEval.h" + +/* + *allocate an instance of bezierPatch. The control points are unknown. But + *the space of this array is allocated with size of + * uorder*vorder*dimension + * + */ +bezierPatch* bezierPatchMake(float umin, float vmin, float umax, float vmax, int uorder, int vorder, int dimension) +{ + bezierPatch* ret = (bezierPatch*) malloc(sizeof(bezierPatch)); + assert(ret); + ret->umin = umin; + ret->vmin = vmin; + ret->umax = umax; + ret->vmax = vmax; + ret->uorder = uorder; + ret->vorder = vorder; + ret->dimension = dimension; + ret->ctlpoints = (float*) malloc(sizeof(float) * dimension * uorder * vorder); + assert(ret->ctlpoints); + + ret->next = NULL; + + return ret; +} + +bezierPatch* bezierPatchMake2(float umin, float vmin, float umax, float vmax, int uorder, int vorder, int dimension, int ustride, int vstride, float* ctlpoints) +{ + bezierPatch* ret = (bezierPatch*) malloc(sizeof(bezierPatch)); + assert(ret); + ret->umin = umin; + ret->vmin = vmin; + ret->umax = umax; + ret->vmax = vmax; + ret->uorder = uorder; + ret->vorder = vorder; + ret->dimension = dimension; + ret->ctlpoints = (float*) malloc(sizeof(float) * dimension * uorder * vorder); + assert(ret->ctlpoints); + + /*copy the control points there*/ + int the_ustride = vorder * dimension; + int the_vstride = dimension; + for(int i=0; ictlpoints[i * the_ustride + j*the_vstride+k] = ctlpoints[i*ustride+j*vstride+k]; + + ret->next = NULL; + + return ret; +} + +/* + *deallocate the space as allocated by Make + */ +void bezierPatchDelete(bezierPatch *b) +{ + free(b->ctlpoints); + free(b); +} + +/*delete the whole linked list + */ +void bezierPatchDeleteList(bezierPatch *b) +{ + bezierPatch *temp; + while (b != NULL) { + temp = b; + b = b->next; + bezierPatchDelete(temp); + } +} + +bezierPatch* bezierPatchInsert(bezierPatch *list, bezierPatch *b) +{ + b->next = list; + return b; +} + +/*print the data stored in this patch*/ +void bezierPatchPrint(bezierPatch *b) +{ + printf("bezierPatch:\n"); + printf("umin,umax=(%f,%f), (vmin, vmax)=(%f,%f)\n", b->umin, b->umax, b->vmin, b->vmax); + printf("uorder=%i, vorder=%i\n", b->uorder, b->vorder); + printf("idmension = %i\n", b->dimension); +} + +/*print the whole list*/ +void bezierPatchPrintList(bezierPatch *list) +{ + bezierPatch* temp; + for(temp=list; temp != NULL; temp = temp->next) + bezierPatchPrint(temp); +} + +void bezierPatchEval(bezierPatch *b, float u, float v, float ret[]) +{ + if( u >= b->umin && u<= b->umax + && v >= b->vmin && v<= b->vmax) + { + + bezierSurfEval(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret); + + } + else if(b->next != NULL) + bezierPatchEval(b->next, u,v, ret); + else + bezierSurfEval(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret); +} + +/*the returned normal is normlized + */ +void bezierPatchEvalNormal(bezierPatch *b, float u, float v, float ret[]) +{ + bezierSurfEvalNormal(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret); + + if( u >= b->umin && u<= b->umax + && v >= b->vmin && v<= b->vmax) + { + bezierSurfEvalNormal(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret); + } + else if(b->next != NULL) + bezierPatchEvalNormal(b->next, u,v, ret); + else + bezierSurfEvalNormal(b->umin, b->umax, b->uorder, b->vmin, b->vmax, b->vorder, b->dimension, b->ctlpoints, b->dimension * b->vorder, b->dimension, u, v, ret); + +} + +void bezierPatchDraw(bezierPatch *bpatch, int u_reso, int v_reso) +{ + if(bpatch->dimension == 3) + glMap2f(GL_MAP2_VERTEX_3, bpatch->umin, bpatch->umax, 3*bpatch->vorder, bpatch->uorder, bpatch->vmin, bpatch->vmax,3, bpatch->vorder, (GLfloat*) bpatch->ctlpoints); + else + glMap2f(GL_MAP2_VERTEX_4, bpatch->umin, bpatch->umax, 4*bpatch->vorder, bpatch->uorder, bpatch->vmin, bpatch->vmax,3, bpatch->vorder, (GLfloat*) bpatch->ctlpoints); + + glMapGrid2f(u_reso, bpatch->umin, bpatch->umax, + v_reso, bpatch->vmin, bpatch->vmax); + glEvalMesh2(GL_LINE, 0, u_reso, 0, v_reso); +} + +void bezierPatchListDraw(bezierPatch *list, int u_reso, int v_reso) +{ + bezierPatch *temp; +glEnable(GL_LIGHTING); +glEnable(GL_LIGHT0); +glEnable(GL_MAP2_VERTEX_3); +glEnable(GL_AUTO_NORMAL); +glEnable(GL_NORMALIZE); +glColor3f(1,0,0); +#ifdef DEBUG +printf("mapmap\n"); +#endif + + + for(temp = list; temp != NULL; temp = temp->next) + bezierPatchDraw(temp, u_reso, v_reso); +} + + + diff --git a/mesalib/src/glu/sgi/libnurbs/interface/bezierPatch.h b/mesalib/src/glu/sgi/libnurbs/interface/bezierPatch.h new file mode 100644 index 000000000..981183afa --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/bezierPatch.h @@ -0,0 +1,104 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _BEZIERPATCH_H +#define _BEZIERPATCH_H + +typedef struct bezierPatch{ + float umin, vmin, umax, vmax; + int uorder; /*order= degree + 1*/ + int vorder; + + /* + *the control points are stored in a one dimensional array. + *the surface is defined as: + * s(u,v) = sum_{i,j} P(i,j) * B_i(u) * B_j(v). + *where P(i,j) are the control points, B_i(.) are Bezier + *basis functions. + *Each control point can have dimension 3 or 4: (x,y,z,w). + *The components of P(i,j) are stored in a one dimensional + *array: + * ctlpoints[] + *in the order of: + * P[0,0], P[0,1], ..., P[0,vorder-1], + * P[1,0], P[1,1], ..., P[1,vorder-1], + * ... + * P[uorder-1,0], P[uorder-1,1], ..., P[uorder-1,vorder-1]. + */ + int dimension; + float* ctlpoints; + + /* + *in case we have to manage multiple bezierPatches. + */ + struct bezierPatch *next; + +} bezierPatch; + +#ifdef __cplusplus +extern "C" { +#endif + +bezierPatch* bezierPatchMake(float umin, float vmin, float umax, float vmax, int urder, int vorder, int dimension); + +bezierPatch* bezierPatchMake2(float umin, float vmin, float umax, float vmax, int urder, int vorder, int dimension, int ustride, int vstride, float *ctlpoints); + + +bezierPatch* bezierPatchInsert(bezierPatch *list, bezierPatch *b); + +void bezierPatchDelete(bezierPatch *b); + +void bezierPatchDeleteList(bezierPatch *b); + +void bezierPatchPrint(bezierPatch *b); + +void bezierPatchPrintList(bezierPatch *list); + +void bezierPatchEval(bezierPatch *b, float u, float v, float ret[]); + +void bezierPatchEvalNormal(bezierPatch *b, float u, float v, float retNormal[]); + +void bezierPatchEval(bezierPatch *b, float u, float v, float ret[]); + +void bezierPatchEvalNormal(bezierPatch *b, float u, float v, float ret[]); + + +void bezierPatchDraw(bezierPatch *bpatch, int u_reso, int v_reso); + +void bezierPatchListDraw(bezierPatch *list, int u_reso, int v_reso); + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc b/mesalib/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc new file mode 100644 index 000000000..ac7ff84fc --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/bezierPatchMesh.cc @@ -0,0 +1,610 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include +#include +#include +#include +#include "bezierEval.h" +#include "bezierPatchMesh.h" + +static int isDegenerate(float A[2], float B[2], float C[2]); + +void drawStrips(float *vertex_array, float *normal_array, int *length_array, GLenum *type_array, int num_strips) +{ + int i,j,k; + k=0; + /*k is the index of the first component of the current vertex*/ + for(i=0; inext) + { + bezierPatchMeshDelDeg(temp); + } +} + +void bezierPatchMeshListDelete(bezierPatchMesh *list) +{ + if(list == NULL) return; + bezierPatchMeshListDelete(list->next); + bezierPatchMeshDelete(list); +} + + + + +bezierPatchMesh* bezierPatchMeshListReverse(bezierPatchMesh* list) +{ + bezierPatchMesh* ret=NULL; + bezierPatchMesh* temp; + bezierPatchMesh* nextone; + for(temp = list; temp != NULL; temp = nextone) + { + nextone = temp->next; + ret=bezierPatchMeshListInsert(ret, temp); + } + return ret; +} + +/*maptype is either GL_MAP2_VERTEX_3 or GL_MAP2_VERTEX_4 + */ +bezierPatchMesh *bezierPatchMeshMake(int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints, int size_UVarray, int size_length_array) +{ + int i,j,k; + int dimension; + int the_ustride; + int the_vstride; + + if(maptype == GL_MAP2_VERTEX_3) dimension = 3; + else if (maptype==GL_MAP2_VERTEX_4) dimension = 4; + else { + fprintf(stderr, "error in inMap2f, maptype=%i is wrong, maptype,map is invalid\n", maptype); + return NULL; + } + + bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh)); + assert(ret); + + ret->bpatch_normal = NULL; + ret->bpatch_color = NULL; + ret->bpatch_texcoord = NULL; + ret->bpatch = bezierPatchMake(umin, vmin, umax, vmax, uorder, vorder, dimension); + + /*copy the control points there*/ + the_ustride = vorder * dimension; + the_vstride = dimension; + for(i=0; ibpatch->ctlpoints[i * the_ustride + j*the_vstride+k] = ctlpoints[i*ustride+j*vstride+k]; + + + ret->size_UVarray = size_UVarray; + ret->size_length_array = size_length_array; + ret->UVarray = (float*) malloc(sizeof(float) * size_UVarray); + assert(ret->UVarray); + ret->length_array = (int *)malloc(sizeof(int) * size_length_array); + assert(ret->length_array); + ret->type_array = (GLenum *)malloc(sizeof(GLenum) * size_length_array); + assert(ret->type_array); + + ret->index_UVarray = 0; + ret->index_length_array = 0; + + ret->vertex_array = NULL; + ret->normal_array = NULL; + ret->color_array = NULL; + ret->texcoord_array = NULL; + + ret->next = NULL; + return ret; +} + +bezierPatchMesh *bezierPatchMeshMake2(int size_UVarray, int size_length_array) +{ + bezierPatchMesh *ret = (bezierPatchMesh*) malloc(sizeof(bezierPatchMesh)); + assert(ret); + + ret->bpatch = NULL; + ret->bpatch_normal = NULL; + ret->bpatch_color = NULL; + ret->bpatch_texcoord = NULL; + + ret->size_UVarray = size_UVarray; + ret->size_length_array = size_length_array; + ret->UVarray = (float*) malloc(sizeof(float) * size_UVarray); + assert(ret->UVarray); + ret->length_array = (int *)malloc(sizeof(int) * size_length_array); + assert(ret->length_array); + ret->type_array = (GLenum *)malloc(sizeof(GLenum) * size_length_array); + assert(ret->type_array); + + ret->index_UVarray = 0; + ret->index_length_array = 0; + + ret->vertex_array = NULL; + ret->normal_array = NULL; + ret->color_array = NULL; + ret->texcoord_array = NULL; + + ret->next = NULL; + return ret; +} + +void bezierPatchMeshPutPatch(bezierPatchMesh *bpm, int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints) +{ + switch(maptype){ + case GL_MAP2_VERTEX_3: + bpm->bpatch = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 3, ustride, vstride, ctlpoints); + break; + case GL_MAP2_VERTEX_4: + bpm->bpatch = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 4,ustride, vstride, ctlpoints ); + break; + case GL_MAP2_NORMAL: + bpm->bpatch_normal = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 3, ustride, vstride, ctlpoints); + break; + case GL_MAP2_INDEX: + bpm->bpatch_color = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 1, ustride, vstride, ctlpoints); + break; + case GL_MAP2_COLOR_4: + bpm->bpatch_color = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 4, ustride, vstride, ctlpoints); + break; + case GL_MAP2_TEXTURE_COORD_1: + bpm->bpatch_texcoord = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 1, ustride, vstride, ctlpoints); + break; + case GL_MAP2_TEXTURE_COORD_2: + bpm->bpatch_texcoord = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 2, ustride, vstride, ctlpoints); + break; + case GL_MAP2_TEXTURE_COORD_3: + bpm->bpatch_texcoord = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 3, ustride, vstride, ctlpoints); + break; + case GL_MAP2_TEXTURE_COORD_4: + bpm->bpatch_texcoord = bezierPatchMake2(umin, vmin, umax, vmax, uorder, vorder, 4, ustride, vstride, ctlpoints); + break; + default: + fprintf(stderr, "error in bezierPatchMeshPutPatch, maptype=%i is wrong, maptype,map is invalid\n", maptype); + } +} + + +/*delete everything including the arrays. So if you want to output the + *pointers of the arrays, you should not use this function to deallocate space. + *you should dealocate manually + */ +void bezierPatchMeshDelete(bezierPatchMesh *bpm) +{ + if(bpm->bpatch != NULL) + bezierPatchDelete(bpm->bpatch); + if(bpm->bpatch_normal != NULL) + bezierPatchDelete(bpm->bpatch_normal); + if(bpm->bpatch_color != NULL) + bezierPatchDelete(bpm->bpatch_color); + if(bpm->bpatch_texcoord != NULL) + bezierPatchDelete(bpm->bpatch_texcoord); + + free(bpm->UVarray); + free(bpm->length_array); + free(bpm->vertex_array); + free(bpm->normal_array); + free(bpm->type_array); + free(bpm); +} + +/*begin a strip + *type is the primitive type: + */ +void bezierPatchMeshBeginStrip(bezierPatchMesh *bpm, GLenum type) +{ + bpm->counter = 0; + bpm->type = type; +} + +/*signal the end of the current strip*/ +void bezierPatchMeshEndStrip(bezierPatchMesh *bpm) +{ + int i; + + /*if there are no vertices in this strip, then nothing needs to be done*/ + if(bpm->counter == 0) return; + + /*if the length_array is full, it should be expanded*/ + if(bpm->index_length_array >= bpm->size_length_array) + { + int *temp = (int*) malloc(sizeof(int) * (bpm->size_length_array*2 + 1)); + assert(temp); + GLenum *temp_type = (GLenum*) malloc(sizeof(GLenum) * (bpm->size_length_array*2 + 1)); + assert(temp_type); + /*update the size*/ + bpm->size_length_array = bpm->size_length_array*2 + 1; + + /*copy*/ + for(i=0; iindex_length_array; i++) + { + temp[i] = bpm->length_array[i]; + temp_type[i] = bpm->type_array[i]; + } + + /*deallocate old array*/ + free(bpm->length_array); + free(bpm->type_array); + + /*point to the new array which is twice as bigger*/ + bpm->length_array = temp; + bpm->type_array = temp_type; + } + bpm->type_array[bpm->index_length_array] = bpm->type; + bpm->length_array[bpm->index_length_array++] = bpm->counter; + +} + +/*insert (u,v) */ +void bezierPatchMeshInsertUV(bezierPatchMesh *bpm, float u, float v) +{ + int i; + /*if the UVarray is full, it should be expanded*/ + if(bpm->index_UVarray+1 >= bpm->size_UVarray) + { + float *temp = (float*) malloc(sizeof(float) * (bpm->size_UVarray * 2 + 2)); + assert(temp); + + /*update the size*/ + bpm->size_UVarray = bpm->size_UVarray*2 + 2; + + /*copy*/ + for(i=0; iindex_UVarray; i++) + { + temp[i] = bpm->UVarray[i]; + } + + /*deallocate old array*/ + free(bpm->UVarray); + + /*pointing to the new arrays*/ + bpm->UVarray = temp; + } + /*insert the new UV*/ + bpm->UVarray[bpm->index_UVarray] = u; + bpm->index_UVarray++; + bpm->UVarray[bpm->index_UVarray] = v; + bpm->index_UVarray++; + + /*update counter: one more vertex*/ + bpm->counter++; + + +} + +void bezierPatchMeshPrint(bezierPatchMesh *bpm) +{ + int i; + printf("the bezier patch is\n"); + bezierPatchPrint(bpm->bpatch); + printf("index_length_array= %i\n", bpm->index_length_array); + printf("size_length_array =%i\n", bpm->size_length_array); + printf("index_UVarray =%i\n", bpm->index_UVarray); + printf("size_UVarray =%i\n", bpm->size_UVarray); + printf("UVarray is\n"); + for(i=0; iindex_UVarray; i++) + printf("%f ", bpm->UVarray[i]); + + printf("length_array is\n"); + for(i=0; iindex_length_array; i++) + printf("%i ", bpm->length_array[i]); + printf("\n"); + +} + +/*insert a new patch in front of the current linked list and return the new list*/ +bezierPatchMesh* bezierPatchMeshListInsert(bezierPatchMesh* list, bezierPatchMesh* bpm) +{ + bpm->next=list; + return bpm; +} + +/*print all the patches*/ +void bezierPatchMeshListPrint(bezierPatchMesh* list) +{ + bezierPatchMesh *temp; + for(temp = list; temp != NULL; temp = temp->next) + { + bezierPatchMeshPrint(temp); + } +} + +int bezierPatchMeshListTotalStrips(bezierPatchMesh* list) +{ + int sum=0; + bezierPatchMesh *temp; + for(temp=list; temp != NULL; temp = temp->next) + { + sum += temp->index_length_array; + } + return sum; +} + +int bezierPatchMeshListTotalVert(bezierPatchMesh* list) +{ + int sum=0; + bezierPatchMesh *temp; + for(temp=list; temp != NULL; temp = temp->next) + { + sum += temp->index_UVarray; + } + return sum/2; +} + +int bezierPatchMeshListNumTriangles(bezierPatchMesh* list) +{ + int sum=0; + bezierPatchMesh* temp; + for(temp=list; temp != NULL; temp = temp->next) + { + sum += bezierPatchMeshNumTriangles(temp); + } + return sum; +} + +int bezierPatchMeshNumTriangles(bezierPatchMesh* bpm) +{ + int i; + int sum=0; + for(i=0; iindex_length_array; i++) + { + switch(bpm->type_array[i]) + { + case GL_TRIANGLES: + sum += bpm->length_array[i]/3; + break; + case GL_TRIANGLE_FAN: + if(bpm->length_array[i] > 2) + sum += bpm->length_array[i]-2; + break; + case GL_TRIANGLE_STRIP: + if(bpm->length_array[i] > 2) + sum += bpm->length_array[i]-2; + break; + case GL_QUAD_STRIP: + if(bpm->length_array[i]>2) + sum += (bpm->length_array[i]-2); + break; + default: + fprintf(stderr,"error in bezierPatchMeshListNumTriangles, type invalid\n"); + } + } + return sum; +} + +/*delete degenerate triangles*/ +void bezierPatchMeshDelDeg(bezierPatchMesh* bpm) +{ + if(bpm == NULL) return; + int i,j,k; + int *new_length_array; + GLenum *new_type_array; + int index_new_length_array; + float *new_UVarray; + int index_new_UVarray; + + new_length_array = (int*)malloc(sizeof(int) * bpm->index_length_array); + assert(new_length_array); + new_type_array = (GLenum*)malloc(sizeof(GLenum) * bpm->index_length_array); + assert(new_length_array); + new_UVarray = (float*) malloc(sizeof(float) * bpm->index_UVarray); + assert(new_UVarray); + + index_new_length_array = 0; + index_new_UVarray=0; + k=0; + for(i=0; iindex_length_array; i++){ + + /*(if not degenerate, we have to copy*/ + if( (bpm->length_array[i] != 3) || (!isDegenerate(bpm->UVarray+k, bpm->UVarray+k+2, bpm->UVarray+k+4))) + { + for(j=0; j<2* bpm->length_array[i]; j++) + new_UVarray[index_new_UVarray++] = bpm->UVarray[k++]; + + new_length_array[index_new_length_array] = bpm->length_array[i]; + new_type_array[index_new_length_array] = bpm->type_array[i]; + index_new_length_array++; + } + else + { + k += 6; + } + } + free(bpm->UVarray); + free(bpm->length_array); + free(bpm->type_array); + bpm->UVarray=new_UVarray; + bpm->length_array=new_length_array; + bpm->type_array=new_type_array; + bpm->index_UVarray = index_new_UVarray; + bpm->index_length_array = index_new_length_array; + +} + +/*(u,v) to XYZ + *the xyz and normals are stored in vertex_array, + *and normal_array. the spaces of both are allocated here + */ +void bezierPatchMeshEval(bezierPatchMesh* bpm) +{ + int i,j,k,l; + float u,v; + float u0 = bpm->bpatch->umin; + float u1 = bpm->bpatch->umax; + int uorder = bpm->bpatch->uorder; + float v0 = bpm->bpatch->vmin; + float v1 = bpm->bpatch->vmax; + int vorder = bpm->bpatch->vorder; + int dimension = bpm->bpatch->dimension; + int ustride = dimension * vorder; + int vstride = dimension; + float *ctlpoints = bpm->bpatch->ctlpoints; + + bpm->vertex_array = (float*) malloc(sizeof(float)* (bpm->index_UVarray/2) * 3); + assert(bpm->vertex_array); + bpm->normal_array = (float*) malloc(sizeof(float)* (bpm->index_UVarray/2) * 3); + assert(bpm->normal_array); + + k=0; + l=0; + for(i=0; iindex_length_array; i++) + { + for(j=0; jlength_array[i]; j++) + { + u = bpm->UVarray[k]; + v = bpm->UVarray[k+1]; + bezierSurfEval(u0,u1,uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u,v, bpm->vertex_array+l); + bezierSurfEvalNormal(u0,u1,uorder, v0, v1, vorder, dimension, ctlpoints, ustride, vstride, u,v, bpm->normal_array+l); + k += 2; + l += 3; + } + } +} + +void bezierPatchMeshListEval(bezierPatchMesh* list) +{ + bezierPatchMesh* temp; + for(temp = list; temp != NULL; temp = temp->next) + { + bezierPatchMeshEval(temp); + } +} + +void bezierPatchMeshDraw(bezierPatchMesh* bpm) +{ + int i,j,k; + k=0; + /*k is the index of the first component of the current vertex*/ + for(i=0; iindex_length_array; i++) + { + glBegin(bpm->type_array[i]); + for(j=0; jlength_array[i]; j++) + { + glNormal3fv(bpm->normal_array+k); + glVertex3fv(bpm->vertex_array+k); + k+= 3; + } + glEnd(); + } +} + +void bezierPatchMeshListDraw(bezierPatchMesh* list) +{ + bezierPatchMesh* temp; + for(temp = list; temp != NULL; temp = temp->next) + { + bezierPatchMeshDraw(temp); + } +} + +void bezierPatchMeshListCollect(bezierPatchMesh* list, float **vertex_array, float **normal_array, int **length_array, GLenum **type_array, int *num_strips) +{ + int i,j,k,l; + bezierPatchMesh *temp; + int total_num_vertices = bezierPatchMeshListTotalVert(list); + (*vertex_array) = (float *) malloc(sizeof(float) * total_num_vertices*3); + assert(*vertex_array); + (*normal_array) = (float *) malloc(sizeof(float) * total_num_vertices*3); + assert(*normal_array); + + *num_strips = bezierPatchMeshListTotalStrips(list); + + *length_array = (int*) malloc(sizeof(int) * (*num_strips)); + assert(*length_array); + + *type_array = (GLenum*) malloc(sizeof(GLenum) * (*num_strips)); + assert(*type_array); + + k=0; + l=0; + for(temp = list; temp != NULL; temp = temp->next) + { + int x=0; + for(i=0; iindex_length_array; i++) + { + for(j=0; jlength_array[i]; j++) + { + (*vertex_array)[k] = temp->vertex_array[x]; + (*vertex_array)[k+1] = temp->vertex_array[x+1]; + (*vertex_array)[k+2] = temp->vertex_array[x+2]; + + (*normal_array)[k] = temp->normal_array[x]; + (*normal_array)[k+1] = temp->normal_array[x+1]; + (*normal_array)[k+2] = temp->normal_array[x+2]; + + x += 3; + k += 3; + } + (*type_array)[l] = temp->type_array[i]; + (*length_array)[l++] = temp->length_array[i]; + } + } +} + + + +static int isDegenerate(float A[2], float B[2], float C[2]) +{ + if( (A[0] == B[0] && A[1]==B[1]) || + (A[0] == C[0] && A[1]==C[1]) || + (B[0] == C[0] && B[1]==C[1]) + ) + return 1; + else + return 0; +} + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/interface/bezierPatchMesh.h b/mesalib/src/glu/sgi/libnurbs/interface/bezierPatchMesh.h new file mode 100644 index 000000000..449329665 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/bezierPatchMesh.h @@ -0,0 +1,120 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _BEZIERPATCHMESH_H +#define _BEZIERPATCHMESH_H + +#include "bezierPatch.h" + +typedef struct bezierPatchMesh{ + bezierPatch *bpatch; /*vertex*/ + bezierPatch *bpatch_normal; + bezierPatch *bpatch_texcoord; /*s,t,r,q*/ + bezierPatch *bpatch_color; /*RGBA*/ + + float *UVarray; /*all UV components of all vertices of all strips*/ + int *length_array; /*[i] is the number of vertices in the ith strip*/ + GLenum *type_array; /*[i] is the type of the ith primitive*/ + + /*to support dynamic insertion*/ + int size_UVarray; + int index_UVarray; + int size_length_array; + int index_length_array; + + int counter; /*track the current strip size*/ + GLenum type; /*track the current type: 0: GL_TRIANGLES, 1: GL_TRIANGLE_STRIP*/ + + /*we eventually want to evaluate from (u,v) to (x,y,z) and draw them*/ + float *vertex_array; /*each vertex contains three components*/ + float *normal_array; /*each normal contains three components*/ + float *color_array; + float *texcoord_array; + + /*in case we need a linked list*/ + struct bezierPatchMesh *next; +} bezierPatchMesh; + +#ifdef __cplusplus +extern "C" { +#endif + + + +bezierPatchMesh *bezierPatchMeshMake(int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints, int size_UVarray, int size_length_array); + +/*initilize patches to be null*/ +bezierPatchMesh *bezierPatchMeshMake2(int size_UVarray, int size_length_array); + +void bezierPatchMeshPutPatch(bezierPatchMesh *bpm, int maptype, float umin, float umax, int ustride, int uorder, float vmin, float vmax, int vstride, int vorder, float *ctlpoints); + +void bezierPatchMeshDelete(bezierPatchMesh *bpm); + +void bezierPatchMeshBeginStrip(bezierPatchMesh *bpm, GLenum type); + +void bezierPatchMeshEndStrip(bezierPatchMesh *bpm); + +void bezierPatchMeshInsertUV(bezierPatchMesh *bpm, float u, float v); + +void bezierPatchMeshPrint(bezierPatchMesh *bpm); + +bezierPatchMesh* bezierPatchMeshListInsert(bezierPatchMesh* list, bezierPatchMesh* bpm); + +void bezierPatchMeshListPrint(bezierPatchMesh* list); + +int bezierPatchMeshListTotalStrips(bezierPatchMesh* list); + +int bezierPatchMeshListTotalVert(bezierPatchMesh* list); +int bezierPatchMeshNumTriangles(bezierPatchMesh* bpm); +int bezierPatchMeshListNumTriangles(bezierPatchMesh* list); + +void bezierPatchMeshDelDeg(bezierPatchMesh* bpm); + + +void bezierPatchMeshEval(bezierPatchMesh* bpm); + +void bezierPatchMeshDraw(bezierPatchMesh* bpm); + +void bezierPatchMeshListDraw(bezierPatchMesh* list); +void bezierPatchMeshListEval(bezierPatchMesh* list); +void bezierPatchMeshListCollect(bezierPatchMesh* list, float **vertex_array, float **normal_array, int **length_array, GLenum **type_array, int *num_strips); + +void bezierPatchMeshListDelDeg(bezierPatchMesh* list); +void bezierPatchMeshListDelete(bezierPatchMesh *list); +bezierPatchMesh* bezierPatchMeshListReverse(bezierPatchMesh* list); +void drawStrips(float *vertex_array, float *normal_array, int *length_array, GLenum *type_array, int num_strips); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/interface/glcurveval.cc b/mesalib/src/glu/sgi/libnurbs/interface/glcurveval.cc new file mode 100644 index 000000000..b6591dba0 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/glcurveval.cc @@ -0,0 +1,402 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * glcurveval.c++ + * + */ + +/* Polynomial Evaluator Interface */ + +#include "gluos.h" +#include "glimports.h" +#include "glrenderer.h" +#include "glcurveval.h" +#include "nurbsconsts.h" + +OpenGLCurveEvaluator::OpenGLCurveEvaluator(void) +{ + //no default callback functions + beginCallBackN = NULL; + endCallBackN = NULL; + vertexCallBackN = NULL; + normalCallBackN = NULL; + colorCallBackN = NULL; + texcoordCallBackN = NULL; + beginCallBackData = NULL; + endCallBackData = NULL; + vertexCallBackData = NULL; + normalCallBackData = NULL; + colorCallBackData = NULL; + texcoordCallBackData = NULL; + + userData = NULL; + + vertex_flag = 0; + normal_flag = 0; + color_flag = 0; + texcoord_flag = 0; + + em_vertex.uprime = -1.0; + em_normal.uprime = -1.0; + em_color.uprime = -1.0; + em_texcoord.uprime = -1.0; + output_triangles = 0; // don't output triangles by default +} + +OpenGLCurveEvaluator::~OpenGLCurveEvaluator(void) +{ +} + +/* added nonsense to avoid the warning messages at compile time */ +void +OpenGLCurveEvaluator::addMap(CurveMap *m) +{ + m = m; +} + +void +OpenGLCurveEvaluator::range1f(long type, REAL *from, REAL *to) +{ + type = type; + from = from; + to = to; +} + +void +OpenGLCurveEvaluator::domain1f(REAL ulo, REAL uhi) +{ + ulo = ulo; + uhi = uhi; +} + +void +OpenGLCurveEvaluator::bgnline(void) +{ + if(output_triangles) + beginCallBack(GL_LINE_STRIP, userData); + else + glBegin((GLenum) GL_LINE_STRIP); +} + +void +OpenGLCurveEvaluator::endline(void) +{ + if(output_triangles) + endCallBack(userData); + else + glEnd(); +} + +/*--------------------------------------------------------------------------- + * disable - turn off a curve map + *--------------------------------------------------------------------------- + */ +void +OpenGLCurveEvaluator::disable(long type) +{ + glDisable((GLenum) type); +} + +/*--------------------------------------------------------------------------- + * enable - turn on a curve map + *--------------------------------------------------------------------------- + */ +void +OpenGLCurveEvaluator::enable(long type) +{ + glEnable((GLenum) type); +} + +/*------------------------------------------------------------------------- + * mapgrid1f - define a lattice of points with origin and offset + *------------------------------------------------------------------------- + */ +void +OpenGLCurveEvaluator::mapgrid1f(long nu, REAL u0, REAL u1) +{ + if(output_triangles) + { + global_grid_u0 = u0; + global_grid_u1 = u1; + global_grid_nu = (int) nu; + } + else + glMapGrid1f((GLint) nu, (GLfloat) u0, (GLfloat) u1); +} + +/*------------------------------------------------------------------------- + * bgnmap1 - preamble to curve definition and evaluations + *------------------------------------------------------------------------- + */ +void +OpenGLCurveEvaluator::bgnmap1f(long) +{ + if(output_triangles) + { + //initialized so that no maps are set initially + vertex_flag = 0; + normal_flag = 0; + color_flag = 0; + texcoord_flag = 0; + //no need to worry about gl states when doing callback + } + else + glPushAttrib((GLbitfield) GL_EVAL_BIT); +} + +/*------------------------------------------------------------------------- + * endmap1 - postamble to a curve map + *------------------------------------------------------------------------- + */ +void +OpenGLCurveEvaluator::endmap1f(void) +{ + if(output_triangles) + { + + } + else + glPopAttrib(); +} + +/*------------------------------------------------------------------------- + * map1f - pass a desription of a curve map + *------------------------------------------------------------------------- + */ +void +OpenGLCurveEvaluator::map1f( + long type, /* map type */ + REAL ulo, /* lower parametric bound */ + REAL uhi, /* upper parametric bound */ + long stride, /* distance to next point in REALS */ + long order, /* parametric order */ + REAL *pts /* control points */ +) +{ + if(output_triangles) + { + int dimension = 0; + int which = 0; + switch(type){ + case GL_MAP1_VERTEX_3: + which = 0; + dimension = 3; + break; + case GL_MAP1_VERTEX_4: + which=0; + dimension = 4; + break; + case GL_MAP1_INDEX: + which=2; + dimension = 1; + break; + case GL_MAP1_COLOR_4: + which=2; + dimension = 4; + break; + case GL_MAP1_NORMAL: + which=1; + dimension = 3; + break; + case GL_MAP1_TEXTURE_COORD_1: + which=3; + dimension = 1; + break; + case GL_MAP1_TEXTURE_COORD_2: + which=3; + dimension = 2; + break; + + case GL_MAP1_TEXTURE_COORD_3: + which=3; + dimension = 3; + break; + case GL_MAP1_TEXTURE_COORD_4: + which=3; + dimension = 4; + break; + } + inMap1f(which, dimension, ulo, uhi, stride, order, pts); + } + else + glMap1f((GLenum) type, (GLfloat) ulo, (GLfloat) uhi, (GLint) stride, + (GLint) order, (const GLfloat *) pts); +} + +/*------------------------------------------------------------------------- + * mapmesh1f - evaluate a mesh of points on lattice + *------------------------------------------------------------------------- + */ +void OpenGLCurveEvaluator::mapmesh1f(long style, long from, long to) +{ + if(output_triangles) + { + inMapMesh1f((int) from, (int) to); + } + else + { + switch(style) { + default: + case N_MESHFILL: + case N_MESHLINE: + glEvalMesh1((GLenum) GL_LINE, (GLint) from, (GLint) to); + break; + case N_MESHPOINT: + glEvalMesh1((GLenum) GL_POINT, (GLint) from, (GLint) to); + break; + } + } +} + +/*------------------------------------------------------------------------- + * evalpoint1i - evaluate a point on a curve + *------------------------------------------------------------------------- + */ +void OpenGLCurveEvaluator::evalpoint1i(long i) +{ + glEvalPoint1((GLint) i); +} + +/*------------------------------------------------------------------------- + * evalcoord1f - evaluate a point on a curve + *------------------------------------------------------------------------- + */ +void OpenGLCurveEvaluator::evalcoord1f(long, REAL u) +{ + glEvalCoord1f((GLfloat) u); +} + +void +#ifdef _WIN32 +OpenGLCurveEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)()) +#else +OpenGLCurveEvaluator::putCallBack(GLenum which, _GLUfuncptr fn) +#endif +{ + switch(which) + { + case GLU_NURBS_BEGIN: + beginCallBackN = (void (GLAPIENTRY *) (GLenum)) fn; + break; + case GLU_NURBS_END: + endCallBackN = (void (GLAPIENTRY *) (void)) fn; + break; + case GLU_NURBS_VERTEX: + vertexCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn; + break; + case GLU_NURBS_NORMAL: + normalCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn; + break; + case GLU_NURBS_COLOR: + colorCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn; + break; + case GLU_NURBS_TEXTURE_COORD: + texcoordCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn; + break; + case GLU_NURBS_BEGIN_DATA: + beginCallBackData = (void (GLAPIENTRY *) (GLenum, void*)) fn; + break; + case GLU_NURBS_END_DATA: + endCallBackData = (void (GLAPIENTRY *) (void*)) fn; + break; + case GLU_NURBS_VERTEX_DATA: + vertexCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn; + break; + case GLU_NURBS_NORMAL_DATA: + normalCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn; + break; + case GLU_NURBS_COLOR_DATA: + colorCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn; + break; + case GLU_NURBS_TEXTURE_COORD_DATA: + texcoordCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn; + break; + } +} + +void +OpenGLCurveEvaluator::beginCallBack(GLenum which, void *data) +{ + if(beginCallBackData) + beginCallBackData(which, data); + else if(beginCallBackN) + beginCallBackN(which); +} + +void +OpenGLCurveEvaluator::endCallBack(void *data) +{ + if(endCallBackData) + endCallBackData(data); + else if(endCallBackN) + endCallBackN(); +} + +void +OpenGLCurveEvaluator::vertexCallBack(const GLfloat *vert, void* data) +{ + if(vertexCallBackData) + vertexCallBackData(vert, data); + else if(vertexCallBackN) + vertexCallBackN(vert); +} + + +void +OpenGLCurveEvaluator::normalCallBack(const GLfloat *normal, void* data) +{ + if(normalCallBackData) + normalCallBackData(normal, data); + else if(normalCallBackN) + normalCallBackN(normal); +} + +void +OpenGLCurveEvaluator::colorCallBack(const GLfloat *color, void* data) +{ + if(colorCallBackData) + colorCallBackData(color, data); + else if(colorCallBackN) + colorCallBackN(color); +} + +void +OpenGLCurveEvaluator::texcoordCallBack(const GLfloat *texcoord, void* data) +{ + if(texcoordCallBackData) + texcoordCallBackData(texcoord, data); + else if(texcoordCallBackN) + texcoordCallBackN(texcoord); +} diff --git a/mesalib/src/glu/sgi/libnurbs/interface/glcurveval.h b/mesalib/src/glu/sgi/libnurbs/interface/glcurveval.h new file mode 100644 index 000000000..8fa493034 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/glcurveval.h @@ -0,0 +1,157 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * glcurveval.h + * + */ + +#ifndef __gluglcurveval_h_ +#define __gluglcurveval_h_ + +#include "gluos.h" +#include +#include +#include "basiccrveval.h" + +class CurveMap; + +/*for internal evaluator callback stuff*/ +#ifndef IN_MAX_BEZIER_ORDER +#define IN_MAX_BEZIER_ORDER 40 /*XXX should be bigger than machine order*/ +#endif + +#ifndef IN_MAX_DIMENSION +#define IN_MAX_DIMENSION 4 +#endif + +typedef struct curveEvalMachine{ + REAL uprime; //cached previously evaluated uprime + int k; //the dimension + REAL u1; + REAL u2; + int ustride; + int uorder; + REAL ctlpoints[IN_MAX_BEZIER_ORDER*IN_MAX_DIMENSION]; + REAL ucoeff[IN_MAX_BEZIER_ORDER];//cache the polynomial values +} curveEvalMachine; + +class OpenGLCurveEvaluator : public BasicCurveEvaluator { +public: + OpenGLCurveEvaluator(void); + virtual ~OpenGLCurveEvaluator(void); + void range1f(long, REAL *, REAL *); + void domain1f(REAL, REAL); + void addMap(CurveMap *); + + void enable(long); + void disable(long); + void bgnmap1f(long); + void map1f(long, REAL, REAL, long, long, REAL *); + void mapgrid1f(long, REAL, REAL); + void mapmesh1f(long, long, long); + void evalpoint1i(long); + void evalcoord1f(long, REAL); + void endmap1f(void); + + void bgnline(void); + void endline(void); + + void put_vertices_call_back(int flag) + { + output_triangles = flag; + } +#ifdef _WIN32 + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); +#else + void putCallBack(GLenum which, _GLUfuncptr fn ); +#endif + void set_callback_userData(void *data) + { + userData = data; + } + +/*------------------begin for curveEvalMachine------------*/ +curveEvalMachine em_vertex; +curveEvalMachine em_normal; +curveEvalMachine em_color; +curveEvalMachine em_texcoord; +int vertex_flag; //whether there is a vertex map or not +int normal_flag; //whether there is a normal map or not +int color_flag; //whether there is a color map or not +int texcoord_flag; //whether there is a texture map or not + +REAL global_grid_u0; +REAL global_grid_u1; +int global_grid_nu; + +void inMap1f(int which, //0: vert, 1: norm, 2: color, 3: tex + int dimension, + REAL ulower, + REAL uupper, + int ustride, + int uorder, + REAL *ctlpoints); + +void inPreEvaluate(int order, REAL vprime, REAL *coeff); +void inDoDomain1(curveEvalMachine *em, REAL u, REAL *retPoint); +void inDoEvalCoord1(REAL u); +void inMapMesh1f(int umin, int umax); + +void (GLAPIENTRY *beginCallBackN) (GLenum type); +void (GLAPIENTRY *endCallBackN) (void); +void (GLAPIENTRY *vertexCallBackN) (const GLfloat *vert); +void (GLAPIENTRY *normalCallBackN) (const GLfloat *normal); +void (GLAPIENTRY *colorCallBackN) (const GLfloat *color); +void (GLAPIENTRY *texcoordCallBackN) (const GLfloat *texcoord); + +void (GLAPIENTRY *beginCallBackData) (GLenum type, void* data); +void (GLAPIENTRY *endCallBackData) (void* data); +void (GLAPIENTRY *vertexCallBackData) (const GLfloat *vert, void* data); +void (GLAPIENTRY *normalCallBackData) (const GLfloat *normal, void* data); +void (GLAPIENTRY *colorCallBackData) (const GLfloat *color, void* data); +void (GLAPIENTRY *texcoordCallBackData) (const GLfloat *texcoord, void* data); + +void* userData; //the opaque pointer for Data callback functions +void beginCallBack(GLenum type, void* data); +void endCallBack(void* data); +void vertexCallBack(const GLfloat *vert, void *data); +void normalCallBack(const GLfloat *normal, void* data); +void colorCallBack(const GLfloat *color, void* data); +void texcoordCallBack(const GLfloat *texcoord, void* data); + + +/*------------------end for curveEvalMachine------------*/ + +private: + int output_triangles; //true 1; false 0 +}; + +#endif /* __gluglcurveval_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/interface/glimports.h b/mesalib/src/glu/sgi/libnurbs/interface/glimports.h new file mode 100644 index 000000000..6e69feb40 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/glimports.h @@ -0,0 +1,42 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * glimports.h + * + */ + +#ifndef __gluimports_h_ +#define __gluimports_h_ + +#include "mystdlib.h" +#include "mystdio.h" + +#endif /* __gluimports_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/interface/glinterface.cc b/mesalib/src/glu/sgi/libnurbs/interface/glinterface.cc new file mode 100644 index 000000000..ba64bcd2d --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/glinterface.cc @@ -0,0 +1,469 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include +#include +#include +#include "glimports.h" +#include "glrenderer.h" +#include "nurbsconsts.h" + +//#define DOWN_LOAD_NURBS +#ifdef DOWN_LOAD_NURBS + +#include "oglTrimNurbs.h" +static int surfcount = 0; +static oglTrimNurbs* otn = NULL; +nurbSurf* tempNurb = NULL; +oglTrimLoops* tempTrim = NULL; +#endif + + +//for LOD +extern "C" {void glu_LOD_eval_list(GLUnurbs *nurb, int level);} + +void glu_LOD_eval_list(GLUnurbs *nurb, int level) +{ + nurb->LOD_eval_list(level); +} + +GLUnurbs * GLAPIENTRY +gluNewNurbsRenderer(void) +{ + GLUnurbs *t; + + t = new GLUnurbs(); + return t; +} + +void GLAPIENTRY +gluDeleteNurbsRenderer(GLUnurbs *r) +{ + delete r; +} + +extern "C" +void GLAPIENTRY + +gluDeleteNurbsTessellatorEXT(GLUnurbsObj *r) +{ + delete r; +} + +void GLAPIENTRY +gluBeginSurface(GLUnurbs *r) +{ +#ifdef DOWN_LOAD_NURBS +surfcount++; +tempTrim = OTL_make(10,10); +#endif + r->bgnsurface(0); +} + +void GLAPIENTRY +gluBeginCurve(GLUnurbs *r) +{ + r->bgncurve(0); +} + +void GLAPIENTRY +gluEndCurve(GLUnurbs *r) +{ + r->endcurve(); +} + +void GLAPIENTRY +gluEndSurface(GLUnurbs *r) +{ +#ifdef DOWN_LOAD_NURBS +if(surfcount == 1) + otn = OTN_make(1); +OTN_insert(otn, tempNurb, tempTrim); +if(surfcount >= 1) +{ +#ifdef DEBUG +printf("write file\n"); +#endif +OTN_write(otn, "out.otn"); + +} +#endif + + r->endsurface(); +} + +void GLAPIENTRY +gluBeginTrim(GLUnurbs *r) +{ +#ifdef DOWN_LOAD_NURBS +OTL_bgnTrim(tempTrim); +#endif + + r->bgntrim(); +} + +void GLAPIENTRY +gluEndTrim(GLUnurbs *r) +{ +#ifdef DOWN_LOAD_NURBS +OTL_endTrim(tempTrim); +#endif + r->endtrim(); +} + +void GLAPIENTRY +gluPwlCurve(GLUnurbs *r, GLint count, INREAL array[], + GLint stride, GLenum type) +{ +#ifdef DOWN_LOAD_NURBS +OTL_pwlCurve(tempTrim, count, array, stride, type); +#endif + + int realType; + switch(type) { + case GLU_MAP1_TRIM_2: + realType = N_P2D; + break; + case GLU_MAP1_TRIM_3: + realType = N_P2DR; + break; + default: + realType = type; + break; + } + r->pwlcurve(count, array, sizeof(INREAL) * stride, realType); +} + +void GLAPIENTRY +gluNurbsCurve(GLUnurbs *r, GLint nknots, INREAL knot[], GLint stride, + INREAL ctlarray[], GLint order, GLenum type) +{ +#ifdef DOWN_LOAD_NURBS +OTL_nurbsCurve(tempTrim, nknots, knot, stride, ctlarray, order, type); +#endif + + int realType; + + switch(type) { + case GLU_MAP1_TRIM_2: + realType = N_P2D; + break; + case GLU_MAP1_TRIM_3: + realType = N_P2DR; + break; + default: + realType = type; + break; + } + + r->nurbscurve(nknots, knot, sizeof(INREAL) * stride, ctlarray, order, + realType); +} + +void GLAPIENTRY +gluNurbsSurface(GLUnurbs *r, GLint sknot_count, GLfloat *sknot, + GLint tknot_count, GLfloat *tknot, + GLint s_stride, GLint t_stride, + GLfloat *ctlarray, GLint sorder, GLint torder, + GLenum type) +{ +#ifdef DOWN_LOAD_NURBS + { + int dimension; + switch(type){ + case GL_MAP2_VERTEX_3: + dimension = 3; + break; + case GL_MAP2_VERTEX_4: + dimension = 4; + break; + default: + fprintf(stderr, "error in glinterface.c++, type no implemented\n"); + exit(1); + } +tempNurb = nurbSurfMake(sknot_count, sknot, + tknot_count, tknot, + sorder, torder, + dimension, + ctlarray, + s_stride, t_stride); + + } +#endif + + r->nurbssurface(sknot_count, sknot, tknot_count, tknot, + sizeof(INREAL) * s_stride, sizeof(INREAL) * t_stride, + ctlarray, sorder, torder, type); +} + +void GLAPIENTRY +gluLoadSamplingMatrices(GLUnurbs *r, const GLfloat modelMatrix[16], + const GLfloat projMatrix[16], + const GLint viewport[4]) +{ + r->useGLMatrices(modelMatrix, projMatrix, viewport); +} + +void GLAPIENTRY +gluNurbsProperty(GLUnurbs *r, GLenum property, GLfloat value) +{ + GLfloat nurbsValue; + + switch (property) { + case GLU_AUTO_LOAD_MATRIX: + r->setautoloadmode(value); + return; + + case GLU_CULLING: + if (value != 0.0) { + nurbsValue = N_CULLINGON; + } else { + nurbsValue = N_NOCULLING; + } + r->setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, nurbsValue); + r->setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLING, nurbsValue); + r->setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLING, nurbsValue); + r->setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLING, nurbsValue); + return; + + case GLU_SAMPLING_METHOD: + if (value == GLU_PATH_LENGTH) { + nurbsValue = N_PATHLENGTH; + } else if (value == GLU_PARAMETRIC_ERROR) { + nurbsValue = N_PARAMETRICDISTANCE; + } else if (value == GLU_DOMAIN_DISTANCE) { + nurbsValue = N_DOMAINDISTANCE; + r->set_is_domain_distance_sampling(1); //optimzing untrimmed case + + } else if (value == GLU_OBJECT_PARAMETRIC_ERROR) { + nurbsValue = N_OBJECTSPACE_PARA; + r->setautoloadmode( 0.0 ); + r->setSamplingMatrixIdentity(); + } else if (value == GLU_OBJECT_PATH_LENGTH) { + nurbsValue = N_OBJECTSPACE_PATH; + r->setautoloadmode( 0.0 ); + r->setSamplingMatrixIdentity(); + } else { + r->postError(GLU_INVALID_VALUE); + return; + } + + r->setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue); + r->setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue); + r->setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMETHOD, nurbsValue); + r->setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMETHOD, nurbsValue); + return; + + case GLU_SAMPLING_TOLERANCE: + r->setnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value); + r->setnurbsproperty(GL_MAP2_VERTEX_4, N_PIXEL_TOLERANCE, value); + r->setnurbsproperty(GL_MAP1_VERTEX_3, N_PIXEL_TOLERANCE, value); + r->setnurbsproperty(GL_MAP1_VERTEX_4, N_PIXEL_TOLERANCE, value); + return; + + case GLU_PARAMETRIC_TOLERANCE: + r->setnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value); + r->setnurbsproperty(GL_MAP2_VERTEX_4, N_ERROR_TOLERANCE, value); + r->setnurbsproperty(GL_MAP1_VERTEX_3, N_ERROR_TOLERANCE, value); + r->setnurbsproperty(GL_MAP1_VERTEX_4, N_ERROR_TOLERANCE, value); + return; + + + case GLU_DISPLAY_MODE: + + if (value == GLU_FILL) { + nurbsValue = N_FILL; + } else if (value == GLU_OUTLINE_POLYGON) { + nurbsValue = N_OUTLINE_POLY; + } else if (value == GLU_OUTLINE_PATCH) { + nurbsValue = N_OUTLINE_PATCH; + } else { + r->postError(GLU_INVALID_VALUE); + return; + } + r->setnurbsproperty(N_DISPLAY, nurbsValue); + + break; + + case GLU_U_STEP: + r->setnurbsproperty(GL_MAP1_VERTEX_3, N_S_STEPS, value); + r->setnurbsproperty(GL_MAP1_VERTEX_4, N_S_STEPS, value); + r->setnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value); + r->setnurbsproperty(GL_MAP2_VERTEX_4, N_S_STEPS, value); + + //added for optimizing untrimmed case + r->set_domain_distance_u_rate(value); + break; + + case GLU_V_STEP: + r->setnurbsproperty(GL_MAP1_VERTEX_3, N_T_STEPS, value); + r->setnurbsproperty(GL_MAP1_VERTEX_4, N_T_STEPS, value); + r->setnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, value); + r->setnurbsproperty(GL_MAP2_VERTEX_4, N_T_STEPS, value); + + //added for optimizing untrimmed case + r->set_domain_distance_v_rate(value); + break; + + case GLU_NURBS_MODE: + if(value == GLU_NURBS_RENDERER) + r->put_callbackFlag(0); + else if(value == GLU_NURBS_TESSELLATOR) + r->put_callbackFlag(1); + else + r->postError(GLU_INVALID_ENUM); + break; + + default: + r->postError(GLU_INVALID_ENUM); + return; + } +} + +void GLAPIENTRY +gluGetNurbsProperty(GLUnurbs *r, GLenum property, GLfloat *value) +{ + GLfloat nurbsValue; + + switch(property) { + case GLU_AUTO_LOAD_MATRIX: + if (r->getautoloadmode()) { + *value = GL_TRUE; + } else { + *value = GL_FALSE; + } + break; + case GLU_CULLING: + r->getnurbsproperty(GL_MAP2_VERTEX_3, N_CULLING, &nurbsValue); + if (nurbsValue == N_CULLINGON) { + *value = GL_TRUE; + } else { + *value = GL_FALSE; + } + break; + case GLU_SAMPLING_METHOD: + r->getnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, value); + if(*value == N_PATHLENGTH) + *value = GLU_PATH_LENGTH; + else if(*value == N_PARAMETRICDISTANCE) + *value = GLU_PARAMETRIC_ERROR; + else if(*value == N_DOMAINDISTANCE) + *value = GLU_DOMAIN_DISTANCE; + else if(*value == N_OBJECTSPACE_PATH) + *value = GLU_OBJECT_PATH_LENGTH; + else if(*value == N_OBJECTSPACE_PARA) + *value = GLU_OBJECT_PARAMETRIC_ERROR; + break; + case GLU_SAMPLING_TOLERANCE: + r->getnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, value); + break; + case GLU_PARAMETRIC_TOLERANCE: + r->getnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, value); + break; + + case GLU_U_STEP: + r->getnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, value); + break; + case GLU_V_STEP: + r->getnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, value); + break; + case GLU_DISPLAY_MODE: + r->getnurbsproperty(N_DISPLAY, &nurbsValue); + if (nurbsValue == N_FILL) { + *value = GLU_FILL; + } else if (nurbsValue == N_OUTLINE_POLY) { + *value = GLU_OUTLINE_POLYGON; + } else { + *value = GLU_OUTLINE_PATCH; + } + break; + + case GLU_NURBS_MODE: + if(r->is_callback()) + *value = GLU_NURBS_TESSELLATOR; + else + *value = GLU_NURBS_RENDERER; + break; + + default: + r->postError(GLU_INVALID_ENUM); + return; + } +} + +extern "C" void GLAPIENTRY +gluNurbsCallback(GLUnurbs *r, GLenum which, _GLUfuncptr fn ) +{ + switch (which) { + case GLU_NURBS_BEGIN: + case GLU_NURBS_END: + case GLU_NURBS_VERTEX: + case GLU_NURBS_NORMAL: + case GLU_NURBS_TEXTURE_COORD: + case GLU_NURBS_COLOR: + case GLU_NURBS_BEGIN_DATA: + case GLU_NURBS_END_DATA: + case GLU_NURBS_VERTEX_DATA: + case GLU_NURBS_NORMAL_DATA: + case GLU_NURBS_TEXTURE_COORD_DATA: + case GLU_NURBS_COLOR_DATA: + r->putSurfCallBack(which, fn); + break; + + case GLU_NURBS_ERROR: + r->errorCallback = (void (APIENTRY *)( GLenum e )) fn; + break; + default: + r->postError(GLU_INVALID_ENUM); + return; + } +} + +extern "C" +void GLAPIENTRY +gluNurbsCallbackDataEXT(GLUnurbs* r, void* userData) +{ + r->setNurbsCallbackData(userData); +} + +extern "C" +void GLAPIENTRY +gluNurbsCallbackData(GLUnurbs* r, void* userData) +{ + gluNurbsCallbackDataEXT(r,userData); +} diff --git a/mesalib/src/glu/sgi/libnurbs/interface/glrenderer.cc b/mesalib/src/glu/sgi/libnurbs/interface/glrenderer.cc new file mode 100644 index 000000000..17123fbc6 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/glrenderer.cc @@ -0,0 +1,301 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include "glimports.h" +#include "glrenderer.h" + +GLUnurbs::GLUnurbs() + : NurbsTessellator(curveEvaluator, surfaceEvaluator) +{ + redefineMaps(); + defineMap(GL_MAP2_NORMAL, 0, 3); + defineMap(GL_MAP1_NORMAL, 0, 3); + defineMap(GL_MAP2_TEXTURE_COORD_1, 0, 1); + defineMap(GL_MAP1_TEXTURE_COORD_1, 0, 1); + defineMap(GL_MAP2_TEXTURE_COORD_2, 0, 2); + defineMap(GL_MAP1_TEXTURE_COORD_2, 0, 2); + defineMap(GL_MAP2_TEXTURE_COORD_3, 0, 3); + defineMap(GL_MAP1_TEXTURE_COORD_3, 0, 3); + defineMap(GL_MAP2_TEXTURE_COORD_4, 1, 4); + defineMap(GL_MAP1_TEXTURE_COORD_4, 1, 4); + defineMap(GL_MAP2_VERTEX_4, 1, 4); + defineMap(GL_MAP1_VERTEX_4, 1, 4); + defineMap(GL_MAP2_VERTEX_3, 0, 3); + defineMap(GL_MAP1_VERTEX_3, 0, 3); + defineMap(GL_MAP2_COLOR_4, 0, 4); + defineMap(GL_MAP1_COLOR_4, 0, 4); + defineMap(GL_MAP2_INDEX, 0, 1); + defineMap(GL_MAP1_INDEX, 0, 1); + + setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMETHOD, (float) N_PATHLENGTH); + setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMETHOD, (float) N_PATHLENGTH); + setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMETHOD, (float) N_PATHLENGTH); + setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMETHOD, (float) N_PATHLENGTH); + + setnurbsproperty(GL_MAP1_VERTEX_3, N_PIXEL_TOLERANCE, (float) 50.0); + setnurbsproperty(GL_MAP1_VERTEX_4, N_PIXEL_TOLERANCE, (float) 50.0); + setnurbsproperty(GL_MAP2_VERTEX_3, N_PIXEL_TOLERANCE, (float) 50.0); + setnurbsproperty(GL_MAP2_VERTEX_4, N_PIXEL_TOLERANCE, (float) 50.0); + + setnurbsproperty(GL_MAP1_VERTEX_3, N_ERROR_TOLERANCE, (float) 0.50); + setnurbsproperty(GL_MAP1_VERTEX_4, N_ERROR_TOLERANCE, (float) 0.50); + setnurbsproperty(GL_MAP2_VERTEX_3, N_ERROR_TOLERANCE, (float) 0.50); + setnurbsproperty(GL_MAP2_VERTEX_4, N_ERROR_TOLERANCE, (float) 0.50); + + setnurbsproperty(GL_MAP1_VERTEX_3, N_S_STEPS, (float) 100.0); + setnurbsproperty(GL_MAP1_VERTEX_4, N_S_STEPS, (float) 100.0); + setnurbsproperty(GL_MAP2_VERTEX_3, N_S_STEPS, (float) 100.0); + setnurbsproperty(GL_MAP2_VERTEX_4, N_S_STEPS, (float) 100.0); + + //added for optimizing untrimmed case + set_domain_distance_u_rate(100.0); + + setnurbsproperty(GL_MAP1_VERTEX_3, N_T_STEPS, (float) 100.0); + setnurbsproperty(GL_MAP1_VERTEX_4, N_T_STEPS, (float) 100.0); + setnurbsproperty(GL_MAP2_VERTEX_3, N_T_STEPS, (float) 100.0); + setnurbsproperty(GL_MAP2_VERTEX_4, N_T_STEPS, (float) 100.0); + + //added for optimizing untrimmed case + set_domain_distance_v_rate(100.0); + set_is_domain_distance_sampling(0); //since the default is path_length + + //default autoloadmode is true + autoloadmode = 1; + + //default callbackFlag is 0 + callbackFlag = 0; + + errorCallback = NULL; +} + +void +GLUnurbs::bgnrender(void) +{ + if (autoloadmode) { + loadGLMatrices(); + } +} + +void +GLUnurbs::endrender(void) +{ +} + +void +GLUnurbs::errorHandler(int i) +{ + int gluError; + + gluError = i + (GLU_NURBS_ERROR1 - 1); + postError( gluError ); +} + +void +GLUnurbs::loadGLMatrices(void) +{ + GLfloat vmat[4][4]; + GLint viewport[4]; + + grabGLMatrix((GLfloat (*)[4]) vmat); + loadCullingMatrix((GLfloat (*)[4]) vmat); + ::glGetIntegerv((GLenum) GL_VIEWPORT, (GLint *) viewport); + loadSamplingMatrix((const GLfloat (*)[4]) vmat, (const GLint *) viewport); +} + +void +GLUnurbs::useGLMatrices(const GLfloat modelMatrix[16], + const GLfloat projMatrix[16], + const GLint viewport[4]) +{ + GLfloat vmat[4][4]; + + multmatrix4d(vmat, (const GLfloat (*)[4]) modelMatrix, + (const GLfloat (*)[4]) projMatrix); + loadCullingMatrix((GLfloat (*)[4]) vmat); + loadSamplingMatrix((const GLfloat (*)[4]) vmat, (const GLint *) viewport); +} + +/*-------------------------------------------------------------------------- + * grabGLMatrix + *-------------------------------------------------------------------------- + */ + +void +GLUnurbs::grabGLMatrix(GLfloat vmat[4][4]) +{ + GLfloat m1[4][4], m2[4][4]; + + ::glGetFloatv((GLenum) GL_MODELVIEW_MATRIX, (GLfloat *) &(m1[0][0])); + ::glGetFloatv((GLenum) GL_PROJECTION_MATRIX, (GLfloat *) &(m2[0][0])); + multmatrix4d((GLfloat (*)[4]) vmat, + (const GLfloat (*)[4]) m1, (const GLfloat (*)[4]) m2); +} + +//for object space tesselation: view independent +void +GLUnurbs::setSamplingMatrixIdentity( void ) +{ + INREAL smat[4][4] = { + {1,0,0,0}, + {0,1,0,0}, + {0,0,1,0}, + {0,0,0,1} + }; + const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]); + const long cstride = 1; + + setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + cstride); + setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + cstride); + setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + cstride); + setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + cstride); +} + + +void +GLUnurbs::loadSamplingMatrix(const GLfloat vmat[4][4], + const GLint viewport[4]) +{ + + /* rescale the mapping to correspond to pixels in x/y */ + REAL xsize = 0.5 * (REAL) (viewport[2]); + REAL ysize = 0.5 * (REAL) (viewport[3]); + + INREAL smat[4][4]; + smat[0][0] = vmat[0][0] * xsize; + smat[1][0] = vmat[1][0] * xsize; + smat[2][0] = vmat[2][0] * xsize; + smat[3][0] = vmat[3][0] * xsize; + + smat[0][1] = vmat[0][1] * ysize; + smat[1][1] = vmat[1][1] * ysize; + smat[2][1] = vmat[2][1] * ysize; + smat[3][1] = vmat[3][1] * ysize; + + smat[0][2] = 0.0; + smat[1][2] = 0.0; + smat[2][2] = 0.0; + smat[3][2] = 0.0; + + smat[0][3] = vmat[0][3]; + smat[1][3] = vmat[1][3]; + smat[2][3] = vmat[2][3]; + smat[3][3] = vmat[3][3]; + + const long rstride = sizeof(smat[0]) / sizeof(smat[0][0]); + const long cstride = 1; + + setnurbsproperty(GL_MAP1_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + cstride); + setnurbsproperty(GL_MAP1_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + cstride); + setnurbsproperty(GL_MAP2_VERTEX_3, N_SAMPLINGMATRIX, &smat[0][0], rstride, + cstride); + setnurbsproperty(GL_MAP2_VERTEX_4, N_SAMPLINGMATRIX, &smat[0][0], rstride, + cstride); +} + +void +GLUnurbs::loadCullingMatrix(GLfloat vmat[4][4]) +{ + INREAL cmat[4][4]; + + cmat[0][0] = vmat[0][0]; + cmat[0][1] = vmat[0][1]; + cmat[0][2] = vmat[0][2]; + cmat[0][3] = vmat[0][3]; + + cmat[1][0] = vmat[1][0]; + cmat[1][1] = vmat[1][1]; + cmat[1][2] = vmat[1][2]; + cmat[1][3] = vmat[1][3]; + + cmat[2][0] = vmat[2][0]; + cmat[2][1] = vmat[2][1]; + cmat[2][2] = vmat[2][2]; + cmat[2][3] = vmat[2][3]; + + cmat[3][0] = vmat[3][0]; + cmat[3][1] = vmat[3][1]; + cmat[3][2] = vmat[3][2]; + cmat[3][3] = vmat[3][3]; + + const long rstride = sizeof(cmat[0]) / sizeof(cmat[0][0]); + const long cstride = 1; + + setnurbsproperty(GL_MAP2_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, + cstride); + setnurbsproperty(GL_MAP2_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, + cstride); + //added for curves by zl + setnurbsproperty(GL_MAP1_VERTEX_3, N_CULLINGMATRIX, &cmat[0][0], rstride, + cstride); + setnurbsproperty(GL_MAP1_VERTEX_4, N_CULLINGMATRIX, &cmat[0][0], rstride, + cstride); +} + +/*--------------------------------------------------------------------- + * A = B * MAT ; transform a 4d vector through a 4x4 matrix + *--------------------------------------------------------------------- + */ +void +GLUnurbs::transform4d(GLfloat A[4], GLfloat B[4], GLfloat mat[4][4]) +{ + + A[0] = B[0]*mat[0][0] + B[1]*mat[1][0] + B[2]*mat[2][0] + B[3]*mat[3][0]; + A[1] = B[0]*mat[0][1] + B[1]*mat[1][1] + B[2]*mat[2][1] + B[3]*mat[3][1]; + A[2] = B[0]*mat[0][2] + B[1]*mat[1][2] + B[2]*mat[2][2] + B[3]*mat[3][2]; + A[3] = B[0]*mat[0][3] + B[1]*mat[1][3] + B[2]*mat[2][3] + B[3]*mat[3][3]; +} + +/*--------------------------------------------------------------------- + * new = [left][right] ; multiply two matrices together + *--------------------------------------------------------------------- + */ +void +GLUnurbs::multmatrix4d (GLfloat n[4][4], const GLfloat left[4][4], + const GLfloat right[4][4]) +{ + transform4d ((GLfloat *) n[0],(GLfloat *) left[0],(GLfloat (*)[4]) right); + transform4d ((GLfloat *) n[1],(GLfloat *) left[1],(GLfloat (*)[4]) right); + transform4d ((GLfloat *) n[2],(GLfloat *) left[2],(GLfloat (*)[4]) right); + transform4d ((GLfloat *) n[3],(GLfloat *) left[3],(GLfloat (*)[4]) right); +} diff --git a/mesalib/src/glu/sgi/libnurbs/interface/glrenderer.h b/mesalib/src/glu/sgi/libnurbs/interface/glrenderer.h new file mode 100644 index 000000000..3b72d44d1 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/glrenderer.h @@ -0,0 +1,146 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * glrenderer.h + * + */ + +#ifndef __gluglrenderer_h_ +#define __gluglrenderer_h_ + +#include +#include +#include "nurbstess.h" +#include "glsurfeval.h" +#include "glcurveval.h" + +extern "C" { + typedef void (APIENTRY *errorCallbackType)( GLenum ); +} + +class GLUnurbs : public NurbsTessellator { + +public: + GLUnurbs( void ); + void loadGLMatrices( void ); + void useGLMatrices( const GLfloat modelMatrix[16], + const GLfloat projMatrix[16], + const GLint viewport[4] ); + void setSamplingMatrixIdentity( void ); + + void errorHandler( int ); + void bgnrender( void ); + void endrender( void ); + void setautoloadmode( INREAL value ) + { + + if (value) autoloadmode = GL_TRUE; + else autoloadmode = GL_FALSE; + + } + GLboolean getautoloadmode( void ) { return autoloadmode; } + + errorCallbackType errorCallback; + void postError( int which ) + { if (errorCallback) (errorCallback)( (GLenum)which ); } +#ifdef _WIN32 + void putSurfCallBack(GLenum which, void (GLAPIENTRY *fn)() ) +#else + void putSurfCallBack(GLenum which, _GLUfuncptr fn ) +#endif + { + curveEvaluator.putCallBack(which, fn); + surfaceEvaluator.putCallBack(which, fn); + } + + int get_vertices_call_back() + { + return surfaceEvaluator.get_vertices_call_back(); + } + + void put_vertices_call_back(int flag) + { + surfaceEvaluator.put_vertices_call_back(flag); + } + + int get_callback_auto_normal() + { + return surfaceEvaluator.get_callback_auto_normal(); + } + + void put_callback_auto_normal(int flag) + { + surfaceEvaluator.put_callback_auto_normal(flag); + } + + void setNurbsCallbackData(void* userData) + { + curveEvaluator.set_callback_userData(userData); + surfaceEvaluator.set_callback_userData(userData); + } + + + //for LOD + void LOD_eval_list(int level) + { + surfaceEvaluator.LOD_eval_list(level); + } + + //NEWCALLBACK + int is_callback() + { + return callbackFlag; + } + void put_callbackFlag(int flag) + { + callbackFlag = flag; + surfaceEvaluator.put_vertices_call_back(flag); + curveEvaluator.put_vertices_call_back(flag); + } + +private: + GLboolean autoloadmode; + OpenGLSurfaceEvaluator surfaceEvaluator; + OpenGLCurveEvaluator curveEvaluator; + + void loadSamplingMatrix( const GLfloat vmat[4][4], + const GLint viewport[4] ); + void loadCullingMatrix( GLfloat vmat[4][4] ); + static void grabGLMatrix( GLfloat vmat[4][4] ); + static void transform4d( GLfloat A[4], GLfloat B[4], + GLfloat mat[4][4] ); + static void multmatrix4d( GLfloat n[4][4], const GLfloat left[4][4], + const GLfloat right[4][4] ); + + int callbackFlag; +}; + +#endif /* __gluglrenderer_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/interface/glsurfeval.cc b/mesalib/src/glu/sgi/libnurbs/interface/glsurfeval.cc new file mode 100644 index 000000000..b5bfab1e2 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/glsurfeval.cc @@ -0,0 +1,1293 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * glsurfeval.c++ + * + */ + +/* Polynomial Evaluator Interface */ +#include "gluos.h" +#include +#include "glimports.h" +#include "glrenderer.h" +#include "glsurfeval.h" +#include "nurbsconsts.h" +#include "bezierPatchMesh.h" + + +//extern int surfcount; +//int surfcount=0; + +/*#define USE_INTERNAL_EVAL*/ //use internal evaluator + +/*whether do evaluation or not*/ +/*#define NO_EVALUATION*/ + +//#define USE_LOD //for LOD test, have to turn on USE_LOD in insurfeval.c++ too + +/*for statistics*/ +//#define STATISTICS +#ifdef STATISTICS +static int STAT_num_of_triangles=0; +static int STAT_num_of_eval_vertices=0; +static int STAT_num_of_quad_strips=0; +#endif + +/*for output triangles*/ +/*#define OUTPUT_TRIANGLES*/ + + +/*#define FOR_CHRIS*/ +#ifdef FOR_CHRIS +extern "C" { void evalUStripExt(int n_upper, REAL v_upper, REAL* upper_val, + int n_lower, REAL v_lower, REAL* lower_val);} + +extern "C" { void evalVStripExt(int n_left, REAL u_left, REAL* left_val, + int n_right, REAL u_right, REAL* right_val); + } +#endif + + +/**************begin for LOD_eval_list***********/ +void OpenGLSurfaceEvaluator::LOD_eval_list(int level) +{ + if(level == 0) + LOD_eval_level = 1; + else if(level == 1) + LOD_eval_level = 2; + else if(level == 2) + LOD_eval_level = 4; + else + LOD_eval_level = 8; + + inBPMListEvalEM(global_bpm); +} + + +OpenGLSurfaceEvaluator::OpenGLSurfaceEvaluator() +{ + int i; + + for (i=0; i= n_upper) /*case1: no more in upper*/ + { + if(j= n_lower) /*case2: no more in lower*/ + { + if(i=i; k--) /*reverse order for two-side lighting*/ + { + coord2f(upper_val[k], v_upper); +// glNormal3fv(upperNormal[k]); +// glVertex3fv(upperXYZ[k]); + } + + endtfan(); + } + break; /*exit the main loop*/ + } + else /* case3: neither is empty, plus the leftMostV, there is at least one triangle to output*/ + { + if(upper_val[i] <= lower_val[j]) + { + bgntfan(); + coord2f(lower_val[j], v_lower); +// glNormal3fv(lowerNormal[j]); +// glVertex3fv(lowerXYZ[j]); + + /*find the last k>=i such that + *upperverts[k][0] <= lowerverts[j][0] + */ + k=i; + + while(k lower_val[j]) + break; + k++; + + } + k--; + + + for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ + { + coord2f(upper_val[l], v_upper); +// glNormal3fv(upperNormal[l]); +// glVertex3fv(upperXYZ[l]); + + } + coord2f(leftMostV[0], leftMostV[1]); +// glNormal3fv(leftMostNormal); +// glVertex3fv(leftMostXYZ); + + endtfan(); + + /*update i and leftMostV for next loop + */ + i = k+1; + + leftMostV[0] = upper_val[k]; + leftMostV[1] = v_upper; +// leftMostNormal = upperNormal[k]; +// leftMostXYZ = upperXYZ[k]; + } + else /*upperVerts[i][0] > lowerVerts[j][0]*/ + { + bgntfan(); + coord2f(upper_val[i], v_upper); +// glNormal3fv(upperNormal[i]); +// glVertex3fv(upperXYZ[i]); + + coord2f(leftMostV[0], leftMostV[1]); +// glNormal3fv(leftMostNormal); +// glVertex3fv(leftMostXYZ); + + + /*find the last k>=j such that + *lowerverts[k][0] < upperverts[i][0] + */ + k=j; + while(k< n_lower) + { + if(lower_val[k] >= upper_val[i]) + break; + coord2f(lower_val[k], v_lower); +// glNormal3fv(lowerNormal[k]); +// glVertex3fv(lowerXYZ[k]); + + k++; + } + endtfan(); + + /*update j and leftMostV for next loop + */ + j=k; + leftMostV[0] = lower_val[j-1]; + leftMostV[1] = v_lower; + +// leftMostNormal = lowerNormal[j-1]; +// leftMostXYZ = lowerXYZ[j-1]; + } + } + } + //clean up +// free(upperXYZ); +// free(lowerXYZ); +// free(upperNormal); +// free(lowerNormal); +#endif + +} + + +void +OpenGLSurfaceEvaluator::evalVStrip(int n_left, REAL u_left, REAL* left_val, int n_right, REAL u_right, REAL* right_val) +{ +#ifdef USE_INTERNAL_EVAL + inEvalVStrip(n_left, u_left, left_val, + n_right, u_right, right_val); +#else + +#ifdef FOR_CHRIS + evalVStripExt(n_left, u_left, left_val, + n_right, u_right, right_val); + return; + +#endif + + int i,j,k,l; + REAL botMostV[2]; + /* + *the algorithm works by scanning from bot to top. + *botMostV: the bot most of the remaining verteces (on both left and right). + * it could an element of leftVerts or rightVerts. + *i: leftVerts[i] is the first vertex to the top of botMostV on left line + *j: rightVerts[j] is the first vertex to the top of botMostV on rightline + */ + + /*initialize i,j,and botMostV + */ + if(left_val[0] <= right_val[0]) + { + i=1; + j=0; + + botMostV[0] = u_left; + botMostV[1] = left_val[0]; + } + else + { + i=0; + j=1; + + botMostV[0] = u_right; + botMostV[1] = right_val[0]; + } + + /*the main loop. + *the invariance is that: + *at the beginning of each loop, the meaning of i,j,and botMostV are + *maintained + */ + while(1) + { + if(i >= n_left) /*case1: no more in left*/ + { + if(j= n_right) /*case2: no more in right*/ + { + if(i=i; k--) /*reverse order for two-side lighting*/ + { + coord2f(u_left, left_val[k]); +// glNormal3fv(leftNormal[k]); +// glVertex3fv(leftXYZ[k]); + } + + endtfan(); + } + break; /*exit the main loop*/ + } + else /* case3: neither is empty, plus the botMostV, there is at least one triangle to output*/ + { + if(left_val[i] <= right_val[j]) + { + bgntfan(); + coord2f(u_right, right_val[j]); +// glNormal3fv(rightNormal[j]); +// glVertex3fv(rightXYZ[j]); + + /*find the last k>=i such that + *leftverts[k][0] <= rightverts[j][0] + */ + k=i; + + while(k right_val[j]) + break; + k++; + + } + k--; + + + for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ + { + coord2f(u_left, left_val[l]); +// glNormal3fv(leftNormal[l]); +// glVertex3fv(leftXYZ[l]); + + } + coord2f(botMostV[0], botMostV[1]); +// glNormal3fv(botMostNormal); +// glVertex3fv(botMostXYZ); + + endtfan(); + + /*update i and botMostV for next loop + */ + i = k+1; + + botMostV[0] = u_left; + botMostV[1] = left_val[k]; +// botMostNormal = leftNormal[k]; +// botMostXYZ = leftXYZ[k]; + } + else /*left_val[i] > right_val[j])*/ + { + bgntfan(); + coord2f(u_left, left_val[i]); +// glNormal3fv(leftNormal[i]); +// glVertex3fv(leftXYZ[i]); + + coord2f(botMostV[0], botMostV[1]); +// glNormal3fv(botMostNormal); +// glVertex3fv(botMostXYZ); + + + /*find the last k>=j such that + *rightverts[k][0] < leftverts[i][0] + */ + k=j; + while(k< n_right) + { + if(right_val[k] >= left_val[i]) + break; + coord2f(u_right, right_val[k]); +// glNormal3fv(rightNormal[k]); +// glVertex3fv(rightXYZ[k]); + + k++; + } + endtfan(); + + /*update j and botMostV for next loop + */ + j=k; + botMostV[0] = u_right; + botMostV[1] = right_val[j-1]; + +// botMostNormal = rightNormal[j-1]; +// botMostXYZ = rightXYZ[j-1]; + } + } + } + //clean up +// free(leftXYZ); +// free(leftNormal); +// free(rightXYZ); +// free(rightNormal); +#endif +} + + +void +OpenGLSurfaceEvaluator::bgnqstrip(void) +{ + if(output_triangles) + bezierPatchMeshBeginStrip(global_bpm, GL_QUAD_STRIP); + else + glBegin((GLenum) GL_QUAD_STRIP); + +#ifdef STATISTICS + STAT_num_of_quad_strips++; +#endif +} + +void +OpenGLSurfaceEvaluator::endqstrip(void) +{ + if(output_triangles) + bezierPatchMeshEndStrip(global_bpm); + else + glEnd(); + +} + +/*------------------------------------------------------------------------- + * bgnmap2f - preamble to surface definition and evaluations + *------------------------------------------------------------------------- + */ +void +OpenGLSurfaceEvaluator::bgnmap2f(long) +{ + if(output_triangles) + { + /*deallocate the space which may has been + *allocated by global_bpm previously + */ + if(global_bpm != NULL) { + bezierPatchMeshListDelete(global_bpm); + global_bpm = NULL; + } + + + /* + auto_normal_flag = 1; //always output normal in callback mode. + //we could have used the following code, + //but Inspector doesn't have gl context + //before it calls tessellator. + //this way is temporary. + */ + //NEWCALLBACK + //if one of the two normal callback functions are set, + //then set + if(normalCallBackN != NULL || + normalCallBackData != NULL) + auto_normal_flag = 1; + else + auto_normal_flag = 0; + + //initialize so that no maps initially + vertex_flag = 0; + normal_flag = 0; + color_flag = 0; + texcoord_flag = 0; + + /* + if(glIsEnabled(GL_AUTO_NORMAL) == GL_TRUE) + auto_normal_flag = 1; + else if (callback_auto_normal == 1) + auto_normal_flag = 1; + else + auto_normal_flag = 0; + */ + glPushAttrib((GLbitfield) GL_EVAL_BIT); + + } + else + { + glPushAttrib((GLbitfield) GL_EVAL_BIT); + + /*to avoid side effect, we restor the opengl state for GL_POLYGON_MODE + */ + glGetIntegerv(GL_POLYGON_MODE, gl_polygon_mode); + } + +} + +/*------------------------------------------------------------------------- + * endmap2f - postamble to a map + *------------------------------------------------------------------------- + */ +void +OpenGLSurfaceEvaluator::endmap2f(void) +{ + + if(output_triangles) + { + //bezierPatchMeshListDelDeg(global_bpm); + + // bezierPatchMeshListEval(global_bpm); + + //surfcount++; + //printf("surfcount=%i\n", surfcount); + //if(surfcount == 8) exit(0); + + inBPMListEvalEM(global_bpm); + + + +/* + global_bpm = bezierPatchMeshListReverse(global_bpm); + { + float *vertex_array; + float *normal_array; + int *length_array; + int *type_array; + int num_strips; + bezierPatchMeshListCollect(global_bpm, &vertex_array, &normal_array, &length_array, &type_array, &num_strips); + drawStrips(vertex_array, normal_array, length_array, type_array, num_strips); + free(vertex_array); + free(normal_array); + free(length_array); + free(type_array); + } +*/ + + //bezierPatchMeshListPrint(global_bpm); + //bezierPatchMeshListDraw(global_bpm); + +// printf("num triangles=%i\n", bezierPatchMeshListNumTriangles(global_bpm)); + +#ifdef USE_LOD +#else + bezierPatchMeshListDelete(global_bpm); + global_bpm = NULL; +#endif + glPopAttrib(); + } +else + { +#ifndef USE_LOD + glPopAttrib(); +#endif + +#ifdef STATISTICS + fprintf(stderr, "num_vertices=%i,num_triangles=%i,num_quads_strips=%i\n", STAT_num_of_eval_vertices,STAT_num_of_triangles,STAT_num_of_quad_strips); +#endif + + /*to restore the gl_polygon_mode + */ +#ifndef USE_LOD + glPolygonMode( GL_FRONT, (GLenum) gl_polygon_mode[0]); + glPolygonMode( GL_BACK, (GLenum) gl_polygon_mode[1]); +#endif +} + +} + +/*------------------------------------------------------------------------- + * map2f - pass a desription of a surface map + *------------------------------------------------------------------------- + */ +void +OpenGLSurfaceEvaluator::map2f( + long _type, + REAL _ulower, /* u lower domain coord */ + REAL _uupper, /* u upper domain coord */ + long _ustride, /* interpoint distance */ + long _uorder, /* parametric order */ + REAL _vlower, /* v lower domain coord */ + REAL _vupper, /* v upper domain coord */ + long _vstride, /* interpoint distance */ + long _vorder, /* parametric order */ + REAL *pts) /* control points */ +{ +#ifdef USE_INTERNAL_EVAL + inMap2f((int) _type, (REAL) _ulower, (REAL) _uupper, + (int) _ustride, (int) _uorder, (REAL) _vlower, + (REAL) _vupper, (int) _vstride, (int) _vorder, + (REAL *) pts); +#else + + + + if(output_triangles) + { + if(global_bpm == NULL) + global_bpm = bezierPatchMeshMake2(10,10); + if( + (global_bpm->bpatch == NULL && + (_type == GL_MAP2_VERTEX_3 || _type == GL_MAP2_VERTEX_4)) + || + (global_bpm->bpatch_normal == NULL && + (_type == GL_MAP2_NORMAL)) + || + (global_bpm->bpatch_color == NULL && + (_type == GL_MAP2_INDEX || _type == GL_MAP2_COLOR_4)) + || + (global_bpm->bpatch_texcoord == NULL && + (_type == GL_MAP2_TEXTURE_COORD_1 || + _type == GL_MAP2_TEXTURE_COORD_2 || + _type == GL_MAP2_TEXTURE_COORD_3 || + _type == GL_MAP2_TEXTURE_COORD_4 ) + )) + { + bezierPatchMeshPutPatch(global_bpm, (int) _type, _ulower, _uupper,(int) _ustride,(int) _uorder,_vlower, _vupper, (int) _vstride, (int) _vorder, pts); + } + else /*new surface patch (with multiple maps) starts*/ + { + bezierPatchMesh *temp = bezierPatchMeshMake2(10,10); + bezierPatchMeshPutPatch(temp, (int) _type, _ulower, _uupper,(int) _ustride,(int) _uorder,_vlower, _vupper, (int) _vstride, (int) _vorder, pts); + global_bpm = bezierPatchMeshListInsert(global_bpm, temp); + + /* + global_bpm = bezierPatchMeshListInsert(global_bpm, + bezierPatchMeshMake( + (int) _type, _ulower, _uupper,(int) _ustride, (int) _uorder, _vlower, _vupper, (int) _vstride, (int) _vorder, pts, 10, 10)); + */ + } + } + else /*not output triangles*/ + { + glMap2f((GLenum) _type, (GLfloat) _ulower, (GLfloat) _uupper, + (GLint) _ustride, (GLint) _uorder, (GLfloat) _vlower, + (GLfloat) _vupper, (GLint) _vstride, (GLint) _vorder, + (const GLfloat *) pts); + } + +#endif +} + + +/*------------------------------------------------------------------------- + * mapmesh2f - evaluate a mesh of points on lattice + *------------------------------------------------------------------------- + */ +void +OpenGLSurfaceEvaluator::mapmesh2f(long style, long umin, long umax, long vmin, long vmax) +{ +#ifdef NO_EVALUATION +return; +#endif + +#ifdef USE_INTERNAL_EVAL + inEvalMesh2((int)umin, (int)vmin, (int)umax, (int)vmax); +#else + + + +if(output_triangles) +{ +#ifdef USE_LOD + bezierPatchMeshBeginStrip(global_bpm, GL_POLYGON); + bezierPatchMeshInsertUV(global_bpm, global_grid_u0, global_grid_v0); + bezierPatchMeshInsertUV(global_bpm, global_grid_u1, global_grid_v1); + bezierPatchMeshInsertUV(global_bpm, (REAL)global_grid_nu, (REAL)global_grid_nv); + bezierPatchMeshInsertUV(global_bpm, (REAL)umin, (REAL)vmin); + bezierPatchMeshInsertUV(global_bpm, (REAL)umax, (REAL)vmax); + bezierPatchMeshEndStrip(global_bpm); + +#else + + REAL du, dv; + long i,j; + if(global_grid_nu == 0 || global_grid_nv == 0) + return; /*no points need to be output*/ + du = (global_grid_u1 - global_grid_u0) / (REAL)global_grid_nu; + dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv; + + if(global_grid_nu >= global_grid_nv){ + + for(i=umin; i=vmin; j--){ + REAL v1 = (j == global_grid_nv)? global_grid_v1: (global_grid_v0 +j*dv); + + coord2f(u1, v1); + coord2f(u2, v1); + } + endqstrip(); + } + } + else{ + + for(i=vmin; i=umin; j--){ + REAL u1 = (j == global_grid_nu)? global_grid_u1: (global_grid_u0 +j*du); + coord2f(u1, v2); + coord2f(u1, v1); + } + endqstrip(); + } + } +#endif +} +else +{ + switch(style) { + default: + case N_MESHFILL: + glEvalMesh2((GLenum) GL_FILL, (GLint) umin, (GLint) umax, + (GLint) vmin, (GLint) vmax); + break; + case N_MESHLINE: + glEvalMesh2((GLenum) GL_LINE, (GLint) umin, (GLint) umax, + (GLint) vmin, (GLint) vmax); + break; + case N_MESHPOINT: + glEvalMesh2((GLenum) GL_POINT, (GLint) umin, (GLint) umax, + (GLint) vmin, (GLint) vmax); + break; + } + } + +#endif + +#ifdef STATISTICS + STAT_num_of_quad_strips += (umax-umin)*(vmax-vmin); +#endif +} + +/*------------------------------------------------------------------------- + * evalcoord2f - evaluate a point on a surface + *------------------------------------------------------------------------- + */ +void +OpenGLSurfaceEvaluator::evalcoord2f(long, REAL u, REAL v) +{ + + +#ifdef NO_EVALUATION +return; +#endif + + + newtmeshvert(u, v); +} + +/*------------------------------------------------------------------------- + * evalpoint2i - evaluate a grid point + *------------------------------------------------------------------------- + */ +void +OpenGLSurfaceEvaluator::evalpoint2i(long u, long v) +{ +#ifdef NO_EVALUATION +return; +#endif + + newtmeshvert(u, v); +} + +void +OpenGLSurfaceEvaluator::point2i( long u, long v ) +{ +#ifdef NO_EVALUATION +return; +#else + +#ifdef USE_INTERNAL_EVAL + inEvalPoint2( (int)u, (int)v); +#else + + +if(output_triangles) +{ + + REAL du, dv; + REAL fu,fv; + du = (global_grid_u1 - global_grid_u0) / (REAL)global_grid_nu; + dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv; + fu = (u==global_grid_nu)? global_grid_u1:(global_grid_u0 + u*du); + fv = (v == global_grid_nv)? global_grid_v1: (global_grid_v0 +v*dv); + coord2f(fu,fv); +} +else + glEvalPoint2((GLint) u, (GLint) v); + + +#endif + +#ifdef STATISTICS + STAT_num_of_eval_vertices++; +#endif + +#endif + +} + +void +OpenGLSurfaceEvaluator::coord2f( REAL u, REAL v ) +{ +#ifdef NO_EVALUATION +return; +#else + +#ifdef USE_INTERNAL_EVAL + inEvalCoord2f( u, v); +#else + + +if(output_triangles) + bezierPatchMeshInsertUV(global_bpm, u,v); +else + glEvalCoord2f((GLfloat) u, (GLfloat) v); + + +#endif + + +#ifdef STATISTICS + STAT_num_of_eval_vertices++; +#endif + +#endif +} + +void +OpenGLSurfaceEvaluator::newtmeshvert( long u, long v ) +{ +#ifdef NO_EVALUATION +return; +#else + + if (tmeshing) { + + if (vcount == 2) { + vertexCache[0]->invoke(this); + vertexCache[1]->invoke(this); + point2i( u, v); + + } else { + vcount++; + } + + vertexCache[which]->saveEvalPoint(u, v); + which = 1 - which; + } else { + point2i( u, v); + } +#endif +} + +void +OpenGLSurfaceEvaluator::newtmeshvert( REAL u, REAL v ) +{ +#ifdef NO_EVALUATION +return; +#else + if (tmeshing) { + + + if (vcount == 2) { + vertexCache[0]->invoke(this); + vertexCache[1]->invoke(this); + coord2f(u,v); + + } else { + vcount++; + } + + vertexCache[which]->saveEvalCoord(u, v); + which = 1 - which; + } else { + + coord2f( u, v); + } +#endif + +} + +#ifdef _WIN32 +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)() ) +#else +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn ) +#endif +{ + switch(which) + { + case GLU_NURBS_BEGIN: + beginCallBackN = (void (GLAPIENTRY *) (GLenum)) fn; + break; + case GLU_NURBS_END: + endCallBackN = (void (GLAPIENTRY *) (void)) fn; + break; + case GLU_NURBS_VERTEX: + vertexCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn; + break; + case GLU_NURBS_NORMAL: + normalCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn; + break; + case GLU_NURBS_COLOR: + colorCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn; + break; + case GLU_NURBS_TEXTURE_COORD: + texcoordCallBackN = (void (GLAPIENTRY *) (const GLfloat*)) fn; + break; + case GLU_NURBS_BEGIN_DATA: + beginCallBackData = (void (GLAPIENTRY *) (GLenum, void*)) fn; + break; + case GLU_NURBS_END_DATA: + endCallBackData = (void (GLAPIENTRY *) (void*)) fn; + break; + case GLU_NURBS_VERTEX_DATA: + vertexCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn; + break; + case GLU_NURBS_NORMAL_DATA: + normalCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn; + break; + case GLU_NURBS_COLOR_DATA: + colorCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn; + break; + case GLU_NURBS_TEXTURE_COORD_DATA: + texcoordCallBackData = (void (GLAPIENTRY *) (const GLfloat*, void*)) fn; + break; + + } +} + + +void +OpenGLSurfaceEvaluator::beginCallBack(GLenum which, void *data) +{ + if(beginCallBackData) + beginCallBackData(which, data); + else if(beginCallBackN) + beginCallBackN(which); +} + +void +OpenGLSurfaceEvaluator::endCallBack(void *data) +{ + if(endCallBackData) + endCallBackData(data); + else if(endCallBackN) + endCallBackN(); +} + +void +OpenGLSurfaceEvaluator::vertexCallBack(const GLfloat *vert, void* data) +{ + if(vertexCallBackData) + vertexCallBackData(vert, data); + else if(vertexCallBackN) + vertexCallBackN(vert); +} + + +void +OpenGLSurfaceEvaluator::normalCallBack(const GLfloat *normal, void* data) +{ + if(normalCallBackData) + normalCallBackData(normal, data); + else if(normalCallBackN) + normalCallBackN(normal); +} + +void +OpenGLSurfaceEvaluator::colorCallBack(const GLfloat *color, void* data) +{ + if(colorCallBackData) + colorCallBackData(color, data); + else if(colorCallBackN) + colorCallBackN(color); +} + +void +OpenGLSurfaceEvaluator::texcoordCallBack(const GLfloat *texcoord, void* data) +{ + if(texcoordCallBackData) + texcoordCallBackData(texcoord, data); + else if(texcoordCallBackN) + texcoordCallBackN(texcoord); +} + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/interface/glsurfeval.h b/mesalib/src/glu/sgi/libnurbs/interface/glsurfeval.h new file mode 100644 index 000000000..1567c6b09 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/glsurfeval.h @@ -0,0 +1,404 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * glsurfeval.h + * + */ + +#ifndef __gluglsurfeval_h_ +#define __gluglsurfeval_h_ + +#include "basicsurfeval.h" +#include "bezierPatchMesh.h" //in case output triangles +#include +#include + +class SurfaceMap; +class OpenGLSurfaceEvaluator; +class StoredVertex; + +#define TYPECOORD 1 +#define TYPEPOINT 2 + +/* Cache up to 3 vertices from tmeshes */ +#define VERTEX_CACHE_SIZE 3 + +/*for internal evaluator callback stuff*/ +#ifndef IN_MAX_BEZIER_ORDER +#define IN_MAX_BEZIER_ORDER 40 /*XXX should be bigger than machine order*/ +#endif + +#ifndef IN_MAX_DIMENSION +#define IN_MAX_DIMENSION 4 +#endif + +typedef struct surfEvalMachine{ + REAL uprime;//cached previusly evaluated uprime. + REAL vprime; + int k; /*the dimension*/ + REAL u1; + REAL u2; + int ustride; + int uorder; + REAL v1; + REAL v2; + int vstride; + int vorder; + REAL ctlPoints[IN_MAX_BEZIER_ORDER*IN_MAX_BEZIER_ORDER*IN_MAX_DIMENSION]; + REAL ucoeff[IN_MAX_BEZIER_ORDER]; /*cache the polynomial values*/ + REAL vcoeff[IN_MAX_BEZIER_ORDER]; + REAL ucoeffDeriv[IN_MAX_BEZIER_ORDER]; /*cache the polynomial derivatives*/ + REAL vcoeffDeriv[IN_MAX_BEZIER_ORDER]; +} surfEvalMachine; + + + +class StoredVertex { +public: + StoredVertex() { type = 0; } + ~StoredVertex(void) {} + void saveEvalCoord(REAL x, REAL y) + {coord[0] = x; coord[1] = y; type = TYPECOORD; } + void saveEvalPoint(long x, long y) + {point[0] = x; point[1] = y; type = TYPEPOINT; } + void invoke(OpenGLSurfaceEvaluator *eval); + +private: + int type; + REAL coord[2]; + long point[2]; +}; + +class OpenGLSurfaceEvaluator : public BasicSurfaceEvaluator { +public: + OpenGLSurfaceEvaluator(); + virtual ~OpenGLSurfaceEvaluator( void ); + void polymode( long style ); + void range2f( long, REAL *, REAL * ); + void domain2f( REAL, REAL, REAL, REAL ); + void addMap( SurfaceMap * ) { } + + void enable( long ); + void disable( long ); + void bgnmap2f( long ); + void map2f( long, REAL, REAL, long, long, + REAL, REAL, long, long, REAL * ); + void mapgrid2f( long, REAL, REAL, long, REAL, REAL ); + void mapmesh2f( long, long, long, long, long ); + void evalcoord2f( long, REAL, REAL ); + void evalpoint2i( long, long ); + void endmap2f( void ); + + void bgnline( void ); + void endline( void ); + void bgnclosedline( void ); + void endclosedline( void ); + void bgntmesh( void ); + void swaptmesh( void ); + void endtmesh( void ); + void bgnqstrip( void ); + void endqstrip( void ); + + void bgntfan( void ); + void endtfan( void ); + void evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, + int n_lower, REAL v_lower, REAL* lower_val); + void evalVStrip(int n_left, REAL u_left, REAL* left_val, + int n_right, REAL u_right, REAL* right_val); + + void coord2f( REAL, REAL ); + void point2i( long, long ); + + void newtmeshvert( REAL, REAL ); + void newtmeshvert( long, long ); + +#ifdef _WIN32 + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); +#else + void putCallBack(GLenum which, _GLUfuncptr fn ); +#endif + + int get_vertices_call_back() + { + return output_triangles; + } + void put_vertices_call_back(int flag) + { + output_triangles = flag; + } + + void put_callback_auto_normal(int flag) + { + callback_auto_normal = flag; + } + + int get_callback_auto_normal() + { + return callback_auto_normal; + } + + void set_callback_userData(void* data) + { + userData = data; + } + + /**************begin for LOD_eval_list***********/ + void LOD_eval_list(int level); + + + + +private: + StoredVertex *vertexCache[VERTEX_CACHE_SIZE]; + int tmeshing; + int which; + int vcount; + + GLint gl_polygon_mode[2];/*to save and restore so that + *no side effect + */ + bezierPatchMesh *global_bpm; //for output triangles + int output_triangles; //true 1 or false 0 + + + + void (GLAPIENTRY *beginCallBackN) (GLenum type); + void (GLAPIENTRY *endCallBackN) (void); + void (GLAPIENTRY *vertexCallBackN) (const GLfloat *vert); + void (GLAPIENTRY *normalCallBackN) (const GLfloat *normal); + void (GLAPIENTRY *colorCallBackN) (const GLfloat *color); + void (GLAPIENTRY *texcoordCallBackN) (const GLfloat *texcoord); + + void (GLAPIENTRY *beginCallBackData) (GLenum type, void* data); + void (GLAPIENTRY *endCallBackData) (void* data); + void (GLAPIENTRY *vertexCallBackData) (const GLfloat *vert, void* data); + void (GLAPIENTRY *normalCallBackData) (const GLfloat *normal, void* data); + void (GLAPIENTRY *colorCallBackData) (const GLfloat *color, void* data); + void (GLAPIENTRY *texcoordCallBackData) (const GLfloat *texcoord, void* data); + + void beginCallBack (GLenum type, void* data); + void endCallBack (void* data); + void vertexCallBack (const GLfloat *vert, void* data); + void normalCallBack (const GLfloat *normal, void* data); + void colorCallBack (const GLfloat *color, void* data); + void texcoordCallBack (const GLfloat *texcoord, void* data); + + + void* userData; //the opaque pointer for Data callback functions. + + /*LOD evaluation*/ + void LOD_triangle(REAL A[2], REAL B[2], REAL C[2], + int level); + void LOD_eval(int num_vert, REAL* verts, int type, int level); + + int LOD_eval_level; //set by LOD_eval_list() + + /*************begin for internal evaluators*****************/ + + /*the following global variables are only defined in this file. + *They are used to cache the precomputed Bezier polynomial values. + *These calues may be used consecutively in which case we don't have + *recompute these values again. + */ + int global_uorder; /*store the uorder in the previous evaluation*/ + int global_vorder; /*store the vorder in the previous evaluation*/ + REAL global_uprime; + REAL global_vprime; + REAL global_vprime_BV; + REAL global_uprime_BU; + int global_uorder_BV; /*store the uorder in the previous evaluation*/ + int global_vorder_BV; /*store the vorder in the previous evaluation*/ + int global_uorder_BU; /*store the uorder in the previous evaluation*/ + int global_vorder_BU; /*store the vorder in the previous evaluation*/ + + REAL global_ucoeff[IN_MAX_BEZIER_ORDER]; /*cache the polynomial values*/ + REAL global_vcoeff[IN_MAX_BEZIER_ORDER]; + REAL global_ucoeffDeriv[IN_MAX_BEZIER_ORDER]; /*cache the polynomial derivatives*/ + REAL global_vcoeffDeriv[IN_MAX_BEZIER_ORDER]; + + REAL global_BV[IN_MAX_BEZIER_ORDER][IN_MAX_DIMENSION]; + REAL global_PBV[IN_MAX_BEZIER_ORDER][IN_MAX_DIMENSION]; + REAL global_BU[IN_MAX_BEZIER_ORDER][IN_MAX_DIMENSION]; + REAL global_PBU[IN_MAX_BEZIER_ORDER][IN_MAX_DIMENSION]; + REAL* global_baseData; + + int global_ev_k; /*the dimension*/ + REAL global_ev_u1; + REAL global_ev_u2; + int global_ev_ustride; + int global_ev_uorder; + REAL global_ev_v1; + REAL global_ev_v2; + int global_ev_vstride; + int global_ev_vorder; + REAL global_ev_ctlPoints[IN_MAX_BEZIER_ORDER*IN_MAX_BEZIER_ORDER*IN_MAX_DIMENSION]; + + REAL global_grid_u0; + REAL global_grid_u1; + int global_grid_nu; + REAL global_grid_v0; + REAL global_grid_v1; + int global_grid_nv; + +/*functions*/ + void inDoDomain2WithDerivs(int k, REAL u, REAL v, + REAL u1, REAL u2, int uorder, + REAL v1, REAL v2, int vorder, + REAL *baseData, + REAL *retPoint, REAL *retdu, REAL *retdv); + void inPreEvaluate(int order, REAL vprime, REAL *coeff); + void inPreEvaluateWithDeriv(int order, REAL vprime, REAL *coeff, REAL *coeffDeriv); + void inComputeFirstPartials(REAL *p, REAL *pu, REAL *pv); + void inComputeNormal2(REAL *pu, REAL *pv, REAL *n); + void inDoEvalCoord2(REAL u, REAL v, + REAL *retPoint, REAL *retNormal); + void inDoEvalCoord2NOGE(REAL u, REAL v, + REAL *retPoint, REAL *retNormal); + void inMap2f(int k, + REAL ulower, + REAL uupper, + int ustride, + int uorder, + REAL vlower, + REAL vupper, + int vstride, + int vorder, + REAL *ctlPoints); + + void inMapGrid2f(int nu, REAL u0, REAL u1, + int nv, REAL v0, REAL v1); + + void inEvalMesh2(int lowU, int lowV, int highU, int highV); + void inEvalPoint2(int i, int j); + void inEvalCoord2f(REAL u, REAL v); + +void inEvalULine(int n_points, REAL v, REAL* u_vals, + int stride, REAL ret_points[][3], REAL ret_normals[][3]); + +void inEvalVLine(int n_points, REAL u, REAL* v_vals, + int stride, REAL ret_points[][3], REAL ret_normals[][3]); + +void inEvalUStrip(int n_upper, REAL v_upper, REAL* upper_val, + int n_lower, REAL v_lower, REAL* lower_val + ); +void inEvalVStrip(int n_left, REAL u_left, REAL* left_val, int n_right, REAL u_right, REAL* right_val); + +void inPreEvaluateBV(int k, int uorder, int vorder, REAL vprime, REAL *baseData); +void inPreEvaluateBU(int k, int uorder, int vorder, REAL uprime, REAL *baseData); +void inPreEvaluateBV_intfac(REAL v ) + { + inPreEvaluateBV(global_ev_k, global_ev_uorder, global_ev_vorder, (v-global_ev_v1)/(global_ev_v2-global_ev_v1), global_ev_ctlPoints); + } + +void inPreEvaluateBU_intfac(REAL u) + { + inPreEvaluateBU(global_ev_k, global_ev_uorder, global_ev_vorder, (u-global_ev_u1)/(global_ev_u2-global_ev_u1), global_ev_ctlPoints); + } + +void inDoDomain2WithDerivsBV(int k, REAL u, REAL v, + REAL u1, REAL u2, int uorder, + REAL v1, REAL v2, int vorder, + REAL *baseData, + REAL *retPoint, REAL* retdu, REAL *retdv); + +void inDoDomain2WithDerivsBU(int k, REAL u, REAL v, + REAL u1, REAL u2, int uorder, + REAL v1, REAL v2, int vorder, + REAL *baseData, + REAL *retPoint, REAL* retdu, REAL *retdv); + + +void inDoEvalCoord2NOGE_BV(REAL u, REAL v, + REAL *retPoint, REAL *retNormal); + +void inDoEvalCoord2NOGE_BU(REAL u, REAL v, + REAL *retPoint, REAL *retNormal); + +void inBPMEval(bezierPatchMesh* bpm); +void inBPMListEval(bezierPatchMesh* list); + +/*-------------begin for surfEvalMachine -------------*/ +surfEvalMachine em_vertex; +surfEvalMachine em_normal; +surfEvalMachine em_color; +surfEvalMachine em_texcoord; + +int auto_normal_flag; //whether to output normla or not in callback + //determined by GL_AUTO_NORMAL and callback_auto_normal +int callback_auto_normal; //GLU_CALLBACK_AUTO_NORMAL_EXT +int vertex_flag; +int normal_flag; +int color_flag; +int texcoord_flag; + +void inMap2fEM(int which, //0:vert,1:norm,2:color,3:tex + int dimension, + REAL ulower, + REAL uupper, + int ustride, + int uorder, + REAL vlower, + REAL vupper, + int vstride, + int vorder, + REAL *ctlPoints); + +void inDoDomain2WithDerivsEM(surfEvalMachine *em, REAL u, REAL v, + REAL *retPoint, REAL *retdu, REAL *retdv); +void inDoDomain2EM(surfEvalMachine *em, REAL u, REAL v, + REAL *retPoint); + void inDoEvalCoord2EM(REAL u, REAL v); + +void inBPMEvalEM(bezierPatchMesh* bpm); +void inBPMListEvalEM(bezierPatchMesh* list); + +/*-------------end for surfEvalMachine -------------*/ + + + /*************end for internal evaluators*****************/ + +}; + +inline void StoredVertex::invoke(OpenGLSurfaceEvaluator *eval) +{ + switch(type) { + case TYPECOORD: + eval->coord2f(coord[0], coord[1]); + break; + case TYPEPOINT: + eval->point2i(point[0], point[1]); + break; + default: + break; + } +} + +#endif /* __gluglsurfeval_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/interface/incurveeval.cc b/mesalib/src/glu/sgi/libnurbs/interface/incurveeval.cc new file mode 100644 index 000000000..96ea8896a --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/incurveeval.cc @@ -0,0 +1,206 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include + +#include "glcurveval.h" + + +/* + *compute the Bezier polynomials C[n,j](v) for all j at v with + *return values stored in coeff[], where + * C[n,j](v) = (n,j) * v^j * (1-v)^(n-j), + * j=0,1,2,...,n. + *order : n+1 + *vprime: v + *coeff : coeff[j]=C[n,j](v), this array store the returned values. + *The algorithm is a recursive scheme: + * C[0,0]=1; + * C[n,j](v) = (1-v)*C[n-1,j](v) + v*C[n-1,j-1](v), n>=1 + *This code is copied from opengl/soft/so_eval.c:PreEvaluate + */ +void OpenGLCurveEvaluator::inPreEvaluate(int order, REAL vprime, REAL *coeff) +{ + int i, j; + REAL oldval, temp; + REAL oneMinusvprime; + + /* + * Minor optimization + * Compute orders 1 and 2 outright, and set coeff[0], coeff[1] to + * their i==1 loop values to avoid the initialization and the i==1 loop. + */ + if (order == 1) { + coeff[0] = 1.0; + return; + } + + oneMinusvprime = 1-vprime; + coeff[0] = oneMinusvprime; + coeff[1] = vprime; + if (order == 2) return; + + for (i = 2; i < order; i++) { + oldval = coeff[0] * vprime; + coeff[0] = oneMinusvprime * coeff[0]; + for (j = 1; j < i; j++) { + temp = oldval; + oldval = coeff[j] * vprime; + coeff[j] = temp + oneMinusvprime * coeff[j]; + } + coeff[j] = oldval; + } +} + +void OpenGLCurveEvaluator::inMap1f(int which, //0: vert, 1: norm, 2: color, 3: tex + int k, //dimension + REAL ulower, + REAL uupper, + int ustride, + int uorder, + REAL *ctlpoints) +{ + int i,x; + curveEvalMachine *temp_em; + switch(which){ + case 0: //vertex + vertex_flag = 1; + temp_em = &em_vertex; + break; + case 1: //normal + normal_flag = 1; + temp_em = &em_normal; + break; + case 2: //color + color_flag = 1; + temp_em = &em_color; + break; + default: + texcoord_flag = 1; + temp_em = &em_texcoord; + break; + } + + REAL *data = temp_em->ctlpoints; + temp_em->uprime = -1; //initialized + temp_em->k = k; + temp_em->u1 = ulower; + temp_em->u2 = uupper; + temp_em->ustride = ustride; + temp_em->uorder = uorder; + /*copy the control points*/ + for(i=0; iu2 == em->u1) + return; + the_uprime = (u-em->u1) / (em->u2-em->u1); + /*use already cached values if possible*/ + if(em->uprime != the_uprime){ + inPreEvaluate(em->uorder, the_uprime, em->ucoeff); + em->uprime = the_uprime; + } + + for(j=0; jk; j++){ + data = em->ctlpoints+j; + retPoint[j] = 0.0; + for(row=0; rowuorder; row++) + { + retPoint[j] += em->ucoeff[row] * (*data); + data += em->k; + } + } +} + +void OpenGLCurveEvaluator::inDoEvalCoord1(REAL u) +{ + REAL temp_vertex[4]; + REAL temp_normal[3]; + REAL temp_color[4]; + REAL temp_texcoord[4]; + if(texcoord_flag) //there is a texture map + { + inDoDomain1(&em_texcoord, u, temp_texcoord); + texcoordCallBack(temp_texcoord, userData); + } +#ifdef DEBUG +printf("color_flag = %i\n", color_flag); +#endif + if(color_flag) //there is a color map + { + inDoDomain1(&em_color, u, temp_color); + colorCallBack(temp_color, userData); + } + if(normal_flag) //there is a normal map + { + inDoDomain1(&em_normal, u, temp_normal); + normalCallBack(temp_normal, userData); + } + if(vertex_flag) + { + inDoDomain1(&em_vertex, u, temp_vertex); + vertexCallBack(temp_vertex, userData); + } +} + +void OpenGLCurveEvaluator::inMapMesh1f(int umin, int umax) +{ + REAL du, u; + int i; + if(global_grid_nu == 0) + return; //no points to output + du = (global_grid_u1 - global_grid_u0) / (REAL) global_grid_nu; + bgnline(); + for(i=umin; i<= umax; i++){ + u = (i==global_grid_nu)? global_grid_u1: global_grid_u0 + i*du; + inDoEvalCoord1(u); + } + endline(); +} diff --git a/mesalib/src/glu/sgi/libnurbs/interface/insurfeval.cc b/mesalib/src/glu/sgi/libnurbs/interface/insurfeval.cc new file mode 100644 index 000000000..9d0c82a91 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/insurfeval.cc @@ -0,0 +1,2064 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include +#include +#include +#include +#include + +#include "glsurfeval.h" + +//extern int surfcount; + +//#define CRACK_TEST + +#define AVOID_ZERO_NORMAL + +#ifdef AVOID_ZERO_NORMAL +#define myabs(x) ((x>0)? x: (-x)) +#define MYZERO 0.000001 +#define MYDELTA 0.001 +#endif + +//#define USE_LOD +#ifdef USE_LOD +//#define LOD_EVAL_COORD(u,v) inDoEvalCoord2EM(u,v) +#define LOD_EVAL_COORD(u,v) glEvalCoord2f(u,v) + +static void LOD_interpolate(REAL A[2], REAL B[2], REAL C[2], int j, int k, int pow2_level, + REAL& u, REAL& v) +{ + REAL a,a1,b,b1; + + a = ((REAL) j) / ((REAL) pow2_level); + a1 = 1-a; + + if(j != 0) + { + b = ((REAL) k) / ((REAL)j); + b1 = 1-b; + } + REAL x,y,z; + x = a1; + if(j==0) + { + y=0; z=0; + } + else{ + y = b1*a; + z = b *a; + } + + u = x*A[0] + y*B[0] + z*C[0]; + v = x*A[1] + y*B[1] + z*C[1]; +} + +void OpenGLSurfaceEvaluator::LOD_triangle(REAL A[2], REAL B[2], REAL C[2], + int level) +{ + int k,j; + int pow2_level; + /*compute 2^level*/ + pow2_level = 1; + + for(j=0; jnext) + { + inBPMEval(temp); + } +} + +void OpenGLSurfaceEvaluator::inBPMEval(bezierPatchMesh* bpm) +{ + int i,j,k,l; + float u,v; + + int ustride = bpm->bpatch->dimension * bpm->bpatch->vorder; + int vstride = bpm->bpatch->dimension; + inMap2f( + (bpm->bpatch->dimension == 3)? GL_MAP2_VERTEX_3 : GL_MAP2_VERTEX_4, + bpm->bpatch->umin, + bpm->bpatch->umax, + ustride, + bpm->bpatch->uorder, + bpm->bpatch->vmin, + bpm->bpatch->vmax, + vstride, + bpm->bpatch->vorder, + bpm->bpatch->ctlpoints); + + bpm->vertex_array = (float*) malloc(sizeof(float)* (bpm->index_UVarray/2) * 3+1); /*in case the origional dimenion is 4, then we need 4 space to pass to evaluator.*/ + assert(bpm->vertex_array); + bpm->normal_array = (float*) malloc(sizeof(float)* (bpm->index_UVarray/2) * 3); + assert(bpm->normal_array); +#ifdef CRACK_TEST +if( global_ev_u1 ==2 && global_ev_u2 == 3 + && global_ev_v1 ==2 && global_ev_v2 == 3) +{ +REAL vertex[4]; +REAL normal[4]; +#ifdef DEBUG +printf("***number 1\n"); +#endif + +beginCallBack(GL_QUAD_STRIP, NULL); +inEvalCoord2f(3.0, 3.0); +inEvalCoord2f(2.0, 3.0); +inEvalCoord2f(3.0, 2.7); +inEvalCoord2f(2.0, 2.7); +inEvalCoord2f(3.0, 2.0); +inEvalCoord2f(2.0, 2.0); +endCallBack(NULL); + + +beginCallBack(GL_TRIANGLE_STRIP, NULL); +inEvalCoord2f(2.0, 3.0); +inEvalCoord2f(2.0, 2.0); +inEvalCoord2f(2.0, 2.7); +endCallBack(NULL); + +} + +/* +if( global_ev_u1 ==2 && global_ev_u2 == 3 + && global_ev_v1 ==1 && global_ev_v2 == 2) +{ +#ifdef DEBUG +printf("***number 2\n"); +#endif +beginCallBack(GL_QUAD_STRIP); +inEvalCoord2f(2.0, 2.0); +inEvalCoord2f(2.0, 1.0); +inEvalCoord2f(3.0, 2.0); +inEvalCoord2f(3.0, 1.0); +endCallBack(); +} +*/ +if( global_ev_u1 ==1 && global_ev_u2 == 2 + && global_ev_v1 ==2 && global_ev_v2 == 3) +{ +#ifdef DEBUG +printf("***number 3\n"); +#endif +beginCallBack(GL_QUAD_STRIP, NULL); +inEvalCoord2f(2.0, 3.0); +inEvalCoord2f(1.0, 3.0); +inEvalCoord2f(2.0, 2.3); +inEvalCoord2f(1.0, 2.3); +inEvalCoord2f(2.0, 2.0); +inEvalCoord2f(1.0, 2.0); +endCallBack(NULL); + +beginCallBack(GL_TRIANGLE_STRIP, NULL); +inEvalCoord2f(2.0, 2.3); +inEvalCoord2f(2.0, 2.0); +inEvalCoord2f(2.0, 3.0); +endCallBack(NULL); + +} +return; +#endif + + k=0; + l=0; + + for(i=0; iindex_length_array; i++) + { + beginCallBack(bpm->type_array[i], userData); + for(j=0; jlength_array[i]; j++) + { + u = bpm->UVarray[k]; + v = bpm->UVarray[k+1]; + inDoEvalCoord2NOGE(u,v, + bpm->vertex_array+l, + bpm->normal_array+l); + + normalCallBack(bpm->normal_array+l, userData); + vertexCallBack(bpm->vertex_array+l, userData); + + k += 2; + l += 3; + } + endCallBack(userData); + } +} + +void OpenGLSurfaceEvaluator::inEvalPoint2(int i, int j) +{ + REAL du, dv; + REAL point[4]; + REAL normal[3]; + REAL u,v; + du = (global_grid_u1 - global_grid_u0) / (REAL)global_grid_nu; + dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv; + u = (i==global_grid_nu)? global_grid_u1:(global_grid_u0 + i*du); + v = (j == global_grid_nv)? global_grid_v1: (global_grid_v0 +j*dv); + inDoEvalCoord2(u,v,point,normal); +} + +void OpenGLSurfaceEvaluator::inEvalCoord2f(REAL u, REAL v) +{ + + REAL point[4]; + REAL normal[3]; + inDoEvalCoord2(u,v,point, normal); +} + + + +/*define a grid. store the values into the global variabls: + * global_grid_* + *These values will be used later by evaluating functions + */ +void OpenGLSurfaceEvaluator::inMapGrid2f(int nu, REAL u0, REAL u1, + int nv, REAL v0, REAL v1) +{ + global_grid_u0 = u0; + global_grid_u1 = u1; + global_grid_nu = nu; + global_grid_v0 = v0; + global_grid_v1 = v1; + global_grid_nv = nv; +} + +void OpenGLSurfaceEvaluator::inEvalMesh2(int lowU, int lowV, int highU, int highV) +{ + REAL du, dv; + int i,j; + REAL point[4]; + REAL normal[3]; + if(global_grid_nu == 0 || global_grid_nv == 0) + return; /*no points need to be output*/ + du = (global_grid_u1 - global_grid_u0) / (REAL)global_grid_nu; + dv = (global_grid_v1 - global_grid_v0) / (REAL)global_grid_nv; + + if(global_grid_nu >= global_grid_nv){ + for(i=lowU; i=lowV; j--){ + REAL v1 = (j == global_grid_nv)? global_grid_v1: (global_grid_v0 +j*dv); + + inDoEvalCoord2(u1, v1, point, normal); + inDoEvalCoord2(u2, v1, point, normal); + } + endqstrip(); + } + } + + else{ + for(i=lowV; i=lowU; j--){ + REAL u1 = (j == global_grid_nu)? global_grid_u1: (global_grid_u0 +j*du); + inDoEvalCoord2(u1, v2, point, normal); + inDoEvalCoord2(u1, v1, point, normal); + } + endqstrip(); + } + } + +} + +void OpenGLSurfaceEvaluator::inMap2f(int k, + REAL ulower, + REAL uupper, + int ustride, + int uorder, + REAL vlower, + REAL vupper, + int vstride, + int vorder, + REAL *ctlPoints) +{ + int i,j,x; + REAL *data = global_ev_ctlPoints; + + + + if(k == GL_MAP2_VERTEX_3) k=3; + else if (k==GL_MAP2_VERTEX_4) k =4; + else { + printf("error in inMap2f, maptype=%i is wrong, k,map is not updated\n", k); + return; + } + + global_ev_k = k; + global_ev_u1 = ulower; + global_ev_u2 = uupper; + global_ev_ustride = ustride; + global_ev_uorder = uorder; + global_ev_v1 = vlower; + global_ev_v2 = vupper; + global_ev_vstride = vstride; + global_ev_vorder = vorder; + + /*copy the contrl points from ctlPoints to global_ev_ctlPoints*/ + for (i=0; i 0.0) { + n[0] /= mag; + n[1] /= mag; + n[2] /= mag; + } +} + + + +/*Compute point and normal + *see the head of inDoDomain2WithDerivs + *for the meaning of the arguments + */ +void OpenGLSurfaceEvaluator::inDoEvalCoord2(REAL u, REAL v, + REAL *retPoint, REAL *retNormal) +{ + + REAL du[4]; + REAL dv[4]; + + + assert(global_ev_k>=3 && global_ev_k <= 4); + /*compute homegeneous point and partial derivatives*/ + inDoDomain2WithDerivs(global_ev_k, u, v, global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, retPoint, du, dv); + +#ifdef AVOID_ZERO_NORMAL + + if(myabs(dv[0]) <= MYZERO && myabs(dv[1]) <= MYZERO && myabs(dv[2]) <= MYZERO) + { + + REAL tempdu[4]; + REAL tempdata[4]; + REAL u1 = global_ev_u1; + REAL u2 = global_ev_u2; + if(u-MYDELTA*(u2-u1) < u1) + u = u+ MYDELTA*(u2-u1); + else + u = u-MYDELTA*(u2-u1); + inDoDomain2WithDerivs(global_ev_k, u,v,global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, tempdata, tempdu, dv); + } + if(myabs(du[0]) <= MYZERO && myabs(du[1]) <= MYZERO && myabs(du[2]) <= MYZERO) + { + REAL tempdv[4]; + REAL tempdata[4]; + REAL v1 = global_ev_v1; + REAL v2 = global_ev_v2; + if(v-MYDELTA*(v2-v1) < v1) + v = v+ MYDELTA*(v2-v1); + else + v = v-MYDELTA*(v2-v1); + inDoDomain2WithDerivs(global_ev_k, u,v,global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, tempdata, du, tempdv); + } +#endif + + + /*compute normal*/ + switch(global_ev_k){ + case 3: + inComputeNormal2(du, dv, retNormal); + + break; + case 4: + inComputeFirstPartials(retPoint, du, dv); + inComputeNormal2(du, dv, retNormal); + /*transform the homegeneous coordinate of retPoint into inhomogenous one*/ + retPoint[0] /= retPoint[3]; + retPoint[1] /= retPoint[3]; + retPoint[2] /= retPoint[3]; + break; + } + /*output this vertex*/ +/* inMeshStreamInsert(global_ms, retPoint, retNormal);*/ + + + + glNormal3fv(retNormal); + glVertex3fv(retPoint); + + + + + #ifdef DEBUG + printf("vertex(%f,%f,%f)\n", retPoint[0],retPoint[1],retPoint[2]); + #endif + + + +} + +/*Compute point and normal + *see the head of inDoDomain2WithDerivs + *for the meaning of the arguments + */ +void OpenGLSurfaceEvaluator::inDoEvalCoord2NOGE_BU(REAL u, REAL v, + REAL *retPoint, REAL *retNormal) +{ + + REAL du[4]; + REAL dv[4]; + + + assert(global_ev_k>=3 && global_ev_k <= 4); + /*compute homegeneous point and partial derivatives*/ +// inPreEvaluateBU(global_ev_k, global_ev_uorder, global_ev_vorder, (u-global_ev_u1)/(global_ev_u2-global_ev_u1), global_ev_ctlPoints); + inDoDomain2WithDerivsBU(global_ev_k, u, v, global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, retPoint, du, dv); + + +#ifdef AVOID_ZERO_NORMAL + + if(myabs(dv[0]) <= MYZERO && myabs(dv[1]) <= MYZERO && myabs(dv[2]) <= MYZERO) + { + + REAL tempdu[4]; + REAL tempdata[4]; + REAL u1 = global_ev_u1; + REAL u2 = global_ev_u2; + if(u-MYDELTA*(u2-u1) < u1) + u = u+ MYDELTA*(u2-u1); + else + u = u-MYDELTA*(u2-u1); + inDoDomain2WithDerivs(global_ev_k, u,v,global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, tempdata, tempdu, dv); + } + if(myabs(du[0]) <= MYZERO && myabs(du[1]) <= MYZERO && myabs(du[2]) <= MYZERO) + { + REAL tempdv[4]; + REAL tempdata[4]; + REAL v1 = global_ev_v1; + REAL v2 = global_ev_v2; + if(v-MYDELTA*(v2-v1) < v1) + v = v+ MYDELTA*(v2-v1); + else + v = v-MYDELTA*(v2-v1); + inDoDomain2WithDerivs(global_ev_k, u,v,global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, tempdata, du, tempdv); + } +#endif + + /*compute normal*/ + switch(global_ev_k){ + case 3: + inComputeNormal2(du, dv, retNormal); + break; + case 4: + inComputeFirstPartials(retPoint, du, dv); + inComputeNormal2(du, dv, retNormal); + /*transform the homegeneous coordinate of retPoint into inhomogenous one*/ + retPoint[0] /= retPoint[3]; + retPoint[1] /= retPoint[3]; + retPoint[2] /= retPoint[3]; + break; + } +} + +/*Compute point and normal + *see the head of inDoDomain2WithDerivs + *for the meaning of the arguments + */ +void OpenGLSurfaceEvaluator::inDoEvalCoord2NOGE_BV(REAL u, REAL v, + REAL *retPoint, REAL *retNormal) +{ + + REAL du[4]; + REAL dv[4]; + + + assert(global_ev_k>=3 && global_ev_k <= 4); + /*compute homegeneous point and partial derivatives*/ +// inPreEvaluateBV(global_ev_k, global_ev_uorder, global_ev_vorder, (v-global_ev_v1)/(global_ev_v2-global_ev_v1), global_ev_ctlPoints); + + inDoDomain2WithDerivsBV(global_ev_k, u, v, global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, retPoint, du, dv); + + +#ifdef AVOID_ZERO_NORMAL + + if(myabs(dv[0]) <= MYZERO && myabs(dv[1]) <= MYZERO && myabs(dv[2]) <= MYZERO) + { + + REAL tempdu[4]; + REAL tempdata[4]; + REAL u1 = global_ev_u1; + REAL u2 = global_ev_u2; + if(u-MYDELTA*(u2-u1) < u1) + u = u+ MYDELTA*(u2-u1); + else + u = u-MYDELTA*(u2-u1); + inDoDomain2WithDerivs(global_ev_k, u,v,global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, tempdata, tempdu, dv); + } + if(myabs(du[0]) <= MYZERO && myabs(du[1]) <= MYZERO && myabs(du[2]) <= MYZERO) + { + REAL tempdv[4]; + REAL tempdata[4]; + REAL v1 = global_ev_v1; + REAL v2 = global_ev_v2; + if(v-MYDELTA*(v2-v1) < v1) + v = v+ MYDELTA*(v2-v1); + else + v = v-MYDELTA*(v2-v1); + inDoDomain2WithDerivs(global_ev_k, u,v,global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, tempdata, du, tempdv); + } +#endif + + /*compute normal*/ + switch(global_ev_k){ + case 3: + inComputeNormal2(du, dv, retNormal); + break; + case 4: + inComputeFirstPartials(retPoint, du, dv); + inComputeNormal2(du, dv, retNormal); + /*transform the homegeneous coordinate of retPoint into inhomogenous one*/ + retPoint[0] /= retPoint[3]; + retPoint[1] /= retPoint[3]; + retPoint[2] /= retPoint[3]; + break; + } +} + + +/*Compute point and normal + *see the head of inDoDomain2WithDerivs + *for the meaning of the arguments + */ +void OpenGLSurfaceEvaluator::inDoEvalCoord2NOGE(REAL u, REAL v, + REAL *retPoint, REAL *retNormal) +{ + + REAL du[4]; + REAL dv[4]; + + + assert(global_ev_k>=3 && global_ev_k <= 4); + /*compute homegeneous point and partial derivatives*/ + inDoDomain2WithDerivs(global_ev_k, u, v, global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, retPoint, du, dv); + + +#ifdef AVOID_ZERO_NORMAL + + if(myabs(dv[0]) <= MYZERO && myabs(dv[1]) <= MYZERO && myabs(dv[2]) <= MYZERO) + { + + REAL tempdu[4]; + REAL tempdata[4]; + REAL u1 = global_ev_u1; + REAL u2 = global_ev_u2; + if(u-MYDELTA*(u2-u1) < u1) + u = u+ MYDELTA*(u2-u1); + else + u = u-MYDELTA*(u2-u1); + inDoDomain2WithDerivs(global_ev_k, u,v,global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, tempdata, tempdu, dv); + } + if(myabs(du[0]) <= MYZERO && myabs(du[1]) <= MYZERO && myabs(du[2]) <= MYZERO) + { + REAL tempdv[4]; + REAL tempdata[4]; + REAL v1 = global_ev_v1; + REAL v2 = global_ev_v2; + if(v-MYDELTA*(v2-v1) < v1) + v = v+ MYDELTA*(v2-v1); + else + v = v-MYDELTA*(v2-v1); + inDoDomain2WithDerivs(global_ev_k, u,v,global_ev_u1, global_ev_u2, global_ev_uorder, global_ev_v1, global_ev_v2, global_ev_vorder, global_ev_ctlPoints, tempdata, du, tempdv); + } +#endif + + /*compute normal*/ + switch(global_ev_k){ + case 3: + inComputeNormal2(du, dv, retNormal); + break; + case 4: + inComputeFirstPartials(retPoint, du, dv); + inComputeNormal2(du, dv, retNormal); + /*transform the homegeneous coordinate of retPoint into inhomogenous one*/ + retPoint[0] /= retPoint[3]; + retPoint[1] /= retPoint[3]; + retPoint[2] /= retPoint[3]; + break; + } +// glNormal3fv(retNormal); +// glVertex3fv(retPoint); +} + +void OpenGLSurfaceEvaluator::inPreEvaluateBV(int k, int uorder, int vorder, REAL vprime, REAL *baseData) +{ + int j,row,col; + REAL p, pdv; + REAL *data; + + if(global_vprime != vprime || global_vorder != vorder) { + inPreEvaluateWithDeriv(vorder, vprime, global_vcoeff, global_vcoeffDeriv); + global_vprime = vprime; + global_vorder = vorder; + } + + for(j=0; j=1 + *This code is copied from opengl/soft/so_eval.c:PreEvaluate + */ +void OpenGLSurfaceEvaluator::inPreEvaluate(int order, REAL vprime, REAL *coeff) +{ + int i, j; + REAL oldval, temp; + REAL oneMinusvprime; + + /* + * Minor optimization + * Compute orders 1 and 2 outright, and set coeff[0], coeff[1] to + * their i==1 loop values to avoid the initialization and the i==1 loop. + */ + if (order == 1) { + coeff[0] = 1.0; + return; + } + + oneMinusvprime = 1-vprime; + coeff[0] = oneMinusvprime; + coeff[1] = vprime; + if (order == 2) return; + + for (i = 2; i < order; i++) { + oldval = coeff[0] * vprime; + coeff[0] = oneMinusvprime * coeff[0]; + for (j = 1; j < i; j++) { + temp = oldval; + oldval = coeff[j] * vprime; + coeff[j] = temp + oneMinusvprime * coeff[j]; + } + coeff[j] = oldval; + } +} + +/* + *compute the Bezier polynomials C[n,j](v) and derivatives for all j at v with + *return values stored in coeff[] and coeffDeriv[]. + *see the head of function inPreEvaluate for the definition of C[n,j](v) + *and how to compute the values. + *The algorithm to compute the derivative is: + * dC[0,0](v) = 0. + * dC[n,j](v) = n*(dC[n-1,j-1](v) - dC[n-1,j](v)). + * + *This code is copied from opengl/soft/so_eval.c:PreEvaluateWidthDeriv + */ +void OpenGLSurfaceEvaluator::inPreEvaluateWithDeriv(int order, REAL vprime, + REAL *coeff, REAL *coeffDeriv) +{ + int i, j; + REAL oldval, temp; + REAL oneMinusvprime; + + oneMinusvprime = 1-vprime; + /* + * Minor optimization + * Compute orders 1 and 2 outright, and set coeff[0], coeff[1] to + * their i==1 loop values to avoid the initialization and the i==1 loop. + */ + if (order == 1) { + coeff[0] = 1.0; + coeffDeriv[0] = 0.0; + return; + } else if (order == 2) { + coeffDeriv[0] = -1.0; + coeffDeriv[1] = 1.0; + coeff[0] = oneMinusvprime; + coeff[1] = vprime; + return; + } + coeff[0] = oneMinusvprime; + coeff[1] = vprime; + for (i = 2; i < order - 1; i++) { + oldval = coeff[0] * vprime; + coeff[0] = oneMinusvprime * coeff[0]; + for (j = 1; j < i; j++) { + temp = oldval; + oldval = coeff[j] * vprime; + coeff[j] = temp + oneMinusvprime * coeff[j]; + } + coeff[j] = oldval; + } + coeffDeriv[0] = -coeff[0]; + /* + ** Minor optimization: + ** Would make this a "for (j=1; j=1 + *n_lower >=1 + */ +void OpenGLSurfaceEvaluator::inEvalUStrip(int n_upper, REAL v_upper, REAL* upper_val, int n_lower, REAL v_lower, REAL* lower_val) +{ + int i,j,k,l; + REAL leftMostV[2]; + typedef REAL REAL3[3]; + + REAL3* upperXYZ = (REAL3*) malloc(sizeof(REAL3)*n_upper); + assert(upperXYZ); + REAL3* upperNormal = (REAL3*) malloc(sizeof(REAL3) * n_upper); + assert(upperNormal); + REAL3* lowerXYZ = (REAL3*) malloc(sizeof(REAL3)*n_lower); + assert(lowerXYZ); + REAL3* lowerNormal = (REAL3*) malloc(sizeof(REAL3) * n_lower); + assert(lowerNormal); + + inEvalULine(n_upper, v_upper, upper_val, 1, upperXYZ, upperNormal); + inEvalULine(n_lower, v_lower, lower_val, 1, lowerXYZ, lowerNormal); + + + + REAL* leftMostXYZ; + REAL* leftMostNormal; + + /* + *the algorithm works by scanning from left to right. + *leftMostV: the left most of the remaining verteces (on both upper and lower). + * it could an element of upperVerts or lowerVerts. + *i: upperVerts[i] is the first vertex to the right of leftMostV on upper line *j: lowerVerts[j] is the first vertex to the right of leftMostV on lower line */ + + /*initialize i,j,and leftMostV + */ + if(upper_val[0] <= lower_val[0]) + { + i=1; + j=0; + + leftMostV[0] = upper_val[0]; + leftMostV[1] = v_upper; + leftMostXYZ = upperXYZ[0]; + leftMostNormal = upperNormal[0]; + } + else + { + i=0; + j=1; + + leftMostV[0] = lower_val[0]; + leftMostV[1] = v_lower; + + leftMostXYZ = lowerXYZ[0]; + leftMostNormal = lowerNormal[0]; + } + + /*the main loop. + *the invariance is that: + *at the beginning of each loop, the meaning of i,j,and leftMostV are + *maintained + */ + while(1) + { + if(i >= n_upper) /*case1: no more in upper*/ + { + if(j= n_lower) /*case2: no more in lower*/ + { + if(i=i; k--) /*reverse order for two-side lighting*/ + { + glNormal3fv(upperNormal[k]); + glVertex3fv(upperXYZ[k]); + } + + endtfan(); + } + break; /*exit the main loop*/ + } + else /* case3: neither is empty, plus the leftMostV, there is at least one triangle to output*/ + { + if(upper_val[i] <= lower_val[j]) + { + bgntfan(); + + glNormal3fv(lowerNormal[j]); + glVertex3fv(lowerXYZ[j]); + + /*find the last k>=i such that + *upperverts[k][0] <= lowerverts[j][0] + */ + k=i; + + while(k lower_val[j]) + break; + k++; + + } + k--; + + + for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ + { + glNormal3fv(upperNormal[l]); + glVertex3fv(upperXYZ[l]); + + } + glNormal3fv(leftMostNormal); + glVertex3fv(leftMostXYZ); + + endtfan(); + + /*update i and leftMostV for next loop + */ + i = k+1; + + leftMostV[0] = upper_val[k]; + leftMostV[1] = v_upper; + leftMostNormal = upperNormal[k]; + leftMostXYZ = upperXYZ[k]; + } + else /*upperVerts[i][0] > lowerVerts[j][0]*/ + { + bgntfan(); + glNormal3fv(upperNormal[i]); + glVertex3fv(upperXYZ[i]); + + glNormal3fv(leftMostNormal); + glVertex3fv(leftMostXYZ); + + + /*find the last k>=j such that + *lowerverts[k][0] < upperverts[i][0] + */ + k=j; + while(k< n_lower) + { + if(lower_val[k] >= upper_val[i]) + break; + glNormal3fv(lowerNormal[k]); + glVertex3fv(lowerXYZ[k]); + + k++; + } + endtfan(); + + /*update j and leftMostV for next loop + */ + j=k; + leftMostV[0] = lower_val[j-1]; + leftMostV[1] = v_lower; + + leftMostNormal = lowerNormal[j-1]; + leftMostXYZ = lowerXYZ[j-1]; + } + } + } + //clean up + free(upperXYZ); + free(lowerXYZ); + free(upperNormal); + free(lowerNormal); +} + +/*triangulate a strip bounded by two lines which are parallel to V-axis + *leftVerts: the verteces on the left line + *rightVertx: the verteces on the right line + *n_left >=1 + *n_right >=1 + */ +void OpenGLSurfaceEvaluator::inEvalVStrip(int n_left, REAL u_left, REAL* left_val, int n_right, REAL u_right, REAL* right_val) +{ + int i,j,k,l; + REAL botMostV[2]; + typedef REAL REAL3[3]; + + REAL3* leftXYZ = (REAL3*) malloc(sizeof(REAL3)*n_left); + assert(leftXYZ); + REAL3* leftNormal = (REAL3*) malloc(sizeof(REAL3) * n_left); + assert(leftNormal); + REAL3* rightXYZ = (REAL3*) malloc(sizeof(REAL3)*n_right); + assert(rightXYZ); + REAL3* rightNormal = (REAL3*) malloc(sizeof(REAL3) * n_right); + assert(rightNormal); + + inEvalVLine(n_left, u_left, left_val, 1, leftXYZ, leftNormal); + inEvalVLine(n_right, u_right, right_val, 1, rightXYZ, rightNormal); + + + + REAL* botMostXYZ; + REAL* botMostNormal; + + /* + *the algorithm works by scanning from bot to top. + *botMostV: the bot most of the remaining verteces (on both left and right). + * it could an element of leftVerts or rightVerts. + *i: leftVerts[i] is the first vertex to the top of botMostV on left line + *j: rightVerts[j] is the first vertex to the top of botMostV on rightline */ + + /*initialize i,j,and botMostV + */ + if(left_val[0] <= right_val[0]) + { + i=1; + j=0; + + botMostV[0] = u_left; + botMostV[1] = left_val[0]; + botMostXYZ = leftXYZ[0]; + botMostNormal = leftNormal[0]; + } + else + { + i=0; + j=1; + + botMostV[0] = u_right; + botMostV[1] = right_val[0]; + + botMostXYZ = rightXYZ[0]; + botMostNormal = rightNormal[0]; + } + + /*the main loop. + *the invariance is that: + *at the beginning of each loop, the meaning of i,j,and botMostV are + *maintained + */ + while(1) + { + if(i >= n_left) /*case1: no more in left*/ + { + if(j= n_right) /*case2: no more in right*/ + { + if(i=i; k--) /*reverse order for two-side lighting*/ + { + glNormal3fv(leftNormal[k]); + glVertex3fv(leftXYZ[k]); + } + + endtfan(); + } + break; /*exit the main loop*/ + } + else /* case3: neither is empty, plus the botMostV, there is at least one triangle to output*/ + { + if(left_val[i] <= right_val[j]) + { + bgntfan(); + + glNormal3fv(rightNormal[j]); + glVertex3fv(rightXYZ[j]); + + /*find the last k>=i such that + *leftverts[k][0] <= rightverts[j][0] + */ + k=i; + + while(k right_val[j]) + break; + k++; + + } + k--; + + + for(l=k; l>=i; l--)/*the reverse is for two-side lighting*/ + { + glNormal3fv(leftNormal[l]); + glVertex3fv(leftXYZ[l]); + + } + glNormal3fv(botMostNormal); + glVertex3fv(botMostXYZ); + + endtfan(); + + /*update i and botMostV for next loop + */ + i = k+1; + + botMostV[0] = u_left; + botMostV[1] = left_val[k]; + botMostNormal = leftNormal[k]; + botMostXYZ = leftXYZ[k]; + } + else /*left_val[i] > right_val[j])*/ + { + bgntfan(); + glNormal3fv(leftNormal[i]); + glVertex3fv(leftXYZ[i]); + + glNormal3fv(botMostNormal); + glVertex3fv(botMostXYZ); + + + /*find the last k>=j such that + *rightverts[k][0] < leftverts[i][0] + */ + k=j; + while(k< n_right) + { + if(right_val[k] >= left_val[i]) + break; + glNormal3fv(rightNormal[k]); + glVertex3fv(rightXYZ[k]); + + k++; + } + endtfan(); + + /*update j and botMostV for next loop + */ + j=k; + botMostV[0] = u_right; + botMostV[1] = right_val[j-1]; + + botMostNormal = rightNormal[j-1]; + botMostXYZ = rightXYZ[j-1]; + } + } + } + //clean up + free(leftXYZ); + free(rightXYZ); + free(leftNormal); + free(rightNormal); +} + +/*-----------------------begin evalMachine-------------------*/ +void OpenGLSurfaceEvaluator::inMap2fEM(int which, int k, + REAL ulower, + REAL uupper, + int ustride, + int uorder, + REAL vlower, + REAL vupper, + int vstride, + int vorder, + REAL *ctlPoints) +{ + int i,j,x; + surfEvalMachine *temp_em; + switch(which){ + case 0: //vertex + vertex_flag = 1; + temp_em = &em_vertex; + break; + case 1: //normal + normal_flag = 1; + temp_em = &em_normal; + break; + case 2: //color + color_flag = 1; + temp_em = &em_color; + break; + default: + texcoord_flag = 1; + temp_em = &em_texcoord; + break; + } + + REAL *data = temp_em->ctlPoints; + + temp_em->uprime = -1;//initilized + temp_em->vprime = -1; + + temp_em->k = k; + temp_em->u1 = ulower; + temp_em->u2 = uupper; + temp_em->ustride = ustride; + temp_em->uorder = uorder; + temp_em->v1 = vlower; + temp_em->v2 = vupper; + temp_em->vstride = vstride; + temp_em->vorder = vorder; + + /*copy the contrl points from ctlPoints to global_ev_ctlPoints*/ + for (i=0; iu2 == em->u1) || (em->v2 == em->v1)) + return; + the_uprime = (u - em->u1) / (em->u2 - em->u1); + the_vprime = (v - em->v1) / (em->v2 - em->v1); + + /* Compute coefficients for values and derivs */ + + /* Use already cached values if possible */ + if(em->uprime != the_uprime) { + inPreEvaluateWithDeriv(em->uorder, the_uprime, em->ucoeff, em->ucoeffDeriv); + em->uprime = the_uprime; + } + if (em->vprime != the_vprime) { + inPreEvaluateWithDeriv(em->vorder, the_vprime, em->vcoeff, em->vcoeffDeriv); + em->vprime = the_vprime; + } + + for (j = 0; j < em->k; j++) { + data=em->ctlPoints+j; + retPoint[j] = retdu[j] = retdv[j] = 0.0; + for (row = 0; row < em->uorder; row++) { + /* + ** Minor optimization. + ** The col == 0 part of the loop is extracted so we don't + ** have to initialize p and pdv to 0. + */ + p = em->vcoeff[0] * (*data); + pdv = em->vcoeffDeriv[0] * (*data); + data += em->k; + for (col = 1; col < em->vorder; col++) { + /* Incrementally build up p, pdv value */ + p += em->vcoeff[col] * (*data); + pdv += em->vcoeffDeriv[col] * (*data); + data += em->k; + } + /* Use p, pdv value to incrementally add up r, du, dv */ + retPoint[j] += em->ucoeff[row] * p; + retdu[j] += em->ucoeffDeriv[row] * p; + retdv[j] += em->ucoeff[row] * pdv; + } + } +} + +void OpenGLSurfaceEvaluator::inDoDomain2EM(surfEvalMachine *em, REAL u, REAL v, + REAL *retPoint) +{ + int j, row, col; + REAL the_uprime; + REAL the_vprime; + REAL p; + REAL *data; + + if((em->u2 == em->u1) || (em->v2 == em->v1)) + return; + the_uprime = (u - em->u1) / (em->u2 - em->u1); + the_vprime = (v - em->v1) / (em->v2 - em->v1); + + /* Compute coefficients for values and derivs */ + + /* Use already cached values if possible */ + if(em->uprime != the_uprime) { + inPreEvaluate(em->uorder, the_uprime, em->ucoeff); + em->uprime = the_uprime; + } + if (em->vprime != the_vprime) { + inPreEvaluate(em->vorder, the_vprime, em->vcoeff); + em->vprime = the_vprime; + } + + for (j = 0; j < em->k; j++) { + data=em->ctlPoints+j; + retPoint[j] = 0.0; + for (row = 0; row < em->uorder; row++) { + /* + ** Minor optimization. + ** The col == 0 part of the loop is extracted so we don't + ** have to initialize p and pdv to 0. + */ + p = em->vcoeff[0] * (*data); + data += em->k; + for (col = 1; col < em->vorder; col++) { + /* Incrementally build up p, pdv value */ + p += em->vcoeff[col] * (*data); + data += em->k; + } + /* Use p, pdv value to incrementally add up r, du, dv */ + retPoint[j] += em->ucoeff[row] * p; + } + } +} + + +void OpenGLSurfaceEvaluator::inDoEvalCoord2EM(REAL u, REAL v) +{ + REAL temp_vertex[5]; + REAL temp_normal[3]; + REAL temp_color[4]; + REAL temp_texcoord[4]; + + if(texcoord_flag) + { + inDoDomain2EM(&em_texcoord, u,v, temp_texcoord); + texcoordCallBack(temp_texcoord, userData); + } + if(color_flag) + { + inDoDomain2EM(&em_color, u,v, temp_color); + colorCallBack(temp_color, userData); + } + + if(normal_flag) //there is a normla map + { + inDoDomain2EM(&em_normal, u,v, temp_normal); + normalCallBack(temp_normal, userData); + + if(vertex_flag) + { + inDoDomain2EM(&em_vertex, u,v,temp_vertex); + if(em_vertex.k == 4) + { + temp_vertex[0] /= temp_vertex[3]; + temp_vertex[1] /= temp_vertex[3]; + temp_vertex[2] /= temp_vertex[3]; + } + temp_vertex[3]=u; + temp_vertex[4]=v; + vertexCallBack(temp_vertex, userData); + } + } + else if(auto_normal_flag) //no normal map but there is a normal callbackfunctin + { + REAL du[4]; + REAL dv[4]; + + /*compute homegeneous point and partial derivatives*/ + inDoDomain2WithDerivsEM(&em_vertex, u,v,temp_vertex,du,dv); + + if(em_vertex.k ==4) + inComputeFirstPartials(temp_vertex, du, dv); + +#ifdef AVOID_ZERO_NORMAL + if(myabs(dv[0]) <= MYZERO && myabs(dv[1]) <= MYZERO && myabs(dv[2]) <= MYZERO) + { + + REAL tempdu[4]; + REAL tempdata[4]; + REAL u1 = em_vertex.u1; + REAL u2 = em_vertex.u2; + if(u-MYDELTA*(u2-u1) < u1) + u = u+ MYDELTA*(u2-u1); + else + u = u-MYDELTA*(u2-u1); + inDoDomain2WithDerivsEM(&em_vertex,u,v, tempdata, tempdu, dv); + + if(em_vertex.k ==4) + inComputeFirstPartials(temp_vertex, du, dv); + } + else if(myabs(du[0]) <= MYZERO && myabs(du[1]) <= MYZERO && myabs(du[2]) <= MYZERO) + { + REAL tempdv[4]; + REAL tempdata[4]; + REAL v1 = em_vertex.v1; + REAL v2 = em_vertex.v2; + if(v-MYDELTA*(v2-v1) < v1) + v = v+ MYDELTA*(v2-v1); + else + v = v-MYDELTA*(v2-v1); + inDoDomain2WithDerivsEM(&em_vertex,u,v, tempdata, du, tempdv); + + if(em_vertex.k ==4) + inComputeFirstPartials(temp_vertex, du, dv); + } +#endif + + /*compute normal*/ + switch(em_vertex.k){ + case 3: + + inComputeNormal2(du, dv, temp_normal); + break; + case 4: + +// inComputeFirstPartials(temp_vertex, du, dv); + inComputeNormal2(du, dv, temp_normal); + + /*transform the homegeneous coordinate of retPoint into inhomogenous one*/ + temp_vertex[0] /= temp_vertex[3]; + temp_vertex[1] /= temp_vertex[3]; + temp_vertex[2] /= temp_vertex[3]; + break; + } + normalCallBack(temp_normal, userData); + temp_vertex[3] = u; + temp_vertex[4] = v; + vertexCallBack(temp_vertex, userData); + + }/*end if auto_normal*/ + else //no normal map, and no normal callback function + { + if(vertex_flag) + { + inDoDomain2EM(&em_vertex, u,v,temp_vertex); + if(em_vertex.k == 4) + { + temp_vertex[0] /= temp_vertex[3]; + temp_vertex[1] /= temp_vertex[3]; + temp_vertex[2] /= temp_vertex[3]; + } + temp_vertex[3] = u; + temp_vertex[4] = v; + vertexCallBack(temp_vertex, userData); + } + } +} + + +void OpenGLSurfaceEvaluator::inBPMEvalEM(bezierPatchMesh* bpm) +{ + int i,j,k; + float u,v; + + int ustride; + int vstride; + +#ifdef USE_LOD + if(bpm->bpatch != NULL) + { + bezierPatch* p=bpm->bpatch; + ustride = p->dimension * p->vorder; + vstride = p->dimension; + + glMap2f( (p->dimension == 3)? GL_MAP2_VERTEX_3 : GL_MAP2_VERTEX_4, + p->umin, + p->umax, + ustride, + p->uorder, + p->vmin, + p->vmax, + vstride, + p->vorder, + p->ctlpoints); + + +/* + inMap2fEM(0, p->dimension, + p->umin, + p->umax, + ustride, + p->uorder, + p->vmin, + p->vmax, + vstride, + p->vorder, + p->ctlpoints); +*/ + } +#else + + if(bpm->bpatch != NULL){ + bezierPatch* p = bpm->bpatch; + ustride = p->dimension * p->vorder; + vstride = p->dimension; + inMap2fEM(0, p->dimension, + p->umin, + p->umax, + ustride, + p->uorder, + p->vmin, + p->vmax, + vstride, + p->vorder, + p->ctlpoints); + } + if(bpm->bpatch_normal != NULL){ + bezierPatch* p = bpm->bpatch_normal; + ustride = p->dimension * p->vorder; + vstride = p->dimension; + inMap2fEM(1, p->dimension, + p->umin, + p->umax, + ustride, + p->uorder, + p->vmin, + p->vmax, + vstride, + p->vorder, + p->ctlpoints); + } + if(bpm->bpatch_color != NULL){ + bezierPatch* p = bpm->bpatch_color; + ustride = p->dimension * p->vorder; + vstride = p->dimension; + inMap2fEM(2, p->dimension, + p->umin, + p->umax, + ustride, + p->uorder, + p->vmin, + p->vmax, + vstride, + p->vorder, + p->ctlpoints); + } + if(bpm->bpatch_texcoord != NULL){ + bezierPatch* p = bpm->bpatch_texcoord; + ustride = p->dimension * p->vorder; + vstride = p->dimension; + inMap2fEM(3, p->dimension, + p->umin, + p->umax, + ustride, + p->uorder, + p->vmin, + p->vmax, + vstride, + p->vorder, + p->ctlpoints); + } +#endif + + + k=0; + for(i=0; iindex_length_array; i++) + { +#ifdef USE_LOD + if(bpm->type_array[i] == GL_POLYGON) //a mesh + { + GLfloat *temp = bpm->UVarray+k; + GLfloat u0 = temp[0]; + GLfloat v0 = temp[1]; + GLfloat u1 = temp[2]; + GLfloat v1 = temp[3]; + GLint nu = (GLint) ( temp[4]); + GLint nv = (GLint) ( temp[5]); + GLint umin = (GLint) ( temp[6]); + GLint vmin = (GLint) ( temp[7]); + GLint umax = (GLint) ( temp[8]); + GLint vmax = (GLint) ( temp[9]); + + glMapGrid2f(LOD_eval_level*nu, u0, u1, LOD_eval_level*nv, v0, v1); + glEvalMesh2(GL_FILL, LOD_eval_level*umin, LOD_eval_level*umax, LOD_eval_level*vmin, LOD_eval_level*vmax); + } + else + { + LOD_eval(bpm->length_array[i], bpm->UVarray+k, bpm->type_array[i], + 0 + ); + } + k+= 2*bpm->length_array[i]; + +#else //undef USE_LOD + +#ifdef CRACK_TEST +if( bpm->bpatch->umin == 2 && bpm->bpatch->umax == 3 + && bpm->bpatch->vmin ==2 && bpm->bpatch->vmax == 3) +{ +REAL vertex[4]; +REAL normal[4]; +#ifdef DEBUG +printf("***number ****1\n"); +#endif + +beginCallBack(GL_QUAD_STRIP, NULL); +inDoEvalCoord2EM(3.0, 3.0); +inDoEvalCoord2EM(2.0, 3.0); +inDoEvalCoord2EM(3.0, 2.7); +inDoEvalCoord2EM(2.0, 2.7); +inDoEvalCoord2EM(3.0, 2.0); +inDoEvalCoord2EM(2.0, 2.0); +endCallBack(NULL); + +beginCallBack(GL_TRIANGLE_STRIP, NULL); +inDoEvalCoord2EM(2.0, 3.0); +inDoEvalCoord2EM(2.0, 2.0); +inDoEvalCoord2EM(2.0, 2.7); +endCallBack(NULL); + +} +if( bpm->bpatch->umin == 1 && bpm->bpatch->umax == 2 + && bpm->bpatch->vmin ==2 && bpm->bpatch->vmax == 3) +{ +#ifdef DEBUG +printf("***number 3\n"); +#endif +beginCallBack(GL_QUAD_STRIP, NULL); +inDoEvalCoord2EM(2.0, 3.0); +inDoEvalCoord2EM(1.0, 3.0); +inDoEvalCoord2EM(2.0, 2.3); +inDoEvalCoord2EM(1.0, 2.3); +inDoEvalCoord2EM(2.0, 2.0); +inDoEvalCoord2EM(1.0, 2.0); +endCallBack(NULL); + +beginCallBack(GL_TRIANGLE_STRIP, NULL); +inDoEvalCoord2EM(2.0, 2.3); +inDoEvalCoord2EM(2.0, 2.0); +inDoEvalCoord2EM(2.0, 3.0); +endCallBack(NULL); + +} +return; +#endif //CRACK_TEST + + beginCallBack(bpm->type_array[i], userData); + + for(j=0; jlength_array[i]; j++) + { + u = bpm->UVarray[k]; + v = bpm->UVarray[k+1]; +#ifdef USE_LOD + LOD_EVAL_COORD(u,v); +// glEvalCoord2f(u,v); +#else + +#ifdef GENERIC_TEST + float temp_normal[3]; + float temp_vertex[3]; + if(temp_signal == 0) + { + gTessVertexSphere(u,v, temp_normal, temp_vertex); +//printf("normal=(%f,%f,%f)\n", temp_normal[0], temp_normal[1], temp_normal[2])//printf("veretx=(%f,%f,%f)\n", temp_vertex[0], temp_vertex[1], temp_vertex[2]); + normalCallBack(temp_normal, userData); + vertexCallBack(temp_vertex, userData); + } + else if(temp_signal == 1) + { + gTessVertexCyl(u,v, temp_normal, temp_vertex); +//printf("normal=(%f,%f,%f)\n", temp_normal[0], temp_normal[1], temp_normal[2])//printf("veretx=(%f,%f,%f)\n", temp_vertex[0], temp_vertex[1], temp_vertex[2]); + normalCallBack(temp_normal, userData); + vertexCallBack(temp_vertex, userData); + } + else +#endif //GENERIC_TEST + + inDoEvalCoord2EM(u,v); + +#endif //USE_LOD + + k += 2; + } + endCallBack(userData); + +#endif //USE_LOD + } +} + +void OpenGLSurfaceEvaluator::inBPMListEvalEM(bezierPatchMesh* list) +{ + bezierPatchMesh* temp; + for(temp = list; temp != NULL; temp = temp->next) + { + inBPMEvalEM(temp); + } +} + diff --git a/mesalib/src/glu/sgi/libnurbs/interface/mystdio.h b/mesalib/src/glu/sgi/libnurbs/interface/mystdio.h new file mode 100644 index 000000000..5ab49effd --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/mystdio.h @@ -0,0 +1,60 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * mystdio.h + * + */ + +#ifndef __glumystdio_h_ +#define __glumystdio_h_ + +#ifdef STANDALONE +inline void _glu_dprintf( const char *, ... ) { } +#endif + +#ifdef LIBRARYBUILD +#ifndef NDEBUG +#include +#define _glu_dprintf printf +#else +inline void _glu_dprintf( const char *, ... ) { } +#endif +#endif + +#ifdef GLBUILD +inline void _glu_dprintf( const char *, ... ) { } +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#endif /* __glumystdio_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/interface/mystdlib.h b/mesalib/src/glu/sgi/libnurbs/interface/mystdlib.h new file mode 100644 index 000000000..ab7a3b273 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/interface/mystdlib.h @@ -0,0 +1,57 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * mystdlib.h + * + */ + +#ifndef __glumystdlib_h_ +#define __glumystdlib_h_ + +#ifdef STANDALONE +typedef unsigned int size_t; +extern "C" void abort( void ); +extern "C" void * malloc( size_t ); +extern "C" void free( void * ); +#endif + +#ifdef LIBRARYBUILD +#include +#endif + +#ifdef GLBUILD +typedef unsigned int size_t; +extern "C" void abort( void ); +extern "C" void * malloc( size_t ); +extern "C" void free( void * ); +#endif + +#endif /* __glumystdlib_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/arc.cc b/mesalib/src/glu/sgi/libnurbs/internals/arc.cc new file mode 100644 index 000000000..b85139de9 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/arc.cc @@ -0,0 +1,347 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * arc.c++ + * + */ + +#include +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "arc.h" +#include "bin.h" +#include "bezierarc.h" +#include "pwlarc.h" +#include "simplemath.h" + +/* local preprocessor definitions */ +#define ZERO 0.00001/*0.000001*/ + +const int Arc::bezier_tag = (1<<13); +const int Arc::arc_tag = (1<<3); +const int Arc::tail_tag = (1<<6); + +/*-------------------------------------------------------------------------- + * makeSide - attach a pwl arc to an arc and mark it as a border arc + *-------------------------------------------------------------------------- + */ + +void +Arc::makeSide( PwlArc *pwl, arc_side side ) +{ + assert( pwl != 0); + assert( pwlArc == 0 ); + assert( pwl->npts > 0 ); + assert( pwl->pts != 0); + pwlArc = pwl; + clearbezier(); + setside( side ); +} + + +/*-------------------------------------------------------------------------- + * numpts - count number of points on arc loop + *-------------------------------------------------------------------------- + */ + +int +Arc::numpts( void ) +{ + Arc_ptr jarc = this; + int npts = 0; + do { + npts += jarc->pwlArc->npts; + jarc = jarc->next; + } while( jarc != this ); + return npts; +} + +/*-------------------------------------------------------------------------- + * markverts - mark each point with id of arc + *-------------------------------------------------------------------------- + */ + +void +Arc::markverts( void ) +{ + Arc_ptr jarc = this; + + do { + TrimVertex *p = jarc->pwlArc->pts; + for( int i=0; ipwlArc->npts; i++ ) + p[i].nuid = jarc->nuid; + jarc = jarc->next; + } while( jarc != this ); +} + +/*-------------------------------------------------------------------------- + * getextrema - find axis extrema on arc loop + *-------------------------------------------------------------------------- + */ + +void +Arc::getextrema( Arc_ptr extrema[4] ) +{ + REAL leftpt, botpt, rightpt, toppt; + + extrema[0] = extrema[1] = extrema[2] = extrema[3] = this; + + leftpt = rightpt = this->tail()[0]; + botpt = toppt = this->tail()[1]; + + for( Arc_ptr jarc = this->next; jarc != this; jarc = jarc->next ) { + if ( jarc->tail()[0] < leftpt || + (jarc->tail()[0] <= leftpt && jarc->rhead()[0]<=leftpt)) { + leftpt = jarc->pwlArc->pts->param[0]; + extrema[1] = jarc; + } + if ( jarc->tail()[0] > rightpt || + (jarc->tail()[0] >= rightpt && jarc->rhead()[0] >= rightpt)) { + rightpt = jarc->pwlArc->pts->param[0]; + extrema[3] = jarc; + } + if ( jarc->tail()[1] < botpt || + (jarc->tail()[1] <= botpt && jarc->rhead()[1] <= botpt )) { + botpt = jarc->pwlArc->pts->param[1]; + extrema[2] = jarc; + } + if ( jarc->tail()[1] > toppt || + (jarc->tail()[1] >= toppt && jarc->rhead()[1] >= toppt)) { + toppt = jarc->pwlArc->pts->param[1]; + extrema[0] = jarc; + } + } +} + + +/*------------------------------------------------------------------------- + * show - print to the stdout the vertices of a pwl arc + *------------------------------------------------------------------------- + */ + +void +Arc::show() +{ +#ifndef NDEBUG + _glu_dprintf( "\tPWLARC NP: %d FL: 1\n", pwlArc->npts ); + for( int i = 0; i < pwlArc->npts; i++ ) { + _glu_dprintf( "\t\tVERTEX %f %f\n", pwlArc->pts[i].param[0], + pwlArc->pts[i].param[1] ); + } +#endif +} + +/*------------------------------------------------------------------------- + * print - print out the vertices of all pwl arcs on a loop + *------------------------------------------------------------------------- + */ + +void +Arc::print( void ) +{ + Arc_ptr jarc = this; + +#ifndef NDEBUG + _glu_dprintf( "BGNTRIM\n" ); +#endif + do { + jarc->show( ); + jarc = jarc->next; + } while (jarc != this); +#ifndef NDEBUG + _glu_dprintf("ENDTRIM\n" ); +#endif +} + +/*------------------------------------------------------------------------- + * isDisconnected - check if tail of arc and head of prev meet + *------------------------------------------------------------------------- + */ + +int +Arc::isDisconnected( void ) +{ + if( pwlArc == 0 ) return 0; + if( prev->pwlArc == 0 ) return 0; + + REAL *p0 = tail(); + REAL *p1 = prev->rhead(); + + if( ((p0[0] - p1[0]) > ZERO) || ((p1[0] - p0[0]) > ZERO) || + ((p0[1] - p1[1]) > ZERO) || ((p1[1] - p0[1]) > ZERO) ) { +#ifndef NDEBUG + _glu_dprintf( "x coord = %f %f %f\n", p0[0], p1[0], p0[0] - p1[0] ); + _glu_dprintf( "y coord = %f %f %f\n", p0[1], p1[1], p0[1] - p1[1] ); +#endif + return 1; + } else { + /* average two points together */ + p0[0] = p1[0] = (p1[0] + p0[0]) * 0.5; + p0[1] = p1[1] = (p1[1] + p0[1]) * 0.5; + return 0; + } +} + +/*------------------------------------------------------------------------- + * neq_vert - assert that two 2D vertices are not equal + *------------------------------------------------------------------------- + */ + +inline static int +neq_vert( REAL *v1, REAL *v2 ) +{ + return ((v1[0] != v2[0]) || (v1[1] != v2[1] )) ? 1 : 0; +} + +/*------------------------------------------------------------------------- + * check - verify consistency of a loop, including + * 1) if pwl, no two consecutive vertices are identical + * 2) the circular link pointers are valid + * 3) the geometric info at the head and tail are consistent + *------------------------------------------------------------------------- + */ + +int +Arc::check( void ) +{ + if( this == 0 ) return 1; + Arc_ptr jarc = this; + do { + assert( (jarc->pwlArc != 0) || (jarc->bezierArc != 0) ); + + if (jarc->prev == 0 || jarc->next == 0) { +#ifndef NDEBUG + _glu_dprintf( "checkjarc:null next/prev pointer\n"); + jarc->print( ); +#endif + return 0; + } + + if (jarc->next->prev != jarc) { +#ifndef NDEBUG + _glu_dprintf( "checkjarc: pointer linkage screwed up\n"); + jarc->print( ); +#endif + return 0; + } + + if( jarc->pwlArc ) { +#ifndef NDEBUG + assert( jarc->pwlArc->npts >= 1 ); + assert( jarc->pwlArc->npts < 100000 ); +/* + for( int i=0; i < jarc->pwlArc->npts-1; i++ ) + assert( neq_vert( jarc->pwlArc->pts[i].param, + jarc->pwlArc->pts[i+1].param) ); +*/ +#endif + if( jarc->prev->pwlArc ) { + if( jarc->tail()[1] != jarc->prev->rhead()[1] ) { +#ifndef NDEBUG + _glu_dprintf( "checkjarc: geometric linkage screwed up 1\n"); + jarc->prev->show(); + jarc->show(); +#endif + return 0; + } + if( jarc->tail()[0] != jarc->prev->rhead()[0] ) { + +#ifndef NDEBUG + _glu_dprintf( "checkjarc: geometric linkage screwed up 2\n"); + jarc->prev->show(); + jarc->show(); +#endif + return 0; + } + } + if( jarc->next->pwlArc ) { + if( jarc->next->tail()[0] != jarc->rhead()[0] ) { +#ifndef NDEBUG + _glu_dprintf( "checkjarc: geometric linkage screwed up 3\n"); + jarc->show(); + jarc->next->show(); +#endif + return 0; + } + if( jarc->next->tail()[1] != jarc->rhead()[1] ) { +#ifndef NDEBUG + _glu_dprintf( "checkjarc: geometric linkage screwed up 4\n"); + jarc->show(); + jarc->next->show(); +#endif + return 0; + } + } + if( jarc->isbezier() ) { + assert( jarc->pwlArc->npts == 2 ); + assert( (jarc->pwlArc->pts[0].param[0] == \ + jarc->pwlArc->pts[1].param[0]) ||\ + (jarc->pwlArc->pts[0].param[1] == \ + jarc->pwlArc->pts[1].param[1]) ); + } + } + jarc = jarc->next; + } while (jarc != this); + return 1; +} + + +#define TOL 0.00001 + +inline long tooclose( REAL x, REAL y ) +{ + return (glu_abs(x-y) < TOL) ? 1 : 0; +} + + +/*-------------------------------------------------------------------------- + * append - append a jordan arc to a circularly linked list + *-------------------------------------------------------------------------- + */ + +Arc_ptr +Arc::append( Arc_ptr jarc ) +{ + if( jarc != 0 ) { + next = jarc->next; + prev = jarc; + next->prev = prev->next = this; + } else { + next = prev = this; + } + return this; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/arc.h b/mesalib/src/glu/sgi/libnurbs/internals/arc.h new file mode 100644 index 000000000..e986019c3 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/arc.h @@ -0,0 +1,133 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * arc.h + * + */ + +#ifndef __gluarc_h_ +#define __gluarc_h_ + +#include "myassert.h" +#include "bufpool.h" +#include "mystdio.h" +#include "types.h" +#include "pwlarc.h" +#include "trimvertex.h" + +class Bin; +class Arc; +struct BezierArc; + +typedef class Arc *Arc_ptr; + +enum arc_side { arc_none = 0, arc_right, arc_top, arc_left, arc_bottom }; + + +class Arc: public PooledObj { /* an arc, in two list, the trim list and bin */ + +public: + static const int bezier_tag; + static const int arc_tag; + static const int tail_tag; + Arc_ptr prev; /* trim list pointer */ + Arc_ptr next; /* trim list pointer */ + Arc_ptr link; /* bin pointers */ + BezierArc * bezierArc; /* associated bezier arc */ + PwlArc * pwlArc; /* associated pwl arc */ + long type; /* curve type */ + long nuid; + + inline Arc( Arc *, PwlArc * ); + inline Arc( arc_side, long ); + + Arc_ptr append( Arc_ptr ); + int check( void ); + int isMonotone( void ); + int isDisconnected( void ); + int numpts( void ); + void markverts( void ); + void getextrema( Arc_ptr[4] ); + void print( void ); + void show( void ); + void makeSide( PwlArc *, arc_side ); + inline int isTessellated() { return pwlArc ? 1 : 0; } + inline long isbezier() { return type & bezier_tag; } + inline void setbezier() { type |= bezier_tag; } + inline void clearbezier() { type &= ~bezier_tag; } + inline long npts() { return pwlArc->npts; } + inline TrimVertex * pts() { return pwlArc->pts; } + inline REAL * tail() { return pwlArc->pts[0].param; } + inline REAL * head() { return next->pwlArc->pts[0].param; } + inline REAL * rhead() { return pwlArc->pts[pwlArc->npts-1].param; } + inline long ismarked() { return type & arc_tag; } + inline void setmark() { type |= arc_tag; } + inline void clearmark() { type &= (~arc_tag); } + inline void clearside() { type &= ~(0x7 << 8); } + inline void setside( arc_side s ) { clearside(); type |= (((long)s)<<8); } + inline arc_side getside() { return (arc_side) ((type>>8) & 0x7); } + inline int getitail() { return type & tail_tag; } + inline void setitail() { type |= tail_tag; } + inline void clearitail() { type &= (~tail_tag); } +}; + +/*-------------------------------------------------------------------------- + * Arc - initialize a new Arc with the same type and uid of + * a given Arc and a given pwl arc + *-------------------------------------------------------------------------- + */ + +inline +Arc::Arc( Arc *j, PwlArc *p ) +{ + bezierArc = NULL; + pwlArc = p; + type = j->type; + nuid = j->nuid; +} + +/*-------------------------------------------------------------------------- + * Arc - initialize a new Arc with the same type and uid of + * a given Arc and a given pwl arc + *-------------------------------------------------------------------------- + */ + +inline +Arc::Arc( arc_side side, long _nuid ) +{ + bezierArc = NULL; + pwlArc = NULL; + type = 0; + setside( side ); + nuid = _nuid; +} + +#endif /* __gluarc_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/arcsorter.cc b/mesalib/src/glu/sgi/libnurbs/internals/arcsorter.cc new file mode 100644 index 000000000..1f85cb710 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/arcsorter.cc @@ -0,0 +1,172 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * arcsorter.c++ + * + */ + +#ifndef __gluarcsorter_c_ +#define __gluarcsorter_c_ + +#include "glimports.h" +#include "arc.h" +#include "arcsorter.h" +#include "subdivider.h" + +ArcSorter::ArcSorter(Subdivider &s) : Sorter( sizeof( Arc ** ) ), subdivider(s) +{ +} + +int +ArcSorter::qscmp( char *, char * ) +{ + _glu_dprintf( "ArcSorter::qscmp: pure virtual called\n" ); + return 0; +} + +void +ArcSorter::qsort( Arc **a, int n ) +{ + Sorter::qsort( (void *) a, n ); +} + +void +ArcSorter::qsexc( char *i, char *j )// i<-j, j<-i +{ + Arc **jarc1 = (Arc **) i; + Arc **jarc2 = (Arc **) j; + Arc *tmp = *jarc1; + *jarc1 = *jarc2; + *jarc2 = tmp; +} + +void +ArcSorter::qstexc( char *i, char *j, char *k )// i<-k, k<-j, j<-i +{ + Arc **jarc1 = (Arc **) i; + Arc **jarc2 = (Arc **) j; + Arc **jarc3 = (Arc **) k; + Arc *tmp = *jarc1; + *jarc1 = *jarc3; + *jarc3 = *jarc2; + *jarc2 = tmp; +} + + +ArcSdirSorter::ArcSdirSorter( Subdivider &s ) : ArcSorter(s) +{ +} + +int +ArcSdirSorter::qscmp( char *i, char *j ) +{ + Arc *jarc1 = *(Arc **) i; + Arc *jarc2 = *(Arc **) j; + + int v1 = (jarc1->getitail() ? 0 : (jarc1->pwlArc->npts - 1)); + int v2 = (jarc2->getitail() ? 0 : (jarc2->pwlArc->npts - 1)); + + REAL diff = jarc1->pwlArc->pts[v1].param[1] - + jarc2->pwlArc->pts[v2].param[1]; + + if( diff < 0.0) + return -1; + else if( diff > 0.0) + return 1; + else { + if( v1 == 0 ) { + if( jarc2->tail()[0] < jarc1->tail()[0] ) { + return subdivider.ccwTurn_sl( jarc2, jarc1 ) ? 1 : -1; + } else { + return subdivider.ccwTurn_sr( jarc2, jarc1 ) ? -1 : 1; + } + } else { + if( jarc2->head()[0] < jarc1->head()[0] ) { + return subdivider.ccwTurn_sl( jarc1, jarc2 ) ? -1 : 1; + } else { + return subdivider.ccwTurn_sr( jarc1, jarc2 ) ? 1 : -1; + } + } + } +} + +ArcTdirSorter::ArcTdirSorter( Subdivider &s ) : ArcSorter(s) +{ +} + +/*---------------------------------------------------------------------------- + * ArcTdirSorter::qscmp - + * compare two axis monotone arcs that are incident + * to the line T == compare_value. Determine which of the + * two intersects that line with a LESSER S value. If + * jarc1 does, return 1. If jarc2 does, return -1. + *---------------------------------------------------------------------------- + */ +int +ArcTdirSorter::qscmp( char *i, char *j ) +{ + Arc *jarc1 = *(Arc **) i; + Arc *jarc2 = *(Arc **) j; + + int v1 = (jarc1->getitail() ? 0 : (jarc1->pwlArc->npts - 1)); + int v2 = (jarc2->getitail() ? 0 : (jarc2->pwlArc->npts - 1)); + + REAL diff = jarc1->pwlArc->pts[v1].param[0] - + jarc2->pwlArc->pts[v2].param[0]; + + if( diff < 0.0) + return 1; + else if( diff > 0.0) + return -1; + else { + if( v1 == 0 ) { + if (jarc2->tail()[1] < jarc1->tail()[1]) { + return subdivider.ccwTurn_tl( jarc2, jarc1 ) ? 1 : -1; + } else { + return subdivider.ccwTurn_tr( jarc2, jarc1 ) ? -1 : 1; + } + } else { + if( jarc2->head()[1] < jarc1->head()[1] ) { + return subdivider.ccwTurn_tl( jarc1, jarc2 ) ? -1 : 1; + } else { + return subdivider.ccwTurn_tr( jarc1, jarc2 ) ? 1 : -1; + } + } + } +} + + + +#endif /* __gluarcsorter_c_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/arcsorter.h b/mesalib/src/glu/sgi/libnurbs/internals/arcsorter.h new file mode 100644 index 000000000..d72dd1e86 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/arcsorter.h @@ -0,0 +1,73 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * arcsorter.h + * + */ + +#ifndef __gluarcsorter_h_ +#define __gluarcsorter_h_ + +#include "sorter.h" +#include "arcsorter.h" + +class Arc; +class Subdivider; + +class ArcSorter : private Sorter { +public: + ArcSorter(Subdivider &); + void qsort( Arc **a, int n ); +protected: + virtual int qscmp( char *, char * ); + Subdivider& subdivider; +private: + void qsexc( char *i, char *j ); // i<-j, j<-i + void qstexc( char *i, char *j, char *k ); // i<-k, k<-j, j<-i +}; + + +class ArcSdirSorter : public ArcSorter { +public: + ArcSdirSorter( Subdivider & ); +private: + int qscmp( char *, char * ); +}; + + +class ArcTdirSorter : public ArcSorter { +public: + ArcTdirSorter( Subdivider & ); +private: + int qscmp( char *, char * ); +}; + +#endif /* __gluarcsorter_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/arctess.cc b/mesalib/src/glu/sgi/libnurbs/internals/arctess.cc new file mode 100644 index 000000000..29e7cf4c0 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/arctess.cc @@ -0,0 +1,611 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * arctessellator.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "arctess.h" +#include "bufpool.h" +#include "simplemath.h" +#include "bezierarc.h" +#include "trimvertex.h" +#include "trimvertpool.h" + +#define NOELIMINATION + +#define steps_function(large, small, rate) (max(1, 1+ (int) ((large-small)/rate))); + +/*----------------------------------------------------------------------------- + * ArcTessellator - construct an ArcTessellator + *----------------------------------------------------------------------------- + */ + +ArcTessellator::ArcTessellator( TrimVertexPool& t, Pool& p ) + : pwlarcpool(p), trimvertexpool(t) +{ +} + +/*----------------------------------------------------------------------------- + * ~ArcTessellator - destroy an ArcTessellator + *----------------------------------------------------------------------------- + */ + +ArcTessellator::~ArcTessellator( void ) +{ +} + +/*----------------------------------------------------------------------------- + * bezier - construct a bezier arc and attach it to an Arc + *----------------------------------------------------------------------------- + */ + +void +ArcTessellator::bezier( Arc *arc, REAL s1, REAL s2, REAL t1, REAL t2 ) +{ + assert( arc != 0 ); + assert( ! arc->isTessellated() ); + +#ifndef NDEBUG + switch( arc->getside() ) { + case arc_left: + assert( s1 == s2 ); + assert( t2 < t1 ); + break; + case arc_right: + assert( s1 == s2 ); + assert( t1 < t2 ); + break; + case arc_top: + assert( t1 == t2 ); + assert( s2 < s1 ); + break; + case arc_bottom: + assert( t1 == t2 ); + assert( s1 < s2 ); + break; + case arc_none: + (void) abort(); + break; + } +#endif + + TrimVertex *p = trimvertexpool.get(2); + arc->pwlArc = new(pwlarcpool) PwlArc( 2, p ); + p[0].param[0] = s1; + p[0].param[1] = t1; + p[1].param[0] = s2; + p[1].param[1] = t2; + assert( (s1 == s2) || (t1 == t2) ); + arc->setbezier(); +} + + +/*----------------------------------------------------------------------------- + * pwl_left - construct a left boundary pwl arc and attach it to an arc + *----------------------------------------------------------------------------- + */ + +void +ArcTessellator::pwl_left( Arc *arc, REAL s, REAL t1, REAL t2, REAL rate ) +{ + assert( t2 < t1 ); + +/* if(rate <= 0.06) rate = 0.06;*/ +/* int nsteps = 1 + (int) ((t1 - t2) / rate ); */ + int nsteps = steps_function(t1, t2, rate); + + + REAL stepsize = (t1 - t2) / (REAL) nsteps; + + TrimVertex *newvert = trimvertexpool.get( nsteps+1 ); + int i; + for( i = nsteps; i > 0; i-- ) { + newvert[i].param[0] = s; + newvert[i].param[1] = t2; + t2 += stepsize; + } + newvert[i].param[0] = s; + newvert[i].param[1] = t1; + + arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_left ); +} + +/*----------------------------------------------------------------------------- + * pwl_right - construct a right boundary pwl arc and attach it to an arc + *----------------------------------------------------------------------------- + */ + +void +ArcTessellator::pwl_right( Arc *arc, REAL s, REAL t1, REAL t2, REAL rate ) +{ + assert( t1 < t2 ); + +/* if(rate <= 0.06) rate = 0.06;*/ + +/* int nsteps = 1 + (int) ((t2 - t1) / rate ); */ + int nsteps = steps_function(t2,t1,rate); + REAL stepsize = (t2 - t1) / (REAL) nsteps; + + TrimVertex *newvert = trimvertexpool.get( nsteps+1 ); + int i; + for( i = 0; i < nsteps; i++ ) { + newvert[i].param[0] = s; + newvert[i].param[1] = t1; + t1 += stepsize; + } + newvert[i].param[0] = s; + newvert[i].param[1] = t2; + + arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_right ); +} + + +/*----------------------------------------------------------------------------- + * pwl_top - construct a top boundary pwl arc and attach it to an arc + *----------------------------------------------------------------------------- + */ + +void +ArcTessellator::pwl_top( Arc *arc, REAL t, REAL s1, REAL s2, REAL rate ) +{ + assert( s2 < s1 ); + +/* if(rate <= 0.06) rate = 0.06;*/ + +/* int nsteps = 1 + (int) ((s1 - s2) / rate ); */ + int nsteps = steps_function(s1,s2,rate); + REAL stepsize = (s1 - s2) / (REAL) nsteps; + + TrimVertex *newvert = trimvertexpool.get( nsteps+1 ); + int i; + for( i = nsteps; i > 0; i-- ) { + newvert[i].param[0] = s2; + newvert[i].param[1] = t; + s2 += stepsize; + } + newvert[i].param[0] = s1; + newvert[i].param[1] = t; + + arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_top ); +} + +/*----------------------------------------------------------------------------- + * pwl_bottom - construct a bottom boundary pwl arc and attach it to an arc + *----------------------------------------------------------------------------- + */ + +void +ArcTessellator::pwl_bottom( Arc *arc, REAL t, REAL s1, REAL s2, REAL rate ) +{ + assert( s1 < s2 ); + +/* if(rate <= 0.06) rate = 0.06;*/ + +/* int nsteps = 1 + (int) ((s2 - s1) / rate ); */ + int nsteps = steps_function(s2,s1,rate); + REAL stepsize = (s2 - s1) / (REAL) nsteps; + + TrimVertex *newvert = trimvertexpool.get( nsteps+1 ); + int i; + for( i = 0; i < nsteps; i++ ) { + newvert[i].param[0] = s1; + newvert[i].param[1] = t; + s1 += stepsize; + } + newvert[i].param[0] = s2; + newvert[i].param[1] = t; + + arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_bottom ); +} + +/*----------------------------------------------------------------------------- + * pwl - construct a pwl arc and attach it to an arc + *----------------------------------------------------------------------------- + */ + +void +ArcTessellator::pwl( Arc *arc, REAL s1, REAL s2, REAL t1, REAL t2, REAL rate ) +{ + +/* if(rate <= 0.06) rate = 0.06;*/ + + int snsteps = 1 + (int) (glu_abs(s2 - s1) / rate ); + int tnsteps = 1 + (int) (glu_abs(t2 - t1) / rate ); + int nsteps = max(1,max( snsteps, tnsteps )); + + REAL sstepsize = (s2 - s1) / (REAL) nsteps; + REAL tstepsize = (t2 - t1) / (REAL) nsteps; + TrimVertex *newvert = trimvertexpool.get( nsteps+1 ); + long i; + for( i = 0; i < nsteps; i++ ) { + newvert[i].param[0] = s1; + newvert[i].param[1] = t1; + s1 += sstepsize; + t1 += tstepsize; + } + newvert[i].param[0] = s2; + newvert[i].param[1] = t2; + + /* arc->makeSide( new(pwlarcpool) PwlArc( nsteps+1, newvert ), arc_bottom ); */ + arc->pwlArc = new(pwlarcpool) PwlArc( nsteps+1, newvert ); + + arc->clearbezier(); + arc->clearside( ); +} + + +/*----------------------------------------------------------------------------- + * tessellateLinear - constuct a linear pwl arc and attach it to an Arc + *----------------------------------------------------------------------------- + */ + +void +ArcTessellator::tessellateLinear( Arc *arc, REAL geo_stepsize, REAL arc_stepsize, int isrational ) +{ + assert( arc->pwlArc == NULL ); + REAL s1, s2, t1, t2; + + //we don't need to scale by arc_stepsize if the trim curve + //is piecewise linear. Reason: In pwl_right, pwl_left, pwl_top, pwl_left, + //and pwl, the nsteps is computed by deltaU (or V) /stepsize. + //The quantity deltaU/arc_stepsize doesn't have any meaning. And + //it causes problems: see bug 517641 + REAL stepsize = geo_stepsize; /* * arc_stepsize*/; + + BezierArc *b = arc->bezierArc; + + if( isrational ) { + s1 = b->cpts[0] / b->cpts[2]; + t1 = b->cpts[1] / b->cpts[2]; + s2 = b->cpts[b->stride+0] / b->cpts[b->stride+2]; + t2 = b->cpts[b->stride+1] / b->cpts[b->stride+2]; + } else { + s1 = b->cpts[0]; + t1 = b->cpts[1]; + s2 = b->cpts[b->stride+0]; + t2 = b->cpts[b->stride+1]; + } + if( s1 == s2 ) + if( t1 < t2 ) + pwl_right( arc, s1, t1, t2, stepsize ); + else + pwl_left( arc, s1, t1, t2, stepsize ); + else if( t1 == t2 ) + if( s1 < s2 ) + pwl_bottom( arc, t1, s1, s2, stepsize ); + else + pwl_top( arc, t1, s1, s2, stepsize ); + else + pwl( arc, s1, s2, t1, t2, stepsize ); +} + +/*----------------------------------------------------------------------------- + * tessellateNonlinear - constuct a nonlinear pwl arc and attach it to an Arc + *----------------------------------------------------------------------------- + */ + +void +ArcTessellator::tessellateNonlinear( Arc *arc, REAL geo_stepsize, REAL arc_stepsize, int isrational ) +{ + assert( arc->pwlArc == NULL ); + + REAL stepsize = geo_stepsize * arc_stepsize; + + BezierArc *bezierArc = arc->bezierArc; + + REAL size; //bounding box size of the curve in UV + { + int i,j; + REAL min_u, min_v, max_u,max_v; + min_u = max_u = bezierArc->cpts[0]; + min_v = max_v = bezierArc->cpts[1]; + for(i=1, j=bezierArc->stride; iorder; i++, j+= bezierArc->stride) + { + if(bezierArc->cpts[j] < min_u) + min_u = bezierArc->cpts[j]; + if(bezierArc->cpts[j] > max_u) + max_u = bezierArc->cpts[j]; + if(bezierArc->cpts[j+1] < min_v) + min_v = bezierArc->cpts[j+1]; + if(bezierArc->cpts[j+1] > max_v) + max_v = bezierArc->cpts[j+1]; + } + + size = max_u - min_u; + if(size < max_v - min_v) + size = max_v - min_v; + } + + /*int nsteps = 1 + (int) (1.0/stepsize);*/ + + int nsteps = (int) (size/stepsize); + if(nsteps <=0) + nsteps=1; + + TrimVertex *vert = trimvertexpool.get( nsteps+1 ); + REAL dp = 1.0/nsteps; + + + arc->pwlArc = new(pwlarcpool) PwlArc(); + arc->pwlArc->pts = vert; + + if( isrational ) { + REAL pow_u[MAXORDER], pow_v[MAXORDER], pow_w[MAXORDER]; + trim_power_coeffs( bezierArc, pow_u, 0 ); + trim_power_coeffs( bezierArc, pow_v, 1 ); + trim_power_coeffs( bezierArc, pow_w, 2 ); + + /* compute first point exactly */ + REAL *b = bezierArc->cpts; + vert->param[0] = b[0]/b[2]; + vert->param[1] = b[1]/b[2]; + + /* strength reduction on p = dp * step would introduce error */ + int step; +#ifndef NOELIMINATION + int ocanremove = 0; +#endif + register long order = bezierArc->order; + for( step=1, ++vert; stepparam[0] = u/w; + vert->param[1] = v/w; +#ifndef NOELIMINATION + REAL ds = glu_abs(vert[0].param[0] - vert[-1].param[0]); + REAL dt = glu_abs(vert[0].param[1] - vert[-1].param[1]); + int canremove = (dsstride; + vert->param[0] = b[0]/b[2]; + vert->param[1] = b[1]/b[2]; + + } else { + REAL pow_u[MAXORDER], pow_v[MAXORDER]; + trim_power_coeffs( bezierArc, pow_u, 0 ); + trim_power_coeffs( bezierArc, pow_v, 1 ); + + /* compute first point exactly */ + REAL *b = bezierArc->cpts; + vert->param[0] = b[0]; + vert->param[1] = b[1]; + + /* strength reduction on p = dp * step would introduce error */ + int step; +#ifndef NOELIMINATION + int ocanremove = 0; +#endif + register long order = bezierArc->order; + for( step=1, ++vert; steporder; i++ ) { + u = u * p + pow_u[i]; + v = v * p + pow_v[i]; + } + vert->param[0] = u; + vert->param[1] = v; +#ifndef NOELIMINATION + REAL ds = glu_abs(vert[0].param[0] - vert[-1].param[0]); + REAL dt = glu_abs(vert[0].param[1] - vert[-1].param[1]); + int canremove = (dsstride; + vert->param[0] = b[0]; + vert->param[1] = b[1]; + } + arc->pwlArc->npts = vert - arc->pwlArc->pts + 1; +/* + for( TrimVertex *vt=pwlArc->pts; vt != vert-1; vt++ ) { + if( tooclose( vt[0].param[0], vt[1].param[0] ) ) + vt[1].param[0] = vt[0].param[0]; + if( tooclose( vt[0].param[1], vt[1].param[1] ) ) + vt[1].param[1] = vt[0].param[1]; + } +*/ +} + +const REAL ArcTessellator::gl_Bernstein[][MAXORDER][MAXORDER] = { + { + {1, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 } + }, + { + {-1, 1, 0, 0, 0, 0, 0, 0 }, + {1, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 } + }, + { + {1, -2, 1, 0, 0, 0, 0, 0 }, + {-2, 2, 0, 0, 0, 0, 0, 0 }, + {1, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 } + }, + { + {-1, 3, -3, 1, 0, 0, 0, 0 }, + {3, -6, 3, 0, 0, 0, 0, 0 }, + {-3, 3, 0, 0, 0, 0, 0, 0 }, + {1, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 } + }, + { + {1, -4, 6, -4, 1, 0, 0, 0 }, + {-4, 12, -12, 4, 0, 0, 0, 0 }, + {6, -12, 6, 0, 0, 0, 0, 0 }, + {-4, 4, 0, 0, 0, 0, 0, 0 }, + {1, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 } + }, + { + {-1, 5, -10, 10, -5, 1, 0, 0 }, + {5, -20, 30, -20, 5, 0, 0, 0 }, + {-10, 30, -30, 10, 0, 0, 0, 0 }, + {10, -20, 10, 0, 0, 0, 0, 0 }, + {-5, 5, 0, 0, 0, 0, 0, 0 }, + {1, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 } + }, + { + {1, -6, 15, -20, 15, -6, 1, 0 }, + {-6, 30, -60, 60, -30, 6, 0, 0 }, + {15, -60, 90, -60, 15, 0, 0, 0 }, + {-20, 60, -60, 20, 0, 0, 0, 0 }, + {15, -30, 15, 0, 0, 0, 0, 0 }, + {-6, 6, 0, 0, 0, 0, 0, 0 }, + {1, 0, 0, 0, 0, 0, 0, 0 }, + {0, 0, 0, 0, 0, 0, 0, 0 } + }, + { + {-1, 7, -21, 35, -35, 21, -7, 1 }, + {7, -42, 105, -140, 105, -42, 7, 0 }, + {-21, 105, -210, 210, -105, 21, 0, 0 }, + {35, -140, 210, -140, 35, 0, 0, 0 }, + {-35, 105, -105, 35, 0, 0, 0, 0 }, + {21, -42, 21, 0, 0, 0, 0, 0 }, + {-7, 7, 0, 0, 0, 0, 0, 0 }, + {1, 0, 0, 0, 0, 0, 0, 0 } + }}; + + +/*----------------------------------------------------------------------------- + * trim_power_coeffs - compute power basis coefficients from bezier coeffients + *----------------------------------------------------------------------------- + */ +void +ArcTessellator::trim_power_coeffs( BezierArc *bez_arc, REAL *p, int coord ) +{ + register int stride = bez_arc->stride; + register int order = bez_arc->order; + register REAL *base = bez_arc->cpts + coord; + + REAL const (*mat)[MAXORDER][MAXORDER] = &gl_Bernstein[order-1]; + REAL const (*lrow)[MAXORDER] = &(*mat)[order]; + + /* WIN32 didn't like the following line within the for-loop */ + REAL const (*row)[MAXORDER] = &(*mat)[0]; + for( ; row != lrow; row++ ) { + register REAL s = 0.0; + register REAL *point = base; + register REAL const *mlast = *row + order; + for( REAL const *m = *row; m != mlast; m++, point += stride ) + s += *(m) * (*point); + *(p++) = s; + } +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/arctess.h b/mesalib/src/glu/sgi/libnurbs/internals/arctess.h new file mode 100644 index 000000000..7802af90c --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/arctess.h @@ -0,0 +1,66 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * arctess.h + * + */ + +#ifndef __gluarctess_h_ +#define __gluarctess_h_ + +#include "defines.h" +#include "types.h" +#include "arc.h" + +struct BezierArc; +class Pool; +class TrimVertexPool; + +class ArcTessellator { +public: + ArcTessellator( TrimVertexPool&, Pool& ); + ~ArcTessellator( void ); + void bezier( Arc_ptr, REAL, REAL, REAL, REAL ); + void pwl( Arc_ptr, REAL, REAL, REAL, REAL, REAL ); + void pwl_left( Arc_ptr, REAL, REAL, REAL, REAL ); + void pwl_right( Arc_ptr, REAL, REAL, REAL, REAL ); + void pwl_top( Arc_ptr, REAL, REAL, REAL, REAL ); + void pwl_bottom( Arc_ptr, REAL, REAL, REAL, REAL ); + void tessellateLinear( Arc_ptr, REAL, REAL, int ); + void tessellateNonlinear( Arc_ptr, REAL, REAL, int ); +private: + static const REAL gl_Bernstein[][MAXORDER][MAXORDER]; + Pool& pwlarcpool; + TrimVertexPool& trimvertexpool; + static void trim_power_coeffs( BezierArc *, REAL[MAXORDER], int ); +}; + +#endif /* __gluarctess_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/backend.cc b/mesalib/src/glu/sgi/libnurbs/internals/backend.cc new file mode 100644 index 000000000..88dc3f516 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/backend.cc @@ -0,0 +1,589 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * backend.c++ + * + */ + +/* Bezier surface backend + - interprets display mode (wireframe,shaded,...) +*/ +#include +#include "glimports.h" +#include "mystdio.h" +#include "backend.h" +#include "basiccrveval.h" +#include "basicsurfeval.h" +#include "nurbsconsts.h" + +#define NOWIREFRAME + + +/*------------------------------------------------------------------------- + * bgnsurf - preamble to surface definition and evaluations + *------------------------------------------------------------------------- + */ +void +Backend::bgnsurf( int wiretris, int wirequads, long nuid ) +{ +/*#ifndef NOWIREFRAME*/ //need this for old version + wireframetris = wiretris; + wireframequads = wirequads; +/*#endif*/ + + /*in the spec, GLU_DISPLAY_MODE is either + * GLU_FILL + * GLU_OUTLINE_POLY + * GLU_OUTLINE_PATCH. + *In fact, GLU_FLL is has the same effect as + * set GL_FRONT_AND_BACK to be GL_FILL + * and GLU_OUTLINE_POLY is the same as set + * GL_FRONT_AND_BACK to be GL_LINE + *It is more efficient to do this once at the beginning of + *each surface than to do it for each primitive. + * The internal has more options: outline_triangle and outline_quad + *can be seperated. But since this is not in spec, and more importantly, + *this is not so useful, so we don't need to keep this option. + */ + + surfaceEvaluator.bgnmap2f( nuid ); + + if(wiretris) + surfaceEvaluator.polymode(N_MESHLINE); + else + surfaceEvaluator.polymode(N_MESHFILL); +} + +void +Backend::patch( REAL ulo, REAL uhi, REAL vlo, REAL vhi ) +{ + surfaceEvaluator.domain2f( ulo, uhi, vlo, vhi ); +} + +void +Backend::surfbbox( long type, REAL *from, REAL *to ) +{ + surfaceEvaluator.range2f( type, from, to ); +} + +/*------------------------------------------------------------------------- + * surfpts - pass a desription of a surface map + *------------------------------------------------------------------------- + */ +void +Backend::surfpts( + long type, /* geometry, color, texture, normal */ + REAL *pts, /* control points */ + long ustride, /* distance to next point in u direction */ + long vstride, /* distance to next point in v direction */ + int uorder, /* u parametric order */ + int vorder, /* v parametric order */ + REAL ulo, /* u lower bound */ + REAL uhi, /* u upper bound */ + REAL vlo, /* v lower bound */ + REAL vhi ) /* v upper bound */ +{ + surfaceEvaluator.map2f( type,ulo,uhi,ustride,uorder,vlo,vhi,vstride,vorder,pts ); + surfaceEvaluator.enable( type ); +} + +/*------------------------------------------------------------------------- + * surfgrid - define a lattice of points with origin and offset + *------------------------------------------------------------------------- + */ +void +Backend::surfgrid( REAL u0, REAL u1, long nu, REAL v0, REAL v1, long nv ) +{ + surfaceEvaluator.mapgrid2f( nu, u0, u1, nv, v0, v1 ); +} + +/*------------------------------------------------------------------------- + * surfmesh - evaluate a mesh of points on lattice + *------------------------------------------------------------------------- + */ +void +Backend::surfmesh( long u, long v, long n, long m ) +{ +#ifndef NOWIREFRAME + if( wireframequads ) { + long v0, v1; + long u0f = u, u1f = u+n; + long v0f = v, v1f = v+m; + long parity = (u & 1); + + for( v0 = v0f, v1 = v0f++ ; v0isGridVert() ) { + tmeshvert( v->g ); + } else { + tmeshvert( v->t ); + } +} + +void +Backend::tmeshvertNOGE(TrimVertex *t) +{ +// surfaceEvaluator.inDoEvalCoord2NOGE( t->param[0], t->param[1], temp, ttt); +#ifdef USE_OPTTT + surfaceEvaluator.inDoEvalCoord2NOGE( t->param[0], t->param[1], t->cache_point, t->cache_normal); +#endif +} + +//opt for a line with the same u. +void +Backend::tmeshvertNOGE_BU(TrimVertex *t) +{ +#ifdef USE_OPTTT + surfaceEvaluator.inDoEvalCoord2NOGE_BU( t->param[0], t->param[1], t->cache_point, t->cache_normal); +#endif +} + +//opt for a line with the same v. +void +Backend::tmeshvertNOGE_BV(TrimVertex *t) +{ +#ifdef USE_OPTTT + surfaceEvaluator.inDoEvalCoord2NOGE_BV( t->param[0], t->param[1], t->cache_point, t->cache_normal); +#endif +} + +void +Backend::preEvaluateBU(REAL u) +{ + surfaceEvaluator.inPreEvaluateBU_intfac(u); +} + +void +Backend::preEvaluateBV(REAL v) +{ + surfaceEvaluator.inPreEvaluateBV_intfac(v); +} + + +/*------------------------------------------------------------------------- + * tmeshvert - evaluate a point on a triangle mesh + *------------------------------------------------------------------------- + */ +void +Backend::tmeshvert( TrimVertex *t ) +{ + +#ifndef NOWIREFRAME + const long nuid = t->nuid; +#endif + const REAL u = t->param[0]; + const REAL v = t->param[1]; + +#ifndef NOWIREFRAME + npts++; + if( wireframetris ) { + if( npts >= 3 ) { + surfaceEvaluator.bgnclosedline(); + if( mesh[0][2] == 0 ) + surfaceEvaluator.evalcoord2f( mesh[0][3], mesh[0][0], mesh[0][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[0][0], (long) mesh[0][1] ); + if( mesh[1][2] == 0 ) + surfaceEvaluator.evalcoord2f( mesh[1][3], mesh[1][0], mesh[1][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[1][0], (long) mesh[1][1] ); + surfaceEvaluator.evalcoord2f( nuid, u, v ); + surfaceEvaluator.endclosedline(); + } + mesh[meshindex][0] = u; + mesh[meshindex][1] = v; + mesh[meshindex][2] = 0; + mesh[meshindex][3] = nuid; + meshindex = (meshindex+1) % 2; + } else { + surfaceEvaluator.evalcoord2f( nuid, u, v ); + } +#else + + surfaceEvaluator.evalcoord2f( 0, u, v ); +//for uninitial memory read surfaceEvaluator.evalcoord2f( nuid, u, v ); +#endif +} + +//the same as tmeshvert(trimvertex), for efficiency purpose +void +Backend::tmeshvert( REAL u, REAL v ) +{ +#ifndef NOWIREFRAME + const long nuid = 0; + + npts++; + if( wireframetris ) { + if( npts >= 3 ) { + surfaceEvaluator.bgnclosedline(); + if( mesh[0][2] == 0 ) + surfaceEvaluator.evalcoord2f( mesh[0][3], mesh[0][0], mesh[0][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[0][0], (long) mesh[0][1] ); + if( mesh[1][2] == 0 ) + surfaceEvaluator.evalcoord2f( mesh[1][3], mesh[1][0], mesh[1][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[1][0], (long) mesh[1][1] ); + surfaceEvaluator.evalcoord2f( nuid, u, v ); + surfaceEvaluator.endclosedline(); + } + mesh[meshindex][0] = u; + mesh[meshindex][1] = v; + mesh[meshindex][2] = 0; + mesh[meshindex][3] = nuid; + meshindex = (meshindex+1) % 2; + } else { + surfaceEvaluator.evalcoord2f( nuid, u, v ); + } +#else + + surfaceEvaluator.evalcoord2f( 0, u, v ); +#endif +} + +/*------------------------------------------------------------------------- + * tmeshvert - evaluate a grid point of a triangle mesh + *------------------------------------------------------------------------- + */ +void +Backend::tmeshvert( GridVertex *g ) +{ + const long u = g->gparam[0]; + const long v = g->gparam[1]; + +#ifndef NOWIREFRAME + npts++; + if( wireframetris ) { + if( npts >= 3 ) { + surfaceEvaluator.bgnclosedline(); + if( mesh[0][2] == 0 ) + surfaceEvaluator.evalcoord2f( (long) mesh[0][3], mesh[0][0], mesh[0][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[0][0], (long) mesh[0][1] ); + if( mesh[1][2] == 0 ) + surfaceEvaluator.evalcoord2f( (long) mesh[1][3], mesh[1][0], mesh[1][1] ); + else + surfaceEvaluator.evalpoint2i( (long) mesh[1][0], (long) mesh[1][1] ); + surfaceEvaluator.evalpoint2i( u, v ); + surfaceEvaluator.endclosedline(); + } + mesh[meshindex][0] = u; + mesh[meshindex][1] = v; + mesh[meshindex][2] = 1; + meshindex = (meshindex+1) % 2; + } else { + surfaceEvaluator.evalpoint2i( u, v ); + } +#else + surfaceEvaluator.evalpoint2i( u, v ); +#endif +} + +/*------------------------------------------------------------------------- + * swaptmesh - perform a swap of the triangle mesh pointers + *------------------------------------------------------------------------- + */ +void +Backend::swaptmesh( void ) +{ +#ifndef NOWIREFRAME + if( wireframetris ) { + meshindex = 1 - meshindex; + } else { + surfaceEvaluator.swaptmesh(); + } +#else + surfaceEvaluator.swaptmesh(); +#endif +} + +/*------------------------------------------------------------------------- + * endtmesh - postamble to triangle mesh + *------------------------------------------------------------------------- + */ +void +Backend::endtmesh( void ) +{ +#ifndef NOWIREFRAME + if( ! wireframetris ) + surfaceEvaluator.endtmesh(); +#else + surfaceEvaluator.endtmesh(); +/* surfaceEvaluator.polymode( N_MESHFILL );*/ +#endif +} + + +/*------------------------------------------------------------------------- + * bgnoutline - preamble to outlined rendering + *------------------------------------------------------------------------- + */ +void +Backend::bgnoutline( void ) +{ + surfaceEvaluator.bgnline(); +} + +/*------------------------------------------------------------------------- + * linevert - evaluate a point on an outlined contour + *------------------------------------------------------------------------- + */ +void +Backend::linevert( TrimVertex *t ) +{ + surfaceEvaluator.evalcoord2f( t->nuid, t->param[0], t->param[1] ); +} + +/*------------------------------------------------------------------------- + * linevert - evaluate a grid point of an outlined contour + *------------------------------------------------------------------------- + */ +void +Backend::linevert( GridVertex *g ) +{ + surfaceEvaluator.evalpoint2i( g->gparam[0], g->gparam[1] ); +} + +/*------------------------------------------------------------------------- + * endoutline - postamble to outlined rendering + *------------------------------------------------------------------------- + */ +void +Backend::endoutline( void ) +{ + surfaceEvaluator.endline(); +} + +/*------------------------------------------------------------------------- + * triangle - output a triangle + *------------------------------------------------------------------------- + */ +void +Backend::triangle( TrimVertex *a, TrimVertex *b, TrimVertex *c ) +{ +/* bgntmesh( "spittriangle" );*/ + bgntfan(); + tmeshvert( a ); + tmeshvert( b ); + tmeshvert( c ); + endtfan(); +/* endtmesh();*/ +} + +void +Backend::bgncurv( void ) +{ + curveEvaluator.bgnmap1f( 0 ); +} + +void +Backend::segment( REAL ulo, REAL uhi ) +{ + curveEvaluator.domain1f( ulo, uhi ); +} + +void +Backend::curvpts( + long type, /* geometry, color, texture, normal */ + REAL *pts, /* control points */ + long stride, /* distance to next point */ + int order, /* parametric order */ + REAL ulo, /* lower parametric bound */ + REAL uhi ) /* upper parametric bound */ + +{ + curveEvaluator.map1f( type, ulo, uhi, stride, order, pts ); + curveEvaluator.enable( type ); +} + +void +Backend::curvgrid( REAL u0, REAL u1, long nu ) +{ + curveEvaluator.mapgrid1f( nu, u0, u1 ); +} + +void +Backend::curvmesh( long from, long n ) +{ + curveEvaluator.mapmesh1f( N_MESHFILL, from, from+n ); +} + +void +Backend::curvpt(REAL u) +{ + curveEvaluator.evalcoord1f( 0, u ); +} + +void +Backend::bgnline( void ) +{ + curveEvaluator.bgnline(); +} + +void +Backend::endline( void ) +{ + curveEvaluator.endline(); +} + +void +Backend::endcurv( void ) +{ + curveEvaluator.endmap1f(); +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/backend.h b/mesalib/src/glu/sgi/libnurbs/internals/backend.h new file mode 100644 index 000000000..6840cb19e --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/backend.h @@ -0,0 +1,113 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * backend.h + * + */ + +#ifndef __glubackend_h_ +#define __glubackend_h_ + +#include "trimvertex.h" +#include "gridvertex.h" +#include "gridtrimvertex.h" + +class BasicCurveEvaluator; +class BasicSurfaceEvaluator; + +class Backend { +private: + BasicCurveEvaluator& curveEvaluator; + BasicSurfaceEvaluator& surfaceEvaluator; +public: + Backend( BasicCurveEvaluator &c, BasicSurfaceEvaluator& e ) + : curveEvaluator(c), surfaceEvaluator(e) {} + + /* surface backend routines */ + void bgnsurf( int, int, long ); + void patch( REAL, REAL, REAL, REAL ); + void surfpts( long, REAL *, long, long, int, int, + REAL, REAL, REAL, REAL ); + void surfbbox( long, REAL *, REAL * ); + void surfgrid( REAL, REAL, long, REAL, REAL, long ); + void surfmesh( long, long, long, long ); + void bgntmesh( const char * ); + void endtmesh( void ); + void swaptmesh( void ); + void tmeshvert( GridTrimVertex * ); + void tmeshvert( TrimVertex * ); + void tmeshvert( GridVertex * ); + void tmeshvert( REAL u, REAL v ); + void linevert( TrimVertex * ); + void linevert( GridVertex * ); + void bgnoutline( void ); + void endoutline( void ); + void endsurf( void ); + void triangle( TrimVertex*, TrimVertex*, TrimVertex* ); + + void bgntfan(); + void endtfan(); + void bgnqstrip(); + void endqstrip(); + void evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, + int n_lower, REAL v_lower, REAL* lower_val + ); + void evalVStrip(int n_left, REAL u_left, REAL* left_val, + int n_right, REAL v_right, REAL* right_val + ); + void tmeshvertNOGE(TrimVertex *t); + void tmeshvertNOGE_BU(TrimVertex *t); + void tmeshvertNOGE_BV(TrimVertex *t); + void preEvaluateBU(REAL u); + void preEvaluateBV(REAL v); + + + /* curve backend routines */ + void bgncurv( void ); + void segment( REAL, REAL ); + void curvpts( long, REAL *, long, int, REAL, REAL ); + void curvgrid( REAL, REAL, long ); + void curvmesh( long, long ); + void curvpt( REAL ); + void bgnline( void ); + void endline( void ); + void endcurv( void ); +private: +#ifndef NOWIREFRAME + int wireframetris; + int wireframequads; + int npts; + REAL mesh[3][4]; + int meshindex; +#endif +}; + +#endif /* __glubackend_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/basiccrveval.cc b/mesalib/src/glu/sgi/libnurbs/internals/basiccrveval.cc new file mode 100644 index 000000000..cc473e4c2 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/basiccrveval.cc @@ -0,0 +1,138 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * basiccrveval.c++ + * + */ + +#include "mystdio.h" +#include "types.h" +#include "basiccrveval.h" + +void +BasicCurveEvaluator::domain1f( REAL, REAL ) +{ +#ifndef NDEBUG + _glu_dprintf( "domain1f\n" ); +#endif +} + +void +BasicCurveEvaluator::range1f( long , REAL *, REAL * ) +{ +#ifndef NDEBUG + _glu_dprintf( "range1f\n" ); +#endif +} + +void +BasicCurveEvaluator::enable( long ) +{ +#ifndef NDEBUG + _glu_dprintf( "enable\n" ); +#endif +} + +void +BasicCurveEvaluator::disable( long ) +{ +#ifndef NDEBUG + _glu_dprintf( "disable\n" ); +#endif +} + +void +BasicCurveEvaluator::bgnmap1f( long ) +{ +#ifndef NDEBUG + _glu_dprintf( "bgnmap1f\n" ); +#endif +} + +void +BasicCurveEvaluator::map1f( long, REAL, REAL, long, long, REAL * ) +{ +#ifndef NDEBUG + _glu_dprintf( "map1f\n" ); +#endif +} + +void +BasicCurveEvaluator::mapgrid1f( long, REAL, REAL ) +{ +#ifndef NDEBUG + _glu_dprintf( "mapgrid1f\n" ); +#endif +} + +void +BasicCurveEvaluator::mapmesh1f( long, long, long ) +{ +#ifndef NDEBUG + _glu_dprintf( "mapmesh1f\n" ); +#endif +} + +void +BasicCurveEvaluator::evalcoord1f( long, REAL ) +{ +#ifndef NDEBUG + _glu_dprintf( "evalcoord1f\n" ); +#endif +} + +void +BasicCurveEvaluator::endmap1f( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "endmap1f\n" ); +#endif +} + +void +BasicCurveEvaluator::bgnline( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "bgnline\n" ); +#endif +} + +void +BasicCurveEvaluator::endline( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "endline\n" ); +#endif +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/basiccrveval.h b/mesalib/src/glu/sgi/libnurbs/internals/basiccrveval.h new file mode 100644 index 000000000..277dc8dc9 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/basiccrveval.h @@ -0,0 +1,62 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * basiccurveeval.h + * + */ + +#ifndef __glubasiccrveval_h_ +#define __glubasiccrveval_h_ + +#include "types.h" +#include "displaymode.h" +#include "cachingeval.h" + +class BasicCurveEvaluator : public CachingEvaluator { +public: + virtual ~BasicCurveEvaluator() { /* silence warning*/ } + virtual void domain1f( REAL, REAL ); + virtual void range1f( long, REAL *, REAL * ); + + virtual void enable( long ); + virtual void disable( long ); + virtual void bgnmap1f( long ); + virtual void map1f( long, REAL, REAL, long, long, REAL * ); + virtual void mapgrid1f( long, REAL, REAL ); + virtual void mapmesh1f( long, long, long ); + virtual void evalcoord1f( long, REAL ); + virtual void endmap1f( void ); + + virtual void bgnline( void ); + virtual void endline( void ); +}; + +#endif /* __glubasiccrveval_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/basicsurfeval.cc b/mesalib/src/glu/sgi/libnurbs/internals/basicsurfeval.cc new file mode 100644 index 000000000..fad5dd0ad --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/basicsurfeval.cc @@ -0,0 +1,232 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * basicsurfaceevaluator.c++ + * + */ + +#include "mystdio.h" +#include "types.h" +#include "basicsurfeval.h" + +#ifdef __WATCOMC__ +#pragma warning 726 10 +#endif + +void +BasicSurfaceEvaluator::domain2f( REAL, REAL, REAL, REAL ) +{ +#ifndef NDEBUG + _glu_dprintf( "domain2f\n" ); +#endif +} + +void +BasicSurfaceEvaluator::polymode( long ) +{ +#ifndef NDEBUG + _glu_dprintf( "polymode\n" ); +#endif +} + +void +BasicSurfaceEvaluator::range2f( long type, REAL *from, REAL *to ) +{ +#ifndef NDEBUG + _glu_dprintf( "range2f type %ld, from (%g,%g), to (%g,%g)\n", + type, from[0], from[1], to[0], to[1] ); +#endif +} + +void +BasicSurfaceEvaluator::enable( long ) +{ +#ifndef NDEBUG + _glu_dprintf( "enable\n" ); +#endif +} + +void +BasicSurfaceEvaluator::disable( long ) +{ +#ifndef NDEBUG + _glu_dprintf( "disable\n" ); +#endif +} + +void +BasicSurfaceEvaluator::bgnmap2f( long ) +{ +#ifndef NDEBUG + _glu_dprintf( "bgnmap2f\n" ); +#endif +} + +void +BasicSurfaceEvaluator::endmap2f( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "endmap2f\n" ); +#endif +} + +void +BasicSurfaceEvaluator::map2f( long, REAL, REAL, long, long, + REAL, REAL, long, long, + REAL * ) +{ +#ifndef NDEBUG + _glu_dprintf( "map2f\n" ); +#endif +} + +void +BasicSurfaceEvaluator::mapgrid2f( long, REAL, REAL, long, REAL, REAL ) +{ +#ifndef NDEBUG + _glu_dprintf( "mapgrid2f\n" ); +#endif +} + +void +BasicSurfaceEvaluator::mapmesh2f( long, long, long, long, long ) +{ +#ifndef NDEBUG + _glu_dprintf( "mapmesh2f\n" ); +#endif +} + +void +BasicSurfaceEvaluator::evalcoord2f( long, REAL, REAL ) +{ +#ifndef NDEBUG + _glu_dprintf( "evalcoord2f\n" ); +#endif +} + +void +BasicSurfaceEvaluator::evalpoint2i( long, long ) +{ +#ifndef NDEBUG + _glu_dprintf( "evalpoint2i\n" ); +#endif +} + +void +BasicSurfaceEvaluator::bgnline( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "bgnline\n" ); +#endif +} + +void +BasicSurfaceEvaluator::endline( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "endline\n" ); +#endif +} + +void +BasicSurfaceEvaluator::bgnclosedline( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "bgnclosedline\n" ); +#endif +} + +void +BasicSurfaceEvaluator::endclosedline( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "endclosedline\n" ); +#endif +} + +void +BasicSurfaceEvaluator::bgntfan( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "bgntfan\n" ); +#endif +} + +void +BasicSurfaceEvaluator::endtfan( void ) +{ +} + + +void +BasicSurfaceEvaluator::bgntmesh( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "bgntmesh\n" ); +#endif +} + +void +BasicSurfaceEvaluator::swaptmesh( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "swaptmesh\n" ); +#endif +} + +void +BasicSurfaceEvaluator::endtmesh( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "endtmesh\n" ); +#endif +} + +void +BasicSurfaceEvaluator::bgnqstrip( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "bgnqstrip\n" ); +#endif +} + +void +BasicSurfaceEvaluator::endqstrip( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "endqstrip\n" ); +#endif +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/basicsurfeval.h b/mesalib/src/glu/sgi/libnurbs/internals/basicsurfeval.h new file mode 100644 index 000000000..8fe18a67f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/basicsurfeval.h @@ -0,0 +1,90 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * basicsurfeval.h + * + */ + +#ifndef __glubasicsurfeval_h_ +#define __glubasicsurfeval_h_ + +#include "types.h" +#include "displaymode.h" +#include "cachingeval.h" + +class BasicSurfaceEvaluator : public CachingEvaluator { +public: + virtual ~BasicSurfaceEvaluator() { /* silence warning*/ } + virtual void range2f( long, REAL *, REAL * ); + virtual void domain2f( REAL, REAL, REAL, REAL ); + + virtual void enable( long ); + virtual void disable( long ); + virtual void bgnmap2f( long ); + virtual void map2f( long, REAL, REAL, long, long, + REAL, REAL, long, long, + REAL * ); + virtual void mapgrid2f( long, REAL, REAL, long, REAL, REAL ); + virtual void mapmesh2f( long, long, long, long, long ); + virtual void evalcoord2f( long, REAL, REAL ); + virtual void evalpoint2i( long, long ); + virtual void endmap2f( void ); + + virtual void polymode( long ); + virtual void bgnline( void ); + virtual void endline( void ); + virtual void bgnclosedline( void ); + virtual void endclosedline( void ); + virtual void bgntmesh( void ); + virtual void swaptmesh( void ); + virtual void endtmesh( void ); + virtual void bgnqstrip( void ); + virtual void endqstrip( void ); + + virtual void bgntfan( void ); + virtual void endtfan( void ); + + virtual void evalUStrip(int n_upper, REAL v_upper, REAL* upper_val, + int n_lower, REAL v_lower, REAL* lower_val + ) = 0; + + virtual void evalVStrip(int n_left, REAL u_left, REAL* left_val, + int n_right, REAL u_right, REAL* right_val + ) = 0; + virtual void inDoEvalCoord2NOGE(REAL u, REAL v, REAL* ret_point, REAL* ret_normal) = 0; + virtual void inDoEvalCoord2NOGE_BU(REAL u, REAL v, REAL* ret_point, REAL* ret_normal) = 0; + virtual void inDoEvalCoord2NOGE_BV(REAL u, REAL v, REAL* ret_point, REAL* ret_normal) = 0; + virtual void inPreEvaluateBV_intfac(REAL v ) = 0; + virtual void inPreEvaluateBU_intfac(REAL u ) = 0; + +}; + +#endif /* __glubasicsurfeval_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/bezierarc.h b/mesalib/src/glu/sgi/libnurbs/internals/bezierarc.h new file mode 100644 index 000000000..4acfb0948 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/bezierarc.h @@ -0,0 +1,51 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * bezierarc.h + * + */ + +#ifndef __glubezierarc_h +#define __glubezierarc_h + +#include "myassert.h" + +class Mapdesc; + +struct BezierArc : public PooledObj { /* a bezier arc */ + REAL * cpts; /* control points of arc */ + int order; /* order of arc */ + int stride; /* REAL distance between points */ + long type; /* curve type */ + Mapdesc * mapdesc; +}; + +#endif /* __glubezierarc_h */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/bin.cc b/mesalib/src/glu/sgi/libnurbs/internals/bin.cc new file mode 100644 index 000000000..54b406147 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/bin.cc @@ -0,0 +1,166 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * bin.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "bin.h" + +/*---------------------------------------------------------------------------- + * Constructor and destructor + *---------------------------------------------------------------------------- + */ +Bin::Bin() +{ + head = NULL; +} + +Bin::~Bin() +{ + assert( head == NULL); +} + +/*---------------------------------------------------------------------------- + * remove_this_arc - remove given Arc_ptr from bin + *---------------------------------------------------------------------------- + */ + +void +Bin::remove_this_arc( Arc_ptr arc ) +{ + Arc_ptr *j; + for( j = &(head); (*j != 0) && (*j != arc); j = &((*j)->link) ); + + if( *j != 0 ) { + if( *j == current ) + current = (*j)->link; + *j = (*j)->link; + } +} + +/*---------------------------------------------------------------------------- + * numarcs - count number of arcs in bin + *---------------------------------------------------------------------------- + */ + +int +Bin::numarcs() +{ + long count = 0; + for( Arc_ptr jarc = firstarc(); jarc; jarc = nextarc() ) + count++; + return count; +} + +/*---------------------------------------------------------------------------- + * adopt - place an orphaned arcs into their new parents bin + *---------------------------------------------------------------------------- + */ + +void +Bin::adopt() +{ + markall(); + + Arc_ptr orphan; + while( (orphan = removearc()) != NULL ) { + for( Arc_ptr parent = orphan->next; parent != orphan; parent = parent->next ) { + if (! parent->ismarked() ) { + orphan->link = parent->link; + parent->link = orphan; + orphan->clearmark(); + break; + } + } + } +} + + +/*---------------------------------------------------------------------------- + * show - print out descriptions of the arcs in the bin + *---------------------------------------------------------------------------- + */ + +void +Bin::show( char *name ) +{ +#ifndef NDEBUG + _glu_dprintf( "%s\n", name ); + for( Arc_ptr jarc = firstarc(); jarc; jarc = nextarc() ) + jarc->show( ); +#endif +} + + + +/*---------------------------------------------------------------------------- + * markall - mark all arcs with an identifying tag + *---------------------------------------------------------------------------- + */ + +void +Bin::markall() +{ + for( Arc_ptr jarc=firstarc(); jarc; jarc=nextarc() ) + jarc->setmark(); +} + +/*---------------------------------------------------------------------------- + * listBezier - print out all arcs that are untessellated border arcs + *---------------------------------------------------------------------------- + */ + +void +Bin::listBezier( void ) +{ + for( Arc_ptr jarc=firstarc(); jarc; jarc=nextarc() ) { + if( jarc->isbezier( ) ) { + assert( jarc->pwlArc->npts == 2 ); +#ifndef NDEBUG + TrimVertex *pts = jarc->pwlArc->pts; + REAL s1 = pts[0].param[0]; + REAL t1 = pts[0].param[1]; + REAL s2 = pts[1].param[0]; + REAL t2 = pts[1].param[1]; + _glu_dprintf( "arc (%g,%g) (%g,%g)\n", s1, t1, s2, t2 ); +#endif + } + } +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/bin.h b/mesalib/src/glu/sgi/libnurbs/internals/bin.h new file mode 100644 index 000000000..2f976eb9b --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/bin.h @@ -0,0 +1,121 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * bin.h + * + */ + +#ifndef __glubin_h_ +#define __glubin_h_ + +#include "myassert.h" +#include "arc.h" +#include "defines.h" + +class Bin +{ /* a linked list of jordan arcs */ +private: + Arc_ptr head;/*first arc on list */ + Arc_ptr current; /* current arc on list */ +public: + Bin(); + ~Bin(); + inline Arc_ptr firstarc( void ); + inline Arc_ptr nextarc( void ); + inline Arc_ptr removearc( void ); + inline int isnonempty( void ) { return (head ? 1 : 0); } + inline void addarc( Arc_ptr ); + void remove_this_arc( Arc_ptr ); + int numarcs( void ); + void adopt( void ); + void markall( void ); + void show( char * ); + void listBezier( void ); +}; + +/*---------------------------------------------------------------------------- + * Bin::addarc - add an Arc_ptr to head of linked list of Arc_ptr + *---------------------------------------------------------------------------- + */ + +inline void +Bin::addarc( Arc_ptr jarc ) +{ + jarc->link = head; + head = jarc; +} + +/*---------------------------------------------------------------------------- + * Bin::removearc - remove first Arc_ptr from bin + *---------------------------------------------------------------------------- + */ + +inline Arc_ptr +Bin::removearc( void ) +{ + Arc_ptr jarc = head; + + if( jarc ) head = jarc->link; + return jarc; +} + + +/*---------------------------------------------------------------------------- + * BinIter::nextarc - return current arc in bin and advance pointer to next arc + *---------------------------------------------------------------------------- + */ + +inline Arc_ptr +Bin::nextarc( void ) +{ + Arc_ptr jarc = current; + +#ifdef DEBUG + assert( jarc->check() != 0 ); +#endif + + if( jarc ) current = jarc->link; + return jarc; +} + +/*---------------------------------------------------------------------------- + * BinIter::firstarc - set current arc to first arc of bin advance to next arc + *---------------------------------------------------------------------------- + */ + +inline Arc_ptr +Bin::firstarc( void ) +{ + current = head; + return nextarc( ); +} + +#endif /* __glubin_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/bufpool.cc b/mesalib/src/glu/sgi/libnurbs/internals/bufpool.cc new file mode 100644 index 000000000..8cc847ab2 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/bufpool.cc @@ -0,0 +1,110 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * bufpool.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "bufpool.h" + + +/*----------------------------------------------------------------------------- + * Pool - allocate a new pool of buffers + *----------------------------------------------------------------------------- + */ +Pool::Pool( int _buffersize, int initpoolsize, const char *n ) +{ + if((unsigned)_buffersize < sizeof(Buffer)) + buffersize = sizeof(Buffer); + else + buffersize = _buffersize; + initsize = initpoolsize * buffersize; + nextsize = initsize; + name = n; + magic = is_allocated; + nextblock = 0; + curblock = 0; + freelist = 0; + nextfree = 0; +} + +/*----------------------------------------------------------------------------- + * ~Pool - free a pool of buffers and the pool itself + *----------------------------------------------------------------------------- + */ + +Pool::~Pool( void ) +{ + assert( (this != 0) && (magic == is_allocated) ); + + while( nextblock ) { + delete [] blocklist[--nextblock]; + blocklist[nextblock] = 0; + } + magic = is_free; +} + + +void Pool::grow( void ) +{ + assert( (this != 0) && (magic == is_allocated) ); + curblock = new char[nextsize]; + blocklist[nextblock++] = curblock; + nextfree = nextsize; + nextsize *= 2; +} + +/*----------------------------------------------------------------------------- + * Pool::clear - free buffers associated with pool but keep pool + *----------------------------------------------------------------------------- + */ + +void +Pool::clear( void ) +{ + assert( (this != 0) && (magic == is_allocated) ); + + while( nextblock ) { + delete [] blocklist[--nextblock]; + blocklist[nextblock] = 0; + } + curblock = 0; + freelist = 0; + nextfree = 0; + if( nextsize > initsize ) + nextsize /= 2; +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/bufpool.h b/mesalib/src/glu/sgi/libnurbs/internals/bufpool.h new file mode 100644 index 000000000..0fa943375 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/bufpool.h @@ -0,0 +1,141 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * bufpool.h + * + */ + +#ifndef __glubufpool_h_ +#define __glubufpool_h_ + +#include "gluos.h" +#include "myassert.h" +#include "mystdlib.h" + +#define NBLOCKS 32 + +class Buffer { + friend class Pool; + Buffer * next; /* next buffer on free list */ +}; + +class Pool { +public: + Pool( int, int, const char * ); + ~Pool( void ); + inline void* new_buffer( void ); + inline void free_buffer( void * ); + void clear( void ); + +private: + void grow( void ); + +protected: + Buffer *freelist; /* linked list of free buffers */ + char *blocklist[NBLOCKS]; /* blocks of malloced memory */ + int nextblock; /* next free block index */ + char *curblock; /* last malloced block */ + int buffersize; /* bytes per buffer */ + int nextsize; /* size of next block of memory */ + int nextfree; /* byte offset past next free buffer */ + int initsize; + enum Magic { is_allocated = 0xf3a1, is_free = 0xf1a2 }; + const char *name; /* name of the pool */ + Magic magic; /* marker for valid pool */ +}; + +/*----------------------------------------------------------------------------- + * Pool::free_buffer - return a buffer to a pool + *----------------------------------------------------------------------------- + */ + +inline void +Pool::free_buffer( void *b ) +{ + assert( (this != 0) && (magic == is_allocated) ); + + /* add buffer to singly connected free list */ + + ((Buffer *) b)->next = freelist; + freelist = (Buffer *) b; +} + + +/*----------------------------------------------------------------------------- + * Pool::new_buffer - allocate a buffer from a pool + *----------------------------------------------------------------------------- + */ + +inline void * +Pool::new_buffer( void ) +{ + void *buffer; + + assert( (this != 0) && (magic == is_allocated) ); + + /* find free buffer */ + + if( freelist ) { + buffer = (void *) freelist; + freelist = freelist->next; + } else { + if( ! nextfree ) + grow( ); + nextfree -= buffersize;; + buffer = (void *) (curblock + nextfree); + } + return buffer; +} + +class PooledObj { +public: + inline void * operator new( size_t, Pool & ); + inline void * operator new( size_t, void *); + inline void * operator new( size_t s) + { return ::new char[s]; } + inline void operator delete( void * ) { assert( 0 ); } + inline void operator delete( void *, Pool & ) { assert( 0 ); } + inline void deleteMe( Pool & ); +}; + +inline void * +PooledObj::operator new( size_t, Pool& pool ) +{ + return pool.new_buffer(); +} + +inline void +PooledObj::deleteMe( Pool& pool ) +{ + pool.free_buffer( (void *) this ); +} + +#endif /* __glubufpool_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/cachingeval.cc b/mesalib/src/glu/sgi/libnurbs/internals/cachingeval.cc new file mode 100644 index 000000000..3fab38c10 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/cachingeval.cc @@ -0,0 +1,78 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * cachingeval.c++ + * + */ + +#include "cachingeval.h" + +int +CachingEvaluator::canRecord( void ) +{ + return 0; +} + +int +CachingEvaluator::canPlayAndRecord( void ) +{ + return 0; +} + +int +CachingEvaluator::createHandle( int ) +{ + return 0; +} + +void +CachingEvaluator::beginOutput( ServiceMode, int ) +{ +} + +void +CachingEvaluator::endOutput( void ) +{ +} + +void +CachingEvaluator::discardRecording( int ) +{ +} + +void +CachingEvaluator::playRecording( int ) +{ +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/cachingeval.h b/mesalib/src/glu/sgi/libnurbs/internals/cachingeval.h new file mode 100644 index 000000000..b390067a2 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/cachingeval.h @@ -0,0 +1,51 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * cachingeval.h + * + */ + +#ifndef __glucachingval_h_ +#define __glucachingval_h_ + +class CachingEvaluator { +public: + virtual ~CachingEvaluator() { /* silence warning*/ } + enum ServiceMode { play, record, playAndRecord }; + virtual int canRecord( void ); + virtual int canPlayAndRecord( void ); + virtual int createHandle( int handle ); + virtual void beginOutput( ServiceMode, int handle ); + virtual void endOutput( void ); + virtual void discardRecording( int handle ); + virtual void playRecording( int handle ); +}; +#endif /* __glucachingval_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/ccw.cc b/mesalib/src/glu/sgi/libnurbs/internals/ccw.cc new file mode 100644 index 000000000..eb01b7781 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/ccw.cc @@ -0,0 +1,565 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * ccw.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "subdivider.h" +#include "types.h" +#include "arc.h" +#include "trimvertex.h" +#include "simplemath.h" + +inline int +Subdivider::bbox( TrimVertex *a, TrimVertex *b, TrimVertex *c, int p ) +{ + return bbox( a->param[p], b->param[p], c->param[p], + a->param[1-p], b->param[1-p], c->param[1-p] ); +} + +int +Subdivider::ccwTurn_sr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1 +{ + register TrimVertex *v1 = &j1->pwlArc->pts[j1->pwlArc->npts-1]; + register TrimVertex *v1last = &j1->pwlArc->pts[0]; + register TrimVertex *v2 = &j2->pwlArc->pts[0]; + register TrimVertex *v2last = &j2->pwlArc->pts[j2->pwlArc->npts-1]; + register TrimVertex *v1next = v1-1; + register TrimVertex *v2next = v2+1; + int sgn; + + assert( v1 != v1last ); + assert( v2 != v2last ); + +#ifndef NDEBUG + _glu_dprintf( "arc_ccw_turn, p = %d\n", 0 ); +#endif + + // the arcs lie on the line (0 == v1->param[0]) + if( v1->param[0] == v1next->param[0] && v2->param[0] == v2next->param[0] ) + return 0; + + if( v2next->param[0] < v2->param[0] || v1next->param[0] < v1->param[0] ) + ::mylongjmp( jumpbuffer, 28 ); + + if( v1->param[1] < v2->param[1] ) + return 0; + else if( v1->param[1] > v2->param[1] ) + return 1; + + while( 1 ) { + if( v1next->param[0] < v2next->param[0] ) { +#ifndef NDEBUG + _glu_dprintf( "case a\n" ); +#endif + assert( v1->param[0] <= v1next->param[0] ); + assert( v2->param[0] <= v1next->param[0] ); + switch( bbox( v2, v2next, v1next, 1 ) ) { + case -1: + return 0; + case 0: + sgn = ccw( v1next, v2, v2next ); + if( sgn != -1 ) { + return sgn; + } else { +#ifdef DEBUG + _glu_dprintf( "decr\n" ); +#endif + v1 = v1next--; + if( v1 == v1last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 1; + } + } else if( v1next->param[0] > v2next->param[0] ) { +#ifndef NDEBUG + _glu_dprintf( "case b\n" ); +#endif + assert( v1->param[0] <= v2next->param[0] ); + assert( v2->param[0] <= v2next->param[0] ); + switch( bbox( v1, v1next, v2next, 1 ) ) { + case -1: + return 1; + case 0: + sgn = ccw( v1next, v1, v2next ); + if( sgn != -1 ) { + return sgn; + } else { +#ifdef DEBUG + _glu_dprintf( "incr\n" ); +#endif + v2 = v2next++; + if( v2 == v2last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 0; + } + } else { +#ifndef NDEBUG + _glu_dprintf( "case ab\n" ); +#endif + if( v1next->param[1] < v2next->param[1] ) + return 0; + else if( v1next->param[1] > v2next->param[1] ) + return 1; + else { +#ifdef DEBUG + _glu_dprintf( "incr\n" ); +#endif + v2 = v2next++; + if( v2 == v2last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + } + } +} + +int +Subdivider::ccwTurn_sl( Arc_ptr j1, Arc_ptr j2 ) // dir = 0 +{ + register TrimVertex *v1 = &j1->pwlArc->pts[j1->pwlArc->npts-1]; + register TrimVertex *v1last = &j1->pwlArc->pts[0]; + register TrimVertex *v2 = &j2->pwlArc->pts[0]; + register TrimVertex *v2last = &j2->pwlArc->pts[j2->pwlArc->npts-1]; + register TrimVertex *v1next = v1-1; + register TrimVertex *v2next = v2+1; + int sgn; + + assert( v1 != v1last ); + assert( v2 != v2last ); + +#ifndef NDEBUG + _glu_dprintf( "arc_ccw_turn, p = %d\n", 0 ); +#endif + + // the arcs lie on the line (0 == v1->param[0]) + if( v1->param[0] == v1next->param[0] && v2->param[0] == v2next->param[0] ) + return 0; + + if( v2next->param[0] > v2->param[0] || v1next->param[0] > v1->param[0] ) + ::mylongjmp( jumpbuffer, 28 ); + + if( v1->param[1] < v2->param[1] ) + return 1; + else if( v1->param[1] > v2->param[1] ) + return 0; + + while( 1 ) { + if( v1next->param[0] > v2next->param[0] ) { +#ifndef NDEBUG + _glu_dprintf( "case c\n" ); +#endif + assert( v1->param[0] >= v1next->param[0] ); + assert( v2->param[0] >= v1next->param[0] ); + switch( bbox( v2next, v2, v1next, 1 ) ) { + case -1: + return 1; + case 0: + sgn = ccw( v1next, v2, v2next ); + if( sgn != -1 ) + return sgn; + else { + v1 = v1next--; +#ifdef DEBUG + _glu_dprintf( "decr\n" ); +#endif + if( v1 == v1last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 0; + } + } else if( v1next->param[0] < v2next->param[0] ) { +#ifndef NDEBUG + _glu_dprintf( "case d\n" ); +#endif + assert( v1->param[0] >= v2next->param[0] ); + assert( v2->param[0] >= v2next->param[0] ); + switch( bbox( v1next, v1, v2next, 1 ) ) { + case -1: + return 0; + case 0: + sgn = ccw( v1next, v1, v2next ); + if( sgn != -1 ) + return sgn; + else { + v2 = v2next++; +#ifdef DEBUG + _glu_dprintf( "incr\n" ); +#endif + if( v2 == v2last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 1; + } + } else { +#ifdef DEBUG + _glu_dprintf( "case cd\n" ); +#endif + if( v1next->param[1] < v2next->param[1] ) + return 1; + else if( v1next->param[1] > v2next->param[1] ) + return 0; + else { + v2 = v2next++; +#ifdef DEBUG + _glu_dprintf( "incr\n" ); +#endif + if( v2 == v2last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + } + } +} + +int +Subdivider::ccwTurn_tr( Arc_ptr j1, Arc_ptr j2 ) // dir = 1 +{ + register TrimVertex *v1 = &j1->pwlArc->pts[j1->pwlArc->npts-1]; + register TrimVertex *v1last = &j1->pwlArc->pts[0]; + register TrimVertex *v2 = &j2->pwlArc->pts[0]; + register TrimVertex *v2last = &j2->pwlArc->pts[j2->pwlArc->npts-1]; + register TrimVertex *v1next = v1-1; + register TrimVertex *v2next = v2+1; + int sgn; + + assert( v1 != v1last ); + assert( v2 != v2last ); + +#ifndef NDEBUG + _glu_dprintf( "arc_ccw_turn, p = %d\n", 1 ); +#endif + + // the arcs lie on the line (1 == v1->param[1]) + if( v1->param[1] == v1next->param[1] && v2->param[1] == v2next->param[1] ) + return 0; + + if( v2next->param[1] < v2->param[1] || v1next->param[1] < v1->param[1] ) + ::mylongjmp( jumpbuffer, 28 ); + + if( v1->param[0] < v2->param[0] ) + return 1; + else if( v1->param[0] > v2->param[0] ) + return 0; + + while( 1 ) { + if( v1next->param[1] < v2next->param[1] ) { +#ifndef NDEBUG + _glu_dprintf( "case a\n" ); +#endif + assert( v1->param[1] <= v1next->param[1] ); + assert( v2->param[1] <= v1next->param[1] ); + switch( bbox( v2, v2next, v1next, 0 ) ) { + case -1: + return 1; + case 0: + sgn = ccw( v1next, v2, v2next ); + if( sgn != -1 ) { + return sgn; + } else { +#ifdef DEBUG + _glu_dprintf( "decr\n" ); +#endif + v1 = v1next--; + if( v1 == v1last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 0; + } + } else if( v1next->param[1] > v2next->param[1] ) { +#ifndef NDEBUG + _glu_dprintf( "case b\n" ); +#endif + assert( v1->param[1] <= v2next->param[1] ); + assert( v2->param[1] <= v2next->param[1] ); + switch( bbox( v1, v1next, v2next, 0 ) ) { + case -1: + return 0; + case 0: + sgn = ccw( v1next, v1, v2next ); + if( sgn != -1 ) { + return sgn; + } else { +#ifdef DEBUG + _glu_dprintf( "incr\n" ); +#endif + v2 = v2next++; + if( v2 == v2last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 1; + } + } else { +#ifdef DEBUG + _glu_dprintf( "case ab\n" ); +#endif + if( v1next->param[0] < v2next->param[0] ) + return 1; + else if( v1next->param[0] > v2next->param[0] ) + return 0; + else { +#ifdef DEBUG + _glu_dprintf( "incr\n" ); +#endif + v2 = v2next++; + if( v2 == v2last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + } + } +} + +int +Subdivider::ccwTurn_tl( Arc_ptr j1, Arc_ptr j2 ) +{ + register TrimVertex *v1 = &j1->pwlArc->pts[j1->pwlArc->npts-1]; + register TrimVertex *v1last = &j1->pwlArc->pts[0]; + register TrimVertex *v2 = &j2->pwlArc->pts[0]; + register TrimVertex *v2last = &j2->pwlArc->pts[j2->pwlArc->npts-1]; + register TrimVertex *v1next = v1-1; + register TrimVertex *v2next = v2+1; + int sgn; + + assert( v1 != v1last ); + assert( v2 != v2last ); + +#ifndef NDEBUG + _glu_dprintf( "arc_ccw_turn, p = %d\n", 1 ); +#endif + + // the arcs lie on the line (1 == v1->param[1]) + if( v1->param[1] == v1next->param[1] && v2->param[1] == v2next->param[1] ) + return 0; + + if( v2next->param[1] > v2->param[1] || v1next->param[1] > v1->param[1] ) + ::mylongjmp( jumpbuffer, 28 ); + + if( v1->param[0] < v2->param[0] ) + return 0; + else if( v1->param[0] > v2->param[0] ) + return 1; + + while( 1 ) { + if( v1next->param[1] > v2next->param[1] ) { +#ifndef NDEBUG + _glu_dprintf( "case c\n" ); +#endif + assert( v1->param[1] >= v1next->param[1] ); + assert( v2->param[1] >= v1next->param[1] ); + switch( bbox( v2next, v2, v1next, 0 ) ) { + case -1: + return 0; + case 0: + sgn = ccw( v1next, v2, v2next ); + if( sgn != -1 ) + return sgn; + else { + v1 = v1next--; +#ifdef DEBUG + _glu_dprintf( "decr\n" ); +#endif + if( v1 == v1last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 1; + } + } else if( v1next->param[1] < v2next->param[1] ) { +#ifndef NDEBUG + _glu_dprintf( "case d\n" ); + assert( v1->param[1] >= v2next->param[1] ); + assert( v2->param[1] >= v2next->param[1] ); +#endif + switch( bbox( v1next, v1, v2next, 0 ) ) { + case -1: + return 1; + case 0: + sgn = ccw( v1next, v1, v2next ); + if( sgn != -1 ) + return sgn; + else { + v2 = v2next++; +#ifdef DEBUG + _glu_dprintf( "incr\n" ); +#endif + if( v2 == v2last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + break; + case 1: + return 0; + } + } else { +#ifdef DEBUG + _glu_dprintf( "case cd\n" ); +#endif + if( v1next->param[0] < v2next->param[0] ) + return 0; + else if( v1next->param[0] > v2next->param[0] ) + return 1; + else { + v2 = v2next++; +#ifdef DEBUG + _glu_dprintf( "incr\n" ); +#endif + if( v2 == v2last ) { +#ifdef DEBUG + _glu_dprintf( "no good results\n" ); +#endif + return 0; // ill-conditioned, guess answer + } + } + } + } +} + + +#ifndef NDEBUG +int +Subdivider::bbox( register REAL sa, register REAL sb, register REAL sc, + register REAL ta, register REAL tb, register REAL tc ) +#else +int +Subdivider::bbox( register REAL sa, register REAL sb, register REAL sc, + register REAL , register REAL , register REAL ) +#endif +{ +#ifndef NDEBUG + assert( tc >= ta ); + assert( tc <= tb ); +#endif + + if( sa < sb ) { + if( sc <= sa ) { + return -1; + } else if( sb <= sc ) { + return 1; + } else { + return 0; + } + } else if( sa > sb ) { + if( sc >= sa ) { + return 1; + } else if( sb >= sc ) { + return -1; + } else { + return 0; + } + } else { + if( sc > sa ) { + return 1; + } else if( sb > sc ) { + return -1; + } else { + return 0; + } + } +} + +/*---------------------------------------------------------------------------- + * ccw - determine how three points are oriented by computing their + * determinant. + * Return 1 if the vertices are ccw oriented, + * 0 if they are cw oriented, or + * -1 if the computation is ill-conditioned. + *---------------------------------------------------------------------------- + */ +int +Subdivider::ccw( TrimVertex *a, TrimVertex *b, TrimVertex *c ) +{ + REAL d = det3( a, b, c ); + if( glu_abs(d) < 0.0001 ) return -1; + return (d < 0.0) ? 0 : 1; +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/coveandtiler.cc b/mesalib/src/glu/sgi/libnurbs/internals/coveandtiler.cc new file mode 100644 index 000000000..ca5bf36b3 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/coveandtiler.cc @@ -0,0 +1,440 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * coveandtiler.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "coveandtiler.h" +#include "gridvertex.h" +#include "gridtrimvertex.h" +#include "uarray.h" +#include "backend.h" + + +const int CoveAndTiler::MAXSTRIPSIZE = 1000; + +CoveAndTiler::CoveAndTiler( Backend& b ) + : backend( b ) +{ } + +CoveAndTiler::~CoveAndTiler( void ) +{ } + +inline void +CoveAndTiler::output( GridVertex &gv ) +{ + backend.tmeshvert( &gv ); +} + +inline void +CoveAndTiler::output( TrimVertex *tv ) +{ + backend.tmeshvert( tv ); +} + +inline void +CoveAndTiler::output( GridTrimVertex& g ) +{ + backend.tmeshvert( &g ); +} + +void +CoveAndTiler::coveAndTile( void ) +{ + long ustart = (top.ustart >= bot.ustart) ? top.ustart : bot.ustart; + long uend = (top.uend <= bot.uend) ? top.uend : bot.uend; + if( ustart <= uend ) { + tile( bot.vindex, ustart, uend ); + if( top.ustart >= bot.ustart ) + coveUpperLeft(); + else + coveLowerLeft(); + + if( top.uend <= bot.uend ) + coveUpperRight(); + else + coveLowerRight(); + } else { + TrimVertex blv, tlv, *bl, *tl; + GridTrimVertex bllv, tllv; + TrimVertex *lf = left.first(); + TrimVertex *ll = left.last(); + if( lf->param[0] >= ll->param[0] ) { + blv.param[0] = lf->param[0]; + blv.param[1] = ll->param[1]; + blv.nuid = 0; // XXX + assert( blv.param[1] == bot.vval ); + bl = &blv; + tl = lf; + tllv.set( lf ); + if( ll->param[0] > uarray.uarray[top.ustart-1] ) { + bllv.set( ll ); + assert( ll->param[0] <= uarray.uarray[bot.ustart] ); + } else { + bllv.set( top.ustart-1, bot.vindex ); + } + coveUpperLeftNoGrid( bl ); + } else { + tlv.param[0] = ll->param[0]; + tlv.param[1] = lf->param[1]; + tlv.nuid = 0; // XXX + assert( tlv.param[1] == top.vval ); + tl = &tlv; + bl = ll; + bllv.set( ll ); + if( lf->param[0] > uarray.uarray[bot.ustart-1] ) { + assert( lf->param[0] <= uarray.uarray[bot.ustart] ); + tllv.set( lf ); + } else { + tllv.set( bot.ustart-1, top.vindex ); + } + coveLowerLeftNoGrid( tl ); + } + + TrimVertex brv, trv, *br, *tr; + GridTrimVertex brrv, trrv; + TrimVertex *rf = right.first(); + TrimVertex *rl = right.last(); + + if( rf->param[0] <= rl->param[0] ) { + brv.param[0] = rf->param[0]; + brv.param[1] = rl->param[1]; + brv.nuid = 0; // XXX + assert( brv.param[1] == bot.vval ); + br = &brv; + tr = rf; + trrv.set( rf ); + if( rl->param[0] < uarray.uarray[top.uend+1] ) { + assert( rl->param[0] >= uarray.uarray[top.uend] ); + brrv.set( rl ); + } else { + brrv.set( top.uend+1, bot.vindex ); + } + coveUpperRightNoGrid( br ); + } else { + trv.param[0] = rl->param[0]; + trv.param[1] = rf->param[1]; + trv.nuid = 0; // XXX + assert( trv.param[1] == top.vval ); + tr = &trv; + br = rl; + brrv.set( rl ); + if( rf->param[0] < uarray.uarray[bot.uend+1] ) { + assert( rf->param[0] >= uarray.uarray[bot.uend] ); + trrv.set( rf ); + } else { + trrv.set( bot.uend+1, top.vindex ); + } + coveLowerRightNoGrid( tr ); + } + + backend.bgntmesh( "doit" ); + output(trrv); + output(tllv); + output( tr ); + output( tl ); + output( br ); + output( bl ); + output(brrv); + output(bllv); + backend.endtmesh(); + } +} + +void +CoveAndTiler::tile( long vindex, long ustart, long uend ) +{ + long numsteps = uend - ustart; + + if( numsteps == 0 ) return; + + if( numsteps > MAXSTRIPSIZE ) { + long umid = ustart + (uend - ustart) / 2; + tile( vindex, ustart, umid ); + tile( vindex, umid, uend ); + } else { + backend.surfmesh( ustart, vindex-1, numsteps, 1 ); + } +} + +void +CoveAndTiler::coveUpperRight( void ) +{ + GridVertex tgv( top.uend, top.vindex ); + GridVertex gv( top.uend, bot.vindex ); + + right.first(); + backend.bgntmesh( "coveUpperRight" ); + output( right.next() ); + output( tgv ); + backend.swaptmesh(); + output( gv ); + coveUR(); + backend.endtmesh(); +} + +void +CoveAndTiler::coveUpperRightNoGrid( TrimVertex* br ) +{ + backend.bgntmesh( "coveUpperRight" ); + output( right.first() ); + output( right.next() ); + backend.swaptmesh(); + output( br ); + coveUR(); + backend.endtmesh(); +} + +void +CoveAndTiler::coveUR( ) +{ + GridVertex gv( top.uend, bot.vindex ); + TrimVertex *vert = right.next(); + if( vert == NULL ) return; + + assert( vert->param[0] >= uarray.uarray[gv.gparam[0]] ); + + if( gv.nextu() >= bot.uend ) { + for( ; vert; vert = right.next() ) { + output( vert ); + backend.swaptmesh(); + } + } else while( 1 ) { + if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { + output( vert ); + backend.swaptmesh(); + vert = right.next(); + if( vert == NULL ) break; + } else { + backend.swaptmesh(); + output( gv ); + if( gv.nextu() == bot.uend ) { + for( ; vert; vert = right.next() ) { + output( vert ); + backend.swaptmesh(); + } + break; + } + } + } +} + +void +CoveAndTiler::coveUpperLeft( void ) +{ + GridVertex tgv( top.ustart, top.vindex ); + GridVertex gv( top.ustart, bot.vindex ); + + left.first(); + backend.bgntmesh( "coveUpperLeft" ); + output( tgv ); + output( left.next() ); + output( gv ); + backend.swaptmesh(); + coveUL(); + backend.endtmesh(); +} + +void +CoveAndTiler::coveUpperLeftNoGrid( TrimVertex* bl ) +{ + backend.bgntmesh( "coveUpperLeftNoGrid" ); + output( left.first() ); + output( left.next() ); + output( bl ); + backend.swaptmesh(); + coveUL(); + backend.endtmesh(); +} + +void +CoveAndTiler::coveUL() +{ + GridVertex gv( top.ustart, bot.vindex ); + TrimVertex *vert = left.next(); + if( vert == NULL ) return; + assert( vert->param[0] <= uarray.uarray[gv.gparam[0]] ); + + if( gv.prevu() <= bot.ustart ) { + for( ; vert; vert = left.next() ) { + backend.swaptmesh(); + output( vert ); + } + } else while( 1 ) { + if( vert->param[0] > uarray.uarray[gv.gparam[0]] ) { + backend.swaptmesh(); + output( vert ); + vert = left.next(); + if( vert == NULL ) break; + } else { + output( gv ); + backend.swaptmesh(); + if( gv.prevu() == bot.ustart ) { + for( ; vert; vert = left.next() ) { + backend.swaptmesh(); + output( vert ); + } + break; + } + } + } +} + +void +CoveAndTiler::coveLowerLeft( void ) +{ + GridVertex bgv( bot.ustart, bot.vindex ); + GridVertex gv( bot.ustart, top.vindex ); + + left.last(); + backend.bgntmesh( "coveLowerLeft" ); + output( left.prev() ); + output( bgv ); + backend.swaptmesh(); + output( gv ); + coveLL(); + backend.endtmesh(); +} + +void +CoveAndTiler::coveLowerLeftNoGrid( TrimVertex* tl ) +{ + backend.bgntmesh( "coveLowerLeft" ); + output( left.last() ); + output( left.prev() ); + backend.swaptmesh(); + output( tl ); + coveLL( ); + backend.endtmesh(); +} + +void +CoveAndTiler::coveLL() +{ + GridVertex gv( bot.ustart, top.vindex ); + TrimVertex *vert = left.prev(); + if( vert == NULL ) return; + assert( vert->param[0] <= uarray.uarray[gv.gparam[0]] ); + + if( gv.prevu() <= top.ustart ) { + for( ; vert; vert = left.prev() ) { + output( vert ); + backend.swaptmesh(); + } + } else while( 1 ) { + if( vert->param[0] > uarray.uarray[gv.gparam[0]] ){ + output( vert ); + backend.swaptmesh(); + vert = left.prev(); + if( vert == NULL ) break; + } else { + backend.swaptmesh(); + output( gv ); + if( gv.prevu() == top.ustart ) { + for( ; vert; vert = left.prev() ) { + output( vert ); + backend.swaptmesh(); + } + break; + } + } + } +} + +void +CoveAndTiler::coveLowerRight( void ) +{ + GridVertex bgv( bot.uend, bot.vindex ); + GridVertex gv( bot.uend, top.vindex ); + + right.last(); + backend.bgntmesh( "coveLowerRight" ); + output( bgv ); + output( right.prev() ); + output( gv ); + backend.swaptmesh(); + coveLR(); + backend.endtmesh( ); +} + +void +CoveAndTiler::coveLowerRightNoGrid( TrimVertex* tr ) +{ + backend.bgntmesh( "coveLowerRIght" ); + output( right.last() ); + output( right.prev() ); + output( tr ); + backend.swaptmesh(); + coveLR(); + backend.endtmesh(); +} + +void +CoveAndTiler::coveLR( ) +{ + GridVertex gv( bot.uend, top.vindex ); + TrimVertex *vert = right.prev(); + if( vert == NULL ) return; + assert( vert->param[0] >= uarray.uarray[gv.gparam[0]] ); + + if( gv.nextu() >= top.uend ) { + for( ; vert; vert = right.prev() ) { + backend.swaptmesh(); + output( vert ); + } + } else while( 1 ) { + if( vert->param[0] < uarray.uarray[gv.gparam[0]] ) { + backend.swaptmesh(); + output( vert ); + vert = right.prev(); + if( vert == NULL ) break; + } else { + output( gv ); + backend.swaptmesh(); + if( gv.nextu() == top.uend ) { + for( ; vert; vert = right.prev() ) { + backend.swaptmesh(); + output( vert ); + } + break; + } + } + } +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/coveandtiler.h b/mesalib/src/glu/sgi/libnurbs/internals/coveandtiler.h new file mode 100644 index 000000000..d454202e6 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/coveandtiler.h @@ -0,0 +1,72 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * coveandtiler.h + * + */ + +#ifndef __glucoveandtiler_h +#define __glucoveandtiler_h + +#include "trimregion.h" +#include "trimvertex.h" +#include "gridvertex.h" + +class Backend; +class GridTrimVertex; + +class CoveAndTiler : virtual public TrimRegion { +public: + CoveAndTiler( Backend& ); + ~CoveAndTiler( void ); + void coveAndTile( void ); +private: + Backend& backend; + static const int MAXSTRIPSIZE; + void tile( long, long, long ); + void coveLowerLeft( void ); + void coveLowerRight( void ); + void coveUpperLeft( void ); + void coveUpperRight( void ); + void coveUpperLeftNoGrid( TrimVertex * ); + void coveUpperRightNoGrid( TrimVertex * ); + void coveLowerLeftNoGrid( TrimVertex * ); + void coveLowerRightNoGrid( TrimVertex * ); + void coveLL( void ); + void coveLR( void ); + void coveUL( void ); + void coveUR( void ); + inline void output( GridTrimVertex& ); + inline void output( GridVertex& ); + inline void output( TrimVertex* ); +}; + +#endif /* __glucoveandtiler_h */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/curve.cc b/mesalib/src/glu/sgi/libnurbs/internals/curve.cc new file mode 100644 index 000000000..33e275264 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/curve.cc @@ -0,0 +1,198 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * curve.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "mymath.h" +#include "curve.h" +#include "mapdesc.h" +#include "types.h" +#include "quilt.h" +#include "nurbsconsts.h" + +/*-------------------------------------------------------------------------- + * Curve::Curve - copy curve from quilt and transform control points + *-------------------------------------------------------------------------- + */ + +Curve::Curve( Quilt_ptr geo, REAL pta, REAL ptb, Curve *c ) +{ + mapdesc = geo->mapdesc; + next = c; + needsSampling = mapdesc->isRangeSampling() ? 1 : 0; + cullval = mapdesc->isCulling() ? CULL_ACCEPT : CULL_TRIVIAL_ACCEPT; + order = geo->qspec[0].order; + stride = MAXCOORDS; + + REAL *ps = geo->cpts; + Quiltspec_ptr qs = geo->qspec; + ps += qs->offset; + ps += qs->index * qs->order * qs->stride; + + if( needsSampling ) + mapdesc->xformSampling( ps, qs->order, qs->stride, spts, stride ); + + if( cullval == CULL_ACCEPT ) + mapdesc->xformCulling( ps, qs->order, qs->stride, cpts, stride ); + + /* set untrimmed curve range */ + range[0] = qs->breakpoints[qs->index]; + range[1] = qs->breakpoints[qs->index+1]; + range[2] = range[1] - range[0]; + + if( range[0] != pta ) { + Curve lower( *this, pta, 0 ); + lower.next = next; + *this = lower; + } + if( range[1] != ptb ) { + Curve lower( *this, ptb, 0 ); + } +} + +/*-------------------------------------------------------------------------- + * Curve::Curve - subdivide a curve along an isoparametric line + *-------------------------------------------------------------------------- + */ + +Curve::Curve( Curve& upper, REAL value, Curve *c ) +{ + Curve &lower = *this; + + lower.next = c; + lower.mapdesc = upper.mapdesc; + lower.needsSampling = upper.needsSampling; + lower.order = upper.order; + lower.stride = upper.stride; + lower.cullval = upper.cullval; + + REAL d = (value - upper.range[0]) / upper.range[2]; + + if( needsSampling ) + mapdesc->subdivide( upper.spts, lower.spts, d, upper.stride, upper.order ); + + if( cullval == CULL_ACCEPT ) + mapdesc->subdivide( upper.cpts, lower.cpts, d, upper.stride, upper.order ); + + lower.range[0] = upper.range[0]; + lower.range[1] = value; + lower.range[2] = value - upper.range[0]; + upper.range[0] = value; + upper.range[2] = upper.range[1] - value; +} + + +/*-------------------------------------------------------------------------- + * Curve::clamp - clamp the sampling rate to a given maximum + *-------------------------------------------------------------------------- + */ + +void +Curve::clamp( void ) +{ + if( stepsize < minstepsize ) + stepsize = mapdesc->clampfactor * minstepsize; +} + +void +Curve::setstepsize( REAL max ) +{ + stepsize = ( max >= 1.0 ) ? (range[2] / max) : range[2]; + minstepsize = stepsize; +} + +void +Curve::getstepsize( void ) +{ + minstepsize= 0; + + if( mapdesc->isConstantSampling() ) { + // fixed number of samples per patch in each direction + // maxrate is number of s samples per patch + setstepsize( mapdesc->maxrate ); + } else if( mapdesc->isDomainSampling() ) { + // maxrate is number of s samples per unit s length of domain + setstepsize( mapdesc->maxrate * range[2] ); + } else { + // upper bound on path length between sample points + + assert( order <= MAXORDER ); + + /* points have been transformed, therefore they are homogeneous */ + REAL tmp[MAXORDER][MAXCOORDS]; + const int tstride = sizeof(tmp[0]) / sizeof(REAL); + int val = mapdesc->project( spts, stride, &tmp[0][0], tstride, order ); + + if( val == 0 ) { + // control points cross infinity, therefore derivatives are undefined + setstepsize( mapdesc->maxrate ); + } else { + REAL t = mapdesc->getProperty( N_PIXEL_TOLERANCE ); + if( mapdesc->isParametricDistanceSampling() ) { + REAL d = mapdesc->calcPartialVelocity( &tmp[0][0], tstride, order, 2, range[2] ); + stepsize = (d > 0.0) ? sqrtf( 8.0 * t / d ) : range[2]; + minstepsize = ( mapdesc->maxrate > 0.0 ) ? (range[2] / mapdesc->maxrate) : 0.0; + } else if( mapdesc->isPathLengthSampling() ) { + // t is upper bound on path (arc) length + REAL d = mapdesc->calcPartialVelocity( &tmp[0][0], tstride, order, 1, range[2] ); + stepsize = ( d > 0.0 ) ? (t / d) : range[2]; + minstepsize = ( mapdesc->maxrate > 0.0 ) ? (range[2] / mapdesc->maxrate) : 0.0; + } else { + // control points cross infinity, therefore partials are undefined + setstepsize( mapdesc->maxrate ); + } + } + } +} + +int +Curve::needsSamplingSubdivision( void ) +{ + return ( stepsize < minstepsize ) ? 1 : 0; +} + +int +Curve::cullCheck( void ) +{ + if( cullval == CULL_ACCEPT ) + cullval = mapdesc->cullCheck( cpts, order, stride ); + return cullval; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/curve.h b/mesalib/src/glu/sgi/libnurbs/internals/curve.h new file mode 100644 index 000000000..0da81c721 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/curve.h @@ -0,0 +1,70 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * curve.h + * + */ + +#ifndef __glucurve_h_ +#define __glucurve_h_ + +#include "types.h" +#include "defines.h" + +class Mapdesc; +class Quilt; + + +class Curve { +public: +friend class Curvelist; + Curve( Quilt *, REAL, REAL, Curve * ); + Curve( Curve&, REAL, Curve * ); + Curve * next; +private: + Mapdesc * mapdesc; + int stride; + int order; + int cullval; + int needsSampling; + REAL cpts[MAXORDER*MAXCOORDS]; + REAL spts[MAXORDER*MAXCOORDS]; + REAL stepsize; + REAL minstepsize; + REAL range[3]; + + void clamp( void ); + void setstepsize( REAL ); + void getstepsize( void ); + int cullCheck( void ); + int needsSamplingSubdivision( void ); +}; +#endif /* __glucurve_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/curvelist.cc b/mesalib/src/glu/sgi/libnurbs/internals/curvelist.cc new file mode 100644 index 000000000..872eb5816 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/curvelist.cc @@ -0,0 +1,110 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * curvelist.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "quilt.h" +#include "curvelist.h" +#include "curve.h" +#include "nurbsconsts.h" +#include "types.h" + +Curvelist::Curvelist( Quilt *quilts, REAL pta, REAL ptb ) +{ + curve = 0; + for( Quilt *q = quilts; q; q = q->next ) + curve = new Curve( q, pta, ptb, curve ); + range[0] = pta; + range[1] = ptb; + range[2] = ptb - pta; +} + +Curvelist::Curvelist( Curvelist &upper, REAL value ) +{ + Curvelist &lower = *this; + curve = 0; + for( Curve *c = upper.curve; c; c = c->next ) + curve = new Curve( *c, value, curve ); + + lower.range[0] = upper.range[0]; + lower.range[1] = value; + lower.range[2] = value - upper.range[0]; + upper.range[0] = value; + upper.range[2] = upper.range[1] - value; +} + +Curvelist::~Curvelist() +{ + while( curve ) { + Curve *c = curve; + curve = curve->next; + delete c; + } +} + +int +Curvelist::cullCheck( void ) +{ + for( Curve *c = curve; c; c = c->next ) + if( c->cullCheck() == CULL_TRIVIAL_REJECT ) + return CULL_TRIVIAL_REJECT; + return CULL_ACCEPT; +} + +void +Curvelist::getstepsize( void ) +{ + stepsize = range[2]; + Curve *c; + for( c = curve; c; c = c->next ) { + c->getstepsize(); + c->clamp(); + stepsize = ((c->stepsize < stepsize) ? c->stepsize : stepsize); + if( c->needsSamplingSubdivision() ) break; + } + needsSubdivision = ( c ) ? 1 : 0; +} + +int +Curvelist::needsSamplingSubdivision( void ) +{ + return needsSubdivision; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/curvelist.h b/mesalib/src/glu/sgi/libnurbs/internals/curvelist.h new file mode 100644 index 000000000..733a5115d --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/curvelist.h @@ -0,0 +1,62 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * curvelist.h + * + */ + +#ifndef __glucurvelist_h_ +#define __glucurvelist_h_ + +#include "types.h" +#include "defines.h" + +class Mapdesc; +class Quilt; +class Curve; + +class Curvelist +{ +friend class Subdivider; +public: + Curvelist( Quilt *, REAL, REAL ); + Curvelist( Curvelist &, REAL ); + ~Curvelist( void ); + int cullCheck( void ); + void getstepsize( void ); + int needsSamplingSubdivision(); +private: + Curve *curve; + float range[3]; + int needsSubdivision; + float stepsize; +}; +#endif /* __glucurvelist_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/curvesub.cc b/mesalib/src/glu/sgi/libnurbs/internals/curvesub.cc new file mode 100644 index 000000000..f85acc269 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/curvesub.cc @@ -0,0 +1,103 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * curvesub.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "subdivider.h" +#include "renderhints.h" +#include "backend.h" +#include "quilt.h" +#include "curvelist.h" +#include "curve.h" +#include "nurbsconsts.h" + +/*-------------------------------------------------------------------------- + * drawCurves - main curve rendering entry point + *-------------------------------------------------------------------------- + */ + +void +Subdivider::drawCurves( void ) +{ + REAL from[1], to[1]; + Flist bpts; + qlist->getRange( from, to, bpts ); + + renderhints.init( ); + + backend.bgncurv(); + for( int i=bpts.start; idownloadAll( &pta, &ptb, backend ); + + Curvelist curvelist( qlist, pta, ptb ); + samplingSplit( curvelist, renderhints.maxsubdivisions ); + } + backend.endcurv(); +} + + +/*-------------------------------------------------------------------------- + * samplingSplit - recursively subdivide patch, cull check each subpatch + *-------------------------------------------------------------------------- + */ + +void +Subdivider::samplingSplit( Curvelist& curvelist, int subdivisions ) +{ + if( curvelist.cullCheck() == CULL_TRIVIAL_REJECT ) return; + + curvelist.getstepsize(); + + if( curvelist.needsSamplingSubdivision() && (subdivisions > 0) ) { + REAL mid = ( curvelist.range[0] + curvelist.range[1] ) * 0.5; + Curvelist lowerlist( curvelist, mid ); + samplingSplit( lowerlist, subdivisions-1 ); // lower + samplingSplit( curvelist, subdivisions-1 ); // upper + } else { + long nu = 1 + ((long) (curvelist.range[2] / curvelist.stepsize)); + backend.curvgrid( curvelist.range[0], curvelist.range[1], nu ); + backend.curvmesh( 0, nu ); + } +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/dataTransform.cc b/mesalib/src/glu/sgi/libnurbs/internals/dataTransform.cc new file mode 100644 index 000000000..55c0fbb15 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/dataTransform.cc @@ -0,0 +1,209 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include "glimports.h" +#include "myassert.h" +#include "nurbsconsts.h" +#include "trimvertex.h" +#include "dataTransform.h" + +extern directedLine* arcLoopToDLineLoop(Arc_ptr loop); + +#if 0 // UNUSED +static directedLine* copy_loop(Arc_ptr loop, Real2* vertArray, int& index, directedLine dline_buf[], sampledLine sline_buf[], int& index_dline) +{ + directedLine *ret; + int old_index = index; + int i = index; + int j; + for(j=0; jpwlArc->npts-1; j++, i++) + { + vertArray[i][0] = loop->pwlArc->pts[j].param[0]; + vertArray[i][1] = loop->pwlArc->pts[j].param[1]; + } + loop->clearmark(); + + for(Arc_ptr jarc = loop->next; jarc != loop; jarc=jarc->next) + { + for(j=0; jpwlArc->npts-1; j++, i++) + { + vertArray[i][0] = jarc->pwlArc->pts[j].param[0]; + vertArray[i][1] = jarc->pwlArc->pts[j].param[1]; + } + jarc->clearmark(); + } + //copy the first vertex again + vertArray[i][0] = loop->pwlArc->pts[0].param[0]; + vertArray[i][1] = loop->pwlArc->pts[0].param[1]; + i++; + index=i; + + directedLine* dline; + sampledLine* sline; + sline = &sline_buf[index_dline]; + dline = &dline_buf[index_dline]; + sline->init(2, &vertArray[old_index]); + dline->init(INCREASING, sline); + ret = dline; + index_dline++; + + for(i=old_index+1; i<= index-2; i++) + { + sline = &sline_buf[index_dline]; + dline = &dline_buf[index_dline]; + sline->init(2, &vertArray[i]); + dline->init(INCREASING, sline); + ret->insert(dline); + index_dline++; + } + return ret; +} +#endif + +#if 0 // UNUSED +static int num_edges(Bin& bin) +{ + int sum=0; + for(Arc_ptr jarc = bin.firstarc(); jarc; jarc=bin.nextarc()) + sum += jarc->pwlArc->npts-1; + return sum; +} +#endif + +/* +directedLine* bin_to_DLineLoops(Bin& bin) +{ + directedLine *ret=NULL; + directedLine *temp; + + int numedges = num_edges(bin); + directedLine* dline_buf = new directedLine[numedges]; //not work for N32? + sampledLine* sline_buf=new sampledLine[numedges]; + + Real2* vertArray = new Real2[numedges*2]; + int index = 0; + int index_dline = 0; + bin.markall(); + + for(Arc_ptr jarc = bin.firstarc(); jarc; jarc=bin.nextarc()) + { + if(jarc->ismarked()) + { + assert(jarc->check() != 0); + Arc_ptr jarchead = jarc; + do { + jarc->clearmark(); + jarc = jarc->next; + } while(jarc != jarchead); + temp=copy_loop(jarchead, vertArray, index, dline_buf, sline_buf, index_dline); + ret = temp->insertPolygon(ret); + } + } + + return ret; +} +*/ + + +directedLine* bin_to_DLineLoops(Bin& bin) +{ + directedLine *ret=NULL; + directedLine *temp; + bin.markall(); + for(Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc()){ + if(jarc->ismarked()) { + assert(jarc->check() != 0); + Arc_ptr jarchead = jarc; + do { + jarc->clearmark(); + jarc = jarc->next; + } while(jarc != jarchead); + temp = arcLoopToDLineLoop(jarc); + ret = temp->insertPolygon(ret); + } + } + return ret; +} + +directedLine* o_pwlcurve_to_DLines(directedLine* original, O_pwlcurve* pwl) +{ + directedLine* ret = original; + for(Int i=0; inpts-1; i++) + { + sampledLine* sline = new sampledLine(2); + sline->setPoint(0, pwl->pts[i].param); + sline->setPoint(1, pwl->pts[i+1].param); + directedLine* dline = new directedLine(INCREASING, sline); + if(ret == NULL) + ret = dline; + else + ret->insert(dline); + } + return ret; +} + +directedLine* o_curve_to_DLineLoop(O_curve* cur) +{ + directedLine *ret; + if(cur == NULL) + return NULL; + assert(cur->curvetype == ct_pwlcurve); + ret = o_pwlcurve_to_DLines(NULL, cur->curve.o_pwlcurve); + for(O_curve* temp = cur->next; temp != NULL; temp = temp->next) + { + assert(temp->curvetype == ct_pwlcurve); + ret = o_pwlcurve_to_DLines(ret, temp->curve.o_pwlcurve); + } + return ret; +} + +directedLine* o_trim_to_DLineLoops(O_trim* trim) +{ + O_trim* temp; + directedLine *ret; + if(trim == NULL) + return NULL; + ret = o_curve_to_DLineLoop(trim->o_curve); + + for(temp=trim->next; temp != NULL; temp = temp->next) + { + ret = ret->insertPolygon(o_curve_to_DLineLoop(temp->o_curve)); + } + return ret; +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/dataTransform.h b/mesalib/src/glu/sgi/libnurbs/internals/dataTransform.h new file mode 100644 index 000000000..7898df754 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/dataTransform.h @@ -0,0 +1,59 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _DATA_TRANSFORM_H +#define _DATA_TRANSFORM_H + +#include "reader.h" +#include "directedLine.h" +#include "bin.h" +directedLine* bin_to_DLineLoops(Bin& bin); + +/*transform the pwlcurve into a number of directedline lines + *insert these directedlines into orignal which is supposed to be + *the part of the trimming loop obtained so far. + *return the updated trimkming loop. + */ +directedLine* o_pwlcurve_to_DLines(directedLine* original, O_pwlcurve* pwl); + +/*transform a trim loop (curve) into a directedLine loop + */ +directedLine* o_curve_to_DLineLoop(O_curve* curve); + +/*transform a list of trim loops (trim) into + *a list of polygons represented as directedLine*. + */ +directedLine* o_trim_to_DLineLoops(O_trim* trim); + + +#endif + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/defines.h b/mesalib/src/glu/sgi/libnurbs/internals/defines.h new file mode 100644 index 000000000..32950d613 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/defines.h @@ -0,0 +1,50 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * defines.h + * + */ + +#ifndef __gludefines_h_ +#define __gludefines_h_ + +/* culling constants */ +#define CULL_TRIVIAL_REJECT 0 +#define CULL_TRIVIAL_ACCEPT 1 +#define CULL_ACCEPT 2 + +/* maximum order of a B-Spline */ +#define MAXORDER 24 + +/* maximum dimension of any B-spline range space */ +#define MAXCOORDS 5 + +#endif /* __gludefines_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/displaylist.cc b/mesalib/src/glu/sgi/libnurbs/internals/displaylist.cc new file mode 100644 index 000000000..48593c637 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/displaylist.cc @@ -0,0 +1,82 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * displaylist.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "nurbstess.h" +#include "displaylist.h" + + +DisplayList::DisplayList( NurbsTessellator *_nt ) : + dlnodePool( sizeof( Dlnode ), 1, "dlnodepool" ) +{ + lastNode = &nodes; + nt = _nt; +} + +DisplayList::~DisplayList( void ) +{ + for( Dlnode *nextNode; nodes; nodes = nextNode ) { + nextNode = nodes->next; + if( nodes->cleanup != 0 ) (nt->*nodes->cleanup)( nodes->arg ); + //nodes->deleteMe(dlnodePool); + } +} + +void +DisplayList::play( void ) +{ + for( Dlnode *node = nodes; node; node = node->next ) + if( node->work != 0 ) (nt->*node->work)( node->arg ); +} + +void +DisplayList::endList( void ) +{ + *lastNode = 0; +} + +void +DisplayList::append( PFVS work, void *arg, PFVS cleanup ) +{ + Dlnode *node = new(dlnodePool) Dlnode( work, arg, cleanup ); + *lastNode = node; + lastNode = &(node->next); +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/displaylist.h b/mesalib/src/glu/sgi/libnurbs/internals/displaylist.h new file mode 100644 index 000000000..22cbec378 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/displaylist.h @@ -0,0 +1,78 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * displaylist.h + * + */ + +#ifndef __gludisplaylist_h_ +#define __gludisplaylist_h_ + +#include "glimports.h" +#include "mysetjmp.h" +#include "mystdio.h" +#include "bufpool.h" + +class NurbsTessellator; + +typedef void (NurbsTessellator::*PFVS)( void * ); + +struct Dlnode : public PooledObj { + Dlnode( PFVS, void *, PFVS ); + PFVS work; + void * arg; + PFVS cleanup; + Dlnode * next; +}; + +inline +Dlnode::Dlnode( PFVS _work, void *_arg, PFVS _cleanup ) +{ + work = _work; + arg = _arg; + cleanup = _cleanup; +} + +class DisplayList { +public: + DisplayList( NurbsTessellator * ); + ~DisplayList( void ); + void play( void ); + void append( PFVS work, void *arg, PFVS cleanup ); + void endList( void ); +private: + Dlnode *nodes; + Pool dlnodePool; + Dlnode **lastNode; + NurbsTessellator *nt; +}; + +#endif /* __gludisplaylist_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/displaymode.h b/mesalib/src/glu/sgi/libnurbs/internals/displaymode.h new file mode 100644 index 000000000..53968b2f1 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/displaymode.h @@ -0,0 +1,40 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef __gludisplaymode_h_ +#define __gludisplaymode_h_ + +#define N_MESHFILL 0 +#define N_MESHLINE 1 +#define N_MESHPOINT 2 + +#endif /* __gludisplaymode_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/flist.cc b/mesalib/src/glu/sgi/libnurbs/internals/flist.cc new file mode 100644 index 000000000..d3162b9f5 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/flist.cc @@ -0,0 +1,118 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * flist.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "flist.h" + +/*---------------------------------------------------------------------------- + * Flist::Flist - initialize a REAL number array + *---------------------------------------------------------------------------- + */ +Flist::Flist( void ) +{ + npts = 0; + pts = 0; + start = end = 0; +} + +/*---------------------------------------------------------------------------- + * Flist::~Flist - free a REAL number array + *---------------------------------------------------------------------------- + */ +Flist::~Flist( void ) +{ + if( npts ) delete[] pts; +} + +void +Flist::add( REAL x ) +{ + pts[end++] = x; + assert( end <= npts ); +} + +/*---------------------------------------------------------------------------- + * Flist::filter - remove duplicate numbers from array + *---------------------------------------------------------------------------- + */ +void Flist::filter( void ) +{ + sorter.qsort( pts, end ); + start = 0; + + int j = 0; + for( int i = 1; i < end; i++ ) { + if( pts[i] == pts[i-j-1] ) + j++; + pts[i-j] = pts[i]; + } + end -= j; +} + +/*---------------------------------------------------------------------------- + * Flist::grow - ensure that array is large enough + *---------------------------------------------------------------------------- + */ +void Flist::grow( int maxpts ) +{ + if( npts < maxpts ) { + if( npts ) delete[] pts; + npts = 2 * maxpts; + pts = new REAL[npts]; + assert( pts != 0 ); + } + start = end = 0; +} + +/*---------------------------------------------------------------------------- + * Flist::taper - ignore head and tail of array + *---------------------------------------------------------------------------- + */ +void Flist::taper( REAL from, REAL to ) +{ + while( pts[start] != from ) + start++; + + while( pts[end-1] != to ) + end--; +} + + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/flist.h b/mesalib/src/glu/sgi/libnurbs/internals/flist.h new file mode 100644 index 000000000..014273ebe --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/flist.h @@ -0,0 +1,59 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * flist.h + * + */ + +#ifndef __gluflist_h_ +#define __gluflist_h_ + +#include "types.h" +#include "flistsorter.h" + +class Flist { +public: + REAL * pts; /* head of array */ + int npts; /* number of points in array */ + int start; /* first important point index */ + int end; /* last important point index */ + + Flist( void ); + ~Flist( void ); + void add( REAL x ); + void filter( void ); + void grow( int); + void taper( REAL , REAL ); +protected: + FlistSorter sorter; +}; + +#endif /* __gluflist_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/flistsorter.cc b/mesalib/src/glu/sgi/libnurbs/internals/flistsorter.cc new file mode 100644 index 000000000..d49bdea3e --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/flistsorter.cc @@ -0,0 +1,81 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * flistsorter.c++ + * + */ + +#include "glimports.h" +#include "flistsorter.h" + +FlistSorter::FlistSorter( void ) : Sorter( sizeof( REAL ) ) +{ +} + +void +FlistSorter::qsort( REAL *p, int n ) +{ + Sorter::qsort( (char *)p, n ); +} + +int +FlistSorter::qscmp( char *i, char *j ) +{ + REAL f0 = *(REAL *)i; + REAL f1 = *(REAL *)j; + return (f0 < f1) ? -1 : 1; +} + +void +FlistSorter::qsexc( char *i, char *j ) +{ + REAL *f0 = (REAL *)i; + REAL *f1 = (REAL *)j; + REAL tmp = *f0; + *f0 = *f1; + *f1 = tmp; +} + +void +FlistSorter::qstexc( char *i, char *j, char *k ) +{ + REAL *f0 = (REAL *)i; + REAL *f1 = (REAL *)j; + REAL *f2 = (REAL *)k; + REAL tmp = *f0; + *f0 = *f2; + *f2 = *f1; + *f1 = tmp; +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/flistsorter.h b/mesalib/src/glu/sgi/libnurbs/internals/flistsorter.h new file mode 100644 index 000000000..65e6a572e --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/flistsorter.h @@ -0,0 +1,53 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * flistsorter.h + * + */ + +#ifndef __gluflistsorter_h_ +#define __gluflistsorter_h_ + +#include "sorter.h" +#include "types.h" + +class FlistSorter : public Sorter { +public: + FlistSorter(void); + virtual ~FlistSorter() { /* silence warning*/ } + void qsort( REAL *a, int n ); + +protected: + virtual int qscmp( char *, char * ); + virtual void qsexc( char *i, char *j ); // i<-j, j<-i + virtual void qstexc( char *i, char *j, char *k ); // i<-k, k<-j, j<-i +}; +#endif /* __gluflistsorter_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/gridline.h b/mesalib/src/glu/sgi/libnurbs/internals/gridline.h new file mode 100644 index 000000000..1a92e3b13 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/gridline.h @@ -0,0 +1,46 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * gridline.h + * + */ + +#ifndef __glugridline_h_ +#define __glugridline_h_ + +struct Gridline { + long v; + REAL vval; + long vindex; + long ustart; + long uend; + }; +#endif /* __glugridline_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/gridtrimvertex.h b/mesalib/src/glu/sgi/libnurbs/internals/gridtrimvertex.h new file mode 100644 index 000000000..707f649d2 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/gridtrimvertex.h @@ -0,0 +1,89 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * gridtrimvertex.h + * + */ + +#ifndef __glugridtrimvertex_h_ +#define __glugridtrimvertex_h_ + +#include "mystdlib.h" +#include "bufpool.h" +#include "trimvertex.h" +#include "gridvertex.h" + +class GridTrimVertex : public PooledObj +{ +private: + TrimVertex dummyt; + GridVertex dummyg; +public: + GridTrimVertex() { g = 0; t = 0; } + TrimVertex *t; + GridVertex *g; + + inline void set( long, long ); + inline void set( REAL, REAL ); + inline void set( TrimVertex * ); + inline void clear( void ) { t = 0; g = 0; }; + inline int isGridVert() { return g ? 1 : 0 ; } + inline int isTrimVert() { return t ? 1 : 0 ; } + inline void output(); +}; + +inline void +GridTrimVertex::set( long x, long y ) +{ + g = &dummyg; + dummyg.gparam[0] = x; + dummyg.gparam[1] = y; +} + +inline void +GridTrimVertex::set( REAL x, REAL y ) +{ + g = 0; + t = &dummyt; + dummyt.param[0] = x; + dummyt.param[1] = y; + dummyt.nuid = 0; +} + +inline void +GridTrimVertex::set( TrimVertex *v ) +{ + g = 0; + t = v; +} + +typedef GridTrimVertex *GridTrimVertex_p; +#endif /* __glugridtrimvertex_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/gridvertex.h b/mesalib/src/glu/sgi/libnurbs/internals/gridvertex.h new file mode 100644 index 000000000..36a65c7bd --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/gridvertex.h @@ -0,0 +1,48 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * gridvertex.h + * + */ + +#ifndef __glugridvertex_h_ +#define __glugridvertex_h_ + +struct GridVertex { + long gparam[2]; + GridVertex( void ) {} + GridVertex( long u, long v ) { gparam[0] = u, gparam[1] = v; } + void set( long u, long v ) { gparam[0] = u, gparam[1] = v; } + long nextu() { return gparam[0]++; } + long prevu() { return gparam[0]--; } +}; + +#endif /* __glugridvertex_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/hull.cc b/mesalib/src/glu/sgi/libnurbs/internals/hull.cc new file mode 100644 index 000000000..389ba66fb --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/hull.cc @@ -0,0 +1,165 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * hull.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "hull.h" +#include "gridvertex.h" +#include "gridtrimvertex.h" +#include "gridline.h" +#include "trimline.h" +#include "uarray.h" +#include "trimregion.h" + +Hull::Hull( void ) +{} + +Hull::~Hull( void ) +{} + +/*---------------------------------------------------------------------- + * Hull:init - this routine does the initialization needed before any + * calls to nextupper or nextlower can be made. + *---------------------------------------------------------------------- + */ +void +Hull::init( void ) +{ + TrimVertex *lfirst = left.first(); + TrimVertex *llast = left.last(); + if( lfirst->param[0] <= llast->param[0] ) { + fakeleft.init( left.first() ); + upper.left = &fakeleft; + lower.left = &left; + } else { + fakeleft.init( left.last() ); + lower.left = &fakeleft; + upper.left = &left; + } + upper.left->last(); + lower.left->first(); + + if( top.ustart <= top.uend ) { + upper.line = ⊤ + upper.index = top.ustart; + } else + upper.line = 0; + + if( bot.ustart <= bot.uend ) { + lower.line = ⊥ + lower.index = bot.ustart; + } else + lower.line = 0; + + TrimVertex *rfirst = right.first(); + TrimVertex *rlast = right.last(); + if( rfirst->param[0] <= rlast->param[0] ) { + fakeright.init( right.last() ); + lower.right = &fakeright; + upper.right = &right; + } else { + fakeright.init( right.first() ); + upper.right = &fakeright; + lower.right = &right; + } + upper.right->first(); + lower.right->last(); +} + +/*---------------------------------------------------------------------- + * nextupper - find next vertex on upper hull of trim region. + * - if vertex is on trim curve, set vtop point to + * that vertex. if vertex is on grid, set vtop to + * point to temporary area and stuff coordinants into + * temporary vertex. Also, place grid coords in temporary + * grid vertex. + *---------------------------------------------------------------------- + */ +GridTrimVertex * +Hull::nextupper( GridTrimVertex *gv ) +{ + if( upper.left ) { + gv->set( upper.left->prev() ); + if( gv->isTrimVert() ) return gv; + upper.left = 0; + } + + if( upper.line ) { + assert( upper.index <= upper.line->uend ); + gv->set( uarray.uarray[upper.index], upper.line->vval ); + gv->set( upper.index, upper.line->vindex ); + if( upper.index++ == upper.line->uend ) upper.line = 0; + return gv; + } + + if( upper.right ) { + gv->set( upper.right->next() ); + if( gv->isTrimVert() ) return gv; + upper.right = 0; + } + + return 0; +} + +GridTrimVertex * +Hull::nextlower( register GridTrimVertex *gv ) +{ + if( lower.left ) { + gv->set( lower.left->next() ); + if( gv->isTrimVert() ) return gv; + lower.left = 0; + } + + if( lower.line ) { + gv->set( uarray.uarray[lower.index], lower.line->vval ); + gv->set( lower.index, lower.line->vindex ); + if( lower.index++ == lower.line->uend ) lower.line = 0; + return gv; + } + + if( lower.right ) { + gv->set( lower.right->prev() ); + if( gv->isTrimVert() ) return gv; + lower.right = 0; + } + + return 0; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/hull.h b/mesalib/src/glu/sgi/libnurbs/internals/hull.h new file mode 100644 index 000000000..dfe865267 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/hull.h @@ -0,0 +1,69 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * hull.h + * + */ + +#ifndef __gluhull_h_ +#define __gluhull_h_ + +#include "trimline.h" +#include "trimregion.h" +#include "trimvertex.h" +#include "gridtrimvertex.h" + +struct Gridline; +class Uarray; + +class Hull : virtual public TrimRegion { +public: + Hull( void ); + ~Hull( void ); + void init( void ); + GridTrimVertex * nextlower( GridTrimVertex * ); + GridTrimVertex * nextupper( GridTrimVertex * ); +private: + struct Side { + Trimline *left; + Gridline *line; + Trimline *right; + long index; + }; + + Side lower; + Side upper; + Trimline fakeleft; + Trimline fakeright; +}; + + +#endif /* __gluhull_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/intersect.cc b/mesalib/src/glu/sgi/libnurbs/internals/intersect.cc new file mode 100644 index 000000000..b39ea2121 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/intersect.cc @@ -0,0 +1,665 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * intersect.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "subdivider.h" +#include "arc.h" +#include "bin.h" +#include "backend.h" +#include "trimvertpool.h" + +/*#define NOTDEF*/ + +enum i_result { INTERSECT_VERTEX, INTERSECT_EDGE }; + +/* local functions */ +#ifndef NDEBUG // for asserts only +static int arc_classify( Arc_ptr, int, REAL ); +#endif +static enum i_result pwlarc_intersect( PwlArc *, int, REAL, int, int[3] ); + + +void +Subdivider::partition( Bin & bin, Bin & left, Bin & intersections, + Bin & right, Bin & unknown, int param, REAL value ) +{ + Bin headonleft, headonright, tailonleft, tailonright; + + for( Arc_ptr jarc = bin.removearc(); jarc; jarc = bin.removearc() ) { + + REAL tdiff = jarc->tail()[param] - value; + REAL hdiff = jarc->head()[param] - value; + + if( tdiff > 0.0 ) { + if( hdiff > 0.0 ) { + right.addarc( jarc ); + } else if( hdiff == 0.0 ) { + tailonright.addarc( jarc ); + } else { + Arc_ptr jtemp; + switch( arc_split(jarc, param, value, 0) ) { + case 2: + tailonright.addarc( jarc ); + headonleft.addarc( jarc->next ); + break; + case 31: + assert( jarc->head()[param] > value ); + right.addarc( jarc ); + tailonright.addarc( jtemp = jarc->next ); + headonleft.addarc( jtemp->next ); + break; + case 32: + assert( jarc->head()[param] <= value ); + tailonright .addarc( jarc ); + headonleft.addarc( jtemp = jarc->next ); + left.addarc( jtemp->next ); + break; + case 4: + right.addarc( jarc ); + tailonright.addarc( jtemp = jarc->next ); + headonleft.addarc( jtemp = jtemp->next ); + left.addarc( jtemp->next ); + } + } + } else if( tdiff == 0.0 ) { + if( hdiff > 0.0 ) { + headonright.addarc( jarc ); + } else if( hdiff == 0.0 ) { + unknown.addarc( jarc ); + } else { + headonleft.addarc( jarc ); + } + } else { + if( hdiff > 0.0 ) { + Arc_ptr jtemp; + switch( arc_split(jarc, param, value, 1) ) { + case 2: + tailonleft.addarc( jarc ); + headonright.addarc( jarc->next ); + break; + case 31: + assert( jarc->head()[param] < value ); + left.addarc( jarc ); + tailonleft.addarc( jtemp = jarc->next ); + headonright.addarc( jtemp->next ); + break; + case 32: + assert( jarc->head()[param] >= value ); + tailonleft.addarc( jarc ); + headonright.addarc( jtemp = jarc->next ); + right.addarc( jtemp->next ); + break; + case 4: + left.addarc( jarc ); + tailonleft.addarc( jtemp = jarc->next ); + headonright.addarc( jtemp = jtemp->next ); + right.addarc( jtemp->next ); + } + } else if( hdiff == 0.0 ) { + tailonleft.addarc( jarc ); + } else { + left.addarc( jarc ); + } + } + } + if( param == 0 ) { + classify_headonleft_s( headonleft, intersections, left, value ); + classify_tailonleft_s( tailonleft, intersections, left, value ); + classify_headonright_s( headonright, intersections, right, value ); + classify_tailonright_s( tailonright, intersections, right, value ); + } else { + classify_headonleft_t( headonleft, intersections, left, value ); + classify_tailonleft_t( tailonleft, intersections, left, value ); + classify_headonright_t( headonright, intersections, right, value ); + classify_tailonright_t( tailonright, intersections, right, value ); + } +} + +inline static void +vert_interp( TrimVertex *n, TrimVertex *l, TrimVertex *r, int p, REAL val ) +{ + assert( val > l->param[p]); + assert( val < r->param[p]); + + n->nuid = l->nuid; + + n->param[p] = val; + if( l->param[1-p] != r->param[1-p] ) { + REAL ratio = (val - l->param[p]) / (r->param[p] - l->param[p]); + n->param[1-p] = l->param[1-p] + + ratio * (r->param[1-p] - l->param[1-p]); + } else { + n->param[1-p] = l->param[1-p]; + } +} + +int +Subdivider::arc_split( Arc_ptr jarc, int param, REAL value, int dir ) +{ + int maxvertex = jarc->pwlArc->npts; + Arc_ptr jarc1; + TrimVertex* v = jarc->pwlArc->pts; + + int loc[3]; + switch( pwlarc_intersect( jarc->pwlArc, param, value, dir, loc ) ) { + + // When the parameter value lands on a vertex, life is sweet + case INTERSECT_VERTEX: { + jarc1 = new(arcpool) Arc( jarc, new( pwlarcpool) PwlArc( maxvertex-loc[1], &v[loc[1]] ) ); + jarc->pwlArc->npts = loc[1] + 1; + jarc1->next = jarc->next; + jarc1->next->prev = jarc1; + jarc->next = jarc1; + jarc1->prev = jarc; + assert(jarc->check() != 0); + return 2; + } + + // When the parameter value intersects an edge, we have to + // interpolate a new vertex. There are special cases + // if the new vertex is adjacent to one or both of the + // endpoints of the arc. + case INTERSECT_EDGE: { + int i, j; + if( dir == 0 ) { + i = loc[0]; + j = loc[2]; + } else { + i = loc[2]; + j = loc[0]; + } + +#ifndef NOTDEF + // The split is between vertices at index j and i, in that + // order (j < i) + + // JEB: This code is my idea of how to do the split without + // increasing the number of links. I'm doing this so that + // the is_rect routine can recognize rectangles created by + // subdivision. In exchange for simplifying the curve list, + // however, it costs in allocated space and vertex copies. + + TrimVertex *newjunk = trimvertexpool.get(maxvertex -i+1 /*-j*/); + int k; + for(k=0; knuid; + } + + TrimVertex *vcopy = trimvertexpool.get(maxvertex); + for(k=0; kpwlArc->pts=vcopy; + + v[i].nuid = jarc->nuid; + v[j].nuid = jarc->nuid; + vert_interp( &newjunk[0], &v[loc[0]], &v[loc[2]], param, value ); + + if( showingDegenerate() ) + backend.triangle( &v[i], &newjunk[0], &v[j] ); + + vcopy[j+1].param[0]=newjunk[0].param[0]; + vcopy[j+1].param[1]=newjunk[0].param[1]; + + + jarc1 = new(arcpool) Arc( jarc, + new(pwlarcpool) PwlArc(maxvertex-i+1 , newjunk ) ); + + jarc->pwlArc->npts = j+2; + jarc1->next = jarc->next; + jarc1->next->prev = jarc1; + jarc->next = jarc1; + jarc1->prev = jarc; + assert(jarc->check() != 0); + + return 2; +#endif //not NOTDEF + // JEB: This is the original version: +#ifdef NOTDEF + Arc_ptr jarc2, jarc3; + + TrimVertex *newjunk = trimvertexpool.get(3); + v[i].nuid = jarc->nuid; + v[j].nuid = jarc->nuid; + newjunk[0] = v[j]; + newjunk[2] = v[i]; + vert_interp( &newjunk[1], &v[loc[0]], &v[loc[2]], param, value ); + + if( showingDegenerate() ) + backend.triangle( &newjunk[2], &newjunk[1], &newjunk[0] ); + + // New vertex adjacent to both endpoints + if (maxvertex == 2) { + jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) ); + jarc->pwlArc->npts = 2; + jarc->pwlArc->pts = newjunk; + jarc1->next = jarc->next; + jarc1->next->prev = jarc1; + jarc->next = jarc1; + jarc1->prev = jarc; + assert(jarc->check() != 0); + + return 2; + + // New vertex adjacent to ending point of arc + } else if (maxvertex - j == 2) { + jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk ) ); + jarc2 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) ); + jarc->pwlArc->npts = maxvertex-1; + jarc2->next = jarc->next; + jarc2->next->prev = jarc2; + jarc->next = jarc1; + jarc1->prev = jarc; + jarc1->next = jarc2; + jarc2->prev = jarc1; + assert(jarc->check() != 0); + return 31; + + // New vertex adjacent to starting point of arc + } else if (i == 1) { + jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) ); + jarc2 = new(arcpool) Arc( jarc, + new(pwlarcpool) PwlArc( maxvertex-1, &jarc->pwlArc->pts[1] ) ); + jarc->pwlArc->npts = 2; + jarc->pwlArc->pts = newjunk; + jarc2->next = jarc->next; + jarc2->next->prev = jarc2; + jarc->next = jarc1; + jarc1->prev = jarc; + jarc1->next = jarc2; + jarc2->prev = jarc1; + assert(jarc->check() != 0); + return 32; + + // It's somewhere in the middle + } else { + jarc1 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk ) ); + jarc2 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( 2, newjunk+1 ) ); + jarc3 = new(arcpool) Arc( jarc, new(pwlarcpool) PwlArc( maxvertex-i, v+i ) ); + jarc->pwlArc->npts = j + 1; + jarc3->next = jarc->next; + jarc3->next->prev = jarc3; + jarc->next = jarc1; + jarc1->prev = jarc; + jarc1->next = jarc2; + jarc2->prev = jarc1; + jarc2->next = jarc3; + jarc3->prev = jarc2; + assert(jarc->check() != 0); + return 4; + } +#endif // NOTDEF + } + default: + return -1; //picked -1 since it's not used + } +} + +/*---------------------------------------------------------------------------- + * pwlarc_intersect - find intersection of pwlArc and isoparametric line + *---------------------------------------------------------------------------- + */ + +static enum i_result +pwlarc_intersect( + PwlArc *pwlArc, + int param, + REAL value, + int dir, + int loc[3] ) +{ + assert( pwlArc->npts > 0 ); + + if( dir ) { + TrimVertex *v = pwlArc->pts; + int imin = 0; + int imax = pwlArc->npts - 1; + assert( value > v[imin].param[param] ); + assert( value < v[imax].param[param] ); + while( (imax - imin) > 1 ) { + int imid = (imax + imin)/2; + if( v[imid].param[param] > value ) + imax = imid; + else if( v[imid].param[param] < value ) + imin = imid; + else { + loc[1] = imid; + return INTERSECT_VERTEX; + } + } + loc[0] = imin; + loc[2] = imax; + return INTERSECT_EDGE; + } else { + TrimVertex *v = pwlArc->pts; + int imax = 0; + int imin = pwlArc->npts - 1; + assert( value > v[imin].param[param] ); + assert( value < v[imax].param[param] ); + while( (imin - imax) > 1 ) { + int imid = (imax + imin)/2; + if( v[imid].param[param] > value ) + imax = imid; + else if( v[imid].param[param] < value ) + imin = imid; + else { + loc[1] = imid; + return INTERSECT_VERTEX; + } + } + loc[0] = imin; + loc[2] = imax; + return INTERSECT_EDGE; + } +} + +/*---------------------------------------------------------------------------- + * arc_classify - determine which side of a line a jarc lies + *---------------------------------------------------------------------------- + */ + +#ifndef NDEBUG // for asserts only +static int +arc_classify( Arc_ptr jarc, int param, REAL value ) +{ + REAL tdiff, hdiff; + if( param == 0 ) { + tdiff = jarc->tail()[0] - value; + hdiff = jarc->head()[0] - value; + } else { + tdiff = jarc->tail()[1] - value; + hdiff = jarc->head()[1] - value; + } + + if( tdiff > 0.0 ) { + if( hdiff > 0.0 ) { + return 0x11; + } else if( hdiff == 0.0 ) { + return 0x12; + } else { + return 0x10; + } + } else if( tdiff == 0.0 ) { + if( hdiff > 0.0 ) { + return 0x21; + } else if( hdiff == 0.0 ) { + return 0x22; + } else { + return 0x20; + } + } else { + if( hdiff > 0.0 ) { + return 0x01; + } else if( hdiff == 0.0 ) { + return 0x02; + } else { + return 0; + } + } +} +#endif + +void +Subdivider::classify_tailonleft_s( Bin& bin, Bin& in, Bin& out, REAL val ) +{ + /* tail at left, head on line */ + Arc_ptr j; + + while( (j = bin.removearc()) != NULL ) { + assert( arc_classify( j, 0, val ) == 0x02 ); + j->clearitail(); + + REAL diff = j->next->head()[0] - val; + if( diff > 0.0 ) { + in.addarc( j ); + } else if( diff < 0.0 ) { + if( ccwTurn_sl( j, j->next ) ) + out.addarc( j ); + else + in.addarc( j ); + } else { + if( j->next->tail()[1] > j->next->head()[1] ) + in.addarc(j); + else + out.addarc(j); + } + } +} + +void +Subdivider::classify_tailonleft_t( Bin& bin, Bin& in, Bin& out, REAL val ) +{ + /* tail at left, head on line */ + Arc_ptr j; + + while( (j = bin.removearc()) != NULL ) { + assert( arc_classify( j, 1, val ) == 0x02 ); + j->clearitail(); + + REAL diff = j->next->head()[1] - val; + if( diff > 0.0 ) { + in.addarc( j ); + } else if( diff < 0.0 ) { + if( ccwTurn_tl( j, j->next ) ) + out.addarc( j ); + else + in.addarc( j ); + } else { + if (j->next->tail()[0] > j->next->head()[0] ) + out.addarc( j ); + else + in.addarc( j ); + } + } +} + +void +Subdivider::classify_headonleft_s( Bin& bin, Bin& in, Bin& out, REAL val ) +{ + /* tail on line, head at left */ + Arc_ptr j; + + while( (j = bin.removearc()) != NULL ) { + assert( arc_classify( j, 0, val ) == 0x20 ); + + j->setitail(); + + REAL diff = j->prev->tail()[0] - val; + if( diff > 0.0 ) { + out.addarc( j ); + } else if( diff < 0.0 ) { + if( ccwTurn_sl( j->prev, j ) ) + out.addarc( j ); + else + in.addarc( j ); + } else { + if( j->prev->tail()[1] > j->prev->head()[1] ) + in.addarc( j ); + else + out.addarc( j ); + } + } +} + +void +Subdivider::classify_headonleft_t( Bin& bin, Bin& in, Bin& out, REAL val ) +{ + /* tail on line, head at left */ + Arc_ptr j; + + while( (j = bin.removearc()) != NULL ) { + assert( arc_classify( j, 1, val ) == 0x20 ); + j->setitail(); + + REAL diff = j->prev->tail()[1] - val; + if( diff > 0.0 ) { + out.addarc( j ); + } else if( diff < 0.0 ) { + if( ccwTurn_tl( j->prev, j ) ) + out.addarc( j ); + else + in.addarc( j ); + } else { + if( j->prev->tail()[0] > j->prev->head()[0] ) + out.addarc( j ); + else + in.addarc( j ); + } + } +} + + +void +Subdivider::classify_tailonright_s( Bin& bin, Bin& in, Bin& out, REAL val ) +{ + /* tail at right, head on line */ + Arc_ptr j; + + while( (j = bin.removearc()) != NULL ) { + assert( arc_classify( j, 0, val ) == 0x12); + + j->clearitail(); + + REAL diff = j->next->head()[0] - val; + if( diff > 0.0 ) { + if( ccwTurn_sr( j, j->next ) ) + out.addarc( j ); + else + in.addarc( j ); + } else if( diff < 0.0 ) { + in.addarc( j ); + } else { + if( j->next->tail()[1] > j->next->head()[1] ) + out.addarc( j ); + else + in.addarc( j ); + } + } +} + +void +Subdivider::classify_tailonright_t( Bin& bin, Bin& in, Bin& out, REAL val ) +{ + /* tail at right, head on line */ + Arc_ptr j; + + while( (j = bin.removearc()) != NULL ) { + assert( arc_classify( j, 1, val ) == 0x12); + + j->clearitail(); + + REAL diff = j->next->head()[1] - val; + if( diff > 0.0 ) { + if( ccwTurn_tr( j, j->next ) ) + out.addarc( j ); + else + in.addarc( j ); + } else if( diff < 0.0 ) { + in.addarc( j ); + } else { + if( j->next->tail()[0] > j->next->head()[0] ) + in.addarc( j ); + else + out.addarc( j ); + } + } +} + +void +Subdivider::classify_headonright_s( Bin& bin, Bin& in, Bin& out, REAL val ) +{ + /* tail on line, head at right */ + Arc_ptr j; + + while( (j = bin.removearc()) != NULL ) { + assert( arc_classify( j, 0, val ) == 0x21 ); + + j->setitail(); + + REAL diff = j->prev->tail()[0] - val; + if( diff > 0.0 ) { + if( ccwTurn_sr( j->prev, j ) ) + out.addarc( j ); + else + in.addarc( j ); + } else if( diff < 0.0 ) { + out.addarc( j ); + } else { + if( j->prev->tail()[1] > j->prev->head()[1] ) + out.addarc( j ); + else + in.addarc( j ); + } + } +} + +void +Subdivider::classify_headonright_t( Bin& bin, Bin& in, Bin& out, REAL val ) +{ + /* tail on line, head at right */ + Arc_ptr j; + + while( (j = bin.removearc()) != NULL ) { + assert( arc_classify( j, 1, val ) == 0x21 ); + + j->setitail(); + + REAL diff = j->prev->tail()[1] - val; + if( diff > 0.0 ) { + if( ccwTurn_tr( j->prev, j ) ) + out.addarc( j ); + else + in.addarc( j ); + } else if( diff < 0.0 ) { + out.addarc( j ); + } else { + if( j->prev->tail()[0] > j->prev->head()[0] ) + in.addarc( j ); + else + out.addarc( j ); + } + } +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/jarcloc.h b/mesalib/src/glu/sgi/libnurbs/internals/jarcloc.h new file mode 100644 index 000000000..5297036fa --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/jarcloc.h @@ -0,0 +1,87 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * jarcloc.h + * + */ + +#ifndef __glujarcloc_h_ +#define __glujarcloc_h_ + +#include "arc.h" + +class Jarcloc { +private: + Arc_ptr arc; + TrimVertex *p; + TrimVertex *plast; +public: + inline void init( Arc_ptr a, long first, long last ) { arc = a; p=&a->pwlArc->pts[first]; plast = &a->pwlArc->pts[last]; } + inline TrimVertex * getnextpt( void ); + inline TrimVertex * getprevpt( void ); + inline void reverse(); +}; + +inline void +Jarcloc::reverse() +{ + if( plast == &arc->pwlArc->pts[0] ) + plast = &arc->pwlArc->pts[arc->pwlArc->npts - 1]; + else + plast = &arc->pwlArc->pts[0]; +} + +inline TrimVertex * +Jarcloc::getnextpt() +{ + assert( p <= plast ); + if( p == plast ) { + arc = arc->next; + p = &arc->pwlArc->pts[0]; + plast = &arc->pwlArc->pts[arc->pwlArc->npts - 1]; + assert( p < plast ); + } + return p++; +} + +inline TrimVertex * +Jarcloc::getprevpt() +{ + assert( p >= plast ); + if( p == plast ) { + arc = arc->prev; + p = &arc->pwlArc->pts[arc->pwlArc->npts - 1]; + plast = &arc->pwlArc->pts[0]; + assert( p > plast ); + } + return p--; +} +#endif /* __glujarcloc_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/knotvector.cc b/mesalib/src/glu/sgi/libnurbs/internals/knotvector.cc new file mode 100644 index 000000000..9eb5cbace --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/knotvector.cc @@ -0,0 +1,139 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * knotvector.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "knotvector.h" +#include "defines.h" + +#ifdef __WATCOMC__ +#pragma warning 726 10 +#endif + +void Knotvector::init( long _knotcount, long _stride, long _order, INREAL *_knotlist ) +{ + knotcount = _knotcount; + stride = _stride; + order = _order; + knotlist = new Knot[_knotcount]; + assert( knotlist != 0 ); + + for( int i = 0; i != _knotcount; i++ ) + knotlist[i] = (Knot) _knotlist[i]; +} + +Knotvector::Knotvector( void ) +{ + knotlist = 0; +} + +Knotvector::~Knotvector( void ) +{ + if( knotlist ) delete[] knotlist; +} + +int Knotvector::validate( void ) +{ + /* kindex is used as an array index so subtract one first, + * this propagates throughout the code so study carefully */ + long kindex = knotcount-1; + + if( order < 1 || order > MAXORDER ) { + // spline order un-supported + return( 1 ); + } + + if( knotcount < (2 * order) ) { + // too few knots + return( 2 ); + } + + if( identical( knotlist[kindex-(order-1)], knotlist[order-1]) ) { + // valid knot range is empty + return( 3 ); + } + + for( long i = 0; i < kindex; i++) + if( knotlist[i] > knotlist[i+1] ) { + // decreasing knot sequence + return( 4 ); + } + + /* check for valid multiplicity */ + + /* kindex is currently the index of the last knot. + * In the next loop it is decremented to ignore the last knot + * and the loop stops when kindex is 2 so as to ignore the first + * knot as well. These knots are not used in computing + * knot multiplicities. + */ + + long multi = 1; + for( ; kindex >= 1; kindex-- ) { + if( knotlist[kindex] - knotlist[kindex-1] < TOLERANCE ) { + multi++; + continue; + } + if ( multi > order ) { + // knot multiplicity greater than order of spline + return( 5 ); + } + multi = 1; + } + + if ( multi > order ) { + // knot multiplicity greater than order of spline + return( 5 ); + } + + return 0; +} + +void Knotvector::show( const char *msg ) +{ +#ifndef NDEBUG + _glu_dprintf( "%s\n", msg ); + _glu_dprintf( "order = %ld, count = %ld\n", order, knotcount ); + + for( int i=0; i +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "mystring.h" +#include "mymath.h" +#include "backend.h" +#include "nurbsconsts.h" +#include "mapdesc.h" + +Mapdesc::Mapdesc( long _type, int _israt, int _ncoords, Backend& b ) + : backend( b ) +{ + type = _type; + isrational = _israt; + ncoords = _ncoords; + hcoords = _ncoords + (_israt ? 0 : 1 ); + inhcoords = _ncoords - (_israt ? 1 : 0 ); + mask = ((1<<(inhcoords*2))-1); + next = 0; + + assert( hcoords <= MAXCOORDS ); + assert( inhcoords >= 1 ); + + pixel_tolerance = 1.0; + error_tolerance = 1.0; + bbox_subdividing = N_NOBBOXSUBDIVISION; + culling_method = N_NOCULLING; + sampling_method = N_NOSAMPLING; + clampfactor = N_NOCLAMPING; + minsavings = N_NOSAVINGSSUBDIVISION; + s_steps = 0.0; + t_steps = 0.0; + maxrate = ( s_steps < 0.0 ) ? 0.0 : s_steps; + maxsrate = ( s_steps < 0.0 ) ? 0.0 : s_steps; + maxtrate = ( t_steps < 0.0 ) ? 0.0 : t_steps; + identify( bmat ); + identify( cmat ); + identify( smat ); + for( int i = 0; i != inhcoords; i++ ) + bboxsize[i] = 1.0; +} + +void +Mapdesc::setBboxsize( INREAL *mat ) +{ + for( int i = 0; i != inhcoords; i++ ) + bboxsize[i] = (REAL) mat[i]; +} + +void +Mapdesc::identify( REAL dest[MAXCOORDS][MAXCOORDS] ) +{ + memset( dest, 0, sizeof( dest ) ); + for( int i=0; i != hcoords; i++ ) + dest[i][i] = 1.0; +} + +void +Mapdesc::surfbbox( REAL bb[2][MAXCOORDS] ) +{ + backend.surfbbox( type, bb[0], bb[1] ); +} + +void +Mapdesc::copy( REAL dest[MAXCOORDS][MAXCOORDS], long n, INREAL *src, + long rstride, long cstride ) +{ + assert( n >= 0 ); + for( int i=0; i != n; i++ ) + for( int j=0; j != n; j++ ) + dest[i][j] = src[i*rstride + j*cstride]; +} + +/*-------------------------------------------------------------------------- + * copyPt - copy a homogeneous point + *-------------------------------------------------------------------------- + */ +void +Mapdesc::copyPt( REAL *d, REAL *s ) +{ + assert( hcoords > 0 ); + switch( hcoords ) { + case 4: + d[3] = s[3]; + d[2] = s[2]; + d[1] = s[1]; + d[0] = s[0]; + break; + case 3: + d[2] = s[2]; + d[1] = s[1]; + d[0] = s[0]; + break; + case 2: + d[1] = s[1]; + d[0] = s[0]; + break; + case 1: + d[0] = s[0]; + break; + case 5: + d[4] = s[4]; + d[3] = s[3]; + d[2] = s[2]; + d[1] = s[1]; + d[0] = s[0]; + break; + default: + memcpy( d, s, hcoords * sizeof( REAL ) ); + break; + } +} + +/*-------------------------------------------------------------------------- + * sumPt - compute affine combination of two homogeneous points + *-------------------------------------------------------------------------- + */ +void +Mapdesc::sumPt( REAL *dst, REAL *src1, REAL *src2, register REAL alpha, register REAL beta ) +{ + assert( hcoords > 0 ); + switch( hcoords ) { + case 4: + dst[3] = src1[3] * alpha + src2[3] * beta; + dst[2] = src1[2] * alpha + src2[2] * beta; + dst[1] = src1[1] * alpha + src2[1] * beta; + dst[0] = src1[0] * alpha + src2[0] * beta; + break; + case 3: + dst[2] = src1[2] * alpha + src2[2] * beta; + dst[1] = src1[1] * alpha + src2[1] * beta; + dst[0] = src1[0] * alpha + src2[0] * beta; + break; + case 2: + dst[1] = src1[1] * alpha + src2[1] * beta; + dst[0] = src1[0] * alpha + src2[0] * beta; + break; + case 1: + dst[0] = src1[0] * alpha + src2[0] * beta; + break; + case 5: + dst[4] = src1[4] * alpha + src2[4] * beta; + dst[3] = src1[3] * alpha + src2[3] * beta; + dst[2] = src1[2] * alpha + src2[2] * beta; + dst[1] = src1[1] * alpha + src2[1] * beta; + dst[0] = src1[0] * alpha + src2[0] * beta; + break; + default: { + for( int i = 0; i != hcoords; i++ ) + dst[i] = src1[i] * alpha + src2[i] * beta; + } + break; + } +} + +/*-------------------------------------------------------------------------- + * clipbits - compute bit-vector indicating point/window position + * of a (transformed) homogeneous point + *-------------------------------------------------------------------------- + */ +unsigned int +Mapdesc::clipbits( REAL *p ) +{ + assert( inhcoords >= 0 ); + assert( inhcoords <= 3 ); + + register int nc = inhcoords; + register REAL pw = p[nc]; + register REAL nw = -pw; + register unsigned int bits = 0; + + if( pw == 0.0 ) return mask; + + if( pw > 0.0 ) { + switch( nc ) { + case 3: + if( p[2] <= pw ) bits |= (1<<5); + if( p[2] >= nw ) bits |= (1<<4); + if( p[1] <= pw ) bits |= (1<<3); + if( p[1] >= nw ) bits |= (1<<2); + if( p[0] <= pw ) bits |= (1<<1); + if( p[0] >= nw ) bits |= (1<<0); + return bits; + case 2: + if( p[1] <= pw ) bits |= (1<<3); + if( p[1] >= nw ) bits |= (1<<2); + if( p[0] <= pw ) bits |= (1<<1); + if( p[0] >= nw ) bits |= (1<<0); + return bits; + case 1: + if( p[0] <= pw ) bits |= (1<<1); + if( p[0] >= nw ) bits |= (1<<0); + return bits; + default: { + int bit = 1; + for( int i=0; i= nw ) bits |= bit; + bit <<= 1; + if( p[i] <= pw ) bits |= bit; + bit <<= 1; + } + abort(); + break; + } + } + } else { + switch( nc ) { + case 3: + if( p[2] <= nw ) bits |= (1<<5); + if( p[2] >= pw ) bits |= (1<<4); + if( p[1] <= nw ) bits |= (1<<3); + if( p[1] >= pw ) bits |= (1<<2); + if( p[0] <= nw ) bits |= (1<<1); + if( p[0] >= pw ) bits |= (1<<0); + return bits; + case 2: + if( p[1] <= nw ) bits |= (1<<3); + if( p[1] >= pw ) bits |= (1<<2); + if( p[0] <= nw ) bits |= (1<<1); + if( p[0] >= pw ) bits |= (1<<0); + return bits; + case 1: + if( p[0] <= nw ) bits |= (1<<1); + if( p[0] >= pw ) bits |= (1<<0); + return bits; + default: { + int bit = 1; + for( int i=0; i= pw ) bits |= bit; + bit <<= 1; + if( p[i] <= nw ) bits |= bit; + bit <<= 1; + } + abort(); + break; + } + } + } + return bits; +} + +/*-------------------------------------------------------------------------- + * xformRational - transform a homogeneous point + *-------------------------------------------------------------------------- + */ +void +Mapdesc::xformRational( Maxmatrix mat, REAL *d, REAL *s ) +{ + assert( hcoords >= 0 ); + + if( hcoords == 3 ) { + REAL x = s[0]; + REAL y = s[1]; + REAL z = s[2]; + d[0] = x*mat[0][0]+y*mat[1][0]+z*mat[2][0]; + d[1] = x*mat[0][1]+y*mat[1][1]+z*mat[2][1]; + d[2] = x*mat[0][2]+y*mat[1][2]+z*mat[2][2]; + } else if( hcoords == 4 ) { + REAL x = s[0]; + REAL y = s[1]; + REAL z = s[2]; + REAL w = s[3]; + d[0] = x*mat[0][0]+y*mat[1][0]+z*mat[2][0]+w*mat[3][0]; + d[1] = x*mat[0][1]+y*mat[1][1]+z*mat[2][1]+w*mat[3][1]; + d[2] = x*mat[0][2]+y*mat[1][2]+z*mat[2][2]+w*mat[3][2]; + d[3] = x*mat[0][3]+y*mat[1][3]+z*mat[2][3]+w*mat[3][3]; + } else { + for( int i=0; i != hcoords; i++ ) { + d[i] = 0; + for( int j = 0; j != hcoords; j++ ) + d[i] += s[j] * mat[j][i]; + } + } +} + +/*-------------------------------------------------------------------------- + * xformNonrational - transform a inhomogeneous point to a homogeneous point + *-------------------------------------------------------------------------- + */ +void +Mapdesc::xformNonrational( Maxmatrix mat, REAL *d, REAL *s ) +{ + if( inhcoords == 2 ) { + REAL x = s[0]; + REAL y = s[1]; + d[0] = x*mat[0][0]+y*mat[1][0]+mat[2][0]; + d[1] = x*mat[0][1]+y*mat[1][1]+mat[2][1]; + d[2] = x*mat[0][2]+y*mat[1][2]+mat[2][2]; + } else if( inhcoords == 3 ) { + REAL x = s[0]; + REAL y = s[1]; + REAL z = s[2]; + d[0] = x*mat[0][0]+y*mat[1][0]+z*mat[2][0]+mat[3][0]; + d[1] = x*mat[0][1]+y*mat[1][1]+z*mat[2][1]+mat[3][1]; + d[2] = x*mat[0][2]+y*mat[1][2]+z*mat[2][2]+mat[3][2]; + d[3] = x*mat[0][3]+y*mat[1][3]+z*mat[2][3]+mat[3][3]; + } else { + assert( inhcoords >= 0 ); + for( int i=0; i != hcoords; i++ ) { + d[i] = mat[inhcoords][i]; + for( int j = 0; j < inhcoords; j++ ) + d[i] += s[j] * mat[j][i]; + } + } +} + +/*-------------------------------------------------------------------------- + * xformAndCullCheck - transform a set of points that may be EITHER + * homogeneous or inhomogeneous depending on the map description and + * check if they are either completely inside, completely outside, + * or intersecting the viewing frustrum. + *-------------------------------------------------------------------------- + */ +int +Mapdesc::xformAndCullCheck( + REAL *pts, int uorder, int ustride, int vorder, int vstride ) +{ + assert( uorder > 0 ); + assert( vorder > 0 ); + + unsigned int inbits = mask; + unsigned int outbits = 0; + + REAL *p = pts; + for( REAL *pend = p + uorder * ustride; p != pend; p += ustride ) { + REAL *q = p; + for( REAL *qend = q + vorder * vstride; q != qend; q += vstride ) { + REAL cpts[MAXCOORDS]; + xformCulling( cpts, q ); + unsigned int bits = clipbits( cpts ); + outbits |= bits; + inbits &= bits; + if( ( outbits == (unsigned int)mask ) && ( inbits != (unsigned int)mask ) ) return CULL_ACCEPT; + } + } + + if( outbits != (unsigned int)mask ) { + return CULL_TRIVIAL_REJECT; + } else if( inbits == (unsigned int)mask ) { + return CULL_TRIVIAL_ACCEPT; + } else { + return CULL_ACCEPT; + } +} + +/*-------------------------------------------------------------------------- + * cullCheck - check if a set of homogeneous transformed points are + * either completely inside, completely outside, + * or intersecting the viewing frustrum. + *-------------------------------------------------------------------------- + */ +int +Mapdesc::cullCheck( REAL *pts, int uorder, int ustride, int vorder, int vstride ) +{ + unsigned int inbits = mask; + unsigned int outbits = 0; + + REAL *p = pts; + for( REAL *pend = p + uorder * ustride; p != pend; p += ustride ) { + REAL *q = p; + for( REAL *qend = q + vorder * vstride; q != qend; q += vstride ) { + unsigned int bits = clipbits( q ); + outbits |= bits; + inbits &= bits; + if( ( outbits == (unsigned int)mask ) && ( inbits != (unsigned int)mask ) ) return CULL_ACCEPT; + } + } + + if( outbits != (unsigned int)mask ) { + return CULL_TRIVIAL_REJECT; + } else if( inbits == (unsigned int)mask ) { + return CULL_TRIVIAL_ACCEPT; + } else { + return CULL_ACCEPT; + } +} + +/*-------------------------------------------------------------------------- + * cullCheck - check if a set of homogeneous transformed points are + * either completely inside, completely outside, + * or intersecting the viewing frustrum. + *-------------------------------------------------------------------------- + */ +int +Mapdesc::cullCheck( REAL *pts, int order, int stride ) +{ + unsigned int inbits = mask; + unsigned int outbits = 0; + + REAL *p = pts; + for( REAL *pend = p + order * stride; p != pend; p += stride ) { + unsigned int bits = clipbits( p ); + outbits |= bits; + inbits &= bits; + if( ( outbits == (unsigned int)mask ) && ( inbits != (unsigned int)mask ) ) return CULL_ACCEPT; + } + + if( outbits != (unsigned int)mask ) { + return CULL_TRIVIAL_REJECT; + } else if( inbits == (unsigned int)mask ) { + return CULL_TRIVIAL_ACCEPT; + } else { + return CULL_ACCEPT; + } +} + +/*-------------------------------------------------------------------------- + * xformSampling - transform a set of points that may be EITHER + * homogeneous or inhomogeneous depending on the map description + * into sampling space + *-------------------------------------------------------------------------- + */ +void +Mapdesc::xformSampling( REAL *pts, int order, int stride, REAL *sp, int outstride ) +{ + xformMat( smat, pts, order, stride, sp, outstride ); +} + +void +Mapdesc::xformBounding( REAL *pts, int order, int stride, REAL *sp, int outstride ) +{ + xformMat( bmat, pts, order, stride, sp, outstride ); +} + +/*-------------------------------------------------------------------------- + * xformCulling - transform a set of points that may be EITHER + * homogeneous or inhomogeneous depending on the map description + * into culling space + *-------------------------------------------------------------------------- + */ +void +Mapdesc::xformCulling( REAL *pts, int order, int stride, REAL *cp, int outstride ) +{ + xformMat( cmat, pts, order, stride, cp, outstride ); +} + +/*-------------------------------------------------------------------------- + * xformCulling - transform a set of points that may be EITHER + * homogeneous or inhomogeneous depending on the map description + * into culling space + *-------------------------------------------------------------------------- + */ +void +Mapdesc::xformCulling( REAL *pts, + int uorder, int ustride, + int vorder, int vstride, + REAL *cp, int outustride, int outvstride ) +{ + xformMat( cmat, pts, uorder, ustride, vorder, vstride, cp, outustride, outvstride ); +} + +/*-------------------------------------------------------------------------- + * xformSampling - transform a set of points that may be EITHER + * homogeneous or inhomogeneous depending on the map description + * into sampling space + *-------------------------------------------------------------------------- + */ +void +Mapdesc::xformSampling( REAL *pts, + int uorder, int ustride, + int vorder, int vstride, + REAL *sp, int outustride, int outvstride ) +{ + xformMat( smat, pts, uorder, ustride, vorder, vstride, sp, outustride, outvstride ); +} + +void +Mapdesc::xformBounding( REAL *pts, + int uorder, int ustride, + int vorder, int vstride, + REAL *sp, int outustride, int outvstride ) +{ + xformMat( bmat, pts, uorder, ustride, vorder, vstride, sp, outustride, outvstride ); +} + +void +Mapdesc::xformMat( + Maxmatrix mat, + REAL * pts, + int order, + int stride, + REAL * cp, + int outstride ) +{ + if( isrational ) { + REAL *pend = pts + order * stride; + for( REAL *p = pts ; p != pend; p += stride ) { + xformRational( mat, cp, p ); + cp += outstride; + } + } else { + REAL *pend = pts + order * stride; + for( REAL *p = pts ; p != pend; p += stride ) { + xformNonrational( mat, cp, p ); + cp += outstride; + } + } +} + +void +Mapdesc::xformMat( Maxmatrix mat, REAL *pts, + int uorder, int ustride, + int vorder, int vstride, + REAL *cp, int outustride, int outvstride ) +{ + if( isrational ) { + REAL *pend = pts + uorder * ustride; + for( REAL *p = pts ; p != pend; p += ustride ) { + REAL *cpts2 = cp; + REAL *qend = p + vorder * vstride; + for( REAL *q = p; q != qend; q += vstride ) { + xformRational( mat, cpts2, q ); + cpts2 += outvstride; + } + cp += outustride; + } + } else { + REAL *pend = pts + uorder * ustride; + for( REAL *p = pts ; p != pend; p += ustride ) { + REAL *cpts2 = cp; + REAL *qend = p + vorder * vstride; + for( REAL *q = p; q != qend; q += vstride ) { + xformNonrational( mat, cpts2, q ); + cpts2 += outvstride; + } + cp += outustride; + } + } +} + +/*-------------------------------------------------------------------------- + * subdivide - subdivide a curve along an isoparametric line + *-------------------------------------------------------------------------- + */ + +void +Mapdesc::subdivide( REAL *src, REAL *dst, REAL v, int stride, int order ) +{ + REAL mv = 1.0 - v; + + for( REAL *send=src+stride*order; src!=send; send-=stride, dst+=stride ) { + copyPt( dst, src ); + REAL *qpnt = src + stride; + for( REAL *qp=src; qpnt!=send; qp=qpnt, qpnt+=stride ) + sumPt( qp, qp, qpnt, mv, v ); + } +} + +/*-------------------------------------------------------------------------- + * subdivide - subdivide a patch along an isoparametric line + *-------------------------------------------------------------------------- + */ + +void +Mapdesc::subdivide( REAL *src, REAL *dst, REAL v, + int so, int ss, int to, int ts ) +{ + REAL mv = 1.0 - v; + + for( REAL *slast = src+ss*so; src != slast; src += ss, dst += ss ) { + REAL *sp = src; + REAL *dp = dst; + for( REAL *send = src+ts*to; sp != send; send -= ts, dp += ts ) { + copyPt( dp, sp ); + REAL *qp = sp; + for( REAL *qpnt = sp+ts; qpnt != send; qp = qpnt, qpnt += ts ) + sumPt( qp, qp, qpnt, mv, v ); + } + } +} + + +#define sign(x) ((x > 0) ? 1 : ((x < 0.0) ? -1 : 0)) + +/*-------------------------------------------------------------------------- + * project - project a set of homogeneous coordinates into inhomogeneous ones + *-------------------------------------------------------------------------- + */ +int +Mapdesc::project( REAL *src, int rstride, int cstride, + REAL *dest, int trstride, int tcstride, + int nrows, int ncols ) +{ + int s = sign( src[inhcoords] ); + REAL *rlast = src + nrows * rstride; + REAL *trptr = dest; + for( REAL *rptr=src; rptr != rlast; rptr+=rstride, trptr+=trstride ) { + REAL *clast = rptr + ncols * cstride; + REAL *tcptr = trptr; + for( REAL *cptr = rptr; cptr != clast; cptr+=cstride, tcptr+=tcstride ) { + REAL *coordlast = cptr + inhcoords; + if( sign( *coordlast ) != s ) return 0; + REAL *tcoord = tcptr; + for( REAL *coord = cptr; coord != coordlast; coord++, tcoord++ ) { + *tcoord = *coord / *coordlast; + } + } + } + return 1; +} + +/*-------------------------------------------------------------------------- + * project - project a set of homogeneous coordinates into inhomogeneous ones + *-------------------------------------------------------------------------- + */ +int +Mapdesc::project( REAL *src, int stride, REAL *dest, int tstride, int ncols ) +{ + int s = sign( src[inhcoords] ); + + REAL *clast = src + ncols * stride; + for( REAL *cptr = src, *tcptr = dest; cptr != clast; cptr+=stride, tcptr+=tstride ) { + REAL *coordlast = cptr + inhcoords; + if( sign( *coordlast ) != s ) return 0; + for( REAL *coord = cptr, *tcoord = tcptr; coord != coordlast; coord++, tcoord++ ) + *tcoord = *coord / *coordlast; + } + + return 1; +} + +int +Mapdesc::bboxTooBig( + REAL *p, + int rstride, + int cstride, + int nrows, + int ncols, + REAL bb[2][MAXCOORDS] ) +{ + REAL bbpts[MAXORDER][MAXORDER][MAXCOORDS]; + const int trstride = sizeof(bbpts[0]) / sizeof(REAL); + const int tcstride = sizeof(bbpts[0][0]) / sizeof(REAL); + + // points have been transformed, therefore they are homogeneous + // project points + int val = project( p, rstride, cstride, + &bbpts[0][0][0], trstride, tcstride, nrows, ncols ); + if( val == 0 ) return -1; + + // compute bounding box + bbox( bb, &bbpts[0][0][0], trstride, tcstride, nrows, ncols ); + + // find out if bounding box can't fit in unit cube + if( bbox_subdividing == N_BBOXROUND ) { + for( int k=0; k != inhcoords; k++ ) + if( ceilf(bb[1][k]) - floorf(bb[0][k]) > bboxsize[k] ) return 1; + } else { + for( int k=0; k != inhcoords; k++ ) + if( bb[1][k] - bb[0][k] > bboxsize[k] ) return 1; + } + return 0; +} + +void +Mapdesc::bbox( + REAL bb[2][MAXCOORDS], + REAL *p, + int rstride, + int cstride, + int nrows, + int ncols ) +{ + int k; + for( k=0; k != inhcoords; k++ ) + bb[0][k] = bb[1][k] = p[k]; + + for( int i=0; i != nrows; i++ ) + for( int j=0; j != ncols; j++ ) + for( k=0; k != inhcoords; k++ ) { + REAL x = p[i*rstride + j*cstride + k]; + if( x < bb[0][k] ) bb[0][k] = x; + else if( x > bb[1][k] ) bb[1][k] = x; + } +} + +/*-------------------------------------------------------------------------- + * calcVelocityRational - calculate upper bound on first partial derivative + * of a homogeneous set of points and bounds on each row of points. + *-------------------------------------------------------------------------- + */ +REAL +Mapdesc::calcVelocityRational( REAL *p, int stride, int ncols ) +{ + REAL tmp[MAXORDER][MAXCOORDS]; + + assert( ncols <= MAXORDER ); + + const int tstride = sizeof(tmp[0]) / sizeof(REAL); + + if( project( p, stride, &tmp[0][0], tstride, ncols ) ) { + return calcPartialVelocity( &tmp[0][0], tstride, ncols, 1, 1.0 ); + } else { /* XXX */ + return calcPartialVelocity( &tmp[0][0], tstride, ncols, 1, 1.0 ); + } +} + +/*-------------------------------------------------------------------------- + * calcVelocityNonrational - calculate upper bound on first partial + * derivative of a inhomogeneous set of points. + *-------------------------------------------------------------------------- + */ +REAL +Mapdesc::calcVelocityNonrational( REAL *pts, int stride, int ncols ) +{ + return calcPartialVelocity( pts, stride, ncols, 1, 1.0 ); +} + +int +Mapdesc::isProperty( long property ) +{ + switch ( property ) { + case N_PIXEL_TOLERANCE: + case N_ERROR_TOLERANCE: + case N_CULLING: + case N_BBOX_SUBDIVIDING: + case N_S_STEPS: + case N_T_STEPS: + case N_SAMPLINGMETHOD: + case N_CLAMPFACTOR: + case N_MINSAVINGS: + return 1; + default: + return 0; + } +} + +REAL +Mapdesc::getProperty( long property ) +{ + switch ( property ) { + case N_PIXEL_TOLERANCE: + return pixel_tolerance; + case N_ERROR_TOLERANCE: + return error_tolerance; + case N_CULLING: + return culling_method; + case N_BBOX_SUBDIVIDING: + return bbox_subdividing; + case N_S_STEPS: + return s_steps; + case N_T_STEPS: + return t_steps; + case N_SAMPLINGMETHOD: + return sampling_method; + case N_CLAMPFACTOR: + return clampfactor; + case N_MINSAVINGS: + return minsavings; + default: + abort(); + return -1; //not necessary, needed to shut up compiler + } +} + +void +Mapdesc::setProperty( long property, REAL value ) +{ + + switch ( property ) { + case N_PIXEL_TOLERANCE: + pixel_tolerance = value; + break; + case N_ERROR_TOLERANCE: + error_tolerance = value; + break; + case N_CULLING: + culling_method = value; + break; + case N_BBOX_SUBDIVIDING: + if( value <= 0.0 ) value = N_NOBBOXSUBDIVISION; + bbox_subdividing = value; + break; + case N_S_STEPS: + if( value < 0.0 ) value = 0.0; + s_steps = value; + maxrate = ( value < 0.0 ) ? 0.0 : value; + maxsrate = ( value < 0.0 ) ? 0.0 : value; + break; + case N_T_STEPS: + if( value < 0.0 ) value = 0.0; + t_steps = value; + maxtrate = ( value < 0.0 ) ? 0.0 : value; + break; + case N_SAMPLINGMETHOD: + sampling_method = value; + break; + case N_CLAMPFACTOR: + if( value <= 0.0 ) value = N_NOCLAMPING; + clampfactor = value; + break; + case N_MINSAVINGS: + if( value <= 0.0 ) value = N_NOSAVINGSSUBDIVISION; + minsavings = value; + break; + default: + abort(); + break; + } +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/mapdesc.h b/mesalib/src/glu/sgi/libnurbs/internals/mapdesc.h new file mode 100644 index 000000000..6f06154f9 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/mapdesc.h @@ -0,0 +1,271 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * mapdesc.h + * + */ + +#ifndef __glumapdesc_h_ +#define __glumapdesc_h_ + +#include "mystdio.h" +#include "types.h" +#include "defines.h" +#include "bufpool.h" +#include "nurbsconsts.h" + +typedef REAL Maxmatrix[MAXCOORDS][MAXCOORDS]; + +class Backend; + +class Mapdesc : public PooledObj { + friend class Maplist; + +public: + Mapdesc( long, int, int, Backend & ); + int isProperty( long ); + REAL getProperty( long ); + void setProperty( long, REAL ); + int isConstantSampling( void ); + int isDomainSampling( void ); + int isRangeSampling( void ); + int isSampling( void ); + int isParametricDistanceSampling( void ); + int isObjectSpaceParaSampling( void ); + int isObjectSpacePathSampling( void ); + int isSurfaceAreaSampling( void ); + int isPathLengthSampling( void ); + int isCulling( void ); + int isBboxSubdividing( void ); + long getType( void ); + + /* curve routines */ + void subdivide( REAL *, REAL *, REAL, int, int ); + int cullCheck( REAL *, int, int ); + void xformBounding( REAL *, int, int, REAL *, int ); + void xformCulling( REAL *, int, int, REAL *, int ); + void xformSampling( REAL *, int, int, REAL *, int ); + void xformMat( Maxmatrix, REAL *, int, int, REAL *, int ); + REAL calcPartialVelocity ( REAL *, int, int, int, REAL ); + int project( REAL *, int, REAL *, int, int ); + REAL calcVelocityRational( REAL *, int, int ); + REAL calcVelocityNonrational( REAL *, int, int ); + + /* surface routines */ + void subdivide( REAL *, REAL *, REAL, int, int, int, int ); + int cullCheck( REAL *, int, int, int, int ); + void xformBounding( REAL *, int, int, int, int, REAL *, int, int ); + void xformCulling( REAL *, int, int, int, int, REAL *, int, int ); + void xformSampling( REAL *, int, int, int, int, REAL *, int, int ); + void xformMat( Maxmatrix, REAL *, int, int, int, int, REAL *, int, int ); + REAL calcPartialVelocity ( REAL *, REAL *, int, int, int, int, int, int, REAL, REAL, int ); + int project( REAL *, int, int, REAL *, int, int, int, int); + void surfbbox( REAL bb[2][MAXCOORDS] ); + + int bboxTooBig( REAL *, int, int, int, int, REAL [2][MAXCOORDS] ); + int xformAndCullCheck( REAL *, int, int, int, int ); + + void identify( REAL[MAXCOORDS][MAXCOORDS] ); + void setBboxsize( INREAL *); + inline void setBmat( INREAL*, long, long ); + inline void setCmat( INREAL*, long, long ); + inline void setSmat( INREAL*, long, long ); + inline int isRational( void ); + inline int getNcoords( void ); + + REAL pixel_tolerance; /* pathlength sampling tolerance */ + REAL error_tolerance; /* parametric error sampling tolerance*/ + REAL object_space_error_tolerance; /* object space tess*/ + REAL clampfactor; + REAL minsavings; + REAL maxrate; + REAL maxsrate; + REAL maxtrate; + REAL bboxsize[MAXCOORDS]; + +private: + long type; + int isrational; + int ncoords; + int hcoords; + int inhcoords; + int mask; + Maxmatrix bmat; + Maxmatrix cmat; + Maxmatrix smat; + REAL s_steps; /* max samples in s direction */ + REAL t_steps; /* max samples in t direction */ + REAL sampling_method; + REAL culling_method; /* check for culling */ + REAL bbox_subdividing; + Mapdesc * next; + Backend & backend; + + void bbox( REAL [2][MAXCOORDS], REAL *, int, int, int, int ); + REAL maxDifference( int, REAL *, int ); + static void copy( Maxmatrix, long, INREAL *, long, long ); + + /* individual control point routines */ + static void transform4d( float[4], float[4], float[4][4] ); + static void multmatrix4d ( float[4][4], const float[4][4], + const float[4][4] ); + void copyPt( REAL *, REAL * ); + void sumPt( REAL *, REAL *, REAL *, REAL, REAL ); + void xformSampling( REAL *, REAL * ); + void xformCulling( REAL *, REAL * ); + void xformRational( Maxmatrix, REAL *, REAL * ); + void xformNonrational( Maxmatrix, REAL *, REAL * ); + unsigned int clipbits( REAL * ); +}; + +inline void +Mapdesc::setBmat( INREAL *mat, long rstride, long cstride ) +{ + copy( bmat, hcoords, mat, rstride, cstride ); +} + +inline void +Mapdesc::setCmat( INREAL *mat, long rstride, long cstride ) +{ + copy( cmat, hcoords, mat, rstride, cstride ); +} + +inline void +Mapdesc::setSmat( INREAL *mat, long rstride, long cstride ) +{ + copy( smat, hcoords, mat, rstride, cstride ); +} + +inline long +Mapdesc::getType( void ) +{ + return type; +} + +inline void +Mapdesc::xformCulling( REAL *d, REAL *s ) +{ + if( isrational ) + xformRational( cmat, d, s ); + else + xformNonrational( cmat, d, s ); +} + +inline void +Mapdesc::xformSampling( REAL *d, REAL *s ) +{ + if( isrational ) + xformRational( smat, d, s ); + else + xformNonrational( smat, d, s ); +} + +inline int +Mapdesc::isRational( void ) +{ + return isrational ? 1 : 0; +} + +inline int +Mapdesc::getNcoords( void ) +{ + return ncoords; +} + +inline int +Mapdesc::isConstantSampling( void ) +{ + return ((sampling_method == N_FIXEDRATE) ? 1 : 0); +} + +inline int +Mapdesc::isDomainSampling( void ) +{ + return ((sampling_method == N_DOMAINDISTANCE) ? 1 : 0); +} + +inline int +Mapdesc::isParametricDistanceSampling( void ) +{ + return ((sampling_method == N_PARAMETRICDISTANCE) ? 1 : 0); +} + +inline int +Mapdesc::isObjectSpaceParaSampling( void ) +{ + return ((sampling_method == N_OBJECTSPACE_PARA) ? 1 : 0); +} + +inline int +Mapdesc::isObjectSpacePathSampling( void ) +{ + return ((sampling_method == N_OBJECTSPACE_PATH) ? 1 : 0); +} + +inline int +Mapdesc::isSurfaceAreaSampling( void ) +{ + return ((sampling_method == N_SURFACEAREA) ? 1 : 0); +} + +inline int +Mapdesc::isPathLengthSampling( void ) +{ + return ((sampling_method == N_PATHLENGTH) ? 1 : 0); +} + +inline int +Mapdesc::isRangeSampling( void ) +{ + return ( isParametricDistanceSampling() || isPathLengthSampling() || + isSurfaceAreaSampling() || + isObjectSpaceParaSampling() || + isObjectSpacePathSampling()); +} + +inline int +Mapdesc::isSampling( void ) +{ + return isRangeSampling() || isConstantSampling() || isDomainSampling(); +} + +inline int +Mapdesc::isCulling( void ) +{ + return ((culling_method != N_NOCULLING) ? 1 : 0); +} + +inline int +Mapdesc::isBboxSubdividing( void ) +{ + return ((bbox_subdividing != N_NOBBOXSUBDIVISION) ? 1 : 0); +} +#endif /* __glumapdesc_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/mapdescv.cc b/mesalib/src/glu/sgi/libnurbs/internals/mapdescv.cc new file mode 100644 index 000000000..35b38b141 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/mapdescv.cc @@ -0,0 +1,243 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * mapdescv.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "mystring.h" +#include "mymath.h" +#include "nurbsconsts.h" +#include "mapdesc.h" + +/*-------------------------------------------------------------------------- + * calcPartialVelocity - calculate maximum magnitude of a given partial + * derivative + *-------------------------------------------------------------------------- + */ +REAL +Mapdesc::calcPartialVelocity ( + REAL *p, + int stride, + int ncols, + int partial, + REAL range ) +{ + REAL tmp[MAXORDER][MAXCOORDS]; + REAL mag[MAXORDER]; + + assert( ncols <= MAXORDER ); + + int j, k, t; + // copy inhomogeneous control points into temporary array + for( j=0; j != ncols; j++ ) + for( k=0; k != inhcoords; k++ ) + tmp[j][k] = p[j*stride + k]; + + for( t=0; t != partial; t++ ) + for( j=0; j != ncols-t-1; j++ ) + for( k=0; k != inhcoords; k++ ) + tmp[j][k] = tmp[j+1][k] - tmp[j][k]; + + // compute magnitude and store in mag array + for( j=0; j != ncols-partial; j++ ) { + mag[j] = 0.0; + for( k=0; k != inhcoords; k++ ) + mag[j] += tmp[j][k] * tmp[j][k]; + } + + // compute scale factor + REAL fac = 1; + REAL invt = 1.0 / range; + for( t = ncols-1; t != ncols-1-partial; t-- ) + fac *= t * invt; + + // compute max magnitude of all entries in array + REAL max = 0.0; + for( j=0; j != ncols-partial; j++ ) + if( mag[j] > max ) max = mag[j]; + max = fac * sqrtf( (float) max ); + + return max; +} + +/*-------------------------------------------------------------------------- + * calcPartialVelocity - calculate maximum magnitude of a given partial + * derivative + *-------------------------------------------------------------------------- + */ +REAL +Mapdesc::calcPartialVelocity ( + REAL *dist, + REAL *p, + int rstride, + int cstride, + int nrows, + int ncols, + int spartial, + int tpartial, + REAL srange, + REAL trange, + int side ) +{ + REAL tmp[MAXORDER][MAXORDER][MAXCOORDS]; + REAL mag[MAXORDER][MAXORDER]; + + assert( nrows <= MAXORDER ); + assert( ncols <= MAXORDER ); + + REAL *tp = &tmp[0][0][0]; + REAL *mp = &mag[0][0]; + const int istride = sizeof( tmp[0]) / sizeof( tmp[0][0][0] ); + const int jstride = sizeof( tmp[0][0]) / sizeof( tmp[0][0][0] ); + /* + const int kstride = sizeof( tmp[0][0][0]) / sizeof( tmp[0][0][0] ); + */ + const int mistride = sizeof( mag[0]) / sizeof( mag[0][0] ); + const int mjstride = sizeof( mag[0][0]) / sizeof( mag[0][0] ); + const int idist = nrows * istride; + const int jdist = ncols * jstride; + /* + const int kdist = inhcoords * kstride; + */ + const int id = idist - spartial * istride; + const int jd = jdist - tpartial * jstride; + + { + // copy control points + REAL *ti = tp; + REAL *qi = p; + REAL *til = tp + idist; + for( ; ti != til; ) { + REAL *tj = ti; + REAL *qj = qi; + REAL *tjl = ti + jdist; + for( ; tj != tjl; ) { + for( int k=0; k != inhcoords; k++ ) { + tj[k] = qj[k]; + } + tj += jstride; + qj += cstride; + } + ti += istride; + qi += rstride; + } + } + + { + // compute (s)-partial derivative control points + REAL *til = tp + idist - istride; + const REAL *till = til - ( spartial * istride ); + for( ; til != till; til -= istride ) + for( REAL *ti = tp; ti != til; ti += istride ) + for( REAL *tj = ti, *tjl = tj + jdist; tj != tjl; tj += jstride ) + for( int k=0; k != inhcoords; k++ ) + tj[k] = tj[k+istride] - tj[k]; + } + + { + // compute (s,t)-partial derivative control points + REAL *tjl = tp + jdist - jstride; + const REAL *tjll = tjl - ( tpartial * jstride ); + for( ; tjl != tjll; tjl -= jstride ) + for( REAL *tj = tp; tj != tjl; tj += jstride ) + for( REAL *ti = tj, *til = ti + id; ti != til; ti += istride ) + for( int k=0; k != inhcoords; k++ ) + ti[k] = ti[k+jstride] - ti[k]; + + } + + REAL max = 0.0; + { + // compute magnitude and store in mag array + memset( (void *) mp, 0, sizeof( mag ) ); + for( REAL *ti = tp, *mi = mp, *til = tp + id; ti != til; ti += istride, mi += mistride ) + for( REAL *tj = ti, *mj = mi, *tjl = ti + jd; tj != tjl; tj += jstride, mj += mjstride ) { + for( int k=0; k != inhcoords; k++ ) + *mj += tj[k] * tj[k]; + if( *mj > max ) max = *mj; + } + + } + + int i, j; + + // compute scale factor + REAL fac = 1.0; + { + REAL invs = 1.0 / srange; + REAL invt = 1.0 / trange; + for( int s = nrows-1, slast = s-spartial; s != slast; s-- ) + fac *= s * invs; + for( int t = ncols-1, tlast = t-tpartial; t != tlast; t-- ) + fac *= t * invt; + } + + if( side == 0 ) { + // compute max magnitude of first and last column + dist[0] = 0.0; + dist[1] = 0.0; + for( i=0; i != nrows-spartial; i++ ) { + j = 0; + if( mag[i][j] > dist[0] ) dist[0] = mag[i][j]; + + j = ncols-tpartial-1; + if( mag[i][j] > dist[1] ) dist[1] = mag[i][j]; + } + dist[0] = fac * sqrtf( dist[0] ); + dist[1] = fac * sqrtf( dist[1] ); + } else if( side == 1 ) { + // compute max magnitude of first and last row + dist[0] = 0.0; + dist[1] = 0.0; + for( j=0; j != ncols-tpartial; j++ ) { + i = 0; + if( mag[i][j] > dist[0] ) dist[0] = mag[i][j]; + + i = nrows-spartial-1; + if( mag[i][j] > dist[1] ) dist[1] = mag[i][j]; + } + dist[0] = fac * sqrtf( dist[0] ); + dist[1] = fac * sqrtf( dist[1] ); + } + + max = fac * sqrtf( (float) max ); + + return max; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/maplist.cc b/mesalib/src/glu/sgi/libnurbs/internals/maplist.cc new file mode 100644 index 000000000..f944d1529 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/maplist.cc @@ -0,0 +1,117 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * maplist.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "mymath.h" +#include "nurbsconsts.h" +#include "maplist.h" +#include "mapdesc.h" +#include "backend.h" + +Maplist::Maplist( Backend& b ) + : mapdescPool( sizeof( Mapdesc ), 10, "mapdesc pool" ), + backend( b ) +{ + maps = 0; lastmap = &maps; +} + +void +Maplist::initialize( void ) +{ + freeMaps(); + define( N_P2D, 0, 2 ); + define( N_P2DR, 1, 3 ); +} + +void +Maplist::add( long type, int israt, int ncoords ) +{ + *lastmap = new(mapdescPool) Mapdesc( type, israt, ncoords, backend ); + lastmap = &((*lastmap)->next); +} + +void +Maplist::define( long type, int israt, int ncoords ) +{ +#ifndef NDEBUG // to avoid warning + Mapdesc *m = locate( type ); + assert( m == NULL || ( m->isrational == israt && m->ncoords == ncoords ) ); +#endif + add( type, israt, ncoords ); +} + +void +Maplist::remove( Mapdesc *m ) +{ + for( Mapdesc **curmap = &maps; *curmap; curmap = &((*curmap)->next) ) { + if( *curmap == m ) { + *curmap = m->next; + m->deleteMe( mapdescPool ); + return; + } + } + abort(); +} + +void +Maplist::freeMaps( void ) +{ + mapdescPool.clear(); + maps = 0; + lastmap = &maps; +} + +Mapdesc * +Maplist::find( long type ) +{ + Mapdesc *val = locate( type ); + assert( val != 0 ); + return val; +} + +Mapdesc * +Maplist::locate( long type ) +{ + Mapdesc *m; + for( m = maps; m; m = m->next ) + if( m->getType() == type ) break; + return m; +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/maplist.h b/mesalib/src/glu/sgi/libnurbs/internals/maplist.h new file mode 100644 index 000000000..49720e49b --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/maplist.h @@ -0,0 +1,81 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * maplist.h + * + */ + +#ifndef __glumaplist_h_ +#define __glumaplist_h_ + +#include "types.h" +#include "defines.h" +#include "bufpool.h" + +class Backend; +class Mapdesc; + +class Maplist { +public: + Maplist( Backend & ); + void define( long, int, int ); + inline void undefine( long ); + inline int isMap( long ); + + void initialize( void ); + Mapdesc * find( long ); + Mapdesc * locate( long ); + +private: + Pool mapdescPool; + Mapdesc * maps; + Mapdesc ** lastmap; + Backend & backend; + + void add( long, int, int ); + void remove( Mapdesc * ); + void freeMaps( void ); +}; + +inline int +Maplist::isMap( long type ) +{ + return (locate( type ) ? 1 : 0); +} + +inline void +Maplist::undefine( long type ) +{ + Mapdesc *m = locate( type ); + assert( m != 0 ); + remove( m ); +} +#endif /* __glumaplist_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/mesher.cc b/mesalib/src/glu/sgi/libnurbs/internals/mesher.cc new file mode 100644 index 000000000..9cc436adb --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/mesher.cc @@ -0,0 +1,486 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * mesher.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "gridvertex.h" +#include "gridtrimvertex.h" +#include "jarcloc.h" +#include "gridline.h" +#include "trimline.h" +#include "uarray.h" +#include "backend.h" +#include "mesher.h" + + +const float Mesher::ZERO = 0.0; + +Mesher::Mesher( Backend& b ) + : backend( b ), + p( sizeof( GridTrimVertex ), 100, "GridTrimVertexPool" ) +{ + stacksize = 0; + vdata = 0; + lastedge = 0; //needed to prevent purify UMR +} + +Mesher::~Mesher( void ) +{ + if( vdata ) delete[] vdata; +} + +void +Mesher::init( unsigned int npts ) +{ + p.clear(); + if( stacksize < npts ) { + stacksize = 2 * npts; + if( vdata ) delete[] vdata; + vdata = new GridTrimVertex_p[stacksize]; + } +} + +inline void +Mesher::push( GridTrimVertex *gt ) +{ + assert( itop+1 != (int)stacksize ); + vdata[++itop] = gt; +} + +inline void +Mesher::pop( long ) +{ +} + +inline void +Mesher::openMesh() +{ + backend.bgntmesh( "addedge" ); +} + +inline void +Mesher::closeMesh() +{ + backend.endtmesh(); +} + +inline void +Mesher::swapMesh() +{ + backend.swaptmesh(); +} + +inline void +Mesher::clearStack() +{ + itop = -1; + last[0] = 0; +} + +void +Mesher::finishLower( GridTrimVertex *gtlower ) +{ + for( push(gtlower); + nextlower( gtlower=new(p) GridTrimVertex ); + push(gtlower) ) + addLower(); + addLast(); +} + +void +Mesher::finishUpper( GridTrimVertex *gtupper ) +{ + for( push(gtupper); + nextupper( gtupper=new(p) GridTrimVertex ); + push(gtupper) ) + addUpper(); + addLast(); +} + +void +Mesher::mesh( void ) +{ + GridTrimVertex *gtlower, *gtupper; + + Hull::init( ); + nextupper( gtupper = new(p) GridTrimVertex ); + nextlower( gtlower = new(p) GridTrimVertex ); + + clearStack(); + openMesh(); + push(gtupper); + + nextupper( gtupper = new(p) GridTrimVertex ); + nextlower( gtlower ); + + assert( gtupper->t && gtlower->t ); + + if( gtupper->t->param[0] < gtlower->t->param[0] ) { + push(gtupper); + lastedge = 1; + if( nextupper( gtupper=new(p) GridTrimVertex ) == 0 ) { + finishLower(gtlower); + return; + } + } else if( gtupper->t->param[0] > gtlower->t->param[0] ) { + push(gtlower); + lastedge = 0; + if( nextlower( gtlower=new(p) GridTrimVertex ) == 0 ) { + finishUpper(gtupper); + return; + } + } else { + if( lastedge == 0 ) { + push(gtupper); + lastedge = 1; + if( nextupper(gtupper=new(p) GridTrimVertex) == 0 ) { + finishLower(gtlower); + return; + } + } else { + push(gtlower); + lastedge = 0; + if( nextlower( gtlower=new(p) GridTrimVertex ) == 0 ) { + finishUpper(gtupper); + return; + } + } + } + + while ( 1 ) { + if( gtupper->t->param[0] < gtlower->t->param[0] ) { + push(gtupper); + addUpper(); + if( nextupper( gtupper=new(p) GridTrimVertex ) == 0 ) { + finishLower(gtlower); + return; + } + } else if( gtupper->t->param[0] > gtlower->t->param[0] ) { + push(gtlower); + addLower(); + if( nextlower( gtlower=new(p) GridTrimVertex ) == 0 ) { + finishUpper(gtupper); + return; + } + } else { + if( lastedge == 0 ) { + push(gtupper); + addUpper(); + if( nextupper( gtupper=new(p) GridTrimVertex ) == 0 ) { + finishLower(gtlower); + return; + } + } else { + push(gtlower); + addLower(); + if( nextlower( gtlower=new(p) GridTrimVertex ) == 0 ) { + finishUpper(gtupper); + return; + } + } + } + } +} + +inline int +Mesher::isCcw( int ilast ) +{ + REAL area = det3( vdata[ilast]->t, vdata[itop-1]->t, vdata[itop-2]->t ); + return (area < ZERO) ? 0 : 1; +} + +inline int +Mesher::isCw( int ilast ) +{ + REAL area = det3( vdata[ilast]->t, vdata[itop-1]->t, vdata[itop-2]->t ); + return (area > -ZERO) ? 0 : 1; +} + +inline int +Mesher::equal( int x, int y ) +{ + return( last[0] == vdata[x] && last[1] == vdata[y] ); +} + +inline void +Mesher::copy( int x, int y ) +{ + last[0] = vdata[x]; last[1] = vdata[y]; +} + +inline void +Mesher::move( int x, int y ) +{ + vdata[x] = vdata[y]; +} + +inline void +Mesher::output( int x ) +{ + backend.tmeshvert( vdata[x] ); +} + +/*--------------------------------------------------------------------------- + * addedge - addedge an edge to the triangulation + * + * This code has been re-written to generate large triangle meshes + * from a monotone polygon. Although smaller triangle meshes + * could be generated faster and with less code, larger meshes + * actually give better SYSTEM performance. This is because + * vertices are processed in the backend slower than they are + * generated by this code and any decrease in the number of vertices + * results in a decrease in the time spent in the backend. + *--------------------------------------------------------------------------- + */ + +void +Mesher::addLast( ) +{ + register int ilast = itop; + + if( lastedge == 0 ) { + if( equal( 0, 1 ) ) { + output( ilast ); + swapMesh(); + for( register int i = 2; i < ilast; i++ ) { + swapMesh(); + output( i ); + } + copy( ilast, ilast-1 ); + } else if( equal( ilast-2, ilast-1) ) { + swapMesh(); + output( ilast ); + for( register int i = ilast-3; i >= 0; i-- ) { + output( i ); + swapMesh(); + } + copy( 0, ilast ); + } else { + closeMesh(); openMesh(); + output( ilast ); + output( 0 ); + for( register int i = 1; i < ilast; i++ ) { + swapMesh(); + output( i ); + } + copy( ilast, ilast-1 ); + } + } else { + if( equal( 1, 0) ) { + swapMesh(); + output( ilast ); + for( register int i = 2; i < ilast; i++ ) { + output( i ); + swapMesh(); + } + copy( ilast-1, ilast ); + } else if( equal( ilast-1, ilast-2) ) { + output( ilast ); + swapMesh(); + for( register int i = ilast-3; i >= 0; i-- ) { + swapMesh(); + output( i ); + } + copy( ilast, 0 ); + } else { + closeMesh(); openMesh(); + output( 0 ); + output( ilast ); + for( register int i = 1; i < ilast; i++ ) { + output( i ); + swapMesh(); + } + copy( ilast-1, ilast ); + } + } + closeMesh(); + //for( register long k=0; k<=ilast; k++ ) pop( k ); +} + +void +Mesher::addUpper( ) +{ + register int ilast = itop; + + if( lastedge == 0 ) { + if( equal( 0, 1 ) ) { + output( ilast ); + swapMesh(); + for( register int i = 2; i < ilast; i++ ) { + swapMesh(); + output( i ); + } + copy( ilast, ilast-1 ); + } else if( equal( ilast-2, ilast-1) ) { + swapMesh(); + output( ilast ); + for( register int i = ilast-3; i >= 0; i-- ) { + output( i ); + swapMesh(); + } + copy( 0, ilast ); + } else { + closeMesh(); openMesh(); + output( ilast ); + output( 0 ); + for( register int i = 1; i < ilast; i++ ) { + swapMesh(); + output( i ); + } + copy( ilast, ilast-1 ); + } + lastedge = 1; + //for( register long k=0; k 1) && isCcw( ilast ) ); + + if( equal( ilast-1, ilast-2 ) ) { + output( ilast ); + swapMesh(); + for( register int i=ilast-3; i>=itop-1; i-- ) { + swapMesh(); + output( i ); + } + copy( ilast, itop-1 ); + } else if( equal( itop, itop-1 ) ) { + swapMesh(); + output( ilast ); + for( register int i = itop+1; i < ilast; i++ ) { + output( i ); + swapMesh(); + } + copy( ilast-1, ilast ); + } else { + closeMesh(); openMesh(); + output( ilast ); + output( ilast-1 ); + for( register int i=ilast-2; i>=itop-1; i-- ) { + swapMesh(); + output( i ); + } + copy( ilast, itop-1 ); + } + //for( register int k=itop; k= 0; i-- ) { + swapMesh(); + output( i ); + } + copy( ilast, 0 ); + } else { + closeMesh(); openMesh(); + output( 0 ); + output( ilast ); + for( register int i = 1; i < ilast; i++ ) { + output( i ); + swapMesh(); + } + copy( ilast-1, ilast ); + } + + lastedge = 0; + //for( register long k=0; k 1) && isCw( ilast ) ); + + if( equal( ilast-2, ilast-1) ) { + swapMesh(); + output( ilast ); + for( register int i=ilast-3; i>=itop-1; i--) { + output( i ); + swapMesh( ); + } + copy( itop-1, ilast ); + } else if( equal( itop-1, itop) ) { + output( ilast ); + swapMesh(); + for( register int i=itop+1; i=itop-1; i-- ) { + output( i ); + swapMesh( ); + } + copy( itop-1, ilast ); + } + //for( register int k=itop; kbgntfan(); + + /* + trimVert.param[0]=v[0]; + trimVert.param[1]=v[1]; + backend->tmeshvert(&trimVert); + */ + backend->tmeshvert(v[0], v[1]); + + if(isIncreasing) { + for(i=0; itmeshvert(&trimVert); + */ + backend->tmeshvert(queue[i][0], queue[i][1]); + } + } + else { + for(i=index_queue-1; i>=0; i--) + { + /* + trimVert.param[0]=queue[i][0]; + trimVert.param[1]=queue[i][1]; + backend->tmeshvert(&trimVert); + */ + backend->tmeshvert(queue[i][0], queue[i][1]); + } + } + backend->endtfan(); +} + +void reflexChain::processNewVertex(Real v[2], Backend* backend) +{ + Int i,j,k; + Int isReflex; + /*TrimVertex trimVert;*/ + /*if there are at most one vertex in the queue, then simply insert + */ + if(index_queue <=1){ + insert(v); + return; + } + + /*there are at least two vertices in the queue*/ + j=index_queue-1; + + for(i=j; i>=1; i--) { + if(isIncreasing) { + isReflex = (area(queue[i-1], queue[i], v) <= 0.0); + } + else /*decreasing*/{ + isReflex = (area(v, queue[i], queue[i-1]) <= 0.0); + } + if(isReflex) { + break; + } + } + + /* + *if ibgntfan(); + /* + trimVert.param[0]=v[0]; + trimVert.param[1]=v[1]; + backend->tmeshvert(& trimVert); + */ + backend->tmeshvert(v[0], v[1]); + + if(isIncreasing) { + for(k=i; k<=j; k++) + { + /* + trimVert.param[0]=queue[k][0]; + trimVert.param[1]=queue[k][1]; + backend->tmeshvert(& trimVert); + */ + backend->tmeshvert(queue[k][0], queue[k][1]); + } + } + else { + for(k=j; k>=i; k--) + { + /* + trimVert.param[0]=queue[k][0]; + trimVert.param[1]=queue[k][1]; + backend->tmeshvert(& trimVert); + */ + backend->tmeshvert(queue[k][0], queue[k][1]); + } + } + + backend->endtfan(); + } + + /*delete vertices i+1--j from the queue*/ + index_queue = i+1; + /*finally insert v at the end of the queue*/ + insert(v); + +} + + +void monoTriangulationRec(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, + vertexArray* dec_chain, Int dec_current, + Backend* backend) +{ + assert( inc_chain != NULL && dec_chain != NULL); + assert( ! (inc_current>=inc_chain->getNumElements() && + dec_current>=dec_chain->getNumElements())); + Int inc_nVertices; + Int dec_nVertices; + Real** inc_array ; + Real** dec_array ; + Int i; + assert( ! ( (inc_chain==NULL) && (dec_chain==NULL))); + + if(inc_current>=inc_chain->getNumElements()) /*no more vertices on inc_chain*/ + { + + dec_array = dec_chain->getArray(); + dec_nVertices = dec_chain->getNumElements(); + reflexChain rChain(20,0); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, backend); + /*process all the vertices on the dec_chain*/ + for(i=dec_current; i= dec_chain->getNumElements()) /*no more vertices on dec_chain*/ + { + inc_array = inc_chain->getArray(); + inc_nVertices= inc_chain->getNumElements(); + reflexChain rChain(20,1); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, backend); + /*process all the vertices on the inc_chain*/ + for(i=inc_current; i getArray(); + dec_array = dec_chain -> getArray(); + inc_nVertices= inc_chain->getNumElements(); + dec_nVertices= dec_chain->getNumElements(); + /*if top of inc_chain is 'lower' than top of dec_chain, process all the + *vertices on the dec_chain which are higher than top of inc_chain + */ + if(compV2InY(inc_array[inc_current], dec_array[dec_current]) <= 0) + { + + reflexChain rChain(20, 0); + rChain.processNewVertex(topVertex, backend); + for(i=dec_current; i 0*/ + { + + reflexChain rChain(20, 1); + rChain.processNewVertex(topVertex, backend); + for(i=inc_current; i0) + rChain.processNewVertex(inc_array[i], backend); + else + break; + } + rChain.outputFan(dec_array[dec_current], backend); + monoTriangulationRec(inc_array[i-1], botVertex, + inc_chain, i, + dec_chain, dec_current, + backend); + } + }/*end case neither is empty*/ +} + + +void monoTriangulationFunBackend(Arc_ptr loop, Int (*compFun)(Real*, Real*), Backend* backend) +{ + Int i; + /*find the top vertex, bottom vertex, inccreasing chain, and decreasing chain, + *then call monoTriangulationRec + */ + Arc_ptr tempV; + Arc_ptr topV; + Arc_ptr botV; + topV = botV = loop; + for(tempV = loop->next; tempV != loop; tempV = tempV->next) + { + if(compFun(topV->tail(), tempV->tail())<0) { + topV = tempV; + } + if(compFun(botV->tail(), tempV->tail())>0) { + botV = tempV; + } + } + + /*creat increase and decrease chains*/ + vertexArray inc_chain(20); /*this is a dynamic array*/ + for(i=1; i<=topV->pwlArc->npts-2; i++) { /*the first vertex is the top vertex which doesn't belong to inc_chain*/ + inc_chain.appendVertex(topV->pwlArc->pts[i].param); + } + for(tempV = topV->next; tempV != botV; tempV = tempV->next) + { + for(i=0; i<=tempV->pwlArc->npts-2; i++){ + inc_chain.appendVertex(tempV->pwlArc->pts[i].param); + } + } + + vertexArray dec_chain(20); + for(tempV = topV->prev; tempV != botV; tempV = tempV->prev) + { + for(i=tempV->pwlArc->npts-2; i>=0; i--){ + dec_chain.appendVertex(tempV->pwlArc->pts[i].param); + } + } + for(i=botV->pwlArc->npts-2; i>=1; i--){ + dec_chain.appendVertex(tempV->pwlArc->pts[i].param); + } + + monoTriangulationRecFunBackend(topV->tail(), botV->tail(), &inc_chain, 0, &dec_chain, 0, compFun, backend); + +} + +/*if compFun == compV2InY, top to bottom: V-monotone + *if compFun == compV2InX, right to left: U-monotone + */ +void monoTriangulationRecFunBackend(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, + vertexArray* dec_chain, Int dec_current, + Int (*compFun)(Real*, Real*), + Backend* backend) +{ + assert( inc_chain != NULL && dec_chain != NULL); + assert( ! (inc_current>=inc_chain->getNumElements() && + dec_current>=dec_chain->getNumElements())); + Int inc_nVertices; + Int dec_nVertices; + Real** inc_array ; + Real** dec_array ; + Int i; + assert( ! ( (inc_chain==NULL) && (dec_chain==NULL))); + + if(inc_current>=inc_chain->getNumElements()) /*no more vertices on inc_chain*/ + { + + dec_array = dec_chain->getArray(); + dec_nVertices = dec_chain->getNumElements(); + reflexChain rChain(20,0); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, backend); + /*process all the vertices on the dec_chain*/ + for(i=dec_current; i= dec_chain->getNumElements()) /*no more vertices on dec_chain*/ + { + inc_array = inc_chain->getArray(); + inc_nVertices= inc_chain->getNumElements(); + reflexChain rChain(20,1); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, backend); + /*process all the vertices on the inc_chain*/ + for(i=inc_current; i getArray(); + dec_array = dec_chain -> getArray(); + inc_nVertices= inc_chain->getNumElements(); + dec_nVertices= dec_chain->getNumElements(); + /*if top of inc_chain is 'lower' than top of dec_chain, process all the + *vertices on the dec_chain which are higher than top of inc_chain + */ + if(compFun(inc_array[inc_current], dec_array[dec_current]) <= 0) + { + + reflexChain rChain(20, 0); + rChain.processNewVertex(topVertex, backend); + for(i=dec_current; i 0*/ + { + + reflexChain rChain(20, 1); + rChain.processNewVertex(topVertex, backend); + for(i=inc_current; i0) + rChain.processNewVertex(inc_array[i], backend); + else + break; + } + rChain.outputFan(dec_array[dec_current], backend); + monoTriangulationRecFunBackend(inc_array[i-1], botVertex, + inc_chain, i, + dec_chain, dec_current, + compFun, + backend); + } + }/*end case neither is empty*/ +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/monotonizer.cc b/mesalib/src/glu/sgi/libnurbs/internals/monotonizer.cc new file mode 100644 index 000000000..5845d310b --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/monotonizer.cc @@ -0,0 +1,260 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * monotonizer.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "arc.h" +#include "arctess.h" +#include "bezierarc.h" +#include "bin.h" +#include "mapdesc.h" +#include "nurbsconsts.h" +#include "subdivider.h" + +/*----------------------------------------------------------------------------- + * Subdivider::decompose - break all curves into monotone arcs + *----------------------------------------------------------------------------- + */ +int +Subdivider::decompose( Bin& bin, REAL geo_stepsize ) +{ + Arc_ptr jarc; + for( jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) { + if( ! jarc->isTessellated() ) { + /* points have not been transformed, therefore they may be either + homogeneous or inhomogeneous */ + tessellate( jarc, geo_stepsize ); + if( jarc->isDisconnected() || jarc->next->isDisconnected() ) + return 1; + } + } + + for( jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) { + monotonize( jarc, bin ); + } + +#ifndef NDEBUG + for( jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) { + assert( isMonotone( jarc ) != 0 ); + } +#endif + + return 0; +} + +void +Subdivider::tessellate( Arc_ptr jarc, REAL geo_stepsize ) +{ + BezierArc *b = jarc->bezierArc; + Mapdesc *mapdesc = b->mapdesc; + + if( mapdesc->isRational() ) { + REAL max = mapdesc->calcVelocityRational( b->cpts, b->stride, b->order ); + REAL arc_stepsize = (max > 1.0) ? (1.0/max) : 1.0; + if( jarc->bezierArc->order != 2 ) + arctessellator.tessellateNonlinear( jarc, geo_stepsize, arc_stepsize, 1 ); + else { + arctessellator.tessellateLinear( jarc, geo_stepsize, arc_stepsize, 1 ); + } + } else { + REAL max = mapdesc->calcVelocityNonrational( b->cpts, b->stride, b->order ); + REAL arc_stepsize = (max > 1.0) ? (1.0/max) : 1.0; + if( jarc->bezierArc->order != 2 ) + arctessellator.tessellateNonlinear( jarc, geo_stepsize, arc_stepsize, 0 ); + else { + arctessellator.tessellateLinear( jarc, geo_stepsize, arc_stepsize, 0 ); + } + } +} + +/*------------------------------------------------------------------------- + * Subdivider::monotonize - break up a jordan arc into s,t-monotone + * components. This code will remove degenerate segments, including + * arcs of only a single point. + *------------------------------------------------------------------------- + */ +void +Subdivider::monotonize( Arc_ptr jarc, Bin& bin ) +{ + TrimVertex *firstvert = jarc->pwlArc->pts; + TrimVertex *lastvert = firstvert + (jarc->pwlArc->npts - 1); + long uid = jarc->nuid; + arc_side side = jarc->getside(); + dir sdir = none; + dir tdir = none; + int degenerate = 1; + + int nudegenerate; + int change; + + TrimVertex *vert; + for( vert = firstvert; vert != lastvert; vert++ ) { + + nudegenerate = 1; + change = 0; + + /* check change relative to s axis, clear degenerate bit if needed */ + REAL sdiff = vert[1].param[0] - vert[0].param[0]; + if( sdiff == 0 ) { + if( sdir != same ) { + sdir = same; + change = 1; + } + } else if( sdiff < 0.0 ) { + if( sdir != down ) { + sdir = down; + change = 1; + } + nudegenerate = 0; + } else { + if( sdir != up ) { + sdir = up; + change = 1; + } + nudegenerate = 0; + } + + /* check change relative to t axis, clear degenerate bit if needed */ + REAL tdiff = vert[1].param[1] - vert[0].param[1]; + if( tdiff == 0 ) { + if( tdir != same ) { + tdir = same; + change = 1; + } + } else if( tdiff < 0.0 ) { + if( tdir != down ) { + tdir = down; + change = 1; + } + nudegenerate = 0; + } else { + if( tdir != up ) { + tdir = up; + change = 1; + } + nudegenerate = 0; + } + + if( change ) { + if( ! degenerate ) { + /* make last segment into separate pwl curve */ + jarc->pwlArc->npts = vert - firstvert + 1; + jarc = (new(arcpool) Arc( side, uid ))->append( jarc ); + jarc->pwlArc = new(pwlarcpool) PwlArc(); + bin.addarc( jarc ); + } + firstvert = jarc->pwlArc->pts = vert; + degenerate = nudegenerate; + } + } + jarc->pwlArc->npts = vert - firstvert + 1; + + if( degenerate ) { + /* remove jarc from circularly linked list */ + jarc->prev->next = jarc->next; + jarc->next->prev = jarc->prev; + + assert( jarc->prev->check( ) != 0 ); + assert( jarc->next->check( ) != 0 ); + + /* remove jarc from bin */ + bin.remove_this_arc( jarc ); + + jarc->pwlArc->deleteMe( pwlarcpool ); jarc->pwlArc = 0; + jarc->deleteMe( arcpool ); + } +} + +/*------------------------------------------------------------------------- + * Subdivider::isMonotone - return true if arc is monotone AND non-degenerate + *------------------------------------------------------------------------- + */ +int +Subdivider::isMonotone( Arc_ptr jarc ) +{ + TrimVertex *firstvert = jarc->pwlArc->pts; + TrimVertex *lastvert = firstvert + (jarc->pwlArc->npts - 1); + + if( firstvert == lastvert ) return 1; + + TrimVertex *vert = firstvert; + enum dir sdir; + enum dir tdir; + + REAL diff = vert[1].param[0] - vert[0].param[0]; + if( diff == 0.0 ) + sdir = same; + else if( diff < 0.0 ) + sdir = down; + else + sdir = up; + + diff = vert[1].param[1] - vert[0].param[1]; + if( diff == 0.0 ) + tdir = same; + else if( diff < 0.0 ) + tdir = down; + else + tdir = up; + + if( (sdir == same) && (tdir == same) ) return 0; + + for( ++vert ; vert != lastvert; vert++ ) { + diff = vert[1].param[0] - vert[0].param[0]; + if( diff == 0.0 ) { + if( sdir != same ) return 0; + } else if( diff < 0.0 ) { + if( sdir != down ) return 0; + } else { + if( sdir != up ) return 0; + } + + diff = vert[1].param[1] - vert[0].param[1]; + if( diff == 0.0 ) { + if( tdir != same ) return 0; + } else if( diff < 0.0 ) { + if( tdir != down ) return 0; + } else { + if( tdir != up ) return 0; + } + } + return 1; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/monotonizer.h b/mesalib/src/glu/sgi/libnurbs/internals/monotonizer.h new file mode 100644 index 000000000..e951084ff --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/monotonizer.h @@ -0,0 +1,64 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * monotonizer.h + * + */ + +#ifndef __glumonotonizer_h_ +#define __glumonotonizer_h_ + +#include "mysetjmp.h" +#include "types.h" + +class Arc; +class ArcTessellator; +class Pool; +class Bin; +class PwlArcPool; +class Mapdesc; + +class Monotonizer { + ArcTessellator& arctessellator; + Pool& arcpool; + Pool& pwlarcpool; + jmp_buf& nurbsJmpBuf; + + enum dir { down, same, up, none }; + void tessellate( Arc *, REAL ); + void monotonize( Arc *, Bin & ); + int isMonotone( Arc * ); +public: + Monotonizer( ArcTessellator& at, Pool& ap, Pool& p, jmp_buf& j ) + : arctessellator(at), arcpool(ap), pwlarcpool(p), nurbsJmpBuf(j) {} + int decompose( Bin &, REAL ); +}; +#endif /* __glumonotonizer_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/myassert.h b/mesalib/src/glu/sgi/libnurbs/internals/myassert.h new file mode 100644 index 000000000..cbd6006f5 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/myassert.h @@ -0,0 +1,51 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * myassert.h + * + */ + +#ifndef __glumyassert_h_ +#define __glumyassert_h_ + +#ifdef STANDALONE +#define assert(EX) ((void)0) +#endif + +#ifdef LIBRARYBUILD +#include +#endif + +#ifdef GLBUILD +#define assert(EX) ((void)0) +#endif + +#endif /* __glumyassert_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/mycode.cc b/mesalib/src/glu/sgi/libnurbs/internals/mycode.cc new file mode 100644 index 000000000..3625cacd7 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/mycode.cc @@ -0,0 +1,67 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "mymath.h" + +#ifdef NEEDCEILF + +float ceilf( float x ) +{ + if( x < 0 ) { + float nx = -x; + int ix = (int) nx; + return (float) -ix; + } else { + int ix = (int) x; + if( x == (float) ix ) return x; + return (float) (ix+1); + } +} + +float floorf( float x ) +{ + if( x < 0 ) { + float nx = -x; + int ix = (int) nx; + if( nx == (float) ix ) return x; + return (float) -(ix+1); + } else { + int ix = (int) x; + return (float) ix; + } +} +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/internals/mymath.h b/mesalib/src/glu/sgi/libnurbs/internals/mymath.h new file mode 100644 index 000000000..17ef7237f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/mymath.h @@ -0,0 +1,68 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * mymath.h + * + */ + +#ifndef __glumymath_h_ +#define __glumymath_h_ + +#ifdef GLBUILD +#define sqrtf gl_fsqrt +#endif + +#if defined(GLBUILD) || defined(STANDALONE) +#define M_SQRT2 1.41421356237309504880 +#define ceilf myceilf +#define floorf myfloorf +#define sqrtf sqrt +extern "C" double sqrt(double); +extern "C" float ceilf(float); +extern "C" float floorf(float); +#define NEEDCEILF +#endif + +#ifdef LIBRARYBUILD +#include +#endif + +#if !defined sqrtf +# define sqrtf(x) ((float)sqrt(x)) +#endif +#if !defined ceilf +# define ceilf(x) ((float)ceil(x)) +#endif +#if !defined floorf +# define floorf(x) ((float)floor(x)) +#endif + +#endif /* __glumymath_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/mysetjmp.h b/mesalib/src/glu/sgi/libnurbs/internals/mysetjmp.h new file mode 100644 index 000000000..2a3f6a87b --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/mysetjmp.h @@ -0,0 +1,85 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * mysetjmp.h + * + */ + +#ifndef __glumysetjmp_h_ +#define __glumysetjmp_h_ + +#ifdef STANDALONE +struct JumpBuffer; +extern "C" JumpBuffer *newJumpbuffer( void ); +extern "C" void deleteJumpbuffer(JumpBuffer *); +extern "C" void mylongjmp( JumpBuffer *, int ); +extern "C" int mysetjmp( JumpBuffer * ); +#endif + +#ifdef GLBUILD +#define setjmp gl_setjmp +#define longjmp gl_longjmp +#endif + +#if defined(LIBRARYBUILD) || defined(GLBUILD) +#include +#include + +struct JumpBuffer { + jmp_buf buf; +}; + +inline JumpBuffer * +newJumpbuffer( void ) +{ + return (JumpBuffer *) malloc( sizeof( JumpBuffer ) ); +} + +inline void +deleteJumpbuffer(JumpBuffer *jb) +{ + free( (void *) jb); +} + +inline void +mylongjmp( JumpBuffer *j, int code ) +{ + ::longjmp( j->buf, code ); +} + +inline int +mysetjmp( JumpBuffer *j ) +{ + return setjmp( j->buf ); +} +#endif + +#endif /* __glumysetjmp_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/mystring.h b/mesalib/src/glu/sgi/libnurbs/internals/mystring.h new file mode 100644 index 000000000..d2952da89 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/mystring.h @@ -0,0 +1,56 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * mystring.h + * + */ + +#ifndef __glumystring_h_ +#define __glumystring_h_ + +#ifdef STANDALONE +typedef unsigned int size_t; +extern "C" void * memcpy(void *, const void *, size_t); +extern "C" void * memset(void *, int, size_t); +#endif + +#ifdef GLBUILD +#define memcpy(a,b,c) bcopy(b,a,c) +#define memset(a,b,c) bzero(a,c) +extern "C" void bcopy(const void *, void *, int); +extern "C" void bzero(void *, int); +#endif + +#ifdef LIBRARYBUILD +#include +#endif + +#endif /* __glumystring_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/nurbsconsts.h b/mesalib/src/glu/sgi/libnurbs/internals/nurbsconsts.h new file mode 100644 index 000000000..acc5d7f31 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/nurbsconsts.h @@ -0,0 +1,120 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * nurbsconsts.h + * + */ + +#ifndef __glunurbsconsts_h_ +#define __glunurbsconsts_h_ + +/* NURBS Properties - one set per map, + each takes a single INREAL arg */ +#define N_SAMPLING_TOLERANCE 1 +#define N_S_RATE 6 +#define N_T_RATE 7 +#define N_CLAMPFACTOR 13 +#define N_NOCLAMPING 0.0 +#define N_MINSAVINGS 14 +#define N_NOSAVINGSSUBDIVISION 0.0 + +/* NURBS Properties - one set per map, + each takes an enumerated value */ +#define N_CULLING 2 +#define N_NOCULLING 0.0 +#define N_CULLINGON 1.0 +#define N_SAMPLINGMETHOD 10 +#define N_NOSAMPLING 0.0 +#define N_FIXEDRATE 3.0 +#define N_DOMAINDISTANCE 2.0 +#define N_PARAMETRICDISTANCE 5.0 +#define N_PATHLENGTH 6.0 +#define N_SURFACEAREA 7.0 +#define N_OBJECTSPACE_PARA 8.0 +#define N_OBJECTSPACE_PATH 9.0 +#define N_BBOX_SUBDIVIDING 17 +#define N_NOBBOXSUBDIVISION 0.0 +#define N_BBOXTIGHT 1.0 +#define N_BBOXROUND 2.0 + +/* NURBS Rendering Properties - one set per renderer + each takes an enumerated value */ +#define N_DISPLAY 3 +#define N_FILL 1.0 +#define N_OUTLINE_POLY 2.0 +#define N_OUTLINE_TRI 3.0 +#define N_OUTLINE_QUAD 4.0 +#define N_OUTLINE_PATCH 5.0 +#define N_OUTLINE_PARAM 6.0 +#define N_OUTLINE_PARAM_S 7.0 +#define N_OUTLINE_PARAM_ST 8.0 +#define N_OUTLINE_SUBDIV 9.0 +#define N_OUTLINE_SUBDIV_S 10.0 +#define N_OUTLINE_SUBDIV_ST 11.0 +#define N_ISOLINE_S 12.0 +#define N_ERRORCHECKING 4 +#define N_NOMSG 0.0 +#define N_MSG 1.0 + +/* GL 4.0 propeties not defined above */ +#ifndef N_PIXEL_TOLERANCE +#define N_PIXEL_TOLERANCE N_SAMPLING_TOLERANCE +#define N_ERROR_TOLERANCE 20 +#define N_SUBDIVISIONS 5 +#define N_TILES 8 +#define N_TMP1 9 +#define N_TMP2 N_SAMPLINGMETHOD +#define N_TMP3 11 +#define N_TMP4 12 +#define N_TMP5 N_CLAMPFACTOR +#define N_TMP6 N_MINSAVINGS +#define N_S_STEPS N_S_RATE +#define N_T_STEPS N_T_RATE +#endif + +/* NURBS Rendering Properties - one set per map, + each takes an INREAL matrix argument */ +#define N_CULLINGMATRIX 1 +#define N_SAMPLINGMATRIX 2 +#define N_BBOXMATRIX 3 + + +/* NURBS Rendering Properties - one set per map, + each takes an INREAL vector argument */ +#define N_BBOXSIZE 4 + +/* type argument for trimming curves */ +#ifndef N_P2D +#define N_P2D 0x8 +#define N_P2DR 0xd +#endif + +#endif /* __glunurbsconsts_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc b/mesalib/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc new file mode 100644 index 000000000..520bd419e --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/nurbsinterfac.cc @@ -0,0 +1,537 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * nurbsinterfac.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "nurbsconsts.h" +#include "nurbstess.h" +#include "bufpool.h" +#include "quilt.h" +#include "displaylist.h" +#include "knotvector.h" +#include "mapdesc.h" + +#define THREAD( work, arg, cleanup ) \ + if( dl ) {\ + arg->save = 1;\ + dl->append( (PFVS)&NurbsTessellator::work, (void *) arg, (PFVS)&NurbsTessellator::cleanup );\ + } else {\ + arg->save = 0;\ + work( arg );\ + } + +#define THREAD2( work ) \ + if( dl ) {\ + dl->append( (PFVS)&NurbsTessellator::work, 0, 0 );\ + } else {\ + work( );\ + } + +NurbsTessellator::NurbsTessellator( BasicCurveEvaluator &c, BasicSurfaceEvaluator& e) + : maplist( backend ), + backend( c, e ), + subdivider( renderhints, backend ), + o_pwlcurvePool( sizeof( O_pwlcurve ), 32, "o_pwlcurvePool" ), + o_nurbscurvePool( sizeof( O_nurbscurve ), 32, "o_nurbscurvePool"), + o_curvePool( sizeof( O_curve ), 32, "o_curvePool" ), + o_trimPool( sizeof( O_trim ), 32, "o_trimPool" ), + o_surfacePool( sizeof( O_surface ), 1, "o_surfacePool" ), + o_nurbssurfacePool( sizeof( O_nurbssurface ), 4, "o_nurbssurfacePool" ), + propertyPool( sizeof( Property ), 32, "propertyPool" ), + quiltPool( sizeof( Quilt ), 32, "quiltPool" ) +{ + dl = 0; + inSurface = 0; + inCurve = 0; + inTrim = 0; + playBack = 0; + jumpbuffer = newJumpbuffer(); + subdivider.setJumpbuffer( jumpbuffer ); +} + +NurbsTessellator::~NurbsTessellator( void ) +{ + if( inTrim ) { + do_nurbserror( 12 ); + endtrim(); + } + + if( inSurface ) { + *nextNurbssurface = 0; + do_freeall(); + } + + if (jumpbuffer) { + deleteJumpbuffer(jumpbuffer); + jumpbuffer= 0; + } +} + +/*----------------------------------------------------------------------------- + * bgnsurface - allocate and initialize an o_surface structure + * + * Client: GL user + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::bgnsurface( long nuid ) +{ + O_surface *o_surface = new(o_surfacePool) O_surface; + o_surface->nuid = nuid; + THREAD( do_bgnsurface, o_surface, do_freebgnsurface ); +} + +/*----------------------------------------------------------------------------- + * bgncurve - allocate an initialize an o_curve structure + * + * Client: GL user + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::bgncurve( long nuid ) +{ + O_curve *o_curve = new(o_curvePool) O_curve; + o_curve->nuid = nuid; + THREAD( do_bgncurve, o_curve, do_freebgncurve ); +} +/*----------------------------------------------------------------------------- + * endcurve - + * + * Client: + *----------------------------------------------------------------------------- + */ + +void +NurbsTessellator::endcurve( void ) +{ + THREAD2( do_endcurve ); +} + +/*----------------------------------------------------------------------------- + * endsurface - user level end of surface call + * + * Client: GL user + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::endsurface( void ) +{ + THREAD2( do_endsurface ); +} + + +/*----------------------------------------------------------------------------- + * bgntrim - allocate and initialize a new trim loop structure (o_trim ) + * + * Client: GL user + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::bgntrim( void ) +{ + O_trim *o_trim = new(o_trimPool) O_trim; + THREAD( do_bgntrim, o_trim, do_freebgntrim ); +} + +/*----------------------------------------------------------------------------- + * endtrim - + * + * Client: GL user + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::endtrim( void ) +{ + THREAD2( do_endtrim ); +} + + +/*----------------------------------------------------------------------------- + * pwlcurve - + * + * count - number of points on curve + * array - array of points on curve + * byte_stride - distance between points in bytes + * type - valid data flag + * + * Client: Gl user + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::pwlcurve( long count, INREAL array[], long byte_stride, long type ) +{ + Mapdesc *mapdesc = maplist.locate( type ); + + if( mapdesc == 0 ) { + do_nurbserror( 35 ); + isDataValid = 0; + return; + } + + if ( (type != N_P2D) && (type != N_P2DR) ) { + do_nurbserror( 22 ); + isDataValid = 0; + return; + } + if( count < 0 ) { + do_nurbserror( 33 ); + isDataValid = 0; + return; + } + if( byte_stride < 0 ) { + do_nurbserror( 34 ); + isDataValid = 0; + return; + } + +#ifdef NOTDEF + if( mapdesc->isRational() ) { + INREAL *p = array; + INREAL x = p[0]; INREAL y = p[1]; INREAL w = p[2]; + p = (INREAL *) (((char *) p) + byte_stride); + for( long i = 1; i != count; i++ ) { + if( p[0] == x && p[1] == y && p[2] == w ) break; + x = p[0]; y = p[1]; w = p[2]; + p = (INREAL *) (((char *) p) + byte_stride); + } + if( i != count ) { + do_nurbserror( 37 ); + _glu_dprintf( "point %d (%f,%f)\n", i, x, y ); + isDataValid = 0; + return; + } + } else { + INREAL *p = array; + INREAL x = p[0]; INREAL y = p[1]; + p = (INREAL *) (((char *) p) + byte_stride); + for( long i = 1; i != count; i++ ) { + if( p[0] == x && p[1] == y ) break; + x = p[0]; y = p[1]; + p = (INREAL *) (((char *) p) + byte_stride); + } + if( i != count ) { + do_nurbserror( 37 ); + _glu_dprintf( "point %d (%f,%f)\n", i, x, y ); + isDataValid = 0; + return; + } + } +#endif + + O_pwlcurve *o_pwlcurve = new(o_pwlcurvePool) O_pwlcurve( type, count, array, byte_stride, extTrimVertexPool.get((int)count) ); + THREAD( do_pwlcurve, o_pwlcurve, do_freepwlcurve ); +} + + +/*----------------------------------------------------------------------------- + * nurbscurve - + * + * Client: GL user + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::nurbscurve( + long nknots, /* number of p knots */ + INREAL knot[], /* nondecreasing knot values in p */ + long byte_stride, /* distance in bytes between control points */ + INREAL ctlarray[], /* pointer to first control point */ + long order, /* order of spline */ + long type ) /* description of range space */ +{ + + Mapdesc *mapdesc = maplist.locate( type ); + + if( mapdesc == 0 ) { + do_nurbserror( 35 ); + isDataValid = 0; + return; + } + + if( ctlarray == 0 ) { + do_nurbserror( 36 ); + isDataValid = 0; + return; + } + + if( byte_stride < 0 ) { + do_nurbserror( 34 ); + isDataValid = 0; + return; + } + + Knotvector knots; + + knots.init( nknots, byte_stride, order, knot ); + if( do_check_knots( &knots, "curve" ) ) return; + + O_nurbscurve *o_nurbscurve = new(o_nurbscurvePool) O_nurbscurve(type); + o_nurbscurve->bezier_curves = new(quiltPool) Quilt(mapdesc); + o_nurbscurve->bezier_curves->toBezier( knots,ctlarray, mapdesc->getNcoords() ); + + THREAD( do_nurbscurve, o_nurbscurve, do_freenurbscurve ); +} + + +/*----------------------------------------------------------------------------- + * nurbssurface - + * + * Client: User routine + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::nurbssurface( + long sknot_count, /* number of s knots */ + INREAL sknot[], /* nondecreasing knot values in s */ + long tknot_count, /* number of t knots */ + INREAL tknot[], /* nondecreasing knot values in t */ + long s_byte_stride, /* s step size in memory bytes */ + long t_byte_stride, /* t step size in memory bytes */ + INREAL ctlarray[], /* pointer to first control point */ + long sorder, /* order of the spline in s parameter */ + long torder, /* order of the spline in t parameter */ + long type) /* description of range space */ +{ + Mapdesc *mapdesc = maplist.locate( type ); + + if( mapdesc == 0 ) { + do_nurbserror( 35 ); + isDataValid = 0; + return; + } + + if( s_byte_stride < 0 ) { + do_nurbserror( 34 ); + isDataValid = 0; + return; + } + + if( t_byte_stride < 0 ) { + do_nurbserror( 34 ); + isDataValid = 0; + return; + } + + Knotvector sknotvector, tknotvector; + + sknotvector.init( sknot_count, s_byte_stride, sorder, sknot ); + if( do_check_knots( &sknotvector, "surface" ) ) return; + + tknotvector.init( tknot_count, t_byte_stride, torder, tknot ); + if( do_check_knots( &tknotvector, "surface" ) ) return; + + O_nurbssurface *o_nurbssurface = new(o_nurbssurfacePool) O_nurbssurface(type); + o_nurbssurface->bezier_patches = new(quiltPool) Quilt(mapdesc); + + o_nurbssurface->bezier_patches->toBezier( sknotvector, tknotvector, + ctlarray, mapdesc->getNcoords() ); + THREAD( do_nurbssurface, o_nurbssurface, do_freenurbssurface ); +} + + +/*----------------------------------------------------------------------------- + * setnurbsproperty - + * + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::setnurbsproperty( long tag, INREAL value ) +{ + if( ! renderhints.isProperty( tag ) ) { + do_nurbserror( 26 ); + } else { + Property *prop = new(propertyPool) Property( tag, value ); + THREAD( do_setnurbsproperty, prop, do_freenurbsproperty ); + } +} + +/*----------------------------------------------------------------------------- + * setnurbsproperty - + * + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::setnurbsproperty( long type, long tag, INREAL value ) +{ + Mapdesc *mapdesc = maplist.locate( type ); + + if( mapdesc == 0 ) { + do_nurbserror( 35 ); + return; + } + + if( ! mapdesc->isProperty( tag ) ) { + do_nurbserror( 26 ); + return; + } + + Property *prop = new(propertyPool) Property( type, tag, value ); + THREAD( do_setnurbsproperty2, prop, do_freenurbsproperty ); +} + + +/*----------------------------------------------------------------------------- + * getnurbsproperty - + * + *----------------------------------------------------------------------------- + */ + +void +NurbsTessellator::getnurbsproperty( long tag, INREAL *value ) +{ + if( renderhints.isProperty( tag ) ) { + *value = renderhints.getProperty( tag ); + } else { + do_nurbserror( 26 ); + } +} + +/*----------------------------------------------------------------------------- + * getnurbsproperty - + * + *----------------------------------------------------------------------------- + */ + +void +NurbsTessellator::getnurbsproperty( long type, long tag, INREAL *value ) +{ + Mapdesc *mapdesc = maplist.locate( type ); + + if( mapdesc == 0 ) + do_nurbserror( 35 ); + + if( mapdesc->isProperty( tag ) ) { + *value = mapdesc->getProperty( tag ); + } else { + do_nurbserror( 26 ); + } +} + +/*-------------------------------------------------------------------------- + * setnurbsproperty - accept a user supplied matrix as culling or sampling mat + *-------------------------------------------------------------------------- + */ + +void +NurbsTessellator::setnurbsproperty( long type, long purpose, INREAL *mat ) +{ + // XXX - cannot be put in display list + Mapdesc *mapdesc = maplist.locate( type ); + + if( mapdesc == 0 ) { + do_nurbserror( 35 ); + isDataValid = 0; + } else if( purpose == N_BBOXSIZE ) { + mapdesc->setBboxsize( mat ); + } else { +#ifndef NDEBUG + _glu_dprintf( "ERRORRORRORR!!!\n"); +#endif + } +} + +/*-------------------------------------------------------------------------- + * setnurbsproperty - accept a user supplied matrix as culling or sampling mat + *-------------------------------------------------------------------------- + */ + +void +NurbsTessellator::setnurbsproperty( long type, long purpose, INREAL *mat, + long rstride, long cstride ) +{ + // XXX - cannot be put in display list + Mapdesc *mapdesc = maplist.locate( type ); + + if( mapdesc == 0 ) { + do_nurbserror( 35 ); + isDataValid = 0; + } else if( purpose == N_CULLINGMATRIX ) { + mapdesc->setCmat( mat, rstride, cstride ); + } else if( purpose == N_SAMPLINGMATRIX ) { + mapdesc->setSmat( mat, rstride, cstride ); + } else if( purpose == N_BBOXMATRIX ) { + mapdesc->setBmat( mat, rstride, cstride ); + } else { +#ifndef NDEBUG + _glu_dprintf( "ERRORRORRORR!!!\n"); +#endif + } +} + +void +NurbsTessellator::redefineMaps( void ) +{ + maplist.initialize(); +} + +void +NurbsTessellator::defineMap( long type, long rational, long ncoords ) +{ + maplist.define( type, (int) rational, (int) ncoords ); +} + +void +NurbsTessellator::discardRecording( void *_dl ) +{ + delete (DisplayList *) _dl; +} + +void * +NurbsTessellator::beginRecording( void ) +{ + dl = new DisplayList( this ); + return (void *) dl; +} + +void +NurbsTessellator::endRecording( void ) +{ + dl->endList(); + dl = 0; +} + +void +NurbsTessellator::playRecording( void *_dl ) +{ + playBack = 1; + bgnrender(); + ((DisplayList *)_dl)->play(); + endrender(); + playBack = 0; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.cc b/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.cc new file mode 100644 index 000000000..68dfd95f3 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.cc @@ -0,0 +1,691 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * nurbstess.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mysetjmp.h" +#include "mystdio.h" +#include "nurbsconsts.h" +#include "nurbstess.h" +#include "bufpool.h" +#include "quilt.h" +#include "knotvector.h" +#include "mapdesc.h" +#include "maplist.h" + +void +NurbsTessellator::set_domain_distance_u_rate(REAL u_rate) +{ + subdivider.set_domain_distance_u_rate(u_rate); +} + +void +NurbsTessellator::set_domain_distance_v_rate(REAL v_rate) +{ + subdivider.set_domain_distance_v_rate(v_rate); +} + +void +NurbsTessellator::set_is_domain_distance_sampling(int flag) +{ + subdivider.set_is_domain_distance_sampling(flag); +} + +void +NurbsTessellator::resetObjects( void ) +{ + subdivider.clear(); +} + +void +NurbsTessellator::makeobj( int ) +{ +#ifndef NDEBUG + _glu_dprintf( "makeobj\n" ); +#endif +} + +void +NurbsTessellator::closeobj( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "closeobj\n" ); +#endif +} + +void +NurbsTessellator::bgnrender( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "bgnrender\n" ); +#endif +} + +void +NurbsTessellator::endrender( void ) +{ +#ifndef NDEBUG + _glu_dprintf( "endrender\n" ); +#endif +} + +/*----------------------------------------------------------------------------- + * do_freebgnsurface - free o_surface structure + * + * Client: do_freeall(), bgnsurface() + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_freebgnsurface( O_surface *o_surface ) +{ + o_surface->deleteMe( o_surfacePool ); +} + + +/*----------------------------------------------------------------------------- + * do_bgnsurface - begin the display of a surface + * + * Client: bgnsurface() + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_bgnsurface( O_surface *o_surface ) +{ + if( inSurface ) { + do_nurbserror( 27 ); + endsurface(); + } + inSurface = 1; + + if( ! playBack ) bgnrender(); + + isTrimModified = 0; + isSurfaceModified = 0; + isDataValid = 1; + numTrims = 0; + currentSurface = o_surface; + nextTrim = &( currentSurface->o_trim ); + nextNurbssurface = &( currentSurface->o_nurbssurface ); +} + +/*----------------------------------------------------------------------------- + * do_bgncurve - begin the display of a curve + * + * Client: bgncurve() + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_bgncurve( O_curve *o_curve ) +{ + if ( inCurve ) { + do_nurbserror( 6 ); + endcurve(); + } + + inCurve = 1; + currentCurve = o_curve; + currentCurve->curvetype = ct_none; + + if( inTrim ) { + if( *nextCurve != o_curve ) { + isCurveModified = 1; + *nextCurve = o_curve; + } + } else { + if( ! playBack ) bgnrender(); + isDataValid = 1; + } + nextCurve = &(o_curve->next); + nextPwlcurve = &(o_curve->curve.o_pwlcurve); + nextNurbscurve = &(o_curve->curve.o_nurbscurve); +} + +/*----------------------------------------------------------------------------- + * do_endcurve - + * + * Client: endcurve() + *----------------------------------------------------------------------------- + */ + +void +NurbsTessellator::do_endcurve( void ) +{ + if( ! inCurve ) { + do_nurbserror( 7 ); + return; + } + inCurve = 0; + + *nextCurve = 0; + if (currentCurve->curvetype == ct_nurbscurve) + *nextNurbscurve = 0; + else + *nextPwlcurve = 0; + + if ( ! inTrim ) { + if( ! isDataValid ) { + do_freecurveall( currentCurve ); + return; + } + + int errval; + errval = ::mysetjmp( jumpbuffer ); + if( errval == 0 ) { + if( currentCurve->curvetype == ct_nurbscurve ) { + subdivider.beginQuilts(); + for( O_nurbscurve *n = currentCurve->curve.o_nurbscurve; n != 0; n = n->next ) + subdivider.addQuilt( n->bezier_curves ); + subdivider.endQuilts(); + subdivider.drawCurves(); + if( ! playBack ) endrender(); + } else { + /* XXX */ + if( ! playBack ) endrender(); + /*do_draw_pwlcurve( currentCurve->curve.o_pwlcurve ) */; + do_nurbserror( 9 ); + } + } else { + if( ! playBack ) endrender(); + do_nurbserror( errval ); + } + do_freecurveall( currentCurve ); + resetObjects(); + } +} + +/*----------------------------------------------------------------------------- + * do_endsurface - mark end of surface, display surface, free immediate data + * + * Client: + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_endsurface( void ) +{ + if( inTrim ) { + do_nurbserror( 12 ); + endtrim(); + } + + if( ! inSurface ) { + do_nurbserror( 13 ); + return; + } + inSurface = 0; + + *nextNurbssurface = 0; + + if( ! isDataValid ) { + do_freeall( ); + return; + } + + if( *nextTrim != 0 ) { + isTrimModified = 1; + *nextTrim = 0; + } + + int errval; + + errval = ::mysetjmp( jumpbuffer ); + if( errval == 0 ) { + if( numTrims > 0 ) { + + subdivider.beginTrims(); + for( O_trim *trim = currentSurface->o_trim; trim; trim = trim->next ) { + subdivider.beginLoop(); + for( O_curve *curve = trim->o_curve; curve; curve = curve->next ) { + curve->used = 0; + assert( curve->curvetype != ct_none ); + if (curve->curvetype == ct_pwlcurve) { + O_pwlcurve *c = curve->curve.o_pwlcurve; + subdivider.addArc( c->npts, c->pts, curve->nuid ); + } else { + Quilt *quilt = curve->curve.o_nurbscurve->bezier_curves; + Quiltspec *qspec = quilt->qspec; + REAL *cpts = quilt->cpts + qspec->offset; + REAL *cptsend = cpts + (qspec->width * qspec->order * qspec->stride); + for( ; cpts != cptsend; cpts += qspec->order*qspec->stride ) + subdivider.addArc( cpts, quilt, curve->nuid ); + } + } + subdivider.endLoop(); + } + subdivider.endTrims(); + } + + subdivider.beginQuilts(); + for( O_nurbssurface *n = currentSurface->o_nurbssurface; n; n = n->next ) + subdivider.addQuilt( n->bezier_patches ); + subdivider.endQuilts(); + subdivider.drawSurfaces( currentSurface->nuid ); + if( ! playBack ) endrender(); + } else { + if( ! playBack ) endrender(); + do_nurbserror( errval ); + } + + do_freeall( ); + resetObjects(); +} + +/*----------------------------------------------------------------------------- + * do_freeall - free all data allocated in immediate mode + * + * Client: + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_freeall( void ) +{ + for( O_trim *o_trim = currentSurface->o_trim; o_trim; ) { + O_trim *next_o_trim = o_trim->next; + for( O_curve *curve = o_trim->o_curve; curve; ) { + O_curve *next_o_curve = curve->next; + do_freecurveall( curve ); + curve = next_o_curve; + } + if( o_trim->save == 0 ) do_freebgntrim( o_trim ); + o_trim = next_o_trim; + } + + O_nurbssurface *nurbss, *next_nurbss; + for( nurbss= currentSurface->o_nurbssurface; nurbss; nurbss = next_nurbss) { + next_nurbss = nurbss->next; + if( nurbss->save == 0 ) + do_freenurbssurface( nurbss ); + else + nurbss->used = 0; + } + + if( currentSurface->save == 0 ) do_freebgnsurface( currentSurface ); +} + +void +NurbsTessellator::do_freecurveall( O_curve *curve ) +{ + assert( curve->curvetype != ct_none ); + + if( curve->curvetype == ct_nurbscurve ) { + O_nurbscurve *ncurve, *next_ncurve; + for( ncurve=curve->curve.o_nurbscurve; ncurve; ncurve=next_ncurve ) { + next_ncurve = ncurve->next; + if( ncurve->save == 0 ) + do_freenurbscurve( ncurve ); + else + ncurve->used = 0; + } + } else { + O_pwlcurve *pcurve, *next_pcurve; + for( pcurve=curve->curve.o_pwlcurve; pcurve; pcurve=next_pcurve ) { + next_pcurve = pcurve->next; + if( pcurve->save == 0 ) + do_freepwlcurve( pcurve ); + else + pcurve->used = 0; + } + } + if( curve->save == 0 ) + do_freebgncurve( curve ); +} + + +/*----------------------------------------------------------------------------- + * do_freebgntrim - free the space allocated for a trim loop + * + * Client: + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_freebgntrim( O_trim *o_trim ) +{ + o_trim->deleteMe( o_trimPool ); +} + + +/*----------------------------------------------------------------------------- + * do_bgntrim - link in a trim loop to the current trimmed surface description + * + * Client: bgntrim() + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_bgntrim( O_trim *o_trim ) +{ + + if( ! inSurface ) { + do_nurbserror( 15 ); + bgnsurface( 0 ); + inSurface = 2; + } + + if( inTrim ) { + do_nurbserror( 16 ); + endtrim(); + } + inTrim = 1; + + if( *nextTrim != o_trim ) { + isTrimModified = 1; + *nextTrim = o_trim; + } + + currentTrim = o_trim; + nextTrim = &(o_trim->next); + nextCurve = &(o_trim->o_curve); +} + + +/*----------------------------------------------------------------------------- + * do_endtrim - mark the end of the current trim loop + * + * Client: endtrim() + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_endtrim( void ) +{ + if( ! inTrim ) { + do_nurbserror( 17 ); + return; + } + inTrim = 0; + + if( currentTrim->o_curve == 0 ) { + do_nurbserror( 18 ); + isDataValid = 0; + } + + numTrims++; + + if( *nextCurve != 0 ) { + isTrimModified = 1; + *nextCurve = 0; + } +} + +/*----------------------------------------------------------------------------- + * do_freepwlcurve - + * + * Client: + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_freepwlcurve( O_pwlcurve *o_pwlcurve ) +{ + o_pwlcurve->deleteMe( o_pwlcurvePool ); +} + +void +NurbsTessellator::do_freebgncurve( O_curve *o_curve ) +{ + o_curve->deleteMe( o_curvePool ); +} + +/*----------------------------------------------------------------------------- + * do_pwlcurve - link in pwl trim loop to the current surface description + * + * Client: pwlcurve() + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_pwlcurve( O_pwlcurve *o_pwlcurve ) +{ + if( ! inTrim ) { + do_nurbserror( 19 ); + if( o_pwlcurve->save == 0 ) + do_freepwlcurve(o_pwlcurve ); + return; + } + + if( ! inCurve ) { + bgncurve( 0 ); + inCurve = 2; + } + + if( o_pwlcurve->used ) { + do_nurbserror( 20 ); + isDataValid = 0; + return; + } else + o_pwlcurve->used = 1; + + if( currentCurve->curvetype == ct_none ) { + currentCurve->curvetype = ct_pwlcurve; + } else if( currentCurve->curvetype != ct_pwlcurve ) { + do_nurbserror( 21 ); + isDataValid = 0; + return; + } + + if( *nextPwlcurve != o_pwlcurve ) { + isCurveModified = 1; + *nextPwlcurve = o_pwlcurve; + } + nextPwlcurve = &(o_pwlcurve->next); + + if( o_pwlcurve->owner != currentCurve ) { + isCurveModified = 1; + o_pwlcurve->owner = currentCurve; + } + + if( (inCurve == 2) ) + endcurve(); +} + + +/*----------------------------------------------------------------------------- + * do_freenurbscurve - + * + * Client: + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_freenurbscurve( O_nurbscurve *o_nurbscurve ) +{ + o_nurbscurve->bezier_curves->deleteMe( quiltPool ); + o_nurbscurve->deleteMe( o_nurbscurvePool ); +} + + +/*----------------------------------------------------------------------------- + * do_nurbscurve - + * + * Client: nurbscurve() + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_nurbscurve( O_nurbscurve *o_nurbscurve ) +{ + if ( ! inCurve ) { + bgncurve( 0 ); + inCurve = 2; + } + + if( o_nurbscurve->used ) { + /* error - curve was already called in current surface */ + do_nurbserror( 23 ); + isDataValid = 0; + return; + } else + o_nurbscurve->used = 1; + + if( currentCurve->curvetype == ct_none ) { + currentCurve->curvetype = ct_nurbscurve; + } else if( currentCurve->curvetype != ct_nurbscurve ) { + do_nurbserror( 24 ); + isDataValid = 0; + return; + } + + if( *nextNurbscurve != o_nurbscurve ) { + isCurveModified = 1; + *nextNurbscurve = o_nurbscurve; + } + + nextNurbscurve = &(o_nurbscurve->next); + + if( o_nurbscurve->owner != currentCurve ) { + isCurveModified = 1; + o_nurbscurve->owner = currentCurve; + } + + if( o_nurbscurve->owner == 0 ) + isCurveModified = 1; + + if( inCurve == 2 ) + endcurve(); +} + + +/*----------------------------------------------------------------------------- + * do_freenurbssurface - + * + * Client: + *----------------------------------------------------------------------------- + */ + +void +NurbsTessellator::do_freenurbssurface( O_nurbssurface *o_nurbssurface ) +{ + o_nurbssurface->bezier_patches->deleteMe( quiltPool ); + o_nurbssurface->deleteMe( o_nurbssurfacePool ); +} + +/*----------------------------------------------------------------------------- + * do_nurbssurface - + * + * Client: nurbssurface() + *----------------------------------------------------------------------------- + */ +void +NurbsTessellator::do_nurbssurface( O_nurbssurface *o_nurbssurface ) +{ + if( ! inSurface ) { + bgnsurface( 0 ); + inSurface = 2; + } + + if( o_nurbssurface->used ) { + /* error - surface was already called in current block */ + do_nurbserror( 25 ); + isDataValid = 0; + return; + } else + o_nurbssurface->used = 1; + + if( *nextNurbssurface != o_nurbssurface ) { + isSurfaceModified = 1; + *nextNurbssurface = o_nurbssurface; + } + + if( o_nurbssurface->owner != currentSurface ) { + isSurfaceModified = 1; + o_nurbssurface->owner = currentSurface; + } + nextNurbssurface = &(o_nurbssurface->next); + + if( inSurface == 2 ) + endsurface(); +} + + +/*----------------------------------------------------------------------------- + * do_freenurbsproperty + * + *----------------------------------------------------------------------------- + */ + +void +NurbsTessellator::do_freenurbsproperty( Property *prop ) +{ + prop->deleteMe( propertyPool ); +} + + +/*----------------------------------------------------------------------------- + * do_setnurbsproperty - + * + *----------------------------------------------------------------------------- + */ + +void +NurbsTessellator::do_setnurbsproperty( Property *prop ) +{ + renderhints.setProperty( prop->tag, prop->value ); + if( prop->save == 0 ) + do_freenurbsproperty( prop ); +} + +void +NurbsTessellator::do_setnurbsproperty2( Property *prop ) +{ + Mapdesc *mapdesc = maplist.find( prop->type ); + + mapdesc->setProperty( prop->tag, prop->value ); + if( prop->save == 0 ) + do_freenurbsproperty( prop ); +} + +void +NurbsTessellator::errorHandler( int ) +{ +} + +void +NurbsTessellator::do_nurbserror( int msg ) +{ + errorHandler( msg ); +} + +int +NurbsTessellator::do_check_knots( Knotvector *knots, const char *msg ) +{ + int status = knots->validate(); + if( status ) { + do_nurbserror( status ); + if( renderhints.errorchecking != N_NOMSG ) knots->show( msg ); + } + return status; +} + + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.h b/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.h new file mode 100644 index 000000000..a6869002f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/nurbstess.h @@ -0,0 +1,172 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * nurbstess.h + * + */ + +#ifndef __glunurbstess_h_ +#define __glunurbstess_h_ + +#include "mysetjmp.h" +#include "subdivider.h" +#include "renderhints.h" +#include "backend.h" +#include "maplist.h" +#include "reader.h" +#include "nurbsconsts.h" + +struct Knotvector; +class Quilt; +class DisplayList; +class BasicCurveEvaluator; +class BasicSurfaceEvaluator; + +class NurbsTessellator { +public: + NurbsTessellator( BasicCurveEvaluator &c, + BasicSurfaceEvaluator &e ); + virtual ~NurbsTessellator( void ); + + void getnurbsproperty( long, INREAL * ); + void getnurbsproperty( long, long, INREAL * ); + void setnurbsproperty( long, INREAL ); + void setnurbsproperty( long, long, INREAL ); + void setnurbsproperty( long, long, INREAL * ); + void setnurbsproperty( long, long, INREAL *, long, long ); + + // called before a tessellation begins/ends + virtual void bgnrender( void ); + virtual void endrender( void ); + + // called to make a display list of the output vertices + virtual void makeobj( int n ); + virtual void closeobj( void ); + + // called when a error occurs + virtual void errorHandler( int ); + + void bgnsurface( long ); + void endsurface( void ); + void bgntrim( void ); + void endtrim( void ); + void bgncurve( long ); + void endcurve( void ); + void pwlcurve( long, INREAL[], long, long ); + void nurbscurve( long, INREAL[], long, INREAL[], long, long ); + void nurbssurface( long, INREAL[], long, INREAL[], long, long, + INREAL[], long, long, long ); + + void defineMap( long, long, long ); + void redefineMaps( void ); + + // recording of input description + void discardRecording( void * ); + void * beginRecording( void ); + void endRecording( void ); + void playRecording( void * ); + + //for optimizing untrimmed nurbs in the case of domain distance sampling + void set_domain_distance_u_rate(REAL u_rate); + void set_domain_distance_v_rate(REAL v_rate); + void set_is_domain_distance_sampling(int flag); + + +protected: + Renderhints renderhints; + Maplist maplist; + Backend backend; + +private: + + void resetObjects( void ); + int do_check_knots( Knotvector *, const char * ); + void do_nurbserror( int ); + void do_bgncurve( O_curve * ); + void do_endcurve( void ); + void do_freeall( void ); + void do_freecurveall( O_curve * ); + void do_freebgntrim( O_trim * ); + void do_freebgncurve( O_curve * ); + void do_freepwlcurve( O_pwlcurve * ); + void do_freenurbscurve( O_nurbscurve * ); + void do_freenurbssurface( O_nurbssurface * ); + void do_freebgnsurface( O_surface * ); + void do_bgnsurface( O_surface * ); + void do_endsurface( void ); + void do_bgntrim( O_trim * ); + void do_endtrim( void ); + void do_pwlcurve( O_pwlcurve * ); + void do_nurbscurve( O_nurbscurve * ); + void do_nurbssurface( O_nurbssurface * ); + void do_freenurbsproperty( Property * ); + void do_setnurbsproperty( Property * ); + void do_setnurbsproperty2( Property * ); + + Subdivider subdivider; + JumpBuffer* jumpbuffer; + Pool o_pwlcurvePool; + Pool o_nurbscurvePool; + Pool o_curvePool; + Pool o_trimPool; + Pool o_surfacePool; + Pool o_nurbssurfacePool; + Pool propertyPool; +public: + Pool quiltPool; +private: + TrimVertexPool extTrimVertexPool; + + int inSurface; /* bgnsurface seen */ + int inCurve; /* bgncurve seen */ + int inTrim; /* bgntrim seen */ + int isCurveModified; /* curve changed */ + int isTrimModified; /* trim curves changed */ + int isSurfaceModified; /* surface changed */ + int isDataValid; /* all data is good */ + int numTrims; /* valid trim regions */ + int playBack; + + O_trim** nextTrim; /* place to link o_trim */ + O_curve** nextCurve; /* place to link o_curve */ + O_nurbscurve** nextNurbscurve; /* place to link o_nurbscurve */ + O_pwlcurve** nextPwlcurve; /* place to link o_pwlcurve */ + O_nurbssurface** nextNurbssurface; /* place to link o_nurbssurface */ + + O_surface* currentSurface; + O_trim* currentTrim; + O_curve* currentCurve; + + DisplayList *dl; + +}; + +#endif /* __glunurbstess_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/patch.cc b/mesalib/src/glu/sgi/libnurbs/internals/patch.cc new file mode 100644 index 000000000..808baa69e --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/patch.cc @@ -0,0 +1,504 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * patch.c++ + * + */ + +#include +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "mymath.h" +#include "mystring.h" +#include "patch.h" +#include "mapdesc.h" +#include "quilt.h" +#include "nurbsconsts.h" +#include "simplemath.h" //for glu_abs function in ::singleStep(); + + +/*-------------------------------------------------------------------------- + * Patch - copy patch from quilt and transform control points + *-------------------------------------------------------------------------- + */ + +Patch::Patch( Quilt_ptr geo, REAL *pta, REAL *ptb, Patch *n ) +{ +/* pspec[i].range is uninit here */ + mapdesc = geo->mapdesc; + cullval = mapdesc->isCulling() ? CULL_ACCEPT : CULL_TRIVIAL_ACCEPT; + notInBbox = mapdesc->isBboxSubdividing() ? 1 : 0; + needsSampling = mapdesc->isRangeSampling() ? 1 : 0; + pspec[0].order = geo->qspec[0].order; + pspec[1].order = geo->qspec[1].order; + pspec[0].stride = pspec[1].order * MAXCOORDS; + pspec[1].stride = MAXCOORDS; + + /* transform control points to sampling and culling spaces */ + REAL *ps = geo->cpts; + geo->select( pta, ptb ); + ps += geo->qspec[0].offset; + ps += geo->qspec[1].offset; + ps += geo->qspec[0].index * geo->qspec[0].order * geo->qspec[0].stride; + ps += geo->qspec[1].index * geo->qspec[1].order * geo->qspec[1].stride; + + if( needsSampling ) { + mapdesc->xformSampling( ps, geo->qspec[0].order, geo->qspec[0].stride, + geo->qspec[1].order, geo->qspec[1].stride, + spts, pspec[0].stride, pspec[1].stride ); + } + + if( cullval == CULL_ACCEPT ) { + mapdesc->xformCulling( ps, geo->qspec[0].order, geo->qspec[0].stride, + geo->qspec[1].order, geo->qspec[1].stride, + cpts, pspec[0].stride, pspec[1].stride ); + } + + if( notInBbox ) { + mapdesc->xformBounding( ps, geo->qspec[0].order, geo->qspec[0].stride, + geo->qspec[1].order, geo->qspec[1].stride, + bpts, pspec[0].stride, pspec[1].stride ); + } + + /* set scale range */ + pspec[0].range[0] = geo->qspec[0].breakpoints[geo->qspec[0].index]; + pspec[0].range[1] = geo->qspec[0].breakpoints[geo->qspec[0].index+1]; + pspec[0].range[2] = pspec[0].range[1] - pspec[0].range[0]; + + pspec[1].range[0] = geo->qspec[1].breakpoints[geo->qspec[1].index]; + pspec[1].range[1] = geo->qspec[1].breakpoints[geo->qspec[1].index+1]; + pspec[1].range[2] = pspec[1].range[1] - pspec[1].range[0]; + + // may need to subdivide to match range of sub-patch + if( pspec[0].range[0] != pta[0] ) { + assert( pspec[0].range[0] < pta[0] ); + Patch lower( *this, 0, pta[0], 0 ); + *this = lower; + } + + if( pspec[0].range[1] != ptb[0] ) { + assert( pspec[0].range[1] > ptb[0] ); + Patch upper( *this, 0, ptb[0], 0 ); + } + + if( pspec[1].range[0] != pta[1] ) { + assert( pspec[1].range[0] < pta[1] ); + Patch lower( *this, 1, pta[1], 0 ); + *this = lower; + } + + if( pspec[1].range[1] != ptb[1] ) { + assert( pspec[1].range[1] > ptb[1] ); + Patch upper( *this, 1, ptb[1], 0 ); + } + checkBboxConstraint(); + next = n; +} + +/*-------------------------------------------------------------------------- + * Patch - subdivide a patch along an isoparametric line + *-------------------------------------------------------------------------- + */ + +Patch::Patch( Patch& upper, int param, REAL value, Patch *n ) +{ + Patch& lower = *this; + + lower.cullval = upper.cullval; + lower.mapdesc = upper.mapdesc; + lower.notInBbox = upper.notInBbox; + lower.needsSampling = upper.needsSampling; + lower.pspec[0].order = upper.pspec[0].order; + lower.pspec[1].order = upper.pspec[1].order; + lower.pspec[0].stride = upper.pspec[0].stride; + lower.pspec[1].stride = upper.pspec[1].stride; + lower.next = n; + + /* reset scale range */ + switch( param ) { + case 0: { + REAL d = (value-upper.pspec[0].range[0]) / upper.pspec[0].range[2]; + if( needsSampling ) + mapdesc->subdivide( upper.spts, lower.spts, d, pspec[1].order, + pspec[1].stride, pspec[0].order, pspec[0].stride ); + + if( cullval == CULL_ACCEPT ) + mapdesc->subdivide( upper.cpts, lower.cpts, d, pspec[1].order, + pspec[1].stride, pspec[0].order, pspec[0].stride ); + + if( notInBbox ) + mapdesc->subdivide( upper.bpts, lower.bpts, d, pspec[1].order, + pspec[1].stride, pspec[0].order, pspec[0].stride ); + + lower.pspec[0].range[0] = upper.pspec[0].range[0]; + lower.pspec[0].range[1] = value; + lower.pspec[0].range[2] = value - upper.pspec[0].range[0]; + upper.pspec[0].range[0] = value; + upper.pspec[0].range[2] = upper.pspec[0].range[1] - value; + + lower.pspec[1].range[0] = upper.pspec[1].range[0]; + lower.pspec[1].range[1] = upper.pspec[1].range[1]; + lower.pspec[1].range[2] = upper.pspec[1].range[2]; + break; + } + case 1: { + REAL d = (value-upper.pspec[1].range[0]) / upper.pspec[1].range[2]; + if( needsSampling ) + mapdesc->subdivide( upper.spts, lower.spts, d, pspec[0].order, + pspec[0].stride, pspec[1].order, pspec[1].stride ); + if( cullval == CULL_ACCEPT ) + mapdesc->subdivide( upper.cpts, lower.cpts, d, pspec[0].order, + pspec[0].stride, pspec[1].order, pspec[1].stride ); + if( notInBbox ) + mapdesc->subdivide( upper.bpts, lower.bpts, d, pspec[0].order, + pspec[0].stride, pspec[1].order, pspec[1].stride ); + lower.pspec[0].range[0] = upper.pspec[0].range[0]; + lower.pspec[0].range[1] = upper.pspec[0].range[1]; + lower.pspec[0].range[2] = upper.pspec[0].range[2]; + + lower.pspec[1].range[0] = upper.pspec[1].range[0]; + lower.pspec[1].range[1] = value; + lower.pspec[1].range[2] = value - upper.pspec[1].range[0]; + upper.pspec[1].range[0] = value; + upper.pspec[1].range[2] = upper.pspec[1].range[1] - value; + break; + } + } + + // inherit bounding box + if( mapdesc->isBboxSubdividing() && ! notInBbox ) + memcpy( lower.bb, upper.bb, sizeof( bb ) ); + + lower.checkBboxConstraint(); + upper.checkBboxConstraint(); +} + +/*-------------------------------------------------------------------------- + * clamp - clamp the sampling rate to a given maximum + *-------------------------------------------------------------------------- + */ + +void +Patch::clamp( void ) +{ + if( mapdesc->clampfactor != N_NOCLAMPING ) { + pspec[0].clamp( mapdesc->clampfactor ); + pspec[1].clamp( mapdesc->clampfactor ); + } +} + +void +Patchspec::clamp( REAL clampfactor ) +{ + if( sidestep[0] < minstepsize ) + sidestep[0] = clampfactor * minstepsize; + if( sidestep[1] < minstepsize ) + sidestep[1] = clampfactor * minstepsize; + if( stepsize < minstepsize ) + stepsize = clampfactor * minstepsize; +} + +void +Patch::checkBboxConstraint( void ) +{ + if( notInBbox && + mapdesc->bboxTooBig( bpts, pspec[0].stride, pspec[1].stride, + pspec[0].order, pspec[1].order, bb ) != 1 ) { + notInBbox = 0; + } +} + +void +Patch::bbox( void ) +{ + if( mapdesc->isBboxSubdividing() ) + mapdesc->surfbbox( bb ); +} + +/*-------------------------------------------------------------------------- + * getstepsize - compute the sampling density across the patch + * and determine if patch needs to be subdivided + *-------------------------------------------------------------------------- + */ + +void +Patch::getstepsize( void ) +{ + pspec[0].minstepsize = pspec[1].minstepsize = 0; + pspec[0].needsSubdivision = pspec[1].needsSubdivision = 0; + + if( mapdesc->isConstantSampling() ) { + // fixed number of samples per patch in each direction + // maxsrate is number of s samples per patch + // maxtrate is number of t samples per patch + pspec[0].getstepsize( mapdesc->maxsrate ); + pspec[1].getstepsize( mapdesc->maxtrate ); + + } else if( mapdesc->isDomainSampling() ) { + // maxsrate is number of s samples per unit s length of domain + // maxtrate is number of t samples per unit t length of domain + pspec[0].getstepsize( mapdesc->maxsrate * pspec[0].range[2] ); + pspec[1].getstepsize( mapdesc->maxtrate * pspec[1].range[2] ); + + } else if( ! needsSampling ) { + pspec[0].singleStep(); + pspec[1].singleStep(); + } else { + // upper bound on path length between sample points + REAL tmp[MAXORDER][MAXORDER][MAXCOORDS]; + const int trstride = sizeof(tmp[0]) / sizeof(REAL); + const int tcstride = sizeof(tmp[0][0]) / sizeof(REAL); + + assert( pspec[0].order <= MAXORDER ); + + /* points have been transformed, therefore they are homogeneous */ + + int val = mapdesc->project( spts, pspec[0].stride, pspec[1].stride, + &tmp[0][0][0], trstride, tcstride, + pspec[0].order, pspec[1].order ); + if( val == 0 ) { + // control points cross infinity, therefore partials are undefined + pspec[0].getstepsize( mapdesc->maxsrate ); + pspec[1].getstepsize( mapdesc->maxtrate ); + } else { + REAL t1 = mapdesc->getProperty( N_PIXEL_TOLERANCE ); +// REAL t2 = mapdesc->getProperty( N_ERROR_TOLERANCE ); + pspec[0].minstepsize = ( mapdesc->maxsrate > 0.0 ) ? + (pspec[0].range[2] / mapdesc->maxsrate) : 0.0; + pspec[1].minstepsize = ( mapdesc->maxtrate > 0.0 ) ? + (pspec[1].range[2] / mapdesc->maxtrate) : 0.0; + if( mapdesc->isParametricDistanceSampling() || + mapdesc->isObjectSpaceParaSampling() ) { + + REAL t2; + t2 = mapdesc->getProperty( N_ERROR_TOLERANCE ); + + // t2 is upper bound on the distance between surface and tessellant + REAL ssv[2], ttv[2]; + REAL ss = mapdesc->calcPartialVelocity( ssv, &tmp[0][0][0], trstride, tcstride, pspec[0].order, pspec[1].order, 2, 0, pspec[0].range[2], pspec[1].range[2], 0 ); + REAL st = mapdesc->calcPartialVelocity( 0, &tmp[0][0][0], trstride, tcstride, pspec[0].order, pspec[1].order, 1, 1, pspec[0].range[2], pspec[1].range[2], -1 ); + REAL tt = mapdesc->calcPartialVelocity( ttv, &tmp[0][0][0], trstride, tcstride, pspec[0].order, pspec[1].order, 0, 2, pspec[0].range[2], pspec[1].range[2], 1 ); + //make sure that ss st and tt are nonnegative: + if(ss <0) ss = -ss; + if(st <0) st = -st; + if(tt <0) tt = -tt; + + if( ss != 0.0 && tt != 0.0 ) { + /* printf( "ssv[0] %g ssv[1] %g ttv[0] %g ttv[1] %g\n", + ssv[0], ssv[1], ttv[0], ttv[1] ); */ + REAL ttq = sqrtf( (float) ss ); + REAL ssq = sqrtf( (float) tt ); + REAL ds = sqrtf( 4 * t2 * ttq / ( ss * ttq + st * ssq ) ); + REAL dt = sqrtf( 4 * t2 * ssq / ( tt * ssq + st * ttq ) ); + pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2]; + REAL scutoff = 2.0 * t2 / ( pspec[0].range[2] * pspec[0].range[2]); + pspec[0].sidestep[0] = (ssv[0] > scutoff) ? sqrtf( 2.0 * t2 / ssv[0] ) : pspec[0].range[2]; + pspec[0].sidestep[1] = (ssv[1] > scutoff) ? sqrtf( 2.0 * t2 / ssv[1] ) : pspec[0].range[2]; + + pspec[1].stepsize = ( dt < pspec[1].range[2] ) ? dt : pspec[1].range[2]; + REAL tcutoff = 2.0 * t2 / ( pspec[1].range[2] * pspec[1].range[2]); + pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? sqrtf( 2.0 * t2 / ttv[0] ) : pspec[1].range[2]; + pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? sqrtf( 2.0 * t2 / ttv[1] ) : pspec[1].range[2]; + } else if( ss != 0.0 ) { + REAL x = pspec[1].range[2] * st; + REAL ds = ( sqrtf( x * x + 8.0 * t2 * ss ) - x ) / ss; + pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2]; + REAL scutoff = 2.0 * t2 / ( pspec[0].range[2] * pspec[0].range[2]); + pspec[0].sidestep[0] = (ssv[0] > scutoff) ? sqrtf( 2.0 * t2 / ssv[0] ) : pspec[0].range[2]; + pspec[0].sidestep[1] = (ssv[1] > scutoff) ? sqrtf( 2.0 * t2 / ssv[1] ) : pspec[0].range[2]; + pspec[1].singleStep(); + } else if( tt != 0.0 ) { + REAL x = pspec[0].range[2] * st; + REAL dt = ( sqrtf( x * x + 8.0 * t2 * tt ) - x ) / tt; + pspec[0].singleStep(); + REAL tcutoff = 2.0 * t2 / ( pspec[1].range[2] * pspec[1].range[2]); + pspec[1].stepsize = ( dt < pspec[1].range[2] ) ? dt : pspec[1].range[2]; + pspec[1].sidestep[0] = (ttv[0] > tcutoff) ? sqrtf( 2.0 * t2 / ttv[0] ) : pspec[1].range[2]; + pspec[1].sidestep[1] = (ttv[1] > tcutoff) ? sqrtf( 2.0 * t2 / ttv[1] ) : pspec[1].range[2]; + } else { + if( 4.0 * t2 > st * pspec[0].range[2] * pspec[1].range[2] ) { + pspec[0].singleStep(); + pspec[1].singleStep(); + } else { + REAL area = 4.0 * t2 / st; + REAL ds = sqrtf( area * pspec[0].range[2] / pspec[1].range[2] ); + REAL dt = sqrtf( area * pspec[1].range[2] / pspec[0].range[2] ); + pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2]; + pspec[0].sidestep[0] = pspec[0].range[2]; + pspec[0].sidestep[1] = pspec[0].range[2]; + + pspec[1].stepsize = ( dt < pspec[1].range[2] ) ? dt : pspec[1].range[2]; + pspec[1].sidestep[0] = pspec[1].range[2]; + pspec[1].sidestep[1] = pspec[1].range[2]; + } + } + } else if( mapdesc->isPathLengthSampling() || + mapdesc->isObjectSpacePathSampling()) { + // t1 is upper bound on path length + REAL msv[2], mtv[2]; + REAL ms = mapdesc->calcPartialVelocity( msv, &tmp[0][0][0], trstride, tcstride, pspec[0].order, pspec[1].order, 1, 0, pspec[0].range[2], pspec[1].range[2], 0 ); + REAL mt = mapdesc->calcPartialVelocity( mtv, &tmp[0][0][0], trstride, tcstride, pspec[0].order, pspec[1].order, 0, 1, pspec[0].range[2], pspec[1].range[2], 1 ); + REAL side_scale = 1.0; + + if( ms != 0.0 ) { + if( mt != 0.0 ) { +/* REAL d = t1 / ( ms * ms + mt * mt );*/ +/* REAL ds = mt * d;*/ + REAL ds = t1 / (2.0*ms); +/* REAL dt = ms * d;*/ + REAL dt = t1 / (2.0*mt); + pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2]; + pspec[0].sidestep[0] = ( msv[0] * pspec[0].range[2] > t1 ) ? (side_scale* t1 / msv[0]) : pspec[0].range[2]; + pspec[0].sidestep[1] = ( msv[1] * pspec[0].range[2] > t1 ) ? (side_scale* t1 / msv[1]) : pspec[0].range[2]; + + pspec[1].stepsize = ( dt < pspec[1].range[2] ) ? dt : pspec[1].range[2]; + pspec[1].sidestep[0] = ( mtv[0] * pspec[1].range[2] > t1 ) ? (side_scale*t1 / mtv[0]) : pspec[1].range[2]; + pspec[1].sidestep[1] = ( mtv[1] * pspec[1].range[2] > t1 ) ? (side_scale*t1 / mtv[1]) : pspec[1].range[2]; + } else { + pspec[0].stepsize = ( t1 < ms * pspec[0].range[2] ) ? (t1 / ms) : pspec[0].range[2]; + pspec[0].sidestep[0] = ( msv[0] * pspec[0].range[2] > t1 ) ? (t1 / msv[0]) : pspec[0].range[2]; + pspec[0].sidestep[1] = ( msv[1] * pspec[0].range[2] > t1 ) ? (t1 / msv[1]) : pspec[0].range[2]; + + pspec[1].singleStep(); + } + } else { + if( mt != 0.0 ) { + pspec[0].singleStep(); + + pspec[1].stepsize = ( t1 < mt * pspec[1].range[2] ) ? (t1 / mt) : pspec[1].range[2]; + pspec[1].sidestep[0] = ( mtv[0] * pspec[1].range[2] > t1 ) ? (t1 / mtv[0]) : pspec[1].range[2]; + pspec[1].sidestep[1] = ( mtv[1] * pspec[1].range[2] > t1 ) ? (t1 / mtv[1]) : pspec[1].range[2]; + } else { + pspec[0].singleStep(); + pspec[1].singleStep(); + } + } + } else if( mapdesc->isSurfaceAreaSampling() ) { + // t is the square root of area +/* + REAL msv[2], mtv[2]; + REAL ms = mapdesc->calcPartialVelocity( msv, &tmp[0][0][0], trstride, tcstride, pspec[0].order, pspec[1].order, 1, 0, pspec[0].range[2], pspec[1].range[2], 0 ); + REAL mt = mapdesc->calcPartialVelocity( mtv, &tmp[0][0][0], trstride, tcstride, pspec[0].order, pspec[1].order, 0, 1, pspec[0].range[2], pspec[1].range[2], 1 ); + if( ms != 0.0 && mt != 0.0 ) { + REAL d = 1.0 / (ms * mt); + t *= M_SQRT2; + REAL ds = t * sqrtf( d * pspec[0].range[2] / pspec[1].range[2] ); + REAL dt = t * sqrtf( d * pspec[1].range[2] / pspec[0].range[2] ); + pspec[0].stepsize = ( ds < pspec[0].range[2] ) ? ds : pspec[0].range[2]; + pspec[0].sidestep[0] = ( msv[0] * pspec[0].range[2] > t ) ? (t / msv[0]) : pspec[0].range[2]; + pspec[0].sidestep[1] = ( msv[1] * pspec[0].range[2] > t ) ? (t / msv[1]) : pspec[0].range[2]; + + pspec[1].stepsize = ( dt < pspec[1].range[2] ) ? dt : pspec[1].range[2]; + pspec[1].sidestep[0] = ( mtv[0] * pspec[1].range[2] > t ) ? (t / mtv[0]) : pspec[1].range[2]; + pspec[1].sidestep[1] = ( mtv[1] * pspec[1].range[2] > t ) ? (t / mtv[1]) : pspec[1].range[2]; + } else { + pspec[0].singleStep(); + pspec[1].singleStep(); + } +*/ + } else { + pspec[0].singleStep(); + pspec[1].singleStep(); + } + } + } + +#ifdef DEBUG + _glu_dprintf( "sidesteps %g %g %g %g, stepsize %g %g\n", + pspec[0].sidestep[0], pspec[0].sidestep[1], + pspec[1].sidestep[0], pspec[1].sidestep[1], + pspec[0].stepsize, pspec[1].stepsize ); +#endif + + if( mapdesc->minsavings != N_NOSAVINGSSUBDIVISION ) { + REAL savings = 1./(pspec[0].stepsize * pspec[1].stepsize) ; + savings-= (2./( pspec[0].sidestep[0] + pspec[0].sidestep[1] )) * + (2./( pspec[1].sidestep[0] + pspec[1].sidestep[1] )); + + savings *= pspec[0].range[2] * pspec[1].range[2]; + if( savings > mapdesc->minsavings ) { + pspec[0].needsSubdivision = pspec[1].needsSubdivision = 1; + } + } + + if( pspec[0].stepsize < pspec[0].minstepsize ) pspec[0].needsSubdivision = 1; + if( pspec[1].stepsize < pspec[1].minstepsize ) pspec[1].needsSubdivision = 1; + needsSampling = (needsSampling ? needsSamplingSubdivision() : 0); +} + +void +Patchspec::singleStep() +{ + stepsize = sidestep[0] = sidestep[1] = glu_abs(range[2]); +} + +void +Patchspec::getstepsize( REAL max ) // max is number of samples for entire patch +{ + stepsize = ( max >= 1.0 ) ? range[2] / max : range[2]; + if (stepsize < 0.0) { + stepsize = -stepsize; + } + sidestep[0] = sidestep[1] = minstepsize = stepsize; +} + +int +Patch::needsSamplingSubdivision( void ) +{ + return (pspec[0].needsSubdivision || pspec[1].needsSubdivision) ? 1 : 0; +} + +int +Patch::needsNonSamplingSubdivision( void ) +{ + return notInBbox; +} + +int +Patch::needsSubdivision( int param ) +{ + return pspec[param].needsSubdivision; +} + +int +Patch::cullCheck( void ) +{ + if( cullval == CULL_ACCEPT ) + cullval = mapdesc->cullCheck( cpts, pspec[0].order, pspec[0].stride, + pspec[1].order, pspec[1].stride ); + return cullval; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/patch.h b/mesalib/src/glu/sgi/libnurbs/internals/patch.h new file mode 100644 index 000000000..324a25938 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/patch.h @@ -0,0 +1,94 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * patch.h + * + */ + +#ifndef __glupatch_h_ +#define __glupatch_h_ + +#include "types.h" +#include "defines.h" + +class Quilt; +class Mapdesc; + + +struct Pspec { + REAL range[3]; + REAL sidestep[2]; + REAL stepsize; + REAL minstepsize; + int needsSubdivision; +}; + +struct Patchspec : public Pspec { + int order; + int stride; + void clamp( REAL ); + void getstepsize( REAL ); + void singleStep( void ); +}; + +class Patch { +public: +friend class Subdivider; +friend class Quilt; +friend class Patchlist; + Patch( Quilt *, REAL*, REAL *, Patch * ); + Patch( Patch &, int, REAL, Patch * ); + void bbox( void ); + void clamp( void ); + void getstepsize( void ); + int cullCheck( void ); + int needsSubdivision( int ); + int needsSamplingSubdivision( void ); + int needsNonSamplingSubdivision( void ); + + int get_uorder() {return pspec[0].order;} + int get_vorder() {return pspec[1].order;} + +private: + + Mapdesc* mapdesc; + Patch* next; + int cullval; + int notInBbox; + int needsSampling; + REAL cpts[MAXORDER*MAXORDER*MAXCOORDS]; //culling pts + REAL spts[MAXORDER*MAXORDER*MAXCOORDS]; //sampling pts + REAL bpts[MAXORDER*MAXORDER*MAXCOORDS]; //bbox pts + Patchspec pspec[2]; + void checkBboxConstraint( void ); + REAL bb[2][MAXCOORDS]; +}; +#endif /* __glupatch_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/patchlist.cc b/mesalib/src/glu/sgi/libnurbs/internals/patchlist.cc new file mode 100644 index 000000000..989d2dd00 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/patchlist.cc @@ -0,0 +1,170 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * patchlist.c++ + * + */ + +#include +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "quilt.h" +#include "patchlist.h" +#include "patch.h" +#include "nurbsconsts.h" + +Patchlist::Patchlist( Quilt *quilts, REAL *pta, REAL *ptb ) +{ + patch = 0; + for( Quilt *q = quilts; q; q = q->next ) + patch = new Patch( q, pta, ptb, patch ); + pspec[0].range[0] = pta[0]; + pspec[0].range[1] = ptb[0]; + pspec[0].range[2] = ptb[0] - pta[0]; + + pspec[1].range[0] = pta[1]; + pspec[1].range[1] = ptb[1]; + pspec[1].range[2] = ptb[1] - pta[1]; +} + +Patchlist::Patchlist( Patchlist &upper, int param, REAL value) +{ + Patchlist &lower = *this; + patch = 0; + for( Patch *p = upper.patch; p; p = p->next ) + patch = new Patch( *p, param, value, patch ); + + if( param == 0 ) { + lower.pspec[0].range[0] = upper.pspec[0].range[0]; + lower.pspec[0].range[1] = value; + lower.pspec[0].range[2] = value - upper.pspec[0].range[0]; + upper.pspec[0].range[0] = value; + upper.pspec[0].range[2] = upper.pspec[0].range[1] - value; + lower.pspec[1] = upper.pspec[1]; + } else { + lower.pspec[0] = upper.pspec[0]; + lower.pspec[1].range[0] = upper.pspec[1].range[0]; + lower.pspec[1].range[1] = value; + lower.pspec[1].range[2] = value - upper.pspec[1].range[0]; + upper.pspec[1].range[0] = value; + upper.pspec[1].range[2] = upper.pspec[1].range[1] - value; + } +} + +Patchlist::~Patchlist() +{ + while( patch ) { + Patch *p = patch; + patch = patch->next; + delete p; + } +} + +int +Patchlist::cullCheck( void ) +{ + for( Patch *p = patch; p; p = p->next ) + if( p->cullCheck() == CULL_TRIVIAL_REJECT ) + return CULL_TRIVIAL_REJECT; + return CULL_ACCEPT; +} + +void +Patchlist::getRanges(REAL ranges[4]) +{ + ranges[0] = pspec[0].range[0]; + ranges[1] = pspec[0].range[1]; + ranges[2] = pspec[1].range[0]; + ranges[3] = pspec[1].range[1]; +} + +void +Patchlist::getstepsize( void ) +{ + pspec[0].stepsize = pspec[0].range[2]; + pspec[0].sidestep[0] = pspec[0].range[2]; + pspec[0].sidestep[1] = pspec[0].range[2]; + + pspec[1].stepsize = pspec[1].range[2]; + pspec[1].sidestep[0] = pspec[1].range[2]; + pspec[1].sidestep[1] = pspec[1].range[2]; + + for( Patch *p = patch; p; p = p->next ) { + p->getstepsize(); + p->clamp(); + pspec[0].stepsize = ((p->pspec[0].stepsize < pspec[0].stepsize) ? p->pspec[0].stepsize : pspec[0].stepsize); + pspec[0].sidestep[0] = ((p->pspec[0].sidestep[0] < pspec[0].sidestep[0]) ? p->pspec[0].sidestep[0] : pspec[0].sidestep[0]); + pspec[0].sidestep[1] = ((p->pspec[0].sidestep[1] < pspec[0].sidestep[1]) ? p->pspec[0].sidestep[1] : pspec[0].sidestep[1]); + pspec[1].stepsize = ((p->pspec[1].stepsize < pspec[1].stepsize) ? p->pspec[1].stepsize : pspec[1].stepsize); + pspec[1].sidestep[0] = ((p->pspec[1].sidestep[0] < pspec[1].sidestep[0]) ? p->pspec[1].sidestep[0] : pspec[1].sidestep[0]); + pspec[1].sidestep[1] = ((p->pspec[1].sidestep[1] < pspec[1].sidestep[1]) ? p->pspec[1].sidestep[1] : pspec[1].sidestep[1]); + } +} + +void +Patchlist::bbox( void ) +{ + for( Patch *p = patch; p; p = p->next ) + p->bbox(); +} + +int +Patchlist::needsNonSamplingSubdivision( void ) +{ + notInBbox = 0; + for( Patch *p = patch; p; p = p->next ) + notInBbox |= p->needsNonSamplingSubdivision(); + return notInBbox; +} + +int +Patchlist::needsSamplingSubdivision( void ) +{ + pspec[0].needsSubdivision = 0; + pspec[1].needsSubdivision = 0; + + for( Patch *p = patch; p; p = p->next ) { + pspec[0].needsSubdivision |= p->pspec[0].needsSubdivision; + pspec[1].needsSubdivision |= p->pspec[0].needsSubdivision; + } + return (pspec[0].needsSubdivision || pspec[1].needsSubdivision) ? 1 : 0; +} + +int +Patchlist::needsSubdivision( int param ) +{ + return pspec[param].needsSubdivision; +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/patchlist.h b/mesalib/src/glu/sgi/libnurbs/internals/patchlist.h new file mode 100644 index 000000000..9bfc5b47a --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/patchlist.h @@ -0,0 +1,92 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * patchlist.h + * + */ + +#ifndef __glupatchlist_h_ +#define __glupatchlist_h_ + +#include "types.h" +#include "defines.h" +#include "patch.h" + +class Quilt; + +class Patchlist { +friend class Subdivider; +public: + Patchlist( Quilt *, REAL *, REAL * ); + Patchlist( Patchlist &, int , REAL ); + ~Patchlist(); + void bbox(); + int cullCheck( void ); + void getstepsize( void ); + int needsNonSamplingSubdivision( void ); + int needsSamplingSubdivision( void ); + int needsSubdivision( int ); + REAL getStepsize( int ); + void getRanges(REAL ranges[4]); + + int get_uorder(); + int get_vorder(); +private: + Patch *patch; + int notInBbox; + int needsSampling; + Pspec pspec[2]; +}; + +inline REAL +Patchlist::getStepsize( int param ) +{ + return pspec[param].stepsize; +} + +inline int +Patchlist::get_uorder() +{ + return patch->get_uorder(); + +} + +inline int + Patchlist::get_vorder() +{ + return patch->get_vorder(); +} + + + + + +#endif /* __glupatchlist_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/pwlarc.h b/mesalib/src/glu/sgi/libnurbs/internals/pwlarc.h new file mode 100644 index 000000000..2e5175a6f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/pwlarc.h @@ -0,0 +1,78 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * pwlarc.h + * + */ + +#ifndef __glupwlarc_h_ +#define __glupwlarc_h_ + +#include "myassert.h" +#include "nurbsconsts.h" + +class TrimVertex; + +class PwlArc : public PooledObj { /* a piecewise-linear arc */ +public: + TrimVertex * pts; /* sample points */ + int npts; /* number of sample points */ + long type; /* curve type */ + inline PwlArc( void ); + inline PwlArc( int, TrimVertex * ); + inline PwlArc( int, TrimVertex *, long ); +}; + +inline +PwlArc::PwlArc( void ) +{ + type = N_P2D; + pts = 0; + npts = -1; +} + +inline +PwlArc::PwlArc( int _npts, TrimVertex *_pts ) +{ + pts = _pts; + npts = _npts; + type = N_P2D; +} + +inline +PwlArc::PwlArc( int _npts, TrimVertex *_pts, long _type ) +{ + pts = _pts; + npts = _npts; + type = _type; +} + +#endif /* __glupwlarc_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/quilt.cc b/mesalib/src/glu/sgi/libnurbs/internals/quilt.cc new file mode 100644 index 000000000..4fc58b747 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/quilt.cc @@ -0,0 +1,276 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * quilt.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "quilt.h" +#include "backend.h" +#include "mapdesc.h" +#include "flist.h" +#include "knotvector.h" +#include "patchlist.h" +#include "math.h" //fglu_abs() +#include "simplemath.h" //min() + +/* local preprocessor definitions */ +#define DEF_PATCH_STEPSIZE .4 +#define fsizeof(x) (sizeof(x)/sizeof(REAL)) + + +Quilt::Quilt( Mapdesc *_mapdesc ) +{ + mapdesc = _mapdesc; +} + +void +Quilt::deleteMe( Pool& p ) +{ + for( Quiltspec *q=qspec; q != eqspec; q++ ) { +#if 1 + if( q->breakpoints) delete[] q->breakpoints; q->breakpoints = 0; +#else + if( q->breakpoints) { + delete[] q->breakpoints; + q->breakpoints = 0; +printf("in here\n"); + } +#endif + } + if( cpts ) delete[] cpts; + cpts = 0; + PooledObj::deleteMe( p ); +} + +void +Quilt::show( void ) +{ +#ifndef NDEBUG + int nc = mapdesc->getNcoords(); + REAL *ps = cpts; + ps += qspec[0].offset; + ps += qspec[1].offset; + for( int i=0; i!= qspec[0].order * qspec[0].width; i++ ) { + for( int j = 0; j!= qspec[1].order * qspec[1].width; j++ ) { + for( int k=0; k < nc; k++ ) + _glu_dprintf( "%g ", ps[i*qspec[0].stride + j*qspec[1].stride + k] ); + _glu_dprintf( "\n" ); + } + _glu_dprintf( "\n" ); + } + _glu_dprintf( "\n" ); +#endif +} + +/*-------------------------------------------------------------------------- + * Quilt::select - find which map in each quilt contains the points + * pta and ptb with pta[i] < ptb[i] + *-------------------------------------------------------------------------- + */ + +void +Quilt::select( REAL *pta, REAL *ptb ) +{ + int dim = eqspec - qspec; + int i, j; + for( i=0; i=0; j-- ) + if( (qspec[i].breakpoints[j] <= pta[i] ) && + (ptb[i] <= qspec[i].breakpoints[j+1] ) ) + break; + assert( j != -1 ); + qspec[i].index = j; + } +} + +void +Quilt::download( Backend &backend ) +{ + if( getDimension() == 2 ) { + REAL *ps = cpts; + ps += qspec[0].offset; + ps += qspec[1].offset; + ps += qspec[0].index * qspec[0].order * qspec[0].stride; + ps += qspec[1].index * qspec[1].order * qspec[1].stride; + backend.surfpts( mapdesc->getType(), ps, + qspec[0].stride, + qspec[1].stride, + qspec[0].order, + qspec[1].order, + qspec[0].breakpoints[qspec[0].index], + qspec[0].breakpoints[qspec[0].index+1], + qspec[1].breakpoints[qspec[1].index], + qspec[1].breakpoints[qspec[1].index+1] ); + } else { + REAL *ps = cpts; + ps += qspec[0].offset; + ps += qspec[0].index * qspec[0].order * qspec[0].stride; + backend.curvpts( mapdesc->getType(), ps, + qspec[0].stride, + qspec[0].order, + qspec[0].breakpoints[qspec[0].index], + qspec[0].breakpoints[qspec[0].index+1] ); + } +} + +/*-------------------------------------------------------------------------- + * Quilt::downloadAll - download each map that contains the current patch + *-------------------------------------------------------------------------- + */ + +void +Quilt::downloadAll( REAL *pta, REAL *ptb, Backend &backend ) +{ + for( Quilt *m = this; m; m=m->next ) { + m->select( pta, ptb ); + m->download( backend ); + } +} + +/*-------------------------------------------------------------------------- + * Quilt::isCulled - determine if an entire quilt is trivially rejected. + *-------------------------------------------------------------------------- + */ + +int +Quilt::isCulled( void ) +{ + if( mapdesc->isCulling() ) + return mapdesc->xformAndCullCheck( cpts + qspec[0].offset + qspec[1].offset, + qspec[0].order * qspec[0].width, qspec[0].stride, + qspec[1].order * qspec[1].width, qspec[1].stride ); + else + return CULL_ACCEPT; +} + +/*--------------------------------------------------------------------------- + * Quilt::getRange - retrieve the valid paramater range of a set of quilts + *--------------------------------------------------------------------------- + */ +void +Quilt::getRange( REAL *from, REAL *to, Flist& slist, Flist &tlist ) +{ + getRange( from, to, 0, slist ); + getRange( from, to, 1, tlist ); +} + +/*--------------------------------------------------------------------------- + * Quilt::getRange - retrieve the valid paramater range of a set of quilts + *--------------------------------------------------------------------------- + */ +void +Quilt::getRange( REAL *from, REAL *to, int i, Flist &list ) +{ + Quilt *maps = this; + from[i] = maps->qspec[i].breakpoints[0]; + to[i] = maps->qspec[i].breakpoints[maps->qspec[i].width]; + int maxpts = 0; + Quilt_ptr m; + for( m=maps; m; m=m->next ) { + if( m->qspec[i].breakpoints[0] > from[i] ) + from[i] = m->qspec[i].breakpoints[0]; + if( m->qspec[i].breakpoints[m->qspec[i].width] < to[i] ) + to[i] = m->qspec[i].breakpoints[m->qspec[i].width]; + maxpts += m->qspec[i].width + 1; + } + + list.grow( maxpts ); + + for( m=maps; m; m=m->next ) + for( int j=0; j<=m->qspec[i].width; j++ ) { + list.add( m->qspec[i].breakpoints[j] ); + } + + list.filter( ); + list.taper( from[i], to[i] ); +} + +void +Quilt::getRange( REAL *from, REAL *to, Flist& slist ) +{ + getRange( from, to, 0, slist ); +} + +void +Quilt::findRates( Flist& slist, Flist& tlist, REAL rate[2] ) +{ + findSampleRates( slist, tlist ); + rate[0] = qspec[0].step_size; + rate[1] = qspec[1].step_size; + + for( Quilt *q = next; q; q = q->next ) { + q->findSampleRates( slist, tlist ); + if( q->qspec[0].step_size < rate[0] ) + rate[0] = q->qspec[0].step_size; + if( q->qspec[1].step_size < rate[1] ) + rate[1] = q->qspec[1].step_size; + } +} + +void +Quilt::findSampleRates( Flist& slist, Flist& tlist ) +{ + qspec[0].step_size = DEF_PATCH_STEPSIZE * + (qspec[0].breakpoints[qspec[0].width] - qspec[0].breakpoints[0]); + qspec[1].step_size = DEF_PATCH_STEPSIZE * + (qspec[1].breakpoints[qspec[1].width] - qspec[1].breakpoints[0]); + + for( int i = slist.start; i < slist.end-1; i++ ) { + for( int j = tlist.start; j < tlist.end-1; j++ ) { + + REAL pta[2], ptb[2]; + pta[0] = slist.pts[i]; + ptb[0] = slist.pts[i+1]; + pta[1] = tlist.pts[j]; + ptb[1] = tlist.pts[j+1]; + Patchlist patchlist( this, pta, ptb ); + patchlist.getstepsize(); + + { + float edge_len_s = min(glu_abs(ptb[0]-pta[0]),1.0); + float edge_len_t = min(glu_abs(ptb[1]-pta[1]),1.0); + + if( patchlist.getStepsize(0)/edge_len_s < qspec[0].step_size ) + qspec[0].step_size = patchlist.getStepsize(0)/edge_len_s; + if( patchlist.getStepsize(1)/edge_len_t < qspec[1].step_size ) + qspec[1].step_size = patchlist.getStepsize(1)/edge_len_t; + } + } + } +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/quilt.h b/mesalib/src/glu/sgi/libnurbs/internals/quilt.h new file mode 100644 index 000000000..fe1e3309e --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/quilt.h @@ -0,0 +1,92 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * quilt.h + * + */ + +#ifndef __gluquilt_h_ +#define __gluquilt_h_ + +#include "defines.h" +#include "bufpool.h" +#include "types.h" + +class Backend; +class Mapdesc; +class Flist; +struct Knotvector; + +/* constants for memory allocation of NURBS to Bezier conversion */ +#define MAXDIM 2 + +struct Quiltspec { /* a specification for a dimension of a quilt */ + int stride; /* words between points */ + int width; /* number of segments */ + int offset; /* words to first point */ + int order; /* order */ + int index; /* current segment number */ + int bdry[2]; /* boundary edge flag */ + REAL step_size; + Knot * breakpoints; +}; + +typedef Quiltspec *Quiltspec_ptr; + +class Quilt : public PooledObj { /* an array of bezier patches */ +public: + Quilt( Mapdesc * ); + Mapdesc * mapdesc; /* map descriptor */ + REAL * cpts; /* control points */ + Quiltspec qspec[MAXDIM]; /* the dimensional data */ + Quiltspec_ptr eqspec; /* qspec trailer */ + Quilt *next; /* next quilt in linked list */ + +public: + void deleteMe( Pool& ); + void toBezier( Knotvector &, INREAL *, long ); + void toBezier( Knotvector &, Knotvector &, INREAL *, long ); + void select( REAL *, REAL * ); + int getDimension( void ) { return eqspec - qspec; } + void download( Backend & ); + void downloadAll( REAL *, REAL *, Backend & ); + int isCulled( void ); + void getRange( REAL *, REAL *, Flist&, Flist & ); + void getRange( REAL *, REAL *, int, Flist & ); + void getRange( REAL *, REAL *, Flist& ); + void findRates( Flist& slist, Flist& tlist, REAL[2] ); + void findSampleRates( Flist& slist, Flist& tlist ); + void show(); +}; + +typedef class Quilt *Quilt_ptr; + +#endif /* __gluquilt_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/reader.cc b/mesalib/src/glu/sgi/libnurbs/internals/reader.cc new file mode 100644 index 000000000..6135eef60 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/reader.cc @@ -0,0 +1,146 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * reader.c++ + * + */ + +#include +#include "glimports.h" +#include "nurbsconsts.h" +#include "reader.h" +#include "trimvertex.h" +#include "simplemath.h" + +//when read a pwlCurve, if two consecutive points are the same, then +//eliminate one of them. This makes the tessellator more robust. The spec +//assumes the application makes sure there are no redundant points. +//but in Inspector, the trim curves seem to have redundant points a lot. +//I guess other similar users may have the same problem. + +#define ELIMINATE_REDUNDANT_POINTS + +#ifdef ELIMINATE_REDUNDANT_POINTS +#define equal(x,y) ( glu_abs(x-y) <= 0.00001) +#endif + +#ifdef ELIMINATE_REDUNDANT_POINTS +O_pwlcurve::O_pwlcurve( long _type, long count, INREAL *array, long byte_stride, TrimVertex *trimpts ) +{ + next = 0; + used = 0; + owner = 0; + pts = trimpts; + npts = (int) count; + int i; + + /* copy user data into internal trimming data structures */ + switch( _type ) { + case N_P2D: { + TrimVertex *v = pts; + TrimVertex *prev = NULL; + int num = 0; + int doit; + for(i=0; iparam[0], array[0]) && equal(prev->param[1], array[1])) + { + doit = 0; + } + } + + if(doit) + { + v->param[0] = (REAL) array[0]; + v->param[1] = (REAL) array[1]; + prev = v; + v++; + num++; + } + array = (INREAL *) (((char *) array) + byte_stride); + } + npts = num; + break; + } + case N_P2DR: { + TrimVertex *v = pts; + for( TrimVertex *lastv = v + count; v != lastv; v++ ) { + v->param[0] = (REAL) array[0] / (REAL) array[2]; + v->param[1] = (REAL) array[1] / (REAL) array[2]; + array = (INREAL *) (((char *) array) + byte_stride); + } + break; + } + } +} +#else +O_pwlcurve::O_pwlcurve( long _type, long count, INREAL *array, long byte_stride, TrimVertex *trimpts ) +{ + next = 0; + used = 0; + owner = 0; + pts = trimpts; + npts = (int) count; + + /* copy user data into internal trimming data structures */ + switch( _type ) { + case N_P2D: { + TrimVertex *v = pts; + for( TrimVertex *lastv = v + count; v != lastv; v++ ) { + v->param[0] = (REAL) array[0]; + v->param[1] = (REAL) array[1]; + array = (INREAL *) (((char *) array) + byte_stride); + } + break; + } + case N_P2DR: { + TrimVertex *v = pts; + for( TrimVertex *lastv = v + count; v != lastv; v++ ) { + v->param[0] = (REAL) array[0] / (REAL) array[2]; + v->param[1] = (REAL) array[1] / (REAL) array[2]; + array = (INREAL *) (((char *) array) + byte_stride); + } + break; + } + } +} +#endif + + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/reader.h b/mesalib/src/glu/sgi/libnurbs/internals/reader.h new file mode 100644 index 000000000..8a8dcebb5 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/reader.h @@ -0,0 +1,132 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * reader.h + * + */ + +#ifndef __glureader_h_ +#define __glureader_h_ + +#include "bufpool.h" +#include "types.h" + +enum Curvetype { ct_nurbscurve, ct_pwlcurve, ct_none }; + +struct Property; +struct O_surface; +struct O_nurbssurface; +struct O_trim; +class O_pwlcurve; +struct O_nurbscurve; +struct O_curve; +class Quilt; +class TrimVertex; + + +struct O_curve : public PooledObj { + union { + O_nurbscurve *o_nurbscurve; + O_pwlcurve *o_pwlcurve; + } curve; + Curvetype curvetype; /* arc type: pwl or nurbs */ + O_curve * next; /* next arc in loop */ + O_surface * owner; /* owning surface */ + int used; /* curve called in cur surf */ + int save; /* 1 if in display list */ + long nuid; + O_curve() { next = 0; used = 0; owner = 0; + curve.o_pwlcurve = 0; } + }; + +struct O_nurbscurve : public PooledObj { + Quilt *bezier_curves; /* array of bezier curves */ + long type; /* range descriptor */ + REAL tesselation; /* tesselation tolerance */ + int method; /* tesselation method */ + O_nurbscurve * next; /* next curve in list */ + int used; /* curve called in cur surf */ + int save; /* 1 if in display list */ + O_curve * owner; /* owning curve */ + O_nurbscurve( long _type ) + { type = _type; owner = 0; next = 0; used = 0; } + }; + +class O_pwlcurve : public PooledObj { +public: + TrimVertex *pts; /* array of trim vertices */ + int npts; /* number of trim vertices */ + O_pwlcurve * next; /* next curve in list */ + int used; /* curve called in cur surf */ + int save; /* 1 if in display list */ + O_curve * owner; /* owning curve */ + O_pwlcurve( long, long, INREAL *, long, TrimVertex * ); + }; + +struct O_trim : public PooledObj { + O_curve *o_curve; /* closed trim loop */ + O_trim * next; /* next loop along trim */ + int save; /* 1 if in display list */ + O_trim() { next = 0; o_curve = 0; } + }; + +struct O_nurbssurface : public PooledObj { + Quilt * bezier_patches;/* array of bezier patches */ + long type; /* range descriptor */ + O_surface * owner; /* owning surface */ + O_nurbssurface * next; /* next surface in chain */ + int save; /* 1 if in display list */ + int used; /* 1 if prev called in block */ + O_nurbssurface( long _type ) + { type = _type; owner = 0; next = 0; used = 0; } + }; + +struct O_surface : public PooledObj { + O_nurbssurface * o_nurbssurface; /* linked list of surfaces */ + O_trim * o_trim; /* list of trim loops */ + int save; /* 1 if in display list */ + long nuid; + O_surface() { o_trim = 0; o_nurbssurface = 0; } + }; + +struct Property : public PooledObj { + long type; + long tag; + REAL value; + int save; /* 1 if in display list */ + Property( long _type, long _tag, INREAL _value ) + { type = _type; tag = _tag; value = (REAL) _value; } + Property( long _tag, INREAL _value ) + { type = 0; tag = _tag; value = (REAL) _value; } + }; + +class NurbsTessellator; +#endif /* __glureader_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/renderhints.cc b/mesalib/src/glu/sgi/libnurbs/internals/renderhints.cc new file mode 100644 index 000000000..a3aa62d42 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/renderhints.cc @@ -0,0 +1,133 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * renderhints.c++ + * + */ + +#include "glimports.h" +#include "mystdio.h" +#include "renderhints.h" +#include "defines.h" +#include "nurbsconsts.h" + + +/*-------------------------------------------------------------------------- + * Renderhints::Renderhints - set all window specific options + *-------------------------------------------------------------------------- + */ +Renderhints::Renderhints() +{ + display_method = N_FILL; + errorchecking = N_MSG; + subdivisions = 6.0; + tmp1 = 0.0; +} + +void +Renderhints::init( void ) +{ + maxsubdivisions = (int) subdivisions; + if( maxsubdivisions < 0 ) maxsubdivisions = 0; + + + if( display_method == N_FILL ) { + wiretris = 0; + wirequads = 0; + } else if( display_method == N_OUTLINE_TRI ) { + wiretris = 1; + wirequads = 0; + } else if( display_method == N_OUTLINE_QUAD ) { + wiretris = 0; + wirequads = 1; + } else { + wiretris = 1; + wirequads = 1; + } +} + +int +Renderhints::isProperty( long property ) +{ + switch ( property ) { + case N_DISPLAY: + case N_ERRORCHECKING: + case N_SUBDIVISIONS: + case N_TMP1: + return 1; + default: + return 0; + } +} + +REAL +Renderhints::getProperty( long property ) +{ + switch ( property ) { + case N_DISPLAY: + return display_method; + case N_ERRORCHECKING: + return errorchecking; + case N_SUBDIVISIONS: + return subdivisions; + case N_TMP1: + return tmp1; + default: + abort(); + return -1; //not necessary, needed to shut up compiler + } +} + +void +Renderhints::setProperty( long property, REAL value ) +{ + switch ( property ) { + case N_DISPLAY: + display_method = value; + break; + case N_ERRORCHECKING: + errorchecking = value; + break; + case N_SUBDIVISIONS: + subdivisions = value; + break; + case N_TMP1: /* unused */ + tmp1 = value; + break; + default: + abort(); + break; + } +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/renderhints.h b/mesalib/src/glu/sgi/libnurbs/internals/renderhints.h new file mode 100644 index 000000000..444f649be --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/renderhints.h @@ -0,0 +1,60 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * renderhints.h + * + */ + +#ifndef __glurenderhints_h_ +#define __glurenderhints_h_ + +#include "types.h" + +class Renderhints { +public: + Renderhints( void ); + void init( void ); + int isProperty( long ); + REAL getProperty( long ); + void setProperty( long, REAL ); + + REAL display_method; /* display mode */ + REAL errorchecking; /* activate error checking */ + REAL subdivisions; /* maximum number of subdivisions per patch */ + REAL tmp1; /* unused */ + + int displaydomain; + int maxsubdivisions; + int wiretris; + int wirequads; +}; + +#endif /* __glurenderhints_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/simplemath.h b/mesalib/src/glu/sgi/libnurbs/internals/simplemath.h new file mode 100644 index 000000000..0a060c57e --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/simplemath.h @@ -0,0 +1,50 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * simplemath.h + * + */ + +#ifndef __glusimplemath_h_ +#define __glusimplemath_h_ + +/* simple inline routines */ + +inline int +max( int x, int y ) { return ( x < y ) ? y : x; } + +inline REAL +min( REAL x, REAL y ) { return ( x > y ) ? y : x; } + +inline REAL +glu_abs( REAL x ) { return ( x < 0.0 ) ? -x : x; } + +#endif /* __glusimplemath_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/slicer.cc b/mesalib/src/glu/sgi/libnurbs/internals/slicer.cc new file mode 100644 index 000000000..27d2a650d --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/slicer.cc @@ -0,0 +1,1300 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * slicer.c++ + * + */ + +#include +#include +#include +#include "glimports.h" +#include "mystdio.h" +#include "myassert.h" +#include "bufpool.h" +#include "slicer.h" +#include "backend.h" +#include "arc.h" +#include "gridtrimvertex.h" +#include "simplemath.h" +#include "trimvertex.h" +#include "varray.h" + +#include "polyUtil.h" //for area() + +//static int count=0; + +/*USE_OPTTT is initiated in trimvertex.h*/ + +#ifdef USE_OPTTT + #include +#endif + +//#define USE_READ_FLAG //whether to use new or old tesselator + //if defined, it reads "flagFile", + // if the number is 1, then use new tess + // otherwise, use the old tess. + //if not defined, then use new tess. +#ifdef USE_READ_FLAG +static Int read_flag(char* name); +Int newtess_flag = read_flag("flagFile"); +#endif + +//#define COUNT_TRIANGLES +#ifdef COUNT_TRIANGLES +Int num_triangles = 0; +Int num_quads = 0; +#endif + +#define max(a,b) ((a>b)? a:b) +#define ZERO 0.00001 /*determing whether a loop is a rectngle or not*/ +#define equalRect(a,b) ((glu_abs(a-b) <= ZERO)? 1:0) //only used in tessellating a rectangle + +#if 0 // UNUSED +static Int is_Convex(Arc_ptr loop) +{ + if(area(loop->tail(), loop->head(), loop->next->head()) <0 ) + return 0; + for(Arc_ptr jarc = loop->next; jarc != loop; jarc = jarc->next) + { + if(area(jarc->tail(), jarc->head(), jarc->next->head()) < 0) + return 0; + } + return 1; +} +#endif + +/******triangulate a monotone polygon**************/ +#include "monoTriangulation.h" +#if 0 // UNUSED +static int is_U_monotone(Arc_ptr loop) +{ + int n_changes=0; + int prev_sign; + int cur_sign; + Arc_ptr temp; + + cur_sign = compV2InX(loop->head(), loop->tail()); + + n_changes = (compV2InX(loop->prev->head(), loop->prev->tail()) + != cur_sign); + + for(temp=loop->next; temp != loop; temp = temp->next) + { + prev_sign = cur_sign; + cur_sign = compV2InX(temp->head(), temp->tail()); + if(cur_sign != prev_sign) + { +#ifdef DEBUG + printf("***change signe\n"); +#endif + n_changes++; + } + } + if(n_changes == 2) return 1; + else + return 0; +} +#endif + +inline int compInY(REAL a[2], REAL b[2]) +{ + if(a[1] < b[1]) + return -1; + else if (a[1] > b[1]) + return 1; + else if(a[0] > b[0]) + return 1; + else return -1; +} + +void monoTriangulationLoop(Arc_ptr loop, Backend& backend, primStream* pStream) +{ + int i; + //find the top, bottom, increasing and decreasing chain + //then call monoTrianulation + Arc_ptr jarc, temp; + Arc_ptr top; + Arc_ptr bot; + top = bot = loop; + if(compInY(loop->tail(), loop->prev->tail()) < 0) + { + //first find bot + for(temp = loop->next; temp != loop; temp = temp->next) + { + if(compInY(temp->tail(), temp->prev->tail()) > 0) + break; + } + bot = temp->prev; + //then find top + for(temp=loop->prev; temp != loop; temp = temp->prev) + { + if(compInY(temp->tail(), temp->prev->tail()) > 0) + break; + } + top = temp; + } + else //loop > loop->prev + { + for(temp=loop->next; temp != loop; temp = temp->next) + { + if(compInY(temp->tail(), temp->prev->tail()) < 0) + break; + } + top = temp->prev; + for(temp=loop->prev; temp != loop; temp = temp->prev) + { + if(compInY(temp->tail(), temp->prev->tail()) < 0) + break; + } + bot = temp; + } + //creat increase and decrease chains + vertexArray inc_chain(50); //this is a dynamci array + for(i=1; i<=top->pwlArc->npts-2; i++) + { + //the first vertex is the top which doesn't below to inc_chain + inc_chain.appendVertex(top->pwlArc->pts[i].param); + } + for(jarc=top->next; jarc != bot; jarc = jarc->next) + { + for(i=0; i<=jarc->pwlArc->npts-2; i++) + { + inc_chain.appendVertex(jarc->pwlArc->pts[i].param); + } + + } + vertexArray dec_chain(50); + for(jarc = top->prev; jarc != bot; jarc = jarc->prev) + { + for(i=jarc->pwlArc->npts-2; i>=0; i--) + { + dec_chain.appendVertex(jarc->pwlArc->pts[i].param); + } + } + for(i=bot->pwlArc->npts-2; i>=1; i--) + { + dec_chain.appendVertex(jarc->pwlArc->pts[i].param); + } + + monoTriangulationRec(top->tail(), bot->tail(), &inc_chain, 0, + &dec_chain, 0, &backend); + +} + +/********tesselate a rectanlge (OPTIMIZATION**************/ +static void triangulateRectGen(Arc_ptr loop, int n_ulines, int n_vlines, Backend& backend); + +static Int is_rect(Arc_ptr loop) +{ + Int nlines =1; + for(Arc_ptr jarc = loop->next; jarc != loop; jarc = jarc->next) + { + nlines++; + if(nlines == 5) + break; + } + if(nlines != 4) + return 0; + + +/* +printf("here1\n"); +printf("loop->tail=(%f,%f)\n", loop->tail()[0], loop->tail()[1]); +printf("loop->head=(%f,%f)\n", loop->head()[0], loop->head()[1]); +printf("loop->next->tail=(%f,%f)\n", loop->next->tail()[0], loop->next->tail()[1]); +printf("loop->next->head=(%f,%f)\n", loop->next->head()[0], loop->next->head()[1]); +if(fglu_abs(loop->tail()[0] - loop->head()[0])<0.000001) + printf("equal 1\n"); +if(loop->next->tail()[1] == loop->next->head()[1]) + printf("equal 2\n"); +*/ + + if( (glu_abs(loop->tail()[0] - loop->head()[0])<=ZERO) && + (glu_abs(loop->next->tail()[1] - loop->next->head()[1])<=ZERO) && + (glu_abs(loop->prev->tail()[1] - loop->prev->head()[1])<=ZERO) && + (glu_abs(loop->prev->prev->tail()[0] - loop->prev->prev->head()[0])<=ZERO) + ) + return 1; + else if + ( (glu_abs(loop->tail()[1] - loop->head()[1]) <= ZERO) && + (glu_abs(loop->next->tail()[0] - loop->next->head()[0]) <= ZERO) && + (glu_abs(loop->prev->tail()[0] - loop->prev->head()[0]) <= ZERO) && + (glu_abs(loop->prev->prev->tail()[1] - loop->prev->prev->head()[1]) <= ZERO) + ) + return 1; + else + return 0; +} + + +//a line with the same u for opt +#ifdef USE_OPTTT +static void evalLineNOGE_BU(TrimVertex *verts, int n, Backend& backend) +{ + int i; + backend.preEvaluateBU(verts[0].param[0]); + for(i=0; itail()[1] == loop->head()[1]) + { + if(loop->tail()[1] > loop->prev->prev->tail()[1]) + { + + top = loop; + } + else{ + + top = loop->prev->prev; + } + } + else + { + if(loop->tail()[0] > loop->prev->prev->tail()[0]) + { + //loop is the right arc + + top = loop->next; + } + else + { + + top = loop->prev; + } + } + left = top->next; + bot = left->next; + right= bot->next; + + //if u, v are both nonlinear, then if the + //boundary is tessellated dense, we also + //sample the inside to get a better tesslletant. + if( (!ulinear) && (!vlinear)) + { + int nu = top->pwlArc->npts; + if(nu < bot->pwlArc->npts) + nu = bot->pwlArc->npts; + int nv = left->pwlArc->npts; + if(nv < right->pwlArc->npts) + nv = right->pwlArc->npts; +/* + if(nu > 2 && nv > 2) + { + triangulateRectGen(top, nu-2, nv-2, backend); + return; + } +*/ + } + + if(TB_or_LR == 1) + triangulateRectAux(top->pwlArc, bot->pwlArc, left->pwlArc, right->pwlArc, backend); + else if(TB_or_LR == -1) + triangulateRectAux(left->pwlArc, right->pwlArc, bot->pwlArc, top->pwlArc, backend); + else + { + Int maxPointsTB = top->pwlArc->npts + bot->pwlArc->npts; + Int maxPointsLR = left->pwlArc->npts + right->pwlArc->npts; + + if(maxPointsTB < maxPointsLR) + triangulateRectAux(left->pwlArc, right->pwlArc, bot->pwlArc, top->pwlArc, backend); + else + triangulateRectAux(top->pwlArc, bot->pwlArc, left->pwlArc, right->pwlArc, backend); + } +} + +static void triangulateRectAux(PwlArc* top, PwlArc* bot, PwlArc* left, PwlArc* right, Backend& backend) +{ //if(maxPointsTB >= maxPointsLR) + { + + Int d, topd_left, topd_right, botd_left, botd_right, i,j; + d = left->npts /2; + +#ifdef USE_OPTTT + evalLineNOGE(top->pts, top->npts, backend); + evalLineNOGE(bot->pts, bot->npts, backend); + evalLineNOGE(left->pts, left->npts, backend); + evalLineNOGE(right->pts, right->npts, backend); +#endif + + if(top->npts == 2) { + backend.bgntfan(); + OPT_OUTVERT(top->pts[0], backend);//the root + for(i=0; inpts; i++){ + OPT_OUTVERT(left->pts[i], backend); + } + for(i=1; i<= bot->npts-2; i++){ + OPT_OUTVERT(bot->pts[i], backend); + } + backend.endtfan(); + + backend.bgntfan(); + OPT_OUTVERT(bot->pts[bot->npts-2], backend); + for(i=0; inpts; i++){ + OPT_OUTVERT(right->pts[i], backend); + } + backend.endtfan(); + } + else if(bot->npts == 2) { + backend.bgntfan(); + OPT_OUTVERT(bot->pts[0], backend);//the root + for(i=0; inpts; i++){ + OPT_OUTVERT(right->pts[i], backend); + } + for(i=1; i<= top->npts-2; i++){ + OPT_OUTVERT(top->pts[i], backend); + } + backend.endtfan(); + + backend.bgntfan(); + OPT_OUTVERT(top->pts[top->npts-2], backend); + for(i=0; inpts; i++){ + OPT_OUTVERT(left->pts[i], backend); + } + backend.endtfan(); + } + else { //both top and bot have >=3 points + + backend.bgntfan(); + + OPT_OUTVERT(top->pts[top->npts-2], backend); + + for(i=0; i<=d; i++) + { + OPT_OUTVERT(left->pts[i], backend); + } + backend.endtfan(); + + backend.bgntfan(); + + OPT_OUTVERT(bot->pts[1], backend); + + OPT_OUTVERT(top->pts[top->npts-2], backend); + + for(i=d; i< left->npts; i++) + { + OPT_OUTVERT(left->pts[i], backend); + } + backend.endtfan(); + + d = right->npts/2; + //output only when dnpts-1 and + // + if(dnpts-1) + { + backend.bgntfan(); + // backend.tmeshvert(& top->pts[1]); + OPT_OUTVERT(top->pts[1], backend); + for(i=d; i< right->npts; i++) + { + // backend.tmeshvert(& right->pts[i]); + + OPT_OUTVERT(right->pts[i], backend); + + } + backend.endtfan(); + } + + backend.bgntfan(); + // backend.tmeshvert(& bot->pts[bot->npts-2]); + OPT_OUTVERT( bot->pts[bot->npts-2], backend); + for(i=0; i<=d; i++) + { + // backend.tmeshvert(& right->pts[i]); + OPT_OUTVERT(right->pts[i], backend); + + } + + // backend.tmeshvert(& top->pts[1]); + OPT_OUTVERT(top->pts[1], backend); + + backend.endtfan(); + + + topd_left = top->npts-2; + topd_right = 1; //topd_left>= topd_right + + botd_left = 1; + botd_right = bot->npts-2; //botd_left<= bot_dright + + + if(top->npts < bot->npts) + { + int delta=bot->npts - top->npts; + int u = delta/2; + botd_left = 1+ u; + botd_right = bot->npts-2-( delta-u); + + if(botd_left >1) + { + backend.bgntfan(); + // backend.tmeshvert(& top->pts[top->npts-2]); + OPT_OUTVERT(top->pts[top->npts-2], backend); + for(i=1; i<= botd_left; i++) + { + // backend.tmeshvert(& bot->pts[i]); + OPT_OUTVERT(bot->pts[i] , backend); + } + backend.endtfan(); + } + if(botd_right < bot->npts-2) + { + backend.bgntfan(); + OPT_OUTVERT(top->pts[1], backend); + for(i=botd_right; i<= bot->npts-2; i++) + OPT_OUTVERT(bot->pts[i], backend); + backend.endtfan(); + } + } + else if(top->npts> bot->npts) + { + int delta=top->npts-bot->npts; + int u = delta/2; + topd_left = top->npts-2 - u; + topd_right = 1+delta-u; + + if(topd_left < top->npts-2) + { + backend.bgntfan(); + // backend.tmeshvert(& bot->pts[1]); + OPT_OUTVERT(bot->pts[1], backend); + for(i=topd_left; i<= top->npts-2; i++) + { + // backend.tmeshvert(& top->pts[i]); + OPT_OUTVERT(top->pts[i], backend); + } + backend.endtfan(); + } + if(topd_right > 1) + { + backend.bgntfan(); + OPT_OUTVERT(bot->pts[bot->npts-2], backend); + for(i=1; i<= topd_right; i++) + OPT_OUTVERT(top->pts[i], backend); + backend.endtfan(); + } + } + + if(topd_left <= topd_right) + return; + + backend.bgnqstrip(); + for(j=botd_left, i=topd_left; i>=topd_right; i--,j++) + { + // backend.tmeshvert(& top->pts[i]); + // backend.tmeshvert(& bot->pts[j]); + OPT_OUTVERT(top->pts[i], backend); + OPT_OUTVERT(bot->pts[j], backend); + } + backend.endqstrip(); + + } + } +} + + +static void triangulateRectCenter(int n_ulines, REAL* u_val, + int n_vlines, REAL* v_val, + Backend& backend) +{ + + // XXX this code was patched by Diego Santa Cruz + // to fix a problem in which glMapGrid2f() was called with bad parameters. + // This has beens submitted to SGI but not integrated as of May 1, 2001. + if(n_ulines>1 && n_vlines>1) { + backend.surfgrid(u_val[0], u_val[n_ulines-1], n_ulines-1, + v_val[n_vlines-1], v_val[0], n_vlines-1); + backend.surfmesh(0,0,n_ulines-1,n_vlines-1); + } + + return; + + /* + for(i=0; ipwlArc->npts); + assert(upper_val); + if(dir) + { + for(k=0,i=arc->pwlArc->npts-1; i>=0; i--,k++) + { + upper_val[k] = arc->pwlArc->pts[i].param[0]; + } + backend.evalUStrip(arc->pwlArc->npts, arc->pwlArc->pts[0].param[1], + upper_val, + n_ulines, v, u_val); + } + else + { + for(k=0,i=0; ipwlArc->npts; i++,k++) + { + upper_val[k] = arc->pwlArc->pts[i].param[0]; + + } + + backend.evalUStrip( + n_ulines, v, u_val, + arc->pwlArc->npts, arc->pwlArc->pts[0].param[1], upper_val + ); + } + + free(upper_val); + return; + } + else //is_v + { + int i,k; + REAL* left_val = (REAL*) malloc(sizeof(REAL) * arc->pwlArc->npts); + assert(left_val); + if(dir) + { + for(k=0,i=arc->pwlArc->npts-1; i>=0; i--,k++) + { + left_val[k] = arc->pwlArc->pts[i].param[1]; + } + backend.evalVStrip(arc->pwlArc->npts, arc->pwlArc->pts[0].param[0], + left_val, + n_ulines, v, u_val); + } + else + { + for(k=0,i=0; ipwlArc->npts; i++,k++) + { + left_val[k] = arc->pwlArc->pts[i].param[1]; + } + backend.evalVStrip( + n_ulines, v, u_val, + arc->pwlArc->npts, arc->pwlArc->pts[0].param[0], left_val + ); + } + free(left_val); + return; + } + + //the following is a different version of the above code. If you comment + //the above code, the following code will still work. The reason to leave + //the folliwng code here is purely for testing purpose. + /* + int i,j; + PwlArc* parc = arc->pwlArc; + int d1 = parc->npts-1; + int d2 = 0; + TrimVertex trimVert; + trimVert.nuid = 0;//???? + REAL* temp_u_val = u_val; + if(dir ==0) //have to reverse u_val + { + temp_u_val = (REAL*) malloc(sizeof(REAL) * n_ulines); + assert(temp_u_val); + for(i=0; inpts > n_ulines) + { + d1 = n_ulines-1; + + backend.bgntfan(); + if(is_u){ + trimVert.param[0] = u_val[0]; + trimVert.param[1] = v; + } + else + { + trimVert.param[1] = u_val[0]; + trimVert.param[0] = v; + } + + backend.tmeshvert(& trimVert); + for(i=d1; i< parc->npts; i++) + backend.tmeshvert(& parc->pts[i]); + backend.endtfan(); + + + } + else if(parc->npts < n_ulines) + { + d2 = n_ulines-parc->npts; + + + backend.bgntfan(); + backend.tmeshvert(& parc->pts[parc->npts-1]); + for(i=0; i<= d2; i++) + { + if(is_u){ + trimVert.param[0] = u_val[i]; + trimVert.param[1] = v; + } + else + { + trimVert.param[1] = u_val[i]; + trimVert.param[0] = v; + } + backend.tmeshvert(&trimVert); + } + backend.endtfan(); + + } + if(d1>0){ + + + backend.bgnqstrip(); + for(i=d1, j=d2; i>=0; i--, j++) + { + backend.tmeshvert(& parc->pts[i]); + + if(is_u){ + trimVert.param[0] = u_val[j]; + trimVert.param[1] = v; + } + else{ + trimVert.param[1] = u_val[j]; + trimVert.param[0] = v; + } + backend.tmeshvert(&trimVert); + + + + } + backend.endqstrip(); + + + } + if(dir == 0) //temp_u_val was mallocated + free(temp_u_val); + */ +} + +//n_ulines is the number of ulines inside, and n_vlines is the number of vlines +//inside, different from meanings elsewhere!!! +static void triangulateRectGen(Arc_ptr loop, int n_ulines, int n_vlines, Backend& backend) +{ + + int i; + //we know the loop is a rectangle, but not sure which is top + Arc_ptr top, bot, left, right; + + if(equalRect(loop->tail()[1] , loop->head()[1])) + { + + if(loop->tail()[1] > loop->prev->prev->tail()[1]) + { + + top = loop; + } + else{ + + top = loop->prev->prev; + } + } + else + { + if(loop->tail()[0] > loop->prev->prev->tail()[0]) + { + //loop is the right arc + + top = loop->next; + } + else + { + + top = loop->prev; + } + } + + left = top->next; + bot = left->next; + right= bot->next; + +#ifdef COUNT_TRIANGLES + num_triangles += loop->pwlArc->npts + + left->pwlArc->npts + + bot->pwlArc->npts + + right->pwlArc->npts + + 2*n_ulines + 2*n_vlines + -8; + num_quads += (n_ulines-1)*(n_vlines-1); +#endif +/* + backend.surfgrid(left->tail()[0], right->tail()[0], n_ulines+1, + top->tail()[1], bot->tail()[1], n_vlines+1); +// if(n_ulines>1 && n_vlines>1) + backend.surfmesh(0,0,n_ulines+1,n_vlines+1); +return; +*/ + REAL* u_val=(REAL*) malloc(sizeof(REAL)*n_ulines); + assert(u_val); + REAL* v_val=(REAL*)malloc(sizeof(REAL) * n_vlines); + assert(v_val); + REAL u_stepsize = (right->tail()[0] - left->tail()[0])/( (REAL) n_ulines+1); + REAL v_stepsize = (top->tail()[1] - bot->tail()[1])/( (REAL) n_vlines+1); + Real temp=left->tail()[0]+u_stepsize; + for(i=0; itail()[1] + v_stepsize; + for(i=0; ipwlArc->npts); + for(i=0; ipwlArc->npts; i++) + { + vert[0] = arc->pwlArc->pts[i].param[0]; + vert[1] = arc->pwlArc->pts[i].param[1]; + sline->setPoint(i, vert); + } + ret = new directedLine(INCREASING, sline); + return ret; +} + +/*an pwlArc may not be a straight line*/ +directedLine* arcToMultDLines(directedLine* original, Arc_ptr arc) +{ + directedLine* ret = original; + int is_linear = 0; + if(arc->pwlArc->npts == 2 ) + is_linear = 1; + else if(area(arc->pwlArc->pts[0].param, arc->pwlArc->pts[1].param, arc->pwlArc->pts[arc->pwlArc->npts-1].param) == 0.0) + is_linear = 1; + + if(is_linear) + { + directedLine *dline = arcToDLine(arc); + if(ret == NULL) + ret = dline; + else + ret->insert(dline); + return ret; + } + else /*not linear*/ + { + for(Int i=0; ipwlArc->npts-1; i++) + { + Real vert[2][2]; + vert[0][0] = arc->pwlArc->pts[i].param[0]; + vert[0][1] = arc->pwlArc->pts[i].param[1]; + vert[1][0] = arc->pwlArc->pts[i+1].param[0]; + vert[1][1] = arc->pwlArc->pts[i+1].param[1]; + + sampledLine *sline = new sampledLine(2, vert); + directedLine *dline = new directedLine(INCREASING, sline); + if(ret == NULL) + ret = dline; + else + ret->insert(dline); + } + return ret; + } +} + + + +directedLine* arcLoopToDLineLoop(Arc_ptr loop) +{ + directedLine* ret; + + if(loop == NULL) + return NULL; + ret = arcToMultDLines(NULL, loop); +//ret->printSingle(); + for(Arc_ptr temp = loop->next; temp != loop; temp = temp->next){ + ret = arcToMultDLines(ret, temp); +//ret->printSingle(); + } + + return ret; +} + +/* +void Slicer::evalRBArray(rectBlockArray* rbArray, gridWrap* grid) +{ + TrimVertex *trimVert = (TrimVertex*)malloc(sizeof(TrimVertex)); + trimVert -> nuid = 0;//???? + + Real* u_values = grid->get_u_values(); + Real* v_values = grid->get_v_values(); + + Int i,j,k,l; + + for(l=0; lget_n_elements(); l++) + { + rectBlock* block = rbArray->get_element(l); + for(k=0, i=block->get_upGridLineIndex(); i>block->get_lowGridLineIndex(); i--, k++) + { + + backend.bgnqstrip(); + for(j=block->get_leftIndices()[k+1]; j<= block->get_rightIndices()[k+1]; j++) + { + trimVert->param[0] = u_values[j]; + trimVert->param[1] = v_values[i]; + backend.tmeshvert(trimVert); + + trimVert->param[1] = v_values[i-1]; + backend.tmeshvert(trimVert); + + } + backend.endqstrip(); + + } + } + + free(trimVert); +} +*/ + +void Slicer::evalRBArray(rectBlockArray* rbArray, gridWrap* grid) +{ + Int i,j,k; + + Int n_vlines=grid->get_n_vlines(); + //the reason to switch the position of v_max and v_min is because of the + //the orientation problem. glEvalMesh generates quad_strip clockwise, but + //we need counter-clockwise. + backend.surfgrid(grid->get_u_min(), grid->get_u_max(), grid->get_n_ulines()-1, + grid->get_v_max(), grid->get_v_min(), n_vlines-1); + + + for(j=0; jget_n_elements(); j++) + { + rectBlock* block = rbArray->get_element(j); + Int low = block->get_lowGridLineIndex(); + Int high = block->get_upGridLineIndex(); + + for(k=0, i=high; i>low; i--, k++) + { + backend.surfmesh(block->get_leftIndices()[k+1], n_vlines-1-i, block->get_rightIndices()[k+1]-block->get_leftIndices()[k+1], 1); + } + } +} + + +void Slicer::evalStream(primStream* pStream) +{ + Int i,j,k; + k=0; +/* TrimVertex X;*/ + TrimVertex *trimVert =/*&X*/ (TrimVertex*)malloc(sizeof(TrimVertex)); + trimVert -> nuid = 0;//??? + Real* vertices = pStream->get_vertices(); //for efficiency + for(i=0; iget_n_prims(); i++) + { + + //ith primitive has #vertices = lengths[i], type=types[i] + switch(pStream->get_type(i)){ + case PRIMITIVE_STREAM_FAN: + + backend.bgntfan(); + + for(j=0; jget_length(i); j++) + { + trimVert->param[0] = vertices[k]; + trimVert->param[1] = vertices[k+1]; + backend.tmeshvert(trimVert); + +// backend.tmeshvert(vertices[k], vertices[k+1]); + k += 2; + } + backend.endtfan(); + break; + + default: + fprintf(stderr, "evalStream: not implemented yet\n"); + exit(1); + + } + } + free(trimVert); +} + + + + +void Slicer::slice_new(Arc_ptr loop) +{ +//count++; +//if(count == 78) count=1; +//printf("count=%i\n", count); +//if( ! (4<= count && count <=4)) return; + + + Int num_ulines; + Int num_vlines; + Real uMin, uMax, vMin, vMax; + Real mydu, mydv; + uMin = uMax = loop->tail()[0]; + vMin = vMax = loop->tail()[1]; + mydu = (du>0)? du: -du; + mydv = (dv>0)? dv: -dv; + + for(Arc_ptr jarc=loop->next; jarc != loop; jarc = jarc->next) + { + + if(jarc->tail()[0] < uMin) + uMin = jarc->tail()[0]; + if(jarc->tail()[0] > uMax) + uMax = jarc->tail()[0]; + if(jarc->tail()[1] < vMin) + vMin = jarc->tail()[1]; + if(jarc->tail()[1] > vMax) + vMax = jarc->tail()[1]; + } + + if (uMax == uMin) + return; // prevent divide-by-zero. Jon Perry. 17 June 2002 + + if(mydu > uMax - uMin) + num_ulines = 2; + else + { + num_ulines = 3 + (Int) ((uMax-uMin)/mydu); + } + if(mydv>=vMax-vMin) + num_vlines = 2; + else + { + num_vlines = 2+(Int)((vMax-vMin)/mydv); + } + + Int isRect = is_rect(loop); + + if(isRect && (num_ulines<=2 || num_vlines<=2)) + { + if(vlinear) + triangulateRect(loop, backend, 1, ulinear, vlinear); + else if(ulinear) + triangulateRect(loop, backend, -1, ulinear, vlinear); + else + triangulateRect(loop, backend, 0, ulinear, vlinear); + } + + else if(isRect) + { + triangulateRectGen(loop, num_ulines-2, num_vlines-2, backend); + } + else if( (num_ulines<=2 || num_vlines <=2) && ulinear) + { + monoTriangulationFunBackend(loop, compV2InY, &backend); + } + else if( (!ulinear) && (!vlinear) && (num_ulines == 2) && (num_vlines > 2)) + { + monoTriangulationFunBackend(loop, compV2InY, &backend); + } + else + { + directedLine* poly = arcLoopToDLineLoop(loop); + + gridWrap grid(num_ulines, num_vlines, uMin, uMax, vMin, vMax); + primStream pStream(20, 20); + rectBlockArray rbArray(20); + + sampleMonoPoly(poly, &grid, ulinear, vlinear, &pStream, &rbArray); + + evalStream(&pStream); + + evalRBArray(&rbArray, &grid); + +#ifdef COUNT_TRIANGLES + num_triangles += pStream.num_triangles(); + num_quads += rbArray.num_quads(); +#endif + poly->deleteSinglePolygonWithSline(); + } + +#ifdef COUNT_TRIANGLES + printf("num_triangles=%i\n", num_triangles); + printf("num_quads = %i\n", num_quads); +#endif +} + +void Slicer::slice(Arc_ptr loop) +{ +#ifdef USE_READ_FLAG + if(read_flag("flagFile")) + slice_new(loop); + else + slice_old(loop); + +#else + slice_new(loop); +#endif + +} + + + +Slicer::Slicer( Backend &b ) + : CoveAndTiler( b ), Mesher( b ), backend( b ) +{ + ulinear = 0; + vlinear = 0; +} + +Slicer::~Slicer() +{ +} + +void +Slicer::setisolines( int x ) +{ + isolines = x; +} + +void +Slicer::setstriptessellation( REAL x, REAL y ) +{ + assert(x > 0 && y > 0); + du = x; + dv = y; + setDu( du ); +} + +void +Slicer::slice_old( Arc_ptr loop ) +{ + loop->markverts(); + + Arc_ptr extrema[4]; + loop->getextrema( extrema ); + + unsigned int npts = loop->numpts(); + TrimRegion::init( npts, extrema[0] ); + + Mesher::init( npts ); + + long ulines = uarray.init( du, extrema[1], extrema[3] ); +//printf("ulines = %i\n", ulines); + Varray varray; + long vlines = varray.init( dv, extrema[0], extrema[2] ); +//printf("vlines = %i\n", vlines); + long botv = 0; + long topv; + TrimRegion::init( varray.varray[botv] ); + getGridExtent( &extrema[0]->pwlArc->pts[0], &extrema[0]->pwlArc->pts[0] ); + + for( long quad=0; quadmarkverts(); + + if( jarc->pwlArc->npts >= 2 ) { + backend.bgnoutline(); + for( int j = jarc->pwlArc->npts-1; j >= 0; j-- ) + backend.linevert( &(jarc->pwlArc->pts[j]) ); + backend.endoutline(); + } +} + + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/slicer.h b/mesalib/src/glu/sgi/libnurbs/internals/slicer.h new file mode 100644 index 000000000..e1f5d22ff --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/slicer.h @@ -0,0 +1,84 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * slicer.h + * + */ + +#ifndef __gluslicer_h_ +#define __gluslicer_h_ + +#include "trimregion.h" +#include "mesher.h" +#include "coveandtiler.h" +#include "primitiveStream.h" +#include "rectBlock.h" + +class Backend; +class Arc; +class TrimVertex; + +class Slicer : public CoveAndTiler, public Mesher { +public: + Slicer( Backend & ); + ~Slicer( void ); + void slice( Arc_ptr ); + void slice_old( Arc_ptr); + void slice_new( Arc_ptr ); + void evalStream(primStream* ); + void evalRBArray(rectBlockArray* rbArray, gridWrap* grid); + + void outline( Arc_ptr ); + void setstriptessellation( REAL, REAL ); + void setisolines( int ); + + void set_ulinear(int ulinear_flag) + { + ulinear = ulinear_flag; + } + void set_vlinear(int vlinear_flag) + { + vlinear = vlinear_flag; + } +private: + Backend& backend; + REAL oneOverDu; + REAL du, dv; + int isolines; + + void outline( void ); + void initGridlines( void ); + void advanceGridlines( long ); + + int ulinear; //indicate whether uorder is 2 or not + int vlinear; //indicate whether vorder is 2 or not +}; +#endif /* __gluslicer_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/sorter.cc b/mesalib/src/glu/sgi/libnurbs/internals/sorter.cc new file mode 100644 index 000000000..7a7994149 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/sorter.cc @@ -0,0 +1,139 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * sorter.c++ + * + */ + +#include "glimports.h" +#include "sorter.h" +#include "mystdio.h" + +Sorter::Sorter( int _es ) +{ + es = _es; +} + +void +Sorter::qsort( void *a, int n ) +{ + qs1( (char *)a, ((char *)a)+n*es); +} + +int +Sorter::qscmp( char *, char * ) +{ + _glu_dprintf( "Sorter::qscmp: pure virtual called\n" ); + return 0; +} + + +void +Sorter::qsexc( char *, char * ) +{ + _glu_dprintf( "Sorter::qsexc: pure virtual called\n" ); +} + + +void +Sorter::qstexc( char *, char *, char * ) +{ + _glu_dprintf( "Sorter::qstexc: pure virtual called\n" ); +} + +void +Sorter::qs1( char *a, char *l ) +{ + char *i, *j; + char *lp, *hp; + int c; + unsigned int n; + +start: + if((n=l-a) <= (unsigned int)es) + return; + n = es * (n / (2*es)); + hp = lp = a+n; + i = a; + j = l-es; + while(1) { + if(i < lp) { + if((c = qscmp(i, lp)) == 0) { + qsexc(i, lp -= es); + continue; + } + if(c < 0) { + i += es; + continue; + } + } + +loop: + if(j > hp) { + if((c = qscmp(hp, j)) == 0) { + qsexc(hp += es, j); + goto loop; + } + if(c > 0) { + if(i == lp) { + qstexc(i, hp += es, j); + i = lp += es; + goto loop; + } + qsexc(i, j); + j -= es; + i += es; + continue; + } + j -= es; + goto loop; + } + + if(i == lp) { + if(lp-a >= l-hp) { + qs1(hp+es, l); + l = lp; + } else { + qs1(a, lp); + a = hp+es; + } + goto start; + } + + qstexc(j, lp -= es, i); + j = hp -= es; + } +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/sorter.h b/mesalib/src/glu/sgi/libnurbs/internals/sorter.h new file mode 100644 index 000000000..57ea12129 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/sorter.h @@ -0,0 +1,51 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef __glusorter_h_ +#define __glusorter_h_ + +class Sorter { +public: + Sorter( int es ); + virtual ~Sorter() { /* silence warning*/ } + void qsort( void *a, int n ); + +protected: + virtual int qscmp( char *, char * ); + virtual void qsexc( char *i, char *j ); // i<-j, j<-i + virtual void qstexc( char *i, char *j, char *k ); // i<-k, k<-j, j<-i + +private: + void qs1( char *, char * ); + int es; +}; +#endif /* __glusorter_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/splitarcs.cc b/mesalib/src/glu/sgi/libnurbs/internals/splitarcs.cc new file mode 100644 index 000000000..1f79d543f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/splitarcs.cc @@ -0,0 +1,293 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * splitarcs.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mysetjmp.h" +#include "mystdio.h" +#include "subdivider.h" +#include "arcsorter.h" +#include "arc.h" +#include "bin.h" + +/* local preprocessor definitions */ +#define MAXARCS 10 + +/*---------------------------------------------------------------------------- + * Subdivider::split - split trim regions in source bin by line (param == value). + *---------------------------------------------------------------------------- + */ + +void +Subdivider::split( Bin& bin, Bin& left, Bin& right, int param, REAL value ) +{ + Bin intersections, unknown; + + partition( bin, left, intersections, right, unknown, param, value ); + + int count = intersections.numarcs(); + if( count % 2 ) { +#ifndef NDEBUG + left.show( "left" ); + intersections.show( "intersections" ); + right.show( "right" ); +#endif + ::mylongjmp( jumpbuffer, 29 ); + } + + Arc_ptr arclist[MAXARCS], *list; + if( count >= MAXARCS ) { + list = new Arc_ptr[count]; + } else { + list = arclist; + } + + Arc_ptr jarc, *last, *lptr; + for( last = list; (jarc=intersections.removearc()) != NULL; last++ ) + *last = jarc; + + if( param == 0 ) { /* sort into increasing t order */ + ArcSdirSorter sorter(*this); + sorter.qsort( list, count ); + + //::qsort ((void *)list, count, sizeof(Arc_ptr), (cmpfunc)compare_s); + for( lptr=list; lptrhead()[0] <= value) && ((*lptr)->tail()[0] <= value) ) + left.addarc( *lptr ); + else + right.addarc( *lptr ); + } + } else { /* sort into decreasing s order */ + ArcTdirSorter sorter(*this); + sorter.qsort( list, count ); + //::qsort ((void *)list, count, sizeof(Arc_ptr), (cmpfunc)compare_t); + for( lptr=list; lptrhead()[1] <= value) && ((*lptr)->tail()[1] <= value) ) + left.addarc( *lptr ); + else + right.addarc( *lptr ); + } + } + + if( list != arclist ) delete[] list; + unknown.adopt(); +} + + +void +Subdivider::check_s( Arc_ptr jarc1, Arc_ptr jarc2 ) +{ + assert( jarc1->check( ) != 0 ); + assert( jarc2->check( ) != 0 ); + assert( jarc1->next->check( ) != 0 ); + assert( jarc2->next->check( ) != 0 ); + assert( jarc1 != jarc2 ); + + /* XXX - if these assertions fail, it is due to user error or + undersampling */ + if( ! ( jarc1->tail()[0] < (jarc1)->head()[0] ) ) { +#ifndef NDEBUG + _glu_dprintf( "s difference %f\n", (jarc1)->tail()[0] - (jarc1)->head()[0] ); +#endif + ::mylongjmp( jumpbuffer, 28 ); + } + + if( ! ( jarc2->tail()[0] > (jarc2)->head()[0] ) ) { +#ifndef NDEBUG + _glu_dprintf( "s difference %f\n", (jarc2)->tail()[0] - (jarc2)->head()[0] ); +#endif + ::mylongjmp( jumpbuffer, 28 ); + } +} + +inline void +Subdivider::link( Arc_ptr jarc1, Arc_ptr jarc2, Arc_ptr up, Arc_ptr down ) +{ + up->nuid = down->nuid = 0; // XXX + + up->next = jarc2; + down->next = jarc1; + up->prev = jarc1->prev; + down->prev = jarc2->prev; + + down->next->prev = down; + up->next->prev = up; + down->prev->next = down; + up->prev->next = up; +} + +inline void +Subdivider::simple_link( Arc_ptr jarc1, Arc_ptr jarc2 ) +{ + Arc_ptr tmp = jarc2->prev; + jarc2->prev = jarc1->prev; + jarc1->prev = tmp; + jarc2->prev->next = jarc2; + jarc1->prev->next = jarc1; +} + + +/*---------------------------------------------------------------------------- + * join - add a pair of oppositely directed jordan arcs between two arcs + *---------------------------------------------------------------------------- + */ + +void +Subdivider::join_s( Bin& left, Bin& right, Arc_ptr jarc1, Arc_ptr jarc2 ) +{ + assert( jarc1->check( ) != 0); + assert( jarc2->check( ) != 0); + assert( jarc1 != jarc2 ); + + if( ! jarc1->getitail() ) + jarc1 = jarc1->next; + + if( ! jarc2->getitail() ) + jarc2 = jarc2->next; + + REAL s = jarc1->tail()[0]; + REAL t1 = jarc1->tail()[1]; + REAL t2 = jarc2->tail()[1]; + + if( t1 == t2 ) { + simple_link( jarc1, jarc2 ); + } else { + Arc_ptr newright = new(arcpool) Arc( arc_right, 0 ); + Arc_ptr newleft = new(arcpool) Arc( arc_left, 0 ); + assert( t1 < t2 ); + if( isBezierArcType() ) { + arctessellator.bezier( newright, s, s, t1, t2 ); + arctessellator.bezier( newleft, s, s, t2, t1 ); + } else { + arctessellator.pwl_right( newright, s, t1, t2, stepsizes[0] ); + arctessellator.pwl_left( newleft, s, t2, t1, stepsizes[2] ); + } + link( jarc1, jarc2, newright, newleft ); + left.addarc( newright ); + right.addarc( newleft ); + } + + assert( jarc1->check( ) != 0 ); + assert( jarc2->check( ) != 0 ); + assert( jarc1->next->check( ) != 0); + assert( jarc2->next->check( ) != 0); +} + +void +Subdivider::check_t( Arc_ptr jarc1, Arc_ptr jarc2 ) +{ + assert( jarc1->check( ) != 0 ); + assert( jarc2->check( ) != 0 ); + assert( jarc1->next->check( ) != 0 ); + assert( jarc2->next->check( ) != 0 ); + assert( jarc1 != jarc2 ); + + /* XXX - if these assertions fail, it is due to user error or + undersampling */ + if( ! ( jarc1->tail()[1] < (jarc1)->head()[1] ) ) { +#ifndef NDEBUG + _glu_dprintf( "t difference %f\n", jarc1->tail()[1] - (jarc1)->head()[1] ); +#endif + ::mylongjmp( jumpbuffer, 28 ); + } + + if( ! ( jarc2->tail()[1] > (jarc2)->head()[1] ) ) { +#ifndef NDEBUG + _glu_dprintf( "t difference %f\n", jarc2->tail()[1] - (jarc2)->head()[1] ); +#endif + ::mylongjmp( jumpbuffer, 28 ); + } +} + +/*---------------------------------------------------------------------------- + * join_t - add a pair of oppositely directed jordan arcs between two arcs + *---------------------------------------------------------------------------- + */ + +void +Subdivider::join_t( Bin& bottom, Bin& top, Arc_ptr jarc1, Arc_ptr jarc2 ) +{ + assert( jarc1->check( ) != 0 ); + assert( jarc2->check( ) != 0 ); + assert( jarc1->next->check( ) != 0 ); + assert( jarc2->next->check( ) != 0 ); + assert( jarc1 != jarc2 ); + + if( ! jarc1->getitail() ) + jarc1 = jarc1->next; + + if( ! jarc2->getitail() ) + jarc2 = jarc2->next; + + REAL s1 = jarc1->tail()[0]; + REAL s2 = jarc2->tail()[0]; + REAL t = jarc1->tail()[1]; + + if( s1 == s2 ) { + simple_link( jarc1, jarc2 ); + } else { + Arc_ptr newtop = new(arcpool) Arc( arc_top, 0 ); + Arc_ptr newbot = new(arcpool) Arc( arc_bottom, 0 ); + assert( s1 > s2 ); + if( isBezierArcType() ) { + arctessellator.bezier( newtop, s1, s2, t, t ); + arctessellator.bezier( newbot, s2, s1, t, t ); + } else { + arctessellator.pwl_top( newtop, t, s1, s2, stepsizes[1] ); + arctessellator.pwl_bottom( newbot, t, s2, s1, stepsizes[3] ); + } + link( jarc1, jarc2, newtop, newbot ); + bottom.addarc( newtop ); + top.addarc( newbot ); + } + + assert( jarc1->check( ) != 0 ); + assert( jarc2->check( ) != 0 ); + assert( jarc1->next->check( ) != 0 ); + assert( jarc2->next->check( ) != 0 ); +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/subdivider.cc b/mesalib/src/glu/sgi/libnurbs/internals/subdivider.cc new file mode 100644 index 000000000..cc0b51470 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/subdivider.cc @@ -0,0 +1,910 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * subdivider.cxx + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "subdivider.h" +#include "arc.h" +#include "bezierarc.h" +#include "bin.h" +#include "renderhints.h" +#include "backend.h" +#include "mapdesc.h" +#include "quilt.h" +#include "patchlist.h" +#include "patch.h" +#include "nurbsconsts.h" +#include "trimvertpool.h" +#include "simplemath.h" + +#include "polyUtil.h" //for function area() + +//#define PARTITION_TEST +#ifdef PARTITION_TEST +#include "partitionY.h" +#include "monoTriangulation.h" +#include "dataTransform.h" +#include "monoChain.h" + +#endif + + +#define OPTIMIZE_UNTRIMED_CASE + + +Bin* +Subdivider::makePatchBoundary( const REAL *from, const REAL *to ) +{ + Bin* ret = new Bin(); + REAL smin = from[0]; + REAL smax = to[0]; + REAL tmin = from[1]; + REAL tmax = to[1]; + + pjarc = 0; + + Arc_ptr jarc = new(arcpool) Arc( arc_bottom, 0 ); + arctessellator.bezier( jarc, smin, smax, tmin, tmin ); + ret->addarc( jarc ); + pjarc = jarc->append( pjarc ); + + jarc = new(arcpool) Arc( arc_right, 0 ); + arctessellator.bezier( jarc, smax, smax, tmin, tmax ); + ret->addarc( jarc ); + pjarc = jarc->append( pjarc ); + + jarc = new(arcpool) Arc( arc_top, 0 ); + arctessellator.bezier( jarc, smax, smin, tmax, tmax ); + ret->addarc( jarc ); + pjarc = jarc->append( pjarc ); + + jarc = new(arcpool) Arc( arc_left, 0 ); + arctessellator.bezier( jarc, smin, smin, tmax, tmin ); + ret->addarc( jarc ); + jarc->append( pjarc ); + + assert( jarc->check() != 0 ); + return ret; +} + +/*--------------------------------------------------------------------------- + * Subdivider - construct a subdivider + *--------------------------------------------------------------------------- + */ + +Subdivider::Subdivider( Renderhints& r, Backend& b ) + : slicer( b ), + arctessellator( trimvertexpool, pwlarcpool ), + arcpool( sizeof( Arc), 1, "arcpool" ), + bezierarcpool( sizeof( BezierArc ), 1, "Bezarcpool" ), + pwlarcpool( sizeof( PwlArc ), 1, "Pwlarcpool" ), + renderhints( r ), + backend( b ) +{ +} + +void +Subdivider::setJumpbuffer( JumpBuffer *j ) +{ + jumpbuffer = j; +} + +/*--------------------------------------------------------------------------- + * clear - reset all state after possible error condition + *--------------------------------------------------------------------------- + */ + +void +Subdivider::clear( void ) +{ + trimvertexpool.clear(); + arcpool.clear(); + pwlarcpool.clear(); + bezierarcpool.clear(); +} + +/*--------------------------------------------------------------------------- + * ~Subdivider - destroy a subdivider + *--------------------------------------------------------------------------- + */ + +Subdivider::~Subdivider( void ) +{ +} + +/*--------------------------------------------------------------------------- + * addArc - add a bezier arc to a trim loop and to a bin + *--------------------------------------------------------------------------- + */ +void +Subdivider::addArc( REAL *cpts, Quilt *quilt, long _nuid ) +{ + BezierArc *bezierArc = new(bezierarcpool) BezierArc; + Arc *jarc = new(arcpool) Arc( arc_none, _nuid ); + jarc->pwlArc = 0; + jarc->bezierArc = bezierArc; + bezierArc->order = quilt->qspec->order; + bezierArc->stride = quilt->qspec->stride; + bezierArc->mapdesc = quilt->mapdesc; + bezierArc->cpts = cpts; + initialbin.addarc( jarc ); + pjarc = jarc->append( pjarc ); +} + +/*--------------------------------------------------------------------------- + * addArc - add a pwl arc to a trim loop and to a bin + *--------------------------------------------------------------------------- + */ + +void +Subdivider::addArc( int npts, TrimVertex *pts, long _nuid ) +{ + Arc *jarc = new(arcpool) Arc( arc_none, _nuid ); + jarc->pwlArc = new(pwlarcpool) PwlArc( npts, pts ); + initialbin.addarc( jarc ); + pjarc = jarc->append( pjarc ); +} + +void +Subdivider::beginQuilts( void ) +{ + qlist = 0; +} + +void +Subdivider::addQuilt( Quilt *quilt ) +{ + quilt->next = qlist; + qlist = quilt; +} + +/*--------------------------------------------------------------------------- + * drawSurfaces - main entry point for surface tessellation + *--------------------------------------------------------------------------- + */ + +void +Subdivider::drawSurfaces( long nuid ) +{ + renderhints.init( ); + + if (qlist == NULL) + { + //initialbin could be nonempty due to some errors + freejarcs(initialbin); + return; + } + + for( Quilt *q = qlist; q; q = q->next ) { + if( q->isCulled( ) == CULL_TRIVIAL_REJECT ) { + freejarcs( initialbin ); + return; + } + } + + + REAL from[2], to[2]; + qlist->getRange( from, to, spbrkpts, tpbrkpts ); +#ifdef OPTIMIZE_UNTRIMED_CASE + //perform optimization only when the samplng method is + //DOMAIN_DISTANCE and the display methdo is either + //fill or outline_polygon. + int optimize = (is_domain_distance_sampling && (renderhints.display_method != N_OUTLINE_PATCH)); +#endif + + if( ! initialbin.isnonempty() ) { +#ifdef OPTIMIZE_UNTRIMED_CASE + if(! optimize ) + { + + makeBorderTrim( from, to ); + } +#else + makeBorderTrim( from, to ); +#endif + } else { + REAL rate[2]; + qlist->findRates( spbrkpts, tpbrkpts, rate ); + + if( decompose( initialbin, min(rate[0], rate[1]) ) ) + mylongjmp( jumpbuffer, 31 ); + } + + backend.bgnsurf( renderhints.wiretris, renderhints.wirequads, nuid ); + +#ifdef PARTITION_TEST + if( initialbin.isnonempty() && spbrkpts.end-2 == spbrkpts.start && + tpbrkpts.end-2 == tpbrkpts.start) +{ + for(int i=spbrkpts.start; idownloadAll(pta, ptb, backend); + + directedLine *poly; + + { + + poly = bin_to_DLineLoops(initialbin); + + poly=poly->deleteDegenerateLinesAllPolygons(); + + sampledLine* retSampledLines; +//printf("before MC_partition\n"); + poly = MC_partitionY(poly, &retSampledLines); +//printf("after MC_partition\n"); + + } + + + { + primStream pStream(5000,5000); + directedLine* temp; + + for(temp=poly; temp != NULL; temp=temp->getNextPolygon()) + + monoTriangulation(temp, &pStream); + + slicer.evalStream(&pStream); + + } + //need to clean up space + } + } + freejarcs( initialbin ); + backend.endsurf(); + return; + + /* + printf("num_polygons=%i\n", poly->numPolygons()); + printf("num_edges=%i\n", poly->numEdgesAllPolygons()); + poly->writeAllPolygons("zloutputFile"); + return; + { + primStream pStream(20,20); + for(directedLine* tempD = poly; tempD != NULL; tempD = tempD->getNextPolygon()) + monoTriangulation(tempD, &pStream); + } + return; + */ +} +#endif //PARTITION_TEST + + +#ifdef OPTIMIZE_UNTRIMED_CASE + if( (!initialbin.isnonempty()) && optimize ) + { + int i,j; + int num_u_steps; + int num_v_steps; + for(i=spbrkpts.start; idownloadAll(pta, ptb, backend); + + num_u_steps = (int) (domain_distance_u_rate * (ptb[0]-pta[0])); + num_v_steps = (int) (domain_distance_v_rate * (ptb[1]-pta[1])); + + if(num_u_steps <= 0) num_u_steps = 1; + if(num_v_steps <= 0) num_v_steps = 1; + + backend.surfgrid(pta[0], ptb[0], num_u_steps, + ptb[1], pta[1], num_v_steps); + backend.surfmesh(0,0,num_u_steps,num_v_steps); + + + + continue; + /* the following is left for reference purpose, don't delete + { + Bin* tempSource; + Patchlist patchlist(qlist, pta, ptb); + patchlist.getstepsize(); + + tempSource=makePatchBoundary(pta, ptb); + + tessellation(*tempSource, patchlist); + + render(*tempSource); + delete tempSource; + } + */ + } + } + } + else + subdivideInS( initialbin ); +#else + + subdivideInS( initialbin ); +#endif + + backend.endsurf(); + +} + +void +Subdivider::subdivideInS( Bin& source ) +{ + if( renderhints.display_method == N_OUTLINE_PARAM ) { + outline( source ); + freejarcs( source ); + } else { + setArcTypeBezier(); + setNonDegenerate(); + splitInS( source, spbrkpts.start, spbrkpts.end ); + } +} + + +/*--------------------------------------------------------------------------- + * splitInS - split a patch and a bin by an isoparametric line + *--------------------------------------------------------------------------- + */ + +void +Subdivider::splitInS( Bin& source, int start, int end ) +{ + if( source.isnonempty() ) { + if( start != end ) { + int i = start + (end - start) / 2; + Bin left, right; + split( source, left, right, 0, spbrkpts.pts[i] ); + splitInS( left, start, i ); + splitInS( right, i+1, end ); + } else { + if( start == spbrkpts.start || start == spbrkpts.end ) { + freejarcs( source ); + } else if( renderhints.display_method == N_OUTLINE_PARAM_S ) { + outline( source ); + freejarcs( source ); + } else { + setArcTypeBezier(); + setNonDegenerate(); + s_index = start; + splitInT( source, tpbrkpts.start, tpbrkpts.end ); + } + } + } +} + +/*--------------------------------------------------------------------------- + * splitInT - split a patch and a bin by an isoparametric line + *--------------------------------------------------------------------------- + */ + +void +Subdivider::splitInT( Bin& source, int start, int end ) +{ + if( source.isnonempty() ) { + if( start != end ) { + int i = start + (end - start) / 2; + Bin left, right; + split( source, left, right, 1, tpbrkpts.pts[i] ); + splitInT( left, start, i ); + splitInT( right, i+1, end ); + } else { + if( start == tpbrkpts.start || start == tpbrkpts.end ) { + freejarcs( source ); + } else if( renderhints.display_method == N_OUTLINE_PARAM_ST ) { + outline( source ); + freejarcs( source ); + } else { + t_index = start; + setArcTypeBezier(); + setDegenerate(); + + REAL pta[2], ptb[2]; + pta[0] = spbrkpts.pts[s_index-1]; + pta[1] = tpbrkpts.pts[t_index-1]; + + ptb[0] = spbrkpts.pts[s_index]; + ptb[1] = tpbrkpts.pts[t_index]; + qlist->downloadAll( pta, ptb, backend ); + + Patchlist patchlist( qlist, pta, ptb ); +/* +printf("-------samplingSplit-----\n"); +source.show("samplingSplit source"); +*/ + samplingSplit( source, patchlist, renderhints.maxsubdivisions, 0 ); + setNonDegenerate(); + setArcTypeBezier(); + } + } + } +} + +/*-------------------------------------------------------------------------- + * samplingSplit - recursively subdivide patch, cull check each subpatch + *-------------------------------------------------------------------------- + */ + +void +Subdivider::samplingSplit( + Bin& source, + Patchlist& patchlist, + int subdivisions, + int param ) +{ + if( ! source.isnonempty() ) return; + + if( patchlist.cullCheck() == CULL_TRIVIAL_REJECT ) { + freejarcs( source ); + return; + } + + patchlist.getstepsize(); + + if( renderhints.display_method == N_OUTLINE_PATCH ) { + tessellation( source, patchlist ); + outline( source ); + freejarcs( source ); + return; + } + + //patchlist.clamp(); + + tessellation( source, patchlist ); + + if( patchlist.needsSamplingSubdivision() && (subdivisions > 0) ) { + if( ! patchlist.needsSubdivision( 0 ) ) + param = 1; + else if( ! patchlist.needsSubdivision( 1 ) ) + param = 0; + else + param = 1 - param; + + Bin left, right; + REAL mid = ( patchlist.pspec[param].range[0] + + patchlist.pspec[param].range[1] ) * 0.5; + split( source, left, right, param, mid ); + Patchlist subpatchlist( patchlist, param, mid ); + samplingSplit( left, subpatchlist, subdivisions-1, param ); + samplingSplit( right, patchlist, subdivisions-1, param ); + } else { + setArcTypePwl(); + setDegenerate(); + nonSamplingSplit( source, patchlist, subdivisions, param ); + setDegenerate(); + setArcTypeBezier(); + } +} + +void +Subdivider::nonSamplingSplit( + Bin& source, + Patchlist& patchlist, + int subdivisions, + int param ) +{ + if( patchlist.needsNonSamplingSubdivision() && (subdivisions > 0) ) { + param = 1 - param; + + Bin left, right; + REAL mid = ( patchlist.pspec[param].range[0] + + patchlist.pspec[param].range[1] ) * 0.5; + split( source, left, right, param, mid ); + Patchlist subpatchlist( patchlist, param, mid ); + if( left.isnonempty() ) + if( subpatchlist.cullCheck() == CULL_TRIVIAL_REJECT ) + freejarcs( left ); + else + nonSamplingSplit( left, subpatchlist, subdivisions-1, param ); + if( right.isnonempty() ) + if( patchlist.cullCheck() == CULL_TRIVIAL_REJECT ) + freejarcs( right ); + else + nonSamplingSplit( right, patchlist, subdivisions-1, param ); + + } else { + // make bbox calls + patchlist.bbox(); + backend.patch( patchlist.pspec[0].range[0], patchlist.pspec[0].range[1], + patchlist.pspec[1].range[0], patchlist.pspec[1].range[1] ); + + if( renderhints.display_method == N_OUTLINE_SUBDIV ) { + outline( source ); + freejarcs( source ); + } else { + setArcTypePwl(); + setDegenerate(); + findIrregularS( source ); + monosplitInS( source, smbrkpts.start, smbrkpts.end ); + } + } +} + +/*-------------------------------------------------------------------------- + * tessellation - set tessellation of interior and boundary of patch + *-------------------------------------------------------------------------- + */ + +void +Subdivider::tessellation( Bin& bin, Patchlist &patchlist ) +{ + // tessellate unsampled trim curves + tessellate( bin, patchlist.pspec[1].sidestep[1], patchlist.pspec[0].sidestep[1], + patchlist.pspec[1].sidestep[0], patchlist.pspec[0].sidestep[0] ); + + // set interior sampling rates + slicer.setstriptessellation( patchlist.pspec[0].stepsize, patchlist.pspec[1].stepsize ); + + //added by zl: set the order which will be used in slicer.c++ + slicer.set_ulinear( (patchlist.get_uorder() == 2)); + slicer.set_vlinear( (patchlist.get_vorder() == 2)); + + // set boundary sampling rates + stepsizes[0] = patchlist.pspec[1].stepsize; + stepsizes[1] = patchlist.pspec[0].stepsize; + stepsizes[2] = patchlist.pspec[1].stepsize; + stepsizes[3] = patchlist.pspec[0].stepsize; +} + +/*--------------------------------------------------------------------------- + * monosplitInS - split a patch and a bin by an isoparametric line + *--------------------------------------------------------------------------- + */ + +void +Subdivider::monosplitInS( Bin& source, int start, int end ) +{ + if( source.isnonempty() ) { + if( start != end ) { + int i = start + (end - start) / 2; + Bin left, right; + split( source, left, right, 0, smbrkpts.pts[i] ); + monosplitInS( left, start, i ); + monosplitInS( right, i+1, end ); + } else { + if( renderhints.display_method == N_OUTLINE_SUBDIV_S ) { + outline( source ); + freejarcs( source ); + } else { + setArcTypePwl(); + setDegenerate(); + findIrregularT( source ); + monosplitInT( source, tmbrkpts.start, tmbrkpts.end ); + } + } + } +} + +/*--------------------------------------------------------------------------- + * monosplitInT - split a patch and a bin by an isoparametric line + *--------------------------------------------------------------------------- + */ + +void +Subdivider::monosplitInT( Bin& source, int start, int end ) +{ + if( source.isnonempty() ) { + if( start != end ) { + int i = start + (end - start) / 2; + Bin left, right; + split( source, left, right, 1, tmbrkpts.pts[i] ); + monosplitInT( left, start, i ); + monosplitInT( right, i+1, end ); + } else { + if( renderhints.display_method == N_OUTLINE_SUBDIV_ST ) { + outline( source ); + freejarcs( source ); + } else { +/* +printf("*******render\n"); +source.show("source\n"); +*/ + render( source ); + freejarcs( source ); + } + } + } +} + + +/*---------------------------------------------------------------------------- + * findIrregularS - determine points of non-monotonicity is s direction + *---------------------------------------------------------------------------- + */ + +void +Subdivider::findIrregularS( Bin& bin ) +{ + assert( bin.firstarc()->check() != 0 ); + + smbrkpts.grow( bin.numarcs() ); + + for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) { + REAL *a = jarc->prev->tail(); + REAL *b = jarc->tail(); + REAL *c = jarc->head(); + + if( b[1] == a[1] && b[1] == c[1] ) continue; + + //corrected code + if((b[1]<=a[1] && b[1] <= c[1]) || + (b[1]>=a[1] && b[1] >= c[1])) + { + //each arc (jarc, jarc->prev, jarc->next) is a + //monotone arc consisting of multiple line segements. + //it may happen that jarc->prev and jarc->next are the same, + //that is, jarc->prev and jarc form a closed loop. + //In such case, a and c will be the same. + if(a[0]==c[0] && a[1] == c[1]) + { + if(jarc->pwlArc->npts >2) + { + c = jarc->pwlArc->pts[jarc->pwlArc->npts-2].param; + } + else + { + assert(jarc->prev->pwlArc->npts>2); + a = jarc->prev->pwlArc->pts[jarc->prev->pwlArc->npts-2].param; + } + + } + if(area(a,b,c) < 0) + { + smbrkpts.add(b[0]); + } + + } + + /* old code, + if( b[1] <= a[1] && b[1] <= c[1] ) { + if( ! ccwTurn_tr( jarc->prev, jarc ) ) + smbrkpts.add( b[0] ); + } else if( b[1] >= a[1] && b[1] >= c[1] ) { + if( ! ccwTurn_tl( jarc->prev, jarc ) ) + smbrkpts.add( b[0] ); + } + */ + + } + + smbrkpts.filter(); +} + +/*---------------------------------------------------------------------------- + * findIrregularT - determine points of non-monotonicity in t direction + * where one arc is parallel to the s axis. + *---------------------------------------------------------------------------- + */ + +void +Subdivider::findIrregularT( Bin& bin ) +{ + assert( bin.firstarc()->check() != 0 ); + + tmbrkpts.grow( bin.numarcs() ); + + for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) { + REAL *a = jarc->prev->tail(); + REAL *b = jarc->tail(); + REAL *c = jarc->head(); + + if( b[0] == a[0] && b[0] == c[0] ) continue; + + if( b[0] <= a[0] && b[0] <= c[0] ) { + if( a[1] != b[1] && b[1] != c[1] ) continue; + if( ! ccwTurn_sr( jarc->prev, jarc ) ) + tmbrkpts.add( b[1] ); + } else if ( b[0] >= a[0] && b[0] >= c[0] ) { + if( a[1] != b[1] && b[1] != c[1] ) continue; + if( ! ccwTurn_sl( jarc->prev, jarc ) ) + tmbrkpts.add( b[1] ); + } + } + tmbrkpts.filter( ); +} + +/*----------------------------------------------------------------------------- + * makeBorderTrim - if no user input trimming data then create + * a trimming curve around the boundaries of the Quilt. The curve consists of + * four Jordan arcs, one for each side of the Quilt, connected, of course, + * head to tail. + *----------------------------------------------------------------------------- + */ + +void +Subdivider::makeBorderTrim( const REAL *from, const REAL *to ) +{ + REAL smin = from[0]; + REAL smax = to[0]; + REAL tmin = from[1]; + REAL tmax = to[1]; + + pjarc = 0; + + Arc_ptr jarc = new(arcpool) Arc( arc_bottom, 0 ); + arctessellator.bezier( jarc, smin, smax, tmin, tmin ); + initialbin.addarc( jarc ); + pjarc = jarc->append( pjarc ); + + jarc = new(arcpool) Arc( arc_right, 0 ); + arctessellator.bezier( jarc, smax, smax, tmin, tmax ); + initialbin.addarc( jarc ); + pjarc = jarc->append( pjarc ); + + jarc = new(arcpool) Arc( arc_top, 0 ); + arctessellator.bezier( jarc, smax, smin, tmax, tmax ); + initialbin.addarc( jarc ); + pjarc = jarc->append( pjarc ); + + jarc = new(arcpool) Arc( arc_left, 0 ); + arctessellator.bezier( jarc, smin, smin, tmax, tmin ); + initialbin.addarc( jarc ); + jarc->append( pjarc ); + + assert( jarc->check() != 0 ); +} + +/*---------------------------------------------------------------------------- + * render - renders all monotone regions in a bin and frees the bin + *---------------------------------------------------------------------------- + */ + +void +Subdivider::render( Bin& bin ) +{ + bin.markall(); + +#ifdef N_ISOLINE_S + slicer.setisolines( ( renderhints.display_method == N_ISOLINE_S ) ? 1 : 0 ); +#else + slicer.setisolines( 0 ); +#endif + + for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) { + if( jarc->ismarked() ) { + assert( jarc->check( ) != 0 ); + Arc_ptr jarchead = jarc; + do { + jarc->clearmark(); + jarc = jarc->next; + } while (jarc != jarchead); + slicer.slice( jarc ); + } + } +} + +/*--------------------------------------------------------------------------- + * outline - render the trimmed patch by outlining the boundary + *--------------------------------------------------------------------------- + */ + +void +Subdivider::outline( Bin& bin ) +{ + bin.markall(); + for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) { + if( jarc->ismarked() ) { + assert( jarc->check( ) != 0 ); + Arc_ptr jarchead = jarc; + do { + slicer.outline( jarc ); + jarc->clearmark(); + jarc = jarc->prev; + } while (jarc != jarchead); + } + } +} + +/*--------------------------------------------------------------------------- + * freejarcs - free all arcs in a bin + *--------------------------------------------------------------------------- + */ + +void +Subdivider::freejarcs( Bin& bin ) +{ + bin.adopt(); /* XXX - should not be necessary */ + + Arc_ptr jarc; + while( (jarc = bin.removearc()) != NULL ) { + if( jarc->pwlArc ) jarc->pwlArc->deleteMe( pwlarcpool ); jarc->pwlArc = 0; + if( jarc->bezierArc) jarc->bezierArc->deleteMe( bezierarcpool ); jarc->bezierArc = 0; + jarc->deleteMe( arcpool ); + } +} + +/*---------------------------------------------------------------------------- + * tessellate - tessellate all Bezier arcs in a bin + * 1) only accepts linear Bezier arcs as input + * 2) the Bezier arcs are stored in the pwlArc structure + * 3) only vertical or horizontal lines work + * -- should + * 1) represent Bezier arcs in BezierArc structure + * (this requires a multitude of changes to the code) + * 2) accept high degree Bezier arcs (hard) + * 3) map the curve onto the surface to determine tessellation + * 4) work for curves of arbitrary geometry + *---------------------------------------------------------------------------- + */ + + +void +Subdivider::tessellate( Bin& bin, REAL rrate, REAL trate, REAL lrate, REAL brate ) +{ + for( Arc_ptr jarc=bin.firstarc(); jarc; jarc=bin.nextarc() ) { + if( jarc->isbezier( ) ) { + assert( jarc->pwlArc->npts == 2 ); + TrimVertex *pts = jarc->pwlArc->pts; + REAL s1 = pts[0].param[0]; + REAL t1 = pts[0].param[1]; + REAL s2 = pts[1].param[0]; + REAL t2 = pts[1].param[1]; + + jarc->pwlArc->deleteMe( pwlarcpool ); jarc->pwlArc = 0; + + switch( jarc->getside() ) { + case arc_left: + assert( s1 == s2 ); + arctessellator.pwl_left( jarc, s1, t1, t2, lrate ); + break; + case arc_right: + assert( s1 == s2 ); + arctessellator.pwl_right( jarc, s1, t1, t2, rrate ); + break; + case arc_top: + assert( t1 == t2 ); + arctessellator.pwl_top( jarc, t1, s1, s2, trate ); + break; + case arc_bottom: + assert( t1 == t2 ); + arctessellator.pwl_bottom( jarc, t1, s1, s2, brate ); + break; + case arc_none: + (void) abort(); + break; + } + assert( ! jarc->isbezier() ); + assert( jarc->check() != 0 ); + } + } +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/subdivider.h b/mesalib/src/glu/sgi/libnurbs/internals/subdivider.h new file mode 100644 index 000000000..4d5395181 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/subdivider.h @@ -0,0 +1,200 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * subdivider.h + * + */ + +#ifndef __glusubdivider_h_ +#define __glusubdivider_h_ + +#include "mysetjmp.h" +#include "bin.h" +#include "flist.h" +#include "slicer.h" +#include "arctess.h" +#include "trimvertex.h" +#include "trimvertpool.h" + +class Arc; +class Pool; +class Renderhints; +class Quilt; +class Patchlist; +class Curvelist; +struct JumpBuffer; + +class Subdivider { +public: + Subdivider( Renderhints&, Backend& ); + ~Subdivider( void ); + void clear( void ); + + void beginTrims( void ) {} + void beginLoop( void ); + void addArc( REAL *, Quilt *, long ); + void addArc( int, TrimVertex *, long ); + void endLoop( void ) {} + void endTrims( void ) {} + + void beginQuilts( void ); + void addQuilt( Quilt * ); + void endQuilts( void ) {} + + void drawCurves( void ); + void drawSurfaces( long ); + + int ccwTurn_sl( Arc_ptr, Arc_ptr ); + int ccwTurn_sr( Arc_ptr , Arc_ptr ); + int ccwTurn_tl( Arc_ptr , Arc_ptr ); + int ccwTurn_tr( Arc_ptr , Arc_ptr ); + + void setJumpbuffer( JumpBuffer * ); + + void set_domain_distance_u_rate(REAL u_rate) + { + domain_distance_u_rate = u_rate; + } + void set_domain_distance_v_rate(REAL v_rate) + { + domain_distance_v_rate = v_rate; + } + void set_is_domain_distance_sampling(int flag) + { + is_domain_distance_sampling = flag; + } + +private: + void classify_headonleft_s( Bin &, Bin &, Bin &, REAL ); + void classify_tailonleft_s( Bin &, Bin &, Bin &, REAL ); + void classify_headonright_s( Bin &, Bin &, Bin &, REAL ); + void classify_tailonright_s( Bin &, Bin &, Bin &, REAL ); + void classify_headonleft_t( Bin &, Bin &, Bin &, REAL ); + void classify_tailonleft_t( Bin &, Bin &, Bin &, REAL ); + void classify_headonright_t( Bin &, Bin &, Bin &, REAL ); + void classify_tailonright_t( Bin &, Bin &, Bin &, REAL ); + + enum dir { down, same, up, none }; + void tessellate( Arc_ptr, REAL ); + void monotonize( Arc_ptr , Bin & ); + int isMonotone( Arc_ptr ); + int decompose( Bin &, REAL ); + + + Slicer slicer; + ArcTessellator arctessellator; + Pool arcpool; + Pool bezierarcpool; + Pool pwlarcpool; + TrimVertexPool trimvertexpool; + + JumpBuffer* jumpbuffer; + Renderhints& renderhints; + Backend& backend; + + Bin initialbin; + Arc_ptr pjarc; + int s_index; + int t_index; + Quilt * qlist; + Flist spbrkpts; + Flist tpbrkpts; + Flist smbrkpts; + Flist tmbrkpts; + REAL stepsizes[4]; + int showDegenerate; + int isArcTypeBezier; + + void samplingSplit( Curvelist&, int ); + + void subdivideInS( Bin& ); + void splitInS( Bin&, int, int ); + void splitInT( Bin&, int, int ); + void samplingSplit( Bin&, Patchlist&, int, int ); + void nonSamplingSplit( Bin&, Patchlist&, int, int ); + void tessellation( Bin&, Patchlist& ); + void monosplitInS( Bin&, int, int ); + void monosplitInT( Bin&, int, int ); + + void outline( Bin & ); + void freejarcs( Bin & ); + void render( Bin & ); + void split( Bin &, Bin &, Bin &, int, REAL ); + void tessellate( Bin &, REAL, REAL, REAL, REAL ); + + inline void setDegenerate( void ) { showDegenerate = 1; } + inline void setNonDegenerate( void ) { showDegenerate = 0; } + inline int showingDegenerate( void ) { return showDegenerate; } + inline void setArcTypeBezier( void ) { isArcTypeBezier = 1; } + inline void setArcTypePwl( void ) { isArcTypeBezier = 0; } + inline int isBezierArcType( void ) { return isArcTypeBezier; } + + void makeBorderTrim( const REAL *, const REAL * ); + void split( Bin &, int, const REAL *, int, int ); + void partition( Bin &, Bin &, Bin &, Bin &, Bin &, int, REAL ); + void findIrregularS( Bin & ); + void findIrregularT( Bin & ); + + + inline int bbox( TrimVertex *, TrimVertex *, TrimVertex *, int ); + static int bbox( REAL, REAL, REAL, REAL, REAL, REAL ); + static int ccw( TrimVertex *, TrimVertex *, TrimVertex * ); + void join_s( Bin &, Bin &, Arc_ptr, Arc_ptr ); + void join_t( Bin &, Bin &, Arc_ptr , Arc_ptr ); + int arc_split( Arc_ptr , int, REAL, int ); + void check_s( Arc_ptr , Arc_ptr ); + void check_t( Arc_ptr , Arc_ptr ); + inline void link( Arc_ptr , Arc_ptr , Arc_ptr , Arc_ptr ); + inline void simple_link( Arc_ptr , Arc_ptr ); + + Bin* makePatchBoundary( const REAL *from, const REAL *to ); + + /*in domain distance method, the tessellation is controled by two numbers: + *GLU_U_STEP: number of u-segments per unit u length of domain + *GLU_V_STEP: number of v-segments per unit v length of domain + *These two numbers are normally stored in mapdesc->maxs(t)rate. + *I (ZL) put these two numbers here so that I can optimize the untrimmed + *case in the case of domain distance sampling. + *These two numbers are set by set_domain_distance_u_rate() and ..._v_..(). + */ + REAL domain_distance_u_rate; + REAL domain_distance_v_rate; + int is_domain_distance_sampling; +}; + +inline void +Subdivider::beginLoop( void ) +{ + pjarc = 0; +} + + +#endif /* __glusubdivider_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/tobezier.cc b/mesalib/src/glu/sgi/libnurbs/internals/tobezier.cc new file mode 100644 index 000000000..531f26bc7 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/tobezier.cc @@ -0,0 +1,687 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * tobezier.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "mystring.h" +#include "quilt.h" +#include "knotvector.h" + +/* local type definitions */ +struct Breakpt { /* breakpoints */ + Knot value; /* value */ + int multi; /* multiplicity */ + int def; /* deficit */ +}; + +struct Knotspec { /* knotvector format */ + long order; /* order of spline */ + Knot_ptr inkbegin; /* input knot sequence */ + Knot_ptr inkend; /* location after last knot */ + Knot_ptr outkbegin; /* in-process knot subsequence */ + Knot_ptr outkend; /* location after last knot */ + Knot_ptr kleft; /* */ + Knot_ptr kright; /* */ + Knot_ptr kfirst; /* */ + Knot_ptr klast; /* */ + Knot_ptr sbegin; /* conversion factor values */ + Breakpt * bbegin; /* in-process breakpoints */ + Breakpt * bend; /* last breakpoint */ + int ncoords; /* coordinates per control point */ + int prestride; /* stride between input points */ + int poststride; /* stride between output points */ + int preoffset; /* scaled point offset */ + int postoffset; /* scaled point offset */ + int prewidth; /* width of dimension */ + int postwidth; /* width of dimension */ + int istransformed; /* was dimension transformed */ + Knotspec * next; /* next knotspec */ + Knotspec * kspectotrans; /* knotspec in transformation direction */ + + Knotspec( void ); + ~Knotspec( void ); + void factors( void ); + void insert( REAL * ); + void preselect(); + void select( void ); + void copy( INREAL *, REAL * ); + void breakpoints( void ); + void knots( void ); + void transform( REAL * ); + void showpts( REAL * ); + + void pt_io_copy( REAL *, INREAL * ); + void pt_oo_copy( REAL *, REAL * ); + void pt_oo_sum( REAL*, REAL*, REAL*, Knot, Knot ); +}; + +struct Splinespec { /* a non-uniform tensor element */ + Splinespec( int ); + ~Splinespec(void); + Knotspec *kspec; /* format of each param. dir. */ + int dim; /* domain dimension */ + REAL * outcpts; /* Bezier control points */ + + void kspecinit( Knotvector & ); + void kspecinit( Knotvector &, Knotvector & ); + void select( void ); + void layout( long ); + void setupquilt( Quilt_ptr ); + void copy( INREAL * ); + void transform( void ); +}; + +/*----------------------------------------------------------------------------- + * Quilt::toBezier - convert from NURBS to rational Bezier + *----------------------------------------------------------------------------- + */ + +void +Quilt::toBezier( + Knotvector& knotvector, /* a knot vector */ + INREAL *ctlpts, /* input contol points */ + long ncoords ) /* number of coordinates per control point */ +{ + Splinespec spline( 1 ); + spline.kspecinit( knotvector ); + spline.select(); + spline.layout( ncoords ); + spline.setupquilt( this ); + spline.copy( ctlpts ); + spline.transform(); +} + +void +Quilt::toBezier( + Knotvector& sknotvector, /* a knot vector */ + Knotvector& tknotvector, /* a knot vector */ + INREAL *ctlpts, /* input contol points */ + long ncoords ) /* number of coordinates per control point */ +{ + Splinespec spline( 2 ); + spline.kspecinit( sknotvector, tknotvector ); + spline.select(); + spline.layout( ncoords ); + spline.setupquilt( this ); + spline.copy( ctlpts ); + spline.transform(); +} +Splinespec::Splinespec( int dimen ) +{ + dim = dimen; +} + +Splinespec::~Splinespec( void ) +{ + /* Note: do NOT delete 'outcpts' here since its address (not contents) + * is copied in 'cpts' in this file in function Splinespec::setupquilt(). + * This block of memory will eventually be deleted in file quilt.c++ in + * function Quilt::deleteMe() through 'cpts' so do NOT delete it here! + */ + Knotspec *ktrav= kspec; //start at beginning of list + while (ktrav != 0) { //any items to delete? + Knotspec *deleteThis= ktrav; //remember to delete this + ktrav= ktrav->next; //go to next item if any + delete deleteThis; //delete it + } +} /* ~Splinespec() */ + +/*----------------------------------------------------------------------------- + * Splinespec::kspecinit - initialize Splinespec structure + * + * Client: Quilt::toBezier + *----------------------------------------------------------------------------- + */ + +void +Splinespec::kspecinit( Knotvector& knotvector ) +{ + kspec = new Knotspec; + kspec->inkbegin = knotvector.knotlist; + kspec->inkend = knotvector.knotlist + knotvector.knotcount; + kspec->prestride = (int) knotvector.stride; + kspec->order = knotvector.order; + kspec->next = NULL; +} + +void +Splinespec::kspecinit( Knotvector& sknotvector, Knotvector& tknotvector ) +{ + kspec = new Knotspec; + Knotspec *tkspec = new Knotspec; + + kspec->inkbegin = sknotvector.knotlist; + kspec->inkend = sknotvector.knotlist + sknotvector.knotcount; + kspec->prestride = (int) sknotvector.stride; + kspec->order = sknotvector.order; + kspec->next = tkspec; + + tkspec->inkbegin = tknotvector.knotlist; + tkspec->inkend = tknotvector.knotlist + tknotvector.knotcount; + tkspec->prestride = (int) tknotvector.stride; + tkspec->order = tknotvector.order; + tkspec->next = NULL; +} + + +/*----------------------------------------------------------------------------- + * Splinespec::select - select the subsegments to copy + * + * Client: gl_quilt_to_bezier + *----------------------------------------------------------------------------- + */ + +void +Splinespec::select( ) +{ + for( Knotspec *knotspec = kspec; knotspec; knotspec = knotspec->next ) { + knotspec->preselect(); + knotspec->select(); + } +} + +/*----------------------------------------------------------------------------- + * Splinespec::layout - + * + * Client: gl_quilt_to_bezier + *----------------------------------------------------------------------------- + */ + +void +Splinespec::layout( long ncoords ) +{ + + long stride = ncoords; + for( Knotspec *knotspec = kspec; knotspec; knotspec=knotspec->next ) { + knotspec->poststride = (int) stride; + stride *= ((knotspec->bend-knotspec->bbegin)*knotspec->order + knotspec->postoffset); + knotspec->preoffset *= knotspec->prestride; + knotspec->prewidth *= knotspec->poststride; + knotspec->postwidth *= knotspec->poststride; + knotspec->postoffset *= knotspec->poststride; + knotspec->ncoords = (int) ncoords; + } + outcpts = new REAL[stride]; + assert( outcpts != 0 ); +} + +/*----------------------------------------------------------------------------- + * Splinespec::copy - copy the control points of current subobject + * + * Client: gl_quilt_to_bezier + *----------------------------------------------------------------------------- + */ + +void +Splinespec::copy( INREAL *incpts ) +{ + kspec->copy( incpts, outcpts ); +} + +/*----------------------------------------------------------------------------- + * Splinespec::setupquilt - assign all quilt variables from knotspec + * + * Client: gl_quilt_to_bezier + *----------------------------------------------------------------------------- + */ + +void +Splinespec::setupquilt( Quilt_ptr quilt ) +{ + Quiltspec_ptr qspec = quilt->qspec; + quilt->eqspec = qspec + dim; + for( Knotspec *knotspec = kspec; knotspec; knotspec=knotspec->next, qspec++ ) { + qspec->stride = knotspec->poststride; + qspec->width = knotspec->bend - knotspec->bbegin; + qspec->order = (int) knotspec->order; + qspec->offset = knotspec->postoffset; + qspec->index = 0; + qspec->bdry[0] = (knotspec->kleft == knotspec->kfirst) ? 1 : 0; + qspec->bdry[1] = (knotspec->kright == knotspec->klast) ? 1 : 0; + qspec->breakpoints = new Knot[qspec->width+1]; + Knot_ptr k = qspec->breakpoints; + for( Breakpt *bk = knotspec->bbegin; bk <= knotspec->bend; bk++ ) + *(k++) = bk->value; + } + quilt->cpts = outcpts; + quilt->next = 0; +} + +/*----------------------------------------------------------------------------- + * Splinespec::transform - convert a spline to Bezier format + * + * Client: gl_quilt_to_bezier + *----------------------------------------------------------------------------- + */ + +void +Splinespec::transform( void ) +{ + Knotspec *knotspec; + for( knotspec = kspec; knotspec; knotspec=knotspec->next ) + knotspec->istransformed = 0; + + for( knotspec = kspec; knotspec; knotspec=knotspec->next ) { + for( Knotspec *kspec2 = kspec; kspec2; kspec2=kspec2->next ) + kspec2->kspectotrans = knotspec; + kspec->transform( outcpts ); + knotspec->istransformed = 1; + } +} + + +/*----------------------------------------------------------------------------- + * Knotspec::Knotspec - constuct a knot spec + *----------------------------------------------------------------------------- + */ + +Knotspec::Knotspec( void ) +{ + bbegin = 0; + sbegin = 0; + outkbegin = 0; +} + +/*----------------------------------------------------------------------------- + * Knotspec::copy - copy the control points along minor direction + * + * Client: Splinespec::copy + *----------------------------------------------------------------------------- + */ + +void +Knotspec::copy( INREAL *inpt, REAL *outpt ) +{ + inpt = (INREAL *) (((char *) inpt) + preoffset); + + if( next ) { + for( REAL *lpt=outpt+prewidth; outpt != lpt; outpt += poststride ) { + next->copy( inpt, outpt ); + inpt = (INREAL *) (((char *) inpt) + prestride); + } + } else { + for( REAL *lpt=outpt+prewidth; outpt != lpt; outpt += poststride ) { + pt_io_copy( outpt, inpt ); + inpt = (INREAL *) (((char *) inpt) + prestride); + } + } +} + +/*----------------------------------------------------------------------------- + * Knotspec::showpts - print out points before transformation + * + * Client: Knotspec::select + *----------------------------------------------------------------------------- + */ +void +Knotspec::showpts( REAL *outpt ) +{ + if( next ) { + for( REAL *lpt=outpt+prewidth; outpt != lpt; outpt += poststride ) + next->showpts( outpt ); + } else { + for( REAL *lpt=outpt+prewidth; outpt != lpt; outpt += poststride ) + _glu_dprintf( "show %g %g %g\n", outpt[0], outpt[1], outpt[2] ); + } +} + +/*----------------------------------------------------------------------------- + * Knotspec::factors - precompute scale factors + * - overwrites knot vector, actual new knot vector is NOT produced + * + * Client: Knotspec::select + *----------------------------------------------------------------------------- + */ + +void +Knotspec::factors( void ) +{ + Knot *mid = (outkend - 1) - order + bend->multi; + Knot_ptr fptr = sbegin; + + for( Breakpt *bpt = bend; bpt >= bbegin; bpt-- ) { + mid -= bpt->multi; // last knot less than knot to insert + int def = bpt->def - 1; // number of knots to insert + if( def <= 0 ) continue; + Knot kv = bpt->value; // knot to insert + + Knot *kf = (mid-def) + (order-1); + for( Knot *kl = kf + def; kl != kf; kl-- ) { + Knot *kh, *kt; + for( kt=kl, kh=mid; kt != kf; kh--, kt-- ) + *(fptr++) = (kv - *kh) / (*kt - *kh); + *kl = kv; + } + } +} + +/*----------------------------------------------------------------------------- + * Knotspec::insert - convert subobject in direction of kspec into Bezier + * + * Client: Knotspec::transform + *----------------------------------------------------------------------------- + */ + +void +Knotspec::insert( REAL *p ) +{ + Knot_ptr fptr = sbegin; + REAL *srcpt = p + prewidth - poststride; + REAL *dstpt = p + postwidth + postoffset - poststride; + Breakpt *bpt = bend; + + for( REAL *pend = srcpt - poststride*bpt->def; srcpt != pend; pend +=poststride ) { + REAL *p1 = srcpt; + for( REAL *p2 = srcpt-poststride; p2 != pend; p1 = p2, p2 -= poststride ) { + pt_oo_sum( p1, p1, p2, *fptr, 1.0-*fptr ); + fptr++; + } + } + + for( --bpt; bpt >= bbegin; bpt-- ) { + + for( int multi = bpt->multi; multi > 0; multi-- ) { + pt_oo_copy( dstpt, srcpt ); + dstpt -= poststride; + srcpt -= poststride; + } + + for( REAL *pend = srcpt - poststride*bpt->def; srcpt != pend; pend +=poststride, dstpt-=poststride ) { + pt_oo_copy( dstpt, srcpt ); + REAL *p1 = srcpt; + + for( REAL *p2 = srcpt-poststride; p2 != pend; p1=p2, p2 -= poststride ) { + pt_oo_sum( p1, p1, p2, *fptr, 1.0-*fptr ); + fptr++; + } + } + } +} + +/*----------------------------------------------------------------------------- + * Knotspec::preselect - initialize kspec for processing + * + * Client: Splinespec::select + *----------------------------------------------------------------------------- + */ + +void +Knotspec::preselect( void ) +{ + Knot kval; + + /* position klast after last knot of "last" breakpoint */ + for( klast = inkend - order, kval = *klast; klast != inkend; klast++ ) + if( ! identical( *klast, kval ) ) break; + + /* position kfirst after last knot of "first" breakpoint */ + for( kfirst = inkbegin+order-1, kval= *kfirst; kfirst != inkend; kfirst++ ) + if( ! identical( *kfirst, kval ) ) break; + + /* compute multiplicity of first breakpoint */ + Knot_ptr k; + for( k = kfirst - 1; k >= inkbegin; k-- ) + if( ! identical( kval, *k ) ) break; + k++; + + /* allocate space for breakpoints - + use worst case estimate on number of breakpoints */ + + bbegin = new Breakpt[(klast - kfirst)+1]; + /* record multiplicity and value of first breakpoint */ + bbegin->multi = kfirst - k; + bbegin->value = kval; + bend = bbegin; + + kleft = kright = kfirst; +} + + +/*----------------------------------------------------------------------------- + * Knotspec::select - Knotspec::select segments and precompute scale factors + * + * Client: Splinespec::select + *----------------------------------------------------------------------------- + */ + +void +Knotspec::select( void ) +{ + breakpoints(); + knots(); + factors(); + + preoffset = kleft - (inkbegin + order); + postwidth = (int)((bend - bbegin) * order); + prewidth = (int)((outkend - outkbegin) - order); + postoffset = (bbegin->def > 1) ? (bbegin->def-1) : 0; +} + +/*----------------------------------------------------------------------------- + * Knotspec::breakpoints - compute breakpoints for knotspec + * + * Client: Knotspec::select + *----------------------------------------------------------------------------- + */ + +void +Knotspec::breakpoints( void ) +{ + Breakpt *ubpt = bbegin; + Breakpt *ubend = bend; + long nfactors = 0; + + ubpt->value = ubend->value; + ubpt->multi = ubend->multi; + + kleft = kright; + + for( ; kright != klast; kright++ ) { + if ( identical(*kright,ubpt->value) ) { + (ubpt->multi)++; + } else { + ubpt->def = (int) (order - ubpt->multi); + nfactors += (ubpt->def * (ubpt->def - 1)) / 2; + (++ubpt)->value = *kright; + ubpt->multi = 1; + } + } + ubpt->def = (int) (order - ubpt->multi); + nfactors += (ubpt->def * (ubpt->def - 1)) / 2; + + bend = ubpt; + + if( nfactors ) { + sbegin = new Knot[nfactors]; + } else { + sbegin = NULL; + } +} + + +/*----------------------------------------------------------------------------- + * Knotspec::knots - copy relevant subsequence of knots into temporary area + * + * Client: Knotspec::select + *----------------------------------------------------------------------------- + */ + +void +Knotspec::knots( void ) +{ + Knot_ptr inkpt = kleft - order; + Knot_ptr inkend = kright + bend->def; + + /* allocate space for knots and factors */ + outkbegin = new Knot[inkend-inkpt]; + Knot_ptr outkpt; + for( outkpt = outkbegin; inkpt != inkend; inkpt++, outkpt++ ) + *outkpt = *inkpt; + + outkend = outkpt; +} + + +/*----------------------------------------------------------------------------- + * Knotspec::transform - convert a spline along a given direction + * + * Client: Splienspec::transform + *----------------------------------------------------------------------------- + */ + +void +Knotspec::transform( REAL *p ) +{ + if( next ) { + if( this == kspectotrans ) { + next->transform( p ); + } else { + if( istransformed ) { + p += postoffset; + for( REAL *pend = p + postwidth; p != pend; p += poststride ) + next->transform( p ); + } else { + REAL *pend = p + prewidth; + for( ; p != pend; p += poststride ) + next->transform( p ); + } + } + } else { + if( this == kspectotrans ) { + insert( p ); + } else { + if( istransformed ) { + p += postoffset; + for( REAL *pend = p + postwidth; p != pend; p += poststride ) + kspectotrans->insert( p ); + } else { + REAL *pend = p + prewidth; + for( ; p != pend; p += poststride ) + kspectotrans->insert( p ); + } + } + } +} + +/*----------------------------------------------------------------------------- + * Knotspec::~Knotspec - free space alocated for knotspec + *----------------------------------------------------------------------------- + */ + +Knotspec::~Knotspec( void ) +{ + if( bbegin ) delete[] bbegin; + if( sbegin ) delete[] sbegin; + if( outkbegin ) delete[] outkbegin; +} + + +/*----------------------------------------------------------------------------- + * pt_io_copy - make internal copy of input cntrl pt. of x coords + *----------------------------------------------------------------------------- + */ + +void +Knotspec::pt_io_copy( REAL *topt, INREAL *frompt ) +{ + switch( ncoords ) { + case 4: + topt[3] = (REAL) frompt[3]; + case 3: + topt[2] = (REAL) frompt[2]; + case 2: + topt[1] = (REAL) frompt[1]; + case 1: + topt[0] = (REAL) frompt[0]; + break; + default: { + for( int i = 0; i < ncoords; i++ ) + *topt++ = (REAL) *frompt++; + } + } +} + +/*----------------------------------------------------------------------------- + * pt_oo_copy - make internal copy of internal cntrl pt. of x coords + *----------------------------------------------------------------------------- + */ + +void +Knotspec::pt_oo_copy( REAL *topt, REAL *frompt ) +{ + switch( ncoords ) { + case 4: + topt[3] = frompt[3]; + case 3: + topt[2] = frompt[2]; + case 2: + topt[1] = frompt[1]; + case 1: + topt[0] = frompt[0]; + break; + default: + memcpy( topt, frompt, ncoords * sizeof( REAL ) ); + } +} + +/*----------------------------------------------------------------------------- + * pt_oo_sum - compute affine combination of internal cntrl pts + *----------------------------------------------------------------------------- + */ + +void +Knotspec::pt_oo_sum( REAL *x, REAL *y, REAL *z, Knot a, Knot b ) +{ + switch( ncoords ) { + case 4: + x[3] = a * y[3] + b * z[3]; + case 3: + x[2] = a * y[2] + b * z[2]; + case 2: + x[1] = a * y[1] + b * z[1]; + case 1: + x[0] = a * y[0] + b * z[0]; + break; + default: { + for( int i = 0; i < ncoords; i++ ) + *x++ = a * *y++ + b * *z++; + } + } +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/trimline.cc b/mesalib/src/glu/sgi/libnurbs/internals/trimline.cc new file mode 100644 index 000000000..61f34cd38 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/trimline.cc @@ -0,0 +1,223 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * trimline.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "trimline.h" +#include "backend.h" + +Trimline::Trimline() +{ + size = 0; pts = 0; numverts = 0; + tinterp = &t; binterp = &b; +} + +Trimline::~Trimline() +{ + if( pts ) delete[] pts; +} + +void +Trimline::init( TrimVertex *v ) +{ + reset(); + grow(1); + append(v); +} + +inline void +Trimline::grow( long npts ) +{ + if( size < npts ) { + size = 2 * npts; + if( pts ) delete[] pts; + pts = new TrimVertex_p[size]; + } +} + +inline void +Trimline::append( TrimVertex *v ) +{ + assert( numverts != size ); + pts[numverts++] = v; +} + +void +Trimline::init( long npts, Arc_ptr jarc, long last ) +{ + jarcl.init( jarc, 0, last ); + grow( npts + 2 ); +} + +inline void +Trimline::swap() +{ + TrimVertex *tmp=tinterp; + tinterp=binterp; + binterp=tmp; +} + +void +Trimline::getNextPt() +{ + *binterp = *jarcl.getnextpt(); +} + +void +Trimline::getPrevPt() +{ + *binterp = *jarcl.getprevpt(); +} + +/*---------------------------------------------------------------------- + * getNextPts - make arrays of pointers to trim points on left and right + * hulls of trim strip. + *---------------------------------------------------------------------- + */ +void +Trimline::getNextPts( REAL vval, Backend& backend ) +{ + reset(); swap(); append( tinterp ); + assert( tinterp->param[1] >= vval ); + + register TrimVertex *p; + for( p=jarcl.getnextpt() ; p->param[1] >= vval; p=jarcl.getnextpt() ) { + append( p ); + } + + /* compute and copy pointer to final point on left hull */ + if( interpvert( last(), p, binterp, vval ) ) { + binterp->nuid = p->nuid; + backend.triangle( p, binterp, last() ); + append( binterp ); + } + jarcl.reverse(); + (void) jarcl.getprevpt(); /* reset jarcl to proper position */ + jarcl.reverse(); +} + +void +Trimline::getPrevPts( REAL vval, Backend& backend ) +{ + reset(); swap(); append( tinterp ); + assert( tinterp->param[1] >= vval ); + + register TrimVertex *q; + for( q=jarcl.getprevpt(); q->param[1] >= vval; q=jarcl.getprevpt() ) { + append( q ); + } + + /* compute and copy pointer to final point on right hull */ + if( interpvert( q, last(), binterp, vval ) ) { + binterp->nuid = q->nuid; + backend.triangle( last(), binterp, q ); + append( binterp ); + } + jarcl.reverse(); + (void) jarcl.getnextpt(); /* reset jarcl to proper position */ + jarcl.reverse(); +} + +void +Trimline::getNextPts( Arc_ptr botarc ) +{ + reset(); swap(); append( tinterp ); + +#ifndef NDEBUG + PwlArc *lastpwl = botarc->prev->pwlArc; + TrimVertex *lastpt1 = &lastpwl->pts[lastpwl->npts-1]; +#endif + TrimVertex *lastpt2 = botarc->pwlArc->pts; + register TrimVertex *p = jarcl.getnextpt(); + for( append( p ); p != lastpt2; append( p ) ) { + assert( p != lastpt1 ); + p = jarcl.getnextpt(); + } +} + +void +Trimline::getPrevPts( Arc_ptr botarc ) +{ + reset(); swap(); append( tinterp ); + + PwlArc *lastpwl = botarc->prev->pwlArc; + TrimVertex *lastpt1 = &lastpwl->pts[lastpwl->npts-1]; +#ifndef NDEBUG + TrimVertex *lastpt2 = botarc->pwlArc->pts; +#endif + + register TrimVertex *q = jarcl.getprevpt(); + for( append( q ); q != lastpt1; append( q ) ) { + assert( q != lastpt2 ); + q = jarcl.getprevpt(); + } +} + + +long +Trimline::interpvert( TrimVertex *a, TrimVertex *b, TrimVertex *c, REAL vval ) +{ + REAL denom = a->param[1] - b->param[1]; + + if(denom != 0) { + if( vval == a->param[1] ) { + c->param[0] = a->param[0]; + c->param[1] = a->param[1]; + c->nuid = a->nuid; + return 0; + } else if( vval == b->param[1] ) { + c->param[0] = b->param[0]; + c->param[1] = b->param[1]; + c->nuid = b->nuid; + return 0; + } else { + REAL r = (a->param[1] - vval)/denom; + c->param[0] = a->param[0] - r * (a->param[0] - b->param[0]); + c->param[1] = vval; + return 1; + } + } else { + c->param[0] = a->param[0]; + c->param[1] = a->param[1]; + c->nuid = a->nuid; + return 0; + } +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/trimline.h b/mesalib/src/glu/sgi/libnurbs/internals/trimline.h new file mode 100644 index 000000000..ecc884284 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/trimline.h @@ -0,0 +1,103 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * trimline.h + * + */ + +#ifndef __glutrimline_h_ +#define __glutrimline_h_ + +class Arc; +class Backend; + +#include "trimvertex.h" +#include "jarcloc.h" + + +class Trimline { +private: + TrimVertex** pts; + long numverts; + long i; + long size; + Jarcloc jarcl; + TrimVertex t, b; + TrimVertex *tinterp, *binterp; + void reset( void ) { numverts = 0; } + inline void grow( long ); + inline void swap( void ); + inline void append( TrimVertex * ); + static long interpvert( TrimVertex *, TrimVertex *, TrimVertex *, REAL ); + + + +public: + Trimline(); + ~Trimline(); + void init( TrimVertex * ); + void init( long, Arc_ptr, long ); + void getNextPt( void ); + void getPrevPt( void ); + void getNextPts( REAL, Backend & ); + void getPrevPts( REAL, Backend & ); + void getNextPts( Arc_ptr ); + void getPrevPts( Arc_ptr ); + inline TrimVertex * next( void ); + inline TrimVertex * prev( void ); + inline TrimVertex * first( void ); + inline TrimVertex * last( void ); +}; + +inline TrimVertex * +Trimline::next( void ) +{ + if( i < numverts) return pts[i++]; else return 0; +} + +inline TrimVertex * +Trimline::prev( void ) +{ + if( i >= 0 ) return pts[i--]; else return 0; +} + +inline TrimVertex * +Trimline::first( void ) +{ + i = 0; return pts[i]; +} + +inline TrimVertex * +Trimline::last( void ) +{ + i = numverts; return pts[--i]; +} +#endif /* __glutrimline_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/trimregion.cc b/mesalib/src/glu/sgi/libnurbs/internals/trimregion.cc new file mode 100644 index 000000000..efe789356 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/trimregion.cc @@ -0,0 +1,114 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * trimregion.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "trimregion.h" +#include "backend.h" + +TrimRegion::TrimRegion( void ) +{ +} + +void +TrimRegion::setDu( REAL du ) +{ + oneOverDu = 1.0/du; +} + +void +TrimRegion::init( long npts, Arc_ptr extrema ) +{ + left.init( npts, extrema, extrema->pwlArc->npts - 1 ); + left.getNextPt(); + + right.init( npts, extrema, 0 ); + right.getPrevPt(); +} + +void +TrimRegion::getPts( Arc_ptr extrema ) +{ + left.getNextPts( extrema ); + right.getPrevPts( extrema ); +} + +void +TrimRegion::getPts( Backend &backend ) +{ + left.getNextPts( bot.vval, backend ); + right.getPrevPts( bot.vval, backend ); +} + +void +TrimRegion::getGridExtent( void ) +{ + getGridExtent( left.last(), right.last() ); +} + +void +TrimRegion::getGridExtent( TrimVertex *l, TrimVertex *r ) +{ + bot.ustart = (long) ((l->param[0] - uarray.uarray[0])*oneOverDu); + if( l->param[0] >= uarray.uarray[bot.ustart] ) bot.ustart++; +// if( l->param[0] > uarray.uarray[bot.ustart] ) bot.ustart++; + assert( l->param[0] <= uarray.uarray[bot.ustart] ); + assert( l->param[0] >= uarray.uarray[bot.ustart-1] ); + + bot.uend = (long) ((r->param[0] - uarray.uarray[0])*oneOverDu); + if( uarray.uarray[bot.uend] >= r->param[0] ) bot.uend--; +// if( uarray.uarray[bot.uend] > r->param[0] ) bot.uend--; + assert( r->param[0] >= uarray.uarray[bot.uend] ); + assert( r->param[0] <= uarray.uarray[bot.uend+1] ); +} + +int +TrimRegion::canTile( void ) +{ + TrimVertex *lf = left.first(); + TrimVertex *ll = left.last(); + TrimVertex *l = ( ll->param[0] > lf->param[0] ) ? ll : lf; + + TrimVertex *rf = right.first(); + TrimVertex *rl = right.last(); + TrimVertex *r = ( rl->param[0] < rf->param[0] ) ? rl : rf; + return (l->param[0] <= r->param[0]) ? 1 : 0; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/trimregion.h b/mesalib/src/glu/sgi/libnurbs/internals/trimregion.h new file mode 100644 index 000000000..ee15d7b98 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/trimregion.h @@ -0,0 +1,84 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * trimregion.h + * + */ + +#ifndef __glutrimregion_h_ +#define __glutrimregion_h_ + +#include "trimline.h" +#include "gridline.h" +#include "uarray.h" + +class Arc; +class Backend; + +class TrimRegion { +public: + TrimRegion(); + Trimline left; + Trimline right; + Gridline top; + Gridline bot; + Uarray uarray; + + void init( REAL ); + void advance( REAL, REAL, REAL ); + void setDu( REAL ); + void init( long, Arc_ptr ); + void getPts( Arc_ptr ); + void getPts( Backend & ); + void getGridExtent( TrimVertex *, TrimVertex * ); + void getGridExtent( void ); + int canTile( void ); +private: + REAL oneOverDu; +}; + +inline void +TrimRegion::init( REAL vval ) +{ + bot.vval = vval; +} + +inline void +TrimRegion::advance( REAL topVindex, REAL botVindex, REAL botVval ) +{ + top.vindex = (long) topVindex; + bot.vindex = (long) botVindex; + top.vval = bot.vval; + bot.vval = botVval; + top.ustart = bot.ustart; + top.uend = bot.uend; +} +#endif /* __glutrimregion_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/trimvertex.h b/mesalib/src/glu/sgi/libnurbs/internals/trimvertex.h new file mode 100644 index 000000000..2780b764a --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/trimvertex.h @@ -0,0 +1,63 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * trimvertex.h + * + */ + +#ifndef __glutrimvertex_h_ +#define __glutrimvertex_h_ + +#include "types.h" + +/*#define USE_OPTTT*/ + +class TrimVertex { /* a vertex on a trim curve */ +public: + REAL param[2]; /* parametric space coords */ +#ifdef USE_OPTTT + REAL cache_point[4]; //only when USE_OPTTT is on in slicer.c++ + REAL cache_normal[3]; +#endif + long nuid; +}; + +typedef class TrimVertex *TrimVertex_p; + +inline REAL +det3( TrimVertex *a, TrimVertex *b, TrimVertex *c ) +{ + return a->param[0] * (b->param[1]-c->param[1]) + + b->param[0] * (c->param[1]-a->param[1]) + + c->param[0] * (a->param[1]-b->param[1]); +} + +#endif /* __glutrimvertex_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/trimvertpool.cc b/mesalib/src/glu/sgi/libnurbs/internals/trimvertpool.cc new file mode 100644 index 000000000..3e5bd7038 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/trimvertpool.cc @@ -0,0 +1,119 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * trimvertexpool.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "mystring.h" +#include "trimvertex.h" +#include "trimvertpool.h" +#include "bufpool.h" + +/*---------------------------------------------------------------------------- + * TrimVertexPool::TrimVertexPool + *---------------------------------------------------------------------------- + */ +TrimVertexPool::TrimVertexPool( void ) + : pool( sizeof(TrimVertex)*3, 32, "Threevertspool" ) +{ + // initialize array of pointers to vertex lists + nextvlistslot = 0; + vlistsize = INIT_VERTLISTSIZE; + vlist = new TrimVertex_p[vlistsize]; +} + +/*---------------------------------------------------------------------------- + * TrimVertexPool::~TrimVertexPool + *---------------------------------------------------------------------------- + */ +TrimVertexPool::~TrimVertexPool( void ) +{ + // free all arrays of TrimVertices vertices + while( nextvlistslot ) { + delete [] vlist[--nextvlistslot]; + } + + // reallocate space for array of pointers to vertex lists + if( vlist ) delete[] vlist; +} + +/*---------------------------------------------------------------------------- + * TrimVertexPool::clear + *---------------------------------------------------------------------------- + */ +void +TrimVertexPool::clear( void ) +{ + // reinitialize pool of 3 vertex arrays + pool.clear(); + + // free all arrays of TrimVertices vertices + while( nextvlistslot ) { + delete [] vlist[--nextvlistslot]; + vlist[nextvlistslot] = 0; + } + + // reallocate space for array of pointers to vertex lists + if( vlist ) delete[] vlist; + vlist = new TrimVertex_p[vlistsize]; +} + + +/*---------------------------------------------------------------------------- + * TrimVertexPool::get - allocate a vertex list + *---------------------------------------------------------------------------- + */ +TrimVertex * +TrimVertexPool::get( int n ) +{ + TrimVertex *v; + if( n == 3 ) { + v = (TrimVertex *) pool.new_buffer(); + } else { + if( nextvlistslot == vlistsize ) { + vlistsize *= 2; + TrimVertex_p *nvlist = new TrimVertex_p[vlistsize]; + memcpy( nvlist, vlist, nextvlistslot * sizeof(TrimVertex_p) ); + if( vlist ) delete[] vlist; + vlist = nvlist; + } + v = vlist[nextvlistslot++] = new TrimVertex[n]; + } + return v; +} diff --git a/mesalib/src/glu/sgi/libnurbs/internals/trimvertpool.h b/mesalib/src/glu/sgi/libnurbs/internals/trimvertpool.h new file mode 100644 index 000000000..ebd3c04b1 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/trimvertpool.h @@ -0,0 +1,57 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * trimvertexpool.h + * + */ + +#ifndef __glutrimvertpool_h_ +#define __glutrimvertpool_h_ + +#include "bufpool.h" + +class TrimVertex; + +#define INIT_VERTLISTSIZE 200 + +class TrimVertexPool { +public: + TrimVertexPool( void ); + ~TrimVertexPool( void ); + void clear( void ); + TrimVertex * get( int ); +private: + Pool pool; + TrimVertex ** vlist; + int nextvlistslot; + int vlistsize; +}; +#endif /* __glutrimvertpool_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/types.h b/mesalib/src/glu/sgi/libnurbs/internals/types.h new file mode 100644 index 000000000..8b59625cf --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/types.h @@ -0,0 +1,47 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * types.h + * + */ + +#ifndef __glutypes_h_ +#define __glutypes_h_ + +//typedef double INREAL; +#define INREAL float +typedef float REAL; +typedef void (*Pfvv)( void ); +typedef void (*Pfvf)( float * ); +typedef int (*cmpfunc)(const void *, const void *); +typedef REAL Knot, *Knot_ptr;/* knot values */ + +#endif /* __glutypes_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/uarray.cc b/mesalib/src/glu/sgi/libnurbs/internals/uarray.cc new file mode 100644 index 000000000..f0e236437 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/uarray.cc @@ -0,0 +1,72 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * uarray.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "uarray.h" +#include "arc.h" + +Uarray::Uarray( void ) +{ + uarray = 0; + size = 0; +} + +Uarray::~Uarray( void ) +{ + if( uarray ) delete[] uarray; +} + +long +Uarray::init( REAL delta, Arc_ptr lo, Arc_ptr hi ) +{ + ulines = (long) ((hi->tail()[0] - lo->tail()[0])/delta) + 3; + if( size < ulines ) { + size = ulines * 2; + if( uarray ) delete[] uarray; + uarray = new REAL[size]; + assert( uarray != 0); + } + uarray[0] = lo->tail()[0] - delta/2.0; + for( long i = 1 ; i != ulines; i++ ) + uarray[i] = uarray[0] + i*delta; + return ulines; +} + diff --git a/mesalib/src/glu/sgi/libnurbs/internals/uarray.h b/mesalib/src/glu/sgi/libnurbs/internals/uarray.h new file mode 100644 index 000000000..cc6fae1b7 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/uarray.h @@ -0,0 +1,55 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * uarray.h + * + */ + +#ifndef __gluuarray_h_ +#define __gluuarray_h_ + +#include "types.h" + +class Arc; +typedef class Arc *Arc_ptr; + +class Uarray { +private: + long size; + long ulines; +public: + Uarray(); + ~Uarray(); + long init( REAL, Arc_ptr, Arc_ptr ); + REAL * uarray; +}; + +#endif /* __gluuarray_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/internals/varray.cc b/mesalib/src/glu/sgi/libnurbs/internals/varray.cc new file mode 100644 index 000000000..31cc73a9d --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/internals/varray.cc @@ -0,0 +1,144 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +/* + * varray.c++ + * + */ + +#include "glimports.h" +#include "myassert.h" +#include "mystdio.h" +#include "varray.h" +#include "arc.h" +#include "simplemath.h" // glu_abs() + +#define TINY 0.0001 +inline long sgn( REAL x ) +{ + return (x < -TINY) ? -1 : ((x > TINY) ? 1 : 0 ); +} + + +Varray::Varray( void ) +{ + varray = 0; + size = 0; +} + +Varray::~Varray( void ) +{ + if( varray ) delete[] varray; +} + +inline void +Varray::update( Arc_ptr arc, long dir[2], REAL val ) +{ + register long ds = sgn(arc->tail()[0] - arc->prev->tail()[0]); + register long dt = sgn(arc->tail()[1] - arc->prev->tail()[1]); + + if( dir[0] != ds || dir[1] != dt ) { + dir[0] = ds; + dir[1] = dt; + append( val ); + } +} + +void +Varray::grow( long guess ) +{ + if( size < guess ) { + size = guess * 2; + if( varray ) delete[] varray; + varray = new REAL[size]; + assert( varray != 0 ); + } +} + +long +Varray::init( REAL delta, Arc_ptr toparc, Arc_ptr botarc ) +{ + Arc_ptr left = toparc->next; + Arc_ptr right = toparc; + long ldir[2], rdir[2]; + + ldir[0] = sgn( left->tail()[0] - left->prev->tail()[0] ); + ldir[1] = sgn( left->tail()[1] - left->prev->tail()[1] ); + rdir[0] = sgn( right->tail()[0] - right->prev->tail()[0] ); + rdir[1] = sgn( right->tail()[1] - right->prev->tail()[1] ); + + vval[0] = toparc->tail()[1]; + numquads = 0; + + while( 1 ) { + switch( sgn( left->tail()[1] - right->prev->tail()[1] ) ) { + case 1: + left = left->next; + update( left, ldir, left->prev->tail()[1] ); + break; + case -1: + right = right->prev; + update( right, rdir, right->tail()[1] ); + break; + case 0: + if( glu_abs(left->tail()[1] - botarc->tail()[1]) < TINY) goto end; + if( glu_abs(left->tail()[0]-right->prev->tail()[0]) < TINY && + glu_abs(left->tail()[1]-right->prev->tail()[1]) < TINY) goto end; + left = left->next; + break; + } + } + +end: + append( botarc->tail()[1] ); + + grow( ((long) ((vval[0] - vval[numquads])/delta)) + numquads + 2 ); + + long i, index = 0; + for( i=0; i delta ) { + long steps = ((long) (dist/delta)) +1; + float deltav = - dist / (REAL) steps; + for( long j=1; j +#include +#include +#include "glimports.h" +#include "zlassert.h" + +#include "quicksort.h" +#include "directedLine.h" +#include "polyDBG.h" + +#ifdef __WATCOMC__ +#pragma warning 726 10 +#endif + +//we must return the newLine +directedLine* directedLine::deleteChain(directedLine* begin, directedLine* end) +{ + if(begin->head()[0] == end->tail()[0] && + begin->head()[1] == end->tail()[1] + ) + { + directedLine *ret = begin->prev; + begin->prev->next = end->next; + end->next->prev = begin->prev; + delete begin->sline; + delete end->sline; + delete begin; + delete end; + + return ret; + } + + directedLine* newLine; + sampledLine* sline = new sampledLine(begin->head(), end->tail()); + newLine = new directedLine(INCREASING, sline); + directedLine *p = begin->prev; + directedLine *n = end->next; + p->next = newLine; + n->prev = newLine; + newLine->prev = p; + newLine->next = n; + + delete begin->sline; + delete end->sline; + delete begin; + delete end; + return newLine; +} + + +void directedLine::deleteSingleLine(directedLine* dline) +{ + //make sure that dline->prev->tail is the same as + //dline->next->head. This is for numerical erros. + //for example, if we delete a line which is almost degeneate + //within (epsilon), then we want to make that the polygon after deletion + //is still a valid polygon + + dline->next->head()[0] = dline->prev->tail()[0]; + dline->next->head()[1] = dline->prev->tail()[1]; + + dline->prev->next = dline->next; + dline->next->prev = dline->prev; + + delete dline; + +} + +static Int myequal(Real a[2], Real b[2]) +{ + /* + if(a[0]==b[0] && a[1] == b[1]) + return 1; + else + return 0; + */ + + + if(fabs(a[0]-b[0]) < 0.00001 && + fabs(a[1]-b[1]) < 0.00001) + return 1; + else + return 0; + +} + +directedLine* directedLine::deleteDegenerateLines() +{ + //if there is only one edge or two edges, don't do anything + if(this->next == this) + return this; + if(this->next == this->prev) + return this; + + //find a nondegenerate line + directedLine* temp; + directedLine* first = NULL; + if(! myequal(head(), tail())) + /* + if(head()[0] != tail()[0] || + head()[1] != tail()[1]) + */ + first = this; + else + { + for(temp = this->next; temp != this; temp = temp->next) + { + /* + if(temp->head()[0] != temp->tail()[0] || + temp->head()[1] != temp->tail()[1]) + */ + if(! myequal(temp->head(), temp->tail())) + { + first = temp; + break; + } + + } + } + + //if there are no non-degenerate lines, then we simply return NULL. + if(first == NULL) + { + deleteSinglePolygonWithSline(); + return NULL; + } + + directedLine* tempNext = NULL; + for(temp =first->next; temp != first; temp = tempNext) + { + tempNext = temp->getNext(); +/* + if(temp->head()[0] == temp->tail()[0] && + temp->head()[1] == temp->tail()[1]) +*/ + + if(myequal(temp->head(), temp->tail())) + deleteSingleLine(temp); + } + return first; +} + +directedLine* directedLine::deleteDegenerateLinesAllPolygons() +{ + directedLine* temp; + directedLine *tempNext = NULL; + directedLine* ret= NULL; + directedLine* retEnd = NULL; + for(temp=this; temp != NULL; temp = tempNext) + { + tempNext = temp->nextPolygon; + temp->nextPolygon = NULL; + if(ret == NULL) + { + ret = retEnd = temp->deleteDegenerateLines(); + + } + else + { + directedLine *newPolygon = temp->deleteDegenerateLines(); + if(newPolygon != NULL) + { + retEnd->nextPolygon = temp->deleteDegenerateLines(); + retEnd = retEnd->nextPolygon; + } + } + } + return ret; +} + +directedLine* directedLine::cutIntersectionAllPoly(int &cutOccur) +{ + directedLine* temp; + directedLine *tempNext = NULL; + directedLine* ret= NULL; + directedLine* retEnd = NULL; + cutOccur = 0; + for(temp=this; temp != NULL; temp = tempNext) + { + int eachCutOccur=0; + tempNext = temp->nextPolygon; + temp->nextPolygon = NULL; + if(ret == NULL) + { + + ret = retEnd = DBG_cutIntersectionPoly(temp, eachCutOccur); + if(eachCutOccur) + cutOccur = 1; + } + else + { + + retEnd->nextPolygon = DBG_cutIntersectionPoly(temp, eachCutOccur); + retEnd = retEnd->nextPolygon; + if(eachCutOccur) + cutOccur = 1; + } + } + return ret; +} + + +void directedLine::deleteSinglePolygonWithSline() +{ + directedLine *temp, *tempNext; + prev->next = NULL; + for(temp=this; temp != NULL; temp = tempNext) + { + tempNext = temp->next; + delete temp->sline; + delete temp; + } +} + +void directedLine::deletePolygonListWithSline() +{ + directedLine *temp, *tempNext; + for(temp=this; temp != NULL; temp=tempNext) + { + tempNext = temp->nextPolygon; + temp->deleteSinglePolygonWithSline(); + } +} + +void directedLine::deleteSinglePolygon() +{ + directedLine *temp, *tempNext; + prev->next = NULL; + for(temp=this; temp != NULL; temp = tempNext) + { + tempNext = temp->next; + delete temp; + } +} + +void directedLine::deletePolygonList() +{ + directedLine *temp, *tempNext; + for(temp=this; temp != NULL; temp=tempNext) + { + tempNext = temp->nextPolygon; + temp->deleteSinglePolygon(); + } +} + + +/*a loop by itself*/ +directedLine::directedLine(short dir, sampledLine* sl) +{ + direction = dir; + sline = sl; + next = this; + prev = this; + nextPolygon = NULL; +// prevPolygon = NULL; + rootBit = 0;/*important to initilzae to 0 meaning not root yet*/ + + rootLink = NULL; + +} + +void directedLine::init(short dir, sampledLine* sl) +{ + direction = dir; + sline = sl; +} + +directedLine::directedLine() +{ + next = this; + prev = this; + nextPolygon = NULL; + rootBit = 0;/*important to initilzae to 0 meaning not root yet*/ + rootLink = NULL; +} + +directedLine::~directedLine() +{ +} + +Real* directedLine::head() +{ + + return (direction==INCREASING)? (sline->get_points())[0] : (sline->get_points())[sline->get_npoints()-1]; +} + +/*inline*/ Real* directedLine::getVertex(Int i) +{ + return (direction==INCREASING)? (sline->get_points())[i] : (sline->get_points())[sline->get_npoints() - 1 -i]; +} + +Real* directedLine::tail() +{ + return (direction==DECREASING)? (sline->get_points())[0] : (sline->get_points())[sline->get_npoints()-1]; +} + + /*insert a new line between prev and this*/ +void directedLine::insert(directedLine* nl) +{ + nl->next = this; + nl->prev = prev; + prev->next = nl; + prev = nl; + nl->rootLink = this; /*assuming that 'this' is the root!!!*/ +} + +Int directedLine::numEdges() +{ + Int ret=0; + directedLine* temp; + if(next == this) return 1; + + ret = 1; + for(temp = next; temp != this; temp = temp->next) + ret++; + return ret; +} + +Int directedLine::numEdgesAllPolygons() +{ + Int ret=0; + directedLine* temp; + for(temp=this; temp!= NULL; temp=temp->nextPolygon) + { + ret += temp->numEdges(); + } + return ret; +} + +/*return 1 if the double linked list forms a polygon. + */ +short directedLine::isPolygon() +{ + directedLine* temp; + + /*a polygon contains at least 3 edges*/ + if(numEdges() <=2) return 0; + + /*check this edge*/ + if(! isConnected()) return 0; + + /*check all other edges*/ + for(temp=next; temp != this; temp = temp->next){ + if(!isConnected()) return 0; + } + return 1; +} + +/*check if the head of this edge is connected to + *the tail of the prev + */ +short directedLine::isConnected() +{ + if( (head()[0] == prev->tail()[0]) && (head()[1] == prev->tail()[1])) + return 1; + else + return 0; +} + +Int compV2InY(Real A[2], Real B[2]) +{ + if(A[1] < B[1]) return -1; + if(A[1] == B[1] && A[0] < B[0]) return -1; + if(A[1] == B[1] && A[0] == B[0]) return 0; + return 1; +} + +Int compV2InX(Real A[2], Real B[2]) +{ + if(A[0] < B[0]) return -1; + if(A[0] == B[0] && A[1] < B[1]) return -1; + if(A[0] == B[0] && A[1] == B[1]) return 0; + return 1; +} + +/*compare two vertices NOT lines! + *A vertex is the head of a directed line. + *(x_1, y_1) <= (x_2, y_2) if + *either y_1 < y_2 + *or y_1 == y_2 && x_1 < x_2. + *return -1 if this->head() <= nl->head(), + *return 1 otherwise + */ +Int directedLine::compInY(directedLine* nl) +{ + if(head()[1] < nl->head()[1]) return -1; + if(head()[1] == nl->head()[1] && head()[0] < nl->head()[0]) return -1; + return 1; +} + +/*compare two vertices NOT lines! + *A vertex is the head of a directed line. + *(x_1, y_1) <= (x_2, y_2) if + *either x_1 < x_2 + *or x_1 == x_2 && y_1 < y_2. + *return -1 if this->head() <= nl->head(), + *return 1 otherwise + */ +Int directedLine::compInX(directedLine* nl) +{ + if(head()[0] < nl->head()[0]) return -1; + if(head()[0] == nl->head()[0] && head()[1] < nl->head()[1]) return -1; + return 1; +} + +/*used by sort precedures + */ +static Int compInY2(directedLine* v1, directedLine* v2) +{ + return v1->compInY(v2); +} +#ifdef NOT_USED +static Int compInX(directedLine* v1, directedLine* v2) +{ + return v1->compInX(v2); +} +#endif + +/*sort all the vertices NOT the lines! + *a vertex is the head of a directed line + */ +directedLine** directedLine::sortAllPolygons() +{ + Int total_num_edges = 0; + directedLine** array = toArrayAllPolygons(total_num_edges); + quicksort( (void**)array, 0, total_num_edges-1, (Int (*)(void *, void *)) compInY2); + + return array; +} + +void directedLine::printSingle() +{ + if(direction == INCREASING) + printf("direction is INCREASING\n"); + else + printf("direction is DECREASING\n"); + printf("head=%f,%f)\n", head()[0], head()[1]); + sline->print(); +} + +/*print one polygon*/ +void directedLine::printList() +{ + directedLine* temp; + printSingle(); + for(temp = next; temp!=this; temp=temp->next) + temp->printSingle(); +} + +/*print all the polygons*/ +void directedLine::printAllPolygons() +{ + directedLine *temp; + for(temp = this; temp!=NULL; temp = temp->nextPolygon) + { + printf("polygon:\n"); + temp->printList(); + } +} + +/*insert this polygon into the head of the old polygon List*/ +directedLine* directedLine::insertPolygon(directedLine* oldList) +{ + /*this polygon is a root*/ + setRootBit(); + if(oldList == NULL) return this; + nextPolygon = oldList; +/* oldList->prevPolygon = this;*/ + return this; +} + +/*cutoff means delete. but we don't deallocate any space, + *so we use cutoff instead of delete + */ +directedLine* directedLine::cutoffPolygon(directedLine *p) +{ + directedLine* temp; + directedLine* prev_polygon = NULL; + if(p == NULL) return this; + + for(temp=this; temp != p; temp = temp->nextPolygon) + { + if(temp == NULL) + { + fprintf(stderr, "in cutoffPolygon, not found\n"); + exit(1); + } + prev_polygon = temp; + } + +/* prev_polygon = p->prevPolygon;*/ + + p->resetRootBit(); + if(prev_polygon == NULL) /*this is the one to cutoff*/ + return nextPolygon; + else { + prev_polygon->nextPolygon = p->nextPolygon; + return this; + } +} + +Int directedLine::numPolygons() +{ + if(nextPolygon == NULL) return 1; + else return 1+nextPolygon->numPolygons(); +} + + +/*let array[index ...] denote + *all the edges in this polygon + *return the next available index of array. + */ +Int directedLine::toArraySinglePolygon(directedLine** array, Int index) +{ + directedLine *temp; + array[index++] = this; + for(temp = next; temp != this; temp = temp->next) + { + array[index++] = temp; + } + return index; +} + +/*the space is allocated. The caller is responsible for + *deallocate the space. + *total_num_edges is set to be the total number of edges of all polygons + */ +directedLine** directedLine::toArrayAllPolygons(Int& total_num_edges) +{ + total_num_edges=numEdgesAllPolygons(); + directedLine** ret = (directedLine**) malloc(sizeof(directedLine*) * total_num_edges); + assert(ret); + + directedLine *temp; + Int index = 0; + for(temp=this; temp != NULL; temp=temp->nextPolygon) { + index = temp->toArraySinglePolygon(ret, index); + } + return ret; +} + +/*assume the polygon is a simple polygon, return + *the area enclosed by it. + *if thee order is counterclock wise, the area is positive. + */ +Real directedLine::polyArea() +{ + directedLine* temp; + Real ret=0.0; + Real x1,y1,x2,y2; + x1 = this->head()[0]; + y1 = this->head()[1]; + x2 = this->next->head()[0]; + y2 = this->next->head()[1]; + ret = -(x2*y1-x1*y2); + for(temp=this->next; temp!=this; temp = temp->next) + { + x1 = temp->head()[0]; + y1 = temp->head()[1]; + x2 = temp->next->head()[0]; + y2 = temp->next->head()[1]; + ret += -( x2*y1-x1*y2); + } + return Real(0.5)*ret; +} + +/*******************split or combine polygons begin********************/ +/*conect a diagonal of a single simple polygon or two simple polygons. + *If the two vertices v1 (head) and v2 (head) are in the same simple polygon, + *then we actually split the simple polygon into two polygons. + *If instead two vertices velong to two difference polygons, + *then we combine the two polygons into one polygon. + *It is upto the caller to decide whether this is a split or a + *combination. + * + *Case Split: + *split a single simple polygon into two simple polygons by + *connecting a diagonal (two vertices). + *v1, v2: the two vertices are the head() of the two directedLines. + * this routine generates one new sampledLine which is returned in + *generatedLine, + *and it generates two directedLines returned in ret_p1 and ret_p2. + *ret_p1 and ret_p2 are used as the entry to the two new polygons. + *Notice the caller should not deallocate the space of v2 and v2 after + *calling this function, since all of the edges are connected to + *ret_p1 or ret_p2. + * + *combine: + *combine two simpolygons into one by connecting one diagonal. + *the returned polygon is returned in ret_p1. + */ +/*ARGSUSED*/ +void directedLine::connectDiagonal(directedLine* v1, directedLine* v2, + directedLine** ret_p1, + directedLine** ret_p2, + sampledLine** generatedLine, + directedLine* polygonList ) +{ + sampledLine *nsline = new sampledLine(2); + + + + nsline->setPoint(0, v1->head()); + nsline->setPoint(1, v2->head()); + + + + /*the increasing line is from v1 head to v2 head*/ + directedLine* newLineInc = new directedLine(INCREASING, nsline); + + + + directedLine* newLineDec = new directedLine(DECREASING, nsline); + + + directedLine* v1Prev = v1->prev; + directedLine* v2Prev = v2->prev; + + v1 ->prev = newLineDec; + v2Prev ->next = newLineDec; + newLineDec->next = v1; + newLineDec->prev = v2Prev; + + v2 ->prev = newLineInc; + v1Prev ->next = newLineInc; + newLineInc->next = v2; + newLineInc->prev = v1Prev; + + *ret_p1 = newLineDec; + *ret_p2 = newLineInc; + *generatedLine = nsline; +} + +//see the function connectDiangle +/*ARGSUSED*/ +void directedLine::connectDiagonal_2slines(directedLine* v1, directedLine* v2, + directedLine** ret_p1, + directedLine** ret_p2, + directedLine* polygonList ) +{ + sampledLine *nsline = new sampledLine(2); + sampledLine *nsline2 = new sampledLine(2); + + nsline->setPoint(0, v1->head()); + nsline->setPoint(1, v2->head()); + nsline2->setPoint(0, v1->head()); + nsline2->setPoint(1, v2->head()); + + /*the increasing line is from v1 head to v2 head*/ + directedLine* newLineInc = new directedLine(INCREASING, nsline); + + directedLine* newLineDec = new directedLine(DECREASING, nsline2); + + directedLine* v1Prev = v1->prev; + directedLine* v2Prev = v2->prev; + + v1 ->prev = newLineDec; + v2Prev ->next = newLineDec; + newLineDec->next = v1; + newLineDec->prev = v2Prev; + + v2 ->prev = newLineInc; + v1Prev ->next = newLineInc; + newLineInc->next = v2; + newLineInc->prev = v1Prev; + + *ret_p1 = newLineDec; + *ret_p2 = newLineInc; + +} + +Int directedLine::samePolygon(directedLine* v1, directedLine* v2) +{ + if(v1 == v2) return 1; + directedLine *temp; + for(temp = v1->next; temp != v1; temp = temp->next) + { + if(temp == v2) return 1; + } + return 0; +} + +directedLine* directedLine::findRoot() +{ + if(rootBit) return this; + directedLine* temp; + for(temp = next; temp != this; temp = temp->next) + if(temp -> rootBit ) return temp; + return NULL; /*should not happen*/ +} + +directedLine* directedLine::rootLinkFindRoot() +{ + directedLine* tempRoot; + directedLine* tempLink; + tempRoot = this; + tempLink = rootLink; + while(tempLink != NULL){ + tempRoot = tempLink; + tempLink = tempRoot->rootLink; + } + return tempRoot; +} + +/*******************split or combine polygons end********************/ + +/*****************IO stuff begin*******************/ + +/*format: + *#polygons + * #vertices + * vertices + * #vertices + * vertices + *... + */ +void directedLine::writeAllPolygons(char* filename) +{ + FILE* fp = fopen(filename, "w"); + assert(fp); + Int nPolygons = numPolygons(); + directedLine *root; + fprintf(fp, "%i\n", nPolygons); + for(root = this; root != NULL; root = root->nextPolygon) + { + directedLine *temp; + Int npoints=0; + npoints = root->get_npoints()-1; + for(temp = root->next; temp != root; temp=temp->next) + npoints += temp->get_npoints()-1; + fprintf(fp, "%i\n", npoints/*root->numEdges()*/); + + + for(Int i=0; iget_npoints()-1; i++){ + fprintf(fp, "%f ", root->getVertex(i)[0]); + fprintf(fp, "%f ", root->getVertex(i)[1]); + } + + for(temp=root->next; temp != root; temp = temp->next) + { + for(Int i=0; iget_npoints()-1; i++){ + + fprintf(fp, "%f ", temp->getVertex(i)[0]); + fprintf(fp, "%f ", temp->getVertex(i)[1]); + } + fprintf(fp,"\n"); + } + fprintf(fp, "\n"); + } + fclose(fp); +} + +directedLine* readAllPolygons(char* filename) +{ + Int i,j; + FILE* fp = fopen(filename, "r"); + assert(fp); + Int nPolygons; + fscanf(fp, "%i", &nPolygons); + directedLine *ret = NULL; + + for(i=0; irootLinkSet(NULL); + + directedLine *dLine; + for(j=2; jrootLinkSet(thisPoly); + thisPoly->insert(dLine); + } + + VV[0][0]=vert[1][0]; + VV[0][1]=vert[1][1]; + sLine = new sampledLine(2,VV); + dLine = new directedLine(INCREASING, sLine); +dLine->rootLinkSet(thisPoly); + thisPoly->insert(dLine); + + ret = thisPoly->insertPolygon(ret); + } + fclose(fp); + return ret; +} + + + + + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/directedLine.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/directedLine.h new file mode 100644 index 000000000..4ed0128ca --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/directedLine.h @@ -0,0 +1,171 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _DIRECTEDLINE_H +#define _DIRECTEDLINE_H + +#include "definitions.h" +#include "sampledLine.h" + +enum {INCREASING, DECREASING}; + +class directedLine { + short direction; /*INCREASING or DECREASING*/ + sampledLine* sline; + directedLine* next; /*double linked list*/ + directedLine* prev; /*double linked list*/ + + /*in case we need a list of polygons each + *consisting of a double linked list + */ + directedLine* nextPolygon; + + /*optimization make cutoff polygon faster*/ +/* directedLine* prevPolygon;*/ + + Int rootBit; /*1 if this is a root of the polygon, set by setRootBit*/ + /*and reset by resetRootBit()*/ + + directedLine* rootLink; /*fast root-finding*/ + + + +public: + directedLine(short dir, sampledLine* sl); + directedLine(); + ~directedLine(); + + void init(short dir, sampledLine* sl); + + Real* head(); /*points[0] if INCREASING, points[n-1] otherwise*/ + Real* tail(); /*points[n-1] if INCREASING, points[0] otherwise*/ + Real* getVertex(Int i); /*points[i] if INCREASING, points[n-1-i] otherwise*/ + Int get_npoints() {return sline->get_npoints();} + directedLine* getPrev() {return prev;} + directedLine* getNext() {return next;} + directedLine* getNextPolygon() {return nextPolygon;} + sampledLine* getSampledLine() {return sline;} + + short getDirection(){return direction;} + void putDirection(short dir) {direction = dir;} + void putPrev(directedLine *p) {prev = p;} + void putNext(directedLine *p) {next = p;} + + /*insert a new line between prev and this*/ + void insert(directedLine* nl); + + /*delete all the polygons following the link: nextPolygon. + *notice that sampledLine is not deleted. The caller is + *responsible for that + */ + void deletePolygonList(); + void deleteSinglePolygon(); + + void deleteSinglePolygonWithSline(); //also delete sanmpled line + void deletePolygonListWithSline(); //also delete sanmpled line + + void deleteSingleLine(directedLine* dline); + directedLine* deleteDegenerateLines(); + directedLine* deleteDegenerateLinesAllPolygons(); + directedLine* cutIntersectionAllPoly(int& cutOccur); + + /*check to see if the list forms a closed polygon + *return 1 if yes + */ + short isPolygon(); + + Int compInY(directedLine* nl); + Int compInX(directedLine* nl); + + /*return an array of pointers. + *the + */ + directedLine** sortAllPolygons(); + + Int numEdges(); + Int numEdgesAllPolygons(); + Int numPolygons(); + + /*check if the head of this edge is connected to + *the tail of the prev + */ + short isConnected(); + + Real polyArea(); + + void printSingle(); + void printList(); + void printAllPolygons(); + void writeAllPolygons(char* filename); + + + /*insert a polygon: using nextPolygon*/ + directedLine* insertPolygon(directedLine* newpolygon); + directedLine* cutoffPolygon(directedLine *p); + + Int toArraySinglePolygon(directedLine** array, Int index); + directedLine** toArrayAllPolygons(Int& total_num_edges); + + void connectDiagonal(directedLine* v1, directedLine* v2, + directedLine** ret_p1, + directedLine** ret_p2, + sampledLine** generatedLine, directedLine* list); + + /*generate two slines + */ + void connectDiagonal_2slines(directedLine* v1, directedLine* v2, + directedLine** ret_p1, + directedLine** ret_p2, + directedLine* list); + + Int samePolygon(directedLine* v1, directedLine* v2); + void setRootBit() {rootBit = 1;} + void resetRootBit() {rootBit = 0;} + directedLine* findRoot(); + + void rootLinkSet(directedLine* r) {rootLink = r;} + directedLine* rootLinkFindRoot(); + + //the chain from begin to end is deleted (the space is deallocated) + //and a new edge(which connectes the head of begin and the tail of end) + // is inserted. The new polygon is returned. + //notice that "this" is arbitrary + directedLine* deleteChain(directedLine* begin, directedLine* end); +}; + +directedLine* readAllPolygons(char* filename); + +extern Int compV2InY(Real A[2], Real B[2]); +extern Int compV2InX(Real A[2], Real B[2]); + +#endif + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/glimports.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/glimports.h new file mode 100644 index 000000000..6e69feb40 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/glimports.h @@ -0,0 +1,42 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * glimports.h + * + */ + +#ifndef __gluimports_h_ +#define __gluimports_h_ + +#include "mystdlib.h" +#include "mystdio.h" + +#endif /* __gluimports_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.cc new file mode 100644 index 000000000..3c92039ba --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.cc @@ -0,0 +1,293 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include +#include +#include +#include "zlassert.h" +#include "gridWrap.h" + + +/*******************grid structure****************************/ +void gridWrap::print() +{ + printf("n_ulines = %i\n", n_ulines); + printf("n_vlines = %i\n", n_vlines); + printf("u_min=%f, umax=%f, vmin=%f, vmax=%f\n", u_min, u_max, v_min, v_max); +} + +gridWrap::gridWrap(Int nUlines, Real* uvals, + Int nVlines, Real* vvals) +{ + assert(nUlines>=2); + assert(nVlines>=2); + + is_uniform = 0; + n_ulines = nUlines; + n_vlines = nVlines; + u_min = uvals[0]; + u_max = uvals[nUlines-1]; + v_min = vvals[0]; + v_max = vvals[nVlines-1]; + u_values = (Real*) malloc(sizeof(Real) * n_ulines); + assert(u_values); + v_values = (Real*) malloc(sizeof(Real) * n_vlines); + assert(v_values); + + Int i; + for(i=0; i=2); + assert(nVlines>=2); + Real du = (uMax-uMin)/(nUlines-1); + Real dv = (vMax-vMin)/(nVlines-1); + + float tempu=uMin; + u_values[0] = tempu; + for(i=1; i= uright) + return; //no triangles to output. + + pStream->begin(); + pStream->insert(vert); + + assert(vert[1] != v_values[v]); //don't output degenerate triangles + + if(vert[1] > v_values[v]) //vertex is above this grid line: notice the orientation + { + for(i=uleft; i<=uright; i++) + pStream->insert(u_values[i], v_values[v]); + } + else //vertex is below the grid line + { + for(i=uright; i>= uleft; i--) + pStream->insert(u_values[i], v_values[v]); + } + + pStream->end(PRIMITIVE_STREAM_FAN); +} + + + +/*each chain stores a number of consecutive + *V-lines within a grid. + *There is one grid vertex on each V-line. + * The total number of V-lines is: + * nVlines. + * with respect to the grid, the index of the first V-line is + * firstVlineIndex. + * So with respect to the grid, the index of the ith V-line is + * firstVlineIndex-i. + * the grid-index of the uline at the ith vline (recall that each vline has one grid point) + * is ulineIndices[i]. The u_value is cached in ulineValues[i], that is, + * ulineValues[i] = grid->get_u_value(ulineIndices[i]) + */ +gridBoundaryChain::gridBoundaryChain( + gridWrap* gr, + Int first_vline_index, + Int n_vlines, + Int* uline_indices, + Int* inner_indices + ) +: grid(gr), firstVlineIndex(first_vline_index), nVlines(n_vlines) +{ + ulineIndices = (Int*) malloc(sizeof(Int) * n_vlines); + assert(ulineIndices); + + innerIndices = (Int*) malloc(sizeof(Int) * n_vlines); + assert(innerIndices); + + vertices = (Real2*) malloc(sizeof(Real2) * n_vlines); + assert(vertices); + + + + Int i; + for(i=0; iget_u_value(ulineIndices[i]); + vertices[i][1] = gr->get_v_value(first_vline_index-i); + } +} + +void gridBoundaryChain::draw() +{ + Int i; + glBegin(GL_LINE_STRIP); + for(i=0; iget_u_value(innerIndices[i]), get_v_value(i-1) ); + glVertex2f(grid->get_u_value(innerIndices[i]), get_v_value(i) ); + glEnd(); + } +} + +Int gridBoundaryChain::lookfor(Real v, Int i1, Int i2) +{ + Int mid; + while(i1 < i2-1) + { + mid = (i1+i2)/2; + if(v > vertices[mid][1]) + { + i2 = mid; + } + else + i1 = mid; + } + return i1; +} + +/*output the fan of the right end between grid line i-1 and grid line i*/ +void gridBoundaryChain::rightEndFan(Int i, primStream* pStream) +{ + Int j; + if(getUlineIndex(i) > getUlineIndex(i-1)) + { + pStream->begin(); + pStream->insert(get_vertex(i-1)); + for(j=getUlineIndex(i-1); j<= getUlineIndex(i); j++) + pStream->insert(grid->get_u_value(j), get_v_value(i)); + pStream->end(PRIMITIVE_STREAM_FAN); + } + else if(getUlineIndex(i) < getUlineIndex(i-1)) + { + pStream->begin(); + pStream->insert(get_vertex(i)); + for(j=getUlineIndex(i-1); j>= getUlineIndex(i); j--) + pStream->insert(grid->get_u_value(j), get_v_value(i-1)); + pStream->end(PRIMITIVE_STREAM_FAN); + } + //otherside, the two are equal, so there is no fan to output +} + + +/*output the fan of the left end between grid line i-1 and grid line i*/ +void gridBoundaryChain::leftEndFan(Int i, primStream* pStream) +{ + Int j; + if(getUlineIndex(i) < getUlineIndex(i-1)) + { + pStream->begin(); + pStream->insert(get_vertex(i-1)); + for(j=getUlineIndex(i); j<= getUlineIndex(i-1); j++) + pStream->insert(grid->get_u_value(j), get_v_value(i)); + pStream->end(PRIMITIVE_STREAM_FAN); + } + else if(getUlineIndex(i) > getUlineIndex(i-1)) + { + pStream->begin(); + pStream->insert(get_vertex(i)); + for(j=getUlineIndex(i); j>= getUlineIndex(i-1); j--) + pStream->insert(grid->get_u_value(j), get_v_value(i-1)); + pStream->end(PRIMITIVE_STREAM_FAN); + } + /*otherwisem, the two are equal, so there is no fan to outout*/ +} diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.h new file mode 100644 index 000000000..b6428484f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/gridWrap.h @@ -0,0 +1,137 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _GRIDWRAP_H +#define _GRIDWRAP_H + +#include +#include "definitions.h" + +#include "primitiveStream.h" +#include "zlassert.h" + +class gridWrap{ + Int n_ulines; + Int n_vlines; + Real u_min, u_max; + Real v_min, v_max; + + /*cache the coordinate values for efficiency. + *these are redundant information when + *the grid is uniform. + */ + Real* u_values; /*size is n_ulines*/ + Real* v_values; /*size is n_vlines*/ + + Int is_uniform; + +public: + //uniform grid constructor + gridWrap(Int nUlines, Int nVlines, + Real uMin, Real uMax, + Real vMin, Real vMax + ); + + //nonuniform grid constructor. + gridWrap(Int nUlines, Real *uvals, + Int nVlines, Real *vvlas + ); + ~gridWrap(); + + void print(); + Int get_n_ulines() {return n_ulines;} + Int get_n_vlines() {return n_vlines;} + Real get_u_min() {return u_min;} + Real get_u_max() {return u_max;} + Real get_v_min() {return v_min;} + Real get_v_max() {return v_max;} + + Real get_u_value(Int i) + { + assert(i=n_ulines){printf("ERROR, n_ulines=%i,i=%i\n",n_ulines,i);exit(0);}*/ + return u_values[i];} + Real get_v_value(Int j) {return v_values[j];} + + Real* get_u_values() {return u_values;} + Real* get_v_values() {return v_values;} + + void outputFanWithPoint(Int v, Int uleft, Int uright, + Real vert[2], primStream* pStream); + + void draw(); + + Int isUniform() {return is_uniform;} +}; + +class gridBoundaryChain{ + gridWrap* grid; + Int firstVlineIndex; + Int nVlines; + Int* ulineIndices; /*each v line has a boundary*/ + Int* innerIndices; /*the segment of the vertical gridline from */ + /*(innerIndices[i], i) to (innerIndices[i+1], i-1) */ + /*is inside the polygon: i=1,...,nVlines-1*/ + + Real2* vertices; /*one grid point at each grid V-line, cached for efficiency*/ + +public: + gridBoundaryChain(gridWrap* gr, Int first_vline_index, Int n_vlines, Int* uline_indices, Int* inner_indices); + + ~gridBoundaryChain() + { + free(innerIndices); + free(ulineIndices); + free(vertices); + } + + /*i indexes the vlines in this chain. + */ + Int getVlineIndex(Int i) {return firstVlineIndex-i;} + Int getUlineIndex(Int i) {return ulineIndices[i];} + Real get_u_value(Int i) {return vertices[i][0];} + Real get_v_value(Int i) {return vertices[i][1];} + Int get_nVlines() {return nVlines;} + Int getInnerIndex(Int i) {return innerIndices[i];} + Real getInner_u_value(Int i) {return grid->get_u_value(innerIndices[i]);} + + Real* get_vertex(Int i) {return vertices[i];} + gridWrap* getGrid() {return grid;} + void leftEndFan(Int i, primStream* pStream); + void rightEndFan(Int i, primStream* pStream); + + Int lookfor(Real v, Int i1, Int i2); //find i in [i1,i2] so that vertices[i][1]>= v > vertices[i+1][1] + void draw(); + void drawInner(); +}; + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.cc new file mode 100644 index 000000000..814bf32fa --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.cc @@ -0,0 +1,934 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include +#include +#include + +#include "glimports.h" +#include "zlassert.h" + +#include "monoChain.h" +#include "quicksort.h" +#include "searchTree.h" +#include "polyUtil.h" + +#ifndef max +#define max(a,b) ((a>b)? a:b) +#endif +#ifndef min +#define min(a,b) ((a>b)? b:a) +#endif + +extern Int isCusp(directedLine *v); +extern Int deleteRepeatDiagonals(Int num_diagonals, directedLine** diagonal_vertices, directedLine** new_vertices); + +//for debug purpose only +#if 0 // UNUSED +static void drawDiagonals(Int num_diagonals, directedLine** diagonal_vertices) +{ + Int i; + for(i=0; ihead()); + glVertex2fv(diagonal_vertices[2*i+1]->head()); + glEnd(); + } +} +#endif + +/*given (x_1, y_1) and (x_2, y_2), and y + *return x such that (x,y) is on the line + */ +inline Real intersectHoriz(Real x1, Real y1, Real x2, Real y2, Real y) +{ + return ((y2==y1)? (x1+x2)*0.5 : x1 + ((y-y1)/(y2-y1)) * (x2-x1)); +} + +//compare the heads of the two chains +static int compChainHeadInY(monoChain* mc1, monoChain* mc2) +{ + return compV2InY(mc1->getHead()->head(), mc2->getHead()->head()); +} + +monoChain::monoChain(directedLine* cHead, directedLine* cTail) +{ + chainHead = cHead; + chainTail = cTail; + next = this; + prev = this; + + nextPolygon = NULL; + + //compute bounding box + directedLine* temp; + minX = maxX = chainTail->head()[0]; + minY = maxY = chainTail->head()[1]; + + for(temp=chainHead; temp!=cTail; temp = temp->getNext()) + { + if(temp->head()[0] < minX) + minX = temp->head()[0]; + if(temp->head()[0] > maxX) + maxX = temp->head()[0]; + + if(temp->head()[1] < minY) + minY = temp->head()[1]; + if(temp->head()[1] > maxY) + maxY = temp->head()[1]; + } + + //check whether the chain is increasing or decreasing + if(chainHead->compInY(chainTail) <0) + isIncrease = 1; + else + isIncrease = 0; + + //initilize currrent, this is used for accelerating search + if(isIncrease) + current = chainHead; + else + current = chainTail; + + isKey = 0; +} + +//insert a new line between prev and this +void monoChain::insert(monoChain* nc) +{ + nc->next = this; + nc->prev = prev; + prev->next = nc; + prev = nc; +} + +void monoChain::deleteLoop() +{ + monoChain *temp, *tempNext; + prev->next = NULL; + for(temp=this; temp != NULL; temp = tempNext) + { + tempNext = temp->next; + delete temp; + } +} + +void monoChain::deleteLoopList() +{ + monoChain *temp, *tempNext; + for(temp=this; temp != NULL; temp = tempNext) + { + tempNext = temp->nextPolygon; + temp->deleteLoop(); + } +} + +Int monoChain::toArraySingleLoop(monoChain** array, Int index) +{ + monoChain *temp; + array[index++] = this; + for(temp = next; temp != this; temp = temp->next) + { + array[index++] = temp; + } + return index; +} + +monoChain** monoChain::toArrayAllLoops(Int& num_chains) +{ + num_chains = numChainsAllLoops(); + monoChain **ret = (monoChain**) malloc(sizeof(monoChain*) * num_chains); + assert(ret); + monoChain *temp; + Int index = 0; + for(temp = this; temp != NULL; temp=temp->nextPolygon){ + index = temp->toArraySingleLoop(ret, index); + } + return ret; +} + +Int monoChain::numChainsSingleLoop() +{ + Int ret=0; + monoChain* temp; + if(next == this) return 1; + ret = 1; + for(temp=next; temp != this; temp = temp->next) + ret++; + return ret; +} + +Int monoChain::numChainsAllLoops() +{ + Int ret=0; + monoChain *temp; + for(temp =this; temp != NULL; temp = temp->nextPolygon) + ret += temp->numChainsSingleLoop(); + return ret; +} + +//update 'current' +Real monoChain::chainIntersectHoriz(Real y) +{ + directedLine* temp; + if(isIncrease) + { + for(temp= current; temp != chainTail; temp = temp->getNext()) + { + if(temp->head()[1] > y) + break; + } + current = temp->getPrev(); + } + else + { + for(temp = current; temp != chainHead; temp = temp->getPrev()) + { + if(temp->head()[1] > y) + break; + } + current = temp->getNext(); + } + return intersectHoriz(current->head()[0], current->head()[1], current->tail()[0], current->tail()[1], y); +} + +monoChain* directedLineLoopToMonoChainLoop(directedLine* loop) +{ + directedLine *temp; + monoChain *ret=NULL; + + //find the first cusp + directedLine *prevCusp=NULL; + directedLine *firstCusp; + + if(isCusp(loop)) + prevCusp = loop; + else + { + for(temp = loop->getNext(); temp != loop; temp = temp->getNext()) + if(isCusp(temp)) + break; + prevCusp = temp; + } + firstCusp = prevCusp; +//printf("first cusp is (%f,%f), (%f,%f), (%f,%f)\n", prevCusp->getPrev()->head()[0], prevCusp->getPrev()->head()[1], prevCusp->head()[0], prevCusp->head()[1], prevCusp->tail()[0], prevCusp->tail()[1]); + + for(temp = prevCusp->getNext(); temp != loop; temp = temp->getNext()) + { + if(isCusp(temp)) + { +//printf("the cusp is (%f,%f), (%f,%f), (%f,%f)\n", temp->getPrev()->head()[0], temp->getPrev()->head()[1], temp->head()[0], temp->head()[1], temp->tail()[0], temp->tail()[1]); + if(ret == NULL) + { + ret = new monoChain(prevCusp, temp); + } + else + ret->insert(new monoChain(prevCusp, temp)); + prevCusp = temp; + } + } + ret->insert(new monoChain(prevCusp, firstCusp)); + + return ret; +} + +monoChain* directedLineLoopListToMonoChainLoopList(directedLine* list) +{ + directedLine* temp; + monoChain* mc; + monoChain* mcEnd; + mc = directedLineLoopToMonoChainLoop(list); + mcEnd = mc; + for(temp = list->getNextPolygon(); temp != NULL; temp = temp->getNextPolygon()) + { + monoChain *newLoop = directedLineLoopToMonoChainLoop(temp); + mcEnd->setNextPolygon(newLoop); + mcEnd = newLoop; + } + return mc; +} + +/*compare two edges of a polygon. + *edge A < edge B if there is a horizontal line so that the intersection + *with A is to the left of the intersection with B. + *This function is used in sweepY for the dynamic search tree insertion to + *order the edges. + * Implementation: (x_1,y_1) and (x_2, y_2) + */ +static Int compEdges(directedLine *e1, directedLine *e2) +{ + Real* head1 = e1->head(); + Real* tail1 = e1->tail(); + Real* head2 = e2->head(); + Real* tail2 = e2->tail(); +/* + Real h10 = head1[0]; + Real h11 = head1[1]; + Real t10 = tail1[0]; + Real t11 = tail1[1]; + Real h20 = head2[0]; + Real h21 = head2[1]; + Real t20 = tail2[0]; + Real t21 = tail2[1]; +*/ + Real e1_Ymax, e1_Ymin, e2_Ymax, e2_Ymin; +/* + if(h11>t11) { + e1_Ymax= h11; + e1_Ymin= t11; + } + else{ + e1_Ymax = t11; + e1_Ymin = h11; + } + + if(h21>t21) { + e2_Ymax= h21; + e2_Ymin= t21; + } + else{ + e2_Ymax = t21; + e2_Ymin = h21; + } +*/ + + if(head1[1]>tail1[1]) { + e1_Ymax= head1[1]; + e1_Ymin= tail1[1]; + } + else{ + e1_Ymax = tail1[1]; + e1_Ymin = head1[1]; + } + + if(head2[1]>tail2[1]) { + e2_Ymax= head2[1]; + e2_Ymin= tail2[1]; + } + else{ + e2_Ymax = tail2[1]; + e2_Ymin = head2[1]; + } + + + /*Real e1_Ymax = max(head1[1], tail1[1]);*/ /*max(e1->head()[1], e1->tail()[1]);*/ + /*Real e1_Ymin = min(head1[1], tail1[1]);*/ /*min(e1->head()[1], e1->tail()[1]);*/ + /*Real e2_Ymax = max(head2[1], tail2[1]);*/ /*max(e2->head()[1], e2->tail()[1]);*/ + /*Real e2_Ymin = min(head2[1], tail2[1]);*/ /*min(e2->head()[1], e2->tail()[1]);*/ + + Real Ymax = min(e1_Ymax, e2_Ymax); + Real Ymin = max(e1_Ymin, e2_Ymin); + + Real y = 0.5*(Ymax + Ymin); + +/* Real x1 = intersectHoriz(e1->head()[0], e1->head()[1], e1->tail()[0], e1->tail()[1], y); + Real x2 = intersectHoriz(e2->head()[0], e2->head()[1], e2->tail()[0], e2->tail()[1], y); +*/ +/* + Real x1 = intersectHoriz(h10, h11, t10, t11, y); + Real x2 = intersectHoriz(h20, h21, t20, t21, y); +*/ + Real x1 = intersectHoriz(head1[0], head1[1], tail1[0], tail1[1], y); + Real x2 = intersectHoriz(head2[0], head2[1], tail2[0], tail2[1], y); + + if(x1<= x2) return -1; + else return 1; +} + +Int compChains(monoChain* mc1, monoChain* mc2) +{ + Real y; + assert(mc1->isKey || mc2->isKey); + if(mc1->isKey) + y = mc1->keyY; + else + y = mc2->keyY; + directedLine *d1 = mc1->find(y); + directedLine *d2 = mc2->find(y); + mc2->find(y); +// Real x1 = mc1->chainIntersectHoriz(y); +// Real x2 = mc2->chainIntersectHoriz(y); + return compEdges(d1, d2); +} + +//this function modifies current for efficiency +directedLine* monoChain::find(Real y) +{ + directedLine *ret; + directedLine *temp; + assert(current->head()[1] <= y); + if(isIncrease) + { + assert(chainTail->head()[1] >=y); + for(temp=current; temp!=chainTail; temp = temp->getNext()) + { + if(temp->head()[1] > y) + break; + } + current = temp->getPrev(); + ret = current; + } + else + { + for(temp=current; temp != chainHead; temp = temp->getPrev()) + { + if(temp->head()[1] > y) + break; + } + current = temp->getNext(); + ret = temp; + } + return ret; +} + +void monoChain::printOneChain() +{ + directedLine* temp; + for(temp = chainHead; temp != chainTail; temp = temp->getNext()) + { + printf("(%f,%f) ", temp->head()[0], temp->head()[1]); + } + printf("(%f,%f) \n", chainTail->head()[0], chainTail->head()[1]); +} + +void monoChain::printChainLoop() +{ + monoChain* temp; + this->printOneChain(); + for(temp = next; temp != this; temp = temp->next) + { + temp->printOneChain(); + } + printf("\n"); +} + +void monoChain::printAllLoops() +{ + monoChain* temp; + for(temp=this; temp != NULL; temp = temp->nextPolygon) + temp->printChainLoop(); +} + +//return 1 if error occures +Int MC_sweepY(Int nVertices, monoChain** sortedVertices, sweepRange** ret_ranges) +{ + Int i; + Real keyY; + Int errOccur=0; +//printf("enter MC_sweepY\n"); +//printf("nVertices=%i\n", nVertices); + /*for each vertex in the sorted list, update the binary search tree. + *and store the range information for each vertex. + */ + treeNode* searchTree = NULL; +//printf("nVertices=%i\n", nVertices); + for(i=0; igetHead()->head()[1]; //the sweep line + directedLine *dline = vert->getHead(); + directedLine *dlinePrev = dline->getPrev(); + if(isBelow(dline, dline) && isBelow(dline, dlinePrev)) + { +//printf("case 1\n"); + //thisisKey = 1; + vert->keyY = keyY; + treeNode* thisNode = TreeNodeFind(searchTree, vert, (Int (*) (void *, void *))compChains); + vert->isKey = 0; + + vert->getPrev()->isKey = 1; + vert->getPrev()->keyY = keyY; + treeNode* prevNode = TreeNodeFind(searchTree, vert->getPrev(), (Int (*) (void *, void *))compChains); + vert->getPrev()->isKey = 0; + + if(cuspType(dline) == 1)//interior cusp + { + + treeNode* leftEdge = TreeNodePredecessor(prevNode); + treeNode* rightEdge = TreeNodeSuccessor(thisNode); + if(leftEdge == NULL || rightEdge == NULL) + { + errOccur = 1; + goto JUMP_HERE; + } + + directedLine* leftEdgeDline = ((monoChain* ) leftEdge->key)->find(keyY); + + + + directedLine* rightEdgeDline = ((monoChain* ) rightEdge->key)->find(keyY); + + ret_ranges[i] = sweepRangeMake(leftEdgeDline, 1, rightEdgeDline, 1); + } + else /*exterior cusp*/ + { + ret_ranges[i] = sweepRangeMake( dline, 1, dlinePrev, 1); + } + + searchTree = TreeNodeDeleteSingleNode(searchTree, thisNode); + searchTree = TreeNodeDeleteSingleNode(searchTree, prevNode); + + } + else if(isAbove(dline, dline) && isAbove(dline, dlinePrev)) + { +//printf("case 2\n"); + //insert both edges + treeNode* thisNode = TreeNodeMake(vert); + treeNode* prevNode = TreeNodeMake(vert->getPrev()); + + vert->isKey = 1; + vert->keyY = keyY; + searchTree = TreeNodeInsert(searchTree, thisNode, (Int (*) (void *, void *))compChains); + vert->isKey = 0; + + vert->getPrev()->isKey = 1; + vert->getPrev()->keyY = keyY; + searchTree = TreeNodeInsert(searchTree, prevNode, (Int (*) (void *, void *))compChains); + vert->getPrev()->isKey = 0; + + if(cuspType(dline) == 1) //interior cusp + { +//printf("cuspType is 1\n"); + treeNode* leftEdge = TreeNodePredecessor(thisNode); + treeNode* rightEdge = TreeNodeSuccessor(prevNode); + if(leftEdge == NULL || rightEdge == NULL) + { + errOccur = 1; + goto JUMP_HERE; + } +//printf("leftEdge is %i, rightEdge is %i\n", leftEdge, rightEdge); + directedLine* leftEdgeDline = ((monoChain*) leftEdge->key)->find(keyY); + directedLine* rightEdgeDline = ((monoChain*) rightEdge->key)->find(keyY); + ret_ranges[i] = sweepRangeMake( leftEdgeDline, 1, rightEdgeDline, 1); + } + else //exterior cusp + { +//printf("cuspType is not 1\n"); + ret_ranges[i] = sweepRangeMake(dlinePrev, 1, dline, 1); + } + } + else + { +//printf("%i,%i\n", isAbove(dline, dline), isAbove(dline, dlinePrev)); + errOccur = 1; + goto JUMP_HERE; + + fprintf(stderr, "error in MC_sweepY\n"); + exit(1); + } + } + + JUMP_HERE: + //finally clean up space: delete the search tree + TreeNodeDeleteWholeTree(searchTree); + return errOccur; +} + +void MC_findDiagonals(Int total_num_edges, monoChain** sortedVertices, + sweepRange** ranges, Int& num_diagonals, + directedLine** diagonal_vertices) +{ + Int i,j,k; + k=0; + //reset 'current' of all the monoChains + for(i=0; iresetCurrent(); + + for(i=0; igetHead(); + directedLine* thisEdge = vert; + directedLine* prevEdge = vert->getPrev(); + if(isBelow(vert, thisEdge) && isBelow(vert, prevEdge) && compEdges(prevEdge, thisEdge)<0) + { + //this is an upward interior cusp + diagonal_vertices[k++] = vert; + + directedLine* leftEdge = ranges[i]->left; + directedLine* rightEdge = ranges[i]->right; + + directedLine* leftVert = leftEdge; + directedLine* rightVert = rightEdge->getNext(); + assert(leftVert->head()[1] >= vert->head()[1]); + assert(rightVert->head()[1] >= vert->head()[1]); + directedLine* minVert = (leftVert->head()[1] <= rightVert->head()[1])?leftVert:rightVert; + Int found = 0; + for(j=i+1; jgetHead()->head()[1] > minVert->head()[1]) + break; + + if(sweepRangeEqual(ranges[i], ranges[j])) + { + found = 1; + break; + } + } + + if(found) + diagonal_vertices[k++] = sortedVertices[j]->getHead(); + else + diagonal_vertices[k++] = minVert; + } + else if(isAbove(vert, thisEdge) && isAbove(vert, prevEdge) && compEdges(prevEdge, thisEdge)>0) + { + //downward interior cusp + diagonal_vertices[k++] = vert; + directedLine* leftEdge = ranges[i]->left; + directedLine* rightEdge = ranges[i]->right; + directedLine* leftVert = leftEdge->getNext(); + directedLine* rightVert = rightEdge; + assert(leftVert->head()[1] <= vert->head()[1]); + assert(rightVert->head()[1] <= vert->head()[1]); + directedLine* maxVert = (leftVert->head()[1] > rightVert->head()[1])? leftVert:rightVert; + Int found=0; + for(j=i-1; j>=0; j--) + { + if(sortedVertices[j]->getHead()->head()[1] < maxVert->head()[1]) + break; + if(sweepRangeEqual(ranges[i], ranges[j])) + { + found = 1; + break; + } + } + if(found) + diagonal_vertices[k++] = sortedVertices[j]->getHead(); + else + diagonal_vertices[k++] = maxVert; + } + } + num_diagonals = k/2; +} + + + + +directedLine* MC_partitionY(directedLine *polygons, sampledLine **retSampledLines) +{ +//printf("enter mc_partitionY\n"); + Int total_num_chains = 0; + monoChain* loopList = directedLineLoopListToMonoChainLoopList(polygons); + monoChain** array = loopList->toArrayAllLoops(total_num_chains); + + if(total_num_chains<=2) //there is just one single monotone polygon + { + loopList->deleteLoopList(); + free(array); + *retSampledLines = NULL; + return polygons; + } + +//loopList->printAllLoops(); +//printf("total_num_chains=%i\n", total_num_chains); + quicksort( (void**)array, 0, total_num_chains-1, (Int (*)(void*, void*))compChainHeadInY); +//printf("after quicksort\n"); + + sweepRange** ranges = (sweepRange**)malloc(sizeof(sweepRange*) * (total_num_chains)); + assert(ranges); + + if(MC_sweepY(total_num_chains, array, ranges)) + { + loopList->deleteLoopList(); + free(array); + *retSampledLines = NULL; + return NULL; + } +//printf("after MC_sweepY\n"); + + + Int num_diagonals; + /*number diagonals is < total_num_edges*total_num_edges*/ + directedLine** diagonal_vertices = (directedLine**) malloc(sizeof(directedLine*) * total_num_chains*2/*total_num_edges*/); + assert(diagonal_vertices); + +//printf("before call MC_findDiagonales\n"); + + MC_findDiagonals(total_num_chains, array, ranges, num_diagonals, diagonal_vertices); +//printf("after call MC_findDia, num_diagnla=%i\n", num_diagonals); + + directedLine* ret_polygons = polygons; + sampledLine* newSampledLines = NULL; + Int i,k; + + num_diagonals=deleteRepeatDiagonals(num_diagonals, diagonal_vertices, diagonal_vertices); + + + +//drawDiagonals(num_diagonals, diagonal_vertices); +//printf("diagoanls are \n"); +//for(i=0; ihead()[0], diagonal_vertices[2*i]->head()[1]); +// printf("**(%f,%f)\n", diagonal_vertices[2*i+1]->head()[0], diagonal_vertices[2*i+1]->head()[1]); +// } + + Int *removedDiagonals=(Int*)malloc(sizeof(Int) * num_diagonals); + for(i=0; ifindRoot(); + directedLine *root2 = v2->findRoot(); + assert(root1); + assert(root2); +*/ + +directedLine* root1 = v1->rootLinkFindRoot(); +directedLine* root2 = v2->rootLinkFindRoot(); + + if(root1 != root2) + { + + removedDiagonals[i] = 1; + sampledLine* generatedLine; + + + + v1->connectDiagonal(v1,v2, &ret_p1, &ret_p2, &generatedLine, ret_polygons); + + + + newSampledLines = generatedLine->insert(newSampledLines); +/* + ret_polygons = ret_polygons->cutoffPolygon(root1); + + ret_polygons = ret_polygons->cutoffPolygon(root2); + ret_polygons = ret_p1->insertPolygon(ret_polygons); +root1->rootLinkSet(ret_p1); +root2->rootLinkSet(ret_p1); +ret_p1->rootLinkSet(NULL); +ret_p2->rootLinkSet(ret_p1); +*/ + ret_polygons = ret_polygons->cutoffPolygon(root2); + + + +root2->rootLinkSet(root1); +ret_p1->rootLinkSet(root1); +ret_p2->rootLinkSet(root1); + + /*now that we have connected the diagonal v1 and v2, + *we have to check those unprocessed diagonals which + *have v1 or v2 as an end point. Notice that the head of v1 + *has the same coodinates as the head of v2->prev, and the head of + *v2 has the same coordinate as the head of v1->prev. + *Suppose these is a diagonal (v1, x). If (v1,x) is still a valid + *diagonal, then x should be on the left hand side of the directed line: *v1->prev->head -- v1->head -- v1->tail. Otherwise, (v1,x) should be + *replaced by (v2->prev, x), that is, x is on the left of + * v2->prev->prev->head, v2->prev->head, v2->prev->tail. + */ + Int ii, kk; + for(ii=0, kk=0; iiprev->head:v1->head:v1->tail*/ + if(! pointLeft2Lines(v1->getPrev()->head(), + v1->head(), v1->tail(), d2->head())) + { +/* + assert(pointLeft2Lines(v2->getPrev()->getPrev()->head(), + v2->getPrev()->head(), + v2->getPrev()->tail(), d2->head())); +*/ + diagonal_vertices[kk] = v2->getPrev(); + } + } + if(d1 == v2) { + /*check if d2 is to left of v2->prev->head:v2->head:v2->tail*/ + if(! pointLeft2Lines(v2->getPrev()->head(), + v2->head(), v2->tail(), d2->head())) + { +/* + assert(pointLeft2Lines(v1->getPrev()->getPrev()->head(), + v1->getPrev()->head(), + v1->getPrev()->tail(), d2->head())); +*/ + diagonal_vertices[kk] = v1->getPrev(); + } + } + /*check d2 and replace diagonal_vertices[k+1] if necessary*/ + if(d2 == v1) { + /*check if d1 is to left of v1->prev->head:v1->head:v1->tail*/ + if(! pointLeft2Lines(v1->getPrev()->head(), + v1->head(), v1->tail(), d1->head())) + { +/* assert(pointLeft2Lines(v2->getPrev()->getPrev()->head(), + v2->getPrev()->head(), + v2->getPrev()->tail(), d1->head())); +*/ + diagonal_vertices[kk+1] = v2->getPrev(); + } + } + if(d2 == v2) { + /*check if d1 is to left of v2->prev->head:v2->head:v2->tail*/ + if(! pointLeft2Lines(v2->getPrev()->head(), + v2->head(), v2->tail(), d1->head())) + { +/* assert(pointLeft2Lines(v1->getPrev()->getPrev()->head(), + v1->getPrev()->head(), + v1->getPrev()->tail(), d1->head())); +*/ + diagonal_vertices[kk+1] = v1->getPrev(); + } + } + } +}/*end if (root1 not equal to root 2)*/ +} + + /*second pass, now all diagoals should belong to the same polygon*/ +//printf("second pass: \n"); + +// for(i=0; ifindRoot(); +/* + directedLine *root2 = v2->findRoot(); + + + + assert(root1); + assert(root2); + assert(root1 == root2); + */ + sampledLine* generatedLine; + + + + v1->connectDiagonal(v1,v2, &ret_p1, &ret_p2, &generatedLine, ret_polygons); + newSampledLines = generatedLine->insert(newSampledLines); + + ret_polygons = ret_polygons->cutoffPolygon(root1); + + ret_polygons = ret_p1->insertPolygon(ret_polygons); + + ret_polygons = ret_p2->insertPolygon(ret_polygons); + + + + for(Int j=i+1; jsamePolygon(temp1, temp2)) + { + /*if temp1 and temp2 are in different polygons, + *then one of them must be v1 or v2. + */ + + + + assert(temp1==v1 || temp1 == v2 || temp2==v1 || temp2 ==v2); + if(temp1==v1) + { + diagonal_vertices[2*j] = v2->getPrev(); + } + if(temp2==v1) + { + diagonal_vertices[2*j+1] = v2->getPrev(); + } + if(temp1==v2) + { + diagonal_vertices[2*j] = v1->getPrev(); + } + if(temp2==v2) + { + diagonal_vertices[2*j+1] = v1->getPrev(); + } + } + } + } + + } + + + //clean up + loopList->deleteLoopList(); + free(array); + free(ranges); + free(diagonal_vertices); + free(removedDiagonals); + + *retSampledLines = newSampledLines; + return ret_polygons; +} + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.h new file mode 100644 index 000000000..999f16319 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoChain.h @@ -0,0 +1,103 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _MONO_CHAIN_H +#define _MONO_CHAIN_H + +#include "directedLine.h" +#include "partitionY.h" + +class monoChain; + +class monoChain{ + directedLine* chainHead; + directedLine* chainTail; + monoChain* next; + monoChain* prev; + monoChain* nextPolygon; //a list of polygons + + //cached informatin + //bounding box + Real minX, maxX, minY, maxY; + Int isIncrease; + + //for efficiently comparing two chains + + directedLine* current; + +public: + monoChain(directedLine* cHead, directedLine* cTail); + ~monoChain() {} + + inline void setNext(monoChain* n) {next = n;} + inline void setPrev(monoChain* p) {prev = p;} + inline void setNextPolygon(monoChain* np) {nextPolygon = np;} + inline monoChain* getNext() {return next;} + inline monoChain* getPrev() {return prev;} + inline directedLine* getHead() {return chainHead;} + inline directedLine* getTail() {return chainTail;} + + inline void resetCurrent() { current = ((isIncrease==1)? chainHead:chainTail);} + + void deleteLoop(); + void deleteLoopList(); + + //insert a new chain between prev and this + void insert(monoChain* nc); + + Int numChainsSingleLoop(); + Int numChainsAllLoops(); + monoChain** toArrayAllLoops(Int& num_chains); + Int toArraySingleLoop(monoChain** array, Int index); + + Int isKey; + Real keyY; //the current horizotal line + Real chainIntersectHoriz(Real y); //updates current incrementally for efficiency + directedLine* find(Real y);//find dline so that y intersects dline. + + void printOneChain(); + void printChainLoop(); + void printAllLoops(); + +}; + +monoChain* directedLineLoopToMonoChainLoop(directedLine* loop); +monoChain* directedLineLoopListToMonoChainLoopList(directedLine* list); +Int MC_sweepY(Int nVertices, monoChain** sortedVertices, sweepRange** ret_ranges); + +void MC_findDiagonals(Int total_num_edges, monoChain** sortedVertices, + sweepRange** ranges, Int& num_diagonals, + directedLine** diagonal_vertices); + +directedLine* MC_partitionY(directedLine *polygons, sampledLine **retSampledLines); + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/monoPolyPart.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoPolyPart.cc new file mode 100644 index 000000000..8391205bf --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoPolyPart.cc @@ -0,0 +1,299 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* + *monoPolyPart.C + * + *To partition a v-monotone polygon into some uv-monotone polygons. + *The algorithm is different from the general monotone partition algorithm. + *while the general monotone partition algorithm works for this special case, + *but it is more expensive (O(nlogn)). The algorithm implemented here takes + *advantage of the fact that the input is a v-monotone polygon and it is + *conceptually simpler and computationally cheaper (a linear time algorithm). + *The algorithm is described in Zicheng Liu's paper + * "Quality-Oriented Linear Time Tessellation". + */ + +#include +#include +#include "directedLine.h" +#include "monoPolyPart.h" + +/*a vertex is u_maximal if both of its two neightbors are to the left of this + *vertex + */ +static Int is_u_maximal(directedLine* v) +{ + if (compV2InX(v->getPrev()->head(), v->head()) == -1 && + compV2InX(v->getNext()->head(), v->head()) == -1) + return 1; + else + return 0; +} + +/*a vertex is u_minimal if both of its two neightbors are to the right of this + *vertex + */ +static Int is_u_minimal(directedLine* v) +{ + if (compV2InX(v->getPrev()->head(), v->head()) == 1 && + compV2InX(v->getNext()->head(), v->head()) == 1) + return 1; + else + return 0; +} + +/*poly: a v-monotone polygon + *return: a linked list of uv-monotone polygons. + */ +directedLine* monoPolyPart(directedLine* polygon) +{ + //handle special cases: + if(polygon == NULL) + return NULL; + if(polygon->getPrev() == polygon) + return polygon; + if(polygon->getPrev() == polygon->getNext()) + return polygon; + if(polygon->getPrev()->getPrev() == polygon->getNext()) + return polygon; + + //find the top and bottom vertexes + directedLine *tempV, *topV, *botV; + topV = botV = polygon; + for(tempV = polygon->getNext(); tempV != polygon; tempV = tempV->getNext()) + { + if(compV2InY(topV->head(), tempV->head())<0) { + topV = tempV; + } + if(compV2InY(botV->head(), tempV->head())>0) { + botV = tempV; + } + } + + //initilization + directedLine *A, *B, *C, *D, *G, *H; + //find A:the first u_maximal vertex on the left chain + //and C: the left most vertex between top and A + A = NULL; + C = topV; + for(tempV=topV->getNext(); tempV != botV; tempV = tempV->getNext()) + { + if(tempV->head()[0] < C->head()[0]) + C = tempV; + + if(is_u_maximal(tempV)) + { + A = tempV; + break; + } + } + if(A == NULL) + { + A = botV; + if(A->head()[0] < C->head()[0]) + C = A; + } + + //find B: the first u_minimal vertex on the right chain + //and D: the right most vertex between top and B + B = NULL; + D = topV; + for(tempV=topV->getPrev(); tempV != botV; tempV = tempV->getPrev()) + { + if(tempV->head()[0] > D->head()[0]) + D = tempV; + if(is_u_minimal(tempV)) + { + B = tempV; + break; + } + } + if(B == NULL) + { + B = botV; + if(B->head()[0] > D->head()[0]) + D = B; + } + + //error checking XXX + if(C->head()[0] >= D->head()[0]) + return polygon; + + //find G on the left chain that is right above B + for(tempV=topV; compV2InY(tempV->head(), B->head()) == 1; tempV=tempV->getNext()); + G = tempV->getPrev(); + //find H on the right chain that is right above A + for(tempV=topV; compV2InY(tempV->head(), A->head()) == 1; tempV = tempV->getPrev()); + H = tempV->getNext(); + + //Main Loop + directedLine* ret = NULL; + directedLine* currentPolygon = polygon; + while(1) + { + //if both B and D are equal to botV, then this polygon is already + //u-monotone + if(A == botV && B == botV) + { + ret = currentPolygon->insertPolygon(ret); + return ret; + } + else //not u-monotone + { + directedLine *ret_p1, *ret_p2; + if(compV2InY(A->head(),B->head()) == 1) //A is above B + { + directedLine* E = NULL; + for(tempV = C; tempV != D; tempV = tempV->getPrev()) + { + if(tempV->head()[0] >= A->head()[0]) + { + E = tempV; + break; + } + } + + if(E == NULL) + E = D; + if(E->head()[0]> H->head()[0]) + E = H; + //connect AE and output polygon ECA + polygon->connectDiagonal_2slines(A, E, + &ret_p1, + &ret_p2, + NULL); + ret = ret_p2->insertPolygon(ret); + currentPolygon = ret_p1; + + if(E == D) + D = ret_p1; + if(E == H) + H = ret_p1; + if(G->head()[1] >= A->head()[1]) + G = A; + //update A to be the next u-maxiaml vertex on left chain + //and C the leftmost vertex between the old A and the new A + C = A; + for(tempV = A->getNext(); tempV != botV; tempV = tempV->getNext()) + { + + if(tempV->head()[0] < C->head()[0]) + C = tempV; + if(is_u_maximal(tempV)) + { + A = tempV; + break; + } + } + + if(tempV == botV) + { + A = botV; + if(botV->head()[0] < C->head()[0]) + C = botV; + } + //update H + + if(A == botV) + H = botV; + else + { + for(tempV = H; compV2InY(tempV->head(), A->head()) == 1; tempV = tempV->getPrev()); + H = tempV->getNext(); + } + + } + else //A is below B + { + + directedLine* F = NULL; + for(tempV = D; tempV != C; tempV = tempV->getNext()) + { + if(tempV->head()[0] <= B->head()[0]) + { + F = tempV; + break; + } + } + if(F == NULL) + F = C; + if(F->head()[0] < G->head()[0]) + F = G; + + //connect FB + polygon->connectDiagonal_2slines(F, B, + &ret_p1, + &ret_p2, + NULL); + ret = ret_p2->insertPolygon(ret); + currentPolygon = ret_p1; + B = ret_p1; + if(H ->head()[1] >= B->head()[1]) + H = ret_p1; + + //update B to be the next u-minimal vertex on right chain + //and D the rightmost vertex between the old B and the new B + D = B; + for(tempV = B->getPrev(); tempV != botV; tempV = tempV->getPrev()) + { + if(tempV->head()[0] > D->head()[0]) + D = tempV; + if(is_u_minimal(tempV)) + { + B = tempV; + break; + } + } + if(tempV == botV) + { + B = botV; + if(botV->head()[0] > D->head()[0]) + D = botV; + } + //update G + if(B == botV) + G = botV; + else + { + for(tempV = G; compV2InY(tempV->head(), B->head()) == 1; tempV = tempV->getNext()); + G = tempV->getPrev(); + } + } //end of A is below B + } //end not u-monotone + } //end of main loop +} + + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/monoPolyPart.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoPolyPart.h new file mode 100644 index 000000000..6877a59c2 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoPolyPart.h @@ -0,0 +1,41 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* + *monoPolyPart.h + */ + +#ifndef _MONO_POLY_PART_H +#define _MONO_POLY_PART_H + +class directedLine; + +directedLine* monoPolyPart(directedLine* polygon); + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc new file mode 100644 index 000000000..8e8d49dda --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/monoTriangulation.cc @@ -0,0 +1,1482 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include "gluos.h" +#include "glimports.h" +#include "zlassert.h" + +#include "monoTriangulation.h" +#include "polyUtil.h" /*for area*/ +#include "partitionX.h" +#include "monoPolyPart.h" + + + +extern directedLine* polygonConvert(directedLine* polygon); + +/*poly is NOT deleted + */ +void monoTriangulationOpt(directedLine* poly, primStream* pStream) +{ + Int n_cusps; + Int n_edges = poly->numEdges(); + directedLine** cusps = (directedLine**) malloc(sizeof(directedLine*)*n_edges); + assert(cusps); + findInteriorCuspsX(poly, n_cusps, cusps); + if(n_cusps ==0) //u monotine + { + monoTriangulationFun(poly, compV2InX, pStream); + } + else if(n_cusps == 1) // one interior cusp + { + directedLine* new_polygon = polygonConvert(cusps[0]); + directedLine* other = findDiagonal_singleCuspX(new_polygon); + // should NOT be null unless there are self-intersecting + //trim curves. In that case, we don't want to core dump, instead, + //we triangulate anyway, and print out error message. + if(other == NULL) + { + monoTriangulationFun(poly, compV2InX, pStream); + } + else + { + directedLine* ret_p1; + directedLine* ret_p2; + + new_polygon->connectDiagonal_2slines(new_polygon, other, + &ret_p1, + &ret_p2, + new_polygon); + + monoTriangulationFun(ret_p1, compV2InX, pStream); + monoTriangulationFun(ret_p2, compV2InX, pStream); + + ret_p1->deleteSinglePolygonWithSline(); + ret_p2->deleteSinglePolygonWithSline(); + } + } + else + { + //we need a general partitionX funtion (supposed to be in partitionX.C, + //not implemented yet. XXX + monoTriangulationFun(poly, compV2InY, pStream); + } + + free(cusps); +} + +void monoTriangulationRecOpt(Real* topVertex, Real* botVertex, + vertexArray* left_chain, Int left_current, + vertexArray* right_chain, Int right_current, + primStream* pStream) +{ + Int i,j; + Int n_left = left_chain->getNumElements(); + Int n_right = right_chain->getNumElements(); + if(left_current>= n_left-1 || + right_current>= n_right-1) + { + monoTriangulationRec(topVertex, botVertex, left_chain, left_current, + right_chain, right_current, pStream); + return; + } + //now both left and right have at least two vertices each. + Real left_v = left_chain->getVertex(left_current)[1]; + Real right_v = right_chain->getVertex(right_current)[1]; + + if(left_v <= right_v) //first left vertex is below right + { + //find the last vertex of right which is above or equal to left + for(j=right_current; j<=n_right-1; j++) + { + if(right_chain->getVertex(j)[1] < left_v) + break; + } + monoTriangulationRecGen(topVertex, left_chain->getVertex(left_current), + left_chain, left_current, left_current, + right_chain, right_current, j-1, + pStream); + monoTriangulationRecOpt(right_chain->getVertex(j-1), + botVertex, + left_chain, left_current, + right_chain, j, + pStream); + } + else //first right vertex is strictly below left + { + //find the last vertex of left which is strictly above right + for(i=left_current; i<=n_left-1; i++) + { + if(left_chain->getVertex(i)[1] <= right_v) + break; + } + monoTriangulationRecGen(topVertex, right_chain->getVertex(right_current), + left_chain, left_current, i-1, + right_chain, right_current, right_current, + pStream); + monoTriangulationRecOpt(left_chain->getVertex(i-1), + botVertex, + left_chain, i, + right_chain, right_current, + pStream); + } +} + + +void monoTriangulationRecGenTBOpt(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, Int inc_end, + vertexArray* dec_chain, Int dec_current, Int dec_end, + primStream* pStream) +{ + pStream->triangle(topVertex, inc_chain->getVertex(inc_current), dec_chain->getVertex(dec_current)); + +/*printf("**(%f,%f)\n", inc_chain->getArray()[0][0],inc_chain->getArray()[0][1]);*/ + triangulateXYMonoTB(inc_end-inc_current+1, inc_chain->getArray()+inc_current, dec_end-dec_current+1, dec_chain->getArray()+dec_current, pStream); + + pStream->triangle(botVertex, dec_chain->getVertex(dec_end), inc_chain->getVertex(inc_end)); +} + + +/*n_left>=1 + *n_right>=1 + *the strip is going top to bottom. compared to the funtion + * triangulateXYmono() + */ +void triangulateXYMonoTB(Int n_left, Real** leftVerts, + Int n_right, Real** rightVerts, + primStream* pStream) +{ + + + Int i,j,k,l; + Real* topMostV; + + assert(n_left>=1 && n_right>=1); + if(leftVerts[0][1] >= rightVerts[0][1]) + { + i=1; + j=0; + topMostV = leftVerts[0]; + } + else + { + i=0; + j=1; + topMostV = rightVerts[0]; + } + + while(1) + { + if(i >= n_left) /*case1: no more in left*/ + { + + if(jbegin(); + pStream->insert(topMostV); + for(k=n_right-1; k>=j; k--) + pStream->insert(rightVerts[j]); + + pStream->end(PRIMITIVE_STREAM_FAN); + + } + + break; + } + else if(j>= n_right) /*case2: no more in right*/ + { + + if(ibegin(); + pStream->insert(topMostV); + + for(k=i; kinsert(leftVerts[k]); + + pStream->end(PRIMITIVE_STREAM_FAN); + } + + break; + } + else /* case3: neither is empty, plus the topMostV, there is at least one triangle to output*/ + { + + if(leftVerts[i][1] >= rightVerts[j][1]) + { + pStream->begin(); + pStream->insert(rightVerts[j]); /*the origin of this fan*/ + + pStream->insert(topMostV); + + /*find the last k>=i such that + *leftverts[k][1] >= rightverts[j][1] + */ + k=i; + while(kinsert(leftVerts[l]); + } + + pStream->end(PRIMITIVE_STREAM_FAN); + //update i for next loop + i = k+1; + topMostV = leftVerts[k]; + + } + else /*leftVerts[i][1] < rightVerts[j][1]*/ + { + pStream->begin(); + pStream->insert(leftVerts[i]);/*the origion of this fan*/ + + /*find the last k>=j such that + *rightverts[k][1] > leftverts[i][1]*/ + k=j; + while(k< n_right) + { + if(rightVerts[k][1] <= leftVerts[i][1]) + break; + k++; + } + k--; + + for(l=k; l>= j; l--) + pStream->insert(rightVerts[l]); + + pStream->insert(topMostV); + pStream->end(PRIMITIVE_STREAM_FAN); + j=k+1; + topMostV = rightVerts[j-1]; + } + } + } +} + +static int chainConvex(vertexArray* inc_chain, Int inc_current, Int inc_end) +{ + Int i; + //if there are no more than 2 vertices, return 1 + if(inc_current >= inc_end-1) return 1; + for(i=inc_current; i<= inc_end-2; i++) + { + if(area(inc_chain->getVertex(i), inc_chain->getVertex(i+1), inc_chain->getVertex(i+2)) <0) + return 0; + } + return 1; +} + +static int chainConcave(vertexArray* dec_chain, Int dec_current, Int dec_end) +{ + Int i; + //if there are no more than 2 vertices, return 1 + if(dec_current >= dec_end -1) return 1; + for(i=dec_current; i<=dec_end-2; i++) + { + if(area(dec_chain->getVertex(i), dec_chain->getVertex(i+1), dec_chain->getVertex(i+2)) >0) + return 0; + } + return 1; +} + +void monoTriangulationRecGenInU(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, Int inc_end, + vertexArray* dec_chain, Int dec_current, Int dec_end, + primStream* pStream) +{ + +} + +void monoTriangulationRecGenOpt(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, Int inc_end, + vertexArray* dec_chain, Int dec_current, Int dec_end, + primStream* pStream) +{ + Int i; + //copy this to a polygon: directedLine Lioop + sampledLine* sline; + directedLine* dline; + directedLine* poly; + + if(inc_current <= inc_end) //at least one vertex in inc_chain + { + sline = new sampledLine(topVertex, inc_chain->getVertex(inc_current)); + poly = new directedLine(INCREASING, sline); + for(i=inc_current; i<=inc_end-1; i++) + { + sline = new sampledLine(inc_chain->getVertex(i), inc_chain->getVertex(i+1)); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + } + sline = new sampledLine(inc_chain->getVertex(inc_end), botVertex); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + } + else //inc_chian is empty + { + sline = new sampledLine(topVertex, botVertex); + dline = new directedLine(INCREASING, sline); + poly = dline; + } + + assert(poly != NULL); + + if(dec_current <= dec_end) //at least on vertex in dec_Chain + { + sline = new sampledLine(botVertex, dec_chain->getVertex(dec_end)); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + for(i=dec_end; i>dec_current; i--) + { + sline = new sampledLine(dec_chain->getVertex(i), dec_chain->getVertex(i-1)); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + } + sline = new sampledLine(dec_chain->getVertex(dec_current), topVertex); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + } + else //dec_chain is empty + { + sline = new sampledLine(botVertex, topVertex); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + } + + { + Int n_cusps; + Int n_edges = poly->numEdges(); + directedLine** cusps = (directedLine**) malloc(sizeof(directedLine*)*n_edges); + assert(cusps); + findInteriorCuspsX(poly, n_cusps, cusps); + + if(n_cusps ==0) //u monotine + { + monoTriangulationFun(poly, compV2InX, pStream); + } + else if(n_cusps == 1) // one interior cusp + { + directedLine* new_polygon = polygonConvert(cusps[0]); + directedLine* other = findDiagonal_singleCuspX(new_polygon); + // should NOT be null unless there are self-intersecting + //trim curves. In that case, we don't want to core dump, instead, + //we triangulate anyway, and print out error message. + if(other == NULL) + { + monoTriangulationFun(poly, compV2InX, pStream); + } + else + { + directedLine* ret_p1; + directedLine* ret_p2; + + new_polygon->connectDiagonal_2slines(new_polygon, other, + &ret_p1, + &ret_p2, + new_polygon); + + monoTriangulationFun(ret_p1, compV2InX, pStream); + monoTriangulationFun(ret_p2, compV2InX, pStream); + + ret_p1->deleteSinglePolygonWithSline(); + ret_p2->deleteSinglePolygonWithSline(); + } + } + else + { + //we need a general partitionX funtion (supposed to be in partitionX.C, + //not implemented yet. XXX + //monoTriangulationFun(poly, compV2InY, pStream); + + directedLine* new_polygon = polygonConvert(poly); + directedLine* list = monoPolyPart(new_polygon); + for(directedLine* temp = list; temp != NULL; temp = temp->getNextPolygon()) + { + monoTriangulationFun(temp, compV2InX, pStream); + } + //clean up + list->deletePolygonListWithSline(); + + } + + free(cusps); + /* + if(numInteriorCuspsX(poly) == 0) //is u monotone + monoTriangulationFun(poly, compV2InX, pStream); + else //it is not u motone + monoTriangulationFun(poly, compV2InY, pStream); + */ + //clean up space + poly->deleteSinglePolygonWithSline(); + return; + } + + //apparently the following code is not reachable, + //it is for test purpose + if(inc_current > inc_end || dec_current>dec_end) + { + monoTriangulationRecGen(topVertex, botVertex, inc_chain, inc_current, inc_end, + dec_chain, dec_current, dec_end, + pStream); + return; + } + + + if( + area(dec_chain->getVertex(dec_current), + topVertex, + inc_chain->getVertex(inc_current)) >=0 + && chainConvex(inc_chain, inc_current, inc_end) + && chainConcave(dec_chain, dec_current, dec_end) + && area(inc_chain->getVertex(inc_end), botVertex, dec_chain->getVertex(dec_end)) >=0 + ) + { + monoTriangulationRecFunGen(topVertex, botVertex, + inc_chain, inc_current, inc_end, + dec_chain, dec_current, dec_end, + compV2InX, pStream); + } + else + { + monoTriangulationRecGen(topVertex, botVertex, inc_chain, inc_current, inc_end, + dec_chain, dec_current, dec_end, + pStream); + } +} + +/*if inc_current>inc_end, then inc_chain has no points to be considered + *same for dec_chain + */ +void monoTriangulationRecGen(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, Int inc_end, + vertexArray* dec_chain, Int dec_current, Int dec_end, + primStream* pStream) +{ + Real** inc_array ; + Real** dec_array ; + Int i; + + if(inc_current > inc_end && dec_current>dec_end) + return; + else if(inc_current>inc_end) /*no more vertices on inc_chain*/ + { + dec_array = dec_chain->getArray(); + reflexChain rChain(100,0); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, pStream); + /*process all the vertices on the dec_chain*/ + for(i=dec_current; i<=dec_end; i++){ + rChain.processNewVertex(dec_array[i], pStream); + } + /*process the bottom vertex*/ + rChain.processNewVertex(botVertex, pStream); + } + else if(dec_current> dec_end) /*no more vertices on dec_chain*/ + { + inc_array = inc_chain->getArray(); + + reflexChain rChain(100,1); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, pStream); + /*process all the vertices on the inc_chain*/ + for(i=inc_current; i<=inc_end; i++){ + rChain.processNewVertex(inc_array[i], pStream); + } + /*process the bottom vertex*/ + rChain.processNewVertex(botVertex, pStream); + } + else /*neither chain is empty*/ + { + inc_array = inc_chain -> getArray(); + dec_array = dec_chain -> getArray(); + + /*if top of inc_chain is 'lower' than top of dec_chain, process all the + *vertices on the dec_chain which are higher than top of inc_chain + */ + if(compV2InY(inc_array[inc_current], dec_array[dec_current]) <= 0) + { + + reflexChain rChain(100, 0); + rChain.processNewVertex(topVertex, pStream); + for(i=dec_current; i<=dec_end; i++) + { + if(compV2InY(inc_array[inc_current], dec_array[i]) <= 0) + rChain.processNewVertex(dec_array[i], pStream); + else + break; + } + rChain.outputFan(inc_array[inc_current], pStream); + monoTriangulationRecGen(dec_array[i-1], botVertex, + inc_chain, inc_current, inc_end, + dec_chain, i, dec_end, + pStream); + } + else /*compV2InY(inc_array[inc_current], dec_array[dec_current]) > 0*/ + { + + reflexChain rChain(100, 1); + rChain.processNewVertex(topVertex, pStream); + for(i=inc_current; i<=inc_end; i++) + { + if(compV2InY(inc_array[i], dec_array[dec_current]) >0) + rChain.processNewVertex(inc_array[i], pStream); + else + break; + } + rChain.outputFan(dec_array[dec_current], pStream); + monoTriangulationRecGen(inc_array[i-1], botVertex, + inc_chain, i, inc_end, + dec_chain, dec_current,dec_end, + pStream); + } + }/*end case neither is empty*/ +} + +void monoTriangulationFun(directedLine* monoPolygon, Int (*compFun)(Real*, Real*), primStream* pStream) +{ + Int i; + /*find the top vertex, bottom vertex, inccreasing chain, and decreasing chain, + *then call monoTriangulationRec + */ + directedLine* tempV; + directedLine* topV; + directedLine* botV; + topV = botV = monoPolygon; + for(tempV = monoPolygon->getNext(); tempV != monoPolygon; tempV = tempV->getNext()) + { + if(compFun(topV->head(), tempV->head())<0) { + topV = tempV; + } + if(compFun(botV->head(), tempV->head())>0) { + botV = tempV; + } + } + + /*creat increase and decrease chains*/ + vertexArray inc_chain(20); /*this is a dynamic array*/ + for(i=1; i<=topV->get_npoints()-2; i++) { /*the first vertex is the top vertex which doesn't belong to inc_chain*/ + inc_chain.appendVertex(topV->getVertex(i)); + } + for(tempV = topV->getNext(); tempV != botV; tempV = tempV->getNext()) + { + for(i=0; i<=tempV->get_npoints()-2; i++){ + inc_chain.appendVertex(tempV->getVertex(i)); + } + } + + vertexArray dec_chain(20); + for(tempV = topV->getPrev(); tempV != botV; tempV = tempV->getPrev()) + { + for(i=tempV->get_npoints()-2; i>=0; i--){ + dec_chain.appendVertex(tempV->getVertex(i)); + } + } + for(i=botV->get_npoints()-2; i>=1; i--){ + dec_chain.appendVertex(tempV->getVertex(i)); + } + + if (!(0 == inc_chain.getNumElements() && 0 == dec_chain.getNumElements())) { + monoTriangulationRecFun(topV->head(), botV->head(), &inc_chain, 0, + &dec_chain, 0, compFun, pStream); + } +} + +void monoTriangulation(directedLine* monoPolygon, primStream* pStream) +{ + Int i; + /*find the top vertex, bottom vertex, inccreasing chain, and decreasing chain, + *then call monoTriangulationRec + */ + directedLine* tempV; + directedLine* topV; + directedLine* botV; + topV = botV = monoPolygon; + for(tempV = monoPolygon->getNext(); tempV != monoPolygon; tempV = tempV->getNext()) + { + if(compV2InY(topV->head(), tempV->head())<0) { + topV = tempV; + } + if(compV2InY(botV->head(), tempV->head())>0) { + botV = tempV; + } + } + /*creat increase and decrease chains*/ + vertexArray inc_chain(20); /*this is a dynamic array*/ + for(i=1; i<=topV->get_npoints()-2; i++) { /*the first vertex is the top vertex which doesn't belong to inc_chain*/ + inc_chain.appendVertex(topV->getVertex(i)); + } + for(tempV = topV->getNext(); tempV != botV; tempV = tempV->getNext()) + { + for(i=0; i<=tempV->get_npoints()-2; i++){ + inc_chain.appendVertex(tempV->getVertex(i)); + } + } + + vertexArray dec_chain(20); + for(tempV = topV->getPrev(); tempV != botV; tempV = tempV->getPrev()) + { + for(i=tempV->get_npoints()-2; i>=0; i--){ + dec_chain.appendVertex(tempV->getVertex(i)); + } + } + for(i=botV->get_npoints()-2; i>=1; i--){ + dec_chain.appendVertex(tempV->getVertex(i)); + } + + monoTriangulationRec(topV->head(), botV->head(), &inc_chain, 0, &dec_chain, 0, pStream); + +} + +/*the chain could be increasing or decreasing, although we use the + * name inc_chain. + *the argument is_increase_chain indicates whether this chain + *is increasing (left chain in V-monotone case) or decreaing (right chain + *in V-monotone case). + */ +void monoTriangulation2(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_smallIndex, + Int inc_largeIndex, + Int is_increase_chain, + primStream* pStream) +{ + assert( inc_chain != NULL); + Real** inc_array ; + + if(inc_smallIndex > inc_largeIndex) + return; //no triangles + if(inc_smallIndex == inc_largeIndex) + { + if(is_increase_chain) + pStream->triangle(inc_chain->getVertex(inc_smallIndex), botVertex, topVertex); + else + pStream->triangle(inc_chain->getVertex(inc_smallIndex), topVertex, botVertex); + return; + } + Int i; + + if(is_increase_chain && botVertex[1] == inc_chain->getVertex(inc_largeIndex)[1]) + { + pStream->triangle(botVertex, inc_chain->getVertex(inc_largeIndex-1), + inc_chain->getVertex(inc_largeIndex)); + monoTriangulation2(topVertex, botVertex, inc_chain, inc_smallIndex, + inc_largeIndex-1, + is_increase_chain, + pStream); + return; + } + else if( (!is_increase_chain) && topVertex[1] == inc_chain->getVertex(inc_smallIndex)[1]) + { + pStream->triangle(topVertex, inc_chain->getVertex(inc_smallIndex+1), + inc_chain->getVertex(inc_smallIndex)); + monoTriangulation2(topVertex, botVertex, inc_chain, inc_smallIndex+1, + inc_largeIndex, is_increase_chain, pStream); + return ; + } + + inc_array = inc_chain->getArray(); + + reflexChain rChain(20,is_increase_chain); /*1 means the chain is increasing*/ + + rChain.processNewVertex(topVertex, pStream); + + for(i=inc_smallIndex; i<=inc_largeIndex; i++){ + rChain.processNewVertex(inc_array[i], pStream); + } + rChain.processNewVertex(botVertex, pStream); + +} + +/*if compFun == compV2InY, top to bottom: V-monotone + *if compFun == compV2InX, right to left: U-monotone + */ +void monoTriangulationRecFunGen(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, Int inc_end, + vertexArray* dec_chain, Int dec_current, Int dec_end, + Int (*compFun)(Real*, Real*), + primStream* pStream) +{ + assert( inc_chain != NULL && dec_chain != NULL); + assert( ! (inc_current> inc_end && + dec_current> dec_end)); + /* + Int inc_nVertices; + Int dec_nVertices; + */ + Real** inc_array ; + Real** dec_array ; + Int i; + assert( ! ( (inc_chain==NULL) && (dec_chain==NULL))); + + if(inc_current> inc_end) /*no more vertices on inc_chain*/ + { + + dec_array = dec_chain->getArray(); + reflexChain rChain(20,0); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, pStream); + /*process all the vertices on the dec_chain*/ + for(i=dec_current; i<=dec_end; i++){ + rChain.processNewVertex(dec_array[i], pStream); + } + /*process the bottom vertex*/ + rChain.processNewVertex(botVertex, pStream); + + } + else if(dec_current> dec_end) /*no more vertices on dec_chain*/ + { + inc_array = inc_chain->getArray(); + reflexChain rChain(20,1); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, pStream); + /*process all the vertices on the inc_chain*/ + for(i=inc_current; i<=inc_end; i++){ + rChain.processNewVertex(inc_array[i], pStream); + } + /*process the bottom vertex*/ + rChain.processNewVertex(botVertex, pStream); + } + else /*neither chain is empty*/ + { + inc_array = inc_chain -> getArray(); + dec_array = dec_chain -> getArray(); + + /*if top of inc_chain is 'lower' than top of dec_chain, process all the + *vertices on the dec_chain which are higher than top of inc_chain + */ + if(compFun(inc_array[inc_current], dec_array[dec_current]) <= 0) + { + + reflexChain rChain(20, 0); + rChain.processNewVertex(topVertex, pStream); + for(i=dec_current; i<=dec_end; i++) + { + if(compFun(inc_array[inc_current], dec_array[i]) <= 0) + rChain.processNewVertex(dec_array[i], pStream); + else + break; + } + rChain.outputFan(inc_array[inc_current], pStream); + monoTriangulationRecFunGen(dec_array[i-1], botVertex, + inc_chain, inc_current, inc_end, + dec_chain, i, dec_end, + compFun, + pStream); + } + else /*compFun(inc_array[inc_current], dec_array[dec_current]) > 0*/ + { + + reflexChain rChain(20, 1); + rChain.processNewVertex(topVertex, pStream); + for(i=inc_current; i<=inc_end; i++) + { + if(compFun(inc_array[i], dec_array[dec_current]) >0) + rChain.processNewVertex(inc_array[i], pStream); + else + break; + } + rChain.outputFan(dec_array[dec_current], pStream); + monoTriangulationRecFunGen(inc_array[i-1], botVertex, + inc_chain, i,inc_end, + dec_chain, dec_current,dec_end, + compFun, + pStream); + } + }/*end case neither is empty*/ +} + +/*if compFun == compV2InY, top to bottom: V-monotone + *if compFun == compV2InX, right to left: U-monotone + */ +void monoTriangulationRecFun(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, + vertexArray* dec_chain, Int dec_current, + Int (*compFun)(Real*, Real*), + primStream* pStream) +{ + assert( inc_chain != NULL && dec_chain != NULL); + assert( ! (inc_current>=inc_chain->getNumElements() && + dec_current>=dec_chain->getNumElements())); + Int inc_nVertices; + Int dec_nVertices; + Real** inc_array ; + Real** dec_array ; + Int i; + assert( ! ( (inc_chain==NULL) && (dec_chain==NULL))); + + if(inc_current>=inc_chain->getNumElements()) /*no more vertices on inc_chain*/ + { + + dec_array = dec_chain->getArray(); + dec_nVertices = dec_chain->getNumElements(); + reflexChain rChain(20,0); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, pStream); + /*process all the vertices on the dec_chain*/ + for(i=dec_current; i= dec_chain->getNumElements()) /*no more vertices on dec_chain*/ + { + inc_array = inc_chain->getArray(); + inc_nVertices= inc_chain->getNumElements(); + reflexChain rChain(20,1); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, pStream); + /*process all the vertices on the inc_chain*/ + for(i=inc_current; i getArray(); + dec_array = dec_chain -> getArray(); + inc_nVertices= inc_chain->getNumElements(); + dec_nVertices= dec_chain->getNumElements(); + /*if top of inc_chain is 'lower' than top of dec_chain, process all the + *vertices on the dec_chain which are higher than top of inc_chain + */ + if(compFun(inc_array[inc_current], dec_array[dec_current]) <= 0) + { + + reflexChain rChain(20, 0); + rChain.processNewVertex(topVertex, pStream); + for(i=dec_current; i 0*/ + { + + reflexChain rChain(20, 1); + rChain.processNewVertex(topVertex, pStream); + for(i=inc_current; i0) + rChain.processNewVertex(inc_array[i], pStream); + else + break; + } + rChain.outputFan(dec_array[dec_current], pStream); + monoTriangulationRecFun(inc_array[i-1], botVertex, + inc_chain, i, + dec_chain, dec_current, + compFun, + pStream); + } + }/*end case neither is empty*/ +} + + +void monoTriangulationRec(Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, + vertexArray* dec_chain, Int dec_current, + primStream* pStream) +{ + assert( inc_chain != NULL && dec_chain != NULL); + assert( ! (inc_current>=inc_chain->getNumElements() && + dec_current>=dec_chain->getNumElements())); + Int inc_nVertices; + Int dec_nVertices; + Real** inc_array ; + Real** dec_array ; + Int i; + assert( ! ( (inc_chain==NULL) && (dec_chain==NULL))); + + if(inc_current>=inc_chain->getNumElements()) /*no more vertices on inc_chain*/ + { + + dec_array = dec_chain->getArray(); + dec_nVertices = dec_chain->getNumElements(); + reflexChain rChain(20,0); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, pStream); + /*process all the vertices on the dec_chain*/ + for(i=dec_current; i= dec_chain->getNumElements()) /*no more vertices on dec_chain*/ + { + inc_array = inc_chain->getArray(); + inc_nVertices= inc_chain->getNumElements(); + reflexChain rChain(20,1); + /*put the top vertex into the reflex chain*/ + rChain.processNewVertex(topVertex, pStream); + /*process all the vertices on the inc_chain*/ + for(i=inc_current; i getArray(); + dec_array = dec_chain -> getArray(); + inc_nVertices= inc_chain->getNumElements(); + dec_nVertices= dec_chain->getNumElements(); + /*if top of inc_chain is 'lower' than top of dec_chain, process all the + *vertices on the dec_chain which are higher than top of inc_chain + */ + if(compV2InY(inc_array[inc_current], dec_array[dec_current]) <= 0) + { + + reflexChain rChain(20, 0); + rChain.processNewVertex(topVertex, pStream); + for(i=dec_current; i 0*/ + { + + reflexChain rChain(20, 1); + rChain.processNewVertex(topVertex, pStream); + for(i=inc_current; i0) + rChain.processNewVertex(inc_array[i], pStream); + else + break; + } + rChain.outputFan(dec_array[dec_current], pStream); + monoTriangulationRec(inc_array[i-1], botVertex, + inc_chain, i, + dec_chain, dec_current, + pStream); + } + }/*end case neither is empty*/ +} + + + +/* the name here assumes that the polygon is Y-monotone, but + *this function also works for X-monotone polygons. + * a monotne polygon consists of two extrem verteices: topVertex and botVertex, and + *two monotone chains: inc_chain, and dec_chain. The edges of the increasing chain (inc_chain) + *is ordered by following pointer: next, while the edges of the decreasing chain (dec_chain) + *is ordered by following pointer: prev + * inc_index index the vertex which is the toppest of the inc_chain which we are handling currently. + * dec_index index the vertex which is the toppest of the dec_chain which we are handling currently. + */ +void monoTriangulationRec(directedLine* inc_chain, Int inc_index, + directedLine* dec_chain, Int dec_index, + directedLine* topVertex, Int top_index, + directedLine* botVertex, + primStream* pStream) +{ + Int i; + directedLine *temp, *oldtemp = NULL; + Int tempIndex, oldtempIndex = 0; + + assert(inc_chain != NULL && dec_chain != NULL); + + if(inc_chain == botVertex) { + reflexChain rChain(20, 0); + rChain.processNewVertex(topVertex->getVertex(top_index), pStream); + for(i=dec_index; i< dec_chain->get_npoints(); i++){ + rChain.processNewVertex(dec_chain->getVertex(i), pStream); + } + for(temp = dec_chain->getPrev(); temp != botVertex; temp = temp->getPrev()) + { + for(i=0; iget_npoints(); i++){ + rChain.processNewVertex(temp->getVertex(i), pStream); + } + } + } + else if(dec_chain==botVertex) { + reflexChain rChain(20, 1); + rChain.processNewVertex(topVertex->getVertex(top_index), pStream); + for(i=inc_index; i< inc_chain->get_npoints(); i++){ + rChain.processNewVertex(inc_chain->getVertex(i), pStream); + } + for(temp = inc_chain->getPrev(); temp != botVertex; temp = temp->getNext()) + { + for(i=0; iget_npoints(); i++){ + rChain.processNewVertex(temp->getVertex(i), pStream); + } + } + } + else /*neither reached the bottom*/{ + if(compV2InY(inc_chain->getVertex(inc_index), dec_chain->getVertex(dec_index)) <=0) { + reflexChain rChain(20, 0); + rChain.processNewVertex(topVertex -> getVertex(top_index), pStream); + temp = dec_chain; + tempIndex = dec_index; + while( compV2InY(inc_chain->getVertex(inc_index), temp->getVertex(tempIndex))<=0) { + oldtemp = temp; + oldtempIndex = tempIndex; + rChain.processNewVertex(temp->getVertex(tempIndex), pStream); + + if(tempIndex == temp->get_npoints()-1){ + tempIndex = 0; + temp = temp->getPrev(); + } + else{ + tempIndex++; + } + } + rChain.outputFan(inc_chain->getVertex(inc_index), pStream); + monoTriangulationRec(inc_chain, inc_index, temp, tempIndex, oldtemp, oldtempIndex, botVertex, pStream); + } + else /* >0*/ { + reflexChain rChain(20, 1); + rChain.processNewVertex(topVertex -> getVertex(top_index), pStream); + temp = inc_chain; + tempIndex = inc_index; + while( compV2InY(temp->getVertex(tempIndex), dec_chain->getVertex(dec_index))>0){ + oldtemp = temp; + oldtempIndex = tempIndex; + rChain.processNewVertex(temp->getVertex(tempIndex), pStream); + + if(tempIndex == temp->get_npoints()-1){ + tempIndex = 0; + temp = temp->getNext(); + } + else{ + tempIndex++; + } + } + rChain.outputFan(dec_chain->getVertex(dec_index), pStream); + monoTriangulationRec(temp, tempIndex, dec_chain, dec_index, oldtemp, oldtempIndex, botVertex, pStream); + } + } /*end case neither reached the bottom*/ +} + +/***************************vertexArray begin here**********************************/ +vertexArray::vertexArray(Real2* vertices, Int nVertices) +{ + Int i; + size = index = nVertices; + array = (Real**) malloc(sizeof(Real*) * nVertices); + assert(array); + for(i=0; i= size){ + Real** temp = (Real**) malloc(sizeof(Real*) * (2*size +1)); + assert(temp); + for(i=0; i= v + * and array[i+1][1] v + *if sartIndex>endIndex, then return endIndex+1. + *otherwise, startIndex<=endIndex, it is assumed that + * 0<=startIndex<=endIndex endIndex) + return endIndex+1; + else if(array[endIndex][1] > v) + return endIndex+1; + else //now array[endIndex][1] <= v + { + for(i=endIndex-1; i>=startIndex; i--) + { + if(array[i][1] > v) + break; + } + return i+1; + } +} + +/*find the first i<=endIndex such that array[i-1][1] >= v + * and array[i][1] < v + *if sartIndex>endIndex, then return endIndex+1. + *otherwise, startIndex<=endIndex, it is assumed that + * 0<=startIndex<=endIndex endIndex) + return endIndex+1; + else if(array[endIndex][1] >= v) + return endIndex+1; + else //now array[endIndex][1] < v + { + for(i=endIndex-1; i>=startIndex; i--) + { + if(array[i][1] >= v) + break; + } + return i+1; + } +} + +/*find the first i>startIndex such that array[i-1][1] > v + * and array[i][1] >=v + *if sartIndex>endIndex, then return startIndex-1. + *otherwise, startIndex<=endIndex, it is assumed that + * 0<=startIndex<=endIndex endIndex) + return startIndex-1; + else if(array[startIndex][1] < v) + return startIndex-1; + else //now array[startIndex][1] >= v + { + + for(i=startIndex; i<=endIndex; i++) + { + if(array[i][1] <= v) + break; + } + if(i>endIndex) // v is strictly below all + return endIndex; + else if(array[i][1] == v) + return i; + else + return i-1; + } + +} + + +/*find the first i>=startIndex such that array[i][1] >= v + * and array[i+1][1] endIndex, then return startIndex-1. + *otherwise, startIndex<=endIndex, it is assumed that + * 0<=startIndex<=endIndex endIndex) + return startIndex-1; + else if(array[startIndex][1] < v) + return startIndex-1; + else //now array[startIndex][1] >= v + { + for(i=startIndex+1; i<=endIndex; i++) + { + if(array[i][1] < v) + break; + } + return i-1; + } +} + +Int vertexArray::findDecreaseChainFromEnd(Int begin, Int end) +{ + Int i = end; + Real prevU = array[i][0]; + Real thisU; + for(i=end-1; i>=begin; i--){ + thisU = array[i][0]; + if(thisU < prevU) + prevU = thisU; + else + break; + } + return i; +} + +//if(V(start) == v, return start, other wise return the +//last i so that V(i)==v +Int vertexArray::skipEqualityFromStart(Real v, Int start, Int end) +{ + Int i; + if(array[start][1] != v) + return start; + //now array[start][1] == v + for(i=start+1; i<= end; i++) + if(array[i][1] != v) + break; + return i-1; +} + + +/***************************vertexArray end****************************************/ + + + +/***************************relfex chain stuff begin here*****************************/ + +reflexChain::reflexChain(Int size, Int is_increasing) +{ + queue = (Real2*) malloc(sizeof(Real2) * size); + assert(queue); + index_queue = 0; + size_queue = size; + isIncreasing = is_increasing; +} + +reflexChain::~reflexChain() +{ + free(queue); +} + +/*put (u,v) at the end of the queue + *pay attention to space + */ +void reflexChain::insert(Real u, Real v) +{ + Int i; + if(index_queue >= size_queue) { + Real2 *temp = (Real2*) malloc(sizeof(Real2) * (2*size_queue+1)); + assert(temp); + + /*copy*/ + for(i=0; ibegin(); + pStream->insert(v); + if(isIncreasing) { + for(i=0; iinsert(queue[i]); + } + else { + for(i=index_queue-1; i>=0; i--) + pStream->insert(queue[i]); + } + pStream->end(PRIMITIVE_STREAM_FAN); +} + +void reflexChain::processNewVertex(Real v[2], primStream* pStream) +{ + Int i,j,k; + Int isReflex; + /*if there are at most one vertex in the queue, then simply insert + */ + if(index_queue <=1){ + insert(v); + return; + } + + /*there are at least two vertices in the queue*/ + j=index_queue-1; + + for(i=j; i>=1; i--) { + if(isIncreasing) { + isReflex = (area(queue[i-1], queue[i], v) <= 0.0); + } + else /*decreasing*/{ + isReflex = (area(v, queue[i], queue[i-1]) <= 0.0); + } + if(isReflex) { + break; + } + } + + /* + *if ibegin(); + pStream->insert(v); + if(isIncreasing) { + for(k=i; k<=j; k++) + pStream->insert(queue[k]); + } + else { + for(k=j; k>=i; k--) + pStream->insert(queue[k]); + } + + pStream->end(PRIMITIVE_STREAM_FAN); + } + + /*delete vertices i+1--j from the queue*/ + index_queue = i+1; + /*finally insert v at the end of the queue*/ + insert(v); + +} + +void reflexChain::print() +{ + Int i; + printf("reflex chain: isIncreasing=%i\n", isIncreasing); + for(i=0; i +#define _glu_dprintf printf +#else +inline void _glu_dprintf( char *, ... ) { } +#endif +#endif + +#ifdef GLBUILD +inline void _glu_dprintf( char *, ... ) { } +#endif + +#ifndef NULL +#define NULL 0 +#endif + +#endif /* __glumystdio_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/mystdlib.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/mystdlib.h new file mode 100644 index 000000000..ab7a3b273 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/mystdlib.h @@ -0,0 +1,57 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +/* + * mystdlib.h + * + */ + +#ifndef __glumystdlib_h_ +#define __glumystdlib_h_ + +#ifdef STANDALONE +typedef unsigned int size_t; +extern "C" void abort( void ); +extern "C" void * malloc( size_t ); +extern "C" void free( void * ); +#endif + +#ifdef LIBRARYBUILD +#include +#endif + +#ifdef GLBUILD +typedef unsigned int size_t; +extern "C" void abort( void ); +extern "C" void * malloc( size_t ); +extern "C" void free( void * ); +#endif + +#endif /* __glumystdlib_h_ */ diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionX.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionX.cc new file mode 100644 index 000000000..e25e30b0f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionX.cc @@ -0,0 +1,162 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include + +#include "partitionX.h" + +#define CONCAVITY_ZERO 1.0e-6 //this number is used to test whether a vertex is concave (refelx) + //or not. The test needs to compute the area of the three adjacent + //vertices to see if the are is positive or negative. + +Int isCuspX(directedLine *v) +{ + //if v->prev <= v && v->next <= v + //|| v->prev >= v && v->next >= v + Real* T = v->head(); + Real* P = v->getPrev()->head(); + Real* N = v->getNext()->head(); + if( + (compV2InX(T,P) != -1 && + compV2InX(T,N) != -1 + ) || + (compV2InX(T,P) != 1 && + compV2InX(T,N) != 1 + ) + ) + return 1; + else + return 0; +} + +Int isReflexX(directedLine* v) +{ + Real* A = v->getPrev()->head(); + Real* B = v->head(); + Real* C = v->tail(); + Real Bx,By, Cx, Cy; + //scale them in case they are too small + Bx = 10*(B[0] - A[0]); + By = 10*(B[1] - A[1]); + Cx = 10*(C[0] - A[0]); + Cy = 10*(C[1] - A[1]); + + if(Bx*Cy - Cx*By < -CONCAVITY_ZERO) return 1; + else return 0; +} + + +/*return + *0: not-cusp + *1: interior cusp + *2: exterior cusp + */ +Int cuspTypeX(directedLine *v) +{ + if(! isCuspX(v)) return 0; + else + { +//printf("isCusp,%f,%f\n", v->head()[0], v->head()[1]); + if(isReflexX(v)) + { +// printf("isReflex\n"); + return 1; + } + else + { +// printf("not isReflex\n"); + return 2; + } + } +} + +Int numInteriorCuspsX(directedLine *polygon) +{ + directedLine *temp; + int ret = 0; + if(cuspTypeX(polygon) == 1) + ret++; + for(temp = polygon->getNext(); temp != polygon; temp = temp->getNext()) + if(cuspTypeX(temp) == 1) + ret++; + return ret; +} + + +void findInteriorCuspsX(directedLine *polygon, Int& ret_n_interior_cusps, + directedLine** ret_interior_cusps) +{ + directedLine *temp; + ret_n_interior_cusps = 0; + if(cuspTypeX(polygon) == 1) + { + ret_interior_cusps[ret_n_interior_cusps++] = polygon; + } + for(temp = polygon->getNext(); temp != polygon; temp = temp->getNext()) + if(cuspTypeX(temp) == 1) + { + ret_interior_cusps[ret_n_interior_cusps++] = temp; + } +} + +directedLine* findDiagonal_singleCuspX(directedLine* cusp) +{ + directedLine* temp; + Int is_minimal = ((compV2InX(cusp->head(), cusp->tail()) == -1)? 1:0); + + if(is_minimal) + for(temp = cusp->getNext(); temp != cusp; temp = temp->getNext()) + { + if(compV2InX(cusp->head(), temp->head()) == 1) + { + return temp; + } + } + else //is maxmal + for(temp = cusp->getNext(); temp != cusp; temp = temp->getNext()) + { + if(compV2InX(cusp->head(), temp->head()) == -1) + { + return temp; + } + } + return NULL; +} + + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionX.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionX.h new file mode 100644 index 000000000..69f2b2df2 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionX.h @@ -0,0 +1,54 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _PARTITIONX_H +#define _PARTITIONX_H + +#include "directedLine.h" + +Int isCuspX(directedLine *v); +Int isReflexX(directedLine *v); +Int cuspTypeX(directedLine *v); + +//assuming the array of ret_interior_cusps has been allocated +void findInteriorCuspsX(directedLine* polygon, Int& ret_n_interior_cusps, + directedLine** ret_interior_cusps); + +Int numInteriorCuspsX(directedLine* polygon); + +/*a single polygon with a single cusp + *return the diagonal vertex corresponding to this cusp + */ +directedLine* findDiagonal_singleCuspX(directedLine* cusp); + +#endif + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.cc new file mode 100644 index 000000000..297c62997 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.cc @@ -0,0 +1,836 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include + +#include "zlassert.h" +#include "partitionY.h" +#include "searchTree.h" +#include "quicksort.h" +#include "polyUtil.h" + + +#define max(a,b) ((a>b)? a:b) +#define min(a,b) ((a>b)? b:a) + + +/*retrurn + *-1: if A < B (YaB + */ +static Int compVertInY(Real A[2], Real B[2]) +{ + if( (A[1] < B[1]) || (A[1]==B[1] && A[0]head(); + if( compVertInY(e->head(), vert) != 1 + && compVertInY(e->tail(), vert) != 1 + ) + return 1; + else + return 0; +} + +/*v is a vertex: the head of en edge, + *e is an edge, + *return 1 if e is below v: assume v1 and v2 are the two endpoints of e: + * v1>= v, v2>=v. + */ +Int isAbove(directedLine *v, directedLine *e) +{ + Real* vert = v->head(); + if( compVertInY(e->head(), vert) != -1 + && compVertInY(e->tail(), vert) != -1 + ) + return 1; + else + return 0; +} + +Int isCusp(directedLine *v) +{ + Real *A=v->getPrev()->head(); + Real *B=v->head(); + Real *C=v->tail(); + if(A[1] < B[1] && B[1] < C[1]) + return 0; + else if(A[1] > B[1] && B[1] > C[1]) + return 0; + else if(A[1] < B[1] && C[1] < B[1]) + return 1; + else if(A[1] > B[1] && C[1] > B[1]) + return 1; + + if(isAbove(v, v) && isAbove(v, v->getPrev()) || + isBelow(v, v) && isBelow(v, v->getPrev())) + return 1; + else + return 0; +} + +/*crossproduct is strictly less than 0*/ +Int isReflex(directedLine *v) +{ + Real* A = v->getPrev()->head(); + Real* B = v->head(); + Real* C = v->tail(); + Real Bx,By, Cx, Cy; + Bx = B[0] - A[0]; + By = B[1] - A[1]; + Cx = C[0] - A[0]; + Cy = C[1] - A[1]; + + if(Bx*Cy - Cx*By < 0) return 1; + else return 0; +} + + /*return + *0: not-cusp + *1: interior cusp + *2: exterior cusp + */ +Int cuspType(directedLine *v) +{ + if(! isCusp(v)) return 0; + else if(isReflex(v)) return 1; + else + return 2; +} + +sweepRange* sweepRangeMake(directedLine* left, Int leftType, + directedLine* right, Int rightType) +{ + sweepRange* ret = (sweepRange*)malloc(sizeof(sweepRange)); + assert(ret); + ret->left = left; + ret->leftType = leftType; + ret->right = right; + ret->rightType = rightType; + return ret; +} + +void sweepRangeDelete(sweepRange* range) +{ + free(range); +} + +Int sweepRangeEqual(sweepRange* src1, sweepRange* src2) +{ + Int leftEqual; + Int rightEqual; + + + /*The case when both are vertices should not happen*/ + assert(! (src1->leftType == 0 && src2->leftType == 0)); + if(src1->leftType == 0 && src2->leftType == 1){ + if(src1->left == src2->left || + src1->left->getPrev() == src2->left + ) + leftEqual = 1; + else + leftEqual = 0; + } + else if(src1->leftType == 1 && src2->leftType == 1){ + if(src1->left == src2->left) + leftEqual = 1; + else + leftEqual = 0; + } + else /*src1->leftType == 1 && src2->leftType == 0*/{ + if(src1->left == src2->left || + src1->left == src2->left->getPrev() + ) + leftEqual = 1; + else + leftEqual = 0; + } + + /*the same thing for right*/ + /*The case when both are vertices should not happen*/ + assert(! (src1->rightType == 0 && src2->rightType == 0)); + if(src1->rightType == 0 && src2->rightType == 1){ + if(src1->right == src2->right || + src1->right->getPrev() == src2->right + ) + rightEqual = 1; + else + rightEqual = 0; + } + else if(src1->rightType == 1 && src2->rightType == 1){ + if(src1->right == src2->right) + rightEqual = 1; + else + rightEqual = 0; + } + else /*src1->rightType == 1 && src2->rightType == 0*/{ + if(src1->right == src2->right || + src1->right == src2->right->getPrev() + ) + rightEqual = 1; + else + rightEqual = 0; + } + + return (leftEqual == 1 || rightEqual == 1); +} + +/*given (x_1, y_1) and (x_2, y_2), and y + *return x such that (x,y) is on the line + */ +inline/*static*/ Real intersectHoriz(Real x1, Real y1, Real x2, Real y2, Real y) +{ + return ((y2==y1)? (x1+x2)*Real(0.5) : x1 + ((y-y1)/(y2-y1)) * (x2-x1)); +/* + if(y2 == y1) return (x1+x2)*0.5; + else return x1 + ((y-y1)/(y2-y1)) * (x2-x1); +*/ +} + +/*compare two edges of a polygon. + *edge A < edge B if there is a horizontal line so that the intersection + *with A is to the left of the intersection with B. + *This function is used in sweepY for the dynamic search tree insertion to + *order the edges. + * Implementation: (x_1,y_1) and (x_2, y_2) + */ +static Int compEdges(directedLine *e1, directedLine *e2) +{ + Real* head1 = e1->head(); + Real* tail1 = e1->tail(); + Real* head2 = e2->head(); + Real* tail2 = e2->tail(); +/* + Real h10 = head1[0]; + Real h11 = head1[1]; + Real t10 = tail1[0]; + Real t11 = tail1[1]; + Real h20 = head2[0]; + Real h21 = head2[1]; + Real t20 = tail2[0]; + Real t21 = tail2[1]; +*/ + Real e1_Ymax, e1_Ymin, e2_Ymax, e2_Ymin; +/* + if(h11>t11) { + e1_Ymax= h11; + e1_Ymin= t11; + } + else{ + e1_Ymax = t11; + e1_Ymin = h11; + } + + if(h21>t21) { + e2_Ymax= h21; + e2_Ymin= t21; + } + else{ + e2_Ymax = t21; + e2_Ymin = h21; + } +*/ + + if(head1[1]>tail1[1]) { + e1_Ymax= head1[1]; + e1_Ymin= tail1[1]; + } + else{ + e1_Ymax = tail1[1]; + e1_Ymin = head1[1]; + } + + if(head2[1]>tail2[1]) { + e2_Ymax= head2[1]; + e2_Ymin= tail2[1]; + } + else{ + e2_Ymax = tail2[1]; + e2_Ymin = head2[1]; + } + + + /*Real e1_Ymax = max(head1[1], tail1[1]);*/ /*max(e1->head()[1], e1->tail()[1]);*/ + /*Real e1_Ymin = min(head1[1], tail1[1]);*/ /*min(e1->head()[1], e1->tail()[1]);*/ + /*Real e2_Ymax = max(head2[1], tail2[1]);*/ /*max(e2->head()[1], e2->tail()[1]);*/ + /*Real e2_Ymin = min(head2[1], tail2[1]);*/ /*min(e2->head()[1], e2->tail()[1]);*/ + + Real Ymax = min(e1_Ymax, e2_Ymax); + Real Ymin = max(e1_Ymin, e2_Ymin); + + Real y = Real(0.5)*(Ymax + Ymin); + +/* Real x1 = intersectHoriz(e1->head()[0], e1->head()[1], e1->tail()[0], e1->tail()[1], y); + Real x2 = intersectHoriz(e2->head()[0], e2->head()[1], e2->tail()[0], e2->tail()[1], y); +*/ +/* + Real x1 = intersectHoriz(h10, h11, t10, t11, y); + Real x2 = intersectHoriz(h20, h21, t20, t21, y); +*/ + Real x1 = intersectHoriz(head1[0], head1[1], tail1[0], tail1[1], y); + Real x2 = intersectHoriz(head2[0], head2[1], tail2[0], tail2[1], y); + + if(x1<= x2) return -1; + else return 1; +} + +/*used by sort precedures + */ +static Int compInY(directedLine* v1, directedLine* v2) +{ + return v1->compInY(v2); +} + +void findDiagonals(Int total_num_edges, directedLine** sortedVertices, sweepRange** ranges, Int& num_diagonals, directedLine** diagonal_vertices) +{ + Int i,j,k; + + k=0; + + for(i=0; igetPrev(); +/* +printf("find i=%i\n", i); +printf("the vertex is\n"); +vert->printSingle(); +*/ + if(isBelow(vert, thisEdge) && isBelow(vert, prevEdge) && compEdges(prevEdge, thisEdge)<0) + { + /*this is an upward interior cusp*/ + diagonal_vertices[k++] = vert; + + for(j=i+1; j0) + { + /*this is an downward interior cusp*/ + diagonal_vertices[k++] = vert; + for(j=i-1; j>=0; j--) + if(sweepRangeEqual(ranges[i], ranges[j])) + { + diagonal_vertices[k++] = sortedVertices[j]; + break; + } +/* printf("j=%i\n", j);*/ + assert(j>=0); + + + + } + } + num_diagonals = k/2; +} + +/*get rid of repeated diagonlas so that each diagonal appears only once in the array + */ +Int deleteRepeatDiagonals(Int num_diagonals, directedLine** diagonal_vertices, directedLine** new_vertices) +{ + Int i,k; + Int j,l; + Int index; + index=0; + for(i=0,k=0; itoArrayAllPolygons(total_num_edges); + quicksort( (void**)array, 0, total_num_edges-1, (Int (*)(void*, void*)) compInY); + sweepRange** ranges = (sweepRange**) malloc(sizeof(sweepRange*) * total_num_edges); + assert(ranges); + + sweepY(total_num_edges, array, ranges); + + directedLine** diagonal_vertices = (directedLine**) malloc(sizeof(directedLine*) * total_num_edges); + assert(diagonal_vertices); + findDiagonals(total_num_edges, array, ranges, num_diagonals, diagonal_vertices); + + num_diagonals=deleteRepeatDiagonals(num_diagonals, diagonal_vertices, diagonal_vertices); + return diagonal_vertices; + +} + + +/*partition into Y-monotone polygons*/ +directedLine* partitionY(directedLine *polygons, sampledLine **retSampledLines) +{ + Int total_num_edges = 0; + directedLine** array = polygons->toArrayAllPolygons(total_num_edges); + + quicksort( (void**)array, 0, total_num_edges-1, (Int (*)(void*, void*)) compInY); + + sweepRange** ranges = (sweepRange**) malloc(sizeof(sweepRange*) * (total_num_edges)); + assert(ranges); + + + + sweepY(total_num_edges, array, ranges); + + + + /*the diagonal vertices are stored as: + *v0-v1: 1st diagonal + *v2-v3: 2nd diagonal + *v5-v5: 3rd diagonal + *... + */ + + + Int num_diagonals; + /*number diagonals is < total_num_edges*total_num_edges*/ + directedLine** diagonal_vertices = (directedLine**) malloc(sizeof(directedLine*) * total_num_edges*2/*total_num_edges*/); + assert(diagonal_vertices); + + + + findDiagonals(total_num_edges, array, ranges, num_diagonals, diagonal_vertices); + + + + directedLine* ret_polygons = polygons; + sampledLine* newSampledLines = NULL; + Int i,k; + +num_diagonals=deleteRepeatDiagonals(num_diagonals, diagonal_vertices, diagonal_vertices); + + + + Int *removedDiagonals=(Int*)malloc(sizeof(Int) * num_diagonals); + for(i=0; ifindRoot(); + directedLine *root2 = v2->findRoot(); + assert(root1); + assert(root2); +*/ + +directedLine* root1 = v1->rootLinkFindRoot(); +directedLine* root2 = v2->rootLinkFindRoot(); + + if(root1 != root2) + { + + removedDiagonals[i] = 1; + sampledLine* generatedLine; + + + + v1->connectDiagonal(v1,v2, &ret_p1, &ret_p2, &generatedLine, ret_polygons); + + + + newSampledLines = generatedLine->insert(newSampledLines); +/* + ret_polygons = ret_polygons->cutoffPolygon(root1); + + ret_polygons = ret_polygons->cutoffPolygon(root2); + ret_polygons = ret_p1->insertPolygon(ret_polygons); +root1->rootLinkSet(ret_p1); +root2->rootLinkSet(ret_p1); +ret_p1->rootLinkSet(NULL); +ret_p2->rootLinkSet(ret_p1); +*/ + ret_polygons = ret_polygons->cutoffPolygon(root2); + + + +root2->rootLinkSet(root1); +ret_p1->rootLinkSet(root1); +ret_p2->rootLinkSet(root1); + + /*now that we have connected the diagonal v1 and v2, + *we have to check those unprocessed diagonals which + *have v1 or v2 as an end point. Notice that the head of v1 + *has the same coodinates as the head of v2->prev, and the head of + *v2 has the same coordinate as the head of v1->prev. + *Suppose these is a diagonal (v1, x). If (v1,x) is still a valid + *diagonal, then x should be on the left hand side of the directed line: *v1->prev->head -- v1->head -- v1->tail. Otherwise, (v1,x) should be + *replaced by (v2->prev, x), that is, x is on the left of + * v2->prev->prev->head, v2->prev->head, v2->prev->tail. + */ + Int ii, kk; + for(ii=0, kk=0; iiprev->head:v1->head:v1->tail*/ + if(! pointLeft2Lines(v1->getPrev()->head(), + v1->head(), v1->tail(), d2->head())) + { +/* + assert(pointLeft2Lines(v2->getPrev()->getPrev()->head(), + v2->getPrev()->head(), + v2->getPrev()->tail(), d2->head())); +*/ + diagonal_vertices[kk] = v2->getPrev(); + } + } + if(d1 == v2) { + /*check if d2 is to left of v2->prev->head:v2->head:v2->tail*/ + if(! pointLeft2Lines(v2->getPrev()->head(), + v2->head(), v2->tail(), d2->head())) + { +/* + assert(pointLeft2Lines(v1->getPrev()->getPrev()->head(), + v1->getPrev()->head(), + v1->getPrev()->tail(), d2->head())); +*/ + diagonal_vertices[kk] = v1->getPrev(); + } + } + /*check d2 and replace diagonal_vertices[k+1] if necessary*/ + if(d2 == v1) { + /*check if d1 is to left of v1->prev->head:v1->head:v1->tail*/ + if(! pointLeft2Lines(v1->getPrev()->head(), + v1->head(), v1->tail(), d1->head())) + { +/* assert(pointLeft2Lines(v2->getPrev()->getPrev()->head(), + v2->getPrev()->head(), + v2->getPrev()->tail(), d1->head())); +*/ + diagonal_vertices[kk+1] = v2->getPrev(); + } + } + if(d2 == v2) { + /*check if d1 is to left of v2->prev->head:v2->head:v2->tail*/ + if(! pointLeft2Lines(v2->getPrev()->head(), + v2->head(), v2->tail(), d1->head())) + { +/* assert(pointLeft2Lines(v1->getPrev()->getPrev()->head(), + v1->getPrev()->head(), + v1->getPrev()->tail(), d1->head())); +*/ + diagonal_vertices[kk+1] = v1->getPrev(); + } + } + } +}/*end if (root1 not equal to root 2)*/ +} + + /*second pass, now all diagoals should belong to the same polygon*/ + + + + for(i=0,k=0; ifindRoot(); +/* + directedLine *root2 = v2->findRoot(); + + + + assert(root1); + assert(root2); + assert(root1 == root2); + */ + sampledLine* generatedLine; + + + + v1->connectDiagonal(v1,v2, &ret_p1, &ret_p2, &generatedLine, ret_polygons); + newSampledLines = generatedLine->insert(newSampledLines); + + ret_polygons = ret_polygons->cutoffPolygon(root1); + + ret_polygons = ret_p1->insertPolygon(ret_polygons); + + ret_polygons = ret_p2->insertPolygon(ret_polygons); + + + + for(Int j=i+1; jsamePolygon(temp1, temp2)) + { + /*if temp1 and temp2 are in different polygons, + *then one of them must be v1 or v2. + */ + + + + assert(temp1==v1 || temp1 == v2 || temp2==v1 || temp2 ==v2); + if(temp1==v1) + { + diagonal_vertices[2*j] = v2->getPrev(); + } + if(temp2==v1) + { + diagonal_vertices[2*j+1] = v2->getPrev(); + } + if(temp1==v2) + { + diagonal_vertices[2*j] = v1->getPrev(); + } + if(temp2==v2) + { + diagonal_vertices[2*j+1] = v1->getPrev(); + } + } + } + } + + } + + /*clean up spaces*/ + free(array); + free(ranges); + free(diagonal_vertices); + free(removedDiagonals); + + *retSampledLines = newSampledLines; + return ret_polygons; +} + +/*given a set of simple polygons where the interior + *is decided by left-hand principle, + *return a range (sight) for each vertex. This is called + *Trapezoidalization. + */ +void sweepY(Int nVertices, directedLine** sortedVertices, sweepRange** ret_ranges) +{ + Int i; + /*for each vertex in the sorted list, update the binary search tree. + *and store the range information for each vertex. + */ + treeNode* searchTree = NULL; + for(i=0; igetPrev(); + + if(isBelow(vert, thisEdge) && isAbove(vert, prevEdge)) + { + + /*case 1: this < v < prev + *the polygon is going down at v, the interior is to + *the right hand side. + * find the edge to the right of thisEdge for right range. + * delete thisEdge + * insert prevEdge + */ + treeNode* thisNode = TreeNodeFind(searchTree, thisEdge, ( Int (*) (void *, void *))compEdges); + assert(thisNode); + + treeNode* succ = TreeNodeSuccessor(thisNode); + assert(succ); + searchTree = TreeNodeDeleteSingleNode(searchTree, thisNode); + searchTree = TreeNodeInsert(searchTree, TreeNodeMake(prevEdge), ( Int (*) (void *, void *))compEdges); + + + ret_ranges[i] = sweepRangeMake(vert, 0, (directedLine*) (succ->key), 1); + + } + else if(isAbove(vert, thisEdge) && isBelow(vert, prevEdge)) + { + + /*case 2: this > v > prev + *the polygon is going up at v, the interior is to + *the left hand side. + * find the edge to the left of thisEdge for left range. + * delete prevEdge + * insert thisEdge + */ + treeNode* prevNode = TreeNodeFind(searchTree, prevEdge, ( Int (*) (void *, void *))compEdges); + assert(prevNode); + treeNode* pred = TreeNodePredecessor(prevNode); + searchTree = TreeNodeDeleteSingleNode(searchTree, prevNode); + searchTree = TreeNodeInsert(searchTree, TreeNodeMake(thisEdge), ( Int (*) (void *, void *))compEdges); + ret_ranges[i] = sweepRangeMake((directedLine*)(pred->key), 1, vert, 0); + } + else if(isAbove(vert, thisEdge) && isAbove(vert, prevEdge)) + { + + /*case 3: insert both edges*/ + treeNode* thisNode = TreeNodeMake(thisEdge); + treeNode* prevNode = TreeNodeMake(prevEdge); + searchTree = TreeNodeInsert(searchTree, thisNode, ( Int (*) (void *, void *))compEdges); + searchTree = TreeNodeInsert(searchTree, prevNode, ( Int (*) (void *, void *))compEdges); + if(compEdges(thisEdge, prevEdge)<0) /*interior cusp*/ + { + + treeNode* leftEdge = TreeNodePredecessor(thisNode); + treeNode* rightEdge = TreeNodeSuccessor(prevNode); + ret_ranges[i] = sweepRangeMake( (directedLine*) leftEdge->key, 1, + (directedLine*) rightEdge->key, 1 + ); + } + else /*exterior cusp*/ + { + + ret_ranges[i] = sweepRangeMake( prevEdge, 1, thisEdge, 1); + } + } + else if(isBelow(vert, thisEdge) && isBelow(vert, prevEdge)) + { + + /*case 4: delete both edges*/ + treeNode* thisNode = TreeNodeFind(searchTree, thisEdge, ( Int (*) (void *, void *))compEdges); + treeNode* prevNode = TreeNodeFind(searchTree, prevEdge, ( Int (*) (void *, void *))compEdges); + if(compEdges(thisEdge, prevEdge)>0) /*interior cusp*/ + { + treeNode* leftEdge = TreeNodePredecessor(prevNode); + treeNode* rightEdge = TreeNodeSuccessor(thisNode); + ret_ranges[i] = sweepRangeMake( (directedLine*) leftEdge->key, 1, + (directedLine*) rightEdge->key, 1 + ); + } + else /*exterior cusp*/ + { + ret_ranges[i] = sweepRangeMake( thisEdge, 1, prevEdge, 1); + } + searchTree = TreeNodeDeleteSingleNode(searchTree, thisNode); + searchTree = TreeNodeDeleteSingleNode(searchTree, prevNode); + } + else + { + fprintf(stderr,"error in partitionY.C, invalid case\n"); + printf("vert is\n"); + vert->printSingle(); + printf("thisEdge is\n"); + thisEdge->printSingle(); + printf("prevEdge is\n"); + prevEdge->printSingle(); + + exit(1); + } + } + + /*finaly clean up space: delete the search tree*/ + TreeNodeDeleteWholeTree(searchTree); +} diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.h new file mode 100644 index 000000000..8dda409de --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/partitionY.h @@ -0,0 +1,97 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* + *partitionY.h: + *partition a polygon into a Y-monotone polygon: + * A polygon is Y-monotone if the boundary can be split into two polygon chains + *A and B such that each chain is Y-monotonic that is the intersection of any + *horizontal line intersects each chain has at most one connected componenets + * (empty, single point or a single line). + * + * A vertex is a cusp if both its ajacent vertices are either at or above v, + *or both at or below v. In addition, at least one of the ajacent verteces is + *strictly below or above v. + * A vertex is a relex vertex if the internals angle is strictly greater than + *180. In other words, if the the signed area is negative: + *(x1, y1), (x2, y2), (x3, y3) are the three vertices along a polygon, the + *order is such that left hand side is inside the polygon. Then (x2,y2) is + *reflex if: + * (x2-x1, y2-y1) cross (x3-x1, y3-y1) <0. + *A vertex is an interior cusp if it is a cusp and a reflex. + *A vertex is an exterior cusp if it is a cusp but not a reflex. + * + */ + +#ifndef _PARTITIONY_H +#define _PARTITIONY_H + +#include "directedLine.h" + +/*whether an edge is below a vertex*/ +Int isBelow(directedLine *v, directedLine *e); + +/*whether an edge is above a vertex*/ +Int isAbove(directedLine *v, directedLine *e); + +/*not-cusp, + *inerior cusp + *exterior cusp + */ +Int cuspType(directedLine *v); + +/*used in trapezoidalization*/ +typedef struct sweepRange{ + directedLine *left; + Int leftType; /*either a vertex (leftType=0) or an edge (leftType =1) */ + directedLine *right; + Int rightType; /*either a vertex (rightType=0) or an edge (rightType =1) */ +} sweepRange; + +sweepRange* sweepRangeMake(directedLine* left, Int leftType, + directedLine* right, Int rightType); + +void sweepRangeDelete(sweepRange* range); +Int sweepRangeEqual(sweepRange* sr1, sweepRange* sr2); + +/*given a set of simple polygons where the interior + *is decided by left-hand principle, + *return a range (sight) for each vertex. This is called + *Trapezoidalization. + */ +void sweepY(Int nVertices, directedLine **sortedVerteces, sweepRange** ret_ranges); + + +directedLine* partitionY(directedLine *polygons, sampledLine **retSampledLines); + +void findDiagonals(Int total_num_edges, directedLine** sortedVertices, sweepRange** ranges, Int& num_diagonals, directedLine** diagonal_vertices); + +directedLine** DBGfindDiagonals(directedLine *polygons, Int& num_diagonals); + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc new file mode 100644 index 000000000..4d04df73f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.cc @@ -0,0 +1,734 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include +#include "zlassert.h" +#include "polyDBG.h" + +#ifdef __WATCOMC__ +#pragma warning 14 10 +#pragma warning 391 10 +#pragma warning 726 10 +#endif + +static Real area(Real A[2], Real B[2], Real C[2]) +{ + Real Bx, By, Cx, Cy; + Bx = B[0] - A[0]; + By = B[1] - A[1]; + Cx = C[0] - A[0]; + Cy = C[1] - A[1]; + return Bx*Cy - Cx*By; +} + +Int DBG_isConvex(directedLine *poly) +{ + directedLine* temp; + if(area(poly->head(), poly->tail(), poly->getNext()->tail()) < 0.00000) + return 0; + for(temp = poly->getNext(); temp != poly; temp = temp->getNext()) + { + if(area(temp->head(), temp->tail(), temp->getNext()->tail()) < 0.00000) + return 0; + } + return 1; +} + +Int DBG_is_U_monotone(directedLine* poly) +{ + Int n_changes = 0; + Int prev_sign; + Int cur_sign; + directedLine* temp; + cur_sign = compV2InX(poly->tail(), poly->head()); + + n_changes = (compV2InX(poly->getPrev()->tail(), poly->getPrev()->head()) + != cur_sign); + + for(temp = poly->getNext(); temp != poly; temp = temp->getNext()) + { + prev_sign = cur_sign; + cur_sign = compV2InX(temp->tail(), temp->head()); + + if(cur_sign != prev_sign) + n_changes++; + } + + if(n_changes ==2) return 1; + else return 0; +} + +/*if u-monotone, and there is a long horizontal edge*/ +Int DBG_is_U_direction(directedLine* poly) +{ +/* + if(! DBG_is_U_monotone(poly)) + return 0; +*/ + Int V_count = 0; + Int U_count = 0; + directedLine* temp; + if( fabs(poly->head()[0] - poly->tail()[0]) <= fabs(poly->head()[1]-poly->tail()[1])) + V_count += poly->get_npoints(); + else + U_count += poly->get_npoints(); + /* + else if(poly->head()[1] == poly->tail()[1]) + U_count += poly->get_npoints(); + */ + for(temp = poly->getNext(); temp != poly; temp = temp->getNext()) + { + if( fabs(temp->head()[0] - temp->tail()[0]) <= fabs(temp->head()[1]-temp->tail()[1])) + V_count += temp->get_npoints(); + else + U_count += temp->get_npoints(); + /* + if(temp->head()[0] == temp->tail()[0]) + V_count += temp->get_npoints(); + else if(temp->head()[1] == temp->tail()[1]) + U_count += temp->get_npoints(); + */ + } + + if(U_count > V_count) return 1; + else return 0; +} + +/*given two line segments, determine whether + *they intersect each other or not. + *return 1 if they do, + *return 0 otherwise + */ +Int DBG_edgesIntersect(directedLine* l1, directedLine* l2) +{ + if(l1->getNext() == l2) + { + if(area(l1->head(), l1->tail(), l2->tail()) == 0) //colinear + { + if( (l1->tail()[0] - l1->head()[0])*(l2->tail()[0]-l2->head()[0]) + + (l1->tail()[1] - l1->head()[1])*(l2->tail()[1]-l2->head()[1]) >=0) + return 0; //not intersect + else + return 1; + } + //else we use the normal code + } + else if(l1->getPrev() == l2) + { + if(area(l2->head(), l2->tail(), l1->tail()) == 0) //colinear + { + if( (l2->tail()[0] - l2->head()[0])*(l1->tail()[0]-l1->head()[0]) + + (l2->tail()[1] - l2->head()[1])*(l1->tail()[1]-l1->head()[1]) >=0) + return 0; //not intersect + else + return 1; + } + //else we use the normal code + } + else //the two edges are not connected + { + if((l1->head()[0] == l2->head()[0] && + l1->head()[1] == l2->head()[1]) || + (l1->tail()[0] == l2->tail()[0] && + l1->tail()[1] == l2->tail()[1])) + return 1; + + } + + + if( + ( + area(l1->head(), l1->tail(), l2->head()) + * + area(l1->head(), l1->tail(), l2->tail()) + < 0 + ) + && + ( + area(l2->head(), l2->tail(), l1->head()) + *area(l2->head(), l2->tail(), l1->tail()) + < 0 + ) + ) + return 1; + else + return 0; +} + +/*whether AB and CD intersect + *return 1 if they do + *retur 0 otheriwse + */ +Int DBG_edgesIntersectGen(Real A[2], Real B[2], Real C[2], Real D[2]) +{ + if( + ( + area(A, B, C) * area(A,B,D) <0 + ) + && + ( + area(C,D,A) * area(C,D,B) < 0 + ) + ) + return 1; + else + return 0; +} + +/*determien whether (A,B) interesect chain[start] to [end] + */ +Int DBG_intersectChain(vertexArray* chain, Int start, Int end, Real A[2], Real B[2]) +{ + Int i; + for(i=start; i<=end-2; i++) + if(DBG_edgesIntersectGen(chain->getVertex(i), chain->getVertex(i+1), A, B)) + return 1; + + return 0; +} + +/*determine whether a polygon intersect itself or not + *return 1 is it does, + * 0 otherwise + */ +Int DBG_polygonSelfIntersect(directedLine* poly) +{ + directedLine* temp1; + directedLine* temp2; + temp1=poly; + for(temp2=temp1->getNext(); temp2 != temp1; temp2=temp2->getNext()) + { + if(DBG_edgesIntersect(temp1, temp2)) + { + return 1; + } + + } + + for(temp1=poly->getNext(); temp1 != poly; temp1 = temp1->getNext()) + for(temp2=temp1->getNext(); temp2 != temp1; temp2=temp2->getNext()) + { + if(DBG_edgesIntersect(temp1, temp2)) + { + return 1; + } + } + return 0; +} + +/*check whether a line segment intersects a polygon + */ +Int DBG_edgeIntersectPoly(directedLine* edge, directedLine* poly) +{ + directedLine* temp; + if(DBG_edgesIntersect(edge, poly)) + return 1; + for(temp=poly->getNext(); temp != poly; temp=temp->getNext()) + if(DBG_edgesIntersect(edge, temp)) + return 1; + return 0; +} + +/*check whether two polygons intersect + */ +Int DBG_polygonsIntersect(directedLine* p1, directedLine* p2) +{ + directedLine* temp; + if(DBG_edgeIntersectPoly(p1, p2)) + return 1; + for(temp=p1->getNext(); temp!= p1; temp = temp->getNext()) + if(DBG_edgeIntersectPoly(temp, p2)) + return 1; + return 0; +} + +/*check whether there are polygons intersecting each other in + *a list of polygons + */ +Int DBG_polygonListIntersect(directedLine* pList) +{ + directedLine *temp; + for(temp=pList; temp != NULL; temp = temp->getNextPolygon()) + if(DBG_polygonSelfIntersect(temp)) + return 1; + directedLine* temp2; + for(temp=pList; temp!=NULL; temp=temp->getNextPolygon()) + { + for(temp2=temp->getNextPolygon(); temp2 != NULL; temp2=temp2->getNextPolygon()) + if(DBG_polygonsIntersect(temp, temp2)) + return 1; + } + + return 0; +} + + +Int DBG_isCounterclockwise(directedLine* poly) +{ + return (poly->polyArea() > 0); +} + +/*ray: v0 with direction (dx,dy). + *edge: v1-v2. + * the extra point v10[2] is given for the information at + *v1. Basically this edge is connectd to edge + * v10-v1. If v1 is on the ray, + * then we need v10 to determine whether this ray intersects + * the edge or not (that is, return 1 or return 0). + * If v1 is on the ray, then if v2 and v10 are on the same side of the ray, + * we return 0, otherwise return 1. + *For v2, if v2 is on the ray, we always return 0. + *Notice that v1 and v2 are not symmetric. So the edge is directed!!! + * The purpose for this convention is such that: a point is inside a polygon + * if and only if it intersets with odd number of edges. + */ +Int DBG_rayIntersectEdge(Real v0[2], Real dx, Real dy, Real v10[2], Real v1[2], Real v2[2]) +{ +/* +if( (v1[1] >= v0[1] && v2[1]<= v0[1] ) + ||(v2[1] >= v0[1] && v1[1]<= v0[1] ) + ) + printf("rayIntersectEdge, *********\n"); +*/ + + Real denom = (v2[0]-v1[0])*(-dy) - (v2[1]-v1[1]) * (-dx); + Real nomRay = (v2[0]-v1[0]) * (v0[1] - v1[1]) - (v2[1]-v1[1])*(v0[0]-v1[0]); + Real nomEdge = (v0[0]-v1[0]) * (-dy) - (v0[1]-v1[1])*(-dx); + + + /*if the ray is parallel to the edge, return 0: not intersect*/ + if(denom == 0.0) + return 0; + + /*if v0 is on the edge, return 0: not intersect*/ + if(nomRay == 0.0) + return 0; + + /*if v1 is on the positive ray, and the neighbor of v1 crosses the ray + *return 1: intersect + */ + if(nomEdge == 0) + { /*v1 is on the positive or negative ray*/ + +/* + printf("v1 is on the ray\n"); +*/ + + if(dx*(v1[0]-v0[0])>=0 && dy*(v1[1]-v0[1])>=0) /*v1 on positive ray*/ + { + if(area(v0, v1, v10) * area(v0, v1, v2) >0) + return 0; + else + return 1; + } + else /*v1 on negative ray*/ + return 0; + } + + /*if v2 is on the ray, always return 0: not intersect*/ + if(nomEdge == denom) { +/* printf("v2 is on the ray\n");*/ + return 0; + } + + /*finally */ + if(denom*nomRay>0 && denom*nomEdge>0 && nomEdge/denom <=1.0) + return 1; + return 0; +} + + +/*return the number of intersections*/ +Int DBG_rayIntersectPoly(Real v0[2], Real dx, Real dy, directedLine* poly) +{ + directedLine* temp; + Int count=0; + if(DBG_rayIntersectEdge(v0, dx, dy, poly->getPrev()->head(), poly->head(), poly->tail())) + count++; + + for(temp=poly->getNext(); temp != poly; temp = temp->getNext()) + if(DBG_rayIntersectEdge(v0, dx, dy, temp->getPrev()->head(), temp->head(), temp->tail())) + count++; +/*printf("ray intersect poly: count=%i\n", count);*/ + return count; +} + +Int DBG_pointInsidePoly(Real v[2], directedLine* poly) +{ +/* +printf("enter pointInsidePoly , v=(%f,%f)\n", v[0], v[1]); +printf("the polygon is\n"); +poly->printList(); +*/ + /*for debug purpose*/ + assert( (DBG_rayIntersectPoly(v,1,0,poly) % 2 ) + == (DBG_rayIntersectPoly(v,1,Real(0.1234), poly) % 2 ) + ); + if(DBG_rayIntersectPoly(v, 1, 0, poly) % 2 == 1) + return 1; + else + return 0; +} + +/*return the number of polygons which contain thie polygon + * as a subset + */ +Int DBG_enclosingPolygons(directedLine* poly, directedLine* list) +{ + directedLine* temp; + Int count=0; +/* +printf("%i\n", DBG_pointInsidePoly(poly->head(), + list->getNextPolygon() + ->getNextPolygon() + ->getNextPolygon() + ->getNextPolygon() +)); +*/ + + for(temp = list; temp != NULL; temp = temp->getNextPolygon()) + { + if(poly != temp) + if(DBG_pointInsidePoly(poly->head(), temp)) + count++; +/* printf("count=%i\n", count);*/ + } + return count; +} + +void DBG_reverse(directedLine* poly) +{ + if(poly->getDirection() == INCREASING) + poly->putDirection(DECREASING); + else + poly->putDirection(INCREASING); + + directedLine* oldNext = poly->getNext(); + poly->putNext(poly->getPrev()); + poly->putPrev(oldNext); + + directedLine* temp; + for(temp=oldNext; temp!=poly; temp = oldNext) + { + if(temp->getDirection() == INCREASING) + temp->putDirection(DECREASING); + else + temp->putDirection(INCREASING); + + oldNext = temp->getNext(); + temp->putNext(temp->getPrev()); + temp->putPrev(oldNext); + } + printf("reverse done\n"); +} + +Int DBG_checkConnectivity(directedLine *polygon) +{ + if(polygon == NULL) return 1; + directedLine* temp; + if(polygon->head()[0] != polygon->getPrev()->tail()[0] || + polygon->head()[1] != polygon->getPrev()->tail()[1]) + return 0; + for(temp=polygon->getNext(); temp != polygon; temp=temp->getNext()) + { + if(temp->head()[0] != temp->getPrev()->tail()[0] || + temp->head()[1] != temp->getPrev()->tail()[1]) + return 0; + } + return 1; +} + +/*print out error message. + *If it cannot modify the polygon list to make it satify the + *requirements, return 1. + *otherwise modify the polygon list, and return 0 + */ +Int DBG_check(directedLine *polyList) +{ + directedLine* temp; + if(polyList == NULL) return 0; + + /*if there are intersections, print out error message + */ + if(DBG_polygonListIntersect(polyList)) + { + fprintf(stderr, "DBG_check: there are self intersections, don't know to modify the polygons\n"); + return 1; + } + + /*check the connectivity of each polygon*/ + for(temp = polyList; temp!= NULL; temp = temp ->getNextPolygon()) + { + if(! DBG_checkConnectivity(temp)) + { + fprintf(stderr, "DBG_check, polygon not connected\n"); + return 1; + } + } + + /*check the orientation of each polygon*/ + for(temp = polyList; temp!= NULL; temp = temp ->getNextPolygon()) + { + + + Int correctDir; + + if( DBG_enclosingPolygons(temp, polyList) % 2 == 0) + correctDir = 1; /*counterclockwise*/ + else + correctDir = 0; /*clockwise*/ + + Int actualDir = DBG_isCounterclockwise(temp); + + if(correctDir != actualDir) + { + fprintf(stderr, "DBG_check: polygon with incorrect orientations. reversed\n"); + + DBG_reverse(temp); + } + + } + return 0; +} + +/**************handle self intersections*****************/ +//determine whether e interects [begin, end] or not +static directedLine* DBG_edgeIntersectChainD(directedLine *e, + directedLine *begin, directedLine *end) +{ + directedLine *temp; + for(temp=begin; temp != end; temp = temp->getNext()) + { + if(DBG_edgesIntersect(e, temp)) + return temp; + } + if(DBG_edgesIntersect(e, end)) + return end; + return NULL; +} + +//given a polygon, cut the edges off and finally obtain a +//a polygon without intersections. The cut-off edges are +//dealloated. The new polygon is returned. +directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur) +{ + directedLine *begin, *end, *next; + begin = polygon; + end = polygon; + cutOccur = 0; + while( (next = end->getNext()) != begin) + { + directedLine *interc = NULL; + if( (interc = DBG_edgeIntersectChainD(next, begin, end))) + { + int fixed = 0; + if(DBG_edgesIntersect(next, interc->getNext())) + { + //trying to fix it + Real buf[2]; + int i; + Int n=5; + buf[0] = interc->tail()[0]; + buf[1] = interc->tail()[1]; + + for(i=1; ihead()[0] + r * interc->tail()[0]; + Real v = (1-r) * interc->head()[1] + r * interc->tail()[1]; + interc->tail()[0] = interc->getNext()->head()[0] = u; + interc->tail()[1] = interc->getNext()->head()[1] = v; + if( (! DBG_edgesIntersect(next, interc)) && + (! DBG_edgesIntersect(next, interc->getNext()))) + break; //we fixed it + } + if(i==n) // we didn't fix it + { + fixed = 0; + //back to original + interc->tail()[0] = interc->getNext()->head()[0] = buf[0]; + interc->tail()[1] = interc->getNext()->head()[1] = buf[1]; + } + else + { + fixed = 1; + } + } + if(fixed == 0) + { + cutOccur = 1; + begin->deleteSingleLine(next); + + if(begin != end) + { + if(DBG_polygonSelfIntersect(begin)) + { + directedLine* newEnd = end->getPrev(); + begin->deleteSingleLine(end); + end = newEnd; + } + } + } + else + { + end = end->getNext(); + } + } + else + { + end = end->getNext(); + } + } + return begin; +} + +//given a polygon, cut the edges off and finally obtain a +//a polygon without intersections. The cut-off edges are +//dealloated. The new polygon is returned. +#if 0 // UNUSED +static directedLine* DBG_cutIntersectionPoly_notwork(directedLine *polygon) +{ + directedLine *crt;//current polygon + directedLine *begin; + directedLine *end; + directedLine *temp; + crt = polygon; + int find=0; + while(1) + { +//printf("loop\n"); + //if there are less than 3 edges, we should stop + if(crt->getPrev()->getPrev() == crt) + return NULL; + + if(DBG_edgesIntersect(crt, crt->getNext()) || + (crt->head()[0] == crt->getNext()->tail()[0] && + crt->head()[1] == crt->getNext()->tail()[1]) + ) + { + find = 1; + crt=crt->deleteChain(crt, crt->getNext()); + } + else + { + //now we know crt and crt->getNext do not intersect + begin = crt; + end = crt->getNext(); +//printf("begin=(%f,%f)\n", begin->head()[0], begin->head()[1]); +//printf("end=(%f,%f)\n", end->head()[0], end->head()[1]); + for(temp=end->getNext(); temp!=begin; temp= temp->getNext()) + { +//printf("temp=(%f,%f)\n", temp->head()[0], temp->head()[1]); + directedLine *intersect = DBG_edgeIntersectChainD(temp, begin, end); + if(intersect != NULL) + { + crt = crt->deleteChain(intersect, temp); + find=1; + break; //the for loop + } + else + { + end = temp; + } + } + } + if(find == 0) + return crt; + else + find = 0; //go to next loop +} +} +#endif + +directedLine* DBG_cutIntersectionAllPoly(directedLine* list) +{ + directedLine* temp; + directedLine* tempNext=NULL; + directedLine* ret = NULL; + int cutOccur=0; + for(temp=list; temp != NULL; temp = tempNext) + { + directedLine *left; + tempNext = temp->getNextPolygon(); + + left = DBG_cutIntersectionPoly(temp, cutOccur); + if(left != NULL) + ret=left->insertPolygon(ret); + } + return ret; +} + +sampledLine* DBG_collectSampledLinesAllPoly(directedLine *polygonList) +{ + directedLine *temp; + sampledLine* tempHead = NULL; + sampledLine* tempTail = NULL; + sampledLine* cHead = NULL; + sampledLine* cTail = NULL; + + if(polygonList == NULL) + return NULL; + + DBG_collectSampledLinesPoly(polygonList, cHead, cTail); + + assert(cHead); + assert(cTail); + for(temp = polygonList->getNextPolygon(); temp != NULL; temp = temp->getNextPolygon()) + { + DBG_collectSampledLinesPoly(temp, tempHead, tempTail); + cTail->insert(tempHead); + cTail = tempTail; + } + return cHead; +} + +void DBG_collectSampledLinesPoly(directedLine *polygon, sampledLine*& retHead, sampledLine*& retTail) +{ + directedLine *temp; + retHead = NULL; + retTail = NULL; + if(polygon == NULL) + return; + + retHead = retTail = polygon->getSampledLine(); + for(temp = polygon->getNext(); temp != polygon; temp=temp->getNext()) + { + retHead = temp->getSampledLine()->insert(retHead); + } +} diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.h new file mode 100644 index 000000000..74843d888 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/polyDBG.h @@ -0,0 +1,68 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _POLYDBG_H +#define _POLYDBG_H + +#include "definitions.h" +#include "directedLine.h" +#include "monoTriangulation.h" + +Int DBG_edgesIntersectGen(Real A[2], Real B[2], Real C[2], Real D[2]); +Int DBG_intersectChain(vertexArray* chain, Int start, Int end, Real A[2], Real B[2]); + + +Int DBG_edgesIntersect(directedLine* l1, directedLine* l2); +Int DBG_polygonSelfIntersect(directedLine* poly); +Int DBG_edgeIntersectPoly(directedLine* edge, directedLine* poly); +Int DBG_polygonsIntersect(directedLine* p1, directedLine* p2); +Int DBG_polygonListIntersect(directedLine* pList); + +Int DBG_isCounterclockwise(directedLine* poly); +Int DBG_rayIntersectEdge(Real v0[2], Real dx, Real dy, Real v10[2], Real v1[2], Real v2[2]); +Int DBG_pointInsidePoly(Real v[2], directedLine* poly); +Int DBG_enclosingPolygons(directedLine* poly, directedLine* list); +void DBG_reverse(directedLine* poly); +Int DBG_check(directedLine *polyList); + +Int DBG_isConvex(directedLine *poly); +Int DBG_is_U_direction(directedLine *poly); +Int DBG_is_U_monotone(directedLine* poly); + +directedLine* DBG_cutIntersectionAllPoly(directedLine* list); +directedLine* DBG_cutIntersectionPoly(directedLine *polygon, int& cutOccur); + +sampledLine* DBG_collectSampledLinesAllPoly(directedLine *polygonList); + +void DBG_collectSampledLinesPoly(directedLine *polygon, sampledLine*& retHead, sampledLine*& retTail); + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.cc new file mode 100644 index 000000000..f9a27f402 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.cc @@ -0,0 +1,90 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include + +#include "polyUtil.h" + +Real area(Real A[2], Real B[2], Real C[2]) +{ + Real Bx, By, Cx, Cy; + Bx = B[0] - A[0]; + By = B[1] - A[1]; + Cx = C[0] - A[0]; + Cy = C[1] - A[1]; + return Bx*Cy - Cx*By; + +/* return (B[0]-A[0])*(C[1]-A[1]) - (C[0]-A[0])*(B[1]-A[1]);*/ +} + +/*given a directed line A->B, and a point P, + *determine whether P is to the left of AB. + *the line A->B (imagine it has beedn extended both + *end to the infinity) divides the plan into two + *half planes. When we walk from A to B, one + *half is to the left and the other half is to the right. + *return 1 if P is to the left. + *if P is on AB, 0 is returned. + */ +Int pointLeftLine(Real A[2], Real B[2], Real P[2]) +{ + if(area(A, B, P) >0) return 1; + else return 0; +} + +/*given two directed line: A -> B -> C, and another point P. + *determine whether P is to the left hand side of A->B->C. + *Think of BA and BC extended as two rays. So that the plane is + * divided into two parts. One part is to the left we walk from A + *to B and to C, the other part is to the right. + * In order for P to be the left, P must be either to the left + *of + */ +Int pointLeft2Lines(Real A[2], Real B[2], Real C[2], Real P[2]) +{ + Int C_left_AB = (area(A, B, C)>0); + Int P_left_AB = (area(A, B, P)>0); + Int P_left_BC = (area(B, C, P)>0); + + if(C_left_AB) + { + return (P_left_AB && P_left_BC); + } + else + return (P_left_AB || P_left_BC); +} diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.h new file mode 100644 index 000000000..1ca2ebcc0 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/polyUtil.h @@ -0,0 +1,47 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _POLYUTIL_H +#define _POLYUTIL_H + +#include "definitions.h" +#ifdef __cplusplus +extern "C" { +#endif +Real area(Real A[2], Real B[2], Real C[2]); + +Int pointLeftLine(Real A[2], Real B[2], Real P[2]); +Int pointLeft2Lines(Real A[2], Real B[2], Real C[2], Real P[2]); +#ifdef __cplusplus +} +#endif +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc new file mode 100644 index 000000000..26d05342f --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/primitiveStream.cc @@ -0,0 +1,190 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include +#include +#include +#include + +#include "primitiveStream.h" + +Int primStream::num_triangles() +{ + Int i; + Int ret=0; + for(i=0; i= size_vertices) { + Real* temp = (Real*) malloc (sizeof(Real) * (2*size_vertices + 2)); + assert(temp); + + /*copy*/ + for(Int i=0; i= size_lengths){ + Int* temp = (Int*) malloc(sizeof(Int) * (2*size_lengths + 2)); + assert(temp); + Int* tempTypes = (Int*) malloc(sizeof(Int) * (2*size_lengths + 2)); + assert(tempTypes); + + /*copy*/ + for(i=0; i + */ + +#ifndef _PRIMITIVE_STREAM_H +#define _PRIMITIVE_STREAM_H + +enum {PRIMITIVE_STREAM_FAN, PRIMITIVE_STREAM_STRIP}; + +#include "definitions.h" + +class primStream { + Int *lengths; /*length[i]=number of vertices of ith primitive*/ + Int *types; /*each primive has a type: FAN or STREAM*/ + Real *vertices; /*the size >= 2 * num_vertices, each vertex (u,v)*/ + + /*the following size information are used for dynamic arrays*/ + Int index_lengths; /*the current available entry*/ + Int size_lengths; /*the allocated size of the array: lengths*/ + Int index_vertices; + Int size_vertices; + + /*the vertex is inserted one by one. counter is used to + *count the number of vertices which have been inserted so far in + *the current primitive + */ + Int counter; + +public: + primStream(Int sizeLengths, Int sizeVertices); + ~primStream(); + + Int get_n_prims() //num of primitives + { + return index_lengths; + } + Int get_type(Int i) //the type of ith primitive + { + return types[i]; + } + Int get_length(Int i) //the length of the ith primitive + { + return lengths[i]; + } + Real* get_vertices() {return vertices;} + + /*the begining of inserting a new primitive. + *reset counter to be 0. + */ + void begin(); + void insert(Real u, Real v); + void insert(Real v[2]) {insert(v[0], v[1]);} + void end(Int type); + + Int num_triangles(); + + void triangle(Real A[2], Real B[2], Real C[2]) + { + begin(); + insert(A); + insert(B); + insert(C); + end(PRIMITIVE_STREAM_FAN); + } + void print(); + void draw(); /*using GL to draw the primitives*/ +}; + + + + + + + + +#endif + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.cc new file mode 100644 index 000000000..9d0b290b3 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.cc @@ -0,0 +1,77 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include + + +static void swap(void *v[], int i, int j) +{ + void *temp; + temp = v[i]; + v[i] = v[j]; + v[j] = temp; +} + +/*as an example to use this function to + *sort integers, you need to supply the function + *int comp(int *i1, int *i2) + *{ + * if( *i1 < * i2) return -1; + * else return 1; + *} + *and an array of pointers to integers: + * int *v[100] (allocate space for where each v[i] points to). + *then you can call: + * quicksort( (void**)v, left, right, (int (*)(void *, void *))comp) + */ +void quicksort(void *v[], int left, int right, + int (*comp) (void *, void *)) +{ + int i, last; + if(left >= right) /*do nothing if array contains */ + return; /*fewer than two elements*/ + + swap(v, left, (left+right)/2); + last = left; + for(i=left+1; i<=right; i++) + if((*comp)(v[i], v[left])<0) + swap(v, ++last, i); + swap(v, left, last); + quicksort(v, left, last-1, comp); + quicksort(v, last+1, right, comp); +} diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.h new file mode 100644 index 000000000..3a8dcd6a2 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/quicksort.h @@ -0,0 +1,42 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _QUICKSORT_H +#define _QUICKSORT_H + +#include +#include + +void quicksort(void *v[], int left, int right, + int (*comp) (void *, void *)); + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.cc new file mode 100644 index 000000000..f457b1573 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.cc @@ -0,0 +1,196 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include +#include +#include "glimports.h" +#include "zlassert.h" +#include + +#include "rectBlock.h" + +rectBlock::rectBlock(gridBoundaryChain* left, gridBoundaryChain* right, Int beginVline, Int endVline) +{ + Int i; + + + upGridLineIndex = left->getVlineIndex(beginVline); + + lowGridLineIndex = left->getVlineIndex(endVline); + + Int n = upGridLineIndex-lowGridLineIndex+1; //number of grid lines + leftIndices = (Int*) malloc(sizeof(Int) * n); + assert(leftIndices); + rightIndices = (Int*) malloc(sizeof(Int) * n); + assert(rightIndices); + for(i=0; igetInnerIndex(i+beginVline); + rightIndices[i] = right->getInnerIndex(i+beginVline); + } +} + + +rectBlock::~rectBlock() +{ + free(leftIndices); + free(rightIndices); +} + +void rectBlock::print() +{ + Int i; + printf("block:\n"); + for(i=upGridLineIndex; i >= lowGridLineIndex; i--) + { + printf("gridline %i, (%i,%i)\n", i, leftIndices[upGridLineIndex-i], rightIndices[upGridLineIndex-i]); + } +} + + + +void rectBlock::draw(Real* u_values, Real* v_values) +{ + Int i,j,k; + //upgrid line to bot grid line +#ifdef DEBUG +printf("upGridLineIndex=%i, lowGridLineIndex=%i\n", upGridLineIndex, lowGridLineIndex); +#endif + for(k=0, i=upGridLineIndex; i > lowGridLineIndex; i--, k++) + { + glBegin(GL_QUAD_STRIP); + + for(j=leftIndices[k+1]; j<= rightIndices[k+1]; j++) + { + glVertex2f(u_values[j], v_values[i]); + glVertex2f(u_values[j], v_values[i-1]); + } + glEnd(); + } +} + + +Int rectBlock::num_quads() +{ + Int ret=0; + Int k,i; + for(k=0, i=upGridLineIndex; i>lowGridLineIndex; i--, k++) + { + ret += (rightIndices[k+1]-leftIndices[k+1]); + } + return ret; +} + +Int rectBlockArray::num_quads() +{ + Int ret=0; + for(Int i=0; inum_quads(); + return ret; +} + +rectBlockArray::rectBlockArray(Int s) +{ + Int i; + n_elements = 0; + size = s; + array = (rectBlock**) malloc(sizeof(rectBlock*) * s); + assert(array); +//initialization + for(i=0; iprint(); +} + +void rectBlockArray::draw(Real* u_values, Real* v_values) +{ + Int i; + for(i=0; idraw(u_values, v_values); +} + + + + + + + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.h new file mode 100644 index 000000000..8dbd7eb81 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/rectBlock.h @@ -0,0 +1,82 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _RECTBLOCK_H +#define _RECTBLOCK_H + +#include "definitions.h" +#include "gridWrap.h" + +class rectBlock{ + Int upGridLineIndex; + Int lowGridLineIndex; + Int* leftIndices; //up to bottome + Int* rightIndices; //up to bottom +public: + //the arrays are copies. + rectBlock(gridBoundaryChain* left, gridBoundaryChain* right, Int beginVline, Int endVline); + ~rectBlock(); //free the two arrays + + Int get_upGridLineIndex() {return upGridLineIndex;} + Int get_lowGridLineIndex() {return lowGridLineIndex;} + Int* get_leftIndices() {return leftIndices;} + Int* get_rightIndices() {return rightIndices;} + + Int num_quads(); + + void print(); + void draw(Real* u_values, Real* v_values); +}; + + +class rectBlockArray{ + rectBlock** array; + Int n_elements; + Int size; +public: + rectBlockArray(Int s); + ~rectBlockArray();//delete avarything including the blocks + + Int get_n_elements() {return n_elements;} + rectBlock* get_element(Int i) {return array[i];} + void insert(rectBlock* newBlock); //only take the pointer, not ther cotent + + Int num_quads(); + + void print(); + void draw(Real* u_values, Real* v_values); +}; + + + +#endif + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleComp.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleComp.cc new file mode 100644 index 000000000..861c71bb3 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleComp.cc @@ -0,0 +1,371 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include "glimports.h" +#include "sampleComp.h" +#include "sampleCompTop.h" +#include "sampleCompBot.h" +#include "sampleCompRight.h" + + + +#define max(a,b) ((a>b)? a:b) +#define min(a,b) ((a>b)? b:a) + +void sampleConnectedComp(Real* topVertex, Real* botVertex, + vertexArray* leftChain, + Int leftStartIndex, Int leftEndIndex, + vertexArray* rightChain, + Int rightStartIndex, Int rightEndIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex1, Int gridIndex2, + Int up_leftCornerWhere, + Int up_leftCornerIndex, + Int up_rightCornerWhere, + Int up_rightCornerIndex, + Int down_leftCornerWhere, + Int down_leftCornerIndex, + Int down_rightCornerWhere, + Int down_rightCornerIndex, + primStream* pStream, + rectBlockArray* rbArray + ) +{ + + sampleCompLeft(topVertex, botVertex, + leftChain, + leftStartIndex, leftEndIndex, + rightChain, + rightStartIndex, rightEndIndex, + leftGridChain, + gridIndex1, + gridIndex2, + up_leftCornerWhere, + up_leftCornerIndex, + down_leftCornerWhere, + down_leftCornerIndex, + pStream); + + + sampleCompRight(topVertex, botVertex, + leftChain, + leftStartIndex, leftEndIndex, + rightChain, + rightStartIndex, + rightEndIndex, + rightGridChain, + gridIndex1, gridIndex2, + up_rightCornerWhere, + up_rightCornerIndex, + down_rightCornerWhere, + down_rightCornerIndex, + pStream); + + + sampleCompTop(topVertex, + leftChain, + leftStartIndex, + rightChain, + rightStartIndex, + leftGridChain, + rightGridChain, + gridIndex1, + up_leftCornerWhere, + up_leftCornerIndex, + up_rightCornerWhere, + up_rightCornerIndex, + pStream); + + sampleCompBot(botVertex, + leftChain, + leftEndIndex, + rightChain, + rightEndIndex, + leftGridChain, + rightGridChain, + gridIndex2, + down_leftCornerWhere, + down_leftCornerIndex, + down_rightCornerWhere, + down_rightCornerIndex, + pStream); + + + //the center + + rbArray->insert(new rectBlock(leftGridChain, rightGridChain, gridIndex1, gridIndex2)); + + +} + +/*notice that we need rightChain because the + *corners could be on the rightChain. + *here comp means component. + */ +void sampleCompLeft(Real* topVertex, Real* botVertex, + vertexArray* leftChain, + Int leftStartIndex, Int leftEndIndex, + vertexArray* rightChain, + Int rightStartIndex, Int rightEndIndex, + gridBoundaryChain* leftGridChain, + Int gridIndex1, Int gridIndex2, + Int up_leftCornerWhere, + Int up_leftCornerIndex, + Int down_leftCornerWhere, + Int down_leftCornerIndex, + primStream* pStream) +{ + /*find out whether there is a trim vertex which is + *inbetween the top and bot grid lines or not. + */ + Int midIndex1; + Int midIndex2; + Int gridMidIndex1 = 0, gridMidIndex2 = 0; + //midIndex1: array[i] <= v, array[i-1] > v + //midIndex2: array[i] >= v, array[i+1] < v + // v(gridMidIndex1) >= v(midindex1) > v(gridMidIndex1+1) + // v(gridMidIndex2-1) >= v(midIndex2) > v(gridMidIndex2) ?? + midIndex1 = leftChain->findIndexBelowGen( + leftGridChain->get_v_value(gridIndex1), + leftStartIndex, + leftEndIndex); + + midIndex2 = -1; /*initilization*/ + if(midIndex1<= leftEndIndex && gridIndex1getVertex(midIndex1)[1] >= leftGridChain->get_v_value(gridIndex2)) + { + midIndex2 = leftChain->findIndexAboveGen( + leftGridChain->get_v_value(gridIndex2), + midIndex1, //midIndex1 <= midIndex2. + leftEndIndex); + gridMidIndex1 = leftGridChain->lookfor(leftChain->getVertex(midIndex1)[1], + gridIndex1, gridIndex2); + gridMidIndex2 = 1+leftGridChain->lookfor(leftChain->getVertex(midIndex2)[1], + gridMidIndex1, gridIndex2); + } + + + /*to interprete the corner information*/ + Real* cornerTop; + Real* cornerBot; + Int cornerLeftStart; + Int cornerLeftEnd; + Int cornerRightUpEnd; + Int cornerRightDownStart; + if(up_leftCornerWhere == 0) /*left corner is on left chain*/ + { + cornerTop = leftChain->getVertex(up_leftCornerIndex); + cornerLeftStart = up_leftCornerIndex+1; + cornerRightUpEnd = -1; /*no right*/ + } + else if(up_leftCornerWhere == 1) /*left corner is on top*/ + { + cornerTop = topVertex; + cornerLeftStart = leftStartIndex; + cornerRightUpEnd = -1; /*no right*/ + } + else /*left corner is on right chain*/ + { + cornerTop = topVertex; + cornerLeftStart = leftStartIndex; + cornerRightUpEnd = up_leftCornerIndex; + } + + if(down_leftCornerWhere == 0) /*left corner is on left chain*/ + { + cornerBot = leftChain->getVertex(down_leftCornerIndex); + cornerLeftEnd = down_leftCornerIndex-1; + cornerRightDownStart = rightEndIndex+1; /*no right*/ + } + else if(down_leftCornerWhere == 1) /*left corner is on bot*/ + { + cornerBot = botVertex; + cornerLeftEnd = leftEndIndex; + cornerRightDownStart = rightEndIndex+1; /*no right*/ + } + else /*left corner is on the right chian*/ + { + cornerBot = botVertex; + cornerLeftEnd = leftEndIndex; + cornerRightDownStart = down_leftCornerIndex; + } + + + + + /*sample*/ + if(midIndex2 >= 0) /*there is a trim point inbewteen grid lines*/ + { + + sampleLeftSingleTrimEdgeRegionGen(cornerTop, leftChain->getVertex(midIndex1), + leftChain, + cornerLeftStart, + midIndex1-1, + leftGridChain, + gridIndex1, + gridMidIndex1, + rightChain, + rightStartIndex, + cornerRightUpEnd, + 0, //no right down section + -1, + pStream); + + sampleLeftSingleTrimEdgeRegionGen(leftChain->getVertex(midIndex2), + cornerBot, + leftChain, + midIndex2+1, + cornerLeftEnd, + leftGridChain, + gridMidIndex2, + gridIndex2, + rightChain, + 0, //no right up section + -1, + cornerRightDownStart, + rightEndIndex, + pStream); + + + sampleLeftStripRecF(leftChain, + midIndex1, + midIndex2, + leftGridChain, + gridMidIndex1, + gridMidIndex2, + pStream); + } + else + { + sampleLeftSingleTrimEdgeRegionGen(cornerTop, cornerBot, + leftChain, + cornerLeftStart, + cornerLeftEnd, + leftGridChain, + gridIndex1, + gridIndex2, + rightChain, + rightStartIndex, + cornerRightUpEnd, + cornerRightDownStart, + rightEndIndex, + pStream); + } +} + +void sampleLeftSingleTrimEdgeRegionGen(Real topVert[2], Real botVert[2], + vertexArray* leftChain, + Int leftStart, + Int leftEnd, + gridBoundaryChain* gridChain, + Int gridBeginIndex, + Int gridEndIndex, + vertexArray* rightChain, + Int rightUpBegin, + Int rightUpEnd, + Int rightDownBegin, + Int rightDownEnd, + primStream* pStream) +{ + Int i,j,k; + + /*creat an array to store all the up and down secments of the right chain, + *and the left end grid points + * + *although vertex array is a dynamic array, but to gain efficiency, + *it is better to initiliza the exact array size + */ + vertexArray vArray(gridEndIndex-gridBeginIndex+1 + + max(0,rightUpEnd - rightUpBegin+1)+ + max(0,rightDownEnd - rightDownBegin+1)); + + /*append the vertices on the up section of thr right chain*/ + for(i=rightUpBegin; i<= rightUpEnd; i++) + vArray.appendVertex(rightChain->getVertex(i)); + + /*append the vertices of the left extremal grid points, + *and at the same time, perform triangulation for the stair cases + */ + vArray.appendVertex(gridChain->get_vertex(gridBeginIndex)); + + for(k=1, i=gridBeginIndex+1; i<=gridEndIndex; i++, k++) + { + vArray.appendVertex(gridChain->get_vertex(i)); + + /*output the fan of the grid points of the (i)th and (i-1)th grid line. + */ + if(gridChain->getUlineIndex(i) < gridChain->getUlineIndex(i-1)) + { + pStream->begin(); + pStream->insert(gridChain->get_vertex(i-1)); + for(j=gridChain->getUlineIndex(i); j<= gridChain->getUlineIndex(i-1); j++) + pStream->insert(gridChain->getGrid()->get_u_value(j), gridChain->get_v_value(i)); + pStream->end(PRIMITIVE_STREAM_FAN); + } + else if(gridChain->getUlineIndex(i) > gridChain->getUlineIndex(i-1)) + { + pStream->begin(); + pStream->insert(gridChain->get_vertex(i)); + for(j=gridChain->getUlineIndex(i); j>= gridChain->getUlineIndex(i-1); j--) + pStream->insert(gridChain->getGrid()->get_u_value(j), gridChain->get_v_value(i-1)); + pStream->end(PRIMITIVE_STREAM_FAN); + } + /*otherwisem, the two are equal, so there is no fan to outout*/ + } + + /*then append all the vertices on the down section of the right chain*/ + for(i=rightDownBegin; i<= rightDownEnd; i++) + vArray.appendVertex(rightChain->getVertex(i)); + + monoTriangulationRecGen(topVert, botVert, + leftChain, leftStart, leftEnd, + &vArray, 0, vArray.getNumElements()-1, + pStream); + +} + + + + + + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleComp.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleComp.h new file mode 100644 index 000000000..a3c179025 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleComp.h @@ -0,0 +1,86 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _SAMPLECOMP_H +#define _SAMPLECOMP_H + +#include "sampleMonoPoly.h" +#include "rectBlock.h" + +void sampleConnectedComp(Real* topVertex, Real* botVertex, + vertexArray* leftChain, + Int leftStartIndex, Int botLeftIndex, + vertexArray* rightChain, + Int rightStartIndex, Int botRightIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex1, Int gridIndex2, + Int up_leftCornerWhere, + Int up_leftCornerIndex, + Int up_rightCornerWhere, + Int up_rightCornerIndex, + Int down_leftCornerWhere, + Int down_leftCornerIndex, + Int down_rightCornerWhere, + Int down_rightCornerIndex, + primStream* pStream, + rectBlockArray* rbArray + ); + +void sampleCompLeft(Real* topVertex, Real* botVertex, + vertexArray* leftChain, + Int leftStartIndex, Int leftEndIndex, + vertexArray* rightChain, + Int rightStartIndex, Int rightEndIndex, + gridBoundaryChain* leftGridChain, + Int gridIndex1, Int gridIndex2, + Int up_leftCornerWhere, + Int up_leftCornerIndex, + Int down_leftCornerWhere, + Int down_leftCornerIndex, + primStream* pStream); + +void sampleLeftSingleTrimEdgeRegionGen(Real topVert[2], Real botVert[2], + vertexArray* leftChain, + Int leftStart, + Int leftEnd, + gridBoundaryChain* gridChain, + Int gridBegindex, + Int gridEndIndex, + vertexArray* rightChain, + Int rightUpBegin, + Int rightUpEnd, + Int rightDownBegin, + Int rightDownEnd, + primStream* pStream); + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc new file mode 100644 index 000000000..e12f88bab --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.cc @@ -0,0 +1,844 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include "zlassert.h" +#include "sampleCompBot.h" +#include "sampleCompRight.h" + +#define max(a,b) ((a>b)? a:b) + +//return: index_mono, index_pass +//from [pass, mono] is strictly U-monotone +//from [corner, pass] is = u +//if everybost is getVertex(i)[0] >= u) + break; + ret_index_pass = i; + if(ret_index_pass <= leftEnd) + { + for(i=ret_index_pass; i< leftEnd; i++) + { + if(leftChain->getVertex(i+1)[0] <= leftChain->getVertex(i)[0]) + break; + } + ret_index_mono = i; + } + +} + +void findBotRightSegment(vertexArray* rightChain, + Int rightEnd, + Int rightCorner, + Real u, + Int& ret_index_mono, + Int& ret_index_pass) +{ + Int i; + assert(rightCorner <= rightEnd); + for(i=rightCorner; i<= rightEnd; i++) + if(rightChain->getVertex(i)[0] <= u) + break; + + + + ret_index_pass = i; + + if(ret_index_pass <= rightEnd) + { + for(i=ret_index_pass; i< rightEnd; i++) + { + if(rightChain->getVertex(i+1)[0] >= rightChain->getVertex(i)[0]) + break; + } + ret_index_mono = i; + } +} + + +void sampleBotRightWithGridLinePost(Real* botVertex, + vertexArray* rightChain, + Int rightEnd, + Int segIndexMono, + Int segIndexPass, + Int rightCorner, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream) +{ + //the possible section which is to the right of rightU + if(segIndexPass > rightCorner) //from corner to pass-1 is > u. + { + Real *tempBot; + if(segIndexPass <= rightEnd) //there is a point to the left of u + tempBot = rightChain->getVertex(segIndexPass); + else //nothing is to the left of u. + tempBot = botVertex; + Real tempTop[2]; + tempTop[0] = grid->get_u_value(rightU); + tempTop[1] = grid->get_v_value(gridV); + + monoTriangulation2(tempTop, tempBot, + rightChain, + rightCorner, + segIndexPass-1, + 0, // a decrease chain + pStream); + } + + //the possible section which is strictly Umonotone + if(segIndexPass <= rightEnd) //segIndex pass and mono exist + { + //if there are grid points which are to the left of botVertex + //then we should use botVertex to form a fan with these points to + //optimize the triangulation + int do_optimize = 1; + if(botVertex[0] <= grid->get_u_value(leftU)) + do_optimize = 0; + else + { + //we also have to make sure that botVertex is the left most vertex on the chain + int i; + for(i=segIndexMono; i<=rightEnd; i++) + if(rightChain->getVertex(i)[0] <= botVertex[0]) + { + do_optimize = 0; + break; + } + } + + if(do_optimize) + { + //find midU so that grid->get_u_value(midU) <= botVertex[0] + //and grid->get_u_value(midU) > botVertex[0] + int midU = leftU; + while(grid->get_u_value(midU) <= botVertex[0]) + { + midU++; + if(midU > rightU) + break; + } + midU--; + + grid->outputFanWithPoint(gridV, leftU, midU, botVertex, pStream); + stripOfFanRight(rightChain, segIndexMono, segIndexPass, grid, gridV, midU, rightU, pStream, 1); + Real tempTop[2]; + tempTop[0] = grid->get_u_value(midU); + tempTop[1] = grid->get_v_value(gridV); + monoTriangulation2(tempTop, botVertex, rightChain, segIndexMono, rightEnd, 0, pStream); + } + else //not optimize + { + stripOfFanRight(rightChain, segIndexMono, segIndexPass, grid, gridV, leftU, rightU, pStream, 1); + Real tempTop[2]; + tempTop[0] = grid->get_u_value(leftU); + tempTop[1] = grid->get_v_value(gridV); + monoTriangulation2(tempTop, botVertex, rightChain, segIndexMono, rightEnd, 0, pStream); + } + } + else //the botVertex forms a fan witht eh grid points + grid->outputFanWithPoint(gridV, leftU, rightU, botVertex, pStream); +} + +void sampleBotRightWithGridLine(Real* botVertex, + vertexArray* rightChain, + Int rightEnd, + Int rightCorner, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream) +{ + //if right chaain is empty, then there is only one bot vertex with + //one grid line + if(rightEndoutputFanWithPoint(gridV, leftU, rightU, botVertex, pStream); + return; + } + + Int segIndexMono, segIndexPass; + findBotRightSegment(rightChain, + rightEnd, + rightCorner, + grid->get_u_value(rightU), + segIndexMono, + segIndexPass); + + sampleBotRightWithGridLinePost(botVertex, + rightChain, + rightEnd, + segIndexMono, + segIndexPass, + rightCorner, + grid, + gridV, + leftU, + rightU, + pStream); +} + + +void sampleBotLeftWithGridLinePost(Real* botVertex, + vertexArray* leftChain, + Int leftEnd, + Int segIndexMono, + Int segIndexPass, + Int leftCorner, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream) +{ + + //the possible section which is to the left of leftU + if(segIndexPass > leftCorner) //at least leftCorner is to the left of leftU + { + Real *tempBot; + if(segIndexPass <= leftEnd) //from corner to pass-1 is getVertex(segIndexPass); + else //nothing is to the rigth of u + tempBot = botVertex; + Real tempTop[2]; + tempTop[0] = grid->get_u_value(leftU); + tempTop[1] = grid->get_v_value(gridV); + monoTriangulation2(tempTop, tempBot, leftChain, leftCorner, segIndexPass-1, + 1, //a increase chain, + pStream); + } + //the possible section which is strictly Umonotone + if(segIndexPass <= leftEnd) //segIndexpass and mono exist + { + stripOfFanLeft(leftChain, segIndexMono, segIndexPass, grid, gridV, leftU, rightU, pStream, 1); + Real tempTop[2]; + tempTop[0] = grid->get_u_value(rightU); + tempTop[1] = grid->get_v_value(gridV); + + monoTriangulation2(tempTop, botVertex, leftChain, segIndexMono, leftEnd, + 1, //increase chain + pStream); + } + else //the botVertex forms a fan with the grid points + { + grid->outputFanWithPoint(gridV, leftU, rightU, botVertex, pStream); + } + +} + +void sampleBotLeftWithGridLine(Real* botVertex, + vertexArray* leftChain, + Int leftEnd, + Int leftCorner, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream) +{ + + //if leftChain is empty, then there is only one botVertex with one grid line + if(leftEnd< leftCorner){ + grid->outputFanWithPoint(gridV, leftU, rightU, botVertex, pStream); + return; + } + + Int segIndexPass, segIndexMono; + findBotLeftSegment(leftChain, leftEnd, leftCorner, grid->get_u_value(leftU), segIndexMono, segIndexPass); + + sampleBotLeftWithGridLinePost(botVertex, + leftChain, + leftEnd, + segIndexMono, + segIndexPass, + leftCorner, + grid, + gridV, + leftU, rightU, pStream); +} + +//return 1 if separator exists, 0 otherwise +Int findBotSeparator(vertexArray* leftChain, + Int leftEnd, + Int leftCorner, + vertexArray* rightChain, + Int rightEnd, + Int rightCorner, + Int& ret_sep_left, + Int& ret_sep_right) +{ + Int oldLeftI, oldRightI, newLeftI, newRightI; + Int i,j,k; + Real leftMax /*= leftChain->getVertex(leftCorner)[0]*/; + Real rightMin /*= rightChain->getVertex(rightCorner)[0]*/; + if(leftChain->getVertex(leftCorner)[1] < rightChain->getVertex(rightCorner)[1])//leftlower + { + oldLeftI = leftCorner-1; + oldRightI = rightCorner; + leftMax = leftChain->getVertex(leftCorner)[0] - Real(1.0) ; //initilize to be left of leftCorner + rightMin = rightChain->getVertex(rightCorner)[0]; + } + else //rightlower + { + oldLeftI = leftCorner; + oldRightI = rightCorner-1; + leftMax = leftChain->getVertex(leftCorner)[0]; + rightMin = rightChain->getVertex(rightCorner)[0] + Real(1.0); + } + + //i: the current working leftChain Index + //j: the curent working right chian index + //if(left(i) is lower than right(j), then the two chains above right(j) are separated. + //else the two chains below left(i) are separated. + i = leftCorner; + j = rightCorner; + while(1) + { + newLeftI = oldLeftI; + newRightI = oldRightI; + if(i> leftEnd) //left chain is doen , go through remaining right chain + { + for(k=j+1; k<= rightEnd; k++) + { + if(rightChain->getVertex(k)[0] > leftMax) //no conflict + { + //update oldRightI if necessary + if(rightChain->getVertex(k)[0] < rightMin) + { + rightMin = rightChain->getVertex(k)[0]; + oldRightI = k; + } + } + else //there is a conflict + break; //the for-loop, above right(k+1) is separated: oldLeftI, oldRightI + } + break; //the while loop + } + else if(j > rightEnd) //right Chain is doen + { + for(k=i+1; k<= leftEnd; k++) + { + if(leftChain->getVertex(k)[0] < rightMin) //no conflict + { + //update oldLeftI if necessary + if(leftChain->getVertex(k)[0] > leftMax) + { + leftMax = leftChain->getVertex(k)[0]; + oldLeftI = k; + } + } + else //there is a conflict + break; //the for-loop, above left(k+1) is separated: oldLeftI, oldRightI + } + break; //the while loop + } + else if(leftChain->getVertex(i)[1] < rightChain->getVertex(j)[1]) //left lower + { + + if(leftChain->getVertex(i)[0] > leftMax) //update leftMax amd newLeftI + { + leftMax = leftChain->getVertex(i)[0]; + newLeftI = i; + } + for(k=j+1; k<= rightEnd; k++) //update rightMin and newRightI; + { + if(rightChain->getVertex(k)[1] < leftChain->getVertex(i)[1]) //right gets lower + break; + if(rightChain->getVertex(k)[0] < rightMin) + { + rightMin = rightChain->getVertex(k)[0]; + newRightI = k; + } + } + j = k; //next working j, since j will he lower than i in next loop + if(leftMax >= rightMin) //there is a conflict + break; + else //still no conflict + { + oldLeftI = newLeftI; + oldRightI = newRightI; + + } + } + else //right lower + { + if(rightChain->getVertex(j)[0] < rightMin) + { + rightMin = rightChain->getVertex(j)[0]; + newRightI = j; + } + for(k=i+1; k<= leftEnd; k++) + { + if(leftChain->getVertex(k)[1] < rightChain->getVertex(j)[1]) + break; + if(leftChain->getVertex(k)[0] > leftMax) + { + leftMax = leftChain->getVertex(k)[0]; + newLeftI = k; + } + } + i=k; //nexct working i, since i will be lower than j next loop + if(leftMax >= rightMin) //there is conflict + break; + else //still no conflict + { + oldLeftI = newLeftI; + oldRightI = newRightI; + } + } + }//end of while loop + //now oldLeftI and oldRight I are the desired separator index notice that they are not + //necessarily valid + if(oldLeftI < leftCorner || oldRightI < rightCorner) + return 0; //no separator + else + { + ret_sep_left = oldLeftI; + ret_sep_right = oldRightI; + return 1; + } +} + +void sampleCompBot(Real* botVertex, + vertexArray* leftChain, + Int leftEnd, + vertexArray* rightChain, + Int rightEnd, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex, + Int down_leftCornerWhere, + Int down_leftCornerIndex, + Int down_rightCornerWhere, + Int down_rightCornerIndex, + primStream* pStream) +{ + + if(down_leftCornerWhere == 1 && down_rightCornerWhere == 1) //the bot is botVertex with possible grid points + { + + leftGridChain->getGrid()->outputFanWithPoint(leftGridChain->getVlineIndex(gridIndex), + leftGridChain->getUlineIndex(gridIndex), + rightGridChain->getUlineIndex(gridIndex), + botVertex, + pStream); + return; + } + else if(down_leftCornerWhere != 0) + { + + Real* tempBot; + Int tempRightEnd; + if(down_leftCornerWhere == 1){ + tempRightEnd = rightEnd; + tempBot = botVertex; + } + else + { + tempRightEnd = down_leftCornerIndex-1; + tempBot = rightChain->getVertex(down_leftCornerIndex); + } + + sampleBotRightWithGridLine(tempBot, + rightChain, + tempRightEnd, + down_rightCornerIndex, + rightGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex), + leftGridChain->getUlineIndex(gridIndex), + rightGridChain->getUlineIndex(gridIndex), + pStream); + } + else if(down_rightCornerWhere != 2) + { + + Real* tempBot; + Int tempLeftEnd; + if(down_rightCornerWhere == 1){ + tempLeftEnd = leftEnd; + tempBot = botVertex; + } + else //right corner is on left chain + { + tempLeftEnd = down_rightCornerIndex-1; + tempBot = leftChain->getVertex(down_rightCornerIndex); + } + + + sampleBotLeftWithGridLine(tempBot, leftChain, tempLeftEnd, down_leftCornerIndex, + leftGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex), + leftGridChain->getUlineIndex(gridIndex), + rightGridChain->getUlineIndex(gridIndex), + pStream); + + } + else //down_leftCornereWhere == 0, down_rightCornerwhere == 2 + { + sampleCompBotSimple(botVertex, + leftChain, + leftEnd, + rightChain, + rightEnd, + leftGridChain, + rightGridChain, + gridIndex, + down_leftCornerWhere, + down_leftCornerIndex, + down_rightCornerWhere, + down_rightCornerIndex, + pStream); + + return; + +#ifdef NOT_REACHABLE + //the following code is trying to do some optimization, but not quite working. so it is not reachable, but leave it here for reference + Int sep_left, sep_right; + if(findBotSeparator(leftChain, leftEnd, down_leftCornerIndex, + rightChain, rightEnd, down_rightCornerIndex, + sep_left, sep_right) + )//separator exiosts + { + + if(leftChain->getVertex(sep_left)[0] >= leftGridChain->get_u_value(gridIndex) && + rightChain->getVertex(sep_right)[0] <= rightGridChain->get_u_value(gridIndex)) + { + Int gridSep; + Int segLeftMono, segLeftPass, segRightMono, segRightPass; + findBotLeftSegment(leftChain, + sep_left, + down_leftCornerIndex, + leftGridChain->get_u_value(gridIndex), + segLeftMono, + segLeftPass); + findBotRightSegment(rightChain, + sep_right, + down_rightCornerIndex, + rightGridChain->get_u_value(gridIndex), + segRightMono, + segRightPass); + if(leftChain->getVertex(segLeftMono)[1] <= rightChain->getVertex(segRightMono)[1]) + { + gridSep = rightGridChain->getUlineIndex(gridIndex); + while(leftGridChain->getGrid()->get_u_value(gridSep) > leftChain->getVertex(segLeftMono)[0]) + gridSep--; + } + else + { + gridSep = leftGridChain->getUlineIndex(gridIndex); + while(leftGridChain->getGrid()->get_u_value(gridSep) < rightChain->getVertex(segRightMono)[0]) + gridSep++; + } + + sampleBotLeftWithGridLinePost(leftChain->getVertex(segLeftMono), + leftChain, + segLeftMono-1, + segLeftMono-1, + segLeftPass, + down_leftCornerIndex, + leftGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex), + leftGridChain->getUlineIndex(gridIndex), + gridSep, + pStream); + sampleBotRightWithGridLinePost(rightChain->getVertex(segRightMono), + rightChain, + segRightMono-1, + segRightMono-1, + segRightPass, + down_rightCornerIndex, + rightGridChain->getGrid(), + rightGridChain->getVlineIndex(gridIndex), + gridSep, + rightGridChain->getUlineIndex(gridIndex), + pStream); + Real tempTop[2]; + tempTop[0] = leftGridChain->getGrid()->get_u_value(gridSep); + tempTop[1] = leftGridChain->get_v_value(gridIndex); + monoTriangulationRecGen(tempTop, botVertex, + leftChain, segLeftMono, leftEnd, + rightChain, segRightMono, rightEnd, + pStream); + }//end if both sides have vertices inside the gridboundary points + else if(leftChain->getVertex(sep_left)[0] >= leftGridChain->get_u_value(gridIndex)) //left n right out + + { + Int segLeftMono, segLeftPass; + findBotLeftSegment(leftChain, + sep_left, + down_leftCornerIndex, + leftGridChain->get_u_value(gridIndex), + segLeftMono, + segLeftPass); + assert(segLeftPass <= sep_left); //make sure there is a point to the right of u. + monoTriangulation2(leftGridChain->get_vertex(gridIndex), + leftChain->getVertex(segLeftPass), + leftChain, + down_leftCornerIndex, + segLeftPass-1, + 1, //a increase chain + pStream); + stripOfFanLeft(leftChain, segLeftMono, segLeftPass, + leftGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex), + leftGridChain->getUlineIndex(gridIndex), + rightGridChain->getUlineIndex(gridIndex), + pStream,1 ); +/* + sampleBotLeftWithGridLinePost(leftChain->getVertex(segLeftMono), + leftChain, + segLeftMono-1, + segLeftMono-1, + segLeftPass, + down_leftCornerIndex, + leftGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex), + leftGridChain->getUlineIndex(gridIndex), + rightGridChain->getUlineIndex(gridIndex), + pStream); +*/ + + monoTriangulationRecGen(rightGridChain->get_vertex(gridIndex), + botVertex, + leftChain, segLeftMono, leftEnd, + rightChain, down_rightCornerIndex, rightEnd, + pStream); + }//end left in right out + else if(rightChain->getVertex(sep_right)[0] <= rightGridChain->get_u_value(gridIndex))//left out right in + { + Int segRightMono, segRightPass; + findBotRightSegment(rightChain, sep_right, down_rightCornerIndex, + rightGridChain->get_u_value(gridIndex), + segRightMono, + segRightPass); + + assert(segRightPass <= sep_right); //make sure there is a point to the left of u. + monoTriangulation2(rightGridChain->get_vertex(gridIndex), + rightChain->getVertex(segRightPass), + rightChain, + down_rightCornerIndex, + segRightPass-1, + 0, // a decrease chain + pStream); + + stripOfFanRight(rightChain, segRightMono, segRightPass, + rightGridChain->getGrid(), + rightGridChain->getVlineIndex(gridIndex), + leftGridChain->getUlineIndex(gridIndex), + rightGridChain->getUlineIndex(gridIndex), + pStream, 1); + + + monoTriangulationRecGen(leftGridChain->get_vertex(gridIndex), + botVertex, + leftChain, down_leftCornerIndex, leftEnd, + rightChain, segRightMono, rightEnd, + pStream); + + }//end left out right in + else //left out, right out + { + sampleCompBotSimple(botVertex, + leftChain, + leftEnd, + rightChain, + rightEnd, + leftGridChain, + rightGridChain, + gridIndex, + down_leftCornerWhere, + down_leftCornerIndex, + down_rightCornerWhere, + down_rightCornerIndex, + pStream); + + }//end leftout right out + }//end if separator exists + else //no separator + { + + sampleCompBotSimple(botVertex, + leftChain, + leftEnd, + rightChain, + rightEnd, + leftGridChain, + rightGridChain, + gridIndex, + down_leftCornerWhere, + down_leftCornerIndex, + down_rightCornerWhere, + down_rightCornerIndex, + pStream); + } +#endif + }//end id 0 2 +}//end if the functin + + +void sampleCompBotSimple(Real* botVertex, + vertexArray* leftChain, + Int leftEnd, + vertexArray* rightChain, + Int rightEnd, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex, + Int down_leftCornerWhere, + Int down_leftCornerIndex, + Int down_rightCornerWhere, + Int down_rightCornerIndex, + primStream* pStream) +{ + //the plan is to use monotriangulation algorithm. + Int i,k; + Real* ActualTop; + Real* ActualBot; + Int ActualLeftStart, ActualLeftEnd; + Int ActualRightStart, ActualRightEnd; + + //creat an array to store the points on the grid line + gridWrap* grid = leftGridChain->getGrid(); + Int gridV = leftGridChain->getVlineIndex(gridIndex); + Int gridLeftU = leftGridChain->getUlineIndex(gridIndex); + Int gridRightU = rightGridChain->getUlineIndex(gridIndex); + Real2* gridPoints = (Real2*) malloc(sizeof(Real2) * (gridRightU - gridLeftU +1)); + assert(gridPoints); + + for(k=0, i=gridRightU; i>= gridLeftU; i--, k++) + { + gridPoints[k][0] = grid->get_u_value(i); + gridPoints[k][1] = grid->get_v_value(gridV); + } + + if(down_rightCornerWhere != 0) //rightCorner is not on lef + ActualLeftEnd = leftEnd; + else + ActualLeftEnd = down_rightCornerIndex-1; //down_rightCornerIndex will be th actualBot + + if(down_leftCornerWhere != 0) //left corner is not on let chian + ActualLeftStart = leftEnd+1; //meaning that there is no actual left section + else + ActualLeftStart = down_leftCornerIndex; + + vertexArray ActualLeftChain(max(0, ActualLeftEnd - ActualLeftStart +1) + gridRightU - gridLeftU +1); + + for(i=0; igetVertex(i)); + + //determine ActualRightStart + if(down_rightCornerWhere != 2) //right is not on right + ActualRightStart = rightEnd +1; //meaning no section on right + else + ActualRightStart = down_rightCornerIndex; + + //determine actualrightEnd + if(down_leftCornerWhere != 2) //left is not on right + { + + ActualRightEnd = rightEnd; + } + else //left corner is on right + { + ActualRightEnd = down_leftCornerIndex-1; //down_leftCornerIndex will be the bot + + } + + //actual bot + if(down_rightCornerWhere == 2) + { + if(down_leftCornerWhere == 2) + ActualBot = rightChain->getVertex(down_leftCornerIndex); + else + ActualBot = botVertex; + } + else if(down_rightCornerWhere == 1) //right corner bot + ActualBot = botVertex; + else //down_rightCornerWhere == 0 + ActualBot = leftChain->getVertex(down_rightCornerIndex); + + ActualTop = gridPoints[0]; +/* +printf("in bot simple, actual leftChain is \n"); +ActualLeftChain.print(); +printf("Actual Top = %f,%f\n", ActualTop[0],ActualTop[1]); +printf("Actual Bot = %f,%f\n", ActualBot[0],ActualBot[1]); +printf("Actual right start = %i, end=%i\n",ActualRightStart, ActualRightEnd); +*/ + if(rightChain->getVertex(ActualRightStart)[1] == ActualTop[1]) + monoTriangulationRecGenOpt(rightChain->getVertex(ActualRightStart), + ActualBot, + &ActualLeftChain, + 0, + ActualLeftChain.getNumElements()-1, + rightChain, + ActualRightStart+1, + ActualRightEnd, + pStream); + else + monoTriangulationRecGenOpt(ActualTop, ActualBot, + &ActualLeftChain, + 1, //the first one is the top vertex + ActualLeftChain.getNumElements()-1, + rightChain, + ActualRightStart, + ActualRightEnd, + pStream); + free(gridPoints); +} + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.h new file mode 100644 index 000000000..7b982794c --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompBot.h @@ -0,0 +1,138 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _SAMPLECOMPBOT_H +#define _SAMPLECOMPBOT_H + +#include "sampleMonoPoly.h" + +void findBotLeftSegment(vertexArray* leftChain, + Int leftEnd, + Int leftCorner, + Real u, + Int& ret_index_mono, + Int& ret_index_pass); + +void findBotRightSegment(vertexArray* rightChain, + Int rightEnd, + Int rightCorner, + Real u, + Int& ret_index_mono, + Int& ret_index_pass); + + +void sampleBotRightWithGridLinePost(Real* botVertex, + vertexArray* rightChain, + Int rightEnd, + Int segIndexMono, + Int segIndexPass, + Int rightCorner, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream); + + +void sampleBotRightWithGridLine(Real* botVertex, + vertexArray* rightChain, + Int rightEnd, + Int rightCorner, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream); + + +void sampleBotLeftWithGridLinePost(Real* botVertex, + vertexArray* leftChain, + Int leftEnd, + Int segIndexMono, + Int segIndexPass, + Int leftCorner, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream); + + +void sampleBotLeftWithGridLine(Real* botVertex, + vertexArray* leftChain, + Int leftEnd, + Int leftCorner, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream); + + +Int findBotSeparator(vertexArray* leftChain, + Int leftEnd, + Int leftCorner, + vertexArray* rightChain, + Int rightEnd, + Int rightCorner, + Int& ret_sep_left, + Int& ret_sep_right); + +void sampleCompBot(Real* botVertex, + vertexArray* leftChain, + Int leftEnd, + vertexArray* rightChain, + Int rightEnd, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex, + Int down_leftCornerWhere, + Int down_leftCornerIndex, + Int down_rightCornerWhere, + Int down_rightCornerIndex, + primStream* pStream); + +void sampleCompBotSimple(Real* botVertex, + vertexArray* leftChain, + Int leftEnd, + vertexArray* rightChain, + Int rightEnd, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex, + Int down_leftCornerWhere, + Int down_leftCornerIndex, + Int down_rightCornerWhere, + Int down_rightCornerIndex, + primStream* pStream); + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc new file mode 100644 index 000000000..d01e50018 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.cc @@ -0,0 +1,644 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include "gluos.h" +#include "glimports.h" +#include "zlassert.h" +#include "sampleCompRight.h" + +#define max(a,b) ((a>b)? a:b) +#define min(a,b) ((a>b)? b:a) + + + +#ifdef NOT_TAKEOUT + +/*notice that we need leftChain because the + *corners could be on the leftChain. + */ +void sampleCompRight(Real* topVertex, Real* botVertex, + vertexArray* leftChain, + Int leftStartIndex, Int leftEndIndex, + vertexArray* rightChain, + Int rightStartIndex, Int rightEndIndex, + gridBoundaryChain* rightGridChain, + Int gridIndex1, Int gridIndex2, + Int up_rightCornerWhere, + Int up_rightCornerIndex, + Int down_rightCornerWhere, + Int down_rightCornerIndex, + primStream* pStream) +{ + /*find out whether there is a trim vertex which is + *inbetween the top and bot grid lines or not. + */ + Int midIndex1; + Int midIndex2; + Int gridMidIndex1 = 0, gridMidIndex2 = 0; + //midIndex1: array[i] <= v, array[i+1] > v + //midIndex2: array[i] >= v, array[i+1] < v + midIndex1 = rightChain->findIndexBelowGen(rightGridChain->get_v_value(gridIndex1), + rightStartIndex, + rightEndIndex); + midIndex2 = -1; //initilization + if(midIndex1 <= rightEndIndex && gridIndex1 < gridIndex2) + if(rightChain->getVertex(midIndex1)[1] >= rightGridChain->get_v_value(gridIndex2)) + { + //midIndex2 must exist: + midIndex2 = rightChain->findIndexAboveGen(rightGridChain->get_v_value(gridIndex2), + midIndex1, //midIndex1<=midIndex2 + rightEndIndex); + //find gridMidIndex1 so that either it=gridIndex1 when the gridline is + // at the same height as trim vertex midIndex1, or it is the last one + //which is strictly above midIndex1. + { + Real temp = rightChain->getVertex(midIndex1)[1]; + if(rightGridChain->get_v_value(gridIndex1) == temp) + gridMidIndex1 = gridIndex1; + else + { + gridMidIndex1 = gridIndex1; + while(rightGridChain->get_v_value(gridMidIndex1) > temp) + gridMidIndex1++; + gridMidIndex1--; + } + }//end of find gridMindIndex1 + //find gridMidIndex2 so that it is the (first one below or equal + //midIndex) last one above or equal midIndex2 + { + Real temp = rightChain->getVertex(midIndex2)[1]; + for(gridMidIndex2 = gridMidIndex1+1; gridMidIndex2 <= gridIndex2; gridMidIndex2++) + if(rightGridChain->get_v_value(gridMidIndex2) <= temp) + break; + + assert(gridMidIndex2 <= gridIndex2); + }//end of find gridMidIndex2 + } + + + + //to interprete the corner information + Real* cornerTop; + Real* cornerBot; + Int cornerRightStart; + Int cornerRightEnd; + Int cornerLeftUpEnd; + Int cornerLeftDownStart; + if(up_rightCornerWhere == 2) //right corner is on right chain + { + cornerTop = rightChain->getVertex(up_rightCornerIndex); + cornerRightStart = up_rightCornerIndex+1; + cornerLeftUpEnd = -1; //no left + } + else if(up_rightCornerWhere == 1) //right corner is on top + { + cornerTop = topVertex; + cornerRightStart = rightStartIndex; + cornerLeftUpEnd = -1; //no left + } + else //right corner is on left chain + { + cornerTop = topVertex; + cornerRightStart = rightStartIndex; + cornerLeftUpEnd = up_rightCornerIndex; + } + + if(down_rightCornerWhere == 2) //right corner is on right chan + { + cornerBot = rightChain->getVertex(down_rightCornerIndex); + cornerRightEnd = down_rightCornerIndex-1; + cornerLeftDownStart = leftEndIndex+1; //no left + } + else if (down_rightCornerWhere == 1) //right corner is at bot + { + cornerBot = botVertex; + cornerRightEnd = rightEndIndex; + cornerLeftDownStart = leftEndIndex+1; //no left + } + else //right corner is on the left chain + { + cornerBot = botVertex; + cornerRightEnd = rightEndIndex; + cornerLeftDownStart = down_rightCornerIndex; + } + + //sample + if(midIndex2 >= 0) //there is a trm point between grid lines + { + + sampleRightSingleTrimEdgeRegionGen(cornerTop, rightChain->getVertex(midIndex1), + rightChain, + cornerRightStart, + midIndex1-1, + rightGridChain, + gridIndex1, + gridMidIndex1, + leftChain, + leftStartIndex, + cornerLeftUpEnd, + 0, //no left down section, + -1, + pStream); + + sampleRightSingleTrimEdgeRegionGen(rightChain->getVertex(midIndex2), + cornerBot, + rightChain, + midIndex2+1, + cornerRightEnd, + rightGridChain, + gridMidIndex2, + gridIndex2, + leftChain, + 0, //no left up section + -1, + cornerLeftDownStart, + leftEndIndex, + pStream); + + sampleRightStripRecF(rightChain, + midIndex1, + midIndex2, + rightGridChain, + gridMidIndex1, + gridMidIndex2, + pStream); + + } + else + { + sampleRightSingleTrimEdgeRegionGen(cornerTop, cornerBot, + rightChain, + cornerRightStart, + cornerRightEnd, + rightGridChain, + gridIndex1, + gridIndex2, + leftChain, + leftStartIndex, + cornerLeftUpEnd, + cornerLeftDownStart, + leftEndIndex, + pStream); + } +} + +void sampleRightSingleTrimEdgeRegionGen(Real topVertex[2], Real botVertex[2], + vertexArray* rightChain, + Int rightStart, + Int rightEnd, + gridBoundaryChain* gridChain, + Int gridBeginIndex, + Int gridEndIndex, + vertexArray* leftChain, + Int leftUpBegin, + Int leftUpEnd, + Int leftDownBegin, + Int leftDownEnd, + primStream* pStream) +{ + Int i,k; + /*creat an array to store all the up and down secments of the left chain, + *and the right end grid points + * + *although vertex array is a dynamic array, but to gain efficiency, + *it is better to initiliza the exact array size + */ + vertexArray vArray(gridEndIndex-gridBeginIndex+1 + + max(0,leftUpEnd - leftUpBegin+1)+ + max(0,leftDownEnd - leftDownBegin+1)); + //append the vertices on the up section of the left chain + for(i=leftUpBegin; i<= leftUpEnd; i++) + vArray.appendVertex(leftChain->getVertex(i)); + + //append the vertices of the right extremal grid points, + //and at the same time, perform triangulation for the stair cases + vArray.appendVertex(gridChain->get_vertex(gridBeginIndex)); + + for(k=1, i=gridBeginIndex+1; i<= gridEndIndex; i++, k++) + { + vArray.appendVertex(gridChain->get_vertex(i)); + + //output the fan of the grid points of the (i)th and (i-1)th grid line. + gridChain->rightEndFan(i, pStream); + } + + //append all the vertices on the down section of the left chain + for(i=leftDownBegin; i<= leftDownEnd; i++) + vArray.appendVertex(leftChain->getVertex(i)); + monoTriangulationRecGen(topVertex, botVertex, + &vArray, 0, vArray.getNumElements()-1, + rightChain, rightStart, rightEnd, + pStream); +} + +void sampleRightSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2], + gridBoundaryChain* gridChain, + Int beginIndex, + Int endIndex, + primStream* pStream) +{ + Int i,k; + vertexArray vArray(endIndex-beginIndex+1); + vArray.appendVertex(gridChain->get_vertex(beginIndex)); + for(k=1, i=beginIndex+1; i<= endIndex; i++, k++) + { + vArray.appendVertex(gridChain->get_vertex(i)); + //output the fan of the grid points of the (i)_th and i-1th gridLine + gridChain->rightEndFan(i, pStream); + } + monoTriangulation2(upperVert, lowerVert, &vArray, 0, endIndex-beginIndex, + 1, //increase chain (to the left) + pStream); +} + + +/*the gridlines from rightGridChainStartIndex to + *rightGridChainEndIndex are assumed to form a + *connected componenet + *the trm vertex of topRightIndex is assumed to be below + *or equal the first gridLine, and the trm vertex of + *botRightIndex is assumed to be above or equal the last gridline + **there could be multipe trm vertices equal to the last gridline, but + **only one could be equal to top gridline. shape: ____| (recall that + **for left chain recF, we allow shape: |---- + *if botRightIndex= topRightIndex, there is at least one triangles to + *output + */ +void sampleRightStripRecF(vertexArray* rightChain, + Int topRightIndex, + Int botRightIndex, + gridBoundaryChain* rightGridChain, + Int rightGridChainStartIndex, + Int rightGridChainEndIndex, + primStream* pStream + ) +{ + + //sstop conditionL: if topRightIndex > botRightIndex, then stop + if(topRightIndex > botRightIndex) + return; + + //if there is only one grid line, return + if(rightGridChainStartIndex >= rightGridChainEndIndex) + return; + + + assert(rightChain->getVertex(topRightIndex)[1] <= rightGridChain->get_v_value(rightGridChainStartIndex) && + rightChain->getVertex(botRightIndex)[1] >= rightGridChain->get_v_value(rightGridChainEndIndex)); + + //firstfind the first trim vertex which is strictly below the second top + //grid line: index1. + Real secondGridChainV = rightGridChain->get_v_value(rightGridChainStartIndex+1); + Int index1 = topRightIndex; + while(rightChain->getVertex(index1)[1] >= secondGridChainV){ + index1++; + if(index1 > botRightIndex) + break; + } + //now rightChain->getVertex(index1-1)[1] >= secondGridChainV and + //rightChain->getVertex(index1)[1] < secondGridChainV and + //we should include index1-1 to perform a gridStep + index1--; + + //now we have rightChain->getVertex(index1)[1] >= secondGridChainV, and + //rightChain->getVertex(index1+1)[1] < secondGridChainV + sampleRightOneGridStep(rightChain, topRightIndex, index1, rightGridChain, rightGridChainStartIndex, pStream); + + //if rightChain->getVertex(index1)[1] ==secondGridChainV then we can + //recurvesively to the rest + if(rightChain->getVertex(index1)[1] == secondGridChainV) + { + + + sampleRightStripRecF(rightChain, index1, botRightIndex, rightGridChain, rightGridChainStartIndex+1, rightGridChainEndIndex, pStream); + } + else if(index1 < botRightIndex) + { + //otherwise, we have rightChain->getVertex(index1)[1] > secondV + //let the next trim vertex be nextTrimVertex, (which should be strictly + //below the second grid line). Find the last grid line index2 which is STRICTLY ABOVE + //nextTrimVertex. + //sample one trm edge region. + Real *uppervert, *lowervert; + uppervert = rightChain->getVertex(index1); + lowervert = rightChain->getVertex(index1+1); //okay since index1get_v_value(index2) > lowervert[1]) + { + index2++; + if(index2 > rightGridChainEndIndex) + break; + } + index2--; + + sampleRightSingleTrimEdgeRegion(uppervert, lowervert, rightGridChain, rightGridChainStartIndex+1, index2, pStream); + + //recursion + sampleRightStripRecF(rightChain, index1+1, botRightIndex, rightGridChain, index2, rightGridChainEndIndex, pStream); + } +} + +//the degenerate case of sampleRightOneGridStep +void sampleRightOneGridStepNoMiddle(vertexArray* rightChain, + Int beginRightIndex, + Int endRightIndex, + gridBoundaryChain* rightGridChain, + Int rightGridChainStartIndex, + primStream* pStream) +{ + /*since there is no middle, there is at most one point which is on the + *second grid line, there could be multiple points on the first (top) + *grid line. + */ + rightGridChain->rightEndFan(rightGridChainStartIndex+1, pStream); + monoTriangulation2(rightGridChain->get_vertex(rightGridChainStartIndex), + rightGridChain->get_vertex(rightGridChainStartIndex+1), + rightChain, + beginRightIndex, + endRightIndex, + 0, //decrease chain + pStream); +} + +//sampling the right area in between two grid lines +//shape: _________| +void sampleRightOneGridStep(vertexArray* rightChain, + Int beginRightIndex, + Int endRightIndex, + gridBoundaryChain* rightGridChain, + Int rightGridChainStartIndex, + primStream* pStream) +{ + if(checkMiddle(rightChain, beginRightIndex, endRightIndex, + rightGridChain->get_v_value(rightGridChainStartIndex), + rightGridChain->get_v_value(rightGridChainStartIndex+1))<0) + { + sampleRightOneGridStepNoMiddle(rightChain, beginRightIndex, endRightIndex, rightGridChain, rightGridChainStartIndex, pStream); + return; + } + + //copy into a polygn + { + directedLine* poly = NULL; + sampledLine* sline; + directedLine* dline; + gridWrap* grid = rightGridChain->getGrid(); + float vert1[2]; + float vert2[2]; + Int i; + + Int innerInd = rightGridChain->getInnerIndex(rightGridChainStartIndex+1); + Int upperInd = rightGridChain->getUlineIndex(rightGridChainStartIndex); + Int lowerInd = rightGridChain->getUlineIndex(rightGridChainStartIndex+1); + Real upperV = rightGridChain->get_v_value(rightGridChainStartIndex); + Real lowerV = rightGridChain->get_v_value(rightGridChainStartIndex+1); + + //the upper gridline + vert1[1]=vert2[1]=upperV; + for(i=upperInd; + i>innerInd; + i--) + { + vert1[0]=grid->get_u_value(i); + vert2[0]=grid->get_u_value(i-1); + sline = new sampledLine(vert1, vert2); + dline = new directedLine(INCREASING, sline); + if(poly == NULL) + poly = dline; + else + poly->insert(dline); + } + + //the vertical grid line segment + vert1[0]=vert2[0] = grid->get_u_value(innerInd); + vert1[1]=upperV; + vert2[1]=lowerV; + sline=new sampledLine(vert1, vert2); + dline=new directedLine(INCREASING, sline); + if(poly == NULL) + poly = dline; + else + poly->insert(dline); + + //the lower grid line + vert1[1]=vert2[1]=lowerV; + for(i=innerInd; iget_u_value(i); + vert2[0] = grid->get_u_value(i+1); + sline = new sampledLine(vert1, vert2); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + } + + //the edge connecting lower grid to right chain + vert1[0]=grid->get_u_value(lowerInd); + sline = new sampledLine(vert1, rightChain->getVertex(endRightIndex)); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + + + //the right Chain + for(i=endRightIndex; i>beginRightIndex; i--) + { + sline = new sampledLine(rightChain->getVertex(i), rightChain->getVertex(i-1)); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + } + + //the edge connecting right chain with upper grid + vert2[1]=upperV; + vert2[0]=grid->get_u_value(upperInd); + sline = new sampledLine(rightChain->getVertex(beginRightIndex), vert2); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + monoTriangulationOpt(poly, pStream); + //clean up + poly->deleteSinglePolygonWithSline(); + + return; + } + + //this following code cannot be reached, but leave it for debuggig purpose. + Int i; + //find the maximal U-monotone chain of beginRightIndex, beginRightIndex+1,... + i=beginRightIndex; + Real prevU = rightChain->getVertex(i)[0]; + for(i=beginRightIndex+1; i<= endRightIndex; i++){ + Real thisU = rightChain->getVertex(i)[0]; + if(thisU < prevU) + prevU = thisU; + else + break; + } + //from beginRightIndex to i-1 is strictly U-monotne + //if(i-1==beginRightIndex and the vertex of rightchain is on the first + //gridline, then we should use 2 vertices on the right chain. Of we only + //use one (begin), we would output degenrate triangles. + if(i-1 == beginRightIndex && rightChain->getVertex(beginRightIndex)[1] == rightGridChain->get_v_value(rightGridChainStartIndex)) + i++; + + Int j = endRightIndex -1; + if(rightGridChain->getInnerIndex(rightGridChainStartIndex+1) < rightGridChain->getUlineIndex(rightGridChainStartIndex+1)) + { + j = rightChain->findDecreaseChainFromEnd(i-1/*beginRightIndex*/, endRightIndex); + Int temp = endRightIndex; + //now from j+1 to end is strictly U-monotone. + //if j+1 is on the last grid line, then we wat to skip to the vertex + //whcih is strictly above the second grid line. This vertex must exist + //since there is a middle vertex + if(j+1 == endRightIndex) + { + while(rightChain->getVertex(j+1)[1] == rightGridChain->get_v_value(rightGridChainStartIndex+1)) + j--; + + monoTriangulation2(rightChain->getVertex(j+1), + rightGridChain->get_vertex(rightGridChainStartIndex+1), + rightChain, + j+2, + endRightIndex, + 0, //a decrease chain + pStream); + + temp = j+1; + } + + stripOfFanRight(rightChain, temp, j+1, rightGridChain->getGrid(), + rightGridChain->getVlineIndex(rightGridChainStartIndex+1), + rightGridChain->getInnerIndex(rightGridChainStartIndex+1), + rightGridChain->getUlineIndex(rightGridChainStartIndex+1), + pStream, + 0 //the grid line is below the trim line + ); + + } + + + stripOfFanRight(rightChain, i-1, beginRightIndex, rightGridChain->getGrid(), + rightGridChain->getVlineIndex(rightGridChainStartIndex), + rightGridChain->getInnerIndex(rightGridChainStartIndex+1), + rightGridChain->getUlineIndex(rightGridChainStartIndex), + pStream, + 1 //the grid line is above the trm lines + ); + + //monotone triangulate the remaining rightchain together with the + //two vertices on the two grid v-lines + Real vert[2][2]; + vert[0][0] = vert[1][0] = rightGridChain->getInner_u_value(rightGridChainStartIndex+1); + vert[0][1] = rightGridChain->get_v_value(rightGridChainStartIndex); + vert[1][1] = rightGridChain->get_v_value(rightGridChainStartIndex+1); + + monoTriangulation2(&vert[0][0], + &vert[1][0], + rightChain, + i-1, + j+1, + 0, ///a decreae chain + pStream); +} + +#endif + +void stripOfFanRight(vertexArray* rightChain, + Int largeIndex, + Int smallIndex, + gridWrap* grid, + Int vlineIndex, + Int ulineSmallIndex, + Int ulineLargeIndex, + primStream* pStream, + Int gridLineUp /*1 if the grid line is above the trim lines*/ + ) +{ + assert(largeIndex >= smallIndex); + + Real grid_v_value; + grid_v_value = grid->get_v_value(vlineIndex); + + Real2* trimVerts=(Real2*) malloc(sizeof(Real2)* (largeIndex-smallIndex+1)); + assert(trimVerts); + + + Real2* gridVerts=(Real2*) malloc(sizeof(Real2)* (ulineLargeIndex-ulineSmallIndex+1)); + assert(gridVerts); + + Int k,i; + if(! gridLineUp) /*trim line is above grid line, so trim vertices are going right when index increases*/ + for(k=0, i=smallIndex; i<=largeIndex; i++, k++) + { + trimVerts[k][0] = rightChain->getVertex(i)[0]; + trimVerts[k][1] = rightChain->getVertex(i)[1]; + } + else + for(k=0, i=largeIndex; i>=smallIndex; i--, k++) + { + trimVerts[k][0] = rightChain->getVertex(i)[0]; + trimVerts[k][1] = rightChain->getVertex(i)[1]; + } + + for(k=0, i=ulineSmallIndex; i<= ulineLargeIndex; i++, k++) + { + gridVerts[k][0] = grid->get_u_value(i); + gridVerts[k][1] = grid_v_value; + } + + if(gridLineUp) + triangulateXYMono( + ulineLargeIndex-ulineSmallIndex+1, gridVerts, + largeIndex-smallIndex+1, trimVerts, + pStream); + else + triangulateXYMono(largeIndex-smallIndex+1, trimVerts, + ulineLargeIndex-ulineSmallIndex+1, gridVerts, + pStream); + free(trimVerts); + free(gridVerts); +} + + + + + + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.h new file mode 100644 index 000000000..4670b87ca --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompRight.h @@ -0,0 +1,117 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _SAMPLECOMPRIGHT_H +#define _SAMPLECOMPRIGHT_H + +#define NOT_TAKEOUT + +#include "sampleMonoPoly.h" +void stripOfFanRight(vertexArray* rightChain, + Int largeIndex, + Int smallIndex, + gridWrap* grid, + Int vlineIndex, + Int ulineSmallIndex, + Int ulineLargeIndex, + primStream* pStream, + Int gridLineUp /*1 if grid line is above the trim lines */ + ); + +#ifdef NOT_TAKEOUT +void sampleRightStripRecF(vertexArray* rightChain, + Int topRightIndex, + Int botRightIndex, + gridBoundaryChain* rightGridChain, + Int rightGridChainStartIndex, + Int rightGridChainEndIndex, + primStream* pStream + ); +//the degenerate case of sampleRightOneGridStep +void sampleRightOneGridStepNoMiddle(vertexArray* rightChain, + Int beginRightIndex, + Int endRightIndex, + gridBoundaryChain* rightGridChain, + Int rightGridChainStartIndex, + primStream* pStream); +//sampling the right area in between two grid lines +//shape: _________| +void sampleRightOneGridStep(vertexArray* rightChain, + Int beginRightIndex, + Int endRightIndex, + gridBoundaryChain* rightGridChain, + Int rightGridChainStartIndex, + primStream* pStream); +void sampleRightSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2], + gridBoundaryChain* gridChain, + Int beginIndex, + Int endIndex, + primStream* pStream); +//the degenerate case of sampleRightOneGridStep +void sampleRightOneGridStepNoMiddle(vertexArray* rightChain, + Int beginRightIndex, + Int endRightIndex, + gridBoundaryChain* rightGridChain, + Int rightGridChainStartIndex, + primStream* pStream); + +void sampleCompRight(Real* topVertex, Real* botVertex, + vertexArray* leftChain, + Int leftStartIndex, Int leftEndIndex, + vertexArray* rightChain, + Int rightStartIndex, Int rightEndIndex, + gridBoundaryChain* rightGridChain, + Int gridIndex1, Int gridIndex2, + Int up_leftCornerWhere, + Int up_leftCornerIndex, + Int down_leftCornerWhere, + Int down_leftCornerIndex, + primStream* pStream); + +void sampleRightSingleTrimEdgeRegionGen(Real topVert[2], Real botVert[2], + vertexArray* rightChain, + Int rightStart, + Int rightEnd, + gridBoundaryChain* gridChain, + Int gridBegindex, + Int gridEndIndex, + vertexArray* leftChain, + Int leftUpBegin, + Int leftUpEnd, + Int leftDownBegin, + Int leftDownEnd, + primStream* pStream); +#endif + +#endif + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc new file mode 100644 index 000000000..b7b929623 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.cc @@ -0,0 +1,1030 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include +#include "zlassert.h" +#include "sampleCompTop.h" +#include "sampleCompRight.h" + +#define max(a,b) ((a>b)? a:b) + +//return : index_small, and index_large, +//from [small, large] is strictly U-monotne, +//from [large+1, end] is = u +//if eveybody is = leftStart; i--) + { + if(leftChain->getVertex(i)[0] >= u) + break; + } + ret_index_large = i; + if(ret_index_large >= leftStart) + { + for(i=ret_index_large; i>leftStart; i--) + { + if(leftChain->getVertex(i-1)[0] <= leftChain->getVertex(i)[0]) + break; + } + ret_index_small = i; + } +} + +void findTopRightSegment(vertexArray* rightChain, + Int rightStart, + Int rightEnd, + Real u, + Int& ret_index_small, + Int& ret_index_large) +{ + Int i; + assert(rightStart<=rightEnd); + for(i=rightEnd; i>=rightStart; i--) + { + if(rightChain->getVertex(i)[0] <= u) + break; + } + ret_index_large = i; + if(ret_index_large >= rightStart) + { + for(i=ret_index_large; i>rightStart;i--) + { + if(rightChain->getVertex(i-1)[0] >= rightChain->getVertex(i)[0]) + break; + } + ret_index_small = i; + } +} + + +void sampleTopRightWithGridLinePost(Real* topVertex, + vertexArray* rightChain, + Int rightStart, + Int segIndexSmall, + Int segIndexLarge, + Int rightEnd, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream) +{ + //the possible section which is to the right of rightU + if(segIndexLarge < rightEnd) + { + Real *tempTop; + if(segIndexLarge >= rightStart) + tempTop = rightChain->getVertex(segIndexLarge); + else + tempTop = topVertex; + Real tempBot[2]; + tempBot[0] = grid->get_u_value(rightU); + tempBot[1] = grid->get_v_value(gridV); +monoTriangulationRecGenOpt(tempTop, tempBot, + NULL, 1,0, + rightChain, segIndexLarge+1, rightEnd, + pStream); +/* + monoTriangulation2(tempTop, tempBot, + rightChain, + segIndexLarge+1, + rightEnd, + 0, //a decrease chian + pStream); +*/ + + } + + //the possible section which is strictly Umonotone + if(segIndexLarge >= rightStart) + { + stripOfFanRight(rightChain, segIndexLarge, segIndexSmall, grid, gridV, leftU, rightU, pStream, 0); + Real tempBot[2]; + tempBot[0] = grid->get_u_value(leftU); + tempBot[1] = grid->get_v_value(gridV); + monoTriangulation2(topVertex, tempBot, rightChain, rightStart, segIndexSmall, 0, pStream); + } + else //the topVertex forms a fan with the grid points + grid->outputFanWithPoint(gridV, leftU, rightU, topVertex, pStream); +} + +void sampleTopRightWithGridLine(Real* topVertex, + vertexArray* rightChain, + Int rightStart, + Int rightEnd, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream + ) +{ + //if right chian is empty, then there is only one topVertex with one grid line + if(rightEnd < rightStart){ + grid->outputFanWithPoint(gridV, leftU, rightU, topVertex, pStream); + return; + } + + Int segIndexSmall, segIndexLarge; + findTopRightSegment(rightChain, + rightStart, + rightEnd, + grid->get_u_value(rightU), + segIndexSmall, + segIndexLarge + ); + sampleTopRightWithGridLinePost(topVertex, rightChain, + rightStart, + segIndexSmall, + segIndexLarge, + rightEnd, + grid, + gridV, + leftU, + rightU, + pStream); +} + + +void sampleTopLeftWithGridLinePost(Real* topVertex, + vertexArray* leftChain, + Int leftStart, + Int segIndexSmall, + Int segIndexLarge, + Int leftEnd, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream) +{ + //the possible section which is to the left of leftU + + if(segIndexLarge < leftEnd) + { + Real *tempTop; + if(segIndexLarge >= leftStart) + tempTop = leftChain->getVertex(segIndexLarge); + else + tempTop = topVertex; + Real tempBot[2]; + tempBot[0] = grid->get_u_value(leftU); + tempBot[1] = grid->get_v_value(gridV); + + monoTriangulation2(tempTop, tempBot, + leftChain, + segIndexLarge+1, + leftEnd, + 1, //a increase chian + pStream); + } + + //the possible section which is strictly Umonotone + if(segIndexLarge >= leftStart) + { + //if there are grid points which are to the right of topV, + //then we should use topVertex to form a fan with these points to + //optimize the triangualtion + int do_optimize=1; + if(topVertex[0] >= grid->get_u_value(rightU)) + do_optimize = 0; + else + { + //we also have to make sure that topVertex are the right most vertex + //on the chain. + int i; + for(i=leftStart; i<=segIndexSmall; i++) + if(leftChain->getVertex(i)[0] >= topVertex[0]) + { + do_optimize = 0; + break; + } + } + + if(do_optimize) + { + //find midU so that grid->get_u_value(midU) >= topVertex[0] + //and grid->get_u_value(midU-1) < topVertex[0] + int midU=rightU; + while(grid->get_u_value(midU) >= topVertex[0]) + { + midU--; + if(midU < leftU) + break; + } + midU++; + + grid->outputFanWithPoint(gridV, midU, rightU, topVertex, pStream); + stripOfFanLeft(leftChain, segIndexLarge, segIndexSmall, grid, gridV, leftU, midU, pStream, 0); + Real tempBot[2]; + tempBot[0] = grid->get_u_value(midU); + tempBot[1] = grid->get_v_value(gridV); + monoTriangulation2(topVertex, tempBot, leftChain, leftStart, segIndexSmall, 1, pStream); + } + else //not optimize + { + + stripOfFanLeft(leftChain, segIndexLarge, segIndexSmall, grid, gridV, leftU, rightU, pStream, 0); + Real tempBot[2]; + tempBot[0] = grid->get_u_value(rightU); + tempBot[1] = grid->get_v_value(gridV); + monoTriangulation2(topVertex, tempBot, leftChain, leftStart, segIndexSmall, 1, pStream); + } + } + else //the topVertex forms a fan with the grid points + grid->outputFanWithPoint(gridV, leftU, rightU, topVertex, pStream); +} + + +void sampleTopLeftWithGridLine(Real* topVertex, + vertexArray* leftChain, + Int leftStart, + Int leftEnd, + gridWrap* grid, + Int gridV, + Int leftU, + Int rightU, + primStream* pStream + ) +{ + Int segIndexSmall, segIndexLarge; + //if left chain is empty, then there is only one top vertex with one grid + // line + if(leftEnd < leftStart) { + grid->outputFanWithPoint(gridV, leftU, rightU, topVertex, pStream); + return; + } + findTopLeftSegment(leftChain, + leftStart, + leftEnd, + grid->get_u_value(leftU), + segIndexSmall, + segIndexLarge + ); + sampleTopLeftWithGridLinePost(topVertex, + leftChain, + leftStart, + segIndexSmall, + segIndexLarge, + leftEnd, + grid, + gridV, + leftU, + rightU, + pStream); +} + + +//return 1 if saprator exits, 0 otherwise +Int findTopSeparator(vertexArray* leftChain, + Int leftStartIndex, + Int leftEndIndex, + vertexArray* rightChain, + Int rightStartIndex, + Int rightEndIndex, + Int& ret_sep_left, + Int& ret_sep_right) +{ + + Int oldLeftI, oldRightI, newLeftI, newRightI; + Int i,j,k; + Real leftMax /*= leftChain->getVertex(leftEndIndex)[0]*/; + Real rightMin /*= rightChain->getVertex(rightEndIndex)[0]*/; + if(leftChain->getVertex(leftEndIndex)[1] > rightChain->getVertex(rightEndIndex)[1]) //left higher + { + oldLeftI = leftEndIndex+1; + oldRightI = rightEndIndex; + leftMax = leftChain->getVertex(leftEndIndex)[0] - Real(1.0); //initilza to left of leftU + rightMin = rightChain->getVertex(rightEndIndex)[0]; + } + else + { + oldLeftI = leftEndIndex; + oldRightI = rightEndIndex+1; + leftMax = leftChain->getVertex(leftEndIndex)[0]; + rightMin = rightChain->getVertex(rightEndIndex)[0] + Real(1.0); + } + + //i: the current working leftChain index, + //j: the current working rightChain index, + //if left(i) is higher than right(j), then the two chains beloew right(j) are separated. + //else the two chains below left(i) are separeated. + i=leftEndIndex; + j=rightEndIndex; + while(1) + { + newLeftI = oldLeftI; + newRightI = oldRightI; + + if(i= rightStartIndex; k--) + { + if(rightChain->getVertex(k)[0] > leftMax) //no conflict + { + //update oldRightI if necessary + if(rightChain->getVertex(k)[0] < rightMin) + { + rightMin = rightChain->getVertex(k)[0]; + oldRightI = k; + } + } + else //there is a conflict + break; //the for-loop. below right(k-1) is seperated: oldLeftI, oldRightI. + } + break; //the while loop + } + else if(j= leftStartIndex; k--) + { + if(leftChain->getVertex(k)[0] < rightMin) //no conflict + { + //update oldLeftI if necessary + if(leftChain->getVertex(k)[0] > leftMax) + { + leftMax = leftChain->getVertex(k)[0]; + oldLeftI = k; + } + } + else //there is a conflict + break; //the for loop + } + break; //the while loop + } + else if(leftChain->getVertex(i)[1] > rightChain->getVertex(j)[1]) //left hgiher + { + if(leftChain->getVertex(i)[0] > leftMax) //update leftMax and newLeftI. + { + leftMax = leftChain->getVertex(i)[0]; + newLeftI = i; + } + for(k=j-1; k>= rightStartIndex; k--) //update rightMin and newRightI. + { + if(rightChain->getVertex(k)[1] > leftChain->getVertex(i)[1]) + break; + if(rightChain->getVertex(k)[0] < rightMin) + { + rightMin = rightChain->getVertex(k)[0]; + newRightI = k; + } + } + j = k; //next working j, since j will be higher than i in next loop + if(leftMax >= rightMin) //there is a conflict + break; + else //still no conflict + { + oldLeftI = newLeftI; + oldRightI = newRightI; + } + } + else //right higher + { + if(rightChain->getVertex(j)[0] < rightMin) + { + rightMin = rightChain->getVertex(j)[0]; + newRightI = j; + } + for(k=i-1; k>= leftStartIndex; k--) + { + if(leftChain->getVertex(k)[1] > rightChain->getVertex(j)[1]) + break; + if(leftChain->getVertex(k)[0] > leftMax) + { + leftMax = leftChain->getVertex(k)[0]; + newLeftI = k; + } + } + i = k; //next working i, since i will be higher than j next loop + + if(leftMax >= rightMin) //there is a conflict + break; + else //still no conflict + { + oldLeftI = newLeftI; + oldRightI = newRightI; + } + } + }//end of while loop + //now oldLeftI and oldRightI are the desired separeator index, notice that there are not necessarily valid + if(oldLeftI > leftEndIndex || oldRightI > rightEndIndex) + return 0; + else + { + ret_sep_left = oldLeftI; + ret_sep_right = oldRightI; + return 1; + } +} + + +void sampleCompTop(Real* topVertex, + vertexArray* leftChain, + Int leftStartIndex, + vertexArray* rightChain, + Int rightStartIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex1, + Int up_leftCornerWhere, + Int up_leftCornerIndex, + Int up_rightCornerWhere, + Int up_rightCornerIndex, + primStream* pStream) +{ + if(up_leftCornerWhere == 1 && up_rightCornerWhere == 1) //the top is topVertex with possible grid points + { + leftGridChain->getGrid()->outputFanWithPoint(leftGridChain->getVlineIndex(gridIndex1), + leftGridChain->getUlineIndex(gridIndex1), + rightGridChain->getUlineIndex(gridIndex1), + topVertex, + pStream); + return; + } + + else if(up_leftCornerWhere != 0) + { + Real* tempTop; + Int tempRightStart; + if(up_leftCornerWhere == 1){ + tempRightStart = rightStartIndex; + tempTop = topVertex; + } + else + { + tempRightStart = up_leftCornerIndex+1; + tempTop = rightChain->getVertex(up_leftCornerIndex); + } + sampleTopRightWithGridLine(tempTop, rightChain, tempRightStart, up_rightCornerIndex, + rightGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex1), + leftGridChain->getUlineIndex(gridIndex1), + rightGridChain->getUlineIndex(gridIndex1), + pStream); + } + else if(up_rightCornerWhere != 2) + { + Real* tempTop; + Int tempLeftStart; + if(up_rightCornerWhere == 1) + { + tempLeftStart = leftStartIndex; + tempTop = topVertex; + } + else //0 + { + tempLeftStart = up_rightCornerIndex+1; + tempTop = leftChain->getVertex(up_rightCornerIndex); + } +/* + sampleTopLeftWithGridLine(tempTop, leftChain, tempLeftStart, up_leftCornerIndex, + leftGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex1), + leftGridChain->getUlineIndex(gridIndex1), + rightGridChain->getUlineIndex(gridIndex1), + pStream); +*/ + sampleCompTopSimple(topVertex, + leftChain, + leftStartIndex, + rightChain, + rightStartIndex, + leftGridChain, + rightGridChain, + gridIndex1, + up_leftCornerWhere, + up_leftCornerIndex, + up_rightCornerWhere, + up_rightCornerIndex, + pStream); + } + else //up_leftCornerWhere == 0, up_rightCornerWhere == 2. + { + sampleCompTopSimple(topVertex, + leftChain, + leftStartIndex, + rightChain, + rightStartIndex, + leftGridChain, + rightGridChain, + gridIndex1, + up_leftCornerWhere, + up_leftCornerIndex, + up_rightCornerWhere, + up_rightCornerIndex, + pStream); + return; +#ifdef NOT_REACHABLE //code is not reachable, for test purpose only + //the following code is trying to do some optimization, but not quite working, also see sampleCompBot.C: + Int sep_left, sep_right; + if(findTopSeparator(leftChain, + leftStartIndex, + up_leftCornerIndex, + rightChain, + rightStartIndex, + up_rightCornerIndex, + sep_left, + sep_right) + ) //separator exists + { + + if( leftChain->getVertex(sep_left)[0] >= leftGridChain->get_u_value(gridIndex1) && + rightChain->getVertex(sep_right)[0] <= rightGridChain->get_u_value(gridIndex1)) + { + Int gridSep; + Int segLeftSmall, segLeftLarge, segRightSmall, segRightLarge; + Int valid=1; //whether the gridStep is valid or not. + findTopLeftSegment(leftChain, + sep_left, + up_leftCornerIndex, + leftGridChain->get_u_value(gridIndex1), + segLeftSmall, + segLeftLarge); + findTopRightSegment(rightChain, + sep_right, + up_rightCornerIndex, + rightGridChain->get_u_value(gridIndex1), + segRightSmall, + segRightLarge); + if(leftChain->getVertex(segLeftSmall)[1] >= rightChain->getVertex(segRightSmall)[1]) + { + gridSep = rightGridChain->getUlineIndex(gridIndex1); + while(leftGridChain->getGrid()->get_u_value(gridSep) > leftChain->getVertex(segLeftSmall)[0]) + gridSep--; + if(segLeftSmallgetGrid()->get_u_value(gridSep) < leftChain->getVertex(segLeftSmall+1)[0]) + { + valid = 0; + } + } + else + { + gridSep = leftGridChain->getUlineIndex(gridIndex1); + while(leftGridChain->getGrid()->get_u_value(gridSep) < rightChain->getVertex(segRightSmall)[0]) + gridSep++; + if(segRightSmallgetGrid()->get_u_value(gridSep) > rightChain->getVertex(segRightSmall+1)[0]) + { + valid = 0; + } + } + + if(! valid) + { + sampleCompTopSimple(topVertex, + leftChain, + leftStartIndex, + rightChain, + rightStartIndex, + leftGridChain, + rightGridChain, + gridIndex1, + up_leftCornerWhere, + up_leftCornerIndex, + up_rightCornerWhere, + up_rightCornerIndex, + pStream); + } + else + { + sampleTopLeftWithGridLinePost(leftChain->getVertex(segLeftSmall), + leftChain, + segLeftSmall+1, + segLeftSmall+1, + segLeftLarge, + up_leftCornerIndex, + leftGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex1), + leftGridChain->getUlineIndex(gridIndex1), + gridSep, + pStream); + sampleTopRightWithGridLinePost(rightChain->getVertex(segRightSmall), + rightChain, + segRightSmall+1, + segRightSmall+1, + segRightLarge, + up_rightCornerIndex, + leftGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex1), + gridSep, + rightGridChain->getUlineIndex(gridIndex1), + pStream); + Real tempBot[2]; + tempBot[0] = leftGridChain->getGrid()->get_u_value(gridSep); + tempBot[1] = leftGridChain->get_v_value(gridIndex1); + monoTriangulationRecGen(topVertex, tempBot, + leftChain, leftStartIndex, segLeftSmall, + rightChain, rightStartIndex, segRightSmall, + pStream); + } + }//end if both sides have vetices inside the gridboundary points + else if(leftChain->getVertex(sep_left)[0] >= leftGridChain->get_u_value(gridIndex1)) //left is in, right is nout + { + + Int segLeftSmall, segLeftLarge; + findTopLeftSegment(leftChain, + sep_left, + up_leftCornerIndex, + leftGridChain->get_u_value(gridIndex1), + segLeftSmall, + segLeftLarge); + assert(segLeftLarge >= sep_left); + monoTriangulation2(leftChain->getVertex(segLeftLarge), + leftGridChain->get_vertex(gridIndex1), + leftChain, + segLeftLarge+1, + up_leftCornerIndex, + 1, //a increase chain, + pStream); + + stripOfFanLeft(leftChain, segLeftLarge, segLeftSmall, + leftGridChain->getGrid(), + leftGridChain->getVlineIndex(gridIndex1), + leftGridChain->getUlineIndex(gridIndex1), + rightGridChain->getUlineIndex(gridIndex1), + pStream, 0); + + + monoTriangulationRecGen(topVertex, rightGridChain->get_vertex(gridIndex1), + leftChain, leftStartIndex, segLeftSmall, + rightChain, rightStartIndex, up_rightCornerIndex, + pStream); + }//end left in right out + else if(rightChain->getVertex(sep_right)[0] <= rightGridChain->get_u_value(gridIndex1)) + { + Int segRightSmall, segRightLarge; + findTopRightSegment(rightChain, + sep_right, + up_rightCornerIndex, + rightGridChain->get_u_value(gridIndex1), + segRightSmall, + segRightLarge); + assert(segRightLarge>=sep_right); + monoTriangulation2(rightChain->getVertex(segRightLarge), + rightGridChain->get_vertex(gridIndex1), + rightChain, + segRightLarge+1, + up_rightCornerIndex, + 0, //a decrease chain + pStream); + stripOfFanRight(rightChain, segRightLarge, segRightSmall, + rightGridChain->getGrid(), + rightGridChain->getVlineIndex(gridIndex1), + leftGridChain->getUlineIndex(gridIndex1), + rightGridChain->getUlineIndex(gridIndex1), + pStream, 0); + + + monoTriangulationRecGen(topVertex, leftGridChain->get_vertex(gridIndex1), + leftChain, leftStartIndex, up_leftCornerIndex, + rightChain, rightStartIndex,segRightSmall, + pStream); + + }//end left out rigth in + else //left out , right out + { + + sampleCompTopSimple(topVertex, + leftChain, + leftStartIndex, + rightChain, + rightStartIndex, + leftGridChain, + rightGridChain, + gridIndex1, + up_leftCornerWhere, + up_leftCornerIndex, + up_rightCornerWhere, + up_rightCornerIndex, + pStream); + }//end leftout, right out + }//end if separator exixts. + else //no separator + { + + sampleCompTopSimple(topVertex, + leftChain, + leftStartIndex, + rightChain, + rightStartIndex, + leftGridChain, + rightGridChain, + gridIndex1, + up_leftCornerWhere, + up_leftCornerIndex, + up_rightCornerWhere, + up_rightCornerIndex, + pStream); + } +#endif + }//end if 0,2 +}//end if the function + + +static void sampleCompTopSimpleOpt(gridWrap* grid, + Int gridV, + Real* topVertex, Real* botVertex, + vertexArray* inc_chain, Int inc_current, Int inc_end, + vertexArray* dec_chain, Int dec_current, Int dec_end, + primStream* pStream) +{ + if(gridV <= 0 || dec_endget_v_value(gridV+1) >= topVertex[1]) + { + monoTriangulationRecGenOpt(topVertex, botVertex, + inc_chain, inc_current, inc_end, + dec_chain, dec_current, dec_end, + pStream); + return; + } + Int i,j,k; + Real currentV = grid->get_v_value(gridV+1); + if(inc_chain->getVertex(inc_end)[1] <= currentV && + dec_chain->getVertex(dec_end)[1] < currentV) + { + //find i bottom up so that inc_chain[i]<= curentV and inc_chain[i-1] > currentV, + //find j botom up so that dec_chain[j] < currentV and dec_chain[j-1] >= currentV + for(i=inc_end; i >= inc_current; i--) + { + if(inc_chain->getVertex(i)[1] > currentV) + break; + } + i++; + for(j=dec_end; j >= dec_current; j--) + { + if(dec_chain->getVertex(j)[1] >= currentV) + break; + } + j++; + if(inc_chain->getVertex(i)[1] <= dec_chain->getVertex(j)[1]) + { + //find the k so that dec_chain[k][1] < inc_chain[i][1] + for(k=j; k<=dec_end; k++) + { + if(dec_chain->getVertex(k)[1] < inc_chain->getVertex(i)[1]) + break; + } + //we know that dec_chain[j][1] >= inc_chian[i][1] + //we know that dec_chain[k-1][1]>=inc_chain[i][1] + //we know that dec_chian[k][1] < inc_chain[i][1] + //find l in [j, k-1] so that dec_chain[l][0] 0 is closest to + // inc_chain[i] + int l; + Real tempI = Real(j); + Real tempMin = (Real)fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]); + for(l=j+1; l<= k-1; l++) + { + if(fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(l)[0]) + <= tempMin) + { + tempMin = (Real)fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(l)[0]); + tempI = (Real)l; + } + } + //inc_chain[i] and dec_chain[tempI] are connected. + monoTriangulationRecGenOpt(dec_chain->getVertex((int)tempI), + botVertex, + inc_chain, i, inc_end, + dec_chain, (int)(tempI+1), dec_end, + pStream); + //recursively do the rest + sampleCompTopSimpleOpt(grid, + gridV+1, + topVertex, inc_chain->getVertex(i), + inc_chain, inc_current, i-1, + dec_chain, dec_current, (int)tempI, + pStream); + } + else + { + //find the k so that inc_chain[k][1] <= dec_chain[j][1] + for(k=i; k<=inc_end; k++) + { + if(inc_chain->getVertex(k)[1] <= dec_chain->getVertex(j)[1]) + break; + } + //we know that inc_chain[i] > dec_chain[j] + //we know that inc_chain[k-1][1] > dec_chain[j][1] + //we know that inc_chain[k][1] <= dec_chain[j][1] + //so we find l between [i,k-1] so that + //inc_chain[l][0] is the closet to dec_chain[j][0] + int tempI = i; + int l; + Real tempMin = (Real)fabs(inc_chain->getVertex(i)[0] - dec_chain->getVertex(j)[0]); + for(l=i+1; l<=k-1; l++) + { + if(fabs(inc_chain->getVertex(l)[0] - dec_chain->getVertex(j)[0]) <= tempMin) + { + tempMin = (Real)fabs(inc_chain->getVertex(l)[0] - dec_chain->getVertex(j)[0]); + tempI = l; + } + } + + //inc_chain[tempI] and dec_chain[j] are connected + + monoTriangulationRecGenOpt(inc_chain->getVertex(tempI), + botVertex, + inc_chain, tempI+1, inc_end, + dec_chain, j, dec_end, + pStream); + + //recurvesily do the rest + sampleCompTopSimpleOpt(grid, gridV+1, + topVertex, dec_chain->getVertex(j), + inc_chain, inc_current, tempI, + dec_chain, dec_current, j-1, + pStream); + } + } + else //go to the next higher gridV + { + sampleCompTopSimpleOpt(grid, + gridV+1, + topVertex, botVertex, + inc_chain, inc_current, inc_end, + dec_chain, dec_current, dec_end, + pStream); + } +} + +void sampleCompTopSimple(Real* topVertex, + vertexArray* leftChain, + Int leftStartIndex, + vertexArray* rightChain, + Int rightStartIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex1, + Int up_leftCornerWhere, + Int up_leftCornerIndex, + Int up_rightCornerWhere, + Int up_rightCornerIndex, + primStream* pStream) +{ + //the plan is to use monotriangulation algortihm. + Int i,k; + Real* ActualTop; + Real* ActualBot; + Int ActualLeftStart, ActualLeftEnd; + Int ActualRightStart, ActualRightEnd; + + //creat an array to store the points on the grid line + gridWrap* grid = leftGridChain->getGrid(); + Int gridV = leftGridChain->getVlineIndex(gridIndex1); + Int gridLeftU = leftGridChain->getUlineIndex(gridIndex1); + Int gridRightU = rightGridChain->getUlineIndex(gridIndex1); + + Real2* gridPoints = (Real2*) malloc(sizeof(Real2) * (gridRightU - gridLeftU +1)); + assert(gridPoints); + + for(k=0, i=gridRightU; i>= gridLeftU; i--, k++) + { + gridPoints[k][0] = grid->get_u_value(i); + gridPoints[k][1] = grid->get_v_value(gridV); + } + + if(up_leftCornerWhere != 2) + ActualRightStart = rightStartIndex; + else + ActualRightStart = up_leftCornerIndex+1; //up_leftCornerIndex will be the ActualTop + + if(up_rightCornerWhere != 2) //right corner is not on right chain + ActualRightEnd = rightStartIndex-1; //meaning that there is no actual rigth section + else + ActualRightEnd = up_rightCornerIndex; + + vertexArray ActualRightChain(max(0, ActualRightEnd-ActualRightStart+1) + gridRightU-gridLeftU+1); + + for(i=ActualRightStart; i<= ActualRightEnd; i++) + ActualRightChain.appendVertex(rightChain->getVertex(i)); + for(i=0; igetVertex(up_rightCornerIndex); + else + ActualTop = topVertex; + } + else if(up_leftCornerWhere == 1) + ActualTop = topVertex; + else //up_leftCornerWhere == 2 + ActualTop = rightChain->getVertex(up_leftCornerIndex); + + ActualBot = gridPoints[gridRightU - gridLeftU]; + + + + + if(leftChain->getVertex(ActualLeftEnd)[1] == ActualBot[1]) + { +/* + monoTriangulationRecGenOpt(ActualTop, leftChain->getVertex(ActualLeftEnd), + leftChain, + ActualLeftStart, ActualLeftEnd-1, + &ActualRightChain, + 0, + ActualRightChain.getNumElements()-1, + pStream); +*/ + + sampleCompTopSimpleOpt(grid, gridV, + ActualTop, leftChain->getVertex(ActualLeftEnd), + leftChain, + ActualLeftStart, ActualLeftEnd-1, + &ActualRightChain, + 0, + ActualRightChain.getNumElements()-1, + pStream); + + } + else + { +/* + monoTriangulationRecGenOpt(ActualTop, ActualBot, leftChain, + ActualLeftStart, ActualLeftEnd, + &ActualRightChain, + 0, ActualRightChain.getNumElements()-2, //the last is the bot. + pStream); +*/ + + sampleCompTopSimpleOpt(grid, gridV, + ActualTop, ActualBot, leftChain, + ActualLeftStart, ActualLeftEnd, + &ActualRightChain, + 0, ActualRightChain.getNumElements()-2, //the last is the bot. + pStream); + + + } + + free(gridPoints); + +} + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.h new file mode 100644 index 000000000..95598d63a --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleCompTop.h @@ -0,0 +1,67 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _SAMPLECOMPTOP_H +#define _SAMPLECOMPTOP_H + +#include "sampleMonoPoly.h" + +void sampleCompTop(Real* topVertex, + vertexArray* leftChain, + Int leftStartIndex, + vertexArray* rightChain, + Int rightStartIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex1, + Int up_leftCornerWhere, + Int up_leftCornerIndex, + Int up_rightCornerWhere, + Int up_rightCornerIndex, + primStream* pStream); + +void sampleCompTopSimple(Real* topVertex, + vertexArray* leftChain, + Int leftStartIndex, + vertexArray* rightChain, + Int rightStartIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex1, + Int up_leftCornerWhere, + Int up_leftCornerIndex, + Int up_rightCornerWhere, + Int up_rightCornerIndex, + primStream* pStream); + +#endif + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc new file mode 100644 index 000000000..051f24108 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.cc @@ -0,0 +1,2427 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include "gluos.h" +#include +#include +#include + +#ifndef max +#define max(a,b) ((a>b)? a:b) +#endif +#ifndef min +#define min(a,b) ((a>b)? b:a) +#endif + +#include + +#include "glimports.h" +#include "zlassert.h" +#include "sampleMonoPoly.h" +#include "sampleComp.h" +#include "polyDBG.h" +#include "partitionX.h" + + +#define ZERO 0.00001 + +//#define MYDEBUG + +//#define SHORTEN_GRID_LINE +//see work/newtess/internal/test/problems + + +/*split a polygon so that each vertex correcpond to one edge + *the head of the first edge of the returned plygon must be the head of the first + *edge of the origianl polygon. This is crucial for the code in sampleMonoPoly function + */ + directedLine* polygonConvert(directedLine* polygon) +{ + int i; + directedLine* ret; + sampledLine* sline; + sline = new sampledLine(2); + sline->setPoint(0, polygon->getVertex(0)); + sline->setPoint(1, polygon->getVertex(1)); + ret=new directedLine(INCREASING, sline); + for(i=1; i<= polygon->get_npoints()-2; i++) + { + sline = new sampledLine(2); + sline->setPoint(0, polygon->getVertex(i)); + sline->setPoint(1, polygon->getVertex(i+1)); + ret->insert(new directedLine(INCREASING, sline)); + } + + for(directedLine *temp = polygon->getNext(); temp != polygon; temp = temp->getNext()) + { + for(i=0; i<= temp->get_npoints()-2; i++) + { + sline = new sampledLine(2); + sline->setPoint(0, temp->getVertex(i)); + sline->setPoint(1, temp->getVertex(i+1)); + ret->insert(new directedLine(INCREASING, sline)); + } + } + return ret; +} + +void triangulateConvexPolyVertical(directedLine* topV, directedLine* botV, primStream *pStream) +{ + Int i,j; + Int n_leftVerts; + Int n_rightVerts; + Real** leftVerts; + Real** rightVerts; + directedLine* tempV; + n_leftVerts = 0; + for(tempV = topV; tempV != botV; tempV = tempV->getNext()) + { + n_leftVerts += tempV->get_npoints(); + } + n_rightVerts=0; + for(tempV = botV; tempV != topV; tempV = tempV->getNext()) + { + n_rightVerts += tempV->get_npoints(); + } + + Real2* temp_leftVerts = (Real2 *) malloc(sizeof(Real2) * n_leftVerts); + assert(temp_leftVerts); + Real2* temp_rightVerts = (Real2 *) malloc(sizeof(Real2) * n_rightVerts); + assert(temp_rightVerts); + + leftVerts = (Real**) malloc(sizeof(Real2*) * n_leftVerts); + assert(leftVerts); + rightVerts = (Real**) malloc(sizeof(Real2*) * n_rightVerts); + assert(rightVerts); + for(i=0; igetNext()) + { + for(j=1; jget_npoints(); j++) + { + leftVerts[i][0] = tempV->getVertex(j)[0]; + leftVerts[i][1] = tempV->getVertex(j)[1]; + i++; + } + } + n_leftVerts = i; + i=0; + for(tempV = topV->getPrev(); tempV != botV->getPrev(); tempV = tempV->getPrev()) + { + for(j=tempV->get_npoints()-1; j>=1; j--) + { + rightVerts[i][0] = tempV->getVertex(j)[0]; + rightVerts[i][1] = tempV->getVertex(j)[1]; + i++; + } + } + n_rightVerts = i; + triangulateXYMonoTB(n_leftVerts, leftVerts, n_rightVerts, rightVerts, pStream); + free(leftVerts); + free(rightVerts); + free(temp_leftVerts); + free(temp_rightVerts); +} + +void triangulateConvexPolyHoriz(directedLine* leftV, directedLine* rightV, primStream *pStream) +{ + Int i,j; + Int n_lowerVerts; + Int n_upperVerts; + Real2 *lowerVerts; + Real2 *upperVerts; + directedLine* tempV; + n_lowerVerts=0; + for(tempV = leftV; tempV != rightV; tempV = tempV->getNext()) + { + n_lowerVerts += tempV->get_npoints(); + } + n_upperVerts=0; + for(tempV = rightV; tempV != leftV; tempV = tempV->getNext()) + { + n_upperVerts += tempV->get_npoints(); + } + lowerVerts = (Real2 *) malloc(sizeof(Real2) * n_lowerVerts); + assert(n_lowerVerts); + upperVerts = (Real2 *) malloc(sizeof(Real2) * n_upperVerts); + assert(n_upperVerts); + i=0; + for(tempV = leftV; tempV != rightV; tempV = tempV->getNext()) + { + for(j=0; jget_npoints(); j++) + { + lowerVerts[i][0] = tempV->getVertex(j)[0]; + lowerVerts[i][1] = tempV->getVertex(j)[1]; + i++; + } + } + i=0; + for(tempV = leftV->getPrev(); tempV != rightV->getPrev(); tempV = tempV->getPrev()) + { + for(j=tempV->get_npoints()-1; j>=0; j--) + { + upperVerts[i][0] = tempV->getVertex(j)[0]; + upperVerts[i][1] = tempV->getVertex(j)[1]; + i++; + } + } + triangulateXYMono(n_upperVerts, upperVerts, n_lowerVerts, lowerVerts, pStream); + free(lowerVerts); + free(upperVerts); +} +void triangulateConvexPoly(directedLine* polygon, Int ulinear, Int vlinear, primStream* pStream) +{ + /*find left, right, top , bot + */ + directedLine* tempV; + directedLine* topV; + directedLine* botV; + directedLine* leftV; + directedLine* rightV; + topV = botV = polygon; + + for(tempV = polygon->getNext(); tempV != polygon; tempV = tempV->getNext()) + { + if(compV2InY(topV->head(), tempV->head())<0) { + + topV = tempV; + } + if(compV2InY(botV->head(), tempV->head())>0) { + + botV = tempV; + } + } + //find leftV + for(tempV = topV; tempV != botV; tempV = tempV->getNext()) + { + if(tempV->tail()[0] >= tempV->head()[0]) + break; + } + leftV = tempV; + //find rightV + for(tempV = botV; tempV != topV; tempV = tempV->getNext()) + { + if(tempV->tail()[0] <= tempV->head()[0]) + break; + } + rightV = tempV; + if(vlinear) + { + triangulateConvexPolyHoriz( leftV, rightV, pStream); + } + else if(ulinear) + { + triangulateConvexPolyVertical(topV, botV, pStream); + } + else + { + if(DBG_is_U_direction(polygon)) + { + triangulateConvexPolyHoriz( leftV, rightV, pStream); + } + else + triangulateConvexPolyVertical(topV, botV, pStream); + } +} + +/*for debug purpose*/ +void drawCorners( + Real* topV, Real* botV, + vertexArray* leftChain, + vertexArray* rightChain, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex1, + Int gridIndex2, + Int leftCornerWhere, + Int leftCornerIndex, + Int rightCornerWhere, + Int rightCornerIndex, + Int bot_leftCornerWhere, + Int bot_leftCornerIndex, + Int bot_rightCornerWhere, + Int bot_rightCornerIndex) +{ + Real* leftCornerV; + Real* rightCornerV; + Real* bot_leftCornerV; + Real* bot_rightCornerV; + + if(leftCornerWhere == 1) + leftCornerV = topV; + else if(leftCornerWhere == 0) + leftCornerV = leftChain->getVertex(leftCornerIndex); + else + leftCornerV = rightChain->getVertex(leftCornerIndex); + + if(rightCornerWhere == 1) + rightCornerV = topV; + else if(rightCornerWhere == 0) + rightCornerV = leftChain->getVertex(rightCornerIndex); + else + rightCornerV = rightChain->getVertex(rightCornerIndex); + + if(bot_leftCornerWhere == 1) + bot_leftCornerV = botV; + else if(bot_leftCornerWhere == 0) + bot_leftCornerV = leftChain->getVertex(bot_leftCornerIndex); + else + bot_leftCornerV = rightChain->getVertex(bot_leftCornerIndex); + + if(bot_rightCornerWhere == 1) + bot_rightCornerV = botV; + else if(bot_rightCornerWhere == 0) + bot_rightCornerV = leftChain->getVertex(bot_rightCornerIndex); + else + bot_rightCornerV = rightChain->getVertex(bot_rightCornerIndex); + + Real topGridV = leftGridChain->get_v_value(gridIndex1); + Real topGridU1 = leftGridChain->get_u_value(gridIndex1); + Real topGridU2 = rightGridChain->get_u_value(gridIndex1); + Real botGridV = leftGridChain->get_v_value(gridIndex2); + Real botGridU1 = leftGridChain->get_u_value(gridIndex2); + Real botGridU2 = rightGridChain->get_u_value(gridIndex2); + + glBegin(GL_LINE_STRIP); + glVertex2fv(leftCornerV); + glVertex2f(topGridU1, topGridV); + glEnd(); + + glBegin(GL_LINE_STRIP); + glVertex2fv(rightCornerV); + glVertex2f(topGridU2, topGridV); + glEnd(); + + glBegin(GL_LINE_STRIP); + glVertex2fv(bot_leftCornerV); + glVertex2f(botGridU1, botGridV); + glEnd(); + + glBegin(GL_LINE_STRIP); + glVertex2fv(bot_rightCornerV); + glVertex2f(botGridU2, botGridV); + glEnd(); + + +} + +void toVertexArrays(directedLine* topV, directedLine* botV, vertexArray& leftChain, vertexArray& rightChain) +{ + Int i; + directedLine* tempV; + for(i=1; i<=topV->get_npoints()-2; i++) { /*the first vertex is the top vertex which doesn't belong to inc_chain*/ + leftChain.appendVertex(topV->getVertex(i)); + } + for(tempV = topV->getNext(); tempV != botV; tempV = tempV->getNext()) + { + for(i=0; i<=tempV->get_npoints()-2; i++){ + leftChain.appendVertex(tempV->getVertex(i)); + } + } + + for(tempV = topV->getPrev(); tempV != botV; tempV = tempV->getPrev()) + { + for(i=tempV->get_npoints()-2; i>=0; i--){ + rightChain.appendVertex(tempV->getVertex(i)); + } + } + for(i=botV->get_npoints()-2; i>=1; i--){ + rightChain.appendVertex(tempV->getVertex(i)); + } +} + + +void findTopAndBot(directedLine* polygon, directedLine*& topV, directedLine*& botV) +{ + assert(polygon); + directedLine* tempV; + topV = botV = polygon; + for(tempV = polygon->getNext(); tempV != polygon; tempV = tempV->getNext()) + { + if(compV2InY(topV->head(), tempV->head())<0) { + topV = tempV; + } + if(compV2InY(botV->head(), tempV->head())>0) { + botV = tempV; + } + } +} + +void findGridChains(directedLine* topV, directedLine* botV, + gridWrap* grid, + gridBoundaryChain*& leftGridChain, + gridBoundaryChain*& rightGridChain) +{ + /*find the first(top) and the last (bottom) grid line which intersect the + *this polygon + */ + Int firstGridIndex; /*the index in the grid*/ + Int lastGridIndex; + + firstGridIndex = (Int) ((topV->head()[1] - grid->get_v_min()) / (grid->get_v_max() - grid->get_v_min()) * (grid->get_n_vlines()-1)); + + if(botV->head()[1] < grid->get_v_min()) + lastGridIndex = 0; + else + lastGridIndex = (Int) ((botV->head()[1] - grid->get_v_min()) / (grid->get_v_max() - grid->get_v_min()) * (grid->get_n_vlines()-1)) + 1; + + /*find the interval inside the polygon for each gridline*/ + Int *leftGridIndices = (Int*) malloc(sizeof(Int) * (firstGridIndex - lastGridIndex +1)); + assert(leftGridIndices); + Int *rightGridIndices = (Int*) malloc(sizeof(Int) * (firstGridIndex - lastGridIndex +1)); + assert(rightGridIndices); + Int *leftGridInnerIndices = (Int*) malloc(sizeof(Int) * (firstGridIndex - lastGridIndex +1)); + assert(leftGridInnerIndices); + Int *rightGridInnerIndices = (Int*) malloc(sizeof(Int) * (firstGridIndex - lastGridIndex +1)); + assert(rightGridInnerIndices); + + findLeftGridIndices(topV, firstGridIndex, lastGridIndex, grid, leftGridIndices, leftGridInnerIndices); + + findRightGridIndices(topV, firstGridIndex, lastGridIndex, grid, rightGridIndices, rightGridInnerIndices); + + leftGridChain = new gridBoundaryChain(grid, firstGridIndex, firstGridIndex-lastGridIndex+1, leftGridIndices, leftGridInnerIndices); + + rightGridChain = new gridBoundaryChain(grid, firstGridIndex, firstGridIndex-lastGridIndex+1, rightGridIndices, rightGridInnerIndices); + + free(leftGridIndices); + free(rightGridIndices); + free(leftGridInnerIndices); + free(rightGridInnerIndices); +} + +void findDownCorners(Real *botVertex, + vertexArray *leftChain, Int leftChainStartIndex, Int leftChainEndIndex, + vertexArray *rightChain, Int rightChainStartIndex, Int rightChainEndIndex, + Real v, + Real uleft, + Real uright, + Int& ret_leftCornerWhere, /*0: left chain, 1: topvertex, 2: rightchain*/ + Int& ret_leftCornerIndex, /*useful when ret_leftCornerWhere == 0 or 2*/ + Int& ret_rightCornerWhere, /*0: left chain, 1: topvertex, 2: rightchain*/ + Int& ret_rightCornerIndex /*useful when ret_leftCornerWhere == 0 or 2*/ + ) +{ +#ifdef MYDEBUG +printf("*************enter find donw corner\n"); +printf("finddownCorner: v=%f, uleft=%f, uright=%f\n", v, uleft, uright); +printf("(%i,%i,%i,%i)\n", leftChainStartIndex, leftChainEndIndex,rightChainStartIndex, rightChainEndIndex); +printf("left chain is\n"); +leftChain->print(); +printf("right chain is\n"); +rightChain->print(); +#endif + + assert(v > botVertex[1]); + Real leftGridPoint[2]; + leftGridPoint[0] = uleft; + leftGridPoint[1] = v; + Real rightGridPoint[2]; + rightGridPoint[0] = uright; + rightGridPoint[1] = v; + + Int i; + Int index1, index2; + + index1 = leftChain->findIndexBelowGen(v, leftChainStartIndex, leftChainEndIndex); + index2 = rightChain->findIndexBelowGen(v, rightChainStartIndex, rightChainEndIndex); + + if(index2 <= rightChainEndIndex) //index2 was found above + index2 = rightChain->skipEqualityFromStart(v, index2, rightChainEndIndex); + + if(index1>leftChainEndIndex && index2 > rightChainEndIndex) /*no point below v on left chain or right chain*/ + { + + /*the botVertex is the only vertex below v*/ + ret_leftCornerWhere = 1; + ret_rightCornerWhere = 1; + } + else if(index1>leftChainEndIndex ) /*index2 <= rightChainEndIndex*/ + { + + ret_rightCornerWhere = 2; /*on right chain*/ + ret_rightCornerIndex = index2; + + + Real tempMin = rightChain->getVertex(index2)[0]; + Int tempI = index2; + for(i=index2+1; i<= rightChainEndIndex; i++) + if(rightChain->getVertex(i)[0] < tempMin) + { + tempI = i; + tempMin = rightChain->getVertex(i)[0]; + } + + + //we consider whether we can use botVertex as left corner. First check + //if (leftGirdPoint, botVertex) interesects right chian or not. + if(DBG_intersectChain(rightChain, rightChainStartIndex,rightChainEndIndex, + leftGridPoint, botVertex)) + { + ret_leftCornerWhere = 2;//right + ret_leftCornerIndex = index2; //should use tempI??? + } + else if(botVertex[0] < tempMin) + ret_leftCornerWhere = 1; //bot + else + { + ret_leftCornerWhere = 2; //right + ret_leftCornerIndex = tempI; + } + } + else if(index2> rightChainEndIndex) /*index1<=leftChainEndIndex*/ + { + ret_leftCornerWhere = 0; /*left chain*/ + ret_leftCornerIndex = index1; + + /*find the vertex on the left chain with the maximum u, + *either this vertex or the botvertex can be used as the right corner + */ + + Int tempI; + //skip those points which are equal to v. (avoid degeneratcy) + for(tempI = index1; tempI <= leftChainEndIndex; tempI++) + if(leftChain->getVertex(tempI)[1] < v) + break; + if(tempI > leftChainEndIndex) + ret_rightCornerWhere = 1; + else + { + Real tempMax = leftChain->getVertex(tempI)[0]; + for(i=tempI; i<= leftChainEndIndex; i++) + if(leftChain->getVertex(i)[0] > tempMax) + { + tempI = i; + tempMax = leftChain->getVertex(i)[0]; + } + + + + //we consider whether we can use botVertex as a corner. So first we check + //whether (rightGridPoint, botVertex) interescts the left chain or not. + if(DBG_intersectChain(leftChain, leftChainStartIndex,leftChainEndIndex, + rightGridPoint, botVertex)) + { + ret_rightCornerWhere = 0; + ret_rightCornerIndex = index1; //should use tempI??? + } + else if(botVertex[0] > tempMax) + { + + ret_rightCornerWhere = 1; + } + else + { + ret_rightCornerWhere = 0; + ret_rightCornerIndex = tempI; + } + } + + } + else /*index1<=leftChainEndIndex and index2 <=rightChainEndIndex*/ + { + if(leftChain->getVertex(index1)[1] >= rightChain->getVertex(index2)[1]) /*left point above right point*/ + { + ret_leftCornerWhere = 0; /*on left chain*/ + ret_leftCornerIndex = index1; + + Real tempMax; + Int tempI; + + tempI = index1; + tempMax = leftChain->getVertex(index1)[0]; + + /*find the maximum u for all the points on the left above the right point index2*/ + for(i=index1+1; i<= leftChainEndIndex; i++) + { + if(leftChain->getVertex(i)[1] < rightChain->getVertex(index2)[1]) + break; + + if(leftChain->getVertex(i)[0]>tempMax) + { + tempI = i; + tempMax = leftChain->getVertex(i)[0]; + } + } + //we consider if we can use rightChain(index2) as right corner + //we check if (rightChain(index2), rightGidPoint) intersecs left chain or not. + if(DBG_intersectChain(leftChain, leftChainStartIndex,leftChainEndIndex, rightGridPoint, rightChain->getVertex(index2))) + { + ret_rightCornerWhere = 0; + ret_rightCornerIndex = index1; //should use tempI??? + } + else if(tempMax >= rightChain->getVertex(index2)[0] || + tempMax >= uright + ) + { + + ret_rightCornerWhere = 0; /*on left Chain*/ + ret_rightCornerIndex = tempI; + } + else + { + ret_rightCornerWhere = 2; /*on right chain*/ + ret_rightCornerIndex = index2; + } + } + else /*left below right*/ + { + ret_rightCornerWhere = 2; /*on the right*/ + ret_rightCornerIndex = index2; + + Real tempMin; + Int tempI; + + tempI = index2; + tempMin = rightChain->getVertex(index2)[0]; + + /*find the minimum u for all the points on the right above the left poitn index1*/ + for(i=index2+1; i<= rightChainEndIndex; i++) + { + if( rightChain->getVertex(i)[1] < leftChain->getVertex(index1)[1]) + break; + if(rightChain->getVertex(i)[0] < tempMin) + { + tempI = i; + tempMin = rightChain->getVertex(i)[0]; + } + } + + //we consider if we can use leftchain(index1) as left corner. + //we check if (leftChain(index1) intersects right chian or not + if(DBG_intersectChain(rightChain, rightChainStartIndex, rightChainEndIndex, leftGridPoint, leftChain->getVertex(index1))) + { + ret_leftCornerWhere = 2; + ret_leftCornerIndex = index2; //should use tempI??? + } + else if(tempMin <= leftChain->getVertex(index1)[0] || + tempMin <= uleft) + { + ret_leftCornerWhere = 2; /* on right chain*/ + ret_leftCornerIndex = tempI; + } + else + { + ret_leftCornerWhere = 0; /*on left chain*/ + ret_leftCornerIndex = index1; + } + } + } + +} + + +void findUpCorners(Real *topVertex, + vertexArray *leftChain, Int leftChainStartIndex, Int leftChainEndIndex, + vertexArray *rightChain, Int rightChainStartIndex, Int rightChainEndIndex, + Real v, + Real uleft, + Real uright, + Int& ret_leftCornerWhere, /*0: left chain, 1: topvertex, 2: rightchain*/ + Int& ret_leftCornerIndex, /*useful when ret_leftCornerWhere == 0 or 2*/ + Int& ret_rightCornerWhere, /*0: left chain, 1: topvertex, 2: rightchain*/ + Int& ret_rightCornerIndex /*useful when ret_leftCornerWhere == 0 or 2*/ + ) +{ +#ifdef MYDEBUG +printf("***********enter findUpCorners\n"); +#endif + + assert(v < topVertex[1]); + Real leftGridPoint[2]; + leftGridPoint[0] = uleft; + leftGridPoint[1] = v; + Real rightGridPoint[2]; + rightGridPoint[0] = uright; + rightGridPoint[1] = v; + + Int i; + Int index1, index2; + + index1 = leftChain->findIndexFirstAboveEqualGen(v, leftChainStartIndex, leftChainEndIndex); + + + index2 = rightChain->findIndexFirstAboveEqualGen(v, rightChainStartIndex, rightChainEndIndex); + + if(index2>= leftChainStartIndex) //index2 was found above + index2 = rightChain->skipEqualityFromStart(v, index2, rightChainEndIndex); + + if(index1= rightChainStartIndex*/ + { + ret_rightCornerWhere = 2; /*on right chain*/ + ret_rightCornerIndex = index2; + + //find the minimum u on right top, either that, or top, or right[index2] is the left corner + Real tempMin = rightChain->getVertex(index2)[0]; + Int tempI = index2; + for(i=index2-1; i>=rightChainStartIndex; i--) + if(rightChain->getVertex(i)[0] < tempMin) + { + tempMin = rightChain->getVertex(i)[0]; + tempI = i; + } + //chech whether (leftGridPoint, top) intersects rightchai, + //if yes, use right corner as left corner + //if not, use top or right[tempI] as left corner + if(DBG_intersectChain(rightChain, rightChainStartIndex, rightChainEndIndex, + leftGridPoint, topVertex)) + { + ret_leftCornerWhere = 2; //rightChain + ret_leftCornerIndex = index2; + } + else if(topVertex[0] < tempMin) + ret_leftCornerWhere = 1; /*topvertex*/ + else + { + ret_leftCornerWhere = 2; //right chain + ret_leftCornerIndex = tempI; + } + + } + else if(index2< rightChainStartIndex) /*index1>=leftChainStartIndex*/ + { + ret_leftCornerWhere = 0; /*left chain*/ + ret_leftCornerIndex = index1; + + //find the maximum u on the left top section. either that or topvertex, or left[index1] is the right corner + Real tempMax = leftChain->getVertex(index1)[0]; + Int tempI = index1; + + for(i=index1-1; i>=leftChainStartIndex; i--){ + + if(leftChain->getVertex(i)[0] > tempMax) + { + + tempMax = leftChain->getVertex(i)[0]; + tempI = i; + } + } + //check whether (rightGridPoint, top) intersects leftChain or not + //if yes, we use leftCorner as the right corner + //if not, we use either top or left[tempI] as the right corner + if(DBG_intersectChain(leftChain, leftChainStartIndex,leftChainEndIndex, + rightGridPoint, topVertex)) + { + ret_rightCornerWhere = 0; //left chan + ret_rightCornerIndex = index1; + } + else if(topVertex[0] > tempMax) + ret_rightCornerWhere = 1;//topVertex + else + { + ret_rightCornerWhere = 0;//left chain + ret_rightCornerIndex = tempI; + } + } + else /*index1>=leftChainStartIndex and index2 >=rightChainStartIndex*/ + { + if(leftChain->getVertex(index1)[1] <= rightChain->getVertex(index2)[1]) /*left point below right point*/ + { + ret_leftCornerWhere = 0; /*on left chain*/ + ret_leftCornerIndex = index1; + + Real tempMax; + Int tempI; + + tempI = index1; + tempMax = leftChain->getVertex(index1)[0]; + + /*find the maximum u for all the points on the left below the right point index2*/ + for(i=index1-1; i>= leftChainStartIndex; i--) + { + if(leftChain->getVertex(i)[1] > rightChain->getVertex(index2)[1]) + break; + + if(leftChain->getVertex(i)[0]>tempMax) + { + tempI = i; + tempMax = leftChain->getVertex(i)[0]; + } + } + //chek whether (rightChain(index2), rightGridPoint) intersects leftchian or not + if(DBG_intersectChain(leftChain, leftChainStartIndex, leftChainEndIndex, rightGridPoint, rightChain->getVertex(index2))) + { + ret_rightCornerWhere = 0; + ret_rightCornerIndex = index1; + } + else if(tempMax >= rightChain->getVertex(index2)[0] || + tempMax >= uright) + { + ret_rightCornerWhere = 0; /*on left Chain*/ + ret_rightCornerIndex = tempI; + } + else + { + ret_rightCornerWhere = 2; /*on right chain*/ + ret_rightCornerIndex = index2; + } + } + else /*left above right*/ + { + ret_rightCornerWhere = 2; /*on the right*/ + ret_rightCornerIndex = index2; + + Real tempMin; + Int tempI; + + tempI = index2; + tempMin = rightChain->getVertex(index2)[0]; + + /*find the minimum u for all the points on the right below the left poitn index1*/ + for(i=index2-1; i>= rightChainStartIndex; i--) + { + if( rightChain->getVertex(i)[1] > leftChain->getVertex(index1)[1]) + break; + if(rightChain->getVertex(i)[0] < tempMin) + { + tempI = i; + tempMin = rightChain->getVertex(i)[0]; + } + } + //check whether (leftGRidPoint,left(index1)) interesect right chain + if(DBG_intersectChain(rightChain, rightChainStartIndex, rightChainEndIndex, + leftGridPoint, leftChain->getVertex(index1))) + { + ret_leftCornerWhere = 2; //right + ret_leftCornerIndex = index2; + } + else if(tempMin <= leftChain->getVertex(index1)[0] || + tempMin <= uleft) + { + ret_leftCornerWhere = 2; /* on right chain*/ + ret_leftCornerIndex = tempI; + } + else + { + ret_leftCornerWhere = 0; /*on left chain*/ + ret_leftCornerIndex = index1; + } + } + } +#ifdef MYDEBUG +printf("***********leave findUpCorners\n"); +#endif +} + +//return 1 if neck exists, 0 othewise +Int findNeckF(vertexArray *leftChain, Int botLeftIndex, + vertexArray *rightChain, Int botRightIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridStartIndex, + Int& neckLeft, + Int& neckRight) +{ +/* +printf("enter findNeckF, botleft, botright=%i,%i,gstartindex=%i\n",botLeftIndex,botRightIndex,gridStartIndex); +printf("leftChain is\n"); +leftChain->print(); +printf("rightChain is\n"); +rightChain->print(); +*/ + + Int lowerGridIndex; //the grid below leftChain and rightChian vertices + Int i; + Int n_vlines = leftGridChain->get_nVlines(); + Real v; + if(botLeftIndex >= leftChain->getNumElements() || + botRightIndex >= rightChain->getNumElements()) + return 0; //no neck exists + + v=min(leftChain->getVertex(botLeftIndex)[1], rightChain->getVertex(botRightIndex)[1]); + + + + + for(i=gridStartIndex; iget_v_value(i) <= v && + leftGridChain->getUlineIndex(i)<= rightGridChain->getUlineIndex(i)) + break; + + lowerGridIndex = i; + + if(lowerGridIndex == n_vlines) //the two trm vertex are higher than all gridlines + return 0; + else + { + Int botLeft2, botRight2; +/* +printf("leftGridChain->get_v_)value=%f\n",leftGridChain->get_v_value(lowerGridIndex), botLeftIndex); +printf("leftChain->get_vertex(0)=(%f,%f)\n", leftChain->getVertex(0)[0],leftChain->getVertex(0)[1]); +printf("leftChain->get_vertex(1)=(%f,%f)\n", leftChain->getVertex(1)[0],leftChain->getVertex(1)[1]); +printf("leftChain->get_vertex(2)=(%f,%f)\n", leftChain->getVertex(2)[0],leftChain->getVertex(2)[1]); +*/ + botLeft2 = leftChain->findIndexFirstAboveEqualGen(leftGridChain->get_v_value(lowerGridIndex), botLeftIndex, leftChain->getNumElements()-1) -1 ; + +/* +printf("botLeft2=%i\n", botLeft2); +printf("leftChain->getNumElements=%i\n", leftChain->getNumElements()); +*/ + + botRight2 = rightChain->findIndexFirstAboveEqualGen(leftGridChain->get_v_value(lowerGridIndex), botRightIndex, rightChain->getNumElements()-1) -1; + if(botRight2 < botRightIndex) botRight2=botRightIndex; + + if(botLeft2 < botLeftIndex) botLeft2 = botLeftIndex; + + assert(botLeft2 >= botLeftIndex); + assert(botRight2 >= botRightIndex); + //find nectLeft so that it is th erightmost vertex on letChain + + Int tempI = botLeftIndex; + Real temp = leftChain->getVertex(tempI)[0]; + for(i=botLeftIndex+1; i<= botLeft2; i++) + if(leftChain->getVertex(i)[0] > temp) + { + temp = leftChain->getVertex(i)[0]; + tempI = i; + } + neckLeft = tempI; + + tempI = botRightIndex; + temp = rightChain->getVertex(tempI)[0]; + for(i=botRightIndex+1; i<= botRight2; i++) + if(rightChain->getVertex(i)[0] < temp) + { + temp = rightChain->getVertex(i)[0]; + tempI = i; + } + neckRight = tempI; + return 1; + } +} + + + +/*find i>=botLeftIndex,j>=botRightIndex so that + *(leftChain[i], rightChain[j]) is a neck. + */ +void findNeck(vertexArray *leftChain, Int botLeftIndex, + vertexArray *rightChain, Int botRightIndex, + Int& leftLastIndex, /*left point of the neck*/ + Int& rightLastIndex /*right point of the neck*/ + ) +{ + assert(botLeftIndex < leftChain->getNumElements() && + botRightIndex < rightChain->getNumElements()); + + /*now the neck exists for sure*/ + + if(leftChain->getVertex(botLeftIndex)[1] <= rightChain->getVertex(botRightIndex)[1]) //left below right + { + + leftLastIndex = botLeftIndex; + + /*find i so that rightChain[i][1] >= leftchainbotverte[1], and i+1< + */ + rightLastIndex=rightChain->findIndexAboveGen(leftChain->getVertex(botLeftIndex)[1], botRightIndex+1, rightChain->getNumElements()-1); + } + else //left above right + { + + rightLastIndex = botRightIndex; + + leftLastIndex = leftChain->findIndexAboveGen(rightChain->getVertex(botRightIndex)[1], + botLeftIndex+1, + leftChain->getNumElements()-1); + } +} + + + +void findLeftGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap* grid, Int* ret_indices, Int* ret_innerIndices) +{ + + Int i,k,isHoriz = 0; + Int n_ulines = grid->get_n_ulines(); + Real uMin = grid->get_u_min(); + Real uMax = grid->get_u_max(); + /* + Real vMin = grid->get_v_min(); + Real vMax = grid->get_v_max(); + */ + Real slop = 0.0, uinterc; + +#ifdef SHORTEN_GRID_LINE + //uintercBuf stores all the interction u value for each grid line + //notice that lastGridIndex<= firstGridIndex + Real *uintercBuf = (Real *) malloc (sizeof(Real) * (firstGridIndex-lastGridIndex+1)); + assert(uintercBuf); +#endif + + /*initialization to make vtail bigger than grid->...*/ + directedLine* dLine = topEdge; + Real vtail = grid->get_v_value(firstGridIndex) + 1.0; + Real tempMaxU = grid->get_u_min(); + + + /*for each grid line*/ + for(k=0, i=firstGridIndex; i>=lastGridIndex; i--, k++) + { + + Real grid_v_value = grid->get_v_value(i); + + /*check whether this grid line is below the current trim edge.*/ + if(vtail > grid_v_value) + { + /*since the grid line is below the trim edge, we + *find the trim edge which will contain the trim line + */ + while( (vtail=dLine->tail()[1]) > grid_v_value){ + + tempMaxU = max(tempMaxU, dLine->tail()[0]); + dLine = dLine -> getNext(); + } + + if( fabs(dLine->head()[1] - vtail) < ZERO) + isHoriz = 1; + else + { + isHoriz = 0; + slop = (dLine->head()[0] - dLine->tail()[0]) / (dLine->head()[1]-vtail); + } + } + + if(isHoriz) + { + uinterc = max(dLine->head()[0], dLine->tail()[0]); + } + else + { + uinterc = slop * (grid_v_value - vtail) + dLine->tail()[0]; + } + + tempMaxU = max(tempMaxU, uinterc); + + if(uinterc < uMin && uinterc >= uMin - ZERO) + uinterc = uMin; + if(uinterc > uMax && uinterc <= uMax + ZERO) + uinterc = uMax; + +#ifdef SHORTEN_GRID_LINE + uintercBuf[k] = uinterc; +#endif + + assert(uinterc >= uMin && uinterc <= uMax); + if(uinterc == uMax) + ret_indices[k] = n_ulines-1; + else + ret_indices[k] = (Int)(((uinterc-uMin)/(uMax - uMin)) * (n_ulines-1)) + 1; + if(ret_indices[k] >= n_ulines) + ret_indices[k] = n_ulines-1; + + + ret_innerIndices[k] = (Int)(((tempMaxU-uMin)/(uMax - uMin)) * (n_ulines-1)) + 1; + + /*reinitialize tempMaxU for next grdiLine*/ + tempMaxU = uinterc; + } +#ifdef SHORTEN_GRID_LINE + //for each grid line, compare the left grid point with the + //intersection point. If the two points are too close, then + //we should move the grid point one grid to the right + //and accordingly we should update the inner index. + for(k=0, i=firstGridIndex; i>=lastGridIndex; i--, k++) + { + //check gridLine i + //check ret_indices[k] + Real a = grid->get_u_value(ret_indices[k]-1); + Real b = grid->get_u_value(ret_indices[k]); + assert(uintercBuf[k] >= a && uintercBuf < b); + if( (b-uintercBuf[k]) <= 0.2 * (b-a)) //interc is very close to b + { + ret_indices[k]++; + } + + //check ret_innerIndices[k] + if(k>0) + { + if(ret_innerIndices[k] < ret_indices[k-1]) + ret_innerIndices[k] = ret_indices[k-1]; + if(ret_innerIndices[k] < ret_indices[k]) + ret_innerIndices[k] = ret_indices[k]; + } + } + //clean up + free(uintercBuf); +#endif +} + +void findRightGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap* grid, Int* ret_indices, Int* ret_innerIndices) +{ + + Int i,k; + Int n_ulines = grid->get_n_ulines(); + Real uMin = grid->get_u_min(); + Real uMax = grid->get_u_max(); + /* + Real vMin = grid->get_v_min(); + Real vMax = grid->get_v_max(); + */ + Real slop = 0.0, uinterc; + +#ifdef SHORTEN_GRID_LINE + //uintercBuf stores all the interction u value for each grid line + //notice that firstGridIndex >= lastGridIndex + Real *uintercBuf = (Real *) malloc (sizeof(Real) * (firstGridIndex-lastGridIndex+1)); + assert(uintercBuf); +#endif + + /*initialization to make vhead bigger than grid->v_value...*/ + directedLine* dLine = topEdge->getPrev(); + Real vhead = dLine->tail()[1]; + Real tempMinU = grid->get_u_max(); + + /*for each grid line*/ + for(k=0, i=firstGridIndex; i>=lastGridIndex; i--, k++) + { + + Real grid_v_value = grid->get_v_value(i); + + + /*check whether this grid line is below the current trim edge.*/ + if(vhead >= grid_v_value) + { + /*since the grid line is below the tail of the trim edge, we + *find the trim edge which will contain the trim line + */ + while( (vhead=dLine->head()[1]) > grid_v_value){ + tempMinU = min(tempMinU, dLine->head()[0]); + dLine = dLine -> getPrev(); + } + + /*skip the equality in the case of degenerat case: horizontal */ + while(dLine->head()[1] == grid_v_value) + dLine = dLine->getPrev(); + + assert( dLine->tail()[1] != dLine->head()[1]); + slop = (dLine->tail()[0] - dLine->head()[0]) / (dLine->tail()[1]-dLine->head()[1]); + /* + if(dLine->tail()[1] == vhead) + isHoriz = 1; + else + { + isHoriz = 0; + slop = (dLine->tail()[0] - dLine->head()[0]) / (dLine->tail()[1]-vhead); + } + */ + } + uinterc = slop * (grid_v_value - dLine->head()[1]) + dLine->head()[0]; + + //in case unterc is outside of the grid due to floating point + if(uinterc < uMin) + uinterc = uMin; + else if(uinterc > uMax) + uinterc = uMax; + +#ifdef SHORTEN_GRID_LINE + uintercBuf[k] = uinterc; +#endif + + tempMinU = min(tempMinU, uinterc); + + assert(uinterc >= uMin && uinterc <= uMax); + + if(uinterc == uMin) + ret_indices[k] = 0; + else + ret_indices[k] = (int)ceil((((uinterc-uMin)/(uMax - uMin)) * (n_ulines-1))) -1; +/* +if(ret_indices[k] >= grid->get_n_ulines()) + { + printf("ERROR3\n"); + exit(0); +} +if(ret_indices[k] < 0) + { + printf("ERROR4\n"); + exit(0); +} +*/ + ret_innerIndices[k] = (int)ceil ((((tempMinU-uMin)/(uMax - uMin)) * (n_ulines-1))) -1; + + tempMinU = uinterc; + } +#ifdef SHORTEN_GRID_LINE + //for each grid line, compare the left grid point with the + //intersection point. If the two points are too close, then + //we should move the grid point one grid to the right + //and accordingly we should update the inner index. + for(k=0, i=firstGridIndex; i>=lastGridIndex; i--, k++) + { + //check gridLine i + //check ret_indices[k] + Real a = grid->get_u_value(ret_indices[k]); + Real b = grid->get_u_value(ret_indices[k]+1); + assert(uintercBuf[k] > a && uintercBuf <= b); + if( (uintercBuf[k]-a) <= 0.2 * (b-a)) //interc is very close to a + { + ret_indices[k]--; + } + + //check ret_innerIndices[k] + if(k>0) + { + if(ret_innerIndices[k] > ret_indices[k-1]) + ret_innerIndices[k] = ret_indices[k-1]; + if(ret_innerIndices[k] > ret_indices[k]) + ret_innerIndices[k] = ret_indices[k]; + } + } + //clean up + free(uintercBuf); +#endif +} + + +void sampleMonoPoly(directedLine* polygon, gridWrap* grid, Int ulinear, Int vlinear, primStream* pStream, rectBlockArray* rbArray) +{ +/* +{ +grid->print(); +polygon->writeAllPolygons("zloutputFile"); +exit(0); +} +*/ + +if(grid->get_n_ulines() == 2 || + grid->get_n_vlines() == 2) +{ + if(ulinear && grid->get_n_ulines() == 2) + { + monoTriangulationFun(polygon, compV2InY, pStream); + return; + } + else if(DBG_isConvex(polygon) && polygon->numEdges() >=4) + { + triangulateConvexPoly(polygon, ulinear, vlinear, pStream); + return; + } + else if(vlinear || DBG_is_U_direction(polygon)) + { + Int n_cusps;//num interior cusps + Int n_edges = polygon->numEdges(); + directedLine** cusps = (directedLine**) malloc(sizeof(directedLine*) * n_edges); + assert(cusps); + findInteriorCuspsX(polygon, n_cusps, cusps); + + if(n_cusps == 0) //u_monotone + { + + monoTriangulationFun(polygon, compV2InX, pStream); + + free(cusps); + return; + } + else if(n_cusps == 1) //one interior cusp + { + + directedLine* new_polygon = polygonConvert(cusps[0]); + + directedLine* other = findDiagonal_singleCuspX( new_polygon); + + + + // should NOT be null unless there are self-intersecting + //trim curves. In that case, we don't want to core dump, instead, + //we triangulate anyway, and print out error message. + if(other == NULL) + { + monoTriangulationFun(polygon, compV2InX, pStream); + free(cusps); + return; + } + + directedLine* ret_p1; + directedLine* ret_p2; + + new_polygon->connectDiagonal_2slines(new_polygon, other, + &ret_p1, + &ret_p2, + new_polygon); + + monoTriangulationFun(ret_p1, compV2InX, pStream); + monoTriangulationFun(ret_p2, compV2InX, pStream); + + ret_p1->deleteSinglePolygonWithSline(); + ret_p2->deleteSinglePolygonWithSline(); + + free(cusps); + return; + } + free(cusps); + } +} + + /*find the top and bottom of the polygon. It is supposed to be + *a V-monotone polygon + */ + + directedLine* tempV; + directedLine* topV; + directedLine* botV; + topV = botV = polygon; + + for(tempV = polygon->getNext(); tempV != polygon; tempV = tempV->getNext()) + { + if(compV2InY(topV->head(), tempV->head())<0) { + + topV = tempV; + } + if(compV2InY(botV->head(), tempV->head())>0) { + + botV = tempV; + } + } + + /*find the first(top) and the last (bottom) grid line which intersect the + *this polygon + */ + Int firstGridIndex; /*the index in the grid*/ + Int lastGridIndex; + firstGridIndex = (Int) ((topV->head()[1] - grid->get_v_min()) / (grid->get_v_max() - grid->get_v_min()) * (grid->get_n_vlines()-1)); + lastGridIndex = (Int) ((botV->head()[1] - grid->get_v_min()) / (grid->get_v_max() - grid->get_v_min()) * (grid->get_n_vlines()-1)) + 1; + + + /*find the interval inside the polygon for each gridline*/ + Int *leftGridIndices = (Int*) malloc(sizeof(Int) * (firstGridIndex - lastGridIndex +1)); + assert(leftGridIndices); + Int *rightGridIndices = (Int*) malloc(sizeof(Int) * (firstGridIndex - lastGridIndex +1)); + assert(rightGridIndices); + Int *leftGridInnerIndices = (Int*) malloc(sizeof(Int) * (firstGridIndex - lastGridIndex +1)); + assert(leftGridInnerIndices); + Int *rightGridInnerIndices = (Int*) malloc(sizeof(Int) * (firstGridIndex - lastGridIndex +1)); + assert(rightGridInnerIndices); + + findLeftGridIndices(topV, firstGridIndex, lastGridIndex, grid, leftGridIndices, leftGridInnerIndices); + + findRightGridIndices(topV, firstGridIndex, lastGridIndex, grid, rightGridIndices, rightGridInnerIndices); + + gridBoundaryChain leftGridChain(grid, firstGridIndex, firstGridIndex-lastGridIndex+1, leftGridIndices, leftGridInnerIndices); + + gridBoundaryChain rightGridChain(grid, firstGridIndex, firstGridIndex-lastGridIndex+1, rightGridIndices, rightGridInnerIndices); + + + +// leftGridChain.draw(); +// leftGridChain.drawInner(); +// rightGridChain.draw(); +// rightGridChain.drawInner(); + /*(1) determine the grid boundaries (left and right). + *(2) process polygon into two monotone chaines: use vertexArray + *(3) call sampleMonoPolyRec + */ + + /*copy the two chains into vertexArray datastructure*/ + Int i; + vertexArray leftChain(20); /*this is a dynamic array*/ + for(i=1; i<=topV->get_npoints()-2; i++) { /*the first vertex is the top vertex which doesn't belong to inc_chain*/ + leftChain.appendVertex(topV->getVertex(i)); + } + for(tempV = topV->getNext(); tempV != botV; tempV = tempV->getNext()) + { + for(i=0; i<=tempV->get_npoints()-2; i++){ + leftChain.appendVertex(tempV->getVertex(i)); + } + } + + vertexArray rightChain(20); + for(tempV = topV->getPrev(); tempV != botV; tempV = tempV->getPrev()) + { + for(i=tempV->get_npoints()-2; i>=0; i--){ + rightChain.appendVertex(tempV->getVertex(i)); + } + } + for(i=botV->get_npoints()-2; i>=1; i--){ + rightChain.appendVertex(tempV->getVertex(i)); + } + + sampleMonoPolyRec(topV->head(), + botV->head(), + &leftChain, + 0, + &rightChain, + 0, + &leftGridChain, + &rightGridChain, + 0, + pStream, + rbArray); + + + /*cleanup space*/ + free(leftGridIndices); + free(rightGridIndices); + free(leftGridInnerIndices); + free(rightGridInnerIndices); +} + +void sampleMonoPolyRec( + Real* topVertex, + Real* botVertex, + vertexArray* leftChain, + Int leftStartIndex, + vertexArray* rightChain, + Int rightStartIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridStartIndex, + primStream* pStream, + rectBlockArray* rbArray) +{ + + /*find the first connected component, and the four corners. + */ + Int index1, index2; /*the first and last grid line of the first connected component*/ + + if(topVertex[1] <= botVertex[1]) + return; + + /*find i so that the grid line is below the top vertex*/ + Int i=gridStartIndex; + while (i < leftGridChain->get_nVlines()) + { + if(leftGridChain->get_v_value(i) < topVertex[1]) + break; + i++; + } + + /*find the first connected component starting with i*/ + /*find index1 so that left_uline_index <= right_uline_index, that is, this + *grid line contains at least one inner grid point + */ + index1=i; + int num_skipped_grid_lines=0; + while(index1 < leftGridChain->get_nVlines()) + { + if(leftGridChain->getUlineIndex(index1) <= rightGridChain->getUlineIndex(index1)) + break; + num_skipped_grid_lines++; + index1++; + } + + + + if(index1 >= leftGridChain->get_nVlines()) /*no grid line exists which has inner point*/ + { + /*stop recursion, ...*/ + /*monotone triangulate it...*/ +// printf("no grid line exists\n"); +/* + monoTriangulationRecOpt(topVertex, botVertex, leftChain, leftStartIndex, + rightChain, rightStartIndex, pStream); +*/ + +if(num_skipped_grid_lines <2) + { + monoTriangulationRecGenOpt(topVertex, botVertex, leftChain, leftStartIndex, + leftChain->getNumElements()-1, + rightChain, rightStartIndex, + rightChain->getNumElements()-1, + pStream); + } +else + { + //the optimum way to triangulate is top-down since this polygon + //is narrow-long. + monoTriangulationRec(topVertex, botVertex, leftChain, leftStartIndex, + rightChain, rightStartIndex, pStream); + } + +/* + monoTriangulationRec(topVertex, botVertex, leftChain, leftStartIndex, + rightChain, rightStartIndex, pStream); +*/ + +/* monoTriangulationRecGenTBOpt(topVertex, botVertex, + leftChain, leftStartIndex, leftChain->getNumElements()-1, + rightChain, rightStartIndex, rightChain->getNumElements()-1, + pStream);*/ + + + + } + else + { + + /*find index2 so that left_inner_index <= right_inner_index holds until index2*/ + index2=index1+1; + if(index2 < leftGridChain->get_nVlines()) + while(leftGridChain->getInnerIndex(index2) <= rightGridChain->getInnerIndex(index2)) + { + index2++; + if(index2 >= leftGridChain->get_nVlines()) + break; + } + + index2--; + + + + /*the neck*/ + Int neckLeftIndex; + Int neckRightIndex; + + /*the four corners*/ + Int up_leftCornerWhere; + Int up_leftCornerIndex; + Int up_rightCornerWhere; + Int up_rightCornerIndex; + Int down_leftCornerWhere; + Int down_leftCornerIndex; + Int down_rightCornerWhere; + Int down_rightCornerIndex; + + Real* tempBotVertex; /*the bottom vertex for this component*/ + Real* nextTopVertex=NULL; /*for the recursion*/ + Int nextLeftStartIndex=0; + Int nextRightStartIndex=0; + + /*find the points below the grid line index2 on both chains*/ + Int botLeftIndex = leftChain->findIndexStrictBelowGen( + leftGridChain->get_v_value(index2), + leftStartIndex, + leftChain->getNumElements()-1); + Int botRightIndex = rightChain->findIndexStrictBelowGen( + rightGridChain->get_v_value(index2), + rightStartIndex, + rightChain->getNumElements()-1); + /*if either botLeftIndex>= numelements, + * or botRightIndex >= numelemnet, + *then there is no neck exists. the bottom vertex is botVertex, + */ + if(! findNeckF(leftChain, botLeftIndex, rightChain, botRightIndex, + leftGridChain, rightGridChain, index2, neckLeftIndex, neckRightIndex)) + /* + if(botLeftIndex == leftChain->getNumElements() || + botRightIndex == rightChain->getNumElements()) + */ + { +#ifdef MYDEBUG + printf("neck NOT exists, botRightIndex=%i\n", botRightIndex); +#endif + + tempBotVertex = botVertex; + nextTopVertex = botVertex; + botLeftIndex = leftChain->getNumElements()-1; + botRightIndex = rightChain->getNumElements()-1; + } + else /*neck exists*/ + { +#ifdef MYDEBUG + printf("neck exists\n"); +#endif + + /* + findNeck(leftChain, botLeftIndex, + rightChain, botRightIndex, + neckLeftIndex, + neckRightIndex); + */ +#ifdef MYDEBUG +printf("neck is found, neckLeftIndex=%i, neckRightIndex=%i\n", neckLeftIndex, neckRightIndex); +glBegin(GL_LINES); +glVertex2fv(leftChain->getVertex(neckLeftIndex)); +glVertex2fv(rightChain->getVertex(neckRightIndex)); +glEnd(); +#endif + + if(leftChain->getVertex(neckLeftIndex)[1] <= rightChain->getVertex(neckRightIndex)[1]) + { + tempBotVertex = leftChain->getVertex(neckLeftIndex); + botLeftIndex = neckLeftIndex-1; + botRightIndex = neckRightIndex; + nextTopVertex = rightChain->getVertex(neckRightIndex); + nextLeftStartIndex = neckLeftIndex; + nextRightStartIndex = neckRightIndex+1; + } + else + { + tempBotVertex = rightChain->getVertex(neckRightIndex); + botLeftIndex = neckLeftIndex; + botRightIndex = neckRightIndex-1; + nextTopVertex = leftChain->getVertex(neckLeftIndex); + nextLeftStartIndex = neckLeftIndex+1; + nextRightStartIndex = neckRightIndex; + } + } + + findUpCorners(topVertex, + leftChain, + leftStartIndex, botLeftIndex, + rightChain, + rightStartIndex, botRightIndex, + leftGridChain->get_v_value(index1), + leftGridChain->get_u_value(index1), + rightGridChain->get_u_value(index1), + up_leftCornerWhere, + up_leftCornerIndex, + up_rightCornerWhere, + up_rightCornerIndex); + + findDownCorners(tempBotVertex, + leftChain, + leftStartIndex, botLeftIndex, + rightChain, + rightStartIndex, botRightIndex, + leftGridChain->get_v_value(index2), + leftGridChain->get_u_value(index2), + rightGridChain->get_u_value(index2), + down_leftCornerWhere, + down_leftCornerIndex, + down_rightCornerWhere, + down_rightCornerIndex); +#ifdef MYDEBUG + printf("find corners done, down_leftwhere=%i, down_righwhere=%i,\n",down_leftCornerWhere, down_rightCornerWhere ); + printf("find corners done, up_leftwhere=%i, up_righwhere=%i,\n",up_leftCornerWhere, up_rightCornerWhere ); + printf("find corners done, up_leftindex=%i, up_righindex=%i,\n",up_leftCornerIndex, up_rightCornerIndex ); + printf("find corners done, down_leftindex=%i, down_righindex=%i,\n",down_leftCornerIndex, down_rightCornerIndex ); +#endif + +/* + drawCorners(topVertex, + tempBotVertex, + leftChain, + rightChain, + leftGridChain, + rightGridChain, + index1, + index2, + up_leftCornerWhere, + up_leftCornerIndex, + up_rightCornerWhere, + up_rightCornerIndex, + down_leftCornerWhere, + down_leftCornerIndex, + down_rightCornerWhere, + down_rightCornerIndex); +*/ + + + sampleConnectedComp(topVertex, tempBotVertex, + leftChain, + leftStartIndex, botLeftIndex, + rightChain, + rightStartIndex, botRightIndex, + leftGridChain, + rightGridChain, + index1, index2, + up_leftCornerWhere, + up_leftCornerIndex, + up_rightCornerWhere, + up_rightCornerIndex, + down_leftCornerWhere, + down_leftCornerIndex, + down_rightCornerWhere, + down_rightCornerIndex, + pStream, + rbArray + ); + + /*recursion*/ + + sampleMonoPolyRec( + nextTopVertex, + botVertex, + leftChain, + nextLeftStartIndex, + rightChain, + nextRightStartIndex, + leftGridChain, + rightGridChain, + index2+1, + pStream, rbArray); + + + } + +} + +void sampleLeftStrip(vertexArray* leftChain, + Int topLeftIndex, + Int botLeftIndex, + gridBoundaryChain* leftGridChain, + Int leftGridChainStartIndex, + Int leftGridChainEndIndex, + primStream* pStream + ) +{ + assert(leftChain->getVertex(topLeftIndex)[1] > leftGridChain->get_v_value(leftGridChainStartIndex)); + assert(leftChain->getVertex(topLeftIndex+1)[1] <= leftGridChain->get_v_value(leftGridChainStartIndex)); + assert(leftChain->getVertex(botLeftIndex)[1] <= leftGridChain->get_v_value(leftGridChainEndIndex)); + assert(leftChain->getVertex(botLeftIndex-1)[1] > leftGridChain->get_v_value(leftGridChainEndIndex)); + + /* + *(1)find the last grid line which doesn'; pass below + * this first edge, sample this region: one trim edge and + * possily multiple grid lines. + */ + Real *upperVert, *lowerVert; /*the end points of the first trim edge*/ + upperVert = leftChain->getVertex(topLeftIndex); + lowerVert = leftChain->getVertex(topLeftIndex+1); + + Int index = leftGridChainStartIndex; + while(leftGridChain->get_v_value(index) >= lowerVert[1]){ + index++; + if(index > leftGridChainEndIndex) + break; + } + index--; + + sampleLeftSingleTrimEdgeRegion(upperVert, lowerVert, + leftGridChain, + leftGridChainStartIndex, + index, + pStream); + sampleLeftStripRec(leftChain, topLeftIndex+1, botLeftIndex, + leftGridChain, index, leftGridChainEndIndex, + pStream); + +} + +void sampleLeftStripRec(vertexArray* leftChain, + Int topLeftIndex, + Int botLeftIndex, + gridBoundaryChain* leftGridChain, + Int leftGridChainStartIndex, + Int leftGridChainEndIndex, + primStream* pStream + ) +{ + /*now top left trim vertex is below the top grid line. + */ + /*stop condition: if topLeftIndex >= botLeftIndex, then stop. + */ + if(topLeftIndex >= botLeftIndex) + return; + + /*find the last trim vertex which is above the second top grid line: + * index1. + *and sampleLeftOneGridStep(leftchain, topLeftIndex, index1, leftGridChain, + * leftGridChainStartIndex). + * index1 could be equal to topLeftIndex. + */ + Real secondGridChainV = leftGridChain->get_v_value(leftGridChainStartIndex+1); + assert(leftGridChainStartIndex < leftGridChainEndIndex); + Int index1 = topLeftIndex; + while(leftChain->getVertex(index1)[1] > secondGridChainV) + index1++; + index1--; + + sampleLeftOneGridStep(leftChain, topLeftIndex, index1, leftGridChain, leftGridChainStartIndex, pStream); + + + /* + * Let the next trim vertex be nextTrimVertIndex (which should be + * below the second grid line). + * Find the last grid line index2 which is above nextTrimVert. + * sampleLeftSingleTrimEdgeRegion(uppervert[2], lowervert[2], + * leftGridChain, leftGridChainStartIndex+1, index2). + */ + Real *uppervert, *lowervert; + uppervert = leftChain->getVertex(index1); + lowervert = leftChain->getVertex(index1+1); + Int index2 = leftGridChainStartIndex+1; + + while(leftGridChain->get_v_value(index2) >= lowervert[1]) + { + index2++; + if(index2 > leftGridChainEndIndex) + break; + } + index2--; + sampleLeftSingleTrimEdgeRegion(uppervert, lowervert, leftGridChain, leftGridChainStartIndex+1, index2, pStream); + + /* sampleLeftStripRec(leftChain, + nextTrimVertIndex, + botLeftIndex, + leftGridChain, + index2, + leftGridChainEndIndex + ) + * + */ + sampleLeftStripRec(leftChain, index1+1, botLeftIndex, leftGridChain, index2, leftGridChainEndIndex, pStream); + +} + + +/***************begin RecF***********************/ +/* the gridlines from leftGridChainStartIndex to + * leftGridChainEndIndex are assumed to form a + * connected component. + * the trim vertex of topLeftIndex is assumed to + * be below the first gridline, and the tim vertex + * of botLeftIndex is assumed to be above the last + * grid line. + * If botLeftIndex < topLeftIndex, then no connected componeent exists, and this funcion returns without + * outputing any triangles. + * Otherwise botLeftIndex >= topLeftIndex, there is at least one triangle to output. + */ +void sampleLeftStripRecF(vertexArray* leftChain, + Int topLeftIndex, + Int botLeftIndex, + gridBoundaryChain* leftGridChain, + Int leftGridChainStartIndex, + Int leftGridChainEndIndex, + primStream* pStream + ) +{ + /*now top left trim vertex is below the top grid line. + */ + /*stop condition: if topLeftIndex > botLeftIndex, then stop. + */ + if(topLeftIndex > botLeftIndex) + return; + + /*if there is only one grid Line, return.*/ + + if(leftGridChainStartIndex>=leftGridChainEndIndex) + return; + + + assert(leftChain->getVertex(topLeftIndex)[1] <= leftGridChain->get_v_value(leftGridChainStartIndex) && + leftChain->getVertex(botLeftIndex)[1] >= leftGridChain->get_v_value(leftGridChainEndIndex)); + + /*firs find the first trim vertex which is below or equal to the second top grid line: + * index1. + */ + Real secondGridChainV = leftGridChain->get_v_value(leftGridChainStartIndex+1); + + + Int index1 = topLeftIndex; + + while(leftChain->getVertex(index1)[1] > secondGridChainV){ + index1++; + if(index1>botLeftIndex) + break; + } + + /*now leftChain->getVertex(index-1)[1] > secondGridChainV and + * leftChain->getVertex(index)[1] <= secondGridChainV + *If equality holds, then we should include the vertex index1, otherwise we include only index1-1, to + *perform sampleOneGridStep. + */ + if(index1>botLeftIndex) + index1--; + else if(leftChain->getVertex(index1)[1] < secondGridChainV) + index1--; + + /*now we have leftChain->getVertex(index1)[1] >= secondGridChainV, and + * leftChain->getVertex(index1+1)[1] <= secondGridChainV + */ + + + sampleLeftOneGridStep(leftChain, topLeftIndex, index1, leftGridChain, leftGridChainStartIndex, pStream); + + + /*if leftChain->getVertex(index1)[1] == secondGridChainV, then we can recursively do the rest. + */ + if(leftChain->getVertex(index1)[1] == secondGridChainV) + { + + sampleLeftStripRecF(leftChain, index1, botLeftIndex,leftGridChain, leftGridChainStartIndex+1, leftGridChainEndIndex, pStream); + } + else if(index1 < botLeftIndex) + { + + /* Otherwise, we have leftChain->getVertex(index1)[1] > secondGridChainV, + * let the next trim vertex be nextTrimVertIndex (which should be strictly + * below the second grid line). + * Find the last grid line index2 which is above nextTrimVert. + * sampleLeftSingleTrimEdgeRegion(uppervert[2], lowervert[2], + * leftGridChain, leftGridChainStartIndex+1, index2). + */ + Real *uppervert, *lowervert; + uppervert = leftChain->getVertex(index1); + lowervert = leftChain->getVertex(index1+1); //okay since index1get_v_value(index2) >= lowervert[1]) + { + index2++; + if(index2 > leftGridChainEndIndex) + break; + } + index2--; + + + sampleLeftSingleTrimEdgeRegion(uppervert, lowervert, leftGridChain, leftGridChainStartIndex+1, index2, pStream); + + /*recursion*/ + + sampleLeftStripRecF(leftChain, index1+1, botLeftIndex, leftGridChain, index2, leftGridChainEndIndex, pStream); + } + +} + +/***************End RecF***********************/ + +/*sample the left area in between one trim edge and multiple grid lines. + * all the grid lines should be in between the two end poins of the + *trim edge. + */ +void sampleLeftSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2], + gridBoundaryChain* gridChain, + Int beginIndex, + Int endIndex, + primStream* pStream) +{ + Int i,j,k; + + vertexArray vArray(endIndex-beginIndex+1); + vArray.appendVertex(gridChain->get_vertex(beginIndex)); + + for(k=1, i=beginIndex+1; i<=endIndex; i++, k++) + { + vArray.appendVertex(gridChain->get_vertex(i)); + + /*output the fan of the grid points of the (i)th and (i-1)th grid line. + */ + if(gridChain->getUlineIndex(i) < gridChain->getUlineIndex(i-1)) + { + pStream->begin(); + pStream->insert(gridChain->get_vertex(i-1)); + for(j=gridChain->getUlineIndex(i); j<= gridChain->getUlineIndex(i-1); j++) + pStream->insert(gridChain->getGrid()->get_u_value(j), gridChain->get_v_value(i)); + pStream->end(PRIMITIVE_STREAM_FAN); + } + else if(gridChain->getUlineIndex(i) > gridChain->getUlineIndex(i-1)) + { + pStream->begin(); + pStream->insert(gridChain->get_vertex(i)); + for(j=gridChain->getUlineIndex(i); j>= gridChain->getUlineIndex(i-1); j--) + pStream->insert(gridChain->getGrid()->get_u_value(j), gridChain->get_v_value(i-1)); + pStream->end(PRIMITIVE_STREAM_FAN); + } + /*otherwisem, the two are equal, so there is no fan to outout*/ + } + + monoTriangulation2(upperVert, lowerVert, &vArray, 0, endIndex-beginIndex, + 0, /*decreasing chain*/ + pStream); +} + +/*return i, such that from begin to i-1 the chain is strictly u-monotone. + */ +Int findIncreaseChainFromBegin(vertexArray* chain, Int begin ,Int end) +{ + Int i=begin; + Real prevU = chain->getVertex(i)[0]; + Real thisU; + for(i=begin+1; i<=end; i++){ + thisU = chain->getVertex(i)[0]; + + if(prevU < thisU){ + prevU = thisU; + } + else + break; + } + return i; +} + +/*check whether there is a vertex whose v value is strictly + *inbetween vup vbelow + *if no middle exists return -1, else return the idnex. + */ +Int checkMiddle(vertexArray* chain, Int begin, Int end, + Real vup, Real vbelow) +{ + Int i; + for(i=begin; i<=end; i++) + { + if(chain->getVertex(i)[1] < vup && chain->getVertex(i)[1]>vbelow) + return i; + } + return -1; +} + +/*the degenerat case of sampleLeftOneGridStep*/ +void sampleLeftOneGridStepNoMiddle(vertexArray* leftChain, + Int beginLeftIndex, + Int endLeftIndex, + gridBoundaryChain* leftGridChain, + Int leftGridChainStartIndex, + primStream* pStream) +{ + /*since there is no middle, there is at most one point which is on the + *second grid line, there could be multiple points on the first (top) + *grid line. + */ + + leftGridChain->leftEndFan(leftGridChainStartIndex+1, pStream); + + monoTriangulation2(leftGridChain->get_vertex(leftGridChainStartIndex), + leftGridChain->get_vertex(leftGridChainStartIndex+1), + leftChain, + beginLeftIndex, + endLeftIndex, + 1, //is increase chain. + pStream); +} + + + +/*sampling the left area in between two grid lines. + */ +void sampleLeftOneGridStep(vertexArray* leftChain, + Int beginLeftIndex, + Int endLeftIndex, + gridBoundaryChain* leftGridChain, + Int leftGridChainStartIndex, + primStream* pStream + ) +{ + if(checkMiddle(leftChain, beginLeftIndex, endLeftIndex, + leftGridChain->get_v_value(leftGridChainStartIndex), + leftGridChain->get_v_value(leftGridChainStartIndex+1))<0) + + { + + sampleLeftOneGridStepNoMiddle(leftChain, beginLeftIndex, endLeftIndex, leftGridChain, leftGridChainStartIndex, pStream); + return; + } + + //copy into a polygon + { + directedLine* poly = NULL; + sampledLine* sline; + directedLine* dline; + gridWrap* grid = leftGridChain->getGrid(); + Real vert1[2]; + Real vert2[2]; + Int i; + + Int innerInd = leftGridChain->getInnerIndex(leftGridChainStartIndex+1); + Int upperInd = leftGridChain->getUlineIndex(leftGridChainStartIndex); + Int lowerInd = leftGridChain->getUlineIndex(leftGridChainStartIndex+1); + Real upperV = leftGridChain->get_v_value(leftGridChainStartIndex); + Real lowerV = leftGridChain->get_v_value(leftGridChainStartIndex+1); + + //the upper gridline + vert1[1] = vert2[1] = upperV; + for(i=innerInd; i>upperInd; i--) + { + vert1[0]=grid->get_u_value(i); + vert2[0]=grid->get_u_value(i-1); + sline = new sampledLine(vert1, vert2); + dline = new directedLine(INCREASING, sline); + if(poly == NULL) + poly = dline; + else + poly->insert(dline); + } + + //the edge connecting upper grid with left chain + vert1[0] = grid->get_u_value(upperInd); + vert1[1] = upperV; + sline = new sampledLine(vert1, leftChain->getVertex(beginLeftIndex)); + dline = new directedLine(INCREASING, sline); + if(poly == NULL) + poly = dline; + else + poly->insert(dline); + + //the left chain + for(i=beginLeftIndex; igetVertex(i), leftChain->getVertex(i+1)); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + } + + //the edge connecting left chain with lower gridline + vert2[0] = grid->get_u_value(lowerInd); + vert2[1] = lowerV; + sline = new sampledLine(leftChain->getVertex(endLeftIndex), vert2); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + + //the lower grid line + vert1[1] = vert2[1] = lowerV; + for(i=lowerInd; iget_u_value(i); + vert2[0] = grid->get_u_value(i+1); + sline = new sampledLine(vert1, vert2); + dline = new directedLine(INCREASING, sline); + poly->insert(dline); + } + + //the vertical grid line segement + vert1[0]=vert2[0] = grid->get_u_value(innerInd); + vert2[1]=upperV; + vert1[1]=lowerV; + sline=new sampledLine(vert1, vert2); + dline=new directedLine(INCREASING, sline); + poly->insert(dline); + monoTriangulationOpt(poly, pStream); + //cleanup + poly->deleteSinglePolygonWithSline(); + return; + } + + + + + + Int i; + if(1/*leftGridChain->getUlineIndex(leftGridChainStartIndex) >= + leftGridChain->getUlineIndex(leftGridChainStartIndex+1)*/ + ) /*the second grid line is beyond the first one to the left*/ + { + /*find the maximal U-monotone chain + * of endLeftIndex, endLeftIndex-1, ..., + */ + i=endLeftIndex; + Real prevU = leftChain->getVertex(i)[0]; + for(i=endLeftIndex-1; i>=beginLeftIndex; i--){ + Real thisU = leftChain->getVertex(i)[0]; + if( prevU < thisU){ + prevU = thisU; + } + else + break; + } + /*from endLeftIndex to i+1 is strictly U- monotone */ + /*if i+1==endLeftIndex and the vertex and leftchain is on the second gridline, then + *we should use 2 vertices on the leftchain. If we only use one (endLeftIndex), then we + *we would output degenerate triangles + */ + if(i+1 == endLeftIndex && leftChain->getVertex(endLeftIndex)[1] == leftGridChain->get_v_value(1+leftGridChainStartIndex)) + i--; + + Int j = beginLeftIndex/*endLeftIndex*/+1; + + + if(leftGridChain->getInnerIndex(leftGridChainStartIndex+1) > leftGridChain->getUlineIndex(leftGridChainStartIndex)) + { + j = findIncreaseChainFromBegin(leftChain, beginLeftIndex, i+1/*endLeftIndex*/); + + Int temp = beginLeftIndex; + /*now from begin to j-1 is strictly u-monotone*/ + /*if j-1 is on the first grid line, then we want to skip to the vertex which is strictly + *below the grid line. This vertexmust exist since there is a 'corner turn' inbetween the two grid lines + */ + if(j-1 == beginLeftIndex) + { + while(leftChain->getVertex(j-1)[1] == leftGridChain->get_v_value(leftGridChainStartIndex)) + j++; + + Real vert[2]; + vert[0] = leftGridChain->get_u_value(leftGridChainStartIndex); + vert[1] = leftGridChain->get_v_value(leftGridChainStartIndex); + + monoTriangulation2( + vert/*leftChain->getVertex(beginLeftIndex)*/, + leftChain->getVertex(j-1), + leftChain, + beginLeftIndex, + j-2, + 1, + pStream //increase chain + ); + + temp = j-1; + } + + stripOfFanLeft(leftChain, j-1, temp/*beginLeftIndex*/, leftGridChain->getGrid(), + leftGridChain->getVlineIndex(leftGridChainStartIndex), + leftGridChain->getUlineIndex(leftGridChainStartIndex), + leftGridChain->getInnerIndex(leftGridChainStartIndex+1), + pStream, + 1 /*the grid line is above the trim line*/ + ); + } + + stripOfFanLeft(leftChain, endLeftIndex, i+1, leftGridChain->getGrid(), + leftGridChain->getVlineIndex(leftGridChainStartIndex+1), + leftGridChain->getUlineIndex(leftGridChainStartIndex+1), + leftGridChain->getInnerIndex(leftGridChainStartIndex+1), + pStream, + 0 /*the grid line is below the trim lines*/ + ); + + /*monotone triangulate the remaining left chain togther with the + *two vertices on the two grid v-lines. + */ + Real vert[2][2]; + vert[0][0]=vert[1][0] = leftGridChain->getInner_u_value(leftGridChainStartIndex+1); + vert[0][1] = leftGridChain->get_v_value(leftGridChainStartIndex); + vert[1][1] = leftGridChain->get_v_value(leftGridChainStartIndex+1); + +// vertexArray right(vert, 2); + + monoTriangulation2( + &vert[0][0], /*top vertex */ + &vert[1][0], /*bottom vertex*/ + leftChain, + /*beginLeftIndex*/j-1, + i+1, + 1, /*an increasing chain*/ + pStream); + } + else /*the second one is shorter than the first one to the left*/ + { + /*find the maximal U-monotone chain of beginLeftIndex, beginLeftIndex+1,..., + */ + i=beginLeftIndex; + Real prevU = leftChain->getVertex(i)[0]; + for(i=beginLeftIndex+1; i<=endLeftIndex; i++){ + Real thisU = leftChain->getVertex(i)[0]; + + if(prevU < thisU){ + prevU = thisU; + } + else + break; + } + /*from beginLeftIndex to i-1 is strictly U-monotone*/ + + + stripOfFanLeft(leftChain, i-1, beginLeftIndex, leftGridChain->getGrid(), + leftGridChain->getVlineIndex(leftGridChainStartIndex), + leftGridChain->getUlineIndex(leftGridChainStartIndex), + leftGridChain->getUlineIndex(leftGridChainStartIndex+1), + pStream, + 1 /*the grid line is above the trim lines*/ + ); + /*monotone triangulate the remaining left chain together with the + *two vertices on the two grid v-lines. + */ + Real vert[2][2]; + vert[0][0]=vert[1][0] = leftGridChain->get_u_value(leftGridChainStartIndex+1); + vert[0][1] = leftGridChain->get_v_value(leftGridChainStartIndex); + vert[1][1] = leftGridChain->get_v_value(leftGridChainStartIndex+1); + + vertexArray right(vert, 2); + + monoTriangulation2( + &vert[0][0], //top vertex + &vert[1][0], //bottom vertex + leftChain, + i-1, + endLeftIndex, + 1, /*an increase chain*/ + pStream); + + } +} + +/*n_upper>=1 + *n_lower>=1 + */ +void triangulateXYMono(Int n_upper, Real upperVerts[][2], + Int n_lower, Real lowerVerts[][2], + primStream* pStream) +{ + Int i,j,k,l; + Real* leftMostV; + + assert(n_upper>=1 && n_lower>=1); + if(upperVerts[0][0] <= lowerVerts[0][0]) + { + i=1; + j=0; + leftMostV = upperVerts[0]; + } + else + { + i=0; + j=1; + leftMostV = lowerVerts[0]; + } + + while(1) + { + if(i >= n_upper) /*case1: no more in upper*/ + { + + if(jbegin(); + pStream->insert(leftMostV); + while(jinsert(lowerVerts[j]); + j++; + } + pStream->end(PRIMITIVE_STREAM_FAN); + } + + break; + } + else if(j>= n_lower) /*case2: no more in lower*/ + { + + if(ibegin(); + pStream->insert(leftMostV); + + for(k=n_upper-1; k>=i; k--) + pStream->insert(upperVerts[k]); + + pStream->end(PRIMITIVE_STREAM_FAN); + } + + break; + } + else /* case3: neither is empty, plus the leftMostV, there is at least one triangle to output*/ + { + + if(upperVerts[i][0] <= lowerVerts[j][0]) + { + pStream->begin(); + pStream->insert(lowerVerts[j]); /*the origin of this fan*/ + + /*find the last k>=i such that + *upperverts[k][0] <= lowerverts[j][0] + */ + k=i; + while(k lowerVerts[j][0]) + break; + k++; + } + k--; + for(l=k; l>=i; l--)/*the reverse is for two-face lighting*/ + { + pStream->insert(upperVerts[l]); + } + pStream->insert(leftMostV); + + pStream->end(PRIMITIVE_STREAM_FAN); + //update i for next loop + i = k+1; + leftMostV = upperVerts[k]; + + } + else /*upperVerts[i][0] > lowerVerts[j][0]*/ + { + pStream->begin(); + pStream->insert(upperVerts[i]);/*the origion of this fan*/ + pStream->insert(leftMostV); + /*find the last k>=j such that + *lowerverts[k][0] < upperverts[i][0]*/ + k=j; + while(k< n_lower) + { + if(lowerVerts[k][0] >= upperVerts[i][0]) + break; + pStream->insert(lowerVerts[k]); + k++; + } + pStream->end(PRIMITIVE_STREAM_FAN); + j=k; + leftMostV = lowerVerts[j-1]; + } + } + } +} + + +void stripOfFanLeft(vertexArray* leftChain, + Int largeIndex, + Int smallIndex, + gridWrap* grid, + Int vlineIndex, + Int ulineSmallIndex, + Int ulineLargeIndex, + primStream* pStream, + Int gridLineUp /*1 if the grid line is above the trim lines*/ + ) +{ + assert(largeIndex >= smallIndex); + + Real grid_v_value; + grid_v_value = grid->get_v_value(vlineIndex); + + Real2* trimVerts=(Real2*) malloc(sizeof(Real2)* (largeIndex-smallIndex+1)); + assert(trimVerts); + + + Real2* gridVerts=(Real2*) malloc(sizeof(Real2)* (ulineLargeIndex-ulineSmallIndex+1)); + assert(gridVerts); + + Int k,i; + if(gridLineUp) /*trim line is below grid line, so trim vertices are going right when index increases*/ + for(k=0, i=smallIndex; i<=largeIndex; i++, k++) + { + trimVerts[k][0] = leftChain->getVertex(i)[0]; + trimVerts[k][1] = leftChain->getVertex(i)[1]; + } + else + for(k=0, i=largeIndex; i>=smallIndex; i--, k++) + { + trimVerts[k][0] = leftChain->getVertex(i)[0]; + trimVerts[k][1] = leftChain->getVertex(i)[1]; + } + + for(k=0, i=ulineSmallIndex; i<= ulineLargeIndex; i++, k++) + { + gridVerts[k][0] = grid->get_u_value(i); + gridVerts[k][1] = grid_v_value; + } + + if(gridLineUp) + triangulateXYMono( + ulineLargeIndex-ulineSmallIndex+1, gridVerts, + largeIndex-smallIndex+1, trimVerts, + pStream); + else + triangulateXYMono(largeIndex-smallIndex+1, trimVerts, + ulineLargeIndex-ulineSmallIndex+1, gridVerts, + pStream); + free(trimVerts); + free(gridVerts); +} + + + + + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.h new file mode 100644 index 000000000..3a5fa6c91 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampleMonoPoly.h @@ -0,0 +1,184 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _SAMPLEMONOPOLY_H +#define _SAMPLEMONOPOLY_H + +#include "monoTriangulation.h" +#include "gridWrap.h" +#include "rectBlock.h" + + +void triangulateXYMono(Int n_upper, Real upperVerts[][2], + Int n_lower, Real lowerVerts[][2], + primStream* pStream); + +void stripOfFanLeft(vertexArray* leftChain, + Int largeIndex, + Int smallIndex, + gridWrap* grid, + Int vlineIndex, + Int ulineSmallIndex, + Int ulineLargeIndex, + primStream* pStream, + Int gridLineUp + ); +void sampleLeftOneGridStep(vertexArray* leftChain, + Int beginLeftIndex, + Int endLeftIndex, + gridBoundaryChain* leftGridChain, + Int leftGridChainStartIndex, + primStream* pStream + ); + +void sampleLeftSingleTrimEdgeRegion(Real upperVert[2], Real lowerVert[2], + gridBoundaryChain* gridChain, + Int beginIndex, + Int endIndex, + primStream* pStream); + +void sampleLeftStripRec(vertexArray* leftChain, + Int topLeftIndex, + Int botLeftIndex, + gridBoundaryChain* leftGridChain, + Int leftGridChainStartIndex, + Int leftGridChainEndIndex, + primStream* pStream + ); + +void sampleLeftStrip(vertexArray* leftChain, + Int topLeftIndex, + Int botLeftIndex, + gridBoundaryChain* leftGridChain, + Int leftGridChainStartIndex, + Int leftGridChainEndIndex, + primStream* pStream + ); + +void findLeftGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap* grid, Int* ret_indices, Int* ret_inner); + +void findRightGridIndices(directedLine* topEdge, Int firstGridIndex, Int lastGridIndex, gridWrap* grid, Int* ret_indices, Int* ret_inner); + +void sampleMonoPoly(directedLine* polygon, gridWrap* grid, Int ulinear, Int vlinear, primStream *pStream, rectBlockArray* rbArray); + +void sampleMonoPolyRec( + Real* topVertex, + Real* botVertex, + vertexArray* leftChain, + Int leftStartIndex, + vertexArray* rightChain, + Int rightStartIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridStartIndex, + primStream* pStream, + rectBlockArray* rbArray + ); + +void sampleLeftStripRecF(vertexArray* leftChain, + Int topLeftIndex, + Int botLeftIndex, + gridBoundaryChain* leftGridChain, + Int leftGridChainStartIndex, + Int leftGridChainEndIndex, + primStream* pStream + ); + +void findUpCorners(Real *topVertex, + vertexArray *leftChain, + Int leftChainStartIndex, Int leftChainEndIndex, + vertexArray *rightChain, + Int rightChainStartIndex, Int rightChainEndIndex, + Real v, + Real uleft, + Real uright, + Int& ret_leftCornerWhere, + Int& ret_leftCornerIndex, + Int& ret_rightCornerWhere, + Int& ret_rightCornerIndex + ); +void findDownCorners(Real *botVertex, + vertexArray *leftChain, Int leftChainStartIndex, Int leftChainEndIndex, + vertexArray *rightChain, Int rightChainStartIndex, Int rightChainEndIndex, + Real v, + Real uleft, + Real uright, + Int& ret_leftCornerWhere, + Int& ret_leftCornerIndex, + Int& ret_rightCornerWhere, + Int& ret_rightCornerIndex + ); +void findNeck(vertexArray *leftChain, Int botLeftIndex, + vertexArray *rightChain, Int botRightIndex, + Int& leftLastIndex, /*left point of the neck*/ + Int& rightLastIndex /*right point of the neck*/ + ); + +Int findNeckF(vertexArray *leftChain, Int botLeftIndex, + vertexArray *rightChain, Int botRightIndex, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridStartIndex, + Int& neckLeft, + Int& neckRight); + +void findTopAndBot(directedLine* polygon, + directedLine*& topV, + directedLine*& botV); +void findGridChains(directedLine* top, directedLine* bot, + gridWrap* grid, + gridBoundaryChain*& leftGridChain, + gridBoundaryChain*& rightGridChain); +void toVertexArrays(directedLine* topV, directedLine* botV, vertexArray& leftChain, vertexArray& rightChain); + +void drawCorners( + Real* topV, Real* botV, + vertexArray* leftChain, + vertexArray* rightChain, + gridBoundaryChain* leftGridChain, + gridBoundaryChain* rightGridChain, + Int gridIndex1, + Int gridIndex2, + Int leftCornerWhere, + Int leftCornerIndex, + Int rightCornerWhere, + Int rightCornerIndex, + Int bot_leftCornerWhere, + Int bot_leftCornerIndex, + Int bot_rightCornerWhere, + Int bot_rightCornerIndex); + +Int checkMiddle(vertexArray* chain, Int begin, Int end, + Real vup, Real vbelow); + +#endif + diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc new file mode 100644 index 000000000..6253a7c09 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.cc @@ -0,0 +1,179 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include //for fabs() +#include "glimports.h" +#include "zlassert.h" +#include "sampledLine.h" + +void sampledLine::setPoint(Int i, Real p[2]) +{ + points[i][0]=p[0]; + points[i][1]=p[1]; +} + + +/*insert this single line in front of the oldList*/ +sampledLine* sampledLine::insert(sampledLine *oldList) +{ + next = oldList; + return this; +} + +void sampledLine::deleteList() +{ + sampledLine *temp, *tempNext; + for(temp = this; temp != NULL; temp = tempNext) + { + tempNext = temp->next; + delete temp; + } +} + + +/*space of points[][2] is allocated*/ +sampledLine::sampledLine(Int n_points) +{ + npoints = n_points; + points = (Real2*) malloc(sizeof(Real2) * n_points); + assert(points); + next = NULL; +} + +/*space of points[][2] is allocated and + *points are copied + */ +sampledLine::sampledLine(Int n_points, Real2 pts[]) +{ + int i; + npoints = n_points; + points = (Real2*) malloc(sizeof(Real2) * n_points); + assert(points); + for(i=0; i nv) n = nu; + else + n = nv; + if(n<1) + n = 1; + //du dv could be negative + Real du = (points[npoints-1][0] - points[0][0])/n; + Real dv = (points[npoints-1][1] - points[0][1])/n; + Real2 *temp = (Real2*) malloc(sizeof(Real2) * (n+1)); + assert(temp); + + Real u,v; + for(i=0, u=points[0][0], v=points[0][1]; inext) + { + temp->tessellate(u_reso, v_reso); + } +} diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.h new file mode 100644 index 000000000..2cc726948 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/sampledLine.h @@ -0,0 +1,71 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _SAMPLEDLINE_H +#define _SAMPLEDLINE_H + +#include "definitions.h" + +class sampledLine{ + Int npoints; + Real2 *points; + +public: + sampledLine(Int n_points); + sampledLine(Int n_points, Real pts[][2]); + sampledLine(Real pt1[2], Real pt2[2]); + sampledLine(); //special, careful about memory + ~sampledLine(); + + void init(Int n_points, Real2 *pts);//special, careful about memory + + void setPoint(Int i, Real p[2]) ; + + sampledLine* insert(sampledLine *nline); + void deleteList(); + + Int get_npoints() {return npoints;} + Real2* get_points() {return points;} + + //u_reso is number of segments (may not be integer) per unit u + void tessellate(Real u_reso, Real v_reso);//n segments + void tessellateAll(Real u_reso, Real v_reso); + + void print(); + + sampledLine* next; +}; + + + + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/searchTree.cc b/mesalib/src/glu/sgi/libnurbs/nurbtess/searchTree.cc new file mode 100644 index 000000000..1865755a4 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/searchTree.cc @@ -0,0 +1,282 @@ +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.1 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +** +*/ +/* +*/ + +#include +#include +#include "zlassert.h" + +#include "searchTree.h" + +#define max(a,b) ((a>b)? a:b) + +treeNode* TreeNodeMake(void *key) +{ + treeNode *ret = (treeNode*) malloc(sizeof(treeNode)); + assert(ret); + ret->key = key; + ret->parent = NULL; + ret->left = NULL; + ret->right = NULL; + return ret; +} + +void TreeNodeDeleteSingleNode(treeNode* node) +{ + free(node); +} + +void TreeNodeDeleteWholeTree(treeNode* node) +{ + if(node == NULL) return; + TreeNodeDeleteWholeTree(node->left); + TreeNodeDeleteWholeTree(node->right); + TreeNodeDeleteSingleNode(node); +} + +void TreeNodePrint(treeNode* node, + void (*keyPrint) (void*)) +{ + if(node ==NULL) return; + TreeNodePrint(node->left, keyPrint); + keyPrint(node->key); + TreeNodePrint(node->right, keyPrint); +} + +int TreeNodeDepth(treeNode* root) +{ + if(root == NULL) return 0; + else{ + int leftdepth = TreeNodeDepth(root->left); + int rightdepth = TreeNodeDepth(root->right); + return 1 + max(leftdepth, rightdepth); + } +} + +/*return the node with the key. + *NULL is returned if not found + */ +treeNode* TreeNodeFind(treeNode* tree, void* key, + int (*compkey) (void*, void*)) +{ + if(tree == NULL) + return NULL; + if(key == tree->key) + return tree; + else if(compkey(key, tree->key) < 0) + return TreeNodeFind(tree->left, key, compkey); + else + return TreeNodeFind(tree->right, key, compkey); +} + + +treeNode* TreeNodeInsert(treeNode* root, treeNode* newnode, + int (*compkey) (void *, void *)) +{ + treeNode *y = NULL; + treeNode *x = root; + /*going down the tree from the root. + *x traces the path, y is the parent of x. + */ + while (x != NULL){ + y = x; + if(compkey(newnode->key,x->key) < 0) /*if newnode < x*/ + x = x->left; + else + x = x->right; + } + + /*now y has the property that + * if newnode < y, then y->left is NULL + * if newnode > y, then y->right is NULL. + *So we want to isnert newnode to be the child of y + */ + newnode->parent = y; + if(y == NULL) + return newnode; + else if( compkey(newnode->key, y->key) <0) + { + y->left = newnode; + } + else + { + y->right = newnode; + } + + return root; +} + +treeNode* TreeNodeDeleteSingleNode(treeNode* tree, treeNode* node) +{ + treeNode* y; + treeNode* x; + treeNode* ret; + if(node==NULL) return tree; + + if(node->left == NULL || node->right == NULL) { + + y = node; + if(y->left != NULL) + x = y->left; + else + x = y->right; + + if( x != NULL) + x->parent = y->parent; + + if(y->parent == NULL) /*y is the root which has at most one child x*/ + ret = x; + else /*y is not the root*/ + { + if(y == y->parent->left) + y->parent->left = x; + else + y->parent->right = x; + ret = tree; + } + } + else { /*node has two children*/ + + y = TreeNodeSuccessor(node); + assert(y->left == NULL); + + if(y == node->right) /*y is the right child if node*/ + { + y->parent = node->parent; + y->left = node->left; + node->left->parent = y; + + } + else /*y != node->right*/ + { + x = y->right; + if(x!= NULL) + x->parent = y->parent; + + assert(y->parent != NULL); + if(y == y->parent->left) + y->parent->left = x; + else + y->parent->right = x; + /*move y to the position of node*/ + y->parent = node->parent; + y->left = node->left; + y->right = node->right; + node->left->parent = y; + node->right->parent = y; + } + if(node->parent != NULL) { + if(node->parent->left == node) + node->parent->left = y; + else + node->parent->right = y; + ret = tree; /*the root if the tree doesn't change*/ + } + else /*node->parent is NULL: node is the root*/ + ret = y; + } + + /*finally free the node, and return the new root*/ + TreeNodeDeleteSingleNode(node); + return ret; +} + + +/*the minimum node in the tree rooted by node + */ +treeNode* TreeNodeMinimum(treeNode* node) +{ + treeNode* temp = node; + if(temp == NULL) return NULL; + while(temp->left != NULL) { + temp = temp->left; + } + return temp; +} + +/*the maximum node in the tree rooted by node + */ +treeNode* TreeNodeMaximum(treeNode* node) +{ + treeNode* temp = node; + if(temp == NULL) return NULL; + while(temp->right != NULL) { + temp = temp->right; + } + return temp; +} + +/*return the first node (in sorted order) which is to the right of this node + */ +treeNode* TreeNodeSuccessor(treeNode* node) +{ + if(node == NULL) return NULL; + if(node->right != NULL) + return TreeNodeMinimum(node->right); + else{ /*node->right is NULL*/ + + /*find the first right-ancestor*/ + treeNode *y = node->parent; + treeNode* x = node; + while(y != NULL && x == y->right) /*if y is a left parent of x*/ + { + + x = y; + y = y->parent; + } + return y; + } +} + +/*return the first node (in sorted order) which is to the left of this node + */ +treeNode* TreeNodePredecessor(treeNode* node) +{ + if(node == NULL) return NULL; + if(node->left != NULL) + return TreeNodeMaximum(node->left); + else{ /*node->left is NULL*/ + /*find the first left-ancestor*/ + treeNode *y = node->parent; + treeNode *x = node; + while(y != NULL && x == y->left) /*if y is a right parent of x*/ + { + x = y; + y = y->parent; + } + return y; + } +} diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/searchTree.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/searchTree.h new file mode 100644 index 000000000..d5e33314b --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/searchTree.h @@ -0,0 +1,61 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +#ifndef _SEARCHTREE_H +#define _SEARCHTREE_H + +typedef struct treeNode{ + void *key; + struct treeNode* parent; + struct treeNode* left; /*children*/ + struct treeNode* right; +} treeNode; + +treeNode* TreeNodeMake(void *key); +void TreeNodeDeleteSingleNode(treeNode* node); +void TreeNodeDeleteWholeTree(treeNode* node); +void TreeNodePrint(treeNode* node, + void (*keyPrint) (void*)); +int TreeNodeDepth(treeNode* root); +treeNode* TreeNodeMinimum(treeNode* node); +treeNode* TreeNodeMaximum(treeNode* node); +treeNode* TreeNodePredecessor(treeNode* node); +treeNode* TreeNodeSuccessor(treeNode* node); +treeNode* TreeNodeFind(treeNode* tree, void* key, + int (*compkey) (void*, void*)); + +treeNode* TreeNodeInsert(treeNode* root, treeNode* newnode, + int (*comp) (void *, void *)); +treeNode* TreeNodeDeleteSingleNode(treeNode* tree, treeNode* node); + + +#endif diff --git a/mesalib/src/glu/sgi/libnurbs/nurbtess/zlassert.h b/mesalib/src/glu/sgi/libnurbs/nurbtess/zlassert.h new file mode 100644 index 000000000..b9c073257 --- /dev/null +++ b/mesalib/src/glu/sgi/libnurbs/nurbtess/zlassert.h @@ -0,0 +1,34 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +*/ + +/*XXXblythe this file should be deleted*/ +#include diff --git a/mesalib/src/glu/sgi/libtess/README b/mesalib/src/glu/sgi/libtess/README new file mode 100644 index 000000000..66a6011e2 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/README @@ -0,0 +1,446 @@ +/* +*/ + +General Polygon Tesselation +--------------------------- + + This note describes a tesselator for polygons consisting of one or + more closed contours. It is backward-compatible with the current + OpenGL Utilities tesselator, and is intended to replace it. Here is + a summary of the major differences: + + - input contours can be intersecting, self-intersecting, or degenerate. + + - supports a choice of several winding rules for determining which parts + of the polygon are on the "interior". This makes it possible to do + CSG operations on polygons. + + - boundary extraction: instead of tesselating the polygon, returns a + set of closed contours which separate the interior from the exterior. + + - returns the output as a small number of triangle fans and strips, + rather than a list of independent triangles (when possible). + + - output is available as an explicit mesh (a quad-edge structure), + in addition to the normal callback interface. + + - the algorithm used is extremely robust. + + +The interface +------------- + + The tesselator state is maintained in a "tesselator object". + These are allocated and destroyed using + + GLUtesselator *gluNewTess( void ); + void gluDeleteTess( GLUtesselator *tess ); + + Several tesselator objects may be used simultaneously. + + Inputs + ------ + + The input contours are specified with the following routines: + + void gluTessBeginPolygon( GLUtesselator *tess ); + void gluTessBeginContour( GLUtesselator *tess ); + void gluTessVertex( GLUtesselator *tess, GLUcoord coords[3], void *data ); + void gluTessEndContour( GLUtesselator *tess ); + void gluTessEndPolygon( GLUtesselator *tess ); + + Within each BeginPolygon/EndPolygon pair, there can be zero or more + calls to BeginContour/EndContour. Within each contour, there are zero + or more calls to gluTessVertex(). The vertices specify a closed + contour (the last vertex of each contour is automatically linked to + the first). + + "coords" give the coordinates of the vertex in 3-space. For useful + results, all vertices should lie in some plane, since the vertices + are projected onto a plane before tesselation. "data" is a pointer + to a user-defined vertex structure, which typically contains other + information such as color, texture coordinates, normal, etc. It is + used to refer to the vertex during rendering. + + The library can be compiled in single- or double-precision; the type + GLUcoord represents either "float" or "double" accordingly. The GLU + version will be available in double-precision only. Compile with + GLU_TESS_API_FLOAT defined to get the single-precision version. + + When EndPolygon is called, the tesselation algorithm determines + which regions are interior to the given contours, according to one + of several "winding rules" described below. The interior regions + are then tesselated, and the output is provided as callbacks. + + + Rendering Callbacks + ------------------- + + Callbacks are specified by the client using + + void gluTessCallback( GLUtesselator *tess, GLenum which, void (*fn)()); + + If "fn" is NULL, any previously defined callback is discarded. + + The callbacks used to provide output are: /* which == */ + + void begin( GLenum type ); /* GLU_TESS_BEGIN */ + void edgeFlag( GLboolean flag ); /* GLU_TESS_EDGE_FLAG */ + void vertex( void *data ); /* GLU_TESS_VERTEX */ + void end( void ); /* GLU_TESS_END */ + + Any of the callbacks may be left undefined; if so, the corresponding + information will not be supplied during rendering. + + The "begin" callback indicates the start of a primitive; type is one + of GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, or GL_TRIANGLES (but see the + notes on "boundary extraction" below). + + It is followed by any number of "vertex" callbacks, which supply the + vertices in the same order as expected by the corresponding glBegin() + call. After the last vertex of a given primitive, there is a callback + to "end". + + If the "edgeFlag" callback is provided, no triangle fans or strips + will be used. When edgeFlag is called, if "flag" is GL_TRUE then each + vertex which follows begins an edge which lies on the polygon boundary + (ie. an edge which separates an interior region from an exterior one). + If "flag" is GL_FALSE, each vertex which follows begins an edge which lies + in the polygon interior. "edgeFlag" will be called before the first + call to "vertex". + + Other Callbacks + --------------- + + void mesh( GLUmesh *mesh ); /* GLU_TESS_MESH */ + + - Returns an explicit mesh, represented using the quad-edge structure + (Guibas/Stolfi '85). Other implementations of this interface might + use a different mesh structure, so this is available only only as an + SGI extension. When the mesh is no longer needed, it should be freed + using + + void gluDeleteMesh( GLUmesh *mesh ); + + There is a brief description of this data structure in the include + file "mesh.h". For the full details, see L. Guibas and J. Stolfi, + Primitives for the manipulation of general subdivisions and the + computation of Voronoi diagrams, ACM Transactions on Graphics, + 4(2):74-123, April 1985. For an introduction, see the course notes + for CS348a, "Mathematical Foundations of Computer Graphics", + available at the Stanford bookstore (and taught during the fall + quarter). + + void error( GLenum errno ); /* GLU_TESS_ERROR */ + + - errno is one of GLU_TESS_MISSING_BEGIN_POLYGON, + GLU_TESS_MISSING_END_POLYGON, + GLU_TESS_MISSING_BEGIN_CONTOUR, + GLU_TESS_MISSING_END_CONTOUR, + GLU_TESS_COORD_TOO_LARGE, + GLU_TESS_NEED_COMBINE_CALLBACK + + The first four are obvious. The interface recovers from these + errors by inserting the missing call(s). + + GLU_TESS_COORD_TOO_LARGE says that some vertex coordinate exceeded + the predefined constant GLU_TESS_MAX_COORD in absolute value, and + that the value has been clamped. (Coordinate values must be small + enough so that two can be multiplied together without overflow.) + + GLU_TESS_NEED_COMBINE_CALLBACK says that the algorithm detected an + intersection between two edges in the input data, and the "combine" + callback (below) was not provided. No output will be generated. + + + void combine( GLUcoord coords[3], void *data[4], /* GLU_TESS_COMBINE */ + GLUcoord weight[4], void **outData ); + + - When the algorithm detects an intersection, or wishes to merge + features, it needs to create a new vertex. The vertex is defined + as a linear combination of up to 4 existing vertices, referenced + by data[0..3]. The coefficients of the linear combination are + given by weight[0..3]; these weights always sum to 1.0. All vertex + pointers are valid even when some of the weights are zero. + "coords" gives the location of the new vertex. + + The user must allocate another vertex, interpolate parameters + using "data" and "weights", and return the new vertex pointer in + "outData". This handle is supplied during rendering callbacks. + For example, if the polygon lies in an arbitrary plane in 3-space, + and we associate a color with each vertex, the combine callback might + look like this: + + void myCombine( GLUcoord coords[3], VERTEX *d[4], + GLUcoord w[4], VERTEX **dataOut ) + { + VERTEX *new = new_vertex(); + + new->x = coords[0]; + new->y = coords[1]; + new->z = coords[2]; + new->r = w[0]*d[0]->r + w[1]*d[1]->r + w[2]*d[2]->r + w[3]*d[3]->r; + new->g = w[0]*d[0]->g + w[1]*d[1]->g + w[2]*d[2]->g + w[3]*d[3]->g; + new->b = w[0]*d[0]->b + w[1]*d[1]->b + w[2]*d[2]->b + w[3]*d[3]->b; + new->a = w[0]*d[0]->a + w[1]*d[1]->a + w[2]*d[2]->a + w[3]*d[3]->a; + *dataOut = new; + } + + If the algorithm detects an intersection, then the "combine" callback + must be defined, and must write a non-NULL pointer into "dataOut". + Otherwise the GLU_TESS_NEED_COMBINE_CALLBACK error occurs, and no + output is generated. This is the only error that can occur during + tesselation and rendering. + + + Control over Tesselation + ------------------------ + + void gluTessProperty( GLUtesselator *tess, GLenum which, GLUcoord value ); + + Properties defined: + + - GLU_TESS_WINDING_RULE. Possible values: + + GLU_TESS_WINDING_ODD + GLU_TESS_WINDING_NONZERO + GLU_TESS_WINDING_POSITIVE + GLU_TESS_WINDING_NEGATIVE + GLU_TESS_WINDING_ABS_GEQ_TWO + + The input contours parition the plane into regions. A winding + rule determines which of these regions are inside the polygon. + + For a single contour C, the winding number of a point x is simply + the signed number of revolutions we make around x as we travel + once around C (where CCW is positive). When there are several + contours, the individual winding numbers are summed. This + procedure associates a signed integer value with each point x in + the plane. Note that the winding number is the same for all + points in a single region. + + The winding rule classifies a region as "inside" if its winding + number belongs to the chosen category (odd, nonzero, positive, + negative, or absolute value of at least two). The current GLU + tesselator implements the "odd" rule. The "nonzero" rule is another + common way to define the interior. The other three rules are + useful for polygon CSG operations (see below). + + - GLU_TESS_BOUNDARY_ONLY. Values: TRUE (non-zero) or FALSE (zero). + + If TRUE, returns a set of closed contours which separate the + polygon interior and exterior (rather than a tesselation). + Exterior contours are oriented CCW with respect to the normal, + interior contours are oriented CW. The GLU_TESS_BEGIN callback + uses the type GL_LINE_LOOP for each contour. + + - GLU_TESS_TOLERANCE. Value: a real number between 0.0 and 1.0. + + This specifies a tolerance for merging features to reduce the size + of the output. For example, two vertices which are very close to + each other might be replaced by a single vertex. The tolerance + is multiplied by the largest coordinate magnitude of any input vertex; + this specifies the maximum distance that any feature can move as the + result of a single merge operation. If a single feature takes part + in several merge operations, the total distance moved could be larger. + + Feature merging is completely optional; the tolerance is only a hint. + The implementation is free to merge in some cases and not in others, + or to never merge features at all. The default tolerance is zero. + + The current implementation merges vertices only if they are exactly + coincident, regardless of the current tolerance. A vertex is + spliced into an edge only if the implementation is unable to + distinguish which side of the edge the vertex lies on. + Two edges are merged only when both endpoints are identical. + + + void gluTessNormal( GLUtesselator *tess, + GLUcoord x, GLUcoord y, GLUcoord z ) + + - Lets the user supply the polygon normal, if known. All input data + is projected into a plane perpendicular to the normal before + tesselation. All output triangles are oriented CCW with + respect to the normal (CW orientation can be obtained by + reversing the sign of the supplied normal). For example, if + you know that all polygons lie in the x-y plane, call + "gluTessNormal(tess, 0.0, 0.0, 1.0)" before rendering any polygons. + + - If the supplied normal is (0,0,0) (the default value), the + normal is determined as follows. The direction of the normal, + up to its sign, is found by fitting a plane to the vertices, + without regard to how the vertices are connected. It is + expected that the input data lies approximately in plane; + otherwise projection perpendicular to the computed normal may + substantially change the geometry. The sign of the normal is + chosen so that the sum of the signed areas of all input contours + is non-negative (where a CCW contour has positive area). + + - The supplied normal persists until it is changed by another + call to gluTessNormal. + + + Backward compatibility with the GLU tesselator + ---------------------------------------------- + + The preferred interface is the one described above. The following + routines are obsolete, and are provided only for backward compatibility: + + typedef GLUtesselator GLUtriangulatorObj; /* obsolete name */ + + void gluBeginPolygon( GLUtesselator *tess ); + void gluNextContour( GLUtesselator *tess, GLenum type ); + void gluEndPolygon( GLUtesselator *tess ); + + "type" is one of GLU_EXTERIOR, GLU_INTERIOR, GLU_CCW, GLU_CW, or + GLU_UNKNOWN. It is ignored by the current GLU tesselator. + + GLU_BEGIN, GLU_VERTEX, GLU_END, GLU_ERROR, and GLU_EDGE_FLAG are defined + as synonyms for GLU_TESS_BEGIN, GLU_TESS_VERTEX, GLU_TESS_END, + GLU_TESS_ERROR, and GLU_TESS_EDGE_FLAG. + + +Polygon CSG operations +---------------------- + + The features of the tesselator make it easy to find the union, difference, + or intersection of several polygons. + + First, assume that each polygon is defined so that the winding number + is 0 for each exterior region, and 1 for each interior region. Under + this model, CCW contours define the outer boundary of the polygon, and + CW contours define holes. Contours may be nested, but a nested + contour must be oriented oppositely from the contour that contains it. + + If the original polygons do not satisfy this description, they can be + converted to this form by first running the tesselator with the + GLU_TESS_BOUNDARY_ONLY property turned on. This returns a list of + contours satisfying the restriction above. By allocating two + tesselator objects, the callbacks from one tesselator can be fed + directly to the input of another. + + Given two or more polygons of the form above, CSG operations can be + implemented as follows: + + Union + Draw all the input contours as a single polygon. The winding number + of each resulting region is the number of original polygons + which cover it. The union can be extracted using the + GLU_TESS_WINDING_NONZERO or GLU_TESS_WINDING_POSITIVE winding rules. + Note that with the nonzero rule, we would get the same result if + all contour orientations were reversed. + + Intersection (two polygons at a time only) + Draw a single polygon using the contours from both input polygons. + Extract the result using GLU_TESS_WINDING_ABS_GEQ_TWO. (Since this + winding rule looks at the absolute value, reversing all contour + orientations does not change the result.) + + Difference + + Suppose we want to compute A \ (B union C union D). Draw a single + polygon consisting of the unmodified contours from A, followed by + the contours of B,C,D with the vertex order reversed (this changes + the winding number of the interior regions to -1). To extract the + result, use the GLU_TESS_WINDING_POSITIVE rule. + + If B,C,D are the result of a GLU_TESS_BOUNDARY_ONLY call, an + alternative to reversing the vertex order is to reverse the sign of + the supplied normal. For example in the x-y plane, call + gluTessNormal( tess, 0.0, 0.0, -1.0 ). + + +Performance +----------- + + The tesselator is not intended for immediate-mode rendering; when + possible the output should be cached in a user structure or display + list. General polygon tesselation is an inherently difficult problem, + especially given the goal of extreme robustness. + + The implementation makes an effort to output a small number of fans + and strips; this should improve the rendering performance when the + output is used in a display list. + + Single-contour input polygons are first tested to see whether they can + be rendered as a triangle fan with respect to the first vertex (to + avoid running the full decomposition algorithm on convex polygons). + Non-convex polygons may be rendered by this "fast path" as well, if + the algorithm gets lucky in its choice of a starting vertex. + + For best performance follow these guidelines: + + - supply the polygon normal, if available, using gluTessNormal(). + This represents about 10% of the computation time. For example, + if all polygons lie in the x-y plane, use gluTessNormal(tess,0,0,1). + + - render many polygons using the same tesselator object, rather than + allocating a new tesselator for each one. (In a multi-threaded, + multi-processor environment you may get better performance using + several tesselators.) + + +Comparison with the GLU tesselator +---------------------------------- + + On polygons which make it through the "fast path", the tesselator is + 3 to 5 times faster than the GLU tesselator. + + On polygons which don't make it through the fast path (but which don't + have self-intersections or degeneracies), it is about 2 times slower. + + On polygons with self-intersections or degeneraces, there is nothing + to compare against. + + The new tesselator generates many more fans and strips, reducing the + number of vertices that need to be sent to the hardware. + + Key to the statistics: + + vert number of input vertices on all contours + cntr number of input contours + tri number of triangles in all output primitives + strip number of triangle strips + fan number of triangle fans + ind number of independent triangles + ms number of milliseconds for tesselation + (on a 150MHz R4400 Indy) + + Convex polygon examples: + +New: 3 vert, 1 cntr, 1 tri, 0 strip, 0 fan, 1 ind, 0.0459 ms +Old: 3 vert, 1 cntr, 1 tri, 0 strip, 0 fan, 1 ind, 0.149 ms +New: 4 vert, 1 cntr, 2 tri, 0 strip, 1 fan, 0 ind, 0.0459 ms +Old: 4 vert, 1 cntr, 2 tri, 0 strip, 0 fan, 2 ind, 0.161 ms +New: 36 vert, 1 cntr, 34 tri, 0 strip, 1 fan, 0 ind, 0.153 ms +Old: 36 vert, 1 cntr, 34 tri, 0 strip, 0 fan, 34 ind, 0.621 ms + + Concave single-contour polygons: + +New: 5 vert, 1 cntr, 3 tri, 0 strip, 1 fan, 0 ind, 0.052 ms +Old: 5 vert, 1 cntr, 3 tri, 0 strip, 0 fan, 3 ind, 0.252 ms +New: 19 vert, 1 cntr, 17 tri, 2 strip, 2 fan, 1 ind, 0.911 ms +Old: 19 vert, 1 cntr, 17 tri, 0 strip, 0 fan, 17 ind, 0.529 ms +New: 151 vert, 1 cntr, 149 tri, 13 strip, 18 fan, 3 ind, 6.82 ms +Old: 151 vert, 1 cntr, 149 tri, 0 strip, 3 fan, 143 ind, 2.7 ms +New: 574 vert, 1 cntr, 572 tri, 59 strip, 54 fan, 11 ind, 26.6 ms +Old: 574 vert, 1 cntr, 572 tri, 0 strip, 31 fan, 499 ind, 12.4 ms + + Multiple contours, but no intersections: + +New: 7 vert, 2 cntr, 7 tri, 1 strip, 0 fan, 0 ind, 0.527 ms +Old: 7 vert, 2 cntr, 7 tri, 0 strip, 0 fan, 7 ind, 0.274 ms +New: 81 vert, 6 cntr, 89 tri, 9 strip, 7 fan, 6 ind, 3.88 ms +Old: 81 vert, 6 cntr, 89 tri, 0 strip, 13 fan, 61 ind, 2.2 ms +New: 391 vert, 19 cntr, 413 tri, 37 strip, 32 fan, 26 ind, 20.2 ms +Old: 391 vert, 19 cntr, 413 tri, 0 strip, 25 fan, 363 ind, 8.68 ms + + Self-intersecting and degenerate examples: + +Bowtie: 4 vert, 1 cntr, 2 tri, 0 strip, 0 fan, 2 ind, 0.483 ms +Star: 5 vert, 1 cntr, 5 tri, 0 strip, 0 fan, 5 ind, 0.91 ms +Random: 24 vert, 7 cntr, 46 tri, 2 strip, 12 fan, 7 ind, 5.32 ms +Font: 333 vert, 2 cntr, 331 tri, 32 strip, 16 fan, 3 ind, 14.1 ms +: 167 vert, 35 cntr, 254 tri, 8 strip, 56 fan, 52 ind, 46.3 ms +: 78 vert, 1 cntr, 2675 tri, 148 strip, 207 fan, 180 ind, 243 ms +: 12480 vert, 2 cntr, 12478 tri, 736 strip,1275 fan, 5 ind, 1010 ms diff --git a/mesalib/src/glu/sgi/libtess/alg-outline b/mesalib/src/glu/sgi/libtess/alg-outline new file mode 100644 index 000000000..33fd69728 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/alg-outline @@ -0,0 +1,228 @@ +/* +*/ + +This is only a very brief overview. There is quite a bit of +additional documentation in the source code itself. + + +Goals of robust tesselation +--------------------------- + +The tesselation algorithm is fundamentally a 2D algorithm. We +initially project all data into a plane; our goal is to robustly +tesselate the projected data. The same topological tesselation is +then applied to the input data. + +Topologically, the output should always be a tesselation. If the +input is even slightly non-planar, then some triangles will +necessarily be back-facing when viewed from some angles, but the goal +is to minimize this effect. + +The algorithm needs some capability of cleaning up the input data as +well as the numerical errors in its own calculations. One way to do +this is to specify a tolerance as defined above, and clean up the +input and output during the line sweep process. At the very least, +the algorithm must handle coincident vertices, vertices incident to an +edge, and coincident edges. + + +Phases of the algorithm +----------------------- + +1. Find the polygon normal N. +2. Project the vertex data onto a plane. It does not need to be + perpendicular to the normal, eg. we can project onto the plane + perpendicular to the coordinate axis whose dot product with N + is largest. +3. Using a line-sweep algorithm, partition the plane into x-monotone + regions. Any vertical line intersects an x-monotone region in + at most one interval. +4. Triangulate the x-monotone regions. +5. Group the triangles into strips and fans. + + +Finding the normal vector +------------------------- + +A common way to find a polygon normal is to compute the signed area +when the polygon is projected along the three coordinate axes. We +can't do this, since contours can have zero area without being +degenerate (eg. a bowtie). + +We fit a plane to the vertex data, ignoring how they are connected +into contours. Ideally this would be a least-squares fit; however for +our purpose the accuracy of the normal is not important. Instead we +find three vertices which are widely separated, and compute the normal +to the triangle they form. The vertices are chosen so that the +triangle has an area at least 1/sqrt(3) times the largest area of any +triangle formed using the input vertices. + +The contours do affect the orientation of the normal; after computing +the normal, we check that the sum of the signed contour areas is +non-negative, and reverse the normal if necessary. + + +Projecting the vertices +----------------------- + +We project the vertices onto a plane perpendicular to one of the three +coordinate axes. This helps numerical accuracy by removing a +transformation step between the original input data and the data +processed by the algorithm. The projection also compresses the input +data; the 2D distance between vertices after projection may be smaller +than the original 2D distance. However by choosing the coordinate +axis whose dot product with the normal is greatest, the compression +factor is at most 1/sqrt(3). + +Even though the *accuracy* of the normal is not that important (since +we are projecting perpendicular to a coordinate axis anyway), the +*robustness* of the computation is important. For example, if there +are many vertices which lie almost along a line, and one vertex V +which is well-separated from the line, then our normal computation +should involve V otherwise the results will be garbage. + +The advantage of projecting perpendicular to the polygon normal is +that computed intersection points will be as close as possible to +their ideal locations. To get this behavior, define TRUE_PROJECT. + + +The Line Sweep +-------------- + +There are three data structures: the mesh, the event queue, and the +edge dictionary. + +The mesh is a "quad-edge" data structure which records the topology of +the current decomposition; for details see the include file "mesh.h". + +The event queue simply holds all vertices (both original and computed +ones), organized so that we can quickly extract the vertex with the +minimum x-coord (and among those, the one with the minimum y-coord). + +The edge dictionary describes the current intersection of the sweep +line with the regions of the polygon. This is just an ordering of the +edges which intersect the sweep line, sorted by their current order of +intersection. For each pair of edges, we store some information about +the monotone region between them -- these are call "active regions" +(since they are crossed by the current sweep line). + +The basic algorithm is to sweep from left to right, processing each +vertex. The processed portion of the mesh (left of the sweep line) is +a planar decomposition. As we cross each vertex, we update the mesh +and the edge dictionary, then we check any newly adjacent pairs of +edges to see if they intersect. + +A vertex can have any number of edges. Vertices with many edges can +be created as vertices are merged and intersection points are +computed. For unprocessed vertices (right of the sweep line), these +edges are in no particular order around the vertex; for processed +vertices, the topological ordering should match the geometric ordering. + +The vertex processing happens in two phases: first we process are the +left-going edges (all these edges are currently in the edge +dictionary). This involves: + + - deleting the left-going edges from the dictionary; + - relinking the mesh if necessary, so that the order of these edges around + the event vertex matches the order in the dictionary; + - marking any terminated regions (regions which lie between two left-going + edges) as either "inside" or "outside" according to their winding number. + +When there are no left-going edges, and the event vertex is in an +"interior" region, we need to add an edge (to split the region into +monotone pieces). To do this we simply join the event vertex to the +rightmost left endpoint of the upper or lower edge of the containing +region. + +Then we process the right-going edges. This involves: + + - inserting the edges in the edge dictionary; + - computing the winding number of any newly created active regions. + We can compute this incrementally using the winding of each edge + that we cross as we walk through the dictionary. + - relinking the mesh if necessary, so that the order of these edges around + the event vertex matches the order in the dictionary; + - checking any newly adjacent edges for intersection and/or merging. + +If there are no right-going edges, again we need to add one to split +the containing region into monotone pieces. In our case it is most +convenient to add an edge to the leftmost right endpoint of either +containing edge; however we may need to change this later (see the +code for details). + + +Invariants +---------- + +These are the most important invariants maintained during the sweep. +We define a function VertLeq(v1,v2) which defines the order in which +vertices cross the sweep line, and a function EdgeLeq(e1,e2; loc) +which says whether e1 is below e2 at the sweep event location "loc". +This function is defined only at sweep event locations which lie +between the rightmost left endpoint of {e1,e2}, and the leftmost right +endpoint of {e1,e2}. + +Invariants for the Edge Dictionary. + + - Each pair of adjacent edges e2=Succ(e1) satisfies EdgeLeq(e1,e2) + at any valid location of the sweep event. + - If EdgeLeq(e2,e1) as well (at any valid sweep event), then e1 and e2 + share a common endpoint. + - For each e in the dictionary, e->Dst has been processed but not e->Org. + - Each edge e satisfies VertLeq(e->Dst,event) && VertLeq(event,e->Org) + where "event" is the current sweep line event. + - No edge e has zero length. + - No two edges have identical left and right endpoints. + +Invariants for the Mesh (the processed portion). + + - The portion of the mesh left of the sweep line is a planar graph, + ie. there is *some* way to embed it in the plane. + - No processed edge has zero length. + - No two processed vertices have identical coordinates. + - Each "inside" region is monotone, ie. can be broken into two chains + of monotonically increasing vertices according to VertLeq(v1,v2) + - a non-invariant: these chains may intersect (slightly) due to + numerical errors, but this does not affect the algorithm's operation. + +Invariants for the Sweep. + + - If a vertex has any left-going edges, then these must be in the edge + dictionary at the time the vertex is processed. + - If an edge is marked "fixUpperEdge" (it is a temporary edge introduced + by ConnectRightVertex), then it is the only right-going edge from + its associated vertex. (This says that these edges exist only + when it is necessary.) + + +Robustness +---------- + +The key to the robustness of the algorithm is maintaining the +invariants above, especially the correct ordering of the edge +dictionary. We achieve this by: + + 1. Writing the numerical computations for maximum precision rather + than maximum speed. + + 2. Making no assumptions at all about the results of the edge + intersection calculations -- for sufficiently degenerate inputs, + the computed location is not much better than a random number. + + 3. When numerical errors violate the invariants, restore them + by making *topological* changes when necessary (ie. relinking + the mesh structure). + + +Triangulation and Grouping +-------------------------- + +We finish the line sweep before doing any triangulation. This is +because even after a monotone region is complete, there can be further +changes to its vertex data because of further vertex merging. + +After triangulating all monotone regions, we want to group the +triangles into fans and strips. We do this using a greedy approach. +The triangulation itself is not optimized to reduce the number of +primitives; we just try to get a reasonable decomposition of the +computed triangulation. diff --git a/mesalib/src/glu/sgi/libtess/dict-list.h b/mesalib/src/glu/sgi/libtess/dict-list.h new file mode 100644 index 000000000..11331a76e --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/dict-list.h @@ -0,0 +1,100 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __dict_list_h_ +#define __dict_list_h_ + +/* Use #define's so that another heap implementation can use this one */ + +#define DictKey DictListKey +#define Dict DictList +#define DictNode DictListNode + +#define dictNewDict(frame,leq) __gl_dictListNewDict(frame,leq) +#define dictDeleteDict(dict) __gl_dictListDeleteDict(dict) + +#define dictSearch(dict,key) __gl_dictListSearch(dict,key) +#define dictInsert(dict,key) __gl_dictListInsert(dict,key) +#define dictInsertBefore(dict,node,key) __gl_dictListInsertBefore(dict,node,key) +#define dictDelete(dict,node) __gl_dictListDelete(dict,node) + +#define dictKey(n) __gl_dictListKey(n) +#define dictSucc(n) __gl_dictListSucc(n) +#define dictPred(n) __gl_dictListPred(n) +#define dictMin(d) __gl_dictListMin(d) +#define dictMax(d) __gl_dictListMax(d) + + + +typedef void *DictKey; +typedef struct Dict Dict; +typedef struct DictNode DictNode; + +Dict *dictNewDict( + void *frame, + int (*leq)(void *frame, DictKey key1, DictKey key2) ); + +void dictDeleteDict( Dict *dict ); + +/* Search returns the node with the smallest key greater than or equal + * to the given key. If there is no such key, returns a node whose + * key is NULL. Similarly, Succ(Max(d)) has a NULL key, etc. + */ +DictNode *dictSearch( Dict *dict, DictKey key ); +DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key ); +void dictDelete( Dict *dict, DictNode *node ); + +#define __gl_dictListKey(n) ((n)->key) +#define __gl_dictListSucc(n) ((n)->next) +#define __gl_dictListPred(n) ((n)->prev) +#define __gl_dictListMin(d) ((d)->head.next) +#define __gl_dictListMax(d) ((d)->head.prev) +#define __gl_dictListInsert(d,k) (dictInsertBefore((d),&(d)->head,(k))) + + +/*** Private data structures ***/ + +struct DictNode { + DictKey key; + DictNode *next; + DictNode *prev; +}; + +struct Dict { + DictNode head; + void *frame; + int (*leq)(void *frame, DictKey key1, DictKey key2); +}; + +#endif diff --git a/mesalib/src/glu/sgi/libtess/dict.c b/mesalib/src/glu/sgi/libtess/dict.c new file mode 100644 index 000000000..49d4f759e --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/dict.c @@ -0,0 +1,111 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include +#include "dict-list.h" +#include "memalloc.h" + +/* really __gl_dictListNewDict */ +Dict *dictNewDict( void *frame, + int (*leq)(void *frame, DictKey key1, DictKey key2) ) +{ + Dict *dict = (Dict *) memAlloc( sizeof( Dict )); + DictNode *head; + + if (dict == NULL) return NULL; + + head = &dict->head; + + head->key = NULL; + head->next = head; + head->prev = head; + + dict->frame = frame; + dict->leq = leq; + + return dict; +} + +/* really __gl_dictListDeleteDict */ +void dictDeleteDict( Dict *dict ) +{ + DictNode *node, *next; + + for( node = dict->head.next; node != &dict->head; node = next ) { + next = node->next; + memFree( node ); + } + memFree( dict ); +} + +/* really __gl_dictListInsertBefore */ +DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key ) +{ + DictNode *newNode; + + do { + node = node->prev; + } while( node->key != NULL && ! (*dict->leq)(dict->frame, node->key, key)); + + newNode = (DictNode *) memAlloc( sizeof( DictNode )); + if (newNode == NULL) return NULL; + + newNode->key = key; + newNode->next = node->next; + node->next->prev = newNode; + newNode->prev = node; + node->next = newNode; + + return newNode; +} + +/* really __gl_dictListDelete */ +void dictDelete( Dict *dict, DictNode *node ) /*ARGSUSED*/ +{ + node->next->prev = node->prev; + node->prev->next = node->next; + memFree( node ); +} + +/* really __gl_dictListSearch */ +DictNode *dictSearch( Dict *dict, DictKey key ) +{ + DictNode *node = &dict->head; + + do { + node = node->next; + } while( node->key != NULL && ! (*dict->leq)(dict->frame, key, node->key)); + + return node; +} diff --git a/mesalib/src/glu/sgi/libtess/dict.h b/mesalib/src/glu/sgi/libtess/dict.h new file mode 100644 index 000000000..11331a76e --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/dict.h @@ -0,0 +1,100 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __dict_list_h_ +#define __dict_list_h_ + +/* Use #define's so that another heap implementation can use this one */ + +#define DictKey DictListKey +#define Dict DictList +#define DictNode DictListNode + +#define dictNewDict(frame,leq) __gl_dictListNewDict(frame,leq) +#define dictDeleteDict(dict) __gl_dictListDeleteDict(dict) + +#define dictSearch(dict,key) __gl_dictListSearch(dict,key) +#define dictInsert(dict,key) __gl_dictListInsert(dict,key) +#define dictInsertBefore(dict,node,key) __gl_dictListInsertBefore(dict,node,key) +#define dictDelete(dict,node) __gl_dictListDelete(dict,node) + +#define dictKey(n) __gl_dictListKey(n) +#define dictSucc(n) __gl_dictListSucc(n) +#define dictPred(n) __gl_dictListPred(n) +#define dictMin(d) __gl_dictListMin(d) +#define dictMax(d) __gl_dictListMax(d) + + + +typedef void *DictKey; +typedef struct Dict Dict; +typedef struct DictNode DictNode; + +Dict *dictNewDict( + void *frame, + int (*leq)(void *frame, DictKey key1, DictKey key2) ); + +void dictDeleteDict( Dict *dict ); + +/* Search returns the node with the smallest key greater than or equal + * to the given key. If there is no such key, returns a node whose + * key is NULL. Similarly, Succ(Max(d)) has a NULL key, etc. + */ +DictNode *dictSearch( Dict *dict, DictKey key ); +DictNode *dictInsertBefore( Dict *dict, DictNode *node, DictKey key ); +void dictDelete( Dict *dict, DictNode *node ); + +#define __gl_dictListKey(n) ((n)->key) +#define __gl_dictListSucc(n) ((n)->next) +#define __gl_dictListPred(n) ((n)->prev) +#define __gl_dictListMin(d) ((d)->head.next) +#define __gl_dictListMax(d) ((d)->head.prev) +#define __gl_dictListInsert(d,k) (dictInsertBefore((d),&(d)->head,(k))) + + +/*** Private data structures ***/ + +struct DictNode { + DictKey key; + DictNode *next; + DictNode *prev; +}; + +struct Dict { + DictNode head; + void *frame; + int (*leq)(void *frame, DictKey key1, DictKey key2); +}; + +#endif diff --git a/mesalib/src/glu/sgi/libtess/geom.c b/mesalib/src/glu/sgi/libtess/geom.c new file mode 100644 index 000000000..7d3b8d8a6 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/geom.c @@ -0,0 +1,264 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include "mesh.h" +#include "geom.h" + +int __gl_vertLeq( GLUvertex *u, GLUvertex *v ) +{ + /* Returns TRUE if u is lexicographically <= v. */ + + return VertLeq( u, v ); +} + +GLdouble __gl_edgeEval( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* Given three vertices u,v,w such that VertLeq(u,v) && VertLeq(v,w), + * evaluates the t-coord of the edge uw at the s-coord of the vertex v. + * Returns v->t - (uw)(v->s), ie. the signed distance from uw to v. + * If uw is vertical (and thus passes thru v), the result is zero. + * + * The calculation is extremely accurate and stable, even when v + * is very close to u or w. In particular if we set v->t = 0 and + * let r be the negated result (this evaluates (uw)(v->s)), then + * r is guaranteed to satisfy MIN(u->t,w->t) <= r <= MAX(u->t,w->t). + */ + GLdouble gapL, gapR; + + assert( VertLeq( u, v ) && VertLeq( v, w )); + + gapL = v->s - u->s; + gapR = w->s - v->s; + + if( gapL + gapR > 0 ) { + if( gapL < gapR ) { + return (v->t - u->t) + (u->t - w->t) * (gapL / (gapL + gapR)); + } else { + return (v->t - w->t) + (w->t - u->t) * (gapR / (gapL + gapR)); + } + } + /* vertical line */ + return 0; +} + +GLdouble __gl_edgeSign( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* Returns a number whose sign matches EdgeEval(u,v,w) but which + * is cheaper to evaluate. Returns > 0, == 0 , or < 0 + * as v is above, on, or below the edge uw. + */ + GLdouble gapL, gapR; + + assert( VertLeq( u, v ) && VertLeq( v, w )); + + gapL = v->s - u->s; + gapR = w->s - v->s; + + if( gapL + gapR > 0 ) { + return (v->t - w->t) * gapL + (v->t - u->t) * gapR; + } + /* vertical line */ + return 0; +} + + +/*********************************************************************** + * Define versions of EdgeSign, EdgeEval with s and t transposed. + */ + +GLdouble __gl_transEval( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* Given three vertices u,v,w such that TransLeq(u,v) && TransLeq(v,w), + * evaluates the t-coord of the edge uw at the s-coord of the vertex v. + * Returns v->s - (uw)(v->t), ie. the signed distance from uw to v. + * If uw is vertical (and thus passes thru v), the result is zero. + * + * The calculation is extremely accurate and stable, even when v + * is very close to u or w. In particular if we set v->s = 0 and + * let r be the negated result (this evaluates (uw)(v->t)), then + * r is guaranteed to satisfy MIN(u->s,w->s) <= r <= MAX(u->s,w->s). + */ + GLdouble gapL, gapR; + + assert( TransLeq( u, v ) && TransLeq( v, w )); + + gapL = v->t - u->t; + gapR = w->t - v->t; + + if( gapL + gapR > 0 ) { + if( gapL < gapR ) { + return (v->s - u->s) + (u->s - w->s) * (gapL / (gapL + gapR)); + } else { + return (v->s - w->s) + (w->s - u->s) * (gapR / (gapL + gapR)); + } + } + /* vertical line */ + return 0; +} + +GLdouble __gl_transSign( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* Returns a number whose sign matches TransEval(u,v,w) but which + * is cheaper to evaluate. Returns > 0, == 0 , or < 0 + * as v is above, on, or below the edge uw. + */ + GLdouble gapL, gapR; + + assert( TransLeq( u, v ) && TransLeq( v, w )); + + gapL = v->t - u->t; + gapR = w->t - v->t; + + if( gapL + gapR > 0 ) { + return (v->s - w->s) * gapL + (v->s - u->s) * gapR; + } + /* vertical line */ + return 0; +} + + +int __gl_vertCCW( GLUvertex *u, GLUvertex *v, GLUvertex *w ) +{ + /* For almost-degenerate situations, the results are not reliable. + * Unless the floating-point arithmetic can be performed without + * rounding errors, *any* implementation will give incorrect results + * on some degenerate inputs, so the client must have some way to + * handle this situation. + */ + return (u->s*(v->t - w->t) + v->s*(w->t - u->t) + w->s*(u->t - v->t)) >= 0; +} + +/* Given parameters a,x,b,y returns the value (b*x+a*y)/(a+b), + * or (x+y)/2 if a==b==0. It requires that a,b >= 0, and enforces + * this in the rare case that one argument is slightly negative. + * The implementation is extremely stable numerically. + * In particular it guarantees that the result r satisfies + * MIN(x,y) <= r <= MAX(x,y), and the results are very accurate + * even when a and b differ greatly in magnitude. + */ +#define RealInterpolate(a,x,b,y) \ + (a = (a < 0) ? 0 : a, b = (b < 0) ? 0 : b, \ + ((a <= b) ? ((b == 0) ? ((x+y) / 2) \ + : (x + (y-x) * (a/(a+b)))) \ + : (y + (x-y) * (b/(a+b))))) + +#ifndef FOR_TRITE_TEST_PROGRAM +#define Interpolate(a,x,b,y) RealInterpolate(a,x,b,y) +#else + +/* Claim: the ONLY property the sweep algorithm relies on is that + * MIN(x,y) <= r <= MAX(x,y). This is a nasty way to test that. + */ +#include +extern int RandomInterpolate; + +GLdouble Interpolate( GLdouble a, GLdouble x, GLdouble b, GLdouble y) +{ +printf("*********************%d\n",RandomInterpolate); + if( RandomInterpolate ) { + a = 1.2 * drand48() - 0.1; + a = (a < 0) ? 0 : ((a > 1) ? 1 : a); + b = 1.0 - a; + } + return RealInterpolate(a,x,b,y); +} + +#endif + +#define Swap(a,b) if (1) { GLUvertex *t = a; a = b; b = t; } else + +void __gl_edgeIntersect( GLUvertex *o1, GLUvertex *d1, + GLUvertex *o2, GLUvertex *d2, + GLUvertex *v ) +/* Given edges (o1,d1) and (o2,d2), compute their point of intersection. + * The computed point is guaranteed to lie in the intersection of the + * bounding rectangles defined by each edge. + */ +{ + GLdouble z1, z2; + + /* This is certainly not the most efficient way to find the intersection + * of two line segments, but it is very numerically stable. + * + * Strategy: find the two middle vertices in the VertLeq ordering, + * and interpolate the intersection s-value from these. Then repeat + * using the TransLeq ordering to find the intersection t-value. + */ + + if( ! VertLeq( o1, d1 )) { Swap( o1, d1 ); } + if( ! VertLeq( o2, d2 )) { Swap( o2, d2 ); } + if( ! VertLeq( o1, o2 )) { Swap( o1, o2 ); Swap( d1, d2 ); } + + if( ! VertLeq( o2, d1 )) { + /* Technically, no intersection -- do our best */ + v->s = (o2->s + d1->s) / 2; + } else if( VertLeq( d1, d2 )) { + /* Interpolate between o2 and d1 */ + z1 = EdgeEval( o1, o2, d1 ); + z2 = EdgeEval( o2, d1, d2 ); + if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; } + v->s = Interpolate( z1, o2->s, z2, d1->s ); + } else { + /* Interpolate between o2 and d2 */ + z1 = EdgeSign( o1, o2, d1 ); + z2 = -EdgeSign( o1, d2, d1 ); + if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; } + v->s = Interpolate( z1, o2->s, z2, d2->s ); + } + + /* Now repeat the process for t */ + + if( ! TransLeq( o1, d1 )) { Swap( o1, d1 ); } + if( ! TransLeq( o2, d2 )) { Swap( o2, d2 ); } + if( ! TransLeq( o1, o2 )) { Swap( o1, o2 ); Swap( d1, d2 ); } + + if( ! TransLeq( o2, d1 )) { + /* Technically, no intersection -- do our best */ + v->t = (o2->t + d1->t) / 2; + } else if( TransLeq( d1, d2 )) { + /* Interpolate between o2 and d1 */ + z1 = TransEval( o1, o2, d1 ); + z2 = TransEval( o2, d1, d2 ); + if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; } + v->t = Interpolate( z1, o2->t, z2, d1->t ); + } else { + /* Interpolate between o2 and d2 */ + z1 = TransSign( o1, o2, d1 ); + z2 = -TransSign( o1, d2, d1 ); + if( z1+z2 < 0 ) { z1 = -z1; z2 = -z2; } + v->t = Interpolate( z1, o2->t, z2, d2->t ); + } +} diff --git a/mesalib/src/glu/sgi/libtess/geom.h b/mesalib/src/glu/sgi/libtess/geom.h new file mode 100644 index 000000000..5cb76c7d1 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/geom.h @@ -0,0 +1,84 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __geom_h_ +#define __geom_h_ + +#include "mesh.h" + +#ifdef NO_BRANCH_CONDITIONS +/* MIPS architecture has special instructions to evaluate boolean + * conditions -- more efficient than branching, IF you can get the + * compiler to generate the right instructions (SGI compiler doesn't) + */ +#define VertEq(u,v) (((u)->s == (v)->s) & ((u)->t == (v)->t)) +#define VertLeq(u,v) (((u)->s < (v)->s) | \ + ((u)->s == (v)->s & (u)->t <= (v)->t)) +#else +#define VertEq(u,v) ((u)->s == (v)->s && (u)->t == (v)->t) +#define VertLeq(u,v) (((u)->s < (v)->s) || \ + ((u)->s == (v)->s && (u)->t <= (v)->t)) +#endif + +#define EdgeEval(u,v,w) __gl_edgeEval(u,v,w) +#define EdgeSign(u,v,w) __gl_edgeSign(u,v,w) + +/* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */ + +#define TransLeq(u,v) (((u)->t < (v)->t) || \ + ((u)->t == (v)->t && (u)->s <= (v)->s)) +#define TransEval(u,v,w) __gl_transEval(u,v,w) +#define TransSign(u,v,w) __gl_transSign(u,v,w) + + +#define EdgeGoesLeft(e) VertLeq( (e)->Dst, (e)->Org ) +#define EdgeGoesRight(e) VertLeq( (e)->Org, (e)->Dst ) + +#undef ABS +#define ABS(x) ((x) < 0 ? -(x) : (x)) +#define VertL1dist(u,v) (ABS(u->s - v->s) + ABS(u->t - v->t)) + +#define VertCCW(u,v,w) __gl_vertCCW(u,v,w) + +int __gl_vertLeq( GLUvertex *u, GLUvertex *v ); +GLdouble __gl_edgeEval( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +GLdouble __gl_edgeSign( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +GLdouble __gl_transEval( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +GLdouble __gl_transSign( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +int __gl_vertCCW( GLUvertex *u, GLUvertex *v, GLUvertex *w ); +void __gl_edgeIntersect( GLUvertex *o1, GLUvertex *d1, + GLUvertex *o2, GLUvertex *d2, + GLUvertex *v ); + +#endif diff --git a/mesalib/src/glu/sgi/libtess/memalloc.c b/mesalib/src/glu/sgi/libtess/memalloc.c new file mode 100644 index 000000000..81879ef78 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/memalloc.c @@ -0,0 +1,55 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "memalloc.h" +#include "string.h" + +int __gl_memInit( size_t maxFast ) +{ +#ifndef NO_MALLOPT +/* mallopt( M_MXFAST, maxFast );*/ +#ifdef MEMORY_DEBUG + mallopt( M_DEBUG, 1 ); +#endif +#endif + return 1; +} + +#ifdef MEMORY_DEBUG +void *__gl_memAlloc( size_t n ) +{ + return memset( malloc( n ), 0xa5, n ); +} +#endif + diff --git a/mesalib/src/glu/sgi/libtess/memalloc.h b/mesalib/src/glu/sgi/libtess/memalloc.h new file mode 100644 index 000000000..c2f969b8b --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/memalloc.h @@ -0,0 +1,54 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __memalloc_simple_h_ +#define __memalloc_simple_h_ + +#include + +#define memRealloc realloc +#define memFree free + +#define memInit __gl_memInit +/*extern void __gl_memInit( size_t );*/ +extern int __gl_memInit( size_t ); + +#ifndef MEMORY_DEBUG +#define memAlloc malloc +#else +#define memAlloc __gl_memAlloc +extern void * __gl_memAlloc( size_t ); +#endif + +#endif diff --git a/mesalib/src/glu/sgi/libtess/mesh.c b/mesalib/src/glu/sgi/libtess/mesh.c new file mode 100644 index 000000000..ae861f864 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/mesh.c @@ -0,0 +1,789 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include "mesh.h" +#include "memalloc.h" + +#define TRUE 1 +#define FALSE 0 + +static GLUvertex *allocVertex() +{ + return (GLUvertex *)memAlloc( sizeof( GLUvertex )); +} + +static GLUface *allocFace() +{ + return (GLUface *)memAlloc( sizeof( GLUface )); +} + +/************************ Utility Routines ************************/ + +/* Allocate and free half-edges in pairs for efficiency. + * The *only* place that should use this fact is allocation/free. + */ +typedef struct { GLUhalfEdge e, eSym; } EdgePair; + +/* MakeEdge creates a new pair of half-edges which form their own loop. + * No vertex or face structures are allocated, but these must be assigned + * before the current edge operation is completed. + */ +static GLUhalfEdge *MakeEdge( GLUhalfEdge *eNext ) +{ + GLUhalfEdge *e; + GLUhalfEdge *eSym; + GLUhalfEdge *ePrev; + EdgePair *pair = (EdgePair *)memAlloc( sizeof( EdgePair )); + if (pair == NULL) return NULL; + + e = &pair->e; + eSym = &pair->eSym; + + /* Make sure eNext points to the first edge of the edge pair */ + if( eNext->Sym < eNext ) { eNext = eNext->Sym; } + + /* Insert in circular doubly-linked list before eNext. + * Note that the prev pointer is stored in Sym->next. + */ + ePrev = eNext->Sym->next; + eSym->next = ePrev; + ePrev->Sym->next = e; + e->next = eNext; + eNext->Sym->next = eSym; + + e->Sym = eSym; + e->Onext = e; + e->Lnext = eSym; + e->Org = NULL; + e->Lface = NULL; + e->winding = 0; + e->activeRegion = NULL; + + eSym->Sym = e; + eSym->Onext = eSym; + eSym->Lnext = e; + eSym->Org = NULL; + eSym->Lface = NULL; + eSym->winding = 0; + eSym->activeRegion = NULL; + + return e; +} + +/* Splice( a, b ) is best described by the Guibas/Stolfi paper or the + * CS348a notes (see mesh.h). Basically it modifies the mesh so that + * a->Onext and b->Onext are exchanged. This can have various effects + * depending on whether a and b belong to different face or vertex rings. + * For more explanation see __gl_meshSplice() below. + */ +static void Splice( GLUhalfEdge *a, GLUhalfEdge *b ) +{ + GLUhalfEdge *aOnext = a->Onext; + GLUhalfEdge *bOnext = b->Onext; + + aOnext->Sym->Lnext = b; + bOnext->Sym->Lnext = a; + a->Onext = bOnext; + b->Onext = aOnext; +} + +/* MakeVertex( newVertex, eOrig, vNext ) attaches a new vertex and makes it the + * origin of all edges in the vertex loop to which eOrig belongs. "vNext" gives + * a place to insert the new vertex in the global vertex list. We insert + * the new vertex *before* vNext so that algorithms which walk the vertex + * list will not see the newly created vertices. + */ +static void MakeVertex( GLUvertex *newVertex, + GLUhalfEdge *eOrig, GLUvertex *vNext ) +{ + GLUhalfEdge *e; + GLUvertex *vPrev; + GLUvertex *vNew = newVertex; + + assert(vNew != NULL); + + /* insert in circular doubly-linked list before vNext */ + vPrev = vNext->prev; + vNew->prev = vPrev; + vPrev->next = vNew; + vNew->next = vNext; + vNext->prev = vNew; + + vNew->anEdge = eOrig; + vNew->data = NULL; + /* leave coords, s, t undefined */ + + /* fix other edges on this vertex loop */ + e = eOrig; + do { + e->Org = vNew; + e = e->Onext; + } while( e != eOrig ); +} + +/* MakeFace( newFace, eOrig, fNext ) attaches a new face and makes it the left + * face of all edges in the face loop to which eOrig belongs. "fNext" gives + * a place to insert the new face in the global face list. We insert + * the new face *before* fNext so that algorithms which walk the face + * list will not see the newly created faces. + */ +static void MakeFace( GLUface *newFace, GLUhalfEdge *eOrig, GLUface *fNext ) +{ + GLUhalfEdge *e; + GLUface *fPrev; + GLUface *fNew = newFace; + + assert(fNew != NULL); + + /* insert in circular doubly-linked list before fNext */ + fPrev = fNext->prev; + fNew->prev = fPrev; + fPrev->next = fNew; + fNew->next = fNext; + fNext->prev = fNew; + + fNew->anEdge = eOrig; + fNew->data = NULL; + fNew->trail = NULL; + fNew->marked = FALSE; + + /* The new face is marked "inside" if the old one was. This is a + * convenience for the common case where a face has been split in two. + */ + fNew->inside = fNext->inside; + + /* fix other edges on this face loop */ + e = eOrig; + do { + e->Lface = fNew; + e = e->Lnext; + } while( e != eOrig ); +} + +/* KillEdge( eDel ) destroys an edge (the half-edges eDel and eDel->Sym), + * and removes from the global edge list. + */ +static void KillEdge( GLUhalfEdge *eDel ) +{ + GLUhalfEdge *ePrev, *eNext; + + /* Half-edges are allocated in pairs, see EdgePair above */ + if( eDel->Sym < eDel ) { eDel = eDel->Sym; } + + /* delete from circular doubly-linked list */ + eNext = eDel->next; + ePrev = eDel->Sym->next; + eNext->Sym->next = ePrev; + ePrev->Sym->next = eNext; + + memFree( eDel ); +} + + +/* KillVertex( vDel ) destroys a vertex and removes it from the global + * vertex list. It updates the vertex loop to point to a given new vertex. + */ +static void KillVertex( GLUvertex *vDel, GLUvertex *newOrg ) +{ + GLUhalfEdge *e, *eStart = vDel->anEdge; + GLUvertex *vPrev, *vNext; + + /* change the origin of all affected edges */ + e = eStart; + do { + e->Org = newOrg; + e = e->Onext; + } while( e != eStart ); + + /* delete from circular doubly-linked list */ + vPrev = vDel->prev; + vNext = vDel->next; + vNext->prev = vPrev; + vPrev->next = vNext; + + memFree( vDel ); +} + +/* KillFace( fDel ) destroys a face and removes it from the global face + * list. It updates the face loop to point to a given new face. + */ +static void KillFace( GLUface *fDel, GLUface *newLface ) +{ + GLUhalfEdge *e, *eStart = fDel->anEdge; + GLUface *fPrev, *fNext; + + /* change the left face of all affected edges */ + e = eStart; + do { + e->Lface = newLface; + e = e->Lnext; + } while( e != eStart ); + + /* delete from circular doubly-linked list */ + fPrev = fDel->prev; + fNext = fDel->next; + fNext->prev = fPrev; + fPrev->next = fNext; + + memFree( fDel ); +} + + +/****************** Basic Edge Operations **********************/ + +/* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face). + * The loop consists of the two new half-edges. + */ +GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh ) +{ + GLUvertex *newVertex1= allocVertex(); + GLUvertex *newVertex2= allocVertex(); + GLUface *newFace= allocFace(); + GLUhalfEdge *e; + + /* if any one is null then all get freed */ + if (newVertex1 == NULL || newVertex2 == NULL || newFace == NULL) { + if (newVertex1 != NULL) memFree(newVertex1); + if (newVertex2 != NULL) memFree(newVertex2); + if (newFace != NULL) memFree(newFace); + return NULL; + } + + e = MakeEdge( &mesh->eHead ); + if (e == NULL) return NULL; + + MakeVertex( newVertex1, e, &mesh->vHead ); + MakeVertex( newVertex2, e->Sym, &mesh->vHead ); + MakeFace( newFace, e, &mesh->fHead ); + return e; +} + + +/* __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the + * mesh connectivity and topology. It changes the mesh so that + * eOrg->Onext <- OLD( eDst->Onext ) + * eDst->Onext <- OLD( eOrg->Onext ) + * where OLD(...) means the value before the meshSplice operation. + * + * This can have two effects on the vertex structure: + * - if eOrg->Org != eDst->Org, the two vertices are merged together + * - if eOrg->Org == eDst->Org, the origin is split into two vertices + * In both cases, eDst->Org is changed and eOrg->Org is untouched. + * + * Similarly (and independently) for the face structure, + * - if eOrg->Lface == eDst->Lface, one loop is split into two + * - if eOrg->Lface != eDst->Lface, two distinct loops are joined into one + * In both cases, eDst->Lface is changed and eOrg->Lface is unaffected. + * + * Some special cases: + * If eDst == eOrg, the operation has no effect. + * If eDst == eOrg->Lnext, the new face will have a single edge. + * If eDst == eOrg->Lprev, the old face will have a single edge. + * If eDst == eOrg->Onext, the new vertex will have a single edge. + * If eDst == eOrg->Oprev, the old vertex will have a single edge. + */ +int __gl_meshSplice( GLUhalfEdge *eOrg, GLUhalfEdge *eDst ) +{ + int joiningLoops = FALSE; + int joiningVertices = FALSE; + + if( eOrg == eDst ) return 1; + + if( eDst->Org != eOrg->Org ) { + /* We are merging two disjoint vertices -- destroy eDst->Org */ + joiningVertices = TRUE; + KillVertex( eDst->Org, eOrg->Org ); + } + if( eDst->Lface != eOrg->Lface ) { + /* We are connecting two disjoint loops -- destroy eDst->Lface */ + joiningLoops = TRUE; + KillFace( eDst->Lface, eOrg->Lface ); + } + + /* Change the edge structure */ + Splice( eDst, eOrg ); + + if( ! joiningVertices ) { + GLUvertex *newVertex= allocVertex(); + if (newVertex == NULL) return 0; + + /* We split one vertex into two -- the new vertex is eDst->Org. + * Make sure the old vertex points to a valid half-edge. + */ + MakeVertex( newVertex, eDst, eOrg->Org ); + eOrg->Org->anEdge = eOrg; + } + if( ! joiningLoops ) { + GLUface *newFace= allocFace(); + if (newFace == NULL) return 0; + + /* We split one loop into two -- the new loop is eDst->Lface. + * Make sure the old face points to a valid half-edge. + */ + MakeFace( newFace, eDst, eOrg->Lface ); + eOrg->Lface->anEdge = eOrg; + } + + return 1; +} + + +/* __gl_meshDelete( eDel ) removes the edge eDel. There are several cases: + * if (eDel->Lface != eDel->Rface), we join two loops into one; the loop + * eDel->Lface is deleted. Otherwise, we are splitting one loop into two; + * the newly created loop will contain eDel->Dst. If the deletion of eDel + * would create isolated vertices, those are deleted as well. + * + * This function could be implemented as two calls to __gl_meshSplice + * plus a few calls to memFree, but this would allocate and delete + * unnecessary vertices and faces. + */ +int __gl_meshDelete( GLUhalfEdge *eDel ) +{ + GLUhalfEdge *eDelSym = eDel->Sym; + int joiningLoops = FALSE; + + /* First step: disconnect the origin vertex eDel->Org. We make all + * changes to get a consistent mesh in this "intermediate" state. + */ + if( eDel->Lface != eDel->Rface ) { + /* We are joining two loops into one -- remove the left face */ + joiningLoops = TRUE; + KillFace( eDel->Lface, eDel->Rface ); + } + + if( eDel->Onext == eDel ) { + KillVertex( eDel->Org, NULL ); + } else { + /* Make sure that eDel->Org and eDel->Rface point to valid half-edges */ + eDel->Rface->anEdge = eDel->Oprev; + eDel->Org->anEdge = eDel->Onext; + + Splice( eDel, eDel->Oprev ); + if( ! joiningLoops ) { + GLUface *newFace= allocFace(); + if (newFace == NULL) return 0; + + /* We are splitting one loop into two -- create a new loop for eDel. */ + MakeFace( newFace, eDel, eDel->Lface ); + } + } + + /* Claim: the mesh is now in a consistent state, except that eDel->Org + * may have been deleted. Now we disconnect eDel->Dst. + */ + if( eDelSym->Onext == eDelSym ) { + KillVertex( eDelSym->Org, NULL ); + KillFace( eDelSym->Lface, NULL ); + } else { + /* Make sure that eDel->Dst and eDel->Lface point to valid half-edges */ + eDel->Lface->anEdge = eDelSym->Oprev; + eDelSym->Org->anEdge = eDelSym->Onext; + Splice( eDelSym, eDelSym->Oprev ); + } + + /* Any isolated vertices or faces have already been freed. */ + KillEdge( eDel ); + + return 1; +} + + +/******************** Other Edge Operations **********************/ + +/* All these routines can be implemented with the basic edge + * operations above. They are provided for convenience and efficiency. + */ + + +/* __gl_meshAddEdgeVertex( eOrg ) creates a new edge eNew such that + * eNew == eOrg->Lnext, and eNew->Dst is a newly created vertex. + * eOrg and eNew will have the same left face. + */ +GLUhalfEdge *__gl_meshAddEdgeVertex( GLUhalfEdge *eOrg ) +{ + GLUhalfEdge *eNewSym; + GLUhalfEdge *eNew = MakeEdge( eOrg ); + if (eNew == NULL) return NULL; + + eNewSym = eNew->Sym; + + /* Connect the new edge appropriately */ + Splice( eNew, eOrg->Lnext ); + + /* Set the vertex and face information */ + eNew->Org = eOrg->Dst; + { + GLUvertex *newVertex= allocVertex(); + if (newVertex == NULL) return NULL; + + MakeVertex( newVertex, eNewSym, eNew->Org ); + } + eNew->Lface = eNewSym->Lface = eOrg->Lface; + + return eNew; +} + + +/* __gl_meshSplitEdge( eOrg ) splits eOrg into two edges eOrg and eNew, + * such that eNew == eOrg->Lnext. The new vertex is eOrg->Dst == eNew->Org. + * eOrg and eNew will have the same left face. + */ +GLUhalfEdge *__gl_meshSplitEdge( GLUhalfEdge *eOrg ) +{ + GLUhalfEdge *eNew; + GLUhalfEdge *tempHalfEdge= __gl_meshAddEdgeVertex( eOrg ); + if (tempHalfEdge == NULL) return NULL; + + eNew = tempHalfEdge->Sym; + + /* Disconnect eOrg from eOrg->Dst and connect it to eNew->Org */ + Splice( eOrg->Sym, eOrg->Sym->Oprev ); + Splice( eOrg->Sym, eNew ); + + /* Set the vertex and face information */ + eOrg->Dst = eNew->Org; + eNew->Dst->anEdge = eNew->Sym; /* may have pointed to eOrg->Sym */ + eNew->Rface = eOrg->Rface; + eNew->winding = eOrg->winding; /* copy old winding information */ + eNew->Sym->winding = eOrg->Sym->winding; + + return eNew; +} + + +/* __gl_meshConnect( eOrg, eDst ) creates a new edge from eOrg->Dst + * to eDst->Org, and returns the corresponding half-edge eNew. + * If eOrg->Lface == eDst->Lface, this splits one loop into two, + * and the newly created loop is eNew->Lface. Otherwise, two disjoint + * loops are merged into one, and the loop eDst->Lface is destroyed. + * + * If (eOrg == eDst), the new face will have only two edges. + * If (eOrg->Lnext == eDst), the old face is reduced to a single edge. + * If (eOrg->Lnext->Lnext == eDst), the old face is reduced to two edges. + */ +GLUhalfEdge *__gl_meshConnect( GLUhalfEdge *eOrg, GLUhalfEdge *eDst ) +{ + GLUhalfEdge *eNewSym; + int joiningLoops = FALSE; + GLUhalfEdge *eNew = MakeEdge( eOrg ); + if (eNew == NULL) return NULL; + + eNewSym = eNew->Sym; + + if( eDst->Lface != eOrg->Lface ) { + /* We are connecting two disjoint loops -- destroy eDst->Lface */ + joiningLoops = TRUE; + KillFace( eDst->Lface, eOrg->Lface ); + } + + /* Connect the new edge appropriately */ + Splice( eNew, eOrg->Lnext ); + Splice( eNewSym, eDst ); + + /* Set the vertex and face information */ + eNew->Org = eOrg->Dst; + eNewSym->Org = eDst->Org; + eNew->Lface = eNewSym->Lface = eOrg->Lface; + + /* Make sure the old face points to a valid half-edge */ + eOrg->Lface->anEdge = eNewSym; + + if( ! joiningLoops ) { + GLUface *newFace= allocFace(); + if (newFace == NULL) return NULL; + + /* We split one loop into two -- the new loop is eNew->Lface */ + MakeFace( newFace, eNew, eOrg->Lface ); + } + return eNew; +} + + +/******************** Other Operations **********************/ + +/* __gl_meshZapFace( fZap ) destroys a face and removes it from the + * global face list. All edges of fZap will have a NULL pointer as their + * left face. Any edges which also have a NULL pointer as their right face + * are deleted entirely (along with any isolated vertices this produces). + * An entire mesh can be deleted by zapping its faces, one at a time, + * in any order. Zapped faces cannot be used in further mesh operations! + */ +void __gl_meshZapFace( GLUface *fZap ) +{ + GLUhalfEdge *eStart = fZap->anEdge; + GLUhalfEdge *e, *eNext, *eSym; + GLUface *fPrev, *fNext; + + /* walk around face, deleting edges whose right face is also NULL */ + eNext = eStart->Lnext; + do { + e = eNext; + eNext = e->Lnext; + + e->Lface = NULL; + if( e->Rface == NULL ) { + /* delete the edge -- see __gl_MeshDelete above */ + + if( e->Onext == e ) { + KillVertex( e->Org, NULL ); + } else { + /* Make sure that e->Org points to a valid half-edge */ + e->Org->anEdge = e->Onext; + Splice( e, e->Oprev ); + } + eSym = e->Sym; + if( eSym->Onext == eSym ) { + KillVertex( eSym->Org, NULL ); + } else { + /* Make sure that eSym->Org points to a valid half-edge */ + eSym->Org->anEdge = eSym->Onext; + Splice( eSym, eSym->Oprev ); + } + KillEdge( e ); + } + } while( e != eStart ); + + /* delete from circular doubly-linked list */ + fPrev = fZap->prev; + fNext = fZap->next; + fNext->prev = fPrev; + fPrev->next = fNext; + + memFree( fZap ); +} + + +/* __gl_meshNewMesh() creates a new mesh with no edges, no vertices, + * and no loops (what we usually call a "face"). + */ +GLUmesh *__gl_meshNewMesh( void ) +{ + GLUvertex *v; + GLUface *f; + GLUhalfEdge *e; + GLUhalfEdge *eSym; + GLUmesh *mesh = (GLUmesh *)memAlloc( sizeof( GLUmesh )); + if (mesh == NULL) { + return NULL; + } + + v = &mesh->vHead; + f = &mesh->fHead; + e = &mesh->eHead; + eSym = &mesh->eHeadSym; + + v->next = v->prev = v; + v->anEdge = NULL; + v->data = NULL; + + f->next = f->prev = f; + f->anEdge = NULL; + f->data = NULL; + f->trail = NULL; + f->marked = FALSE; + f->inside = FALSE; + + e->next = e; + e->Sym = eSym; + e->Onext = NULL; + e->Lnext = NULL; + e->Org = NULL; + e->Lface = NULL; + e->winding = 0; + e->activeRegion = NULL; + + eSym->next = eSym; + eSym->Sym = e; + eSym->Onext = NULL; + eSym->Lnext = NULL; + eSym->Org = NULL; + eSym->Lface = NULL; + eSym->winding = 0; + eSym->activeRegion = NULL; + + return mesh; +} + + +/* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in + * both meshes, and returns the new mesh (the old meshes are destroyed). + */ +GLUmesh *__gl_meshUnion( GLUmesh *mesh1, GLUmesh *mesh2 ) +{ + GLUface *f1 = &mesh1->fHead; + GLUvertex *v1 = &mesh1->vHead; + GLUhalfEdge *e1 = &mesh1->eHead; + GLUface *f2 = &mesh2->fHead; + GLUvertex *v2 = &mesh2->vHead; + GLUhalfEdge *e2 = &mesh2->eHead; + + /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */ + if( f2->next != f2 ) { + f1->prev->next = f2->next; + f2->next->prev = f1->prev; + f2->prev->next = f1; + f1->prev = f2->prev; + } + + if( v2->next != v2 ) { + v1->prev->next = v2->next; + v2->next->prev = v1->prev; + v2->prev->next = v1; + v1->prev = v2->prev; + } + + if( e2->next != e2 ) { + e1->Sym->next->Sym->next = e2->next; + e2->next->Sym->next = e1->Sym->next; + e2->Sym->next->Sym->next = e1; + e1->Sym->next = e2->Sym->next; + } + + memFree( mesh2 ); + return mesh1; +} + + +#ifdef DELETE_BY_ZAPPING + +/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. + */ +void __gl_meshDeleteMesh( GLUmesh *mesh ) +{ + GLUface *fHead = &mesh->fHead; + + while( fHead->next != fHead ) { + __gl_meshZapFace( fHead->next ); + } + assert( mesh->vHead.next == &mesh->vHead ); + + memFree( mesh ); +} + +#else + +/* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. + */ +void __gl_meshDeleteMesh( GLUmesh *mesh ) +{ + GLUface *f, *fNext; + GLUvertex *v, *vNext; + GLUhalfEdge *e, *eNext; + + for( f = mesh->fHead.next; f != &mesh->fHead; f = fNext ) { + fNext = f->next; + memFree( f ); + } + + for( v = mesh->vHead.next; v != &mesh->vHead; v = vNext ) { + vNext = v->next; + memFree( v ); + } + + for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) { + /* One call frees both e and e->Sym (see EdgePair above) */ + eNext = e->next; + memFree( e ); + } + + memFree( mesh ); +} + +#endif + +#ifndef NDEBUG + +/* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. + */ +void __gl_meshCheckMesh( GLUmesh *mesh ) +{ + GLUface *fHead = &mesh->fHead; + GLUvertex *vHead = &mesh->vHead; + GLUhalfEdge *eHead = &mesh->eHead; + GLUface *f, *fPrev; + GLUvertex *v, *vPrev; + GLUhalfEdge *e, *ePrev; + + fPrev = fHead; + for( fPrev = fHead ; (f = fPrev->next) != fHead; fPrev = f) { + assert( f->prev == fPrev ); + e = f->anEdge; + do { + assert( e->Sym != e ); + assert( e->Sym->Sym == e ); + assert( e->Lnext->Onext->Sym == e ); + assert( e->Onext->Sym->Lnext == e ); + assert( e->Lface == f ); + e = e->Lnext; + } while( e != f->anEdge ); + } + assert( f->prev == fPrev && f->anEdge == NULL && f->data == NULL ); + + vPrev = vHead; + for( vPrev = vHead ; (v = vPrev->next) != vHead; vPrev = v) { + assert( v->prev == vPrev ); + e = v->anEdge; + do { + assert( e->Sym != e ); + assert( e->Sym->Sym == e ); + assert( e->Lnext->Onext->Sym == e ); + assert( e->Onext->Sym->Lnext == e ); + assert( e->Org == v ); + e = e->Onext; + } while( e != v->anEdge ); + } + assert( v->prev == vPrev && v->anEdge == NULL && v->data == NULL ); + + ePrev = eHead; + for( ePrev = eHead ; (e = ePrev->next) != eHead; ePrev = e) { + assert( e->Sym->next == ePrev->Sym ); + assert( e->Sym != e ); + assert( e->Sym->Sym == e ); + assert( e->Org != NULL ); + assert( e->Dst != NULL ); + assert( e->Lnext->Onext->Sym == e ); + assert( e->Onext->Sym->Lnext == e ); + } + assert( e->Sym->next == ePrev->Sym + && e->Sym == &mesh->eHeadSym + && e->Sym->Sym == e + && e->Org == NULL && e->Dst == NULL + && e->Lface == NULL && e->Rface == NULL ); +} + +#endif diff --git a/mesalib/src/glu/sgi/libtess/mesh.h b/mesalib/src/glu/sgi/libtess/mesh.h new file mode 100644 index 000000000..690c5f2f6 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/mesh.h @@ -0,0 +1,266 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __mesh_h_ +#define __mesh_h_ + +#include + +typedef struct GLUmesh GLUmesh; + +typedef struct GLUvertex GLUvertex; +typedef struct GLUface GLUface; +typedef struct GLUhalfEdge GLUhalfEdge; + +typedef struct ActiveRegion ActiveRegion; /* Internal data */ + +/* The mesh structure is similar in spirit, notation, and operations + * to the "quad-edge" structure (see L. Guibas and J. Stolfi, Primitives + * for the manipulation of general subdivisions and the computation of + * Voronoi diagrams, ACM Transactions on Graphics, 4(2):74-123, April 1985). + * For a simplified description, see the course notes for CS348a, + * "Mathematical Foundations of Computer Graphics", available at the + * Stanford bookstore (and taught during the fall quarter). + * The implementation also borrows a tiny subset of the graph-based approach + * use in Mantyla's Geometric Work Bench (see M. Mantyla, An Introduction + * to Sold Modeling, Computer Science Press, Rockville, Maryland, 1988). + * + * The fundamental data structure is the "half-edge". Two half-edges + * go together to make an edge, but they point in opposite directions. + * Each half-edge has a pointer to its mate (the "symmetric" half-edge Sym), + * its origin vertex (Org), the face on its left side (Lface), and the + * adjacent half-edges in the CCW direction around the origin vertex + * (Onext) and around the left face (Lnext). There is also a "next" + * pointer for the global edge list (see below). + * + * The notation used for mesh navigation: + * Sym = the mate of a half-edge (same edge, but opposite direction) + * Onext = edge CCW around origin vertex (keep same origin) + * Dnext = edge CCW around destination vertex (keep same dest) + * Lnext = edge CCW around left face (dest becomes new origin) + * Rnext = edge CCW around right face (origin becomes new dest) + * + * "prev" means to substitute CW for CCW in the definitions above. + * + * The mesh keeps global lists of all vertices, faces, and edges, + * stored as doubly-linked circular lists with a dummy header node. + * The mesh stores pointers to these dummy headers (vHead, fHead, eHead). + * + * The circular edge list is special; since half-edges always occur + * in pairs (e and e->Sym), each half-edge stores a pointer in only + * one direction. Starting at eHead and following the e->next pointers + * will visit each *edge* once (ie. e or e->Sym, but not both). + * e->Sym stores a pointer in the opposite direction, thus it is + * always true that e->Sym->next->Sym->next == e. + * + * Each vertex has a pointer to next and previous vertices in the + * circular list, and a pointer to a half-edge with this vertex as + * the origin (NULL if this is the dummy header). There is also a + * field "data" for client data. + * + * Each face has a pointer to the next and previous faces in the + * circular list, and a pointer to a half-edge with this face as + * the left face (NULL if this is the dummy header). There is also + * a field "data" for client data. + * + * Note that what we call a "face" is really a loop; faces may consist + * of more than one loop (ie. not simply connected), but there is no + * record of this in the data structure. The mesh may consist of + * several disconnected regions, so it may not be possible to visit + * the entire mesh by starting at a half-edge and traversing the edge + * structure. + * + * The mesh does NOT support isolated vertices; a vertex is deleted along + * with its last edge. Similarly when two faces are merged, one of the + * faces is deleted (see __gl_meshDelete below). For mesh operations, + * all face (loop) and vertex pointers must not be NULL. However, once + * mesh manipulation is finished, __gl_MeshZapFace can be used to delete + * faces of the mesh, one at a time. All external faces can be "zapped" + * before the mesh is returned to the client; then a NULL face indicates + * a region which is not part of the output polygon. + */ + +struct GLUvertex { + GLUvertex *next; /* next vertex (never NULL) */ + GLUvertex *prev; /* previous vertex (never NULL) */ + GLUhalfEdge *anEdge; /* a half-edge with this origin */ + void *data; /* client's data */ + + /* Internal data (keep hidden) */ + GLdouble coords[3]; /* vertex location in 3D */ + GLdouble s, t; /* projection onto the sweep plane */ + long pqHandle; /* to allow deletion from priority queue */ +}; + +struct GLUface { + GLUface *next; /* next face (never NULL) */ + GLUface *prev; /* previous face (never NULL) */ + GLUhalfEdge *anEdge; /* a half edge with this left face */ + void *data; /* room for client's data */ + + /* Internal data (keep hidden) */ + GLUface *trail; /* "stack" for conversion to strips */ + GLboolean marked; /* flag for conversion to strips */ + GLboolean inside; /* this face is in the polygon interior */ +}; + +struct GLUhalfEdge { + GLUhalfEdge *next; /* doubly-linked list (prev==Sym->next) */ + GLUhalfEdge *Sym; /* same edge, opposite direction */ + GLUhalfEdge *Onext; /* next edge CCW around origin */ + GLUhalfEdge *Lnext; /* next edge CCW around left face */ + GLUvertex *Org; /* origin vertex (Overtex too long) */ + GLUface *Lface; /* left face */ + + /* Internal data (keep hidden) */ + ActiveRegion *activeRegion; /* a region with this upper edge (sweep.c) */ + int winding; /* change in winding number when crossing + from the right face to the left face */ +}; + +#define Rface Sym->Lface +#define Dst Sym->Org + +#define Oprev Sym->Lnext +#define Lprev Onext->Sym +#define Dprev Lnext->Sym +#define Rprev Sym->Onext +#define Dnext Rprev->Sym /* 3 pointers */ +#define Rnext Oprev->Sym /* 3 pointers */ + + +struct GLUmesh { + GLUvertex vHead; /* dummy header for vertex list */ + GLUface fHead; /* dummy header for face list */ + GLUhalfEdge eHead; /* dummy header for edge list */ + GLUhalfEdge eHeadSym; /* and its symmetric counterpart */ +}; + +/* The mesh operations below have three motivations: completeness, + * convenience, and efficiency. The basic mesh operations are MakeEdge, + * Splice, and Delete. All the other edge operations can be implemented + * in terms of these. The other operations are provided for convenience + * and/or efficiency. + * + * When a face is split or a vertex is added, they are inserted into the + * global list *before* the existing vertex or face (ie. e->Org or e->Lface). + * This makes it easier to process all vertices or faces in the global lists + * without worrying about processing the same data twice. As a convenience, + * when a face is split, the "inside" flag is copied from the old face. + * Other internal data (v->data, v->activeRegion, f->data, f->marked, + * f->trail, e->winding) is set to zero. + * + * ********************** Basic Edge Operations ************************** + * + * __gl_meshMakeEdge( mesh ) creates one edge, two vertices, and a loop. + * The loop (face) consists of the two new half-edges. + * + * __gl_meshSplice( eOrg, eDst ) is the basic operation for changing the + * mesh connectivity and topology. It changes the mesh so that + * eOrg->Onext <- OLD( eDst->Onext ) + * eDst->Onext <- OLD( eOrg->Onext ) + * where OLD(...) means the value before the meshSplice operation. + * + * This can have two effects on the vertex structure: + * - if eOrg->Org != eDst->Org, the two vertices are merged together + * - if eOrg->Org == eDst->Org, the origin is split into two vertices + * In both cases, eDst->Org is changed and eOrg->Org is untouched. + * + * Similarly (and independently) for the face structure, + * - if eOrg->Lface == eDst->Lface, one loop is split into two + * - if eOrg->Lface != eDst->Lface, two distinct loops are joined into one + * In both cases, eDst->Lface is changed and eOrg->Lface is unaffected. + * + * __gl_meshDelete( eDel ) removes the edge eDel. There are several cases: + * if (eDel->Lface != eDel->Rface), we join two loops into one; the loop + * eDel->Lface is deleted. Otherwise, we are splitting one loop into two; + * the newly created loop will contain eDel->Dst. If the deletion of eDel + * would create isolated vertices, those are deleted as well. + * + * ********************** Other Edge Operations ************************** + * + * __gl_meshAddEdgeVertex( eOrg ) creates a new edge eNew such that + * eNew == eOrg->Lnext, and eNew->Dst is a newly created vertex. + * eOrg and eNew will have the same left face. + * + * __gl_meshSplitEdge( eOrg ) splits eOrg into two edges eOrg and eNew, + * such that eNew == eOrg->Lnext. The new vertex is eOrg->Dst == eNew->Org. + * eOrg and eNew will have the same left face. + * + * __gl_meshConnect( eOrg, eDst ) creates a new edge from eOrg->Dst + * to eDst->Org, and returns the corresponding half-edge eNew. + * If eOrg->Lface == eDst->Lface, this splits one loop into two, + * and the newly created loop is eNew->Lface. Otherwise, two disjoint + * loops are merged into one, and the loop eDst->Lface is destroyed. + * + * ************************ Other Operations ***************************** + * + * __gl_meshNewMesh() creates a new mesh with no edges, no vertices, + * and no loops (what we usually call a "face"). + * + * __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in + * both meshes, and returns the new mesh (the old meshes are destroyed). + * + * __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. + * + * __gl_meshZapFace( fZap ) destroys a face and removes it from the + * global face list. All edges of fZap will have a NULL pointer as their + * left face. Any edges which also have a NULL pointer as their right face + * are deleted entirely (along with any isolated vertices this produces). + * An entire mesh can be deleted by zapping its faces, one at a time, + * in any order. Zapped faces cannot be used in further mesh operations! + * + * __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. + */ + +GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh ); +int __gl_meshSplice( GLUhalfEdge *eOrg, GLUhalfEdge *eDst ); +int __gl_meshDelete( GLUhalfEdge *eDel ); + +GLUhalfEdge *__gl_meshAddEdgeVertex( GLUhalfEdge *eOrg ); +GLUhalfEdge *__gl_meshSplitEdge( GLUhalfEdge *eOrg ); +GLUhalfEdge *__gl_meshConnect( GLUhalfEdge *eOrg, GLUhalfEdge *eDst ); + +GLUmesh *__gl_meshNewMesh( void ); +GLUmesh *__gl_meshUnion( GLUmesh *mesh1, GLUmesh *mesh2 ); +void __gl_meshDeleteMesh( GLUmesh *mesh ); +void __gl_meshZapFace( GLUface *fZap ); + +#ifdef NDEBUG +#define __gl_meshCheckMesh( mesh ) +#else +void __gl_meshCheckMesh( GLUmesh *mesh ); +#endif + +#endif diff --git a/mesalib/src/glu/sgi/libtess/normal.c b/mesalib/src/glu/sgi/libtess/normal.c new file mode 100644 index 000000000..0a2494be3 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/normal.c @@ -0,0 +1,253 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include "mesh.h" +#include "tess.h" +#include "normal.h" +#include +#include + +#define TRUE 1 +#define FALSE 0 + +#define Dot(u,v) (u[0]*v[0] + u[1]*v[1] + u[2]*v[2]) + +#if 0 +static void Normalize( GLdouble v[3] ) +{ + GLdouble len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; + + assert( len > 0 ); + len = sqrt( len ); + v[0] /= len; + v[1] /= len; + v[2] /= len; +} +#endif + +#undef ABS +#define ABS(x) ((x) < 0 ? -(x) : (x)) + +static int LongAxis( GLdouble v[3] ) +{ + int i = 0; + + if( ABS(v[1]) > ABS(v[0]) ) { i = 1; } + if( ABS(v[2]) > ABS(v[i]) ) { i = 2; } + return i; +} + +static void ComputeNormal( GLUtesselator *tess, GLdouble norm[3] ) +{ + GLUvertex *v, *v1, *v2; + GLdouble c, tLen2, maxLen2; + GLdouble maxVal[3], minVal[3], d1[3], d2[3], tNorm[3]; + GLUvertex *maxVert[3], *minVert[3]; + GLUvertex *vHead = &tess->mesh->vHead; + int i; + + maxVal[0] = maxVal[1] = maxVal[2] = -2 * GLU_TESS_MAX_COORD; + minVal[0] = minVal[1] = minVal[2] = 2 * GLU_TESS_MAX_COORD; + + for( v = vHead->next; v != vHead; v = v->next ) { + for( i = 0; i < 3; ++i ) { + c = v->coords[i]; + if( c < minVal[i] ) { minVal[i] = c; minVert[i] = v; } + if( c > maxVal[i] ) { maxVal[i] = c; maxVert[i] = v; } + } + } + + /* Find two vertices separated by at least 1/sqrt(3) of the maximum + * distance between any two vertices + */ + i = 0; + if( maxVal[1] - minVal[1] > maxVal[0] - minVal[0] ) { i = 1; } + if( maxVal[2] - minVal[2] > maxVal[i] - minVal[i] ) { i = 2; } + if( minVal[i] >= maxVal[i] ) { + /* All vertices are the same -- normal doesn't matter */ + norm[0] = 0; norm[1] = 0; norm[2] = 1; + return; + } + + /* Look for a third vertex which forms the triangle with maximum area + * (Length of normal == twice the triangle area) + */ + maxLen2 = 0; + v1 = minVert[i]; + v2 = maxVert[i]; + d1[0] = v1->coords[0] - v2->coords[0]; + d1[1] = v1->coords[1] - v2->coords[1]; + d1[2] = v1->coords[2] - v2->coords[2]; + for( v = vHead->next; v != vHead; v = v->next ) { + d2[0] = v->coords[0] - v2->coords[0]; + d2[1] = v->coords[1] - v2->coords[1]; + d2[2] = v->coords[2] - v2->coords[2]; + tNorm[0] = d1[1]*d2[2] - d1[2]*d2[1]; + tNorm[1] = d1[2]*d2[0] - d1[0]*d2[2]; + tNorm[2] = d1[0]*d2[1] - d1[1]*d2[0]; + tLen2 = tNorm[0]*tNorm[0] + tNorm[1]*tNorm[1] + tNorm[2]*tNorm[2]; + if( tLen2 > maxLen2 ) { + maxLen2 = tLen2; + norm[0] = tNorm[0]; + norm[1] = tNorm[1]; + norm[2] = tNorm[2]; + } + } + + if( maxLen2 <= 0 ) { + /* All points lie on a single line -- any decent normal will do */ + norm[0] = norm[1] = norm[2] = 0; + norm[LongAxis(d1)] = 1; + } +} + + +static void CheckOrientation( GLUtesselator *tess ) +{ + GLdouble area; + GLUface *f, *fHead = &tess->mesh->fHead; + GLUvertex *v, *vHead = &tess->mesh->vHead; + GLUhalfEdge *e; + + /* When we compute the normal automatically, we choose the orientation + * so that the the sum of the signed areas of all contours is non-negative. + */ + area = 0; + for( f = fHead->next; f != fHead; f = f->next ) { + e = f->anEdge; + if( e->winding <= 0 ) continue; + do { + area += (e->Org->s - e->Dst->s) * (e->Org->t + e->Dst->t); + e = e->Lnext; + } while( e != f->anEdge ); + } + if( area < 0 ) { + /* Reverse the orientation by flipping all the t-coordinates */ + for( v = vHead->next; v != vHead; v = v->next ) { + v->t = - v->t; + } + tess->tUnit[0] = - tess->tUnit[0]; + tess->tUnit[1] = - tess->tUnit[1]; + tess->tUnit[2] = - tess->tUnit[2]; + } +} + +#ifdef FOR_TRITE_TEST_PROGRAM +#include +extern int RandomSweep; +#define S_UNIT_X (RandomSweep ? (2*drand48()-1) : 1.0) +#define S_UNIT_Y (RandomSweep ? (2*drand48()-1) : 0.0) +#else +#if defined(SLANTED_SWEEP) +/* The "feature merging" is not intended to be complete. There are + * special cases where edges are nearly parallel to the sweep line + * which are not implemented. The algorithm should still behave + * robustly (ie. produce a reasonable tesselation) in the presence + * of such edges, however it may miss features which could have been + * merged. We could minimize this effect by choosing the sweep line + * direction to be something unusual (ie. not parallel to one of the + * coordinate axes). + */ +#define S_UNIT_X 0.50941539564955385 /* Pre-normalized */ +#define S_UNIT_Y 0.86052074622010633 +#else +#define S_UNIT_X 1.0 +#define S_UNIT_Y 0.0 +#endif +#endif + +/* Determine the polygon normal and project vertices onto the plane + * of the polygon. + */ +void __gl_projectPolygon( GLUtesselator *tess ) +{ + GLUvertex *v, *vHead = &tess->mesh->vHead; + GLdouble norm[3]; + GLdouble *sUnit, *tUnit; + int i, computedNormal = FALSE; + + norm[0] = tess->normal[0]; + norm[1] = tess->normal[1]; + norm[2] = tess->normal[2]; + if( norm[0] == 0 && norm[1] == 0 && norm[2] == 0 ) { + ComputeNormal( tess, norm ); + computedNormal = TRUE; + } + sUnit = tess->sUnit; + tUnit = tess->tUnit; + i = LongAxis( norm ); + +#if defined(FOR_TRITE_TEST_PROGRAM) || defined(TRUE_PROJECT) + /* Choose the initial sUnit vector to be approximately perpendicular + * to the normal. + */ + Normalize( norm ); + + sUnit[i] = 0; + sUnit[(i+1)%3] = S_UNIT_X; + sUnit[(i+2)%3] = S_UNIT_Y; + + /* Now make it exactly perpendicular */ + w = Dot( sUnit, norm ); + sUnit[0] -= w * norm[0]; + sUnit[1] -= w * norm[1]; + sUnit[2] -= w * norm[2]; + Normalize( sUnit ); + + /* Choose tUnit so that (sUnit,tUnit,norm) form a right-handed frame */ + tUnit[0] = norm[1]*sUnit[2] - norm[2]*sUnit[1]; + tUnit[1] = norm[2]*sUnit[0] - norm[0]*sUnit[2]; + tUnit[2] = norm[0]*sUnit[1] - norm[1]*sUnit[0]; + Normalize( tUnit ); +#else + /* Project perpendicular to a coordinate axis -- better numerically */ + sUnit[i] = 0; + sUnit[(i+1)%3] = S_UNIT_X; + sUnit[(i+2)%3] = S_UNIT_Y; + + tUnit[i] = 0; + tUnit[(i+1)%3] = (norm[i] > 0) ? -S_UNIT_Y : S_UNIT_Y; + tUnit[(i+2)%3] = (norm[i] > 0) ? S_UNIT_X : -S_UNIT_X; +#endif + + /* Project the vertices onto the sweep plane */ + for( v = vHead->next; v != vHead; v = v->next ) { + v->s = Dot( v->coords, sUnit ); + v->t = Dot( v->coords, tUnit ); + } + if( computedNormal ) { + CheckOrientation( tess ); + } +} diff --git a/mesalib/src/glu/sgi/libtess/normal.h b/mesalib/src/glu/sgi/libtess/normal.h new file mode 100644 index 000000000..c376ca445 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/normal.h @@ -0,0 +1,45 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __normal_h_ +#define __normal_h_ + +#include "tess.h" + +/* __gl_projectPolygon( tess ) determines the polygon normal + * and project vertices onto the plane of the polygon. + */ +void __gl_projectPolygon( GLUtesselator *tess ); + +#endif diff --git a/mesalib/src/glu/sgi/libtess/priorityq-heap.c b/mesalib/src/glu/sgi/libtess/priorityq-heap.c new file mode 100644 index 000000000..e3a6c6068 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/priorityq-heap.c @@ -0,0 +1,252 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include +#include +#include "priorityq-heap.h" +#include "memalloc.h" + +#define INIT_SIZE 32 + +#define TRUE 1 +#define FALSE 0 + +#ifdef FOR_TRITE_TEST_PROGRAM +#define LEQ(x,y) (*pq->leq)(x,y) +#else +/* Violates modularity, but a little faster */ +#include "geom.h" +#define LEQ(x,y) VertLeq((GLUvertex *)x, (GLUvertex *)y) +#endif + +/* really __gl_pqHeapNewPriorityQ */ +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ) +{ + PriorityQ *pq = (PriorityQ *)memAlloc( sizeof( PriorityQ )); + if (pq == NULL) return NULL; + + pq->size = 0; + pq->max = INIT_SIZE; + pq->nodes = (PQnode *)memAlloc( (INIT_SIZE + 1) * sizeof(pq->nodes[0]) ); + if (pq->nodes == NULL) { + memFree(pq); + return NULL; + } + + pq->handles = (PQhandleElem *)memAlloc( (INIT_SIZE + 1) * sizeof(pq->handles[0]) ); + if (pq->handles == NULL) { + memFree(pq->nodes); + memFree(pq); + return NULL; + } + + pq->initialized = FALSE; + pq->freeList = 0; + pq->leq = leq; + + pq->nodes[1].handle = 1; /* so that Minimum() returns NULL */ + pq->handles[1].key = NULL; + return pq; +} + +/* really __gl_pqHeapDeletePriorityQ */ +void pqDeletePriorityQ( PriorityQ *pq ) +{ + memFree( pq->handles ); + memFree( pq->nodes ); + memFree( pq ); +} + + +static void FloatDown( PriorityQ *pq, long curr ) +{ + PQnode *n = pq->nodes; + PQhandleElem *h = pq->handles; + PQhandle hCurr, hChild; + long child; + + hCurr = n[curr].handle; + for( ;; ) { + child = curr << 1; + if( child < pq->size && LEQ( h[n[child+1].handle].key, + h[n[child].handle].key )) { + ++child; + } + + assert(child <= pq->max); + + hChild = n[child].handle; + if( child > pq->size || LEQ( h[hCurr].key, h[hChild].key )) { + n[curr].handle = hCurr; + h[hCurr].node = curr; + break; + } + n[curr].handle = hChild; + h[hChild].node = curr; + curr = child; + } +} + + +static void FloatUp( PriorityQ *pq, long curr ) +{ + PQnode *n = pq->nodes; + PQhandleElem *h = pq->handles; + PQhandle hCurr, hParent; + long parent; + + hCurr = n[curr].handle; + for( ;; ) { + parent = curr >> 1; + hParent = n[parent].handle; + if( parent == 0 || LEQ( h[hParent].key, h[hCurr].key )) { + n[curr].handle = hCurr; + h[hCurr].node = curr; + break; + } + n[curr].handle = hParent; + h[hParent].node = curr; + curr = parent; + } +} + +/* really __gl_pqHeapInit */ +void pqInit( PriorityQ *pq ) +{ + long i; + + /* This method of building a heap is O(n), rather than O(n lg n). */ + + for( i = pq->size; i >= 1; --i ) { + FloatDown( pq, i ); + } + pq->initialized = TRUE; +} + +/* really __gl_pqHeapInsert */ +/* returns LONG_MAX iff out of memory */ +PQhandle pqInsert( PriorityQ *pq, PQkey keyNew ) +{ + long curr; + PQhandle free; + + curr = ++ pq->size; + if( (curr*2) > pq->max ) { + PQnode *saveNodes= pq->nodes; + PQhandleElem *saveHandles= pq->handles; + + /* If the heap overflows, double its size. */ + pq->max <<= 1; + pq->nodes = (PQnode *)memRealloc( pq->nodes, + (size_t) + ((pq->max + 1) * sizeof( pq->nodes[0] ))); + if (pq->nodes == NULL) { + pq->nodes = saveNodes; /* restore ptr to free upon return */ + return LONG_MAX; + } + pq->handles = (PQhandleElem *)memRealloc( pq->handles, + (size_t) + ((pq->max + 1) * + sizeof( pq->handles[0] ))); + if (pq->handles == NULL) { + pq->handles = saveHandles; /* restore ptr to free upon return */ + return LONG_MAX; + } + } + + if( pq->freeList == 0 ) { + free = curr; + } else { + free = pq->freeList; + pq->freeList = pq->handles[free].node; + } + + pq->nodes[curr].handle = free; + pq->handles[free].node = curr; + pq->handles[free].key = keyNew; + + if( pq->initialized ) { + FloatUp( pq, curr ); + } + assert(free != LONG_MAX); + return free; +} + +/* really __gl_pqHeapExtractMin */ +PQkey pqExtractMin( PriorityQ *pq ) +{ + PQnode *n = pq->nodes; + PQhandleElem *h = pq->handles; + PQhandle hMin = n[1].handle; + PQkey min = h[hMin].key; + + if( pq->size > 0 ) { + n[1].handle = n[pq->size].handle; + h[n[1].handle].node = 1; + + h[hMin].key = NULL; + h[hMin].node = pq->freeList; + pq->freeList = hMin; + + if( -- pq->size > 0 ) { + FloatDown( pq, 1 ); + } + } + return min; +} + +/* really __gl_pqHeapDelete */ +void pqDelete( PriorityQ *pq, PQhandle hCurr ) +{ + PQnode *n = pq->nodes; + PQhandleElem *h = pq->handles; + long curr; + + assert( hCurr >= 1 && hCurr <= pq->max && h[hCurr].key != NULL ); + + curr = h[hCurr].node; + n[curr].handle = n[pq->size].handle; + h[n[curr].handle].node = curr; + + if( curr <= -- pq->size ) { + if( curr <= 1 || LEQ( h[n[curr>>1].handle].key, h[n[curr].handle].key )) { + FloatDown( pq, curr ); + } else { + FloatUp( pq, curr ); + } + } + h[hCurr].key = NULL; + h[hCurr].node = pq->freeList; + pq->freeList = hCurr; +} diff --git a/mesalib/src/glu/sgi/libtess/priorityq-heap.h b/mesalib/src/glu/sgi/libtess/priorityq-heap.h new file mode 100644 index 000000000..dc9aaef87 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/priorityq-heap.h @@ -0,0 +1,107 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __priorityq_heap_h_ +#define __priorityq_heap_h_ + +/* Use #define's so that another heap implementation can use this one */ + +#define PQkey PQHeapKey +#define PQhandle PQHeapHandle +#define PriorityQ PriorityQHeap + +#define pqNewPriorityQ(leq) __gl_pqHeapNewPriorityQ(leq) +#define pqDeletePriorityQ(pq) __gl_pqHeapDeletePriorityQ(pq) + +/* The basic operations are insertion of a new key (pqInsert), + * and examination/extraction of a key whose value is minimum + * (pqMinimum/pqExtractMin). Deletion is also allowed (pqDelete); + * for this purpose pqInsert returns a "handle" which is supplied + * as the argument. + * + * An initial heap may be created efficiently by calling pqInsert + * repeatedly, then calling pqInit. In any case pqInit must be called + * before any operations other than pqInsert are used. + * + * If the heap is empty, pqMinimum/pqExtractMin will return a NULL key. + * This may also be tested with pqIsEmpty. + */ +#define pqInit(pq) __gl_pqHeapInit(pq) +#define pqInsert(pq,key) __gl_pqHeapInsert(pq,key) +#define pqMinimum(pq) __gl_pqHeapMinimum(pq) +#define pqExtractMin(pq) __gl_pqHeapExtractMin(pq) +#define pqDelete(pq,handle) __gl_pqHeapDelete(pq,handle) +#define pqIsEmpty(pq) __gl_pqHeapIsEmpty(pq) + + +/* Since we support deletion the data structure is a little more + * complicated than an ordinary heap. "nodes" is the heap itself; + * active nodes are stored in the range 1..pq->size. When the + * heap exceeds its allocated size (pq->max), its size doubles. + * The children of node i are nodes 2i and 2i+1. + * + * Each node stores an index into an array "handles". Each handle + * stores a key, plus a pointer back to the node which currently + * represents that key (ie. nodes[handles[i].node].handle == i). + */ + +typedef void *PQkey; +typedef long PQhandle; +typedef struct PriorityQ PriorityQ; + +typedef struct { PQhandle handle; } PQnode; +typedef struct { PQkey key; PQhandle node; } PQhandleElem; + +struct PriorityQ { + PQnode *nodes; + PQhandleElem *handles; + long size, max; + PQhandle freeList; + int initialized; + int (*leq)(PQkey key1, PQkey key2); +}; + +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ); +void pqDeletePriorityQ( PriorityQ *pq ); + +void pqInit( PriorityQ *pq ); +PQhandle pqInsert( PriorityQ *pq, PQkey key ); +PQkey pqExtractMin( PriorityQ *pq ); +void pqDelete( PriorityQ *pq, PQhandle handle ); + + +#define __gl_pqHeapMinimum(pq) ((pq)->handles[(pq)->nodes[1].handle].key) +#define __gl_pqHeapIsEmpty(pq) ((pq)->size == 0) + +#endif diff --git a/mesalib/src/glu/sgi/libtess/priorityq-sort.h b/mesalib/src/glu/sgi/libtess/priorityq-sort.h new file mode 100644 index 000000000..746cf5fa6 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/priorityq-sort.h @@ -0,0 +1,117 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __priorityq_sort_h_ +#define __priorityq_sort_h_ + +#include "priorityq-heap.h" + +#undef PQkey +#undef PQhandle +#undef PriorityQ +#undef pqNewPriorityQ +#undef pqDeletePriorityQ +#undef pqInit +#undef pqInsert +#undef pqMinimum +#undef pqExtractMin +#undef pqDelete +#undef pqIsEmpty + +/* Use #define's so that another heap implementation can use this one */ + +#define PQkey PQSortKey +#define PQhandle PQSortHandle +#define PriorityQ PriorityQSort + +#define pqNewPriorityQ(leq) __gl_pqSortNewPriorityQ(leq) +#define pqDeletePriorityQ(pq) __gl_pqSortDeletePriorityQ(pq) + +/* The basic operations are insertion of a new key (pqInsert), + * and examination/extraction of a key whose value is minimum + * (pqMinimum/pqExtractMin). Deletion is also allowed (pqDelete); + * for this purpose pqInsert returns a "handle" which is supplied + * as the argument. + * + * An initial heap may be created efficiently by calling pqInsert + * repeatedly, then calling pqInit. In any case pqInit must be called + * before any operations other than pqInsert are used. + * + * If the heap is empty, pqMinimum/pqExtractMin will return a NULL key. + * This may also be tested with pqIsEmpty. + */ +#define pqInit(pq) __gl_pqSortInit(pq) +#define pqInsert(pq,key) __gl_pqSortInsert(pq,key) +#define pqMinimum(pq) __gl_pqSortMinimum(pq) +#define pqExtractMin(pq) __gl_pqSortExtractMin(pq) +#define pqDelete(pq,handle) __gl_pqSortDelete(pq,handle) +#define pqIsEmpty(pq) __gl_pqSortIsEmpty(pq) + + +/* Since we support deletion the data structure is a little more + * complicated than an ordinary heap. "nodes" is the heap itself; + * active nodes are stored in the range 1..pq->size. When the + * heap exceeds its allocated size (pq->max), its size doubles. + * The children of node i are nodes 2i and 2i+1. + * + * Each node stores an index into an array "handles". Each handle + * stores a key, plus a pointer back to the node which currently + * represents that key (ie. nodes[handles[i].node].handle == i). + */ + +typedef PQHeapKey PQkey; +typedef PQHeapHandle PQhandle; +typedef struct PriorityQ PriorityQ; + +struct PriorityQ { + PriorityQHeap *heap; + PQkey *keys; + PQkey **order; + PQhandle size, max; + int initialized; + int (*leq)(PQkey key1, PQkey key2); +}; + +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ); +void pqDeletePriorityQ( PriorityQ *pq ); + +int pqInit( PriorityQ *pq ); +PQhandle pqInsert( PriorityQ *pq, PQkey key ); +PQkey pqExtractMin( PriorityQ *pq ); +void pqDelete( PriorityQ *pq, PQhandle handle ); + +PQkey pqMinimum( PriorityQ *pq ); +int pqIsEmpty( PriorityQ *pq ); + +#endif diff --git a/mesalib/src/glu/sgi/libtess/priorityq.c b/mesalib/src/glu/sgi/libtess/priorityq.c new file mode 100644 index 000000000..11f0263ac --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/priorityq.c @@ -0,0 +1,260 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include /* LONG_MAX */ +#include "memalloc.h" + +/* Include all the code for the regular heap-based queue here. */ + +#include "priorityq-heap.c" + +/* Now redefine all the function names to map to their "Sort" versions. */ + +#include "priorityq-sort.h" + +/* really __gl_pqSortNewPriorityQ */ +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ) +{ + PriorityQ *pq = (PriorityQ *)memAlloc( sizeof( PriorityQ )); + if (pq == NULL) return NULL; + + pq->heap = __gl_pqHeapNewPriorityQ( leq ); + if (pq->heap == NULL) { + memFree(pq); + return NULL; + } + + pq->keys = (PQHeapKey *)memAlloc( INIT_SIZE * sizeof(pq->keys[0]) ); + if (pq->keys == NULL) { + __gl_pqHeapDeletePriorityQ(pq->heap); + memFree(pq); + return NULL; + } + + pq->size = 0; + pq->max = INIT_SIZE; + pq->initialized = FALSE; + pq->leq = leq; + return pq; +} + +/* really __gl_pqSortDeletePriorityQ */ +void pqDeletePriorityQ( PriorityQ *pq ) +{ + assert(pq != NULL); + if (pq->heap != NULL) __gl_pqHeapDeletePriorityQ( pq->heap ); + if (pq->order != NULL) memFree( pq->order ); + if (pq->keys != NULL) memFree( pq->keys ); + memFree( pq ); +} + + +#define LT(x,y) (! LEQ(y,x)) +#define GT(x,y) (! LEQ(x,y)) +#define Swap(a,b) if(1){PQkey *tmp = *a; *a = *b; *b = tmp;}else + +/* really __gl_pqSortInit */ +int pqInit( PriorityQ *pq ) +{ + PQkey **p, **r, **i, **j, *piv; + struct { PQkey **p, **r; } Stack[50], *top = Stack; + unsigned long seed = 2016473283; + + /* Create an array of indirect pointers to the keys, so that we + * the handles we have returned are still valid. + */ +/* + pq->order = (PQHeapKey **)memAlloc( (size_t) + (pq->size * sizeof(pq->order[0])) ); +*/ + pq->order = (PQHeapKey **)memAlloc( (size_t) + ((pq->size+1) * sizeof(pq->order[0])) ); +/* the previous line is a patch to compensate for the fact that IBM */ +/* machines return a null on a malloc of zero bytes (unlike SGI), */ +/* so we have to put in this defense to guard against a memory */ +/* fault four lines down. from fossum@austin.ibm.com. */ + if (pq->order == NULL) return 0; + + p = pq->order; + r = p + pq->size - 1; + for( piv = pq->keys, i = p; i <= r; ++piv, ++i ) { + *i = piv; + } + + /* Sort the indirect pointers in descending order, + * using randomized Quicksort + */ + top->p = p; top->r = r; ++top; + while( --top >= Stack ) { + p = top->p; + r = top->r; + while( r > p + 10 ) { + seed = seed * 1539415821 + 1; + i = p + seed % (r - p + 1); + piv = *i; + *i = *p; + *p = piv; + i = p - 1; + j = r + 1; + do { + do { ++i; } while( GT( **i, *piv )); + do { --j; } while( LT( **j, *piv )); + Swap( i, j ); + } while( i < j ); + Swap( i, j ); /* Undo last swap */ + if( i - p < r - j ) { + top->p = j+1; top->r = r; ++top; + r = i-1; + } else { + top->p = p; top->r = i-1; ++top; + p = j+1; + } + } + /* Insertion sort small lists */ + for( i = p+1; i <= r; ++i ) { + piv = *i; + for( j = i; j > p && LT( **(j-1), *piv ); --j ) { + *j = *(j-1); + } + *j = piv; + } + } + pq->max = pq->size; + pq->initialized = TRUE; + __gl_pqHeapInit( pq->heap ); /* always succeeds */ + +#ifndef NDEBUG + p = pq->order; + r = p + pq->size - 1; + for( i = p; i < r; ++i ) { + assert( LEQ( **(i+1), **i )); + } +#endif + + return 1; +} + +/* really __gl_pqSortInsert */ +/* returns LONG_MAX iff out of memory */ +PQhandle pqInsert( PriorityQ *pq, PQkey keyNew ) +{ + long curr; + + if( pq->initialized ) { + return __gl_pqHeapInsert( pq->heap, keyNew ); + } + curr = pq->size; + if( ++ pq->size >= pq->max ) { + PQkey *saveKey= pq->keys; + + /* If the heap overflows, double its size. */ + pq->max <<= 1; + pq->keys = (PQHeapKey *)memRealloc( pq->keys, + (size_t) + (pq->max * sizeof( pq->keys[0] ))); + if (pq->keys == NULL) { + pq->keys = saveKey; /* restore ptr to free upon return */ + return LONG_MAX; + } + } + assert(curr != LONG_MAX); + pq->keys[curr] = keyNew; + + /* Negative handles index the sorted array. */ + return -(curr+1); +} + +/* really __gl_pqSortExtractMin */ +PQkey pqExtractMin( PriorityQ *pq ) +{ + PQkey sortMin, heapMin; + + if( pq->size == 0 ) { + return __gl_pqHeapExtractMin( pq->heap ); + } + sortMin = *(pq->order[pq->size-1]); + if( ! __gl_pqHeapIsEmpty( pq->heap )) { + heapMin = __gl_pqHeapMinimum( pq->heap ); + if( LEQ( heapMin, sortMin )) { + return __gl_pqHeapExtractMin( pq->heap ); + } + } + do { + -- pq->size; + } while( pq->size > 0 && *(pq->order[pq->size-1]) == NULL ); + return sortMin; +} + +/* really __gl_pqSortMinimum */ +PQkey pqMinimum( PriorityQ *pq ) +{ + PQkey sortMin, heapMin; + + if( pq->size == 0 ) { + return __gl_pqHeapMinimum( pq->heap ); + } + sortMin = *(pq->order[pq->size-1]); + if( ! __gl_pqHeapIsEmpty( pq->heap )) { + heapMin = __gl_pqHeapMinimum( pq->heap ); + if( LEQ( heapMin, sortMin )) { + return heapMin; + } + } + return sortMin; +} + +/* really __gl_pqSortIsEmpty */ +int pqIsEmpty( PriorityQ *pq ) +{ + return (pq->size == 0) && __gl_pqHeapIsEmpty( pq->heap ); +} + +/* really __gl_pqSortDelete */ +void pqDelete( PriorityQ *pq, PQhandle curr ) +{ + if( curr >= 0 ) { + __gl_pqHeapDelete( pq->heap, curr ); + return; + } + curr = -(curr+1); + assert( curr < pq->max && pq->keys[curr] != NULL ); + + pq->keys[curr] = NULL; + while( pq->size > 0 && *(pq->order[pq->size-1]) == NULL ) { + -- pq->size; + } +} diff --git a/mesalib/src/glu/sgi/libtess/priorityq.h b/mesalib/src/glu/sgi/libtess/priorityq.h new file mode 100644 index 000000000..746cf5fa6 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/priorityq.h @@ -0,0 +1,117 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __priorityq_sort_h_ +#define __priorityq_sort_h_ + +#include "priorityq-heap.h" + +#undef PQkey +#undef PQhandle +#undef PriorityQ +#undef pqNewPriorityQ +#undef pqDeletePriorityQ +#undef pqInit +#undef pqInsert +#undef pqMinimum +#undef pqExtractMin +#undef pqDelete +#undef pqIsEmpty + +/* Use #define's so that another heap implementation can use this one */ + +#define PQkey PQSortKey +#define PQhandle PQSortHandle +#define PriorityQ PriorityQSort + +#define pqNewPriorityQ(leq) __gl_pqSortNewPriorityQ(leq) +#define pqDeletePriorityQ(pq) __gl_pqSortDeletePriorityQ(pq) + +/* The basic operations are insertion of a new key (pqInsert), + * and examination/extraction of a key whose value is minimum + * (pqMinimum/pqExtractMin). Deletion is also allowed (pqDelete); + * for this purpose pqInsert returns a "handle" which is supplied + * as the argument. + * + * An initial heap may be created efficiently by calling pqInsert + * repeatedly, then calling pqInit. In any case pqInit must be called + * before any operations other than pqInsert are used. + * + * If the heap is empty, pqMinimum/pqExtractMin will return a NULL key. + * This may also be tested with pqIsEmpty. + */ +#define pqInit(pq) __gl_pqSortInit(pq) +#define pqInsert(pq,key) __gl_pqSortInsert(pq,key) +#define pqMinimum(pq) __gl_pqSortMinimum(pq) +#define pqExtractMin(pq) __gl_pqSortExtractMin(pq) +#define pqDelete(pq,handle) __gl_pqSortDelete(pq,handle) +#define pqIsEmpty(pq) __gl_pqSortIsEmpty(pq) + + +/* Since we support deletion the data structure is a little more + * complicated than an ordinary heap. "nodes" is the heap itself; + * active nodes are stored in the range 1..pq->size. When the + * heap exceeds its allocated size (pq->max), its size doubles. + * The children of node i are nodes 2i and 2i+1. + * + * Each node stores an index into an array "handles". Each handle + * stores a key, plus a pointer back to the node which currently + * represents that key (ie. nodes[handles[i].node].handle == i). + */ + +typedef PQHeapKey PQkey; +typedef PQHeapHandle PQhandle; +typedef struct PriorityQ PriorityQ; + +struct PriorityQ { + PriorityQHeap *heap; + PQkey *keys; + PQkey **order; + PQhandle size, max; + int initialized; + int (*leq)(PQkey key1, PQkey key2); +}; + +PriorityQ *pqNewPriorityQ( int (*leq)(PQkey key1, PQkey key2) ); +void pqDeletePriorityQ( PriorityQ *pq ); + +int pqInit( PriorityQ *pq ); +PQhandle pqInsert( PriorityQ *pq, PQkey key ); +PQkey pqExtractMin( PriorityQ *pq ); +void pqDelete( PriorityQ *pq, PQhandle handle ); + +PQkey pqMinimum( PriorityQ *pq ); +int pqIsEmpty( PriorityQ *pq ); + +#endif diff --git a/mesalib/src/glu/sgi/libtess/render.c b/mesalib/src/glu/sgi/libtess/render.c new file mode 100644 index 000000000..4f376f7f4 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/render.c @@ -0,0 +1,498 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include "mesh.h" +#include "tess.h" +#include "render.h" + +#define TRUE 1 +#define FALSE 0 + +/* This structure remembers the information we need about a primitive + * to be able to render it later, once we have determined which + * primitive is able to use the most triangles. + */ +struct FaceCount { + long size; /* number of triangles used */ + GLUhalfEdge *eStart; /* edge where this primitive starts */ + void (*render)(GLUtesselator *, GLUhalfEdge *, long); + /* routine to render this primitive */ +}; + +static struct FaceCount MaximumFan( GLUhalfEdge *eOrig ); +static struct FaceCount MaximumStrip( GLUhalfEdge *eOrig ); + +static void RenderFan( GLUtesselator *tess, GLUhalfEdge *eStart, long size ); +static void RenderStrip( GLUtesselator *tess, GLUhalfEdge *eStart, long size ); +static void RenderTriangle( GLUtesselator *tess, GLUhalfEdge *eStart, + long size ); + +static void RenderMaximumFaceGroup( GLUtesselator *tess, GLUface *fOrig ); +static void RenderLonelyTriangles( GLUtesselator *tess, GLUface *head ); + + + +/************************ Strips and Fans decomposition ******************/ + +/* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle + * fans, strips, and separate triangles. A substantial effort is made + * to use as few rendering primitives as possible (ie. to make the fans + * and strips as large as possible). + * + * The rendering output is provided as callbacks (see the api). + */ +void __gl_renderMesh( GLUtesselator *tess, GLUmesh *mesh ) +{ + GLUface *f; + + /* Make a list of separate triangles so we can render them all at once */ + tess->lonelyTriList = NULL; + + for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) { + f->marked = FALSE; + } + for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) { + + /* We examine all faces in an arbitrary order. Whenever we find + * an unprocessed face F, we output a group of faces including F + * whose size is maximum. + */ + if( f->inside && ! f->marked ) { + RenderMaximumFaceGroup( tess, f ); + assert( f->marked ); + } + } + if( tess->lonelyTriList != NULL ) { + RenderLonelyTriangles( tess, tess->lonelyTriList ); + tess->lonelyTriList = NULL; + } +} + + +static void RenderMaximumFaceGroup( GLUtesselator *tess, GLUface *fOrig ) +{ + /* We want to find the largest triangle fan or strip of unmarked faces + * which includes the given face fOrig. There are 3 possible fans + * passing through fOrig (one centered at each vertex), and 3 possible + * strips (one for each CCW permutation of the vertices). Our strategy + * is to try all of these, and take the primitive which uses the most + * triangles (a greedy approach). + */ + GLUhalfEdge *e = fOrig->anEdge; + struct FaceCount max, newFace; + + max.size = 1; + max.eStart = e; + max.render = &RenderTriangle; + + if( ! tess->flagBoundary ) { + newFace = MaximumFan( e ); if( newFace.size > max.size ) { max = newFace; } + newFace = MaximumFan( e->Lnext ); if( newFace.size > max.size ) { max = newFace; } + newFace = MaximumFan( e->Lprev ); if( newFace.size > max.size ) { max = newFace; } + + newFace = MaximumStrip( e ); if( newFace.size > max.size ) { max = newFace; } + newFace = MaximumStrip( e->Lnext ); if( newFace.size > max.size ) { max = newFace; } + newFace = MaximumStrip( e->Lprev ); if( newFace.size > max.size ) { max = newFace; } + } + (*(max.render))( tess, max.eStart, max.size ); +} + + +/* Macros which keep track of faces we have marked temporarily, and allow + * us to backtrack when necessary. With triangle fans, this is not + * really necessary, since the only awkward case is a loop of triangles + * around a single origin vertex. However with strips the situation is + * more complicated, and we need a general tracking method like the + * one here. + */ +#define Marked(f) (! (f)->inside || (f)->marked) + +#define AddToTrail(f,t) ((f)->trail = (t), (t) = (f), (f)->marked = TRUE) + +#define FreeTrail(t) if( 1 ) { \ + while( (t) != NULL ) { \ + (t)->marked = FALSE; t = (t)->trail; \ + } \ + } else /* absorb trailing semicolon */ + + + +static struct FaceCount MaximumFan( GLUhalfEdge *eOrig ) +{ + /* eOrig->Lface is the face we want to render. We want to find the size + * of a maximal fan around eOrig->Org. To do this we just walk around + * the origin vertex as far as possible in both directions. + */ + struct FaceCount newFace = { 0, NULL, &RenderFan }; + GLUface *trail = NULL; + GLUhalfEdge *e; + + for( e = eOrig; ! Marked( e->Lface ); e = e->Onext ) { + AddToTrail( e->Lface, trail ); + ++newFace.size; + } + for( e = eOrig; ! Marked( e->Rface ); e = e->Oprev ) { + AddToTrail( e->Rface, trail ); + ++newFace.size; + } + newFace.eStart = e; + /*LINTED*/ + FreeTrail( trail ); + return newFace; +} + + +#define IsEven(n) (((n) & 1) == 0) + +static struct FaceCount MaximumStrip( GLUhalfEdge *eOrig ) +{ + /* Here we are looking for a maximal strip that contains the vertices + * eOrig->Org, eOrig->Dst, eOrig->Lnext->Dst (in that order or the + * reverse, such that all triangles are oriented CCW). + * + * Again we walk forward and backward as far as possible. However for + * strips there is a twist: to get CCW orientations, there must be + * an *even* number of triangles in the strip on one side of eOrig. + * We walk the strip starting on a side with an even number of triangles; + * if both side have an odd number, we are forced to shorten one side. + */ + struct FaceCount newFace = { 0, NULL, &RenderStrip }; + long headSize = 0, tailSize = 0; + GLUface *trail = NULL; + GLUhalfEdge *e, *eTail, *eHead; + + for( e = eOrig; ! Marked( e->Lface ); ++tailSize, e = e->Onext ) { + AddToTrail( e->Lface, trail ); + ++tailSize; + e = e->Dprev; + if( Marked( e->Lface )) break; + AddToTrail( e->Lface, trail ); + } + eTail = e; + + for( e = eOrig; ! Marked( e->Rface ); ++headSize, e = e->Dnext ) { + AddToTrail( e->Rface, trail ); + ++headSize; + e = e->Oprev; + if( Marked( e->Rface )) break; + AddToTrail( e->Rface, trail ); + } + eHead = e; + + newFace.size = tailSize + headSize; + if( IsEven( tailSize )) { + newFace.eStart = eTail->Sym; + } else if( IsEven( headSize )) { + newFace.eStart = eHead; + } else { + /* Both sides have odd length, we must shorten one of them. In fact, + * we must start from eHead to guarantee inclusion of eOrig->Lface. + */ + --newFace.size; + newFace.eStart = eHead->Onext; + } + /*LINTED*/ + FreeTrail( trail ); + return newFace; +} + + +static void RenderTriangle( GLUtesselator *tess, GLUhalfEdge *e, long size ) +{ + /* Just add the triangle to a triangle list, so we can render all + * the separate triangles at once. + */ + assert( size == 1 ); + AddToTrail( e->Lface, tess->lonelyTriList ); +} + + +static void RenderLonelyTriangles( GLUtesselator *tess, GLUface *f ) +{ + /* Now we render all the separate triangles which could not be + * grouped into a triangle fan or strip. + */ + GLUhalfEdge *e; + int newState; + int edgeState = -1; /* force edge state output for first vertex */ + + CALL_BEGIN_OR_BEGIN_DATA( GL_TRIANGLES ); + + for( ; f != NULL; f = f->trail ) { + /* Loop once for each edge (there will always be 3 edges) */ + + e = f->anEdge; + do { + if( tess->flagBoundary ) { + /* Set the "edge state" to TRUE just before we output the + * first vertex of each edge on the polygon boundary. + */ + newState = ! e->Rface->inside; + if( edgeState != newState ) { + edgeState = newState; + CALL_EDGE_FLAG_OR_EDGE_FLAG_DATA( edgeState ); + } + } + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + + e = e->Lnext; + } while( e != f->anEdge ); + } + CALL_END_OR_END_DATA(); +} + + +static void RenderFan( GLUtesselator *tess, GLUhalfEdge *e, long size ) +{ + /* Render as many CCW triangles as possible in a fan starting from + * edge "e". The fan *should* contain exactly "size" triangles + * (otherwise we've goofed up somewhere). + */ + CALL_BEGIN_OR_BEGIN_DATA( GL_TRIANGLE_FAN ); + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data ); + + while( ! Marked( e->Lface )) { + e->Lface->marked = TRUE; + --size; + e = e->Onext; + CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data ); + } + + assert( size == 0 ); + CALL_END_OR_END_DATA(); +} + + +static void RenderStrip( GLUtesselator *tess, GLUhalfEdge *e, long size ) +{ + /* Render as many CCW triangles as possible in a strip starting from + * edge "e". The strip *should* contain exactly "size" triangles + * (otherwise we've goofed up somewhere). + */ + CALL_BEGIN_OR_BEGIN_DATA( GL_TRIANGLE_STRIP ); + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data ); + + while( ! Marked( e->Lface )) { + e->Lface->marked = TRUE; + --size; + e = e->Dprev; + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + if( Marked( e->Lface )) break; + + e->Lface->marked = TRUE; + --size; + e = e->Onext; + CALL_VERTEX_OR_VERTEX_DATA( e->Dst->data ); + } + + assert( size == 0 ); + CALL_END_OR_END_DATA(); +} + + +/************************ Boundary contour decomposition ******************/ + +/* __gl_renderBoundary( tess, mesh ) takes a mesh, and outputs one + * contour for each face marked "inside". The rendering output is + * provided as callbacks (see the api). + */ +void __gl_renderBoundary( GLUtesselator *tess, GLUmesh *mesh ) +{ + GLUface *f; + GLUhalfEdge *e; + + for( f = mesh->fHead.next; f != &mesh->fHead; f = f->next ) { + if( f->inside ) { + CALL_BEGIN_OR_BEGIN_DATA( GL_LINE_LOOP ); + e = f->anEdge; + do { + CALL_VERTEX_OR_VERTEX_DATA( e->Org->data ); + e = e->Lnext; + } while( e != f->anEdge ); + CALL_END_OR_END_DATA(); + } + } +} + + +/************************ Quick-and-dirty decomposition ******************/ + +#define SIGN_INCONSISTENT 2 + +static int ComputeNormal( GLUtesselator *tess, GLdouble norm[3], int check ) +/* + * If check==FALSE, we compute the polygon normal and place it in norm[]. + * If check==TRUE, we check that each triangle in the fan from v0 has a + * consistent orientation with respect to norm[]. If triangles are + * consistently oriented CCW, return 1; if CW, return -1; if all triangles + * are degenerate return 0; otherwise (no consistent orientation) return + * SIGN_INCONSISTENT. + */ +{ + CachedVertex *v0 = tess->cache; + CachedVertex *vn = v0 + tess->cacheCount; + CachedVertex *vc; + GLdouble dot, xc, yc, zc, xp, yp, zp, n[3]; + int sign = 0; + + /* Find the polygon normal. It is important to get a reasonable + * normal even when the polygon is self-intersecting (eg. a bowtie). + * Otherwise, the computed normal could be very tiny, but perpendicular + * to the true plane of the polygon due to numerical noise. Then all + * the triangles would appear to be degenerate and we would incorrectly + * decompose the polygon as a fan (or simply not render it at all). + * + * We use a sum-of-triangles normal algorithm rather than the more + * efficient sum-of-trapezoids method (used in CheckOrientation() + * in normal.c). This lets us explicitly reverse the signed area + * of some triangles to get a reasonable normal in the self-intersecting + * case. + */ + if( ! check ) { + norm[0] = norm[1] = norm[2] = 0.0; + } + + vc = v0 + 1; + xc = vc->coords[0] - v0->coords[0]; + yc = vc->coords[1] - v0->coords[1]; + zc = vc->coords[2] - v0->coords[2]; + while( ++vc < vn ) { + xp = xc; yp = yc; zp = zc; + xc = vc->coords[0] - v0->coords[0]; + yc = vc->coords[1] - v0->coords[1]; + zc = vc->coords[2] - v0->coords[2]; + + /* Compute (vp - v0) cross (vc - v0) */ + n[0] = yp*zc - zp*yc; + n[1] = zp*xc - xp*zc; + n[2] = xp*yc - yp*xc; + + dot = n[0]*norm[0] + n[1]*norm[1] + n[2]*norm[2]; + if( ! check ) { + /* Reverse the contribution of back-facing triangles to get + * a reasonable normal for self-intersecting polygons (see above) + */ + if( dot >= 0 ) { + norm[0] += n[0]; norm[1] += n[1]; norm[2] += n[2]; + } else { + norm[0] -= n[0]; norm[1] -= n[1]; norm[2] -= n[2]; + } + } else if( dot != 0 ) { + /* Check the new orientation for consistency with previous triangles */ + if( dot > 0 ) { + if( sign < 0 ) return SIGN_INCONSISTENT; + sign = 1; + } else { + if( sign > 0 ) return SIGN_INCONSISTENT; + sign = -1; + } + } + } + return sign; +} + +/* __gl_renderCache( tess ) takes a single contour and tries to render it + * as a triangle fan. This handles convex polygons, as well as some + * non-convex polygons if we get lucky. + * + * Returns TRUE if the polygon was successfully rendered. The rendering + * output is provided as callbacks (see the api). + */ +GLboolean __gl_renderCache( GLUtesselator *tess ) +{ + CachedVertex *v0 = tess->cache; + CachedVertex *vn = v0 + tess->cacheCount; + CachedVertex *vc; + GLdouble norm[3]; + int sign; + + if( tess->cacheCount < 3 ) { + /* Degenerate contour -- no output */ + return TRUE; + } + + norm[0] = tess->normal[0]; + norm[1] = tess->normal[1]; + norm[2] = tess->normal[2]; + if( norm[0] == 0 && norm[1] == 0 && norm[2] == 0 ) { + ComputeNormal( tess, norm, FALSE ); + } + + sign = ComputeNormal( tess, norm, TRUE ); + if( sign == SIGN_INCONSISTENT ) { + /* Fan triangles did not have a consistent orientation */ + return FALSE; + } + if( sign == 0 ) { + /* All triangles were degenerate */ + return TRUE; + } + + /* Make sure we do the right thing for each winding rule */ + switch( tess->windingRule ) { + case GLU_TESS_WINDING_ODD: + case GLU_TESS_WINDING_NONZERO: + break; + case GLU_TESS_WINDING_POSITIVE: + if( sign < 0 ) return TRUE; + break; + case GLU_TESS_WINDING_NEGATIVE: + if( sign > 0 ) return TRUE; + break; + case GLU_TESS_WINDING_ABS_GEQ_TWO: + return TRUE; + } + + CALL_BEGIN_OR_BEGIN_DATA( tess->boundaryOnly ? GL_LINE_LOOP + : (tess->cacheCount > 3) ? GL_TRIANGLE_FAN + : GL_TRIANGLES ); + + CALL_VERTEX_OR_VERTEX_DATA( v0->data ); + if( sign > 0 ) { + for( vc = v0+1; vc < vn; ++vc ) { + CALL_VERTEX_OR_VERTEX_DATA( vc->data ); + } + } else { + for( vc = vn-1; vc > v0; --vc ) { + CALL_VERTEX_OR_VERTEX_DATA( vc->data ); + } + } + CALL_END_OR_END_DATA(); + return TRUE; +} diff --git a/mesalib/src/glu/sgi/libtess/render.h b/mesalib/src/glu/sgi/libtess/render.h new file mode 100644 index 000000000..a298c9a94 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/render.h @@ -0,0 +1,52 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __render_h_ +#define __render_h_ + +#include "mesh.h" + +/* __gl_renderMesh( tess, mesh ) takes a mesh and breaks it into triangle + * fans, strips, and separate triangles. A substantial effort is made + * to use as few rendering primitives as possible (ie. to make the fans + * and strips as large as possible). + * + * The rendering output is provided as callbacks (see the api). + */ +void __gl_renderMesh( GLUtesselator *tess, GLUmesh *mesh ); +void __gl_renderBoundary( GLUtesselator *tess, GLUmesh *mesh ); + +GLboolean __gl_renderCache( GLUtesselator *tess ); + +#endif diff --git a/mesalib/src/glu/sgi/libtess/sweep.c b/mesalib/src/glu/sgi/libtess/sweep.c new file mode 100644 index 000000000..744be6b47 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/sweep.c @@ -0,0 +1,1357 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include /* longjmp */ +#include /* LONG_MAX */ + +#include "mesh.h" +#include "geom.h" +#include "tess.h" +#include "dict.h" +#include "priorityq.h" +#include "memalloc.h" +#include "sweep.h" + +#define TRUE 1 +#define FALSE 0 + +#ifdef FOR_TRITE_TEST_PROGRAM +extern void DebugEvent( GLUtesselator *tess ); +#else +#define DebugEvent( tess ) +#endif + +/* + * Invariants for the Edge Dictionary. + * - each pair of adjacent edges e2=Succ(e1) satisfies EdgeLeq(e1,e2) + * at any valid location of the sweep event + * - if EdgeLeq(e2,e1) as well (at any valid sweep event), then e1 and e2 + * share a common endpoint + * - for each e, e->Dst has been processed, but not e->Org + * - each edge e satisfies VertLeq(e->Dst,event) && VertLeq(event,e->Org) + * where "event" is the current sweep line event. + * - no edge e has zero length + * + * Invariants for the Mesh (the processed portion). + * - the portion of the mesh left of the sweep line is a planar graph, + * ie. there is *some* way to embed it in the plane + * - no processed edge has zero length + * - no two processed vertices have identical coordinates + * - each "inside" region is monotone, ie. can be broken into two chains + * of monotonically increasing vertices according to VertLeq(v1,v2) + * - a non-invariant: these chains may intersect (very slightly) + * + * Invariants for the Sweep. + * - if none of the edges incident to the event vertex have an activeRegion + * (ie. none of these edges are in the edge dictionary), then the vertex + * has only right-going edges. + * - if an edge is marked "fixUpperEdge" (it is a temporary edge introduced + * by ConnectRightVertex), then it is the only right-going edge from + * its associated vertex. (This says that these edges exist only + * when it is necessary.) + */ + +#undef MAX +#undef MIN +#define MAX(x,y) ((x) >= (y) ? (x) : (y)) +#define MIN(x,y) ((x) <= (y) ? (x) : (y)) + +/* When we merge two edges into one, we need to compute the combined + * winding of the new edge. + */ +#define AddWinding(eDst,eSrc) (eDst->winding += eSrc->winding, \ + eDst->Sym->winding += eSrc->Sym->winding) + +static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent ); +static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp ); +static int CheckForRightSplice( GLUtesselator *tess, ActiveRegion *regUp ); + +static int EdgeLeq( GLUtesselator *tess, ActiveRegion *reg1, + ActiveRegion *reg2 ) +/* + * Both edges must be directed from right to left (this is the canonical + * direction for the upper edge of each region). + * + * The strategy is to evaluate a "t" value for each edge at the + * current sweep line position, given by tess->event. The calculations + * are designed to be very stable, but of course they are not perfect. + * + * Special case: if both edge destinations are at the sweep event, + * we sort the edges by slope (they would otherwise compare equally). + */ +{ + GLUvertex *event = tess->event; + GLUhalfEdge *e1, *e2; + GLdouble t1, t2; + + e1 = reg1->eUp; + e2 = reg2->eUp; + + if( e1->Dst == event ) { + if( e2->Dst == event ) { + /* Two edges right of the sweep line which meet at the sweep event. + * Sort them by slope. + */ + if( VertLeq( e1->Org, e2->Org )) { + return EdgeSign( e2->Dst, e1->Org, e2->Org ) <= 0; + } + return EdgeSign( e1->Dst, e2->Org, e1->Org ) >= 0; + } + return EdgeSign( e2->Dst, event, e2->Org ) <= 0; + } + if( e2->Dst == event ) { + return EdgeSign( e1->Dst, event, e1->Org ) >= 0; + } + + /* General case - compute signed distance *from* e1, e2 to event */ + t1 = EdgeEval( e1->Dst, event, e1->Org ); + t2 = EdgeEval( e2->Dst, event, e2->Org ); + return (t1 >= t2); +} + + +static void DeleteRegion( GLUtesselator *tess, ActiveRegion *reg ) +{ + if( reg->fixUpperEdge ) { + /* It was created with zero winding number, so it better be + * deleted with zero winding number (ie. it better not get merged + * with a real edge). + */ + assert( reg->eUp->winding == 0 ); + } + reg->eUp->activeRegion = NULL; + dictDelete( tess->dict, reg->nodeUp ); /* __gl_dictListDelete */ + memFree( reg ); +} + + +static int FixUpperEdge( ActiveRegion *reg, GLUhalfEdge *newEdge ) +/* + * Replace an upper edge which needs fixing (see ConnectRightVertex). + */ +{ + assert( reg->fixUpperEdge ); + if ( !__gl_meshDelete( reg->eUp ) ) return 0; + reg->fixUpperEdge = FALSE; + reg->eUp = newEdge; + newEdge->activeRegion = reg; + + return 1; +} + +static ActiveRegion *TopLeftRegion( ActiveRegion *reg ) +{ + GLUvertex *org = reg->eUp->Org; + GLUhalfEdge *e; + + /* Find the region above the uppermost edge with the same origin */ + do { + reg = RegionAbove( reg ); + } while( reg->eUp->Org == org ); + + /* If the edge above was a temporary edge introduced by ConnectRightVertex, + * now is the time to fix it. + */ + if( reg->fixUpperEdge ) { + e = __gl_meshConnect( RegionBelow(reg)->eUp->Sym, reg->eUp->Lnext ); + if (e == NULL) return NULL; + if ( !FixUpperEdge( reg, e ) ) return NULL; + reg = RegionAbove( reg ); + } + return reg; +} + +static ActiveRegion *TopRightRegion( ActiveRegion *reg ) +{ + GLUvertex *dst = reg->eUp->Dst; + + /* Find the region above the uppermost edge with the same destination */ + do { + reg = RegionAbove( reg ); + } while( reg->eUp->Dst == dst ); + return reg; +} + +static ActiveRegion *AddRegionBelow( GLUtesselator *tess, + ActiveRegion *regAbove, + GLUhalfEdge *eNewUp ) +/* + * Add a new active region to the sweep line, *somewhere* below "regAbove" + * (according to where the new edge belongs in the sweep-line dictionary). + * The upper edge of the new region will be "eNewUp". + * Winding number and "inside" flag are not updated. + */ +{ + ActiveRegion *regNew = (ActiveRegion *)memAlloc( sizeof( ActiveRegion )); + if (regNew == NULL) longjmp(tess->env,1); + + regNew->eUp = eNewUp; + /* __gl_dictListInsertBefore */ + regNew->nodeUp = dictInsertBefore( tess->dict, regAbove->nodeUp, regNew ); + if (regNew->nodeUp == NULL) longjmp(tess->env,1); + regNew->fixUpperEdge = FALSE; + regNew->sentinel = FALSE; + regNew->dirty = FALSE; + + eNewUp->activeRegion = regNew; + return regNew; +} + +static GLboolean IsWindingInside( GLUtesselator *tess, int n ) +{ + switch( tess->windingRule ) { + case GLU_TESS_WINDING_ODD: + return (n & 1); + case GLU_TESS_WINDING_NONZERO: + return (n != 0); + case GLU_TESS_WINDING_POSITIVE: + return (n > 0); + case GLU_TESS_WINDING_NEGATIVE: + return (n < 0); + case GLU_TESS_WINDING_ABS_GEQ_TWO: + return (n >= 2) || (n <= -2); + } + /*LINTED*/ + assert( FALSE ); + /*NOTREACHED*/ + return GL_FALSE; /* avoid compiler complaints */ +} + + +static void ComputeWinding( GLUtesselator *tess, ActiveRegion *reg ) +{ + reg->windingNumber = RegionAbove(reg)->windingNumber + reg->eUp->winding; + reg->inside = IsWindingInside( tess, reg->windingNumber ); +} + + +static void FinishRegion( GLUtesselator *tess, ActiveRegion *reg ) +/* + * Delete a region from the sweep line. This happens when the upper + * and lower chains of a region meet (at a vertex on the sweep line). + * The "inside" flag is copied to the appropriate mesh face (we could + * not do this before -- since the structure of the mesh is always + * changing, this face may not have even existed until now). + */ +{ + GLUhalfEdge *e = reg->eUp; + GLUface *f = e->Lface; + + f->inside = reg->inside; + f->anEdge = e; /* optimization for __gl_meshTessellateMonoRegion() */ + DeleteRegion( tess, reg ); +} + + +static GLUhalfEdge *FinishLeftRegions( GLUtesselator *tess, + ActiveRegion *regFirst, ActiveRegion *regLast ) +/* + * We are given a vertex with one or more left-going edges. All affected + * edges should be in the edge dictionary. Starting at regFirst->eUp, + * we walk down deleting all regions where both edges have the same + * origin vOrg. At the same time we copy the "inside" flag from the + * active region to the face, since at this point each face will belong + * to at most one region (this was not necessarily true until this point + * in the sweep). The walk stops at the region above regLast; if regLast + * is NULL we walk as far as possible. At the same time we relink the + * mesh if necessary, so that the ordering of edges around vOrg is the + * same as in the dictionary. + */ +{ + ActiveRegion *reg, *regPrev; + GLUhalfEdge *e, *ePrev; + + regPrev = regFirst; + ePrev = regFirst->eUp; + while( regPrev != regLast ) { + regPrev->fixUpperEdge = FALSE; /* placement was OK */ + reg = RegionBelow( regPrev ); + e = reg->eUp; + if( e->Org != ePrev->Org ) { + if( ! reg->fixUpperEdge ) { + /* Remove the last left-going edge. Even though there are no further + * edges in the dictionary with this origin, there may be further + * such edges in the mesh (if we are adding left edges to a vertex + * that has already been processed). Thus it is important to call + * FinishRegion rather than just DeleteRegion. + */ + FinishRegion( tess, regPrev ); + break; + } + /* If the edge below was a temporary edge introduced by + * ConnectRightVertex, now is the time to fix it. + */ + e = __gl_meshConnect( ePrev->Lprev, e->Sym ); + if (e == NULL) longjmp(tess->env,1); + if ( !FixUpperEdge( reg, e ) ) longjmp(tess->env,1); + } + + /* Relink edges so that ePrev->Onext == e */ + if( ePrev->Onext != e ) { + if ( !__gl_meshSplice( e->Oprev, e ) ) longjmp(tess->env,1); + if ( !__gl_meshSplice( ePrev, e ) ) longjmp(tess->env,1); + } + FinishRegion( tess, regPrev ); /* may change reg->eUp */ + ePrev = reg->eUp; + regPrev = reg; + } + return ePrev; +} + + +static void AddRightEdges( GLUtesselator *tess, ActiveRegion *regUp, + GLUhalfEdge *eFirst, GLUhalfEdge *eLast, GLUhalfEdge *eTopLeft, + GLboolean cleanUp ) +/* + * Purpose: insert right-going edges into the edge dictionary, and update + * winding numbers and mesh connectivity appropriately. All right-going + * edges share a common origin vOrg. Edges are inserted CCW starting at + * eFirst; the last edge inserted is eLast->Oprev. If vOrg has any + * left-going edges already processed, then eTopLeft must be the edge + * such that an imaginary upward vertical segment from vOrg would be + * contained between eTopLeft->Oprev and eTopLeft; otherwise eTopLeft + * should be NULL. + */ +{ + ActiveRegion *reg, *regPrev; + GLUhalfEdge *e, *ePrev; + int firstTime = TRUE; + + /* Insert the new right-going edges in the dictionary */ + e = eFirst; + do { + assert( VertLeq( e->Org, e->Dst )); + AddRegionBelow( tess, regUp, e->Sym ); + e = e->Onext; + } while ( e != eLast ); + + /* Walk *all* right-going edges from e->Org, in the dictionary order, + * updating the winding numbers of each region, and re-linking the mesh + * edges to match the dictionary ordering (if necessary). + */ + if( eTopLeft == NULL ) { + eTopLeft = RegionBelow( regUp )->eUp->Rprev; + } + regPrev = regUp; + ePrev = eTopLeft; + for( ;; ) { + reg = RegionBelow( regPrev ); + e = reg->eUp->Sym; + if( e->Org != ePrev->Org ) break; + + if( e->Onext != ePrev ) { + /* Unlink e from its current position, and relink below ePrev */ + if ( !__gl_meshSplice( e->Oprev, e ) ) longjmp(tess->env,1); + if ( !__gl_meshSplice( ePrev->Oprev, e ) ) longjmp(tess->env,1); + } + /* Compute the winding number and "inside" flag for the new regions */ + reg->windingNumber = regPrev->windingNumber - e->winding; + reg->inside = IsWindingInside( tess, reg->windingNumber ); + + /* Check for two outgoing edges with same slope -- process these + * before any intersection tests (see example in __gl_computeInterior). + */ + regPrev->dirty = TRUE; + if( ! firstTime && CheckForRightSplice( tess, regPrev )) { + AddWinding( e, ePrev ); + DeleteRegion( tess, regPrev ); + if ( !__gl_meshDelete( ePrev ) ) longjmp(tess->env,1); + } + firstTime = FALSE; + regPrev = reg; + ePrev = e; + } + regPrev->dirty = TRUE; + assert( regPrev->windingNumber - e->winding == reg->windingNumber ); + + if( cleanUp ) { + /* Check for intersections between newly adjacent edges. */ + WalkDirtyRegions( tess, regPrev ); + } +} + + +static void CallCombine( GLUtesselator *tess, GLUvertex *isect, + void *data[4], GLfloat weights[4], int needed ) +{ + GLdouble coords[3]; + + /* Copy coord data in case the callback changes it. */ + coords[0] = isect->coords[0]; + coords[1] = isect->coords[1]; + coords[2] = isect->coords[2]; + + isect->data = NULL; + CALL_COMBINE_OR_COMBINE_DATA( coords, data, weights, &isect->data ); + if( isect->data == NULL ) { + if( ! needed ) { + isect->data = data[0]; + } else if( ! tess->fatalError ) { + /* The only way fatal error is when two edges are found to intersect, + * but the user has not provided the callback necessary to handle + * generated intersection points. + */ + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_NEED_COMBINE_CALLBACK ); + tess->fatalError = TRUE; + } + } +} + +static void SpliceMergeVertices( GLUtesselator *tess, GLUhalfEdge *e1, + GLUhalfEdge *e2 ) +/* + * Two vertices with idential coordinates are combined into one. + * e1->Org is kept, while e2->Org is discarded. + */ +{ + void *data[4] = { NULL, NULL, NULL, NULL }; + GLfloat weights[4] = { 0.5, 0.5, 0.0, 0.0 }; + + data[0] = e1->Org->data; + data[1] = e2->Org->data; + CallCombine( tess, e1->Org, data, weights, FALSE ); + if ( !__gl_meshSplice( e1, e2 ) ) longjmp(tess->env,1); +} + +static void VertexWeights( GLUvertex *isect, GLUvertex *org, GLUvertex *dst, + GLfloat *weights ) +/* + * Find some weights which describe how the intersection vertex is + * a linear combination of "org" and "dest". Each of the two edges + * which generated "isect" is allocated 50% of the weight; each edge + * splits the weight between its org and dst according to the + * relative distance to "isect". + */ +{ + GLdouble t1 = VertL1dist( org, isect ); + GLdouble t2 = VertL1dist( dst, isect ); + + weights[0] = 0.5 * t2 / (t1 + t2); + weights[1] = 0.5 * t1 / (t1 + t2); + isect->coords[0] += weights[0]*org->coords[0] + weights[1]*dst->coords[0]; + isect->coords[1] += weights[0]*org->coords[1] + weights[1]*dst->coords[1]; + isect->coords[2] += weights[0]*org->coords[2] + weights[1]*dst->coords[2]; +} + + +static void GetIntersectData( GLUtesselator *tess, GLUvertex *isect, + GLUvertex *orgUp, GLUvertex *dstUp, + GLUvertex *orgLo, GLUvertex *dstLo ) +/* + * We've computed a new intersection point, now we need a "data" pointer + * from the user so that we can refer to this new vertex in the + * rendering callbacks. + */ +{ + void *data[4]; + GLfloat weights[4]; + + data[0] = orgUp->data; + data[1] = dstUp->data; + data[2] = orgLo->data; + data[3] = dstLo->data; + + isect->coords[0] = isect->coords[1] = isect->coords[2] = 0; + VertexWeights( isect, orgUp, dstUp, &weights[0] ); + VertexWeights( isect, orgLo, dstLo, &weights[2] ); + + CallCombine( tess, isect, data, weights, TRUE ); +} + +static int CheckForRightSplice( GLUtesselator *tess, ActiveRegion *regUp ) +/* + * Check the upper and lower edge of "regUp", to make sure that the + * eUp->Org is above eLo, or eLo->Org is below eUp (depending on which + * origin is leftmost). + * + * The main purpose is to splice right-going edges with the same + * dest vertex and nearly identical slopes (ie. we can't distinguish + * the slopes numerically). However the splicing can also help us + * to recover from numerical errors. For example, suppose at one + * point we checked eUp and eLo, and decided that eUp->Org is barely + * above eLo. Then later, we split eLo into two edges (eg. from + * a splice operation like this one). This can change the result of + * our test so that now eUp->Org is incident to eLo, or barely below it. + * We must correct this condition to maintain the dictionary invariants. + * + * One possibility is to check these edges for intersection again + * (ie. CheckForIntersect). This is what we do if possible. However + * CheckForIntersect requires that tess->event lies between eUp and eLo, + * so that it has something to fall back on when the intersection + * calculation gives us an unusable answer. So, for those cases where + * we can't check for intersection, this routine fixes the problem + * by just splicing the offending vertex into the other edge. + * This is a guaranteed solution, no matter how degenerate things get. + * Basically this is a combinatorial solution to a numerical problem. + */ +{ + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp = regUp->eUp; + GLUhalfEdge *eLo = regLo->eUp; + + if( VertLeq( eUp->Org, eLo->Org )) { + if( EdgeSign( eLo->Dst, eUp->Org, eLo->Org ) > 0 ) return FALSE; + + /* eUp->Org appears to be below eLo */ + if( ! VertEq( eUp->Org, eLo->Org )) { + /* Splice eUp->Org into eLo */ + if ( __gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eUp, eLo->Oprev ) ) longjmp(tess->env,1); + regUp->dirty = regLo->dirty = TRUE; + + } else if( eUp->Org != eLo->Org ) { + /* merge the two vertices, discarding eUp->Org */ + pqDelete( tess->pq, eUp->Org->pqHandle ); /* __gl_pqSortDelete */ + SpliceMergeVertices( tess, eLo->Oprev, eUp ); + } + } else { + if( EdgeSign( eUp->Dst, eLo->Org, eUp->Org ) < 0 ) return FALSE; + + /* eLo->Org appears to be above eUp, so splice eLo->Org into eUp */ + RegionAbove(regUp)->dirty = regUp->dirty = TRUE; + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Oprev, eUp ) ) longjmp(tess->env,1); + } + return TRUE; +} + +static int CheckForLeftSplice( GLUtesselator *tess, ActiveRegion *regUp ) +/* + * Check the upper and lower edge of "regUp", to make sure that the + * eUp->Dst is above eLo, or eLo->Dst is below eUp (depending on which + * destination is rightmost). + * + * Theoretically, this should always be true. However, splitting an edge + * into two pieces can change the results of previous tests. For example, + * suppose at one point we checked eUp and eLo, and decided that eUp->Dst + * is barely above eLo. Then later, we split eLo into two edges (eg. from + * a splice operation like this one). This can change the result of + * the test so that now eUp->Dst is incident to eLo, or barely below it. + * We must correct this condition to maintain the dictionary invariants + * (otherwise new edges might get inserted in the wrong place in the + * dictionary, and bad stuff will happen). + * + * We fix the problem by just splicing the offending vertex into the + * other edge. + */ +{ + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp = regUp->eUp; + GLUhalfEdge *eLo = regLo->eUp; + GLUhalfEdge *e; + + assert( ! VertEq( eUp->Dst, eLo->Dst )); + + if( VertLeq( eUp->Dst, eLo->Dst )) { + if( EdgeSign( eUp->Dst, eLo->Dst, eUp->Org ) < 0 ) return FALSE; + + /* eLo->Dst is above eUp, so splice eLo->Dst into eUp */ + RegionAbove(regUp)->dirty = regUp->dirty = TRUE; + e = __gl_meshSplitEdge( eUp ); + if (e == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Sym, e ) ) longjmp(tess->env,1); + e->Lface->inside = regUp->inside; + } else { + if( EdgeSign( eLo->Dst, eUp->Dst, eLo->Org ) > 0 ) return FALSE; + + /* eUp->Dst is below eLo, so splice eUp->Dst into eLo */ + regUp->dirty = regLo->dirty = TRUE; + e = __gl_meshSplitEdge( eLo ); + if (e == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eUp->Lnext, eLo->Sym ) ) longjmp(tess->env,1); + e->Rface->inside = regUp->inside; + } + return TRUE; +} + + +static int CheckForIntersect( GLUtesselator *tess, ActiveRegion *regUp ) +/* + * Check the upper and lower edges of the given region to see if + * they intersect. If so, create the intersection and add it + * to the data structures. + * + * Returns TRUE if adding the new intersection resulted in a recursive + * call to AddRightEdges(); in this case all "dirty" regions have been + * checked for intersections, and possibly regUp has been deleted. + */ +{ + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp = regUp->eUp; + GLUhalfEdge *eLo = regLo->eUp; + GLUvertex *orgUp = eUp->Org; + GLUvertex *orgLo = eLo->Org; + GLUvertex *dstUp = eUp->Dst; + GLUvertex *dstLo = eLo->Dst; + GLdouble tMinUp, tMaxLo; + GLUvertex isect, *orgMin; + GLUhalfEdge *e; + + assert( ! VertEq( dstLo, dstUp )); + assert( EdgeSign( dstUp, tess->event, orgUp ) <= 0 ); + assert( EdgeSign( dstLo, tess->event, orgLo ) >= 0 ); + assert( orgUp != tess->event && orgLo != tess->event ); + assert( ! regUp->fixUpperEdge && ! regLo->fixUpperEdge ); + + if( orgUp == orgLo ) return FALSE; /* right endpoints are the same */ + + tMinUp = MIN( orgUp->t, dstUp->t ); + tMaxLo = MAX( orgLo->t, dstLo->t ); + if( tMinUp > tMaxLo ) return FALSE; /* t ranges do not overlap */ + + if( VertLeq( orgUp, orgLo )) { + if( EdgeSign( dstLo, orgUp, orgLo ) > 0 ) return FALSE; + } else { + if( EdgeSign( dstUp, orgLo, orgUp ) < 0 ) return FALSE; + } + + /* At this point the edges intersect, at least marginally */ + DebugEvent( tess ); + + __gl_edgeIntersect( dstUp, orgUp, dstLo, orgLo, &isect ); + /* The following properties are guaranteed: */ + assert( MIN( orgUp->t, dstUp->t ) <= isect.t ); + assert( isect.t <= MAX( orgLo->t, dstLo->t )); + assert( MIN( dstLo->s, dstUp->s ) <= isect.s ); + assert( isect.s <= MAX( orgLo->s, orgUp->s )); + + if( VertLeq( &isect, tess->event )) { + /* The intersection point lies slightly to the left of the sweep line, + * so move it until it''s slightly to the right of the sweep line. + * (If we had perfect numerical precision, this would never happen + * in the first place). The easiest and safest thing to do is + * replace the intersection by tess->event. + */ + isect.s = tess->event->s; + isect.t = tess->event->t; + } + /* Similarly, if the computed intersection lies to the right of the + * rightmost origin (which should rarely happen), it can cause + * unbelievable inefficiency on sufficiently degenerate inputs. + * (If you have the test program, try running test54.d with the + * "X zoom" option turned on). + */ + orgMin = VertLeq( orgUp, orgLo ) ? orgUp : orgLo; + if( VertLeq( orgMin, &isect )) { + isect.s = orgMin->s; + isect.t = orgMin->t; + } + + if( VertEq( &isect, orgUp ) || VertEq( &isect, orgLo )) { + /* Easy case -- intersection at one of the right endpoints */ + (void) CheckForRightSplice( tess, regUp ); + return FALSE; + } + + if( (! VertEq( dstUp, tess->event ) + && EdgeSign( dstUp, tess->event, &isect ) >= 0) + || (! VertEq( dstLo, tess->event ) + && EdgeSign( dstLo, tess->event, &isect ) <= 0 )) + { + /* Very unusual -- the new upper or lower edge would pass on the + * wrong side of the sweep event, or through it. This can happen + * due to very small numerical errors in the intersection calculation. + */ + if( dstLo == tess->event ) { + /* Splice dstLo into eUp, and process the new region(s) */ + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Sym, eUp ) ) longjmp(tess->env,1); + regUp = TopLeftRegion( regUp ); + if (regUp == NULL) longjmp(tess->env,1); + eUp = RegionBelow(regUp)->eUp; + FinishLeftRegions( tess, RegionBelow(regUp), regLo ); + AddRightEdges( tess, regUp, eUp->Oprev, eUp, eUp, TRUE ); + return TRUE; + } + if( dstUp == tess->event ) { + /* Splice dstUp into eLo, and process the new region(s) */ + if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eUp->Lnext, eLo->Oprev ) ) longjmp(tess->env,1); + regLo = regUp; + regUp = TopRightRegion( regUp ); + e = RegionBelow(regUp)->eUp->Rprev; + regLo->eUp = eLo->Oprev; + eLo = FinishLeftRegions( tess, regLo, NULL ); + AddRightEdges( tess, regUp, eLo->Onext, eUp->Rprev, e, TRUE ); + return TRUE; + } + /* Special case: called from ConnectRightVertex. If either + * edge passes on the wrong side of tess->event, split it + * (and wait for ConnectRightVertex to splice it appropriately). + */ + if( EdgeSign( dstUp, tess->event, &isect ) >= 0 ) { + RegionAbove(regUp)->dirty = regUp->dirty = TRUE; + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + eUp->Org->s = tess->event->s; + eUp->Org->t = tess->event->t; + } + if( EdgeSign( dstLo, tess->event, &isect ) <= 0 ) { + regUp->dirty = regLo->dirty = TRUE; + if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1); + eLo->Org->s = tess->event->s; + eLo->Org->t = tess->event->t; + } + /* leave the rest for ConnectRightVertex */ + return FALSE; + } + + /* General case -- split both edges, splice into new vertex. + * When we do the splice operation, the order of the arguments is + * arbitrary as far as correctness goes. However, when the operation + * creates a new face, the work done is proportional to the size of + * the new face. We expect the faces in the processed part of + * the mesh (ie. eUp->Lface) to be smaller than the faces in the + * unprocessed original contours (which will be eLo->Oprev->Lface). + */ + if (__gl_meshSplitEdge( eUp->Sym ) == NULL) longjmp(tess->env,1); + if (__gl_meshSplitEdge( eLo->Sym ) == NULL) longjmp(tess->env,1); + if ( !__gl_meshSplice( eLo->Oprev, eUp ) ) longjmp(tess->env,1); + eUp->Org->s = isect.s; + eUp->Org->t = isect.t; + eUp->Org->pqHandle = pqInsert( tess->pq, eUp->Org ); /* __gl_pqSortInsert */ + if (eUp->Org->pqHandle == LONG_MAX) { + pqDeletePriorityQ(tess->pq); /* __gl_pqSortDeletePriorityQ */ + tess->pq = NULL; + longjmp(tess->env,1); + } + GetIntersectData( tess, eUp->Org, orgUp, dstUp, orgLo, dstLo ); + RegionAbove(regUp)->dirty = regUp->dirty = regLo->dirty = TRUE; + return FALSE; +} + +static void WalkDirtyRegions( GLUtesselator *tess, ActiveRegion *regUp ) +/* + * When the upper or lower edge of any region changes, the region is + * marked "dirty". This routine walks through all the dirty regions + * and makes sure that the dictionary invariants are satisfied + * (see the comments at the beginning of this file). Of course + * new dirty regions can be created as we make changes to restore + * the invariants. + */ +{ + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp, *eLo; + + for( ;; ) { + /* Find the lowest dirty region (we walk from the bottom up). */ + while( regLo->dirty ) { + regUp = regLo; + regLo = RegionBelow(regLo); + } + if( ! regUp->dirty ) { + regLo = regUp; + regUp = RegionAbove( regUp ); + if( regUp == NULL || ! regUp->dirty ) { + /* We've walked all the dirty regions */ + return; + } + } + regUp->dirty = FALSE; + eUp = regUp->eUp; + eLo = regLo->eUp; + + if( eUp->Dst != eLo->Dst ) { + /* Check that the edge ordering is obeyed at the Dst vertices. */ + if( CheckForLeftSplice( tess, regUp )) { + + /* If the upper or lower edge was marked fixUpperEdge, then + * we no longer need it (since these edges are needed only for + * vertices which otherwise have no right-going edges). + */ + if( regLo->fixUpperEdge ) { + DeleteRegion( tess, regLo ); + if ( !__gl_meshDelete( eLo ) ) longjmp(tess->env,1); + regLo = RegionBelow( regUp ); + eLo = regLo->eUp; + } else if( regUp->fixUpperEdge ) { + DeleteRegion( tess, regUp ); + if ( !__gl_meshDelete( eUp ) ) longjmp(tess->env,1); + regUp = RegionAbove( regLo ); + eUp = regUp->eUp; + } + } + } + if( eUp->Org != eLo->Org ) { + if( eUp->Dst != eLo->Dst + && ! regUp->fixUpperEdge && ! regLo->fixUpperEdge + && (eUp->Dst == tess->event || eLo->Dst == tess->event) ) + { + /* When all else fails in CheckForIntersect(), it uses tess->event + * as the intersection location. To make this possible, it requires + * that tess->event lie between the upper and lower edges, and also + * that neither of these is marked fixUpperEdge (since in the worst + * case it might splice one of these edges into tess->event, and + * violate the invariant that fixable edges are the only right-going + * edge from their associated vertex). + */ + if( CheckForIntersect( tess, regUp )) { + /* WalkDirtyRegions() was called recursively; we're done */ + return; + } + } else { + /* Even though we can't use CheckForIntersect(), the Org vertices + * may violate the dictionary edge ordering. Check and correct this. + */ + (void) CheckForRightSplice( tess, regUp ); + } + } + if( eUp->Org == eLo->Org && eUp->Dst == eLo->Dst ) { + /* A degenerate loop consisting of only two edges -- delete it. */ + AddWinding( eLo, eUp ); + DeleteRegion( tess, regUp ); + if ( !__gl_meshDelete( eUp ) ) longjmp(tess->env,1); + regUp = RegionAbove( regLo ); + } + } +} + + +static void ConnectRightVertex( GLUtesselator *tess, ActiveRegion *regUp, + GLUhalfEdge *eBottomLeft ) +/* + * Purpose: connect a "right" vertex vEvent (one where all edges go left) + * to the unprocessed portion of the mesh. Since there are no right-going + * edges, two regions (one above vEvent and one below) are being merged + * into one. "regUp" is the upper of these two regions. + * + * There are two reasons for doing this (adding a right-going edge): + * - if the two regions being merged are "inside", we must add an edge + * to keep them separated (the combined region would not be monotone). + * - in any case, we must leave some record of vEvent in the dictionary, + * so that we can merge vEvent with features that we have not seen yet. + * For example, maybe there is a vertical edge which passes just to + * the right of vEvent; we would like to splice vEvent into this edge. + * + * However, we don't want to connect vEvent to just any vertex. We don''t + * want the new edge to cross any other edges; otherwise we will create + * intersection vertices even when the input data had no self-intersections. + * (This is a bad thing; if the user's input data has no intersections, + * we don't want to generate any false intersections ourselves.) + * + * Our eventual goal is to connect vEvent to the leftmost unprocessed + * vertex of the combined region (the union of regUp and regLo). + * But because of unseen vertices with all right-going edges, and also + * new vertices which may be created by edge intersections, we don''t + * know where that leftmost unprocessed vertex is. In the meantime, we + * connect vEvent to the closest vertex of either chain, and mark the region + * as "fixUpperEdge". This flag says to delete and reconnect this edge + * to the next processed vertex on the boundary of the combined region. + * Quite possibly the vertex we connected to will turn out to be the + * closest one, in which case we won''t need to make any changes. + */ +{ + GLUhalfEdge *eNew; + GLUhalfEdge *eTopLeft = eBottomLeft->Onext; + ActiveRegion *regLo = RegionBelow(regUp); + GLUhalfEdge *eUp = regUp->eUp; + GLUhalfEdge *eLo = regLo->eUp; + int degenerate = FALSE; + + if( eUp->Dst != eLo->Dst ) { + (void) CheckForIntersect( tess, regUp ); + } + + /* Possible new degeneracies: upper or lower edge of regUp may pass + * through vEvent, or may coincide with new intersection vertex + */ + if( VertEq( eUp->Org, tess->event )) { + if ( !__gl_meshSplice( eTopLeft->Oprev, eUp ) ) longjmp(tess->env,1); + regUp = TopLeftRegion( regUp ); + if (regUp == NULL) longjmp(tess->env,1); + eTopLeft = RegionBelow( regUp )->eUp; + FinishLeftRegions( tess, RegionBelow(regUp), regLo ); + degenerate = TRUE; + } + if( VertEq( eLo->Org, tess->event )) { + if ( !__gl_meshSplice( eBottomLeft, eLo->Oprev ) ) longjmp(tess->env,1); + eBottomLeft = FinishLeftRegions( tess, regLo, NULL ); + degenerate = TRUE; + } + if( degenerate ) { + AddRightEdges( tess, regUp, eBottomLeft->Onext, eTopLeft, eTopLeft, TRUE ); + return; + } + + /* Non-degenerate situation -- need to add a temporary, fixable edge. + * Connect to the closer of eLo->Org, eUp->Org. + */ + if( VertLeq( eLo->Org, eUp->Org )) { + eNew = eLo->Oprev; + } else { + eNew = eUp; + } + eNew = __gl_meshConnect( eBottomLeft->Lprev, eNew ); + if (eNew == NULL) longjmp(tess->env,1); + + /* Prevent cleanup, otherwise eNew might disappear before we've even + * had a chance to mark it as a temporary edge. + */ + AddRightEdges( tess, regUp, eNew, eNew->Onext, eNew->Onext, FALSE ); + eNew->Sym->activeRegion->fixUpperEdge = TRUE; + WalkDirtyRegions( tess, regUp ); +} + +/* Because vertices at exactly the same location are merged together + * before we process the sweep event, some degenerate cases can't occur. + * However if someone eventually makes the modifications required to + * merge features which are close together, the cases below marked + * TOLERANCE_NONZERO will be useful. They were debugged before the + * code to merge identical vertices in the main loop was added. + */ +#define TOLERANCE_NONZERO FALSE + +static void ConnectLeftDegenerate( GLUtesselator *tess, + ActiveRegion *regUp, GLUvertex *vEvent ) +/* + * The event vertex lies exacty on an already-processed edge or vertex. + * Adding the new vertex involves splicing it into the already-processed + * part of the mesh. + */ +{ + GLUhalfEdge *e, *eTopLeft, *eTopRight, *eLast; + ActiveRegion *reg; + + e = regUp->eUp; + if( VertEq( e->Org, vEvent )) { + /* e->Org is an unprocessed vertex - just combine them, and wait + * for e->Org to be pulled from the queue + */ + assert( TOLERANCE_NONZERO ); + SpliceMergeVertices( tess, e, vEvent->anEdge ); + return; + } + + if( ! VertEq( e->Dst, vEvent )) { + /* General case -- splice vEvent into edge e which passes through it */ + if (__gl_meshSplitEdge( e->Sym ) == NULL) longjmp(tess->env,1); + if( regUp->fixUpperEdge ) { + /* This edge was fixable -- delete unused portion of original edge */ + if ( !__gl_meshDelete( e->Onext ) ) longjmp(tess->env,1); + regUp->fixUpperEdge = FALSE; + } + if ( !__gl_meshSplice( vEvent->anEdge, e ) ) longjmp(tess->env,1); + SweepEvent( tess, vEvent ); /* recurse */ + return; + } + + /* vEvent coincides with e->Dst, which has already been processed. + * Splice in the additional right-going edges. + */ + assert( TOLERANCE_NONZERO ); + regUp = TopRightRegion( regUp ); + reg = RegionBelow( regUp ); + eTopRight = reg->eUp->Sym; + eTopLeft = eLast = eTopRight->Onext; + if( reg->fixUpperEdge ) { + /* Here e->Dst has only a single fixable edge going right. + * We can delete it since now we have some real right-going edges. + */ + assert( eTopLeft != eTopRight ); /* there are some left edges too */ + DeleteRegion( tess, reg ); + if ( !__gl_meshDelete( eTopRight ) ) longjmp(tess->env,1); + eTopRight = eTopLeft->Oprev; + } + if ( !__gl_meshSplice( vEvent->anEdge, eTopRight ) ) longjmp(tess->env,1); + if( ! EdgeGoesLeft( eTopLeft )) { + /* e->Dst had no left-going edges -- indicate this to AddRightEdges() */ + eTopLeft = NULL; + } + AddRightEdges( tess, regUp, eTopRight->Onext, eLast, eTopLeft, TRUE ); +} + + +static void ConnectLeftVertex( GLUtesselator *tess, GLUvertex *vEvent ) +/* + * Purpose: connect a "left" vertex (one where both edges go right) + * to the processed portion of the mesh. Let R be the active region + * containing vEvent, and let U and L be the upper and lower edge + * chains of R. There are two possibilities: + * + * - the normal case: split R into two regions, by connecting vEvent to + * the rightmost vertex of U or L lying to the left of the sweep line + * + * - the degenerate case: if vEvent is close enough to U or L, we + * merge vEvent into that edge chain. The subcases are: + * - merging with the rightmost vertex of U or L + * - merging with the active edge of U or L + * - merging with an already-processed portion of U or L + */ +{ + ActiveRegion *regUp, *regLo, *reg; + GLUhalfEdge *eUp, *eLo, *eNew; + ActiveRegion tmp; + + /* assert( vEvent->anEdge->Onext->Onext == vEvent->anEdge ); */ + + /* Get a pointer to the active region containing vEvent */ + tmp.eUp = vEvent->anEdge->Sym; + /* __GL_DICTLISTKEY */ /* __gl_dictListSearch */ + regUp = (ActiveRegion *)dictKey( dictSearch( tess->dict, &tmp )); + regLo = RegionBelow( regUp ); + eUp = regUp->eUp; + eLo = regLo->eUp; + + /* Try merging with U or L first */ + if( EdgeSign( eUp->Dst, vEvent, eUp->Org ) == 0 ) { + ConnectLeftDegenerate( tess, regUp, vEvent ); + return; + } + + /* Connect vEvent to rightmost processed vertex of either chain. + * e->Dst is the vertex that we will connect to vEvent. + */ + reg = VertLeq( eLo->Dst, eUp->Dst ) ? regUp : regLo; + + if( regUp->inside || reg->fixUpperEdge) { + if( reg == regUp ) { + eNew = __gl_meshConnect( vEvent->anEdge->Sym, eUp->Lnext ); + if (eNew == NULL) longjmp(tess->env,1); + } else { + GLUhalfEdge *tempHalfEdge= __gl_meshConnect( eLo->Dnext, vEvent->anEdge); + if (tempHalfEdge == NULL) longjmp(tess->env,1); + + eNew = tempHalfEdge->Sym; + } + if( reg->fixUpperEdge ) { + if ( !FixUpperEdge( reg, eNew ) ) longjmp(tess->env,1); + } else { + ComputeWinding( tess, AddRegionBelow( tess, regUp, eNew )); + } + SweepEvent( tess, vEvent ); + } else { + /* The new vertex is in a region which does not belong to the polygon. + * We don''t need to connect this vertex to the rest of the mesh. + */ + AddRightEdges( tess, regUp, vEvent->anEdge, vEvent->anEdge, NULL, TRUE ); + } +} + + +static void SweepEvent( GLUtesselator *tess, GLUvertex *vEvent ) +/* + * Does everything necessary when the sweep line crosses a vertex. + * Updates the mesh and the edge dictionary. + */ +{ + ActiveRegion *regUp, *reg; + GLUhalfEdge *e, *eTopLeft, *eBottomLeft; + + tess->event = vEvent; /* for access in EdgeLeq() */ + DebugEvent( tess ); + + /* Check if this vertex is the right endpoint of an edge that is + * already in the dictionary. In this case we don't need to waste + * time searching for the location to insert new edges. + */ + e = vEvent->anEdge; + while( e->activeRegion == NULL ) { + e = e->Onext; + if( e == vEvent->anEdge ) { + /* All edges go right -- not incident to any processed edges */ + ConnectLeftVertex( tess, vEvent ); + return; + } + } + + /* Processing consists of two phases: first we "finish" all the + * active regions where both the upper and lower edges terminate + * at vEvent (ie. vEvent is closing off these regions). + * We mark these faces "inside" or "outside" the polygon according + * to their winding number, and delete the edges from the dictionary. + * This takes care of all the left-going edges from vEvent. + */ + regUp = TopLeftRegion( e->activeRegion ); + if (regUp == NULL) longjmp(tess->env,1); + reg = RegionBelow( regUp ); + eTopLeft = reg->eUp; + eBottomLeft = FinishLeftRegions( tess, reg, NULL ); + + /* Next we process all the right-going edges from vEvent. This + * involves adding the edges to the dictionary, and creating the + * associated "active regions" which record information about the + * regions between adjacent dictionary edges. + */ + if( eBottomLeft->Onext == eTopLeft ) { + /* No right-going edges -- add a temporary "fixable" edge */ + ConnectRightVertex( tess, regUp, eBottomLeft ); + } else { + AddRightEdges( tess, regUp, eBottomLeft->Onext, eTopLeft, eTopLeft, TRUE ); + } +} + + +/* Make the sentinel coordinates big enough that they will never be + * merged with real input features. (Even with the largest possible + * input contour and the maximum tolerance of 1.0, no merging will be + * done with coordinates larger than 3 * GLU_TESS_MAX_COORD). + */ +#define SENTINEL_COORD (4 * GLU_TESS_MAX_COORD) + +static void AddSentinel( GLUtesselator *tess, GLdouble t ) +/* + * We add two sentinel edges above and below all other edges, + * to avoid special cases at the top and bottom. + */ +{ + GLUhalfEdge *e; + ActiveRegion *reg = (ActiveRegion *)memAlloc( sizeof( ActiveRegion )); + if (reg == NULL) longjmp(tess->env,1); + + e = __gl_meshMakeEdge( tess->mesh ); + if (e == NULL) longjmp(tess->env,1); + + e->Org->s = SENTINEL_COORD; + e->Org->t = t; + e->Dst->s = -SENTINEL_COORD; + e->Dst->t = t; + tess->event = e->Dst; /* initialize it */ + + reg->eUp = e; + reg->windingNumber = 0; + reg->inside = FALSE; + reg->fixUpperEdge = FALSE; + reg->sentinel = TRUE; + reg->dirty = FALSE; + reg->nodeUp = dictInsert( tess->dict, reg ); /* __gl_dictListInsertBefore */ + if (reg->nodeUp == NULL) longjmp(tess->env,1); +} + + +static void InitEdgeDict( GLUtesselator *tess ) +/* + * We maintain an ordering of edge intersections with the sweep line. + * This order is maintained in a dynamic dictionary. + */ +{ + /* __gl_dictListNewDict */ + tess->dict = dictNewDict( tess, (int (*)(void *, DictKey, DictKey)) EdgeLeq ); + if (tess->dict == NULL) longjmp(tess->env,1); + + AddSentinel( tess, -SENTINEL_COORD ); + AddSentinel( tess, SENTINEL_COORD ); +} + + +static void DoneEdgeDict( GLUtesselator *tess ) +{ + ActiveRegion *reg; +#ifndef NDEBUG + int fixedEdges = 0; +#endif + + /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ + while( (reg = (ActiveRegion *)dictKey( dictMin( tess->dict ))) != NULL ) { + /* + * At the end of all processing, the dictionary should contain + * only the two sentinel edges, plus at most one "fixable" edge + * created by ConnectRightVertex(). + */ + if( ! reg->sentinel ) { + assert( reg->fixUpperEdge ); + assert( ++fixedEdges == 1 ); + } + assert( reg->windingNumber == 0 ); + DeleteRegion( tess, reg ); +/* __gl_meshDelete( reg->eUp );*/ + } + dictDeleteDict( tess->dict ); /* __gl_dictListDeleteDict */ +} + + +static void RemoveDegenerateEdges( GLUtesselator *tess ) +/* + * Remove zero-length edges, and contours with fewer than 3 vertices. + */ +{ + GLUhalfEdge *e, *eNext, *eLnext; + GLUhalfEdge *eHead = &tess->mesh->eHead; + + /*LINTED*/ + for( e = eHead->next; e != eHead; e = eNext ) { + eNext = e->next; + eLnext = e->Lnext; + + if( VertEq( e->Org, e->Dst ) && e->Lnext->Lnext != e ) { + /* Zero-length edge, contour has at least 3 edges */ + + SpliceMergeVertices( tess, eLnext, e ); /* deletes e->Org */ + if ( !__gl_meshDelete( e ) ) longjmp(tess->env,1); /* e is a self-loop */ + e = eLnext; + eLnext = e->Lnext; + } + if( eLnext->Lnext == e ) { + /* Degenerate contour (one or two edges) */ + + if( eLnext != e ) { + if( eLnext == eNext || eLnext == eNext->Sym ) { eNext = eNext->next; } + if ( !__gl_meshDelete( eLnext ) ) longjmp(tess->env,1); + } + if( e == eNext || e == eNext->Sym ) { eNext = eNext->next; } + if ( !__gl_meshDelete( e ) ) longjmp(tess->env,1); + } + } +} + +static int InitPriorityQ( GLUtesselator *tess ) +/* + * Insert all vertices into the priority queue which determines the + * order in which vertices cross the sweep line. + */ +{ + PriorityQ *pq; + GLUvertex *v, *vHead; + + /* __gl_pqSortNewPriorityQ */ + pq = tess->pq = pqNewPriorityQ( (int (*)(PQkey, PQkey)) __gl_vertLeq ); + if (pq == NULL) return 0; + + vHead = &tess->mesh->vHead; + for( v = vHead->next; v != vHead; v = v->next ) { + v->pqHandle = pqInsert( pq, v ); /* __gl_pqSortInsert */ + if (v->pqHandle == LONG_MAX) break; + } + if (v != vHead || !pqInit( pq ) ) { /* __gl_pqSortInit */ + pqDeletePriorityQ(tess->pq); /* __gl_pqSortDeletePriorityQ */ + tess->pq = NULL; + return 0; + } + + return 1; +} + + +static void DonePriorityQ( GLUtesselator *tess ) +{ + pqDeletePriorityQ( tess->pq ); /* __gl_pqSortDeletePriorityQ */ +} + + +static int RemoveDegenerateFaces( GLUmesh *mesh ) +/* + * Delete any degenerate faces with only two edges. WalkDirtyRegions() + * will catch almost all of these, but it won't catch degenerate faces + * produced by splice operations on already-processed edges. + * The two places this can happen are in FinishLeftRegions(), when + * we splice in a "temporary" edge produced by ConnectRightVertex(), + * and in CheckForLeftSplice(), where we splice already-processed + * edges to ensure that our dictionary invariants are not violated + * by numerical errors. + * + * In both these cases it is *very* dangerous to delete the offending + * edge at the time, since one of the routines further up the stack + * will sometimes be keeping a pointer to that edge. + */ +{ + GLUface *f, *fNext; + GLUhalfEdge *e; + + /*LINTED*/ + for( f = mesh->fHead.next; f != &mesh->fHead; f = fNext ) { + fNext = f->next; + e = f->anEdge; + assert( e->Lnext != e ); + + if( e->Lnext->Lnext == e ) { + /* A face with only two edges */ + AddWinding( e->Onext, e ); + if ( !__gl_meshDelete( e ) ) return 0; + } + } + return 1; +} + +int __gl_computeInterior( GLUtesselator *tess ) +/* + * __gl_computeInterior( tess ) computes the planar arrangement specified + * by the given contours, and further subdivides this arrangement + * into regions. Each region is marked "inside" if it belongs + * to the polygon, according to the rule given by tess->windingRule. + * Each interior region is guaranteed be monotone. + */ +{ + GLUvertex *v, *vNext; + + tess->fatalError = FALSE; + + /* Each vertex defines an event for our sweep line. Start by inserting + * all the vertices in a priority queue. Events are processed in + * lexicographic order, ie. + * + * e1 < e2 iff e1.x < e2.x || (e1.x == e2.x && e1.y < e2.y) + */ + RemoveDegenerateEdges( tess ); + if ( !InitPriorityQ( tess ) ) return 0; /* if error */ + InitEdgeDict( tess ); + + /* __gl_pqSortExtractMin */ + while( (v = (GLUvertex *)pqExtractMin( tess->pq )) != NULL ) { + for( ;; ) { + vNext = (GLUvertex *)pqMinimum( tess->pq ); /* __gl_pqSortMinimum */ + if( vNext == NULL || ! VertEq( vNext, v )) break; + + /* Merge together all vertices at exactly the same location. + * This is more efficient than processing them one at a time, + * simplifies the code (see ConnectLeftDegenerate), and is also + * important for correct handling of certain degenerate cases. + * For example, suppose there are two identical edges A and B + * that belong to different contours (so without this code they would + * be processed by separate sweep events). Suppose another edge C + * crosses A and B from above. When A is processed, we split it + * at its intersection point with C. However this also splits C, + * so when we insert B we may compute a slightly different + * intersection point. This might leave two edges with a small + * gap between them. This kind of error is especially obvious + * when using boundary extraction (GLU_TESS_BOUNDARY_ONLY). + */ + vNext = (GLUvertex *)pqExtractMin( tess->pq ); /* __gl_pqSortExtractMin*/ + SpliceMergeVertices( tess, v->anEdge, vNext->anEdge ); + } + SweepEvent( tess, v ); + } + + /* Set tess->event for debugging purposes */ + /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ + tess->event = ((ActiveRegion *) dictKey( dictMin( tess->dict )))->eUp->Org; + DebugEvent( tess ); + DoneEdgeDict( tess ); + DonePriorityQ( tess ); + + if ( !RemoveDegenerateFaces( tess->mesh ) ) return 0; + __gl_meshCheckMesh( tess->mesh ); + + return 1; +} diff --git a/mesalib/src/glu/sgi/libtess/sweep.h b/mesalib/src/glu/sgi/libtess/sweep.h new file mode 100644 index 000000000..feb68b0ff --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/sweep.h @@ -0,0 +1,77 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __sweep_h_ +#define __sweep_h_ + +#include "mesh.h" + +/* __gl_computeInterior( tess ) computes the planar arrangement specified + * by the given contours, and further subdivides this arrangement + * into regions. Each region is marked "inside" if it belongs + * to the polygon, according to the rule given by tess->windingRule. + * Each interior region is guaranteed be monotone. + */ +int __gl_computeInterior( GLUtesselator *tess ); + + +/* The following is here *only* for access by debugging routines */ + +#include "dict.h" + +/* For each pair of adjacent edges crossing the sweep line, there is + * an ActiveRegion to represent the region between them. The active + * regions are kept in sorted order in a dynamic dictionary. As the + * sweep line crosses each vertex, we update the affected regions. + */ + +struct ActiveRegion { + GLUhalfEdge *eUp; /* upper edge, directed right to left */ + DictNode *nodeUp; /* dictionary node corresponding to eUp */ + int windingNumber; /* used to determine which regions are + * inside the polygon */ + GLboolean inside; /* is this region inside the polygon? */ + GLboolean sentinel; /* marks fake edges at t = +/-infinity */ + GLboolean dirty; /* marks regions where the upper or lower + * edge has changed, but we haven't checked + * whether they intersect yet */ + GLboolean fixUpperEdge; /* marks temporary edges introduced when + * we process a "right vertex" (one without + * any edges leaving to the right) */ +}; + +#define RegionBelow(r) ((ActiveRegion *) dictKey(dictPred((r)->nodeUp))) +#define RegionAbove(r) ((ActiveRegion *) dictKey(dictSucc((r)->nodeUp))) + +#endif diff --git a/mesalib/src/glu/sgi/libtess/tess.c b/mesalib/src/glu/sgi/libtess/tess.c new file mode 100644 index 000000000..029a02c3a --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/tess.c @@ -0,0 +1,628 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include +#include +#include "memalloc.h" +#include "tess.h" +#include "mesh.h" +#include "normal.h" +#include "sweep.h" +#include "tessmono.h" +#include "render.h" + +#define GLU_TESS_DEFAULT_TOLERANCE 0.0 +#define GLU_TESS_MESH 100112 /* void (*)(GLUmesh *mesh) */ + +#define TRUE 1 +#define FALSE 0 + +/*ARGSUSED*/ static void GLAPIENTRY noBegin( GLenum type ) {} +/*ARGSUSED*/ static void GLAPIENTRY noEdgeFlag( GLboolean boundaryEdge ) {} +/*ARGSUSED*/ static void GLAPIENTRY noVertex( void *data ) {} +/*ARGSUSED*/ static void GLAPIENTRY noEnd( void ) {} +/*ARGSUSED*/ static void GLAPIENTRY noError( GLenum errnum ) {} +/*ARGSUSED*/ static void GLAPIENTRY noCombine( GLdouble coords[3], void *data[4], + GLfloat weight[4], void **dataOut ) {} +/*ARGSUSED*/ static void GLAPIENTRY noMesh( GLUmesh *mesh ) {} + + +/*ARGSUSED*/ void GLAPIENTRY __gl_noBeginData( GLenum type, + void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge, + void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noVertexData( void *data, + void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noEndData( void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noErrorData( GLenum errnum, + void *polygonData ) {} +/*ARGSUSED*/ void GLAPIENTRY __gl_noCombineData( GLdouble coords[3], + void *data[4], + GLfloat weight[4], + void **outData, + void *polygonData ) {} + +/* Half-edges are allocated in pairs (see mesh.c) */ +typedef struct { GLUhalfEdge e, eSym; } EdgePair; + +#undef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#define MAX_FAST_ALLOC (MAX(sizeof(EdgePair), \ + MAX(sizeof(GLUvertex),sizeof(GLUface)))) + + +GLUtesselator * GLAPIENTRY +gluNewTess( void ) +{ + GLUtesselator *tess; + + /* Only initialize fields which can be changed by the api. Other fields + * are initialized where they are used. + */ + + if (memInit( MAX_FAST_ALLOC ) == 0) { + return 0; /* out of memory */ + } + tess = (GLUtesselator *)memAlloc( sizeof( GLUtesselator )); + if (tess == NULL) { + return 0; /* out of memory */ + } + + tess->state = T_DORMANT; + + tess->normal[0] = 0; + tess->normal[1] = 0; + tess->normal[2] = 0; + + tess->relTolerance = GLU_TESS_DEFAULT_TOLERANCE; + tess->windingRule = GLU_TESS_WINDING_ODD; + tess->flagBoundary = FALSE; + tess->boundaryOnly = FALSE; + + tess->callBegin = &noBegin; + tess->callEdgeFlag = &noEdgeFlag; + tess->callVertex = &noVertex; + tess->callEnd = &noEnd; + + tess->callError = &noError; + tess->callCombine = &noCombine; + tess->callMesh = &noMesh; + + tess->callBeginData= &__gl_noBeginData; + tess->callEdgeFlagData= &__gl_noEdgeFlagData; + tess->callVertexData= &__gl_noVertexData; + tess->callEndData= &__gl_noEndData; + tess->callErrorData= &__gl_noErrorData; + tess->callCombineData= &__gl_noCombineData; + + tess->polygonData= NULL; + + return tess; +} + +static void MakeDormant( GLUtesselator *tess ) +{ + /* Return the tessellator to its original dormant state. */ + + if( tess->mesh != NULL ) { + __gl_meshDeleteMesh( tess->mesh ); + } + tess->state = T_DORMANT; + tess->lastEdge = NULL; + tess->mesh = NULL; +} + +#define RequireState( tess, s ) if( tess->state != s ) GotoState(tess,s) + +static void GotoState( GLUtesselator *tess, enum TessState newState ) +{ + while( tess->state != newState ) { + /* We change the current state one level at a time, to get to + * the desired state. + */ + if( tess->state < newState ) { + switch( tess->state ) { + case T_DORMANT: + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_POLYGON ); + gluTessBeginPolygon( tess, NULL ); + break; + case T_IN_POLYGON: + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_BEGIN_CONTOUR ); + gluTessBeginContour( tess ); + break; + default: + ; + } + } else { + switch( tess->state ) { + case T_IN_CONTOUR: + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_CONTOUR ); + gluTessEndContour( tess ); + break; + case T_IN_POLYGON: + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_MISSING_END_POLYGON ); + /* gluTessEndPolygon( tess ) is too much work! */ + MakeDormant( tess ); + break; + default: + ; + } + } + } +} + + +void GLAPIENTRY +gluDeleteTess( GLUtesselator *tess ) +{ + RequireState( tess, T_DORMANT ); + memFree( tess ); +} + + +void GLAPIENTRY +gluTessProperty( GLUtesselator *tess, GLenum which, GLdouble value ) +{ + GLenum windingRule; + + switch( which ) { + case GLU_TESS_TOLERANCE: + if( value < 0.0 || value > 1.0 ) break; + tess->relTolerance = value; + return; + + case GLU_TESS_WINDING_RULE: + windingRule = (GLenum) value; + if( windingRule != value ) break; /* not an integer */ + + switch( windingRule ) { + case GLU_TESS_WINDING_ODD: + case GLU_TESS_WINDING_NONZERO: + case GLU_TESS_WINDING_POSITIVE: + case GLU_TESS_WINDING_NEGATIVE: + case GLU_TESS_WINDING_ABS_GEQ_TWO: + tess->windingRule = windingRule; + return; + default: + break; + } + + case GLU_TESS_BOUNDARY_ONLY: + tess->boundaryOnly = (value != 0); + return; + + default: + CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_ENUM ); + return; + } + CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_VALUE ); +} + +/* Returns tessellator property */ +void GLAPIENTRY +gluGetTessProperty( GLUtesselator *tess, GLenum which, GLdouble *value ) +{ + switch (which) { + case GLU_TESS_TOLERANCE: + /* tolerance should be in range [0..1] */ + assert(0.0 <= tess->relTolerance && tess->relTolerance <= 1.0); + *value= tess->relTolerance; + break; + case GLU_TESS_WINDING_RULE: + assert(tess->windingRule == GLU_TESS_WINDING_ODD || + tess->windingRule == GLU_TESS_WINDING_NONZERO || + tess->windingRule == GLU_TESS_WINDING_POSITIVE || + tess->windingRule == GLU_TESS_WINDING_NEGATIVE || + tess->windingRule == GLU_TESS_WINDING_ABS_GEQ_TWO); + *value= tess->windingRule; + break; + case GLU_TESS_BOUNDARY_ONLY: + assert(tess->boundaryOnly == TRUE || tess->boundaryOnly == FALSE); + *value= tess->boundaryOnly; + break; + default: + *value= 0.0; + CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_ENUM ); + break; + } +} /* gluGetTessProperty() */ + +void GLAPIENTRY +gluTessNormal( GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z ) +{ + tess->normal[0] = x; + tess->normal[1] = y; + tess->normal[2] = z; +} + +void GLAPIENTRY +gluTessCallback( GLUtesselator *tess, GLenum which, _GLUfuncptr fn) +{ + switch( which ) { + case GLU_TESS_BEGIN: + tess->callBegin = (fn == NULL) ? &noBegin : (void (GLAPIENTRY *)(GLenum)) fn; + return; + case GLU_TESS_BEGIN_DATA: + tess->callBeginData = (fn == NULL) ? + &__gl_noBeginData : (void (GLAPIENTRY *)(GLenum, void *)) fn; + return; + case GLU_TESS_EDGE_FLAG: + tess->callEdgeFlag = (fn == NULL) ? &noEdgeFlag : + (void (GLAPIENTRY *)(GLboolean)) fn; + /* If the client wants boundary edges to be flagged, + * we render everything as separate triangles (no strips or fans). + */ + tess->flagBoundary = (fn != NULL); + return; + case GLU_TESS_EDGE_FLAG_DATA: + tess->callEdgeFlagData= (fn == NULL) ? + &__gl_noEdgeFlagData : (void (GLAPIENTRY *)(GLboolean, void *)) fn; + /* If the client wants boundary edges to be flagged, + * we render everything as separate triangles (no strips or fans). + */ + tess->flagBoundary = (fn != NULL); + return; + case GLU_TESS_VERTEX: + tess->callVertex = (fn == NULL) ? &noVertex : + (void (GLAPIENTRY *)(void *)) fn; + return; + case GLU_TESS_VERTEX_DATA: + tess->callVertexData = (fn == NULL) ? + &__gl_noVertexData : (void (GLAPIENTRY *)(void *, void *)) fn; + return; + case GLU_TESS_END: + tess->callEnd = (fn == NULL) ? &noEnd : (void (GLAPIENTRY *)(void)) fn; + return; + case GLU_TESS_END_DATA: + tess->callEndData = (fn == NULL) ? &__gl_noEndData : + (void (GLAPIENTRY *)(void *)) fn; + return; + case GLU_TESS_ERROR: + tess->callError = (fn == NULL) ? &noError : (void (GLAPIENTRY *)(GLenum)) fn; + return; + case GLU_TESS_ERROR_DATA: + tess->callErrorData = (fn == NULL) ? + &__gl_noErrorData : (void (GLAPIENTRY *)(GLenum, void *)) fn; + return; + case GLU_TESS_COMBINE: + tess->callCombine = (fn == NULL) ? &noCombine : + (void (GLAPIENTRY *)(GLdouble [3],void *[4], GLfloat [4], void ** )) fn; + return; + case GLU_TESS_COMBINE_DATA: + tess->callCombineData = (fn == NULL) ? &__gl_noCombineData : + (void (GLAPIENTRY *)(GLdouble [3], + void *[4], + GLfloat [4], + void **, + void *)) fn; + return; + case GLU_TESS_MESH: + tess->callMesh = (fn == NULL) ? &noMesh : (void (GLAPIENTRY *)(GLUmesh *)) fn; + return; + default: + CALL_ERROR_OR_ERROR_DATA( GLU_INVALID_ENUM ); + return; + } +} + +static int AddVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) +{ + GLUhalfEdge *e; + + e = tess->lastEdge; + if( e == NULL ) { + /* Make a self-loop (one vertex, one edge). */ + + e = __gl_meshMakeEdge( tess->mesh ); + if (e == NULL) return 0; + if ( !__gl_meshSplice( e, e->Sym ) ) return 0; + } else { + /* Create a new vertex and edge which immediately follow e + * in the ordering around the left face. + */ + if (__gl_meshSplitEdge( e ) == NULL) return 0; + e = e->Lnext; + } + + /* The new vertex is now e->Org. */ + e->Org->data = data; + e->Org->coords[0] = coords[0]; + e->Org->coords[1] = coords[1]; + e->Org->coords[2] = coords[2]; + + /* The winding of an edge says how the winding number changes as we + * cross from the edge''s right face to its left face. We add the + * vertices in such an order that a CCW contour will add +1 to + * the winding number of the region inside the contour. + */ + e->winding = 1; + e->Sym->winding = -1; + + tess->lastEdge = e; + + return 1; +} + + +static void CacheVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) +{ + CachedVertex *v = &tess->cache[tess->cacheCount]; + + v->data = data; + v->coords[0] = coords[0]; + v->coords[1] = coords[1]; + v->coords[2] = coords[2]; + ++tess->cacheCount; +} + + +static int EmptyCache( GLUtesselator *tess ) +{ + CachedVertex *v = tess->cache; + CachedVertex *vLast; + + tess->mesh = __gl_meshNewMesh(); + if (tess->mesh == NULL) return 0; + + for( vLast = v + tess->cacheCount; v < vLast; ++v ) { + if ( !AddVertex( tess, v->coords, v->data ) ) return 0; + } + tess->cacheCount = 0; + tess->emptyCache = FALSE; + + return 1; +} + + +void GLAPIENTRY +gluTessVertex( GLUtesselator *tess, GLdouble coords[3], void *data ) +{ + int i, tooLarge = FALSE; + GLdouble x, clamped[3]; + + RequireState( tess, T_IN_CONTOUR ); + + if( tess->emptyCache ) { + if ( !EmptyCache( tess ) ) { + CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); + return; + } + tess->lastEdge = NULL; + } + for( i = 0; i < 3; ++i ) { + x = coords[i]; + if( x < - GLU_TESS_MAX_COORD ) { + x = - GLU_TESS_MAX_COORD; + tooLarge = TRUE; + } + if( x > GLU_TESS_MAX_COORD ) { + x = GLU_TESS_MAX_COORD; + tooLarge = TRUE; + } + clamped[i] = x; + } + if( tooLarge ) { + CALL_ERROR_OR_ERROR_DATA( GLU_TESS_COORD_TOO_LARGE ); + } + + if( tess->mesh == NULL ) { + if( tess->cacheCount < TESS_MAX_CACHE ) { + CacheVertex( tess, clamped, data ); + return; + } + if ( !EmptyCache( tess ) ) { + CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); + return; + } + } + if ( !AddVertex( tess, clamped, data ) ) { + CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); + } +} + + +void GLAPIENTRY +gluTessBeginPolygon( GLUtesselator *tess, void *data ) +{ + RequireState( tess, T_DORMANT ); + + tess->state = T_IN_POLYGON; + tess->cacheCount = 0; + tess->emptyCache = FALSE; + tess->mesh = NULL; + + tess->polygonData= data; +} + + +void GLAPIENTRY +gluTessBeginContour( GLUtesselator *tess ) +{ + RequireState( tess, T_IN_POLYGON ); + + tess->state = T_IN_CONTOUR; + tess->lastEdge = NULL; + if( tess->cacheCount > 0 ) { + /* Just set a flag so we don't get confused by empty contours + * -- these can be generated accidentally with the obsolete + * NextContour() interface. + */ + tess->emptyCache = TRUE; + } +} + + +void GLAPIENTRY +gluTessEndContour( GLUtesselator *tess ) +{ + RequireState( tess, T_IN_CONTOUR ); + tess->state = T_IN_POLYGON; +} + +void GLAPIENTRY +gluTessEndPolygon( GLUtesselator *tess ) +{ + GLUmesh *mesh; + + if (setjmp(tess->env) != 0) { + /* come back here if out of memory */ + CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); + return; + } + + RequireState( tess, T_IN_POLYGON ); + tess->state = T_DORMANT; + + if( tess->mesh == NULL ) { + if( ! tess->flagBoundary && tess->callMesh == &noMesh ) { + + /* Try some special code to make the easy cases go quickly + * (eg. convex polygons). This code does NOT handle multiple contours, + * intersections, edge flags, and of course it does not generate + * an explicit mesh either. + */ + if( __gl_renderCache( tess )) { + tess->polygonData= NULL; + return; + } + } + if ( !EmptyCache( tess ) ) longjmp(tess->env,1); /* could've used a label*/ + } + + /* Determine the polygon normal and project vertices onto the plane + * of the polygon. + */ + __gl_projectPolygon( tess ); + + /* __gl_computeInterior( tess ) computes the planar arrangement specified + * by the given contours, and further subdivides this arrangement + * into regions. Each region is marked "inside" if it belongs + * to the polygon, according to the rule given by tess->windingRule. + * Each interior region is guaranteed be monotone. + */ + if ( !__gl_computeInterior( tess ) ) { + longjmp(tess->env,1); /* could've used a label */ + } + + mesh = tess->mesh; + if( ! tess->fatalError ) { + int rc = 1; + + /* If the user wants only the boundary contours, we throw away all edges + * except those which separate the interior from the exterior. + * Otherwise we tessellate all the regions marked "inside". + */ + if( tess->boundaryOnly ) { + rc = __gl_meshSetWindingNumber( mesh, 1, TRUE ); + } else { + rc = __gl_meshTessellateInterior( mesh ); + } + if (rc == 0) longjmp(tess->env,1); /* could've used a label */ + + __gl_meshCheckMesh( mesh ); + + if( tess->callBegin != &noBegin || tess->callEnd != &noEnd + || tess->callVertex != &noVertex || tess->callEdgeFlag != &noEdgeFlag + || tess->callBeginData != &__gl_noBeginData + || tess->callEndData != &__gl_noEndData + || tess->callVertexData != &__gl_noVertexData + || tess->callEdgeFlagData != &__gl_noEdgeFlagData ) + { + if( tess->boundaryOnly ) { + __gl_renderBoundary( tess, mesh ); /* output boundary contours */ + } else { + __gl_renderMesh( tess, mesh ); /* output strips and fans */ + } + } + if( tess->callMesh != &noMesh ) { + + /* Throw away the exterior faces, so that all faces are interior. + * This way the user doesn't have to check the "inside" flag, + * and we don't need to even reveal its existence. It also leaves + * the freedom for an implementation to not generate the exterior + * faces in the first place. + */ + __gl_meshDiscardExterior( mesh ); + (*tess->callMesh)( mesh ); /* user wants the mesh itself */ + tess->mesh = NULL; + tess->polygonData= NULL; + return; + } + } + __gl_meshDeleteMesh( mesh ); + tess->polygonData= NULL; + tess->mesh = NULL; +} + + +/*XXXblythe unused function*/ +#if 0 +void GLAPIENTRY +gluDeleteMesh( GLUmesh *mesh ) +{ + __gl_meshDeleteMesh( mesh ); +} +#endif + + + +/*******************************************************/ + +/* Obsolete calls -- for backward compatibility */ + +void GLAPIENTRY +gluBeginPolygon( GLUtesselator *tess ) +{ + gluTessBeginPolygon( tess, NULL ); + gluTessBeginContour( tess ); +} + + +/*ARGSUSED*/ +void GLAPIENTRY +gluNextContour( GLUtesselator *tess, GLenum type ) +{ + gluTessEndContour( tess ); + gluTessBeginContour( tess ); +} + + +void GLAPIENTRY +gluEndPolygon( GLUtesselator *tess ) +{ + gluTessEndContour( tess ); + gluTessEndPolygon( tess ); +} diff --git a/mesalib/src/glu/sgi/libtess/tess.h b/mesalib/src/glu/sgi/libtess/tess.h new file mode 100644 index 000000000..162496088 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/tess.h @@ -0,0 +1,165 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __tess_h_ +#define __tess_h_ + +#include +#include +#include "mesh.h" +#include "dict.h" +#include "priorityq.h" + +/* The begin/end calls must be properly nested. We keep track of + * the current state to enforce the ordering. + */ +enum TessState { T_DORMANT, T_IN_POLYGON, T_IN_CONTOUR }; + +/* We cache vertex data for single-contour polygons so that we can + * try a quick-and-dirty decomposition first. + */ +#define TESS_MAX_CACHE 100 + +typedef struct CachedVertex { + GLdouble coords[3]; + void *data; +} CachedVertex; + +struct GLUtesselator { + + /*** state needed for collecting the input data ***/ + + enum TessState state; /* what begin/end calls have we seen? */ + + GLUhalfEdge *lastEdge; /* lastEdge->Org is the most recent vertex */ + GLUmesh *mesh; /* stores the input contours, and eventually + the tessellation itself */ + + void (GLAPIENTRY *callError)( GLenum errnum ); + + /*** state needed for projecting onto the sweep plane ***/ + + GLdouble normal[3]; /* user-specified normal (if provided) */ + GLdouble sUnit[3]; /* unit vector in s-direction (debugging) */ + GLdouble tUnit[3]; /* unit vector in t-direction (debugging) */ + + /*** state needed for the line sweep ***/ + + GLdouble relTolerance; /* tolerance for merging features */ + GLenum windingRule; /* rule for determining polygon interior */ + GLboolean fatalError; /* fatal error: needed combine callback */ + + Dict *dict; /* edge dictionary for sweep line */ + PriorityQ *pq; /* priority queue of vertex events */ + GLUvertex *event; /* current sweep event being processed */ + + void (GLAPIENTRY *callCombine)( GLdouble coords[3], void *data[4], + GLfloat weight[4], void **outData ); + + /*** state needed for rendering callbacks (see render.c) ***/ + + GLboolean flagBoundary; /* mark boundary edges (use EdgeFlag) */ + GLboolean boundaryOnly; /* Extract contours, not triangles */ + GLUface *lonelyTriList; + /* list of triangles which could not be rendered as strips or fans */ + + void (GLAPIENTRY *callBegin)( GLenum type ); + void (GLAPIENTRY *callEdgeFlag)( GLboolean boundaryEdge ); + void (GLAPIENTRY *callVertex)( void *data ); + void (GLAPIENTRY *callEnd)( void ); + void (GLAPIENTRY *callMesh)( GLUmesh *mesh ); + + + /*** state needed to cache single-contour polygons for renderCache() */ + + GLboolean emptyCache; /* empty cache on next vertex() call */ + int cacheCount; /* number of cached vertices */ + CachedVertex cache[TESS_MAX_CACHE]; /* the vertex data */ + + /*** rendering callbacks that also pass polygon data ***/ + void (GLAPIENTRY *callBeginData)( GLenum type, void *polygonData ); + void (GLAPIENTRY *callEdgeFlagData)( GLboolean boundaryEdge, + void *polygonData ); + void (GLAPIENTRY *callVertexData)( void *data, void *polygonData ); + void (GLAPIENTRY *callEndData)( void *polygonData ); + void (GLAPIENTRY *callErrorData)( GLenum errnum, void *polygonData ); + void (GLAPIENTRY *callCombineData)( GLdouble coords[3], void *data[4], + GLfloat weight[4], void **outData, + void *polygonData ); + + jmp_buf env; /* place to jump to when memAllocs fail */ + + void *polygonData; /* client data for current polygon */ +}; + +void GLAPIENTRY __gl_noBeginData( GLenum type, void *polygonData ); +void GLAPIENTRY __gl_noEdgeFlagData( GLboolean boundaryEdge, void *polygonData ); +void GLAPIENTRY __gl_noVertexData( void *data, void *polygonData ); +void GLAPIENTRY __gl_noEndData( void *polygonData ); +void GLAPIENTRY __gl_noErrorData( GLenum errnum, void *polygonData ); +void GLAPIENTRY __gl_noCombineData( GLdouble coords[3], void *data[4], + GLfloat weight[4], void **outData, + void *polygonData ); + +#define CALL_BEGIN_OR_BEGIN_DATA(a) \ + if (tess->callBeginData != &__gl_noBeginData) \ + (*tess->callBeginData)((a),tess->polygonData); \ + else (*tess->callBegin)((a)); + +#define CALL_VERTEX_OR_VERTEX_DATA(a) \ + if (tess->callVertexData != &__gl_noVertexData) \ + (*tess->callVertexData)((a),tess->polygonData); \ + else (*tess->callVertex)((a)); + +#define CALL_EDGE_FLAG_OR_EDGE_FLAG_DATA(a) \ + if (tess->callEdgeFlagData != &__gl_noEdgeFlagData) \ + (*tess->callEdgeFlagData)((a),tess->polygonData); \ + else (*tess->callEdgeFlag)((a)); + +#define CALL_END_OR_END_DATA() \ + if (tess->callEndData != &__gl_noEndData) \ + (*tess->callEndData)(tess->polygonData); \ + else (*tess->callEnd)(); + +#define CALL_COMBINE_OR_COMBINE_DATA(a,b,c,d) \ + if (tess->callCombineData != &__gl_noCombineData) \ + (*tess->callCombineData)((a),(b),(c),(d),tess->polygonData); \ + else (*tess->callCombine)((a),(b),(c),(d)); + +#define CALL_ERROR_OR_ERROR_DATA(a) \ + if (tess->callErrorData != &__gl_noErrorData) \ + (*tess->callErrorData)((a),tess->polygonData); \ + else (*tess->callError)((a)); + +#endif diff --git a/mesalib/src/glu/sgi/libtess/tessmono.c b/mesalib/src/glu/sgi/libtess/tessmono.c new file mode 100644 index 000000000..4d0844005 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/tessmono.c @@ -0,0 +1,201 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#include "gluos.h" +#include +#include "geom.h" +#include "mesh.h" +#include "tessmono.h" +#include + +#define AddWinding(eDst,eSrc) (eDst->winding += eSrc->winding, \ + eDst->Sym->winding += eSrc->Sym->winding) + +/* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region + * (what else would it do??) The region must consist of a single + * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this + * case means that any vertical line intersects the interior of the + * region in a single interval. + * + * Tessellation consists of adding interior edges (actually pairs of + * half-edges), to split the region into non-overlapping triangles. + * + * The basic idea is explained in Preparata and Shamos (which I don''t + * have handy right now), although their implementation is more + * complicated than this one. The are two edge chains, an upper chain + * and a lower chain. We process all vertices from both chains in order, + * from right to left. + * + * The algorithm ensures that the following invariant holds after each + * vertex is processed: the untessellated region consists of two + * chains, where one chain (say the upper) is a single edge, and + * the other chain is concave. The left vertex of the single edge + * is always to the left of all vertices in the concave chain. + * + * Each step consists of adding the rightmost unprocessed vertex to one + * of the two chains, and forming a fan of triangles from the rightmost + * of two chain endpoints. Determining whether we can add each triangle + * to the fan is a simple orientation test. By making the fan as large + * as possible, we restore the invariant (check it yourself). + */ +int __gl_meshTessellateMonoRegion( GLUface *face ) +{ + GLUhalfEdge *up, *lo; + + /* All edges are oriented CCW around the boundary of the region. + * First, find the half-edge whose origin vertex is rightmost. + * Since the sweep goes from left to right, face->anEdge should + * be close to the edge we want. + */ + up = face->anEdge; + assert( up->Lnext != up && up->Lnext->Lnext != up ); + + for( ; VertLeq( up->Dst, up->Org ); up = up->Lprev ) + ; + for( ; VertLeq( up->Org, up->Dst ); up = up->Lnext ) + ; + lo = up->Lprev; + + while( up->Lnext != lo ) { + if( VertLeq( up->Dst, lo->Org )) { + /* up->Dst is on the left. It is safe to form triangles from lo->Org. + * The EdgeGoesLeft test guarantees progress even when some triangles + * are CW, given that the upper and lower chains are truly monotone. + */ + while( lo->Lnext != up && (EdgeGoesLeft( lo->Lnext ) + || EdgeSign( lo->Org, lo->Dst, lo->Lnext->Dst ) <= 0 )) { + GLUhalfEdge *tempHalfEdge= __gl_meshConnect( lo->Lnext, lo ); + if (tempHalfEdge == NULL) return 0; + lo = tempHalfEdge->Sym; + } + lo = lo->Lprev; + } else { + /* lo->Org is on the left. We can make CCW triangles from up->Dst. */ + while( lo->Lnext != up && (EdgeGoesRight( up->Lprev ) + || EdgeSign( up->Dst, up->Org, up->Lprev->Org ) >= 0 )) { + GLUhalfEdge *tempHalfEdge= __gl_meshConnect( up, up->Lprev ); + if (tempHalfEdge == NULL) return 0; + up = tempHalfEdge->Sym; + } + up = up->Lnext; + } + } + + /* Now lo->Org == up->Dst == the leftmost vertex. The remaining region + * can be tessellated in a fan from this leftmost vertex. + */ + assert( lo->Lnext != up ); + while( lo->Lnext->Lnext != up ) { + GLUhalfEdge *tempHalfEdge= __gl_meshConnect( lo->Lnext, lo ); + if (tempHalfEdge == NULL) return 0; + lo = tempHalfEdge->Sym; + } + + return 1; +} + + +/* __gl_meshTessellateInterior( mesh ) tessellates each region of + * the mesh which is marked "inside" the polygon. Each such region + * must be monotone. + */ +int __gl_meshTessellateInterior( GLUmesh *mesh ) +{ + GLUface *f, *next; + + /*LINTED*/ + for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) { + /* Make sure we don''t try to tessellate the new triangles. */ + next = f->next; + if( f->inside ) { + if ( !__gl_meshTessellateMonoRegion( f ) ) return 0; + } + } + + return 1; +} + + +/* __gl_meshDiscardExterior( mesh ) zaps (ie. sets to NULL) all faces + * which are not marked "inside" the polygon. Since further mesh operations + * on NULL faces are not allowed, the main purpose is to clean up the + * mesh so that exterior loops are not represented in the data structure. + */ +void __gl_meshDiscardExterior( GLUmesh *mesh ) +{ + GLUface *f, *next; + + /*LINTED*/ + for( f = mesh->fHead.next; f != &mesh->fHead; f = next ) { + /* Since f will be destroyed, save its next pointer. */ + next = f->next; + if( ! f->inside ) { + __gl_meshZapFace( f ); + } + } +} + +#define MARKED_FOR_DELETION 0x7fffffff + +/* __gl_meshSetWindingNumber( mesh, value, keepOnlyBoundary ) resets the + * winding numbers on all edges so that regions marked "inside" the + * polygon have a winding number of "value", and regions outside + * have a winding number of 0. + * + * If keepOnlyBoundary is TRUE, it also deletes all edges which do not + * separate an interior region from an exterior one. + */ +int __gl_meshSetWindingNumber( GLUmesh *mesh, int value, + GLboolean keepOnlyBoundary ) +{ + GLUhalfEdge *e, *eNext; + + for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) { + eNext = e->next; + if( e->Rface->inside != e->Lface->inside ) { + + /* This is a boundary edge (one side is interior, one is exterior). */ + e->winding = (e->Lface->inside) ? value : -value; + } else { + + /* Both regions are interior, or both are exterior. */ + if( ! keepOnlyBoundary ) { + e->winding = 0; + } else { + if ( !__gl_meshDelete( e ) ) return 0; + } + } + } + return 1; +} diff --git a/mesalib/src/glu/sgi/libtess/tessmono.h b/mesalib/src/glu/sgi/libtess/tessmono.h new file mode 100644 index 000000000..8ee1b2fe3 --- /dev/null +++ b/mesalib/src/glu/sgi/libtess/tessmono.h @@ -0,0 +1,71 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ +/* +** Author: Eric Veach, July 1994. +** +*/ + +#ifndef __tessmono_h_ +#define __tessmono_h_ + +/* __gl_meshTessellateMonoRegion( face ) tessellates a monotone region + * (what else would it do??) The region must consist of a single + * loop of half-edges (see mesh.h) oriented CCW. "Monotone" in this + * case means that any vertical line intersects the interior of the + * region in a single interval. + * + * Tessellation consists of adding interior edges (actually pairs of + * half-edges), to split the region into non-overlapping triangles. + * + * __gl_meshTessellateInterior( mesh ) tessellates each region of + * the mesh which is marked "inside" the polygon. Each such region + * must be monotone. + * + * __gl_meshDiscardExterior( mesh ) zaps (ie. sets to NULL) all faces + * which are not marked "inside" the polygon. Since further mesh operations + * on NULL faces are not allowed, the main purpose is to clean up the + * mesh so that exterior loops are not represented in the data structure. + * + * __gl_meshSetWindingNumber( mesh, value, keepOnlyBoundary ) resets the + * winding numbers on all edges so that regions marked "inside" the + * polygon have a winding number of "value", and regions outside + * have a winding number of 0. + * + * If keepOnlyBoundary is TRUE, it also deletes all edges which do not + * separate an interior region from an exterior one. + */ + +int __gl_meshTessellateMonoRegion( GLUface *face ); +int __gl_meshTessellateInterior( GLUmesh *mesh ); +void __gl_meshDiscardExterior( GLUmesh *mesh ); +int __gl_meshSetWindingNumber( GLUmesh *mesh, int value, + GLboolean keepOnlyBoundary ); + +#endif diff --git a/mesalib/src/glu/sgi/libutil/error.c b/mesalib/src/glu/sgi/libutil/error.c new file mode 100644 index 000000000..e734818ed --- /dev/null +++ b/mesalib/src/glu/sgi/libutil/error.c @@ -0,0 +1,83 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#include "gluos.h" +#include "gluint.h" +#include +#include +#include + + +struct token_string +{ + GLuint Token; + const char *String; +}; + +static const struct token_string Errors[] = { + { GL_NO_ERROR, "no error" }, + { GL_INVALID_ENUM, "invalid enumerant" }, + { GL_INVALID_VALUE, "invalid value" }, + { GL_INVALID_OPERATION, "invalid operation" }, + { GL_STACK_OVERFLOW, "stack overflow" }, + { GL_STACK_UNDERFLOW, "stack underflow" }, + { GL_OUT_OF_MEMORY, "out of memory" }, + { GL_TABLE_TOO_LARGE, "table too large" }, +#ifdef GL_EXT_framebuffer_object + { GL_INVALID_FRAMEBUFFER_OPERATION_EXT, "invalid framebuffer operation" }, +#endif + /* GLU */ + { GLU_INVALID_ENUM, "invalid enumerant" }, + { GLU_INVALID_VALUE, "invalid value" }, + { GLU_OUT_OF_MEMORY, "out of memory" }, + { GLU_INCOMPATIBLE_GL_VERSION, "incompatible gl version" }, + { GLU_INVALID_OPERATION, "invalid operation" }, + { ~0, NULL } /* end of list indicator */ +}; + + + +const GLubyte* GLAPIENTRY +gluErrorString(GLenum errorCode) +{ + int i; + for (i = 0; Errors[i].String; i++) { + if (Errors[i].Token == errorCode) + return (const GLubyte *) Errors[i].String; + } + if ((errorCode >= GLU_NURBS_ERROR1) && (errorCode <= GLU_NURBS_ERROR37)) { + return (const GLubyte *) __gluNURBSErrorString(errorCode - (GLU_NURBS_ERROR1 - 1)); + } + if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR6)) { + return (const GLubyte *) __gluTessErrorString(errorCode - (GLU_TESS_ERROR1 - 1)); + } + return (const GLubyte *) 0; +} + diff --git a/mesalib/src/glu/sgi/libutil/glue.c b/mesalib/src/glu/sgi/libutil/glue.c new file mode 100644 index 000000000..cd65d65ad --- /dev/null +++ b/mesalib/src/glu/sgi/libutil/glue.c @@ -0,0 +1,93 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#include +#include "gluint.h" + +static unsigned char *__gluNurbsErrors[] = { + (unsigned char*) " ", + (unsigned char*) "spline order un-supported", + (unsigned char*) "too few knots", + (unsigned char*) "valid knot range is empty", + (unsigned char*) "decreasing knot sequence knot", + (unsigned char*) "knot multiplicity greater than order of spline", + (unsigned char*) "gluEndCurve() must follow gluBeginCurve()", + (unsigned char*) "gluBeginCurve() must precede gluEndCurve()", + (unsigned char*) "missing or extra geometric data", + (unsigned char*) "can't draw piecewise linear trimming curves", + (unsigned char*) "missing or extra domain data", + (unsigned char*) "missing or extra domain data", + (unsigned char*) "gluEndTrim() must precede gluEndSurface()", + (unsigned char*) "gluBeginSurface() must precede gluEndSurface()", + (unsigned char*) "curve of improper type passed as trim curve", + (unsigned char*) "gluBeginSurface() must precede gluBeginTrim()", + (unsigned char*) "gluEndTrim() must follow gluBeginTrim()", + (unsigned char*) "gluBeginTrim() must precede gluEndTrim()", + (unsigned char*) "invalid or missing trim curve", + (unsigned char*) "gluBeginTrim() must precede gluPwlCurve()", + (unsigned char*) "piecewise linear trimming curve referenced twice", + (unsigned char*) "piecewise linear trimming curve and nurbs curve mixed", + (unsigned char*) "improper usage of trim data type", + (unsigned char*) "nurbs curve referenced twice", + (unsigned char*) "nurbs curve and piecewise linear trimming curve mixed", + (unsigned char*) "nurbs surface referenced twice", + (unsigned char*) "invalid property", + (unsigned char*) "gluEndSurface() must follow gluBeginSurface()", + (unsigned char*) "intersecting or misoriented trim curves", + (unsigned char*) "intersecting trim curves", + (unsigned char*) "UNUSED", + (unsigned char*) "unconnected trim curves", + (unsigned char*) "unknown knot error", + (unsigned char*) "negative vertex count encountered", + (unsigned char*) "negative byte-stride encounteed", + (unsigned char*) "unknown type descriptor", + (unsigned char*) "null control point reference", + (unsigned char*) "duplicate point on piecewise linear trimming curve", +}; + +const unsigned char *__gluNURBSErrorString( int errnum ) +{ + return __gluNurbsErrors[errnum]; +} + +static unsigned char *__gluTessErrors[] = { + (unsigned char*) " ", + (unsigned char*) "gluTessBeginPolygon() must precede a gluTessEndPolygon()", + (unsigned char*) "gluTessBeginContour() must precede a gluTessEndContour()", + (unsigned char*) "gluTessEndPolygon() must follow a gluTessBeginPolygon()", + (unsigned char*) "gluTessEndContour() must follow a gluTessBeginContour()", + (unsigned char*) "a coordinate is too large", + (unsigned char*) "need combine callback", +}; + +const unsigned char *__gluTessErrorString( int errnum ) +{ + return __gluTessErrors[errnum]; +} /* __glTessErrorString() */ diff --git a/mesalib/src/glu/sgi/libutil/gluint.h b/mesalib/src/glu/sgi/libutil/gluint.h new file mode 100644 index 000000000..fd513caa6 --- /dev/null +++ b/mesalib/src/glu/sgi/libutil/gluint.h @@ -0,0 +1,48 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#ifndef __gluint_h__ +#define __gluint_h__ + +extern const unsigned char *__gluNURBSErrorString( int errnum ); + +extern const unsigned char *__gluTessErrorString( int errnum ); + +#ifdef _EXTENSIONS_ +#define COS cosf +#define SIN sinf +#define SQRT sqrtf +#else +#define COS cos +#define SIN sin +#define SQRT sqrt +#endif + +#endif /* __gluint_h__ */ diff --git a/mesalib/src/glu/sgi/libutil/mipmap.c b/mesalib/src/glu/sgi/libutil/mipmap.c new file mode 100644 index 000000000..af647af73 --- /dev/null +++ b/mesalib/src/glu/sgi/libutil/mipmap.c @@ -0,0 +1,8931 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#include "gluos.h" +#include +#include +#include +#include +#include +#include /* UINT_MAX */ +#include +#include "gluint.h" + +typedef union { + unsigned char ub[4]; + unsigned short us[2]; + unsigned int ui; + char b[4]; + short s[2]; + int i; + float f; +} Type_Widget; + +/* Pixel storage modes */ +typedef struct { + GLint pack_alignment; + GLint pack_row_length; + GLint pack_skip_rows; + GLint pack_skip_pixels; + GLint pack_lsb_first; + GLint pack_swap_bytes; + GLint pack_skip_images; + GLint pack_image_height; + + GLint unpack_alignment; + GLint unpack_row_length; + GLint unpack_skip_rows; + GLint unpack_skip_pixels; + GLint unpack_lsb_first; + GLint unpack_swap_bytes; + GLint unpack_skip_images; + GLint unpack_image_height; +} PixelStorageModes; + +static int gluBuild1DMipmapLevelsCore(GLenum, GLint, + GLsizei, + GLsizei, + GLenum, GLenum, GLint, GLint, GLint, + const void *); +static int gluBuild2DMipmapLevelsCore(GLenum, GLint, + GLsizei, GLsizei, + GLsizei, GLsizei, + GLenum, GLenum, GLint, GLint, GLint, + const void *); +static int gluBuild3DMipmapLevelsCore(GLenum, GLint, + GLsizei, GLsizei, GLsizei, + GLsizei, GLsizei, GLsizei, + GLenum, GLenum, GLint, GLint, GLint, + const void *); + +/* + * internal function declarations + */ +static GLfloat bytes_per_element(GLenum type); +static GLint elements_per_group(GLenum format, GLenum type); +static GLint is_index(GLenum format); +static GLint image_size(GLint width, GLint height, GLenum format, GLenum type); +static void fill_image(const PixelStorageModes *, + GLint width, GLint height, GLenum format, + GLenum type, GLboolean index_format, + const void *userdata, GLushort *newimage); +static void empty_image(const PixelStorageModes *, + GLint width, GLint height, GLenum format, + GLenum type, GLboolean index_format, + const GLushort *oldimage, void *userdata); +static void scale_internal(GLint components, GLint widthin, GLint heightin, + const GLushort *datain, + GLint widthout, GLint heightout, + GLushort *dataout); + +static void scale_internal_ubyte(GLint components, GLint widthin, + GLint heightin, const GLubyte *datain, + GLint widthout, GLint heightout, + GLubyte *dataout, GLint element_size, + GLint ysize, GLint group_size); +static void scale_internal_byte(GLint components, GLint widthin, + GLint heightin, const GLbyte *datain, + GLint widthout, GLint heightout, + GLbyte *dataout, GLint element_size, + GLint ysize, GLint group_size); +static void scale_internal_ushort(GLint components, GLint widthin, + GLint heightin, const GLushort *datain, + GLint widthout, GLint heightout, + GLushort *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); +static void scale_internal_short(GLint components, GLint widthin, + GLint heightin, const GLshort *datain, + GLint widthout, GLint heightout, + GLshort *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); +static void scale_internal_uint(GLint components, GLint widthin, + GLint heightin, const GLuint *datain, + GLint widthout, GLint heightout, + GLuint *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); +static void scale_internal_int(GLint components, GLint widthin, + GLint heightin, const GLint *datain, + GLint widthout, GLint heightout, + GLint *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); +static void scale_internal_float(GLint components, GLint widthin, + GLint heightin, const GLfloat *datain, + GLint widthout, GLint heightout, + GLfloat *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes); + +static int checkMipmapArgs(GLenum, GLenum, GLenum); +static GLboolean legalFormat(GLenum); +static GLboolean legalType(GLenum); +static GLboolean isTypePackedPixel(GLenum); +static GLboolean isLegalFormatForPackedPixelType(GLenum, GLenum); +static GLboolean isLegalLevels(GLint, GLint, GLint, GLint); +static void closestFit(GLenum, GLint, GLint, GLint, GLenum, GLenum, + GLint *, GLint *); + +/* all extract/shove routines must return double to handle unsigned ints */ +static GLdouble extractUbyte(int, const void *); +static void shoveUbyte(GLdouble, int, void *); +static GLdouble extractSbyte(int, const void *); +static void shoveSbyte(GLdouble, int, void *); +static GLdouble extractUshort(int, const void *); +static void shoveUshort(GLdouble, int, void *); +static GLdouble extractSshort(int, const void *); +static void shoveSshort(GLdouble, int, void *); +static GLdouble extractUint(int, const void *); +static void shoveUint(GLdouble, int, void *); +static GLdouble extractSint(int, const void *); +static void shoveSint(GLdouble, int, void *); +static GLdouble extractFloat(int, const void *); +static void shoveFloat(GLdouble, int, void *); +static void halveImageSlice(int, GLdouble (*)(int, const void *), + void (*)(GLdouble, int, void *), + GLint, GLint, GLint, + const void *, void *, + GLint, GLint, GLint, GLint, GLint); +static void halveImage3D(int, GLdouble (*)(int, const void *), + void (*)(GLdouble, int, void *), + GLint, GLint, GLint, + const void *, void *, + GLint, GLint, GLint, GLint, GLint); + +/* packedpixel type scale routines */ +static void extract332(int,const void *, GLfloat []); +static void shove332(const GLfloat [],int ,void *); +static void extract233rev(int,const void *, GLfloat []); +static void shove233rev(const GLfloat [],int ,void *); +static void extract565(int,const void *, GLfloat []); +static void shove565(const GLfloat [],int ,void *); +static void extract565rev(int,const void *, GLfloat []); +static void shove565rev(const GLfloat [],int ,void *); +static void extract4444(int,const void *, GLfloat []); +static void shove4444(const GLfloat [],int ,void *); +static void extract4444rev(int,const void *, GLfloat []); +static void shove4444rev(const GLfloat [],int ,void *); +static void extract5551(int,const void *, GLfloat []); +static void shove5551(const GLfloat [],int ,void *); +static void extract1555rev(int,const void *, GLfloat []); +static void shove1555rev(const GLfloat [],int ,void *); +static void extract8888(int,const void *, GLfloat []); +static void shove8888(const GLfloat [],int ,void *); +static void extract8888rev(int,const void *, GLfloat []); +static void shove8888rev(const GLfloat [],int ,void *); +static void extract1010102(int,const void *, GLfloat []); +static void shove1010102(const GLfloat [],int ,void *); +static void extract2101010rev(int,const void *, GLfloat []); +static void shove2101010rev(const GLfloat [],int ,void *); +static void scaleInternalPackedPixel(int, + void (*)(int, const void *,GLfloat []), + void (*)(const GLfloat [],int, void *), + GLint,GLint, const void *, + GLint,GLint,void *,GLint,GLint,GLint); +static void halveImagePackedPixel(int, + void (*)(int, const void *,GLfloat []), + void (*)(const GLfloat [],int, void *), + GLint, GLint, const void *, + void *, GLint, GLint, GLint); +static void halve1DimagePackedPixel(int, + void (*)(int, const void *,GLfloat []), + void (*)(const GLfloat [],int, void *), + GLint, GLint, const void *, + void *, GLint, GLint, GLint); + +static void halve1Dimage_ubyte(GLint, GLuint, GLuint,const GLubyte *, + GLubyte *, GLint, GLint, GLint); +static void halve1Dimage_byte(GLint, GLuint, GLuint,const GLbyte *, GLbyte *, + GLint, GLint, GLint); +static void halve1Dimage_ushort(GLint, GLuint, GLuint, const GLushort *, + GLushort *, GLint, GLint, GLint, GLint); +static void halve1Dimage_short(GLint, GLuint, GLuint,const GLshort *, GLshort *, + GLint, GLint, GLint, GLint); +static void halve1Dimage_uint(GLint, GLuint, GLuint, const GLuint *, GLuint *, + GLint, GLint, GLint, GLint); +static void halve1Dimage_int(GLint, GLuint, GLuint, const GLint *, GLint *, + GLint, GLint, GLint, GLint); +static void halve1Dimage_float(GLint, GLuint, GLuint, const GLfloat *, GLfloat *, + GLint, GLint, GLint, GLint); + +static GLint imageSize3D(GLint, GLint, GLint, GLenum,GLenum); +static void fillImage3D(const PixelStorageModes *, GLint, GLint, GLint,GLenum, + GLenum, GLboolean, const void *, GLushort *); +static void emptyImage3D(const PixelStorageModes *, + GLint, GLint, GLint, GLenum, + GLenum, GLboolean, + const GLushort *, void *); +static void scaleInternal3D(GLint, GLint, GLint, GLint, const GLushort *, + GLint, GLint, GLint, GLushort *); + +static void retrieveStoreModes(PixelStorageModes *psm) +{ + glGetIntegerv(GL_UNPACK_ALIGNMENT, &psm->unpack_alignment); + glGetIntegerv(GL_UNPACK_ROW_LENGTH, &psm->unpack_row_length); + glGetIntegerv(GL_UNPACK_SKIP_ROWS, &psm->unpack_skip_rows); + glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &psm->unpack_skip_pixels); + glGetIntegerv(GL_UNPACK_LSB_FIRST, &psm->unpack_lsb_first); + glGetIntegerv(GL_UNPACK_SWAP_BYTES, &psm->unpack_swap_bytes); + + glGetIntegerv(GL_PACK_ALIGNMENT, &psm->pack_alignment); + glGetIntegerv(GL_PACK_ROW_LENGTH, &psm->pack_row_length); + glGetIntegerv(GL_PACK_SKIP_ROWS, &psm->pack_skip_rows); + glGetIntegerv(GL_PACK_SKIP_PIXELS, &psm->pack_skip_pixels); + glGetIntegerv(GL_PACK_LSB_FIRST, &psm->pack_lsb_first); + glGetIntegerv(GL_PACK_SWAP_BYTES, &psm->pack_swap_bytes); +} + +static void retrieveStoreModes3D(PixelStorageModes *psm) +{ + glGetIntegerv(GL_UNPACK_ALIGNMENT, &psm->unpack_alignment); + glGetIntegerv(GL_UNPACK_ROW_LENGTH, &psm->unpack_row_length); + glGetIntegerv(GL_UNPACK_SKIP_ROWS, &psm->unpack_skip_rows); + glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &psm->unpack_skip_pixels); + glGetIntegerv(GL_UNPACK_LSB_FIRST, &psm->unpack_lsb_first); + glGetIntegerv(GL_UNPACK_SWAP_BYTES, &psm->unpack_swap_bytes); + glGetIntegerv(GL_UNPACK_SKIP_IMAGES, &psm->unpack_skip_images); + glGetIntegerv(GL_UNPACK_IMAGE_HEIGHT, &psm->unpack_image_height); + + glGetIntegerv(GL_PACK_ALIGNMENT, &psm->pack_alignment); + glGetIntegerv(GL_PACK_ROW_LENGTH, &psm->pack_row_length); + glGetIntegerv(GL_PACK_SKIP_ROWS, &psm->pack_skip_rows); + glGetIntegerv(GL_PACK_SKIP_PIXELS, &psm->pack_skip_pixels); + glGetIntegerv(GL_PACK_LSB_FIRST, &psm->pack_lsb_first); + glGetIntegerv(GL_PACK_SWAP_BYTES, &psm->pack_swap_bytes); + glGetIntegerv(GL_PACK_SKIP_IMAGES, &psm->pack_skip_images); + glGetIntegerv(GL_PACK_IMAGE_HEIGHT, &psm->pack_image_height); +} + +static int computeLog(GLuint value) +{ + int i; + + i = 0; + + /* Error! */ + if (value == 0) return -1; + + for (;;) { + if (value & 1) { + /* Error ! */ + if (value != 1) return -1; + return i; + } + value = value >> 1; + i++; + } +} + +/* +** Compute the nearest power of 2 number. This algorithm is a little +** strange, but it works quite well. +*/ +static int nearestPower(GLuint value) +{ + int i; + + i = 1; + + /* Error! */ + if (value == 0) return -1; + + for (;;) { + if (value == 1) { + return i; + } else if (value == 3) { + return i*4; + } + value = value >> 1; + i *= 2; + } +} + +#define __GLU_SWAP_2_BYTES(s)\ +(GLushort)(((GLushort)((const GLubyte*)(s))[1])<<8 | ((const GLubyte*)(s))[0]) + +#define __GLU_SWAP_4_BYTES(s)\ +(GLuint)(((GLuint)((const GLubyte*)(s))[3])<<24 | \ + ((GLuint)((const GLubyte*)(s))[2])<<16 | \ + ((GLuint)((const GLubyte*)(s))[1])<<8 | ((const GLubyte*)(s))[0]) + +static void halveImage(GLint components, GLuint width, GLuint height, + const GLushort *datain, GLushort *dataout) +{ + int i, j, k; + int newwidth, newheight; + int delta; + GLushort *s; + const GLushort *t; + + newwidth = width / 2; + newheight = height / 2; + delta = width * components; + s = dataout; + t = datain; + + /* Piece o' cake! */ + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + s[0] = (t[0] + t[components] + t[delta] + + t[delta+components] + 2) / 4; + s++; t++; + } + t += components; + } + t += delta; + } +} + +static void halveImage_ubyte(GLint components, GLuint width, GLuint height, + const GLubyte *datain, GLubyte *dataout, + GLint element_size, GLint ysize, GLint group_size) +{ + int i, j, k; + int newwidth, newheight; + int padBytes; + GLubyte *s; + const char *t; + + /* handle case where there is only 1 column/row */ + if (width == 1 || height == 1) { + assert( !(width == 1 && height == 1) ); /* can't be 1x1 */ + halve1Dimage_ubyte(components,width,height,datain,dataout, + element_size,ysize,group_size); + return; + } + + newwidth = width / 2; + newheight = height / 2; + padBytes = ysize - (width*group_size); + s = dataout; + t = (const char *)datain; + + /* Piece o' cake! */ + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + s[0] = (*(const GLubyte*)t + + *(const GLubyte*)(t+group_size) + + *(const GLubyte*)(t+ysize) + + *(const GLubyte*)(t+ysize+group_size) + 2) / 4; + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } +} + +/* */ +static void halve1Dimage_ubyte(GLint components, GLuint width, GLuint height, + const GLubyte *dataIn, GLubyte *dataOut, + GLint element_size, GLint ysize, + GLint group_size) +{ + GLint halfWidth= width / 2; + GLint halfHeight= height / 2; + const char *src= (const char *) dataIn; + GLubyte *dest= dataOut; + int jj; + + assert(width == 1 || height == 1); /* must be 1D */ + assert(width != height); /* can't be square */ + + if (height == 1) { /* 1 row */ + assert(width != 1); /* widthxheight can't be 1x1 */ + halfHeight= 1; + + for (jj= 0; jj< halfWidth; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { + *dest= (*(const GLubyte*)src + + *(const GLubyte*)(src+group_size)) / 2; + + src+= element_size; + dest++; + } + src+= group_size; /* skip to next 2 */ + } + { + int padBytes= ysize - (width*group_size); + src+= padBytes; /* for assertion only */ + } + } + else if (width == 1) { /* 1 column */ + int padBytes= ysize - (width * group_size); + assert(height != 1); /* widthxheight can't be 1x1 */ + halfWidth= 1; + /* one vertical column with possible pad bytes per row */ + /* average two at a time */ + + for (jj= 0; jj< halfHeight; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { + *dest= (*(const GLubyte*)src + *(const GLubyte*)(src+ysize)) / 2; + + src+= element_size; + dest++; + } + src+= padBytes; /* add pad bytes, if any, to get to end to row */ + src+= ysize; + } + } + + assert(src == &((const char *)dataIn)[ysize*height]); + assert((char *)dest == &((char *)dataOut) + [components * element_size * halfWidth * halfHeight]); +} /* halve1Dimage_ubyte() */ + +static void halveImage_byte(GLint components, GLuint width, GLuint height, + const GLbyte *datain, GLbyte *dataout, + GLint element_size, + GLint ysize, GLint group_size) +{ + int i, j, k; + int newwidth, newheight; + int padBytes; + GLbyte *s; + const char *t; + + /* handle case where there is only 1 column/row */ + if (width == 1 || height == 1) { + assert( !(width == 1 && height == 1) ); /* can't be 1x1 */ + halve1Dimage_byte(components,width,height,datain,dataout, + element_size,ysize,group_size); + return; + } + + newwidth = width / 2; + newheight = height / 2; + padBytes = ysize - (width*group_size); + s = dataout; + t = (const char *)datain; + + /* Piece o' cake! */ + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + s[0] = (*(const GLbyte*)t + + *(const GLbyte*)(t+group_size) + + *(const GLbyte*)(t+ysize) + + *(const GLbyte*)(t+ysize+group_size) + 2) / 4; + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } +} + +static void halve1Dimage_byte(GLint components, GLuint width, GLuint height, + const GLbyte *dataIn, GLbyte *dataOut, + GLint element_size,GLint ysize, GLint group_size) +{ + GLint halfWidth= width / 2; + GLint halfHeight= height / 2; + const char *src= (const char *) dataIn; + GLbyte *dest= dataOut; + int jj; + + assert(width == 1 || height == 1); /* must be 1D */ + assert(width != height); /* can't be square */ + + if (height == 1) { /* 1 row */ + assert(width != 1); /* widthxheight can't be 1x1 */ + halfHeight= 1; + + for (jj= 0; jj< halfWidth; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { + *dest= (*(const GLbyte*)src + *(const GLbyte*)(src+group_size)) / 2; + + src+= element_size; + dest++; + } + src+= group_size; /* skip to next 2 */ + } + { + int padBytes= ysize - (width*group_size); + src+= padBytes; /* for assertion only */ + } + } + else if (width == 1) { /* 1 column */ + int padBytes= ysize - (width * group_size); + assert(height != 1); /* widthxheight can't be 1x1 */ + halfWidth= 1; + /* one vertical column with possible pad bytes per row */ + /* average two at a time */ + + for (jj= 0; jj< halfHeight; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { + *dest= (*(const GLbyte*)src + *(const GLbyte*)(src+ysize)) / 2; + + src+= element_size; + dest++; + } + src+= padBytes; /* add pad bytes, if any, to get to end to row */ + src+= ysize; + } + + assert(src == &((const char *)dataIn)[ysize*height]); + } + + assert((char *)dest == &((char *)dataOut) + [components * element_size * halfWidth * halfHeight]); +} /* halve1Dimage_byte() */ + +static void halveImage_ushort(GLint components, GLuint width, GLuint height, + const GLushort *datain, GLushort *dataout, + GLint element_size, GLint ysize, GLint group_size, + GLint myswap_bytes) +{ + int i, j, k; + int newwidth, newheight; + int padBytes; + GLushort *s; + const char *t; + + /* handle case where there is only 1 column/row */ + if (width == 1 || height == 1) { + assert( !(width == 1 && height == 1) ); /* can't be 1x1 */ + halve1Dimage_ushort(components,width,height,datain,dataout, + element_size,ysize,group_size, myswap_bytes); + return; + } + + newwidth = width / 2; + newheight = height / 2; + padBytes = ysize - (width*group_size); + s = dataout; + t = (const char *)datain; + + /* Piece o' cake! */ + if (!myswap_bytes) + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + s[0] = (*(const GLushort*)t + + *(const GLushort*)(t+group_size) + + *(const GLushort*)(t+ysize) + + *(const GLushort*)(t+ysize+group_size) + 2) / 4; + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } + else + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + s[0] = (__GLU_SWAP_2_BYTES(t) + + __GLU_SWAP_2_BYTES(t+group_size) + + __GLU_SWAP_2_BYTES(t+ysize) + + __GLU_SWAP_2_BYTES(t+ysize+group_size)+ 2)/4; + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } +} + +static void halve1Dimage_ushort(GLint components, GLuint width, GLuint height, + const GLushort *dataIn, GLushort *dataOut, + GLint element_size, GLint ysize, + GLint group_size, GLint myswap_bytes) +{ + GLint halfWidth= width / 2; + GLint halfHeight= height / 2; + const char *src= (const char *) dataIn; + GLushort *dest= dataOut; + int jj; + + assert(width == 1 || height == 1); /* must be 1D */ + assert(width != height); /* can't be square */ + + if (height == 1) { /* 1 row */ + assert(width != 1); /* widthxheight can't be 1x1 */ + halfHeight= 1; + + for (jj= 0; jj< halfWidth; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLushort ushort[BOX2]; + if (myswap_bytes) { + ushort[0]= __GLU_SWAP_2_BYTES(src); + ushort[1]= __GLU_SWAP_2_BYTES(src+group_size); + } + else { + ushort[0]= *(const GLushort*)src; + ushort[1]= *(const GLushort*)(src+group_size); + } + + *dest= (ushort[0] + ushort[1]) / 2; + src+= element_size; + dest++; + } + src+= group_size; /* skip to next 2 */ + } + { + int padBytes= ysize - (width*group_size); + src+= padBytes; /* for assertion only */ + } + } + else if (width == 1) { /* 1 column */ + int padBytes= ysize - (width * group_size); + assert(height != 1); /* widthxheight can't be 1x1 */ + halfWidth= 1; + /* one vertical column with possible pad bytes per row */ + /* average two at a time */ + + for (jj= 0; jj< halfHeight; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLushort ushort[BOX2]; + if (myswap_bytes) { + ushort[0]= __GLU_SWAP_2_BYTES(src); + ushort[1]= __GLU_SWAP_2_BYTES(src+ysize); + } + else { + ushort[0]= *(const GLushort*)src; + ushort[1]= *(const GLushort*)(src+ysize); + } + *dest= (ushort[0] + ushort[1]) / 2; + + src+= element_size; + dest++; + } + src+= padBytes; /* add pad bytes, if any, to get to end to row */ + src+= ysize; + } + + assert(src == &((const char *)dataIn)[ysize*height]); + } + + assert((char *)dest == &((char *)dataOut) + [components * element_size * halfWidth * halfHeight]); + +} /* halve1Dimage_ushort() */ + + +static void halveImage_short(GLint components, GLuint width, GLuint height, + const GLshort *datain, GLshort *dataout, + GLint element_size, GLint ysize, GLint group_size, + GLint myswap_bytes) +{ + int i, j, k; + int newwidth, newheight; + int padBytes; + GLshort *s; + const char *t; + + /* handle case where there is only 1 column/row */ + if (width == 1 || height == 1) { + assert( !(width == 1 && height == 1) ); /* can't be 1x1 */ + halve1Dimage_short(components,width,height,datain,dataout, + element_size,ysize,group_size, myswap_bytes); + return; + } + + newwidth = width / 2; + newheight = height / 2; + padBytes = ysize - (width*group_size); + s = dataout; + t = (const char *)datain; + + /* Piece o' cake! */ + if (!myswap_bytes) + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + s[0] = (*(const GLshort*)t + + *(const GLshort*)(t+group_size) + + *(const GLshort*)(t+ysize) + + *(const GLshort*)(t+ysize+group_size) + 2) / 4; + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } + else + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + GLushort b; + GLint buf; + b = __GLU_SWAP_2_BYTES(t); + buf = *(const GLshort*)&b; + b = __GLU_SWAP_2_BYTES(t+group_size); + buf += *(const GLshort*)&b; + b = __GLU_SWAP_2_BYTES(t+ysize); + buf += *(const GLshort*)&b; + b = __GLU_SWAP_2_BYTES(t+ysize+group_size); + buf += *(const GLshort*)&b; + s[0] = (GLshort)((buf+2)/4); + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } +} + +static void halve1Dimage_short(GLint components, GLuint width, GLuint height, + const GLshort *dataIn, GLshort *dataOut, + GLint element_size, GLint ysize, + GLint group_size, GLint myswap_bytes) +{ + GLint halfWidth= width / 2; + GLint halfHeight= height / 2; + const char *src= (const char *) dataIn; + GLshort *dest= dataOut; + int jj; + + assert(width == 1 || height == 1); /* must be 1D */ + assert(width != height); /* can't be square */ + + if (height == 1) { /* 1 row */ + assert(width != 1); /* widthxheight can't be 1x1 */ + halfHeight= 1; + + for (jj= 0; jj< halfWidth; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLshort sshort[BOX2]; + if (myswap_bytes) { + sshort[0]= __GLU_SWAP_2_BYTES(src); + sshort[1]= __GLU_SWAP_2_BYTES(src+group_size); + } + else { + sshort[0]= *(const GLshort*)src; + sshort[1]= *(const GLshort*)(src+group_size); + } + + *dest= (sshort[0] + sshort[1]) / 2; + src+= element_size; + dest++; + } + src+= group_size; /* skip to next 2 */ + } + { + int padBytes= ysize - (width*group_size); + src+= padBytes; /* for assertion only */ + } + } + else if (width == 1) { /* 1 column */ + int padBytes= ysize - (width * group_size); + assert(height != 1); /* widthxheight can't be 1x1 */ + halfWidth= 1; + /* one vertical column with possible pad bytes per row */ + /* average two at a time */ + + for (jj= 0; jj< halfHeight; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLshort sshort[BOX2]; + if (myswap_bytes) { + sshort[0]= __GLU_SWAP_2_BYTES(src); + sshort[1]= __GLU_SWAP_2_BYTES(src+ysize); + } + else { + sshort[0]= *(const GLshort*)src; + sshort[1]= *(const GLshort*)(src+ysize); + } + *dest= (sshort[0] + sshort[1]) / 2; + + src+= element_size; + dest++; + } + src+= padBytes; /* add pad bytes, if any, to get to end to row */ + src+= ysize; + } + + assert(src == &((const char *)dataIn)[ysize*height]); + } + + assert((char *)dest == &((char *)dataOut) + [components * element_size * halfWidth * halfHeight]); + +} /* halve1Dimage_short() */ + + +static void halveImage_uint(GLint components, GLuint width, GLuint height, + const GLuint *datain, GLuint *dataout, + GLint element_size, GLint ysize, GLint group_size, + GLint myswap_bytes) +{ + int i, j, k; + int newwidth, newheight; + int padBytes; + GLuint *s; + const char *t; + + /* handle case where there is only 1 column/row */ + if (width == 1 || height == 1) { + assert( !(width == 1 && height == 1) ); /* can't be 1x1 */ + halve1Dimage_uint(components,width,height,datain,dataout, + element_size,ysize,group_size, myswap_bytes); + return; + } + + newwidth = width / 2; + newheight = height / 2; + padBytes = ysize - (width*group_size); + s = dataout; + t = (const char *)datain; + + /* Piece o' cake! */ + if (!myswap_bytes) + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + /* need to cast to double to hold large unsigned ints */ + s[0] = ((double)*(const GLuint*)t + + (double)*(const GLuint*)(t+group_size) + + (double)*(const GLuint*)(t+ysize) + + (double)*(const GLuint*)(t+ysize+group_size))/4 + 0.5; + s++; t += element_size; + + } + t += group_size; + } + t += padBytes; + t += ysize; + } + else + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + /* need to cast to double to hold large unsigned ints */ + GLdouble buf; + buf = (GLdouble)__GLU_SWAP_4_BYTES(t) + + (GLdouble)__GLU_SWAP_4_BYTES(t+group_size) + + (GLdouble)__GLU_SWAP_4_BYTES(t+ysize) + + (GLdouble)__GLU_SWAP_4_BYTES(t+ysize+group_size); + s[0] = (GLuint)(buf/4 + 0.5); + + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } +} + +/* */ +static void halve1Dimage_uint(GLint components, GLuint width, GLuint height, + const GLuint *dataIn, GLuint *dataOut, + GLint element_size, GLint ysize, + GLint group_size, GLint myswap_bytes) +{ + GLint halfWidth= width / 2; + GLint halfHeight= height / 2; + const char *src= (const char *) dataIn; + GLuint *dest= dataOut; + int jj; + + assert(width == 1 || height == 1); /* must be 1D */ + assert(width != height); /* can't be square */ + + if (height == 1) { /* 1 row */ + assert(width != 1); /* widthxheight can't be 1x1 */ + halfHeight= 1; + + for (jj= 0; jj< halfWidth; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLuint uint[BOX2]; + if (myswap_bytes) { + uint[0]= __GLU_SWAP_4_BYTES(src); + uint[1]= __GLU_SWAP_4_BYTES(src+group_size); + } + else { + uint[0]= *(const GLuint*)src; + uint[1]= *(const GLuint*)(src+group_size); + } + *dest= ((double)uint[0]+(double)uint[1])/2.0; + + src+= element_size; + dest++; + } + src+= group_size; /* skip to next 2 */ + } + { + int padBytes= ysize - (width*group_size); + src+= padBytes; /* for assertion only */ + } + } + else if (width == 1) { /* 1 column */ + int padBytes= ysize - (width * group_size); + assert(height != 1); /* widthxheight can't be 1x1 */ + halfWidth= 1; + /* one vertical column with possible pad bytes per row */ + /* average two at a time */ + + for (jj= 0; jj< halfHeight; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLuint uint[BOX2]; + if (myswap_bytes) { + uint[0]= __GLU_SWAP_4_BYTES(src); + uint[1]= __GLU_SWAP_4_BYTES(src+ysize); + } + else { + uint[0]= *(const GLuint*)src; + uint[1]= *(const GLuint*)(src+ysize); + } + *dest= ((double)uint[0]+(double)uint[1])/2.0; + + src+= element_size; + dest++; + } + src+= padBytes; /* add pad bytes, if any, to get to end to row */ + src+= ysize; + } + + assert(src == &((const char *)dataIn)[ysize*height]); + } + + assert((char *)dest == &((char *)dataOut) + [components * element_size * halfWidth * halfHeight]); + +} /* halve1Dimage_uint() */ + +static void halveImage_int(GLint components, GLuint width, GLuint height, + const GLint *datain, GLint *dataout, GLint element_size, + GLint ysize, GLint group_size, GLint myswap_bytes) +{ + int i, j, k; + int newwidth, newheight; + int padBytes; + GLint *s; + const char *t; + + /* handle case where there is only 1 column/row */ + if (width == 1 || height == 1) { + assert( !(width == 1 && height == 1) ); /* can't be 1x1 */ + halve1Dimage_int(components,width,height,datain,dataout, + element_size,ysize,group_size, myswap_bytes); + return; + } + + newwidth = width / 2; + newheight = height / 2; + padBytes = ysize - (width*group_size); + s = dataout; + t = (const char *)datain; + + /* Piece o' cake! */ + if (!myswap_bytes) + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + s[0] = ((float)*(const GLint*)t + + (float)*(const GLint*)(t+group_size) + + (float)*(const GLint*)(t+ysize) + + (float)*(const GLint*)(t+ysize+group_size))/4 + 0.5; + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } + else + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + GLuint b; + GLfloat buf; + b = __GLU_SWAP_4_BYTES(t); + buf = *(GLint*)&b; + b = __GLU_SWAP_4_BYTES(t+group_size); + buf += *(GLint*)&b; + b = __GLU_SWAP_4_BYTES(t+ysize); + buf += *(GLint*)&b; + b = __GLU_SWAP_4_BYTES(t+ysize+group_size); + buf += *(GLint*)&b; + s[0] = (GLint)(buf/4 + 0.5); + + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } +} + +/* */ +static void halve1Dimage_int(GLint components, GLuint width, GLuint height, + const GLint *dataIn, GLint *dataOut, + GLint element_size, GLint ysize, + GLint group_size, GLint myswap_bytes) +{ + GLint halfWidth= width / 2; + GLint halfHeight= height / 2; + const char *src= (const char *) dataIn; + GLint *dest= dataOut; + int jj; + + assert(width == 1 || height == 1); /* must be 1D */ + assert(width != height); /* can't be square */ + + if (height == 1) { /* 1 row */ + assert(width != 1); /* widthxheight can't be 1x1 */ + halfHeight= 1; + + for (jj= 0; jj< halfWidth; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLuint uint[BOX2]; + if (myswap_bytes) { + uint[0]= __GLU_SWAP_4_BYTES(src); + uint[1]= __GLU_SWAP_4_BYTES(src+group_size); + } + else { + uint[0]= *(const GLuint*)src; + uint[1]= *(const GLuint*)(src+group_size); + } + *dest= ((float)uint[0]+(float)uint[1])/2.0; + + src+= element_size; + dest++; + } + src+= group_size; /* skip to next 2 */ + } + { + int padBytes= ysize - (width*group_size); + src+= padBytes; /* for assertion only */ + } + } + else if (width == 1) { /* 1 column */ + int padBytes= ysize - (width * group_size); + assert(height != 1); /* widthxheight can't be 1x1 */ + halfWidth= 1; + /* one vertical column with possible pad bytes per row */ + /* average two at a time */ + + for (jj= 0; jj< halfHeight; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLuint uint[BOX2]; + if (myswap_bytes) { + uint[0]= __GLU_SWAP_4_BYTES(src); + uint[1]= __GLU_SWAP_4_BYTES(src+ysize); + } + else { + uint[0]= *(const GLuint*)src; + uint[1]= *(const GLuint*)(src+ysize); + } + *dest= ((float)uint[0]+(float)uint[1])/2.0; + + src+= element_size; + dest++; + } + src+= padBytes; /* add pad bytes, if any, to get to end to row */ + src+= ysize; + } + + assert(src == &((const char *)dataIn)[ysize*height]); + } + + assert((char *)dest == &((char *)dataOut) + [components * element_size * halfWidth * halfHeight]); + +} /* halve1Dimage_int() */ + + +static void halveImage_float(GLint components, GLuint width, GLuint height, + const GLfloat *datain, GLfloat *dataout, + GLint element_size, GLint ysize, GLint group_size, + GLint myswap_bytes) +{ + int i, j, k; + int newwidth, newheight; + int padBytes; + GLfloat *s; + const char *t; + + /* handle case where there is only 1 column/row */ + if (width == 1 || height == 1) { + assert( !(width == 1 && height == 1) ); /* can't be 1x1 */ + halve1Dimage_float(components,width,height,datain,dataout, + element_size,ysize,group_size, myswap_bytes); + return; + } + + newwidth = width / 2; + newheight = height / 2; + padBytes = ysize - (width*group_size); + s = dataout; + t = (const char *)datain; + + /* Piece o' cake! */ + if (!myswap_bytes) + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + s[0] = (*(const GLfloat*)t + + *(const GLfloat*)(t+group_size) + + *(const GLfloat*)(t+ysize) + + *(const GLfloat*)(t+ysize+group_size)) / 4; + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } + else + for (i = 0; i < newheight; i++) { + for (j = 0; j < newwidth; j++) { + for (k = 0; k < components; k++) { + union { GLuint b; GLfloat f; } swapbuf; + swapbuf.b = __GLU_SWAP_4_BYTES(t); + s[0] = swapbuf.f; + swapbuf.b = __GLU_SWAP_4_BYTES(t+group_size); + s[0] += swapbuf.f; + swapbuf.b = __GLU_SWAP_4_BYTES(t+ysize); + s[0] += swapbuf.f; + swapbuf.b = __GLU_SWAP_4_BYTES(t+ysize+group_size); + s[0] += swapbuf.f; + s[0] /= 4; + s++; t += element_size; + } + t += group_size; + } + t += padBytes; + t += ysize; + } +} + +/* */ +static void halve1Dimage_float(GLint components, GLuint width, GLuint height, + const GLfloat *dataIn, GLfloat *dataOut, + GLint element_size, GLint ysize, + GLint group_size, GLint myswap_bytes) +{ + GLint halfWidth= width / 2; + GLint halfHeight= height / 2; + const char *src= (const char *) dataIn; + GLfloat *dest= dataOut; + int jj; + + assert(width == 1 || height == 1); /* must be 1D */ + assert(width != height); /* can't be square */ + + if (height == 1) { /* 1 row */ + assert(width != 1); /* widthxheight can't be 1x1 */ + halfHeight= 1; + + for (jj= 0; jj< halfWidth; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLfloat sfloat[BOX2]; + if (myswap_bytes) { + sfloat[0]= __GLU_SWAP_4_BYTES(src); + sfloat[1]= __GLU_SWAP_4_BYTES(src+group_size); + } + else { + sfloat[0]= *(const GLfloat*)src; + sfloat[1]= *(const GLfloat*)(src+group_size); + } + + *dest= (sfloat[0] + sfloat[1]) / 2.0; + src+= element_size; + dest++; + } + src+= group_size; /* skip to next 2 */ + } + { + int padBytes= ysize - (width*group_size); + src+= padBytes; /* for assertion only */ + } + } + else if (width == 1) { /* 1 column */ + int padBytes= ysize - (width * group_size); + assert(height != 1); /* widthxheight can't be 1x1 */ + halfWidth= 1; + /* one vertical column with possible pad bytes per row */ + /* average two at a time */ + + for (jj= 0; jj< halfHeight; jj++) { + int kk; + for (kk= 0; kk< components; kk++) { +#define BOX2 2 + GLfloat sfloat[BOX2]; + if (myswap_bytes) { + sfloat[0]= __GLU_SWAP_4_BYTES(src); + sfloat[1]= __GLU_SWAP_4_BYTES(src+ysize); + } + else { + sfloat[0]= *(const GLfloat*)src; + sfloat[1]= *(const GLfloat*)(src+ysize); + } + *dest= (sfloat[0] + sfloat[1]) / 2.0; + + src+= element_size; + dest++; + } + src+= padBytes; /* add pad bytes, if any, to get to end to row */ + src+= ysize; /* skip to odd row */ + } + } + + assert(src == &((const char *)dataIn)[ysize*height]); + assert((char *)dest == &((char *)dataOut) + [components * element_size * halfWidth * halfHeight]); +} /* halve1Dimage_float() */ + +static void scale_internal(GLint components, GLint widthin, GLint heightin, + const GLushort *datain, + GLint widthout, GLint heightout, + GLushort *dataout) +{ + float x, lowx, highx, convx, halfconvx; + float y, lowy, highy, convy, halfconvy; + float xpercent,ypercent; + float percent; + /* Max components in a format is 4, so... */ + float totals[4]; + float area; + int i,j,k,yint,xint,xindex,yindex; + int temp; + + if (widthin == widthout*2 && heightin == heightout*2) { + halveImage(components, widthin, heightin, datain, dataout); + return; + } + convy = (float) heightin/heightout; + convx = (float) widthin/widthout; + halfconvx = convx/2; + halfconvy = convy/2; + for (i = 0; i < heightout; i++) { + y = convy * (i+0.5); + if (heightin > heightout) { + highy = y + halfconvy; + lowy = y - halfconvy; + } else { + highy = y + 0.5; + lowy = y - 0.5; + } + for (j = 0; j < widthout; j++) { + x = convx * (j+0.5); + if (widthin > widthout) { + highx = x + halfconvx; + lowx = x - halfconvx; + } else { + highx = x + 0.5; + lowx = x - 0.5; + } + + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + area = 0.0; + + y = lowy; + yint = floor(y); + while (y < highy) { + yindex = (yint + heightin) % heightin; + if (highy < yint+1) { + ypercent = highy - y; + } else { + ypercent = yint+1 - y; + } + + x = lowx; + xint = floor(x); + + while (x < highx) { + xindex = (xint + widthin) % widthin; + if (highx < xint+1) { + xpercent = highx - x; + } else { + xpercent = xint+1 - x; + } + + percent = xpercent * ypercent; + area += percent; + temp = (xindex + (yindex * widthin)) * components; + for (k = 0; k < components; k++) { + totals[k] += datain[temp + k] * percent; + } + + xint++; + x = xint; + } + yint++; + y = yint; + } + + temp = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + /* totals[] should be rounded in the case of enlarging an RGB + * ramp when the type is 332 or 4444 + */ + dataout[temp + k] = (totals[k]+0.5)/area; + } + } + } +} + +static void scale_internal_ubyte(GLint components, GLint widthin, + GLint heightin, const GLubyte *datain, + GLint widthout, GLint heightout, + GLubyte *dataout, GLint element_size, + GLint ysize, GLint group_size) +{ + float convx; + float convy; + float percent; + /* Max components in a format is 4, so... */ + float totals[4]; + float area; + int i,j,k,xindex; + + const char *temp, *temp0; + const char *temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + const char *left, *right; + + if (widthin == widthout*2 && heightin == heightout*2) { + halveImage_ubyte(components, widthin, heightin, + (const GLubyte *)datain, (GLubyte *)dataout, + element_size, ysize, group_size); + return; + } + convy = (float) heightin/heightout; + convx = (float) widthin/widthout; + convy_int = floor(convy); + convy_float = convy - convy_int; + convx_int = floor(convx); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0; + highy_int = convy_int; + highy_float = convy_float; + + for (i = 0; i < heightout; i++) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * percent; + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * y_percent; + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * percent; + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * percent; + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * y_percent; + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * percent; + } + + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + totals[k] += (GLubyte)(*(left))*(1-lowx_float) + +(GLubyte)(*(right))*highx_float; + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * percent; + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * x_percent; + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * percent; + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * percent; + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * y_percent; + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * percent; + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)) * percent; + } + } + + + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + + (lowy_int+1)*ysize; + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLubyte)(*(temp_index)); + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } + } +} + +static void scale_internal_byte(GLint components, GLint widthin, + GLint heightin, const GLbyte *datain, + GLint widthout, GLint heightout, + GLbyte *dataout, GLint element_size, + GLint ysize, GLint group_size) +{ + float convx; + float convy; + float percent; + /* Max components in a format is 4, so... */ + float totals[4]; + float area; + int i,j,k,xindex; + + const char *temp, *temp0; + const char *temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + const char *left, *right; + + if (widthin == widthout*2 && heightin == heightout*2) { + halveImage_byte(components, widthin, heightin, + (const GLbyte *)datain, (GLbyte *)dataout, + element_size, ysize, group_size); + return; + } + convy = (float) heightin/heightout; + convx = (float) widthin/widthout; + convy_int = floor(convy); + convy_float = convy - convy_int; + convx_int = floor(convx); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0; + highy_int = convy_int; + highy_float = convy_float; + + for (i = 0; i < heightout; i++) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * percent; + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * y_percent; + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * percent; + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * percent; + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * y_percent; + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * percent; + } + + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + totals[k] += (GLbyte)(*(left))*(1-lowx_float) + +(GLbyte)(*(right))*highx_float; + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * percent; + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * x_percent; + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * percent; + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * percent; + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * y_percent; + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * percent; + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)) * percent; + } + } + + + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + + (lowy_int+1)*ysize; + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + totals[k] += (GLbyte)(*(temp_index)); + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } + } +} + +static void scale_internal_ushort(GLint components, GLint widthin, + GLint heightin, const GLushort *datain, + GLint widthout, GLint heightout, + GLushort *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes) +{ + float convx; + float convy; + float percent; + /* Max components in a format is 4, so... */ + float totals[4]; + float area; + int i,j,k,xindex; + + const char *temp, *temp0; + const char *temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + const char *left, *right; + + if (widthin == widthout*2 && heightin == heightout*2) { + halveImage_ushort(components, widthin, heightin, + (const GLushort *)datain, (GLushort *)dataout, + element_size, ysize, group_size, myswap_bytes); + return; + } + convy = (float) heightin/heightout; + convx = (float) widthin/widthout; + convy_int = floor(convy); + convy_float = convy - convy_int; + convx_int = floor(convx); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0; + highy_int = convy_int; + highy_float = convy_float; + + for (i = 0; i < heightout; i++) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(left) * (1-lowx_float) + + __GLU_SWAP_2_BYTES(right) * highx_float; + } else { + totals[k] += *(const GLushort*)left * (1-lowx_float) + + *(const GLushort*)right * highx_float; + } + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * x_percent; + } else { + totals[k] += *(const GLushort*)temp_index * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } + } + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + + (lowy_int+1)*ysize; + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index); + } else { + totals[k] += *(const GLushort*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } + } +} + +static void scale_internal_short(GLint components, GLint widthin, + GLint heightin, const GLshort *datain, + GLint widthout, GLint heightout, + GLshort *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes) +{ + float convx; + float convy; + float percent; + /* Max components in a format is 4, so... */ + float totals[4]; + float area; + int i,j,k,xindex; + + const char *temp, *temp0; + const char *temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + const char *left, *right; + + GLushort swapbuf; /* unsigned buffer */ + + if (widthin == widthout*2 && heightin == heightout*2) { + halveImage_short(components, widthin, heightin, + (const GLshort *)datain, (GLshort *)dataout, + element_size, ysize, group_size, myswap_bytes); + return; + } + convy = (float) heightin/heightout; + convx = (float) widthin/widthout; + convy_int = floor(convy); + convy_float = convy - convy_int; + convx_int = floor(convx); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0; + highy_int = convy_int; + highy_float = convy_float; + + for (i = 0; i < heightout; i++) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLshort*)temp_index * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLshort*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(left); + totals[k] += *(const GLshort*)&swapbuf * (1-lowx_float); + swapbuf = __GLU_SWAP_2_BYTES(right); + totals[k] += *(const GLshort*)&swapbuf * highx_float; + } else { + totals[k] += *(const GLshort*)left * (1-lowx_float) + + *(const GLshort*)right * highx_float; + } + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * x_percent; + } else { + totals[k] += *(const GLshort*)temp_index * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLshort*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf * percent; + } else { + totals[k] += *(const GLshort*)temp_index * percent; + } + } + } + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + + (lowy_int+1)*ysize; + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_2_BYTES(temp_index); + totals[k] += *(const GLshort*)&swapbuf; + } else { + totals[k] += *(const GLshort*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } + } +} + +static void scale_internal_uint(GLint components, GLint widthin, + GLint heightin, const GLuint *datain, + GLint widthout, GLint heightout, + GLuint *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes) +{ + float convx; + float convy; + float percent; + /* Max components in a format is 4, so... */ + float totals[4]; + float area; + int i,j,k,xindex; + + const char *temp, *temp0; + const char *temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + const char *left, *right; + + if (widthin == widthout*2 && heightin == heightout*2) { + halveImage_uint(components, widthin, heightin, + (const GLuint *)datain, (GLuint *)dataout, + element_size, ysize, group_size, myswap_bytes); + return; + } + convy = (float) heightin/heightout; + convx = (float) widthin/widthout; + convy_int = floor(convy); + convy_float = convy - convy_int; + convx_int = floor(convx); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0; + highy_int = convy_int; + highy_float = convy_float; + + for (i = 0; i < heightout; i++) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLuint*)temp_index * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLuint*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(left) * (1-lowx_float) + + __GLU_SWAP_4_BYTES(right) * highx_float; + } else { + totals[k] += *(const GLuint*)left * (1-lowx_float) + + *(const GLuint*)right * highx_float; + } + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(temp_index) * x_percent; + } else { + totals[k] += *(const GLuint*)temp_index * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_4_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLuint*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLuint*)temp_index * percent; + } + } + } + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + + (lowy_int+1)*ysize; + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_4_BYTES(temp_index); + } else { + totals[k] += *(const GLuint*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + /* clamp at UINT_MAX */ + float value= totals[k]/area; + if (value >= (float) UINT_MAX) { /* need '=' */ + dataout[outindex + k] = UINT_MAX; + } + else dataout[outindex + k] = value; + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } + } +} + + + +static void scale_internal_int(GLint components, GLint widthin, + GLint heightin, const GLint *datain, + GLint widthout, GLint heightout, + GLint *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes) +{ + float convx; + float convy; + float percent; + /* Max components in a format is 4, so... */ + float totals[4]; + float area; + int i,j,k,xindex; + + const char *temp, *temp0; + const char *temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + const char *left, *right; + + GLuint swapbuf; /* unsigned buffer */ + + if (widthin == widthout*2 && heightin == heightout*2) { + halveImage_int(components, widthin, heightin, + (const GLint *)datain, (GLint *)dataout, + element_size, ysize, group_size, myswap_bytes); + return; + } + convy = (float) heightin/heightout; + convx = (float) widthin/widthout; + convy_int = floor(convy); + convy_float = convy - convy_int; + convx_int = floor(convx); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0; + highy_int = convy_int; + highy_float = convy_float; + + for (i = 0; i < heightout; i++) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLint*)temp_index * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLint*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(left); + totals[k] += *(const GLint*)&swapbuf * (1-lowx_float); + swapbuf = __GLU_SWAP_4_BYTES(right); + totals[k] += *(const GLint*)&swapbuf * highx_float; + } else { + totals[k] += *(const GLint*)left * (1-lowx_float) + + *(const GLint*)right * highx_float; + } + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * x_percent; + } else { + totals[k] += *(const GLint*)temp_index * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * y_percent; + } else { + totals[k] += *(const GLint*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf * percent; + } else { + totals[k] += *(const GLint*)temp_index * percent; + } + } + } + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + + (lowy_int+1)*ysize; + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += *(const GLint*)&swapbuf; + } else { + totals[k] += *(const GLint*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } + } +} + + + +static void scale_internal_float(GLint components, GLint widthin, + GLint heightin, const GLfloat *datain, + GLint widthout, GLint heightout, + GLfloat *dataout, GLint element_size, + GLint ysize, GLint group_size, + GLint myswap_bytes) +{ + float convx; + float convy; + float percent; + /* Max components in a format is 4, so... */ + float totals[4]; + float area; + int i,j,k,xindex; + + const char *temp, *temp0; + const char *temp_index; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + const char *left, *right; + + union { GLuint b; GLfloat f; } swapbuf; + + if (widthin == widthout*2 && heightin == heightout*2) { + halveImage_float(components, widthin, heightin, + (const GLfloat *)datain, (GLfloat *)dataout, + element_size, ysize, group_size, myswap_bytes); + return; + } + convy = (float) heightin/heightout; + convx = (float) widthin/widthout; + convy_int = floor(convy); + convy_float = convy - convy_int; + convx_int = floor(convx); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0; + highy_int = convy_int; + highy_float = convy_float; + + for (i = 0; i < heightout; i++) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthout; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*group_size; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)datain + xindex + lowy_int * ysize; + percent = y_percent * (1-lowx_float); + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * y_percent; + } else { + totals[k] += *(const GLfloat*)temp_index * y_percent; + } + } + } + temp += group_size; + right = temp; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + + /* calculate the value for pixels in the last row */ + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)datain + xindex + highy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + for(l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * y_percent; + } else { + totals[k] += *(const GLfloat*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += ysize; + right += ysize; + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(left); + totals[k] += swapbuf.f * (1-lowx_float); + swapbuf.b = __GLU_SWAP_4_BYTES(right); + totals[k] += swapbuf.f * highx_float; + } else { + totals[k] += *(const GLfloat*)left * (1-lowx_float) + + *(const GLfloat*)right * highx_float; + } + } + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + for(m = lowy_int+1; m < highy_int; m++) { + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * x_percent; + } else { + totals[k] += *(const GLfloat*)temp_index * x_percent; + } + } + } + percent = x_percent * highy_float; + temp += ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + + temp = (const char *)datain + xindex + lowy_int*ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + for (l = lowx_int+1; l < highx_int; l++) { + temp += group_size; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * y_percent; + } else { + totals[k] += *(const GLfloat*)temp_index * y_percent; + } + } + } + temp += group_size; + percent = y_percent * highx_float; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)datain + xindex + lowy_int * ysize; + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f * percent; + } else { + totals[k] += *(const GLfloat*)temp_index * percent; + } + } + } + + /* this is for the pixels in the body */ + temp0 = (const char *)datain + xindex + group_size + + (lowy_int+1)*ysize; + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + swapbuf.b = __GLU_SWAP_4_BYTES(temp_index); + totals[k] += swapbuf.f; + } else { + totals[k] += *(const GLfloat*)temp_index; + } + } + temp += group_size; + } + temp0 += ysize; + } + + outindex = (j + (i * widthout)) * components; + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } + } +} + +static int checkMipmapArgs(GLenum internalFormat, GLenum format, GLenum type) +{ + if (!legalFormat(format) || !legalType(type)) { + return GLU_INVALID_ENUM; + } + if (format == GL_STENCIL_INDEX) { + return GLU_INVALID_ENUM; + } + + if (!isLegalFormatForPackedPixelType(format, type)) { + return GLU_INVALID_OPERATION; + } + + return 0; +} /* checkMipmapArgs() */ + +static GLboolean legalFormat(GLenum format) +{ + switch(format) { + case GL_COLOR_INDEX: + case GL_STENCIL_INDEX: + case GL_DEPTH_COMPONENT: + case GL_RED: + case GL_GREEN: + case GL_BLUE: + case GL_ALPHA: + case GL_RGB: + case GL_RGBA: + case GL_LUMINANCE: + case GL_LUMINANCE_ALPHA: + case GL_BGR: + case GL_BGRA: + return GL_TRUE; + default: + return GL_FALSE; + } +} + + +static GLboolean legalType(GLenum type) +{ + switch(type) { + case GL_BITMAP: + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + return GL_TRUE; + default: + return GL_FALSE; + } +} + +/* */ +static GLboolean isTypePackedPixel(GLenum type) +{ + assert(legalType(type)); + + if (type == GL_UNSIGNED_BYTE_3_3_2 || + type == GL_UNSIGNED_BYTE_2_3_3_REV || + type == GL_UNSIGNED_SHORT_5_6_5 || + type == GL_UNSIGNED_SHORT_5_6_5_REV || + type == GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL_UNSIGNED_SHORT_1_5_5_5_REV || + type == GL_UNSIGNED_INT_8_8_8_8 || + type == GL_UNSIGNED_INT_8_8_8_8_REV || + type == GL_UNSIGNED_INT_10_10_10_2 || + type == GL_UNSIGNED_INT_2_10_10_10_REV) { + return 1; + } + else return 0; +} /* isTypePackedPixel() */ + +/* Determines if the packed pixel type is compatible with the format */ +static GLboolean isLegalFormatForPackedPixelType(GLenum format, GLenum type) +{ + /* if not a packed pixel type then return true */ + if (!isTypePackedPixel(type)) { + return GL_TRUE; + } + + /* 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB */ + if ((type == GL_UNSIGNED_BYTE_3_3_2 || type == GL_UNSIGNED_BYTE_2_3_3_REV|| + type == GL_UNSIGNED_SHORT_5_6_5|| type == GL_UNSIGNED_SHORT_5_6_5_REV) + && format != GL_RGB) + return GL_FALSE; + + /* 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & + * 10_10_10_2/2_10_10_10_REV are only compatible with RGBA, BGRA & ABGR_EXT. + */ + if ((type == GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL_UNSIGNED_SHORT_1_5_5_5_REV || + type == GL_UNSIGNED_INT_8_8_8_8 || + type == GL_UNSIGNED_INT_8_8_8_8_REV || + type == GL_UNSIGNED_INT_10_10_10_2 || + type == GL_UNSIGNED_INT_2_10_10_10_REV) && + (format != GL_RGBA && + format != GL_BGRA)) { + return GL_FALSE; + } + + return GL_TRUE; +} /* isLegalFormatForPackedPixelType() */ + +static GLboolean isLegalLevels(GLint userLevel,GLint baseLevel,GLint maxLevel, + GLint totalLevels) +{ + if (baseLevel < 0 || baseLevel < userLevel || maxLevel < baseLevel || + totalLevels < maxLevel) + return GL_FALSE; + else return GL_TRUE; +} /* isLegalLevels() */ + +/* Given user requested texture size, determine if it fits. If it + * doesn't then halve both sides and make the determination again + * until it does fit (for IR only). + * Note that proxy textures are not implemented in RE* even though + * they advertise the texture extension. + * Note that proxy textures are implemented but not according to spec in + * IMPACT*. + */ +static void closestFit(GLenum target, GLint width, GLint height, + GLint internalFormat, GLenum format, GLenum type, + GLint *newWidth, GLint *newHeight) +{ + /* Use proxy textures if OpenGL version is >= 1.1 */ + if ( (strtod((const char *)glGetString(GL_VERSION),NULL) >= 1.1) + ) { + GLint widthPowerOf2= nearestPower(width); + GLint heightPowerOf2= nearestPower(height); + GLint proxyWidth; + + do { + /* compute level 1 width & height, clamping each at 1 */ + GLint widthAtLevelOne= (widthPowerOf2 > 1) ? + widthPowerOf2 >> 1 : + widthPowerOf2; + GLint heightAtLevelOne= (heightPowerOf2 > 1) ? + heightPowerOf2 >> 1 : + heightPowerOf2; + GLenum proxyTarget; + assert(widthAtLevelOne > 0); assert(heightAtLevelOne > 0); + + /* does width x height at level 1 & all their mipmaps fit? */ + if (target == GL_TEXTURE_2D || target == GL_PROXY_TEXTURE_2D) { + proxyTarget = GL_PROXY_TEXTURE_2D; + glTexImage2D(proxyTarget, 1, /* must be non-zero */ + internalFormat, + widthAtLevelOne,heightAtLevelOne,0,format,type,NULL); + } else +#if defined(GL_ARB_texture_cube_map) + if ((target == GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB) || + (target == GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB) || + (target == GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB) || + (target == GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB) || + (target == GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB) || + (target == GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { + proxyTarget = GL_PROXY_TEXTURE_CUBE_MAP_ARB; + glTexImage2D(proxyTarget, 1, /* must be non-zero */ + internalFormat, + widthAtLevelOne,heightAtLevelOne,0,format,type,NULL); + } else +#endif /* GL_ARB_texture_cube_map */ + { + assert(target == GL_TEXTURE_1D || target == GL_PROXY_TEXTURE_1D); + proxyTarget = GL_PROXY_TEXTURE_1D; + glTexImage1D(proxyTarget, 1, /* must be non-zero */ + internalFormat,widthAtLevelOne,0,format,type,NULL); + } + glGetTexLevelParameteriv(proxyTarget, 1,GL_TEXTURE_WIDTH,&proxyWidth); + /* does it fit??? */ + if (proxyWidth == 0) { /* nope, so try again with these sizes */ + if (widthPowerOf2 == 1 && heightPowerOf2 == 1) { + /* An 1x1 texture couldn't fit for some reason, so + * break out. This should never happen. But things + * happen. The disadvantage with this if-statement is + * that we will never be aware of when this happens + * since it will silently branch out. + */ + goto noProxyTextures; + } + widthPowerOf2= widthAtLevelOne; + heightPowerOf2= heightAtLevelOne; + } + /* else it does fit */ + } while (proxyWidth == 0); + /* loop must terminate! */ + + /* return the width & height at level 0 that fits */ + *newWidth= widthPowerOf2; + *newHeight= heightPowerOf2; +/*printf("Proxy Textures\n");*/ + } /* if gluCheckExtension() */ + else { /* no texture extension, so do this instead */ + GLint maxsize; + +noProxyTextures: + + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize); + /* clamp user's texture sizes to maximum sizes, if necessary */ + *newWidth = nearestPower(width); + if (*newWidth > maxsize) *newWidth = maxsize; + *newHeight = nearestPower(height); + if (*newHeight > maxsize) *newHeight = maxsize; +/*printf("NO proxy textures\n");*/ + } +} /* closestFit() */ + +GLint GLAPIENTRY +gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin, + GLenum typein, const void *datain, + GLsizei widthout, GLsizei heightout, GLenum typeout, + void *dataout) +{ + int components; + GLushort *beforeImage; + GLushort *afterImage; + PixelStorageModes psm; + + if (widthin == 0 || heightin == 0 || widthout == 0 || heightout == 0) { + return 0; + } + if (widthin < 0 || heightin < 0 || widthout < 0 || heightout < 0) { + return GLU_INVALID_VALUE; + } + if (!legalFormat(format) || !legalType(typein) || !legalType(typeout)) { + return GLU_INVALID_ENUM; + } + if (!isLegalFormatForPackedPixelType(format, typein)) { + return GLU_INVALID_OPERATION; + } + if (!isLegalFormatForPackedPixelType(format, typeout)) { + return GLU_INVALID_OPERATION; + } + beforeImage = + malloc(image_size(widthin, heightin, format, GL_UNSIGNED_SHORT)); + afterImage = + malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT)); + if (beforeImage == NULL || afterImage == NULL) { + return GLU_OUT_OF_MEMORY; + } + + retrieveStoreModes(&psm); + fill_image(&psm,widthin, heightin, format, typein, is_index(format), + datain, beforeImage); + components = elements_per_group(format, 0); + scale_internal(components, widthin, heightin, beforeImage, + widthout, heightout, afterImage); + empty_image(&psm,widthout, heightout, format, typeout, + is_index(format), afterImage, dataout); + free((GLbyte *) beforeImage); + free((GLbyte *) afterImage); + + return 0; +} + +int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat, + GLsizei width, + GLsizei widthPowerOf2, + GLenum format, GLenum type, + GLint userLevel, GLint baseLevel,GLint maxLevel, + const void *data) +{ + GLint newwidth; + GLint level, levels; + GLushort *newImage; + GLint newImage_width; + GLushort *otherImage; + GLushort *imageTemp; + GLint memreq; + GLint cmpts; + PixelStorageModes psm; + + assert(checkMipmapArgs(internalFormat,format,type) == 0); + assert(width >= 1); + + otherImage = NULL; + + newwidth= widthPowerOf2; + levels = computeLog(newwidth); + + levels+= userLevel; + + retrieveStoreModes(&psm); + newImage = (GLushort *) + malloc(image_size(width, 1, format, GL_UNSIGNED_SHORT)); + newImage_width = width; + if (newImage == NULL) { + return GLU_OUT_OF_MEMORY; + } + fill_image(&psm,width, 1, format, type, is_index(format), + data, newImage); + cmpts = elements_per_group(format,type); + glPixelStorei(GL_UNPACK_ALIGNMENT, 2); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + /* + ** If swap_bytes was set, swapping occurred in fill_image. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); + + for (level = userLevel; level <= levels; level++) { + if (newImage_width == newwidth) { + /* Use newImage for this level */ + if (baseLevel <= level && level <= maxLevel) { + glTexImage1D(target, level, internalFormat, newImage_width, + 0, format, GL_UNSIGNED_SHORT, (void *) newImage); + } + } else { + if (otherImage == NULL) { + memreq = image_size(newwidth, 1, format, GL_UNSIGNED_SHORT); + otherImage = (GLushort *) malloc(memreq); + if (otherImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + return GLU_OUT_OF_MEMORY; + } + } + scale_internal(cmpts, newImage_width, 1, newImage, + newwidth, 1, otherImage); + /* Swap newImage and otherImage */ + imageTemp = otherImage; + otherImage = newImage; + newImage = imageTemp; + + newImage_width = newwidth; + if (baseLevel <= level && level <= maxLevel) { + glTexImage1D(target, level, internalFormat, newImage_width, + 0, format, GL_UNSIGNED_SHORT, (void *) newImage); + } + } + if (newwidth > 1) newwidth /= 2; + } + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + + free((GLbyte *) newImage); + if (otherImage) { + free((GLbyte *) otherImage); + } + return 0; +} + +GLint GLAPIENTRY +gluBuild1DMipmapLevels(GLenum target, GLint internalFormat, + GLsizei width, + GLenum format, GLenum type, + GLint userLevel, GLint baseLevel, GLint maxLevel, + const void *data) +{ + int levels; + + int rc= checkMipmapArgs(internalFormat,format,type); + if (rc != 0) return rc; + + if (width < 1) { + return GLU_INVALID_VALUE; + } + + levels = computeLog(width); + + levels+= userLevel; + if (!isLegalLevels(userLevel,baseLevel,maxLevel,levels)) + return GLU_INVALID_VALUE; + + return gluBuild1DMipmapLevelsCore(target, internalFormat, + width, + width,format, type, + userLevel, baseLevel, maxLevel, + data); +} /* gluBuild1DMipmapLevels() */ + +GLint GLAPIENTRY +gluBuild1DMipmaps(GLenum target, GLint internalFormat, GLsizei width, + GLenum format, GLenum type, + const void *data) +{ + GLint widthPowerOf2; + int levels; + GLint dummy; + + int rc= checkMipmapArgs(internalFormat,format,type); + if (rc != 0) return rc; + + if (width < 1) { + return GLU_INVALID_VALUE; + } + + closestFit(target,width,1,internalFormat,format,type,&widthPowerOf2,&dummy); + levels = computeLog(widthPowerOf2); + + return gluBuild1DMipmapLevelsCore(target,internalFormat, + width, + widthPowerOf2, + format,type,0,0,levels,data); +} + +static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat, + GLint width, GLint height, GLenum format, + GLenum type, const void *data) +{ + GLint newwidth, newheight; + GLint level, levels; + GLushort *newImage; + GLint newImage_width; + GLint newImage_height; + GLushort *otherImage; + GLushort *imageTemp; + GLint memreq; + GLint cmpts; + PixelStorageModes psm; + + retrieveStoreModes(&psm); + +#if 0 + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize); + newwidth = nearestPower(width); + if (newwidth > maxsize) newwidth = maxsize; + newheight = nearestPower(height); + if (newheight > maxsize) newheight = maxsize; +#else + closestFit(target,width,height,internalFormat,format,type, + &newwidth,&newheight); +#endif + levels = computeLog(newwidth); + level = computeLog(newheight); + if (level > levels) levels=level; + + otherImage = NULL; + newImage = (GLushort *) + malloc(image_size(width, height, format, GL_UNSIGNED_SHORT)); + newImage_width = width; + newImage_height = height; + if (newImage == NULL) { + return GLU_OUT_OF_MEMORY; + } + + fill_image(&psm,width, height, format, type, is_index(format), + data, newImage); + + cmpts = elements_per_group(format,type); + glPixelStorei(GL_UNPACK_ALIGNMENT, 2); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + /* + ** If swap_bytes was set, swapping occurred in fill_image. + */ + glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); + + for (level = 0; level <= levels; level++) { + if (newImage_width == newwidth && newImage_height == newheight) { /* Use newImage for this level */ + glTexImage2D(target, level, internalFormat, newImage_width, + newImage_height, 0, format, GL_UNSIGNED_SHORT, + (void *) newImage); + } else { + if (otherImage == NULL) { + memreq = + image_size(newwidth, newheight, format, GL_UNSIGNED_SHORT); + otherImage = (GLushort *) malloc(memreq); + if (otherImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + return GLU_OUT_OF_MEMORY; + } + } + scale_internal(cmpts, newImage_width, newImage_height, newImage, + newwidth, newheight, otherImage); + /* Swap newImage and otherImage */ + imageTemp = otherImage; + otherImage = newImage; + newImage = imageTemp; + + newImage_width = newwidth; + newImage_height = newheight; + glTexImage2D(target, level, internalFormat, newImage_width, + newImage_height, 0, format, GL_UNSIGNED_SHORT, + (void *) newImage); + } + if (newwidth > 1) newwidth /= 2; + if (newheight > 1) newheight /= 2; + } + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + + free((GLbyte *) newImage); + if (otherImage) { + free((GLbyte *) otherImage); + } + return 0; +} + +/* To make swapping images less error prone */ +#define __GLU_INIT_SWAP_IMAGE void *tmpImage +#define __GLU_SWAP_IMAGE(a,b) tmpImage = a; a = b; b = tmpImage; + +static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, + GLsizei width, GLsizei height, + GLsizei widthPowerOf2, + GLsizei heightPowerOf2, + GLenum format, GLenum type, + GLint userLevel, + GLint baseLevel,GLint maxLevel, + const void *data) +{ + GLint newwidth, newheight; + GLint level, levels; + const void *usersImage; /* passed from user. Don't touch! */ + void *srcImage, *dstImage; /* scratch area to build mipmapped images */ + __GLU_INIT_SWAP_IMAGE; + GLint memreq; + GLint cmpts; + + GLint myswap_bytes, groups_per_line, element_size, group_size; + GLint rowsize, padding; + PixelStorageModes psm; + + assert(checkMipmapArgs(internalFormat,format,type) == 0); + assert(width >= 1 && height >= 1); + + if(type == GL_BITMAP) { + return bitmapBuild2DMipmaps(target, internalFormat, width, height, + format, type, data); + } + + srcImage = dstImage = NULL; + + newwidth= widthPowerOf2; + newheight= heightPowerOf2; + levels = computeLog(newwidth); + level = computeLog(newheight); + if (level > levels) levels=level; + + levels+= userLevel; + + retrieveStoreModes(&psm); + myswap_bytes = psm.unpack_swap_bytes; + cmpts = elements_per_group(format,type); + if (psm.unpack_row_length > 0) { + groups_per_line = psm.unpack_row_length; + } else { + groups_per_line = width; + } + + element_size = bytes_per_element(type); + group_size = element_size * cmpts; + if (element_size == 1) myswap_bytes = 0; + + rowsize = groups_per_line * group_size; + padding = (rowsize % psm.unpack_alignment); + if (padding) { + rowsize += psm.unpack_alignment - padding; + } + usersImage = (const GLubyte *) data + psm.unpack_skip_rows * rowsize + + psm.unpack_skip_pixels * group_size; + + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + + level = userLevel; + + /* already power-of-two square */ + if (width == newwidth && height == newheight) { + /* Use usersImage for level userLevel */ + if (baseLevel <= level && level <= maxLevel) { + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glTexImage2D(target, level, internalFormat, width, + height, 0, format, type, + usersImage); + } + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + if(levels == 0) { /* we're done. clean up and return */ + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + return 0; + } + { + int nextWidth= newwidth/2; + int nextHeight= newheight/2; + + /* clamp to 1 */ + if (nextWidth < 1) nextWidth= 1; + if (nextHeight < 1) nextHeight= 1; + memreq = image_size(nextWidth, nextHeight, format, type); + } + + switch(type) { + case GL_UNSIGNED_BYTE: + dstImage = (GLubyte *)malloc(memreq); + break; + case GL_BYTE: + dstImage = (GLbyte *)malloc(memreq); + break; + case GL_UNSIGNED_SHORT: + dstImage = (GLushort *)malloc(memreq); + break; + case GL_SHORT: + dstImage = (GLshort *)malloc(memreq); + break; + case GL_UNSIGNED_INT: + dstImage = (GLuint *)malloc(memreq); + break; + case GL_INT: + dstImage = (GLint *)malloc(memreq); + break; + case GL_FLOAT: + dstImage = (GLfloat *)malloc(memreq); + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + dstImage = (GLubyte *)malloc(memreq); + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + dstImage = (GLushort *)malloc(memreq); + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + dstImage = (GLuint *)malloc(memreq); + break; + default: + return GLU_INVALID_ENUM; + } + if (dstImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + return GLU_OUT_OF_MEMORY; + } + else + switch(type) { + case GL_UNSIGNED_BYTE: + halveImage_ubyte(cmpts, width, height, + (const GLubyte *)usersImage, (GLubyte *)dstImage, + element_size, rowsize, group_size); + break; + case GL_BYTE: + halveImage_byte(cmpts, width, height, + (const GLbyte *)usersImage, (GLbyte *)dstImage, + element_size, rowsize, group_size); + break; + case GL_UNSIGNED_SHORT: + halveImage_ushort(cmpts, width, height, + (const GLushort *)usersImage, (GLushort *)dstImage, + element_size, rowsize, group_size, myswap_bytes); + break; + case GL_SHORT: + halveImage_short(cmpts, width, height, + (const GLshort *)usersImage, (GLshort *)dstImage, + element_size, rowsize, group_size, myswap_bytes); + break; + case GL_UNSIGNED_INT: + halveImage_uint(cmpts, width, height, + (const GLuint *)usersImage, (GLuint *)dstImage, + element_size, rowsize, group_size, myswap_bytes); + break; + case GL_INT: + halveImage_int(cmpts, width, height, + (const GLint *)usersImage, (GLint *)dstImage, + element_size, rowsize, group_size, myswap_bytes); + break; + case GL_FLOAT: + halveImage_float(cmpts, width, height, + (const GLfloat *)usersImage, (GLfloat *)dstImage, + element_size, rowsize, group_size, myswap_bytes); + break; + case GL_UNSIGNED_BYTE_3_3_2: + assert(format == GL_RGB); + halveImagePackedPixel(3,extract332,shove332, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + assert(format == GL_RGB); + halveImagePackedPixel(3,extract233rev,shove233rev, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_5_6_5: + halveImagePackedPixel(3,extract565,shove565, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + halveImagePackedPixel(3,extract565rev,shove565rev, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + halveImagePackedPixel(4,extract4444,shove4444, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + halveImagePackedPixel(4,extract4444rev,shove4444rev, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + halveImagePackedPixel(4,extract5551,shove5551, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + halveImagePackedPixel(4,extract1555rev,shove1555rev, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_INT_8_8_8_8: + halveImagePackedPixel(4,extract8888,shove8888, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + halveImagePackedPixel(4,extract8888rev,shove8888rev, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_INT_10_10_10_2: + halveImagePackedPixel(4,extract1010102,shove1010102, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + halveImagePackedPixel(4,extract2101010rev,shove2101010rev, + width,height,usersImage,dstImage, + element_size,rowsize,myswap_bytes); + break; + default: + assert(0); + break; + } + newwidth = width/2; + newheight = height/2; + /* clamp to 1 */ + if (newwidth < 1) newwidth= 1; + if (newheight < 1) newheight= 1; + + myswap_bytes = 0; + rowsize = newwidth * group_size; + memreq = image_size(newwidth, newheight, format, type); + /* Swap srcImage and dstImage */ + __GLU_SWAP_IMAGE(srcImage,dstImage); + switch(type) { + case GL_UNSIGNED_BYTE: + dstImage = (GLubyte *)malloc(memreq); + break; + case GL_BYTE: + dstImage = (GLbyte *)malloc(memreq); + break; + case GL_UNSIGNED_SHORT: + dstImage = (GLushort *)malloc(memreq); + break; + case GL_SHORT: + dstImage = (GLshort *)malloc(memreq); + break; + case GL_UNSIGNED_INT: + dstImage = (GLuint *)malloc(memreq); + break; + case GL_INT: + dstImage = (GLint *)malloc(memreq); + break; + case GL_FLOAT: + dstImage = (GLfloat *)malloc(memreq); + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + dstImage = (GLubyte *)malloc(memreq); + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + dstImage = (GLushort *)malloc(memreq); + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + dstImage = (GLuint *)malloc(memreq); + break; + default: + return GLU_INVALID_ENUM; + } + if (dstImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + return GLU_OUT_OF_MEMORY; + } + /* level userLevel+1 is in srcImage; level userLevel already saved */ + level = userLevel+1; + } else { /* user's image is *not* nice power-of-2 sized square */ + memreq = image_size(newwidth, newheight, format, type); + switch(type) { + case GL_UNSIGNED_BYTE: + dstImage = (GLubyte *)malloc(memreq); + break; + case GL_BYTE: + dstImage = (GLbyte *)malloc(memreq); + break; + case GL_UNSIGNED_SHORT: + dstImage = (GLushort *)malloc(memreq); + break; + case GL_SHORT: + dstImage = (GLshort *)malloc(memreq); + break; + case GL_UNSIGNED_INT: + dstImage = (GLuint *)malloc(memreq); + break; + case GL_INT: + dstImage = (GLint *)malloc(memreq); + break; + case GL_FLOAT: + dstImage = (GLfloat *)malloc(memreq); + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + dstImage = (GLubyte *)malloc(memreq); + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + dstImage = (GLushort *)malloc(memreq); + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + dstImage = (GLuint *)malloc(memreq); + break; + default: + return GLU_INVALID_ENUM; + } + + if (dstImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + return GLU_OUT_OF_MEMORY; + } + + switch(type) { + case GL_UNSIGNED_BYTE: + scale_internal_ubyte(cmpts, width, height, + (const GLubyte *)usersImage, newwidth, newheight, + (GLubyte *)dstImage, element_size, + rowsize, group_size); + break; + case GL_BYTE: + scale_internal_byte(cmpts, width, height, + (const GLbyte *)usersImage, newwidth, newheight, + (GLbyte *)dstImage, element_size, + rowsize, group_size); + break; + case GL_UNSIGNED_SHORT: + scale_internal_ushort(cmpts, width, height, + (const GLushort *)usersImage, newwidth, newheight, + (GLushort *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_SHORT: + scale_internal_short(cmpts, width, height, + (const GLshort *)usersImage, newwidth, newheight, + (GLshort *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_UNSIGNED_INT: + scale_internal_uint(cmpts, width, height, + (const GLuint *)usersImage, newwidth, newheight, + (GLuint *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_INT: + scale_internal_int(cmpts, width, height, + (const GLint *)usersImage, newwidth, newheight, + (GLint *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_FLOAT: + scale_internal_float(cmpts, width, height, + (const GLfloat *)usersImage, newwidth, newheight, + (GLfloat *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_UNSIGNED_BYTE_3_3_2: + scaleInternalPackedPixel(3,extract332,shove332, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + scaleInternalPackedPixel(3,extract233rev,shove233rev, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_5_6_5: + scaleInternalPackedPixel(3,extract565,shove565, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + scaleInternalPackedPixel(3,extract565rev,shove565rev, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + scaleInternalPackedPixel(4,extract4444,shove4444, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + scaleInternalPackedPixel(4,extract4444rev,shove4444rev, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + scaleInternalPackedPixel(4,extract5551,shove5551, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + scaleInternalPackedPixel(4,extract1555rev,shove1555rev, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_INT_8_8_8_8: + scaleInternalPackedPixel(4,extract8888,shove8888, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + scaleInternalPackedPixel(4,extract8888rev,shove8888rev, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_INT_10_10_10_2: + scaleInternalPackedPixel(4,extract1010102,shove1010102, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + scaleInternalPackedPixel(4,extract2101010rev,shove2101010rev, + width, height,usersImage, + newwidth,newheight,(void *)dstImage, + element_size,rowsize,myswap_bytes); + break; + default: + assert(0); + break; + } + myswap_bytes = 0; + rowsize = newwidth * group_size; + /* Swap dstImage and srcImage */ + __GLU_SWAP_IMAGE(srcImage,dstImage); + + if(levels != 0) { /* use as little memory as possible */ + { + int nextWidth= newwidth/2; + int nextHeight= newheight/2; + if (nextWidth < 1) nextWidth= 1; + if (nextHeight < 1) nextHeight= 1; + + memreq = image_size(nextWidth, nextHeight, format, type); + } + + switch(type) { + case GL_UNSIGNED_BYTE: + dstImage = (GLubyte *)malloc(memreq); + break; + case GL_BYTE: + dstImage = (GLbyte *)malloc(memreq); + break; + case GL_UNSIGNED_SHORT: + dstImage = (GLushort *)malloc(memreq); + break; + case GL_SHORT: + dstImage = (GLshort *)malloc(memreq); + break; + case GL_UNSIGNED_INT: + dstImage = (GLuint *)malloc(memreq); + break; + case GL_INT: + dstImage = (GLint *)malloc(memreq); + break; + case GL_FLOAT: + dstImage = (GLfloat *)malloc(memreq); + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + dstImage = (GLubyte *)malloc(memreq); + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + dstImage = (GLushort *)malloc(memreq); + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + dstImage = (GLuint *)malloc(memreq); + break; + default: + return GLU_INVALID_ENUM; + } + if (dstImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + return GLU_OUT_OF_MEMORY; + } + } + /* level userLevel is in srcImage; nothing saved yet */ + level = userLevel; + } + + glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); + if (baseLevel <= level && level <= maxLevel) { + glTexImage2D(target, level, internalFormat, newwidth, newheight, 0, + format, type, (void *)srcImage); + } + + level++; /* update current level for the loop */ + for (; level <= levels; level++) { + switch(type) { + case GL_UNSIGNED_BYTE: + halveImage_ubyte(cmpts, newwidth, newheight, + (GLubyte *)srcImage, (GLubyte *)dstImage, element_size, + rowsize, group_size); + break; + case GL_BYTE: + halveImage_byte(cmpts, newwidth, newheight, + (GLbyte *)srcImage, (GLbyte *)dstImage, element_size, + rowsize, group_size); + break; + case GL_UNSIGNED_SHORT: + halveImage_ushort(cmpts, newwidth, newheight, + (GLushort *)srcImage, (GLushort *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_SHORT: + halveImage_short(cmpts, newwidth, newheight, + (GLshort *)srcImage, (GLshort *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_UNSIGNED_INT: + halveImage_uint(cmpts, newwidth, newheight, + (GLuint *)srcImage, (GLuint *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_INT: + halveImage_int(cmpts, newwidth, newheight, + (GLint *)srcImage, (GLint *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_FLOAT: + halveImage_float(cmpts, newwidth, newheight, + (GLfloat *)srcImage, (GLfloat *)dstImage, element_size, + rowsize, group_size, myswap_bytes); + break; + case GL_UNSIGNED_BYTE_3_3_2: + halveImagePackedPixel(3,extract332,shove332, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + halveImagePackedPixel(3,extract233rev,shove233rev, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_SHORT_5_6_5: + halveImagePackedPixel(3,extract565,shove565, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + halveImagePackedPixel(3,extract565rev,shove565rev, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + halveImagePackedPixel(4,extract4444,shove4444, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + halveImagePackedPixel(4,extract4444rev,shove4444rev, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + halveImagePackedPixel(4,extract5551,shove5551, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + halveImagePackedPixel(4,extract1555rev,shove1555rev, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_INT_8_8_8_8: + halveImagePackedPixel(4,extract8888,shove8888, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + halveImagePackedPixel(4,extract8888rev,shove8888rev, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_INT_10_10_10_2: + halveImagePackedPixel(4,extract1010102,shove1010102, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + halveImagePackedPixel(4,extract2101010rev,shove2101010rev, + newwidth,newheight, + srcImage,dstImage,element_size,rowsize, + myswap_bytes); + break; + default: + assert(0); + break; + } + + __GLU_SWAP_IMAGE(srcImage,dstImage); + + if (newwidth > 1) { newwidth /= 2; rowsize /= 2;} + if (newheight > 1) newheight /= 2; + { + /* compute amount to pad per row, if any */ + int rowPad= rowsize % psm.unpack_alignment; + + /* should row be padded? */ + if (rowPad == 0) { /* nope, row should not be padded */ + /* call tex image with srcImage untouched since it's not padded */ + if (baseLevel <= level && level <= maxLevel) { + glTexImage2D(target, level, internalFormat, newwidth, newheight, 0, + format, type, (void *) srcImage); + } + } + else { /* yes, row should be padded */ + /* compute length of new row in bytes, including padding */ + int newRowLength= rowsize + psm.unpack_alignment - rowPad; + int ii; unsigned char *dstTrav, *srcTrav; /* indices for copying */ + + /* allocate new image for mipmap of size newRowLength x newheight */ + void *newMipmapImage= malloc((size_t) (newRowLength*newheight)); + if (newMipmapImage == NULL) { + /* out of memory so return */ + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + return GLU_OUT_OF_MEMORY; + } + + /* copy image from srcImage into newMipmapImage by rows */ + for (ii= 0, + dstTrav= (unsigned char *) newMipmapImage, + srcTrav= (unsigned char *) srcImage; + ii< newheight; + ii++, + dstTrav+= newRowLength, /* make sure the correct distance... */ + srcTrav+= rowsize) { /* ...is skipped */ + memcpy(dstTrav,srcTrav,rowsize); + /* note that the pad bytes are not visited and will contain + * garbage, which is ok. + */ + } + + /* ...and use this new image for mipmapping instead */ + if (baseLevel <= level && level <= maxLevel) { + glTexImage2D(target, level, internalFormat, newwidth, newheight, 0, + format, type, newMipmapImage); + } + free(newMipmapImage); /* don't forget to free it! */ + } /* else */ + } + } /* for level */ + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + + free(srcImage); /*if you get to here, a srcImage has always been malloc'ed*/ + if (dstImage) { /* if it's non-rectangular and only 1 level */ + free(dstImage); + } + return 0; +} /* gluBuild2DMipmapLevelsCore() */ + +GLint GLAPIENTRY +gluBuild2DMipmapLevels(GLenum target, GLint internalFormat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + GLint userLevel, GLint baseLevel, GLint maxLevel, + const void *data) +{ + int level, levels; + + int rc= checkMipmapArgs(internalFormat,format,type); + if (rc != 0) return rc; + + if (width < 1 || height < 1) { + return GLU_INVALID_VALUE; + } + + levels = computeLog(width); + level = computeLog(height); + if (level > levels) levels=level; + + levels+= userLevel; + if (!isLegalLevels(userLevel,baseLevel,maxLevel,levels)) + return GLU_INVALID_VALUE; + + return gluBuild2DMipmapLevelsCore(target, internalFormat, + width, height, + width, height, + format, type, + userLevel, baseLevel, maxLevel, + data); +} /* gluBuild2DMipmapLevels() */ + +GLint GLAPIENTRY +gluBuild2DMipmaps(GLenum target, GLint internalFormat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const void *data) +{ + GLint widthPowerOf2, heightPowerOf2; + int level, levels; + + int rc= checkMipmapArgs(internalFormat,format,type); + if (rc != 0) return rc; + + if (width < 1 || height < 1) { + return GLU_INVALID_VALUE; + } + + closestFit(target,width,height,internalFormat,format,type, + &widthPowerOf2,&heightPowerOf2); + + levels = computeLog(widthPowerOf2); + level = computeLog(heightPowerOf2); + if (level > levels) levels=level; + + return gluBuild2DMipmapLevelsCore(target,internalFormat, + width, height, + widthPowerOf2,heightPowerOf2, + format,type, + 0,0,levels,data); +} /* gluBuild2DMipmaps() */ + +#if 0 +/* +** This routine is for the limited case in which +** type == GL_UNSIGNED_BYTE && format != index && +** unpack_alignment = 1 && unpack_swap_bytes == false +** +** so all of the work data can be kept as ubytes instead of shorts. +*/ +static int fastBuild2DMipmaps(const PixelStorageModes *psm, + GLenum target, GLint components, GLint width, + GLint height, GLenum format, + GLenum type, void *data) +{ + GLint newwidth, newheight; + GLint level, levels; + GLubyte *newImage; + GLint newImage_width; + GLint newImage_height; + GLubyte *otherImage; + GLubyte *imageTemp; + GLint memreq; + GLint cmpts; + + +#if 0 + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxsize); + newwidth = nearestPower(width); + if (newwidth > maxsize) newwidth = maxsize; + newheight = nearestPower(height); + if (newheight > maxsize) newheight = maxsize; +#else + closestFit(target,width,height,components,format,type, + &newwidth,&newheight); +#endif + levels = computeLog(newwidth); + level = computeLog(newheight); + if (level > levels) levels=level; + + cmpts = elements_per_group(format,type); + + otherImage = NULL; + /** + ** No need to copy the user data if its in the packed correctly. + ** Make sure that later routines don't change that data. + */ + if (psm->unpack_skip_rows == 0 && psm->unpack_skip_pixels == 0) { + newImage = (GLubyte *)data; + newImage_width = width; + newImage_height = height; + } else { + GLint rowsize; + GLint groups_per_line; + GLint elements_per_line; + const GLubyte *start; + const GLubyte *iter; + GLubyte *iter2; + GLint i, j; + + newImage = (GLubyte *) + malloc(image_size(width, height, format, GL_UNSIGNED_BYTE)); + newImage_width = width; + newImage_height = height; + if (newImage == NULL) { + return GLU_OUT_OF_MEMORY; + } + + /* + ** Abbreviated version of fill_image for this restricted case. + */ + if (psm->unpack_row_length > 0) { + groups_per_line = psm->unpack_row_length; + } else { + groups_per_line = width; + } + rowsize = groups_per_line * cmpts; + elements_per_line = width * cmpts; + start = (const GLubyte *) data + psm->unpack_skip_rows * rowsize + + psm->unpack_skip_pixels * cmpts; + iter2 = newImage; + + for (i = 0; i < height; i++) { + iter = start; + for (j = 0; j < elements_per_line; j++) { + *iter2 = *iter; + iter++; + iter2++; + } + start += rowsize; + } + } + + + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); + + for (level = 0; level <= levels; level++) { + if (newImage_width == newwidth && newImage_height == newheight) { + /* Use newImage for this level */ + glTexImage2D(target, level, components, newImage_width, + newImage_height, 0, format, GL_UNSIGNED_BYTE, + (void *) newImage); + } else { + if (otherImage == NULL) { + memreq = + image_size(newwidth, newheight, format, GL_UNSIGNED_BYTE); + otherImage = (GLubyte *) malloc(memreq); + if (otherImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm->unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm->unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm->unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH,psm->unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES,psm->unpack_swap_bytes); + return GLU_OUT_OF_MEMORY; + } + } +/* + scale_internal_ubyte(cmpts, newImage_width, newImage_height, + newImage, newwidth, newheight, otherImage); +*/ + /* Swap newImage and otherImage */ + imageTemp = otherImage; + otherImage = newImage; + newImage = imageTemp; + + newImage_width = newwidth; + newImage_height = newheight; + glTexImage2D(target, level, components, newImage_width, + newImage_height, 0, format, GL_UNSIGNED_BYTE, + (void *) newImage); + } + if (newwidth > 1) newwidth /= 2; + if (newheight > 1) newheight /= 2; + } + glPixelStorei(GL_UNPACK_ALIGNMENT, psm->unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm->unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm->unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm->unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm->unpack_swap_bytes); + + if (newImage != (const GLubyte *)data) { + free((GLbyte *) newImage); + } + if (otherImage && otherImage != (const GLubyte *)data) { + free((GLbyte *) otherImage); + } + return 0; +} +#endif + +/* + * Utility Routines + */ +static GLint elements_per_group(GLenum format, GLenum type) +{ + /* + * Return the number of elements per group of a specified format + */ + + /* If the type is packedpixels then answer is 1 (ignore format) */ + if (type == GL_UNSIGNED_BYTE_3_3_2 || + type == GL_UNSIGNED_BYTE_2_3_3_REV || + type == GL_UNSIGNED_SHORT_5_6_5 || + type == GL_UNSIGNED_SHORT_5_6_5_REV || + type == GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL_UNSIGNED_SHORT_4_4_4_4_REV || + type == GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL_UNSIGNED_SHORT_1_5_5_5_REV || + type == GL_UNSIGNED_INT_8_8_8_8 || + type == GL_UNSIGNED_INT_8_8_8_8_REV || + type == GL_UNSIGNED_INT_10_10_10_2 || + type == GL_UNSIGNED_INT_2_10_10_10_REV) { + return 1; + } + + /* Types are not packed pixels, so get elements per group */ + switch(format) { + case GL_RGB: + case GL_BGR: + return 3; + case GL_LUMINANCE_ALPHA: + return 2; + case GL_RGBA: + case GL_BGRA: + return 4; + default: + return 1; + } +} + +static GLfloat bytes_per_element(GLenum type) +{ + /* + * Return the number of bytes per element, based on the element type + */ + switch(type) { + case GL_BITMAP: + return 1.0 / 8.0; + case GL_UNSIGNED_SHORT: + return(sizeof(GLushort)); + case GL_SHORT: + return(sizeof(GLshort)); + case GL_UNSIGNED_BYTE: + return(sizeof(GLubyte)); + case GL_BYTE: + return(sizeof(GLbyte)); + case GL_INT: + return(sizeof(GLint)); + case GL_UNSIGNED_INT: + return(sizeof(GLuint)); + case GL_FLOAT: + return(sizeof(GLfloat)); + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + return(sizeof(GLubyte)); + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + return(sizeof(GLushort)); + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + return(sizeof(GLuint)); + default: + return 4; + } +} + +static GLint is_index(GLenum format) +{ + return format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX; +} + +/* +** Compute memory required for internal packed array of data of given type +** and format. +*/ +static GLint image_size(GLint width, GLint height, GLenum format, GLenum type) +{ + int bytes_per_row; + int components; + +assert(width > 0); +assert(height > 0); + components = elements_per_group(format,type); + if (type == GL_BITMAP) { + bytes_per_row = (width + 7) / 8; + } else { + bytes_per_row = bytes_per_element(type) * width; + } + return bytes_per_row * height * components; +} + +/* +** Extract array from user's data applying all pixel store modes. +** The internal format used is an array of unsigned shorts. +*/ +static void fill_image(const PixelStorageModes *psm, + GLint width, GLint height, GLenum format, + GLenum type, GLboolean index_format, + const void *userdata, GLushort *newimage) +{ + GLint components; + GLint element_size; + GLint rowsize; + GLint padding; + GLint groups_per_line; + GLint group_size; + GLint elements_per_line; + const GLubyte *start; + const GLubyte *iter; + GLushort *iter2; + GLint i, j, k; + GLint myswap_bytes; + + myswap_bytes = psm->unpack_swap_bytes; + components = elements_per_group(format,type); + if (psm->unpack_row_length > 0) { + groups_per_line = psm->unpack_row_length; + } else { + groups_per_line = width; + } + + /* All formats except GL_BITMAP fall out trivially */ + if (type == GL_BITMAP) { + GLint bit_offset; + GLint current_bit; + + rowsize = (groups_per_line * components + 7) / 8; + padding = (rowsize % psm->unpack_alignment); + if (padding) { + rowsize += psm->unpack_alignment - padding; + } + start = (const GLubyte *) userdata + psm->unpack_skip_rows * rowsize + + (psm->unpack_skip_pixels * components / 8); + elements_per_line = width * components; + iter2 = newimage; + for (i = 0; i < height; i++) { + iter = start; + bit_offset = (psm->unpack_skip_pixels * components) % 8; + for (j = 0; j < elements_per_line; j++) { + /* Retrieve bit */ + if (psm->unpack_lsb_first) { + current_bit = iter[0] & (1 << bit_offset); + } else { + current_bit = iter[0] & (1 << (7 - bit_offset)); + } + if (current_bit) { + if (index_format) { + *iter2 = 1; + } else { + *iter2 = 65535; + } + } else { + *iter2 = 0; + } + bit_offset++; + if (bit_offset == 8) { + bit_offset = 0; + iter++; + } + iter2++; + } + start += rowsize; + } + } else { + element_size = bytes_per_element(type); + group_size = element_size * components; + if (element_size == 1) myswap_bytes = 0; + + rowsize = groups_per_line * group_size; + padding = (rowsize % psm->unpack_alignment); + if (padding) { + rowsize += psm->unpack_alignment - padding; + } + start = (const GLubyte *) userdata + psm->unpack_skip_rows * rowsize + + psm->unpack_skip_pixels * group_size; + elements_per_line = width * components; + + iter2 = newimage; + for (i = 0; i < height; i++) { + iter = start; + for (j = 0; j < elements_per_line; j++) { + Type_Widget widget; + float extractComponents[4]; + + switch(type) { + case GL_UNSIGNED_BYTE_3_3_2: + extract332(0,iter,extractComponents); + for (k = 0; k < 3; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + extract233rev(0,iter,extractComponents); + for (k = 0; k < 3; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_BYTE: + if (index_format) { + *iter2++ = *iter; + } else { + *iter2++ = (*iter) * 257; + } + break; + case GL_BYTE: + if (index_format) { + *iter2++ = *((const GLbyte *) iter); + } else { + /* rough approx */ + *iter2++ = (*((const GLbyte *) iter)) * 516; + } + break; + case GL_UNSIGNED_SHORT_5_6_5: + extract565(myswap_bytes,iter,extractComponents); + for (k = 0; k < 3; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + extract565rev(myswap_bytes,iter,extractComponents); + for (k = 0; k < 3; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + extract4444(myswap_bytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + extract4444rev(myswap_bytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + extract5551(myswap_bytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + extract1555rev(myswap_bytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT: + case GL_SHORT: + if (myswap_bytes) { + widget.ub[0] = iter[1]; + widget.ub[1] = iter[0]; + } else { + widget.ub[0] = iter[0]; + widget.ub[1] = iter[1]; + } + if (type == GL_SHORT) { + if (index_format) { + *iter2++ = widget.s[0]; + } else { + /* rough approx */ + *iter2++ = widget.s[0]*2; + } + } else { + *iter2++ = widget.us[0]; + } + break; + case GL_UNSIGNED_INT_8_8_8_8: + extract8888(myswap_bytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + extract8888rev(myswap_bytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_INT_10_10_10_2: + extract1010102(myswap_bytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + extract2101010rev(myswap_bytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + if (myswap_bytes) { + widget.ub[0] = iter[3]; + widget.ub[1] = iter[2]; + widget.ub[2] = iter[1]; + widget.ub[3] = iter[0]; + } else { + widget.ub[0] = iter[0]; + widget.ub[1] = iter[1]; + widget.ub[2] = iter[2]; + widget.ub[3] = iter[3]; + } + if (type == GL_FLOAT) { + if (index_format) { + *iter2++ = widget.f; + } else { + *iter2++ = 65535 * widget.f; + } + } else if (type == GL_UNSIGNED_INT) { + if (index_format) { + *iter2++ = widget.ui; + } else { + *iter2++ = widget.ui >> 16; + } + } else { + if (index_format) { + *iter2++ = widget.i; + } else { + *iter2++ = widget.i >> 15; + } + } + break; + } + iter += element_size; + } /* for j */ + start += rowsize; +#if 1 + /* want 'iter' pointing at start, not within, row for assertion + * purposes + */ + iter= start; +#endif + } /* for i */ + + /* iterators should be one byte past end */ + if (!isTypePackedPixel(type)) { + assert(iter2 == &newimage[width*height*components]); + } + else { + assert(iter2 == &newimage[width*height* + elements_per_group(format,0)]); + } + assert( iter == &((const GLubyte *)userdata)[rowsize*height + + psm->unpack_skip_rows * rowsize + + psm->unpack_skip_pixels * group_size] ); + + } /* else */ +} /* fill_image() */ + +/* +** Insert array into user's data applying all pixel store modes. +** The internal format is an array of unsigned shorts. +** empty_image() because it is the opposite of fill_image(). +*/ +static void empty_image(const PixelStorageModes *psm, + GLint width, GLint height, GLenum format, + GLenum type, GLboolean index_format, + const GLushort *oldimage, void *userdata) +{ + GLint components; + GLint element_size; + GLint rowsize; + GLint padding; + GLint groups_per_line; + GLint group_size; + GLint elements_per_line; + GLubyte *start; + GLubyte *iter; + const GLushort *iter2; + GLint i, j, k; + GLint myswap_bytes; + + myswap_bytes = psm->pack_swap_bytes; + components = elements_per_group(format,type); + if (psm->pack_row_length > 0) { + groups_per_line = psm->pack_row_length; + } else { + groups_per_line = width; + } + + /* All formats except GL_BITMAP fall out trivially */ + if (type == GL_BITMAP) { + GLint bit_offset; + GLint current_bit; + + rowsize = (groups_per_line * components + 7) / 8; + padding = (rowsize % psm->pack_alignment); + if (padding) { + rowsize += psm->pack_alignment - padding; + } + start = (GLubyte *) userdata + psm->pack_skip_rows * rowsize + + (psm->pack_skip_pixels * components / 8); + elements_per_line = width * components; + iter2 = oldimage; + for (i = 0; i < height; i++) { + iter = start; + bit_offset = (psm->pack_skip_pixels * components) % 8; + for (j = 0; j < elements_per_line; j++) { + if (index_format) { + current_bit = iter2[0] & 1; + } else { + if (iter2[0] > 32767) { + current_bit = 1; + } else { + current_bit = 0; + } + } + + if (current_bit) { + if (psm->pack_lsb_first) { + *iter |= (1 << bit_offset); + } else { + *iter |= (1 << (7 - bit_offset)); + } + } else { + if (psm->pack_lsb_first) { + *iter &= ~(1 << bit_offset); + } else { + *iter &= ~(1 << (7 - bit_offset)); + } + } + + bit_offset++; + if (bit_offset == 8) { + bit_offset = 0; + iter++; + } + iter2++; + } + start += rowsize; + } + } else { + float shoveComponents[4]; + + element_size = bytes_per_element(type); + group_size = element_size * components; + if (element_size == 1) myswap_bytes = 0; + + rowsize = groups_per_line * group_size; + padding = (rowsize % psm->pack_alignment); + if (padding) { + rowsize += psm->pack_alignment - padding; + } + start = (GLubyte *) userdata + psm->pack_skip_rows * rowsize + + psm->pack_skip_pixels * group_size; + elements_per_line = width * components; + + iter2 = oldimage; + for (i = 0; i < height; i++) { + iter = start; + for (j = 0; j < elements_per_line; j++) { + Type_Widget widget; + + switch(type) { + case GL_UNSIGNED_BYTE_3_3_2: + for (k = 0; k < 3; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove332(shoveComponents,0,(void *)iter); + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + for (k = 0; k < 3; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove233rev(shoveComponents,0,(void *)iter); + break; + case GL_UNSIGNED_BYTE: + if (index_format) { + *iter = *iter2++; + } else { + *iter = *iter2++ >> 8; + } + break; + case GL_BYTE: + if (index_format) { + *((GLbyte *) iter) = *iter2++; + } else { + *((GLbyte *) iter) = *iter2++ >> 9; + } + break; + case GL_UNSIGNED_SHORT_5_6_5: + for (k = 0; k < 3; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove565(shoveComponents,0,(void *)&widget.us[0]); + if (myswap_bytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } + else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + for (k = 0; k < 3; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove565rev(shoveComponents,0,(void *)&widget.us[0]); + if (myswap_bytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } + else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove4444(shoveComponents,0,(void *)&widget.us[0]); + if (myswap_bytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove4444rev(shoveComponents,0,(void *)&widget.us[0]); + if (myswap_bytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove5551(shoveComponents,0,(void *)&widget.us[0]); + if (myswap_bytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove1555rev(shoveComponents,0,(void *)&widget.us[0]); + if (myswap_bytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT: + case GL_SHORT: + if (type == GL_SHORT) { + if (index_format) { + widget.s[0] = *iter2++; + } else { + widget.s[0] = *iter2++ >> 1; + } + } else { + widget.us[0] = *iter2++; + } + if (myswap_bytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + iter[0] = widget.ub[0]; + iter[1] = widget.ub[1]; + } + break; + case GL_UNSIGNED_INT_8_8_8_8: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove8888(shoveComponents,0,(void *)&widget.ui); + if (myswap_bytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + *(GLuint *)iter= widget.ui; + } + + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove8888rev(shoveComponents,0,(void *)&widget.ui); + if (myswap_bytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + *(GLuint *)iter= widget.ui; + } + break; + case GL_UNSIGNED_INT_10_10_10_2: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove1010102(shoveComponents,0,(void *)&widget.ui); + if (myswap_bytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + *(GLuint *)iter= widget.ui; + } + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove2101010rev(shoveComponents,0,(void *)&widget.ui); + if (myswap_bytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + *(GLuint *)iter= widget.ui; + } + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + if (type == GL_FLOAT) { + if (index_format) { + widget.f = *iter2++; + } else { + widget.f = *iter2++ / (float) 65535.0; + } + } else if (type == GL_UNSIGNED_INT) { + if (index_format) { + widget.ui = *iter2++; + } else { + widget.ui = (unsigned int) *iter2++ * 65537; + } + } else { + if (index_format) { + widget.i = *iter2++; + } else { + widget.i = ((unsigned int) *iter2++ * 65537)/2; + } + } + if (myswap_bytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + iter[0] = widget.ub[0]; + iter[1] = widget.ub[1]; + iter[2] = widget.ub[2]; + iter[3] = widget.ub[3]; + } + break; + } + iter += element_size; + } /* for j */ + start += rowsize; +#if 1 + /* want 'iter' pointing at start, not within, row for assertion + * purposes + */ + iter= start; +#endif + } /* for i */ + + /* iterators should be one byte past end */ + if (!isTypePackedPixel(type)) { + assert(iter2 == &oldimage[width*height*components]); + } + else { + assert(iter2 == &oldimage[width*height* + elements_per_group(format,0)]); + } + assert( iter == &((GLubyte *)userdata)[rowsize*height + + psm->pack_skip_rows * rowsize + + psm->pack_skip_pixels * group_size] ); + + } /* else */ +} /* empty_image() */ + +/*-------------------------------------------------------------------------- + * Decimation of packed pixel types + *-------------------------------------------------------------------------- + */ +static void extract332(int isSwap, + const void *packedPixel, GLfloat extractComponents[]) +{ + GLubyte ubyte= *(const GLubyte *)packedPixel; + + isSwap= isSwap; /* turn off warnings */ + + /* 11100000 == 0xe0 */ + /* 00011100 == 0x1c */ + /* 00000011 == 0x03 */ + + extractComponents[0]= (float)((ubyte & 0xe0) >> 5) / 7.0; + extractComponents[1]= (float)((ubyte & 0x1c) >> 2) / 7.0; /* 7 = 2^3-1 */ + extractComponents[2]= (float)((ubyte & 0x03) ) / 3.0; /* 3 = 2^2-1 */ +} /* extract332() */ + +static void shove332(const GLfloat shoveComponents[], + int index, void *packedPixel) +{ + /* 11100000 == 0xe0 */ + /* 00011100 == 0x1c */ + /* 00000011 == 0x03 */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLubyte *)packedPixel)[index] = + ((GLubyte)((shoveComponents[0] * 7)+0.5) << 5) & 0xe0; + ((GLubyte *)packedPixel)[index] |= + ((GLubyte)((shoveComponents[1] * 7)+0.5) << 2) & 0x1c; + ((GLubyte *)packedPixel)[index] |= + ((GLubyte)((shoveComponents[2] * 3)+0.5) ) & 0x03; +} /* shove332() */ + +static void extract233rev(int isSwap, + const void *packedPixel, GLfloat extractComponents[]) +{ + GLubyte ubyte= *(const GLubyte *)packedPixel; + + isSwap= isSwap; /* turn off warnings */ + + /* 0000,0111 == 0x07 */ + /* 0011,1000 == 0x38 */ + /* 1100,0000 == 0xC0 */ + + extractComponents[0]= (float)((ubyte & 0x07) ) / 7.0; + extractComponents[1]= (float)((ubyte & 0x38) >> 3) / 7.0; + extractComponents[2]= (float)((ubyte & 0xC0) >> 6) / 3.0; +} /* extract233rev() */ + +static void shove233rev(const GLfloat shoveComponents[], + int index, void *packedPixel) +{ + /* 0000,0111 == 0x07 */ + /* 0011,1000 == 0x38 */ + /* 1100,0000 == 0xC0 */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLubyte *)packedPixel)[index] = + ((GLubyte)((shoveComponents[0] * 7.0)+0.5) ) & 0x07; + ((GLubyte *)packedPixel)[index]|= + ((GLubyte)((shoveComponents[1] * 7.0)+0.5) << 3) & 0x38; + ((GLubyte *)packedPixel)[index]|= + ((GLubyte)((shoveComponents[2] * 3.0)+0.5) << 6) & 0xC0; +} /* shove233rev() */ + +static void extract565(int isSwap, + const void *packedPixel, GLfloat extractComponents[]) +{ + GLushort ushort= *(const GLushort *)packedPixel; + + if (isSwap) { + ushort= __GLU_SWAP_2_BYTES(packedPixel); + } + else { + ushort= *(const GLushort *)packedPixel; + } + + /* 11111000,00000000 == 0xf800 */ + /* 00000111,11100000 == 0x07e0 */ + /* 00000000,00011111 == 0x001f */ + + extractComponents[0]=(float)((ushort & 0xf800) >> 11) / 31.0;/* 31 = 2^5-1*/ + extractComponents[1]=(float)((ushort & 0x07e0) >> 5) / 63.0;/* 63 = 2^6-1*/ + extractComponents[2]=(float)((ushort & 0x001f) ) / 31.0; +} /* extract565() */ + +static void shove565(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + /* 11111000,00000000 == 0xf800 */ + /* 00000111,11100000 == 0x07e0 */ + /* 00000000,00011111 == 0x001f */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLushort *)packedPixel)[index] = + ((GLushort)((shoveComponents[0] * 31)+0.5) << 11) & 0xf800; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[1] * 63)+0.5) << 5) & 0x07e0; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[2] * 31)+0.5) ) & 0x001f; +} /* shove565() */ + +static void extract565rev(int isSwap, + const void *packedPixel, GLfloat extractComponents[]) +{ + GLushort ushort= *(const GLushort *)packedPixel; + + if (isSwap) { + ushort= __GLU_SWAP_2_BYTES(packedPixel); + } + else { + ushort= *(const GLushort *)packedPixel; + } + + /* 00000000,00011111 == 0x001f */ + /* 00000111,11100000 == 0x07e0 */ + /* 11111000,00000000 == 0xf800 */ + + extractComponents[0]= (float)((ushort & 0x001F) ) / 31.0; + extractComponents[1]= (float)((ushort & 0x07E0) >> 5) / 63.0; + extractComponents[2]= (float)((ushort & 0xF800) >> 11) / 31.0; +} /* extract565rev() */ + +static void shove565rev(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + /* 00000000,00011111 == 0x001f */ + /* 00000111,11100000 == 0x07e0 */ + /* 11111000,00000000 == 0xf800 */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLushort *)packedPixel)[index] = + ((GLushort)((shoveComponents[0] * 31.0)+0.5) ) & 0x001F; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[1] * 63.0)+0.5) << 5) & 0x07E0; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[2] * 31.0)+0.5) << 11) & 0xF800; +} /* shove565rev() */ + +static void extract4444(int isSwap,const void *packedPixel, + GLfloat extractComponents[]) +{ + GLushort ushort; + + if (isSwap) { + ushort= __GLU_SWAP_2_BYTES(packedPixel); + } + else { + ushort= *(const GLushort *)packedPixel; + } + + /* 11110000,00000000 == 0xf000 */ + /* 00001111,00000000 == 0x0f00 */ + /* 00000000,11110000 == 0x00f0 */ + /* 00000000,00001111 == 0x000f */ + + extractComponents[0]= (float)((ushort & 0xf000) >> 12) / 15.0;/* 15=2^4-1 */ + extractComponents[1]= (float)((ushort & 0x0f00) >> 8) / 15.0; + extractComponents[2]= (float)((ushort & 0x00f0) >> 4) / 15.0; + extractComponents[3]= (float)((ushort & 0x000f) ) / 15.0; +} /* extract4444() */ + +static void shove4444(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLushort *)packedPixel)[index] = + ((GLushort)((shoveComponents[0] * 15)+0.5) << 12) & 0xf000; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[1] * 15)+0.5) << 8) & 0x0f00; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[2] * 15)+0.5) << 4) & 0x00f0; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[3] * 15)+0.5) ) & 0x000f; +} /* shove4444() */ + +static void extract4444rev(int isSwap,const void *packedPixel, + GLfloat extractComponents[]) +{ + GLushort ushort; + + if (isSwap) { + ushort= __GLU_SWAP_2_BYTES(packedPixel); + } + else { + ushort= *(const GLushort *)packedPixel; + } + + /* 00000000,00001111 == 0x000f */ + /* 00000000,11110000 == 0x00f0 */ + /* 00001111,00000000 == 0x0f00 */ + /* 11110000,00000000 == 0xf000 */ + + /* 15 = 2^4-1 */ + extractComponents[0]= (float)((ushort & 0x000F) ) / 15.0; + extractComponents[1]= (float)((ushort & 0x00F0) >> 4) / 15.0; + extractComponents[2]= (float)((ushort & 0x0F00) >> 8) / 15.0; + extractComponents[3]= (float)((ushort & 0xF000) >> 12) / 15.0; +} /* extract4444rev() */ + +static void shove4444rev(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + /* 00000000,00001111 == 0x000f */ + /* 00000000,11110000 == 0x00f0 */ + /* 00001111,00000000 == 0x0f00 */ + /* 11110000,00000000 == 0xf000 */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLushort *)packedPixel)[index] = + ((GLushort)((shoveComponents[0] * 15)+0.5) ) & 0x000F; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[1] * 15)+0.5) << 4) & 0x00F0; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[2] * 15)+0.5) << 8) & 0x0F00; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[3] * 15)+0.5) << 12) & 0xF000; +} /* shove4444rev() */ + +static void extract5551(int isSwap,const void *packedPixel, + GLfloat extractComponents[]) +{ + GLushort ushort; + + if (isSwap) { + ushort= __GLU_SWAP_2_BYTES(packedPixel); + } + else { + ushort= *(const GLushort *)packedPixel; + } + + /* 11111000,00000000 == 0xf800 */ + /* 00000111,11000000 == 0x07c0 */ + /* 00000000,00111110 == 0x003e */ + /* 00000000,00000001 == 0x0001 */ + + extractComponents[0]=(float)((ushort & 0xf800) >> 11) / 31.0;/* 31 = 2^5-1*/ + extractComponents[1]=(float)((ushort & 0x07c0) >> 6) / 31.0; + extractComponents[2]=(float)((ushort & 0x003e) >> 1) / 31.0; + extractComponents[3]=(float)((ushort & 0x0001) ); +} /* extract5551() */ + +static void shove5551(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + /* 11111000,00000000 == 0xf800 */ + /* 00000111,11000000 == 0x07c0 */ + /* 00000000,00111110 == 0x003e */ + /* 00000000,00000001 == 0x0001 */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLushort *)packedPixel)[index] = + ((GLushort)((shoveComponents[0] * 31)+0.5) << 11) & 0xf800; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[1] * 31)+0.5) << 6) & 0x07c0; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[2] * 31)+0.5) << 1) & 0x003e; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[3])+0.5) ) & 0x0001; +} /* shove5551() */ + +static void extract1555rev(int isSwap,const void *packedPixel, + GLfloat extractComponents[]) +{ + GLushort ushort; + + if (isSwap) { + ushort= __GLU_SWAP_2_BYTES(packedPixel); + } + else { + ushort= *(const GLushort *)packedPixel; + } + + /* 00000000,00011111 == 0x001F */ + /* 00000011,11100000 == 0x03E0 */ + /* 01111100,00000000 == 0x7C00 */ + /* 10000000,00000000 == 0x8000 */ + + /* 31 = 2^5-1 */ + extractComponents[0]= (float)((ushort & 0x001F) ) / 31.0; + extractComponents[1]= (float)((ushort & 0x03E0) >> 5) / 31.0; + extractComponents[2]= (float)((ushort & 0x7C00) >> 10) / 31.0; + extractComponents[3]= (float)((ushort & 0x8000) >> 15); +} /* extract1555rev() */ + +static void shove1555rev(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + /* 00000000,00011111 == 0x001F */ + /* 00000011,11100000 == 0x03E0 */ + /* 01111100,00000000 == 0x7C00 */ + /* 10000000,00000000 == 0x8000 */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLushort *)packedPixel)[index] = + ((GLushort)((shoveComponents[0] * 31)+0.5) ) & 0x001F; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[1] * 31)+0.5) << 5) & 0x03E0; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[2] * 31)+0.5) << 10) & 0x7C00; + ((GLushort *)packedPixel)[index]|= + ((GLushort)((shoveComponents[3])+0.5) << 15) & 0x8000; +} /* shove1555rev() */ + +static void extract8888(int isSwap, + const void *packedPixel, GLfloat extractComponents[]) +{ + GLuint uint; + + if (isSwap) { + uint= __GLU_SWAP_4_BYTES(packedPixel); + } + else { + uint= *(const GLuint *)packedPixel; + } + + /* 11111111,00000000,00000000,00000000 == 0xff000000 */ + /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ + /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ + /* 00000000,00000000,00000000,11111111 == 0x000000ff */ + + /* 255 = 2^8-1 */ + extractComponents[0]= (float)((uint & 0xff000000) >> 24) / 255.0; + extractComponents[1]= (float)((uint & 0x00ff0000) >> 16) / 255.0; + extractComponents[2]= (float)((uint & 0x0000ff00) >> 8) / 255.0; + extractComponents[3]= (float)((uint & 0x000000ff) ) / 255.0; +} /* extract8888() */ + +static void shove8888(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + /* 11111111,00000000,00000000,00000000 == 0xff000000 */ + /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ + /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ + /* 00000000,00000000,00000000,11111111 == 0x000000ff */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLuint *)packedPixel)[index] = + ((GLuint)((shoveComponents[0] * 255)+0.5) << 24) & 0xff000000; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[1] * 255)+0.5) << 16) & 0x00ff0000; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[2] * 255)+0.5) << 8) & 0x0000ff00; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[3] * 255)+0.5) ) & 0x000000ff; +} /* shove8888() */ + +static void extract8888rev(int isSwap, + const void *packedPixel,GLfloat extractComponents[]) +{ + GLuint uint; + + if (isSwap) { + uint= __GLU_SWAP_4_BYTES(packedPixel); + } + else { + uint= *(const GLuint *)packedPixel; + } + + /* 00000000,00000000,00000000,11111111 == 0x000000ff */ + /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ + /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ + /* 11111111,00000000,00000000,00000000 == 0xff000000 */ + + /* 255 = 2^8-1 */ + extractComponents[0]= (float)((uint & 0x000000FF) ) / 255.0; + extractComponents[1]= (float)((uint & 0x0000FF00) >> 8) / 255.0; + extractComponents[2]= (float)((uint & 0x00FF0000) >> 16) / 255.0; + extractComponents[3]= (float)((uint & 0xFF000000) >> 24) / 255.0; +} /* extract8888rev() */ + +static void shove8888rev(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + /* 00000000,00000000,00000000,11111111 == 0x000000ff */ + /* 00000000,00000000,11111111,00000000 == 0x0000ff00 */ + /* 00000000,11111111,00000000,00000000 == 0x00ff0000 */ + /* 11111111,00000000,00000000,00000000 == 0xff000000 */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLuint *)packedPixel)[index] = + ((GLuint)((shoveComponents[0] * 255)+0.5) ) & 0x000000FF; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[1] * 255)+0.5) << 8) & 0x0000FF00; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[2] * 255)+0.5) << 16) & 0x00FF0000; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[3] * 255)+0.5) << 24) & 0xFF000000; +} /* shove8888rev() */ + +static void extract1010102(int isSwap, + const void *packedPixel,GLfloat extractComponents[]) +{ + GLuint uint; + + if (isSwap) { + uint= __GLU_SWAP_4_BYTES(packedPixel); + } + else { + uint= *(const GLuint *)packedPixel; + } + + /* 11111111,11000000,00000000,00000000 == 0xffc00000 */ + /* 00000000,00111111,11110000,00000000 == 0x003ff000 */ + /* 00000000,00000000,00001111,11111100 == 0x00000ffc */ + /* 00000000,00000000,00000000,00000011 == 0x00000003 */ + + /* 1023 = 2^10-1 */ + extractComponents[0]= (float)((uint & 0xffc00000) >> 22) / 1023.0; + extractComponents[1]= (float)((uint & 0x003ff000) >> 12) / 1023.0; + extractComponents[2]= (float)((uint & 0x00000ffc) >> 2) / 1023.0; + extractComponents[3]= (float)((uint & 0x00000003) ) / 3.0; +} /* extract1010102() */ + +static void shove1010102(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + /* 11111111,11000000,00000000,00000000 == 0xffc00000 */ + /* 00000000,00111111,11110000,00000000 == 0x003ff000 */ + /* 00000000,00000000,00001111,11111100 == 0x00000ffc */ + /* 00000000,00000000,00000000,00000011 == 0x00000003 */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLuint *)packedPixel)[index] = + ((GLuint)((shoveComponents[0] * 1023)+0.5) << 22) & 0xffc00000; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[1] * 1023)+0.5) << 12) & 0x003ff000; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[2] * 1023)+0.5) << 2) & 0x00000ffc; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[3] * 3)+0.5) ) & 0x00000003; +} /* shove1010102() */ + +static void extract2101010rev(int isSwap, + const void *packedPixel, + GLfloat extractComponents[]) +{ + GLuint uint; + + if (isSwap) { + uint= __GLU_SWAP_4_BYTES(packedPixel); + } + else { + uint= *(const GLuint *)packedPixel; + } + + /* 00000000,00000000,00000011,11111111 == 0x000003FF */ + /* 00000000,00001111,11111100,00000000 == 0x000FFC00 */ + /* 00111111,11110000,00000000,00000000 == 0x3FF00000 */ + /* 11000000,00000000,00000000,00000000 == 0xC0000000 */ + + /* 1023 = 2^10-1 */ + extractComponents[0]= (float)((uint & 0x000003FF) ) / 1023.0; + extractComponents[1]= (float)((uint & 0x000FFC00) >> 10) / 1023.0; + extractComponents[2]= (float)((uint & 0x3FF00000) >> 20) / 1023.0; + extractComponents[3]= (float)((uint & 0xC0000000) >> 30) / 3.0; + /* 3 = 2^2-1 */ +} /* extract2101010rev() */ + +static void shove2101010rev(const GLfloat shoveComponents[], + int index,void *packedPixel) +{ + /* 00000000,00000000,00000011,11111111 == 0x000003FF */ + /* 00000000,00001111,11111100,00000000 == 0x000FFC00 */ + /* 00111111,11110000,00000000,00000000 == 0x3FF00000 */ + /* 11000000,00000000,00000000,00000000 == 0xC0000000 */ + + assert(0.0 <= shoveComponents[0] && shoveComponents[0] <= 1.0); + assert(0.0 <= shoveComponents[1] && shoveComponents[1] <= 1.0); + assert(0.0 <= shoveComponents[2] && shoveComponents[2] <= 1.0); + assert(0.0 <= shoveComponents[3] && shoveComponents[3] <= 1.0); + + /* due to limited precision, need to round before shoving */ + ((GLuint *)packedPixel)[index] = + ((GLuint)((shoveComponents[0] * 1023)+0.5) ) & 0x000003FF; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[1] * 1023)+0.5) << 10) & 0x000FFC00; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[2] * 1023)+0.5) << 20) & 0x3FF00000; + ((GLuint *)packedPixel)[index]|= + ((GLuint)((shoveComponents[3] * 3)+0.5) << 30) & 0xC0000000; +} /* shove2101010rev() */ + +static void scaleInternalPackedPixel(int components, + void (*extractPackedPixel) + (int, const void *,GLfloat []), + void (*shovePackedPixel) + (const GLfloat [], int, void *), + GLint widthIn,GLint heightIn, + const void *dataIn, + GLint widthOut,GLint heightOut, + void *dataOut, + GLint pixelSizeInBytes, + GLint rowSizeInBytes,GLint isSwap) +{ + float convx; + float convy; + float percent; + + /* Max components in a format is 4, so... */ + float totals[4]; + float extractTotals[4], extractMoreTotals[4], shoveTotals[4]; + + float area; + int i,j,k,xindex; + + const char *temp, *temp0; + int outindex; + + int lowx_int, highx_int, lowy_int, highy_int; + float x_percent, y_percent; + float lowx_float, highx_float, lowy_float, highy_float; + float convy_float, convx_float; + int convy_int, convx_int; + int l, m; + const char *left, *right; + + if (widthIn == widthOut*2 && heightIn == heightOut*2) { + halveImagePackedPixel(components,extractPackedPixel,shovePackedPixel, + widthIn, heightIn, dataIn, dataOut, + pixelSizeInBytes,rowSizeInBytes,isSwap); + return; + } + convy = (float) heightIn/heightOut; + convx = (float) widthIn/widthOut; + convy_int = floor(convy); + convy_float = convy - convy_int; + convx_int = floor(convx); + convx_float = convx - convx_int; + + area = convx * convy; + + lowy_int = 0; + lowy_float = 0; + highy_int = convy_int; + highy_float = convy_float; + + for (i = 0; i < heightOut; i++) { + lowx_int = 0; + lowx_float = 0; + highx_int = convx_int; + highx_float = convx_float; + + for (j = 0; j < widthOut; j++) { + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy) + ** to (highx, highy) on input data into this pixel on output + ** data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + + /* calculate the value for pixels in the 1st row */ + xindex = lowx_int*pixelSizeInBytes; + if((highy_int>lowy_int) && (highx_int>lowx_int)) { + + y_percent = 1-lowy_float; + temp = (const char *)dataIn + xindex + lowy_int * rowSizeInBytes; + percent = y_percent * (1-lowx_float); +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * percent; + } +#endif + left = temp; + for(l = lowx_int+1; l < highx_int; l++) { + temp += pixelSizeInBytes; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * y_percent; + } +#endif + } + temp += pixelSizeInBytes; + right = temp; + percent = y_percent * highx_float; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * percent; + } +#endif + + /* calculate the value for pixels in the last row */ + + y_percent = highy_float; + percent = y_percent * (1-lowx_float); + temp = (const char *)dataIn + xindex + highy_int * rowSizeInBytes; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * percent; + } +#endif + for(l = lowx_int+1; l < highx_int; l++) { + temp += pixelSizeInBytes; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * y_percent; + } +#endif + + } + temp += pixelSizeInBytes; + percent = y_percent * highx_float; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * percent; + } +#endif + + /* calculate the value for pixels in the 1st and last column */ + for(m = lowy_int+1; m < highy_int; m++) { + left += rowSizeInBytes; + right += rowSizeInBytes; +#if 0 + for (k = 0; k < components; + k++, left += element_size, right += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(left) * (1-lowx_float) + + __GLU_SWAP_2_BYTES(right) * highx_float; + } else { + totals[k] += *(const GLushort*)left * (1-lowx_float) + + *(const GLushort*)right * highx_float; + } + } +#else + (*extractPackedPixel)(isSwap,left,extractTotals); + (*extractPackedPixel)(isSwap,right,extractMoreTotals); + for (k = 0; k < components; k++) { + totals[k]+= (extractTotals[k]*(1-lowx_float) + + extractMoreTotals[k]*highx_float); + } +#endif + } + } else if (highy_int > lowy_int) { + x_percent = highx_float - lowx_float; + percent = (1-lowy_float)*x_percent; + temp = (const char *)dataIn + xindex + lowy_int*rowSizeInBytes; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * percent; + } +#endif + for(m = lowy_int+1; m < highy_int; m++) { + temp += rowSizeInBytes; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * x_percent; + } else { + totals[k] += *(const GLushort*)temp_index * x_percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * x_percent; + } +#endif + } + percent = x_percent * highy_float; + temp += rowSizeInBytes; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * percent; + } +#endif + } else if (highx_int > lowx_int) { + y_percent = highy_float - lowy_float; + percent = (1-lowx_float)*y_percent; + temp = (const char *)dataIn + xindex + lowy_int*rowSizeInBytes; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * percent; + } +#endif + for (l = lowx_int+1; l < highx_int; l++) { + temp += pixelSizeInBytes; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += + __GLU_SWAP_2_BYTES(temp_index) * y_percent; + } else { + totals[k] += *(const GLushort*)temp_index * y_percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * y_percent; + } +#endif + } + temp += pixelSizeInBytes; + percent = y_percent * highx_float; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * percent; + } +#endif + } else { + percent = (highy_float-lowy_float)*(highx_float-lowx_float); + temp = (const char *)dataIn + xindex + lowy_int * rowSizeInBytes; +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index) * percent; + } else { + totals[k] += *(const GLushort*)temp_index * percent; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k] * percent; + } +#endif + } + + /* this is for the pixels in the body */ + temp0 = (const char *)dataIn + xindex + pixelSizeInBytes + (lowy_int+1)*rowSizeInBytes; + for (m = lowy_int+1; m < highy_int; m++) { + temp = temp0; + for(l = lowx_int+1; l < highx_int; l++) { +#if 0 + for (k = 0, temp_index = temp; k < components; + k++, temp_index += element_size) { + if (myswap_bytes) { + totals[k] += __GLU_SWAP_2_BYTES(temp_index); + } else { + totals[k] += *(const GLushort*)temp_index; + } + } +#else + (*extractPackedPixel)(isSwap,temp,extractTotals); + for (k = 0; k < components; k++) { + totals[k]+= extractTotals[k]; + } +#endif + temp += pixelSizeInBytes; + } + temp0 += rowSizeInBytes; + } + + outindex = (j + (i * widthOut)); /* * (components == 1) */ +#if 0 + for (k = 0; k < components; k++) { + dataout[outindex + k] = totals[k]/area; + /*printf("totals[%d] = %f\n", k, totals[k]);*/ + } +#else + for (k = 0; k < components; k++) { + shoveTotals[k]= totals[k]/area; + } + (*shovePackedPixel)(shoveTotals,outindex,(void *)dataOut); +#endif + lowx_int = highx_int; + lowx_float = highx_float; + highx_int += convx_int; + highx_float += convx_float; + if(highx_float > 1) { + highx_float -= 1.0; + highx_int++; + } + } + lowy_int = highy_int; + lowy_float = highy_float; + highy_int += convy_int; + highy_float += convy_float; + if(highy_float > 1) { + highy_float -= 1.0; + highy_int++; + } + } + + assert(outindex == (widthOut*heightOut - 1)); +} /* scaleInternalPackedPixel() */ + +/* rowSizeInBytes is at least the width (in bytes) due to padding on + * inputs; not always equal. Output NEVER has row padding. + */ +static void halveImagePackedPixel(int components, + void (*extractPackedPixel) + (int, const void *,GLfloat []), + void (*shovePackedPixel) + (const GLfloat [],int, void *), + GLint width, GLint height, + const void *dataIn, void *dataOut, + GLint pixelSizeInBytes, + GLint rowSizeInBytes, GLint isSwap) +{ + /* handle case where there is only 1 column/row */ + if (width == 1 || height == 1) { + assert(!(width == 1 && height == 1)); /* can't be 1x1 */ + halve1DimagePackedPixel(components,extractPackedPixel,shovePackedPixel, + width,height,dataIn,dataOut,pixelSizeInBytes, + rowSizeInBytes,isSwap); + return; + } + + { + int ii, jj; + + int halfWidth= width / 2; + int halfHeight= height / 2; + const char *src= (const char *) dataIn; + int padBytes= rowSizeInBytes - (width*pixelSizeInBytes); + int outIndex= 0; + + for (ii= 0; ii< halfHeight; ii++) { + for (jj= 0; jj< halfWidth; jj++) { +#define BOX4 4 + float totals[4]; /* 4 is maximum components */ + float extractTotals[BOX4][4]; /* 4 is maximum components */ + int cc; + + (*extractPackedPixel)(isSwap,src, + &extractTotals[0][0]); + (*extractPackedPixel)(isSwap,(src+pixelSizeInBytes), + &extractTotals[1][0]); + (*extractPackedPixel)(isSwap,(src+rowSizeInBytes), + &extractTotals[2][0]); + (*extractPackedPixel)(isSwap, + (src+rowSizeInBytes+pixelSizeInBytes), + &extractTotals[3][0]); + for (cc = 0; cc < components; cc++) { + int kk; + + /* grab 4 pixels to average */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ + * extractTotals[2][RED]+extractTotals[3][RED]; + * totals[RED]/= 4.0; + */ + for (kk = 0; kk < BOX4; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (float)BOX4; + } + (*shovePackedPixel)(totals,outIndex,dataOut); + + outIndex++; + /* skip over to next square of 4 */ + src+= pixelSizeInBytes + pixelSizeInBytes; + } + /* skip past pad bytes, if any, to get to next row */ + src+= padBytes; + + /* src is at beginning of a row here, but it's the second row of + * the square block of 4 pixels that we just worked on so we + * need to go one more row. + * i.e., + * OO... + * here -->OO... + * but want -->OO... + * OO... + * ... + */ + src+= rowSizeInBytes; + } + + /* both pointers must reach one byte after the end */ + assert(src == &((const char *)dataIn)[rowSizeInBytes*height]); + assert(outIndex == halfWidth * halfHeight); + } +} /* halveImagePackedPixel() */ + +static void halve1DimagePackedPixel(int components, + void (*extractPackedPixel) + (int, const void *,GLfloat []), + void (*shovePackedPixel) + (const GLfloat [],int, void *), + GLint width, GLint height, + const void *dataIn, void *dataOut, + GLint pixelSizeInBytes, + GLint rowSizeInBytes, GLint isSwap) +{ + int halfWidth= width / 2; + int halfHeight= height / 2; + const char *src= (const char *) dataIn; + int jj; + + assert(width == 1 || height == 1); /* must be 1D */ + assert(width != height); /* can't be square */ + + if (height == 1) { /* 1 row */ + int outIndex= 0; + + assert(width != 1); /* widthxheight can't be 1x1 */ + halfHeight= 1; + + /* one horizontal row with possible pad bytes */ + + for (jj= 0; jj< halfWidth; jj++) { +#define BOX2 2 + float totals[4]; /* 4 is maximum components */ + float extractTotals[BOX2][4]; /* 4 is maximum components */ + int cc; + + /* average two at a time, instead of four */ + (*extractPackedPixel)(isSwap,src, + &extractTotals[0][0]); + (*extractPackedPixel)(isSwap,(src+pixelSizeInBytes), + &extractTotals[1][0]); + for (cc = 0; cc < components; cc++) { + int kk; + + /* grab 2 pixels to average */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]; + * totals[RED]/= 2.0; + */ + for (kk = 0; kk < BOX2; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (float)BOX2; + } + (*shovePackedPixel)(totals,outIndex,dataOut); + + outIndex++; + /* skip over to next group of 2 */ + src+= pixelSizeInBytes + pixelSizeInBytes; + } + + { + int padBytes= rowSizeInBytes - (width*pixelSizeInBytes); + src+= padBytes; /* for assertion only */ + } + assert(src == &((const char *)dataIn)[rowSizeInBytes]); + assert(outIndex == halfWidth * halfHeight); + } + else if (width == 1) { /* 1 column */ + int outIndex= 0; + + assert(height != 1); /* widthxheight can't be 1x1 */ + halfWidth= 1; + /* one vertical column with possible pad bytes per row */ + /* average two at a time */ + + for (jj= 0; jj< halfHeight; jj++) { +#define BOX2 2 + float totals[4]; /* 4 is maximum components */ + float extractTotals[BOX2][4]; /* 4 is maximum components */ + int cc; + + /* average two at a time, instead of four */ + (*extractPackedPixel)(isSwap,src, + &extractTotals[0][0]); + (*extractPackedPixel)(isSwap,(src+rowSizeInBytes), + &extractTotals[1][0]); + for (cc = 0; cc < components; cc++) { + int kk; + + /* grab 2 pixels to average */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]; + * totals[RED]/= 2.0; + */ + for (kk = 0; kk < BOX2; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (float)BOX2; + } + (*shovePackedPixel)(totals,outIndex,dataOut); + + outIndex++; + src+= rowSizeInBytes + rowSizeInBytes; /* go to row after next */ + } + + assert(src == &((const char *)dataIn)[rowSizeInBytes*height]); + assert(outIndex == halfWidth * halfHeight); + } +} /* halve1DimagePackedPixel() */ + +/*===========================================================================*/ + +#ifdef RESOLVE_3D_TEXTURE_SUPPORT +/* + * This section ensures that GLU 1.3 will load and run on + * a GL 1.1 implementation. It dynamically resolves the + * call to glTexImage3D() which might not be available. + * Or is it might be supported as an extension. + * Contributed by Gerk Huisma . + */ + +typedef void (GLAPIENTRY *TexImage3Dproc)( GLenum target, GLint level, + GLenum internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ); + +static TexImage3Dproc pTexImage3D = 0; + +#if !defined(_WIN32) && !defined(__WIN32__) +# include +# include +#else + WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR); +#endif + +static void gluTexImage3D( GLenum target, GLint level, + GLenum internalFormat, + GLsizei width, GLsizei height, + GLsizei depth, GLint border, + GLenum format, GLenum type, + const GLvoid *pixels ) +{ + if (!pTexImage3D) { +#if defined(_WIN32) || defined(__WIN32__) + pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3D"); + if (!pTexImage3D) + pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3DEXT"); +#else + void *libHandle = dlopen("libgl.so", RTLD_LAZY); + pTexImage3D = TexImage3Dproc) dlsym(libHandle, "glTexImage3D" ); + if (!pTexImage3D) + pTexImage3D = (TexImage3Dproc) dlsym(libHandle,"glTexImage3DEXT"); + dlclose(libHandle); +#endif + } + + /* Now call glTexImage3D */ + if (pTexImage3D) + pTexImage3D(target, level, internalFormat, width, height, + depth, border, format, type, pixels); +} + +#else + +/* Only bind to a GL 1.2 implementation: */ +#define gluTexImage3D glTexImage3D + +#endif + +static GLint imageSize3D(GLint width, GLint height, GLint depth, + GLenum format, GLenum type) +{ + int components= elements_per_group(format,type); + int bytes_per_row= bytes_per_element(type) * width; + +assert(width > 0 && height > 0 && depth > 0); +assert(type != GL_BITMAP); + + return bytes_per_row * height * depth * components; +} /* imageSize3D() */ + +static void fillImage3D(const PixelStorageModes *psm, + GLint width, GLint height, GLint depth, GLenum format, + GLenum type, GLboolean indexFormat, + const void *userImage, GLushort *newImage) +{ + int myswapBytes; + int components; + int groupsPerLine; + int elementSize; + int groupSize; + int rowSize; + int padding; + int elementsPerLine; + int rowsPerImage; + int imageSize; + const GLubyte *start, *rowStart, *iter; + GLushort *iter2; + int ww, hh, dd, k; + + myswapBytes= psm->unpack_swap_bytes; + components= elements_per_group(format,type); + if (psm->unpack_row_length > 0) { + groupsPerLine= psm->unpack_row_length; + } + else { + groupsPerLine= width; + } + elementSize= bytes_per_element(type); + groupSize= elementSize * components; + if (elementSize == 1) myswapBytes= 0; + + /* 3dstuff begin */ + if (psm->unpack_image_height > 0) { + rowsPerImage= psm->unpack_image_height; + } + else { + rowsPerImage= height; + } + /* 3dstuff end */ + + rowSize= groupsPerLine * groupSize; + padding= rowSize % psm->unpack_alignment; + if (padding) { + rowSize+= psm->unpack_alignment - padding; + } + + imageSize= rowsPerImage * rowSize; /* 3dstuff */ + + start= (const GLubyte *)userImage + psm->unpack_skip_rows * rowSize + + psm->unpack_skip_pixels * groupSize + + /*3dstuff*/ + psm->unpack_skip_images * imageSize; + elementsPerLine = width * components; + + iter2= newImage; + for (dd= 0; dd < depth; dd++) { + rowStart= start; + + for (hh= 0; hh < height; hh++) { + iter= rowStart; + + for (ww= 0; ww < elementsPerLine; ww++) { + Type_Widget widget; + float extractComponents[4]; + + switch(type) { + case GL_UNSIGNED_BYTE: + if (indexFormat) { + *iter2++ = *iter; + } else { + *iter2++ = (*iter) * 257; + } + break; + case GL_BYTE: + if (indexFormat) { + *iter2++ = *((const GLbyte *) iter); + } else { + /* rough approx */ + *iter2++ = (*((const GLbyte *) iter)) * 516; + } + break; + case GL_UNSIGNED_BYTE_3_3_2: + extract332(0,iter,extractComponents); + for (k = 0; k < 3; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + extract233rev(0,iter,extractComponents); + for (k = 0; k < 3; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_5_6_5: + extract565(myswapBytes,iter,extractComponents); + for (k = 0; k < 3; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + extract565rev(myswapBytes,iter,extractComponents); + for (k = 0; k < 3; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + extract4444(myswapBytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + extract4444rev(myswapBytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + extract5551(myswapBytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + extract1555rev(myswapBytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_SHORT: + case GL_SHORT: + if (myswapBytes) { + widget.ub[0] = iter[1]; + widget.ub[1] = iter[0]; + } else { + widget.ub[0] = iter[0]; + widget.ub[1] = iter[1]; + } + if (type == GL_SHORT) { + if (indexFormat) { + *iter2++ = widget.s[0]; + } else { + /* rough approx */ + *iter2++ = widget.s[0]*2; + } + } else { + *iter2++ = widget.us[0]; + } + break; + case GL_UNSIGNED_INT_8_8_8_8: + extract8888(myswapBytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + extract8888rev(myswapBytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_INT_10_10_10_2: + extract1010102(myswapBytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + extract2101010rev(myswapBytes,iter,extractComponents); + for (k = 0; k < 4; k++) { + *iter2++ = (GLushort)(extractComponents[k]*65535); + } + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + if (myswapBytes) { + widget.ub[0] = iter[3]; + widget.ub[1] = iter[2]; + widget.ub[2] = iter[1]; + widget.ub[3] = iter[0]; + } else { + widget.ub[0] = iter[0]; + widget.ub[1] = iter[1]; + widget.ub[2] = iter[2]; + widget.ub[3] = iter[3]; + } + if (type == GL_FLOAT) { + if (indexFormat) { + *iter2++ = widget.f; + } else { + *iter2++ = 65535 * widget.f; + } + } else if (type == GL_UNSIGNED_INT) { + if (indexFormat) { + *iter2++ = widget.ui; + } else { + *iter2++ = widget.ui >> 16; + } + } else { + if (indexFormat) { + *iter2++ = widget.i; + } else { + *iter2++ = widget.i >> 15; + } + } + break; + default: + assert(0); + } + + iter+= elementSize; + } /* for ww */ + rowStart+= rowSize; + + iter= rowStart; /* for assertion purposes */ + } /* for hh */ + + start+= imageSize; + } /* for dd */ + + /* iterators should be one byte past end */ + if (!isTypePackedPixel(type)) { + assert(iter2 == &newImage[width*height*depth*components]); + } + else { + assert(iter2 == &newImage[width*height*depth* + elements_per_group(format,0)]); + } + assert( iter == &((const GLubyte *)userImage)[rowSize*height*depth + + psm->unpack_skip_rows * rowSize + + psm->unpack_skip_pixels * groupSize + + /*3dstuff*/ + psm->unpack_skip_images * imageSize] ); +} /* fillImage3D () */ + +static void scaleInternal3D(GLint components, + GLint widthIn, GLint heightIn, GLint depthIn, + const GLushort *dataIn, + GLint widthOut, GLint heightOut, GLint depthOut, + GLushort *dataOut) +{ + float x, lowx, highx, convx, halfconvx; + float y, lowy, highy, convy, halfconvy; + float z, lowz, highz, convz, halfconvz; + float xpercent,ypercent,zpercent; + float percent; + /* Max components in a format is 4, so... */ + float totals[4]; + float volume; + int i,j,d,k,zint,yint,xint,xindex,yindex,zindex; + int temp; + + convz = (float) depthIn/depthOut; + convy = (float) heightIn/heightOut; + convx = (float) widthIn/widthOut; + halfconvx = convx/2; + halfconvy = convy/2; + halfconvz = convz/2; + for (d = 0; d < depthOut; d++) { + z = convz * (d+0.5); + if (depthIn > depthOut) { + highz = z + halfconvz; + lowz = z - halfconvz; + } else { + highz = z + 0.5; + lowz = z - 0.5; + } + for (i = 0; i < heightOut; i++) { + y = convy * (i+0.5); + if (heightIn > heightOut) { + highy = y + halfconvy; + lowy = y - halfconvy; + } else { + highy = y + 0.5; + lowy = y - 0.5; + } + for (j = 0; j < widthOut; j++) { + x = convx * (j+0.5); + if (widthIn > widthOut) { + highx = x + halfconvx; + lowx = x - halfconvx; + } else { + highx = x + 0.5; + lowx = x - 0.5; + } + + /* + ** Ok, now apply box filter to box that goes from (lowx, lowy, + ** lowz) to (highx, highy, highz) on input data into this pixel + ** on output data. + */ + totals[0] = totals[1] = totals[2] = totals[3] = 0.0; + volume = 0.0; + + z = lowz; + zint = floor(z); + while (z < highz) { + zindex = (zint + depthIn) % depthIn; + if (highz < zint+1) { + zpercent = highz - z; + } else { + zpercent = zint+1 - z; + } + + y = lowy; + yint = floor(y); + while (y < highy) { + yindex = (yint + heightIn) % heightIn; + if (highy < yint+1) { + ypercent = highy - y; + } else { + ypercent = yint+1 - y; + } + + x = lowx; + xint = floor(x); + + while (x < highx) { + xindex = (xint + widthIn) % widthIn; + if (highx < xint+1) { + xpercent = highx - x; + } else { + xpercent = xint+1 - x; + } + + percent = xpercent * ypercent * zpercent; + volume += percent; + + temp = (xindex + (yindex*widthIn) + + (zindex*widthIn*heightIn)) * components; + for (k = 0; k < components; k++) { + assert(0 <= (temp+k) && + (temp+k) < + (widthIn*heightIn*depthIn*components)); + totals[k] += dataIn[temp + k] * percent; + } + + xint++; + x = xint; + } /* while x */ + + yint++; + y = yint; + } /* while y */ + + zint++; + z = zint; + } /* while z */ + + temp = (j + (i * widthOut) + + (d*widthOut*heightOut)) * components; + for (k = 0; k < components; k++) { + /* totals[] should be rounded in the case of enlarging an + * RGB ramp when the type is 332 or 4444 + */ + assert(0 <= (temp+k) && + (temp+k) < (widthOut*heightOut*depthOut*components)); + dataOut[temp + k] = (totals[k]+0.5)/volume; + } + } /* for j */ + } /* for i */ + } /* for d */ +} /* scaleInternal3D() */ + +static void emptyImage3D(const PixelStorageModes *psm, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, GLboolean indexFormat, + const GLushort *oldImage, void *userImage) +{ + int myswapBytes; + int components; + int groupsPerLine; + int elementSize; + int groupSize; + int rowSize; + int padding; + GLubyte *start, *rowStart, *iter; + int elementsPerLine; + const GLushort *iter2; + int ii, jj, dd, k; + int rowsPerImage; + int imageSize; + + myswapBytes= psm->pack_swap_bytes; + components = elements_per_group(format,type); + if (psm->pack_row_length > 0) { + groupsPerLine = psm->pack_row_length; + } + else { + groupsPerLine = width; + } + + elementSize= bytes_per_element(type); + groupSize= elementSize * components; + if (elementSize == 1) myswapBytes= 0; + + /* 3dstuff begin */ + if (psm->pack_image_height > 0) { + rowsPerImage= psm->pack_image_height; + } + else { + rowsPerImage= height; + } + + /* 3dstuff end */ + + rowSize = groupsPerLine * groupSize; + padding = rowSize % psm->pack_alignment; + if (padding) { + rowSize+= psm->pack_alignment - padding; + } + + imageSize= rowsPerImage * rowSize; /* 3dstuff */ + + start = (GLubyte *)userImage + psm->pack_skip_rows * rowSize + + psm->pack_skip_pixels * groupSize + + /*3dstuff*/ + psm->pack_skip_images * imageSize; + elementsPerLine= width * components; + + iter2 = oldImage; + for (dd= 0; dd < depth; dd++) { + rowStart= start; + + for (ii= 0; ii< height; ii++) { + iter = rowStart; + + for (jj = 0; jj < elementsPerLine; jj++) { + Type_Widget widget; + float shoveComponents[4]; + + switch(type){ + case GL_UNSIGNED_BYTE: + if (indexFormat) { + *iter = *iter2++; + } else { + *iter = *iter2++ >> 8; + } + break; + case GL_BYTE: + if (indexFormat) { + *((GLbyte *) iter) = *iter2++; + } else { + *((GLbyte *) iter) = *iter2++ >> 9; + } + break; + case GL_UNSIGNED_BYTE_3_3_2: + for (k = 0; k < 3; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove332(shoveComponents,0,(void *)iter); + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + for (k = 0; k < 3; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove233rev(shoveComponents,0,(void *)iter); + break; + case GL_UNSIGNED_SHORT_5_6_5: + for (k = 0; k < 3; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove565(shoveComponents,0,(void *)&widget.us[0]); + if (myswapBytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } + else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + for (k = 0; k < 3; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove565rev(shoveComponents,0,(void *)&widget.us[0]); + if (myswapBytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } + else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove4444(shoveComponents,0,(void *)&widget.us[0]); + if (myswapBytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove4444rev(shoveComponents,0,(void *)&widget.us[0]); + if (myswapBytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove5551(shoveComponents,0,(void *)&widget.us[0]); + if (myswapBytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove1555rev(shoveComponents,0,(void *)&widget.us[0]); + if (myswapBytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + *(GLushort *)iter = widget.us[0]; + } + break; + case GL_UNSIGNED_SHORT: + case GL_SHORT: + if (type == GL_SHORT) { + if (indexFormat) { + widget.s[0] = *iter2++; + } else { + widget.s[0] = *iter2++ >> 1; + } + } else { + widget.us[0] = *iter2++; + } + if (myswapBytes) { + iter[0] = widget.ub[1]; + iter[1] = widget.ub[0]; + } else { + iter[0] = widget.ub[0]; + iter[1] = widget.ub[1]; + } + break; + case GL_UNSIGNED_INT_8_8_8_8: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove8888(shoveComponents,0,(void *)&widget.ui); + if (myswapBytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + *(GLuint *)iter= widget.ui; + } + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove8888rev(shoveComponents,0,(void *)&widget.ui); + if (myswapBytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + *(GLuint *)iter= widget.ui; + } + break; + case GL_UNSIGNED_INT_10_10_10_2: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove1010102(shoveComponents,0,(void *)&widget.ui); + if (myswapBytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + *(GLuint *)iter= widget.ui; + } + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + for (k = 0; k < 4; k++) { + shoveComponents[k]= *iter2++ / 65535.0; + } + shove2101010rev(shoveComponents,0,(void *)&widget.ui); + if (myswapBytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + *(GLuint *)iter= widget.ui; + } + break; + case GL_INT: + case GL_UNSIGNED_INT: + case GL_FLOAT: + if (type == GL_FLOAT) { + if (indexFormat) { + widget.f = *iter2++; + } else { + widget.f = *iter2++ / (float) 65535.0; + } + } else if (type == GL_UNSIGNED_INT) { + if (indexFormat) { + widget.ui = *iter2++; + } else { + widget.ui = (unsigned int) *iter2++ * 65537; + } + } else { + if (indexFormat) { + widget.i = *iter2++; + } else { + widget.i = ((unsigned int) *iter2++ * 65537)/2; + } + } + if (myswapBytes) { + iter[3] = widget.ub[0]; + iter[2] = widget.ub[1]; + iter[1] = widget.ub[2]; + iter[0] = widget.ub[3]; + } else { + iter[0] = widget.ub[0]; + iter[1] = widget.ub[1]; + iter[2] = widget.ub[2]; + iter[3] = widget.ub[3]; + } + break; + default: + assert(0); + } + + iter+= elementSize; + } /* for jj */ + + rowStart+= rowSize; + } /* for ii */ + + start+= imageSize; + } /* for dd */ + + /* iterators should be one byte past end */ + if (!isTypePackedPixel(type)) { + assert(iter2 == &oldImage[width*height*depth*components]); + } + else { + assert(iter2 == &oldImage[width*height*depth* + elements_per_group(format,0)]); + } + assert( iter == &((GLubyte *)userImage)[rowSize*height*depth + + psm->unpack_skip_rows * rowSize + + psm->unpack_skip_pixels * groupSize + + /*3dstuff*/ + psm->unpack_skip_images * imageSize] ); +} /* emptyImage3D() */ + +static +int gluScaleImage3D(GLenum format, + GLint widthIn, GLint heightIn, GLint depthIn, + GLenum typeIn, const void *dataIn, + GLint widthOut, GLint heightOut, GLint depthOut, + GLenum typeOut, void *dataOut) +{ + int components; + GLushort *beforeImage, *afterImage; + PixelStorageModes psm; + + if (widthIn == 0 || heightIn == 0 || depthIn == 0 || + widthOut == 0 || heightOut == 0 || depthOut == 0) { + return 0; + } + + if (widthIn < 0 || heightIn < 0 || depthIn < 0 || + widthOut < 0 || heightOut < 0 || depthOut < 0) { + return GLU_INVALID_VALUE; + } + + if (!legalFormat(format) || !legalType(typeIn) || !legalType(typeOut) || + typeIn == GL_BITMAP || typeOut == GL_BITMAP) { + return GLU_INVALID_ENUM; + } + if (!isLegalFormatForPackedPixelType(format, typeIn)) { + return GLU_INVALID_OPERATION; + } + if (!isLegalFormatForPackedPixelType(format, typeOut)) { + return GLU_INVALID_OPERATION; + } + + beforeImage = malloc(imageSize3D(widthIn, heightIn, depthIn, format, + GL_UNSIGNED_SHORT)); + afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format, + GL_UNSIGNED_SHORT)); + if (beforeImage == NULL || afterImage == NULL) { + return GLU_OUT_OF_MEMORY; + } + retrieveStoreModes3D(&psm); + + fillImage3D(&psm,widthIn,heightIn,depthIn,format,typeIn, is_index(format), + dataIn, beforeImage); + components = elements_per_group(format,0); + scaleInternal3D(components,widthIn,heightIn,depthIn,beforeImage, + widthOut,heightOut,depthOut,afterImage); + emptyImage3D(&psm,widthOut,heightOut,depthOut,format,typeOut, + is_index(format),afterImage, dataOut); + free((void *) beforeImage); + free((void *) afterImage); + + return 0; +} /* gluScaleImage3D() */ + + +static void closestFit3D(GLenum target, GLint width, GLint height, GLint depth, + GLint internalFormat, GLenum format, GLenum type, + GLint *newWidth, GLint *newHeight, GLint *newDepth) +{ + GLint widthPowerOf2= nearestPower(width); + GLint heightPowerOf2= nearestPower(height); + GLint depthPowerOf2= nearestPower(depth); + GLint proxyWidth; + + do { + /* compute level 1 width & height & depth, clamping each at 1 */ + GLint widthAtLevelOne= (widthPowerOf2 > 1) ? + widthPowerOf2 >> 1 : + widthPowerOf2; + GLint heightAtLevelOne= (heightPowerOf2 > 1) ? + heightPowerOf2 >> 1 : + heightPowerOf2; + GLint depthAtLevelOne= (depthPowerOf2 > 1) ? + depthPowerOf2 >> 1 : + depthPowerOf2; + GLenum proxyTarget = GL_PROXY_TEXTURE_3D; + assert(widthAtLevelOne > 0); + assert(heightAtLevelOne > 0); + assert(depthAtLevelOne > 0); + + /* does width x height x depth at level 1 & all their mipmaps fit? */ + assert(target == GL_TEXTURE_3D || target == GL_PROXY_TEXTURE_3D); + gluTexImage3D(proxyTarget, 1, /* must be non-zero */ + internalFormat, + widthAtLevelOne,heightAtLevelOne,depthAtLevelOne, + 0,format,type,NULL); + glGetTexLevelParameteriv(proxyTarget, 1,GL_TEXTURE_WIDTH,&proxyWidth); + /* does it fit??? */ + if (proxyWidth == 0) { /* nope, so try again with these sizes */ + if (widthPowerOf2 == 1 && heightPowerOf2 == 1 && + depthPowerOf2 == 1) { + *newWidth= *newHeight= *newDepth= 1; /* must fit 1x1x1 texture */ + return; + } + widthPowerOf2= widthAtLevelOne; + heightPowerOf2= heightAtLevelOne; + depthPowerOf2= depthAtLevelOne; + } + /* else it does fit */ + } while (proxyWidth == 0); + /* loop must terminate! */ + + /* return the width & height at level 0 that fits */ + *newWidth= widthPowerOf2; + *newHeight= heightPowerOf2; + *newDepth= depthPowerOf2; +/*printf("Proxy Textures\n");*/ +} /* closestFit3D() */ + +static void halveImagePackedPixelSlice(int components, + void (*extractPackedPixel) + (int, const void *,GLfloat []), + void (*shovePackedPixel) + (const GLfloat [],int, void *), + GLint width, GLint height, GLint depth, + const void *dataIn, void *dataOut, + GLint pixelSizeInBytes, + GLint rowSizeInBytes, + GLint imageSizeInBytes, + GLint isSwap) +{ + int ii, jj; + int halfWidth= width / 2; + int halfHeight= height / 2; + int halfDepth= depth / 2; + const char *src= (const char *)dataIn; + int outIndex= 0; + + assert((width == 1 || height == 1) && depth >= 2); + + if (width == height) { /* a 1-pixel column viewed from top */ + assert(width == 1 && height == 1); + assert(depth >= 2); + + for (ii= 0; ii< halfDepth; ii++) { + float totals[4]; + float extractTotals[BOX2][4]; + int cc; + + (*extractPackedPixel)(isSwap,src,&extractTotals[0][0]); + (*extractPackedPixel)(isSwap,(src+imageSizeInBytes), + &extractTotals[1][0]); + for (cc = 0; cc < components; cc++) { + int kk; + + /* average 2 pixels since only a column */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]; + * totals[RED]/= 2.0; + */ + for (kk = 0; kk < BOX2; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (float)BOX2; + } /* for cc */ + + (*shovePackedPixel)(totals,outIndex,dataOut); + outIndex++; + /* skip over to next group of 2 */ + src+= imageSizeInBytes + imageSizeInBytes; + } /* for ii */ + } + else if (height == 1) { /* horizontal slice viewed from top */ + assert(width != 1); + + for (ii= 0; ii< halfDepth; ii++) { + for (jj= 0; jj< halfWidth; jj++) { + float totals[4]; + float extractTotals[BOX4][4]; + int cc; + + (*extractPackedPixel)(isSwap,src, + &extractTotals[0][0]); + (*extractPackedPixel)(isSwap,(src+pixelSizeInBytes), + &extractTotals[1][0]); + (*extractPackedPixel)(isSwap,(src+imageSizeInBytes), + &extractTotals[2][0]); + (*extractPackedPixel)(isSwap, + (src+imageSizeInBytes+pixelSizeInBytes), + &extractTotals[3][0]); + for (cc = 0; cc < components; cc++) { + int kk; + + /* grab 4 pixels to average */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ + * extractTotals[2][RED]+extractTotals[3][RED]; + * totals[RED]/= 4.0; + */ + for (kk = 0; kk < BOX4; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (float)BOX4; + } + (*shovePackedPixel)(totals,outIndex,dataOut); + + outIndex++; + /* skip over to next horizontal square of 4 */ + src+= imageSizeInBytes + imageSizeInBytes; + } + } + + /* assert() */ + } + else if (width == 1) { /* vertical slice viewed from top */ + assert(height != 1); + + for (ii= 0; ii< halfDepth; ii++) { + for (jj= 0; jj< halfHeight; jj++) { + float totals[4]; + float extractTotals[BOX4][4]; + int cc; + + (*extractPackedPixel)(isSwap,src, + &extractTotals[0][0]); + (*extractPackedPixel)(isSwap,(src+rowSizeInBytes), + &extractTotals[1][0]); + (*extractPackedPixel)(isSwap,(src+imageSizeInBytes), + &extractTotals[2][0]); + (*extractPackedPixel)(isSwap, + (src+imageSizeInBytes+rowSizeInBytes), + &extractTotals[3][0]); + for (cc = 0; cc < components; cc++) { + int kk; + + /* grab 4 pixels to average */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ + * extractTotals[2][RED]+extractTotals[3][RED]; + * totals[RED]/= 4.0; + */ + for (kk = 0; kk < BOX4; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (float)BOX4; + } + (*shovePackedPixel)(totals,outIndex,dataOut); + + outIndex++; + + /* skip over to next vertical square of 4 */ + src+= imageSizeInBytes + imageSizeInBytes; + } + } + /* assert() */ + } + +} /* halveImagePackedPixelSlice() */ + +static void halveImagePackedPixel3D(int components, + void (*extractPackedPixel) + (int, const void *,GLfloat []), + void (*shovePackedPixel) + (const GLfloat [],int, void *), + GLint width, GLint height, GLint depth, + const void *dataIn, void *dataOut, + GLint pixelSizeInBytes, + GLint rowSizeInBytes, + GLint imageSizeInBytes, + GLint isSwap) +{ + if (depth == 1) { + assert(1 <= width && 1 <= height); + + halveImagePackedPixel(components,extractPackedPixel,shovePackedPixel, + width,height,dataIn,dataOut,pixelSizeInBytes, + rowSizeInBytes,isSwap); + return; + } + /* a horizontal or vertical slice viewed from top */ + else if (width == 1 || height == 1) { + assert(1 <= depth); + + halveImagePackedPixelSlice(components, + extractPackedPixel,shovePackedPixel, + width, height, depth, dataIn, dataOut, + pixelSizeInBytes, rowSizeInBytes, + imageSizeInBytes, isSwap); + return; + } + { + int ii, jj, dd; + + int halfWidth= width / 2; + int halfHeight= height / 2; + int halfDepth= depth / 2; + const char *src= (const char *) dataIn; + int padBytes= rowSizeInBytes - (width*pixelSizeInBytes); + int outIndex= 0; + + for (dd= 0; dd < halfDepth; dd++) { + for (ii= 0; ii< halfHeight; ii++) { + for (jj= 0; jj< halfWidth; jj++) { +#define BOX8 8 + float totals[4]; /* 4 is maximum components */ + float extractTotals[BOX8][4]; /* 4 is maximum components */ + int cc; + + (*extractPackedPixel)(isSwap,src, + &extractTotals[0][0]); + (*extractPackedPixel)(isSwap,(src+pixelSizeInBytes), + &extractTotals[1][0]); + (*extractPackedPixel)(isSwap,(src+rowSizeInBytes), + &extractTotals[2][0]); + (*extractPackedPixel)(isSwap, + (src+rowSizeInBytes+pixelSizeInBytes), + &extractTotals[3][0]); + + (*extractPackedPixel)(isSwap,(src+imageSizeInBytes), + &extractTotals[4][0]); + (*extractPackedPixel)(isSwap,(src+pixelSizeInBytes+imageSizeInBytes), + &extractTotals[5][0]); + (*extractPackedPixel)(isSwap,(src+rowSizeInBytes+imageSizeInBytes), + &extractTotals[6][0]); + (*extractPackedPixel)(isSwap, + (src+rowSizeInBytes+pixelSizeInBytes+imageSizeInBytes), + &extractTotals[7][0]); + for (cc = 0; cc < components; cc++) { + int kk; + + /* grab 8 pixels to average */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ + * extractTotals[2][RED]+extractTotals[3][RED]+ + * extractTotals[4][RED]+extractTotals[5][RED]+ + * extractTotals[6][RED]+extractTotals[7][RED]; + * totals[RED]/= 8.0; + */ + for (kk = 0; kk < BOX8; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (float)BOX8; + } + (*shovePackedPixel)(totals,outIndex,dataOut); + + outIndex++; + /* skip over to next square of 4 */ + src+= pixelSizeInBytes + pixelSizeInBytes; + } + /* skip past pad bytes, if any, to get to next row */ + src+= padBytes; + + /* src is at beginning of a row here, but it's the second row of + * the square block of 4 pixels that we just worked on so we + * need to go one more row. + * i.e., + * OO... + * here -->OO... + * but want -->OO... + * OO... + * ... + */ + src+= rowSizeInBytes; + } + + src+= imageSizeInBytes; + } /* for dd */ + + /* both pointers must reach one byte after the end */ + assert(src == &((const char *)dataIn)[rowSizeInBytes*height*depth]); + assert(outIndex == halfWidth * halfHeight * halfDepth); + } /* for dd */ + +} /* halveImagePackedPixel3D() */ + +static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLsizei widthPowerOf2, + GLsizei heightPowerOf2, + GLsizei depthPowerOf2, + GLenum format, GLenum type, + GLint userLevel, + GLint baseLevel,GLint maxLevel, + const void *data) +{ + GLint newWidth, newHeight, newDepth; + GLint level, levels; + const void *usersImage; + void *srcImage, *dstImage; + __GLU_INIT_SWAP_IMAGE; + GLint memReq; + GLint cmpts; + + GLint myswapBytes, groupsPerLine, elementSize, groupSize; + GLint rowsPerImage, imageSize; + GLint rowSize, padding; + PixelStorageModes psm; + + assert(checkMipmapArgs(internalFormat,format,type) == 0); + assert(width >= 1 && height >= 1 && depth >= 1); + assert(type != GL_BITMAP); + + srcImage = dstImage = NULL; + + newWidth= widthPowerOf2; + newHeight= heightPowerOf2; + newDepth= depthPowerOf2; + levels = computeLog(newWidth); + level = computeLog(newHeight); + if (level > levels) levels=level; + level = computeLog(newDepth); + if (level > levels) levels=level; + + levels+= userLevel; + + retrieveStoreModes3D(&psm); + myswapBytes = psm.unpack_swap_bytes; + cmpts = elements_per_group(format,type); + if (psm.unpack_row_length > 0) { + groupsPerLine = psm.unpack_row_length; + } else { + groupsPerLine = width; + } + + elementSize = bytes_per_element(type); + groupSize = elementSize * cmpts; + if (elementSize == 1) myswapBytes = 0; + + /* 3dstuff begin */ + if (psm.unpack_image_height > 0) { + rowsPerImage= psm.unpack_image_height; + } + else { + rowsPerImage= height; + } + + /* 3dstuff end */ + rowSize = groupsPerLine * groupSize; + padding = (rowSize % psm.unpack_alignment); + if (padding) { + rowSize += psm.unpack_alignment - padding; + } + + imageSize= rowsPerImage * rowSize; /* 3dstuff */ + + usersImage = (const GLubyte *)data + psm.unpack_skip_rows * rowSize + + psm.unpack_skip_pixels * groupSize + + /* 3dstuff */ + psm.unpack_skip_images * imageSize; + + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, 0); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); + + level = userLevel; + + if (width == newWidth && height == newHeight && depth == newDepth) { + /* Use usersImage for level userLevel */ + if (baseLevel <= level && level <= maxLevel) { + gluTexImage3D(target, level, internalFormat, width, + height, depth, 0, format, type, + usersImage); + } + if(levels == 0) { /* we're done. clean up and return */ + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + return 0; + } + { + int nextWidth= newWidth/2; + int nextHeight= newHeight/2; + int nextDepth= newDepth/2; + + /* clamp to 1 */ + if (nextWidth < 1) nextWidth= 1; + if (nextHeight < 1) nextHeight= 1; + if (nextDepth < 1) nextDepth= 1; + memReq = imageSize3D(nextWidth, nextHeight, nextDepth, format, type); + } + switch(type) { + case GL_UNSIGNED_BYTE: + dstImage = (GLubyte *)malloc(memReq); + break; + case GL_BYTE: + dstImage = (GLbyte *)malloc(memReq); + break; + case GL_UNSIGNED_SHORT: + dstImage = (GLushort *)malloc(memReq); + break; + case GL_SHORT: + dstImage = (GLshort *)malloc(memReq); + break; + case GL_UNSIGNED_INT: + dstImage = (GLuint *)malloc(memReq); + break; + case GL_INT: + dstImage = (GLint *)malloc(memReq); + break; + case GL_FLOAT: + dstImage = (GLfloat *)malloc(memReq); + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + dstImage = (GLubyte *)malloc(memReq); + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + dstImage = (GLushort *)malloc(memReq); + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + dstImage = (GLuint *)malloc(memReq); + break; + default: + return GLU_INVALID_ENUM; /* assertion */ + } + if (dstImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + return GLU_OUT_OF_MEMORY; + } + else + switch(type) { + case GL_UNSIGNED_BYTE: + if (depth > 1) { + halveImage3D(cmpts,extractUbyte,shoveUbyte, + width,height,depth, + usersImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_ubyte(cmpts,width,height,usersImage,dstImage, + elementSize,rowSize,groupSize); + } + break; + case GL_BYTE: + if (depth > 1) { + halveImage3D(cmpts,extractSbyte,shoveSbyte, + width,height,depth, + usersImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_byte(cmpts,width,height,usersImage,dstImage, + elementSize,rowSize,groupSize); + } + break; + case GL_UNSIGNED_SHORT: + if (depth > 1) { + halveImage3D(cmpts,extractUshort,shoveUshort, + width,height,depth, + usersImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_ushort(cmpts,width,height,usersImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_SHORT: + if (depth > 1) { + halveImage3D(cmpts,extractSshort,shoveSshort, + width,height,depth, + usersImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_short(cmpts,width,height,usersImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_UNSIGNED_INT: + if (depth > 1) { + halveImage3D(cmpts,extractUint,shoveUint, + width,height,depth, + usersImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_uint(cmpts,width,height,usersImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_INT: + if (depth > 1) { + halveImage3D(cmpts,extractSint,shoveSint, + width,height,depth, + usersImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_int(cmpts,width,height,usersImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_FLOAT: + if (depth > 1 ) { + halveImage3D(cmpts,extractFloat,shoveFloat, + width,height,depth, + usersImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_float(cmpts,width,height,usersImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_UNSIGNED_BYTE_3_3_2: + assert(format == GL_RGB); + halveImagePackedPixel3D(3,extract332,shove332, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + assert(format == GL_RGB); + halveImagePackedPixel3D(3,extract233rev,shove233rev, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_5_6_5: + halveImagePackedPixel3D(3,extract565,shove565, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + halveImagePackedPixel3D(3,extract565rev,shove565rev, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + halveImagePackedPixel3D(4,extract4444,shove4444, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + halveImagePackedPixel3D(4,extract4444rev,shove4444rev, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + halveImagePackedPixel3D(4,extract5551,shove5551, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + halveImagePackedPixel3D(4,extract1555rev,shove1555rev, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_INT_8_8_8_8: + halveImagePackedPixel3D(4,extract8888,shove8888, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + halveImagePackedPixel3D(4,extract8888rev,shove8888rev, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_INT_10_10_10_2: + halveImagePackedPixel3D(4,extract1010102,shove1010102, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + halveImagePackedPixel3D(4,extract2101010rev,shove2101010rev, + width,height,depth,usersImage,dstImage, + elementSize,rowSize,imageSize,myswapBytes); + break; + default: + assert(0); + break; + } + newWidth = width/2; + newHeight = height/2; + newDepth = depth/2; + /* clamp to 1 */ + if (newWidth < 1) newWidth= 1; + if (newHeight < 1) newHeight= 1; + if (newDepth < 1) newDepth= 1; + + myswapBytes = 0; + rowSize = newWidth * groupSize; + imageSize= rowSize * newHeight; /* 3dstuff */ + memReq = imageSize3D(newWidth, newHeight, newDepth, format, type); + /* Swap srcImage and dstImage */ + __GLU_SWAP_IMAGE(srcImage,dstImage); + switch(type) { + case GL_UNSIGNED_BYTE: + dstImage = (GLubyte *)malloc(memReq); + break; + case GL_BYTE: + dstImage = (GLbyte *)malloc(memReq); + break; + case GL_UNSIGNED_SHORT: + dstImage = (GLushort *)malloc(memReq); + break; + case GL_SHORT: + dstImage = (GLshort *)malloc(memReq); + break; + case GL_UNSIGNED_INT: + dstImage = (GLuint *)malloc(memReq); + break; + case GL_INT: + dstImage = (GLint *)malloc(memReq); + break; + case GL_FLOAT: + dstImage = (GLfloat *)malloc(memReq); + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + dstImage = (GLubyte *)malloc(memReq); + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + dstImage = (GLushort *)malloc(memReq); + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + dstImage = (GLuint *)malloc(memReq); + break; + default: + return GLU_INVALID_ENUM; /* assertion */ + } + if (dstImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + return GLU_OUT_OF_MEMORY; + } + /* level userLevel+1 is in srcImage; level userLevel already saved */ + level = userLevel+1; + } else {/* user's image is *not* nice power-of-2 sized square */ + memReq = imageSize3D(newWidth, newHeight, newDepth, format, type); + switch(type) { + case GL_UNSIGNED_BYTE: + dstImage = (GLubyte *)malloc(memReq); + break; + case GL_BYTE: + dstImage = (GLbyte *)malloc(memReq); + break; + case GL_UNSIGNED_SHORT: + dstImage = (GLushort *)malloc(memReq); + break; + case GL_SHORT: + dstImage = (GLshort *)malloc(memReq); + break; + case GL_UNSIGNED_INT: + dstImage = (GLuint *)malloc(memReq); + break; + case GL_INT: + dstImage = (GLint *)malloc(memReq); + break; + case GL_FLOAT: + dstImage = (GLfloat *)malloc(memReq); + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + dstImage = (GLubyte *)malloc(memReq); + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + dstImage = (GLushort *)malloc(memReq); + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + dstImage = (GLuint *)malloc(memReq); + break; + default: + return GLU_INVALID_ENUM; /* assertion */ + } + + if (dstImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + return GLU_OUT_OF_MEMORY; + } + /*printf("Build3DMipmaps(): ScaleImage3D %d %d %d->%d %d %d\n", + width,height,depth,newWidth,newHeight,newDepth);*/ + + gluScaleImage3D(format, width, height, depth, type, usersImage, + newWidth, newHeight, newDepth, type, dstImage); + + myswapBytes = 0; + rowSize = newWidth * groupSize; + imageSize = rowSize * newHeight; /* 3dstuff */ + /* Swap dstImage and srcImage */ + __GLU_SWAP_IMAGE(srcImage,dstImage); + + if(levels != 0) { /* use as little memory as possible */ + { + int nextWidth= newWidth/2; + int nextHeight= newHeight/2; + int nextDepth= newDepth/2; + if (nextWidth < 1) nextWidth= 1; + if (nextHeight < 1) nextHeight= 1; + if (nextDepth < 1) nextDepth= 1; + + memReq = imageSize3D(nextWidth, nextHeight, nextDepth, format, type); + } + switch(type) { + case GL_UNSIGNED_BYTE: + dstImage = (GLubyte *)malloc(memReq); + break; + case GL_BYTE: + dstImage = (GLbyte *)malloc(memReq); + break; + case GL_UNSIGNED_SHORT: + dstImage = (GLushort *)malloc(memReq); + break; + case GL_SHORT: + dstImage = (GLshort *)malloc(memReq); + break; + case GL_UNSIGNED_INT: + dstImage = (GLuint *)malloc(memReq); + break; + case GL_INT: + dstImage = (GLint *)malloc(memReq); + break; + case GL_FLOAT: + dstImage = (GLfloat *)malloc(memReq); + break; + case GL_UNSIGNED_BYTE_3_3_2: + case GL_UNSIGNED_BYTE_2_3_3_REV: + dstImage = (GLubyte *)malloc(memReq); + break; + case GL_UNSIGNED_SHORT_5_6_5: + case GL_UNSIGNED_SHORT_5_6_5_REV: + case GL_UNSIGNED_SHORT_4_4_4_4: + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + case GL_UNSIGNED_SHORT_5_5_5_1: + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + dstImage = (GLushort *)malloc(memReq); + break; + case GL_UNSIGNED_INT_8_8_8_8: + case GL_UNSIGNED_INT_8_8_8_8_REV: + case GL_UNSIGNED_INT_10_10_10_2: + case GL_UNSIGNED_INT_2_10_10_10_REV: + dstImage = (GLuint *)malloc(memReq); + break; + default: + return GLU_INVALID_ENUM; /* assertion */ + } + if (dstImage == NULL) { + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + return GLU_OUT_OF_MEMORY; + } + } + /* level userLevel is in srcImage; nothing saved yet */ + level = userLevel; + } + + glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); + if (baseLevel <= level && level <= maxLevel) { + gluTexImage3D(target, level, internalFormat, newWidth, newHeight, newDepth, + 0,format, type, (void *)srcImage); + } + level++; /* update current level for the loop */ + for (; level <= levels; level++) { + switch(type) { + case GL_UNSIGNED_BYTE: + if (newDepth > 1) { + halveImage3D(cmpts,extractUbyte,shoveUbyte, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_ubyte(cmpts,newWidth,newHeight,srcImage,dstImage, + elementSize,rowSize,groupSize); + } + break; + case GL_BYTE: + if (newDepth > 1) { + halveImage3D(cmpts,extractSbyte,shoveSbyte, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_byte(cmpts,newWidth,newHeight,srcImage,dstImage, + elementSize,rowSize,groupSize); + } + break; + case GL_UNSIGNED_SHORT: + if (newDepth > 1) { + halveImage3D(cmpts,extractUshort,shoveUshort, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_ushort(cmpts,newWidth,newHeight,srcImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_SHORT: + if (newDepth > 1) { + halveImage3D(cmpts,extractSshort,shoveSshort, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_short(cmpts,newWidth,newHeight,srcImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_UNSIGNED_INT: + if (newDepth > 1) { + halveImage3D(cmpts,extractUint,shoveUint, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_uint(cmpts,newWidth,newHeight,srcImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_INT: + if (newDepth > 1) { + halveImage3D(cmpts,extractSint,shoveSint, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_int(cmpts,newWidth,newHeight,srcImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_FLOAT: + if (newDepth > 1) { + halveImage3D(cmpts,extractFloat,shoveFloat, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,groupSize,rowSize, + imageSize,myswapBytes); + } + else { + halveImage_float(cmpts,newWidth,newHeight,srcImage,dstImage, + elementSize,rowSize,groupSize,myswapBytes); + } + break; + case GL_UNSIGNED_BYTE_3_3_2: + halveImagePackedPixel3D(3,extract332,shove332, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + halveImagePackedPixel3D(3,extract233rev,shove233rev, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_5_6_5: + halveImagePackedPixel3D(3,extract565,shove565, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + halveImagePackedPixel3D(3,extract565rev,shove565rev, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4: + halveImagePackedPixel3D(4,extract4444,shove4444, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_4_4_4_4_REV: + halveImagePackedPixel3D(4,extract4444rev,shove4444rev, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_5_5_5_1: + halveImagePackedPixel3D(4,extract5551,shove5551, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_SHORT_1_5_5_5_REV: + halveImagePackedPixel3D(4,extract1555rev,shove1555rev, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_INT_8_8_8_8: + halveImagePackedPixel3D(4,extract8888,shove8888, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + halveImagePackedPixel3D(4,extract8888rev,shove8888rev, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_INT_10_10_10_2: + halveImagePackedPixel3D(4,extract1010102,shove1010102, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + case GL_UNSIGNED_INT_2_10_10_10_REV: + halveImagePackedPixel3D(4,extract2101010rev,shove2101010rev, + newWidth,newHeight,newDepth, + srcImage,dstImage,elementSize,rowSize, + imageSize,myswapBytes); + break; + default: + assert(0); + break; + } + + __GLU_SWAP_IMAGE(srcImage,dstImage); + + if (newWidth > 1) { newWidth /= 2; rowSize /= 2;} + if (newHeight > 1) { newHeight /= 2; imageSize = rowSize * newHeight; } + if (newDepth > 1) newDepth /= 2; + { + /* call tex image with srcImage untouched since it's not padded */ + if (baseLevel <= level && level <= maxLevel) { + gluTexImage3D(target, level, internalFormat, newWidth, newHeight, + newDepth,0, format, type, (void *) srcImage); + } + } + } /* for level */ + glPixelStorei(GL_UNPACK_ALIGNMENT, psm.unpack_alignment); + glPixelStorei(GL_UNPACK_SKIP_ROWS, psm.unpack_skip_rows); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); + glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); + glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); + glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + + free(srcImage); /*if you get to here, a srcImage has always been malloc'ed*/ + if (dstImage) { /* if it's non-rectangular and only 1 level */ + free(dstImage); + } + return 0; +} /* gluBuild3DMipmapLevelsCore() */ + +GLint GLAPIENTRY +gluBuild3DMipmapLevels(GLenum target, GLint internalFormat, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type, + GLint userLevel, GLint baseLevel, GLint maxLevel, + const void *data) +{ + int level, levels; + + int rc= checkMipmapArgs(internalFormat,format,type); + if (rc != 0) return rc; + + if (width < 1 || height < 1 || depth < 1) { + return GLU_INVALID_VALUE; + } + + if(type == GL_BITMAP) { + return GLU_INVALID_ENUM; + } + + levels = computeLog(width); + level = computeLog(height); + if (level > levels) levels=level; + level = computeLog(depth); + if (level > levels) levels=level; + + levels+= userLevel; + if (!isLegalLevels(userLevel,baseLevel,maxLevel,levels)) + return GLU_INVALID_VALUE; + + return gluBuild3DMipmapLevelsCore(target, internalFormat, + width, height, depth, + width, height, depth, + format, type, + userLevel, baseLevel, maxLevel, + data); +} /* gluBuild3DMipmapLevels() */ + +GLint GLAPIENTRY +gluBuild3DMipmaps(GLenum target, GLint internalFormat, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type, const void *data) +{ + GLint widthPowerOf2, heightPowerOf2, depthPowerOf2; + int level, levels; + + int rc= checkMipmapArgs(internalFormat,format,type); + if (rc != 0) return rc; + + if (width < 1 || height < 1 || depth < 1) { + return GLU_INVALID_VALUE; + } + + if(type == GL_BITMAP) { + return GLU_INVALID_ENUM; + } + + closestFit3D(target,width,height,depth,internalFormat,format,type, + &widthPowerOf2,&heightPowerOf2,&depthPowerOf2); + + levels = computeLog(widthPowerOf2); + level = computeLog(heightPowerOf2); + if (level > levels) levels=level; + level = computeLog(depthPowerOf2); + if (level > levels) levels=level; + + return gluBuild3DMipmapLevelsCore(target, internalFormat, + width, height, depth, + widthPowerOf2, heightPowerOf2, + depthPowerOf2, + format, type, 0, 0, levels, + data); +} /* gluBuild3DMipmaps() */ + +static GLdouble extractUbyte(int isSwap, const void *ubyte) +{ + isSwap= isSwap; /* turn off warnings */ + + assert(*((const GLubyte *)ubyte) <= 255); + + return (GLdouble)(*((const GLubyte *)ubyte)); +} /* extractUbyte() */ + +static void shoveUbyte(GLdouble value, int index, void *data) +{ + assert(0.0 <= value && value < 256.0); + + ((GLubyte *)data)[index]= (GLubyte)value; +} /* shoveUbyte() */ + +static GLdouble extractSbyte(int isSwap, const void *sbyte) +{ + isSwap= isSwap; /* turn off warnings */ + + assert(*((const GLbyte *)sbyte) <= 127); + + return (GLdouble)(*((const GLbyte *)sbyte)); +} /* extractSbyte() */ + +static void shoveSbyte(GLdouble value, int index, void *data) +{ + ((GLbyte *)data)[index]= (GLbyte)value; +} /* shoveSbyte() */ + +static GLdouble extractUshort(int isSwap, const void *uitem) +{ + GLushort ushort; + + if (isSwap) { + ushort= __GLU_SWAP_2_BYTES(uitem); + } + else { + ushort= *(const GLushort *)uitem; + } + + assert(ushort <= 65535); + + return (GLdouble)ushort; +} /* extractUshort() */ + +static void shoveUshort(GLdouble value, int index, void *data) +{ + assert(0.0 <= value && value < 65536.0); + + ((GLushort *)data)[index]= (GLushort)value; +} /* shoveUshort() */ + +static GLdouble extractSshort(int isSwap, const void *sitem) +{ + GLshort sshort; + + if (isSwap) { + sshort= __GLU_SWAP_2_BYTES(sitem); + } + else { + sshort= *(const GLshort *)sitem; + } + + assert(sshort <= 32767); + + return (GLdouble)sshort; +} /* extractSshort() */ + +static void shoveSshort(GLdouble value, int index, void *data) +{ + assert(0.0 <= value && value < 32768.0); + + ((GLshort *)data)[index]= (GLshort)value; +} /* shoveSshort() */ + +static GLdouble extractUint(int isSwap, const void *uitem) +{ + GLuint uint; + + if (isSwap) { + uint= __GLU_SWAP_4_BYTES(uitem); + } + else { + uint= *(const GLuint *)uitem; + } + + assert(uint <= 0xffffffff); + + return (GLdouble)uint; +} /* extractUint() */ + +static void shoveUint(GLdouble value, int index, void *data) +{ + assert(0.0 <= value && value <= (GLdouble) UINT_MAX); + + ((GLuint *)data)[index]= (GLuint)value; +} /* shoveUint() */ + +static GLdouble extractSint(int isSwap, const void *sitem) +{ + GLint sint; + + if (isSwap) { + sint= __GLU_SWAP_4_BYTES(sitem); + } + else { + sint= *(const GLint *)sitem; + } + + assert(sint <= 0x7fffffff); + + return (GLdouble)sint; +} /* extractSint() */ + +static void shoveSint(GLdouble value, int index, void *data) +{ + assert(0.0 <= value && value <= (GLdouble) INT_MAX); + + ((GLint *)data)[index]= (GLint)value; +} /* shoveSint() */ + +static GLdouble extractFloat(int isSwap, const void *item) +{ + GLfloat ffloat; + + if (isSwap) { + ffloat= __GLU_SWAP_4_BYTES(item); + } + else { + ffloat= *(const GLfloat *)item; + } + + assert(ffloat <= 1.0); + + return (GLdouble)ffloat; +} /* extractFloat() */ + +static void shoveFloat(GLdouble value, int index, void *data) +{ + assert(0.0 <= value && value <= 1.0); + + ((GLfloat *)data)[index]= value; +} /* shoveFloat() */ + +static void halveImageSlice(int components, + GLdouble (*extract)(int, const void *), + void (*shove)(GLdouble, int, void *), + GLint width, GLint height, GLint depth, + const void *dataIn, void *dataOut, + GLint elementSizeInBytes, + GLint groupSizeInBytes, + GLint rowSizeInBytes, + GLint imageSizeInBytes, + GLint isSwap) +{ + int ii, jj; + int halfWidth= width / 2; + int halfHeight= height / 2; + int halfDepth= depth / 2; + const char *src= (const char *)dataIn; + int rowPadBytes= rowSizeInBytes - (width * groupSizeInBytes); + int imagePadBytes= imageSizeInBytes - (width*height*groupSizeInBytes); + int outIndex= 0; + + assert((width == 1 || height == 1) && depth >= 2); + + if (width == height) { /* a 1-pixel column viewed from top */ + /* printf("1-column\n");*/ + assert(width == 1 && height == 1); + assert(depth >= 2); + + for (ii= 0; ii< halfDepth; ii++) { + int cc; + + for (cc = 0; cc < components; cc++) { + double totals[4]; + double extractTotals[BOX2][4]; + int kk; + + extractTotals[0][cc]= (*extract)(isSwap,src); + extractTotals[1][cc]= (*extract)(isSwap,(src+imageSizeInBytes)); + + /* average 2 pixels since only a column */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]; + * totals[RED]/= 2.0; + */ + for (kk = 0; kk < BOX2; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (double)BOX2; + + (*shove)(totals[cc],outIndex,dataOut); + outIndex++; + src+= elementSizeInBytes; + } /* for cc */ + + /* skip over to next group of 2 */ + src+= rowSizeInBytes; + } /* for ii */ + + assert(src == &((const char *)dataIn)[rowSizeInBytes*height*depth]); + assert(outIndex == halfDepth * components); + } + else if (height == 1) { /* horizontal slice viewed from top */ + /* printf("horizontal slice\n"); */ + assert(width != 1); + + for (ii= 0; ii< halfDepth; ii++) { + for (jj= 0; jj< halfWidth; jj++) { + int cc; + + for (cc = 0; cc < components; cc++) { + int kk; + double totals[4]; + double extractTotals[BOX4][4]; + + extractTotals[0][cc]=(*extract)(isSwap,src); + extractTotals[1][cc]=(*extract)(isSwap, + (src+groupSizeInBytes)); + extractTotals[2][cc]=(*extract)(isSwap, + (src+imageSizeInBytes)); + extractTotals[3][cc]=(*extract)(isSwap, + (src+imageSizeInBytes+groupSizeInBytes)); + + /* grab 4 pixels to average */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ + * extractTotals[2][RED]+extractTotals[3][RED]; + * totals[RED]/= 4.0; + */ + for (kk = 0; kk < BOX4; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (double)BOX4; + + (*shove)(totals[cc],outIndex,dataOut); + outIndex++; + + src+= elementSizeInBytes; + } /* for cc */ + + /* skip over to next horizontal square of 4 */ + src+= groupSizeInBytes; + } /* for jj */ + src+= rowPadBytes; + + src+= rowSizeInBytes; + } /* for ii */ + + assert(src == &((const char *)dataIn)[rowSizeInBytes*height*depth]); + assert(outIndex == halfWidth * halfDepth * components); + } + else if (width == 1) { /* vertical slice viewed from top */ + /* printf("vertical slice\n"); */ + assert(height != 1); + + for (ii= 0; ii< halfDepth; ii++) { + for (jj= 0; jj< halfHeight; jj++) { + int cc; + + for (cc = 0; cc < components; cc++) { + int kk; + double totals[4]; + double extractTotals[BOX4][4]; + + extractTotals[0][cc]=(*extract)(isSwap,src); + extractTotals[1][cc]=(*extract)(isSwap, + (src+rowSizeInBytes)); + extractTotals[2][cc]=(*extract)(isSwap, + (src+imageSizeInBytes)); + extractTotals[3][cc]=(*extract)(isSwap, + (src+imageSizeInBytes+rowSizeInBytes)); + + /* grab 4 pixels to average */ + totals[cc]= 0.0; + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ + * extractTotals[2][RED]+extractTotals[3][RED]; + * totals[RED]/= 4.0; + */ + for (kk = 0; kk < BOX4; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (double)BOX4; + + (*shove)(totals[cc],outIndex,dataOut); + outIndex++; + + src+= elementSizeInBytes; + } /* for cc */ + src+= rowPadBytes; + + /* skip over to next vertical square of 4 */ + src+= rowSizeInBytes; + } /* for jj */ + src+= imagePadBytes; + + src+= imageSizeInBytes; + } /* for ii */ + + assert(src == &((const char *)dataIn)[rowSizeInBytes*height*depth]); + assert(outIndex == halfHeight * halfDepth * components); + } + +} /* halveImageSlice() */ + +static void halveImage3D(int components, + GLdouble (*extract)(int, const void *), + void (*shove)(GLdouble, int, void *), + GLint width, GLint height, GLint depth, + const void *dataIn, void *dataOut, + GLint elementSizeInBytes, + GLint groupSizeInBytes, + GLint rowSizeInBytes, + GLint imageSizeInBytes, + GLint isSwap) +{ + assert(depth > 1); + + /* a horizontal/vertical/one-column slice viewed from top */ + if (width == 1 || height == 1) { + assert(1 <= depth); + + halveImageSlice(components,extract,shove, width, height, depth, + dataIn, dataOut, elementSizeInBytes, groupSizeInBytes, + rowSizeInBytes, imageSizeInBytes, isSwap); + return; + } + { + int ii, jj, dd; + + int halfWidth= width / 2; + int halfHeight= height / 2; + int halfDepth= depth / 2; + const char *src= (const char *) dataIn; + int rowPadBytes= rowSizeInBytes - (width*groupSizeInBytes); + int imagePadBytes= imageSizeInBytes - (width*height*groupSizeInBytes); + int outIndex= 0; + + for (dd= 0; dd < halfDepth; dd++) { + for (ii= 0; ii< halfHeight; ii++) { + for (jj= 0; jj< halfWidth; jj++) { + int cc; + + for (cc= 0; cc < components; cc++) { + int kk; +#define BOX8 8 + double totals[4]; /* 4 is maximum components */ + double extractTotals[BOX8][4]; /* 4 is maximum components */ + + extractTotals[0][cc]= (*extract)(isSwap,src); + extractTotals[1][cc]= (*extract)(isSwap, + (src+groupSizeInBytes)); + extractTotals[2][cc]= (*extract)(isSwap, + (src+rowSizeInBytes)); + extractTotals[3][cc]= (*extract)(isSwap, + (src+rowSizeInBytes+groupSizeInBytes)); + + extractTotals[4][cc]= (*extract)(isSwap, + (src+imageSizeInBytes)); + + extractTotals[5][cc]= (*extract)(isSwap, + (src+groupSizeInBytes+imageSizeInBytes)); + extractTotals[6][cc]= (*extract)(isSwap, + (src+rowSizeInBytes+imageSizeInBytes)); + extractTotals[7][cc]= (*extract)(isSwap, + (src+rowSizeInBytes+groupSizeInBytes+imageSizeInBytes)); + + totals[cc]= 0.0; + + /* totals[RED]= extractTotals[0][RED]+extractTotals[1][RED]+ + * extractTotals[2][RED]+extractTotals[3][RED]+ + * extractTotals[4][RED]+extractTotals[5][RED]+ + * extractTotals[6][RED]+extractTotals[7][RED]; + * totals[RED]/= 8.0; + */ + for (kk = 0; kk < BOX8; kk++) { + totals[cc]+= extractTotals[kk][cc]; + } + totals[cc]/= (double)BOX8; + + (*shove)(totals[cc],outIndex,dataOut); + + outIndex++; + + src+= elementSizeInBytes; /* go to next component */ + } /* for cc */ + + /* skip over to next square of 4 */ + src+= groupSizeInBytes; + } /* for jj */ + /* skip past pad bytes, if any, to get to next row */ + src+= rowPadBytes; + + /* src is at beginning of a row here, but it's the second row of + * the square block of 4 pixels that we just worked on so we + * need to go one more row. + * i.e., + * OO... + * here -->OO... + * but want -->OO... + * OO... + * ... + */ + src+= rowSizeInBytes; + } /* for ii */ + + /* skip past pad bytes, if any, to get to next image */ + src+= imagePadBytes; + + src+= imageSizeInBytes; + } /* for dd */ + + /* both pointers must reach one byte after the end */ + assert(src == &((const char *)dataIn)[rowSizeInBytes*height*depth]); + assert(outIndex == halfWidth * halfHeight * halfDepth * components); + } +} /* halveImage3D() */ + + + +/*** mipmap.c ***/ + diff --git a/mesalib/src/glu/sgi/libutil/project.c b/mesalib/src/glu/sgi/libutil/project.c new file mode 100644 index 000000000..f4bf8839b --- /dev/null +++ b/mesalib/src/glu/sgi/libutil/project.c @@ -0,0 +1,359 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#include "gluos.h" +#include +#include +#include +#include "gluint.h" + +/* +** Make m an identity matrix +*/ +static void __gluMakeIdentityd(GLdouble m[16]) +{ + m[0+4*0] = 1; m[0+4*1] = 0; m[0+4*2] = 0; m[0+4*3] = 0; + m[1+4*0] = 0; m[1+4*1] = 1; m[1+4*2] = 0; m[1+4*3] = 0; + m[2+4*0] = 0; m[2+4*1] = 0; m[2+4*2] = 1; m[2+4*3] = 0; + m[3+4*0] = 0; m[3+4*1] = 0; m[3+4*2] = 0; m[3+4*3] = 1; +} + +static void __gluMakeIdentityf(GLfloat m[16]) +{ + m[0+4*0] = 1; m[0+4*1] = 0; m[0+4*2] = 0; m[0+4*3] = 0; + m[1+4*0] = 0; m[1+4*1] = 1; m[1+4*2] = 0; m[1+4*3] = 0; + m[2+4*0] = 0; m[2+4*1] = 0; m[2+4*2] = 1; m[2+4*3] = 0; + m[3+4*0] = 0; m[3+4*1] = 0; m[3+4*2] = 0; m[3+4*3] = 1; +} + +void GLAPIENTRY +gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top) +{ + glOrtho(left, right, bottom, top, -1, 1); +} + +#define __glPi 3.14159265358979323846 + +void GLAPIENTRY +gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) +{ + GLdouble m[4][4]; + double sine, cotangent, deltaZ; + double radians = fovy / 2 * __glPi / 180; + + deltaZ = zFar - zNear; + sine = sin(radians); + if ((deltaZ == 0) || (sine == 0) || (aspect == 0)) { + return; + } + cotangent = COS(radians) / sine; + + __gluMakeIdentityd(&m[0][0]); + m[0][0] = cotangent / aspect; + m[1][1] = cotangent; + m[2][2] = -(zFar + zNear) / deltaZ; + m[2][3] = -1; + m[3][2] = -2 * zNear * zFar / deltaZ; + m[3][3] = 0; + glMultMatrixd(&m[0][0]); +} + +static void normalize(float v[3]) +{ + float r; + + r = sqrt( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] ); + if (r == 0.0) return; + + v[0] /= r; + v[1] /= r; + v[2] /= r; +} + +static void cross(float v1[3], float v2[3], float result[3]) +{ + result[0] = v1[1]*v2[2] - v1[2]*v2[1]; + result[1] = v1[2]*v2[0] - v1[0]*v2[2]; + result[2] = v1[0]*v2[1] - v1[1]*v2[0]; +} + +void GLAPIENTRY +gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, + GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, + GLdouble upz) +{ + float forward[3], side[3], up[3]; + GLfloat m[4][4]; + + forward[0] = centerx - eyex; + forward[1] = centery - eyey; + forward[2] = centerz - eyez; + + up[0] = upx; + up[1] = upy; + up[2] = upz; + + normalize(forward); + + /* Side = forward x up */ + cross(forward, up, side); + normalize(side); + + /* Recompute up as: up = side x forward */ + cross(side, forward, up); + + __gluMakeIdentityf(&m[0][0]); + m[0][0] = side[0]; + m[1][0] = side[1]; + m[2][0] = side[2]; + + m[0][1] = up[0]; + m[1][1] = up[1]; + m[2][1] = up[2]; + + m[0][2] = -forward[0]; + m[1][2] = -forward[1]; + m[2][2] = -forward[2]; + + glMultMatrixf(&m[0][0]); + glTranslated(-eyex, -eyey, -eyez); +} + +static void __gluMultMatrixVecd(const GLdouble matrix[16], const GLdouble in[4], + GLdouble out[4]) +{ + int i; + + for (i=0; i<4; i++) { + out[i] = + in[0] * matrix[0*4+i] + + in[1] * matrix[1*4+i] + + in[2] * matrix[2*4+i] + + in[3] * matrix[3*4+i]; + } +} + +/* +** Invert 4x4 matrix. +** Contributed by David Moore (See Mesa bug #6748) +*/ +static int __gluInvertMatrixd(const GLdouble m[16], GLdouble invOut[16]) +{ + double inv[16], det; + int i; + + inv[0] = m[5]*m[10]*m[15] - m[5]*m[11]*m[14] - m[9]*m[6]*m[15] + + m[9]*m[7]*m[14] + m[13]*m[6]*m[11] - m[13]*m[7]*m[10]; + inv[4] = -m[4]*m[10]*m[15] + m[4]*m[11]*m[14] + m[8]*m[6]*m[15] + - m[8]*m[7]*m[14] - m[12]*m[6]*m[11] + m[12]*m[7]*m[10]; + inv[8] = m[4]*m[9]*m[15] - m[4]*m[11]*m[13] - m[8]*m[5]*m[15] + + m[8]*m[7]*m[13] + m[12]*m[5]*m[11] - m[12]*m[7]*m[9]; + inv[12] = -m[4]*m[9]*m[14] + m[4]*m[10]*m[13] + m[8]*m[5]*m[14] + - m[8]*m[6]*m[13] - m[12]*m[5]*m[10] + m[12]*m[6]*m[9]; + inv[1] = -m[1]*m[10]*m[15] + m[1]*m[11]*m[14] + m[9]*m[2]*m[15] + - m[9]*m[3]*m[14] - m[13]*m[2]*m[11] + m[13]*m[3]*m[10]; + inv[5] = m[0]*m[10]*m[15] - m[0]*m[11]*m[14] - m[8]*m[2]*m[15] + + m[8]*m[3]*m[14] + m[12]*m[2]*m[11] - m[12]*m[3]*m[10]; + inv[9] = -m[0]*m[9]*m[15] + m[0]*m[11]*m[13] + m[8]*m[1]*m[15] + - m[8]*m[3]*m[13] - m[12]*m[1]*m[11] + m[12]*m[3]*m[9]; + inv[13] = m[0]*m[9]*m[14] - m[0]*m[10]*m[13] - m[8]*m[1]*m[14] + + m[8]*m[2]*m[13] + m[12]*m[1]*m[10] - m[12]*m[2]*m[9]; + inv[2] = m[1]*m[6]*m[15] - m[1]*m[7]*m[14] - m[5]*m[2]*m[15] + + m[5]*m[3]*m[14] + m[13]*m[2]*m[7] - m[13]*m[3]*m[6]; + inv[6] = -m[0]*m[6]*m[15] + m[0]*m[7]*m[14] + m[4]*m[2]*m[15] + - m[4]*m[3]*m[14] - m[12]*m[2]*m[7] + m[12]*m[3]*m[6]; + inv[10] = m[0]*m[5]*m[15] - m[0]*m[7]*m[13] - m[4]*m[1]*m[15] + + m[4]*m[3]*m[13] + m[12]*m[1]*m[7] - m[12]*m[3]*m[5]; + inv[14] = -m[0]*m[5]*m[14] + m[0]*m[6]*m[13] + m[4]*m[1]*m[14] + - m[4]*m[2]*m[13] - m[12]*m[1]*m[6] + m[12]*m[2]*m[5]; + inv[3] = -m[1]*m[6]*m[11] + m[1]*m[7]*m[10] + m[5]*m[2]*m[11] + - m[5]*m[3]*m[10] - m[9]*m[2]*m[7] + m[9]*m[3]*m[6]; + inv[7] = m[0]*m[6]*m[11] - m[0]*m[7]*m[10] - m[4]*m[2]*m[11] + + m[4]*m[3]*m[10] + m[8]*m[2]*m[7] - m[8]*m[3]*m[6]; + inv[11] = -m[0]*m[5]*m[11] + m[0]*m[7]*m[9] + m[4]*m[1]*m[11] + - m[4]*m[3]*m[9] - m[8]*m[1]*m[7] + m[8]*m[3]*m[5]; + inv[15] = m[0]*m[5]*m[10] - m[0]*m[6]*m[9] - m[4]*m[1]*m[10] + + m[4]*m[2]*m[9] + m[8]*m[1]*m[6] - m[8]*m[2]*m[5]; + + det = m[0]*inv[0] + m[1]*inv[4] + m[2]*inv[8] + m[3]*inv[12]; + if (det == 0) + return GL_FALSE; + + det = 1.0 / det; + + for (i = 0; i < 16; i++) + invOut[i] = inv[i] * det; + + return GL_TRUE; +} + +static void __gluMultMatricesd(const GLdouble a[16], const GLdouble b[16], + GLdouble r[16]) +{ + int i, j; + + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + r[i*4+j] = + a[i*4+0]*b[0*4+j] + + a[i*4+1]*b[1*4+j] + + a[i*4+2]*b[2*4+j] + + a[i*4+3]*b[3*4+j]; + } + } +} + +GLint GLAPIENTRY +gluProject(GLdouble objx, GLdouble objy, GLdouble objz, + const GLdouble modelMatrix[16], + const GLdouble projMatrix[16], + const GLint viewport[4], + GLdouble *winx, GLdouble *winy, GLdouble *winz) +{ + double in[4]; + double out[4]; + + in[0]=objx; + in[1]=objy; + in[2]=objz; + in[3]=1.0; + __gluMultMatrixVecd(modelMatrix, in, out); + __gluMultMatrixVecd(projMatrix, out, in); + if (in[3] == 0.0) return(GL_FALSE); + in[0] /= in[3]; + in[1] /= in[3]; + in[2] /= in[3]; + /* Map x, y and z to range 0-1 */ + in[0] = in[0] * 0.5 + 0.5; + in[1] = in[1] * 0.5 + 0.5; + in[2] = in[2] * 0.5 + 0.5; + + /* Map x,y to viewport */ + in[0] = in[0] * viewport[2] + viewport[0]; + in[1] = in[1] * viewport[3] + viewport[1]; + + *winx=in[0]; + *winy=in[1]; + *winz=in[2]; + return(GL_TRUE); +} + +GLint GLAPIENTRY +gluUnProject(GLdouble winx, GLdouble winy, GLdouble winz, + const GLdouble modelMatrix[16], + const GLdouble projMatrix[16], + const GLint viewport[4], + GLdouble *objx, GLdouble *objy, GLdouble *objz) +{ + double finalMatrix[16]; + double in[4]; + double out[4]; + + __gluMultMatricesd(modelMatrix, projMatrix, finalMatrix); + if (!__gluInvertMatrixd(finalMatrix, finalMatrix)) return(GL_FALSE); + + in[0]=winx; + in[1]=winy; + in[2]=winz; + in[3]=1.0; + + /* Map x and y from window coordinates */ + in[0] = (in[0] - viewport[0]) / viewport[2]; + in[1] = (in[1] - viewport[1]) / viewport[3]; + + /* Map to range -1 to 1 */ + in[0] = in[0] * 2 - 1; + in[1] = in[1] * 2 - 1; + in[2] = in[2] * 2 - 1; + + __gluMultMatrixVecd(finalMatrix, in, out); + if (out[3] == 0.0) return(GL_FALSE); + out[0] /= out[3]; + out[1] /= out[3]; + out[2] /= out[3]; + *objx = out[0]; + *objy = out[1]; + *objz = out[2]; + return(GL_TRUE); +} + +GLint GLAPIENTRY +gluUnProject4(GLdouble winx, GLdouble winy, GLdouble winz, GLdouble clipw, + const GLdouble modelMatrix[16], + const GLdouble projMatrix[16], + const GLint viewport[4], + GLclampd nearVal, GLclampd farVal, + GLdouble *objx, GLdouble *objy, GLdouble *objz, + GLdouble *objw) +{ + double finalMatrix[16]; + double in[4]; + double out[4]; + + __gluMultMatricesd(modelMatrix, projMatrix, finalMatrix); + if (!__gluInvertMatrixd(finalMatrix, finalMatrix)) return(GL_FALSE); + + in[0]=winx; + in[1]=winy; + in[2]=winz; + in[3]=clipw; + + /* Map x and y from window coordinates */ + in[0] = (in[0] - viewport[0]) / viewport[2]; + in[1] = (in[1] - viewport[1]) / viewport[3]; + in[2] = (in[2] - nearVal) / (farVal - nearVal); + + /* Map to range -1 to 1 */ + in[0] = in[0] * 2 - 1; + in[1] = in[1] * 2 - 1; + in[2] = in[2] * 2 - 1; + + __gluMultMatrixVecd(finalMatrix, in, out); + if (out[3] == 0.0) return(GL_FALSE); + *objx = out[0]; + *objy = out[1]; + *objz = out[2]; + *objw = out[3]; + return(GL_TRUE); +} + +void GLAPIENTRY +gluPickMatrix(GLdouble x, GLdouble y, GLdouble deltax, GLdouble deltay, + GLint viewport[4]) +{ + if (deltax <= 0 || deltay <= 0) { + return; + } + + /* Translate and scale the picked region to the entire window */ + glTranslatef((viewport[2] - 2 * (x - viewport[0])) / deltax, + (viewport[3] - 2 * (y - viewport[1])) / deltay, 0); + glScalef(viewport[2] / deltax, viewport[3] / deltay, 1.0); +} diff --git a/mesalib/src/glu/sgi/libutil/quad.c b/mesalib/src/glu/sgi/libutil/quad.c new file mode 100644 index 000000000..d88b20f55 --- /dev/null +++ b/mesalib/src/glu/sgi/libutil/quad.c @@ -0,0 +1,1155 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#include "gluos.h" +#include "gluint.h" +#include +#include +#include +#include +#include + +/* Make it not a power of two to avoid cache thrashing on the chip */ +#define CACHE_SIZE 240 + +#undef PI +#define PI 3.14159265358979323846 + +struct GLUquadric { + GLint normals; + GLboolean textureCoords; + GLint orientation; + GLint drawStyle; + void (GLAPIENTRY *errorCallback)( GLint ); +}; + +GLUquadric * GLAPIENTRY +gluNewQuadric(void) +{ + GLUquadric *newstate; + + newstate = (GLUquadric *) malloc(sizeof(GLUquadric)); + if (newstate == NULL) { + /* Can't report an error at this point... */ + return NULL; + } + newstate->normals = GLU_SMOOTH; + newstate->textureCoords = GL_FALSE; + newstate->orientation = GLU_OUTSIDE; + newstate->drawStyle = GLU_FILL; + newstate->errorCallback = NULL; + return newstate; +} + + +void GLAPIENTRY +gluDeleteQuadric(GLUquadric *state) +{ + free(state); +} + +static void gluQuadricError(GLUquadric *qobj, GLenum which) +{ + if (qobj->errorCallback) { + qobj->errorCallback(which); + } +} + +void GLAPIENTRY +gluQuadricCallback(GLUquadric *qobj, GLenum which, _GLUfuncptr fn) +{ + switch (which) { + case GLU_ERROR: + qobj->errorCallback = (void (GLAPIENTRY *)(GLint)) fn; + break; + default: + gluQuadricError(qobj, GLU_INVALID_ENUM); + return; + } +} + +void GLAPIENTRY +gluQuadricNormals(GLUquadric *qobj, GLenum normals) +{ + switch (normals) { + case GLU_SMOOTH: + case GLU_FLAT: + case GLU_NONE: + break; + default: + gluQuadricError(qobj, GLU_INVALID_ENUM); + return; + } + qobj->normals = normals; +} + +void GLAPIENTRY +gluQuadricTexture(GLUquadric *qobj, GLboolean textureCoords) +{ + qobj->textureCoords = textureCoords; +} + +void GLAPIENTRY +gluQuadricOrientation(GLUquadric *qobj, GLenum orientation) +{ + switch(orientation) { + case GLU_OUTSIDE: + case GLU_INSIDE: + break; + default: + gluQuadricError(qobj, GLU_INVALID_ENUM); + return; + } + qobj->orientation = orientation; +} + +void GLAPIENTRY +gluQuadricDrawStyle(GLUquadric *qobj, GLenum drawStyle) +{ + switch(drawStyle) { + case GLU_POINT: + case GLU_LINE: + case GLU_FILL: + case GLU_SILHOUETTE: + break; + default: + gluQuadricError(qobj, GLU_INVALID_ENUM); + return; + } + qobj->drawStyle = drawStyle; +} + +void GLAPIENTRY +gluCylinder(GLUquadric *qobj, GLdouble baseRadius, GLdouble topRadius, + GLdouble height, GLint slices, GLint stacks) +{ + GLint i,j; + GLfloat sinCache[CACHE_SIZE]; + GLfloat cosCache[CACHE_SIZE]; + GLfloat sinCache2[CACHE_SIZE]; + GLfloat cosCache2[CACHE_SIZE]; + GLfloat sinCache3[CACHE_SIZE]; + GLfloat cosCache3[CACHE_SIZE]; + GLfloat angle; + GLfloat zLow, zHigh; + GLfloat sintemp, costemp; + GLfloat length; + GLfloat deltaRadius; + GLfloat zNormal; + GLfloat xyNormalRatio; + GLfloat radiusLow, radiusHigh; + int needCache2, needCache3; + + if (slices >= CACHE_SIZE) slices = CACHE_SIZE-1; + + if (slices < 2 || stacks < 1 || baseRadius < 0.0 || topRadius < 0.0 || + height < 0.0) { + gluQuadricError(qobj, GLU_INVALID_VALUE); + return; + } + + /* Compute length (needed for normal calculations) */ + deltaRadius = baseRadius - topRadius; + length = SQRT(deltaRadius*deltaRadius + height*height); + if (length == 0.0) { + gluQuadricError(qobj, GLU_INVALID_VALUE); + return; + } + + /* Cache is the vertex locations cache */ + /* Cache2 is the various normals at the vertices themselves */ + /* Cache3 is the various normals for the faces */ + needCache2 = needCache3 = 0; + if (qobj->normals == GLU_SMOOTH) { + needCache2 = 1; + } + + if (qobj->normals == GLU_FLAT) { + if (qobj->drawStyle != GLU_POINT) { + needCache3 = 1; + } + if (qobj->drawStyle == GLU_LINE) { + needCache2 = 1; + } + } + + zNormal = deltaRadius / length; + xyNormalRatio = height / length; + + for (i = 0; i < slices; i++) { + angle = 2 * PI * i / slices; + if (needCache2) { + if (qobj->orientation == GLU_OUTSIDE) { + sinCache2[i] = xyNormalRatio * SIN(angle); + cosCache2[i] = xyNormalRatio * COS(angle); + } else { + sinCache2[i] = -xyNormalRatio * SIN(angle); + cosCache2[i] = -xyNormalRatio * COS(angle); + } + } + sinCache[i] = SIN(angle); + cosCache[i] = COS(angle); + } + + if (needCache3) { + for (i = 0; i < slices; i++) { + angle = 2 * PI * (i-0.5) / slices; + if (qobj->orientation == GLU_OUTSIDE) { + sinCache3[i] = xyNormalRatio * SIN(angle); + cosCache3[i] = xyNormalRatio * COS(angle); + } else { + sinCache3[i] = -xyNormalRatio * SIN(angle); + cosCache3[i] = -xyNormalRatio * COS(angle); + } + } + } + + sinCache[slices] = sinCache[0]; + cosCache[slices] = cosCache[0]; + if (needCache2) { + sinCache2[slices] = sinCache2[0]; + cosCache2[slices] = cosCache2[0]; + } + if (needCache3) { + sinCache3[slices] = sinCache3[0]; + cosCache3[slices] = cosCache3[0]; + } + + switch (qobj->drawStyle) { + case GLU_FILL: + /* Note: + ** An argument could be made for using a TRIANGLE_FAN for the end + ** of the cylinder of either radii is 0.0 (a cone). However, a + ** TRIANGLE_FAN would not work in smooth shading mode (the common + ** case) because the normal for the apex is different for every + ** triangle (and TRIANGLE_FAN doesn't let me respecify that normal). + ** Now, my choice is GL_TRIANGLES, or leave the GL_QUAD_STRIP and + ** just let the GL trivially reject one of the two triangles of the + ** QUAD. GL_QUAD_STRIP is probably faster, so I will leave this code + ** alone. + */ + for (j = 0; j < stacks; j++) { + zLow = j * height / stacks; + zHigh = (j + 1) * height / stacks; + radiusLow = baseRadius - deltaRadius * ((float) j / stacks); + radiusHigh = baseRadius - deltaRadius * ((float) (j + 1) / stacks); + + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= slices; i++) { + switch(qobj->normals) { + case GLU_FLAT: + glNormal3f(sinCache3[i], cosCache3[i], zNormal); + break; + case GLU_SMOOTH: + glNormal3f(sinCache2[i], cosCache2[i], zNormal); + break; + case GLU_NONE: + default: + break; + } + if (qobj->orientation == GLU_OUTSIDE) { + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + (float) j / stacks); + } + glVertex3f(radiusLow * sinCache[i], + radiusLow * cosCache[i], zLow); + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + (float) (j+1) / stacks); + } + glVertex3f(radiusHigh * sinCache[i], + radiusHigh * cosCache[i], zHigh); + } else { + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + (float) (j+1) / stacks); + } + glVertex3f(radiusHigh * sinCache[i], + radiusHigh * cosCache[i], zHigh); + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + (float) j / stacks); + } + glVertex3f(radiusLow * sinCache[i], + radiusLow * cosCache[i], zLow); + } + } + glEnd(); + } + break; + case GLU_POINT: + glBegin(GL_POINTS); + for (i = 0; i < slices; i++) { + switch(qobj->normals) { + case GLU_FLAT: + case GLU_SMOOTH: + glNormal3f(sinCache2[i], cosCache2[i], zNormal); + break; + case GLU_NONE: + default: + break; + } + sintemp = sinCache[i]; + costemp = cosCache[i]; + for (j = 0; j <= stacks; j++) { + zLow = j * height / stacks; + radiusLow = baseRadius - deltaRadius * ((float) j / stacks); + + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + (float) j / stacks); + } + glVertex3f(radiusLow * sintemp, + radiusLow * costemp, zLow); + } + } + glEnd(); + break; + case GLU_LINE: + for (j = 1; j < stacks; j++) { + zLow = j * height / stacks; + radiusLow = baseRadius - deltaRadius * ((float) j / stacks); + + glBegin(GL_LINE_STRIP); + for (i = 0; i <= slices; i++) { + switch(qobj->normals) { + case GLU_FLAT: + glNormal3f(sinCache3[i], cosCache3[i], zNormal); + break; + case GLU_SMOOTH: + glNormal3f(sinCache2[i], cosCache2[i], zNormal); + break; + case GLU_NONE: + default: + break; + } + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + (float) j / stacks); + } + glVertex3f(radiusLow * sinCache[i], + radiusLow * cosCache[i], zLow); + } + glEnd(); + } + /* Intentionally fall through here... */ + case GLU_SILHOUETTE: + for (j = 0; j <= stacks; j += stacks) { + zLow = j * height / stacks; + radiusLow = baseRadius - deltaRadius * ((float) j / stacks); + + glBegin(GL_LINE_STRIP); + for (i = 0; i <= slices; i++) { + switch(qobj->normals) { + case GLU_FLAT: + glNormal3f(sinCache3[i], cosCache3[i], zNormal); + break; + case GLU_SMOOTH: + glNormal3f(sinCache2[i], cosCache2[i], zNormal); + break; + case GLU_NONE: + default: + break; + } + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + (float) j / stacks); + } + glVertex3f(radiusLow * sinCache[i], radiusLow * cosCache[i], + zLow); + } + glEnd(); + } + for (i = 0; i < slices; i++) { + switch(qobj->normals) { + case GLU_FLAT: + case GLU_SMOOTH: + glNormal3f(sinCache2[i], cosCache2[i], 0.0); + break; + case GLU_NONE: + default: + break; + } + sintemp = sinCache[i]; + costemp = cosCache[i]; + glBegin(GL_LINE_STRIP); + for (j = 0; j <= stacks; j++) { + zLow = j * height / stacks; + radiusLow = baseRadius - deltaRadius * ((float) j / stacks); + + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + (float) j / stacks); + } + glVertex3f(radiusLow * sintemp, + radiusLow * costemp, zLow); + } + glEnd(); + } + break; + default: + break; + } +} + +void GLAPIENTRY +gluDisk(GLUquadric *qobj, GLdouble innerRadius, GLdouble outerRadius, + GLint slices, GLint loops) +{ + gluPartialDisk(qobj, innerRadius, outerRadius, slices, loops, 0.0, 360.0); +} + +void GLAPIENTRY +gluPartialDisk(GLUquadric *qobj, GLdouble innerRadius, + GLdouble outerRadius, GLint slices, GLint loops, + GLdouble startAngle, GLdouble sweepAngle) +{ + GLint i,j; + GLfloat sinCache[CACHE_SIZE]; + GLfloat cosCache[CACHE_SIZE]; + GLfloat angle; + GLfloat sintemp, costemp; + GLfloat deltaRadius; + GLfloat radiusLow, radiusHigh; + GLfloat texLow = 0.0, texHigh = 0.0; + GLfloat angleOffset; + GLint slices2; + GLint finish; + + if (slices >= CACHE_SIZE) slices = CACHE_SIZE-1; + if (slices < 2 || loops < 1 || outerRadius <= 0.0 || innerRadius < 0.0 || + innerRadius > outerRadius) { + gluQuadricError(qobj, GLU_INVALID_VALUE); + return; + } + + if (sweepAngle < -360.0) sweepAngle = 360.0; + if (sweepAngle > 360.0) sweepAngle = 360.0; + if (sweepAngle < 0) { + startAngle += sweepAngle; + sweepAngle = -sweepAngle; + } + + if (sweepAngle == 360.0) { + slices2 = slices; + } else { + slices2 = slices + 1; + } + + /* Compute length (needed for normal calculations) */ + deltaRadius = outerRadius - innerRadius; + + /* Cache is the vertex locations cache */ + + angleOffset = startAngle / 180.0 * PI; + for (i = 0; i <= slices; i++) { + angle = angleOffset + ((PI * sweepAngle) / 180.0) * i / slices; + sinCache[i] = SIN(angle); + cosCache[i] = COS(angle); + } + + if (sweepAngle == 360.0) { + sinCache[slices] = sinCache[0]; + cosCache[slices] = cosCache[0]; + } + + switch(qobj->normals) { + case GLU_FLAT: + case GLU_SMOOTH: + if (qobj->orientation == GLU_OUTSIDE) { + glNormal3f(0.0, 0.0, 1.0); + } else { + glNormal3f(0.0, 0.0, -1.0); + } + break; + default: + case GLU_NONE: + break; + } + + switch (qobj->drawStyle) { + case GLU_FILL: + if (innerRadius == 0.0) { + finish = loops - 1; + /* Triangle strip for inner polygons */ + glBegin(GL_TRIANGLE_FAN); + if (qobj->textureCoords) { + glTexCoord2f(0.5, 0.5); + } + glVertex3f(0.0, 0.0, 0.0); + radiusLow = outerRadius - + deltaRadius * ((float) (loops-1) / loops); + if (qobj->textureCoords) { + texLow = radiusLow / outerRadius / 2; + } + + if (qobj->orientation == GLU_OUTSIDE) { + for (i = slices; i >= 0; i--) { + if (qobj->textureCoords) { + glTexCoord2f(texLow * sinCache[i] + 0.5, + texLow * cosCache[i] + 0.5); + } + glVertex3f(radiusLow * sinCache[i], + radiusLow * cosCache[i], 0.0); + } + } else { + for (i = 0; i <= slices; i++) { + if (qobj->textureCoords) { + glTexCoord2f(texLow * sinCache[i] + 0.5, + texLow * cosCache[i] + 0.5); + } + glVertex3f(radiusLow * sinCache[i], + radiusLow * cosCache[i], 0.0); + } + } + glEnd(); + } else { + finish = loops; + } + for (j = 0; j < finish; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + radiusHigh = outerRadius - deltaRadius * ((float) (j + 1) / loops); + if (qobj->textureCoords) { + texLow = radiusLow / outerRadius / 2; + texHigh = radiusHigh / outerRadius / 2; + } + + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= slices; i++) { + if (qobj->orientation == GLU_OUTSIDE) { + if (qobj->textureCoords) { + glTexCoord2f(texLow * sinCache[i] + 0.5, + texLow * cosCache[i] + 0.5); + } + glVertex3f(radiusLow * sinCache[i], + radiusLow * cosCache[i], 0.0); + + if (qobj->textureCoords) { + glTexCoord2f(texHigh * sinCache[i] + 0.5, + texHigh * cosCache[i] + 0.5); + } + glVertex3f(radiusHigh * sinCache[i], + radiusHigh * cosCache[i], 0.0); + } else { + if (qobj->textureCoords) { + glTexCoord2f(texHigh * sinCache[i] + 0.5, + texHigh * cosCache[i] + 0.5); + } + glVertex3f(radiusHigh * sinCache[i], + radiusHigh * cosCache[i], 0.0); + + if (qobj->textureCoords) { + glTexCoord2f(texLow * sinCache[i] + 0.5, + texLow * cosCache[i] + 0.5); + } + glVertex3f(radiusLow * sinCache[i], + radiusLow * cosCache[i], 0.0); + } + } + glEnd(); + } + break; + case GLU_POINT: + glBegin(GL_POINTS); + for (i = 0; i < slices2; i++) { + sintemp = sinCache[i]; + costemp = cosCache[i]; + for (j = 0; j <= loops; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + + if (qobj->textureCoords) { + texLow = radiusLow / outerRadius / 2; + + glTexCoord2f(texLow * sinCache[i] + 0.5, + texLow * cosCache[i] + 0.5); + } + glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0); + } + } + glEnd(); + break; + case GLU_LINE: + if (innerRadius == outerRadius) { + glBegin(GL_LINE_STRIP); + + for (i = 0; i <= slices; i++) { + if (qobj->textureCoords) { + glTexCoord2f(sinCache[i] / 2 + 0.5, + cosCache[i] / 2 + 0.5); + } + glVertex3f(innerRadius * sinCache[i], + innerRadius * cosCache[i], 0.0); + } + glEnd(); + break; + } + for (j = 0; j <= loops; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + if (qobj->textureCoords) { + texLow = radiusLow / outerRadius / 2; + } + + glBegin(GL_LINE_STRIP); + for (i = 0; i <= slices; i++) { + if (qobj->textureCoords) { + glTexCoord2f(texLow * sinCache[i] + 0.5, + texLow * cosCache[i] + 0.5); + } + glVertex3f(radiusLow * sinCache[i], + radiusLow * cosCache[i], 0.0); + } + glEnd(); + } + for (i=0; i < slices2; i++) { + sintemp = sinCache[i]; + costemp = cosCache[i]; + glBegin(GL_LINE_STRIP); + for (j = 0; j <= loops; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + if (qobj->textureCoords) { + texLow = radiusLow / outerRadius / 2; + } + + if (qobj->textureCoords) { + glTexCoord2f(texLow * sinCache[i] + 0.5, + texLow * cosCache[i] + 0.5); + } + glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0); + } + glEnd(); + } + break; + case GLU_SILHOUETTE: + if (sweepAngle < 360.0) { + for (i = 0; i <= slices; i+= slices) { + sintemp = sinCache[i]; + costemp = cosCache[i]; + glBegin(GL_LINE_STRIP); + for (j = 0; j <= loops; j++) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + + if (qobj->textureCoords) { + texLow = radiusLow / outerRadius / 2; + glTexCoord2f(texLow * sinCache[i] + 0.5, + texLow * cosCache[i] + 0.5); + } + glVertex3f(radiusLow * sintemp, radiusLow * costemp, 0.0); + } + glEnd(); + } + } + for (j = 0; j <= loops; j += loops) { + radiusLow = outerRadius - deltaRadius * ((float) j / loops); + if (qobj->textureCoords) { + texLow = radiusLow / outerRadius / 2; + } + + glBegin(GL_LINE_STRIP); + for (i = 0; i <= slices; i++) { + if (qobj->textureCoords) { + glTexCoord2f(texLow * sinCache[i] + 0.5, + texLow * cosCache[i] + 0.5); + } + glVertex3f(radiusLow * sinCache[i], + radiusLow * cosCache[i], 0.0); + } + glEnd(); + if (innerRadius == outerRadius) break; + } + break; + default: + break; + } +} + +void GLAPIENTRY +gluSphere(GLUquadric *qobj, GLdouble radius, GLint slices, GLint stacks) +{ + GLint i,j; + GLfloat sinCache1a[CACHE_SIZE]; + GLfloat cosCache1a[CACHE_SIZE]; + GLfloat sinCache2a[CACHE_SIZE]; + GLfloat cosCache2a[CACHE_SIZE]; + GLfloat sinCache3a[CACHE_SIZE]; + GLfloat cosCache3a[CACHE_SIZE]; + GLfloat sinCache1b[CACHE_SIZE]; + GLfloat cosCache1b[CACHE_SIZE]; + GLfloat sinCache2b[CACHE_SIZE]; + GLfloat cosCache2b[CACHE_SIZE]; + GLfloat sinCache3b[CACHE_SIZE]; + GLfloat cosCache3b[CACHE_SIZE]; + GLfloat angle; + GLfloat zLow, zHigh; + GLfloat sintemp1 = 0.0, sintemp2 = 0.0, sintemp3 = 0.0, sintemp4 = 0.0; + GLfloat costemp1 = 0.0, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0; + GLboolean needCache2, needCache3; + GLint start, finish; + + if (slices >= CACHE_SIZE) slices = CACHE_SIZE-1; + if (stacks >= CACHE_SIZE) stacks = CACHE_SIZE-1; + if (slices < 2 || stacks < 1 || radius < 0.0) { + gluQuadricError(qobj, GLU_INVALID_VALUE); + return; + } + + /* Cache is the vertex locations cache */ + /* Cache2 is the various normals at the vertices themselves */ + /* Cache3 is the various normals for the faces */ + needCache2 = needCache3 = GL_FALSE; + + if (qobj->normals == GLU_SMOOTH) { + needCache2 = GL_TRUE; + } + + if (qobj->normals == GLU_FLAT) { + if (qobj->drawStyle != GLU_POINT) { + needCache3 = GL_TRUE; + } + if (qobj->drawStyle == GLU_LINE) { + needCache2 = GL_TRUE; + } + } + + for (i = 0; i < slices; i++) { + angle = 2 * PI * i / slices; + sinCache1a[i] = SIN(angle); + cosCache1a[i] = COS(angle); + if (needCache2) { + sinCache2a[i] = sinCache1a[i]; + cosCache2a[i] = cosCache1a[i]; + } + } + + for (j = 0; j <= stacks; j++) { + angle = PI * j / stacks; + if (needCache2) { + if (qobj->orientation == GLU_OUTSIDE) { + sinCache2b[j] = SIN(angle); + cosCache2b[j] = COS(angle); + } else { + sinCache2b[j] = -SIN(angle); + cosCache2b[j] = -COS(angle); + } + } + sinCache1b[j] = radius * SIN(angle); + cosCache1b[j] = radius * COS(angle); + } + /* Make sure it comes to a point */ + sinCache1b[0] = 0; + sinCache1b[stacks] = 0; + + if (needCache3) { + for (i = 0; i < slices; i++) { + angle = 2 * PI * (i-0.5) / slices; + sinCache3a[i] = SIN(angle); + cosCache3a[i] = COS(angle); + } + for (j = 0; j <= stacks; j++) { + angle = PI * (j - 0.5) / stacks; + if (qobj->orientation == GLU_OUTSIDE) { + sinCache3b[j] = SIN(angle); + cosCache3b[j] = COS(angle); + } else { + sinCache3b[j] = -SIN(angle); + cosCache3b[j] = -COS(angle); + } + } + } + + sinCache1a[slices] = sinCache1a[0]; + cosCache1a[slices] = cosCache1a[0]; + if (needCache2) { + sinCache2a[slices] = sinCache2a[0]; + cosCache2a[slices] = cosCache2a[0]; + } + if (needCache3) { + sinCache3a[slices] = sinCache3a[0]; + cosCache3a[slices] = cosCache3a[0]; + } + + switch (qobj->drawStyle) { + case GLU_FILL: + /* Do ends of sphere as TRIANGLE_FAN's (if not texturing) + ** We don't do it when texturing because we need to respecify the + ** texture coordinates of the apex for every adjacent vertex (because + ** it isn't a constant for that point) + */ + if (!(qobj->textureCoords)) { + start = 1; + finish = stacks - 1; + + /* Low end first (j == 0 iteration) */ + sintemp2 = sinCache1b[1]; + zHigh = cosCache1b[1]; + switch(qobj->normals) { + case GLU_FLAT: + sintemp3 = sinCache3b[1]; + costemp3 = cosCache3b[1]; + break; + case GLU_SMOOTH: + sintemp3 = sinCache2b[1]; + costemp3 = cosCache2b[1]; + glNormal3f(sinCache2a[0] * sinCache2b[0], + cosCache2a[0] * sinCache2b[0], + cosCache2b[0]); + break; + default: + break; + } + glBegin(GL_TRIANGLE_FAN); + glVertex3f(0.0, 0.0, radius); + if (qobj->orientation == GLU_OUTSIDE) { + for (i = slices; i >= 0; i--) { + switch(qobj->normals) { + case GLU_SMOOTH: + glNormal3f(sinCache2a[i] * sintemp3, + cosCache2a[i] * sintemp3, + costemp3); + break; + case GLU_FLAT: + if (i != slices) { + glNormal3f(sinCache3a[i+1] * sintemp3, + cosCache3a[i+1] * sintemp3, + costemp3); + } + break; + case GLU_NONE: + default: + break; + } + glVertex3f(sintemp2 * sinCache1a[i], + sintemp2 * cosCache1a[i], zHigh); + } + } else { + for (i = 0; i <= slices; i++) { + switch(qobj->normals) { + case GLU_SMOOTH: + glNormal3f(sinCache2a[i] * sintemp3, + cosCache2a[i] * sintemp3, + costemp3); + break; + case GLU_FLAT: + glNormal3f(sinCache3a[i] * sintemp3, + cosCache3a[i] * sintemp3, + costemp3); + break; + case GLU_NONE: + default: + break; + } + glVertex3f(sintemp2 * sinCache1a[i], + sintemp2 * cosCache1a[i], zHigh); + } + } + glEnd(); + + /* High end next (j == stacks-1 iteration) */ + sintemp2 = sinCache1b[stacks-1]; + zHigh = cosCache1b[stacks-1]; + switch(qobj->normals) { + case GLU_FLAT: + sintemp3 = sinCache3b[stacks]; + costemp3 = cosCache3b[stacks]; + break; + case GLU_SMOOTH: + sintemp3 = sinCache2b[stacks-1]; + costemp3 = cosCache2b[stacks-1]; + glNormal3f(sinCache2a[stacks] * sinCache2b[stacks], + cosCache2a[stacks] * sinCache2b[stacks], + cosCache2b[stacks]); + break; + default: + break; + } + glBegin(GL_TRIANGLE_FAN); + glVertex3f(0.0, 0.0, -radius); + if (qobj->orientation == GLU_OUTSIDE) { + for (i = 0; i <= slices; i++) { + switch(qobj->normals) { + case GLU_SMOOTH: + glNormal3f(sinCache2a[i] * sintemp3, + cosCache2a[i] * sintemp3, + costemp3); + break; + case GLU_FLAT: + glNormal3f(sinCache3a[i] * sintemp3, + cosCache3a[i] * sintemp3, + costemp3); + break; + case GLU_NONE: + default: + break; + } + glVertex3f(sintemp2 * sinCache1a[i], + sintemp2 * cosCache1a[i], zHigh); + } + } else { + for (i = slices; i >= 0; i--) { + switch(qobj->normals) { + case GLU_SMOOTH: + glNormal3f(sinCache2a[i] * sintemp3, + cosCache2a[i] * sintemp3, + costemp3); + break; + case GLU_FLAT: + if (i != slices) { + glNormal3f(sinCache3a[i+1] * sintemp3, + cosCache3a[i+1] * sintemp3, + costemp3); + } + break; + case GLU_NONE: + default: + break; + } + glVertex3f(sintemp2 * sinCache1a[i], + sintemp2 * cosCache1a[i], zHigh); + } + } + glEnd(); + } else { + start = 0; + finish = stacks; + } + for (j = start; j < finish; j++) { + zLow = cosCache1b[j]; + zHigh = cosCache1b[j+1]; + sintemp1 = sinCache1b[j]; + sintemp2 = sinCache1b[j+1]; + switch(qobj->normals) { + case GLU_FLAT: + sintemp4 = sinCache3b[j+1]; + costemp4 = cosCache3b[j+1]; + break; + case GLU_SMOOTH: + if (qobj->orientation == GLU_OUTSIDE) { + sintemp3 = sinCache2b[j+1]; + costemp3 = cosCache2b[j+1]; + sintemp4 = sinCache2b[j]; + costemp4 = cosCache2b[j]; + } else { + sintemp3 = sinCache2b[j]; + costemp3 = cosCache2b[j]; + sintemp4 = sinCache2b[j+1]; + costemp4 = cosCache2b[j+1]; + } + break; + default: + break; + } + + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= slices; i++) { + switch(qobj->normals) { + case GLU_SMOOTH: + glNormal3f(sinCache2a[i] * sintemp3, + cosCache2a[i] * sintemp3, + costemp3); + break; + case GLU_FLAT: + case GLU_NONE: + default: + break; + } + if (qobj->orientation == GLU_OUTSIDE) { + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + 1 - (float) (j+1) / stacks); + } + glVertex3f(sintemp2 * sinCache1a[i], + sintemp2 * cosCache1a[i], zHigh); + } else { + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + 1 - (float) j / stacks); + } + glVertex3f(sintemp1 * sinCache1a[i], + sintemp1 * cosCache1a[i], zLow); + } + switch(qobj->normals) { + case GLU_SMOOTH: + glNormal3f(sinCache2a[i] * sintemp4, + cosCache2a[i] * sintemp4, + costemp4); + break; + case GLU_FLAT: + glNormal3f(sinCache3a[i] * sintemp4, + cosCache3a[i] * sintemp4, + costemp4); + break; + case GLU_NONE: + default: + break; + } + if (qobj->orientation == GLU_OUTSIDE) { + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + 1 - (float) j / stacks); + } + glVertex3f(sintemp1 * sinCache1a[i], + sintemp1 * cosCache1a[i], zLow); + } else { + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + 1 - (float) (j+1) / stacks); + } + glVertex3f(sintemp2 * sinCache1a[i], + sintemp2 * cosCache1a[i], zHigh); + } + } + glEnd(); + } + break; + case GLU_POINT: + glBegin(GL_POINTS); + for (j = 0; j <= stacks; j++) { + sintemp1 = sinCache1b[j]; + costemp1 = cosCache1b[j]; + switch(qobj->normals) { + case GLU_FLAT: + case GLU_SMOOTH: + sintemp2 = sinCache2b[j]; + costemp2 = cosCache2b[j]; + break; + default: + break; + } + for (i = 0; i < slices; i++) { + switch(qobj->normals) { + case GLU_FLAT: + case GLU_SMOOTH: + glNormal3f(sinCache2a[i] * sintemp2, + cosCache2a[i] * sintemp2, + costemp2); + break; + case GLU_NONE: + default: + break; + } + + zLow = j * radius / stacks; + + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + 1 - (float) j / stacks); + } + glVertex3f(sintemp1 * sinCache1a[i], + sintemp1 * cosCache1a[i], costemp1); + } + } + glEnd(); + break; + case GLU_LINE: + case GLU_SILHOUETTE: + for (j = 1; j < stacks; j++) { + sintemp1 = sinCache1b[j]; + costemp1 = cosCache1b[j]; + switch(qobj->normals) { + case GLU_FLAT: + case GLU_SMOOTH: + sintemp2 = sinCache2b[j]; + costemp2 = cosCache2b[j]; + break; + default: + break; + } + + glBegin(GL_LINE_STRIP); + for (i = 0; i <= slices; i++) { + switch(qobj->normals) { + case GLU_FLAT: + glNormal3f(sinCache3a[i] * sintemp2, + cosCache3a[i] * sintemp2, + costemp2); + break; + case GLU_SMOOTH: + glNormal3f(sinCache2a[i] * sintemp2, + cosCache2a[i] * sintemp2, + costemp2); + break; + case GLU_NONE: + default: + break; + } + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + 1 - (float) j / stacks); + } + glVertex3f(sintemp1 * sinCache1a[i], + sintemp1 * cosCache1a[i], costemp1); + } + glEnd(); + } + for (i = 0; i < slices; i++) { + sintemp1 = sinCache1a[i]; + costemp1 = cosCache1a[i]; + switch(qobj->normals) { + case GLU_FLAT: + case GLU_SMOOTH: + sintemp2 = sinCache2a[i]; + costemp2 = cosCache2a[i]; + break; + default: + break; + } + + glBegin(GL_LINE_STRIP); + for (j = 0; j <= stacks; j++) { + switch(qobj->normals) { + case GLU_FLAT: + glNormal3f(sintemp2 * sinCache3b[j], + costemp2 * sinCache3b[j], + cosCache3b[j]); + break; + case GLU_SMOOTH: + glNormal3f(sintemp2 * sinCache2b[j], + costemp2 * sinCache2b[j], + cosCache2b[j]); + break; + case GLU_NONE: + default: + break; + } + + if (qobj->textureCoords) { + glTexCoord2f(1 - (float) i / slices, + 1 - (float) j / stacks); + } + glVertex3f(sintemp1 * sinCache1b[j], + costemp1 * sinCache1b[j], cosCache1b[j]); + } + glEnd(); + } + break; + default: + break; + } +} diff --git a/mesalib/src/glu/sgi/libutil/registry.c b/mesalib/src/glu/sgi/libutil/registry.c new file mode 100644 index 000000000..2e3b574fb --- /dev/null +++ b/mesalib/src/glu/sgi/libutil/registry.c @@ -0,0 +1,91 @@ +/* + * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) + * Copyright (C) 1991-2000 Silicon Graphics, Inc. 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 including the dates of first publication and + * either this permission notice or a reference to + * http://oss.sgi.com/projects/FreeB/ + * 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 + * SILICON GRAPHICS, INC. 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. + * + * Except as contained in this notice, the name of Silicon Graphics, Inc. + * shall not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization from + * Silicon Graphics, Inc. + */ + +#include "gluos.h" +#include +#include +#include +#include + +static const GLubyte versionString[] = "1.3"; +static const GLubyte extensionString[] = + "GLU_EXT_nurbs_tessellator " + "GLU_EXT_object_space_tess " + ; + +const GLubyte * GLAPIENTRY +gluGetString(GLenum name) +{ + + if (name == GLU_VERSION) { + return versionString; + } else if (name == GLU_EXTENSIONS) { + return extensionString; + } + return NULL; +} + +/* extName is an extension name. + * extString is a string of extensions separated by blank(s). There may or + * may not be leading or trailing blank(s) in extString. + * This works in cases of extensions being prefixes of another like + * GL_EXT_texture and GL_EXT_texture3D. + * Returns GL_TRUE if extName is found otherwise it returns GL_FALSE. + */ +GLboolean GLAPIENTRY +gluCheckExtension(const GLubyte *extName, const GLubyte *extString) +{ + GLboolean flag = GL_FALSE; + char *word; + char *lookHere; + char *deleteThis; + + if (extString == NULL) return GL_FALSE; + + deleteThis = lookHere = (char *)malloc(strlen((const char *)extString)+1); + if (lookHere == NULL) + return GL_FALSE; + /* strtok() will modify string, so copy it somewhere */ + strcpy(lookHere,(const char *)extString); + + while ((word= strtok(lookHere," ")) != NULL) { + if (strcmp(word,(const char *)extName) == 0) { + flag = GL_TRUE; + break; + } + lookHere = NULL; /* get next token */ + } + free((void *)deleteThis); + return flag; +} /* gluCheckExtension() */ + + + +/*** registry.c ***/ diff --git a/mesalib/src/mesa/Makefile b/mesalib/src/mesa/Makefile new file mode 100644 index 000000000..8300b3014 --- /dev/null +++ b/mesalib/src/mesa/Makefile @@ -0,0 +1,166 @@ +# src/mesa/Makefile + +TOP = ../.. +include $(TOP)/configs/current + +include sources.mak + +.SUFFIXES : .cpp + +.c.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + +.cpp.o: + $(CXX) -c $(INCLUDE_DIRS) $(CXXFLAGS) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@ + + + + +# Default: build dependencies, then asm_subdirs, then convenience +# libs (.a) and finally the device drivers: +default: depend asm_subdirs libmesa.a libmesagallium.a libglapi.a \ + driver_subdirs + + + +###################################################################### +# Helper libraries used by many drivers: + +# Make archive of core mesa object files +libmesa.a: $(MESA_OBJECTS) + @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) + +# Make archive of subset of core mesa object files for gallium +libmesagallium.a: $(MESA_GALLIUM_OBJECTS) + @ $(MKLIB) -o mesagallium -static $(MESA_GALLIUM_OBJECTS) + +# Make archive of gl* API dispatcher functions only +libglapi.a: $(GLAPI_OBJECTS) + @if [ "${WINDOW_SYSTEM}" = "dri" ] ; then \ + touch libglapi.a ; \ + else \ + $(MKLIB) -o glapi -static $(GLAPI_OBJECTS) ; \ + fi + +###################################################################### +# Device drivers +driver_subdirs: libmesa.a libglapi.a + @ (cd drivers && $(MAKE)) + + +###################################################################### +# Assembly subdirs +asm_subdirs: + @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_ASM ; then \ + (cd x86 && $(MAKE)) || exit 1 ; \ + fi + @ if echo "$(ASM_FLAGS)" | grep -q USE_X86_64_ASM ; then \ + (cd x86 && $(MAKE)) || exit 1 ; \ + (cd x86-64 && $(MAKE)) || exit 1 ; \ + fi + + +###################################################################### +# Dependency generation + +depend: $(ALL_SOURCES) + @ echo "running $(MKDEP)" + @ touch depend + @$(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDE_DIRS) $(ALL_SOURCES) \ + > /dev/null 2>/dev/null + + +###################################################################### +# Installation rules + +# this isn't fleshed out yet but is probably the way to go in the future +new_install: + (cd drivers && $(MAKE) install) + + +# XXX replace this with new_install above someday +install: default + @for driver in $(DRIVER_DIRS) ; do \ + case "$$driver" in \ + osmesa) if [ "$(DRIVER_DIRS)" = osmesa ]; then \ + $(MAKE) install-headers install-osmesa || exit 1 ; \ + else \ + $(MAKE) install-osmesa || exit 1 ; \ + fi ;; \ + dri) $(MAKE) install-libgl install-dri || exit 1 ;; \ + *) $(MAKE) install-libgl || exit 1 ;; \ + esac ; \ + done + + +gl_pcedit = sed \ + -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ + -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ + -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ + -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + -e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \ + -e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \ + -e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \ + -e 's,@GL_LIB@,$(GL_LIB),' + +gl.pc: gl.pc.in + $(gl_pcedit) $< > $@ + +osmesa_pcedit = sed \ + -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ + -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ + -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ + -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + -e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \ + -e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \ + -e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),' + +osmesa.pc: osmesa.pc.in + $(osmesa_pcedit) $< > $@ + +install-headers: + $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL + $(INSTALL) -m 644 $(TOP)/include/GL/*.h \ + $(DESTDIR)$(INSTALL_INC_DIR)/GL + +install-libgl: default gl.pc install-headers + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \ + $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + +install-osmesa: default osmesa.pc + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + $(MINSTALL) $(TOP)/$(LIB_DIR)/$(OSMESA_LIB_GLOB) \ + $(DESTDIR)$(INSTALL_LIB_DIR) + $(INSTALL) -m 644 osmesa.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + +install-dri: default + cd drivers/dri && $(MAKE) install + + + +# Emacs tags +tags: + etags `find . -name \*.[ch]` $(TOP)/include/GL/*.h + + +clean: + -rm -f */*.o + -rm -f */*/*.o + -rm -f depend depend.bak libmesa.a libglapi.a + -rm -f drivers/*/*.o + -rm -f *.pc + -@cd drivers/dri && $(MAKE) clean + -@cd drivers/x11 && $(MAKE) clean + -@cd drivers/osmesa && $(MAKE) clean + -@cd x86 && $(MAKE) clean + -@cd x86-64 && $(MAKE) clean + + +-include depend diff --git a/mesalib/src/mesa/Makefile.mgw b/mesalib/src/mesa/Makefile.mgw new file mode 100644 index 000000000..097c390a8 --- /dev/null +++ b/mesalib/src/mesa/Makefile.mgw @@ -0,0 +1,235 @@ +# Mesa 3-D graphics library +# Version: 7.0 +# +# Copyright (C) 1999-2003 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. + +# MinGW core makefile v1.4 for Mesa +# +# Copyright (C) 2002 - Daniel Borca +# Email : dborca@users.sourceforge.net +# Web : http://www.geocities.com/dborca + +# MinGW core-gl makefile updated for Mesa 7.0 +# +# updated : by Heromyth, on 2007-7-21 +# Email : zxpmyth@yahoo.com.cn +# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. +# The others havn't been tested yet. +# 2) The generated DLLs are *not* compatible with the ones built +# with the other compilers like VC8, especially for GLUT. +# 3) Although more tests are needed, it can be used individually! + + +# +# Available options: +# +# Environment variables: +# CFLAGS +# +# GLIDE path to Glide3 SDK; used with FX. +# default = $(TOP)/glide3 +# FX=1 build for 3dfx Glide3. Note that this disables +# compilation of most WMesa code and requires fxMesa. +# As a consequence, you'll need the Win32 Glide3 +# library to build any application. +# default = no +# ICD=1 build the installable client driver interface +# (windows opengl driver interface) +# default = no +# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). +# default = no +# +# Targets: +# all: build GL +# clean: remove object files +# + + +.PHONY: all clean +.INTERMEDIATE: x86/gen_matypes.exe +.SUFFIXES: .rc .res + +# Set this to the prefix of your build tools, i.e. mingw32- +TOOLS_PREFIX = mingw32- + +ifeq ($(ICD),1) + LIB_NAME = mesa32 +else + LIB_NAME = opengl32 +endif + +DLL_EXT = .dll +IMP_EXT = .a +LIB_PRE = lib +STRIP = -s + +AR = ar +ARFLAGS = crus +DLLTOOL = dlltool + +TOP = ../.. +GLIDE ?= $(TOP)/glide3 +LIBDIR = $(TOP)/lib + +GL_DLL = $(LIB_NAME)$(DLL_EXT) +GL_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT) + +MESA_LIB = libmesa.a +CC = $(TOOLS_PREFIX)gcc + +LDLIBS = -lgdi32 -luser32 -liberty +LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at + +CFLAGS += -DBUILD_GL32 -D_DLL -DMESA_MINWARN +CFLAGS += -DNDEBUG -DUSE_EXTERNAL_DXTN_LIB=1 + +ifeq ($(FX),1) + CFLAGS += -I$(GLIDE)/include -DFX + LDLIBS += -L$(GLIDE)/lib -lglide3x + GL_DEF = drivers/windows/fx/fxopengl.def + GL_RES = drivers/windows/fx/fx.rc +else + ifeq ($(ICD),1) + CFLAGS += -DUSE_MGL_NAMESPACE + GL_DEF = drivers/windows/icd/mesa.def + else + GL_DEF = $(LIB_NAME).def + endif +endif + + + +UNLINK = del $(subst /,\,$(1)) +ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif +ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif + +include sources.mak + +CFLAGS += $(INCLUDE_DIRS) + +ifeq ($(X86),1) +CFLAGS += -DUSE_X86_ASM +CFLAGS += -DUSE_MMX_ASM +CFLAGS += -DUSE_SSE_ASM +CFLAGS += -DUSE_3DNOW_ASM +X86_SOURCES += $(X86_API) +else +X86_SOURCES = +endif + +ifeq ($(FX),1) +DRIVER_SOURCES = \ + $(GLIDE_DRIVER_SOURCES) \ + drivers/windows/fx/fxwgl.c +else +ifeq ($(ICD),1) +DRIVER_SOURCES = \ + drivers/windows/gdi/wmesa.c \ + drivers/windows/icd/icd.c +else +DRIVER_SOURCES = \ + drivers/windows/gdi/wmesa.c \ + drivers/windows/gdi/wgl.c +endif +endif + +SOURCES = $(MESA_SOURCES) $(GLAPI_SOURCES) $(X86_SOURCES) $(DRIVER_SOURCES) + +OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) + +X86_OBJECTS = $(addsuffix .o,$(basename $(X86_SOURCES))) + +RESOURCE = $(GL_RES:.rc=.res) + +.c.o: + $(CC) -o $@ $(CFLAGS) -c $< +.s.o: + $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< + +.rc.res: + windres -o $@ -Irc -Ocoff $< + + +all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP) + +$(LIBDIR): + mkdir -p $(LIBDIR) + +$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE) + $(CC) $(LDFLAGS) -o $(LIBDIR)/$(GL_DLL) $^ $(LDLIBS) + $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GL_DEF) $^ + $(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GL_IMP) --def $(LIBDIR)/$(GL_DEF) + + +$(X86_OBJECTS): x86/matypes.h + +x86/matypes.h: x86/gen_matypes.exe + $(subst /,\,$< > $@) + +x86/gen_matypes.exe: x86/gen_matypes.c + $(CC) -o $@ $(CFLAGS) -s $< + +# [dBorca] +# glapi_x86.S needs some adjustments +# in order to generate correct entrypoints +# Trick: change the following condition to +# be always false if you need C entrypoints +# with USE_X86_ASM (useful for trace/debug) +ifeq (1,1) +x86/glapi_x86.o: x86/glapi_x86.S + $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< +else +main/dispatch.o: main/dispatch.c + $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< +glapi/glapi.o: glapi/glapi.c + $(CC) -o $@ $(CFLAGS) -UUSE_X86_ASM -c $< +endif + +# [dBorca] +# if we want codegen, we have to stdcall +tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S + $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< + +clean: + -$(call UNLINK,glapi/*.o) + -$(call UNLINK,main/*.o) + -$(call UNLINK,math/*.o) + -$(call UNLINK,vbo/*.o) + -$(call UNLINK,shader/*.o) + -$(call UNLINK,shader/slang/*.o) + -$(call UNLINK,shader/grammar/*.o) + -$(call UNLINK,sparc/*.o) + -$(call UNLINK,ppc/*.o) + -$(call UNLINK,swrast/*.o) + -$(call UNLINK,swrast_setup/*.o) + -$(call UNLINK,tnl/*.o) + -$(call UNLINK,x86/*.o) + -$(call UNLINK,x86/rtasm/*.o) + -$(call UNLINK,x86-64/*.o) + -$(call UNLINK,drivers/common/*.o) + -$(call UNLINK,drivers/glide/*.o) + -$(call UNLINK,drivers/windows/fx/*.o) + -$(call UNLINK,drivers/windows/fx/*.res) + -$(call UNLINK,drivers/windows/gdi/*.o) + -$(call UNLINK,drivers/windows/icd/*.o) diff --git a/mesalib/src/mesa/depend b/mesalib/src/mesa/depend new file mode 100644 index 000000000..e69de29bb diff --git a/mesalib/src/mesa/descrip.mms b/mesalib/src/mesa/descrip.mms new file mode 100644 index 000000000..dbfa336a9 --- /dev/null +++ b/mesalib/src/mesa/descrip.mms @@ -0,0 +1,27 @@ +# Makefile for Mesa for VMS +# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl +# Date last revision : 7 March 2007 + +all : + set default [.main] + $(MMS)$(MMSQUALIFIERS) + set default [-.glapi] + $(MMS)$(MMSQUALIFIERS) + set default [-.shader] + $(MMS)$(MMSQUALIFIERS) + set default [-.drivers.common] + $(MMS)$(MMSQUALIFIERS) + set default [-.x11] + $(MMS)$(MMSQUALIFIERS) + set default [-.osmesa] + $(MMS)$(MMSQUALIFIERS) + set default [--.math] + $(MMS)$(MMSQUALIFIERS) + set default [-.tnl] + $(MMS)$(MMSQUALIFIERS) + set default [-.swrast] + $(MMS)$(MMSQUALIFIERS) + set default [-.swrast_setup] + $(MMS)$(MMSQUALIFIERS) + set default [-.vbo] + $(MMS)$(MMSQUALIFIERS) diff --git a/mesalib/src/mesa/drivers/Makefile b/mesalib/src/mesa/drivers/Makefile new file mode 100644 index 000000000..c5998413e --- /dev/null +++ b/mesalib/src/mesa/drivers/Makefile @@ -0,0 +1,29 @@ +# src/mesa/drivers/Makefile + +TOP = ../../.. +include $(TOP)/configs/current + + +default: + @for dir in $(DRIVER_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1; \ + fi \ + done + + +clean: + @for dir in $(DRIVER_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) || exit 1; \ + fi \ + done + + +install: + @for dir in $(DRIVER_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) install) || exit 1; \ + fi \ + done + diff --git a/mesalib/src/mesa/drivers/common/descrip.mms b/mesalib/src/mesa/drivers/common/descrip.mms new file mode 100644 index 000000000..d5bbc69df --- /dev/null +++ b/mesalib/src/mesa/drivers/common/descrip.mms @@ -0,0 +1,42 @@ +# Makefile for core library for VMS +# contributed by Jouk Jansen joukj@hrem.nano.tudelft.nl +# Last revision : 29 September 2008 + +.first + define gl [----.include.gl] + define math [--.math] + define tnl [--.tnl] + define swrast [--.swrast] + define glapi [--.glapi] + define shader [--.shader] + define main [--.main] + +.include [----]mms-config. + +##### MACROS ##### + +VPATH = RCS + +INCDIR = [----.include],[--.main],[--.glapi],[--.shader] +LIBDIR = [----.lib] +CFLAGS = /include=($(INCDIR),[])/define=(PTHREADS=1)/name=(as_is,short)\ + /float=ieee/ieee=denorm/warn=disable=(PTRMISMATCH) + +SOURCES = driverfuncs.c + +OBJECTS =driverfuncs.obj + +##### RULES ##### + +VERSION=Mesa V3.4 + +##### TARGETS ##### +# Make the library +$(LIBDIR)$(GL_LIB) : $(OBJECTS) + @ library $(LIBDIR)$(GL_LIB) $(OBJECTS) + +clean : + purge + delete *.obj;* + +driverfuncs.obj : driverfuncs.c diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c new file mode 100644 index 000000000..a9f3c8e72 --- /dev/null +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -0,0 +1,353 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 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. + */ + + +#include "main/glheader.h" +#include "main/imports.h" +#include "main/arrayobj.h" +#include "main/buffers.h" +#include "main/context.h" +#include "main/framebuffer.h" +#include "main/mipmap.h" +#include "main/queryobj.h" +#include "main/renderbuffer.h" +#include "main/texcompress.h" +#include "main/texformat.h" +#include "main/texgetimage.h" +#include "main/teximage.h" +#include "main/texobj.h" +#include "main/texstore.h" +#if FEATURE_ARB_vertex_buffer_object +#include "main/bufferobj.h" +#endif +#if FEATURE_EXT_framebuffer_object +#include "main/fbobject.h" +#include "main/texrender.h" +#endif +#if FEATURE_ARB_sync +#include "main/syncobj.h" +#endif + +#include "shader/program.h" +#include "shader/prog_execute.h" +#include "shader/shader_api.h" +#include "tnl/tnl.h" +#include "swrast/swrast.h" + +#include "driverfuncs.h" + + + +/** + * Plug in default functions for all pointers in the dd_function_table + * structure. + * Device drivers should call this function and then plug in any + * functions which it wants to override. + * Some functions (pointers) MUST be implemented by all drivers (REQUIRED). + * + * \param table the dd_function_table to initialize + */ +void +_mesa_init_driver_functions(struct dd_function_table *driver) +{ + _mesa_bzero(driver, sizeof(*driver)); + + driver->GetString = NULL; /* REQUIRED! */ + driver->UpdateState = NULL; /* REQUIRED! */ + driver->GetBufferSize = NULL; /* REQUIRED! */ + driver->ResizeBuffers = _mesa_resize_framebuffer; + driver->Error = NULL; + + driver->Finish = NULL; + driver->Flush = NULL; + + /* framebuffer/image functions */ + driver->Clear = _swrast_Clear; + driver->Accum = _swrast_Accum; + driver->RasterPos = _tnl_RasterPos; + driver->DrawPixels = _swrast_DrawPixels; + driver->ReadPixels = _swrast_ReadPixels; + driver->CopyPixels = _swrast_CopyPixels; + driver->Bitmap = _swrast_Bitmap; + + /* Texture functions */ + driver->ChooseTextureFormat = _mesa_choose_tex_format; + driver->TexImage1D = _mesa_store_teximage1d; + driver->TexImage2D = _mesa_store_teximage2d; + driver->TexImage3D = _mesa_store_teximage3d; + driver->TexSubImage1D = _mesa_store_texsubimage1d; + driver->TexSubImage2D = _mesa_store_texsubimage2d; + driver->TexSubImage3D = _mesa_store_texsubimage3d; + driver->GetTexImage = _mesa_get_teximage; + driver->CopyTexImage1D = _swrast_copy_teximage1d; + driver->CopyTexImage2D = _swrast_copy_teximage2d; + driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d; + driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d; + driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d; + driver->GenerateMipmap = _mesa_generate_mipmap; + driver->TestProxyTexImage = _mesa_test_proxy_teximage; + driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; + driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d; + driver->CompressedTexImage3D = _mesa_store_compressed_teximage3d; + driver->CompressedTexSubImage1D = _mesa_store_compressed_texsubimage1d; + driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; + driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; + driver->GetCompressedTexImage = _mesa_get_compressed_teximage; + driver->CompressedTextureSize = _mesa_compressed_texture_size; + driver->BindTexture = NULL; + driver->NewTextureObject = _mesa_new_texture_object; + driver->DeleteTexture = _mesa_delete_texture_object; + driver->NewTextureImage = _mesa_new_texture_image; + driver->FreeTexImageData = _mesa_free_texture_image_data; + driver->MapTexture = NULL; + driver->UnmapTexture = NULL; + driver->TextureMemCpy = _mesa_memcpy; + driver->IsTextureResident = NULL; + driver->PrioritizeTexture = NULL; + driver->ActiveTexture = NULL; + driver->UpdateTexturePalette = NULL; + + /* imaging */ + driver->CopyColorTable = _swrast_CopyColorTable; + driver->CopyColorSubTable = _swrast_CopyColorSubTable; + driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; + driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; + + /* Vertex/fragment programs */ + driver->BindProgram = NULL; + driver->NewProgram = _mesa_new_program; + driver->DeleteProgram = _mesa_delete_program; + + /* simple state commands */ + driver->AlphaFunc = NULL; + driver->BlendColor = NULL; + driver->BlendEquationSeparate = NULL; + driver->BlendFuncSeparate = NULL; + driver->ClearColor = NULL; + driver->ClearDepth = NULL; + driver->ClearIndex = NULL; + driver->ClearStencil = NULL; + driver->ClipPlane = NULL; + driver->ColorMask = NULL; + driver->ColorMaterial = NULL; + driver->CullFace = NULL; + driver->DrawBuffer = NULL; + driver->DrawBuffers = NULL; + driver->FrontFace = NULL; + driver->DepthFunc = NULL; + driver->DepthMask = NULL; + driver->DepthRange = NULL; + driver->Enable = NULL; + driver->Fogfv = NULL; + driver->Hint = NULL; + driver->IndexMask = NULL; + driver->Lightfv = NULL; + driver->LightModelfv = NULL; + driver->LineStipple = NULL; + driver->LineWidth = NULL; + driver->LogicOpcode = NULL; + driver->PointParameterfv = NULL; + driver->PointSize = NULL; + driver->PolygonMode = NULL; + driver->PolygonOffset = NULL; + driver->PolygonStipple = NULL; + driver->ReadBuffer = NULL; + driver->RenderMode = NULL; + driver->Scissor = NULL; + driver->ShadeModel = NULL; + driver->StencilFuncSeparate = NULL; + driver->StencilOpSeparate = NULL; + driver->StencilMaskSeparate = NULL; + driver->TexGen = NULL; + driver->TexEnv = NULL; + driver->TexParameter = NULL; + driver->TextureMatrix = NULL; + driver->Viewport = NULL; + + /* vertex arrays */ + driver->VertexPointer = NULL; + driver->NormalPointer = NULL; + driver->ColorPointer = NULL; + driver->FogCoordPointer = NULL; + driver->IndexPointer = NULL; + driver->SecondaryColorPointer = NULL; + driver->TexCoordPointer = NULL; + driver->EdgeFlagPointer = NULL; + driver->VertexAttribPointer = NULL; + driver->LockArraysEXT = NULL; + driver->UnlockArraysEXT = NULL; + + /* state queries */ + driver->GetBooleanv = NULL; + driver->GetDoublev = NULL; + driver->GetFloatv = NULL; + driver->GetIntegerv = NULL; + driver->GetInteger64v = NULL; + driver->GetPointerv = NULL; + + /* buffer objects */ + _mesa_init_buffer_object_functions(driver); + + /* query objects */ + _mesa_init_query_object_functions(driver); + +#if FEATURE_ARB_sync + _mesa_init_sync_object_functions(driver); +#endif + +#if FEATURE_EXT_framebuffer_object + driver->NewFramebuffer = _mesa_new_framebuffer; + driver->NewRenderbuffer = _mesa_new_soft_renderbuffer; + driver->RenderTexture = _mesa_render_texture; + driver->FinishRenderTexture = _mesa_finish_render_texture; + driver->FramebufferRenderbuffer = _mesa_framebuffer_renderbuffer; +#endif + +#if FEATURE_EXT_framebuffer_blit + driver->BlitFramebuffer = _swrast_BlitFramebuffer; +#endif + + /* APPLE_vertex_array_object */ + driver->NewArrayObject = _mesa_new_array_object; + driver->DeleteArrayObject = _mesa_delete_array_object; + driver->BindArrayObject = NULL; + + /* T&L stuff */ + driver->NeedValidate = GL_FALSE; + driver->ValidateTnlModule = NULL; + driver->CurrentExecPrimitive = 0; + driver->CurrentSavePrimitive = 0; + driver->NeedFlush = 0; + driver->SaveNeedFlush = 0; + + driver->ProgramStringNotify = _tnl_program_string; + driver->FlushVertices = NULL; + driver->SaveFlushVertices = NULL; + driver->NotifySaveBegin = NULL; + driver->LightingSpaceChange = NULL; + + /* display list */ + driver->NewList = NULL; + driver->EndList = NULL; + driver->BeginCallList = NULL; + driver->EndCallList = NULL; + + + /* XXX temporary here */ + _mesa_init_glsl_driver_functions(driver); +} + + +/** + * Call the ctx->Driver.* state functions with current values to initialize + * driver state. + * Only the Intel drivers use this so far. + */ +void +_mesa_init_driver_state(GLcontext *ctx) +{ + ctx->Driver.AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef); + + ctx->Driver.BlendColor(ctx, ctx->Color.BlendColor); + + ctx->Driver.BlendEquationSeparate(ctx, + ctx->Color.BlendEquationRGB, + ctx->Color.BlendEquationA); + + ctx->Driver.BlendFuncSeparate(ctx, + ctx->Color.BlendSrcRGB, + ctx->Color.BlendDstRGB, + ctx->Color.BlendSrcA, ctx->Color.BlendDstA); + + ctx->Driver.ColorMask(ctx, + ctx->Color.ColorMask[RCOMP], + ctx->Color.ColorMask[GCOMP], + ctx->Color.ColorMask[BCOMP], + ctx->Color.ColorMask[ACOMP]); + + ctx->Driver.CullFace(ctx, ctx->Polygon.CullFaceMode); + ctx->Driver.DepthFunc(ctx, ctx->Depth.Func); + ctx->Driver.DepthMask(ctx, ctx->Depth.Mask); + + ctx->Driver.Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled); + ctx->Driver.Enable(ctx, GL_BLEND, ctx->Color.BlendEnabled); + ctx->Driver.Enable(ctx, GL_COLOR_LOGIC_OP, ctx->Color.ColorLogicOpEnabled); + ctx->Driver.Enable(ctx, GL_COLOR_SUM, ctx->Fog.ColorSumEnabled); + ctx->Driver.Enable(ctx, GL_CULL_FACE, ctx->Polygon.CullFlag); + ctx->Driver.Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test); + ctx->Driver.Enable(ctx, GL_DITHER, ctx->Color.DitherFlag); + ctx->Driver.Enable(ctx, GL_FOG, ctx->Fog.Enabled); + ctx->Driver.Enable(ctx, GL_LIGHTING, ctx->Light.Enabled); + ctx->Driver.Enable(ctx, GL_LINE_SMOOTH, ctx->Line.SmoothFlag); + ctx->Driver.Enable(ctx, GL_POLYGON_STIPPLE, ctx->Polygon.StippleFlag); + ctx->Driver.Enable(ctx, GL_SCISSOR_TEST, ctx->Scissor.Enabled); + ctx->Driver.Enable(ctx, GL_STENCIL_TEST, ctx->Stencil._Enabled); + ctx->Driver.Enable(ctx, GL_TEXTURE_1D, GL_FALSE); + ctx->Driver.Enable(ctx, GL_TEXTURE_2D, GL_FALSE); + ctx->Driver.Enable(ctx, GL_TEXTURE_RECTANGLE_NV, GL_FALSE); + ctx->Driver.Enable(ctx, GL_TEXTURE_3D, GL_FALSE); + ctx->Driver.Enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE); + + ctx->Driver.Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color); + ctx->Driver.Fogfv(ctx, GL_FOG_MODE, 0); + ctx->Driver.Fogfv(ctx, GL_FOG_DENSITY, &ctx->Fog.Density); + ctx->Driver.Fogfv(ctx, GL_FOG_START, &ctx->Fog.Start); + ctx->Driver.Fogfv(ctx, GL_FOG_END, &ctx->Fog.End); + + ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace); + + { + GLfloat f = (GLfloat) ctx->Light.Model.ColorControl; + ctx->Driver.LightModelfv(ctx, GL_LIGHT_MODEL_COLOR_CONTROL, &f); + } + + ctx->Driver.LineWidth(ctx, ctx->Line.Width); + ctx->Driver.LogicOpcode(ctx, ctx->Color.LogicOp); + ctx->Driver.PointSize(ctx, ctx->Point.Size); + ctx->Driver.PolygonStipple(ctx, (const GLubyte *) ctx->PolygonStipple); + ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y, + ctx->Scissor.Width, ctx->Scissor.Height); + ctx->Driver.ShadeModel(ctx, ctx->Light.ShadeModel); + ctx->Driver.StencilFuncSeparate(ctx, GL_FRONT, + ctx->Stencil.Function[0], + ctx->Stencil.Ref[0], + ctx->Stencil.ValueMask[0]); + ctx->Driver.StencilFuncSeparate(ctx, GL_BACK, + ctx->Stencil.Function[1], + ctx->Stencil.Ref[1], + ctx->Stencil.ValueMask[1]); + ctx->Driver.StencilMaskSeparate(ctx, GL_FRONT, ctx->Stencil.WriteMask[0]); + ctx->Driver.StencilMaskSeparate(ctx, GL_BACK, ctx->Stencil.WriteMask[1]); + ctx->Driver.StencilOpSeparate(ctx, GL_FRONT, + ctx->Stencil.FailFunc[0], + ctx->Stencil.ZFailFunc[0], + ctx->Stencil.ZPassFunc[0]); + ctx->Driver.StencilOpSeparate(ctx, GL_BACK, + ctx->Stencil.FailFunc[1], + ctx->Stencil.ZFailFunc[1], + ctx->Stencil.ZPassFunc[1]); + + + ctx->Driver.DrawBuffer(ctx, ctx->Color.DrawBuffer[0]); +} diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.h b/mesalib/src/mesa/drivers/common/driverfuncs.h new file mode 100644 index 000000000..4c90ed12f --- /dev/null +++ b/mesalib/src/mesa/drivers/common/driverfuncs.h @@ -0,0 +1,37 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef DRIVERFUNCS_H +#define DRIVERFUNCS_H + +extern void +_mesa_init_driver_functions(struct dd_function_table *driver); + + +extern void +_mesa_init_driver_state(GLcontext *ctx); + + +#endif diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c new file mode 100644 index 000000000..2741a41bf --- /dev/null +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -0,0 +1,1638 @@ +/* + * Mesa 3-D graphics library + * Version: 7.6 + * + * Copyright (C) 2009 VMware, Inc. 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. + */ + +/** + * Meta operations. Some GL operations can be expressed in terms of + * other GL operations. For example, glBlitFramebuffer() can be done + * with texture mapping and glClear() can be done with polygon rendering. + * + * \author Brian Paul + */ + + +#include "main/glheader.h" +#include "main/mtypes.h" +#include "main/imports.h" +#include "main/arrayobj.h" +#include "main/blend.h" +#include "main/bufferobj.h" +#include "main/depth.h" +#include "main/enable.h" +#include "main/image.h" +#include "main/macros.h" +#include "main/matrix.h" +#include "main/polygon.h" +#include "main/readpix.h" +#include "main/scissor.h" +#include "main/shaders.h" +#include "main/stencil.h" +#include "main/texobj.h" +#include "main/texenv.h" +#include "main/teximage.h" +#include "main/texparam.h" +#include "main/texstate.h" +#include "main/varray.h" +#include "main/viewport.h" +#include "shader/program.h" +#include "shader/arbprogram.h" +#include "swrast/swrast.h" +#include "drivers/common/meta.h" + + +/** + * State which we may save/restore across meta ops. + * XXX this may be incomplete... + */ +struct save_state +{ + GLbitfield SavedState; /**< bitmask of META_* flags */ + + /** META_ALPHA_TEST */ + GLboolean AlphaEnabled; + + /** META_BLEND */ + GLboolean BlendEnabled; + GLboolean ColorLogicOpEnabled; + + /** META_COLOR_MASK */ + GLubyte ColorMask[4]; + + /** META_DEPTH_TEST */ + struct gl_depthbuffer_attrib Depth; + + /** META_FOG */ + GLboolean Fog; + + /** META_PIXEL_STORE */ + struct gl_pixelstore_attrib Pack, Unpack; + + /** META_RASTERIZATION */ + GLenum FrontPolygonMode, BackPolygonMode; + GLboolean PolygonOffset; + GLboolean PolygonSmooth; + GLboolean PolygonStipple; + GLboolean PolygonCull; + + /** META_SCISSOR */ + struct gl_scissor_attrib Scissor; + + /** META_SHADER */ + GLboolean VertexProgramEnabled; + struct gl_vertex_program *VertexProgram; + GLboolean FragmentProgramEnabled; + struct gl_fragment_program *FragmentProgram; + GLuint Shader; + + /** META_STENCIL_TEST */ + struct gl_stencil_attrib Stencil; + + /** META_TRANSFORM */ + GLenum MatrixMode; + GLfloat ModelviewMatrix[16]; + GLfloat ProjectionMatrix[16]; + GLfloat TextureMatrix[16]; + GLbitfield ClipPlanesEnabled; + + /** META_TEXTURE */ + GLuint ActiveUnit; + GLuint ClientActiveUnit; + /** for unit[0] only */ + struct gl_texture_object *CurrentTexture[NUM_TEXTURE_TARGETS]; + /** mask of TEXTURE_2D_BIT, etc */ + GLbitfield TexEnabled[MAX_TEXTURE_UNITS]; + GLbitfield TexGenEnabled[MAX_TEXTURE_UNITS]; + GLuint EnvMode; /* unit[0] only */ + + /** META_VERTEX */ + struct gl_array_object *ArrayObj; + struct gl_buffer_object *ArrayBufferObj; + + /** META_VIEWPORT */ + GLint ViewportX, ViewportY, ViewportW, ViewportH; + GLclampd DepthNear, DepthFar; + + /** Miscellaneous (always disabled) */ + GLboolean Lighting; +}; + + +/** + * State for glBlitFramebufer() + */ +struct blit_state +{ + GLuint ArrayObj; + GLuint VBO; + GLuint DepthFP; +}; + + +/** + * State for glClear() + */ +struct clear_state +{ + GLuint ArrayObj; + GLuint VBO; +}; + + +/** + * State for glCopyPixels() + */ +struct copypix_state +{ + GLuint ArrayObj; + GLuint VBO; +}; + + +/** + * State for glDrawPixels() + */ +struct drawpix_state +{ + GLuint ArrayObj; + + GLuint StencilFP; /**< Fragment program for drawing stencil images */ + GLuint DepthFP; /**< Fragment program for drawing depth images */ +}; + + +/** + * Temporary texture used for glBlitFramebuffer, glDrawPixels, etc. + * This is currently shared by all the meta ops. But we could create a + * separate one for each of glDrawPixel, glBlitFramebuffer, glCopyPixels, etc. + */ +struct temp_texture +{ + GLuint TexObj; + GLenum Target; /**< GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE */ + GLsizei MaxSize; /**< Max possible texture size */ + GLboolean NPOT; /**< Non-power of two size OK? */ + GLsizei Width, Height; /**< Current texture size */ + GLenum IntFormat; + GLfloat Sright, Ttop; /**< right, top texcoords */ +}; + + +/** + * All per-context meta state. + */ +struct gl_meta_state +{ + struct save_state Save; /**< state saved during meta-ops */ + + struct temp_texture TempTex; + + struct blit_state Blit; /**< For _mesa_meta_blit_framebuffer() */ + struct clear_state Clear; /**< For _mesa_meta_clear() */ + struct copypix_state CopyPix; /**< For _mesa_meta_copy_pixels() */ + struct drawpix_state DrawPix; /**< For _mesa_meta_draw_pixels() */ + + /* other possible meta-ops: + * glBitmap() + * glGenerateMipmap() + */ +}; + + +/** + * Initialize meta-ops for a context. + * To be called once during context creation. + */ +void +_mesa_meta_init(GLcontext *ctx) +{ + ASSERT(!ctx->Meta); + + ctx->Meta = CALLOC_STRUCT(gl_meta_state); +} + + +/** + * Free context meta-op state. + * To be called once during context destruction. + */ +void +_mesa_meta_free(GLcontext *ctx) +{ + struct gl_meta_state *meta = ctx->Meta; + + if (_mesa_get_current_context()) { + /* if there's no current context, these textures, buffers, etc should + * still get freed by _mesa_free_context_data(). + */ + + _mesa_DeleteTextures(1, &meta->TempTex.TexObj); + + /* glBlitFramebuffer */ + _mesa_DeleteBuffersARB(1, & meta->Blit.VBO); + _mesa_DeleteVertexArraysAPPLE(1, &meta->Blit.ArrayObj); + _mesa_DeletePrograms(1, &meta->Blit.DepthFP); + + /* glClear */ + _mesa_DeleteBuffersARB(1, & meta->Clear.VBO); + _mesa_DeleteVertexArraysAPPLE(1, &meta->Clear.ArrayObj); + + /* glCopyPixels */ + _mesa_DeleteBuffersARB(1, & meta->CopyPix.VBO); + _mesa_DeleteVertexArraysAPPLE(1, &meta->CopyPix.ArrayObj); + + /* glDrawPixels */ + _mesa_DeleteVertexArraysAPPLE(1, &meta->DrawPix.ArrayObj); + _mesa_DeletePrograms(1, &meta->DrawPix.DepthFP); + _mesa_DeletePrograms(1, &meta->DrawPix.StencilFP); + } + + _mesa_free(ctx->Meta); + ctx->Meta = NULL; +} + + +/** + * Enter meta state. This is like a light-weight version of glPushAttrib + * but it also resets most GL state back to default values. + * + * \param state bitmask of META_* flags indicating which attribute groups + * to save and reset to their defaults + */ +static void +_mesa_meta_begin(GLcontext *ctx, GLbitfield state) +{ + struct save_state *save = &ctx->Meta->Save; + + save->SavedState = state; + + if (state & META_ALPHA_TEST) { + save->AlphaEnabled = ctx->Color.AlphaEnabled; + if (ctx->Color.AlphaEnabled) + _mesa_Disable(GL_ALPHA_TEST); + } + + if (state & META_BLEND) { + save->BlendEnabled = ctx->Color.BlendEnabled; + if (ctx->Color.BlendEnabled) + _mesa_Disable(GL_BLEND); + save->ColorLogicOpEnabled = ctx->Color.ColorLogicOpEnabled; + if (ctx->Color.ColorLogicOpEnabled) + _mesa_Disable(GL_COLOR_LOGIC_OP); + } + + if (state & META_COLOR_MASK) { + COPY_4V(save->ColorMask, ctx->Color.ColorMask); + if (!ctx->Color.ColorMask[0] || + !ctx->Color.ColorMask[1] || + !ctx->Color.ColorMask[2] || + !ctx->Color.ColorMask[3]) + _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + } + + if (state & META_DEPTH_TEST) { + save->Depth = ctx->Depth; /* struct copy */ + if (ctx->Depth.Test) + _mesa_Disable(GL_DEPTH_TEST); + } + + if (state & META_FOG) { + save->Fog = ctx->Fog.Enabled; + if (ctx->Fog.Enabled) + _mesa_set_enable(ctx, GL_FOG, GL_FALSE); + } + + if (state & META_PIXEL_STORE) { + save->Pack = ctx->Pack; + save->Unpack = ctx->Unpack; + ctx->Pack = ctx->DefaultPacking; + ctx->Unpack = ctx->DefaultPacking; + } + + if (state & META_RASTERIZATION) { + save->FrontPolygonMode = ctx->Polygon.FrontMode; + save->BackPolygonMode = ctx->Polygon.BackMode; + save->PolygonOffset = ctx->Polygon.OffsetFill; + save->PolygonSmooth = ctx->Polygon.SmoothFlag; + save->PolygonStipple = ctx->Polygon.StippleFlag; + save->PolygonCull = ctx->Polygon.CullFlag; + _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, GL_FALSE); + _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, GL_FALSE); + _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, GL_FALSE); + _mesa_set_enable(ctx, GL_CULL_FACE, GL_FALSE); + } + + if (state & META_SCISSOR) { + save->Scissor = ctx->Scissor; /* struct copy */ + } + + if (state & META_SHADER) { + if (ctx->Extensions.ARB_vertex_program) { + save->VertexProgramEnabled = ctx->VertexProgram.Enabled; + save->VertexProgram = ctx->VertexProgram.Current; + _mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE); + } + + if (ctx->Extensions.ARB_fragment_program) { + save->FragmentProgramEnabled = ctx->FragmentProgram.Enabled; + save->FragmentProgram = ctx->FragmentProgram.Current; + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_FALSE); + } + + if (ctx->Extensions.ARB_shader_objects) { + save->Shader = ctx->Shader.CurrentProgram ? + ctx->Shader.CurrentProgram->Name : 0; + _mesa_UseProgramObjectARB(0); + } + } + + if (state & META_STENCIL_TEST) { + save->Stencil = ctx->Stencil; /* struct copy */ + if (ctx->Stencil.Enabled) + _mesa_Disable(GL_STENCIL_TEST); + /* NOTE: other stencil state not reset */ + } + + if (state & META_TEXTURE) { + GLuint u, tgt; + + save->ActiveUnit = ctx->Texture.CurrentUnit; + save->ClientActiveUnit = ctx->Array.ActiveTexture; + save->EnvMode = ctx->Texture.Unit[0].EnvMode; + + /* Disable all texture units */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + save->TexEnabled[u] = ctx->Texture.Unit[u].Enabled; + save->TexGenEnabled[u] = ctx->Texture.Unit[u].TexGenEnabled; + if (ctx->Texture.Unit[u].Enabled || + ctx->Texture.Unit[u].TexGenEnabled) { + _mesa_ActiveTextureARB(GL_TEXTURE0 + u); + _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_FALSE); + _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_FALSE); + } + } + + /* save current texture objects for unit[0] only */ + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { + _mesa_reference_texobj(&save->CurrentTexture[tgt], + ctx->Texture.Unit[0].CurrentTex[tgt]); + } + + /* set defaults for unit[0] */ + _mesa_ActiveTextureARB(GL_TEXTURE0); + _mesa_ClientActiveTextureARB(GL_TEXTURE0); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + } + + if (state & META_TRANSFORM) { + GLuint activeTexture = ctx->Texture.CurrentUnit; + _mesa_memcpy(save->ModelviewMatrix, ctx->ModelviewMatrixStack.Top->m, + 16 * sizeof(GLfloat)); + _mesa_memcpy(save->ProjectionMatrix, ctx->ProjectionMatrixStack.Top->m, + 16 * sizeof(GLfloat)); + _mesa_memcpy(save->TextureMatrix, ctx->TextureMatrixStack[0].Top->m, + 16 * sizeof(GLfloat)); + save->MatrixMode = ctx->Transform.MatrixMode; + /* set 1:1 vertex:pixel coordinate transform */ + _mesa_ActiveTextureARB(GL_TEXTURE0); + _mesa_MatrixMode(GL_TEXTURE); + _mesa_LoadIdentity(); + _mesa_ActiveTextureARB(GL_TEXTURE0 + activeTexture); + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_LoadIdentity(); + _mesa_MatrixMode(GL_PROJECTION); + _mesa_LoadIdentity(); + _mesa_Ortho(0.0F, ctx->DrawBuffer->Width, + 0.0F, ctx->DrawBuffer->Height, + -1.0F, 1.0F); + save->ClipPlanesEnabled = ctx->Transform.ClipPlanesEnabled; + if (ctx->Transform.ClipPlanesEnabled) { + GLuint i; + for (i = 0; i < ctx->Const.MaxClipPlanes; i++) { + _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_FALSE); + } + } + } + + if (state & META_VERTEX) { + /* save vertex array object state */ + _mesa_reference_array_object(ctx, &save->ArrayObj, + ctx->Array.ArrayObj); + _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, + ctx->Array.ArrayBufferObj); + /* set some default state? */ + } + + if (state & META_VIEWPORT) { + /* save viewport state */ + save->ViewportX = ctx->Viewport.X; + save->ViewportY = ctx->Viewport.Y; + save->ViewportW = ctx->Viewport.Width; + save->ViewportH = ctx->Viewport.Height; + /* set viewport to match window size */ + if (ctx->Viewport.X != 0 || + ctx->Viewport.Y != 0 || + ctx->Viewport.Width != ctx->DrawBuffer->Width || + ctx->Viewport.Height != ctx->DrawBuffer->Height) { + _mesa_set_viewport(ctx, 0, 0, + ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); + } + /* save depth range state */ + save->DepthNear = ctx->Viewport.Near; + save->DepthFar = ctx->Viewport.Far; + /* set depth range to default */ + _mesa_DepthRange(0.0, 1.0); + } + + /* misc */ + { + save->Lighting = ctx->Light.Enabled; + if (ctx->Light.Enabled) + _mesa_set_enable(ctx, GL_LIGHTING, GL_FALSE); + } +} + + +/** + * Leave meta state. This is like a light-weight version of glPopAttrib(). + */ +static void +_mesa_meta_end(GLcontext *ctx) +{ + struct save_state *save = &ctx->Meta->Save; + const GLbitfield state = save->SavedState; + + if (state & META_ALPHA_TEST) { + if (ctx->Color.AlphaEnabled != save->AlphaEnabled) + _mesa_set_enable(ctx, GL_ALPHA_TEST, save->AlphaEnabled); + } + + if (state & META_BLEND) { + if (ctx->Color.BlendEnabled != save->BlendEnabled) + _mesa_set_enable(ctx, GL_BLEND, save->BlendEnabled); + if (ctx->Color.ColorLogicOpEnabled != save->ColorLogicOpEnabled) + _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, save->ColorLogicOpEnabled); + } + + if (state & META_COLOR_MASK) { + if (!TEST_EQ_4V(ctx->Color.ColorMask, save->ColorMask)) + _mesa_ColorMask(save->ColorMask[0], save->ColorMask[1], + save->ColorMask[2], save->ColorMask[3]); + } + + if (state & META_DEPTH_TEST) { + if (ctx->Depth.Test != save->Depth.Test) + _mesa_set_enable(ctx, GL_DEPTH_TEST, save->Depth.Test); + _mesa_DepthFunc(save->Depth.Func); + _mesa_DepthMask(save->Depth.Mask); + } + + if (state & META_FOG) { + _mesa_set_enable(ctx, GL_FOG, save->Fog); + } + + if (state & META_PIXEL_STORE) { + ctx->Pack = save->Pack; + ctx->Unpack = save->Unpack; + } + + if (state & META_RASTERIZATION) { + _mesa_PolygonMode(GL_FRONT, save->FrontPolygonMode); + _mesa_PolygonMode(GL_BACK, save->BackPolygonMode); + _mesa_set_enable(ctx, GL_POLYGON_STIPPLE, save->PolygonStipple); + _mesa_set_enable(ctx, GL_POLYGON_OFFSET_FILL, save->PolygonOffset); + _mesa_set_enable(ctx, GL_POLYGON_SMOOTH, save->PolygonSmooth); + _mesa_set_enable(ctx, GL_CULL_FACE, save->PolygonCull); + } + + if (state & META_SCISSOR) { + _mesa_set_enable(ctx, GL_SCISSOR_TEST, save->Scissor.Enabled); + _mesa_Scissor(save->Scissor.X, save->Scissor.Y, + save->Scissor.Width, save->Scissor.Height); + } + + if (state & META_SHADER) { + if (ctx->Extensions.ARB_vertex_program) { + _mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, + save->VertexProgramEnabled); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + save->VertexProgram); + } + + if (ctx->Extensions.ARB_fragment_program) { + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, + save->FragmentProgramEnabled); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + save->FragmentProgram); + } + + if (ctx->Extensions.ARB_shader_objects) { + _mesa_UseProgramObjectARB(save->Shader); + } + } + + if (state & META_STENCIL_TEST) { + const struct gl_stencil_attrib *stencil = &save->Stencil; + + _mesa_set_enable(ctx, GL_STENCIL_TEST, stencil->Enabled); + _mesa_ClearStencil(stencil->Clear); + if (ctx->Extensions.EXT_stencil_two_side) { + _mesa_set_enable(ctx, GL_STENCIL_TEST_TWO_SIDE_EXT, + stencil->TestTwoSide); + _mesa_ActiveStencilFaceEXT(stencil->ActiveFace + ? GL_BACK : GL_FRONT); + } + /* front state */ + _mesa_StencilFuncSeparate(GL_FRONT, + stencil->Function[0], + stencil->Ref[0], + stencil->ValueMask[0]); + _mesa_StencilMaskSeparate(GL_FRONT, stencil->WriteMask[0]); + _mesa_StencilOpSeparate(GL_FRONT, stencil->FailFunc[0], + stencil->ZFailFunc[0], + stencil->ZPassFunc[0]); + /* back state */ + _mesa_StencilFuncSeparate(GL_BACK, + stencil->Function[1], + stencil->Ref[1], + stencil->ValueMask[1]); + _mesa_StencilMaskSeparate(GL_BACK, stencil->WriteMask[1]); + _mesa_StencilOpSeparate(GL_BACK, stencil->FailFunc[1], + stencil->ZFailFunc[1], + stencil->ZPassFunc[1]); + } + + if (state & META_TEXTURE) { + GLuint u, tgt; + + ASSERT(ctx->Texture.CurrentUnit == 0); + + /* restore texenv for unit[0] */ + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, save->EnvMode); + + /* restore texture objects for unit[0] only */ + for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { + _mesa_reference_texobj(&ctx->Texture.Unit[0].CurrentTex[tgt], + save->CurrentTexture[tgt]); + } + + /* Re-enable textures, texgen */ + for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { + if (save->TexEnabled[u]) { + _mesa_ActiveTextureARB(GL_TEXTURE0 + u); + + if (save->TexEnabled[u] & TEXTURE_1D_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_1D, GL_TRUE); + if (save->TexEnabled[u] & TEXTURE_2D_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_2D, GL_TRUE); + if (save->TexEnabled[u] & TEXTURE_3D_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_3D, GL_TRUE); + if (save->TexEnabled[u] & TEXTURE_CUBE_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_CUBE_MAP, GL_TRUE); + if (save->TexEnabled[u] & TEXTURE_RECT_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_TRUE); + } + + if (save->TexGenEnabled[u]) { + _mesa_ActiveTextureARB(GL_TEXTURE0 + u); + + if (save->TexGenEnabled[u] & S_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_GEN_S, GL_TRUE); + if (save->TexGenEnabled[u] & T_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_GEN_T, GL_TRUE); + if (save->TexGenEnabled[u] & R_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_GEN_R, GL_TRUE); + if (save->TexGenEnabled[u] & Q_BIT) + _mesa_set_enable(ctx, GL_TEXTURE_GEN_Q, GL_TRUE); + } + } + + /* restore current unit state */ + _mesa_ActiveTextureARB(GL_TEXTURE0 + save->ActiveUnit); + _mesa_ClientActiveTextureARB(GL_TEXTURE0 + save->ClientActiveUnit); + } + + if (state & META_TRANSFORM) { + GLuint activeTexture = ctx->Texture.CurrentUnit; + _mesa_ActiveTextureARB(GL_TEXTURE0); + _mesa_MatrixMode(GL_TEXTURE); + _mesa_LoadMatrixf(save->TextureMatrix); + _mesa_ActiveTextureARB(GL_TEXTURE0 + activeTexture); + + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_LoadMatrixf(save->ModelviewMatrix); + + _mesa_MatrixMode(GL_PROJECTION); + _mesa_LoadMatrixf(save->ProjectionMatrix); + + _mesa_MatrixMode(save->MatrixMode); + + if (save->ClipPlanesEnabled) { + GLuint i; + for (i = 0; i < ctx->Const.MaxClipPlanes; i++) { + if (save->ClipPlanesEnabled & (1 << i)) { + _mesa_set_enable(ctx, GL_CLIP_PLANE0 + i, GL_TRUE); + } + } + } + } + + if (state & META_VERTEX) { + /* restore vertex buffer object */ + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, save->ArrayBufferObj->Name); + _mesa_reference_buffer_object(ctx, &save->ArrayBufferObj, NULL); + + /* restore vertex array object */ + _mesa_BindVertexArray(save->ArrayObj->Name); + _mesa_reference_array_object(ctx, &save->ArrayObj, NULL); + } + + if (state & META_VIEWPORT) { + if (save->ViewportX != ctx->Viewport.X || + save->ViewportY != ctx->Viewport.Y || + save->ViewportW != ctx->Viewport.Width || + save->ViewportH != ctx->Viewport.Height) { + _mesa_set_viewport(ctx, save->ViewportX, save->ViewportY, + save->ViewportW, save->ViewportH); + } + _mesa_DepthRange(save->DepthNear, save->DepthFar); + } + + /* misc */ + if (save->Lighting) { + _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE); + } +} + + +/** + * Return pointer to temp_texture info. This does some one-time init + * if needed. + */ +static struct temp_texture * +get_temp_texture(GLcontext *ctx) +{ + struct temp_texture *tex = &ctx->Meta->TempTex; + + if (!tex->TexObj) { + /* do one-time init */ + + /* prefer texture rectangle */ + if (ctx->Extensions.NV_texture_rectangle) { + tex->Target = GL_TEXTURE_RECTANGLE; + tex->MaxSize = ctx->Const.MaxTextureRectSize; + tex->NPOT = GL_TRUE; + } + else { + /* use 2D texture, NPOT if possible */ + tex->Target = GL_TEXTURE_2D; + tex->MaxSize = 1 << (ctx->Const.MaxTextureLevels - 1); + tex->NPOT = ctx->Extensions.ARB_texture_non_power_of_two; + } + assert(tex->MaxSize > 0); + + _mesa_GenTextures(1, &tex->TexObj); + _mesa_BindTexture(tex->Target, tex->TexObj); + } + + return tex; +} + + +/** + * Compute the width/height of texture needed to draw an image of the + * given size. Return a flag indicating whether the current texture + * can be re-used (glTexSubImage2D) or if a new texture needs to be + * allocated (glTexImage2D). + * Also, compute s/t texcoords for drawing. + * + * \return GL_TRUE if new texture is needed, GL_FALSE otherwise + */ +static GLboolean +alloc_texture(struct temp_texture *tex, + GLsizei width, GLsizei height, GLenum intFormat) +{ + GLboolean newTex = GL_FALSE; + + if (width > tex->Width || + height > tex->Height || + intFormat != tex->IntFormat) { + /* alloc new texture (larger or different format) */ + + if (tex->NPOT) { + /* use non-power of two size */ + tex->Width = width; + tex->Height = height; + } + else { + /* find power of two size */ + GLsizei w, h; + w = h = 16; + while (w < width) + w *= 2; + while (h < height) + h *= 2; + tex->Width = w; + tex->Height = h; + } + + tex->IntFormat = intFormat; + + newTex = GL_TRUE; + } + + /* compute texcoords */ + if (tex->Target == GL_TEXTURE_RECTANGLE) { + tex->Sright = (GLfloat) width; + tex->Ttop = (GLfloat) height; + } + else { + tex->Sright = (GLfloat) width / tex->Width; + tex->Ttop = (GLfloat) height / tex->Height; + } + + return newTex; +} + + +/** + * Setup/load texture for glCopyPixels or glBlitFramebuffer. + */ +static void +setup_copypix_texture(struct temp_texture *tex, + GLboolean newTex, + GLint srcX, GLint srcY, + GLsizei width, GLsizei height, GLenum intFormat, + GLenum filter) +{ + _mesa_BindTexture(tex->Target, tex->TexObj); + _mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, filter); + _mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, filter); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + /* copy framebuffer image to texture */ + if (newTex) { + /* create new tex image */ + if (tex->Width == width && tex->Height == height) { + /* create new tex with framebuffer data */ + _mesa_CopyTexImage2D(tex->Target, 0, tex->IntFormat, + srcX, srcY, width, height, 0); + } + else { + /* create empty texture */ + _mesa_TexImage2D(tex->Target, 0, tex->IntFormat, + tex->Width, tex->Height, 0, + intFormat, GL_UNSIGNED_BYTE, NULL); + /* load image */ + _mesa_CopyTexSubImage2D(tex->Target, 0, + 0, 0, srcX, srcY, width, height); + } + } + else { + /* replace existing tex image */ + _mesa_CopyTexSubImage2D(tex->Target, 0, + 0, 0, srcX, srcY, width, height); + } +} + + +/** + * Setup/load texture for glDrawPixels. + */ +static void +setup_drawpix_texture(struct temp_texture *tex, + GLboolean newTex, + GLenum texIntFormat, + GLsizei width, GLsizei height, + GLenum format, GLenum type, + const GLvoid *pixels) +{ + _mesa_BindTexture(tex->Target, tex->TexObj); + _mesa_TexParameteri(tex->Target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + _mesa_TexParameteri(tex->Target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + + /* copy pixel data to texture */ + if (newTex) { + /* create new tex image */ + if (tex->Width == width && tex->Height == height) { + /* create new tex and load image data */ + _mesa_TexImage2D(tex->Target, 0, tex->IntFormat, + tex->Width, tex->Height, 0, format, type, pixels); + } + else { + /* create empty texture */ + _mesa_TexImage2D(tex->Target, 0, tex->IntFormat, + tex->Width, tex->Height, 0, format, type, NULL); + /* load image */ + _mesa_TexSubImage2D(tex->Target, 0, + 0, 0, width, height, format, type, pixels); + } + } + else { + /* replace existing tex image */ + _mesa_TexSubImage2D(tex->Target, 0, + 0, 0, width, height, format, type, pixels); + } +} + + + +/** + * One-time init for drawing depth pixels. + */ +static void +init_blit_depth_pixels(GLcontext *ctx) +{ + static const char *program = + "!!ARBfp1.0\n" + "TEX result.depth, fragment.texcoord[0], texture[0], %s; \n" + "END \n"; + char program2[200]; + struct blit_state *blit = &ctx->Meta->Blit; + struct temp_texture *tex = get_temp_texture(ctx); + const char *texTarget; + + assert(blit->DepthFP == 0); + + /* replace %s with "RECT" or "2D" */ + assert(strlen(program) + 4 < sizeof(program2)); + if (tex->Target == GL_TEXTURE_RECTANGLE) + texTarget = "RECT"; + else + texTarget = "2D"; + _mesa_snprintf(program2, sizeof(program2), program, texTarget); + + _mesa_GenPrograms(1, &blit->DepthFP); + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, blit->DepthFP); + _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(program2), (const GLubyte *) program2); +} + + +/** + * Meta implementation of ctx->Driver.BlitFramebuffer() in terms + * of texture mapping and polygon rendering. + */ +void +_mesa_meta_blit_framebuffer(GLcontext *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + struct blit_state *blit = &ctx->Meta->Blit; + struct temp_texture *tex = get_temp_texture(ctx); + const GLsizei maxTexSize = tex->MaxSize; + const GLint srcX = MIN2(srcX0, srcX1); + const GLint srcY = MIN2(srcY0, srcY1); + const GLint srcW = abs(srcX1 - srcX0); + const GLint srcH = abs(srcY1 - srcY0); + const GLboolean srcFlipX = srcX1 < srcX0; + const GLboolean srcFlipY = srcY1 < srcY0; + GLfloat verts[4][4]; /* four verts of X,Y,S,T */ + GLboolean newTex; + + if (srcW > maxTexSize || srcH > maxTexSize) { + /* XXX avoid this fallback */ + _swrast_BlitFramebuffer(ctx, srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, mask, filter); + return; + } + + if (srcFlipX) { + GLint tmp = dstX0; + dstX0 = dstX1; + dstX1 = tmp; + } + + if (srcFlipY) { + GLint tmp = dstY0; + dstY0 = dstY1; + dstY1 = tmp; + } + + /* only scissor effects blit so save/clear all other relevant state */ + _mesa_meta_begin(ctx, ~META_SCISSOR); + + if (blit->ArrayObj == 0) { + /* one-time setup */ + + /* create vertex array object */ + _mesa_GenVertexArrays(1, &blit->ArrayObj); + _mesa_BindVertexArray(blit->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, &blit->VBO); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, blit->VBO); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + NULL, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(2, GL_FLOAT, sizeof(verts[0]), + (void *) (0 * sizeof(GLfloat))); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]), + (void *) (2 * sizeof(GLfloat))); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); + } + else { + _mesa_BindVertexArray(blit->ArrayObj); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, blit->VBO); + } + + newTex = alloc_texture(tex, srcW, srcH, GL_RGBA); + + /* vertex positions/texcoords (after texture allocation!) */ + { + verts[0][0] = (GLfloat) dstX0; + verts[0][1] = (GLfloat) dstY0; + verts[1][0] = (GLfloat) dstX1; + verts[1][1] = (GLfloat) dstY0; + verts[2][0] = (GLfloat) dstX1; + verts[2][1] = (GLfloat) dstY1; + verts[3][0] = (GLfloat) dstX0; + verts[3][1] = (GLfloat) dstY1; + + verts[0][2] = 0.0F; + verts[0][3] = 0.0F; + verts[1][2] = tex->Sright; + verts[1][3] = 0.0F; + verts[2][2] = tex->Sright; + verts[2][3] = tex->Ttop; + verts[3][2] = 0.0F; + verts[3][3] = tex->Ttop; + + /* upload new vertex data */ + _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + } + + _mesa_Enable(tex->Target); + + if (mask & GL_COLOR_BUFFER_BIT) { + setup_copypix_texture(tex, newTex, srcX, srcY, srcW, srcH, + GL_RGBA, filter); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + mask &= ~GL_COLOR_BUFFER_BIT; + } + + if (mask & GL_DEPTH_BUFFER_BIT) { + GLuint *tmp = (GLuint *) _mesa_malloc(srcW * srcH * sizeof(GLuint)); + if (tmp) { + if (!blit->DepthFP) + init_blit_depth_pixels(ctx); + + /* maybe change tex format here */ + newTex = alloc_texture(tex, srcW, srcH, GL_DEPTH_COMPONENT); + + _mesa_ReadPixels(srcX, srcY, srcW, srcH, + GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp); + + setup_drawpix_texture(tex, newTex, GL_DEPTH_COMPONENT, srcW, srcH, + GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp); + + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, blit->DepthFP); + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE); + _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + _mesa_set_enable(ctx, GL_DEPTH_TEST, GL_TRUE); + _mesa_DepthFunc(GL_ALWAYS); + _mesa_DepthMask(GL_TRUE); + + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + mask &= ~GL_DEPTH_BUFFER_BIT; + + _mesa_free(tmp); + } + } + + if (mask & GL_STENCIL_BUFFER_BIT) { + /* XXX can't easily do stencil */ + } + + _mesa_Disable(tex->Target); + + _mesa_meta_end(ctx); + + if (mask) { + _swrast_BlitFramebuffer(ctx, srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, mask, filter); + } +} + + +/** + * Meta implementation of ctx->Driver.Clear() in terms of polygon rendering. + */ +void +_mesa_meta_clear(GLcontext *ctx, GLbitfield buffers) +{ + struct clear_state *clear = &ctx->Meta->Clear; + GLfloat verts[4][7]; /* four verts of X,Y,Z,R,G,B,A */ + /* save all state but scissor, pixel pack/unpack */ + GLbitfield metaSave = META_ALL - META_SCISSOR - META_PIXEL_STORE; + + if (buffers & BUFFER_BITS_COLOR) { + /* if clearing color buffers, don't save/restore colormask */ + metaSave -= META_COLOR_MASK; + } + + _mesa_meta_begin(ctx, metaSave); + + if (clear->ArrayObj == 0) { + /* one-time setup */ + + /* create vertex array object */ + _mesa_GenVertexArrays(1, &clear->ArrayObj); + _mesa_BindVertexArray(clear->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, &clear->VBO); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + NULL, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]), + (void *) (0 * sizeof(GLfloat))); + _mesa_ColorPointer(4, GL_FLOAT, sizeof(verts[0]), + (void *) (3 * sizeof(GLfloat))); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_COLOR_ARRAY); + } + else { + _mesa_BindVertexArray(clear->ArrayObj); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO); + } + + /* GL_COLOR_BUFFER_BIT */ + if (buffers & BUFFER_BITS_COLOR) { + /* leave colormask, glDrawBuffer state as-is */ + } + else { + ASSERT(metaSave & META_COLOR_MASK); + _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + } + + /* GL_DEPTH_BUFFER_BIT */ + if (buffers & BUFFER_BIT_DEPTH) { + _mesa_set_enable(ctx, GL_DEPTH_TEST, GL_TRUE); + _mesa_DepthFunc(GL_ALWAYS); + _mesa_DepthMask(GL_TRUE); + } + else { + assert(!ctx->Depth.Test); + } + + /* GL_STENCIL_BUFFER_BIT */ + if (buffers & BUFFER_BIT_STENCIL) { + _mesa_set_enable(ctx, GL_STENCIL_TEST, GL_TRUE); + _mesa_StencilOpSeparate(GL_FRONT_AND_BACK, + GL_REPLACE, GL_REPLACE, GL_REPLACE); + _mesa_StencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, + ctx->Stencil.Clear & 0x7fffffff, + ctx->Stencil.WriteMask[0]); + } + else { + assert(!ctx->Stencil.Enabled); + } + + /* vertex positions/colors */ + { + const GLfloat x0 = (GLfloat) ctx->DrawBuffer->_Xmin; + const GLfloat y0 = (GLfloat) ctx->DrawBuffer->_Ymin; + const GLfloat x1 = (GLfloat) ctx->DrawBuffer->_Xmax; + const GLfloat y1 = (GLfloat) ctx->DrawBuffer->_Ymax; + const GLfloat z = 1.0 - 2.0 * ctx->Depth.Clear; + GLuint i; + + verts[0][0] = x0; + verts[0][1] = y0; + verts[0][2] = z; + verts[1][0] = x1; + verts[1][1] = y0; + verts[1][2] = z; + verts[2][0] = x1; + verts[2][1] = y1; + verts[2][2] = z; + verts[3][0] = x0; + verts[3][1] = y1; + verts[3][2] = z; + + /* vertex colors */ + for (i = 0; i < 4; i++) { + COPY_4FV(&verts[i][3], ctx->Color.ClearColor); + } + + /* upload new vertex data */ + _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + } + + /* draw quad */ + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + + _mesa_meta_end(ctx); +} + + +/** + * Meta implementation of ctx->Driver.CopyPixels() in terms + * of texture mapping and polygon rendering. + */ +void +_mesa_meta_copy_pixels(GLcontext *ctx, GLint srcX, GLint srcY, + GLsizei width, GLsizei height, + GLint dstX, GLint dstY, GLenum type) +{ + struct copypix_state *copypix = &ctx->Meta->CopyPix; + struct temp_texture *tex = get_temp_texture(ctx); + GLfloat verts[4][5]; /* four verts of X,Y,Z,S,T */ + GLboolean newTex; + GLenum intFormat = GL_RGBA; + + if (type != GL_COLOR || + ctx->_ImageTransferState || + ctx->Fog.Enabled || + width > tex->MaxSize || + height > tex->MaxSize) { + /* XXX avoid this fallback */ + _swrast_CopyPixels(ctx, srcX, srcY, width, height, dstX, dstY, type); + return; + } + + /* Most GL state applies to glCopyPixels, but a there's a few things + * we need to override: + */ + _mesa_meta_begin(ctx, (META_RASTERIZATION | + META_SHADER | + META_TEXTURE | + META_TRANSFORM | + META_VERTEX | + META_VIEWPORT)); + + if (copypix->ArrayObj == 0) { + /* one-time setup */ + + /* create vertex array object */ + _mesa_GenVertexArrays(1, ©pix->ArrayObj); + _mesa_BindVertexArray(copypix->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, ©pix->VBO); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, copypix->VBO); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + NULL, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]), + (void *) (0 * sizeof(GLfloat))); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]), + (void *) (3 * sizeof(GLfloat))); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); + } + else { + _mesa_BindVertexArray(copypix->ArrayObj); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, copypix->VBO); + } + + newTex = alloc_texture(tex, width, height, intFormat); + + /* vertex positions, texcoords (after texture allocation!) */ + { + const GLfloat dstX0 = (GLfloat) dstX; + const GLfloat dstY0 = (GLfloat) dstY; + const GLfloat dstX1 = dstX + width * ctx->Pixel.ZoomX; + const GLfloat dstY1 = dstY + height * ctx->Pixel.ZoomY; + const GLfloat z = ctx->Current.RasterPos[2]; + + verts[0][0] = dstX0; + verts[0][1] = dstY0; + verts[0][2] = z; + verts[0][3] = 0.0F; + verts[0][4] = 0.0F; + verts[1][0] = dstX1; + verts[1][1] = dstY0; + verts[1][2] = z; + verts[1][3] = tex->Sright; + verts[1][4] = 0.0F; + verts[2][0] = dstX1; + verts[2][1] = dstY1; + verts[2][2] = z; + verts[2][3] = tex->Sright; + verts[2][4] = tex->Ttop; + verts[3][0] = dstX0; + verts[3][1] = dstY1; + verts[3][2] = z; + verts[3][3] = 0.0F; + verts[3][4] = tex->Ttop; + + /* upload new vertex data */ + _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + } + + /* Alloc/setup texture */ + setup_copypix_texture(tex, newTex, srcX, srcY, width, height, + GL_RGBA, GL_NEAREST); + + _mesa_Enable(tex->Target); + + /* draw textured quad */ + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + + _mesa_Disable(tex->Target); + + _mesa_meta_end(ctx); +} + + + +/** + * When the glDrawPixels() image size is greater than the max rectangle + * texture size we use this function to break the glDrawPixels() image + * into tiles which fit into the max texture size. + */ +static void +tiled_draw_pixels(GLcontext *ctx, + GLint tileSize, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) +{ + struct gl_pixelstore_attrib tileUnpack = *unpack; + GLint i, j; + + if (tileUnpack.RowLength == 0) + tileUnpack.RowLength = width; + + for (i = 0; i < width; i += tileSize) { + const GLint tileWidth = MIN2(tileSize, width - i); + const GLint tileX = (GLint) (x + i * ctx->Pixel.ZoomX); + + tileUnpack.SkipPixels = unpack->SkipPixels + i; + + for (j = 0; j < height; j += tileSize) { + const GLint tileHeight = MIN2(tileSize, height - j); + const GLint tileY = (GLint) (y + j * ctx->Pixel.ZoomY); + + tileUnpack.SkipRows = unpack->SkipRows + j; + + _mesa_meta_draw_pixels(ctx, tileX, tileY, + tileWidth, tileHeight, + format, type, &tileUnpack, pixels); + } + } +} + + +/** + * One-time init for drawing stencil pixels. + */ +static void +init_draw_stencil_pixels(GLcontext *ctx) +{ + /* This program is run eight times, once for each stencil bit. + * The stencil values to draw are found in an 8-bit alpha texture. + * We read the texture/stencil value and test if bit 'b' is set. + * If the bit is not set, use KIL to kill the fragment. + * Finally, we use the stencil test to update the stencil buffer. + * + * The basic algorithm for checking if a bit is set is: + * if (is_odd(value / (1 << bit))) + * result is one (or non-zero). + * else + * result is zero. + * The program parameter contains three values: + * parm.x = 255 / (1 << bit) + * parm.y = 0.5 + * parm.z = 0.0 + */ + static const char *program = + "!!ARBfp1.0\n" + "PARAM parm = program.local[0]; \n" + "TEMP t; \n" + "TEX t, fragment.texcoord[0], texture[0], %s; \n" /* NOTE %s here! */ + "# t = t * 255 / bit \n" + "MUL t.x, t.a, parm.x; \n" + "# t = (int) t \n" + "FRC t.y, t.x; \n" + "SUB t.x, t.x, t.y; \n" + "# t = t * 0.5 \n" + "MUL t.x, t.x, parm.y; \n" + "# t = fract(t.x) \n" + "FRC t.x, t.x; # if t.x != 0, then the bit is set \n" + "# t.x = (t.x == 0 ? 1 : 0) \n" + "SGE t.x, -t.x, parm.z; \n" + "KIL -t.x; \n" + "# for debug only \n" + "#MOV result.color, t.x; \n" + "END \n"; + char program2[1000]; + struct drawpix_state *drawpix = &ctx->Meta->DrawPix; + struct temp_texture *tex = get_temp_texture(ctx); + const char *texTarget; + + assert(drawpix->StencilFP == 0); + + /* replace %s with "RECT" or "2D" */ + assert(strlen(program) + 4 < sizeof(program2)); + if (tex->Target == GL_TEXTURE_RECTANGLE) + texTarget = "RECT"; + else + texTarget = "2D"; + _mesa_snprintf(program2, sizeof(program2), program, texTarget); + + _mesa_GenPrograms(1, &drawpix->StencilFP); + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP); + _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(program2), (const GLubyte *) program2); +} + + +/** + * One-time init for drawing depth pixels. + */ +static void +init_draw_depth_pixels(GLcontext *ctx) +{ + static const char *program = + "!!ARBfp1.0\n" + "PARAM color = program.local[0]; \n" + "TEX result.depth, fragment.texcoord[0], texture[0], %s; \n" + "MOV result.color, color; \n" + "END \n"; + char program2[200]; + struct drawpix_state *drawpix = &ctx->Meta->DrawPix; + struct temp_texture *tex = get_temp_texture(ctx); + const char *texTarget; + + assert(drawpix->DepthFP == 0); + + /* replace %s with "RECT" or "2D" */ + assert(strlen(program) + 4 < sizeof(program2)); + if (tex->Target == GL_TEXTURE_RECTANGLE) + texTarget = "RECT"; + else + texTarget = "2D"; + _mesa_snprintf(program2, sizeof(program2), program, texTarget); + + _mesa_GenPrograms(1, &drawpix->DepthFP); + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->DepthFP); + _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(program2), (const GLubyte *) program2); +} + + +/** + * Meta implementation of ctx->Driver.DrawPixels() in terms + * of texture mapping and polygon rendering. + */ +void +_mesa_meta_draw_pixels(GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) +{ + struct drawpix_state *drawpix = &ctx->Meta->DrawPix; + struct temp_texture *tex = get_temp_texture(ctx); + const struct gl_pixelstore_attrib unpackSave = ctx->Unpack; + const GLuint origStencilMask = ctx->Stencil.WriteMask[0]; + GLfloat verts[4][5]; /* four verts of X,Y,Z,S,T */ + GLenum texIntFormat; + GLboolean fallback, newTex; + GLbitfield metaExtraSave = 0x0; + GLuint vbo; + + /* + * Determine if we can do the glDrawPixels with texture mapping. + */ + fallback = GL_FALSE; + if (ctx->_ImageTransferState || + ctx->Fog.Enabled) { + fallback = GL_TRUE; + } + + if (_mesa_is_color_format(format)) { + /* use more compact format when possible */ + /* XXX disable special case for GL_LUMINANCE for now to work around + * apparent i965 driver bug (see bug #23670). + */ + if (/*format == GL_LUMINANCE ||*/ format == GL_LUMINANCE_ALPHA) + texIntFormat = format; + else + texIntFormat = GL_RGBA; + } + else if (_mesa_is_stencil_format(format)) { + if (ctx->Extensions.ARB_fragment_program && + ctx->Pixel.IndexShift == 0 && + ctx->Pixel.IndexOffset == 0 && + type == GL_UNSIGNED_BYTE) { + /* We'll store stencil as alpha. This only works for GLubyte + * image data because of how incoming values are mapped to alpha + * in [0,1]. + */ + texIntFormat = GL_ALPHA; + metaExtraSave = (META_COLOR_MASK | + META_DEPTH_TEST | + META_SHADER | + META_STENCIL_TEST); + } + else { + fallback = GL_TRUE; + } + } + else if (_mesa_is_depth_format(format)) { + if (ctx->Extensions.ARB_depth_texture && + ctx->Extensions.ARB_fragment_program) { + texIntFormat = GL_DEPTH_COMPONENT; + metaExtraSave = (META_SHADER); + } + else { + fallback = GL_TRUE; + } + } + else { + fallback = GL_TRUE; + } + + if (fallback) { + _swrast_DrawPixels(ctx, x, y, width, height, + format, type, unpack, pixels); + return; + } + + /* + * Check image size against max texture size, draw as tiles if needed. + */ + if (width > tex->MaxSize || height > tex->MaxSize) { + tiled_draw_pixels(ctx, tex->MaxSize, x, y, width, height, + format, type, unpack, pixels); + return; + } + + /* Most GL state applies to glDrawPixels (like blending, stencil, etc), + * but a there's a few things we need to override: + */ + _mesa_meta_begin(ctx, (META_RASTERIZATION | + META_SHADER | + META_TEXTURE | + META_TRANSFORM | + META_VERTEX | + META_VIEWPORT | + metaExtraSave)); + + newTex = alloc_texture(tex, width, height, texIntFormat); + + /* vertex positions, texcoords (after texture allocation!) */ + { + const GLfloat x0 = (GLfloat) x; + const GLfloat y0 = (GLfloat) y; + const GLfloat x1 = x + width * ctx->Pixel.ZoomX; + const GLfloat y1 = y + height * ctx->Pixel.ZoomY; + const GLfloat z = ctx->Current.RasterPos[2]; + + verts[0][0] = x0; + verts[0][1] = y0; + verts[0][2] = z; + verts[0][3] = 0.0F; + verts[0][4] = 0.0F; + verts[1][0] = x1; + verts[1][1] = y0; + verts[1][2] = z; + verts[1][3] = tex->Sright; + verts[1][4] = 0.0F; + verts[2][0] = x1; + verts[2][1] = y1; + verts[2][2] = z; + verts[2][3] = tex->Sright; + verts[2][4] = tex->Ttop; + verts[3][0] = x0; + verts[3][1] = y1; + verts[3][2] = z; + verts[3][3] = 0.0F; + verts[3][4] = tex->Ttop; + } + + if (drawpix->ArrayObj == 0) { + /* one-time setup: create vertex array object */ + _mesa_GenVertexArrays(1, &drawpix->ArrayObj); + } + _mesa_BindVertexArray(drawpix->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, &vbo); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + verts, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]), + (void *) (0 * sizeof(GLfloat))); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]), + (void *) (3 * sizeof(GLfloat))); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); + + /* set given unpack params */ + ctx->Unpack = *unpack; + + _mesa_Enable(tex->Target); + + if (_mesa_is_stencil_format(format)) { + /* Drawing stencil */ + GLint bit; + + if (!drawpix->StencilFP) + init_draw_stencil_pixels(ctx); + + setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + GL_ALPHA, type, pixels); + + _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + + _mesa_set_enable(ctx, GL_STENCIL_TEST, GL_TRUE); + + /* set all stencil bits to 0 */ + _mesa_StencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); + _mesa_StencilFunc(GL_ALWAYS, 0, 255); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + + /* set stencil bits to 1 where needed */ + _mesa_StencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); + + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP); + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE); + + for (bit = 0; bit < ctx->Visual.stencilBits; bit++) { + const GLuint mask = 1 << bit; + if (mask & origStencilMask) { + _mesa_StencilFunc(GL_ALWAYS, mask, mask); + _mesa_StencilMask(mask); + + _mesa_ProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, + 255.0 / mask, 0.5, 0.0, 0.0); + + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + } + } + else if (_mesa_is_depth_format(format)) { + /* Drawing depth */ + if (!drawpix->DepthFP) + init_draw_depth_pixels(ctx); + + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->DepthFP); + _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_TRUE); + + /* polygon color = current raster color */ + _mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, + ctx->Current.RasterColor); + + setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + format, type, pixels); + + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + else { + /* Drawing RGBA */ + setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + format, type, pixels); + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + + _mesa_Disable(tex->Target); + + _mesa_DeleteBuffersARB(1, &vbo); + + /* restore unpack params */ + ctx->Unpack = unpackSave; + + _mesa_meta_end(ctx); +} diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h new file mode 100644 index 000000000..b03b64c48 --- /dev/null +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -0,0 +1,81 @@ +/* + * Mesa 3-D graphics library + * Version: 7.6 + * + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef META_H +#define META_H + + +/** + * Flags passed to _mesa_meta_begin(). + * XXX these flags may evolve... + */ +/*@{*/ +#define META_ALPHA_TEST 0x1 +#define META_BLEND 0x2 /**< includes logicop */ +#define META_COLOR_MASK 0x4 +#define META_DEPTH_TEST 0x8 +#define META_FOG 0x10 +#define META_RASTERIZATION 0x20 +#define META_SCISSOR 0x40 +#define META_SHADER 0x80 +#define META_STENCIL_TEST 0x100 +#define META_TRANSFORM 0x200 /**< modelview, projection */ +#define META_TEXTURE 0x400 +#define META_VERTEX 0x800 +#define META_VIEWPORT 0x1000 +#define META_PIXEL_STORE 0x2000 +#define META_ALL ~0x0 +/*@}*/ + + +extern void +_mesa_meta_init(GLcontext *ctx); + +extern void +_mesa_meta_free(GLcontext *ctx); + +extern void +_mesa_meta_blit_framebuffer(GLcontext *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); + +extern void +_mesa_meta_clear(GLcontext *ctx, GLbitfield buffers); + +extern void +_mesa_meta_copy_pixels(GLcontext *ctx, GLint srcx, GLint srcy, + GLsizei width, GLsizei height, + GLint dstx, GLint dsty, GLenum type); + +extern void +_mesa_meta_draw_pixels(GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels); + + +#endif /* META_H */ diff --git a/mesalib/src/mesa/drivers/dri/Makefile b/mesalib/src/mesa/drivers/dri/Makefile new file mode 100644 index 000000000..32db09786 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/Makefile @@ -0,0 +1,55 @@ +# src/mesa/drivers/dri/Makefile + +TOP = ../../../.. + +include $(TOP)/configs/current + + + +default: $(TOP)/$(LIB_DIR) subdirs dri.pc + + +$(TOP)/$(LIB_DIR): + -mkdir $(TOP)/$(LIB_DIR) + + +subdirs: + @for dir in $(DRI_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1 ; \ + fi \ + done + +pcedit = sed \ + -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \ + -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ + -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ + -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ + -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),' \ + -e 's,@DRI_PC_REQ_PRIV@,$(DRI_PC_REQ_PRIV),' + +dri.pc: dri.pc.in + $(pcedit) $< > $@ + + +install: dri.pc + @for dir in $(DRI_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) install) || exit 1 ; \ + fi \ + done + $(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal + $(INSTALL) -m 0644 $(TOP)/include/GL/internal/dri_interface.h \ + $(DESTDIR)$(INSTALL_INC_DIR)/GL/internal + $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + $(INSTALL) -m 0644 dri.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig + + +clean: + -@for dir in $(DRI_DIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) clean) ; \ + fi \ + done + -rm -f common/*.o + -rm -f *.pc diff --git a/mesalib/src/mesa/drivers/dri/Makefile.template b/mesalib/src/mesa/drivers/dri/Makefile.template new file mode 100644 index 000000000..18dbeba24 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/Makefile.template @@ -0,0 +1,99 @@ +# -*-makefile-*- + +MESA_MODULES = $(TOP)/src/mesa/libmesa.a + +COMMON_GALLIUM_SOURCES = \ + ../common/utils.c \ + ../common/vblank.c \ + ../common/dri_util.c \ + ../common/xmlconfig.c + +COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ + ../../common/driverfuncs.c \ + ../common/texmem.c \ + ../common/drirenderbuffer.c \ + ../common/dri_metaops.c + +ifeq ($(WINDOW_SYSTEM),dri) +WINOBJ= +WINLIB= +INCLUDES = $(SHARED_INCLUDES) $(EXPAT_INCLUDES) + +OBJECTS = $(C_SOURCES:.c=.o) \ + $(ASM_SOURCES:.S=.o) + +else +# miniglx +WINOBJ= +WINLIB=-L$(MESA)/src/glx/mini +MINIGLX_INCLUDES = -I$(TOP)/src/glx/mini +INCLUDES = $(MINIGLX_INCLUDES) \ + $(SHARED_INCLUDES) \ + $(PCIACCESS_CFLAGS) + +OBJECTS = $(C_SOURCES:.c=.o) \ + $(MINIGLX_SOURCES:.c=.o) \ + $(ASM_SOURCES:.S=.o) +endif + + +### Include directories +SHARED_INCLUDES = \ + -I. \ + -I$(TOP)/src/mesa/drivers/dri/common \ + -Iserver \ + -I$(TOP)/include \ + -I$(TOP)/src/mesa \ + -I$(TOP)/src/egl/main \ + -I$(TOP)/src/egl/drivers/dri \ + $(LIBDRM_CFLAGS) + + +##### RULES ##### + +.c.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDES) $(CFLAGS) $(DRIVER_DEFINES) $< -o $@ + + +##### TARGETS ##### + +default: symlinks depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) + + +$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template + $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS) + + +$(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME) + $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR) + + +depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS) + @ echo "running $(MKDEP)" + @ rm -f depend + @ touch depend + @ $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \ + $(ASM_SOURCES) > /dev/null 2>/dev/null + + +# Emacs tags +tags: + etags `find . -name \*.[ch]` `find ../include` + + +# Remove .o and backup files +clean: + -rm -f *.o */*.o *~ *.so *~ server/*.o $(SYMLINKS) + -rm -f depend depend.bak + + +install: $(LIBNAME) + $(INSTALL) -d $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) + $(MINSTALL) -m 755 $(LIBNAME) $(DESTDIR)$(DRI_DRIVER_INSTALL_DIR) + + +-include depend diff --git a/mesalib/src/mesa/drivers/dri/common/depthtmp.h b/mesalib/src/mesa/drivers/dri/common/depthtmp.h new file mode 100644 index 000000000..fd2dab3b4 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/depthtmp.h @@ -0,0 +1,270 @@ + +/* + * Notes: + * 1. These functions plug into the gl_renderbuffer structure. + * 2. The 'values' parameter always points to GLuint values, regardless of + * the actual Z buffer depth. + */ + + +#include "spantmp_common.h" + +#ifndef DBG +#define DBG 0 +#endif + +#ifndef HAVE_HW_DEPTH_SPANS +#define HAVE_HW_DEPTH_SPANS 0 +#endif + +#ifndef HAVE_HW_DEPTH_PIXELS +#define HAVE_HW_DEPTH_PIXELS 0 +#endif + +static void TAG(WriteDepthSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const VALUE_TYPE *depth = (const VALUE_TYPE *) values; + GLint x1; + GLint n1; + LOCAL_DEPTH_VARS; + + y = Y_FLIP( y ); + +#if HAVE_HW_DEPTH_SPANS + (void) x1; (void) n1; + + if ( DBG ) fprintf( stderr, "WriteDepthSpan 0..%d (x1 %d)\n", + (int)n, (int)x ); + + WRITE_DEPTH_SPAN(); +#else + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN( x, y, n, x1, n1, i ); + + if ( DBG ) fprintf( stderr, "WriteDepthSpan %d..%d (x1 %d) (mask %p)\n", + (int)i, (int)n1, (int)x1, mask ); + + if ( mask ) { + for ( ; n1>0 ; i++, x1++, n1-- ) { + if ( mask[i] ) WRITE_DEPTH( x1, y, depth[i] ); + } + } else { + for ( ; n1>0 ; i++, x1++, n1-- ) { + WRITE_DEPTH( x1, y, depth[i] ); + } + } + } + HW_ENDCLIPLOOP(); +#endif + } + HW_WRITE_UNLOCK(); +} + + +#if HAVE_HW_DEPTH_SPANS +/* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */ +static void +TAG(WriteMonoDepthSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *value, const GLubyte mask[] ) +{ + const GLuint depthVal = *((GLuint *) value); + GLuint depths[MAX_WIDTH]; + GLuint i; + for (i = 0; i < n; i++) + depths[i] = depthVal; + TAG(WriteDepthSpan)(ctx, rb, n, x, y, depths, mask); +} +#else +static void TAG(WriteMonoDepthSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *value, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLuint depth = *((GLuint *) value); + GLint x1; + GLint n1; + LOCAL_DEPTH_VARS; + + y = Y_FLIP( y ); + + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN( x, y, n, x1, n1, i ); + + if ( DBG ) fprintf( stderr, "%s %d..%d (x1 %d) = %u\n", + __FUNCTION__, (int)i, (int)n1, (int)x1, (GLuint)depth ); + + if ( mask ) { + for ( ; n1>0 ; i++, x1++, n1-- ) { + if ( mask[i] ) WRITE_DEPTH( x1, y, depth ); + } + } else { + for ( ; n1>0 ; x1++, n1-- ) { + WRITE_DEPTH( x1, y, depth ); + } + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} +#endif + + +static void TAG(WriteDepthPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], + const GLint y[], + const void *values, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const VALUE_TYPE *depth = (const VALUE_TYPE *) values; + GLuint i; + LOCAL_DEPTH_VARS; + + if ( DBG ) fprintf( stderr, "WriteDepthPixels\n" ); + +#if HAVE_HW_DEPTH_PIXELS + (void) i; + + WRITE_DEPTH_PIXELS(); +#else + HW_CLIPLOOP() + { + if ( mask ) { + for ( i = 0 ; i < n ; i++ ) { + if ( mask[i] ) { + const int fy = Y_FLIP( y[i] ); + if ( CLIPPIXEL( x[i], fy ) ) + WRITE_DEPTH( x[i], fy, depth[i] ); + } + } + } + else { + for ( i = 0 ; i < n ; i++ ) { + const int fy = Y_FLIP( y[i] ); + if ( CLIPPIXEL( x[i], fy ) ) + WRITE_DEPTH( x[i], fy, depth[i] ); + } + } + } + HW_ENDCLIPLOOP(); +#endif + } + HW_WRITE_UNLOCK(); +} + + +/* Read depth spans and pixels + */ +static void TAG(ReadDepthSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + void *values ) +{ + HW_READ_LOCK() + { + VALUE_TYPE *depth = (VALUE_TYPE *) values; + GLint x1, n1; + LOCAL_DEPTH_VARS; + + y = Y_FLIP( y ); + + if ( DBG ) fprintf( stderr, "ReadDepthSpan\n" ); + +#if HAVE_HW_DEPTH_SPANS + (void) x1; (void) n1; + + READ_DEPTH_SPAN(); +#else + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN( x, y, n, x1, n1, i ); + for ( ; n1>0 ; i++, n1-- ) { + READ_DEPTH( depth[i], x+i, y ); + } + } + HW_ENDCLIPLOOP(); +#endif + } + HW_READ_UNLOCK(); +} + +static void TAG(ReadDepthPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + void *values ) +{ + HW_READ_LOCK() + { + VALUE_TYPE *depth = (VALUE_TYPE *) values; + GLuint i; + LOCAL_DEPTH_VARS; + + if ( DBG ) fprintf( stderr, "ReadDepthPixels\n" ); + +#if HAVE_HW_DEPTH_PIXELS + (void) i; + + READ_DEPTH_PIXELS(); +#else + HW_CLIPLOOP() + { + for ( i = 0 ; i < n ;i++ ) { + int fy = Y_FLIP( y[i] ); + if ( CLIPPIXEL( x[i], fy ) ) + READ_DEPTH( depth[i], x[i], fy ); + } + } + HW_ENDCLIPLOOP(); +#endif + } + HW_READ_UNLOCK(); +} + + +/** + * Initialize the given renderbuffer's span routines to point to + * the depth/z functions we generated above. + */ +static void TAG(InitDepthPointers)(struct gl_renderbuffer *rb) +{ + rb->GetRow = TAG(ReadDepthSpan); + rb->GetValues = TAG(ReadDepthPixels); + rb->PutRow = TAG(WriteDepthSpan); + rb->PutRowRGB = NULL; + rb->PutMonoRow = TAG(WriteMonoDepthSpan); + rb->PutValues = TAG(WriteDepthPixels); + rb->PutMonoValues = NULL; +} + + +#if HAVE_HW_DEPTH_SPANS +#undef WRITE_DEPTH_SPAN +#undef WRITE_DEPTH_PIXELS +#undef READ_DEPTH_SPAN +#undef READ_DEPTH_PIXELS +#else +#undef WRITE_DEPTH +#undef READ_DEPTH +#endif +#undef TAG +#undef VALUE_TYPE diff --git a/mesalib/src/mesa/drivers/dri/common/dri_metaops.c b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c new file mode 100644 index 000000000..c7bea07dc --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/dri_metaops.c @@ -0,0 +1,298 @@ +/************************************************************************** + * + * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 Intel Corporation. + * 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 TUNGSTEN GRAPHICS 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. + * + **************************************************************************/ + +#include "main/arrayobj.h" +#include "main/attrib.h" +#include "main/blend.h" +#include "main/bufferobj.h" +#include "main/buffers.h" +#include "main/depth.h" +#include "main/enable.h" +#include "main/matrix.h" +#include "main/macros.h" +#include "main/polygon.h" +#include "main/shaders.h" +#include "main/stencil.h" +#include "main/texstate.h" +#include "main/varray.h" +#include "main/viewport.h" +#include "shader/arbprogram.h" +#include "shader/program.h" +#include "dri_metaops.h" + +void +meta_set_passthrough_transform(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + meta->saved_vp_x = ctx->Viewport.X; + meta->saved_vp_y = ctx->Viewport.Y; + meta->saved_vp_width = ctx->Viewport.Width; + meta->saved_vp_height = ctx->Viewport.Height; + meta->saved_matrix_mode = ctx->Transform.MatrixMode; + + meta->internal_viewport_call = GL_TRUE; + _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height); + meta->internal_viewport_call = GL_FALSE; + + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); + _mesa_Ortho(0, ctx->DrawBuffer->Width, 0, ctx->DrawBuffer->Height, 1, -1); + + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PushMatrix(); + _mesa_LoadIdentity(); +} + +void +meta_restore_transform(struct dri_metaops *meta) +{ + _mesa_MatrixMode(GL_PROJECTION); + _mesa_PopMatrix(); + _mesa_MatrixMode(GL_MODELVIEW); + _mesa_PopMatrix(); + + _mesa_MatrixMode(meta->saved_matrix_mode); + + meta->internal_viewport_call = GL_TRUE; + _mesa_Viewport(meta->saved_vp_x, meta->saved_vp_y, + meta->saved_vp_width, meta->saved_vp_height); + meta->internal_viewport_call = GL_FALSE; +} + + +/** + * Set up a vertex program to pass through the position and first texcoord + * for pixel path. + */ +void +meta_set_passthrough_vertex_program(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + static const char *vp = + "!!ARBvp1.0\n" + "TEMP vertexClip;\n" + "DP4 vertexClip.x, state.matrix.mvp.row[0], vertex.position;\n" + "DP4 vertexClip.y, state.matrix.mvp.row[1], vertex.position;\n" + "DP4 vertexClip.z, state.matrix.mvp.row[2], vertex.position;\n" + "DP4 vertexClip.w, state.matrix.mvp.row[3], vertex.position;\n" + "MOV result.position, vertexClip;\n" + "MOV result.texcoord[0], vertex.texcoord[0];\n" + "MOV result.color, vertex.color;\n" + "END\n"; + + assert(meta->saved_vp == NULL); + + _mesa_reference_vertprog(ctx, &meta->saved_vp, + ctx->VertexProgram.Current); + if (meta->passthrough_vp == NULL) { + GLuint prog_name; + _mesa_GenPrograms(1, &prog_name); + _mesa_BindProgram(GL_VERTEX_PROGRAM_ARB, prog_name); + _mesa_ProgramStringARB(GL_VERTEX_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(vp), (const GLubyte *)vp); + _mesa_reference_vertprog(ctx, &meta->passthrough_vp, + ctx->VertexProgram.Current); + _mesa_DeletePrograms(1, &prog_name); + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + meta->passthrough_vp); + ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, + &meta->passthrough_vp->Base); + + meta->saved_vp_enable = ctx->VertexProgram.Enabled; + _mesa_Enable(GL_VERTEX_PROGRAM_ARB); +} + +/** + * Restores the previous vertex program after + * meta_set_passthrough_vertex_program() + */ +void +meta_restore_vertex_program(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, + meta->saved_vp); + _mesa_reference_vertprog(ctx, &meta->saved_vp, NULL); + ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB, + &ctx->VertexProgram.Current->Base); + + if (!meta->saved_vp_enable) + _mesa_Disable(GL_VERTEX_PROGRAM_ARB); +} + +/** + * Binds the given program string to GL_FRAGMENT_PROGRAM_ARB, caching the + * program object. + */ +void +meta_set_fragment_program(struct dri_metaops *meta, + struct gl_fragment_program **prog, + const char *prog_string) +{ + GLcontext *ctx = meta->ctx; + assert(meta->saved_fp == NULL); + + _mesa_reference_fragprog(ctx, &meta->saved_fp, + ctx->FragmentProgram.Current); + if (*prog == NULL) { + GLuint prog_name; + _mesa_GenPrograms(1, &prog_name); + _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, prog_name); + _mesa_ProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, + GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(prog_string), (const GLubyte *)prog_string); + _mesa_reference_fragprog(ctx, prog, ctx->FragmentProgram.Current); + /* Note that DeletePrograms unbinds the program on us */ + _mesa_DeletePrograms(1, &prog_name); + } + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, *prog); + ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, &((*prog)->Base)); + + meta->saved_fp_enable = ctx->FragmentProgram.Enabled; + _mesa_Enable(GL_FRAGMENT_PROGRAM_ARB); +} + +/** + * Restores the previous fragment program after + * meta_set_fragment_program() + */ +void +meta_restore_fragment_program(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + FLUSH_VERTICES(ctx, _NEW_PROGRAM); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, + meta->saved_fp); + _mesa_reference_fragprog(ctx, &meta->saved_fp, NULL); + ctx->Driver.BindProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, + &ctx->FragmentProgram.Current->Base); + + if (!meta->saved_fp_enable) + _mesa_Disable(GL_FRAGMENT_PROGRAM_ARB); +} + +static const float default_texcoords[4][2] = { { 0.0, 0.0 }, + { 1.0, 0.0 }, + { 1.0, 1.0 }, + { 0.0, 1.0 } }; + +void +meta_set_default_texrect(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + struct gl_client_array *old_texcoord_array; + + meta->saved_active_texture = ctx->Texture.CurrentUnit; + if (meta->saved_array_vbo == NULL) { + _mesa_reference_buffer_object(ctx, &meta->saved_array_vbo, + ctx->Array.ArrayBufferObj); + } + + old_texcoord_array = &ctx->Array.ArrayObj->TexCoord[0]; + meta->saved_texcoord_type = old_texcoord_array->Type; + meta->saved_texcoord_size = old_texcoord_array->Size; + meta->saved_texcoord_stride = old_texcoord_array->Stride; + meta->saved_texcoord_enable = old_texcoord_array->Enabled; + meta->saved_texcoord_ptr = old_texcoord_array->Ptr; + _mesa_reference_buffer_object(ctx, &meta->saved_texcoord_vbo, + old_texcoord_array->BufferObj); + + _mesa_ClientActiveTextureARB(GL_TEXTURE0); + + if (meta->texcoord_vbo == NULL) { + GLuint vbo_name; + + _mesa_GenBuffersARB(1, &vbo_name); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo_name); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(default_texcoords), + default_texcoords, GL_STATIC_DRAW_ARB); + _mesa_reference_buffer_object(ctx, &meta->texcoord_vbo, + ctx->Array.ArrayBufferObj); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + meta->texcoord_vbo->Name); + } + _mesa_TexCoordPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), NULL); + + _mesa_Enable(GL_TEXTURE_COORD_ARRAY); +} + +void +meta_restore_texcoords(struct dri_metaops *meta) +{ + GLcontext *ctx = meta->ctx; + + /* Restore the old TexCoordPointer */ + if (meta->saved_texcoord_vbo) { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + meta->saved_texcoord_vbo->Name); + _mesa_reference_buffer_object(ctx, &meta->saved_texcoord_vbo, NULL); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } + + _mesa_TexCoordPointer(meta->saved_texcoord_size, + meta->saved_texcoord_type, + meta->saved_texcoord_stride, + meta->saved_texcoord_ptr); + if (!meta->saved_texcoord_enable) + _mesa_Disable(GL_TEXTURE_COORD_ARRAY); + + _mesa_ClientActiveTextureARB(GL_TEXTURE0 + + meta->saved_active_texture); + + if (meta->saved_array_vbo) { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, + meta->saved_array_vbo->Name); + _mesa_reference_buffer_object(ctx, &meta->saved_array_vbo, NULL); + } else { + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + } +} + + +void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta) +{ + meta->ctx = ctx; +} + +void meta_destroy_metaops(struct dri_metaops *meta) +{ + +} diff --git a/mesalib/src/mesa/drivers/dri/common/dri_metaops.h b/mesalib/src/mesa/drivers/dri/common/dri_metaops.h new file mode 100644 index 000000000..248714532 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/dri_metaops.h @@ -0,0 +1,81 @@ +/************************************************************************** + * + * Copyright 2006 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 Intel Corporation. + * 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 TUNGSTEN GRAPHICS 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. + * + **************************************************************************/ + +#ifndef DRI_METAOPS_H +#define DRI_METAOPS_H + + +struct dri_metaops { + GLcontext *ctx; + GLboolean internal_viewport_call; + struct gl_fragment_program *bitmap_fp; + struct gl_vertex_program *passthrough_vp; + struct gl_buffer_object *texcoord_vbo; + + struct gl_fragment_program *saved_fp; + GLboolean saved_fp_enable; + struct gl_vertex_program *saved_vp; + GLboolean saved_vp_enable; + + struct gl_fragment_program *tex2d_fp; + + GLboolean saved_texcoord_enable; + struct gl_buffer_object *saved_array_vbo, *saved_texcoord_vbo; + GLenum saved_texcoord_type; + GLsizei saved_texcoord_size, saved_texcoord_stride; + const void *saved_texcoord_ptr; + int saved_active_texture; + + GLint saved_vp_x, saved_vp_y; + GLsizei saved_vp_width, saved_vp_height; + GLenum saved_matrix_mode; +}; + + +void meta_set_passthrough_transform(struct dri_metaops *meta); + +void meta_restore_transform(struct dri_metaops *meta); + +void meta_set_passthrough_vertex_program(struct dri_metaops *meta); + +void meta_restore_vertex_program(struct dri_metaops *meta); + +void meta_set_fragment_program(struct dri_metaops *meta, + struct gl_fragment_program **prog, + const char *prog_string); + +void meta_restore_fragment_program(struct dri_metaops *meta); + +void meta_set_default_texrect(struct dri_metaops *meta); + +void meta_restore_texcoords(struct dri_metaops *meta); + +void meta_init_metaops(GLcontext *ctx, struct dri_metaops *meta); +void meta_destroy_metaops(struct dri_metaops *meta); + +#endif diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c new file mode 100644 index 000000000..e48e10d7c --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c @@ -0,0 +1,957 @@ +/** + * \file dri_util.c + * DRI utility functions. + * + * This module acts as glue between GLX and the actual hardware driver. A DRI + * driver doesn't really \e have to use any of this - it's optional. But, some + * useful stuff is done here that otherwise would have to be duplicated in most + * drivers. + * + * Basically, these utility functions take care of some of the dirty details of + * screen initialization, context creation, context binding, DRM setup, etc. + * + * These functions are compiled into each DRI driver so libGL.so knows nothing + * about them. + */ + + +#include +#include +#include +#include +#include + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +#include "main/imports.h" +#define None 0 + +#include "dri_util.h" +#include "drm_sarea.h" +#include "utils.h" + +#ifndef GLX_OML_sync_control +typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator); +#endif + +static void dri_get_drawable(__DRIdrawable *pdp); +static void dri_put_drawable(__DRIdrawable *pdp); + +/** + * This is just a token extension used to signal that the driver + * supports setting a read drawable. + */ +const __DRIextension driReadDrawableExtension = { + __DRI_READ_DRAWABLE, __DRI_READ_DRAWABLE_VERSION +}; + +/** + * Print message to \c stderr if the \c LIBGL_DEBUG environment variable + * is set. + * + * Is called from the drivers. + * + * \param f \c printf like format string. + */ +void +__driUtilMessage(const char *f, ...) +{ + va_list args; + + if (getenv("LIBGL_DEBUG")) { + fprintf(stderr, "libGL: "); + va_start(args, f); + vfprintf(stderr, f, args); + va_end(args); + fprintf(stderr, "\n"); + } +} + +GLint +driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ) +{ + if (rect2.x1 > rect1.x1) rect1.x1 = rect2.x1; + if (rect2.x2 < rect1.x2) rect1.x2 = rect2.x2; + if (rect2.y1 > rect1.y1) rect1.y1 = rect2.y1; + if (rect2.y2 < rect1.y2) rect1.y2 = rect2.y2; + + if (rect1.x1 > rect1.x2 || rect1.y1 > rect1.y2) return 0; + + return (rect1.x2 - rect1.x1) * (rect1.y2 - rect1.y1); +} + +/*****************************************************************/ +/** \name Context (un)binding functions */ +/*****************************************************************/ +/*@{*/ + +/** + * Unbind context. + * + * \param scrn the screen. + * \param gc context. + * + * \return \c GL_TRUE on success, or \c GL_FALSE on failure. + * + * \internal + * This function calls __DriverAPIRec::UnbindContext, and then decrements + * __DRIdrawablePrivateRec::refcount which must be non-zero for a successful + * return. + * + * While casting the opaque private pointers associated with the parameters + * into their respective real types it also assures they are not \c NULL. + */ +static int driUnbindContext(__DRIcontext *pcp) +{ + __DRIscreen *psp; + __DRIdrawable *pdp; + __DRIdrawable *prp; + + /* + ** Assume error checking is done properly in glXMakeCurrent before + ** calling driUnbindContext. + */ + + if (pcp == NULL) + return GL_FALSE; + + psp = pcp->driScreenPriv; + pdp = pcp->driDrawablePriv; + prp = pcp->driReadablePriv; + + /* already unbound */ + if (!pdp && !prp) + return GL_TRUE; + /* Let driver unbind drawable from context */ + (*psp->DriverAPI.UnbindContext)(pcp); + + if (pdp->refcount == 0) { + /* ERROR!!! */ + return GL_FALSE; + } + + dri_put_drawable(pdp); + + if (prp != pdp) { + if (prp->refcount == 0) { + /* ERROR!!! */ + return GL_FALSE; + } + + dri_put_drawable(prp); + } + + + /* XXX this is disabled so that if we call SwapBuffers on an unbound + * window we can determine the last context bound to the window and + * use that context's lock. (BrianP, 2-Dec-2000) + */ + pcp->driDrawablePriv = pcp->driReadablePriv = NULL; + +#if 0 + /* Unbind the drawable */ + pdp->driContextPriv = &psp->dummyContextPriv; +#endif + + return GL_TRUE; +} + +/** + * This function takes both a read buffer and a draw buffer. This is needed + * for \c glXMakeCurrentReadSGI or GLX 1.3's \c glXMakeContextCurrent + * function. + */ +static int driBindContext(__DRIcontext *pcp, + __DRIdrawable *pdp, + __DRIdrawable *prp) +{ + __DRIscreenPrivate *psp = pcp->driScreenPriv; + + /* Bind the drawable to the context */ + + if (pcp) { + pcp->driDrawablePriv = pdp; + pcp->driReadablePriv = prp; + if (pdp) { + pdp->driContextPriv = pcp; + dri_get_drawable(pdp); + } + if ( prp && pdp != prp ) { + dri_get_drawable(prp); + } + } + + /* + ** Now that we have a context associated with this drawable, we can + ** initialize the drawable information if has not been done before. + */ + + if (!psp->dri2.enabled) { + if (pdp && !pdp->pStamp) { + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + __driUtilUpdateDrawableInfo(pdp); + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + } + if (prp && pdp != prp && !prp->pStamp) { + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + __driUtilUpdateDrawableInfo(prp); + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + } + } + + /* Call device-specific MakeCurrent */ + + return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp); +} + +/*@}*/ + + +/*****************************************************************/ +/** \name Drawable handling functions */ +/*****************************************************************/ +/*@{*/ + +/** + * Update private drawable information. + * + * \param pdp pointer to the private drawable information to update. + * + * This function basically updates the __DRIdrawablePrivate struct's + * cliprect information by calling \c __DRIinterfaceMethods::getDrawableInfo. + * This is usually called by the DRI_VALIDATE_DRAWABLE_INFO macro which + * compares the __DRIdrwablePrivate pStamp and lastStamp values. If + * the values are different that means we have to update the clipping + * info. + */ +void +__driUtilUpdateDrawableInfo(__DRIdrawablePrivate *pdp) +{ + __DRIscreenPrivate *psp = pdp->driScreenPriv; + __DRIcontextPrivate *pcp = pdp->driContextPriv; + + if (!pcp + || ((pdp != pcp->driDrawablePriv) && (pdp != pcp->driReadablePriv))) { + /* ERROR!!! + * ...but we must ignore it. There can be many contexts bound to a + * drawable. + */ + } + + if (pdp->pClipRects) { + _mesa_free(pdp->pClipRects); + pdp->pClipRects = NULL; + } + + if (pdp->pBackClipRects) { + _mesa_free(pdp->pBackClipRects); + pdp->pBackClipRects = NULL; + } + + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); + + if (! (*psp->getDrawableInfo->getDrawableInfo)(pdp, + &pdp->index, &pdp->lastStamp, + &pdp->x, &pdp->y, &pdp->w, &pdp->h, + &pdp->numClipRects, &pdp->pClipRects, + &pdp->backX, + &pdp->backY, + &pdp->numBackClipRects, + &pdp->pBackClipRects, + pdp->loaderPrivate)) { + /* Error -- eg the window may have been destroyed. Keep going + * with no cliprects. + */ + pdp->pStamp = &pdp->lastStamp; /* prevent endless loop */ + pdp->numClipRects = 0; + pdp->pClipRects = NULL; + pdp->numBackClipRects = 0; + pdp->pBackClipRects = NULL; + } + else + pdp->pStamp = &(psp->pSAREA->drawableTable[pdp->index].stamp); + + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); +} + +/*@}*/ + +/*****************************************************************/ +/** \name GLX callbacks */ +/*****************************************************************/ +/*@{*/ + +static void driReportDamage(__DRIdrawable *pdp, + struct drm_clip_rect *pClipRects, int numClipRects) +{ + __DRIscreen *psp = pdp->driScreenPriv; + + /* Check that we actually have the new damage report method */ + if (psp->damage) { + /* Report the damage. Currently, all our drivers draw + * directly to the front buffer, so we report the damage there + * rather than to the backing storein (if any). + */ + (*psp->damage->reportDamage)(pdp, + pdp->x, pdp->y, + pClipRects, numClipRects, + GL_TRUE, pdp->loaderPrivate); + } +} + + +/** + * Swap buffers. + * + * \param drawablePrivate opaque pointer to the per-drawable private info. + * + * \internal + * This function calls __DRIdrawablePrivate::swapBuffers. + * + * Is called directly from glXSwapBuffers(). + */ +static void driSwapBuffers(__DRIdrawable *dPriv) +{ + __DRIscreen *psp = dPriv->driScreenPriv; + drm_clip_rect_t *rects; + int i; + + psp->DriverAPI.SwapBuffers(dPriv); + + if (!dPriv->numClipRects) + return; + + rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects); + + if (!rects) + return; + + for (i = 0; i < dPriv->numClipRects; i++) { + rects[i].x1 = dPriv->pClipRects[i].x1 - dPriv->x; + rects[i].y1 = dPriv->pClipRects[i].y1 - dPriv->y; + rects[i].x2 = dPriv->pClipRects[i].x2 - dPriv->x; + rects[i].y2 = dPriv->pClipRects[i].y2 - dPriv->y; + } + + driReportDamage(dPriv, rects, dPriv->numClipRects); + _mesa_free(rects); +} + +static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv, + int64_t *msc ) +{ + return sPriv->DriverAPI.GetDrawableMSC(sPriv, dPriv, msc); +} + + +static int driWaitForMSC(__DRIdrawable *dPriv, int64_t target_msc, + int64_t divisor, int64_t remainder, + int64_t * msc, int64_t * sbc) +{ + __DRIswapInfo sInfo; + int status; + + status = dPriv->driScreenPriv->DriverAPI.WaitForMSC( dPriv, target_msc, + divisor, remainder, + msc ); + + /* GetSwapInfo() may not be provided by the driver if GLX_SGI_video_sync + * is supported but GLX_OML_sync_control is not. Therefore, don't return + * an error value if GetSwapInfo() is not implemented. + */ + if ( status == 0 + && dPriv->driScreenPriv->DriverAPI.GetSwapInfo ) { + status = dPriv->driScreenPriv->DriverAPI.GetSwapInfo( dPriv, & sInfo ); + *sbc = sInfo.swap_count; + } + + return status; +} + + +const __DRImediaStreamCounterExtension driMediaStreamCounterExtension = { + { __DRI_MEDIA_STREAM_COUNTER, __DRI_MEDIA_STREAM_COUNTER_VERSION }, + driWaitForMSC, + driDrawableGetMSC, +}; + + +static void driCopySubBuffer(__DRIdrawable *dPriv, + int x, int y, int w, int h) +{ + drm_clip_rect_t rect; + + rect.x1 = x; + rect.y1 = dPriv->h - y - h; + rect.x2 = x + w; + rect.y2 = rect.y1 + h; + driReportDamage(dPriv, &rect, 1); + + dPriv->driScreenPriv->DriverAPI.CopySubBuffer(dPriv, x, y, w, h); +} + +const __DRIcopySubBufferExtension driCopySubBufferExtension = { + { __DRI_COPY_SUB_BUFFER, __DRI_COPY_SUB_BUFFER_VERSION }, + driCopySubBuffer +}; + +static void driSetSwapInterval(__DRIdrawable *dPriv, unsigned int interval) +{ + dPriv->swap_interval = interval; +} + +static unsigned int driGetSwapInterval(__DRIdrawable *dPriv) +{ + return dPriv->swap_interval; +} + +const __DRIswapControlExtension driSwapControlExtension = { + { __DRI_SWAP_CONTROL, __DRI_SWAP_CONTROL_VERSION }, + driSetSwapInterval, + driGetSwapInterval +}; + + +/** + * This is called via __DRIscreenRec's createNewDrawable pointer. + */ +static __DRIdrawable * +driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config, + drm_drawable_t hwDrawable, int renderType, + const int *attrs, void *data) +{ + __DRIdrawable *pdp; + + /* Since pbuffers are not yet supported, no drawable attributes are + * supported either. + */ + (void) attrs; + + pdp = _mesa_malloc(sizeof *pdp); + if (!pdp) { + return NULL; + } + + pdp->loaderPrivate = data; + pdp->hHWDrawable = hwDrawable; + pdp->refcount = 1; + pdp->pStamp = NULL; + pdp->lastStamp = 0; + pdp->index = 0; + pdp->x = 0; + pdp->y = 0; + pdp->w = 0; + pdp->h = 0; + pdp->numClipRects = 0; + pdp->numBackClipRects = 0; + pdp->pClipRects = NULL; + pdp->pBackClipRects = NULL; + pdp->vblSeq = 0; + pdp->vblFlags = 0; + + pdp->driScreenPriv = psp; + pdp->driContextPriv = &psp->dummyContextPriv; + + if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes, + renderType == GLX_PIXMAP_BIT)) { + _mesa_free(pdp); + return NULL; + } + + pdp->msc_base = 0; + + /* This special default value is replaced with the configured + * default value when the drawable is first bound to a direct + * rendering context. + */ + pdp->swap_interval = (unsigned)-1; + + return pdp; +} + + +static __DRIdrawable * +dri2CreateNewDrawable(__DRIscreen *screen, + const __DRIconfig *config, + void *loaderPrivate) +{ + __DRIdrawable *pdraw; + + pdraw = driCreateNewDrawable(screen, config, 0, 0, NULL, loaderPrivate); + if (!pdraw) + return NULL; + + pdraw->pClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); + pdraw->pBackClipRects = _mesa_malloc(sizeof *pdraw->pBackClipRects); + + return pdraw; +} + +static void dri_get_drawable(__DRIdrawable *pdp) +{ + pdp->refcount++; +} + +static void dri_put_drawable(__DRIdrawable *pdp) +{ + __DRIscreenPrivate *psp; + + pdp->refcount--; + if (pdp->refcount) + return; + + if (pdp) { + psp = pdp->driScreenPriv; + (*psp->DriverAPI.DestroyBuffer)(pdp); + if (pdp->pClipRects) { + _mesa_free(pdp->pClipRects); + pdp->pClipRects = NULL; + } + if (pdp->pBackClipRects) { + _mesa_free(pdp->pBackClipRects); + pdp->pBackClipRects = NULL; + } + _mesa_free(pdp); + } +} + +static void +driDestroyDrawable(__DRIdrawable *pdp) +{ + dri_put_drawable(pdp); +} + +/*@}*/ + + +/*****************************************************************/ +/** \name Context handling functions */ +/*****************************************************************/ +/*@{*/ + +/** + * Destroy the per-context private information. + * + * \internal + * This function calls __DriverAPIRec::DestroyContext on \p contextPrivate, calls + * drmDestroyContext(), and finally frees \p contextPrivate. + */ +static void +driDestroyContext(__DRIcontext *pcp) +{ + if (pcp) { + (*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp); + _mesa_free(pcp); + } +} + + +/** + * Create the per-drawable private driver information. + * + * \param render_type Type of rendering target. \c GLX_RGBA is the only + * type likely to ever be supported for direct-rendering. + * \param shared Context with which to share textures, etc. or NULL + * + * \returns An opaque pointer to the per-context private information on + * success, or \c NULL on failure. + * + * \internal + * This function allocates and fills a __DRIcontextPrivateRec structure. It + * performs some device independent initialization and passes all the + * relevent information to __DriverAPIRec::CreateContext to create the + * context. + * + */ +static __DRIcontext * +driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config, + int render_type, __DRIcontext *shared, + drm_context_t hwContext, void *data) +{ + __DRIcontext *pcp; + void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL; + + pcp = _mesa_malloc(sizeof *pcp); + if (!pcp) + return NULL; + + pcp->driScreenPriv = psp; + pcp->driDrawablePriv = NULL; + + /* When the first context is created for a screen, initialize a "dummy" + * context. + */ + + if (!psp->dri2.enabled && !psp->dummyContextPriv.driScreenPriv) { + psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context; + psp->dummyContextPriv.driScreenPriv = psp; + psp->dummyContextPriv.driDrawablePriv = NULL; + psp->dummyContextPriv.driverPrivate = NULL; + /* No other fields should be used! */ + } + + pcp->hHWContext = hwContext; + + if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) { + _mesa_free(pcp); + return NULL; + } + + return pcp; +} + + +static __DRIcontext * +dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config, + __DRIcontext *shared, void *data) +{ + return driCreateNewContext(screen, config, 0, shared, 0, data); +} + + +static int +driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask) +{ + return GL_FALSE; +} + +/*@}*/ + + +/*****************************************************************/ +/** \name Screen handling functions */ +/*****************************************************************/ +/*@{*/ + +/** + * Destroy the per-screen private information. + * + * \internal + * This function calls __DriverAPIRec::DestroyScreen on \p screenPrivate, calls + * drmClose(), and finally frees \p screenPrivate. + */ +static void driDestroyScreen(__DRIscreen *psp) +{ + if (psp) { + /* No interaction with the X-server is possible at this point. This + * routine is called after XCloseDisplay, so there is no protocol + * stream open to the X-server anymore. + */ + + if (psp->DriverAPI.DestroyScreen) + (*psp->DriverAPI.DestroyScreen)(psp); + + if (!psp->dri2.enabled) { + (void)drmUnmap((drmAddress)psp->pSAREA, SAREA_MAX); + (void)drmUnmap((drmAddress)psp->pFB, psp->fbSize); + (void)drmCloseOnce(psp->fd); + } + + _mesa_free(psp); + } +} + +static void +setupLoaderExtensions(__DRIscreen *psp, + const __DRIextension **extensions) +{ + int i; + + for (i = 0; extensions[i]; i++) { + if (strcmp(extensions[i]->name, __DRI_GET_DRAWABLE_INFO) == 0) + psp->getDrawableInfo = (__DRIgetDrawableInfoExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_DAMAGE) == 0) + psp->damage = (__DRIdamageExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_SYSTEM_TIME) == 0) + psp->systemTime = (__DRIsystemTimeExtension *) extensions[i]; + if (strcmp(extensions[i]->name, __DRI_DRI2_LOADER) == 0) + psp->dri2.loader = (__DRIdri2LoaderExtension *) extensions[i]; + } +} + +/** + * This is the bootstrap function for the driver. libGL supplies all of the + * requisite information about the system, and the driver initializes itself. + * This routine also fills in the linked list pointed to by \c driver_modes + * with the \c __GLcontextModes that the driver can support for windows or + * pbuffers. + * + * For legacy DRI. + * + * \param scrn Index of the screen + * \param ddx_version Version of the 2D DDX. This may not be meaningful for + * all drivers. + * \param dri_version Version of the "server-side" DRI. + * \param drm_version Version of the kernel DRM. + * \param frame_buffer Data describing the location and layout of the + * framebuffer. + * \param pSAREA Pointer the the SAREA. + * \param fd Device handle for the DRM. + * \param extensions ?? + * \param driver_modes Returns modes suppoted by the driver + * \param loaderPrivate ?? + * + * \note There is no need to check the minimum API version in this + * function. Since the name of this function is versioned, it is + * impossible for a loader that is too old to even load this driver. + */ +static __DRIscreen * +driCreateNewScreen(int scrn, + const __DRIversion *ddx_version, + const __DRIversion *dri_version, + const __DRIversion *drm_version, + const __DRIframebuffer *frame_buffer, + drmAddress pSAREA, int fd, + const __DRIextension **extensions, + const __DRIconfig ***driver_modes, + void *loaderPrivate) +{ + static const __DRIextension *emptyExtensionList[] = { NULL }; + __DRIscreen *psp; + + psp = _mesa_calloc(sizeof *psp); + if (!psp) + return NULL; + + setupLoaderExtensions(psp, extensions); + + /* + ** NOT_DONE: This is used by the X server to detect when the client + ** has died while holding the drawable lock. The client sets the + ** drawable lock to this value. + */ + psp->drawLockID = 1; + + psp->drm_version = *drm_version; + psp->ddx_version = *ddx_version; + psp->dri_version = *dri_version; + + psp->pSAREA = pSAREA; + psp->lock = (drmLock *) &psp->pSAREA->lock; + + psp->pFB = frame_buffer->base; + psp->fbSize = frame_buffer->size; + psp->fbStride = frame_buffer->stride; + psp->fbWidth = frame_buffer->width; + psp->fbHeight = frame_buffer->height; + psp->devPrivSize = frame_buffer->dev_priv_size; + psp->pDevPriv = frame_buffer->dev_priv; + psp->fbBPP = psp->fbStride * 8 / frame_buffer->width; + + psp->extensions = emptyExtensionList; + psp->fd = fd; + psp->myNum = scrn; + psp->dri2.enabled = GL_FALSE; + + /* + ** Do not init dummy context here; actual initialization will be + ** done when the first DRI context is created. Init screen priv ptr + ** to NULL to let CreateContext routine that it needs to be inited. + */ + psp->dummyContextPriv.driScreenPriv = NULL; + + psp->DriverAPI = driDriverAPI; + + *driver_modes = driDriverAPI.InitScreen(psp); + if (*driver_modes == NULL) { + _mesa_free(psp); + return NULL; + } + + return psp; +} + +/** + * DRI2 + */ +static __DRIscreen * +dri2CreateNewScreen(int scrn, int fd, + const __DRIextension **extensions, + const __DRIconfig ***driver_configs, void *data) +{ + static const __DRIextension *emptyExtensionList[] = { NULL }; + __DRIscreen *psp; + drmVersionPtr version; + + if (driDriverAPI.InitScreen2 == NULL) + return NULL; + + psp = _mesa_calloc(sizeof(*psp)); + if (!psp) + return NULL; + + setupLoaderExtensions(psp, extensions); + + version = drmGetVersion(fd); + if (version) { + psp->drm_version.major = version->version_major; + psp->drm_version.minor = version->version_minor; + psp->drm_version.patch = version->version_patchlevel; + drmFreeVersion(version); + } + + psp->extensions = emptyExtensionList; + psp->fd = fd; + psp->myNum = scrn; + psp->dri2.enabled = GL_TRUE; + + psp->DriverAPI = driDriverAPI; + *driver_configs = driDriverAPI.InitScreen2(psp); + if (*driver_configs == NULL) { + _mesa_free(psp); + return NULL; + } + + psp->DriverAPI = driDriverAPI; + + return psp; +} + +static const __DRIextension **driGetExtensions(__DRIscreen *psp) +{ + return psp->extensions; +} + +/** Core interface */ +const __DRIcoreExtension driCoreExtension = { + { __DRI_CORE, __DRI_CORE_VERSION }, + NULL, + driDestroyScreen, + driGetExtensions, + driGetConfigAttrib, + driIndexConfigAttrib, + NULL, + driDestroyDrawable, + driSwapBuffers, + NULL, + driCopyContext, + driDestroyContext, + driBindContext, + driUnbindContext +}; + +/** Legacy DRI interface */ +const __DRIlegacyExtension driLegacyExtension = { + { __DRI_LEGACY, __DRI_LEGACY_VERSION }, + driCreateNewScreen, + driCreateNewDrawable, + driCreateNewContext, +}; + +/** Legacy DRI interface */ +const __DRIdri2Extension driDRI2Extension = { + { __DRI_DRI2, __DRI_DRI2_VERSION }, + dri2CreateNewScreen, + dri2CreateNewDrawable, + dri2CreateNewContext, +}; + +/* This is the table of extensions that the loader will dlsym() for. */ +PUBLIC const __DRIextension *__driDriverExtensions[] = { + &driCoreExtension.base, + &driLegacyExtension.base, + &driDRI2Extension.base, + NULL +}; + +static int +driFrameTracking(__DRIdrawable *drawable, GLboolean enable) +{ + return GLX_BAD_CONTEXT; +} + +static int +driQueryFrameTracking(__DRIdrawable *dpriv, + int64_t * sbc, int64_t * missedFrames, + float * lastMissedUsage, float * usage) +{ + __DRIswapInfo sInfo; + int status; + int64_t ust; + __DRIscreenPrivate *psp = dpriv->driScreenPriv; + + status = dpriv->driScreenPriv->DriverAPI.GetSwapInfo( dpriv, & sInfo ); + if ( status == 0 ) { + *sbc = sInfo.swap_count; + *missedFrames = sInfo.swap_missed_count; + *lastMissedUsage = sInfo.swap_missed_usage; + + (*psp->systemTime->getUST)( & ust ); + *usage = driCalculateSwapUsage( dpriv, sInfo.swap_ust, ust ); + } + + return status; +} + +const __DRIframeTrackingExtension driFrameTrackingExtension = { + { __DRI_FRAME_TRACKING, __DRI_FRAME_TRACKING_VERSION }, + driFrameTracking, + driQueryFrameTracking +}; + +/** + * Calculate amount of swap interval used between GLX buffer swaps. + * + * The usage value, on the range [0,max], is the fraction of total swap + * interval time used between GLX buffer swaps is calculated. + * + * \f$p = t_d / (i * t_r)\f$ + * + * Where \f$t_d\f$ is the time since the last GLX buffer swap, \f$i\f$ is the + * swap interval (as set by \c glXSwapIntervalSGI), and \f$t_r\f$ time + * required for a single vertical refresh period (as returned by \c + * glXGetMscRateOML). + * + * See the documentation for the GLX_MESA_swap_frame_usage extension for more + * details. + * + * \param dPriv Pointer to the private drawable structure. + * \return If less than a single swap interval time period was required + * between GLX buffer swaps, a number greater than 0 and less than + * 1.0 is returned. If exactly one swap interval time period is + * required, 1.0 is returned, and if more than one is required then + * a number greater than 1.0 will be returned. + * + * \sa glXSwapIntervalSGI glXGetMscRateOML + * + * \todo Instead of caching the \c glXGetMscRateOML function pointer, would it + * be possible to cache the sync rate? + */ +float +driCalculateSwapUsage( __DRIdrawablePrivate *dPriv, int64_t last_swap_ust, + int64_t current_ust ) +{ + int32_t n; + int32_t d; + int interval; + float usage = 1.0; + __DRIscreenPrivate *psp = dPriv->driScreenPriv; + + if ( (*psp->systemTime->getMSCRate)(dPriv, &n, &d, dPriv->loaderPrivate) ) { + interval = (dPriv->swap_interval != 0) ? dPriv->swap_interval : 1; + + + /* We want to calculate + * (current_UST - last_swap_UST) / (interval * us_per_refresh). We get + * current_UST by calling __glXGetUST. last_swap_UST is stored in + * dPriv->swap_ust. interval has already been calculated. + * + * The only tricky part is us_per_refresh. us_per_refresh is + * 1000000 / MSC_rate. We know the MSC_rate is n / d. We can flip it + * around and say us_per_refresh = 1000000 * d / n. Since this goes in + * the denominator of the final calculation, we calculate + * (interval * 1000000 * d) and move n into the numerator. + */ + + usage = (current_ust - last_swap_ust); + usage *= n; + usage /= (interval * d); + usage /= 1000000.0; + } + + return usage; +} + +/*@}*/ diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.h b/mesalib/src/mesa/drivers/dri/common/dri_util.h new file mode 100644 index 000000000..c95a5c829 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/dri_util.h @@ -0,0 +1,555 @@ +/* + * 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. + */ + +/** + * \file dri_util.h + * DRI utility functions definitions. + * + * This module acts as glue between GLX and the actual hardware driver. A DRI + * driver doesn't really \e have to use any of this - it's optional. But, some + * useful stuff is done here that otherwise would have to be duplicated in most + * drivers. + * + * Basically, these utility functions take care of some of the dirty details of + * screen initialization, context creation, context binding, DRM setup, etc. + * + * These functions are compiled into each DRI driver so libGL.so knows nothing + * about them. + * + * \sa dri_util.c. + * + * \author Kevin E. Martin + * \author Brian Paul + */ + +#ifndef _DRI_UTIL_H_ +#define _DRI_UTIL_H_ + +#include +#include +#include +#include +#include "main/glheader.h" +#include "GL/internal/glcore.h" +#include "GL/internal/dri_interface.h" + +#define GLX_BAD_CONTEXT 5 + +typedef struct __DRIswapInfoRec __DRIswapInfo; + +/* Typedefs to avoid rewriting the world. */ +typedef struct __DRIscreenRec __DRIscreenPrivate; +typedef struct __DRIdrawableRec __DRIdrawablePrivate; +typedef struct __DRIcontextRec __DRIcontextPrivate; + +/** + * Extensions. + */ +extern const __DRIlegacyExtension driLegacyExtension; +extern const __DRIcoreExtension driCoreExtension; +extern const __DRIextension driReadDrawableExtension; +extern const __DRIcopySubBufferExtension driCopySubBufferExtension; +extern const __DRIswapControlExtension driSwapControlExtension; +extern const __DRIframeTrackingExtension driFrameTrackingExtension; +extern const __DRImediaStreamCounterExtension driMediaStreamCounterExtension; + +/** + * Used by DRI_VALIDATE_DRAWABLE_INFO + */ +#define DRI_VALIDATE_DRAWABLE_INFO_ONCE(pDrawPriv) \ + do { \ + if (*(pDrawPriv->pStamp) != pDrawPriv->lastStamp) { \ + __driUtilUpdateDrawableInfo(pDrawPriv); \ + } \ + } while (0) + + +/** + * Utility macro to validate the drawable information. + * + * See __DRIdrawable::pStamp and __DRIdrawable::lastStamp. + */ +#define DRI_VALIDATE_DRAWABLE_INFO(psp, pdp) \ +do { \ + while (*(pdp->pStamp) != pdp->lastStamp) { \ + register unsigned int hwContext = psp->pSAREA->lock.lock & \ + ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \ + DRM_UNLOCK(psp->fd, &psp->pSAREA->lock, hwContext); \ + \ + DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \ + DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \ + DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID); \ + \ + DRM_LIGHT_LOCK(psp->fd, &psp->pSAREA->lock, hwContext); \ + } \ +} while (0) + +/** + * Same as above, but for two drawables simultaneously. + * + */ + +#define DRI_VALIDATE_TWO_DRAWABLES_INFO(psp, pdp, prp) \ +do { \ + while (*((pdp)->pStamp) != (pdp)->lastStamp || \ + *((prp)->pStamp) != (prp)->lastStamp) { \ + register unsigned int hwContext = (psp)->pSAREA->lock.lock & \ + ~(DRM_LOCK_HELD | DRM_LOCK_CONT); \ + DRM_UNLOCK((psp)->fd, &(psp)->pSAREA->lock, hwContext); \ + \ + DRM_SPINLOCK(&(psp)->pSAREA->drawable_lock, (psp)->drawLockID); \ + DRI_VALIDATE_DRAWABLE_INFO_ONCE(pdp); \ + DRI_VALIDATE_DRAWABLE_INFO_ONCE(prp); \ + DRM_SPINUNLOCK(&(psp)->pSAREA->drawable_lock, (psp)->drawLockID); \ + \ + DRM_LIGHT_LOCK((psp)->fd, &(psp)->pSAREA->lock, hwContext); \ + } \ +} while (0) + + +/** + * Driver callback functions. + * + * Each DRI driver must have one of these structures with all the pointers set + * to appropriate functions within the driver. + * + * When glXCreateContext() is called, for example, it'll call a helper function + * dri_util.c which in turn will jump through the \a CreateContext pointer in + * this structure. + */ +struct __DriverAPIRec { + const __DRIconfig **(*InitScreen) (__DRIscreen * priv); + + /** + * Screen destruction callback + */ + void (*DestroyScreen)(__DRIscreen *driScrnPriv); + + /** + * Context creation callback + */ + GLboolean (*CreateContext)(const __GLcontextModes *glVis, + __DRIcontext *driContextPriv, + void *sharedContextPrivate); + + /** + * Context destruction callback + */ + void (*DestroyContext)(__DRIcontext *driContextPriv); + + /** + * Buffer (drawable) creation callback + */ + GLboolean (*CreateBuffer)(__DRIscreen *driScrnPriv, + __DRIdrawable *driDrawPriv, + const __GLcontextModes *glVis, + GLboolean pixmapBuffer); + + /** + * Buffer (drawable) destruction callback + */ + void (*DestroyBuffer)(__DRIdrawable *driDrawPriv); + + /** + * Buffer swapping callback + */ + void (*SwapBuffers)(__DRIdrawable *driDrawPriv); + + /** + * Context activation callback + */ + GLboolean (*MakeCurrent)(__DRIcontext *driContextPriv, + __DRIdrawable *driDrawPriv, + __DRIdrawable *driReadPriv); + + /** + * Context unbinding callback + */ + GLboolean (*UnbindContext)(__DRIcontext *driContextPriv); + + /** + * Retrieves statistics about buffer swap operations. Required if + * GLX_OML_sync_control or GLX_MESA_swap_frame_usage is supported. + */ + int (*GetSwapInfo)( __DRIdrawable *dPriv, __DRIswapInfo * sInfo ); + + + /** + * These are required if GLX_OML_sync_control is supported. + */ + /*@{*/ + int (*WaitForMSC)( __DRIdrawable *priv, int64_t target_msc, + int64_t divisor, int64_t remainder, + int64_t * msc ); + int (*WaitForSBC)( __DRIdrawable *priv, int64_t target_sbc, + int64_t * msc, int64_t * sbc ); + + int64_t (*SwapBuffersMSC)( __DRIdrawable *priv, int64_t target_msc, + int64_t divisor, int64_t remainder ); + /*@}*/ + void (*CopySubBuffer)(__DRIdrawable *driDrawPriv, + int x, int y, int w, int h); + + /** + * New version of GetMSC so we can pass drawable data to the low + * level DRM driver (e.g. pipe info). Required if + * GLX_SGI_video_sync or GLX_OML_sync_control is supported. + */ + int (*GetDrawableMSC) ( __DRIscreen * priv, + __DRIdrawable *drawablePrivate, + int64_t *count); + + + + /* DRI2 Entry point */ + const __DRIconfig **(*InitScreen2) (__DRIscreen * priv); +}; + +extern const struct __DriverAPIRec driDriverAPI; + + +struct __DRIswapInfoRec { + /** + * Number of swapBuffers operations that have been *completed*. + */ + uint64_t swap_count; + + /** + * Unadjusted system time of the last buffer swap. This is the time + * when the swap completed, not the time when swapBuffers was called. + */ + int64_t swap_ust; + + /** + * Number of swap operations that occurred after the swap deadline. That + * is if a swap happens more than swap_interval frames after the previous + * swap, it has missed its deadline. If swap_interval is 0, then the + * swap deadline is 1 frame after the previous swap. + */ + uint64_t swap_missed_count; + + /** + * Amount of time used by the last swap that missed its deadline. This + * is calculated as (__glXGetUST() - swap_ust) / (swap_interval * + * time_for_single_vrefresh)). If the actual value of swap_interval is + * 0, then 1 is used instead. If swap_missed_count is non-zero, this + * should be greater-than 1.0. + */ + float swap_missed_usage; +}; + + +/** + * Per-drawable private DRI driver information. + */ +struct __DRIdrawableRec { + /** + * Kernel drawable handle + */ + drm_drawable_t hHWDrawable; + + /** + * Driver's private drawable information. + * + * This structure is opaque. + */ + void *driverPrivate; + + /** + * Private data from the loader. We just hold on to it and pass + * it back when calling into loader provided functions. + */ + void *loaderPrivate; + + /** + * Reference count for number of context's currently bound to this + * drawable. + * + * Once it reaches zero, the drawable can be destroyed. + * + * \note This behavior will change with GLX 1.3. + */ + int refcount; + + /** + * Index of this drawable information in the SAREA. + */ + unsigned int index; + + /** + * Pointer to the "drawable has changed ID" stamp in the SAREA. + */ + unsigned int *pStamp; + + /** + * Last value of the stamp. + * + * If this differs from the value stored at __DRIdrawable::pStamp, + * then the drawable information has been modified by the X server, and the + * drawable information (below) should be retrieved from the X server. + */ + unsigned int lastStamp; + + /** + * \name Drawable + * + * Drawable information used in software fallbacks. + */ + /*@{*/ + int x; + int y; + int w; + int h; + int numClipRects; + drm_clip_rect_t *pClipRects; + /*@}*/ + + /** + * \name Back and depthbuffer + * + * Information about the back and depthbuffer where different from above. + */ + /*@{*/ + int backX; + int backY; + int backClipRectType; + int numBackClipRects; + drm_clip_rect_t *pBackClipRects; + /*@}*/ + + /** + * \name Vertical blank tracking information + * Used for waiting on vertical blank events. + */ + /*@{*/ + unsigned int vblSeq; + unsigned int vblFlags; + /*@}*/ + + /** + * \name Monotonic MSC tracking + * + * Low level driver is responsible for updating msc_base and + * vblSeq values so that higher level code can calculate + * a new msc value or msc target for a WaitMSC call. The new value + * will be: + * msc = msc_base + get_vblank_count() - vblank_base; + * + * And for waiting on a value, core code will use: + * actual_target = target_msc - msc_base + vblank_base; + */ + /*@{*/ + int64_t vblank_base; + int64_t msc_base; + /*@}*/ + + /** + * Pointer to context to which this drawable is currently bound. + */ + __DRIcontext *driContextPriv; + + /** + * Pointer to screen on which this drawable was created. + */ + __DRIscreen *driScreenPriv; + + /** + * Controls swap interval as used by GLX_SGI_swap_control and + * GLX_MESA_swap_control. + */ + unsigned int swap_interval; +}; + +/** + * Per-context private driver information. + */ +struct __DRIcontextRec { + /** + * Kernel context handle used to access the device lock. + */ + drm_context_t hHWContext; + + /** + * Device driver's private context data. This structure is opaque. + */ + void *driverPrivate; + + /** + * Pointer back to the \c __DRIcontext that contains this structure. + */ + __DRIcontext *pctx; + + /** + * Pointer to drawable currently bound to this context for drawing. + */ + __DRIdrawable *driDrawablePriv; + + /** + * Pointer to drawable currently bound to this context for reading. + */ + __DRIdrawable *driReadablePriv; + + /** + * Pointer to screen on which this context was created. + */ + __DRIscreen *driScreenPriv; +}; + +/** + * Per-screen private driver information. + */ +struct __DRIscreenRec { + /** + * Current screen's number + */ + int myNum; + + /** + * Callback functions into the hardware-specific DRI driver code. + */ + struct __DriverAPIRec DriverAPI; + + const __DRIextension **extensions; + /** + * DDX / 2D driver version information. + */ + __DRIversion ddx_version; + + /** + * DRI X extension version information. + */ + __DRIversion dri_version; + + /** + * DRM (kernel module) version information. + */ + __DRIversion drm_version; + + /** + * ID used when the client sets the drawable lock. + * + * The X server uses this value to detect if the client has died while + * holding the drawable lock. + */ + int drawLockID; + + /** + * File descriptor returned when the kernel device driver is opened. + * + * Used to: + * - authenticate client to kernel + * - map the frame buffer, SAREA, etc. + * - close the kernel device driver + */ + int fd; + + /** + * SAREA pointer + * + * Used to access: + * - the device lock + * - the device-independent per-drawable and per-context(?) information + */ + drm_sarea_t *pSAREA; + + /** + * \name Direct frame buffer access information + * Used for software fallbacks. + */ + /*@{*/ + unsigned char *pFB; + int fbSize; + int fbOrigin; + int fbStride; + int fbWidth; + int fbHeight; + int fbBPP; + /*@}*/ + + /** + * \name Device-dependent private information (stored in the SAREA). + * + * This data is accessed by the client driver only. + */ + /*@{*/ + void *pDevPriv; + int devPrivSize; + /*@}*/ + + /** + * Dummy context to which drawables are bound when not bound to any + * other context. + * + * A dummy hHWContext is created for this context, and is used by the GL + * core when a hardware lock is required but the drawable is not currently + * bound (e.g., potentially during a SwapBuffers request). The dummy + * context is created when the first "real" context is created on this + * screen. + */ + __DRIcontext dummyContextPriv; + + /** + * Device-dependent private information (not stored in the SAREA). + * + * This pointer is never touched by the DRI layer. + */ + void *private; + + /** + * Pointer back to the \c __DRIscreen that contains this structure. + */ + __DRIscreen *psc; + + /* Extensions provided by the loader. */ + const __DRIgetDrawableInfoExtension *getDrawableInfo; + const __DRIsystemTimeExtension *systemTime; + const __DRIdamageExtension *damage; + + struct { + /* Flag to indicate that this is a DRI2 screen. Many of the above + * fields will not be valid or initializaed in that case. */ + int enabled; + __DRIdri2LoaderExtension *loader; + } dri2; + + /* The lock actually in use, old sarea or DRI2 */ + drmLock *lock; +}; + +extern void +__driUtilMessage(const char *f, ...); + + +extern void +__driUtilUpdateDrawableInfo(__DRIdrawable *pdp); + +extern float +driCalculateSwapUsage( __DRIdrawable *dPriv, + int64_t last_swap_ust, int64_t current_ust ); + +extern GLint +driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ); + +#endif /* _DRI_UTIL_H_ */ diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c new file mode 100644 index 000000000..15af99136 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.c @@ -0,0 +1,217 @@ + +#include "main/mtypes.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" +#include "main/imports.h" +#include "drirenderbuffer.h" + + +/** + * This will get called when a window (gl_framebuffer) is resized (probably + * via driUpdateFramebufferSize(), below). + * Just update width, height and internal format fields for now. + * There's usually no memory allocation above because the present + * DRI drivers use statically-allocated full-screen buffers. If that's not + * the case for a DRI driver, a different AllocStorage method should + * be used. + */ +static GLboolean +driRenderbufferStorage(GLcontext *ctx, struct gl_renderbuffer *rb, + GLenum internalFormat, GLuint width, GLuint height) +{ + rb->Width = width; + rb->Height = height; + rb->InternalFormat = internalFormat; + return GL_TRUE; +} + + +static void +driDeleteRenderbuffer(struct gl_renderbuffer *rb) +{ + /* don't free rb->Data Chances are it's a memory mapped region for + * the dri drivers. + */ + _mesa_free(rb); +} + + +/** + * Allocate a new driRenderbuffer object. + * Individual drivers are free to implement different versions of + * this function. + * + * At this time, this function can only be used for window-system + * renderbuffers, not user-created RBOs. + * + * \param format Either GL_RGBA, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT24, + * GL_DEPTH_COMPONENT32, or GL_STENCIL_INDEX8_EXT (for now). + * \param addr address in main memory of the buffer. Probably a memory + * mapped region. + * \param cpp chars or bytes per pixel + * \param offset start of renderbuffer with respect to start of framebuffer + * \param pitch pixels per row + */ +driRenderbuffer * +driNewRenderbuffer(GLenum format, GLvoid *addr, + GLint cpp, GLint offset, GLint pitch, + __DRIdrawablePrivate *dPriv) +{ + driRenderbuffer *drb; + + assert(format == GL_RGBA || + format == GL_RGB5 || + format == GL_RGBA8 || + format == GL_DEPTH_COMPONENT16 || + format == GL_DEPTH_COMPONENT24 || + format == GL_DEPTH_COMPONENT32 || + format == GL_STENCIL_INDEX8_EXT); + + assert(cpp > 0); + assert(pitch > 0); + + drb = _mesa_calloc(sizeof(driRenderbuffer)); + if (drb) { + const GLuint name = 0; + + _mesa_init_renderbuffer(&drb->Base, name); + + /* Make sure we're using a null-valued GetPointer routine */ + assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL); + + drb->Base.InternalFormat = format; + + if (format == GL_RGBA || format == GL_RGB5 || format == GL_RGBA8) { + /* Color */ + drb->Base._BaseFormat = GL_RGBA; + drb->Base.DataType = GL_UNSIGNED_BYTE; + if (format == GL_RGB5) { + drb->Base.RedBits = 5; + drb->Base.GreenBits = 6; + drb->Base.BlueBits = 5; + } + else { + drb->Base.RedBits = + drb->Base.GreenBits = + drb->Base.BlueBits = + drb->Base.AlphaBits = 8; + } + } + else if (format == GL_DEPTH_COMPONENT16) { + /* Depth */ + drb->Base._BaseFormat = GL_DEPTH_COMPONENT; + /* we always Get/Put 32-bit Z values */ + drb->Base.DataType = GL_UNSIGNED_INT; + drb->Base.DepthBits = 16; + } + else if (format == GL_DEPTH_COMPONENT24) { + /* Depth */ + drb->Base._BaseFormat = GL_DEPTH_COMPONENT; + /* we always Get/Put 32-bit Z values */ + drb->Base.DataType = GL_UNSIGNED_INT; + drb->Base.DepthBits = 24; + } + else if (format == GL_DEPTH_COMPONENT32) { + /* Depth */ + drb->Base._BaseFormat = GL_DEPTH_COMPONENT; + /* we always Get/Put 32-bit Z values */ + drb->Base.DataType = GL_UNSIGNED_INT; + drb->Base.DepthBits = 32; + } + else { + /* Stencil */ + ASSERT(format == GL_STENCIL_INDEX8_EXT); + drb->Base._BaseFormat = GL_STENCIL_INDEX; + drb->Base.DataType = GL_UNSIGNED_BYTE; + drb->Base.StencilBits = 8; + } + + /* XXX if we were allocating a user-created renderbuffer, we'd have + * to fill in the Red/Green/Blue/.../Bits values too. + */ + + drb->Base.AllocStorage = driRenderbufferStorage; + drb->Base.Delete = driDeleteRenderbuffer; + + drb->Base.Data = addr; + + /* DRI renderbuffer-specific fields: */ + drb->dPriv = dPriv; + drb->offset = offset; + drb->pitch = pitch; + drb->cpp = cpp; + + /* may be changed if page flipping is active: */ + drb->flippedOffset = offset; + drb->flippedPitch = pitch; + drb->flippedData = addr; + } + return drb; +} + + +/** + * Update the front and back renderbuffers' flippedPitch/Offset/Data fields. + * If stereo, flip both the left and right pairs. + * This is used when we do double buffering via page flipping. + * \param fb the framebuffer we're page flipping + * \param flipped if true, set flipped values, else set non-flipped values + */ +void +driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped) +{ + const GLuint count = fb->Visual.stereoMode ? 2 : 1; + GLuint lr; /* left or right */ + + /* we shouldn't really call this function if single-buffered, but + * play it safe. + */ + if (!fb->Visual.doubleBufferMode) + return; + + for (lr = 0; lr < count; lr++) { + GLuint frontBuf = (lr == 0) ? BUFFER_FRONT_LEFT : BUFFER_FRONT_RIGHT; + GLuint backBuf = (lr == 0) ? BUFFER_BACK_LEFT : BUFFER_BACK_RIGHT; + driRenderbuffer *front_drb + = (driRenderbuffer *) fb->Attachment[frontBuf].Renderbuffer; + driRenderbuffer *back_drb + = (driRenderbuffer *) fb->Attachment[backBuf].Renderbuffer; + + if (flipped) { + front_drb->flippedOffset = back_drb->offset; + front_drb->flippedPitch = back_drb->pitch; + front_drb->flippedData = back_drb->Base.Data; + back_drb->flippedOffset = front_drb->offset; + back_drb->flippedPitch = front_drb->pitch; + back_drb->flippedData = front_drb->Base.Data; + } + else { + front_drb->flippedOffset = front_drb->offset; + front_drb->flippedPitch = front_drb->pitch; + front_drb->flippedData = front_drb->Base.Data; + back_drb->flippedOffset = back_drb->offset; + back_drb->flippedPitch = back_drb->pitch; + back_drb->flippedData = back_drb->Base.Data; + } + } +} + + +/** + * Check that the gl_framebuffer associated with dPriv is the right size. + * Resize the gl_framebuffer if needed. + * It's expected that the dPriv->driverPrivate member points to a + * gl_framebuffer object. + */ +void +driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv) +{ + struct gl_framebuffer *fb = (struct gl_framebuffer *) dPriv->driverPrivate; + if (fb && (dPriv->w != fb->Width || dPriv->h != fb->Height)) { + ctx->Driver.ResizeBuffers(ctx, fb, dPriv->w, dPriv->h); + /* if the driver needs the hw lock for ResizeBuffers, the drawable + might have changed again by now */ + assert(fb->Width == dPriv->w); + assert(fb->Height == dPriv->h); + } +} diff --git a/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h new file mode 100644 index 000000000..cf55286b3 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/drirenderbuffer.h @@ -0,0 +1,78 @@ + +/** + * A driRenderbuffer is dervied from gl_renderbuffer. + * It describes a color buffer (front or back), a depth buffer, or stencil + * buffer etc. + * Specific to DRI drivers are the offset and pitch fields. + */ + + +#ifndef DRIRENDERBUFFER_H +#define DRIRENDERBUFFER_H + +#include "main/mtypes.h" +#include "dri_util.h" + + +typedef struct { + struct gl_renderbuffer Base; + + /* Chars or bytes per pixel. If Z and Stencil are stored together this + * will typically be 32 whether this a depth or stencil renderbuffer. + */ + GLint cpp; + + /* Buffer position and pitch (row stride). Recall that for today's DRI + * drivers, we have statically allocated color/depth/stencil buffers. + * So this information describes the whole screen, not just a window. + * To address pixels in a window, we need to know the window's position + * and size with respect to the screen. + */ + GLint offset; /* in bytes */ + GLint pitch; /* in pixels */ + + /* If the driver can do page flipping (full-screen double buffering) + * the current front/back buffers may get swapped. + * If page flipping is disabled, these fields will be identical to + * the offset/pitch/Data above. + * If page flipping is enabled, and this is the front(back) renderbuffer, + * flippedOffset/Pitch/Data will have the back(front) renderbuffer's values. + */ + GLint flippedOffset; + GLint flippedPitch; + GLvoid *flippedData; /* mmap'd address of buffer memory, if used */ + + /* Pointer to corresponding __DRIdrawablePrivate. This is used to compute + * the window's position within the framebuffer. + */ + __DRIdrawablePrivate *dPriv; + + /* XXX this is for radeon/r200 only. We should really create a new + * r200Renderbuffer class, derived from this class... not a huge deal. + */ + GLboolean depthHasSurface; + + /** + * A handy flag to know if this is the back color buffer. + * + * \note + * This is currently only used by s3v and tdfx. + */ + GLboolean backBuffer; +} driRenderbuffer; + + +extern driRenderbuffer * +driNewRenderbuffer(GLenum format, GLvoid *addr, + GLint cpp, GLint offset, GLint pitch, + __DRIdrawablePrivate *dPriv); + +extern void +driFlipRenderbuffers(struct gl_framebuffer *fb, GLboolean flipped); + + +extern void +driUpdateFramebufferSize(GLcontext *ctx, const __DRIdrawablePrivate *dPriv); + + +#endif /* DRIRENDERBUFFER_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/extension_helper.h b/mesalib/src/mesa/drivers/dri/common/extension_helper.h new file mode 100644 index 000000000..40a030ce0 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/extension_helper.h @@ -0,0 +1,6609 @@ +/* DO NOT EDIT - This file generated automatically by extension_helper.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * 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 + * IBM, + * AND/OR THEIR 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. + */ + +#include "utils.h" +#include "glapi/dispatch.h" + +#ifndef NULL +# define NULL 0 +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char UniformMatrix3fvARB_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix3fv\0" + "glUniformMatrix3fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_multisample) +static const char SampleCoverageARB_names[] = + "fi\0" /* Parameter signature */ + "glSampleCoverage\0" + "glSampleCoverageARB\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionFilter1D_names[] = + "iiiiip\0" /* Parameter signature */ + "glConvolutionFilter1D\0" + "glConvolutionFilter1DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char BeginQueryARB_names[] = + "ii\0" /* Parameter signature */ + "glBeginQuery\0" + "glBeginQueryARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite) +static const char PointParameteriNV_names[] = + "ii\0" /* Parameter signature */ + "glPointParameteri\0" + "glPointParameteriNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetProgramiv_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramiv\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3sARB_names[] = + "iiii\0" /* Parameter signature */ + "glMultiTexCoord3s\0" + "glMultiTexCoord3sARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3iEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3i\0" + "glSecondaryColor3iEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3fMESA_names[] = + "fff\0" /* Parameter signature */ + "glWindowPos3f\0" + "glWindowPos3fARB\0" + "glWindowPos3fMESA\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char PixelTexGenParameterfvSGIS_names[] = + "ip\0" /* Parameter signature */ + "glPixelTexGenParameterfvSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char ActiveTextureARB_names[] = + "i\0" /* Parameter signature */ + "glActiveTexture\0" + "glActiveTextureARB\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_blit) +static const char BlitFramebufferEXT_names[] = + "iiiiiiiiii\0" /* Parameter signature */ + "glBlitFramebuffer\0" + "glBlitFramebufferEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4ubvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4ubvNV\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char GetProgramNamedParameterdvNV_names[] = + "iipp\0" /* Parameter signature */ + "glGetProgramNamedParameterdvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char Histogram_names[] = + "iiii\0" /* Parameter signature */ + "glHistogram\0" + "glHistogramEXT\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture4D) +static const char TexImage4DSGIS_names[] = + "iiiiiiiiiip\0" /* Parameter signature */ + "glTexImage4DSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2dvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos2dv\0" + "glWindowPos2dvARB\0" + "glWindowPos2dvMESA\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glReplacementCodeuiColor3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_EXT_blend_equation_separate) || defined(need_GL_ATI_blend_equation_separate) +static const char BlendEquationSeparateEXT_names[] = + "ii\0" /* Parameter signature */ + "glBlendEquationSeparate\0" + "glBlendEquationSeparateEXT\0" + "glBlendEquationSeparateATI\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char ListParameterfSGIX_names[] = + "iif\0" /* Parameter signature */ + "glListParameterfSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3bEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3b\0" + "glSecondaryColor3bEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord4fColor4fNormal3fVertex4fvSUN_names[] = + "pppp\0" /* Parameter signature */ + "glTexCoord4fColor4fNormal3fVertex4fvSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4svNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4svNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char GetBufferSubDataARB_names[] = + "iiip\0" /* Parameter signature */ + "glGetBufferSubData\0" + "glGetBufferSubDataARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char BufferSubDataARB_names[] = + "iiip\0" /* Parameter signature */ + "glBufferSubData\0" + "glBufferSubDataARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor4ubVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glTexCoord2fColor4ubVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char AttachShader_names[] = + "ii\0" /* Parameter signature */ + "glAttachShader\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2fARB_names[] = + "iff\0" /* Parameter signature */ + "glVertexAttrib2f\0" + "glVertexAttrib2fARB\0" + ""; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const char GetDebugLogLengthMESA_names[] = + "iii\0" /* Parameter signature */ + "glGetDebugLogLengthMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3fARB_names[] = + "ifff\0" /* Parameter signature */ + "glVertexAttrib3f\0" + "glVertexAttrib3fARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char GetQueryivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryiv\0" + "glGetQueryivARB\0" + ""; +#endif + +#if defined(need_GL_EXT_texture3D) +static const char TexImage3D_names[] = + "iiiiiiiiip\0" /* Parameter signature */ + "glTexImage3D\0" + "glTexImage3DEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glReplacementCodeuiVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char GetQueryObjectivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryObjectiv\0" + "glGetQueryObjectivARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexSubImage2DARB_names[] = + "iiiiiiiip\0" /* Parameter signature */ + "glCompressedTexSubImage2D\0" + "glCompressedTexSubImage2DARB\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerOutputNV_names[] = + "iiiiiiiiii\0" /* Parameter signature */ + "glCombinerOutputNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform2fARB_names[] = + "iff\0" /* Parameter signature */ + "glUniform2f\0" + "glUniform2fARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1svARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1sv\0" + "glVertexAttrib1svARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs1dvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs1dvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform2ivARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform2iv\0" + "glUniform2ivARB\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char GetImageTransformParameterfvHP_names[] = + "iip\0" /* Parameter signature */ + "glGetImageTransformParameterfvHP\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightubvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightubvARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1fvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1fvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char CopyConvolutionFilter1D_names[] = + "iiiii\0" /* Parameter signature */ + "glCopyConvolutionFilter1D\0" + "glCopyConvolutionFilter1DEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiNormal3fVertex3fSUN_names[] = + "iffffff\0" /* Parameter signature */ + "glReplacementCodeuiNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char DeleteSync_names[] = + "i\0" /* Parameter signature */ + "glDeleteSync\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentMaterialfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glFragmentMaterialfvSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_blend_color) +static const char BlendColor_names[] = + "ffff\0" /* Parameter signature */ + "glBlendColor\0" + "glBlendColorEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char UniformMatrix4fvARB_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix4fv\0" + "glUniformMatrix4fvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object) +static const char DeleteVertexArraysAPPLE_names[] = + "ip\0" /* Parameter signature */ + "glDeleteVertexArrays\0" + "glDeleteVertexArraysAPPLE\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char ReadInstrumentsSGIX_names[] = + "i\0" /* Parameter signature */ + "glReadInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix2x4fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix2x4fv\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4ubVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glColor4ubVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_texture_array) +static const char FramebufferTextureLayerEXT_names[] = + "iiiii\0" /* Parameter signature */ + "glFramebufferTextureLayer\0" + "glFramebufferTextureLayerEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char GetListParameterfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetListParameterfvSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NusvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nusv\0" + "glVertexAttrib4NusvARB\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4svMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos4svMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char CreateProgramObjectARB_names[] = + "\0" /* Parameter signature */ + "glCreateProgramObjectARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightModelivSGIX_names[] = + "ip\0" /* Parameter signature */ + "glFragmentLightModelivSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix4x3fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix4x3fv\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char PrioritizeTextures_names[] = + "ipp\0" /* Parameter signature */ + "glPrioritizeTextures\0" + "glPrioritizeTexturesEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char AsyncMarkerSGIX_names[] = + "i\0" /* Parameter signature */ + "glAsyncMarkerSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorubSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactorubSUN\0" + ""; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const char ClearDebugLogMESA_names[] = + "iii\0" /* Parameter signature */ + "glClearDebugLogMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char ResetHistogram_names[] = + "i\0" /* Parameter signature */ + "glResetHistogram\0" + "glResetHistogramEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char GetProgramNamedParameterfvNV_names[] = + "iipp\0" /* Parameter signature */ + "glGetProgramNamedParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters) +static const char PointParameterfEXT_names[] = + "if\0" /* Parameter signature */ + "glPointParameterf\0" + "glPointParameterfARB\0" + "glPointParameterfEXT\0" + "glPointParameterfSGIS\0" + ""; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const char LoadIdentityDeformationMapSGIX_names[] = + "i\0" /* Parameter signature */ + "glLoadIdentityDeformationMapSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char GenFencesNV_names[] = + "ip\0" /* Parameter signature */ + "glGenFencesNV\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char ImageTransformParameterfHP_names[] = + "iif\0" /* Parameter signature */ + "glImageTransformParameterfHP\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char MatrixIndexusvARB_names[] = + "ip\0" /* Parameter signature */ + "glMatrixIndexusvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char DisableVertexAttribArrayARB_names[] = + "i\0" /* Parameter signature */ + "glDisableVertexAttribArray\0" + "glDisableVertexAttribArrayARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char StencilMaskSeparate_names[] = + "ii\0" /* Parameter signature */ + "glStencilMaskSeparate\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramLocalParameter4dARB_names[] = + "iidddd\0" /* Parameter signature */ + "glProgramLocalParameter4dARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexImage3DARB_names[] = + "iiiiiiiip\0" /* Parameter signature */ + "glCompressedTexImage3D\0" + "glCompressedTexImage3DARB\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char GetConvolutionParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glGetConvolutionParameteriv\0" + "glGetConvolutionParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1fARB_names[] = + "if\0" /* Parameter signature */ + "glVertexAttrib1f\0" + "glVertexAttrib1fARB\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char TestFenceNV_names[] = + "i\0" /* Parameter signature */ + "glTestFenceNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1fvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord1fv\0" + "glMultiTexCoord1fvARB\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char ColorFragmentOp2ATI_names[] = + "iiiiiiiiii\0" /* Parameter signature */ + "glColorFragmentOp2ATI\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char SecondaryColorPointerListIBM_names[] = + "iiipi\0" /* Parameter signature */ + "glSecondaryColorPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char GetPixelTexGenParameterivSGIS_names[] = + "ip\0" /* Parameter signature */ + "glGetPixelTexGenParameterivSGIS\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4fNV_names[] = + "iffff\0" /* Parameter signature */ + "glVertexAttrib4fNV\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeubSUN_names[] = + "i\0" /* Parameter signature */ + "glReplacementCodeubSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char FinishAsyncSGIX_names[] = + "p\0" /* Parameter signature */ + "glFinishAsyncSGIX\0" + ""; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const char GetDebugLogMESA_names[] = + "iiiipp\0" /* Parameter signature */ + "glGetDebugLogMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoorddEXT_names[] = + "d\0" /* Parameter signature */ + "glFogCoordd\0" + "glFogCoorddEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4ubVertex3fSUN_names[] = + "iiiifff\0" /* Parameter signature */ + "glColor4ubVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoordfEXT_names[] = + "f\0" /* Parameter signature */ + "glFogCoordf\0" + "glFogCoordfEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fVertex3fSUN_names[] = + "fffff\0" /* Parameter signature */ + "glTexCoord2fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactoriSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactoriSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2dNV_names[] = + "idd\0" /* Parameter signature */ + "glVertexAttrib2dNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetProgramInfoLog_names[] = + "iipp\0" /* Parameter signature */ + "glGetProgramInfoLog\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NbvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nbv\0" + "glVertexAttrib4NbvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader) +static const char GetActiveAttribARB_names[] = + "iiipppp\0" /* Parameter signature */ + "glGetActiveAttrib\0" + "glGetActiveAttribARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4ubNV_names[] = + "iiiii\0" /* Parameter signature */ + "glVertexAttrib4ubNV\0" + ""; +#endif + +#if defined(need_GL_APPLE_texture_range) +static const char TextureRangeAPPLE_names[] = + "iip\0" /* Parameter signature */ + "glTextureRangeAPPLE\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor4fNormal3fVertex3fSUN_names[] = + "ffffffffffff\0" /* Parameter signature */ + "glTexCoord2fColor4fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerParameterfvNV_names[] = + "ip\0" /* Parameter signature */ + "glCombinerParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs3dvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs3dvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs4fvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs4fvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_array_range) +static const char VertexArrayRangeNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexArrayRangeNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightiSGIX_names[] = + "iii\0" /* Parameter signature */ + "glFragmentLightiSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_polygon_offset) +static const char PolygonOffsetEXT_names[] = + "ff\0" /* Parameter signature */ + "glPolygonOffsetEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char PollAsyncSGIX_names[] = + "p\0" /* Parameter signature */ + "glPollAsyncSGIX\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char DeleteFragmentShaderATI_names[] = + "i\0" /* Parameter signature */ + "glDeleteFragmentShaderATI\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fNormal3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glTexCoord2fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) +static const char MultTransposeMatrixdARB_names[] = + "p\0" /* Parameter signature */ + "glMultTransposeMatrixd\0" + "glMultTransposeMatrixdARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2svMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos2sv\0" + "glWindowPos2svARB\0" + "glWindowPos2svMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexImage1DARB_names[] = + "iiiiiip\0" /* Parameter signature */ + "glCompressedTexImage1D\0" + "glCompressedTexImage1DARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2sNV_names[] = + "iii\0" /* Parameter signature */ + "glVertexAttrib2sNV\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char NormalPointerListIBM_names[] = + "iipi\0" /* Parameter signature */ + "glNormalPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char IndexPointerEXT_names[] = + "iiip\0" /* Parameter signature */ + "glIndexPointerEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char NormalPointerEXT_names[] = + "iiip\0" /* Parameter signature */ + "glNormalPointerEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3dARB_names[] = + "iddd\0" /* Parameter signature */ + "glMultiTexCoord3d\0" + "glMultiTexCoord3dARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2iARB_names[] = + "iii\0" /* Parameter signature */ + "glMultiTexCoord2i\0" + "glMultiTexCoord2iARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names[] = + "iffffffff\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2svARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord2sv\0" + "glMultiTexCoord2svARB\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeubvSUN_names[] = + "p\0" /* Parameter signature */ + "glReplacementCodeubvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform3iARB_names[] = + "iiii\0" /* Parameter signature */ + "glUniform3i\0" + "glUniform3iARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char GetFragmentMaterialfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetFragmentMaterialfvSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetShaderInfoLog_names[] = + "iipp\0" /* Parameter signature */ + "glGetShaderInfoLog\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightivARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightivARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char PollInstrumentsSGIX_names[] = + "p\0" /* Parameter signature */ + "glPollInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactordSUN_names[] = + "d\0" /* Parameter signature */ + "glGlobalAlphaFactordSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs3fvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs3fvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GenerateMipmapEXT_names[] = + "i\0" /* Parameter signature */ + "glGenerateMipmap\0" + "glGenerateMipmapEXT\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char SetFragmentShaderConstantATI_names[] = + "ip\0" /* Parameter signature */ + "glSetFragmentShaderConstantATI\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapAttribParameterivNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetMapAttribParameterivNV\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char CreateShaderObjectARB_names[] = + "i\0" /* Parameter signature */ + "glCreateShaderObjectARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_sharpen_texture) +static const char GetSharpenTexFuncSGIS_names[] = + "ip\0" /* Parameter signature */ + "glGetSharpenTexFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char BufferDataARB_names[] = + "iipi\0" /* Parameter signature */ + "glBufferData\0" + "glBufferDataARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_array_range) +static const char FlushVertexArrayRangeNV_names[] = + "\0" /* Parameter signature */ + "glFlushVertexArrayRangeNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char SampleMapATI_names[] = + "iii\0" /* Parameter signature */ + "glSampleMapATI\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char VertexPointerEXT_names[] = + "iiiip\0" /* Parameter signature */ + "glVertexPointerEXT\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture_filter4) +static const char GetTexFilterFuncSGIS_names[] = + "iip\0" /* Parameter signature */ + "glGetTexFilterFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetCombinerOutputParameterfvNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetCombinerOutputParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_subtexture) +static const char TexSubImage1D_names[] = + "iiiiiip\0" /* Parameter signature */ + "glTexSubImage1D\0" + "glTexSubImage1DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1sARB_names[] = + "ii\0" /* Parameter signature */ + "glVertexAttrib1s\0" + "glVertexAttrib1sARB\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char FenceSync_names[] = + "ii\0" /* Parameter signature */ + "glFenceSync\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char FinalCombinerInputNV_names[] = + "iiii\0" /* Parameter signature */ + "glFinalCombinerInputNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_flush_raster) +static const char FlushRasterSGIX_names[] = + "\0" /* Parameter signature */ + "glFlushRasterSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fVertex3fSUN_names[] = + "ifffff\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform1fARB_names[] = + "if\0" /* Parameter signature */ + "glUniform1f\0" + "glUniform1fARB\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char AreTexturesResident_names[] = + "ipp\0" /* Parameter signature */ + "glAreTexturesResident\0" + "glAreTexturesResidentEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil) +static const char StencilOpSeparate_names[] = + "iiii\0" /* Parameter signature */ + "glStencilOpSeparate\0" + "glStencilOpSeparateATI\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) +static const char ColorTableParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glColorTableParameteriv\0" + "glColorTableParameterivSGI\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char FogCoordPointerListIBM_names[] = + "iipi\0" /* Parameter signature */ + "glFogCoordPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3dMESA_names[] = + "ddd\0" /* Parameter signature */ + "glWindowPos3d\0" + "glWindowPos3dARB\0" + "glWindowPos3dMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters) +static const char PointParameterfvEXT_names[] = + "ip\0" /* Parameter signature */ + "glPointParameterfv\0" + "glPointParameterfvARB\0" + "glPointParameterfvEXT\0" + "glPointParameterfvSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2fvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos2fv\0" + "glWindowPos2fvARB\0" + "glWindowPos2fvMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3bvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3bv\0" + "glSecondaryColor3bvEXT\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char VertexPointerListIBM_names[] = + "iiipi\0" /* Parameter signature */ + "glVertexPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramLocalParameterfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramLocalParameterfvARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentMaterialfSGIX_names[] = + "iif\0" /* Parameter signature */ + "glFragmentMaterialfSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fNormal3fVertex3fSUN_names[] = + "ffffffff\0" /* Parameter signature */ + "glTexCoord2fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char RenderbufferStorageEXT_names[] = + "iiii\0" /* Parameter signature */ + "glRenderbufferStorage\0" + "glRenderbufferStorageEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char IsFenceNV_names[] = + "i\0" /* Parameter signature */ + "glIsFenceNV\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char AttachObjectARB_names[] = + "ii\0" /* Parameter signature */ + "glAttachObjectARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char GetFragmentLightivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetFragmentLightivSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char UniformMatrix2fvARB_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix2fv\0" + "glUniformMatrix2fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2fARB_names[] = + "iff\0" /* Parameter signature */ + "glMultiTexCoord2f\0" + "glMultiTexCoord2fARB\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) +static const char ColorTable_names[] = + "iiiiip\0" /* Parameter signature */ + "glColorTable\0" + "glColorTableSGI\0" + "glColorTableEXT\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char MapControlPointsNV_names[] = + "iiiiiiiip\0" /* Parameter signature */ + "glMapControlPointsNV\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionFilter2D_names[] = + "iiiiiip\0" /* Parameter signature */ + "glConvolutionFilter2D\0" + "glConvolutionFilter2DEXT\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char MapParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glMapParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3dvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3dv\0" + "glVertexAttrib3dvARB\0" + ""; +#endif + +#if defined(need_GL_PGI_misc_hints) +static const char HintPGI_names[] = + "ii\0" /* Parameter signature */ + "glHintPGI\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glConvolutionParameteriv\0" + "glConvolutionParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_cull_vertex) +static const char CullParameterdvEXT_names[] = + "ip\0" /* Parameter signature */ + "glCullParameterdvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char ProgramNamedParameter4fNV_names[] = + "iipffff\0" /* Parameter signature */ + "glProgramNamedParameter4fNV\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color3fVertex3fSUN_names[] = + "ffffff\0" /* Parameter signature */ + "glColor3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char ProgramEnvParameter4fvARB_names[] = + "iip\0" /* Parameter signature */ + "glProgramEnvParameter4fvARB\0" + "glProgramParameter4fvNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightModeliSGIX_names[] = + "ii\0" /* Parameter signature */ + "glFragmentLightModeliSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glConvolutionParameterfv\0" + "glConvolutionParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_3DFX_tbuffer) +static const char TbufferMask3DFX_names[] = + "i\0" /* Parameter signature */ + "glTbufferMask3DFX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char LoadProgramNV_names[] = + "iiip\0" /* Parameter signature */ + "glLoadProgramNV\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char WaitSync_names[] = + "iii\0" /* Parameter signature */ + "glWaitSync\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4fvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4fvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetAttachedObjectsARB_names[] = + "iipp\0" /* Parameter signature */ + "glGetAttachedObjectsARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform3fvARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform3fv\0" + "glUniform3fvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_draw_range_elements) +static const char DrawRangeElements_names[] = + "iiiiip\0" /* Parameter signature */ + "glDrawRangeElements\0" + "glDrawRangeElementsEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_sprite) +static const char SpriteParameterfvSGIX_names[] = + "ip\0" /* Parameter signature */ + "glSpriteParameterfvSGIX\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char CheckFramebufferStatusEXT_names[] = + "i\0" /* Parameter signature */ + "glCheckFramebufferStatus\0" + "glCheckFramebufferStatusEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactoruiSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactoruiSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetHandleARB_names[] = + "i\0" /* Parameter signature */ + "glGetHandleARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char GetVertexAttribivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribiv\0" + "glGetVertexAttribivARB\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetCombinerInputParameterfvNV_names[] = + "iiiip\0" /* Parameter signature */ + "glGetCombinerInputParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char CreateProgram_names[] = + "\0" /* Parameter signature */ + "glCreateProgram\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) +static const char LoadTransposeMatrixdARB_names[] = + "p\0" /* Parameter signature */ + "glLoadTransposeMatrixd\0" + "glLoadTransposeMatrixdARB\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetMinmax_names[] = + "iiiip\0" /* Parameter signature */ + "glGetMinmax\0" + "glGetMinmaxEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char StencilFuncSeparate_names[] = + "iiii\0" /* Parameter signature */ + "glStencilFuncSeparate\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3sEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3s\0" + "glSecondaryColor3sEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color3fVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glColor3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorbSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactorbSUN\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char ImageTransformParameterfvHP_names[] = + "iip\0" /* Parameter signature */ + "glImageTransformParameterfvHP\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4ivARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4iv\0" + "glVertexAttrib4ivARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3fNV_names[] = + "ifff\0" /* Parameter signature */ + "glVertexAttrib3fNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs2dvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs2dvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_timer_query) +static const char GetQueryObjectui64vEXT_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryObjectui64vEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3fvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord3fv\0" + "glMultiTexCoord3fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3dEXT_names[] = + "ddd\0" /* Parameter signature */ + "glSecondaryColor3d\0" + "glSecondaryColor3dEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetProgramParameterfvNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetProgramParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char TangentPointerEXT_names[] = + "iip\0" /* Parameter signature */ + "glTangentPointerEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4fNormal3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glColor4fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char GetInstrumentsSGIX_names[] = + "\0" /* Parameter signature */ + "glGetInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char EvalMapsNV_names[] = + "ii\0" /* Parameter signature */ + "glEvalMapsNV\0" + ""; +#endif + +#if defined(need_GL_EXT_subtexture) +static const char TexSubImage2D_names[] = + "iiiiiiiip\0" /* Parameter signature */ + "glTexSubImage2D\0" + "glTexSubImage2DEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glFragmentLightivSGIX\0" + ""; +#endif + +#if defined(need_GL_APPLE_texture_range) +static const char GetTexParameterPointervAPPLE_names[] = + "iip\0" /* Parameter signature */ + "glGetTexParameterPointervAPPLE\0" + ""; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const char PixelTransformParameterfvEXT_names[] = + "iip\0" /* Parameter signature */ + "glPixelTransformParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4bvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4bv\0" + "glVertexAttrib4bvARB\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char AlphaFragmentOp2ATI_names[] = + "iiiiiiiii\0" /* Parameter signature */ + "glAlphaFragmentOp2ATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4sARB_names[] = + "iiiii\0" /* Parameter signature */ + "glMultiTexCoord4s\0" + "glMultiTexCoord4sARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char GetFragmentMaterialivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetFragmentMaterialivSGIX\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4dMESA_names[] = + "dddd\0" /* Parameter signature */ + "glWindowPos4dMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightPointerARB_names[] = + "iiip\0" /* Parameter signature */ + "glWeightPointerARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2dMESA_names[] = + "dd\0" /* Parameter signature */ + "glWindowPos2d\0" + "glWindowPos2dARB\0" + "glWindowPos2dMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char FramebufferTexture3DEXT_names[] = + "iiiiii\0" /* Parameter signature */ + "glFramebufferTexture3D\0" + "glFramebufferTexture3DEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_blend_minmax) +static const char BlendEquation_names[] = + "i\0" /* Parameter signature */ + "glBlendEquation\0" + "glBlendEquationEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3dNV_names[] = + "iddd\0" /* Parameter signature */ + "glVertexAttrib3dNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3dARB_names[] = + "iddd\0" /* Parameter signature */ + "glVertexAttrib3d\0" + "glVertexAttrib3dARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names[] = + "ppppp\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4fARB_names[] = + "iffff\0" /* Parameter signature */ + "glVertexAttrib4f\0" + "glVertexAttrib4fARB\0" + ""; +#endif + +#if defined(need_GL_EXT_index_func) +static const char IndexFuncEXT_names[] = + "if\0" /* Parameter signature */ + "glIndexFuncEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char FramebufferTexture2DEXT_names[] = + "iiiii\0" /* Parameter signature */ + "glFramebufferTexture2D\0" + "glFramebufferTexture2DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2dvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord2dv\0" + "glMultiTexCoord2dvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_cull_vertex) +static const char CullParameterfvEXT_names[] = + "ip\0" /* Parameter signature */ + "glCullParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char ProgramNamedParameter4fvNV_names[] = + "iipp\0" /* Parameter signature */ + "glProgramNamedParameter4fvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColorPointerEXT_names[] = + "iiip\0" /* Parameter signature */ + "glSecondaryColorPointer\0" + "glSecondaryColorPointerEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4fvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4fv\0" + "glVertexAttrib4fvARB\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char ColorPointerListIBM_names[] = + "iiipi\0" /* Parameter signature */ + "glColorPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetActiveUniformARB_names[] = + "iiipppp\0" /* Parameter signature */ + "glGetActiveUniform\0" + "glGetActiveUniformARB\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char ImageTransformParameteriHP_names[] = + "iii\0" /* Parameter signature */ + "glImageTransformParameteriHP\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1svARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord1sv\0" + "glMultiTexCoord1svARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char EndQueryARB_names[] = + "i\0" /* Parameter signature */ + "glEndQuery\0" + "glEndQueryARB\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char DeleteFencesNV_names[] = + "ip\0" /* Parameter signature */ + "glDeleteFencesNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const char DeformationMap3dSGIX_names[] = + "iddiiddiiddiip\0" /* Parameter signature */ + "glDeformationMap3dSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char IsShader_names[] = + "i\0" /* Parameter signature */ + "glIsShader\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char GetImageTransformParameterivHP_names[] = + "iip\0" /* Parameter signature */ + "glGetImageTransformParameterivHP\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4ivMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos4ivMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3svARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord3sv\0" + "glMultiTexCoord3svARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4iARB_names[] = + "iiiii\0" /* Parameter signature */ + "glMultiTexCoord4i\0" + "glMultiTexCoord4iARB\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3ivEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3ivEXT\0" + ""; +#endif + +#if defined(need_GL_MESA_resize_buffers) +static const char ResizeBuffersMESA_names[] = + "\0" /* Parameter signature */ + "glResizeBuffersMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetUniformivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetUniformiv\0" + "glGetUniformivARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char PixelTexGenParameteriSGIS_names[] = + "ii\0" /* Parameter signature */ + "glPixelTexGenParameteriSGIS\0" + ""; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const char VertexPointervINTEL_names[] = + "iip\0" /* Parameter signature */ + "glVertexPointervINTEL\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names[] = + "pppp\0" /* Parameter signature */ + "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3uiEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3ui\0" + "glSecondaryColor3uiEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char StartInstrumentsSGIX_names[] = + "\0" /* Parameter signature */ + "glStartInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3usvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3usv\0" + "glSecondaryColor3usvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2fvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2fvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramLocalParameter4dvARB_names[] = + "iip\0" /* Parameter signature */ + "glProgramLocalParameter4dvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char MatrixIndexuivARB_names[] = + "ip\0" /* Parameter signature */ + "glMatrixIndexuivARB\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) +static const char RenderbufferStorageMultisample_names[] = + "iiiii\0" /* Parameter signature */ + "glRenderbufferStorageMultisample\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3sEXT_names[] = + "iii\0" /* Parameter signature */ + "glTangent3sEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorfSUN_names[] = + "f\0" /* Parameter signature */ + "glGlobalAlphaFactorfSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3iARB_names[] = + "iiii\0" /* Parameter signature */ + "glMultiTexCoord3i\0" + "glMultiTexCoord3iARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char IsProgram_names[] = + "i\0" /* Parameter signature */ + "glIsProgram\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char TexCoordPointerListIBM_names[] = + "iiipi\0" /* Parameter signature */ + "glTexCoordPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorusSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactorusSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2dvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2dvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char FramebufferRenderbufferEXT_names[] = + "iiii\0" /* Parameter signature */ + "glFramebufferRenderbuffer\0" + "glFramebufferRenderbufferEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1dvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1dvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char GenTextures_names[] = + "ip\0" /* Parameter signature */ + "glGenTextures\0" + "glGenTexturesEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char SetFenceNV_names[] = + "ii\0" /* Parameter signature */ + "glSetFenceNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char FramebufferTexture1DEXT_names[] = + "iiiii\0" /* Parameter signature */ + "glFramebufferTexture1D\0" + "glFramebufferTexture1DEXT\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetCombinerOutputParameterivNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetCombinerOutputParameterivNV\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char PixelTexGenParameterivSGIS_names[] = + "ip\0" /* Parameter signature */ + "glPixelTexGenParameterivSGIS\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_perturb_normal) +static const char TextureNormalEXT_names[] = + "i\0" /* Parameter signature */ + "glTextureNormalEXT\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char IndexPointerListIBM_names[] = + "iipi\0" /* Parameter signature */ + "glIndexPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightfvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightfvARB\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4fMESA_names[] = + "ffff\0" /* Parameter signature */ + "glWindowPos4fMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3dvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos3dv\0" + "glWindowPos3dvARB\0" + "glWindowPos3dvMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_timer_query) +static const char GetQueryObjecti64vEXT_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryObjecti64vEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1dARB_names[] = + "id\0" /* Parameter signature */ + "glMultiTexCoord1d\0" + "glMultiTexCoord1dARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite) +static const char PointParameterivNV_names[] = + "ip\0" /* Parameter signature */ + "glPointParameteriv\0" + "glPointParameterivNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform2fvARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform2fv\0" + "glUniform2fvARB\0" + ""; +#endif + +#if defined(need_GL_APPLE_flush_buffer_range) +static const char BufferParameteriAPPLE_names[] = + "iii\0" /* Parameter signature */ + "glBufferParameteriAPPLE\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3dvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord3dv\0" + "glMultiTexCoord3dvARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names[] = + "pppp\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char DeleteObjectARB_names[] = + "i\0" /* Parameter signature */ + "glDeleteObjectARB\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char MatrixIndexPointerARB_names[] = + "iiip\0" /* Parameter signature */ + "glMatrixIndexPointerARB\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char ProgramNamedParameter4dvNV_names[] = + "iipp\0" /* Parameter signature */ + "glProgramNamedParameter4dvNV\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3fvEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3fvEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_array_object) +static const char GenVertexArrays_names[] = + "ip\0" /* Parameter signature */ + "glGenVertexArrays\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char BindFramebufferEXT_names[] = + "ii\0" /* Parameter signature */ + "glBindFramebuffer\0" + "glBindFramebufferEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_reference_plane) +static const char ReferencePlaneSGIX_names[] = + "p\0" /* Parameter signature */ + "glReferencePlaneSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char ValidateProgramARB_names[] = + "i\0" /* Parameter signature */ + "glValidateProgram\0" + "glValidateProgramARB\0" + ""; +#endif + +#if defined(need_GL_EXT_compiled_vertex_array) +static const char UnlockArraysEXT_names[] = + "\0" /* Parameter signature */ + "glUnlockArraysEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor3fVertex3fSUN_names[] = + "ffffffff\0" /* Parameter signature */ + "glTexCoord2fColor3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3fvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos3fv\0" + "glWindowPos3fvARB\0" + "glWindowPos3fvMESA\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1svNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1svNV\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexSubImage3D_names[] = + "iiiiiiiii\0" /* Parameter signature */ + "glCopyTexSubImage3D\0" + "glCopyTexSubImage3DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2dARB_names[] = + "idd\0" /* Parameter signature */ + "glVertexAttrib2d\0" + "glVertexAttrib2dARB\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char GetInteger64v_names[] = + "ip\0" /* Parameter signature */ + "glGetInteger64v\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture_color_mask) +static const char TextureColorMaskSGIS_names[] = + "iiii\0" /* Parameter signature */ + "glTextureColorMaskSGIS\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) +static const char GetColorTable_names[] = + "iiip\0" /* Parameter signature */ + "glGetColorTable\0" + "glGetColorTableSGI\0" + "glGetColorTableEXT\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) +static const char CopyColorTable_names[] = + "iiiii\0" /* Parameter signature */ + "glCopyColorTable\0" + "glCopyColorTableSGI\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetHistogramParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glGetHistogramParameterfv\0" + "glGetHistogramParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const char ColorPointervINTEL_names[] = + "iip\0" /* Parameter signature */ + "glColorPointervINTEL\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char AlphaFragmentOp1ATI_names[] = + "iiiiii\0" /* Parameter signature */ + "glAlphaFragmentOp1ATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3ivARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord3iv\0" + "glMultiTexCoord3ivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2sARB_names[] = + "iii\0" /* Parameter signature */ + "glMultiTexCoord2s\0" + "glMultiTexCoord2sARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1dvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1dv\0" + "glVertexAttrib1dvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char DeleteTextures_names[] = + "ip\0" /* Parameter signature */ + "glDeleteTextures\0" + "glDeleteTexturesEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char TexCoordPointerEXT_names[] = + "iiiip\0" /* Parameter signature */ + "glTexCoordPointerEXT\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture4D) +static const char TexSubImage4DSGIS_names[] = + "iiiiiiiiiiiip\0" /* Parameter signature */ + "glTexSubImage4DSGIS\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners2) +static const char CombinerStageParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glCombinerStageParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char StopInstrumentsSGIX_names[] = + "i\0" /* Parameter signature */ + "glStopInstrumentsSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord4fColor4fNormal3fVertex4fSUN_names[] = + "fffffffffffffff\0" /* Parameter signature */ + "glTexCoord4fColor4fNormal3fVertex4fSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const char DeformSGIX_names[] = + "i\0" /* Parameter signature */ + "glDeformSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char GetVertexAttribfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribfv\0" + "glGetVertexAttribfvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3ivEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3iv\0" + "glSecondaryColor3ivEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix4x2fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix4x2fv\0" + ""; +#endif + +#if defined(need_GL_SGIS_detail_texture) +static const char GetDetailTexFuncSGIS_names[] = + "ip\0" /* Parameter signature */ + "glGetDetailTexFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners2) +static const char GetCombinerStageParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetCombinerStageParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_array_object) +static const char BindVertexArray_names[] = + "i\0" /* Parameter signature */ + "glBindVertexArray\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4ubVertex2fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glColor4ubVertex2fvSUN\0" + ""; +#endif + +#if defined(need_GL_SGIS_texture_filter4) +static const char TexFilterFuncSGIS_names[] = + "iiip\0" /* Parameter signature */ + "glTexFilterFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample) +static const char SampleMaskSGIS_names[] = + "fi\0" /* Parameter signature */ + "glSampleMaskSGIS\0" + "glSampleMaskEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader) +static const char GetAttribLocationARB_names[] = + "ip\0" /* Parameter signature */ + "glGetAttribLocation\0" + "glGetAttribLocationARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4ubvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4ubv\0" + "glVertexAttrib4ubvARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_detail_texture) +static const char DetailTexFuncSGIS_names[] = + "iip\0" /* Parameter signature */ + "glDetailTexFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Normal3fVertex3fSUN_names[] = + "ffffff\0" /* Parameter signature */ + "glNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexImage2D_names[] = + "iiiiiiii\0" /* Parameter signature */ + "glCopyTexImage2D\0" + "glCopyTexImage2DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char GetBufferPointervARB_names[] = + "iip\0" /* Parameter signature */ + "glGetBufferPointerv\0" + "glGetBufferPointervARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char ProgramEnvParameter4fARB_names[] = + "iiffff\0" /* Parameter signature */ + "glProgramEnvParameter4fARB\0" + "glProgramParameter4fNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform3ivARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform3iv\0" + "glUniform3ivARB\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char GetFenceivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetFenceivNV\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4dvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos4dvMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_color_subtable) +static const char ColorSubTable_names[] = + "iiiiip\0" /* Parameter signature */ + "glColorSubTable\0" + "glColorSubTableEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4ivARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord4iv\0" + "glMultiTexCoord4ivARB\0" + ""; +#endif + +#if defined(need_GL_EXT_gpu_program_parameters) +static const char ProgramLocalParameters4fvEXT_names[] = + "iiip\0" /* Parameter signature */ + "glProgramLocalParameters4fvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapAttribParameterfvNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetMapAttribParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4sARB_names[] = + "iiiii\0" /* Parameter signature */ + "glVertexAttrib4s\0" + "glVertexAttrib4sARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char GetQueryObjectuivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetQueryObjectuiv\0" + "glGetQueryObjectuivARB\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char MapParameterivNV_names[] = + "iip\0" /* Parameter signature */ + "glMapParameterivNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GenRenderbuffersEXT_names[] = + "ip\0" /* Parameter signature */ + "glGenRenderbuffers\0" + "glGenRenderbuffersEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2dvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2dv\0" + "glVertexAttrib2dvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char EdgeFlagPointerEXT_names[] = + "iip\0" /* Parameter signature */ + "glEdgeFlagPointerEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs2svNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs2svNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightbvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightbvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2fvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2fv\0" + "glVertexAttrib2fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char GetBufferParameterivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetBufferParameteriv\0" + "glGetBufferParameterivARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char ListParameteriSGIX_names[] = + "iii\0" /* Parameter signature */ + "glListParameteriSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor4fNormal3fVertex3fSUN_names[] = + "iffffffffff\0" /* Parameter signature */ + "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_instruments) +static const char InstrumentsBufferSGIX_names[] = + "ip\0" /* Parameter signature */ + "glInstrumentsBufferSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NivARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Niv\0" + "glVertexAttrib4NivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetAttachedShaders_names[] = + "iipp\0" /* Parameter signature */ + "glGetAttachedShaders\0" + ""; +#endif + +#if defined(need_GL_APPLE_vertex_array_object) +static const char GenVertexArraysAPPLE_names[] = + "ip\0" /* Parameter signature */ + "glGenVertexArraysAPPLE\0" + ""; +#endif + +#if defined(need_GL_EXT_gpu_program_parameters) +static const char ProgramEnvParameters4fvEXT_names[] = + "iiip\0" /* Parameter signature */ + "glProgramEnvParameters4fvEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor4fNormal3fVertex3fvSUN_names[] = + "pppp\0" /* Parameter signature */ + "glTexCoord2fColor4fNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2iMESA_names[] = + "ii\0" /* Parameter signature */ + "glWindowPos2i\0" + "glWindowPos2iARB\0" + "glWindowPos2iMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3fvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3fv\0" + "glSecondaryColor3fvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexSubImage1DARB_names[] = + "iiiiiip\0" /* Parameter signature */ + "glCompressedTexSubImage1D\0" + "glCompressedTexSubImage1DARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetVertexAttribivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribivNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramStringARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramStringARB\0" + ""; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const char TexBumpParameterfvATI_names[] = + "ip\0" /* Parameter signature */ + "glTexBumpParameterfvATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char CompileShaderARB_names[] = + "i\0" /* Parameter signature */ + "glCompileShader\0" + "glCompileShaderARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char DeleteShader_names[] = + "i\0" /* Parameter signature */ + "glDeleteShader\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform3fARB_names[] = + "ifff\0" /* Parameter signature */ + "glUniform3f\0" + "glUniform3fARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char ListParameterfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glListParameterfvSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3dvEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3dvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetVertexAttribfvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribfvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3sMESA_names[] = + "iii\0" /* Parameter signature */ + "glWindowPos3s\0" + "glWindowPos3sARB\0" + "glWindowPos3sMESA\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2svNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2svNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs1fvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs1fvNV\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glTexCoord2fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4sMESA_names[] = + "iiii\0" /* Parameter signature */ + "glWindowPos4sMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NuivARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nuiv\0" + "glVertexAttrib4NuivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char ClientActiveTextureARB_names[] = + "i\0" /* Parameter signature */ + "glClientActiveTexture\0" + "glClientActiveTextureARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_pixel_texture) +static const char PixelTexGenSGIX_names[] = + "i\0" /* Parameter signature */ + "glPixelTexGenSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeusvSUN_names[] = + "p\0" /* Parameter signature */ + "glReplacementCodeusvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform4fARB_names[] = + "iffff\0" /* Parameter signature */ + "glUniform4f\0" + "glUniform4fARB\0" + ""; +#endif + +#if defined(need_GL_ARB_map_buffer_range) +static const char FlushMappedBufferRange_names[] = + "iii\0" /* Parameter signature */ + "glFlushMappedBufferRange\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char IsProgramNV_names[] = + "i\0" /* Parameter signature */ + "glIsProgramARB\0" + "glIsProgramNV\0" + ""; +#endif + +#if defined(need_GL_APPLE_flush_buffer_range) +static const char FlushMappedBufferRangeAPPLE_names[] = + "iii\0" /* Parameter signature */ + "glFlushMappedBufferRangeAPPLE\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodePointerSUN_names[] = + "iip\0" /* Parameter signature */ + "glReplacementCodePointerSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char ProgramEnvParameter4dARB_names[] = + "iidddd\0" /* Parameter signature */ + "glProgramEnvParameter4dARB\0" + "glProgramParameter4dNV\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) +static const char ColorTableParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glColorTableParameterfv\0" + "glColorTableParameterfvSGI\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightModelfSGIX_names[] = + "if\0" /* Parameter signature */ + "glFragmentLightModelfSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3bvEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3bvEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char IsTexture_names[] = + "i\0" /* Parameter signature */ + "glIsTexture\0" + "glIsTextureEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_weighting) +static const char VertexWeightfvEXT_names[] = + "p\0" /* Parameter signature */ + "glVertexWeightfvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1dARB_names[] = + "id\0" /* Parameter signature */ + "glVertexAttrib1d\0" + "glVertexAttrib1dARB\0" + ""; +#endif + +#if defined(need_GL_HP_image_transform) +static const char ImageTransformParameterivHP_names[] = + "iip\0" /* Parameter signature */ + "glImageTransformParameterivHP\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char DeleteQueriesARB_names[] = + "ip\0" /* Parameter signature */ + "glDeleteQueries\0" + "glDeleteQueriesARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4ubVertex2fSUN_names[] = + "iiiiff\0" /* Parameter signature */ + "glColor4ubVertex2fSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentColorMaterialSGIX_names[] = + "ii\0" /* Parameter signature */ + "glFragmentColorMaterialSGIX\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char CurrentPaletteMatrixARB_names[] = + "i\0" /* Parameter signature */ + "glCurrentPaletteMatrixARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample) +static const char SamplePatternSGIS_names[] = + "i\0" /* Parameter signature */ + "glSamplePatternSGIS\0" + "glSamplePatternEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char IsQueryARB_names[] = + "i\0" /* Parameter signature */ + "glIsQuery\0" + "glIsQueryARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor4ubVertex3fSUN_names[] = + "iiiiifff\0" /* Parameter signature */ + "glReplacementCodeuiColor4ubVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4usvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4usv\0" + "glVertexAttrib4usvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char LinkProgramARB_names[] = + "i\0" /* Parameter signature */ + "glLinkProgram\0" + "glLinkProgramARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib2fNV_names[] = + "iff\0" /* Parameter signature */ + "glVertexAttrib2fNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char ShaderSourceARB_names[] = + "iipp\0" /* Parameter signature */ + "glShaderSource\0" + "glShaderSourceARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentMaterialiSGIX_names[] = + "iii\0" /* Parameter signature */ + "glFragmentMaterialiSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3svARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3sv\0" + "glVertexAttrib3svARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexSubImage3DARB_names[] = + "iiiiiiiiiip\0" /* Parameter signature */ + "glCompressedTexSubImage3D\0" + "glCompressedTexSubImage3DARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2ivMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos2iv\0" + "glWindowPos2ivARB\0" + "glWindowPos2ivMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char IsFramebufferEXT_names[] = + "i\0" /* Parameter signature */ + "glIsFramebuffer\0" + "glIsFramebufferEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform4ivARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform4iv\0" + "glUniform4ivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char GetVertexAttribdvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribdv\0" + "glGetVertexAttribdvARB\0" + ""; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const char TexBumpParameterivATI_names[] = + "ip\0" /* Parameter signature */ + "glTexBumpParameterivATI\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char GetSeparableFilter_names[] = + "iiippp\0" /* Parameter signature */ + "glGetSeparableFilter\0" + "glGetSeparableFilterEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3dEXT_names[] = + "ddd\0" /* Parameter signature */ + "glBinormal3dEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_sprite) +static const char SpriteParameteriSGIX_names[] = + "ii\0" /* Parameter signature */ + "glSpriteParameteriSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char RequestResidentProgramsNV_names[] = + "ip\0" /* Parameter signature */ + "glRequestResidentProgramsNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_tag_sample_buffer) +static const char TagSampleBufferSGIX_names[] = + "\0" /* Parameter signature */ + "glTagSampleBufferSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeusSUN_names[] = + "i\0" /* Parameter signature */ + "glReplacementCodeusSUN\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char ListParameterivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glListParameterivSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays) +static const char MultiDrawElementsEXT_names[] = + "ipipi\0" /* Parameter signature */ + "glMultiDrawElements\0" + "glMultiDrawElementsEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform1ivARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform1iv\0" + "glUniform1ivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2sMESA_names[] = + "ii\0" /* Parameter signature */ + "glWindowPos2s\0" + "glWindowPos2sARB\0" + "glWindowPos2sMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightusvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightusvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoordPointerEXT_names[] = + "iip\0" /* Parameter signature */ + "glFogCoordPointer\0" + "glFogCoordPointerEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_index_material) +static const char IndexMaterialEXT_names[] = + "ii\0" /* Parameter signature */ + "glIndexMaterialEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3ubvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3ubv\0" + "glSecondaryColor3ubvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4dvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4dv\0" + "glVertexAttrib4dvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader) +static const char BindAttribLocationARB_names[] = + "iip\0" /* Parameter signature */ + "glBindAttribLocation\0" + "glBindAttribLocationARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2dARB_names[] = + "idd\0" /* Parameter signature */ + "glMultiTexCoord2d\0" + "glMultiTexCoord2dARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char ExecuteProgramNV_names[] = + "iip\0" /* Parameter signature */ + "glExecuteProgramNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char LightEnviSGIX_names[] = + "ii\0" /* Parameter signature */ + "glLightEnviSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeuiSUN_names[] = + "i\0" /* Parameter signature */ + "glReplacementCodeuiSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribPointerNV_names[] = + "iiiip\0" /* Parameter signature */ + "glVertexAttribPointerNV\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GetFramebufferAttachmentParameterivEXT_names[] = + "iiip\0" /* Parameter signature */ + "glGetFramebufferAttachmentParameteriv\0" + "glGetFramebufferAttachmentParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const char PixelTransformParameterfEXT_names[] = + "iif\0" /* Parameter signature */ + "glPixelTransformParameterfEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4dvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord4dv\0" + "glMultiTexCoord4dvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const char PixelTransformParameteriEXT_names[] = + "iii\0" /* Parameter signature */ + "glPixelTransformParameteriEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor4ubVertex3fSUN_names[] = + "ffiiiifff\0" /* Parameter signature */ + "glTexCoord2fColor4ubVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform1iARB_names[] = + "ii\0" /* Parameter signature */ + "glUniform1i\0" + "glUniform1iARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttribPointerARB_names[] = + "iiiiip\0" /* Parameter signature */ + "glVertexAttribPointer\0" + "glVertexAttribPointerARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_sharpen_texture) +static const char SharpenTexFuncSGIS_names[] = + "iip\0" /* Parameter signature */ + "glSharpenTexFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4fvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord4fv\0" + "glMultiTexCoord4fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix2x3fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix2x3fv\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char TrackMatrixNV_names[] = + "iiii\0" /* Parameter signature */ + "glTrackMatrixNV\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerParameteriNV_names[] = + "ii\0" /* Parameter signature */ + "glCombinerParameteriNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char DeleteAsyncMarkersSGIX_names[] = + "ii\0" /* Parameter signature */ + "glDeleteAsyncMarkersSGIX\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char IsAsyncMarkerSGIX_names[] = + "i\0" /* Parameter signature */ + "glIsAsyncMarkerSGIX\0" + ""; +#endif + +#if defined(need_GL_SGIX_framezoom) +static const char FrameZoomSGIX_names[] = + "i\0" /* Parameter signature */ + "glFrameZoomSGIX\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Normal3fVertex3fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NsvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nsv\0" + "glVertexAttrib4NsvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3fvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3fv\0" + "glVertexAttrib3fvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char GetSynciv_names[] = + "iiipp\0" /* Parameter signature */ + "glGetSynciv\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char DeleteFramebuffersEXT_names[] = + "ip\0" /* Parameter signature */ + "glDeleteFramebuffers\0" + "glDeleteFramebuffersEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const char GlobalAlphaFactorsSUN_names[] = + "i\0" /* Parameter signature */ + "glGlobalAlphaFactorsSUN\0" + ""; +#endif + +#if defined(need_GL_EXT_texture3D) +static const char TexSubImage3D_names[] = + "iiiiiiiiiip\0" /* Parameter signature */ + "glTexSubImage3D\0" + "glTexSubImage3DEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3fEXT_names[] = + "fff\0" /* Parameter signature */ + "glTangent3fEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3uivEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3uiv\0" + "glSecondaryColor3uivEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const char MatrixIndexubvARB_names[] = + "ip\0" /* Parameter signature */ + "glMatrixIndexubvARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char Color4fNormal3fVertex3fSUN_names[] = + "ffffffffff\0" /* Parameter signature */ + "glColor4fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char PixelTexGenParameterfSGIS_names[] = + "if\0" /* Parameter signature */ + "glPixelTexGenParameterfSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char CreateShader_names[] = + "i\0" /* Parameter signature */ + "glCreateShader\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) +static const char GetColorTableParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glGetColorTableParameterfv\0" + "glGetColorTableParameterfvSGI\0" + "glGetColorTableParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightModelfvSGIX_names[] = + "ip\0" /* Parameter signature */ + "glFragmentLightModelfvSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord3fARB_names[] = + "ifff\0" /* Parameter signature */ + "glMultiTexCoord3f\0" + "glMultiTexCoord3fARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const char GetPixelTexGenParameterfvSGIS_names[] = + "ip\0" /* Parameter signature */ + "glGetPixelTexGenParameterfvSGIS\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GenFramebuffersEXT_names[] = + "ip\0" /* Parameter signature */ + "glGenFramebuffers\0" + "glGenFramebuffersEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetProgramParameterdvNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetProgramParameterdvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object) +static const char IsVertexArrayAPPLE_names[] = + "i\0" /* Parameter signature */ + "glIsVertexArray\0" + "glIsVertexArrayAPPLE\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glFragmentLightfvSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char DetachShader_names[] = + "ii\0" /* Parameter signature */ + "glDetachShader\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NubARB_names[] = + "iiiii\0" /* Parameter signature */ + "glVertexAttrib4Nub\0" + "glVertexAttrib4NubARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramEnvParameterfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramEnvParameterfvARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetTrackMatrixivNV_names[] = + "iiip\0" /* Parameter signature */ + "glGetTrackMatrixivNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3svNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3svNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform4fvARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform4fv\0" + "glUniform4fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) +static const char MultTransposeMatrixfARB_names[] = + "p\0" /* Parameter signature */ + "glMultTransposeMatrixf\0" + "glMultTransposeMatrixfARB\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char ColorFragmentOp1ATI_names[] = + "iiiiiii\0" /* Parameter signature */ + "glColorFragmentOp1ATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetUniformfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetUniformfv\0" + "glGetUniformfvARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names[] = + "iffffffffffff\0" /* Parameter signature */ + "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char DetachObjectARB_names[] = + "ii\0" /* Parameter signature */ + "glDetachObjectARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char VertexBlendARB_names[] = + "i\0" /* Parameter signature */ + "glVertexBlendARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3iMESA_names[] = + "iii\0" /* Parameter signature */ + "glWindowPos3i\0" + "glWindowPos3iARB\0" + "glWindowPos3iMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char SeparableFilter2D_names[] = + "iiiiiipp\0" /* Parameter signature */ + "glSeparableFilter2D\0" + "glSeparableFilter2DEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor4ubVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glReplacementCodeuiColor4ubVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char CompressedTexImage2DARB_names[] = + "iiiiiiip\0" /* Parameter signature */ + "glCompressedTexImage2D\0" + "glCompressedTexImage2DARB\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char ArrayElement_names[] = + "i\0" /* Parameter signature */ + "glArrayElement\0" + "glArrayElementEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_depth_bounds_test) +static const char DepthBoundsEXT_names[] = + "dd\0" /* Parameter signature */ + "glDepthBoundsEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char ProgramParameters4fvNV_names[] = + "iiip\0" /* Parameter signature */ + "glProgramParameters4fvNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const char DeformationMap3fSGIX_names[] = + "iffiiffiiffiip\0" /* Parameter signature */ + "glDeformationMap3fSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetProgramivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramivNV\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetMinmaxParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glGetMinmaxParameteriv\0" + "glGetMinmaxParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexImage1D_names[] = + "iiiiiii\0" /* Parameter signature */ + "glCopyTexImage1D\0" + "glCopyTexImage1DEXT\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char AlphaFragmentOp3ATI_names[] = + "iiiiiiiiiiii\0" /* Parameter signature */ + "glAlphaFragmentOp3ATI\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetVertexAttribdvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribdvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3fvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3fvNV\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetFinalCombinerInputParameterivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetFinalCombinerInputParameterivNV\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapParameterivNV_names[] = + "iip\0" /* Parameter signature */ + "glGetMapParameterivNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform4iARB_names[] = + "iiiii\0" /* Parameter signature */ + "glUniform4i\0" + "glUniform4iARB\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionParameteri_names[] = + "iii\0" /* Parameter signature */ + "glConvolutionParameteri\0" + "glConvolutionParameteriEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3sEXT_names[] = + "iii\0" /* Parameter signature */ + "glBinormal3sEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char ConvolutionParameterf_names[] = + "iif\0" /* Parameter signature */ + "glConvolutionParameterf\0" + "glConvolutionParameterfEXT\0" + ""; +#endif + +#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) +static const char GetColorTableParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glGetColorTableParameteriv\0" + "glGetColorTableParameterivSGI\0" + "glGetColorTableParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char ProgramEnvParameter4dvARB_names[] = + "iip\0" /* Parameter signature */ + "glProgramEnvParameter4dvARB\0" + "glProgramParameter4dvNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs2fvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs2fvNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char UseProgramObjectARB_names[] = + "i\0" /* Parameter signature */ + "glUseProgram\0" + "glUseProgramObjectARB\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetMapParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char PassTexCoordATI_names[] = + "iii\0" /* Parameter signature */ + "glPassTexCoordATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char DeleteProgram_names[] = + "i\0" /* Parameter signature */ + "glDeleteProgram\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3ivEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3ivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3dEXT_names[] = + "ddd\0" /* Parameter signature */ + "glTangent3dEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3dvEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3dv\0" + "glSecondaryColor3dvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays) +static const char MultiDrawArraysEXT_names[] = + "ippi\0" /* Parameter signature */ + "glMultiDrawArrays\0" + "glMultiDrawArraysEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char BindRenderbufferEXT_names[] = + "ii\0" /* Parameter signature */ + "glBindRenderbuffer\0" + "glBindRenderbufferEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4dARB_names[] = + "idddd\0" /* Parameter signature */ + "glMultiTexCoord4d\0" + "glMultiTexCoord4dARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3usEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3us\0" + "glSecondaryColor3usEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramLocalParameter4fvARB_names[] = + "iip\0" /* Parameter signature */ + "glProgramLocalParameter4fvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char DeleteProgramsNV_names[] = + "ip\0" /* Parameter signature */ + "glDeleteProgramsARB\0" + "glDeleteProgramsNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1sARB_names[] = + "ii\0" /* Parameter signature */ + "glMultiTexCoord1s\0" + "glMultiTexCoord1sARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiColor3fVertex3fSUN_names[] = + "iffffff\0" /* Parameter signature */ + "glReplacementCodeuiColor3fVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char GetVertexAttribPointervNV_names[] = + "iip\0" /* Parameter signature */ + "glGetVertexAttribPointerv\0" + "glGetVertexAttribPointervARB\0" + "glGetVertexAttribPointervNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1dvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord1dv\0" + "glMultiTexCoord1dvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform2iARB_names[] = + "iii\0" /* Parameter signature */ + "glUniform2i\0" + "glUniform2iARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char GetProgramStringNV_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramStringNV\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char ColorPointerEXT_names[] = + "iiiip\0" /* Parameter signature */ + "glColorPointerEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char MapBufferARB_names[] = + "ii\0" /* Parameter signature */ + "glMapBuffer\0" + "glMapBufferARB\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3svEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3svEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_light_texture) +static const char ApplyTextureEXT_names[] = + "i\0" /* Parameter signature */ + "glApplyTextureEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_light_texture) +static const char TextureMaterialEXT_names[] = + "ii\0" /* Parameter signature */ + "glTextureMaterialEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_light_texture) +static const char TextureLightEXT_names[] = + "i\0" /* Parameter signature */ + "glTextureLightEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char ResetMinmax_names[] = + "i\0" /* Parameter signature */ + "glResetMinmax\0" + "glResetMinmaxEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_sprite) +static const char SpriteParameterfSGIX_names[] = + "if\0" /* Parameter signature */ + "glSpriteParameterfSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4sNV_names[] = + "iiiii\0" /* Parameter signature */ + "glVertexAttrib4sNV\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char GetConvolutionParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glGetConvolutionParameterfv\0" + "glGetConvolutionParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs4dvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs4dvNV\0" + ""; +#endif + +#if defined(need_GL_IBM_multimode_draw_arrays) +static const char MultiModeDrawArraysIBM_names[] = + "pppii\0" /* Parameter signature */ + "glMultiModeDrawArraysIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4dARB_names[] = + "idddd\0" /* Parameter signature */ + "glVertexAttrib4d\0" + "glVertexAttrib4dARB\0" + ""; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const char GetTexBumpParameterfvATI_names[] = + "ip\0" /* Parameter signature */ + "glGetTexBumpParameterfvATI\0" + ""; +#endif + +#if defined(need_GL_NV_fragment_program) +static const char ProgramNamedParameter4dNV_names[] = + "iipdddd\0" /* Parameter signature */ + "glProgramNamedParameter4dNV\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_weighting) +static const char VertexWeightfEXT_names[] = + "f\0" /* Parameter signature */ + "glVertexWeightfEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3fEXT_names[] = + "fff\0" /* Parameter signature */ + "glBinormal3fEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoordfvEXT_names[] = + "p\0" /* Parameter signature */ + "glFogCoordfv\0" + "glFogCoordfvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1ivARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord1iv\0" + "glMultiTexCoord1ivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3ubEXT_names[] = + "iii\0" /* Parameter signature */ + "glSecondaryColor3ub\0" + "glSecondaryColor3ubEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2ivARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord2iv\0" + "glMultiTexCoord2ivARB\0" + ""; +#endif + +#if defined(need_GL_SGIS_fog_function) +static const char FogFuncSGIS_names[] = + "ip\0" /* Parameter signature */ + "glFogFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexSubImage2D_names[] = + "iiiiiiii\0" /* Parameter signature */ + "glCopyTexSubImage2D\0" + "glCopyTexSubImage2DEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetObjectParameterivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetObjectParameterivARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord4fVertex4fSUN_names[] = + "ffffffff\0" /* Parameter signature */ + "glTexCoord4fVertex4fSUN\0" + ""; +#endif + +#if defined(need_GL_APPLE_vertex_array_object) +static const char BindVertexArrayAPPLE_names[] = + "i\0" /* Parameter signature */ + "glBindVertexArrayAPPLE\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramLocalParameterdvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramLocalParameterdvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetHistogramParameteriv_names[] = + "iip\0" /* Parameter signature */ + "glGetHistogramParameteriv\0" + "glGetHistogramParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1iARB_names[] = + "ii\0" /* Parameter signature */ + "glMultiTexCoord1i\0" + "glMultiTexCoord1iARB\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char GetConvolutionFilter_names[] = + "iiip\0" /* Parameter signature */ + "glGetConvolutionFilter\0" + "glGetConvolutionFilterEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramivARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_blend_func_separate) || defined(need_GL_INGR_blend_func_separate) +static const char BlendFuncSeparateEXT_names[] = + "iiii\0" /* Parameter signature */ + "glBlendFuncSeparate\0" + "glBlendFuncSeparateEXT\0" + "glBlendFuncSeparateINGR\0" + ""; +#endif + +#if defined(need_GL_ARB_map_buffer_range) +static const char MapBufferRange_names[] = + "iiii\0" /* Parameter signature */ + "glMapBufferRange\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char ProgramParameters4dvNV_names[] = + "iiip\0" /* Parameter signature */ + "glProgramParameters4dvNV\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord2fColor3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glTexCoord2fColor3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3dvEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3dvEXT\0" + ""; +#endif + +#if defined(need_GL_NV_fence) +static const char FinishFenceNV_names[] = + "i\0" /* Parameter signature */ + "glFinishFenceNV\0" + ""; +#endif + +#if defined(need_GL_SGIS_fog_function) +static const char GetFogFuncSGIS_names[] = + "p\0" /* Parameter signature */ + "glGetFogFuncSGIS\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetUniformLocationARB_names[] = + "ip\0" /* Parameter signature */ + "glGetUniformLocation\0" + "glGetUniformLocationARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3fEXT_names[] = + "fff\0" /* Parameter signature */ + "glSecondaryColor3f\0" + "glSecondaryColor3fEXT\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerInputNV_names[] = + "iiiiii\0" /* Parameter signature */ + "glCombinerInputNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib3sARB_names[] = + "iiii\0" /* Parameter signature */ + "glVertexAttrib3s\0" + "glVertexAttrib3sARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiNormal3fVertex3fvSUN_names[] = + "ppp\0" /* Parameter signature */ + "glReplacementCodeuiNormal3fVertex3fvSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramStringARB_names[] = + "iiip\0" /* Parameter signature */ + "glProgramStringARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char TexCoord4fVertex4fvSUN_names[] = + "pp\0" /* Parameter signature */ + "glTexCoord4fVertex4fvSUN\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3sNV_names[] = + "iiii\0" /* Parameter signature */ + "glVertexAttrib3sNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1fNV_names[] = + "if\0" /* Parameter signature */ + "glVertexAttrib1fNV\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentLightfSGIX_names[] = + "iif\0" /* Parameter signature */ + "glFragmentLightfSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) +static const char GetCompressedTexImageARB_names[] = + "iip\0" /* Parameter signature */ + "glGetCompressedTexImage\0" + "glGetCompressedTexImageARB\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_weighting) +static const char VertexWeightPointerEXT_names[] = + "iiip\0" /* Parameter signature */ + "glVertexWeightPointerEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetHistogram_names[] = + "iiiip\0" /* Parameter signature */ + "glGetHistogram\0" + "glGetHistogramEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_stencil_two_side) +static const char ActiveStencilFaceEXT_names[] = + "i\0" /* Parameter signature */ + "glActiveStencilFaceEXT\0" + ""; +#endif + +#if defined(need_GL_ATI_separate_stencil) +static const char StencilFuncSeparateATI_names[] = + "iiii\0" /* Parameter signature */ + "glStencilFuncSeparateATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char GetShaderSourceARB_names[] = + "iipp\0" /* Parameter signature */ + "glGetShaderSource\0" + "glGetShaderSourceARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_igloo_interface) +static const char IglooInterfaceSGIX_names[] = + "ip\0" /* Parameter signature */ + "glIglooInterfaceSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4dNV_names[] = + "idddd\0" /* Parameter signature */ + "glVertexAttrib4dNV\0" + ""; +#endif + +#if defined(need_GL_IBM_multimode_draw_arrays) +static const char MultiModeDrawElementsIBM_names[] = + "ppipii\0" /* Parameter signature */ + "glMultiModeDrawElementsIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4svARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord4sv\0" + "glMultiTexCoord4svARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) +static const char GenQueriesARB_names[] = + "ip\0" /* Parameter signature */ + "glGenQueries\0" + "glGenQueriesARB\0" + ""; +#endif + +#if defined(need_GL_SUN_vertex) +static const char ReplacementCodeuiVertex3fSUN_names[] = + "ifff\0" /* Parameter signature */ + "glReplacementCodeuiVertex3fSUN\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3iEXT_names[] = + "iii\0" /* Parameter signature */ + "glTangent3iEXT\0" + ""; +#endif + +#if defined(need_GL_SUN_mesh_array) +static const char DrawMeshArraysSUN_names[] = + "iiii\0" /* Parameter signature */ + "glDrawMeshArraysSUN\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char IsSync_names[] = + "i\0" /* Parameter signature */ + "glIsSync\0" + ""; +#endif + +#if defined(need_GL_NV_evaluators) +static const char GetMapControlPointsNV_names[] = + "iiiiiip\0" /* Parameter signature */ + "glGetMapControlPointsNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_draw_buffers) || defined(need_GL_ATI_draw_buffers) +static const char DrawBuffersARB_names[] = + "ip\0" /* Parameter signature */ + "glDrawBuffers\0" + "glDrawBuffersARB\0" + "glDrawBuffersATI\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char ProgramLocalParameter4fARB_names[] = + "iiffff\0" /* Parameter signature */ + "glProgramLocalParameter4fARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_sprite) +static const char SpriteParameterivSGIX_names[] = + "ip\0" /* Parameter signature */ + "glSpriteParameterivSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_provoking_vertex) +static const char ProvokingVertexEXT_names[] = + "i\0" /* Parameter signature */ + "glProvokingVertexEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord1fARB_names[] = + "if\0" /* Parameter signature */ + "glMultiTexCoord1f\0" + "glMultiTexCoord1fARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs4ubvNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs4ubvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightsvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightsvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) +static const char Uniform1fvARB_names[] = + "iip\0" /* Parameter signature */ + "glUniform1fv\0" + "glUniform1fvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const char CopyTexSubImage1D_names[] = + "iiiiii\0" /* Parameter signature */ + "glCopyTexSubImage1D\0" + "glCopyTexSubImage1DEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_texture_object) +static const char BindTexture_names[] = + "ii\0" /* Parameter signature */ + "glBindTexture\0" + "glBindTextureEXT\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char BeginFragmentShaderATI_names[] = + "\0" /* Parameter signature */ + "glBeginFragmentShaderATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord4fARB_names[] = + "iffff\0" /* Parameter signature */ + "glMultiTexCoord4f\0" + "glMultiTexCoord4fARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs3svNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs3svNV\0" + ""; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const char ReplacementCodeuivSUN_names[] = + "p\0" /* Parameter signature */ + "glReplacementCodeuivSUN\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char EnableVertexAttribArrayARB_names[] = + "i\0" /* Parameter signature */ + "glEnableVertexAttribArray\0" + "glEnableVertexAttribArrayARB\0" + ""; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const char NormalPointervINTEL_names[] = + "ip\0" /* Parameter signature */ + "glNormalPointervINTEL\0" + ""; +#endif + +#if defined(need_GL_EXT_convolution) +static const char CopyConvolutionFilter2D_names[] = + "iiiiii\0" /* Parameter signature */ + "glCopyConvolutionFilter2D\0" + "glCopyConvolutionFilter2DEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3ivMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos3iv\0" + "glWindowPos3ivARB\0" + "glWindowPos3ivMESA\0" + ""; +#endif + +#if defined(need_GL_ARB_copy_buffer) +static const char CopyBufferSubData_names[] = + "iiiii\0" /* Parameter signature */ + "glCopyBufferSubData\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char IsBufferARB_names[] = + "i\0" /* Parameter signature */ + "glIsBuffer\0" + "glIsBufferARB\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4iMESA_names[] = + "iiii\0" /* Parameter signature */ + "glWindowPos4iMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4uivARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4uiv\0" + "glVertexAttrib4uivARB\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3bvEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3bvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix3x4fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix3x4fv\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3fvEXT_names[] = + "p\0" /* Parameter signature */ + "glBinormal3fvEXT\0" + ""; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const char TexCoordPointervINTEL_names[] = + "iip\0" /* Parameter signature */ + "glTexCoordPointervINTEL\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char DeleteBuffersARB_names[] = + "ip\0" /* Parameter signature */ + "glDeleteBuffers\0" + "glDeleteBuffersARB\0" + ""; +#endif + +#if defined(need_GL_MESA_window_pos) +static const char WindowPos4fvMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos4fvMESA\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1sNV_names[] = + "ii\0" /* Parameter signature */ + "glVertexAttrib1sNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) +static const char SecondaryColor3svEXT_names[] = + "p\0" /* Parameter signature */ + "glSecondaryColor3sv\0" + "glSecondaryColor3svEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) +static const char LoadTransposeMatrixfARB_names[] = + "p\0" /* Parameter signature */ + "glLoadTransposeMatrixf\0" + "glLoadTransposeMatrixfARB\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char GetPointerv_names[] = + "ip\0" /* Parameter signature */ + "glGetPointerv\0" + "glGetPointervEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3bEXT_names[] = + "iii\0" /* Parameter signature */ + "glTangent3bEXT\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerParameterfNV_names[] = + "if\0" /* Parameter signature */ + "glCombinerParameterfNV\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char BindProgramNV_names[] = + "ii\0" /* Parameter signature */ + "glBindProgramARB\0" + "glBindProgramNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4svARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4sv\0" + "glVertexAttrib4svARB\0" + ""; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const char CreateDebugObjectMESA_names[] = + "\0" /* Parameter signature */ + "glCreateDebugObjectMESA\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) +static const char GetShaderiv_names[] = + "iip\0" /* Parameter signature */ + "glGetShaderiv\0" + ""; +#endif + +#if defined(need_GL_ARB_sync) +static const char ClientWaitSync_names[] = + "iii\0" /* Parameter signature */ + "glClientWaitSync\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char BindFragmentShaderATI_names[] = + "i\0" /* Parameter signature */ + "glBindFragmentShaderATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char UnmapBufferARB_names[] = + "i\0" /* Parameter signature */ + "glUnmapBuffer\0" + "glUnmapBufferARB\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char Minmax_names[] = + "iii\0" /* Parameter signature */ + "glMinmax\0" + "glMinmaxEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) +static const char FogCoorddvEXT_names[] = + "p\0" /* Parameter signature */ + "glFogCoorddv\0" + "glFogCoorddvEXT\0" + ""; +#endif + +#if defined(need_GL_SUNX_constant_data) +static const char FinishTextureSUNX_names[] = + "\0" /* Parameter signature */ + "glFinishTextureSUNX\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char GetFragmentLightfvSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetFragmentLightfvSGIX\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetFinalCombinerInputParameterfvNV_names[] = + "iip\0" /* Parameter signature */ + "glGetFinalCombinerInputParameterfvNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char ColorFragmentOp3ATI_names[] = + "iiiiiiiiiiiii\0" /* Parameter signature */ + "glColorFragmentOp3ATI\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2svARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib2sv\0" + "glVertexAttrib2svARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char AreProgramsResidentNV_names[] = + "ipp\0" /* Parameter signature */ + "glAreProgramsResidentNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos3svMESA_names[] = + "p\0" /* Parameter signature */ + "glWindowPos3sv\0" + "glWindowPos3svARB\0" + "glWindowPos3svMESA\0" + ""; +#endif + +#if defined(need_GL_EXT_color_subtable) +static const char CopyColorSubTable_names[] = + "iiiii\0" /* Parameter signature */ + "glCopyColorSubTable\0" + "glCopyColorSubTableEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightdvARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightdvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char DeleteRenderbuffersEXT_names[] = + "ip\0" /* Parameter signature */ + "glDeleteRenderbuffers\0" + "glDeleteRenderbuffersEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib4NubvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4Nubv\0" + "glVertexAttrib4NubvARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib3dvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib3dvNV\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetObjectParameterfvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetObjectParameterfvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const char GetProgramEnvParameterdvARB_names[] = + "iip\0" /* Parameter signature */ + "glGetProgramEnvParameterdvARB\0" + ""; +#endif + +#if defined(need_GL_EXT_compiled_vertex_array) +static const char LockArraysEXT_names[] = + "ii\0" /* Parameter signature */ + "glLockArraysEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const char PixelTransformParameterivEXT_names[] = + "iip\0" /* Parameter signature */ + "glPixelTransformParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char BinormalPointerEXT_names[] = + "iip\0" /* Parameter signature */ + "glBinormalPointerEXT\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib1dNV_names[] = + "id\0" /* Parameter signature */ + "glVertexAttrib1dNV\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char GetCombinerInputParameterivNV_names[] = + "iiiip\0" /* Parameter signature */ + "glGetCombinerInputParameterivNV\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_3) +static const char MultiTexCoord2fvARB_names[] = + "ip\0" /* Parameter signature */ + "glMultiTexCoord2fv\0" + "glMultiTexCoord2fvARB\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char GetRenderbufferParameterivEXT_names[] = + "iip\0" /* Parameter signature */ + "glGetRenderbufferParameteriv\0" + "glGetRenderbufferParameterivEXT\0" + ""; +#endif + +#if defined(need_GL_NV_register_combiners) +static const char CombinerParameterivNV_names[] = + "ip\0" /* Parameter signature */ + "glCombinerParameterivNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char GenFragmentShadersATI_names[] = + "i\0" /* Parameter signature */ + "glGenFragmentShadersATI\0" + ""; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const char DrawArrays_names[] = + "iii\0" /* Parameter signature */ + "glDrawArrays\0" + "glDrawArraysEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const char WeightuivARB_names[] = + "ip\0" /* Parameter signature */ + "glWeightuivARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib2sARB_names[] = + "iii\0" /* Parameter signature */ + "glVertexAttrib2s\0" + "glVertexAttrib2sARB\0" + ""; +#endif + +#if defined(need_GL_SGIX_async) +static const char GenAsyncMarkersSGIX_names[] = + "i\0" /* Parameter signature */ + "glGenAsyncMarkersSGIX\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Tangent3svEXT_names[] = + "p\0" /* Parameter signature */ + "glTangent3svEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const char GetListParameterivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glGetListParameterivSGIX\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char BindBufferARB_names[] = + "ii\0" /* Parameter signature */ + "glBindBuffer\0" + "glBindBufferARB\0" + ""; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const char GetInfoLogARB_names[] = + "iipp\0" /* Parameter signature */ + "glGetInfoLogARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs4svNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs4svNV\0" + ""; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const char EdgeFlagPointerListIBM_names[] = + "ipi\0" /* Parameter signature */ + "glEdgeFlagPointerListIBM\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_1) +static const char UniformMatrix3x2fv_names[] = + "iiip\0" /* Parameter signature */ + "glUniformMatrix3x2fv\0" + ""; +#endif + +#if defined(need_GL_EXT_histogram) +static const char GetMinmaxParameterfv_names[] = + "iip\0" /* Parameter signature */ + "glGetMinmaxParameterfv\0" + "glGetMinmaxParameterfvEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) +static const char VertexAttrib1fvARB_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib1fv\0" + "glVertexAttrib1fvARB\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) +static const char GenBuffersARB_names[] = + "ip\0" /* Parameter signature */ + "glGenBuffers\0" + "glGenBuffersARB\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttribs1svNV_names[] = + "iip\0" /* Parameter signature */ + "glVertexAttribs1svNV\0" + ""; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const char GetTexBumpParameterivATI_names[] = + "ip\0" /* Parameter signature */ + "glGetTexBumpParameterivATI\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3bEXT_names[] = + "iii\0" /* Parameter signature */ + "glBinormal3bEXT\0" + ""; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const char FragmentMaterialivSGIX_names[] = + "iip\0" /* Parameter signature */ + "glFragmentMaterialivSGIX\0" + ""; +#endif + +#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) +static const char IsRenderbufferEXT_names[] = + "i\0" /* Parameter signature */ + "glIsRenderbuffer\0" + "glIsRenderbufferEXT\0" + ""; +#endif + +#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) +static const char GenProgramsNV_names[] = + "ip\0" /* Parameter signature */ + "glGenProgramsARB\0" + "glGenProgramsNV\0" + ""; +#endif + +#if defined(need_GL_NV_vertex_program) +static const char VertexAttrib4dvNV_names[] = + "ip\0" /* Parameter signature */ + "glVertexAttrib4dvNV\0" + ""; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const char EndFragmentShaderATI_names[] = + "\0" /* Parameter signature */ + "glEndFragmentShaderATI\0" + ""; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const char Binormal3iEXT_names[] = + "iii\0" /* Parameter signature */ + "glBinormal3iEXT\0" + ""; +#endif + +#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) +static const char WindowPos2fMESA_names[] = + "ff\0" /* Parameter signature */ + "glWindowPos2f\0" + "glWindowPos2fARB\0" + "glWindowPos2fMESA\0" + ""; +#endif + +#if defined(need_GL_3DFX_tbuffer) +static const struct dri_extension_function GL_3DFX_tbuffer_functions[] = { + { TbufferMask3DFX_names, TbufferMask3DFX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_APPLE_flush_buffer_range) +static const struct dri_extension_function GL_APPLE_flush_buffer_range_functions[] = { + { BufferParameteriAPPLE_names, BufferParameteriAPPLE_remap_index, -1 }, + { FlushMappedBufferRangeAPPLE_names, FlushMappedBufferRangeAPPLE_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_APPLE_texture_range) +static const struct dri_extension_function GL_APPLE_texture_range_functions[] = { + { TextureRangeAPPLE_names, TextureRangeAPPLE_remap_index, -1 }, + { GetTexParameterPointervAPPLE_names, GetTexParameterPointervAPPLE_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_APPLE_vertex_array_object) +static const struct dri_extension_function GL_APPLE_vertex_array_object_functions[] = { + { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 }, + { GenVertexArraysAPPLE_names, GenVertexArraysAPPLE_remap_index, -1 }, + { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 }, + { BindVertexArrayAPPLE_names, BindVertexArrayAPPLE_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_copy_buffer) +static const struct dri_extension_function GL_ARB_copy_buffer_functions[] = { + { CopyBufferSubData_names, CopyBufferSubData_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_draw_buffers) +static const struct dri_extension_function GL_ARB_draw_buffers_functions[] = { + { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_framebuffer_object) +static const struct dri_extension_function GL_ARB_framebuffer_object_functions[] = { + { BlitFramebufferEXT_names, BlitFramebufferEXT_remap_index, -1 }, + { FramebufferTextureLayerEXT_names, FramebufferTextureLayerEXT_remap_index, -1 }, + { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 }, + { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 }, + { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 }, + { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 }, + { FramebufferTexture2DEXT_names, FramebufferTexture2DEXT_remap_index, -1 }, + { RenderbufferStorageMultisample_names, RenderbufferStorageMultisample_remap_index, -1 }, + { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 }, + { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 }, + { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 }, + { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 }, + { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 }, + { GetFramebufferAttachmentParameterivEXT_names, GetFramebufferAttachmentParameterivEXT_remap_index, -1 }, + { DeleteFramebuffersEXT_names, DeleteFramebuffersEXT_remap_index, -1 }, + { GenFramebuffersEXT_names, GenFramebuffersEXT_remap_index, -1 }, + { BindRenderbufferEXT_names, BindRenderbufferEXT_remap_index, -1 }, + { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 }, + { GetRenderbufferParameterivEXT_names, GetRenderbufferParameterivEXT_remap_index, -1 }, + { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_map_buffer_range) +static const struct dri_extension_function GL_ARB_map_buffer_range_functions[] = { + { FlushMappedBufferRange_names, FlushMappedBufferRange_remap_index, -1 }, + { MapBufferRange_names, MapBufferRange_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const struct dri_extension_function GL_ARB_matrix_palette_functions[] = { + { MatrixIndexusvARB_names, MatrixIndexusvARB_remap_index, -1 }, + { MatrixIndexuivARB_names, MatrixIndexuivARB_remap_index, -1 }, + { MatrixIndexPointerARB_names, MatrixIndexPointerARB_remap_index, -1 }, + { CurrentPaletteMatrixARB_names, CurrentPaletteMatrixARB_remap_index, -1 }, + { MatrixIndexubvARB_names, MatrixIndexubvARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_multisample) +static const struct dri_extension_function GL_ARB_multisample_functions[] = { + { SampleCoverageARB_names, SampleCoverageARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_occlusion_query) +static const struct dri_extension_function GL_ARB_occlusion_query_functions[] = { + { BeginQueryARB_names, BeginQueryARB_remap_index, -1 }, + { GetQueryivARB_names, GetQueryivARB_remap_index, -1 }, + { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, -1 }, + { EndQueryARB_names, EndQueryARB_remap_index, -1 }, + { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, -1 }, + { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, -1 }, + { IsQueryARB_names, IsQueryARB_remap_index, -1 }, + { GenQueriesARB_names, GenQueriesARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_point_parameters) +static const struct dri_extension_function GL_ARB_point_parameters_functions[] = { + { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, + { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_shader_objects) +static const struct dri_extension_function GL_ARB_shader_objects_functions[] = { + { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, -1 }, + { Uniform2fARB_names, Uniform2fARB_remap_index, -1 }, + { Uniform2ivARB_names, Uniform2ivARB_remap_index, -1 }, + { UniformMatrix4fvARB_names, UniformMatrix4fvARB_remap_index, -1 }, + { CreateProgramObjectARB_names, CreateProgramObjectARB_remap_index, -1 }, + { Uniform3iARB_names, Uniform3iARB_remap_index, -1 }, + { CreateShaderObjectARB_names, CreateShaderObjectARB_remap_index, -1 }, + { Uniform1fARB_names, Uniform1fARB_remap_index, -1 }, + { AttachObjectARB_names, AttachObjectARB_remap_index, -1 }, + { UniformMatrix2fvARB_names, UniformMatrix2fvARB_remap_index, -1 }, + { GetAttachedObjectsARB_names, GetAttachedObjectsARB_remap_index, -1 }, + { Uniform3fvARB_names, Uniform3fvARB_remap_index, -1 }, + { GetHandleARB_names, GetHandleARB_remap_index, -1 }, + { GetActiveUniformARB_names, GetActiveUniformARB_remap_index, -1 }, + { GetUniformivARB_names, GetUniformivARB_remap_index, -1 }, + { Uniform2fvARB_names, Uniform2fvARB_remap_index, -1 }, + { DeleteObjectARB_names, DeleteObjectARB_remap_index, -1 }, + { ValidateProgramARB_names, ValidateProgramARB_remap_index, -1 }, + { Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 }, + { CompileShaderARB_names, CompileShaderARB_remap_index, -1 }, + { Uniform3fARB_names, Uniform3fARB_remap_index, -1 }, + { Uniform4fARB_names, Uniform4fARB_remap_index, -1 }, + { LinkProgramARB_names, LinkProgramARB_remap_index, -1 }, + { ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 }, + { Uniform4ivARB_names, Uniform4ivARB_remap_index, -1 }, + { Uniform1ivARB_names, Uniform1ivARB_remap_index, -1 }, + { Uniform1iARB_names, Uniform1iARB_remap_index, -1 }, + { Uniform4fvARB_names, Uniform4fvARB_remap_index, -1 }, + { GetUniformfvARB_names, GetUniformfvARB_remap_index, -1 }, + { DetachObjectARB_names, DetachObjectARB_remap_index, -1 }, + { Uniform4iARB_names, Uniform4iARB_remap_index, -1 }, + { UseProgramObjectARB_names, UseProgramObjectARB_remap_index, -1 }, + { Uniform2iARB_names, Uniform2iARB_remap_index, -1 }, + { GetObjectParameterivARB_names, GetObjectParameterivARB_remap_index, -1 }, + { GetUniformLocationARB_names, GetUniformLocationARB_remap_index, -1 }, + { GetShaderSourceARB_names, GetShaderSourceARB_remap_index, -1 }, + { Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 }, + { GetObjectParameterfvARB_names, GetObjectParameterfvARB_remap_index, -1 }, + { GetInfoLogARB_names, GetInfoLogARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_sync) +static const struct dri_extension_function GL_ARB_sync_functions[] = { + { DeleteSync_names, DeleteSync_remap_index, -1 }, + { FenceSync_names, FenceSync_remap_index, -1 }, + { WaitSync_names, WaitSync_remap_index, -1 }, + { GetInteger64v_names, GetInteger64v_remap_index, -1 }, + { GetSynciv_names, GetSynciv_remap_index, -1 }, + { IsSync_names, IsSync_remap_index, -1 }, + { ClientWaitSync_names, ClientWaitSync_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_texture_compression) +static const struct dri_extension_function GL_ARB_texture_compression_functions[] = { + { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, -1 }, + { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, -1 }, + { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, -1 }, + { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, -1 }, + { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, -1 }, + { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, -1 }, + { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_transpose_matrix) +static const struct dri_extension_function GL_ARB_transpose_matrix_functions[] = { + { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, -1 }, + { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, -1 }, + { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, -1 }, + { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_array_object) +static const struct dri_extension_function GL_ARB_vertex_array_object_functions[] = { + { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 }, + { GenVertexArrays_names, GenVertexArrays_remap_index, -1 }, + { BindVertexArray_names, BindVertexArray_remap_index, -1 }, + { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const struct dri_extension_function GL_ARB_vertex_blend_functions[] = { + { WeightubvARB_names, WeightubvARB_remap_index, -1 }, + { WeightivARB_names, WeightivARB_remap_index, -1 }, + { WeightPointerARB_names, WeightPointerARB_remap_index, -1 }, + { WeightfvARB_names, WeightfvARB_remap_index, -1 }, + { WeightbvARB_names, WeightbvARB_remap_index, -1 }, + { WeightusvARB_names, WeightusvARB_remap_index, -1 }, + { VertexBlendARB_names, VertexBlendARB_remap_index, -1 }, + { WeightsvARB_names, WeightsvARB_remap_index, -1 }, + { WeightdvARB_names, WeightdvARB_remap_index, -1 }, + { WeightuivARB_names, WeightuivARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_buffer_object) +static const struct dri_extension_function GL_ARB_vertex_buffer_object_functions[] = { + { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, -1 }, + { BufferSubDataARB_names, BufferSubDataARB_remap_index, -1 }, + { BufferDataARB_names, BufferDataARB_remap_index, -1 }, + { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, -1 }, + { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, -1 }, + { MapBufferARB_names, MapBufferARB_remap_index, -1 }, + { IsBufferARB_names, IsBufferARB_remap_index, -1 }, + { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, -1 }, + { UnmapBufferARB_names, UnmapBufferARB_remap_index, -1 }, + { BindBufferARB_names, BindBufferARB_remap_index, -1 }, + { GenBuffersARB_names, GenBuffersARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_program) +static const struct dri_extension_function GL_ARB_vertex_program_functions[] = { + { VertexAttrib2fARB_names, VertexAttrib2fARB_remap_index, -1 }, + { VertexAttrib3fARB_names, VertexAttrib3fARB_remap_index, -1 }, + { VertexAttrib1svARB_names, VertexAttrib1svARB_remap_index, -1 }, + { VertexAttrib4NusvARB_names, VertexAttrib4NusvARB_remap_index, -1 }, + { DisableVertexAttribArrayARB_names, DisableVertexAttribArrayARB_remap_index, -1 }, + { ProgramLocalParameter4dARB_names, ProgramLocalParameter4dARB_remap_index, -1 }, + { VertexAttrib1fARB_names, VertexAttrib1fARB_remap_index, -1 }, + { VertexAttrib4NbvARB_names, VertexAttrib4NbvARB_remap_index, -1 }, + { VertexAttrib1sARB_names, VertexAttrib1sARB_remap_index, -1 }, + { GetProgramLocalParameterfvARB_names, GetProgramLocalParameterfvARB_remap_index, -1 }, + { VertexAttrib3dvARB_names, VertexAttrib3dvARB_remap_index, -1 }, + { ProgramEnvParameter4fvARB_names, ProgramEnvParameter4fvARB_remap_index, -1 }, + { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 }, + { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 }, + { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 }, + { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 }, + { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 }, + { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 }, + { ProgramLocalParameter4dvARB_names, ProgramLocalParameter4dvARB_remap_index, -1 }, + { VertexAttrib2dARB_names, VertexAttrib2dARB_remap_index, -1 }, + { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 }, + { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 }, + { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 }, + { ProgramEnvParameter4fARB_names, ProgramEnvParameter4fARB_remap_index, -1 }, + { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 }, + { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 }, + { VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, -1 }, + { VertexAttrib4NivARB_names, VertexAttrib4NivARB_remap_index, -1 }, + { GetProgramStringARB_names, GetProgramStringARB_remap_index, -1 }, + { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 }, + { IsProgramNV_names, IsProgramNV_remap_index, -1 }, + { ProgramEnvParameter4dARB_names, ProgramEnvParameter4dARB_remap_index, -1 }, + { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 }, + { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 }, + { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 }, + { GetVertexAttribdvARB_names, GetVertexAttribdvARB_remap_index, -1 }, + { VertexAttrib4dvARB_names, VertexAttrib4dvARB_remap_index, -1 }, + { VertexAttribPointerARB_names, VertexAttribPointerARB_remap_index, -1 }, + { VertexAttrib4NsvARB_names, VertexAttrib4NsvARB_remap_index, -1 }, + { VertexAttrib3fvARB_names, VertexAttrib3fvARB_remap_index, -1 }, + { VertexAttrib4NubARB_names, VertexAttrib4NubARB_remap_index, -1 }, + { GetProgramEnvParameterfvARB_names, GetProgramEnvParameterfvARB_remap_index, -1 }, + { ProgramEnvParameter4dvARB_names, ProgramEnvParameter4dvARB_remap_index, -1 }, + { ProgramLocalParameter4fvARB_names, ProgramLocalParameter4fvARB_remap_index, -1 }, + { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, -1 }, + { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 }, + { VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, -1 }, + { GetProgramLocalParameterdvARB_names, GetProgramLocalParameterdvARB_remap_index, -1 }, + { GetProgramivARB_names, GetProgramivARB_remap_index, -1 }, + { VertexAttrib3sARB_names, VertexAttrib3sARB_remap_index, -1 }, + { ProgramStringARB_names, ProgramStringARB_remap_index, -1 }, + { ProgramLocalParameter4fARB_names, ProgramLocalParameter4fARB_remap_index, -1 }, + { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 }, + { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 }, + { BindProgramNV_names, BindProgramNV_remap_index, -1 }, + { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 }, + { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 }, + { VertexAttrib4NubvARB_names, VertexAttrib4NubvARB_remap_index, -1 }, + { GetProgramEnvParameterdvARB_names, GetProgramEnvParameterdvARB_remap_index, -1 }, + { VertexAttrib2sARB_names, VertexAttrib2sARB_remap_index, -1 }, + { VertexAttrib1fvARB_names, VertexAttrib1fvARB_remap_index, -1 }, + { GenProgramsNV_names, GenProgramsNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_vertex_shader) +static const struct dri_extension_function GL_ARB_vertex_shader_functions[] = { + { GetActiveAttribARB_names, GetActiveAttribARB_remap_index, -1 }, + { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 }, + { BindAttribLocationARB_names, BindAttribLocationARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ARB_window_pos) +static const struct dri_extension_function GL_ARB_window_pos_functions[] = { + { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 }, + { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 }, + { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 }, + { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 }, + { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 }, + { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 }, + { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 }, + { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 }, + { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 }, + { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 }, + { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 }, + { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 }, + { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 }, + { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 }, + { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 }, + { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_blend_equation_separate) +static const struct dri_extension_function GL_ATI_blend_equation_separate_functions[] = { + { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_draw_buffers) +static const struct dri_extension_function GL_ATI_draw_buffers_functions[] = { + { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +static const struct dri_extension_function GL_ATI_envmap_bumpmap_functions[] = { + { TexBumpParameterfvATI_names, TexBumpParameterfvATI_remap_index, -1 }, + { TexBumpParameterivATI_names, TexBumpParameterivATI_remap_index, -1 }, + { GetTexBumpParameterfvATI_names, GetTexBumpParameterfvATI_remap_index, -1 }, + { GetTexBumpParameterivATI_names, GetTexBumpParameterivATI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_fragment_shader) +static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = { + { ColorFragmentOp2ATI_names, ColorFragmentOp2ATI_remap_index, -1 }, + { DeleteFragmentShaderATI_names, DeleteFragmentShaderATI_remap_index, -1 }, + { SetFragmentShaderConstantATI_names, SetFragmentShaderConstantATI_remap_index, -1 }, + { SampleMapATI_names, SampleMapATI_remap_index, -1 }, + { AlphaFragmentOp2ATI_names, AlphaFragmentOp2ATI_remap_index, -1 }, + { AlphaFragmentOp1ATI_names, AlphaFragmentOp1ATI_remap_index, -1 }, + { ColorFragmentOp1ATI_names, ColorFragmentOp1ATI_remap_index, -1 }, + { AlphaFragmentOp3ATI_names, AlphaFragmentOp3ATI_remap_index, -1 }, + { PassTexCoordATI_names, PassTexCoordATI_remap_index, -1 }, + { BeginFragmentShaderATI_names, BeginFragmentShaderATI_remap_index, -1 }, + { BindFragmentShaderATI_names, BindFragmentShaderATI_remap_index, -1 }, + { ColorFragmentOp3ATI_names, ColorFragmentOp3ATI_remap_index, -1 }, + { GenFragmentShadersATI_names, GenFragmentShadersATI_remap_index, -1 }, + { EndFragmentShaderATI_names, EndFragmentShaderATI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_ATI_separate_stencil) +static const struct dri_extension_function GL_ATI_separate_stencil_functions[] = { + { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 }, + { StencilFuncSeparateATI_names, StencilFuncSeparateATI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_blend_color) +static const struct dri_extension_function GL_EXT_blend_color_functions[] = { + { BlendColor_names, -1, 336 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_blend_equation_separate) +static const struct dri_extension_function GL_EXT_blend_equation_separate_functions[] = { + { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_blend_func_separate) +static const struct dri_extension_function GL_EXT_blend_func_separate_functions[] = { + { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_blend_minmax) +static const struct dri_extension_function GL_EXT_blend_minmax_functions[] = { + { BlendEquation_names, -1, 337 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_color_subtable) +static const struct dri_extension_function GL_EXT_color_subtable_functions[] = { + { ColorSubTable_names, -1, 346 }, + { CopyColorSubTable_names, -1, 347 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_compiled_vertex_array) +static const struct dri_extension_function GL_EXT_compiled_vertex_array_functions[] = { + { UnlockArraysEXT_names, UnlockArraysEXT_remap_index, -1 }, + { LockArraysEXT_names, LockArraysEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_convolution) +static const struct dri_extension_function GL_EXT_convolution_functions[] = { + { ConvolutionFilter1D_names, -1, 348 }, + { CopyConvolutionFilter1D_names, -1, 354 }, + { GetConvolutionParameteriv_names, -1, 358 }, + { ConvolutionFilter2D_names, -1, 349 }, + { ConvolutionParameteriv_names, -1, 353 }, + { ConvolutionParameterfv_names, -1, 351 }, + { GetSeparableFilter_names, -1, 359 }, + { SeparableFilter2D_names, -1, 360 }, + { ConvolutionParameteri_names, -1, 352 }, + { ConvolutionParameterf_names, -1, 350 }, + { GetConvolutionParameterfv_names, -1, 357 }, + { GetConvolutionFilter_names, -1, 356 }, + { CopyConvolutionFilter2D_names, -1, 355 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const struct dri_extension_function GL_EXT_coordinate_frame_functions[] = { + { TangentPointerEXT_names, TangentPointerEXT_remap_index, -1 }, + { Binormal3ivEXT_names, Binormal3ivEXT_remap_index, -1 }, + { Tangent3sEXT_names, Tangent3sEXT_remap_index, -1 }, + { Tangent3fvEXT_names, Tangent3fvEXT_remap_index, -1 }, + { Tangent3dvEXT_names, Tangent3dvEXT_remap_index, -1 }, + { Binormal3bvEXT_names, Binormal3bvEXT_remap_index, -1 }, + { Binormal3dEXT_names, Binormal3dEXT_remap_index, -1 }, + { Tangent3fEXT_names, Tangent3fEXT_remap_index, -1 }, + { Binormal3sEXT_names, Binormal3sEXT_remap_index, -1 }, + { Tangent3ivEXT_names, Tangent3ivEXT_remap_index, -1 }, + { Tangent3dEXT_names, Tangent3dEXT_remap_index, -1 }, + { Binormal3svEXT_names, Binormal3svEXT_remap_index, -1 }, + { Binormal3fEXT_names, Binormal3fEXT_remap_index, -1 }, + { Binormal3dvEXT_names, Binormal3dvEXT_remap_index, -1 }, + { Tangent3iEXT_names, Tangent3iEXT_remap_index, -1 }, + { Tangent3bvEXT_names, Tangent3bvEXT_remap_index, -1 }, + { Binormal3fvEXT_names, Binormal3fvEXT_remap_index, -1 }, + { Tangent3bEXT_names, Tangent3bEXT_remap_index, -1 }, + { BinormalPointerEXT_names, BinormalPointerEXT_remap_index, -1 }, + { Tangent3svEXT_names, Tangent3svEXT_remap_index, -1 }, + { Binormal3bEXT_names, Binormal3bEXT_remap_index, -1 }, + { Binormal3iEXT_names, Binormal3iEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const struct dri_extension_function GL_EXT_copy_texture_functions[] = { + { CopyTexSubImage3D_names, -1, 373 }, + { CopyTexImage2D_names, -1, 324 }, + { CopyTexImage1D_names, -1, 323 }, + { CopyTexSubImage2D_names, -1, 326 }, + { CopyTexSubImage1D_names, -1, 325 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_cull_vertex) +static const struct dri_extension_function GL_EXT_cull_vertex_functions[] = { + { CullParameterdvEXT_names, CullParameterdvEXT_remap_index, -1 }, + { CullParameterfvEXT_names, CullParameterfvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_depth_bounds_test) +static const struct dri_extension_function GL_EXT_depth_bounds_test_functions[] = { + { DepthBoundsEXT_names, DepthBoundsEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_draw_range_elements) +static const struct dri_extension_function GL_EXT_draw_range_elements_functions[] = { + { DrawRangeElements_names, -1, 338 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_fog_coord) +static const struct dri_extension_function GL_EXT_fog_coord_functions[] = { + { FogCoorddEXT_names, FogCoorddEXT_remap_index, -1 }, + { FogCoordfEXT_names, FogCoordfEXT_remap_index, -1 }, + { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, -1 }, + { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, -1 }, + { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_framebuffer_blit) +static const struct dri_extension_function GL_EXT_framebuffer_blit_functions[] = { + { BlitFramebufferEXT_names, BlitFramebufferEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_framebuffer_object) +static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = { + { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 }, + { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 }, + { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 }, + { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 }, + { FramebufferTexture2DEXT_names, FramebufferTexture2DEXT_remap_index, -1 }, + { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 }, + { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 }, + { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 }, + { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 }, + { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 }, + { GetFramebufferAttachmentParameterivEXT_names, GetFramebufferAttachmentParameterivEXT_remap_index, -1 }, + { DeleteFramebuffersEXT_names, DeleteFramebuffersEXT_remap_index, -1 }, + { GenFramebuffersEXT_names, GenFramebuffersEXT_remap_index, -1 }, + { BindRenderbufferEXT_names, BindRenderbufferEXT_remap_index, -1 }, + { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 }, + { GetRenderbufferParameterivEXT_names, GetRenderbufferParameterivEXT_remap_index, -1 }, + { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_gpu_program_parameters) +static const struct dri_extension_function GL_EXT_gpu_program_parameters_functions[] = { + { ProgramLocalParameters4fvEXT_names, ProgramLocalParameters4fvEXT_remap_index, -1 }, + { ProgramEnvParameters4fvEXT_names, ProgramEnvParameters4fvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_histogram) +static const struct dri_extension_function GL_EXT_histogram_functions[] = { + { Histogram_names, -1, 367 }, + { ResetHistogram_names, -1, 369 }, + { GetMinmax_names, -1, 364 }, + { GetHistogramParameterfv_names, -1, 362 }, + { GetMinmaxParameteriv_names, -1, 366 }, + { ResetMinmax_names, -1, 370 }, + { GetHistogramParameteriv_names, -1, 363 }, + { GetHistogram_names, -1, 361 }, + { Minmax_names, -1, 368 }, + { GetMinmaxParameterfv_names, -1, 365 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_index_func) +static const struct dri_extension_function GL_EXT_index_func_functions[] = { + { IndexFuncEXT_names, IndexFuncEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_index_material) +static const struct dri_extension_function GL_EXT_index_material_functions[] = { + { IndexMaterialEXT_names, IndexMaterialEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_light_texture) +static const struct dri_extension_function GL_EXT_light_texture_functions[] = { + { ApplyTextureEXT_names, ApplyTextureEXT_remap_index, -1 }, + { TextureMaterialEXT_names, TextureMaterialEXT_remap_index, -1 }, + { TextureLightEXT_names, TextureLightEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_multi_draw_arrays) +static const struct dri_extension_function GL_EXT_multi_draw_arrays_functions[] = { + { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, -1 }, + { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_multisample) +static const struct dri_extension_function GL_EXT_multisample_functions[] = { + { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, -1 }, + { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_paletted_texture) +static const struct dri_extension_function GL_EXT_paletted_texture_functions[] = { + { ColorTable_names, -1, 339 }, + { GetColorTable_names, -1, 343 }, + { GetColorTableParameterfv_names, -1, 344 }, + { GetColorTableParameteriv_names, -1, 345 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const struct dri_extension_function GL_EXT_pixel_transform_functions[] = { + { PixelTransformParameterfvEXT_names, PixelTransformParameterfvEXT_remap_index, -1 }, + { PixelTransformParameterfEXT_names, PixelTransformParameterfEXT_remap_index, -1 }, + { PixelTransformParameteriEXT_names, PixelTransformParameteriEXT_remap_index, -1 }, + { PixelTransformParameterivEXT_names, PixelTransformParameterivEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_point_parameters) +static const struct dri_extension_function GL_EXT_point_parameters_functions[] = { + { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, + { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_polygon_offset) +static const struct dri_extension_function GL_EXT_polygon_offset_functions[] = { + { PolygonOffsetEXT_names, PolygonOffsetEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_provoking_vertex) +static const struct dri_extension_function GL_EXT_provoking_vertex_functions[] = { + { ProvokingVertexEXT_names, ProvokingVertexEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_secondary_color) +static const struct dri_extension_function GL_EXT_secondary_color_functions[] = { + { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, -1 }, + { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, -1 }, + { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, -1 }, + { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, -1 }, + { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, -1 }, + { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, -1 }, + { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, -1 }, + { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, -1 }, + { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, -1 }, + { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, -1 }, + { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, -1 }, + { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, -1 }, + { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, -1 }, + { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, -1 }, + { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, -1 }, + { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, -1 }, + { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_stencil_two_side) +static const struct dri_extension_function GL_EXT_stencil_two_side_functions[] = { + { ActiveStencilFaceEXT_names, ActiveStencilFaceEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_subtexture) +static const struct dri_extension_function GL_EXT_subtexture_functions[] = { + { TexSubImage1D_names, -1, 332 }, + { TexSubImage2D_names, -1, 333 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_texture3D) +static const struct dri_extension_function GL_EXT_texture3D_functions[] = { + { TexImage3D_names, -1, 371 }, + { TexSubImage3D_names, -1, 372 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_texture_array) +static const struct dri_extension_function GL_EXT_texture_array_functions[] = { + { FramebufferTextureLayerEXT_names, FramebufferTextureLayerEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_texture_object) +static const struct dri_extension_function GL_EXT_texture_object_functions[] = { + { PrioritizeTextures_names, -1, 331 }, + { AreTexturesResident_names, -1, 322 }, + { GenTextures_names, -1, 328 }, + { DeleteTextures_names, -1, 327 }, + { IsTexture_names, -1, 330 }, + { BindTexture_names, -1, 307 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_texture_perturb_normal) +static const struct dri_extension_function GL_EXT_texture_perturb_normal_functions[] = { + { TextureNormalEXT_names, TextureNormalEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_timer_query) +static const struct dri_extension_function GL_EXT_timer_query_functions[] = { + { GetQueryObjectui64vEXT_names, GetQueryObjectui64vEXT_remap_index, -1 }, + { GetQueryObjecti64vEXT_names, GetQueryObjecti64vEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_vertex_array) +static const struct dri_extension_function GL_EXT_vertex_array_functions[] = { + { IndexPointerEXT_names, IndexPointerEXT_remap_index, -1 }, + { NormalPointerEXT_names, NormalPointerEXT_remap_index, -1 }, + { VertexPointerEXT_names, VertexPointerEXT_remap_index, -1 }, + { TexCoordPointerEXT_names, TexCoordPointerEXT_remap_index, -1 }, + { EdgeFlagPointerEXT_names, EdgeFlagPointerEXT_remap_index, -1 }, + { ArrayElement_names, -1, 306 }, + { ColorPointerEXT_names, ColorPointerEXT_remap_index, -1 }, + { GetPointerv_names, -1, 329 }, + { DrawArrays_names, -1, 310 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_EXT_vertex_weighting) +static const struct dri_extension_function GL_EXT_vertex_weighting_functions[] = { + { VertexWeightfvEXT_names, VertexWeightfvEXT_remap_index, -1 }, + { VertexWeightfEXT_names, VertexWeightfEXT_remap_index, -1 }, + { VertexWeightPointerEXT_names, VertexWeightPointerEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_HP_image_transform) +static const struct dri_extension_function GL_HP_image_transform_functions[] = { + { GetImageTransformParameterfvHP_names, GetImageTransformParameterfvHP_remap_index, -1 }, + { ImageTransformParameterfHP_names, ImageTransformParameterfHP_remap_index, -1 }, + { ImageTransformParameterfvHP_names, ImageTransformParameterfvHP_remap_index, -1 }, + { ImageTransformParameteriHP_names, ImageTransformParameteriHP_remap_index, -1 }, + { GetImageTransformParameterivHP_names, GetImageTransformParameterivHP_remap_index, -1 }, + { ImageTransformParameterivHP_names, ImageTransformParameterivHP_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_IBM_multimode_draw_arrays) +static const struct dri_extension_function GL_IBM_multimode_draw_arrays_functions[] = { + { MultiModeDrawArraysIBM_names, MultiModeDrawArraysIBM_remap_index, -1 }, + { MultiModeDrawElementsIBM_names, MultiModeDrawElementsIBM_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const struct dri_extension_function GL_IBM_vertex_array_lists_functions[] = { + { SecondaryColorPointerListIBM_names, SecondaryColorPointerListIBM_remap_index, -1 }, + { NormalPointerListIBM_names, NormalPointerListIBM_remap_index, -1 }, + { FogCoordPointerListIBM_names, FogCoordPointerListIBM_remap_index, -1 }, + { VertexPointerListIBM_names, VertexPointerListIBM_remap_index, -1 }, + { ColorPointerListIBM_names, ColorPointerListIBM_remap_index, -1 }, + { TexCoordPointerListIBM_names, TexCoordPointerListIBM_remap_index, -1 }, + { IndexPointerListIBM_names, IndexPointerListIBM_remap_index, -1 }, + { EdgeFlagPointerListIBM_names, EdgeFlagPointerListIBM_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_INGR_blend_func_separate) +static const struct dri_extension_function GL_INGR_blend_func_separate_functions[] = { + { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const struct dri_extension_function GL_INTEL_parallel_arrays_functions[] = { + { VertexPointervINTEL_names, VertexPointervINTEL_remap_index, -1 }, + { ColorPointervINTEL_names, ColorPointervINTEL_remap_index, -1 }, + { NormalPointervINTEL_names, NormalPointervINTEL_remap_index, -1 }, + { TexCoordPointervINTEL_names, TexCoordPointervINTEL_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_MESA_resize_buffers) +static const struct dri_extension_function GL_MESA_resize_buffers_functions[] = { + { ResizeBuffersMESA_names, ResizeBuffersMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const struct dri_extension_function GL_MESA_shader_debug_functions[] = { + { GetDebugLogLengthMESA_names, GetDebugLogLengthMESA_remap_index, -1 }, + { ClearDebugLogMESA_names, ClearDebugLogMESA_remap_index, -1 }, + { GetDebugLogMESA_names, GetDebugLogMESA_remap_index, -1 }, + { CreateDebugObjectMESA_names, CreateDebugObjectMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_MESA_window_pos) +static const struct dri_extension_function GL_MESA_window_pos_functions[] = { + { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 }, + { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 }, + { WindowPos4svMESA_names, WindowPos4svMESA_remap_index, -1 }, + { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 }, + { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 }, + { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 }, + { WindowPos4dMESA_names, WindowPos4dMESA_remap_index, -1 }, + { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 }, + { WindowPos4ivMESA_names, WindowPos4ivMESA_remap_index, -1 }, + { WindowPos4fMESA_names, WindowPos4fMESA_remap_index, -1 }, + { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 }, + { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 }, + { WindowPos4dvMESA_names, WindowPos4dvMESA_remap_index, -1 }, + { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 }, + { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 }, + { WindowPos4sMESA_names, WindowPos4sMESA_remap_index, -1 }, + { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 }, + { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 }, + { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 }, + { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 }, + { WindowPos4iMESA_names, WindowPos4iMESA_remap_index, -1 }, + { WindowPos4fvMESA_names, WindowPos4fvMESA_remap_index, -1 }, + { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 }, + { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_evaluators) +static const struct dri_extension_function GL_NV_evaluators_functions[] = { + { GetMapAttribParameterivNV_names, GetMapAttribParameterivNV_remap_index, -1 }, + { MapControlPointsNV_names, MapControlPointsNV_remap_index, -1 }, + { MapParameterfvNV_names, MapParameterfvNV_remap_index, -1 }, + { EvalMapsNV_names, EvalMapsNV_remap_index, -1 }, + { GetMapAttribParameterfvNV_names, GetMapAttribParameterfvNV_remap_index, -1 }, + { MapParameterivNV_names, MapParameterivNV_remap_index, -1 }, + { GetMapParameterivNV_names, GetMapParameterivNV_remap_index, -1 }, + { GetMapParameterfvNV_names, GetMapParameterfvNV_remap_index, -1 }, + { GetMapControlPointsNV_names, GetMapControlPointsNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_fence) +static const struct dri_extension_function GL_NV_fence_functions[] = { + { GenFencesNV_names, GenFencesNV_remap_index, -1 }, + { TestFenceNV_names, TestFenceNV_remap_index, -1 }, + { IsFenceNV_names, IsFenceNV_remap_index, -1 }, + { DeleteFencesNV_names, DeleteFencesNV_remap_index, -1 }, + { SetFenceNV_names, SetFenceNV_remap_index, -1 }, + { GetFenceivNV_names, GetFenceivNV_remap_index, -1 }, + { FinishFenceNV_names, FinishFenceNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_fragment_program) +static const struct dri_extension_function GL_NV_fragment_program_functions[] = { + { GetProgramNamedParameterdvNV_names, GetProgramNamedParameterdvNV_remap_index, -1 }, + { GetProgramNamedParameterfvNV_names, GetProgramNamedParameterfvNV_remap_index, -1 }, + { ProgramNamedParameter4fNV_names, ProgramNamedParameter4fNV_remap_index, -1 }, + { ProgramNamedParameter4fvNV_names, ProgramNamedParameter4fvNV_remap_index, -1 }, + { ProgramNamedParameter4dvNV_names, ProgramNamedParameter4dvNV_remap_index, -1 }, + { ProgramNamedParameter4dNV_names, ProgramNamedParameter4dNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_point_sprite) +static const struct dri_extension_function GL_NV_point_sprite_functions[] = { + { PointParameteriNV_names, PointParameteriNV_remap_index, -1 }, + { PointParameterivNV_names, PointParameterivNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_register_combiners) +static const struct dri_extension_function GL_NV_register_combiners_functions[] = { + { CombinerOutputNV_names, CombinerOutputNV_remap_index, -1 }, + { CombinerParameterfvNV_names, CombinerParameterfvNV_remap_index, -1 }, + { GetCombinerOutputParameterfvNV_names, GetCombinerOutputParameterfvNV_remap_index, -1 }, + { FinalCombinerInputNV_names, FinalCombinerInputNV_remap_index, -1 }, + { GetCombinerInputParameterfvNV_names, GetCombinerInputParameterfvNV_remap_index, -1 }, + { GetCombinerOutputParameterivNV_names, GetCombinerOutputParameterivNV_remap_index, -1 }, + { CombinerParameteriNV_names, CombinerParameteriNV_remap_index, -1 }, + { GetFinalCombinerInputParameterivNV_names, GetFinalCombinerInputParameterivNV_remap_index, -1 }, + { CombinerInputNV_names, CombinerInputNV_remap_index, -1 }, + { CombinerParameterfNV_names, CombinerParameterfNV_remap_index, -1 }, + { GetFinalCombinerInputParameterfvNV_names, GetFinalCombinerInputParameterfvNV_remap_index, -1 }, + { GetCombinerInputParameterivNV_names, GetCombinerInputParameterivNV_remap_index, -1 }, + { CombinerParameterivNV_names, CombinerParameterivNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_register_combiners2) +static const struct dri_extension_function GL_NV_register_combiners2_functions[] = { + { CombinerStageParameterfvNV_names, CombinerStageParameterfvNV_remap_index, -1 }, + { GetCombinerStageParameterfvNV_names, GetCombinerStageParameterfvNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_vertex_array_range) +static const struct dri_extension_function GL_NV_vertex_array_range_functions[] = { + { VertexArrayRangeNV_names, VertexArrayRangeNV_remap_index, -1 }, + { FlushVertexArrayRangeNV_names, FlushVertexArrayRangeNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_NV_vertex_program) +static const struct dri_extension_function GL_NV_vertex_program_functions[] = { + { VertexAttrib4ubvNV_names, VertexAttrib4ubvNV_remap_index, -1 }, + { VertexAttrib4svNV_names, VertexAttrib4svNV_remap_index, -1 }, + { VertexAttribs1dvNV_names, VertexAttribs1dvNV_remap_index, -1 }, + { VertexAttrib1fvNV_names, VertexAttrib1fvNV_remap_index, -1 }, + { VertexAttrib4fNV_names, VertexAttrib4fNV_remap_index, -1 }, + { VertexAttrib2dNV_names, VertexAttrib2dNV_remap_index, -1 }, + { VertexAttrib4ubNV_names, VertexAttrib4ubNV_remap_index, -1 }, + { VertexAttribs3dvNV_names, VertexAttribs3dvNV_remap_index, -1 }, + { VertexAttribs4fvNV_names, VertexAttribs4fvNV_remap_index, -1 }, + { VertexAttrib2sNV_names, VertexAttrib2sNV_remap_index, -1 }, + { VertexAttribs3fvNV_names, VertexAttribs3fvNV_remap_index, -1 }, + { ProgramEnvParameter4fvARB_names, ProgramEnvParameter4fvARB_remap_index, -1 }, + { LoadProgramNV_names, LoadProgramNV_remap_index, -1 }, + { VertexAttrib4fvNV_names, VertexAttrib4fvNV_remap_index, -1 }, + { VertexAttrib3fNV_names, VertexAttrib3fNV_remap_index, -1 }, + { VertexAttribs2dvNV_names, VertexAttribs2dvNV_remap_index, -1 }, + { GetProgramParameterfvNV_names, GetProgramParameterfvNV_remap_index, -1 }, + { VertexAttrib3dNV_names, VertexAttrib3dNV_remap_index, -1 }, + { VertexAttrib2fvNV_names, VertexAttrib2fvNV_remap_index, -1 }, + { VertexAttrib2dvNV_names, VertexAttrib2dvNV_remap_index, -1 }, + { VertexAttrib1dvNV_names, VertexAttrib1dvNV_remap_index, -1 }, + { VertexAttrib1svNV_names, VertexAttrib1svNV_remap_index, -1 }, + { ProgramEnvParameter4fARB_names, ProgramEnvParameter4fARB_remap_index, -1 }, + { VertexAttribs2svNV_names, VertexAttribs2svNV_remap_index, -1 }, + { GetVertexAttribivNV_names, GetVertexAttribivNV_remap_index, -1 }, + { GetVertexAttribfvNV_names, GetVertexAttribfvNV_remap_index, -1 }, + { VertexAttrib2svNV_names, VertexAttrib2svNV_remap_index, -1 }, + { VertexAttribs1fvNV_names, VertexAttribs1fvNV_remap_index, -1 }, + { IsProgramNV_names, IsProgramNV_remap_index, -1 }, + { ProgramEnvParameter4dARB_names, ProgramEnvParameter4dARB_remap_index, -1 }, + { VertexAttrib2fNV_names, VertexAttrib2fNV_remap_index, -1 }, + { RequestResidentProgramsNV_names, RequestResidentProgramsNV_remap_index, -1 }, + { ExecuteProgramNV_names, ExecuteProgramNV_remap_index, -1 }, + { VertexAttribPointerNV_names, VertexAttribPointerNV_remap_index, -1 }, + { TrackMatrixNV_names, TrackMatrixNV_remap_index, -1 }, + { GetProgramParameterdvNV_names, GetProgramParameterdvNV_remap_index, -1 }, + { GetTrackMatrixivNV_names, GetTrackMatrixivNV_remap_index, -1 }, + { VertexAttrib3svNV_names, VertexAttrib3svNV_remap_index, -1 }, + { ProgramParameters4fvNV_names, ProgramParameters4fvNV_remap_index, -1 }, + { GetProgramivNV_names, GetProgramivNV_remap_index, -1 }, + { GetVertexAttribdvNV_names, GetVertexAttribdvNV_remap_index, -1 }, + { VertexAttrib3fvNV_names, VertexAttrib3fvNV_remap_index, -1 }, + { ProgramEnvParameter4dvARB_names, ProgramEnvParameter4dvARB_remap_index, -1 }, + { VertexAttribs2fvNV_names, VertexAttribs2fvNV_remap_index, -1 }, + { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, -1 }, + { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 }, + { GetProgramStringNV_names, GetProgramStringNV_remap_index, -1 }, + { VertexAttrib4sNV_names, VertexAttrib4sNV_remap_index, -1 }, + { VertexAttribs4dvNV_names, VertexAttribs4dvNV_remap_index, -1 }, + { ProgramParameters4dvNV_names, ProgramParameters4dvNV_remap_index, -1 }, + { VertexAttrib3sNV_names, VertexAttrib3sNV_remap_index, -1 }, + { VertexAttrib1fNV_names, VertexAttrib1fNV_remap_index, -1 }, + { VertexAttrib4dNV_names, VertexAttrib4dNV_remap_index, -1 }, + { VertexAttribs4ubvNV_names, VertexAttribs4ubvNV_remap_index, -1 }, + { VertexAttribs3svNV_names, VertexAttribs3svNV_remap_index, -1 }, + { VertexAttrib1sNV_names, VertexAttrib1sNV_remap_index, -1 }, + { BindProgramNV_names, BindProgramNV_remap_index, -1 }, + { AreProgramsResidentNV_names, AreProgramsResidentNV_remap_index, -1 }, + { VertexAttrib3dvNV_names, VertexAttrib3dvNV_remap_index, -1 }, + { VertexAttrib1dNV_names, VertexAttrib1dNV_remap_index, -1 }, + { VertexAttribs4svNV_names, VertexAttribs4svNV_remap_index, -1 }, + { VertexAttribs1svNV_names, VertexAttribs1svNV_remap_index, -1 }, + { GenProgramsNV_names, GenProgramsNV_remap_index, -1 }, + { VertexAttrib4dvNV_names, VertexAttrib4dvNV_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_PGI_misc_hints) +static const struct dri_extension_function GL_PGI_misc_hints_functions[] = { + { HintPGI_names, HintPGI_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_detail_texture) +static const struct dri_extension_function GL_SGIS_detail_texture_functions[] = { + { GetDetailTexFuncSGIS_names, GetDetailTexFuncSGIS_remap_index, -1 }, + { DetailTexFuncSGIS_names, DetailTexFuncSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_fog_function) +static const struct dri_extension_function GL_SGIS_fog_function_functions[] = { + { FogFuncSGIS_names, FogFuncSGIS_remap_index, -1 }, + { GetFogFuncSGIS_names, GetFogFuncSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_multisample) +static const struct dri_extension_function GL_SGIS_multisample_functions[] = { + { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, -1 }, + { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +static const struct dri_extension_function GL_SGIS_pixel_texture_functions[] = { + { PixelTexGenParameterfvSGIS_names, PixelTexGenParameterfvSGIS_remap_index, -1 }, + { GetPixelTexGenParameterivSGIS_names, GetPixelTexGenParameterivSGIS_remap_index, -1 }, + { PixelTexGenParameteriSGIS_names, PixelTexGenParameteriSGIS_remap_index, -1 }, + { PixelTexGenParameterivSGIS_names, PixelTexGenParameterivSGIS_remap_index, -1 }, + { PixelTexGenParameterfSGIS_names, PixelTexGenParameterfSGIS_remap_index, -1 }, + { GetPixelTexGenParameterfvSGIS_names, GetPixelTexGenParameterfvSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_point_parameters) +static const struct dri_extension_function GL_SGIS_point_parameters_functions[] = { + { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, + { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_sharpen_texture) +static const struct dri_extension_function GL_SGIS_sharpen_texture_functions[] = { + { GetSharpenTexFuncSGIS_names, GetSharpenTexFuncSGIS_remap_index, -1 }, + { SharpenTexFuncSGIS_names, SharpenTexFuncSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_texture4D) +static const struct dri_extension_function GL_SGIS_texture4D_functions[] = { + { TexImage4DSGIS_names, TexImage4DSGIS_remap_index, -1 }, + { TexSubImage4DSGIS_names, TexSubImage4DSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_texture_color_mask) +static const struct dri_extension_function GL_SGIS_texture_color_mask_functions[] = { + { TextureColorMaskSGIS_names, TextureColorMaskSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIS_texture_filter4) +static const struct dri_extension_function GL_SGIS_texture_filter4_functions[] = { + { GetTexFilterFuncSGIS_names, GetTexFilterFuncSGIS_remap_index, -1 }, + { TexFilterFuncSGIS_names, TexFilterFuncSGIS_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_async) +static const struct dri_extension_function GL_SGIX_async_functions[] = { + { AsyncMarkerSGIX_names, AsyncMarkerSGIX_remap_index, -1 }, + { FinishAsyncSGIX_names, FinishAsyncSGIX_remap_index, -1 }, + { PollAsyncSGIX_names, PollAsyncSGIX_remap_index, -1 }, + { DeleteAsyncMarkersSGIX_names, DeleteAsyncMarkersSGIX_remap_index, -1 }, + { IsAsyncMarkerSGIX_names, IsAsyncMarkerSGIX_remap_index, -1 }, + { GenAsyncMarkersSGIX_names, GenAsyncMarkersSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_flush_raster) +static const struct dri_extension_function GL_SGIX_flush_raster_functions[] = { + { FlushRasterSGIX_names, FlushRasterSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const struct dri_extension_function GL_SGIX_fragment_lighting_functions[] = { + { FragmentMaterialfvSGIX_names, FragmentMaterialfvSGIX_remap_index, -1 }, + { FragmentLightModelivSGIX_names, FragmentLightModelivSGIX_remap_index, -1 }, + { FragmentLightiSGIX_names, FragmentLightiSGIX_remap_index, -1 }, + { GetFragmentMaterialfvSGIX_names, GetFragmentMaterialfvSGIX_remap_index, -1 }, + { FragmentMaterialfSGIX_names, FragmentMaterialfSGIX_remap_index, -1 }, + { GetFragmentLightivSGIX_names, GetFragmentLightivSGIX_remap_index, -1 }, + { FragmentLightModeliSGIX_names, FragmentLightModeliSGIX_remap_index, -1 }, + { FragmentLightivSGIX_names, FragmentLightivSGIX_remap_index, -1 }, + { GetFragmentMaterialivSGIX_names, GetFragmentMaterialivSGIX_remap_index, -1 }, + { FragmentLightModelfSGIX_names, FragmentLightModelfSGIX_remap_index, -1 }, + { FragmentColorMaterialSGIX_names, FragmentColorMaterialSGIX_remap_index, -1 }, + { FragmentMaterialiSGIX_names, FragmentMaterialiSGIX_remap_index, -1 }, + { LightEnviSGIX_names, LightEnviSGIX_remap_index, -1 }, + { FragmentLightModelfvSGIX_names, FragmentLightModelfvSGIX_remap_index, -1 }, + { FragmentLightfvSGIX_names, FragmentLightfvSGIX_remap_index, -1 }, + { FragmentLightfSGIX_names, FragmentLightfSGIX_remap_index, -1 }, + { GetFragmentLightfvSGIX_names, GetFragmentLightfvSGIX_remap_index, -1 }, + { FragmentMaterialivSGIX_names, FragmentMaterialivSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_framezoom) +static const struct dri_extension_function GL_SGIX_framezoom_functions[] = { + { FrameZoomSGIX_names, FrameZoomSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_igloo_interface) +static const struct dri_extension_function GL_SGIX_igloo_interface_functions[] = { + { IglooInterfaceSGIX_names, IglooInterfaceSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_instruments) +static const struct dri_extension_function GL_SGIX_instruments_functions[] = { + { ReadInstrumentsSGIX_names, ReadInstrumentsSGIX_remap_index, -1 }, + { PollInstrumentsSGIX_names, PollInstrumentsSGIX_remap_index, -1 }, + { GetInstrumentsSGIX_names, GetInstrumentsSGIX_remap_index, -1 }, + { StartInstrumentsSGIX_names, StartInstrumentsSGIX_remap_index, -1 }, + { StopInstrumentsSGIX_names, StopInstrumentsSGIX_remap_index, -1 }, + { InstrumentsBufferSGIX_names, InstrumentsBufferSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const struct dri_extension_function GL_SGIX_list_priority_functions[] = { + { ListParameterfSGIX_names, ListParameterfSGIX_remap_index, -1 }, + { GetListParameterfvSGIX_names, GetListParameterfvSGIX_remap_index, -1 }, + { ListParameteriSGIX_names, ListParameteriSGIX_remap_index, -1 }, + { ListParameterfvSGIX_names, ListParameterfvSGIX_remap_index, -1 }, + { ListParameterivSGIX_names, ListParameterivSGIX_remap_index, -1 }, + { GetListParameterivSGIX_names, GetListParameterivSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_pixel_texture) +static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = { + { PixelTexGenSGIX_names, PixelTexGenSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = { + { LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 }, + { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 }, + { DeformSGIX_names, DeformSGIX_remap_index, -1 }, + { DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_reference_plane) +static const struct dri_extension_function GL_SGIX_reference_plane_functions[] = { + { ReferencePlaneSGIX_names, ReferencePlaneSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_sprite) +static const struct dri_extension_function GL_SGIX_sprite_functions[] = { + { SpriteParameterfvSGIX_names, SpriteParameterfvSGIX_remap_index, -1 }, + { SpriteParameteriSGIX_names, SpriteParameteriSGIX_remap_index, -1 }, + { SpriteParameterfSGIX_names, SpriteParameterfSGIX_remap_index, -1 }, + { SpriteParameterivSGIX_names, SpriteParameterivSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGIX_tag_sample_buffer) +static const struct dri_extension_function GL_SGIX_tag_sample_buffer_functions[] = { + { TagSampleBufferSGIX_names, TagSampleBufferSGIX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SGI_color_table) +static const struct dri_extension_function GL_SGI_color_table_functions[] = { + { ColorTableParameteriv_names, -1, 341 }, + { ColorTable_names, -1, 339 }, + { GetColorTable_names, -1, 343 }, + { CopyColorTable_names, -1, 342 }, + { ColorTableParameterfv_names, -1, 340 }, + { GetColorTableParameterfv_names, -1, 344 }, + { GetColorTableParameteriv_names, -1, 345 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUNX_constant_data) +static const struct dri_extension_function GL_SUNX_constant_data_functions[] = { + { FinishTextureSUNX_names, FinishTextureSUNX_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const struct dri_extension_function GL_SUN_global_alpha_functions[] = { + { GlobalAlphaFactorubSUN_names, GlobalAlphaFactorubSUN_remap_index, -1 }, + { GlobalAlphaFactoriSUN_names, GlobalAlphaFactoriSUN_remap_index, -1 }, + { GlobalAlphaFactordSUN_names, GlobalAlphaFactordSUN_remap_index, -1 }, + { GlobalAlphaFactoruiSUN_names, GlobalAlphaFactoruiSUN_remap_index, -1 }, + { GlobalAlphaFactorbSUN_names, GlobalAlphaFactorbSUN_remap_index, -1 }, + { GlobalAlphaFactorfSUN_names, GlobalAlphaFactorfSUN_remap_index, -1 }, + { GlobalAlphaFactorusSUN_names, GlobalAlphaFactorusSUN_remap_index, -1 }, + { GlobalAlphaFactorsSUN_names, GlobalAlphaFactorsSUN_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUN_mesh_array) +static const struct dri_extension_function GL_SUN_mesh_array_functions[] = { + { DrawMeshArraysSUN_names, DrawMeshArraysSUN_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const struct dri_extension_function GL_SUN_triangle_list_functions[] = { + { ReplacementCodeubSUN_names, ReplacementCodeubSUN_remap_index, -1 }, + { ReplacementCodeubvSUN_names, ReplacementCodeubvSUN_remap_index, -1 }, + { ReplacementCodeusvSUN_names, ReplacementCodeusvSUN_remap_index, -1 }, + { ReplacementCodePointerSUN_names, ReplacementCodePointerSUN_remap_index, -1 }, + { ReplacementCodeusSUN_names, ReplacementCodeusSUN_remap_index, -1 }, + { ReplacementCodeuiSUN_names, ReplacementCodeuiSUN_remap_index, -1 }, + { ReplacementCodeuivSUN_names, ReplacementCodeuivSUN_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_SUN_vertex) +static const struct dri_extension_function GL_SUN_vertex_functions[] = { + { ReplacementCodeuiColor3fVertex3fvSUN_names, ReplacementCodeuiColor3fVertex3fvSUN_remap_index, -1 }, + { TexCoord4fColor4fNormal3fVertex4fvSUN_names, TexCoord4fColor4fNormal3fVertex4fvSUN_remap_index, -1 }, + { TexCoord2fColor4ubVertex3fvSUN_names, TexCoord2fColor4ubVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiVertex3fvSUN_names, ReplacementCodeuiVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiNormal3fVertex3fSUN_names, ReplacementCodeuiNormal3fVertex3fSUN_remap_index, -1 }, + { Color4ubVertex3fvSUN_names, Color4ubVertex3fvSUN_remap_index, -1 }, + { Color4ubVertex3fSUN_names, Color4ubVertex3fSUN_remap_index, -1 }, + { TexCoord2fVertex3fSUN_names, TexCoord2fVertex3fSUN_remap_index, -1 }, + { TexCoord2fColor4fNormal3fVertex3fSUN_names, TexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 }, + { TexCoord2fNormal3fVertex3fvSUN_names, TexCoord2fNormal3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fVertex3fSUN_names, ReplacementCodeuiTexCoord2fVertex3fSUN_remap_index, -1 }, + { TexCoord2fNormal3fVertex3fSUN_names, TexCoord2fNormal3fVertex3fSUN_remap_index, -1 }, + { Color3fVertex3fSUN_names, Color3fVertex3fSUN_remap_index, -1 }, + { Color3fVertex3fvSUN_names, Color3fVertex3fvSUN_remap_index, -1 }, + { Color4fNormal3fVertex3fvSUN_names, Color4fNormal3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_remap_index, -1 }, + { TexCoord2fColor3fVertex3fSUN_names, TexCoord2fColor3fVertex3fSUN_remap_index, -1 }, + { TexCoord4fColor4fNormal3fVertex4fSUN_names, TexCoord4fColor4fNormal3fVertex4fSUN_remap_index, -1 }, + { Color4ubVertex2fvSUN_names, Color4ubVertex2fvSUN_remap_index, -1 }, + { Normal3fVertex3fSUN_names, Normal3fVertex3fSUN_remap_index, -1 }, + { ReplacementCodeuiColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fSUN_remap_index, -1 }, + { TexCoord2fColor4fNormal3fVertex3fvSUN_names, TexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 }, + { TexCoord2fVertex3fvSUN_names, TexCoord2fVertex3fvSUN_remap_index, -1 }, + { Color4ubVertex2fSUN_names, Color4ubVertex2fSUN_remap_index, -1 }, + { ReplacementCodeuiColor4ubVertex3fSUN_names, ReplacementCodeuiColor4ubVertex3fSUN_remap_index, -1 }, + { TexCoord2fColor4ubVertex3fSUN_names, TexCoord2fColor4ubVertex3fSUN_remap_index, -1 }, + { Normal3fVertex3fvSUN_names, Normal3fVertex3fvSUN_remap_index, -1 }, + { Color4fNormal3fVertex3fSUN_names, Color4fNormal3fVertex3fSUN_remap_index, -1 }, + { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 }, + { ReplacementCodeuiColor4ubVertex3fvSUN_names, ReplacementCodeuiColor4ubVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiColor3fVertex3fSUN_names, ReplacementCodeuiColor3fVertex3fSUN_remap_index, -1 }, + { TexCoord4fVertex4fSUN_names, TexCoord4fVertex4fSUN_remap_index, -1 }, + { TexCoord2fColor3fVertex3fvSUN_names, TexCoord2fColor3fVertex3fvSUN_remap_index, -1 }, + { ReplacementCodeuiNormal3fVertex3fvSUN_names, ReplacementCodeuiNormal3fVertex3fvSUN_remap_index, -1 }, + { TexCoord4fVertex4fvSUN_names, TexCoord4fVertex4fvSUN_remap_index, -1 }, + { ReplacementCodeuiVertex3fSUN_names, ReplacementCodeuiVertex3fSUN_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_1_3) +static const struct dri_extension_function GL_VERSION_1_3_functions[] = { + { SampleCoverageARB_names, SampleCoverageARB_remap_index, -1 }, + { MultiTexCoord3sARB_names, -1, 398 }, + { ActiveTextureARB_names, -1, 374 }, + { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, -1 }, + { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, -1 }, + { MultiTexCoord1fvARB_names, -1, 379 }, + { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, -1 }, + { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, -1 }, + { MultiTexCoord3dARB_names, -1, 392 }, + { MultiTexCoord2iARB_names, -1, 388 }, + { MultiTexCoord2svARB_names, -1, 391 }, + { MultiTexCoord2fARB_names, -1, 386 }, + { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, -1 }, + { MultiTexCoord3fvARB_names, -1, 395 }, + { MultiTexCoord4sARB_names, -1, 406 }, + { MultiTexCoord2dvARB_names, -1, 385 }, + { MultiTexCoord1svARB_names, -1, 383 }, + { MultiTexCoord3svARB_names, -1, 399 }, + { MultiTexCoord4iARB_names, -1, 404 }, + { MultiTexCoord3iARB_names, -1, 396 }, + { MultiTexCoord1dARB_names, -1, 376 }, + { MultiTexCoord3dvARB_names, -1, 393 }, + { MultiTexCoord3ivARB_names, -1, 397 }, + { MultiTexCoord2sARB_names, -1, 390 }, + { MultiTexCoord4ivARB_names, -1, 405 }, + { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, -1 }, + { ClientActiveTextureARB_names, -1, 375 }, + { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, -1 }, + { MultiTexCoord2dARB_names, -1, 384 }, + { MultiTexCoord4dvARB_names, -1, 401 }, + { MultiTexCoord4fvARB_names, -1, 403 }, + { MultiTexCoord3fARB_names, -1, 394 }, + { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, -1 }, + { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, -1 }, + { MultiTexCoord4dARB_names, -1, 400 }, + { MultiTexCoord1sARB_names, -1, 382 }, + { MultiTexCoord1dvARB_names, -1, 377 }, + { MultiTexCoord1ivARB_names, -1, 381 }, + { MultiTexCoord2ivARB_names, -1, 389 }, + { MultiTexCoord1iARB_names, -1, 380 }, + { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, -1 }, + { MultiTexCoord4svARB_names, -1, 407 }, + { MultiTexCoord1fARB_names, -1, 378 }, + { MultiTexCoord4fARB_names, -1, 402 }, + { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, -1 }, + { MultiTexCoord2fvARB_names, -1, 387 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_1_4) +static const struct dri_extension_function GL_VERSION_1_4_functions[] = { + { PointParameteriNV_names, PointParameteriNV_remap_index, -1 }, + { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, -1 }, + { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 }, + { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 }, + { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, -1 }, + { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, + { FogCoorddEXT_names, FogCoorddEXT_remap_index, -1 }, + { FogCoordfEXT_names, FogCoordfEXT_remap_index, -1 }, + { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 }, + { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 }, + { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, + { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 }, + { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, -1 }, + { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, -1 }, + { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, -1 }, + { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 }, + { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, -1 }, + { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, -1 }, + { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, -1 }, + { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 }, + { PointParameterivNV_names, PointParameterivNV_remap_index, -1 }, + { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 }, + { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, -1 }, + { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 }, + { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, -1 }, + { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 }, + { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 }, + { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, -1 }, + { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 }, + { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, -1 }, + { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, -1 }, + { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, -1 }, + { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 }, + { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, -1 }, + { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, -1 }, + { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, -1 }, + { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, -1 }, + { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, -1 }, + { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 }, + { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, -1 }, + { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 }, + { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, -1 }, + { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, -1 }, + { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 }, + { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_1_5) +static const struct dri_extension_function GL_VERSION_1_5_functions[] = { + { BeginQueryARB_names, BeginQueryARB_remap_index, -1 }, + { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, -1 }, + { BufferSubDataARB_names, BufferSubDataARB_remap_index, -1 }, + { GetQueryivARB_names, GetQueryivARB_remap_index, -1 }, + { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, -1 }, + { BufferDataARB_names, BufferDataARB_remap_index, -1 }, + { EndQueryARB_names, EndQueryARB_remap_index, -1 }, + { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, -1 }, + { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, -1 }, + { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, -1 }, + { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, -1 }, + { IsQueryARB_names, IsQueryARB_remap_index, -1 }, + { MapBufferARB_names, MapBufferARB_remap_index, -1 }, + { GenQueriesARB_names, GenQueriesARB_remap_index, -1 }, + { IsBufferARB_names, IsBufferARB_remap_index, -1 }, + { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, -1 }, + { UnmapBufferARB_names, UnmapBufferARB_remap_index, -1 }, + { BindBufferARB_names, BindBufferARB_remap_index, -1 }, + { GenBuffersARB_names, GenBuffersARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_2_0) +static const struct dri_extension_function GL_VERSION_2_0_functions[] = { + { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, -1 }, + { GetProgramiv_names, GetProgramiv_remap_index, -1 }, + { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 }, + { AttachShader_names, AttachShader_remap_index, -1 }, + { VertexAttrib2fARB_names, VertexAttrib2fARB_remap_index, -1 }, + { VertexAttrib3fARB_names, VertexAttrib3fARB_remap_index, -1 }, + { Uniform2fARB_names, Uniform2fARB_remap_index, -1 }, + { VertexAttrib1svARB_names, VertexAttrib1svARB_remap_index, -1 }, + { Uniform2ivARB_names, Uniform2ivARB_remap_index, -1 }, + { UniformMatrix4fvARB_names, UniformMatrix4fvARB_remap_index, -1 }, + { VertexAttrib4NusvARB_names, VertexAttrib4NusvARB_remap_index, -1 }, + { DisableVertexAttribArrayARB_names, DisableVertexAttribArrayARB_remap_index, -1 }, + { StencilMaskSeparate_names, StencilMaskSeparate_remap_index, -1 }, + { VertexAttrib1fARB_names, VertexAttrib1fARB_remap_index, -1 }, + { GetProgramInfoLog_names, GetProgramInfoLog_remap_index, -1 }, + { VertexAttrib4NbvARB_names, VertexAttrib4NbvARB_remap_index, -1 }, + { GetActiveAttribARB_names, GetActiveAttribARB_remap_index, -1 }, + { Uniform3iARB_names, Uniform3iARB_remap_index, -1 }, + { GetShaderInfoLog_names, GetShaderInfoLog_remap_index, -1 }, + { VertexAttrib1sARB_names, VertexAttrib1sARB_remap_index, -1 }, + { Uniform1fARB_names, Uniform1fARB_remap_index, -1 }, + { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 }, + { UniformMatrix2fvARB_names, UniformMatrix2fvARB_remap_index, -1 }, + { VertexAttrib3dvARB_names, VertexAttrib3dvARB_remap_index, -1 }, + { Uniform3fvARB_names, Uniform3fvARB_remap_index, -1 }, + { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 }, + { CreateProgram_names, CreateProgram_remap_index, -1 }, + { StencilFuncSeparate_names, StencilFuncSeparate_remap_index, -1 }, + { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 }, + { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 }, + { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 }, + { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 }, + { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 }, + { GetActiveUniformARB_names, GetActiveUniformARB_remap_index, -1 }, + { IsShader_names, IsShader_remap_index, -1 }, + { GetUniformivARB_names, GetUniformivARB_remap_index, -1 }, + { IsProgram_names, IsProgram_remap_index, -1 }, + { Uniform2fvARB_names, Uniform2fvARB_remap_index, -1 }, + { ValidateProgramARB_names, ValidateProgramARB_remap_index, -1 }, + { VertexAttrib2dARB_names, VertexAttrib2dARB_remap_index, -1 }, + { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 }, + { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 }, + { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 }, + { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 }, + { Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 }, + { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 }, + { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 }, + { VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, -1 }, + { VertexAttrib4NivARB_names, VertexAttrib4NivARB_remap_index, -1 }, + { GetAttachedShaders_names, GetAttachedShaders_remap_index, -1 }, + { CompileShaderARB_names, CompileShaderARB_remap_index, -1 }, + { DeleteShader_names, DeleteShader_remap_index, -1 }, + { Uniform3fARB_names, Uniform3fARB_remap_index, -1 }, + { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 }, + { Uniform4fARB_names, Uniform4fARB_remap_index, -1 }, + { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 }, + { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 }, + { LinkProgramARB_names, LinkProgramARB_remap_index, -1 }, + { ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 }, + { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 }, + { Uniform4ivARB_names, Uniform4ivARB_remap_index, -1 }, + { GetVertexAttribdvARB_names, GetVertexAttribdvARB_remap_index, -1 }, + { Uniform1ivARB_names, Uniform1ivARB_remap_index, -1 }, + { VertexAttrib4dvARB_names, VertexAttrib4dvARB_remap_index, -1 }, + { BindAttribLocationARB_names, BindAttribLocationARB_remap_index, -1 }, + { Uniform1iARB_names, Uniform1iARB_remap_index, -1 }, + { VertexAttribPointerARB_names, VertexAttribPointerARB_remap_index, -1 }, + { VertexAttrib4NsvARB_names, VertexAttrib4NsvARB_remap_index, -1 }, + { VertexAttrib3fvARB_names, VertexAttrib3fvARB_remap_index, -1 }, + { CreateShader_names, CreateShader_remap_index, -1 }, + { DetachShader_names, DetachShader_remap_index, -1 }, + { VertexAttrib4NubARB_names, VertexAttrib4NubARB_remap_index, -1 }, + { Uniform4fvARB_names, Uniform4fvARB_remap_index, -1 }, + { GetUniformfvARB_names, GetUniformfvARB_remap_index, -1 }, + { Uniform4iARB_names, Uniform4iARB_remap_index, -1 }, + { UseProgramObjectARB_names, UseProgramObjectARB_remap_index, -1 }, + { DeleteProgram_names, DeleteProgram_remap_index, -1 }, + { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 }, + { Uniform2iARB_names, Uniform2iARB_remap_index, -1 }, + { VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, -1 }, + { GetUniformLocationARB_names, GetUniformLocationARB_remap_index, -1 }, + { VertexAttrib3sARB_names, VertexAttrib3sARB_remap_index, -1 }, + { GetShaderSourceARB_names, GetShaderSourceARB_remap_index, -1 }, + { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, + { Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 }, + { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 }, + { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 }, + { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 }, + { GetShaderiv_names, GetShaderiv_remap_index, -1 }, + { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 }, + { VertexAttrib4NubvARB_names, VertexAttrib4NubvARB_remap_index, -1 }, + { VertexAttrib2sARB_names, VertexAttrib2sARB_remap_index, -1 }, + { VertexAttrib1fvARB_names, VertexAttrib1fvARB_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + +#if defined(need_GL_VERSION_2_1) +static const struct dri_extension_function GL_VERSION_2_1_functions[] = { + { UniformMatrix2x4fv_names, UniformMatrix2x4fv_remap_index, -1 }, + { UniformMatrix4x3fv_names, UniformMatrix4x3fv_remap_index, -1 }, + { UniformMatrix4x2fv_names, UniformMatrix4x2fv_remap_index, -1 }, + { UniformMatrix2x3fv_names, UniformMatrix2x3fv_remap_index, -1 }, + { UniformMatrix3x4fv_names, UniformMatrix3x4fv_remap_index, -1 }, + { UniformMatrix3x2fv_names, UniformMatrix3x2fv_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + diff --git a/mesalib/src/mesa/drivers/dri/common/memops.h b/mesalib/src/mesa/drivers/dri/common/memops.h new file mode 100644 index 000000000..9cd1d8ec3 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/memops.h @@ -0,0 +1,17 @@ +#ifndef DRIMEMSETIO_H +#define DRIMEMSETIO_H +/* +* memset an area in I/O space +* We need to be careful about this on some archs +*/ +static INLINE void drimemsetio(void* address, int c, int size) +{ +#if defined(__powerpc__) || defined(__ia64__) + int i; + for(i=0;i + */ + + +#ifndef MMIO_H +#define MMIO_H + +#include "main/glheader.h" + +#if defined( __powerpc__ ) + +static INLINE uint32_t +read_MMIO_LE32( volatile void * base, unsigned long offset ) +{ + uint32_t val; + + __asm__ __volatile__( "lwbrx %0, %1, %2 ; eieio" + : "=r" (val) + : "b" (base), "r" (offset) ); + return val; +} + +#else + +static INLINE uint32_t +read_MMIO_LE32( volatile void * base, unsigned long offset ) +{ + volatile uint32_t * p = (volatile uint32_t *) (((volatile char *) base) + offset); + return LE32_TO_CPU( p[0] ); +} + +#endif + +#endif /* MMIO_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/mmx.h b/mesalib/src/mesa/drivers/dri/common/mmx.h new file mode 100644 index 000000000..49ce7e3e3 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/mmx.h @@ -0,0 +1,560 @@ +/* mmx.h + + MultiMedia eXtensions GCC interface library for IA32. + + To use this library, simply include this header file + and compile with GCC. You MUST have inlining enabled + in order for mmx_ok() to work; this can be done by + simply using -O on the GCC command line. + + Compiling with -DMMX_TRACE will cause detailed trace + output to be sent to stderr for each mmx operation. + This adds lots of code, and obviously slows execution to + a crawl, but can be very useful for debugging. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT + LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR ANY PARTICULAR PURPOSE. + + 1997-98 by H. Dietz and R. Fisher + + History: + 97-98* R.Fisher Early versions + 980501 R.Fisher Original Release + 980611* H.Dietz Rewrite, correctly implementing inlines, and + R.Fisher including direct register accesses. + 980616 R.Fisher Release of 980611 as 980616. + 980714 R.Fisher Minor corrections to Makefile, etc. + 980715 R.Fisher mmx_ok() now prevents optimizer from using + clobbered values. + mmx_ok() now checks if cpuid instruction is + available before trying to use it. + 980726* R.Fisher mm_support() searches for AMD 3DNow, Cyrix + Extended MMX, and standard MMX. It returns a + value which is positive if any of these are + supported, and can be masked with constants to + see which. mmx_ok() is now a call to this + 980726* R.Fisher Added i2r support for shift functions + 980919 R.Fisher Fixed AMD extended feature recognition bug. + 980921 R.Fisher Added definition/check for _MMX_H. + Added "float s[2]" to mmx_t for use with + 3DNow and EMMX. So same mmx_t can be used. + 981013 R.Fisher Fixed cpuid function 1 bug (looked at wrong reg) + Fixed psllq_i2r error in mmxtest.c + + * Unreleased (internal or interim) versions + + Notes: + It appears that the latest gas has the pand problem fixed, therefore + I'll undefine BROKEN_PAND by default. + String compares may be quicker than the multiple test/jumps in vendor + test sequence in mmx_ok(), but I'm not concerned with that right now. + + Acknowledgments: + Jussi Laako for pointing out the errors ultimately found to be + connected to the failure to notify the optimizer of clobbered values. + Roger Hardiman for reminding us that CPUID isn't everywhere, and that + someone may actually try to use this on a machine without CPUID. + Also for suggesting code for checking this. + Robert Dale for pointing out the AMD recognition bug. + Jimmy Mayfield and Carl Witty for pointing out the Intel recognition + bug. + Carl Witty for pointing out the psllq_i2r test bug. +*/ + +#ifndef _MMX_H +#define _MMX_H + +//#define MMX_TRACE + +/* Warning: at this writing, the version of GAS packaged + with most Linux distributions does not handle the + parallel AND operation mnemonic correctly. If the + symbol BROKEN_PAND is defined, a slower alternative + coding will be used. If execution of mmxtest results + in an illegal instruction fault, define this symbol. +*/ +#undef BROKEN_PAND + + +/* The type of an value that fits in an MMX register + (note that long long constant values MUST be suffixed + by LL and unsigned long long values by ULL, lest + they be truncated by the compiler) +*/ +typedef union { + long long q; /* Quadword (64-bit) value */ + unsigned long long uq; /* Unsigned Quadword */ + int d[2]; /* 2 Doubleword (32-bit) values */ + unsigned int ud[2]; /* 2 Unsigned Doubleword */ + short w[4]; /* 4 Word (16-bit) values */ + unsigned short uw[4]; /* 4 Unsigned Word */ + char b[8]; /* 8 Byte (8-bit) values */ + unsigned char ub[8]; /* 8 Unsigned Byte */ + float s[2]; /* Single-precision (32-bit) value */ +} mmx_t; + +/* Helper functions for the instruction macros that follow... + (note that memory-to-register, m2r, instructions are nearly + as efficient as register-to-register, r2r, instructions; + however, memory-to-memory instructions are really simulated + as a convenience, and are only 1/3 as efficient) +*/ +#ifdef MMX_TRACE + +/* Include the stuff for printing a trace to stderr... +*/ + +#include + +#define mmx_i2r(op, imm, reg) \ + { \ + mmx_t mmx_trace; \ + mmx_trace = (imm); \ + fprintf(stderr, #op "_i2r(" #imm "=0x%016llx, ", mmx_trace.q); \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ (#op " %0, %%" #reg \ + : /* nothing */ \ + : "X" (imm)); \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \ + } + +#define mmx_m2r(op, mem, reg) \ + { \ + mmx_t mmx_trace; \ + mmx_trace = (mem); \ + fprintf(stderr, #op "_m2r(" #mem "=0x%016llx, ", mmx_trace.q); \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #reg "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ (#op " %0, %%" #reg \ + : /* nothing */ \ + : "X" (mem)); \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #reg "=0x%016llx\n", mmx_trace.q); \ + } + +#define mmx_r2m(op, reg, mem) \ + { \ + mmx_t mmx_trace; \ + __asm__ __volatile__ ("movq %%" #reg ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #op "_r2m(" #reg "=0x%016llx, ", mmx_trace.q); \ + mmx_trace = (mem); \ + fprintf(stderr, #mem "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ (#op " %%" #reg ", %0" \ + : "=X" (mem) \ + : /* nothing */ ); \ + mmx_trace = (mem); \ + fprintf(stderr, #mem "=0x%016llx\n", mmx_trace.q); \ + } + +#define mmx_r2r(op, regs, regd) \ + { \ + mmx_t mmx_trace; \ + __asm__ __volatile__ ("movq %%" #regs ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #op "_r2r(" #regs "=0x%016llx, ", mmx_trace.q); \ + __asm__ __volatile__ ("movq %%" #regd ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #regd "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ (#op " %" #regs ", %" #regd); \ + __asm__ __volatile__ ("movq %%" #regd ", %0" \ + : "=X" (mmx_trace) \ + : /* nothing */ ); \ + fprintf(stderr, #regd "=0x%016llx\n", mmx_trace.q); \ + } + +#define mmx_m2m(op, mems, memd) \ + { \ + mmx_t mmx_trace; \ + mmx_trace = (mems); \ + fprintf(stderr, #op "_m2m(" #mems "=0x%016llx, ", mmx_trace.q); \ + mmx_trace = (memd); \ + fprintf(stderr, #memd "=0x%016llx) => ", mmx_trace.q); \ + __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ + #op " %1, %%mm0\n\t" \ + "movq %%mm0, %0" \ + : "=X" (memd) \ + : "X" (mems)); \ + mmx_trace = (memd); \ + fprintf(stderr, #memd "=0x%016llx\n", mmx_trace.q); \ + } + +#else + +/* These macros are a lot simpler without the tracing... +*/ + +#define mmx_i2r(op, imm, reg) \ + __asm__ __volatile__ (#op " $" #imm ", %%" #reg \ + : /* nothing */ \ + : /* nothing */); + +#define mmx_m2r(op, mem, reg) \ + __asm__ __volatile__ (#op " %0, %%" #reg \ + : /* nothing */ \ + : "X" (mem)) + +#define mmx_r2m(op, reg, mem) \ + __asm__ __volatile__ (#op " %%" #reg ", %0" \ + : "=X" (mem) \ + : /* nothing */ ) + +#define mmx_r2r(op, regs, regd) \ + __asm__ __volatile__ (#op " %" #regs ", %" #regd) + +#define mmx_m2m(op, mems, memd) \ + __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ + #op " %1, %%mm0\n\t" \ + "movq %%mm0, %0" \ + : "=X" (memd) \ + : "X" (mems)) + +#endif + + +/* 1x64 MOVe Quadword + (this is both a load and a store... + in fact, it is the only way to store) +*/ +#define movq_m2r(var, reg) mmx_m2r(movq, var, reg) +#define movq_r2m(reg, var) mmx_r2m(movq, reg, var) +#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd) +#define movq(vars, vard) \ + __asm__ __volatile__ ("movq %1, %%mm0\n\t" \ + "movq %%mm0, %0" \ + : "=X" (vard) \ + : "X" (vars)) + + +/* 1x32 MOVe Doubleword + (like movq, this is both load and store... + but is most useful for moving things between + mmx registers and ordinary registers) +*/ +#define movd_m2r(var, reg) mmx_m2r(movd, var, reg) +#define movd_r2m(reg, var) mmx_r2m(movd, reg, var) +#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd) +#define movd(vars, vard) \ + __asm__ __volatile__ ("movd %1, %%mm0\n\t" \ + "movd %%mm0, %0" \ + : "=X" (vard) \ + : "X" (vars)) + + +/* 2x32, 4x16, and 8x8 Parallel ADDs +*/ +#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg) +#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd) +#define paddd(vars, vard) mmx_m2m(paddd, vars, vard) + +#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg) +#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd) +#define paddw(vars, vard) mmx_m2m(paddw, vars, vard) + +#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg) +#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd) +#define paddb(vars, vard) mmx_m2m(paddb, vars, vard) + + +/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic +*/ +#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg) +#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd) +#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard) + +#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg) +#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd) +#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard) + + +/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic +*/ +#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg) +#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd) +#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard) + +#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg) +#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd) +#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard) + + +/* 2x32, 4x16, and 8x8 Parallel SUBs +*/ +#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg) +#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd) +#define psubd(vars, vard) mmx_m2m(psubd, vars, vard) + +#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg) +#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd) +#define psubw(vars, vard) mmx_m2m(psubw, vars, vard) + +#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg) +#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd) +#define psubb(vars, vard) mmx_m2m(psubb, vars, vard) + + +/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic +*/ +#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg) +#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd) +#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard) + +#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg) +#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd) +#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard) + + +/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic +*/ +#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg) +#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd) +#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard) + +#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg) +#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd) +#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard) + + +/* 4x16 Parallel MULs giving Low 4x16 portions of results +*/ +#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg) +#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd) +#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard) + + +/* 4x16 Parallel MULs giving High 4x16 portions of results +*/ +#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg) +#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd) +#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard) + + +/* 4x16->2x32 Parallel Mul-ADD + (muls like pmullw, then adds adjacent 16-bit fields + in the multiply result to make the final 2x32 result) +*/ +#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg) +#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd) +#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard) + + +/* 1x64 bitwise AND +*/ +#ifdef BROKEN_PAND +#define pand_m2r(var, reg) \ + { \ + mmx_m2r(pandn, (mmx_t) -1LL, reg); \ + mmx_m2r(pandn, var, reg); \ + } +#define pand_r2r(regs, regd) \ + { \ + mmx_m2r(pandn, (mmx_t) -1LL, regd); \ + mmx_r2r(pandn, regs, regd) \ + } +#define pand(vars, vard) \ + { \ + movq_m2r(vard, mm0); \ + mmx_m2r(pandn, (mmx_t) -1LL, mm0); \ + mmx_m2r(pandn, vars, mm0); \ + movq_r2m(mm0, vard); \ + } +#else +#define pand_m2r(var, reg) mmx_m2r(pand, var, reg) +#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd) +#define pand(vars, vard) mmx_m2m(pand, vars, vard) +#endif + + +/* 1x64 bitwise AND with Not the destination +*/ +#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg) +#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd) +#define pandn(vars, vard) mmx_m2m(pandn, vars, vard) + + +/* 1x64 bitwise OR +*/ +#define por_m2r(var, reg) mmx_m2r(por, var, reg) +#define por_r2r(regs, regd) mmx_r2r(por, regs, regd) +#define por(vars, vard) mmx_m2m(por, vars, vard) + + +/* 1x64 bitwise eXclusive OR +*/ +#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg) +#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd) +#define pxor(vars, vard) mmx_m2m(pxor, vars, vard) + + +/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality + (resulting fields are either 0 or -1) +*/ +#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg) +#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd) +#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard) + +#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg) +#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd) +#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard) + +#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg) +#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd) +#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard) + + +/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than + (resulting fields are either 0 or -1) +*/ +#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg) +#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd) +#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard) + +#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg) +#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd) +#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard) + +#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg) +#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd) +#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard) + + +/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical +*/ +#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg) +#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg) +#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd) +#define psllq(vars, vard) mmx_m2m(psllq, vars, vard) + +#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg) +#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg) +#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd) +#define pslld(vars, vard) mmx_m2m(pslld, vars, vard) + +#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg) +#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg) +#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd) +#define psllw(vars, vard) mmx_m2m(psllw, vars, vard) + + +/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical +*/ +#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg) +#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg) +#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd) +#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard) + +#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg) +#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg) +#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd) +#define psrld(vars, vard) mmx_m2m(psrld, vars, vard) + +#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg) +#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg) +#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd) +#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard) + + +/* 2x32 and 4x16 Parallel Shift Right Arithmetic +*/ +#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg) +#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg) +#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd) +#define psrad(vars, vard) mmx_m2m(psrad, vars, vard) + +#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg) +#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg) +#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd) +#define psraw(vars, vard) mmx_m2m(psraw, vars, vard) + + +/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate + (packs source and dest fields into dest in that order) +*/ +#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg) +#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd) +#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard) + +#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg) +#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd) +#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard) + + +/* 4x16->8x8 PACK and Unsigned Saturate + (packs source and dest fields into dest in that order) +*/ +#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg) +#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd) +#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard) + + +/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low + (interleaves low half of dest with low half of source + as padding in each result field) +*/ +#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg) +#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd) +#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard) + +#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg) +#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd) +#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard) + +#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg) +#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd) +#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard) + + +/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High + (interleaves high half of dest with high half of source + as padding in each result field) +*/ +#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg) +#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd) +#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard) + +#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg) +#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd) +#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard) + +#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg) +#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd) +#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard) + + +/* Empty MMx State + (used to clean-up when going from mmx to float use + of the registers that are shared by both; note that + there is no float-to-mmx operation needed, because + only the float tag word info is corruptible) +*/ +#ifdef MMX_TRACE + +#define emms() \ + { \ + fprintf(stderr, "emms()\n"); \ + __asm__ __volatile__ ("emms"); \ + } + +#else + +#define emms() __asm__ __volatile__ ("emms") + +#endif + +#endif + diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp.h b/mesalib/src/mesa/drivers/dri/common/spantmp.h new file mode 100644 index 000000000..d5608b880 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/spantmp.h @@ -0,0 +1,338 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (C) Copyright IBM Corporation 2002, 2003 + * 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 + * on 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 + * VA LINUX SYSTEM, IBM AND/OR THEIR 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 + * Gareth Hughes + */ + +#include "spantmp_common.h" + +#ifndef DBG +#define DBG 0 +#endif + +#ifndef HW_READ_CLIPLOOP +#define HW_READ_CLIPLOOP() HW_CLIPLOOP() +#endif + +#ifndef HW_WRITE_CLIPLOOP +#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP() +#endif + + +static void TAG(WriteRGBASpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; + GLint x1; + GLint n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + HW_WRITE_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3] ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3] ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + +static void TAG(WriteRGBSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; + GLint x1; + GLint n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + HW_WRITE_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + +static void TAG(WriteRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; + GLuint i; + LOCAL_VARS; + + if (DBG) fprintf(stderr, "WriteRGBAPixels\n"); + + HW_WRITE_CLIPLOOP() + { + if (mask) + { + for (i=0;i0;i++,x1++,n1--) + if (mask[i]) + WRITE_PIXEL( x1, y, p ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_PIXEL( x1, y, p ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + + +static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + const void *value, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte *color = (const GLubyte *) value; + GLuint i; + LOCAL_VARS; + INIT_MONO_PIXEL(p, color); + + if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n"); + + HW_WRITE_CLIPLOOP() + { + if (mask) + { + for (i=0;i0;i++,x1++,n1--) + READ_RGBA( rgba[i], x1, y ); + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +} + + +static void TAG(ReadRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + void *values ) +{ + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + const GLubyte *mask = NULL; /* remove someday */ + GLuint i; + LOCAL_VARS; + + if (DBG) fprintf(stderr, "ReadRGBAPixels\n"); + + HW_READ_CLIPLOOP() + { + if (mask) + { + for (i=0;iPutRow = TAG(WriteRGBASpan); + rb->PutRowRGB = TAG(WriteRGBSpan); + rb->PutMonoRow = TAG(WriteMonoRGBASpan); + rb->PutValues = TAG(WriteRGBAPixels); + rb->PutMonoValues = TAG(WriteMonoRGBAPixels); + rb->GetValues = TAG(ReadRGBAPixels); + rb->GetRow = TAG(ReadRGBASpan); +} + + +#undef WRITE_PIXEL +#undef WRITE_RGBA +#undef READ_RGBA +#undef TAG diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp2.h b/mesalib/src/mesa/drivers/dri/common/spantmp2.h new file mode 100644 index 000000000..89c815722 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/spantmp2.h @@ -0,0 +1,686 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (C) Copyright IBM Corporation 2004 + * 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 + * on 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 + * VA LINUX SYSTEM, IBM AND/OR THEIR 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. + */ + +/** + * \file spantmp2.h + * + * Template file of span read / write functions. + * + * \author Keith Whitwell + * \author Gareth Hughes + * \author Ian Romanick + */ + +#include "main/colormac.h" +#include "spantmp_common.h" + +#ifndef DBG +#define DBG 0 +#endif + +#ifndef HW_READ_CLIPLOOP +#define HW_READ_CLIPLOOP() HW_CLIPLOOP() +#endif + +#ifndef HW_WRITE_CLIPLOOP +#define HW_WRITE_CLIPLOOP() HW_CLIPLOOP() +#endif + +#if (SPANTMP_PIXEL_FMT == GL_RGB) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5) + +/** + ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5 + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_565( color[0], color[1], color[2] ) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, ((((int)r & 0xf8) << 8) | \ + (((int)g & 0xfc) << 3) | \ + (((int)b & 0xf8) >> 3))) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \ + rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \ + rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + rgba[3] = 0xff; \ + } while (0) + +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4_REV) + +/** + ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_4444(color[3], color[0], color[1], color[2]) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, PACK_COLOR_4444(a, r, g, b)) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = ((p >> 8) & 0xf) * 0x11; \ + rgba[1] = ((p >> 4) & 0xf) * 0x11; \ + rgba[2] = ((p >> 0) & 0xf) * 0x11; \ + rgba[3] = ((p >> 12) & 0xf) * 0x11; \ + } while (0) + + +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5_REV) + +/** + ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_1555(color[3], color[0], color[1], color[2]) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, PACK_COLOR_1555(a, r, g, b)) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8; \ + rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8; \ + rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + rgba[3] = ((p >> 15) & 0x1) * 0xff; \ + } while (0) + +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) + +/** + ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +# define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_8888(color[3], color[0], color[1], color[2]) + +# define WRITE_RGBA(_x, _y, r, g, b, a) \ + PUT_VALUE(_x, _y, ((r << 16) | \ + (g << 8) | \ + (b << 0) | \ + (a << 24))) + +#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p) + +# if defined( USE_X86_ASM ) +# define READ_RGBA(rgba, _x, _y) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + __asm__ __volatile__( "bswap %0; rorl $8, %0" \ + : "=r" (p) : "0" (p) ); \ + ((GLuint *)rgba)[0] = p; \ + } while (0) +# elif defined( MESA_BIG_ENDIAN ) + /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single + * rotlwi instruction. It also produces good code on SPARC. + */ +# define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + GLuint t = p; \ + *((uint32_t *) rgba) = (t >> 24) | (p << 8); \ + } while (0) +# else +# define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = (p >> 24) & 0xff; \ + } while (0) +# endif + +#else +#error SPANTMP_PIXEL_FMT must be set to a valid value! +#endif + + + +/** + ** Assembly routines. + **/ + +#if defined( USE_MMX_ASM ) || defined( USE_SSE_ASM ) +#include "x86/read_rgba_span_x86.h" +#include "x86/common_x86_asm.h" +#endif + +static void TAG(WriteRGBASpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; + GLint x1; + GLint n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + HW_WRITE_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3] ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, + rgba[i][0], rgba[i][1], + rgba[i][2], rgba[i][3] ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + +static void TAG(WriteRGBSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; + GLint x1; + GLint n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + HW_WRITE_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + +static void TAG(WriteRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; + GLint i; + LOCAL_VARS; + + if (DBG) fprintf(stderr, "WriteRGBAPixels\n"); + + HW_WRITE_CLIPLOOP() + { + if (mask) + { + for (i=0;i0;i++,x1++,n1--) + if (mask[i]) + WRITE_PIXEL( x1, y, p ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_PIXEL( x1, y, p ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} + + +static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + const void *value, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte *color = (const GLubyte *) value; + GLint i; + LOCAL_VARS; + INIT_MONO_PIXEL(p, color); + + if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n"); + + HW_WRITE_CLIPLOOP() + { + if (mask) + { + for (i=0;i0;i++,x1++,n1--) + READ_RGBA( rgba[i], x1, y ); + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +} + + +#if defined(GET_PTR) && \ + defined(USE_MMX_ASM) && \ + (((SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \ + ((SPANTMP_PIXEL_FMT == GL_RGB) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5))) +static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, void *values) +{ +#ifndef USE_INNER_EMMS + /* The EMMS instruction is directly in-lined here because using GCC's + * built-in _mm_empty function was found to utterly destroy performance. + */ + __asm__ __volatile__( "emms" ); +#endif + + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + GLint x1,n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + if (DBG) fprintf(stderr, "ReadRGBASpan\n"); + + HW_READ_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + { + const void * src = GET_PTR( x1, y ); +#if (SPANTMP_PIXEL_FMT == GL_RGB) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5) + _generic_read_RGBA_span_RGB565_MMX( src, rgba[i], n1 ); +#else + _generic_read_RGBA_span_BGRA8888_REV_MMX( src, rgba[i], n1 ); +#endif + } + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +#ifndef USE_INNER_EMMS + __asm__ __volatile__( "emms" ); +#endif +} +#endif + + +#if defined(GET_PTR) && \ + defined(USE_SSE_ASM) && \ + (SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) +static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + void *values) +{ + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + GLint x1,n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + if (DBG) fprintf(stderr, "ReadRGBASpan\n"); + + HW_READ_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + { + const void * src = GET_PTR( x1, y ); + _generic_read_RGBA_span_BGRA8888_REV_SSE2( src, rgba[i], n1 ); + } + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +} +#endif + +#if defined(GET_PTR) && \ + defined(USE_SSE_ASM) && \ + (SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) +static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + void *values) +{ +#ifndef USE_INNER_EMMS + /* The EMMS instruction is directly in-lined here because using GCC's + * built-in _mm_empty function was found to utterly destroy performance. + */ + __asm__ __volatile__( "emms" ); +#endif + + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + GLint x1,n1; + LOCAL_VARS; + + y = Y_FLIP(y); + + if (DBG) fprintf(stderr, "ReadRGBASpan\n"); + + HW_READ_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + { + const void * src = GET_PTR( x1, y ); + _generic_read_RGBA_span_BGRA8888_REV_SSE( src, rgba[i], n1 ); + } + } + HW_ENDCLIPLOOP(); + } + HW_READ_UNLOCK(); +#ifndef USE_INNER_EMMS + __asm__ __volatile__( "emms" ); +#endif +} +#endif + + +static void TAG(ReadRGBAPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + void *values ) +{ + HW_READ_LOCK() + { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; + GLubyte *mask = NULL; /* remove someday */ + GLint i; + LOCAL_VARS; + + if (DBG) fprintf(stderr, "ReadRGBAPixels\n"); + + HW_READ_CLIPLOOP() + { + if (mask) + { + for (i=0;iPutRow = TAG(WriteRGBASpan); + rb->PutRowRGB = TAG(WriteRGBSpan); + rb->PutMonoRow = TAG(WriteMonoRGBASpan); + rb->PutValues = TAG(WriteRGBAPixels); + rb->PutMonoValues = TAG(WriteMonoRGBAPixels); + rb->GetValues = TAG(ReadRGBAPixels); + +#if defined(GET_PTR) +#if defined(USE_SSE_ASM) && \ + (SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) + if ( cpu_has_xmm2 ) { + if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE2" ); + rb->GetRow = TAG2(ReadRGBASpan, _SSE2); + } + else +#endif +#if defined(USE_SSE_ASM) && \ + (SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) + if ( cpu_has_xmm ) { + if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE" ); + rb->GetRow = TAG2(ReadRGBASpan, _SSE); + } + else +#endif +#if defined(USE_MMX_ASM) && \ + (((SPANTMP_PIXEL_FMT == GL_BGRA) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \ + ((SPANTMP_PIXEL_FMT == GL_RGB) && \ + (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5))) + if ( cpu_has_mmx ) { + if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "MMX" ); + rb->GetRow = TAG2(ReadRGBASpan, _MMX); + } + else +#endif +#endif /* GET_PTR */ + { + if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "C" ); + rb->GetRow = TAG(ReadRGBASpan); + } + +} + + +#undef INIT_MONO_PIXEL +#undef WRITE_PIXEL +#undef WRITE_RGBA +#undef READ_RGBA +#undef TAG +#undef TAG2 +#undef GET_VALUE +#undef PUT_VALUE +#undef GET_PTR +#undef SPANTMP_PIXEL_FMT +#undef SPANTMP_PIXEL_TYPE diff --git a/mesalib/src/mesa/drivers/dri/common/spantmp_common.h b/mesalib/src/mesa/drivers/dri/common/spantmp_common.h new file mode 100644 index 000000000..a4509a569 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/spantmp_common.h @@ -0,0 +1,81 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (C) Copyright IBM Corporation 2004 + * 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 + * on 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 + * VA LINUX SYSTEM, IBM AND/OR THEIR 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. + */ + +/** + * \file spantmp_common.h + * + * common macros for span read / write functions to be used in the depth, + * stencil and pixel span templates. + */ + +#ifndef HW_WRITE_LOCK +#define HW_WRITE_LOCK() HW_LOCK() +#endif + +#ifndef HW_WRITE_UNLOCK +#define HW_WRITE_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_READ_LOCK +#define HW_READ_LOCK() HW_LOCK() +#endif + +#ifndef HW_READ_UNLOCK +#define HW_READ_UNLOCK() HW_UNLOCK() +#endif + +#ifndef HW_CLIPLOOP +#define HW_CLIPLOOP() \ + do { \ + int _nc = dPriv->numClipRects; \ + while ( _nc-- ) { \ + int minx = dPriv->pClipRects[_nc].x1 - dPriv->x; \ + int miny = dPriv->pClipRects[_nc].y1 - dPriv->y; \ + int maxx = dPriv->pClipRects[_nc].x2 - dPriv->x; \ + int maxy = dPriv->pClipRects[_nc].y2 - dPriv->y; +#endif + +#ifndef HW_ENDCLIPLOOP +#define HW_ENDCLIPLOOP() \ + } \ + } while (0) +#endif + +#ifndef CLIPPIXEL +#define CLIPPIXEL( _x, _y ) \ + ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy)) +#endif + +#ifndef CLIPSPAN +#define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \ + if ( _y < miny || _y >= maxy /*|| _x + n < minx || _x >=maxx*/ ) { \ + _n1 = 0, _x1 = x; \ + } else { \ + _n1 = _n; \ + _x1 = _x; \ + if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \ + if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \ + } +#endif diff --git a/mesalib/src/mesa/drivers/dri/common/stenciltmp.h b/mesalib/src/mesa/drivers/dri/common/stenciltmp.h new file mode 100644 index 000000000..2b10b9ecf --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/stenciltmp.h @@ -0,0 +1,245 @@ + +#include "spantmp_common.h" + +#ifndef DBG +#define DBG 0 +#endif + +#ifndef HAVE_HW_STENCIL_SPANS +#define HAVE_HW_STENCIL_SPANS 0 +#endif + +#ifndef HAVE_HW_STENCIL_PIXELS +#define HAVE_HW_STENCIL_PIXELS 0 +#endif + +static void TAG(WriteStencilSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte *stencil = (const GLubyte *) values; + GLint x1; + GLint n1; + LOCAL_STENCIL_VARS; + + y = Y_FLIP(y); + +#if HAVE_HW_STENCIL_SPANS + (void) x1; (void) n1; + + if (DBG) fprintf(stderr, "WriteStencilSpan 0..%d (x1 %d)\n", + (int)n1, (int)x1); + + WRITE_STENCIL_SPAN(); +#else /* HAVE_HW_STENCIL_SPANS */ + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteStencilSpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_STENCIL( x1, y, stencil[i] ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_STENCIL( x1, y, stencil[i] ); + } + } + HW_ENDCLIPLOOP(); +#endif /* !HAVE_HW_STENCIL_SPANS */ + } + HW_WRITE_UNLOCK(); +} + +#if HAVE_HW_STENCIL_SPANS +/* implement MonoWriteDepthSpan() in terms of WriteDepthSpan() */ +static void +TAG(WriteMonoStencilSpan)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *value, const GLubyte mask[] ) +{ + const GLuint stenVal = *((GLuint *) value); + GLuint stens[MAX_WIDTH]; + GLuint i; + for (i = 0; i < n; i++) + stens[i] = stenVal; + TAG(WriteStencilSpan)(ctx, rb, n, x, y, stens, mask); +} +#else /* HAVE_HW_STENCIL_SPANS */ +static void TAG(WriteMonoStencilSpan)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, + const void *value, + const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte stencil = *((const GLubyte *) value); + GLint x1; + GLint n1; + LOCAL_STENCIL_VARS; + + y = Y_FLIP(y); + + HW_CLIPLOOP() + { + GLint i = 0; + CLIPSPAN(x,y,n,x1,n1,i); + + if (DBG) fprintf(stderr, "WriteStencilSpan %d..%d (x1 %d)\n", + (int)i, (int)n1, (int)x1); + + if (mask) + { + for (;n1>0;i++,x1++,n1--) + if (mask[i]) + WRITE_STENCIL( x1, y, stencil ); + } + else + { + for (;n1>0;i++,x1++,n1--) + WRITE_STENCIL( x1, y, stencil ); + } + } + HW_ENDCLIPLOOP(); + } + HW_WRITE_UNLOCK(); +} +#endif /* !HAVE_HW_STENCIL_SPANS */ + + +static void TAG(WriteStencilPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, + const GLint x[], const GLint y[], + const void *values, const GLubyte mask[] ) +{ + HW_WRITE_LOCK() + { + const GLubyte *stencil = (const GLubyte *) values; + GLuint i; + LOCAL_STENCIL_VARS; + + if (DBG) fprintf(stderr, "WriteStencilPixels\n"); + +#if HAVE_HW_STENCIL_PIXELS + (void) i; + + WRITE_STENCIL_PIXELS(); +#else /* HAVE_HW_STENCIL_PIXELS */ + HW_CLIPLOOP() + { + for (i=0;i0;i++,n1--) + READ_STENCIL( stencil[i], (x+i), y ); + } + HW_ENDCLIPLOOP(); +#endif /* !HAVE_HW_STENCIL_SPANS */ + } + HW_READ_UNLOCK(); +} + +static void TAG(ReadStencilPixels)( GLcontext *ctx, + struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], + void *values ) +{ + HW_READ_LOCK() + { + GLubyte *stencil = (GLubyte *) values; + GLuint i; + LOCAL_STENCIL_VARS; + + if (DBG) fprintf(stderr, "ReadStencilPixels\n"); + +#if HAVE_HW_STENCIL_PIXELS + (void) i; + + READ_STENCIL_PIXELS(); +#else /* HAVE_HW_STENCIL_PIXELS */ + HW_CLIPLOOP() + { + for (i=0;iGetRow = TAG(ReadStencilSpan); + rb->GetValues = TAG(ReadStencilPixels); + rb->PutRow = TAG(WriteStencilSpan); + rb->PutRowRGB = NULL; + rb->PutMonoRow = TAG(WriteMonoStencilSpan); + rb->PutValues = TAG(WriteStencilPixels); + rb->PutMonoValues = NULL; +} + + +#undef WRITE_STENCIL +#undef READ_STENCIL +#undef TAG diff --git a/mesalib/src/mesa/drivers/dri/common/texmem.c b/mesalib/src/mesa/drivers/dri/common/texmem.c new file mode 100644 index 000000000..b64618a03 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/texmem.c @@ -0,0 +1,1347 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (C) Copyright IBM Corporation 2002, 2003 + * 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 + * on 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 + * VA LINUX SYSTEM, IBM AND/OR THEIR 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: + * Ian Romanick + * Keith Whitwell + * Kevin E. Martin + * Gareth Hughes + */ + +/** \file texmem.c + * Implements all of the device-independent texture memory management. + * + * Currently, only a simple LRU texture memory management policy is + * implemented. In the (hopefully very near) future, better policies will be + * implemented. The idea is that the DRI should be able to run in one of two + * modes. In the default mode the DRI will dynamically attempt to discover + * the best texture management policy for the running application. In the + * other mode, the user (via some sort of as yet TBD mechanism) will select + * a texture management policy that is known to work well with the + * application. + */ + +#include "texmem.h" +#include "main/simple_list.h" +#include "main/imports.h" +#include "main/macros.h" +#include "main/texformat.h" + +#include + + + +static unsigned dummy_swap_counter; + + +/** + * Calculate \f$\log_2\f$ of a value. This is a particularly poor + * implementation of this function. However, since system performance is in + * no way dependent on this function, the slowness of the implementation is + * irrelevent. + * + * \param n Value whose \f$\log_2\f$ is to be calculated + */ + +static GLuint +driLog2( GLuint n ) +{ + GLuint log2; + + for ( log2 = 1 ; n > 1 ; log2++ ) { + n >>= 1; + } + + return log2; +} + + + + +/** + * Determine if a texture is resident in textureable memory. Depending on + * the driver, this may or may not be on-card memory. It could be AGP memory + * or anyother type of memory from which the hardware can directly read + * texels. + * + * This function is intended to be used as the \c IsTextureResident function + * in the device's \c dd_function_table. + * + * \param ctx GL context pointer (currently unused) + * \param texObj Texture object to be tested + */ + +GLboolean +driIsTextureResident( GLcontext * ctx, + struct gl_texture_object * texObj ) +{ + driTextureObject * t; + + + t = (driTextureObject *) texObj->DriverData; + return( (t != NULL) && (t->memBlock != NULL) ); +} + + + + +/** + * (Re)initialize the global circular LRU list. The last element + * in the array (\a heap->nrRegions) is the sentinal. Keeping it + * at the end of the array allows the other elements of the array + * to be addressed rationally when looking up objects at a particular + * location in texture memory. + * + * \param heap Texture heap to be reset + */ + +static void resetGlobalLRU( driTexHeap * heap ) +{ + drmTextureRegionPtr list = heap->global_regions; + unsigned sz = 1U << heap->logGranularity; + unsigned i; + + for (i = 0 ; (i+1) * sz <= heap->size ; i++) { + list[i].prev = i-1; + list[i].next = i+1; + list[i].age = 0; + } + + i--; + list[0].prev = heap->nrRegions; + list[i].prev = i-1; + list[i].next = heap->nrRegions; + list[heap->nrRegions].prev = i; + list[heap->nrRegions].next = 0; + heap->global_age[0] = 0; +} + +/** + * Print out debugging information about the local texture LRU. + * + * \param heap Texture heap to be printed + * \param callername Name of calling function + */ +static void printLocalLRU( driTexHeap * heap, const char *callername ) +{ + driTextureObject *t; + unsigned sz = 1U << heap->logGranularity; + + fprintf( stderr, "%s in %s:\nLocal LRU, heap %d:\n", + __FUNCTION__, callername, heap->heapId ); + + foreach ( t, &heap->texture_objects ) { + if (!t->memBlock) + continue; + if (!t->tObj) { + fprintf( stderr, "Placeholder (%p) %d at 0x%x sz 0x%x\n", + (void *)t, + t->memBlock->ofs / sz, + t->memBlock->ofs, + t->memBlock->size ); + } else { + fprintf( stderr, "Texture (%p) at 0x%x sz 0x%x\n", + (void *)t, + t->memBlock->ofs, + t->memBlock->size ); + } + } + foreach ( t, heap->swapped_objects ) { + if (!t->tObj) { + fprintf( stderr, "Swapped Placeholder (%p)\n", (void *)t ); + } else { + fprintf( stderr, "Swapped Texture (%p)\n", (void *)t ); + } + } + + fprintf( stderr, "\n" ); +} + +/** + * Print out debugging information about the global texture LRU. + * + * \param heap Texture heap to be printed + * \param callername Name of calling function + */ +static void printGlobalLRU( driTexHeap * heap, const char *callername ) +{ + drmTextureRegionPtr list = heap->global_regions; + unsigned int i, j; + + fprintf( stderr, "%s in %s:\nGlobal LRU, heap %d list %p:\n", + __FUNCTION__, callername, heap->heapId, (void *)list ); + + for ( i = 0, j = heap->nrRegions ; i < heap->nrRegions ; i++ ) { + fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n", + j, list[j].age, list[j].next, list[j].prev, list[j].in_use ); + j = list[j].next; + if ( j == heap->nrRegions ) break; + } + + if ( j != heap->nrRegions ) { + fprintf( stderr, "Loop detected in global LRU\n" ); + for ( i = 0 ; i < heap->nrRegions ; i++ ) { + fprintf( stderr, "list[%d] age %d next %d prev %d in_use %d\n", + i, list[i].age, list[i].next, list[i].prev, list[i].in_use ); + } + } + + fprintf( stderr, "\n" ); +} + + +/** + * Called by the client whenever it touches a local texture. + * + * \param t Texture object that the client has accessed + */ + +void driUpdateTextureLRU( driTextureObject * t ) +{ + driTexHeap * heap; + drmTextureRegionPtr list; + unsigned shift; + unsigned start; + unsigned end; + unsigned i; + + + heap = t->heap; + if ( heap != NULL ) { + shift = heap->logGranularity; + start = t->memBlock->ofs >> shift; + end = (t->memBlock->ofs + t->memBlock->size - 1) >> shift; + + + heap->local_age = ++heap->global_age[0]; + list = heap->global_regions; + + + /* Update the context's local LRU + */ + + move_to_head( & heap->texture_objects, t ); + + + for (i = start ; i <= end ; i++) { + list[i].age = heap->local_age; + + /* remove_from_list(i) + */ + list[(unsigned)list[i].next].prev = list[i].prev; + list[(unsigned)list[i].prev].next = list[i].next; + + /* insert_at_head(list, i) + */ + list[i].prev = heap->nrRegions; + list[i].next = list[heap->nrRegions].next; + list[(unsigned)list[heap->nrRegions].next].prev = i; + list[heap->nrRegions].next = i; + } + + if ( 0 ) { + printGlobalLRU( heap, __FUNCTION__ ); + printLocalLRU( heap, __FUNCTION__ ); + } + } +} + + + + +/** + * Keep track of swapped out texture objects. + * + * \param t Texture object to be "swapped" out of its texture heap + */ + +void driSwapOutTextureObject( driTextureObject * t ) +{ + unsigned face; + + + if ( t->memBlock != NULL ) { + assert( t->heap != NULL ); + mmFreeMem( t->memBlock ); + t->memBlock = NULL; + + if (t->timestamp > t->heap->timestamp) + t->heap->timestamp = t->timestamp; + + t->heap->texture_swaps[0]++; + move_to_tail( t->heap->swapped_objects, t ); + t->heap = NULL; + } + else { + assert( t->heap == NULL ); + } + + + for ( face = 0 ; face < 6 ; face++ ) { + t->dirty_images[face] = ~0; + } +} + + + + +/** + * Destroy hardware state associated with texture \a t. Calls the + * \a destroy_texture_object method associated with the heap from which + * \a t was allocated. + * + * \param t Texture object to be destroyed + */ + +void driDestroyTextureObject( driTextureObject * t ) +{ + driTexHeap * heap; + + + if ( 0 ) { + fprintf( stderr, "[%s:%d] freeing %p (tObj = %p, DriverData = %p)\n", + __FILE__, __LINE__, + (void *)t, + (void *)((t != NULL) ? t->tObj : NULL), + (void *)((t != NULL && t->tObj != NULL) ? t->tObj->DriverData : NULL )); + } + + if ( t != NULL ) { + if ( t->memBlock ) { + heap = t->heap; + assert( heap != NULL ); + + heap->texture_swaps[0]++; + + mmFreeMem( t->memBlock ); + t->memBlock = NULL; + + if (t->timestamp > t->heap->timestamp) + t->heap->timestamp = t->timestamp; + + heap->destroy_texture_object( heap->driverContext, t ); + t->heap = NULL; + } + + if ( t->tObj != NULL ) { + assert( t->tObj->DriverData == t ); + t->tObj->DriverData = NULL; + } + + remove_from_list( t ); + FREE( t ); + } + + if ( 0 ) { + fprintf( stderr, "[%s:%d] done freeing %p\n", __FILE__, __LINE__, (void *)t ); + } +} + + + + +/** + * Update the local heap's representation of texture memory based on + * data in the SAREA. This is done each time it is detected that some other + * direct rendering client has held the lock. This pertains to both our local + * textures and the textures belonging to other clients. Keep track of other + * client's textures by pushing a placeholder texture onto the LRU list -- + * these are denoted by \a tObj being \a NULL. + * + * \param heap Heap whose state is to be updated + * \param offset Byte offset in the heap that has been stolen + * \param size Size, in bytes, of the stolen block + * \param in_use Non-zero if the block is pinned/reserved by the kernel + */ + +static void driTexturesGone( driTexHeap * heap, int offset, int size, + int in_use ) +{ + driTextureObject * t; + driTextureObject * tmp; + + + foreach_s ( t, tmp, & heap->texture_objects ) { + if ( (t->memBlock->ofs < (offset + size)) + && ((t->memBlock->ofs + t->memBlock->size) > offset) ) { + /* It overlaps - kick it out. If the texture object is just a + * place holder, then destroy it all together. Otherwise, mark + * it as being swapped out. + */ + + if ( t->tObj != NULL ) { + driSwapOutTextureObject( t ); + } + else { + driDestroyTextureObject( t ); + } + } + } + + + { + t = (driTextureObject *) CALLOC( heap->texture_object_size ); + if ( t == NULL ) return; + + t->memBlock = mmAllocMem( heap->memory_heap, size, 0, offset ); + if ( t->memBlock == NULL ) { + fprintf( stderr, "Couldn't alloc placeholder: heap %u sz %x ofs %x\n", heap->heapId, + (int)size, (int)offset ); + mmDumpMemInfo( heap->memory_heap ); + FREE(t); + return; + } + t->heap = heap; + if (in_use) + t->reserved = 1; + insert_at_head( & heap->texture_objects, t ); + } +} + + + + +/** + * Called by the client on lock contention to determine whether textures have + * been stolen. If another client has modified a region in which we have + * textures, then we need to figure out which of our textures have been + * removed and update our global LRU. + * + * \param heap Texture heap to be updated + */ + +void driAgeTextures( driTexHeap * heap ) +{ + drmTextureRegionPtr list = heap->global_regions; + unsigned sz = 1U << (heap->logGranularity); + unsigned i, nr = 0; + + + /* Have to go right round from the back to ensure stuff ends up + * LRU in the local list... Fix with a cursor pointer. + */ + + for (i = list[heap->nrRegions].prev ; + i != heap->nrRegions && nr < heap->nrRegions ; + i = list[i].prev, nr++) { + /* If switching texturing schemes, then the SAREA might not have been + * properly cleared, so we need to reset the global texture LRU. + */ + + if ( (i * sz) > heap->size ) { + nr = heap->nrRegions; + break; + } + + if (list[i].age > heap->local_age) + driTexturesGone( heap, i * sz, sz, list[i].in_use); + } + + /* Loop or uninitialized heap detected. Reset. + */ + + if (nr == heap->nrRegions) { + driTexturesGone( heap, 0, heap->size, 0); + resetGlobalLRU( heap ); + } + + if ( 0 ) { + printGlobalLRU( heap, __FUNCTION__ ); + printLocalLRU( heap, __FUNCTION__ ); + } + + heap->local_age = heap->global_age[0]; +} + + + + +#define INDEX_ARRAY_SIZE 6 /* I'm not aware of driver with more than 2 heaps */ + +/** + * Allocate memory from a texture heap to hold a texture object. This + * routine will attempt to allocate memory for the texture from the heaps + * specified by \c heap_array in order. That is, first it will try to + * allocate from \c heap_array[0], then \c heap_array[1], and so on. + * + * \param heap_array Array of pointers to texture heaps to use + * \param nr_heaps Number of heap pointer in \a heap_array + * \param t Texture object for which space is needed + * \return The ID of the heap from which memory was allocated, or -1 if + * memory could not be allocated. + * + * \bug The replacement policy implemented by this function is horrible. + */ + + +int +driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps, + driTextureObject * t ) +{ + driTexHeap * heap; + driTextureObject * temp; + driTextureObject * cursor; + unsigned id; + + + /* In case it already has texture space, initialize heap. This also + * prevents GCC from issuing a warning that heap might be used + * uninitialized. + */ + + heap = t->heap; + + + /* Run through each of the existing heaps and try to allocate a buffer + * to hold the texture. + */ + + for ( id = 0 ; (t->memBlock == NULL) && (id < nr_heaps) ; id++ ) { + heap = heap_array[ id ]; + if ( heap != NULL ) { + t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize, + heap->alignmentShift, 0 ); + } + } + + + /* Kick textures out until the requested texture fits. + */ + + if ( t->memBlock == NULL ) { + unsigned index[INDEX_ARRAY_SIZE]; + unsigned nrGoodHeaps = 0; + + /* Trying to avoid dynamic memory allocation. If you have more + * heaps, increase INDEX_ARRAY_SIZE. I'm not aware of any + * drivers with more than 2 tex heaps. */ + assert( nr_heaps < INDEX_ARRAY_SIZE ); + + /* Sort large enough heaps by duty. Insertion sort should be + * fast enough for such a short array. */ + for ( id = 0 ; id < nr_heaps ; id++ ) { + heap = heap_array[ id ]; + + if ( heap != NULL && t->totalSize <= heap->size ) { + unsigned j; + + for ( j = 0 ; j < nrGoodHeaps; j++ ) { + if ( heap->duty > heap_array[ index[ j ] ]->duty ) + break; + } + + if ( j < nrGoodHeaps ) { + memmove( &index[ j+1 ], &index[ j ], + sizeof(index[ 0 ]) * (nrGoodHeaps - j) ); + } + + index[ j ] = id; + + nrGoodHeaps++; + } + } + + for ( id = 0 ; (t->memBlock == NULL) && (id < nrGoodHeaps) ; id++ ) { + heap = heap_array[ index[ id ] ]; + + for ( cursor = heap->texture_objects.prev, temp = cursor->prev; + cursor != &heap->texture_objects ; + cursor = temp, temp = cursor->prev ) { + + /* The the LRU element. If the texture is bound to one of + * the texture units, then we cannot kick it out. + */ + if ( cursor->bound || cursor->reserved ) { + continue; + } + + if ( cursor->memBlock ) + heap->duty -= cursor->memBlock->size; + + /* If this is a placeholder, there's no need to keep it */ + if (cursor->tObj) + driSwapOutTextureObject( cursor ); + else + driDestroyTextureObject( cursor ); + + t->memBlock = mmAllocMem( heap->memory_heap, t->totalSize, + heap->alignmentShift, 0 ); + + if (t->memBlock) + break; + } + } + + /* Rebalance duties. If a heap kicked more data than its duty, + * then all other heaps get that amount multiplied with their + * relative weight added to their duty. The negative duty is + * reset to 0. In the end all heaps have a duty >= 0. + * + * CAUTION: we must not change the heap pointer here, because it + * is used below to update the texture object. + */ + for ( id = 0 ; id < nr_heaps ; id++ ) + if ( heap_array[ id ] != NULL && heap_array[ id ]->duty < 0) { + int duty = -heap_array[ id ]->duty; + double weight = heap_array[ id ]->weight; + unsigned j; + + for ( j = 0 ; j < nr_heaps ; j++ ) + if ( j != id && heap_array[ j ] != NULL ) { + heap_array[ j ]->duty += (double) duty * + heap_array[ j ]->weight / weight; + } + + heap_array[ id ]->duty = 0; + } + } + + + if ( t->memBlock != NULL ) { + /* id and heap->heapId may or may not be the same value here. + */ + + assert( heap != NULL ); + assert( (t->heap == NULL) || (t->heap == heap) ); + + t->heap = heap; + return heap->heapId; + } + else { + assert( t->heap == NULL ); + + fprintf( stderr, "[%s:%d] unable to allocate texture\n", + __FUNCTION__, __LINE__ ); + return -1; + } +} + + + + + + +/** + * Set the location where the texture-swap counter is stored. + */ + +void +driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter ) +{ + heap->texture_swaps = (counter == NULL) ? & dummy_swap_counter : counter; +} + + + + +/** + * Create a new heap for texture data. + * + * \param heap_id Device-dependent heap identifier. This value + * will returned by driAllocateTexture when memory + * is allocated from this heap. + * \param context Device-dependent driver context. This is + * supplied as the first parameter to the + * \c destroy_tex_obj function. + * \param size Size, in bytes, of the texture region + * \param alignmentShift Alignment requirement for textures. If textures + * must be allocated on a 4096 byte boundry, this + * would be 12. + * \param nr_regions Number of regions into which this texture space + * should be partitioned + * \param global_regions Array of \c drmTextureRegion structures in the SAREA + * \param global_age Pointer to the global texture age in the SAREA + * \param swapped_objects Pointer to the list of texture objects that are + * not in texture memory (i.e., have been swapped + * out). + * \param texture_object_size Size, in bytes, of a device-dependent texture + * object + * \param destroy_tex_obj Function used to destroy a device-dependent + * texture object + * + * \sa driDestroyTextureHeap + */ + +driTexHeap * +driCreateTextureHeap( unsigned heap_id, void * context, unsigned size, + unsigned alignmentShift, unsigned nr_regions, + drmTextureRegionPtr global_regions, unsigned * global_age, + driTextureObject * swapped_objects, + unsigned texture_object_size, + destroy_texture_object_t * destroy_tex_obj + ) +{ + driTexHeap * heap; + unsigned l; + + + if ( 0 ) + fprintf( stderr, "%s( %u, %p, %u, %u, %u )\n", + __FUNCTION__, + heap_id, (void *)context, size, alignmentShift, nr_regions ); + + heap = (driTexHeap *) CALLOC( sizeof( driTexHeap ) ); + if ( heap != NULL ) { + l = driLog2( (size - 1) / nr_regions ); + if ( l < alignmentShift ) + { + l = alignmentShift; + } + + heap->logGranularity = l; + heap->size = size & ~((1L << l) - 1); + + heap->memory_heap = mmInit( 0, heap->size ); + if ( heap->memory_heap != NULL ) { + heap->heapId = heap_id; + heap->driverContext = context; + + heap->alignmentShift = alignmentShift; + heap->nrRegions = nr_regions; + heap->global_regions = global_regions; + heap->global_age = global_age; + heap->swapped_objects = swapped_objects; + heap->texture_object_size = texture_object_size; + heap->destroy_texture_object = destroy_tex_obj; + + /* Force global heap init */ + if (heap->global_age[0] == 0) + heap->local_age = ~0; + else + heap->local_age = 0; + + make_empty_list( & heap->texture_objects ); + driSetTextureSwapCounterLocation( heap, NULL ); + + heap->weight = heap->size; + heap->duty = 0; + } + else { + FREE( heap ); + heap = NULL; + } + } + + + if ( 0 ) + fprintf( stderr, "%s returning %p\n", __FUNCTION__, (void *)heap ); + + return heap; +} + + + + +/** Destroys a texture heap + * + * \param heap Texture heap to be destroyed + */ + +void +driDestroyTextureHeap( driTexHeap * heap ) +{ + driTextureObject * t; + driTextureObject * temp; + + + if ( heap != NULL ) { + foreach_s( t, temp, & heap->texture_objects ) { + driDestroyTextureObject( t ); + } + foreach_s( t, temp, heap->swapped_objects ) { + driDestroyTextureObject( t ); + } + + mmDestroy( heap->memory_heap ); + FREE( heap ); + } +} + + + + +/****************************************************************************/ +/** + * Determine how many texels (including all mipmap levels) would be required + * for a texture map of size \f$2^^\c base_size_log2\f$ would require. + * + * \param base_size_log2 \f$log_2\f$ of the size of a side of the texture + * \param dimensions Number of dimensions of the texture. Either 2 or 3. + * \param faces Number of faces of the texture. Either 1 or 6 (for cube maps). + * \return Number of texels + */ + +static unsigned +texels_this_map_size( int base_size_log2, unsigned dimensions, unsigned faces ) +{ + unsigned texels; + + + assert( (faces == 1) || (faces == 6) ); + assert( (dimensions == 2) || (dimensions == 3) ); + + texels = 0; + if ( base_size_log2 >= 0 ) { + texels = (1U << (dimensions * base_size_log2)); + + /* See http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg03636.html + * for the complete explaination of why this formulation is used. + * Basically, the smaller mipmap levels sum to 0.333 the size of the + * level 0 map. The total size is therefore the size of the map + * multipled by 1.333. The +2 is there to round up. + */ + + texels = (texels * 4 * faces + 2) / 3; + } + + return texels; +} + + + + +struct maps_per_heap { + unsigned c[32]; +}; + +static void +fill_in_maximums( driTexHeap * const * heaps, unsigned nr_heaps, + unsigned max_bytes_per_texel, unsigned max_size, + unsigned mipmaps_at_once, unsigned dimensions, + unsigned faces, struct maps_per_heap * max_textures ) +{ + unsigned heap; + unsigned log2_size; + unsigned mask; + + + /* Determine how many textures of each size can be stored in each + * texture heap. + */ + + for ( heap = 0 ; heap < nr_heaps ; heap++ ) { + if ( heaps[ heap ] == NULL ) { + (void) memset( max_textures[ heap ].c, 0, + sizeof( max_textures[ heap ].c ) ); + continue; + } + + mask = (1U << heaps[ heap ]->logGranularity) - 1; + + if ( 0 ) { + fprintf( stderr, "[%s:%d] heap[%u] = %u bytes, mask = 0x%08x\n", + __FILE__, __LINE__, + heap, heaps[ heap ]->size, mask ); + } + + for ( log2_size = max_size ; log2_size > 0 ; log2_size-- ) { + unsigned total; + + + /* Determine the total number of bytes required by a texture of + * size log2_size. + */ + + total = texels_this_map_size( log2_size, dimensions, faces ) + - texels_this_map_size( log2_size - mipmaps_at_once, + dimensions, faces ); + total *= max_bytes_per_texel; + total = (total + mask) & ~mask; + + /* The number of textures of a given size that will fit in a heap + * is equal to the size of the heap divided by the size of the + * texture. + */ + + max_textures[ heap ].c[ log2_size ] = heaps[ heap ]->size / total; + + if ( 0 ) { + fprintf( stderr, "[%s:%d] max_textures[%u].c[%02u] " + "= 0x%08x / 0x%08x " + "= %u (%u)\n", + __FILE__, __LINE__, + heap, log2_size, + heaps[ heap ]->size, total, + heaps[ heap ]->size / total, + max_textures[ heap ].c[ log2_size ] ); + } + } + } +} + + +static unsigned +get_max_size( unsigned nr_heaps, + unsigned texture_units, + unsigned max_size, + int all_textures_one_heap, + struct maps_per_heap * max_textures ) +{ + unsigned heap; + unsigned log2_size; + + + /* Determine the largest texture size such that a texture of that size + * can be bound to each texture unit at the same time. Some hardware + * may require that all textures be in the same texture heap for + * multitexturing. + */ + + for ( log2_size = max_size ; log2_size > 0 ; log2_size-- ) { + unsigned total = 0; + + for ( heap = 0 ; heap < nr_heaps ; heap++ ) + { + total += max_textures[ heap ].c[ log2_size ]; + + if ( 0 ) { + fprintf( stderr, "[%s:%d] max_textures[%u].c[%02u] = %u, " + "total = %u\n", __FILE__, __LINE__, heap, log2_size, + max_textures[ heap ].c[ log2_size ], total ); + } + + if ( (max_textures[ heap ].c[ log2_size ] >= texture_units) + || (!all_textures_one_heap && (total >= texture_units)) ) { + /* The number of mipmap levels is the log-base-2 of the + * maximum texture size plus 1. If the maximum texture size + * is 1x1, the log-base-2 is 0 and 1 mipmap level (the base + * level) is available. + */ + + return log2_size + 1; + } + } + } + + /* This should NEVER happen. It should always be possible to have at + * *least* a 1x1 texture in memory! + */ + assert( log2_size != 0 ); + return 0; +} + +#define SET_MAX(f,v) \ + do { if ( max_sizes[v] != 0 ) { limits-> f = max_sizes[v]; } } while( 0 ) + +#define SET_MAX_RECT(f,v) \ + do { if ( max_sizes[v] != 0 ) { limits-> f = 1 << (max_sizes[v] - 1); } } while( 0 ) + + +/** + * Given the amount of texture memory, the number of texture units, and the + * maximum size of a texel, calculate the maximum texture size the driver can + * advertise. + * + * \param heaps Texture heaps for this card + * \param nr_heap Number of texture heaps + * \param limits OpenGL contants. MaxTextureUnits must be set. + * \param max_bytes_per_texel Maximum size of a single texel, in bytes + * \param max_2D_size \f$\log_2\f$ of the maximum 2D texture size (i.e., + * 1024x1024 textures, this would be 10) + * \param max_3D_size \f$\log_2\f$ of the maximum 3D texture size (i.e., + * 1024x1024x1024 textures, this would be 10) + * \param max_cube_size \f$\log_2\f$ of the maximum cube texture size (i.e., + * 1024x1024 textures, this would be 10) + * \param max_rect_size \f$\log_2\f$ of the maximum texture rectangle size + * (i.e., 1024x1024 textures, this would be 10). This is a power-of-2 + * even though texture rectangles need not be a power-of-2. + * \param mipmaps_at_once Total number of mipmaps that can be used + * at one time. For most hardware this will be \f$\c max_size + 1\f$. + * For hardware that does not support mipmapping, this will be 1. + * \param all_textures_one_heap True if the hardware requires that all + * textures be in a single texture heap for multitexturing. + * \param allow_larger_textures 0 conservative, 1 calculate limits + * so at least one worst-case texture can fit, 2 just use hw limits. + */ + +void +driCalculateMaxTextureLevels( driTexHeap * const * heaps, + unsigned nr_heaps, + struct gl_constants * limits, + unsigned max_bytes_per_texel, + unsigned max_2D_size, + unsigned max_3D_size, + unsigned max_cube_size, + unsigned max_rect_size, + unsigned mipmaps_at_once, + int all_textures_one_heap, + int allow_larger_textures ) +{ + struct maps_per_heap max_textures[8]; + unsigned i; + const unsigned dimensions[4] = { 2, 3, 2, 2 }; + const unsigned faces[4] = { 1, 1, 6, 1 }; + unsigned max_sizes[4]; + unsigned mipmaps[4]; + + + max_sizes[0] = max_2D_size; + max_sizes[1] = max_3D_size; + max_sizes[2] = max_cube_size; + max_sizes[3] = max_rect_size; + + mipmaps[0] = mipmaps_at_once; + mipmaps[1] = mipmaps_at_once; + mipmaps[2] = mipmaps_at_once; + mipmaps[3] = 1; + + + /* Calculate the maximum number of texture levels in two passes. The + * first pass determines how many textures of each power-of-two size + * (including all mipmap levels for that size) can fit in each texture + * heap. The second pass finds the largest texture size that allows + * a texture of that size to be bound to every texture unit. + */ + + for ( i = 0 ; i < 4 ; i++ ) { + if ( (allow_larger_textures != 2) && (max_sizes[ i ] != 0) ) { + fill_in_maximums( heaps, nr_heaps, max_bytes_per_texel, + max_sizes[ i ], mipmaps[ i ], + dimensions[ i ], faces[ i ], + max_textures ); + + max_sizes[ i ] = get_max_size( nr_heaps, + allow_larger_textures == 1 ? + 1 : limits->MaxTextureUnits, + max_sizes[ i ], + all_textures_one_heap, + max_textures ); + } + else if (max_sizes[ i ] != 0) { + max_sizes[ i ] += 1; + } + } + + SET_MAX( MaxTextureLevels, 0 ); + SET_MAX( Max3DTextureLevels, 1 ); + SET_MAX( MaxCubeTextureLevels, 2 ); + SET_MAX_RECT( MaxTextureRectSize, 3 ); +} + + + + +/** + * Perform initial binding of default textures objects on a per unit, per + * texture target basis. + * + * \param ctx Current OpenGL context + * \param swapped List of swapped-out textures + * \param targets Bit-mask of value texture targets + */ + +void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, + GLuint targets ) +{ + struct gl_texture_object *texObj; + GLuint tmp = ctx->Texture.CurrentUnit; + unsigned i; + + + for ( i = 0 ; i < ctx->Const.MaxTextureUnits ; i++ ) { + ctx->Texture.CurrentUnit = i; + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_1D) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_1D_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_1D, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_2D) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_2D_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_2D, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_3D) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_3D_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_3D, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_CUBE) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_CUBE_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_CUBE_MAP_ARB, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + + if ( (targets & DRI_TEXMGR_DO_TEXTURE_RECT) != 0 ) { + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_RECT_INDEX]; + ctx->Driver.BindTexture( ctx, GL_TEXTURE_RECTANGLE_NV, texObj ); + move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); + } + } + + ctx->Texture.CurrentUnit = tmp; +} + + + + +/** + * Verify that the specified texture is in the specificed heap. + * + * \param tex Texture to be tested. + * \param heap Texture memory heap to be tested. + * \return True if the texture is in the heap, false otherwise. + */ + +static GLboolean +check_in_heap( const driTextureObject * tex, const driTexHeap * heap ) +{ +#if 1 + return tex->heap == heap; +#else + driTextureObject * curr; + + foreach( curr, & heap->texture_objects ) { + if ( curr == tex ) { + break; + } + } + + return curr == tex; +#endif +} + + + +/****************************************************************************/ +/** + * Validate the consistency of a set of texture heaps. + * Original version by Keith Whitwell in r200/r200_sanity.c. + */ + +GLboolean +driValidateTextureHeaps( driTexHeap * const * texture_heaps, + unsigned nr_heaps, const driTextureObject * swapped ) +{ + driTextureObject *t; + unsigned i; + + for ( i = 0 ; i < nr_heaps ; i++ ) { + int last_end = 0; + unsigned textures_in_heap = 0; + unsigned blocks_in_mempool = 0; + const driTexHeap * heap = texture_heaps[i]; + const struct mem_block *p = heap->memory_heap; + + /* Check each texture object has a MemBlock, and is linked into + * the correct heap. + * + * Check the texobj base address corresponds to the MemBlock + * range. Check the texobj size (recalculate?) fits within + * the MemBlock. + * + * Count the number of texobj's using this heap. + */ + + foreach ( t, &heap->texture_objects ) { + if ( !check_in_heap( t, heap ) ) { + fprintf( stderr, "%s memory block for texture object @ %p not " + "found in heap #%d\n", + __FUNCTION__, (void *)t, i ); + return GL_FALSE; + } + + + if ( t->totalSize > t->memBlock->size ) { + fprintf( stderr, "%s: Memory block for texture object @ %p is " + "only %u bytes, but %u are required\n", + __FUNCTION__, (void *)t, t->totalSize, t->memBlock->size ); + return GL_FALSE; + } + + textures_in_heap++; + } + + /* Validate the contents of the heap: + * - Ordering + * - Overlaps + * - Bounds + */ + + while ( p != NULL ) { + if (p->reserved) { + fprintf( stderr, "%s: Block (%08x,%x), is reserved?!\n", + __FUNCTION__, p->ofs, p->size ); + return GL_FALSE; + } + + if (p->ofs != last_end) { + fprintf( stderr, "%s: blocks_in_mempool = %d, last_end = %d, p->ofs = %d\n", + __FUNCTION__, blocks_in_mempool, last_end, p->ofs ); + return GL_FALSE; + } + + if (!p->reserved && !p->free) { + blocks_in_mempool++; + } + + last_end = p->ofs + p->size; + p = p->next; + } + + if (textures_in_heap != blocks_in_mempool) { + fprintf( stderr, "%s: Different number of textures objects (%u) and " + "inuse memory blocks (%u)\n", + __FUNCTION__, textures_in_heap, blocks_in_mempool ); + return GL_FALSE; + } + +#if 0 + fprintf( stderr, "%s: textures_in_heap = %u\n", + __FUNCTION__, textures_in_heap ); +#endif + } + + + /* Check swapped texobj's have zero memblocks + */ + i = 0; + foreach ( t, swapped ) { + if ( t->memBlock != NULL ) { + fprintf( stderr, "%s: Swapped texobj %p has non-NULL memblock %p\n", + __FUNCTION__, (void *)t, (void *)t->memBlock ); + return GL_FALSE; + } + i++; + } + +#if 0 + fprintf( stderr, "%s: swapped texture count = %u\n", __FUNCTION__, i ); +#endif + + return GL_TRUE; +} + + + + +/****************************************************************************/ +/** + * Compute which mipmap levels that really need to be sent to the hardware. + * This depends on the base image size, GL_TEXTURE_MIN_LOD, + * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. + */ + +void +driCalculateTextureFirstLastLevel( driTextureObject * t ) +{ + struct gl_texture_object * const tObj = t->tObj; + const struct gl_texture_image * const baseImage = + tObj->Image[0][tObj->BaseLevel]; + + /* These must be signed values. MinLod and MaxLod can be negative numbers, + * and having firstLevel and lastLevel as signed prevents the need for + * extra sign checks. + */ + int firstLevel; + int lastLevel; + + /* Yes, this looks overly complicated, but it's all needed. + */ + + switch (tObj->Target) { + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + case GL_TEXTURE_CUBE_MAP: + if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { + /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL. + */ + + firstLevel = lastLevel = tObj->BaseLevel; + } + else { + firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); + firstLevel = MAX2(firstLevel, tObj->BaseLevel); + firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2); + lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); + lastLevel = MAX2(lastLevel, t->tObj->BaseLevel); + lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2); + lastLevel = MIN2(lastLevel, t->tObj->MaxLevel); + lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ + } + break; + case GL_TEXTURE_RECTANGLE_NV: + case GL_TEXTURE_4D_SGIS: + firstLevel = lastLevel = 0; + break; + default: + return; + } + + /* save these values */ + t->firstLevel = firstLevel; + t->lastLevel = lastLevel; +} + + + + +/** + * \name DRI texture formats. Pointers initialized to either the big- or + * little-endian Mesa formats. + */ +/*@{*/ +const struct gl_texture_format *_dri_texformat_rgba8888 = NULL; +const struct gl_texture_format *_dri_texformat_argb8888 = NULL; +const struct gl_texture_format *_dri_texformat_rgb565 = NULL; +const struct gl_texture_format *_dri_texformat_argb4444 = NULL; +const struct gl_texture_format *_dri_texformat_argb1555 = NULL; +const struct gl_texture_format *_dri_texformat_al88 = NULL; +const struct gl_texture_format *_dri_texformat_a8 = &_mesa_texformat_a8; +const struct gl_texture_format *_dri_texformat_ci8 = &_mesa_texformat_ci8; +const struct gl_texture_format *_dri_texformat_i8 = &_mesa_texformat_i8; +const struct gl_texture_format *_dri_texformat_l8 = &_mesa_texformat_l8; +/*@}*/ + + +/** + * Initialize little endian target, host byte order independent texture formats + */ +void +driInitTextureFormats(void) +{ + const GLuint ui = 1; + const GLubyte littleEndian = *((const GLubyte *) &ui); + + if (littleEndian) { + _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888; + _dri_texformat_argb8888 = &_mesa_texformat_argb8888; + _dri_texformat_rgb565 = &_mesa_texformat_rgb565; + _dri_texformat_argb4444 = &_mesa_texformat_argb4444; + _dri_texformat_argb1555 = &_mesa_texformat_argb1555; + _dri_texformat_al88 = &_mesa_texformat_al88; + } + else { + _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888_rev; + _dri_texformat_argb8888 = &_mesa_texformat_argb8888_rev; + _dri_texformat_rgb565 = &_mesa_texformat_rgb565_rev; + _dri_texformat_argb4444 = &_mesa_texformat_argb4444_rev; + _dri_texformat_argb1555 = &_mesa_texformat_argb1555_rev; + _dri_texformat_al88 = &_mesa_texformat_al88_rev; + } +} diff --git a/mesalib/src/mesa/drivers/dri/common/texmem.h b/mesalib/src/mesa/drivers/dri/common/texmem.h new file mode 100644 index 000000000..9c065da8b --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/texmem.h @@ -0,0 +1,333 @@ +/* + * Copyright 2000-2001 VA Linux Systems, Inc. + * (c) Copyright IBM Corporation 2002 + * 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 + * on 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 + * VA LINUX SYSTEM, IBM AND/OR THEIR 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: + * Ian Romanick + * Keith Whitwell + * Kevin E. Martin + * Gareth Hughes + */ + +/** \file texmem.h + * Public interface to the DRI texture memory management routines. + * + * \sa texmem.c + */ + +#ifndef DRI_TEXMEM_H +#define DRI_TEXMEM_H + +#include "main/mtypes.h" +#include "main/mm.h" +#include "xf86drm.h" + +struct dri_tex_heap; +typedef struct dri_tex_heap driTexHeap; + +struct dri_texture_object; +typedef struct dri_texture_object driTextureObject; + + +/** + * Base texture object type. Each driver will extend this type with its own + * private data members. + */ + +struct dri_texture_object { + struct dri_texture_object * next; + struct dri_texture_object * prev; + + driTexHeap * heap; /**< Texture heap currently stored in */ + struct gl_texture_object * tObj;/**< Pointer to Mesa texture object + * If NULL, this texture object is a + * "placeholder" object representing + * texture memory in use by another context. + * A placeholder should have a heap and a memBlock. + */ + struct mem_block *memBlock; /**< Memory block containing texture */ + + unsigned reserved; /**< Cannot be swapped out by user contexts. */ + + unsigned bound; /**< Bitmask indicating which tex units + * this texture object is bound to. + * Bit 0 = unit 0, Bit 1 = unit 1, etc + */ + + unsigned totalSize; /**< Total size of the texture, + * including all mipmap levels + */ + + unsigned dirty_images[6]; /**< Flags for whether or not images + * need to be uploaded to local or + * AGP texture space. One flag set + * for each cube face for cubic + * textures. Bit zero corresponds to + * the base-level, which may or may + * not be the level zero mipmap. + */ + + unsigned timestamp; /**< Timestamp used to + * synchronize with 3d engine + * in hardware where textures + * are uploaded directly to + * the framebuffer. + */ + + unsigned firstLevel; /**< Image in \c tObj->Image[0] that + * corresponds to the base-level of + * this texture object. + */ + + unsigned lastLevel; /**< Last image in \c tObj->Image[0] + * used by the + * current LOD settings of + * this texture object. This + * value must be greater than + * or equal to \c firstLevel. + */ +}; + + +typedef void (destroy_texture_object_t)( void * driverContext, + driTextureObject * t ); + +/** + * Client-private representation of texture memory state. + * + * Clients will place one or more of these structs in their driver + * context struct to manage one or more global texture heaps. + */ + +struct dri_tex_heap { + + /** Client-supplied heap identifier + */ + unsigned heapId; + + /** Pointer to the client's private context + */ + void *driverContext; + + /** Total size of the heap, in bytes + */ + unsigned size; + + /** \brief \f$log_2\f$ of size of single heap region + * + * Each context takes memory from the global texture heap in + * \f$2^{logGranularity}\f$ byte blocks. The value of + * \a logGranularity is based on the amount of memory represented + * by the heap and the maximum number of regions in the SAREA. Given + * \a b bytes of texture memory an \a n regions in the SAREA, + * \a logGranularity will be \f$\lfloor\log_2( b / n )\rfloor\f$. + */ + unsigned logGranularity; + + /** \brief Required alignment of allocations in this heap + * + * The alignment shift is supplied to \a mmAllocMem when memory is + * allocated from this heap. The value of \a alignmentShift will + * typically reflect some require of the hardware. This value has + * \b no \b relation to \a logGranularity. \a alignmentShift is a + * per-context value. + * + * \sa mmAllocMem + */ + unsigned alignmentShift; + + /** Number of elements in global list (the SAREA). + */ + unsigned nrRegions; + + /** Pointer to SAREA \a driTexRegion array + */ + drmTextureRegionPtr global_regions; + + /** Pointer to the texture state age (generation number) in the SAREA + */ + unsigned * global_age; + + /** Local age (generation number) of texture state + */ + unsigned local_age; + + /** Memory heap used to manage texture memory represented by + * this texture heap. + */ + struct mem_block * memory_heap; + + /** List of objects that we currently believe to be in texture + * memory. + */ + driTextureObject texture_objects; + + /** Pointer to the list of texture objects that are not in + * texture memory. + */ + driTextureObject * swapped_objects; + + /** Size of the driver-speicific texture object. + */ + unsigned texture_object_size; + + + /** + * \brief Function to destroy driver-specific texture object data. + * + * This function is supplied by the driver so that the texture manager + * can release all resources associated with a texture object. This + * function should only release driver-specific data. That is, + * \a driDestroyTextureObject will release the texture memory + * associated with the texture object, it will release the memory + * for the texture object itself, and it will unlink the texture + * object from the texture object lists. + * + * \param driverContext Pointer to the driver supplied context + * \param t Texture object that is to be destroyed + * \sa driDestroyTextureObject + */ + + destroy_texture_object_t * destroy_texture_object; + + + /** + */ + unsigned * texture_swaps; + + /** + * Timestamp used to synchronize with 3d engine in hardware + * where textures are uploaded directly to the + * framebuffer. + */ + unsigned timestamp; + + /** \brief Kick/upload weight + * + * When not enough free space is available this weight + * influences the choice of the heap from which textures are + * kicked. By default the weight is equal to the heap size. + */ + double weight; + + /** \brief Kick/upload duty + * + * The heap with the highest duty will be chosen for kicking + * textures if not enough free space is available. The duty is + * reduced by the amount of data kicked. Rebalancing of + * negative duties takes the weights into account. + */ + int duty; +}; + + + + +/** + * Called by the client on lock contention to determine whether textures have + * been stolen. If another client has modified a region in which we have + * textures, then we need to figure out which of our textures have been + * removed and update our global LRU. + * + * \param heap Texture heap to be updated + * \hideinitializer + */ + +#define DRI_AGE_TEXTURES( heap ) \ + do { \ + if ( ((heap) != NULL) \ + && ((heap)->local_age != (heap)->global_age[0]) ) \ + driAgeTextures( heap ); \ + } while( 0 ) + + + + +/* This should be called whenever there has been contention on the hardware + * lock. driAgeTextures should not be called directly. Instead, clients + * should use DRI_AGE_TEXTURES, above. + */ + +void driAgeTextures( driTexHeap * heap ); + +void driUpdateTextureLRU( driTextureObject * t ); +void driSwapOutTextureObject( driTextureObject * t ); +void driDestroyTextureObject( driTextureObject * t ); +int driAllocateTexture( driTexHeap * const * heap_array, unsigned nr_heaps, + driTextureObject * t ); + +GLboolean driIsTextureResident( GLcontext * ctx, + struct gl_texture_object * texObj ); + +driTexHeap * driCreateTextureHeap( unsigned heap_id, void * context, + unsigned size, unsigned alignmentShift, unsigned nr_regions, + drmTextureRegionPtr global_regions, unsigned * global_age, + driTextureObject * swapped_objects, unsigned texture_object_size, + destroy_texture_object_t * destroy_tex_obj ); +void driDestroyTextureHeap( driTexHeap * heap ); + +void +driCalculateMaxTextureLevels( driTexHeap * const * heaps, + unsigned nr_heaps, + struct gl_constants * limits, + unsigned max_bytes_per_texel, + unsigned max_2D_size, + unsigned max_3D_size, + unsigned max_cube_size, + unsigned max_rect_size, + unsigned mipmaps_at_once, + int all_textures_one_heap, + int allow_larger_textures ); + +void +driSetTextureSwapCounterLocation( driTexHeap * heap, unsigned * counter ); + +#define DRI_TEXMGR_DO_TEXTURE_1D 0x0001 +#define DRI_TEXMGR_DO_TEXTURE_2D 0x0002 +#define DRI_TEXMGR_DO_TEXTURE_3D 0x0004 +#define DRI_TEXMGR_DO_TEXTURE_CUBE 0x0008 +#define DRI_TEXMGR_DO_TEXTURE_RECT 0x0010 + +void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, + GLuint targets ); + +GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps, + unsigned nr_heaps, const driTextureObject * swapped ); + +extern void driCalculateTextureFirstLastLevel( driTextureObject * t ); + + +extern const struct gl_texture_format *_dri_texformat_rgba8888; +extern const struct gl_texture_format *_dri_texformat_argb8888; +extern const struct gl_texture_format *_dri_texformat_rgb565; +extern const struct gl_texture_format *_dri_texformat_argb4444; +extern const struct gl_texture_format *_dri_texformat_argb1555; +extern const struct gl_texture_format *_dri_texformat_al88; +extern const struct gl_texture_format *_dri_texformat_a8; +extern const struct gl_texture_format *_dri_texformat_ci8; +extern const struct gl_texture_format *_dri_texformat_i8; +extern const struct gl_texture_format *_dri_texformat_l8; + +extern void driInitTextureFormats( void ); + +#endif /* DRI_TEXMEM_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/utils.c b/mesalib/src/mesa/drivers/dri/common/utils.c new file mode 100644 index 000000000..66f277c10 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/utils.c @@ -0,0 +1,839 @@ +/* + * (C) Copyright IBM Corporation 2002, 2004 + * 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 + * on 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 + * VA LINUX SYSTEM, IBM AND/OR THEIR 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. + */ + +/** + * \file utils.c + * Utility functions for DRI drivers. + * + * \author Ian Romanick + */ + +#include +#include +#include "main/mtypes.h" +#include "main/cpuinfo.h" +#include "main/extensions.h" +#include "glapi/dispatch.h" +#include "utils.h" + + +int driDispatchRemapTable[ driDispatchRemapTable_size ]; + + +unsigned +driParseDebugString( const char * debug, + const struct dri_debug_control * control ) +{ + unsigned flag; + + + flag = 0; + if ( debug != NULL ) { + while( control->string != NULL ) { + if ( !strcmp( debug, "all" ) || + strstr( debug, control->string ) != NULL ) { + flag |= control->flag; + } + + control++; + } + } + + return flag; +} + + + +/** + * Create the \c GL_RENDERER string for DRI drivers. + * + * Almost all DRI drivers use a \c GL_RENDERER string of the form: + * + * "Mesa DRI " + * + * Using the supplied chip name, driver data, and AGP speed, this function + * creates the string. + * + * \param buffer Buffer to hold the \c GL_RENDERER string. + * \param hardware_name Name of the hardware. + * \param driver_date Driver date. + * \param agp_mode AGP mode (speed). + * + * \returns + * The length of the string stored in \c buffer. This does \b not include + * the terminating \c NUL character. + */ +unsigned +driGetRendererString( char * buffer, const char * hardware_name, + const char * driver_date, GLuint agp_mode ) +{ + unsigned offset; + char *cpu; + + offset = sprintf( buffer, "Mesa DRI %s %s", hardware_name, driver_date ); + + /* Append any AGP-specific information. + */ + switch ( agp_mode ) { + case 1: + case 2: + case 4: + case 8: + offset += sprintf( & buffer[ offset ], " AGP %ux", agp_mode ); + break; + + default: + break; + } + + /* Append any CPU-specific information. + */ + cpu = _mesa_get_cpu_string(); + if (cpu) { + offset += sprintf(buffer + offset, " %s", cpu); + _mesa_free(cpu); + } + + return offset; +} + + + + +#define need_GL_ARB_draw_buffers +#define need_GL_ARB_multisample +#define need_GL_ARB_texture_compression +#define need_GL_ARB_transpose_matrix +#define need_GL_ARB_vertex_buffer_object +#define need_GL_ARB_window_pos +#define need_GL_EXT_compiled_vertex_array +#define need_GL_EXT_multi_draw_arrays +#define need_GL_EXT_polygon_offset +#define need_GL_EXT_texture_object +#define need_GL_EXT_vertex_array +#define need_GL_IBM_multimode_draw_arrays +#define need_GL_MESA_window_pos + +/* These are needed in *all* drivers because Mesa internally implements + * certain functionality in terms of functions provided by these extensions. + * For example, glBlendFunc is implemented by calling glBlendFuncSeparateEXT. + */ +#define need_GL_EXT_blend_func_separate +#define need_GL_NV_vertex_program + +#include "extension_helper.h" + +static const struct dri_extension all_mesa_extensions[] = { + { "GL_ARB_draw_buffers", GL_ARB_draw_buffers_functions }, + { "GL_ARB_multisample", GL_ARB_multisample_functions }, + { "GL_ARB_texture_compression", GL_ARB_texture_compression_functions }, + { "GL_ARB_transpose_matrix", GL_ARB_transpose_matrix_functions }, + { "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, + { "GL_ARB_window_pos", GL_ARB_window_pos_functions }, + { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions }, + { "GL_EXT_compiled_vertex_array", GL_EXT_compiled_vertex_array_functions }, + { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions }, + { "GL_EXT_polygon_offset", GL_EXT_polygon_offset_functions }, + { "GL_EXT_texture_object", GL_EXT_texture_object_functions }, + { "GL_EXT_vertex_array", GL_EXT_vertex_array_functions }, + { "GL_IBM_multimode_draw_arrays", GL_IBM_multimode_draw_arrays_functions }, + { "GL_MESA_window_pos", GL_MESA_window_pos_functions }, + { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, + { NULL, NULL } +}; + + +/** + * Enable extensions supported by the driver. + * + * \bug + * ARB_imaging isn't handled properly. In Mesa, enabling ARB_imaging also + * enables all the sub-extensions that are folded into it. This means that + * we need to add entry-points (via \c driInitSingleExtension) for those + * new functions here. + */ +void driInitExtensions( GLcontext * ctx, + const struct dri_extension * extensions_to_enable, + GLboolean enable_imaging ) +{ + static int first_time = 1; + unsigned i; + + if ( first_time ) { + for ( i = 0 ; i < driDispatchRemapTable_size ; i++ ) { + driDispatchRemapTable[i] = -1; + } + + first_time = 0; + driInitExtensions( ctx, all_mesa_extensions, GL_FALSE ); + } + + if ( (ctx != NULL) && enable_imaging ) { + _mesa_enable_imaging_extensions( ctx ); + } + + for ( i = 0 ; extensions_to_enable[i].name != NULL ; i++ ) { + driInitSingleExtension( ctx, & extensions_to_enable[i] ); + } +} + + + + +/** + * Enable and add dispatch functions for a single extension + * + * \param ctx Context where extension is to be enabled. + * \param ext Extension that is to be enabled. + * + * \sa driInitExtensions, _mesa_enable_extension, _glapi_add_entrypoint + * + * \todo + * Determine if it would be better to use \c strlen instead of the hardcoded + * for-loops. + */ +void driInitSingleExtension( GLcontext * ctx, + const struct dri_extension * ext ) +{ + unsigned i; + + + if ( ext->functions != NULL ) { + for ( i = 0 ; ext->functions[i].strings != NULL ; i++ ) { + const char * functions[16]; + const char * parameter_signature; + const char * str = ext->functions[i].strings; + unsigned j; + unsigned offset; + + + /* Separate the parameter signature from the rest of the string. + * If the parameter signature is empty (i.e., the string starts + * with a NUL character), then the function has a void parameter + * list. + */ + parameter_signature = str; + while ( str[0] != '\0' ) { + str++; + } + str++; + + + /* Divide the string into the substrings that name each + * entry-point for the function. + */ + for ( j = 0 ; j < 16 ; j++ ) { + if ( str[0] == '\0' ) { + functions[j] = NULL; + break; + } + + functions[j] = str; + + while ( str[0] != '\0' ) { + str++; + } + str++; + } + + + /* Add each entry-point to the dispatch table. + */ + offset = _glapi_add_dispatch( functions, parameter_signature ); + if (offset == -1) { +#if 0 /* this causes noise with egl */ + fprintf(stderr, "DISPATCH ERROR! _glapi_add_dispatch failed " + "to add %s!\n", functions[0]); +#endif + } + else if (ext->functions[i].remap_index != -1) { + driDispatchRemapTable[ ext->functions[i].remap_index ] = + offset; + } + else if (ext->functions[i].offset != offset) { + fprintf(stderr, "DISPATCH ERROR! %s -> %u != %u\n", + functions[0], offset, ext->functions[i].offset); + } + } + } + + if ( ctx != NULL ) { + _mesa_enable_extension( ctx, ext->name ); + } +} + + +/** + * Utility function used by drivers to test the verions of other components. + * + * If one of the version requirements is not met, a message is logged using + * \c __driUtilMessage. + * + * \param driver_name Name of the driver. Used in error messages. + * \param driActual Actual DRI version supplied __driCreateNewScreen. + * \param driExpected Minimum DRI version required by the driver. + * \param ddxActual Actual DDX version supplied __driCreateNewScreen. + * \param ddxExpected Minimum DDX minor and range of DDX major version required by the driver. + * \param drmActual Actual DRM version supplied __driCreateNewScreen. + * \param drmExpected Minimum DRM version required by the driver. + * + * \returns \c GL_TRUE if all version requirements are met. Otherwise, + * \c GL_FALSE is returned. + * + * \sa __driCreateNewScreen, driCheckDriDdxDrmVersions2, __driUtilMessage + * + * \todo + * Now that the old \c driCheckDriDdxDrmVersions function is gone, this + * function and \c driCheckDriDdxDrmVersions2 should be renamed. + */ +GLboolean +driCheckDriDdxDrmVersions3(const char * driver_name, + const __DRIversion * driActual, + const __DRIversion * driExpected, + const __DRIversion * ddxActual, + const __DRIutilversion2 * ddxExpected, + const __DRIversion * drmActual, + const __DRIversion * drmExpected) +{ + static const char format[] = "%s DRI driver expected %s version %d.%d.x " + "but got version %d.%d.%d\n"; + static const char format2[] = "%s DRI driver expected %s version %d-%d.%d.x " + "but got version %d.%d.%d\n"; + + + /* Check the DRI version */ + if ( (driActual->major != driExpected->major) + || (driActual->minor < driExpected->minor) ) { + fprintf(stderr, format, driver_name, "DRI", + driExpected->major, driExpected->minor, + driActual->major, driActual->minor, driActual->patch); + return GL_FALSE; + } + + /* Check that the DDX driver version is compatible */ + /* for miniglx we pass in -1 so we can ignore the DDX version */ + if ( (ddxActual->major != -1) && ((ddxActual->major < ddxExpected->major_min) + || (ddxActual->major > ddxExpected->major_max) + || (ddxActual->minor < ddxExpected->minor)) ) { + fprintf(stderr, format2, driver_name, "DDX", + ddxExpected->major_min, ddxExpected->major_max, ddxExpected->minor, + ddxActual->major, ddxActual->minor, ddxActual->patch); + return GL_FALSE; + } + + /* Check that the DRM driver version is compatible */ + if ( (drmActual->major != drmExpected->major) + || (drmActual->minor < drmExpected->minor) ) { + fprintf(stderr, format, driver_name, "DRM", + drmExpected->major, drmExpected->minor, + drmActual->major, drmActual->minor, drmActual->patch); + return GL_FALSE; + } + + return GL_TRUE; +} + +GLboolean +driCheckDriDdxDrmVersions2(const char * driver_name, + const __DRIversion * driActual, + const __DRIversion * driExpected, + const __DRIversion * ddxActual, + const __DRIversion * ddxExpected, + const __DRIversion * drmActual, + const __DRIversion * drmExpected) +{ + __DRIutilversion2 ddx_expected; + ddx_expected.major_min = ddxExpected->major; + ddx_expected.major_max = ddxExpected->major; + ddx_expected.minor = ddxExpected->minor; + ddx_expected.patch = ddxExpected->patch; + return driCheckDriDdxDrmVersions3(driver_name, driActual, + driExpected, ddxActual, & ddx_expected, + drmActual, drmExpected); +} + +GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, + GLint *x, GLint *y, + GLsizei *width, GLsizei *height ) +{ + /* left clipping */ + if (*x < buffer->_Xmin) { + *width -= (buffer->_Xmin - *x); + *x = buffer->_Xmin; + } + + /* right clipping */ + if (*x + *width > buffer->_Xmax) + *width -= (*x + *width - buffer->_Xmax - 1); + + if (*width <= 0) + return GL_FALSE; + + /* bottom clipping */ + if (*y < buffer->_Ymin) { + *height -= (buffer->_Ymin - *y); + *y = buffer->_Ymin; + } + + /* top clipping */ + if (*y + *height > buffer->_Ymax) + *height -= (*y + *height - buffer->_Ymax - 1); + + if (*height <= 0) + return GL_FALSE; + + return GL_TRUE; +} + +/** + * Creates a set of \c __GLcontextModes that a driver will expose. + * + * A set of \c __GLcontextModes will be created based on the supplied + * parameters. The number of modes processed will be 2 * + * \c num_depth_stencil_bits * \c num_db_modes. + * + * For the most part, data is just copied from \c depth_bits, \c stencil_bits, + * \c db_modes, and \c visType into each \c __GLcontextModes element. + * However, the meanings of \c fb_format and \c fb_type require further + * explanation. The \c fb_format specifies which color components are in + * each pixel and what the default order is. For example, \c GL_RGB specifies + * that red, green, blue are available and red is in the "most significant" + * position and blue is in the "least significant". The \c fb_type specifies + * the bit sizes of each component and the actual ordering. For example, if + * \c GL_UNSIGNED_SHORT_5_6_5_REV is specified with \c GL_RGB, bits [15:11] + * are the blue value, bits [10:5] are the green value, and bits [4:0] are + * the red value. + * + * One sublte issue is the combination of \c GL_RGB or \c GL_BGR and either + * of the \c GL_UNSIGNED_INT_8_8_8_8 modes. The resulting mask values in the + * \c __GLcontextModes structure is \b identical to the \c GL_RGBA or + * \c GL_BGRA case, except the \c alphaMask is zero. This means that, as + * far as this routine is concerned, \c GL_RGB with \c GL_UNSIGNED_INT_8_8_8_8 + * still uses 32-bits. + * + * If in doubt, look at the tables used in the function. + * + * \param ptr_to_modes Pointer to a pointer to a linked list of + * \c __GLcontextModes. Upon completion, a pointer to + * the next element to be process will be stored here. + * If the function fails and returns \c GL_FALSE, this + * value will be unmodified, but some elements in the + * linked list may be modified. + * \param fb_format Format of the framebuffer. Currently only \c GL_RGB, + * \c GL_RGBA, \c GL_BGR, and \c GL_BGRA are supported. + * \param fb_type Type of the pixels in the framebuffer. Currently only + * \c GL_UNSIGNED_SHORT_5_6_5, + * \c GL_UNSIGNED_SHORT_5_6_5_REV, + * \c GL_UNSIGNED_INT_8_8_8_8, and + * \c GL_UNSIGNED_INT_8_8_8_8_REV are supported. + * \param depth_bits Array of depth buffer sizes to be exposed. + * \param stencil_bits Array of stencil buffer sizes to be exposed. + * \param num_depth_stencil_bits Number of entries in both \c depth_bits and + * \c stencil_bits. + * \param db_modes Array of buffer swap modes. If an element has a + * value of \c GLX_NONE, then it represents a + * single-buffered mode. Other valid values are + * \c GLX_SWAP_EXCHANGE_OML, \c GLX_SWAP_COPY_OML, and + * \c GLX_SWAP_UNDEFINED_OML. See the + * GLX_OML_swap_method extension spec for more details. + * \param num_db_modes Number of entries in \c db_modes. + * \param msaa_samples Array of msaa sample count. 0 represents a visual + * without a multisample buffer. + * \param num_msaa_modes Number of entries in \c msaa_samples. + * \param visType GLX visual type. Usually either \c GLX_TRUE_COLOR or + * \c GLX_DIRECT_COLOR. + * + * \returns + * \c GL_TRUE on success or \c GL_FALSE on failure. Currently the only + * cause of failure is a bad parameter (i.e., unsupported \c fb_format or + * \c fb_type). + * + * \todo + * There is currently no way to support packed RGB modes (i.e., modes with + * exactly 3 bytes per pixel) or floating-point modes. This could probably + * be done by creating some new, private enums with clever names likes + * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32, + * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it. + */ +__DRIconfig ** +driCreateConfigs(GLenum fb_format, GLenum fb_type, + const uint8_t * depth_bits, const uint8_t * stencil_bits, + unsigned num_depth_stencil_bits, + const GLenum * db_modes, unsigned num_db_modes, + const uint8_t * msaa_samples, unsigned num_msaa_modes) +{ + static const uint8_t bits_table[4][4] = { + /* R G B A */ + { 3, 3, 2, 0 }, /* Any GL_UNSIGNED_BYTE_3_3_2 */ + { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */ + { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */ + { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */ + }; + + static const uint32_t masks_table_rgb[6][4] = { + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ + { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ + { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */ + { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000 }, /* 8_8_8_8 */ + { 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 } /* 8_8_8_8_REV */ + }; + + static const uint32_t masks_table_rgba[6][4] = { + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 3_3_2 */ + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 2_3_3_REV */ + { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5 */ + { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5_REV */ + { 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF }, /* 8_8_8_8 */ + { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }, /* 8_8_8_8_REV */ + }; + + static const uint32_t masks_table_bgr[6][4] = { + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ + { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ + { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */ + { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000 }, /* 8_8_8_8 */ + { 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 }, /* 8_8_8_8_REV */ + }; + + static const uint32_t masks_table_bgra[6][4] = { + { 0x00000007, 0x00000038, 0x000000C0, 0x00000000 }, /* 3_3_2 */ + { 0x000000E0, 0x0000001C, 0x00000003, 0x00000000 }, /* 2_3_3_REV */ + { 0x0000001F, 0x000007E0, 0x0000F800, 0x00000000 }, /* 5_6_5 */ + { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }, /* 5_6_5_REV */ + { 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF }, /* 8_8_8_8 */ + { 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 }, /* 8_8_8_8_REV */ + }; + + static const uint8_t bytes_per_pixel[6] = { + 1, /* 3_3_2 */ + 1, /* 2_3_3_REV */ + 2, /* 5_6_5 */ + 2, /* 5_6_5_REV */ + 4, /* 8_8_8_8 */ + 4 /* 8_8_8_8_REV */ + }; + + const uint8_t * bits; + const uint32_t * masks; + int index; + __DRIconfig **configs, **c; + __GLcontextModes *modes; + unsigned i, j, k, h; + unsigned num_modes; + unsigned num_accum_bits = 2; + + switch ( fb_type ) { + case GL_UNSIGNED_BYTE_3_3_2: + index = 0; + break; + case GL_UNSIGNED_BYTE_2_3_3_REV: + index = 1; + break; + case GL_UNSIGNED_SHORT_5_6_5: + index = 2; + break; + case GL_UNSIGNED_SHORT_5_6_5_REV: + index = 3; + break; + case GL_UNSIGNED_INT_8_8_8_8: + index = 4; + break; + case GL_UNSIGNED_INT_8_8_8_8_REV: + index = 5; + break; + default: + fprintf( stderr, "[%s:%u] Unknown framebuffer type 0x%04x.\n", + __FUNCTION__, __LINE__, fb_type ); + return NULL; + } + + + /* Valid types are GL_UNSIGNED_SHORT_5_6_5 and GL_UNSIGNED_INT_8_8_8_8 and + * the _REV versions. + * + * Valid formats are GL_RGBA, GL_RGB, and GL_BGRA. + */ + + switch ( fb_format ) { + case GL_RGB: + masks = masks_table_rgb[ index ]; + break; + + case GL_RGBA: + masks = masks_table_rgba[ index ]; + break; + + case GL_BGR: + masks = masks_table_bgr[ index ]; + break; + + case GL_BGRA: + masks = masks_table_bgra[ index ]; + break; + + default: + fprintf( stderr, "[%s:%u] Unknown framebuffer format 0x%04x.\n", + __FUNCTION__, __LINE__, fb_format ); + return NULL; + } + + switch ( bytes_per_pixel[ index ] ) { + case 1: + bits = bits_table[0]; + break; + case 2: + bits = bits_table[1]; + break; + default: + bits = ((fb_format == GL_RGB) || (fb_format == GL_BGR)) + ? bits_table[2] + : bits_table[3]; + break; + } + + num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes; + configs = _mesa_calloc((num_modes + 1) * sizeof *configs); + if (configs == NULL) + return NULL; + + c = configs; + for ( k = 0 ; k < num_depth_stencil_bits ; k++ ) { + for ( i = 0 ; i < num_db_modes ; i++ ) { + for ( h = 0 ; h < num_msaa_modes; h++ ) { + for ( j = 0 ; j < num_accum_bits ; j++ ) { + *c = _mesa_malloc (sizeof **c); + modes = &(*c)->modes; + c++; + + memset(modes, 0, sizeof *modes); + modes->redBits = bits[0]; + modes->greenBits = bits[1]; + modes->blueBits = bits[2]; + modes->alphaBits = bits[3]; + modes->redMask = masks[0]; + modes->greenMask = masks[1]; + modes->blueMask = masks[2]; + modes->alphaMask = masks[3]; + modes->rgbBits = modes->redBits + modes->greenBits + + modes->blueBits + modes->alphaBits; + + modes->accumRedBits = 16 * j; + modes->accumGreenBits = 16 * j; + modes->accumBlueBits = 16 * j; + modes->accumAlphaBits = (masks[3] != 0) ? 16 * j : 0; + modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG; + + modes->stencilBits = stencil_bits[k]; + modes->depthBits = depth_bits[k]; + + modes->transparentPixel = GLX_NONE; + modes->transparentRed = GLX_DONT_CARE; + modes->transparentGreen = GLX_DONT_CARE; + modes->transparentBlue = GLX_DONT_CARE; + modes->transparentAlpha = GLX_DONT_CARE; + modes->transparentIndex = GLX_DONT_CARE; + modes->visualType = GLX_DONT_CARE; + modes->renderType = GLX_RGBA_BIT; + modes->drawableType = GLX_WINDOW_BIT; + modes->rgbMode = GL_TRUE; + + if ( db_modes[i] == GLX_NONE ) { + modes->doubleBufferMode = GL_FALSE; + } + else { + modes->doubleBufferMode = GL_TRUE; + modes->swapMethod = db_modes[i]; + } + + modes->samples = msaa_samples[h]; + modes->sampleBuffers = modes->samples ? 1 : 0; + + + modes->haveAccumBuffer = ((modes->accumRedBits + + modes->accumGreenBits + + modes->accumBlueBits + + modes->accumAlphaBits) > 0); + modes->haveDepthBuffer = (modes->depthBits > 0); + modes->haveStencilBuffer = (modes->stencilBits > 0); + + modes->bindToTextureRgb = GL_TRUE; + modes->bindToTextureRgba = GL_TRUE; + modes->bindToMipmapTexture = GL_FALSE; + modes->bindToTextureTargets = modes->rgbMode ? + __DRI_ATTRIB_TEXTURE_1D_BIT | + __DRI_ATTRIB_TEXTURE_2D_BIT | + __DRI_ATTRIB_TEXTURE_RECTANGLE_BIT : + 0; + } + } + } + } + *c = NULL; + + return configs; +} + +__DRIconfig **driConcatConfigs(__DRIconfig **a, + __DRIconfig **b) +{ + __DRIconfig **all; + int i, j, index; + + i = 0; + while (a[i] != NULL) + i++; + j = 0; + while (b[j] != NULL) + j++; + + all = _mesa_malloc((i + j + 1) * sizeof *all); + index = 0; + for (i = 0; a[i] != NULL; i++) + all[index++] = a[i]; + for (j = 0; b[j] != NULL; j++) + all[index++] = b[j]; + all[index++] = NULL; + + _mesa_free(a); + _mesa_free(b); + + return all; +} + +#define __ATTRIB(attrib, field) \ + { attrib, offsetof(__GLcontextModes, field) } + +static const struct { unsigned int attrib, offset; } attribMap[] = { + __ATTRIB(__DRI_ATTRIB_BUFFER_SIZE, rgbBits), + __ATTRIB(__DRI_ATTRIB_LEVEL, level), + __ATTRIB(__DRI_ATTRIB_RED_SIZE, redBits), + __ATTRIB(__DRI_ATTRIB_GREEN_SIZE, greenBits), + __ATTRIB(__DRI_ATTRIB_BLUE_SIZE, blueBits), + __ATTRIB(__DRI_ATTRIB_ALPHA_SIZE, alphaBits), + __ATTRIB(__DRI_ATTRIB_DEPTH_SIZE, depthBits), + __ATTRIB(__DRI_ATTRIB_STENCIL_SIZE, stencilBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_RED_SIZE, accumRedBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_GREEN_SIZE, accumGreenBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_BLUE_SIZE, accumBlueBits), + __ATTRIB(__DRI_ATTRIB_ACCUM_ALPHA_SIZE, accumAlphaBits), + __ATTRIB(__DRI_ATTRIB_SAMPLE_BUFFERS, sampleBuffers), + __ATTRIB(__DRI_ATTRIB_SAMPLES, samples), + __ATTRIB(__DRI_ATTRIB_DOUBLE_BUFFER, doubleBufferMode), + __ATTRIB(__DRI_ATTRIB_STEREO, stereoMode), + __ATTRIB(__DRI_ATTRIB_AUX_BUFFERS, numAuxBuffers), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_TYPE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_INDEX_VALUE, transparentPixel), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_RED_VALUE, transparentRed), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_GREEN_VALUE, transparentGreen), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_BLUE_VALUE, transparentBlue), + __ATTRIB(__DRI_ATTRIB_TRANSPARENT_ALPHA_VALUE, transparentAlpha), + __ATTRIB(__DRI_ATTRIB_FLOAT_MODE, floatMode), + __ATTRIB(__DRI_ATTRIB_RED_MASK, redMask), + __ATTRIB(__DRI_ATTRIB_GREEN_MASK, greenMask), + __ATTRIB(__DRI_ATTRIB_BLUE_MASK, blueMask), + __ATTRIB(__DRI_ATTRIB_ALPHA_MASK, alphaMask), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_WIDTH, maxPbufferWidth), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_HEIGHT, maxPbufferHeight), + __ATTRIB(__DRI_ATTRIB_MAX_PBUFFER_PIXELS, maxPbufferPixels), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_WIDTH, optimalPbufferWidth), + __ATTRIB(__DRI_ATTRIB_OPTIMAL_PBUFFER_HEIGHT, optimalPbufferHeight), + __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, swapMethod), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGB, bindToTextureRgb), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_RGBA, bindToTextureRgba), + __ATTRIB(__DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE, bindToMipmapTexture), + __ATTRIB(__DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS, bindToTextureTargets), + __ATTRIB(__DRI_ATTRIB_YINVERTED, yInverted), + + /* The struct field doesn't matter here, these are handled by the + * switch in driGetConfigAttribIndex. We need them in the array + * so the iterator includes them though.*/ + __ATTRIB(__DRI_ATTRIB_RENDER_TYPE, level), + __ATTRIB(__DRI_ATTRIB_CONFIG_CAVEAT, level), + __ATTRIB(__DRI_ATTRIB_SWAP_METHOD, level) +}; + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + +static int +driGetConfigAttribIndex(const __DRIconfig *config, + unsigned int index, unsigned int *value) +{ + switch (attribMap[index].attrib) { + case __DRI_ATTRIB_RENDER_TYPE: + if (config->modes.rgbMode) + *value = __DRI_ATTRIB_RGBA_BIT; + else + *value = __DRI_ATTRIB_COLOR_INDEX_BIT; + break; + case __DRI_ATTRIB_CONFIG_CAVEAT: + if (config->modes.visualRating == GLX_NON_CONFORMANT_CONFIG) + *value = __DRI_ATTRIB_NON_CONFORMANT_CONFIG; + else if (config->modes.visualRating == GLX_SLOW_CONFIG) + *value = __DRI_ATTRIB_SLOW_BIT; + else + *value = 0; + break; + case __DRI_ATTRIB_SWAP_METHOD: + break; + + case __DRI_ATTRIB_FLOAT_MODE: + *value = config->modes.floatMode; + break; + + default: + *value = *(unsigned int *) + ((char *) &config->modes + attribMap[index].offset); + + break; + } + + return GL_TRUE; +} + +int +driGetConfigAttrib(const __DRIconfig *config, + unsigned int attrib, unsigned int *value) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(attribMap); i++) + if (attribMap[i].attrib == attrib) + return driGetConfigAttribIndex(config, i, value); + + return GL_FALSE; +} + +int +driIndexConfigAttrib(const __DRIconfig *config, int index, + unsigned int *attrib, unsigned int *value) +{ + if (index >= 0 && index < ARRAY_SIZE(attribMap)) { + *attrib = attribMap[index].attrib; + return driGetConfigAttribIndex(config, index, value); + } + + return GL_FALSE; +} diff --git a/mesalib/src/mesa/drivers/dri/common/utils.h b/mesalib/src/mesa/drivers/dri/common/utils.h new file mode 100644 index 000000000..9e9e5bc22 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/utils.h @@ -0,0 +1,147 @@ +/* + * (C) Copyright IBM Corporation 2002, 2004 + * 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 + * on 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 + * VA LINUX SYSTEM, IBM AND/OR THEIR 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: + * Ian Romanick + */ + +#ifndef DRI_DEBUG_H +#define DRI_DEBUG_H + +#include +#include +#include "main/context.h" + +typedef struct __DRIutilversionRec2 __DRIutilversion2; + +struct dri_debug_control { + const char * string; + unsigned flag; +}; + +/** + * Description of the entry-points and parameters for an OpenGL function. + */ +struct dri_extension_function { + /** + * \brief + * Packed string describing the parameter signature and the entry-point + * names. + * + * The parameter signature and the names of the entry-points for this + * function are packed into a single string. The substrings are + * separated by NUL characters. The whole string is terminated by + * two consecutive NUL characters. + */ + const char * strings; + + + /** + * Location in the remap table where the dispatch offset should be + * stored. + */ + int remap_index; + + /** + * Offset of the function in the dispatch table. + */ + int offset; +}; + +/** + * Description of the API for an extension to OpenGL. + */ +struct dri_extension { + /** + * Name of the extension. + */ + const char * name; + + + /** + * Pointer to a list of \c dri_extension_function structures. The list + * is terminated by a structure with a \c NULL + * \c dri_extension_function::strings pointer. + */ + const struct dri_extension_function * functions; +}; + +/** + * Used to store a version which includes a major range instead of a single + * major version number. + */ +struct __DRIutilversionRec2 { + int major_min; /** min allowed Major version number. */ + int major_max; /** max allowed Major version number. */ + int minor; /**< Minor version number. */ + int patch; /**< Patch-level. */ +}; + +extern unsigned driParseDebugString( const char * debug, + const struct dri_debug_control * control ); + +extern unsigned driGetRendererString( char * buffer, + const char * hardware_name, const char * driver_date, GLuint agp_mode ); + +extern void driInitExtensions( GLcontext * ctx, + const struct dri_extension * card_extensions, GLboolean enable_imaging ); + +extern void driInitSingleExtension( GLcontext * ctx, + const struct dri_extension * ext ); + +extern GLboolean driCheckDriDdxDrmVersions2(const char * driver_name, + const __DRIversion * driActual, const __DRIversion * driExpected, + const __DRIversion * ddxActual, const __DRIversion * ddxExpected, + const __DRIversion * drmActual, const __DRIversion * drmExpected); + +extern GLboolean driCheckDriDdxDrmVersions3(const char * driver_name, + const __DRIversion * driActual, const __DRIversion * driExpected, + const __DRIversion * ddxActual, const __DRIutilversion2 * ddxExpected, + const __DRIversion * drmActual, const __DRIversion * drmExpected); + +extern GLboolean driClipRectToFramebuffer( const GLframebuffer *buffer, + GLint *x, GLint *y, + GLsizei *width, GLsizei *height ); + +struct __DRIconfigRec { + __GLcontextModes modes; +}; + +extern __DRIconfig ** +driCreateConfigs(GLenum fb_format, GLenum fb_type, + const uint8_t * depth_bits, const uint8_t * stencil_bits, + unsigned num_depth_stencil_bits, + const GLenum * db_modes, unsigned num_db_modes, + const uint8_t * msaa_samples, unsigned num_msaa_modes); + +__DRIconfig **driConcatConfigs(__DRIconfig **a, + __DRIconfig **b); + +int +driGetConfigAttrib(const __DRIconfig *config, + unsigned int attrib, unsigned int *value); +int +driIndexConfigAttrib(const __DRIconfig *config, int index, + unsigned int *attrib, unsigned int *value); + +#endif /* DRI_DEBUG_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/vblank.c b/mesalib/src/mesa/drivers/dri/common/vblank.c new file mode 100644 index 000000000..12aeaa108 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/vblank.c @@ -0,0 +1,434 @@ +/* -*- mode: c; c-basic-offset: 3 -*- */ +/* + * (c) Copyright IBM Corporation 2002 + * 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 + * on 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 + * VA LINUX SYSTEM, IBM AND/OR THEIR 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: + * Ian Romanick + */ + +#include "main/glheader.h" +#include "xf86drm.h" +#include "main/mtypes.h" +#include "main/macros.h" +#include "main/dd.h" +#include "vblank.h" +#include "xmlpool.h" + +static unsigned int msc_to_vblank(__DRIdrawablePrivate * dPriv, int64_t msc) +{ + return (unsigned int)(msc - dPriv->msc_base + dPriv->vblank_base); +} + +static int64_t vblank_to_msc(__DRIdrawablePrivate * dPriv, unsigned int vblank) +{ + return (int64_t)(vblank - dPriv->vblank_base + dPriv->msc_base); +} + + +/****************************************************************************/ +/** + * Get the current MSC refresh counter. + * + * Stores the 64-bit count of vertical refreshes since some (arbitrary) + * point in time in \c count. Unless the value wraps around, which it + * may, it will never decrease for a given drawable. + * + * \warning This function is called from \c glXGetVideoSyncSGI, which expects + * a \c count of type \c unsigned (32-bit), and \c glXGetSyncValuesOML, which + * expects a \c count of type \c int64_t (signed 64-bit). The kernel ioctl + * currently always returns a \c sequence of type \c unsigned. + * + * \param priv Pointer to the DRI screen private struct. + * \param dPriv Pointer to the DRI drawable private struct + * \param count Storage to hold MSC counter. + * \return Zero is returned on success. A negative errno value + * is returned on failure. + */ +int driDrawableGetMSC32( __DRIscreenPrivate * priv, + __DRIdrawablePrivate * dPriv, + int64_t * count) +{ + drmVBlank vbl; + int ret; + + /* Don't wait for anything. Just get the current refresh count. */ + + vbl.request.type = DRM_VBLANK_RELATIVE; + vbl.request.sequence = 0; + if ( dPriv && dPriv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; + + ret = drmWaitVBlank( priv->fd, &vbl ); + + if (dPriv) { + *count = vblank_to_msc(dPriv, vbl.reply.sequence); + } else { + /* Old driver (no knowledge of drawable MSC callback) */ + *count = vbl.reply.sequence; + } + + return ret; +} + +/****************************************************************************/ +/** + * Wait for a specified refresh count. This implements most of the + * functionality of \c glXWaitForMscOML from the GLX_OML_sync_control spec. + * Waits for the \c target_msc refresh. If that has already passed, it + * waits until \f$(MSC \bmod divisor)\f$ is equal to \c remainder. If + * \c target_msc is 0, use the behavior of glXWaitVideoSyncSGI(), which + * omits the initial check against a target MSC value. + * + * This function is actually something of a hack. The problem is that, at + * the time of this writing, none of the existing DRM modules support an + * ioctl that returns a 64-bit count (at least not on 32-bit platforms). + * However, this function exists to support a GLX function that requires + * the use of 64-bit counts. As such, there is a little bit of ugly + * hackery at the end of this function to make the 32-bit count act like + * a 64-bit count. There are still some cases where this will break, but + * I believe it catches the most common cases. + * + * The real solution is to provide an ioctl that uses a 64-bit count. + * + * \param dpy Pointer to the \c Display. + * \param priv Pointer to the DRI drawable private. + * \param target_msc Desired refresh count to wait for. A value of 0 + * means to use the glXWaitVideoSyncSGI() behavior. + * \param divisor MSC divisor if \c target_msc is already reached. + * \param remainder Desired MSC remainder if \c target_msc is already + * reached. + * \param msc Buffer to hold MSC when done waiting. + * + * \return Zero on success or \c GLX_BAD_CONTEXT on failure. + */ + +int driWaitForMSC32( __DRIdrawablePrivate *priv, + int64_t target_msc, int64_t divisor, int64_t remainder, + int64_t * msc ) +{ + drmVBlank vbl; + + + if ( divisor != 0 ) { + int64_t next = target_msc; + int64_t r; + int dont_wait = (target_msc == 0); + + do { + /* dont_wait means we're using the glXWaitVideoSyncSGI() behavior. + * The first time around, just get the current count and proceed + * to the test for (MSC % divisor) == remainder. + */ + vbl.request.type = dont_wait ? DRM_VBLANK_RELATIVE : + DRM_VBLANK_ABSOLUTE; + vbl.request.sequence = next ? msc_to_vblank(priv, next) : 0; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; + + if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) { + /* FIXME: This doesn't seem like the right thing to return here. + */ + return GLX_BAD_CONTEXT; + } + + *msc = vblank_to_msc(priv, vbl.reply.sequence); + + if (!dont_wait && *msc == next) + break; + dont_wait = 0; + + /* Assuming the wait-done test fails, the next refresh to wait for + * will be one that satisfies (MSC % divisor) == remainder. The + * value (MSC - (MSC % divisor) + remainder) is the refresh value + * closest to the current value that would satisfy the equation. + * If this refresh has already happened, we add divisor to obtain + * the next refresh after the current one that will satisfy it. + */ + r = ((uint64_t)*msc % divisor); + next = (*msc - r + remainder); + if (next <= *msc) + next += divisor; + + } while (r != remainder); + } + else { + /* If the \c divisor is zero, just wait until the MSC is greater + * than or equal to \c target_msc. + */ + + vbl.request.type = DRM_VBLANK_ABSOLUTE; + vbl.request.sequence = target_msc ? msc_to_vblank(priv, target_msc) : 0; + + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; + + if ( drmWaitVBlank( priv->driScreenPriv->fd, &vbl ) != 0 ) { + /* FIXME: This doesn't seem like the right thing to return here. + */ + return GLX_BAD_CONTEXT; + } + } + + *msc = vblank_to_msc(priv, vbl.reply.sequence); + + if ( *msc < target_msc ) { + *msc += 0x0000000100000000LL; + } + + return 0; +} + + +/****************************************************************************/ +/** + * Gets a set of default vertical-blank-wait flags based on the internal GLX + * API version and several configuration options. + */ + +GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ) +{ + GLuint flags = VBLANK_FLAG_INTERVAL; + int vblank_mode; + + + if ( driCheckOption( optionCache, "vblank_mode", DRI_ENUM ) ) + vblank_mode = driQueryOptioni( optionCache, "vblank_mode" ); + else + vblank_mode = DRI_CONF_VBLANK_DEF_INTERVAL_1; + + switch (vblank_mode) { + case DRI_CONF_VBLANK_NEVER: + flags = 0; + break; + case DRI_CONF_VBLANK_DEF_INTERVAL_0: + break; + case DRI_CONF_VBLANK_DEF_INTERVAL_1: + flags |= VBLANK_FLAG_THROTTLE; + break; + case DRI_CONF_VBLANK_ALWAYS_SYNC: + flags |= VBLANK_FLAG_SYNC; + break; + } + + return flags; +} + + +/****************************************************************************/ +/** + * Wrapper to call \c drmWaitVBlank. The main purpose of this function is to + * wrap the error message logging. The error message should only be logged + * the first time the \c drmWaitVBlank fails. If \c drmWaitVBlank is + * successful, \c vbl_seq will be set the sequence value in the reply. + * + * \param vbl Pointer to drmVBlank packet desribing how to wait. + * \param vbl_seq Location to store the current refresh counter. + * \param fd File descriptor use to call into the DRM. + * \return Zero on success or -1 on failure. + */ + +static int do_wait( drmVBlank * vbl, GLuint * vbl_seq, int fd ) +{ + int ret; + + + ret = drmWaitVBlank( fd, vbl ); + if ( ret != 0 ) { + static GLboolean first_time = GL_TRUE; + + if ( first_time ) { + fprintf(stderr, + "%s: drmWaitVBlank returned %d, IRQs don't seem to be" + " working correctly.\nTry adjusting the vblank_mode" + " configuration parameter.\n", __FUNCTION__, ret); + first_time = GL_FALSE; + } + + return -1; + } + + *vbl_seq = vbl->reply.sequence; + return 0; +} + + +/****************************************************************************/ +/** + * Returns the default swap interval of the given drawable. + */ + +static unsigned +driGetDefaultVBlankInterval( const __DRIdrawablePrivate *priv ) +{ + if ( (priv->vblFlags & (VBLANK_FLAG_THROTTLE | VBLANK_FLAG_SYNC)) != 0 ) { + return 1; + } + else { + return 0; + } +} + + +/****************************************************************************/ +/** + * Sets the default swap interval when the drawable is first bound to a + * direct rendering context. + */ + +void driDrawableInitVBlank( __DRIdrawablePrivate *priv ) +{ + if ( priv->swap_interval == (unsigned)-1 && + !( priv->vblFlags & VBLANK_FLAG_NO_IRQ ) ) { + /* Get current vertical blank sequence */ + drmVBlank vbl; + + vbl.request.type = DRM_VBLANK_RELATIVE; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) + vbl.request.type |= DRM_VBLANK_SECONDARY; + vbl.request.sequence = 0; + do_wait( &vbl, &priv->vblSeq, priv->driScreenPriv->fd ); + priv->vblank_base = priv->vblSeq; + + priv->swap_interval = driGetDefaultVBlankInterval( priv ); + } +} + + +/****************************************************************************/ +/** + * Returns the current swap interval of the given drawable. + */ + +unsigned +driGetVBlankInterval( const __DRIdrawablePrivate *priv ) +{ + if ( (priv->vblFlags & VBLANK_FLAG_INTERVAL) != 0 ) { + /* this must have been initialized when the drawable was first bound + * to a direct rendering context. */ + assert ( priv->swap_interval != (unsigned)-1 ); + + return priv->swap_interval; + } + else + return driGetDefaultVBlankInterval( priv ); +} + + +/****************************************************************************/ +/** + * Returns the current vertical blank sequence number of the given drawable. + */ + +void +driGetCurrentVBlank( __DRIdrawablePrivate *priv ) +{ + drmVBlank vbl; + + vbl.request.type = DRM_VBLANK_RELATIVE; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) { + vbl.request.type |= DRM_VBLANK_SECONDARY; + } + vbl.request.sequence = 0; + + (void) do_wait( &vbl, &priv->vblSeq, priv->driScreenPriv->fd ); +} + + +/****************************************************************************/ +/** + * Waits for the vertical blank for use with glXSwapBuffers. + * + * \param missed_deadline Set to \c GL_TRUE if the MSC after waiting is later + * than the "target" based on \c priv->vblFlags. The idea is + * that if \c missed_deadline is set, then the application is + * not achieving its desired framerate. + * \return Zero on success, -1 on error. + */ + +int +driWaitForVBlank( __DRIdrawablePrivate *priv, GLboolean * missed_deadline ) +{ + drmVBlank vbl; + unsigned original_seq; + unsigned deadline; + unsigned interval; + unsigned diff; + + *missed_deadline = GL_FALSE; + if ( (priv->vblFlags & (VBLANK_FLAG_INTERVAL | + VBLANK_FLAG_THROTTLE | + VBLANK_FLAG_SYNC)) == 0 || + (priv->vblFlags & VBLANK_FLAG_NO_IRQ) != 0 ) { + return 0; + } + + + /* VBLANK_FLAG_SYNC means to wait for at least one vertical blank. If + * that flag is not set, do a fake wait for zero vertical blanking + * periods so that we can get the current MSC. + * + * VBLANK_FLAG_INTERVAL and VBLANK_FLAG_THROTTLE mean to wait for at + * least one vertical blank since the last wait. Since do_wait modifies + * priv->vblSeq, we have to save the original value of priv->vblSeq for the + * VBLANK_FLAG_INTERVAL / VBLANK_FLAG_THROTTLE calculation later. + */ + + original_seq = priv->vblSeq; + interval = driGetVBlankInterval(priv); + deadline = original_seq + interval; + + vbl.request.type = DRM_VBLANK_RELATIVE; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) { + vbl.request.type |= DRM_VBLANK_SECONDARY; + } + vbl.request.sequence = ((priv->vblFlags & VBLANK_FLAG_SYNC) != 0) ? 1 : 0; + + if ( do_wait( & vbl, &priv->vblSeq, priv->driScreenPriv->fd ) != 0 ) { + return -1; + } + + diff = priv->vblSeq - deadline; + + /* No need to wait again if we've already reached the target */ + if (diff <= (1 << 23)) { + *missed_deadline = (priv->vblFlags & VBLANK_FLAG_SYNC) ? (diff > 0) : + GL_TRUE; + return 0; + } + + /* Wait until the target vertical blank. */ + vbl.request.type = DRM_VBLANK_ABSOLUTE; + if ( priv->vblFlags & VBLANK_FLAG_SECONDARY ) { + vbl.request.type |= DRM_VBLANK_SECONDARY; + } + vbl.request.sequence = deadline; + + if ( do_wait( & vbl, &priv->vblSeq, priv->driScreenPriv->fd ) != 0 ) { + return -1; + } + + diff = priv->vblSeq - deadline; + *missed_deadline = diff > 0 && diff <= (1 << 23); + + return 0; +} diff --git a/mesalib/src/mesa/drivers/dri/common/vblank.h b/mesalib/src/mesa/drivers/dri/common/vblank.h new file mode 100644 index 000000000..8b2c761a1 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/vblank.h @@ -0,0 +1,75 @@ +/* -*- mode: c; c-basic-offset: 3 -*- */ +/* + * (c) Copyright IBM Corporation 2002 + * 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 + * on 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 + * VA LINUX SYSTEM, IBM AND/OR THEIR 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: + * Ian Romanick + */ + +#ifndef DRI_VBLANK_H +#define DRI_VBLANK_H + +#include "main/context.h" +#include "dri_util.h" +#include "xmlconfig.h" + +#define VBLANK_FLAG_INTERVAL (1U << 0) /* Respect the swap_interval setting + */ +#define VBLANK_FLAG_THROTTLE (1U << 1) /* Wait 1 refresh since last call. + */ +#define VBLANK_FLAG_SYNC (1U << 2) /* Sync to the next refresh. + */ +#define VBLANK_FLAG_NO_IRQ (1U << 7) /* DRM has no IRQ to wait on. + */ +#define VBLANK_FLAG_SECONDARY (1U << 8) /* Wait for secondary vblank. + */ + +extern int driGetMSC32( __DRIscreenPrivate * priv, int64_t * count ); +extern int driDrawableGetMSC32( __DRIscreenPrivate * priv, + __DRIdrawablePrivate * drawablePrivate, + int64_t * count); +extern int driWaitForMSC32( __DRIdrawablePrivate *priv, + int64_t target_msc, int64_t divisor, int64_t remainder, int64_t * msc ); +extern GLuint driGetDefaultVBlankFlags( const driOptionCache *optionCache ); +extern void driDrawableInitVBlank ( __DRIdrawablePrivate *priv ); +extern unsigned driGetVBlankInterval( const __DRIdrawablePrivate *priv ); +extern void driGetCurrentVBlank( __DRIdrawablePrivate *priv ); +extern int driWaitForVBlank( __DRIdrawablePrivate *priv, + GLboolean * missed_deadline ); + +#undef usleep +#include /* for usleep() */ +#include /* for sched_yield() */ + +#ifdef linux +#include /* for sched_yield() */ +#endif + +#define DO_USLEEP(nr) \ + do { \ + if (0) fprintf(stderr, "%s: usleep for %u\n", __FUNCTION__, nr ); \ + if (1) usleep( nr ); \ + sched_yield(); \ + } while( 0 ) + +#endif /* DRI_VBLANK_H */ diff --git a/mesalib/src/mesa/drivers/dri/common/xmlconfig.c b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c new file mode 100644 index 000000000..46ba2ffbf --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/xmlconfig.c @@ -0,0 +1,1008 @@ +/* + * XML DRI client-side driver configuration + * Copyright (C) 2003 Felix Kuehling + * + * 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 + * FELIX KUEHLING, OR ANY OTHER CONTRIBUTORS 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. + * + */ +/** + * \file xmlconfig.c + * \brief Driver-independent client-side part of the XML configuration + * \author Felix Kuehling + */ + +#include "main/glheader.h" + +#include +#include +#include +#include +#include +#include +#include "main/imports.h" +#include "dri_util.h" +#include "xmlconfig.h" + +/* + * OS dependent ways of getting the name of the running program + */ +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include +#endif + +#undef GET_PROGRAM_NAME + +#if (defined(__GNU_LIBRARY__) || defined(__GLIBC__)) && !defined(__UCLIBC__) +# if !defined(__GLIBC__) || (__GLIBC__ < 2) +/* These aren't declared in any libc5 header */ +extern char *program_invocation_name, *program_invocation_short_name; +# endif +# define GET_PROGRAM_NAME() program_invocation_short_name +#elif defined(__FreeBSD__) && (__FreeBSD__ >= 2) +# include +# if (__FreeBSD_version >= 440000) +# include +# define GET_PROGRAM_NAME() getprogname() +# endif +#elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100) +# include +# define GET_PROGRAM_NAME() getprogname() +#elif defined(__sun) +/* Solaris has getexecname() which returns the full path - return just + the basename to match BSD getprogname() */ +# include +# include +# define GET_PROGRAM_NAME() basename(getexecname()) +#endif + +#if !defined(GET_PROGRAM_NAME) +# if defined(OpenBSD) || defined(NetBSD) || defined(__UCLIBC__) +/* This is a hack. It's said to work on OpenBSD, NetBSD and GNU. + * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's + * used as a last resort, if there is no documented facility available. */ +static const char *__getProgramName () { + extern const char *__progname; + char * arg = strrchr(__progname, '/'); + if (arg) + return arg+1; + else + return __progname; +} +# define GET_PROGRAM_NAME() __getProgramName() +# else +# define GET_PROGRAM_NAME() "" +# warning "Per application configuration won't work with your OS version." +# endif +#endif + +/** \brief Find an option in an option cache with the name as key */ +static GLuint findOption (const driOptionCache *cache, const char *name) { + GLuint len = strlen (name); + GLuint size = 1 << cache->tableSize, mask = size - 1; + GLuint hash = 0; + GLuint i, shift; + + /* compute a hash from the variable length name */ + for (i = 0, shift = 0; i < len; ++i, shift = (shift+8) & 31) + hash += (GLuint)name[i] << shift; + hash *= hash; + hash = (hash >> (16-cache->tableSize/2)) & mask; + + /* this is just the starting point of the linear search for the option */ + for (i = 0; i < size; ++i, hash = (hash+1) & mask) { + /* if we hit an empty entry then the option is not defined (yet) */ + if (cache->info[hash].name == 0) + break; + else if (!strcmp (name, cache->info[hash].name)) + break; + } + /* this assertion fails if the hash table is full */ + assert (i < size); + + return hash; +} + +/** \brief Count the real number of options in an option cache */ +static GLuint countOptions (const driOptionCache *cache) { + GLuint size = 1 << cache->tableSize; + GLuint i, count = 0; + for (i = 0; i < size; ++i) + if (cache->info[i].name) + count++; + return count; +} + +/** \brief Like strdup but using MALLOC and with error checking. */ +#define XSTRDUP(dest,source) do { \ + GLuint len = strlen (source); \ + if (!(dest = MALLOC (len+1))) { \ + fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); \ + abort(); \ + } \ + memcpy (dest, source, len+1); \ +} while (0) + +static int compare (const void *a, const void *b) { + return strcmp (*(char *const*)a, *(char *const*)b); +} +/** \brief Binary search in a string array. */ +static GLuint bsearchStr (const XML_Char *name, + const XML_Char *elems[], GLuint count) { + const XML_Char **found; + found = bsearch (&name, elems, count, sizeof (XML_Char *), compare); + if (found) + return found - elems; + else + return count; +} + +/** \brief Locale-independent integer parser. + * + * Works similar to strtol. Leading space is NOT skipped. The input + * number may have an optional sign. Radix is specified by base. If + * base is 0 then decimal is assumed unless the input number is + * prefixed by 0x or 0X for hexadecimal or 0 for octal. After + * returning tail points to the first character that is not part of + * the integer number. If no number was found then tail points to the + * start of the input string. */ +static GLint strToI (const XML_Char *string, const XML_Char **tail, int base) { + GLint radix = base == 0 ? 10 : base; + GLint result = 0; + GLint sign = 1; + GLboolean numberFound = GL_FALSE; + const XML_Char *start = string; + + assert (radix >= 2 && radix <= 36); + + if (*string == '-') { + sign = -1; + string++; + } else if (*string == '+') + string++; + if (base == 0 && *string == '0') { + numberFound = GL_TRUE; + if (*(string+1) == 'x' || *(string+1) == 'X') { + radix = 16; + string += 2; + } else { + radix = 8; + string++; + } + } + do { + GLint digit = -1; + if (radix <= 10) { + if (*string >= '0' && *string < '0' + radix) + digit = *string - '0'; + } else { + if (*string >= '0' && *string <= '9') + digit = *string - '0'; + else if (*string >= 'a' && *string < 'a' + radix - 10) + digit = *string - 'a' + 10; + else if (*string >= 'A' && *string < 'A' + radix - 10) + digit = *string - 'A' + 10; + } + if (digit != -1) { + numberFound = GL_TRUE; + result = radix*result + digit; + string++; + } else + break; + } while (GL_TRUE); + *tail = numberFound ? string : start; + return sign * result; +} + +/** \brief Locale-independent floating-point parser. + * + * Works similar to strtod. Leading space is NOT skipped. The input + * number may have an optional sign. '.' is interpreted as decimal + * point and may occor at most once. Optionally the number may end in + * [eE], where is an integer as recognized by + * strToI. In that case the result is number * 10^exponent. After + * returning tail points to the first character that is not part of + * the floating point number. If no number was found then tail points + * to the start of the input string. + * + * Uses two passes for maximum accuracy. */ +static GLfloat strToF (const XML_Char *string, const XML_Char **tail) { + GLint nDigits = 0, pointPos, exponent; + GLfloat sign = 1.0f, result = 0.0f, scale; + const XML_Char *start = string, *numStart; + + /* sign */ + if (*string == '-') { + sign = -1.0f; + string++; + } else if (*string == '+') + string++; + + /* first pass: determine position of decimal point, number of + * digits, exponent and the end of the number. */ + numStart = string; + while (*string >= '0' && *string <= '9') { + string++; + nDigits++; + } + pointPos = nDigits; + if (*string == '.') { + string++; + while (*string >= '0' && *string <= '9') { + string++; + nDigits++; + } + } + if (nDigits == 0) { + /* no digits, no number */ + *tail = start; + return 0.0f; + } + *tail = string; + if (*string == 'e' || *string == 'E') { + const XML_Char *expTail; + exponent = strToI (string+1, &expTail, 10); + if (expTail == string+1) + exponent = 0; + else + *tail = expTail; + } else + exponent = 0; + string = numStart; + + /* scale of the first digit */ + scale = sign * (GLfloat)pow (10.0, (GLdouble)(pointPos-1 + exponent)); + + /* second pass: parse digits */ + do { + if (*string != '.') { + assert (*string >= '0' && *string <= '9'); + result += scale * (GLfloat)(*string - '0'); + scale *= 0.1f; + nDigits--; + } + string++; + } while (nDigits > 0); + + return result; +} + +/** \brief Parse a value of a given type. */ +static GLboolean parseValue (driOptionValue *v, driOptionType type, + const XML_Char *string) { + const XML_Char *tail = NULL; + /* skip leading white-space */ + string += strspn (string, " \f\n\r\t\v"); + switch (type) { + case DRI_BOOL: + if (!strcmp (string, "false")) { + v->_bool = GL_FALSE; + tail = string + 5; + } else if (!strcmp (string, "true")) { + v->_bool = GL_TRUE; + tail = string + 4; + } + else + return GL_FALSE; + break; + case DRI_ENUM: /* enum is just a special integer */ + case DRI_INT: + v->_int = strToI (string, &tail, 0); + break; + case DRI_FLOAT: + v->_float = strToF (string, &tail); + break; + } + + if (tail == string) + return GL_FALSE; /* empty string (or containing only white-space) */ + /* skip trailing white space */ + if (*tail) + tail += strspn (tail, " \f\n\r\t\v"); + if (*tail) + return GL_FALSE; /* something left over that is not part of value */ + + return GL_TRUE; +} + +/** \brief Parse a list of ranges of type info->type. */ +static GLboolean parseRanges (driOptionInfo *info, const XML_Char *string) { + XML_Char *cp, *range; + GLuint nRanges, i; + driOptionRange *ranges; + + XSTRDUP (cp, string); + /* pass 1: determine the number of ranges (number of commas + 1) */ + range = cp; + for (nRanges = 1; *range; ++range) + if (*range == ',') + ++nRanges; + + if ((ranges = MALLOC (nRanges*sizeof(driOptionRange))) == NULL) { + fprintf (stderr, "%s: %d: out of memory.\n", __FILE__, __LINE__); + abort(); + } + + /* pass 2: parse all ranges into preallocated array */ + range = cp; + for (i = 0; i < nRanges; ++i) { + XML_Char *end, *sep; + assert (range); + end = strchr (range, ','); + if (end) + *end = '\0'; + sep = strchr (range, ':'); + if (sep) { /* non-empty interval */ + *sep = '\0'; + if (!parseValue (&ranges[i].start, info->type, range) || + !parseValue (&ranges[i].end, info->type, sep+1)) + break; + if (info->type == DRI_INT && + ranges[i].start._int > ranges[i].end._int) + break; + if (info->type == DRI_FLOAT && + ranges[i].start._float > ranges[i].end._float) + break; + } else { /* empty interval */ + if (!parseValue (&ranges[i].start, info->type, range)) + break; + ranges[i].end = ranges[i].start; + } + if (end) + range = end+1; + else + range = NULL; + } + FREE (cp); + if (i < nRanges) { + FREE (ranges); + return GL_FALSE; + } else + assert (range == NULL); + + info->nRanges = nRanges; + info->ranges = ranges; + return GL_TRUE; +} + +/** \brief Check if a value is in one of info->ranges. */ +static GLboolean checkValue (const driOptionValue *v, const driOptionInfo *info) { + GLuint i; + assert (info->type != DRI_BOOL); /* should be caught by the parser */ + if (info->nRanges == 0) + return GL_TRUE; + switch (info->type) { + case DRI_ENUM: /* enum is just a special integer */ + case DRI_INT: + for (i = 0; i < info->nRanges; ++i) + if (v->_int >= info->ranges[i].start._int && + v->_int <= info->ranges[i].end._int) + return GL_TRUE; + break; + case DRI_FLOAT: + for (i = 0; i < info->nRanges; ++i) + if (v->_float >= info->ranges[i].start._float && + v->_float <= info->ranges[i].end._float) + return GL_TRUE; + break; + default: + assert (0); /* should never happen */ + } + return GL_FALSE; +} + +/** \brief Output a warning message. */ +#define XML_WARNING1(msg) do {\ + __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser)); \ +} while (0) +#define XML_WARNING(msg,args...) do { \ + __driUtilMessage ("Warning in %s line %d, column %d: "msg, data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser), \ + args); \ +} while (0) +/** \brief Output an error message. */ +#define XML_ERROR1(msg) do { \ + __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser)); \ +} while (0) +#define XML_ERROR(msg,args...) do { \ + __driUtilMessage ("Error in %s line %d, column %d: "msg, data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser), \ + args); \ +} while (0) +/** \brief Output a fatal error message and abort. */ +#define XML_FATAL1(msg) do { \ + fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \ + data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser)); \ + abort();\ +} while (0) +#define XML_FATAL(msg,args...) do { \ + fprintf (stderr, "Fatal error in %s line %d, column %d: "msg"\n", \ + data->name, \ + (int) XML_GetCurrentLineNumber(data->parser), \ + (int) XML_GetCurrentColumnNumber(data->parser), \ + args); \ + abort();\ +} while (0) + +/** \brief Parser context for __driConfigOptions. */ +struct OptInfoData { + const char *name; + XML_Parser parser; + driOptionCache *cache; + GLboolean inDriInfo; + GLboolean inSection; + GLboolean inDesc; + GLboolean inOption; + GLboolean inEnum; + int curOption; +}; + +/** \brief Elements in __driConfigOptions. */ +enum OptInfoElem { + OI_DESCRIPTION = 0, OI_DRIINFO, OI_ENUM, OI_OPTION, OI_SECTION, OI_COUNT +}; +static const XML_Char *OptInfoElems[] = { + "description", "driinfo", "enum", "option", "section" +}; + +/** \brief Parse attributes of an enum element. + * + * We're not actually interested in the data. Just make sure this is ok + * for external configuration tools. + */ +static void parseEnumAttr (struct OptInfoData *data, const XML_Char **attr) { + GLuint i; + const XML_Char *value = NULL, *text = NULL; + driOptionValue v; + GLuint opt = data->curOption; + for (i = 0; attr[i]; i += 2) { + if (!strcmp (attr[i], "value")) value = attr[i+1]; + else if (!strcmp (attr[i], "text")) text = attr[i+1]; + else XML_FATAL("illegal enum attribute: %s.", attr[i]); + } + if (!value) XML_FATAL1 ("value attribute missing in enum."); + if (!text) XML_FATAL1 ("text attribute missing in enum."); + if (!parseValue (&v, data->cache->info[opt].type, value)) + XML_FATAL ("illegal enum value: %s.", value); + if (!checkValue (&v, &data->cache->info[opt])) + XML_FATAL ("enum value out of valid range: %s.", value); +} + +/** \brief Parse attributes of a description element. + * + * We're not actually interested in the data. Just make sure this is ok + * for external configuration tools. + */ +static void parseDescAttr (struct OptInfoData *data, const XML_Char **attr) { + GLuint i; + const XML_Char *lang = NULL, *text = NULL; + for (i = 0; attr[i]; i += 2) { + if (!strcmp (attr[i], "lang")) lang = attr[i+1]; + else if (!strcmp (attr[i], "text")) text = attr[i+1]; + else XML_FATAL("illegal description attribute: %s.", attr[i]); + } + if (!lang) XML_FATAL1 ("lang attribute missing in description."); + if (!text) XML_FATAL1 ("text attribute missing in description."); +} + +/** \brief Parse attributes of an option element. */ +static void parseOptInfoAttr (struct OptInfoData *data, const XML_Char **attr) { + enum OptAttr {OA_DEFAULT = 0, OA_NAME, OA_TYPE, OA_VALID, OA_COUNT}; + static const XML_Char *optAttr[] = {"default", "name", "type", "valid"}; + const XML_Char *attrVal[OA_COUNT] = {NULL, NULL, NULL, NULL}; + const char *defaultVal; + driOptionCache *cache = data->cache; + GLuint opt, i; + for (i = 0; attr[i]; i += 2) { + GLuint attrName = bsearchStr (attr[i], optAttr, OA_COUNT); + if (attrName >= OA_COUNT) + XML_FATAL ("illegal option attribute: %s", attr[i]); + attrVal[attrName] = attr[i+1]; + } + if (!attrVal[OA_NAME]) XML_FATAL1 ("name attribute missing in option."); + if (!attrVal[OA_TYPE]) XML_FATAL1 ("type attribute missing in option."); + if (!attrVal[OA_DEFAULT]) XML_FATAL1 ("default attribute missing in option."); + + opt = findOption (cache, attrVal[OA_NAME]); + if (cache->info[opt].name) + XML_FATAL ("option %s redefined.", attrVal[OA_NAME]); + data->curOption = opt; + + XSTRDUP (cache->info[opt].name, attrVal[OA_NAME]); + + if (!strcmp (attrVal[OA_TYPE], "bool")) + cache->info[opt].type = DRI_BOOL; + else if (!strcmp (attrVal[OA_TYPE], "enum")) + cache->info[opt].type = DRI_ENUM; + else if (!strcmp (attrVal[OA_TYPE], "int")) + cache->info[opt].type = DRI_INT; + else if (!strcmp (attrVal[OA_TYPE], "float")) + cache->info[opt].type = DRI_FLOAT; + else + XML_FATAL ("illegal type in option: %s.", attrVal[OA_TYPE]); + + defaultVal = getenv (cache->info[opt].name); + if (defaultVal != NULL) { + /* don't use XML_WARNING, we want the user to see this! */ + fprintf (stderr, + "ATTENTION: default value of option %s overridden by environment.\n", + cache->info[opt].name); + } else + defaultVal = attrVal[OA_DEFAULT]; + if (!parseValue (&cache->values[opt], cache->info[opt].type, defaultVal)) + XML_FATAL ("illegal default value: %s.", defaultVal); + + if (attrVal[OA_VALID]) { + if (cache->info[opt].type == DRI_BOOL) + XML_FATAL1 ("boolean option with valid attribute."); + if (!parseRanges (&cache->info[opt], attrVal[OA_VALID])) + XML_FATAL ("illegal valid attribute: %s.", attrVal[OA_VALID]); + if (!checkValue (&cache->values[opt], &cache->info[opt])) + XML_FATAL ("default value out of valid range '%s': %s.", + attrVal[OA_VALID], defaultVal); + } else if (cache->info[opt].type == DRI_ENUM) { + XML_FATAL1 ("valid attribute missing in option (mandatory for enums)."); + } else { + cache->info[opt].nRanges = 0; + cache->info[opt].ranges = NULL; + } +} + +/** \brief Handler for start element events. */ +static void optInfoStartElem (void *userData, const XML_Char *name, + const XML_Char **attr) { + struct OptInfoData *data = (struct OptInfoData *)userData; + enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT); + switch (elem) { + case OI_DRIINFO: + if (data->inDriInfo) + XML_FATAL1 ("nested elements."); + if (attr[0]) + XML_FATAL1 ("attributes specified on element."); + data->inDriInfo = GL_TRUE; + break; + case OI_SECTION: + if (!data->inDriInfo) + XML_FATAL1 ("
    must be inside ."); + if (data->inSection) + XML_FATAL1 ("nested
    elements."); + if (attr[0]) + XML_FATAL1 ("attributes specified on
    element."); + data->inSection = GL_TRUE; + break; + case OI_DESCRIPTION: + if (!data->inSection && !data->inOption) + XML_FATAL1 (" must be inside or inDesc) + XML_FATAL1 ("nested elements."); + data->inDesc = GL_TRUE; + parseDescAttr (data, attr); + break; + case OI_OPTION: + if (!data->inSection) + XML_FATAL1 ("