https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5f2bebf7a5b1a1602b553c43118d745e51c5609c

commit 5f2bebf7a5b1a1602b553c43118d745e51c5609c
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Mon Dec 10 18:04:20 2018 +0100
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Sat Jan 19 14:23:54 2019 +0100

    [OPENGL32][MESA] Downgrade Mesa library to version 2.6
    
    With this commit, we now use a forked version of MESA which only supports 
OpenGL 1.1, like the windows implementation does.
    It exposes :
      - The same pixel formats
      - The same set of extensions
      - Nothing more
    All of this without taking 10% of your build time.
    If you need a more modern option, look at the MESA package from Rapps, 
which is (and must be) maintained outside of this code tree.
    CORE-7499
---
 dll/opengl/mesa/CMakeLists.txt                |   93 +-
 dll/opengl/mesa/accum.c                       |  373 ++
 dll/opengl/mesa/accum.h                       |   55 +
 dll/opengl/mesa/all.h                         |  136 +
 dll/opengl/mesa/alpha.c                       |  142 +
 dll/opengl/mesa/alpha.h                       |   46 +
 dll/opengl/mesa/alphabuf.c                    |  271 ++
 dll/opengl/mesa/alphabuf.h                    |   78 +
 dll/opengl/mesa/api.c                         | 2874 +++++++++++
 dll/opengl/mesa/api.h                         |   83 +
 dll/opengl/mesa/asm-386.S                     | 1644 +++++++
 dll/opengl/mesa/asm-386.h                     |   99 +
 dll/opengl/mesa/attrib.c                      |  624 +++
 dll/opengl/mesa/attrib.h                      |   48 +
 dll/opengl/mesa/bitmap.c                      |  221 +
 dll/opengl/mesa/bitmap.h                      |   59 +
 dll/opengl/mesa/blend.c                       |  547 +++
 dll/opengl/mesa/blend.h                       |   54 +
 dll/opengl/mesa/clip.c                        | 1055 ++++
 dll/opengl/mesa/clip.h                        |   98 +
 dll/opengl/mesa/colortab.c                    |  287 ++
 dll/opengl/mesa/colortab.h                    |   65 +
 dll/opengl/mesa/config.h                      |  167 +
 dll/opengl/mesa/context.c                     | 1926 ++++++++
 dll/opengl/mesa/context.h                     |  179 +
 dll/opengl/mesa/copypix.c                     |  517 ++
 dll/opengl/mesa/copypix.h                     |   46 +
 dll/opengl/mesa/dd.h                          |  557 +++
 dll/opengl/mesa/depth.c                       |  924 ++++
 dll/opengl/mesa/depth.h                       |  101 +
 dll/opengl/mesa/dlist.c                       | 3096 ++++++++++++
 dll/opengl/mesa/dlist.h                       |  432 ++
 dll/opengl/mesa/drawpix.c                     | 1207 +++++
 dll/opengl/mesa/drawpix.h                     |   46 +
 dll/opengl/mesa/drivers/common/CMakeLists.txt |    7 -
 dll/opengl/mesa/drivers/common/driverfuncs.c  |  163 -
 dll/opengl/mesa/drivers/common/driverfuncs.h  |   33 -
 dll/opengl/mesa/drivers/common/meta.c         |  756 ---
 dll/opengl/mesa/drivers/common/meta.h         |   90 -
 dll/opengl/mesa/enable.c                      |  652 +++
 dll/opengl/mesa/enable.h                      |   50 +
 dll/opengl/mesa/eval.c                        | 2466 ++++++++++
 dll/opengl/mesa/eval.h                        |  108 +
 dll/opengl/mesa/feedback.c                    |  428 ++
 dll/opengl/mesa/feedback.h                    |   75 +
 dll/opengl/mesa/fixed.h                       |   57 +
 dll/opengl/mesa/fog.c                         |  389 ++
 dll/opengl/mesa/fog.h                         |   62 +
 dll/opengl/mesa/get.c                         | 3198 ++++++++++++
 dll/opengl/mesa/get.h                         |   49 +
 dll/opengl/mesa/hash.c                        |  302 ++
 dll/opengl/mesa/hash.h                        |   63 +
 dll/opengl/mesa/image.c                       |  667 +++
 dll/opengl/mesa/image.h                       |   80 +
 dll/opengl/mesa/light.c                       |  888 ++++
 dll/opengl/mesa/light.h                       |   93 +
 dll/opengl/mesa/lines.c                       |  978 ++++
 dll/opengl/mesa/lines.h                       |   46 +
 dll/opengl/mesa/linetemp.h                    |  502 ++
 dll/opengl/mesa/logic.c                       |  726 +++
 dll/opengl/mesa/logic.h                       |   69 +
 dll/opengl/mesa/macros.h                      |  277 ++
 dll/opengl/mesa/main/CMakeLists.txt           |   81 -
 dll/opengl/mesa/main/accum.c                  |  481 --
 dll/opengl/mesa/main/accum.h                  |   93 -
 dll/opengl/mesa/main/api_arrayelt.c           |  910 ----
 dll/opengl/mesa/main/api_arrayelt.h           |   84 -
 dll/opengl/mesa/main/api_exec.c               |  306 --
 dll/opengl/mesa/main/api_exec.h               |   45 -
 dll/opengl/mesa/main/api_loopback.c           | 1022 ----
 dll/opengl/mesa/main/api_loopback.h           |   48 -
 dll/opengl/mesa/main/api_validate.c           |  252 -
 dll/opengl/mesa/main/api_validate.h           |   58 -
 dll/opengl/mesa/main/attrib.c                 | 1268 -----
 dll/opengl/mesa/main/attrib.h                 |   80 -
 dll/opengl/mesa/main/bitset.h                 |  160 -
 dll/opengl/mesa/main/blend.c                  |  352 --
 dll/opengl/mesa/main/blend.h                  |   64 -
 dll/opengl/mesa/main/bufferobj.c              | 1312 -----
 dll/opengl/mesa/main/bufferobj.h              |  155 -
 dll/opengl/mesa/main/buffers.c                |  347 --
 dll/opengl/mesa/main/buffers.h                |   57 -
 dll/opengl/mesa/main/clear.c                  |  223 -
 dll/opengl/mesa/main/clear.h                  |   51 -
 dll/opengl/mesa/main/clip.c                   |  108 -
 dll/opengl/mesa/main/clip.h                   |   47 -
 dll/opengl/mesa/main/colormac.h               |  125 -
 dll/opengl/mesa/main/compiler.h               |  506 --
 dll/opengl/mesa/main/config.h                 |  228 -
 dll/opengl/mesa/main/context.c                | 1321 -----
 dll/opengl/mesa/main/context.h                |  294 --
 dll/opengl/mesa/main/core.h                   |   55 -
 dll/opengl/mesa/main/cpuinfo.c                |  106 -
 dll/opengl/mesa/main/cpuinfo.h                |   47 -
 dll/opengl/mesa/main/dd.h                     |  768 ---
 dll/opengl/mesa/main/depth.c                  |  159 -
 dll/opengl/mesa/main/depth.h                  |   65 -
 dll/opengl/mesa/main/dispatch.h               | 5833 ----------------------
 dll/opengl/mesa/main/dlist.c                  | 6206 ------------------------
 dll/opengl/mesa/main/dlist.h                  |  104 -
 dll/opengl/mesa/main/dlopen.c                 |  113 -
 dll/opengl/mesa/main/dlopen.h                 |   42 -
 dll/opengl/mesa/main/drawpix.c                |  260 -
 dll/opengl/mesa/main/drawpix.h                |   50 -
 dll/opengl/mesa/main/enable.c                 |  931 ----
 dll/opengl/mesa/main/enable.h                 |   59 -
 dll/opengl/mesa/main/enums.c                  | 6399 -------------------------
 dll/opengl/mesa/main/enums.h                  |   62 -
 dll/opengl/mesa/main/eval.c                   |  928 ----
 dll/opengl/mesa/main/eval.h                   |  107 -
 dll/opengl/mesa/main/execmem.c                |  149 -
 dll/opengl/mesa/main/extensions.c             |  623 ---
 dll/opengl/mesa/main/extensions.h             |   91 -
 dll/opengl/mesa/main/feedback.c               |  537 ---
 dll/opengl/mesa/main/feedback.h               |  102 -
 dll/opengl/mesa/main/fog.c                    |  204 -
 dll/opengl/mesa/main/fog.h                    |   69 -
 dll/opengl/mesa/main/format_pack.c            | 1461 ------
 dll/opengl/mesa/main/format_pack.h            |   97 -
 dll/opengl/mesa/main/format_unpack.c          | 1862 -------
 dll/opengl/mesa/main/format_unpack.h          |   59 -
 dll/opengl/mesa/main/formats.c                | 1567 ------
 dll/opengl/mesa/main/formats.h                |  226 -
 dll/opengl/mesa/main/framebuffer.c            |  623 ---
 dll/opengl/mesa/main/framebuffer.h            |   86 -
 dll/opengl/mesa/main/get.c                    | 1639 -------
 dll/opengl/mesa/main/get.h                    |   68 -
 dll/opengl/mesa/main/getstring.c              |  153 -
 dll/opengl/mesa/main/git_sha1.h               |    0
 dll/opengl/mesa/main/glheader.h               |  193 -
 dll/opengl/mesa/main/hash.c                   |  562 ---
 dll/opengl/mesa/main/hash.h                   |   72 -
 dll/opengl/mesa/main/hint.c                   |  108 -
 dll/opengl/mesa/main/hint.h                   |   59 -
 dll/opengl/mesa/main/image.c                  | 1805 -------
 dll/opengl/mesa/main/image.h                  |  174 -
 dll/opengl/mesa/main/imports.c                |  903 ----
 dll/opengl/mesa/main/imports.h                |  645 ---
 dll/opengl/mesa/main/light.c                  | 1357 ------
 dll/opengl/mesa/main/light.h                  |  144 -
 dll/opengl/mesa/main/lines.c                  |  111 -
 dll/opengl/mesa/main/lines.h                  |   49 -
 dll/opengl/mesa/main/macros.h                 |  683 ---
 dll/opengl/mesa/main/matrix.c                 |  711 ---
 dll/opengl/mesa/main/matrix.h                 |  113 -
 dll/opengl/mesa/main/mfeatures.h              |  135 -
 dll/opengl/mesa/main/mm.c                     |  281 --
 dll/opengl/mesa/main/mm.h                     |   90 -
 dll/opengl/mesa/main/mtypes.h                 | 1976 --------
 dll/opengl/mesa/main/multisample.c            |   56 -
 dll/opengl/mesa/main/multisample.h            |   41 -
 dll/opengl/mesa/main/pack.c                   | 4547 ------------------
 dll/opengl/mesa/main/pack.h                   |  143 -
 dll/opengl/mesa/main/pack_tmp.h               |  115 -
 dll/opengl/mesa/main/pixel.c                  |  588 ---
 dll/opengl/mesa/main/pixel.h                  |   81 -
 dll/opengl/mesa/main/pixelstore.c             |  256 -
 dll/opengl/mesa/main/pixelstore.h             |   52 -
 dll/opengl/mesa/main/pixeltransfer.c          |  299 --
 dll/opengl/mesa/main/pixeltransfer.h          |   81 -
 dll/opengl/mesa/main/points.c                 |  262 -
 dll/opengl/mesa/main/points.h                 |   59 -
 dll/opengl/mesa/main/polygon.c                |  299 --
 dll/opengl/mesa/main/polygon.h                |   67 -
 dll/opengl/mesa/main/precomp.h                |   79 -
 dll/opengl/mesa/main/rastpos.c                |  538 ---
 dll/opengl/mesa/main/rastpos.h                |   60 -
 dll/opengl/mesa/main/readpix.c                |  574 ---
 dll/opengl/mesa/main/readpix.h                |   51 -
 dll/opengl/mesa/main/renderbuffer.c           |  139 -
 dll/opengl/mesa/main/renderbuffer.h           |   64 -
 dll/opengl/mesa/main/scissor.c                |   95 -
 dll/opengl/mesa/main/scissor.h                |   47 -
 dll/opengl/mesa/main/shared.c                 |  214 -
 dll/opengl/mesa/main/shared.h                 |   40 -
 dll/opengl/mesa/main/simple_list.h            |  210 -
 dll/opengl/mesa/main/state.c                  |  303 --
 dll/opengl/mesa/main/state.h                  |   40 -
 dll/opengl/mesa/main/stencil.c                |  249 -
 dll/opengl/mesa/main/stencil.h                |   69 -
 dll/opengl/mesa/main/texenv.c                 |  635 ---
 dll/opengl/mesa/main/texenv.h                 |   51 -
 dll/opengl/mesa/main/texformat.c              |  361 --
 dll/opengl/mesa/main/texformat.h              |   39 -
 dll/opengl/mesa/main/texgen.c                 |  371 --
 dll/opengl/mesa/main/texgen.h                 |   85 -
 dll/opengl/mesa/main/texgetimage.c            |  557 ---
 dll/opengl/mesa/main/texgetimage.h            |   47 -
 dll/opengl/mesa/main/teximage.c               | 2094 --------
 dll/opengl/mesa/main/teximage.h               |  205 -
 dll/opengl/mesa/main/texobj.c                 | 1073 -----
 dll/opengl/mesa/main/texobj.h                 |  134 -
 dll/opengl/mesa/main/texpal.c                 |  210 -
 dll/opengl/mesa/main/texpal.h                 |   45 -
 dll/opengl/mesa/main/texparam.c               |  834 ----
 dll/opengl/mesa/main/texparam.h               |   75 -
 dll/opengl/mesa/main/texstate.c               |  636 ---
 dll/opengl/mesa/main/texstate.h               |   65 -
 dll/opengl/mesa/main/texstorage.c             |  371 --
 dll/opengl/mesa/main/texstorage.h             |   61 -
 dll/opengl/mesa/main/texstore.c               | 3311 -------------
 dll/opengl/mesa/main/texstore.h               |  127 -
 dll/opengl/mesa/main/varray.c                 |  650 ---
 dll/opengl/mesa/main/varray.h                 |  183 -
 dll/opengl/mesa/main/version.c                |   89 -
 dll/opengl/mesa/main/version.h                |   48 -
 dll/opengl/mesa/main/viewport.c               |  174 -
 dll/opengl/mesa/main/viewport.h               |   55 -
 dll/opengl/mesa/main/vsnprintf.c              |  165 -
 dll/opengl/mesa/main/vtxfmt.c                 |  115 -
 dll/opengl/mesa/main/vtxfmt.h                 |   59 -
 dll/opengl/mesa/masking.c                     |  200 +
 dll/opengl/mesa/masking.h                     |   85 +
 dll/opengl/mesa/math/CMakeLists.txt           |   15 -
 dll/opengl/mesa/math/m_clip_tmp.h             |  243 -
 dll/opengl/mesa/math/m_copy_tmp.h             |   86 -
 dll/opengl/mesa/math/m_debug.h                |   42 -
 dll/opengl/mesa/math/m_debug_clip.c           |  397 --
 dll/opengl/mesa/math/m_debug_norm.c           |  377 --
 dll/opengl/mesa/math/m_debug_util.h           |  320 --
 dll/opengl/mesa/math/m_debug_xform.c          |  333 --
 dll/opengl/mesa/math/m_dotprod_tmp.h          |  102 -
 dll/opengl/mesa/math/m_eval.c                 |  458 --
 dll/opengl/mesa/math/m_eval.h                 |  103 -
 dll/opengl/mesa/math/m_matrix.c               | 1635 -------
 dll/opengl/mesa/math/m_matrix.h               |  221 -
 dll/opengl/mesa/math/m_norm_tmp.h             |  390 --
 dll/opengl/mesa/math/m_trans_tmp.h            |  281 --
 dll/opengl/mesa/math/m_translate.c            |  747 ---
 dll/opengl/mesa/math/m_translate.h            |  123 -
 dll/opengl/mesa/math/m_vector.c               |  179 -
 dll/opengl/mesa/math/m_vector.h               |   92 -
 dll/opengl/mesa/math/m_xform.c                |  121 -
 dll/opengl/mesa/math/m_xform.h                |  167 -
 dll/opengl/mesa/math/m_xform_tmp.h            |  810 ----
 dll/opengl/mesa/math/precomp.h                |   14 -
 dll/opengl/mesa/matrix.c                      | 1048 ++++
 dll/opengl/mesa/matrix.h                      |   92 +
 dll/opengl/mesa/misc.c                        |  495 ++
 dll/opengl/mesa/misc.h                        |   63 +
 dll/opengl/mesa/mmath.c                       |  150 +
 dll/opengl/mesa/mmath.h                       |   84 +
 dll/opengl/mesa/pb.c                          |  449 ++
 dll/opengl/mesa/pb.h                          |  177 +
 dll/opengl/mesa/pixel.c                       |  991 ++++
 dll/opengl/mesa/pixel.h                       |   83 +
 dll/opengl/mesa/pointers.c                    |  541 +++
 dll/opengl/mesa/pointers.h                    |   45 +
 dll/opengl/mesa/points.c                      |  586 +++
 dll/opengl/mesa/points.h                      |   46 +
 dll/opengl/mesa/polygon.c                     |  171 +
 dll/opengl/mesa/polygon.h                     |   54 +
 dll/opengl/mesa/quads.c                       |  101 +
 dll/opengl/mesa/quads.h                       |   42 +
 dll/opengl/mesa/rastpos.c                     |  225 +
 dll/opengl/mesa/rastpos.h                     |   49 +
 dll/opengl/mesa/readpix.c                     | 1099 +++++
 dll/opengl/mesa/readpix.h                     |   44 +
 dll/opengl/mesa/rect.c                        |   76 +
 dll/opengl/mesa/rect.h                        |   43 +
 dll/opengl/mesa/scissor.c                     |  132 +
 dll/opengl/mesa/scissor.h                     |   52 +
 dll/opengl/mesa/shade.c                       |  607 +++
 dll/opengl/mesa/shade.h                       |   68 +
 dll/opengl/mesa/span.c                        |  929 ++++
 dll/opengl/mesa/span.h                        |   84 +
 dll/opengl/mesa/stencil.c                     | 1022 ++++
 dll/opengl/mesa/stencil.h                     |   89 +
 dll/opengl/mesa/swrast/CMakeLists.txt         |   41 -
 dll/opengl/mesa/swrast/precomp.h              |   40 -
 dll/opengl/mesa/swrast/s_aaline.c             |  479 --
 dll/opengl/mesa/swrast/s_aaline.h             |   38 -
 dll/opengl/mesa/swrast/s_aalinetemp.h         |  238 -
 dll/opengl/mesa/swrast/s_aatriangle.c         |  285 --
 dll/opengl/mesa/swrast/s_aatriangle.h         |   38 -
 dll/opengl/mesa/swrast/s_aatritemp.h          |  341 --
 dll/opengl/mesa/swrast/s_alpha.c              |  153 -
 dll/opengl/mesa/swrast/s_alpha.h              |   39 -
 dll/opengl/mesa/swrast/s_bitmap.c             |  207 -
 dll/opengl/mesa/swrast/s_blend.c              |  673 ---
 dll/opengl/mesa/swrast/s_blend.h              |   45 -
 dll/opengl/mesa/swrast/s_chan.h               |  119 -
 dll/opengl/mesa/swrast/s_clear.c              |  216 -
 dll/opengl/mesa/swrast/s_context.c            |  735 ---
 dll/opengl/mesa/swrast/s_context.h            |  460 --
 dll/opengl/mesa/swrast/s_copypix.c            |  615 ---
 dll/opengl/mesa/swrast/s_depth.c              |  556 ---
 dll/opengl/mesa/swrast/s_depth.h              |   53 -
 dll/opengl/mesa/swrast/s_drawpix.c            |  520 --
 dll/opengl/mesa/swrast/s_feedback.c           |  131 -
 dll/opengl/mesa/swrast/s_feedback.h           |   50 -
 dll/opengl/mesa/swrast/s_fog.c                |  237 -
 dll/opengl/mesa/swrast/s_fog.h                |   42 -
 dll/opengl/mesa/swrast/s_lines.c              |  218 -
 dll/opengl/mesa/swrast/s_lines.h              |   41 -
 dll/opengl/mesa/swrast/s_linetemp.h           |  388 --
 dll/opengl/mesa/swrast/s_logic.c              |  209 -
 dll/opengl/mesa/swrast/s_logic.h              |   40 -
 dll/opengl/mesa/swrast/s_masking.c            |   94 -
 dll/opengl/mesa/swrast/s_masking.h            |   41 -
 dll/opengl/mesa/swrast/s_points.c             |  522 --
 dll/opengl/mesa/swrast/s_points.h             |   39 -
 dll/opengl/mesa/swrast/s_renderbuffer.c       |  581 ---
 dll/opengl/mesa/swrast/s_renderbuffer.h       |   62 -
 dll/opengl/mesa/swrast/s_span.c               | 1242 -----
 dll/opengl/mesa/swrast/s_span.h               |  212 -
 dll/opengl/mesa/swrast/s_stencil.c            |  602 ---
 dll/opengl/mesa/swrast/s_stencil.h            |   53 -
 dll/opengl/mesa/swrast/s_texcombine.c         |  625 ---
 dll/opengl/mesa/swrast/s_texcombine.h         |   37 -
 dll/opengl/mesa/swrast/s_texfetch.c           |  622 ---
 dll/opengl/mesa/swrast/s_texfetch.h           |   38 -
 dll/opengl/mesa/swrast/s_texfetch_tmp.h       |  802 ----
 dll/opengl/mesa/swrast/s_texfilter.c          | 1922 --------
 dll/opengl/mesa/swrast/s_texfilter.h          |   41 -
 dll/opengl/mesa/swrast/s_texture.c            |  320 --
 dll/opengl/mesa/swrast/s_triangle.c           | 1028 ----
 dll/opengl/mesa/swrast/s_triangle.h           |   50 -
 dll/opengl/mesa/swrast/s_tritemp.h            |  926 ----
 dll/opengl/mesa/swrast/s_zoom.c               |  420 --
 dll/opengl/mesa/swrast/s_zoom.h               |   56 -
 dll/opengl/mesa/swrast/swrast.h               |  263 -
 dll/opengl/mesa/swrast_setup/CMakeLists.txt   |    7 -
 dll/opengl/mesa/swrast_setup/ss_context.c     |  230 -
 dll/opengl/mesa/swrast_setup/ss_context.h     |   45 -
 dll/opengl/mesa/swrast_setup/ss_triangle.c    |  253 -
 dll/opengl/mesa/swrast_setup/ss_triangle.h    |   38 -
 dll/opengl/mesa/swrast_setup/ss_tritmp.h      |  239 -
 dll/opengl/mesa/swrast_setup/ss_vb.h          |   37 -
 dll/opengl/mesa/swrast_setup/swrast_setup.h   |   55 -
 dll/opengl/mesa/teximage.c                    | 1890 ++++++++
 dll/opengl/mesa/teximage.h                    |  166 +
 dll/opengl/mesa/texobj.c                      |  597 +++
 dll/opengl/mesa/texobj.h                      |   88 +
 dll/opengl/mesa/texstate.c                    |  988 ++++
 dll/opengl/mesa/texstate.h                    |   93 +
 dll/opengl/mesa/texture.c                     | 1702 +++++++
 dll/opengl/mesa/texture.h                     |   79 +
 dll/opengl/mesa/tnl/CMakeLists.txt            |   22 -
 dll/opengl/mesa/tnl/precomp.h                 |   28 -
 dll/opengl/mesa/tnl/t_context.c               |  176 -
 dll/opengl/mesa/tnl/t_context.h               |  486 --
 dll/opengl/mesa/tnl/t_draw.c                  |  438 --
 dll/opengl/mesa/tnl/t_pipeline.c              |  205 -
 dll/opengl/mesa/tnl/t_pipeline.h              |   71 -
 dll/opengl/mesa/tnl/t_rasterpos.c             |  437 --
 dll/opengl/mesa/tnl/t_vb_cliptmp.h            |  320 --
 dll/opengl/mesa/tnl/t_vb_fog.c                |  265 -
 dll/opengl/mesa/tnl/t_vb_light.c              |  320 --
 dll/opengl/mesa/tnl/t_vb_lighttmp.h           |  637 ---
 dll/opengl/mesa/tnl/t_vb_normals.c            |  175 -
 dll/opengl/mesa/tnl/t_vb_points.c             |  108 -
 dll/opengl/mesa/tnl/t_vb_render.c             |  337 --
 dll/opengl/mesa/tnl/t_vb_rendertmp.h          |  433 --
 dll/opengl/mesa/tnl/t_vb_texgen.c             |  588 ---
 dll/opengl/mesa/tnl/t_vb_texmat.c             |  111 -
 dll/opengl/mesa/tnl/t_vb_vertex.c             |  248 -
 dll/opengl/mesa/tnl/t_vertex.c                |  559 ---
 dll/opengl/mesa/tnl/t_vertex.h                |  184 -
 dll/opengl/mesa/tnl/t_vertex_generic.c        | 1134 -----
 dll/opengl/mesa/tnl/t_vertex_sse.c            |  678 ---
 dll/opengl/mesa/tnl/tnl.h                     |  100 -
 dll/opengl/mesa/triangle.c                    |  793 +++
 dll/opengl/mesa/triangle.h                    |   43 +
 dll/opengl/mesa/tritemp.h                     |  874 ++++
 dll/opengl/mesa/types.h                       | 1411 ++++++
 dll/opengl/mesa/varray.c                      | 1341 ++++++
 dll/opengl/mesa/varray.h                      |  102 +
 dll/opengl/mesa/vb.c                          |   88 +
 dll/opengl/mesa/vb.h                          |  158 +
 dll/opengl/mesa/vbfill.c                      | 1453 ++++++
 dll/opengl/mesa/vbfill.h                      |  149 +
 dll/opengl/mesa/vbo/CMakeLists.txt            |   22 -
 dll/opengl/mesa/vbo/precomp.h                 |   32 -
 dll/opengl/mesa/vbo/vbo.h                     |  143 -
 dll/opengl/mesa/vbo/vbo_attrib.h              |   78 -
 dll/opengl/mesa/vbo/vbo_attrib_tmp.h          |  332 --
 dll/opengl/mesa/vbo/vbo_context.c             |  185 -
 dll/opengl/mesa/vbo/vbo_context.h             |   91 -
 dll/opengl/mesa/vbo/vbo_exec.c                |  133 -
 dll/opengl/mesa/vbo/vbo_exec.h                |  226 -
 dll/opengl/mesa/vbo/vbo_exec_api.c            | 1167 -----
 dll/opengl/mesa/vbo/vbo_exec_array.c          |  543 ---
 dll/opengl/mesa/vbo/vbo_exec_draw.c           |  387 --
 dll/opengl/mesa/vbo/vbo_exec_eval.c           |  240 -
 dll/opengl/mesa/vbo/vbo_noop.c                |  349 --
 dll/opengl/mesa/vbo/vbo_noop.h                |   51 -
 dll/opengl/mesa/vbo/vbo_rebase.c              |  203 -
 dll/opengl/mesa/vbo/vbo_save.c                |  114 -
 dll/opengl/mesa/vbo/vbo_save.h                |  204 -
 dll/opengl/mesa/vbo/vbo_save_api.c            | 1363 ------
 dll/opengl/mesa/vbo/vbo_save_draw.c           |  256 -
 dll/opengl/mesa/vbo/vbo_save_loopback.c       |  186 -
 dll/opengl/mesa/vbo/vbo_split.c               |  154 -
 dll/opengl/mesa/vbo/vbo_split.h               |   72 -
 dll/opengl/mesa/vbo/vbo_split_copy.c          |  606 ---
 dll/opengl/mesa/vbo/vbo_split_inplace.c       |  279 --
 dll/opengl/mesa/vbrender.c                    | 1310 +++++
 dll/opengl/mesa/vbrender.h                    |   44 +
 dll/opengl/mesa/vbxform.c                     | 1263 +++++
 dll/opengl/mesa/vbxform.h                     |   44 +
 dll/opengl/mesa/x86-64/calling_convention.txt |   50 -
 dll/opengl/mesa/x86-64/x86-64.c               |  129 -
 dll/opengl/mesa/x86-64/x86-64.h               |   31 -
 dll/opengl/mesa/x86-64/xform4.S               |  483 --
 dll/opengl/mesa/x86/3dnow.c                   |   91 -
 dll/opengl/mesa/x86/3dnow.h                   |   36 -
 dll/opengl/mesa/x86/3dnow_normal.S            |  852 ----
 dll/opengl/mesa/x86/3dnow_xform1.S            |  437 --
 dll/opengl/mesa/x86/3dnow_xform2.S            |  477 --
 dll/opengl/mesa/x86/3dnow_xform3.S            |  561 ---
 dll/opengl/mesa/x86/3dnow_xform4.S            |  570 ---
 dll/opengl/mesa/x86/CMakeLists.txt            |   34 -
 dll/opengl/mesa/x86/assyntax.h                | 1747 -------
 dll/opengl/mesa/x86/clip_args.h               |   59 -
 dll/opengl/mesa/x86/common_x86.c              |  317 --
 dll/opengl/mesa/x86/common_x86_asm.S          |  220 -
 dll/opengl/mesa/x86/common_x86_asm.h          |   53 -
 dll/opengl/mesa/x86/common_x86_features.h     |   67 -
 dll/opengl/mesa/x86/gen_matypes.c             |  239 -
 dll/opengl/mesa/x86/matypes.h                 |  162 -
 dll/opengl/mesa/x86/mmx.h                     |   49 -
 dll/opengl/mesa/x86/mmx_blend.S               |  338 --
 dll/opengl/mesa/x86/mmx_blendtmp.h            |  114 -
 dll/opengl/mesa/x86/norm_args.h               |   57 -
 dll/opengl/mesa/x86/read_rgba_span_x86.S      |  686 ---
 dll/opengl/mesa/x86/read_rgba_span_x86.h      |   56 -
 dll/opengl/mesa/x86/rtasm/x86sse.c            | 1203 -----
 dll/opengl/mesa/x86/rtasm/x86sse.h            |  256 -
 dll/opengl/mesa/x86/sse.c                     |  123 -
 dll/opengl/mesa/x86/sse.h                     |   36 -
 dll/opengl/mesa/x86/sse_normal.S              |  261 -
 dll/opengl/mesa/x86/sse_xform1.S              |  446 --
 dll/opengl/mesa/x86/sse_xform2.S              |  466 --
 dll/opengl/mesa/x86/sse_xform3.S              |  512 --
 dll/opengl/mesa/x86/sse_xform4.S              |  235 -
 dll/opengl/mesa/x86/x86_cliptest.S            |  407 --
 dll/opengl/mesa/x86/x86_xform.c               |  124 -
 dll/opengl/mesa/x86/x86_xform.h               |  106 -
 dll/opengl/mesa/x86/x86_xform2.S              |  574 ---
 dll/opengl/mesa/x86/x86_xform3.S              |  644 ---
 dll/opengl/mesa/x86/x86_xform4.S              |  677 ---
 dll/opengl/mesa/x86/xform_args.h              |   51 -
 dll/opengl/mesa/xform.c                       |  258 +
 dll/opengl/mesa/xform.h                       |   85 +
 dll/opengl/opengl32/CMakeLists.txt            |   14 +-
 dll/opengl/opengl32/glfuncs.h                 |  610 +--
 dll/opengl/opengl32/swimpl.c                  | 1792 +++++--
 448 files changed, 56963 insertions(+), 132237 deletions(-)

diff --git a/dll/opengl/mesa/CMakeLists.txt b/dll/opengl/mesa/CMakeLists.txt
index 004d505e21..20f8d31137 100644
--- a/dll/opengl/mesa/CMakeLists.txt
+++ b/dll/opengl/mesa/CMakeLists.txt
@@ -1,36 +1,71 @@
 
 include_directories(.)
 
-# our DBG definitions conflict with mesa source code
-remove_definitions(-DDBG=1 -DDBG=0)
+add_definitions(-DFAST_MATH -DTHREADS)
 
-add_definitions(
-    -DWIN32
-    -D_WINDOWS
-    -D_DLL
-    -DFEATURE_GL=1
-    -D_GDI32_           # prevent gl* being declared __declspec(dllimport) in 
MS headers
-    -DBUILD_GL32        # declare gl* as __declspec(dllexport) in Mesa headers
-    -D_GLAPI_NO_EXPORTS # prevent _glapi_* from being declared 
__declspec(dllimport)
-)
-
-if(OPENGL32_USE_TLS)
-    add_definitions(-DOPENGL32_USE_TLS)
+if(ARCH STREQUAL "i386")
+    list(APPEND ASM_SOURCE asm-386.S)
+    add_definitions(-DUSE_ASM)
 endif()
 
-if((ARCH STREQUAL "i386") AND (NOT MSVC))
-    add_definitions(
-        -DUSE_X86_ASM
-        -DUSE_MMX_ASM
-        -DUSE_3DNOW_ASM
-        -DUSE_SSE_ASM)
-    add_subdirectory(x86)
-endif()
+add_asm_files(mesa_asm ${ASM_SOURCE})
+
+list(APPEND SOURCE
+    accum.c
+    alpha.c
+    alphabuf.c
+    api.c
+    attrib.c
+    bitmap.c
+    blend.c
+    clip.c
+    colortab.c
+    context.c
+    copypix.c
+    depth.c
+    dlist.c
+    drawpix.c
+    enable.c
+    eval.c
+    feedback.c
+    fog.c
+    get.c
+    hash.c
+    image.c
+    light.c
+    lines.c
+    logic.c
+    masking.c
+    matrix.c
+    misc.c
+    mmath.c
+    pb.c
+    pixel.c
+    pointers.c
+    points.c
+    polygon.c
+    quads.c
+    rastpos.c
+    readpix.c
+    rect.c
+    scissor.c
+    shade.c
+    span.c
+    stencil.c
+    teximage.c
+    texobj.c
+    texstate.c
+    texture.c
+    triangle.c
+    varray.c
+    vb.c
+    vbfill.c
+    vbrender.c
+    vbxform.c
+    xform.c
+)
+
+add_library(mesa STATIC ${SOURCE} ${mesa_asm})
+add_dependencies(mesa psdk)
 
-add_subdirectory(drivers/common)
-add_subdirectory(main)
-add_subdirectory(math)
-add_subdirectory(swrast)
-add_subdirectory(swrast_setup)
-add_subdirectory(tnl)
-add_subdirectory(vbo)
+    
diff --git a/dll/opengl/mesa/accum.c b/dll/opengl/mesa/accum.c
new file mode 100644
index 0000000000..1d24902429
--- /dev/null
+++ b/dll/opengl/mesa/accum.c
@@ -0,0 +1,373 @@
+/* $Id: accum.c,v 1.5 1997/07/24 01:24:28 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  2.4
+ * Copyright (C) 1995-1997  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.
+ */
+
+
+/*
+ * $Log: accum.c,v $
+ * Revision 1.5  1997/07/24 01:24:28  brianp
+ * changed precompiled header symbol from PCH to PC_HEADER
+ *
+ * Revision 1.4  1997/05/28 03:23:09  brianp
+ * added precompiled header (PCH) support
+ *
+ * Revision 1.3  1997/04/30 01:54:48  brianp
+ * call gl_warning() if calling gl_Accum w/out accum buffer
+ *
+ * Revision 1.2  1996/09/15 14:19:44  brianp
+ * now use GLframebuffer and GLvisual
+ * added gl_alloc_accum_buffer()
+ *
+ * Revision 1.1  1996/09/13 01:38:16  brianp
+ * Initial revision
+ *
+ */
+
+
+#ifdef PC_HEADER
+#include "all.h"
+#else
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include "accum.h"
+#include "context.h"
+#include "dlist.h"
+#include "macros.h"
+#include "types.h"
+#endif
+
+
+void gl_alloc_accum_buffer( GLcontext *ctx )
+{
+   GLint n;
+
+   if (ctx->Buffer->Accum) {
+      free( ctx->Buffer->Accum );
+      ctx->Buffer->Accum = NULL;
+   }
+
+   /* allocate accumulation buffer if not already present */
+   n = ctx->Buffer->Width * ctx->Buffer->Height * 4 * sizeof(GLaccum);
+   ctx->Buffer->Accum = (GLaccum *) malloc( n );
+   if (!ctx->Buffer->Accum) {
+      /* unable to setup accumulation buffer */
+      gl_error( ctx, GL_OUT_OF_MEMORY, "glAccum" );
+   }
+}
+
+
+
+void gl_ClearAccum( GLcontext *ctx,
+                    GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha )
+{
+   if (INSIDE_BEGIN_END(ctx)) {
+      gl_error( ctx, GL_INVALID_OPERATION, "glAccum" );
+      return;
+   }
+   ctx->Accum.ClearColor[0] = CLAMP( red, -1.0, 1.0 );
+   ctx->Accum.ClearColor[1] = CLAMP( green, -1.0, 1.0 );
+   ctx->Accum.ClearColor[2] = CLAMP( blue, -1.0, 1.0 );
+   ctx->Accum.ClearColor[3] = CLAMP( alpha, -1.0, 1.0 );
+}
+
+
+
+
+void gl_Accum( GLcontext *ctx, GLenum op, GLfloat value )
+{
+   GLuint xpos, ypos, width, height;
+   GLfloat acc_scale;
+
+   if (INSIDE_BEGIN_END(ctx)) {
+      gl_error( ctx, GL_INVALID_OPERATION, "glAccum" );
+      return;
+   }
+
+   if (ctx->Visual->AccumBits==0 || !ctx->Buffer->Accum) {
+      /* No accumulation buffer! */
+      gl_warning(ctx, "Calling glAccum() without an accumulation buffer");
+      return;
+   }
+
+   if (sizeof(GLaccum)==1) {
+      acc_scale = 127.0;
+   }
+   else if (sizeof(GLaccum)==2) {
+      acc_scale = 32767.0;
+   }
+   else {
+      /* sizeof(GLaccum) > 2 (Cray) */
+      acc_scale = (float) SHRT_MAX;
+   }
+
+   /* Determine region to operate upon. */
+   if (ctx->Scissor.Enabled) {
+      xpos = ctx->Scissor.X;
+      ypos = ctx->Scissor.Y;
+      width = ctx->Scissor.Width;
+      height = ctx->Scissor.Height;
+   }
+   else {
+      /* whole window */
+      xpos = 0;
+      ypos = 0;
+      width = ctx->Buffer->Width;
+      height = ctx->Buffer->Height;
+   }
+
+   switch (op) {
+      case GL_ADD:
+         {
+           GLaccum ival, *acc;
+           GLuint i, j;
+
+           ival = (GLaccum) (value * acc_scale);
+           for (j=0;j<height;j++) {
+              acc = ctx->Buffer->Accum
+                     + (ypos * ctx->Buffer->Width + xpos) * 4;
+              for (i=0;i<width;i++) {
+                 *acc += ival;   acc++;   /* red */
+                 *acc += ival;   acc++;   /* green */
+                 *acc += ival;   acc++;   /* blue */
+                 *acc += ival;   acc++;   /* alpha */
+              }
+              ypos++;
+           }
+        }
+        break;
+      case GL_MULT:
+        {
+           GLaccum *acc;
+           GLuint i, j;
+
+           for (j=0;j<height;j++) {
+              acc = ctx->Buffer->Accum
+                     + (ypos * ctx->Buffer->Width + xpos) * 4;
+              for (i=0;i<width;i++) {
+                 *acc = (GLaccum) ( (GLfloat) *acc * value );    acc++; /*r*/
+                 *acc = (GLaccum) ( (GLfloat) *acc * value );    acc++; /*g*/
+                 *acc = (GLaccum) ( (GLfloat) *acc * value );    acc++; /*g*/
+                 *acc = (GLaccum) ( (GLfloat) *acc * value );    acc++; /*a*/
+              }
+              ypos++;
+           }
+        }
+        break;
+      case GL_ACCUM:
+        {
+           GLaccum *acc;
+           GLubyte red[MAX_WIDTH], green[MAX_WIDTH];
+           GLubyte blue[MAX_WIDTH], alpha[MAX_WIDTH];
+           GLfloat rscale, gscale, bscale, ascale;
+           GLuint i, j;
+
+           (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.ReadBuffer );
+
+           /* Accumulate */
+           rscale = value * acc_scale * ctx->Visual->InvRedScale;
+           gscale = value * acc_scale * ctx->Visual->InvGreenScale;
+           bscale = value * acc_scale * ctx->Visual->InvBlueScale;
+           ascale = value * acc_scale * ctx->Visual->InvAlphaScale;
+           for (j=0;j<height;j++) {
+              (*ctx->Driver.ReadColorSpan)( ctx, width, xpos, ypos,
+                                             red, green, blue, alpha);
+              acc = ctx->Buffer->Accum
+                     + (ypos * ctx->Buffer->Width + xpos) * 4;
+              for (i=0;i<width;i++) {
+                 *acc += (GLaccum) ( (GLfloat) red[i]   * rscale );  acc++;
+                 *acc += (GLaccum) ( (GLfloat) green[i] * gscale );  acc++;
+                 *acc += (GLaccum) ( (GLfloat) blue[i]  * bscale );  acc++;
+                 *acc += (GLaccum) ( (GLfloat) alpha[i] * ascale );  acc++;
+              }
+              ypos++;
+           }
+
+           (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DrawBuffer );
+        }
+        break;
+      case GL_LOAD:
+        {
+           GLaccum *acc;
+           GLubyte red[MAX_WIDTH], green[MAX_WIDTH];
+           GLubyte blue[MAX_WIDTH], alpha[MAX_WIDTH];
+           GLfloat rscale, gscale, bscale, ascale;
+           GLuint i, j;
+
+           (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Pixel.ReadBuffer );
+
+           /* Load accumulation buffer */
+           rscale = value * acc_scale * ctx->Visual->InvRedScale;
+           gscale = value * acc_scale * ctx->Visual->InvGreenScale;
+           bscale = value * acc_scale * ctx->Visual->InvBlueScale;
+           ascale = value * acc_scale * ctx->Visual->InvAlphaScale;
+           for (j=0;j<height;j++) {
+              (*ctx->Driver.ReadColorSpan)( ctx, width, xpos, ypos,
+                                             red, green, blue, alpha);
+              acc = ctx->Buffer->Accum
+                     + (ypos * ctx->Buffer->Width + xpos) * 4;
+              for (i=0;i<width;i++) {
+                 *acc++ = (GLaccum) ( (GLfloat) red[i]   * rscale );
+                 *acc++ = (GLaccum) ( (GLfloat) green[i] * gscale );
+                 *acc++ = (GLaccum) ( (GLfloat) blue[i]  * bscale );
+                 *acc++ = (GLaccum) ( (GLfloat) alpha[i] * ascale );
+              }
+              ypos++;
+           }
+
+           (void) (*ctx->Driver.SetBuffer)( ctx, ctx->Color.DrawBuffer );
+        }
+        break;
+      case GL_RETURN:
+        {
+           GLubyte red[MAX_WIDTH], green[MAX_WIDTH];
+           GLubyte blue[MAX_WIDTH], alpha[MAX_WIDTH];
+           GLaccum *acc;
+           GLfloat rscale, gscale, bscale, ascale;
+           GLint rmax, gmax, bmax, amax;
+           GLuint i, j;
+
+           rscale = value / acc_scale * ctx->Visual->RedScale;
+           gscale = value / acc_scale * ctx->Visual->GreenScale;
+           bscale = value / acc_scale * ctx->Visual->BlueScale;
+           ascale = value / acc_scale * ctx->Visual->AlphaScale;
+           rmax = (GLint) ctx->Visual->RedScale;
+           gmax = (GLint) ctx->Visual->GreenScale;
+           bmax = (GLint) ctx->Visual->BlueScale;
+           amax = (GLint) ctx->Visual->AlphaScale;
+           for (j=0;j<height;j++) {
+              acc = ctx->Buffer->Accum
+                     + (ypos * ctx->Buffer->Width + xpos) * 4;
+              for (i=0;i<width;i++) {
+                 GLint r, g, b, a;
+                 r = (GLint) ( (GLfloat) (*acc++) * rscale + 0.5F );
+                 g = (GLint) ( (GLfloat) (*acc++) * gscale + 0.5F );
+                 b = (GLint) ( (GLfloat) (*acc++) * bscale + 0.5F );
+                 a = (GLint) ( (GLfloat) (*acc++) * ascale + 0.5F );
+                 red[i]   = CLAMP( r, 0, rmax );
+                 green[i] = CLAMP( g, 0, gmax );
+                 blue[i]  = CLAMP( b, 0, bmax );
+                 alpha[i] = CLAMP( a, 0, amax );
+              }
+              (*ctx->Driver.WriteColorSpan)( ctx, width, xpos, ypos,
+                                              red, green, blue, alpha, NULL );
+              ypos++;
+           }
+        }
+        break;
+      default:
+         gl_error( ctx, GL_INVALID_ENUM, "glAccum" );
+   }
+}
+
+
+
+
+/*
+ * Clear the accumulation Buffer->
+ */
+void gl_clear_accum_buffer( GLcontext *ctx )
+{
+   GLuint buffersize;
+   GLfloat acc_scale;
+
+   if (ctx->Visual->AccumBits==0) {
+      /* No accumulation buffer! */
+      return;
+   }
+
+   if (sizeof(GLaccum)==1) {
+      acc_scale = 127.0;
+   }
+   else if (sizeof(GLaccum)==2) {
+      acc_scale = 32767.0;
+   }
+   else {
+      /* sizeof(GLaccum) > 2 (Cray) */
+      acc_scale = (float) SHRT_MAX;
+   }
+
+   /* number of pixels */
+   buffersize = ctx->Buffer->Width * ctx->Buffer->Height;
+
+   if (!ctx->Buffer->Accum) {
+      /* try to alloc accumulation buffer */
+      ctx->Buffer->Accum = (GLaccum *)
+                          malloc( buffersize * 4 * sizeof(GLaccum) );
+   }
+
+   if (ctx->Buffer->Accum) {
+      if (ctx->Scissor.Enabled) {
+        /* Limit clear to scissor box */
+        GLaccum r, g, b, a;
+        GLint i, j;
+         GLint width, height;
+         GLaccum *row;
+        r = (GLaccum) (ctx->Accum.ClearColor[0] * acc_scale);
+        g = (GLaccum) (ctx->Accum.ClearColor[1] * acc_scale);
+        b = (GLaccum) (ctx->Accum.ClearColor[2] * acc_scale);
+        a = (GLaccum) (ctx->Accum.ClearColor[3] * acc_scale);
+         /* size of region to clear */
+         width = 4 * (ctx->Buffer->Xmax - ctx->Buffer->Xmin + 1);
+         height = ctx->Buffer->Ymax - ctx->Buffer->Ymin + 1;
+         /* ptr to first element to clear */
+         row = ctx->Buffer->Accum
+               + 4 * (ctx->Buffer->Ymin * ctx->Buffer->Width
+                      + ctx->Buffer->Xmin);
+         for (j=0;j<height;j++) {
+            for (i=0;i<width;i+=4) {
+               row[i+0] = r;
+               row[i+1] = g;
+               row[i+2] = b;
+               row[i+3] = a;
+           }
+            row += 4 * ctx->Buffer->Width;
+        }
+      }
+      else {
+        /* clear whole buffer */
+        if (ctx->Accum.ClearColor[0]==0.0 &&
+            ctx->Accum.ClearColor[1]==0.0 &&
+            ctx->Accum.ClearColor[2]==0.0 &&
+            ctx->Accum.ClearColor[3]==0.0) {
+           /* Black */
+           MEMSET( ctx->Buffer->Accum, 0, buffersize * 4 * sizeof(GLaccum) );
+        }
+        else {
+           /* Not black */
+           GLaccum *acc, r, g, b, a;
+           GLuint i;
+
+           acc = ctx->Buffer->Accum;
+           r = (GLaccum) (ctx->Accum.ClearColor[0] * acc_scale);
+           g = (GLaccum) (ctx->Accum.ClearColor[1] * acc_scale);
+           b = (GLaccum) (ctx->Accum.ClearColor[2] * acc_scale);
+           a = (GLaccum) (ctx->Accum.ClearColor[3] * acc_scale);
+           for (i=0;i<buffersize;i++) {
+              *acc++ = r;
+              *acc++ = g;
+              *acc++ = b;
+              *acc++ = a;
+           }
+        }
+      }
+   }
+}
diff --git a/dll/opengl/mesa/accum.h b/dll/opengl/mesa/accum.h
new file mode 100644
index 0000000000..76a603b63e
--- /dev/null
+++ b/dll/opengl/mesa/accum.h
@@ -0,0 +1,55 @@
+/* $Id: accum.h,v 1.2 1996/09/15 14:19:57 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  2.0
+ * Copyright (C) 1995-1996  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.
+ */
+
+
+/*
+ * $Log: accum.h,v $
+ * Revision 1.2  1996/09/15 14:19:57  brianp
+ * added gl_alloc_accum_buffer()
+ *
+ * Revision 1.1  1996/09/13 01:38:16  brianp
+ * Initial revision
+ *
+ */
+
+
+#ifndef ACCUM_H
+#define ACCUM_H
+
+
+#include "types.h"
+
+
+extern void gl_alloc_accum_buffer( GLcontext *ctx );
+
+
+extern void gl_Accum( GLcontext* ctx, GLenum op, GLfloat value );
+
+
+extern void gl_ClearAccum( GLcontext* ctx, GLfloat red, GLfloat green,
+                           GLfloat blue, GLfloat alpha );
+
+
+extern void gl_clear_accum_buffer( GLcontext* ctx );
+
+
+#endif
diff --git a/dll/opengl/mesa/all.h b/dll/opengl/mesa/all.h
new file mode 100644
index 0000000000..8040d3eece
--- /dev/null
+++ b/dll/opengl/mesa/all.h
@@ -0,0 +1,136 @@
+/* $Id: all.h,v 1.6 1997/12/15 03:40:05 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  2.6
+ * Copyright (C) 1995-1997  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.
+ */
+
+
+/*
+ * $Log: all.h,v $
+ * Revision 1.6  1997/12/15 03:40:05  brianp
+ * added asm-386.h file
+ *
+ * Revision 1.5  1997/11/20 00:23:21  brianp
+ * added rect.h
+ *
+ * Revision 1.4  1997/09/27 00:16:04  brianp
+ * added colortab.h
+ *
+ * Revision 1.3  1997/08/22 01:42:48  brianp
+ * added api.h and hash.h
+ *
+ * Revision 1.2  1997/05/28 03:22:27  brianp
+ * added a few more headers
+ *
+ * Revision 1.1  1997/04/02 03:49:26  brianp
+ * Initial revision
+ *
+ */
+
+
+/* The purpose of this file is to collect all the header files that Mesa
+ * uses into a single header so that we can get new compilers that support
+ * pre-compiled headers to compile much faster.
+ * All we do is list all the internal headers used by Mesa in this one
+ * main header file, and most compilers will pre-compile all these headers
+ * and use them over and over again for each source module. This makes a
+ * big difference for Win32 support, because the <windows.h> headers take
+ * a *long* time to compile.
+ */
+
+
+#ifndef SRC_ALL_H
+#define SRC_ALL_H
+
+
+#ifndef PC_HEADER
+  This is an error.  all.h should be included only if PC_HEADER is defined.
+#endif
+
+
+#include <assert.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <float.h>
+#include <math.h>
+#include "GL/gl.h"
+#include "GL/osmesa.h"
+#include "accum.h"
+#include "alpha.h"
+#include "alphabuf.h"
+#include "api.h"
+#include "asm-386.h"
+#include "attrib.h"
+#include "bitmap.h"
+#include "blend.h"
+#include "clip.h"
+#include "colortab.h"
+#include "context.h"
+#include "config.h"
+#include "copypix.h"
+#include "dd.h"
+#include "depth.h"
+#include "dlist.h"
+#include "drawpix.h"
+#include "enable.h"
+#include "eval.h"
+#include "feedback.h"
+#include "fixed.h"
+#include "fog.h"
+#include "get.h"
+#include "hash.h"
+#include "image.h"
+#include "light.h"
+#include "lines.h"
+#include "logic.h"
+#include "macros.h"
+#include "masking.h"
+#include "matrix.h"
+#include "misc.h"
+#include "mmath.h"
+#include "pb.h"
+#include "pixel.h"
+#include "pointers.h"
+#include "points.h"
+#include "polygon.h"
+#include "rastpos.h"
+#include "readpix.h"
+#include "rect.h"
+#include "scissor.h"
+#include "shade.h"
+#include "span.h"
+#include "stencil.h"
+#include "teximage.h"
+#include "texobj.h"
+#include "texstate.h"
+#include "texture.h"
+#include "triangle.h"
+#include "types.h"
+#include "varray.h"
+#include "vb.h"
+#include "vbfill.h"
+#include "vbrender.h"
+#include "vbxform.h"
+#include "winpos.h"
+#include "xform.h"
+
+
+#endif /*SRC_ALL_H*/
diff --git a/dll/opengl/mesa/alpha.c b/dll/opengl/mesa/alpha.c
new file mode 100644
index 0000000000..c99a6d4450
--- /dev/null
+++ b/dll/opengl/mesa/alpha.c
@@ -0,0 +1,142 @@
+/* $Id: alpha.c,v 1.5 1997/07/24 01:24:28 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  2.4
+ * Copyright (C) 1995-1997  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.
+ */
+
+
+/*
+ * $Log: alpha.c,v $
+ * Revision 1.5  1997/07/24 01:24:28  brianp
+ * changed precompiled header symbol from PCH to PC_HEADER
+ *
+ * Revision 1.4  1997/05/28 03:23:09  brianp
+ * added precompiled header (PCH) support
+ *
+ * Revision 1.3  1997/03/13 03:07:53  brianp
+ * optimized gl_alpha_test() by removing conditional from inside loops
+ *
+ * Revision 1.2  1996/09/15 14:15:54  brianp
+ * now use GLframebuffer and GLvisual
+ *
+ * Revision 1.1  1996/09/13 01:38:16  brianp
+ * Initial revision
+ *
+ */
+
+
+#ifdef PC_HEADER
+#include "all.h"
+#else
+#include "alpha.h"
+#include "context.h"
+#include "types.h"
+#include "dlist.h"
+#include "macros.h"
+#endif
+
+
+
+void gl_AlphaFunc( GLcontext* ctx, GLenum func, GLclampf ref )
+{
+   if (INSIDE_BEGIN_END(ctx)) {
+      gl_error( ctx, GL_INVALID_OPERATION, "glAlphaFunc" );
+      return;
+   }
+   switch (func) {
+      case GL_NEVER:
+      case GL_LESS:
+      case GL_EQUAL:
+      case GL_LEQUAL:
+      case GL_GREATER:
+      case GL_NOTEQUAL:
+      case GL_GEQUAL:
+      case GL_ALWAYS:
+         ctx->Color.AlphaFunc = func;
+         ctx->Color.AlphaRef = CLAMP( ref, 0.0F, 1.0F );
+         ctx->Color.AlphaRefUbyte = (GLubyte) (ctx->Color.AlphaRef
+                                              * ctx->Visual->AlphaScale);
+         break;
+      default:
+         gl_error( ctx, GL_INVALID_ENUM, "glAlphaFunc(func)" );
+         break;
+   }
+}
+
+
+
+
+/*
+ * Apply the alpha test to a span of pixels.
+ * In/Out:  mask - current pixel mask.  Pixels which fail the alpha test
+ *                 will set the corresponding mask flag to 0.
+ * Return:  0 = all pixels in the span failed the alpha test.
+ *          1 = one or more pixels passed the alpha test.
+ */
+GLint gl_alpha_test( GLcontext* ctx,
+                     GLuint n, const GLubyte alpha[], GLubyte mask[] )
+{
+   GLuint i;
+   GLubyte ref = ctx->Color.AlphaRefUbyte;
+
+   /* switch cases ordered from most frequent to less frequent */
+   switch (ctx->Color.AlphaFunc) {
+      case GL_LESS:
+         for (i=0;i<n;i++) {
+           mask[i] &= (alpha[i] < ref);
+        }
+        return 1;
+      case GL_LEQUAL:
+         for (i=0;i<n;i++) {
+           mask[i] &= (alpha[i] <= ref);
+        }
+        return 1;
+      case GL_GEQUAL:
+         for (i=0;i<n;i++) {
+           mask[i] &= (alpha[i] >= ref);
+        }
+        return 1;
+      case GL_GREATER:
+         for (i=0;i<n;i++) {
+           mask[i] &= (alpha[i] > ref);
+        }
+        return 1;
+      case GL_NOTEQUAL:
+         for (i=0;i<n;i++) {
+           mask[i] &= (alpha[i] != ref);
+        }
+        return 1;
+      case GL_EQUAL:
+         for (i=0;i<n;i++) {
+           mask[i] &= (alpha[i] == ref);
+        }
+        return 1;
+      case GL_ALWAYS:
+        /* do nothing */
+        return 1;
+      case GL_NEVER:
+         /* caller should check for zero! */
+        return 0;
+      default:
+        gl_problem( ctx, "Invalid alpha test in gl_alpha_test" );
+         return 0;
+   }
+   /* Never get here */
+   return 1;
+}
diff --git a/dll/opengl/mesa/alpha.h b/dll/opengl/mesa/alpha.h
new file mode 100644
index 0000000000..4e0a55abe4
--- /dev/null
+++ b/dll/opengl/mesa/alpha.h
@@ -0,0 +1,46 @@
+/* $Id: alpha.h,v 1.1 1996/09/13 01:38:16 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  2.0
+ * Copyright (C) 1995-1996  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.
+ */
+
+
+/*
+ * $Log: alpha.h,v $
+ * Revision 1.1  1996/09/13 01:38:16  brianp
+ * Initial revision
+ *
+ */
+
+
+#ifndef ALPHA_H
+#define ALPHA_H
+
+
+#include "types.h"
+
+
+extern GLint gl_alpha_test( GLcontext* ctx,
+                            GLuint n, const GLubyte alpha[], GLubyte mask[] );
+
+
+extern void gl_AlphaFunc( GLcontext* ctx, GLenum func, GLclampf ref );
+
+
+#endif
diff --git a/dll/opengl/mesa/alphabuf.c b/dll/opengl/mesa/alphabuf.c
new file mode 100644
index 0000000000..786f187b3a
--- /dev/null
+++ b/dll/opengl/mesa/alphabuf.c
@@ -0,0 +1,271 @@
+/* $Id: alphabuf.c,v 1.5 1997/07/24 01:24:28 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  2.4
+ * Copyright (C) 1995-1997  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.
+ */
+
+
+/*
+ * $Log: alphabuf.c,v $
+ * Revision 1.5  1997/07/24 01:24:28  brianp
+ * changed precompiled header symbol from PCH to PC_HEADER
+ *
+ * Revision 1.4  1997/05/28 03:23:09  brianp
+ * added precompiled header (PCH) support
+ *
+ * Revision 1.3  1996/10/02 02:51:07  brianp
+ * in gl_clear_alpha_buffers() check for GL_FRONT_AND_BACK draw mode
+ *
+ * Revision 1.2  1996/09/15 14:15:54  brianp
+ * now use GLframebuffer and GLvisual
+ *
+ * Revision 1.1  1996/09/13 01:38:16  brianp
+ * Initial revision
+ *
+ */
+
+
+
+/*
+ * Software alpha planes.  Many frame buffers don't have alpha bits so
+ * we simulate them in software.
+ */
+
+
+#ifdef PC_HEADER
+#include "all.h"
+#else
+#include <stdlib.h>
+#include <string.h>
+#include "alphabuf.h"
+#include "context.h"
+#include "macros.h"
+#include "types.h"
+#endif
+
+
+
+#define ALPHA_ADDR(X,Y)  (ctx->Buffer->Alpha + (Y) * ctx->Buffer->Width + (X))
+
+
+
+/*
+ * Allocate a new front and back alpha buffer.
+ */
+void gl_alloc_alpha_buffers( GLcontext* ctx )
+{
+   GLint bytes = ctx->Buffer->Width * ctx->Buffer->Height * sizeof(GLubyte);
+
+   if (ctx->Visual->FrontAlphaEnabled) {
+      if (ctx->Buffer->FrontAlpha) {
+         free( ctx->Buffer->FrontAlpha );
+      }
+      ctx->Buffer->FrontAlpha = (GLubyte *) malloc( bytes );
+      if (!ctx->Buffer->FrontAlpha) {
+         /* out of memory */
+         gl_error( ctx, GL_OUT_OF_MEMORY, "Couldn't allocate front alpha 
buffer" );
+      }
+   }
+   if (ctx->Visual->BackAlphaEnabled) {
+      if (ctx->Buffer->BackAlpha) {
+         free( ctx->Buffer->BackAlpha );
+      }
+      ctx->Buffer->BackAlpha = (GLubyte *) malloc( bytes );
+      if (!ctx->Buffer->BackAlpha) {
+         /* out of memory */
+         gl_error( ctx, GL_OUT_OF_MEMORY, "Couldn't allocate back alpha 
buffer" );
+      }
+   }
+   if (ctx->Color.DrawBuffer==GL_FRONT) {
+      ctx->Buffer->Alpha = ctx->Buffer->FrontAlpha;
+   }
+   if (ctx->Color.DrawBuffer==GL_BACK) {
+      ctx->Buffer->Alpha = ctx->Buffer->BackAlpha;
+   }
+}
+
+
+
+/*
+ * Clear the front and/or back alpha planes.
+ */
+void gl_clear_alpha_buffers( GLcontext* ctx )
+{
+   GLint buffer;
+
+   /* Loop over front and back buffers */
+   for (buffer=0;buffer<2;buffer++) {
+
+      /* Get pointer to front or back buffer */
+      GLubyte *abuffer = NULL;
+      if (buffer==0
+          && (   ctx->Color.DrawBuffer==GL_FRONT
+              || ctx->Color.DrawBuffer==GL_FRONT_AND_BACK)
+          && ctx->Visual->FrontAlphaEnabled && ctx->Buffer->FrontAlpha) {
+         abuffer = ctx->Buffer->FrontAlpha;
+      }
+      else if (buffer==1
+               && (   ctx->Color.DrawBuffer==GL_BACK
+                   || ctx->Color.DrawBuffer==GL_FRONT_AND_BACK)
+               && ctx->Visual->BackAlphaEnabled && ctx->Buffer->BackAlpha) {
+         abuffer = ctx->Buffer->BackAlpha;
+      }
+
+      /* Clear the alpha buffer */
+      if (abuffer) {
+         GLubyte aclear = (GLint) (ctx->Color.ClearColor[3]
+                                   * ctx->Visual->AlphaScale);
+         if (ctx->Scissor.Enabled) {
+            /* clear scissor region */
+            GLint i, j;
+            for (j=0;j<ctx->Scissor.Height;j++) {
+               GLubyte *aptr = ALPHA_ADDR(ctx->Buffer->Xmin,
+                                          ctx->Buffer->Ymin+j);
+               for (i=0;i<ctx->Scissor.Width;i++) {
+                  *aptr++ = aclear;
+               }
+            }
+         }
+         else {
+            /* clear whole buffer */
+            MEMSET( abuffer, aclear, ctx->Buffer->Width*ctx->Buffer->Height );
+         }
+      }
+   }
+}
+
+
+
+void gl_write_alpha_span( GLcontext* ctx, GLuint n, GLint x, GLint y,
+                          GLubyte alpha[], GLubyte mask[] )
+{
+   GLubyte *aptr = ALPHA_ADDR( x, y );
+   GLuint i;
+
+   if (mask) {
+      for (i=0;i<n;i++) {
+         if (mask[i]) {
+            *aptr = alpha[i];
+         }
+         aptr++;
+      }
+   }
+   else {
+      for (i=0;i<n;i++) {
+         *aptr++ = alpha[i];
+      }
+   }
+}
+
+
+void gl_write_mono_alpha_span( GLcontext* ctx, GLuint n, GLint x, GLint y,
+                               GLubyte alpha, GLubyte mask[] )
+{
+   GLubyte *aptr = ALPHA_ADDR( x, y );
+   GLuint i;
+
+   if (mask) {
+      for (i=0;i<n;i++) {
+         if (mask[i]) {
+            *aptr = alpha;
+         }
+         aptr++;
+      }
+   }
+   else {
+      for (i=0;i<n;i++) {
+         *aptr++ = alpha;
+      }
+   }
+}
+
+
+void gl_write_alpha_pixels( GLcontext* ctx,
+                            GLuint n, const GLint x[], const GLint y[],
+                            const GLubyte alpha[], const GLubyte mask[] )
+{
+   GLuint i;
+
+   if (mask) {
+      for (i=0;i<n;i++) {
+         if (mask[i]) {
+            GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
+            *aptr = alpha[i];
+         }
+      }
+   }
+   else {
+      for (i=0;i<n;i++) {
+         GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
+         *aptr = alpha[i];
+      }
+   }
+}
+
+
+void gl_write_mono_alpha_pixels( GLcontext* ctx,
+                                 GLuint n, const GLint x[], const GLint y[],
+                                 GLubyte alpha, const GLubyte mask[] )
+{
+   GLuint i;
+
+   if (mask) {
+      for (i=0;i<n;i++) {
+         if (mask[i]) {
+            GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
+            *aptr = alpha;
+         }
+      }
+   }
+   else {
+      for (i=0;i<n;i++) {
+         GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
+         *aptr = alpha;
+      }
+   }
+}
+
+
+
+void gl_read_alpha_span( GLcontext* ctx,
+                         GLuint n, GLint x, GLint y, GLubyte alpha[] )
+{
+   GLubyte *aptr = ALPHA_ADDR( x, y );
+   GLuint i;
+   for (i=0;i<n;i++) {
+      alpha[i] = *aptr++;
+   }
+}
+
+
+void gl_read_alpha_pixels( GLcontext* ctx,
+                           GLuint n, const GLint x[], const GLint y[],
+                           GLubyte alpha[], const GLubyte mask[] )
+{
+   GLuint i;
+   for (i=0;i<n;i++) {
+      if (mask[i]) {
+         GLubyte *aptr = ALPHA_ADDR( x[i], y[i] );
+         alpha[i] = *aptr;
+      }
+   }
+}
+
+
+
diff --git a/dll/opengl/mesa/alphabuf.h b/dll/opengl/mesa/alphabuf.h
new file mode 100644
index 0000000000..e2f6ef8e0b
--- /dev/null
+++ b/dll/opengl/mesa/alphabuf.h
@@ -0,0 +1,78 @@
+/* $Id: alphabuf.h,v 1.1 1996/09/13 01:38:16 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  2.0
+ * Copyright (C) 1995-1996  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.
+ */
+
+
+/*
+ * $Log: alphabuf.h,v $
+ * Revision 1.1  1996/09/13 01:38:16  brianp
+ * Initial revision
+ *
+ */
+
+
+
+#ifndef ALPHABUF_H
+#define ALPHABUF_H
+
+
+#include "types.h"
+
+
+extern void gl_alloc_alpha_buffers( GLcontext* ctx );
+
+
+extern void gl_clear_alpha_buffers( GLcontext* ctx );
+
+
+extern void gl_write_alpha_span( GLcontext* ctx, GLuint n, GLint x, GLint y,
+                                 GLubyte alpha[], GLubyte mask[] );
+
+
+extern void gl_write_mono_alpha_span( GLcontext* ctx,
+                                      GLuint n, GLint x, GLint y,
+                                      GLubyte alpha, GLubyte mask[] );
+
+
+
+extern void gl_write_alpha_pixels( GLcontext* ctx,
+                                   GLuint n, const GLint x[], const GLint y[],
+                                   const GLubyte alpha[],
+                                   const GLubyte mask[] );
+
+
+extern void gl_write_mono_alpha_pixels( GLcontext* ctx,
+                                        GLuint n, const GLint x[],
+                                        const GLint y[], GLubyte alpha,
+                                        const GLubyte mask[] );
+
+
+extern void  gl_read_alpha_span( GLcontext* ctx,
+                                 GLuint n, GLint x, GLint y, GLubyte alpha[] );
+
+
+extern void gl_read_alpha_pixels( GLcontext* ctx,
+                                  GLuint n, const GLint x[], const GLint y[],
+                                  GLubyte alpha[], const GLubyte mask[] );
+
+
+#endif
+
diff --git a/dll/opengl/mesa/api.c b/dll/opengl/mesa/api.c
new file mode 100644
index 0000000000..b594b23473
--- /dev/null
+++ b/dll/opengl/mesa/api.c
@@ -0,0 +1,2874 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  2.5
+ * Copyright (C) 1995-1997  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.
+ */
+
+#ifdef PC_HEADER
+#include "all.h"
+#else
+#include <stdio.h>
+#include <stdlib.h>
+#include "api.h"
+#include "bitmap.h"
+#include "context.h"
+
+#include "drawpix.h"
+
+#include "eval.h"
+#include "image.h"
+#include "macros.h"
+#include "matrix.h"
+#include "teximage.h"
+#include "types.h"
+#include "vb.h"
+#endif
+
+void APIENTRY _mesa_Accum( GLenum op, GLfloat value )
+{
+   GET_CONTEXT;
+   (*CC->API.Accum)(CC, op, value);
+}
+
+void APIENTRY _mesa_AlphaFunc( GLenum func, GLclampf ref )
+{
+   GET_CONTEXT;
+   (*CC->API.AlphaFunc)(CC, func, ref);
+}
+
+
+GLboolean APIENTRY _mesa_AreTexturesResident( GLsizei n, const GLuint 
*textures,
+                                 GLboolean *residences )
+{
+   GET_CONTEXT;
+   return (*CC->API.AreTexturesResident)(CC, n, textures, residences);
+}
+
+void APIENTRY _mesa_ArrayElement( GLint i )
+{
+   GET_CONTEXT;
+   (*CC->API.ArrayElement)(CC, i);
+}
+
+
+void APIENTRY _mesa_Begin( GLenum mode )
+{
+   GET_CONTEXT;
+   (*CC->API.Begin)( CC, mode );
+}
+
+
+void APIENTRY _mesa_BindTexture( GLenum target, GLuint texture )
+{
+   GET_CONTEXT;
+   (*CC->API.BindTexture)(CC, target, texture);
+}
+
+
+void APIENTRY _mesa_Bitmap( GLsizei width, GLsizei height,
+               GLfloat xorig, GLfloat yorig,
+               GLfloat xmove, GLfloat ymove,
+               const GLubyte *bitmap )
+{
+   GET_CONTEXT;
+   if (!CC->CompileFlag) {
+      /* execute only, try optimized case where no unpacking needed */
+      if (   CC->Unpack.LsbFirst==GL_FALSE
+          && CC->Unpack.Alignment==1
+          && CC->Unpack.RowLength==0
+          && CC->Unpack.SkipPixels==0
+          && CC->Unpack.SkipRows==0) {
+         /* Special case: no unpacking needed */
+         struct gl_image image;
+         image.Width = width;
+         image.Height = height;
+         image.Components = 0;
+         image.Type = GL_BITMAP;
+         image.Format = GL_COLOR_INDEX;
+         image.Data = (GLvoid *) bitmap;
+         (*CC->Exec.Bitmap)( CC, width, height, xorig, yorig,
+                             xmove, ymove, &image );
+      }
+      else {
+         struct gl_image *image;
+         image = gl_unpack_bitmap( CC, width, height, bitmap );
+         (*CC->Exec.Bitmap)( CC, width, height, xorig, yorig,
+                             xmove, ymove, image );
+         if (image) {
+            gl_free_image( image );
+         }
+      }
+   }
+   else {
+      /* compile and maybe execute */
+      struct gl_image *image;
+      image = gl_unpack_bitmap( CC, width, height, bitmap );
+      (*CC->API.Bitmap)(CC, width, height, xorig, yorig, xmove, ymove, image );
+   }
+}
+
+
+void APIENTRY _mesa_BlendFunc( GLenum sfactor, GLenum dfactor )
+{
+   GET_CONTEXT;
+   (*CC->API.BlendFunc)(CC, sfactor, dfactor);
+}
+
+
+void APIENTRY _mesa_CallList( GLuint list )
+{
+   GET_CONTEXT;
+   (*CC->API.CallList)(CC, list);
+}
+
+
+void APIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists )
+{
+   GET_CONTEXT;
+   (*CC->API.CallLists)(CC, n, type, lists);
+}
+
+
+void APIENTRY _mesa_Clear( GLbitfield mask )
+{
+   GET_CONTEXT;
+   (*CC->API.Clear)(CC, mask);
+}
+
+
+void APIENTRY _mesa_ClearAccum( GLfloat red, GLfloat green,
+              GLfloat blue, GLfloat alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.ClearAccum)(CC, red, green, blue, alpha);
+}
+
+
+
+void APIENTRY _mesa_ClearIndex( GLfloat c )
+{
+   GET_CONTEXT;
+   (*CC->API.ClearIndex)(CC, c);
+}
+
+
+void APIENTRY _mesa_ClearColor( GLclampf red,
+              GLclampf green,
+              GLclampf blue,
+              GLclampf alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.ClearColor)(CC, red, green, blue, alpha);
+}
+
+
+void APIENTRY _mesa_ClearDepth( GLclampd depth )
+{
+   GET_CONTEXT;
+   (*CC->API.ClearDepth)( CC, depth );
+}
+
+
+void APIENTRY _mesa_ClearStencil( GLint s )
+{
+   GET_CONTEXT;
+   (*CC->API.ClearStencil)(CC, s);
+}
+
+
+void APIENTRY _mesa_ClipPlane( GLenum plane, const GLdouble *equation )
+{
+   GLfloat eq[4];
+   GET_CONTEXT;
+   eq[0] = (GLfloat) equation[0];
+   eq[1] = (GLfloat) equation[1];
+   eq[2] = (GLfloat) equation[2];
+   eq[3] = (GLfloat) equation[3];
+   (*CC->API.ClipPlane)(CC, plane, eq );
+}
+
+
+void APIENTRY _mesa_Color3b( GLbyte red, GLbyte green, GLbyte blue )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green),
+                       BYTE_TO_FLOAT(blue) );
+}
+
+
+void APIENTRY _mesa_Color3d( GLdouble red, GLdouble green, GLdouble blue )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, (GLfloat) red, (GLfloat) green, (GLfloat) blue );
+}
+
+
+void APIENTRY _mesa_Color3f( GLfloat red, GLfloat green, GLfloat blue )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, red, green, blue );
+}
+
+
+void APIENTRY _mesa_Color3i( GLint red, GLint green, GLint blue )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, INT_TO_FLOAT(red), INT_TO_FLOAT(green),
+                       INT_TO_FLOAT(blue) );
+}
+
+
+void APIENTRY _mesa_Color3s( GLshort red, GLshort green, GLshort blue )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green),
+                       SHORT_TO_FLOAT(blue) );
+}
+
+
+void APIENTRY _mesa_Color3ub( GLubyte red, GLubyte green, GLubyte blue )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4ub)( CC, red, green, blue, 255 );
+}
+
+
+void APIENTRY _mesa_Color3ui( GLuint red, GLuint green, GLuint blue )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, UINT_TO_FLOAT(red), UINT_TO_FLOAT(green),
+                       UINT_TO_FLOAT(blue) );
+}
+
+
+void APIENTRY _mesa_Color3us( GLushort red, GLushort green, GLushort blue )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green),
+                       USHORT_TO_FLOAT(blue) );
+}
+
+
+void APIENTRY _mesa_Color4b( GLbyte red, GLbyte green, GLbyte blue, GLbyte 
alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, BYTE_TO_FLOAT(red), BYTE_TO_FLOAT(green),
+                       BYTE_TO_FLOAT(blue), BYTE_TO_FLOAT(alpha) );
+}
+
+
+void APIENTRY _mesa_Color4d( GLdouble red, GLdouble green, GLdouble blue, 
GLdouble alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, (GLfloat) red, (GLfloat) green,
+                       (GLfloat) blue, (GLfloat) alpha );
+}
+
+
+void APIENTRY _mesa_Color4f( GLfloat red, GLfloat green, GLfloat blue, GLfloat 
alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, red, green, blue, alpha );
+}
+
+void APIENTRY _mesa_Color4i( GLint red, GLint green, GLint blue, GLint alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, INT_TO_FLOAT(red), INT_TO_FLOAT(green),
+                       INT_TO_FLOAT(blue), INT_TO_FLOAT(alpha) );
+}
+
+
+void APIENTRY _mesa_Color4s( GLshort red, GLshort green, GLshort blue, GLshort 
alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, SHORT_TO_FLOAT(red), SHORT_TO_FLOAT(green),
+                       SHORT_TO_FLOAT(blue), SHORT_TO_FLOAT(alpha) );
+}
+
+void APIENTRY _mesa_Color4ub( GLubyte red, GLubyte green, GLubyte blue, 
GLubyte alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4ub)( CC, red, green, blue, alpha );
+}
+
+void APIENTRY _mesa_Color4ui( GLuint red, GLuint green, GLuint blue, GLuint 
alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, UINT_TO_FLOAT(red), UINT_TO_FLOAT(green),
+                       UINT_TO_FLOAT(blue), UINT_TO_FLOAT(alpha) );
+}
+
+void APIENTRY _mesa_Color4us( GLushort red, GLushort green, GLushort blue, 
GLushort alpha )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, USHORT_TO_FLOAT(red), USHORT_TO_FLOAT(green),
+                       USHORT_TO_FLOAT(blue), USHORT_TO_FLOAT(alpha) );
+}
+
+
+void APIENTRY _mesa_Color3bv( const GLbyte *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]),
+                       BYTE_TO_FLOAT(v[2]) );
+}
+
+
+void APIENTRY _mesa_Color3dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, (GLdouble) v[0], (GLdouble) v[1], (GLdouble) v[2] );
+}
+
+
+void APIENTRY _mesa_Color3fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3fv)( CC, v );
+}
+
+
+void APIENTRY _mesa_Color3iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]),
+                       INT_TO_FLOAT(v[2]) );
+}
+
+
+void APIENTRY _mesa_Color3sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]),
+                       SHORT_TO_FLOAT(v[2]) );
+}
+
+
+void APIENTRY _mesa_Color3ubv( const GLubyte *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4ub)( CC, v[0], v[1], v[2], 255 );
+}
+
+
+void APIENTRY _mesa_Color3uiv( const GLuint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]),
+                       UINT_TO_FLOAT(v[2]) );
+}
+
+
+void APIENTRY _mesa_Color3usv( const GLushort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color3f)( CC, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]),
+                       USHORT_TO_FLOAT(v[2]) );
+
+}
+
+
+void APIENTRY _mesa_Color4bv( const GLbyte *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, BYTE_TO_FLOAT(v[0]), BYTE_TO_FLOAT(v[1]),
+                       BYTE_TO_FLOAT(v[2]), BYTE_TO_FLOAT(v[3]) );
+}
+
+
+void APIENTRY _mesa_Color4dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, (GLdouble) v[0], (GLdouble) v[1],
+                       (GLdouble) v[2], (GLdouble) v[3] );
+}
+
+
+void APIENTRY _mesa_Color4fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, v[0], v[1], v[2], v[3] );
+}
+
+
+void APIENTRY _mesa_Color4iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, INT_TO_FLOAT(v[0]), INT_TO_FLOAT(v[1]),
+                       INT_TO_FLOAT(v[2]), INT_TO_FLOAT(v[3]) );
+}
+
+
+void APIENTRY _mesa_Color4sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, SHORT_TO_FLOAT(v[0]), SHORT_TO_FLOAT(v[1]),
+                       SHORT_TO_FLOAT(v[2]), SHORT_TO_FLOAT(v[3]) );
+}
+
+
+void APIENTRY _mesa_Color4ubv( const GLubyte *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4ubv)( CC, v );
+}
+
+
+void APIENTRY _mesa_Color4uiv( const GLuint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, UINT_TO_FLOAT(v[0]), UINT_TO_FLOAT(v[1]),
+                       UINT_TO_FLOAT(v[2]), UINT_TO_FLOAT(v[3]) );
+}
+
+
+void APIENTRY _mesa_Color4usv( const GLushort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Color4f)( CC, USHORT_TO_FLOAT(v[0]), USHORT_TO_FLOAT(v[1]),
+                       USHORT_TO_FLOAT(v[2]), USHORT_TO_FLOAT(v[3]) );
+}
+
+
+void APIENTRY _mesa_ColorMask( GLboolean red, GLboolean green,
+             GLboolean blue, GLboolean alpha )
+{
+   GET_CONTEXT;
+          (*CC->API.ColorMask)(CC, red, green, blue, alpha);
+}
+
+
+void APIENTRY _mesa_ColorMaterial( GLenum face, GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.ColorMaterial)(CC, face, mode);
+}
+
+
+void APIENTRY _mesa_ColorPointer( GLint size, GLenum type, GLsizei stride,
+                     const GLvoid *ptr )
+{
+   GET_CONTEXT;
+          (*CC->API.ColorPointer)(CC, size, type, stride, ptr);
+}
+
+
+void APIENTRY _mesa_CopyPixels( GLint x, GLint y, GLsizei width, GLsizei 
height,
+              GLenum type )
+{
+   GET_CONTEXT;
+          (*CC->API.CopyPixels)(CC, x, y, width, height, type);
+}
+
+
+void APIENTRY _mesa_CopyTexImage1D( GLenum target, GLint level,
+                                GLenum internalformat,
+                                GLint x, GLint y,
+                                GLsizei width, GLint border )
+{
+   GET_CONTEXT;
+          (*CC->API.CopyTexImage1D)( CC, target, level, internalformat,
+                                 x, y, width, border );
+}
+
+
+void APIENTRY _mesa_CopyTexImage2D( GLenum target, GLint level,
+                                GLenum internalformat,
+                                GLint x, GLint y,
+                                GLsizei width, GLsizei height, GLint border )
+{
+   GET_CONTEXT;
+          (*CC->API.CopyTexImage2D)( CC, target, level, internalformat,
+                              x, y, width, height, border );
+}
+
+
+void APIENTRY _mesa_CopyTexSubImage1D( GLenum target, GLint level,
+                                   GLint xoffset, GLint x, GLint y,
+                                   GLsizei width )
+{
+   GET_CONTEXT;
+          (*CC->API.CopyTexSubImage1D)( CC, target, level, xoffset, x, y, 
width );
+}
+
+
+void APIENTRY _mesa_CopyTexSubImage2D( GLenum target, GLint level,
+                                   GLint xoffset, GLint yoffset,
+                                   GLint x, GLint y,
+                                   GLsizei width, GLsizei height )
+{
+   GET_CONTEXT;
+          (*CC->API.CopyTexSubImage2D)( CC, target, level, xoffset, yoffset,
+                                 x, y, width, height );
+}
+
+
+
+void APIENTRY _mesa_CullFace( GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.CullFace)(CC, mode);
+}
+
+
+void APIENTRY _mesa_DepthFunc( GLenum func )
+{
+   GET_CONTEXT;
+          (*CC->API.DepthFunc)( CC, func );
+}
+
+
+void APIENTRY _mesa_DepthMask( GLboolean flag )
+{
+   GET_CONTEXT;
+          (*CC->API.DepthMask)( CC, flag );
+}
+
+
+void APIENTRY _mesa_DepthRange( GLclampd near_val, GLclampd far_val )
+{
+   GET_CONTEXT;
+          (*CC->API.DepthRange)( CC, near_val, far_val );
+}
+
+
+void APIENTRY _mesa_DeleteLists( GLuint list, GLsizei range )
+{
+   GET_CONTEXT;
+          (*CC->API.DeleteLists)(CC, list, range);
+}
+
+
+void APIENTRY _mesa_DeleteTextures( GLsizei n, const GLuint *textures)
+{
+   GET_CONTEXT;
+          (*CC->API.DeleteTextures)(CC, n, textures);
+}
+
+
+void APIENTRY _mesa_Disable( GLenum cap )
+{
+   GET_CONTEXT;
+          (*CC->API.Disable)( CC, cap );
+}
+
+
+void APIENTRY _mesa_DisableClientState( GLenum cap )
+{
+   GET_CONTEXT;
+          (*CC->API.DisableClientState)( CC, cap );
+}
+
+
+void APIENTRY _mesa_DrawArrays( GLenum mode, GLint first, GLsizei count )
+{
+   GET_CONTEXT;
+          (*CC->API.DrawArrays)(CC, mode, first, count);
+}
+
+
+void APIENTRY _mesa_DrawBuffer( GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.DrawBuffer)(CC, mode);
+}
+
+
+void APIENTRY _mesa_DrawElements( GLenum mode, GLsizei count,
+                              GLenum type, const GLvoid *indices )
+{
+   GET_CONTEXT;
+          (*CC->API.DrawElements)( CC, mode, count, type, indices );
+}
+
+
+void APIENTRY _mesa_DrawPixels( GLsizei width, GLsizei height,
+                            GLenum format, GLenum type, const GLvoid *pixels )
+{
+   GET_CONTEXT;
+          (*CC->API.DrawPixels)( CC, width, height, format, type, pixels );
+}
+
+
+void APIENTRY _mesa_Enable( GLenum cap )
+{
+   GET_CONTEXT;
+          (*CC->API.Enable)( CC, cap );
+}
+
+
+void APIENTRY _mesa_EnableClientState( GLenum cap )
+{
+   GET_CONTEXT;
+          (*CC->API.EnableClientState)( CC, cap );
+}
+
+
+void APIENTRY _mesa_End( void )
+{
+   GET_CONTEXT;
+          (*CC->API.End)( CC );
+}
+
+
+void APIENTRY _mesa_EndList( void )
+{
+   GET_CONTEXT;
+          (*CC->API.EndList)(CC);
+}
+
+
+
+
+void APIENTRY _mesa_EvalCoord1d( GLdouble u )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalCoord1f)( CC, (GLfloat) u );
+}
+
+
+void APIENTRY _mesa_EvalCoord1f( GLfloat u )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalCoord1f)( CC, u );
+}
+
+
+void APIENTRY _mesa_EvalCoord1dv( const GLdouble *u )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalCoord1f)( CC, (GLfloat) *u );
+}
+
+
+void APIENTRY _mesa_EvalCoord1fv( const GLfloat *u )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalCoord1f)( CC, (GLfloat) *u );
+}
+
+
+void APIENTRY _mesa_EvalCoord2d( GLdouble u, GLdouble v )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalCoord2f)( CC, (GLfloat) u, (GLfloat) v );
+}
+
+
+void APIENTRY _mesa_EvalCoord2f( GLfloat u, GLfloat v )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalCoord2f)( CC, u, v );
+}
+
+
+void APIENTRY _mesa_EvalCoord2dv( const GLdouble *u )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalCoord2f)( CC, (GLfloat) u[0], (GLfloat) u[1] );
+}
+
+
+void APIENTRY _mesa_EvalCoord2fv( const GLfloat *u )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalCoord2f)( CC, u[0], u[1] );
+}
+
+
+void APIENTRY _mesa_EvalPoint1( GLint i )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalPoint1)( CC, i );
+}
+
+
+void APIENTRY _mesa_EvalPoint2( GLint i, GLint j )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalPoint2)( CC, i, j );
+}
+
+
+void APIENTRY _mesa_EvalMesh1( GLenum mode, GLint i1, GLint i2 )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalMesh1)( CC, mode, i1, i2 );
+}
+
+
+void APIENTRY _mesa_EdgeFlag( GLboolean flag )
+{
+   GET_CONTEXT;
+          (*CC->API.EdgeFlag)(CC, flag);
+}
+
+
+void APIENTRY _mesa_EdgeFlagv( const GLboolean *flag )
+{
+   GET_CONTEXT;
+          (*CC->API.EdgeFlag)(CC, *flag);
+}
+
+
+void APIENTRY _mesa_EdgeFlagPointer( GLsizei stride, const GLboolean *ptr )
+{
+   GET_CONTEXT;
+          (*CC->API.EdgeFlagPointer)(CC, stride, ptr);
+}
+
+
+void APIENTRY _mesa_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, 
GLint j2 )
+{
+   GET_CONTEXT;
+          (*CC->API.EvalMesh2)( CC, mode, i1, i2, j1, j2 );
+}
+
+
+void APIENTRY _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer 
)
+{
+   GET_CONTEXT;
+          (*CC->API.FeedbackBuffer)(CC, size, type, buffer);
+}
+
+
+void APIENTRY _mesa_Finish( void )
+{
+   GET_CONTEXT;
+          (*CC->API.Finish)(CC);
+}
+
+
+void APIENTRY _mesa_Flush( void )
+{
+   GET_CONTEXT;
+          (*CC->API.Flush)(CC);
+}
+
+
+void APIENTRY _mesa_Fogf( GLenum pname, GLfloat param )
+{
+   GET_CONTEXT;
+          (*CC->API.Fogfv)(CC, pname, &param);
+}
+
+
+void APIENTRY _mesa_Fogi( GLenum pname, GLint param )
+{
+   GLfloat fparam = (GLfloat) param;
+   GET_CONTEXT;
+          (*CC->API.Fogfv)(CC, pname, &fparam);
+}
+
+
+void APIENTRY _mesa_Fogfv( GLenum pname, const GLfloat *params )
+{
+   GET_CONTEXT;
+          (*CC->API.Fogfv)(CC, pname, params);
+}
+
+
+void APIENTRY _mesa_Fogiv( GLenum pname, const GLint *params )
+{
+   GLfloat p[4];
+   GET_CONTEXT;
+
+   switch (pname) {
+      case GL_FOG_MODE:
+      case GL_FOG_DENSITY:
+      case GL_FOG_START:
+      case GL_FOG_END:
+      case GL_FOG_INDEX:
+     p[0] = (GLfloat) *params;
+     break;
+      case GL_FOG_COLOR:
+     p[0] = INT_TO_FLOAT( params[0] );
+     p[1] = INT_TO_FLOAT( params[1] );
+     p[2] = INT_TO_FLOAT( params[2] );
+     p[3] = INT_TO_FLOAT( params[3] );
+     break;
+      default:
+         /* Error will be caught later in gl_Fogfv */
+         ;
+   }
+   (*CC->API.Fogfv)( CC, pname, p );
+}
+
+
+
+void APIENTRY _mesa_FrontFace( GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.FrontFace)(CC, mode);
+}
+
+
+void APIENTRY _mesa_Frustum( GLdouble left, GLdouble right,
+                         GLdouble bottom, GLdouble top,
+                         GLdouble nearval, GLdouble farval )
+{
+   GET_CONTEXT;
+          (*CC->API.Frustum)(CC, left, right, bottom, top, nearval, farval);
+}
+
+
+GLuint APIENTRY _mesa_GenLists( GLsizei range )
+{
+   GET_CONTEXT;
+          return (*CC->API.GenLists)(CC, range);
+}
+
+
+void APIENTRY _mesa_GenTextures( GLsizei n, GLuint *textures )
+{
+   GET_CONTEXT;
+          (*CC->API.GenTextures)(CC, n, textures);
+}
+
+
+void APIENTRY _mesa_GetBooleanv( GLenum pname, GLboolean *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetBooleanv)(CC, pname, params);
+}
+
+
+void APIENTRY _mesa_GetClipPlane( GLenum plane, GLdouble *equation )
+{
+   GET_CONTEXT;
+          (*CC->API.GetClipPlane)(CC, plane, equation);
+}
+
+void APIENTRY _mesa_GetDoublev( GLenum pname, GLdouble *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetDoublev)(CC, pname, params);
+}
+
+
+GLenum APIENTRY _mesa_GetError( void )
+{
+   GET_CONTEXT;
+   if (!CC) {
+      /* No current context */
+      return GL_NO_ERROR;
+   }
+   return (*CC->API.GetError)(CC);
+}
+
+
+void APIENTRY _mesa_GetFloatv( GLenum pname, GLfloat *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetFloatv)(CC, pname, params);
+}
+
+
+void APIENTRY _mesa_GetIntegerv( GLenum pname, GLint *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetIntegerv)(CC, pname, params);
+}
+
+
+void APIENTRY _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetLightfv)(CC, light, pname, params);
+}
+
+
+void APIENTRY _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetLightiv)(CC, light, pname, params);
+}
+
+
+void APIENTRY _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v )
+{
+   GET_CONTEXT;
+          (*CC->API.GetMapdv)( CC, target, query, v );
+}
+
+
+void APIENTRY _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v )
+{
+   GET_CONTEXT;
+          (*CC->API.GetMapfv)( CC, target, query, v );
+}
+
+
+void APIENTRY _mesa_GetMapiv( GLenum target, GLenum query, GLint *v )
+{
+   GET_CONTEXT;
+          (*CC->API.GetMapiv)( CC, target, query, v );
+}
+
+
+void APIENTRY _mesa_GetMaterialfv( GLenum face, GLenum pname, GLfloat *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetMaterialfv)(CC, face, pname, params);
+}
+
+
+void APIENTRY _mesa_GetMaterialiv( GLenum face, GLenum pname, GLint *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetMaterialiv)(CC, face, pname, params);
+}
+
+
+void APIENTRY _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
+{
+   GET_CONTEXT;
+          (*CC->API.GetPixelMapfv)(CC, map, values);
+}
+
+
+void APIENTRY _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
+{
+   GET_CONTEXT;
+          (*CC->API.GetPixelMapuiv)(CC, map, values);
+}
+
+
+void APIENTRY _mesa_GetPixelMapusv( GLenum map, GLushort *values )
+{
+   GET_CONTEXT;
+          (*CC->API.GetPixelMapusv)(CC, map, values);
+}
+
+
+void APIENTRY _mesa_GetPointerv( GLenum pname, GLvoid **params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetPointerv)(CC, pname, params);
+}
+
+
+void APIENTRY _mesa_GetPolygonStipple( GLubyte *mask )
+{
+   GET_CONTEXT;
+          (*CC->API.GetPolygonStipple)(CC, mask);
+}
+
+
+const GLubyte * APIENTRY _mesa_GetString( GLenum name )
+{
+   GET_CONTEXT;
+          return (*CC->API.GetString)(CC, name);
+}
+
+
+
+void APIENTRY _mesa_GetTexEnvfv( GLenum target, GLenum pname, GLfloat *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexEnvfv)(CC, target, pname, params);
+}
+
+
+void APIENTRY _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexEnviv)(CC, target, pname, params);
+}
+
+
+void APIENTRY _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexGeniv)(CC, coord, pname, params);
+}
+
+
+void APIENTRY _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexGendv)(CC, coord, pname, params);
+}
+
+
+void APIENTRY _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexGenfv)(CC, coord, pname, params);
+}
+
+
+
+void APIENTRY _mesa_GetTexImage( GLenum target, GLint level, GLenum format,
+                             GLenum type, GLvoid *pixels )
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexImage)(CC, target, level, format, type, pixels);
+}
+
+
+void APIENTRY _mesa_GetTexLevelParameterfv( GLenum target, GLint level,
+                                        GLenum pname, GLfloat *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexLevelParameterfv)(CC, target, level, pname, params);
+}
+
+
+void APIENTRY _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
+                                        GLenum pname, GLint *params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexLevelParameteriv)(CC, target, level, pname, params);
+}
+
+
+
+
+void APIENTRY _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat 
*params)
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexParameterfv)(CC, target, pname, params);
+}
+
+
+void APIENTRY _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint 
*params )
+{
+   GET_CONTEXT;
+          (*CC->API.GetTexParameteriv)(CC, target, pname, params);
+}
+
+
+void APIENTRY _mesa_Hint( GLenum target, GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.Hint)(CC, target, mode);
+}
+
+
+void APIENTRY _mesa_Indexd( GLdouble c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexf)( CC, (GLfloat) c );
+}
+
+
+void APIENTRY _mesa_Indexf( GLfloat c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexf)( CC, c );
+}
+
+
+void APIENTRY _mesa_Indexi( GLint c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexi)( CC, c );
+}
+
+
+void APIENTRY _mesa_Indexs( GLshort c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexi)( CC, (GLint) c );
+}
+
+
+#ifdef GL_VERSION_1_1
+void APIENTRY _mesa_Indexub( GLubyte c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexi)( CC, (GLint) c );
+}
+#endif
+
+
+void APIENTRY _mesa_Indexdv( const GLdouble *c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexf)( CC, (GLfloat) *c );
+}
+
+
+void APIENTRY _mesa_Indexfv( const GLfloat *c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexf)( CC, *c );
+}
+
+
+void APIENTRY _mesa_Indexiv( const GLint *c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexi)( CC, *c );
+}
+
+
+void APIENTRY _mesa_Indexsv( const GLshort *c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexi)( CC, (GLint) *c );
+}
+
+
+#ifdef GL_VERSION_1_1
+void APIENTRY _mesa_Indexubv( const GLubyte *c )
+{
+   GET_CONTEXT;
+   (*CC->API.Indexi)( CC, (GLint) *c );
+}
+#endif
+
+
+void APIENTRY _mesa_IndexMask( GLuint mask )
+{
+   GET_CONTEXT;
+   (*CC->API.IndexMask)(CC, mask);
+}
+
+
+void APIENTRY _mesa_IndexPointer( GLenum type, GLsizei stride, const GLvoid 
*ptr )
+{
+   GET_CONTEXT;
+          (*CC->API.IndexPointer)(CC, type, stride, ptr);
+}
+
+
+void APIENTRY _mesa_InterleavedArrays( GLenum format, GLsizei stride,
+                                   const GLvoid *pointer )
+{
+   GET_CONTEXT;
+          (*CC->API.InterleavedArrays)( CC, format, stride, pointer );
+}
+
+
+void APIENTRY _mesa_InitNames( void )
+{
+   GET_CONTEXT;
+          (*CC->API.InitNames)(CC);
+}
+
+
+GLboolean APIENTRY _mesa_IsList( GLuint list )
+{
+   GET_CONTEXT;
+          return (*CC->API.IsList)(CC, list);
+}
+
+
+GLboolean APIENTRY _mesa_IsTexture( GLuint texture )
+{
+   GET_CONTEXT;
+          return (*CC->API.IsTexture)(CC, texture);
+}
+
+
+void APIENTRY _mesa_Lightf( GLenum light, GLenum pname, GLfloat param )
+{
+   GET_CONTEXT;
+          (*CC->API.Lightfv)( CC, light, pname, &param, 1 );
+}
+
+
+
+void APIENTRY _mesa_Lighti( GLenum light, GLenum pname, GLint param )
+{
+   GLfloat fparam = (GLfloat) param;
+   GET_CONTEXT;
+          (*CC->API.Lightfv)( CC, light, pname, &fparam, 1 );
+}
+
+
+
+void APIENTRY _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params 
)
+{
+   GET_CONTEXT;
+          (*CC->API.Lightfv)( CC, light, pname, params, 4 );
+}
+
+
+
+void APIENTRY _mesa_Lightiv( GLenum light, GLenum pname, const GLint *params )
+{
+   GLfloat fparam[4];
+   GET_CONTEXT;
+
+   switch (pname) {
+      case GL_AMBIENT:
+      case GL_DIFFUSE:
+      case GL_SPECULAR:
+         fparam[0] = INT_TO_FLOAT( params[0] );
+         fparam[1] = INT_TO_FLOAT( params[1] );
+         fparam[2] = INT_TO_FLOAT( params[2] );
+         fparam[3] = INT_TO_FLOAT( params[3] );
+         break;
+      case GL_POSITION:
+         fparam[0] = (GLfloat) params[0];
+         fparam[1] = (GLfloat) params[1];
+         fparam[2] = (GLfloat) params[2];
+         fparam[3] = (GLfloat) params[3];
+         break;
+      case GL_SPOT_DIRECTION:
+         fparam[0] = (GLfloat) params[0];
+         fparam[1] = (GLfloat) params[1];
+         fparam[2] = (GLfloat) params[2];
+         break;
+      case GL_SPOT_EXPONENT:
+      case GL_SPOT_CUTOFF:
+      case GL_CONSTANT_ATTENUATION:
+      case GL_LINEAR_ATTENUATION:
+      case GL_QUADRATIC_ATTENUATION:
+         fparam[0] = (GLfloat) params[0];
+         break;
+      default:
+         /* error will be caught later in gl_Lightfv */
+         ;
+   }
+   (*CC->API.Lightfv)( CC, light, pname, fparam, 4 );
+}
+
+
+
+void APIENTRY _mesa_LightModelf( GLenum pname, GLfloat param )
+{
+   GET_CONTEXT;
+          (*CC->API.LightModelfv)( CC, pname, &param );
+}
+
+
+void APIENTRY _mesa_LightModeli( GLenum pname, GLint param )
+{
+   GLfloat fparam[4];
+   GET_CONTEXT;
+          fparam[0] = (GLfloat) param;
+   (*CC->API.LightModelfv)( CC, pname, fparam );
+}
+
+
+void APIENTRY _mesa_LightModelfv( GLenum pname, const GLfloat *params )
+{
+   GET_CONTEXT;
+          (*CC->API.LightModelfv)( CC, pname, params );
+}
+
+
+void APIENTRY _mesa_LightModeliv( GLenum pname, const GLint *params )
+{
+   GLfloat fparam[4];
+   GET_CONTEXT;
+
+   switch (pname) {
+      case GL_LIGHT_MODEL_AMBIENT:
+         fparam[0] = INT_TO_FLOAT( params[0] );
+         fparam[1] = INT_TO_FLOAT( params[1] );
+         fparam[2] = INT_TO_FLOAT( params[2] );
+         fparam[3] = INT_TO_FLOAT( params[3] );
+         break;
+      case GL_LIGHT_MODEL_LOCAL_VIEWER:
+      case GL_LIGHT_MODEL_TWO_SIDE:
+         fparam[0] = (GLfloat) params[0];
+         break;
+      default:
+         /* Error will be caught later in gl_LightModelfv */
+         ;
+   }
+   (*CC->API.LightModelfv)( CC, pname, fparam );
+}
+
+
+void APIENTRY _mesa_LineWidth( GLfloat width )
+{
+   GET_CONTEXT;
+          (*CC->API.LineWidth)(CC, width);
+}
+
+
+void APIENTRY _mesa_LineStipple( GLint factor, GLushort pattern )
+{
+   GET_CONTEXT;
+          (*CC->API.LineStipple)(CC, factor, pattern);
+}
+
+
+void APIENTRY _mesa_ListBase( GLuint base )
+{
+   GET_CONTEXT;
+          (*CC->API.ListBase)(CC, base);
+}
+
+
+void APIENTRY _mesa_LoadIdentity( void )
+{
+   GET_CONTEXT;
+          (*CC->API.LoadIdentity)( CC );
+}
+
+
+void APIENTRY _mesa_LoadMatrixd( const GLdouble *m )
+{
+   GLfloat fm[16];
+   GLuint i;
+   GET_CONTEXT;
+
+   for (i=0;i<16;i++) {
+      fm[i] = (GLfloat) m[i];
+   }
+
+   (*CC->API.LoadMatrixf)( CC, fm );
+}
+
+
+void APIENTRY _mesa_LoadMatrixf( const GLfloat *m )
+{
+   GET_CONTEXT;
+          (*CC->API.LoadMatrixf)( CC, m );
+}
+
+
+void APIENTRY _mesa_LoadName( GLuint name )
+{
+   GET_CONTEXT;
+          (*CC->API.LoadName)(CC, name);
+}
+
+
+void APIENTRY _mesa_LogicOp( GLenum opcode )
+{
+   GET_CONTEXT;
+          (*CC->API.LogicOp)(CC, opcode);
+}
+
+
+
+void APIENTRY _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint 
stride,
+                       GLint order, const GLdouble *points )
+{
+   GLfloat *pnts;
+   GLboolean retain;
+   GET_CONTEXT;
+
+   pnts = gl_copy_map_points1d( target, stride, order, points );
+   retain = CC->CompileFlag;
+   (*CC->API.Map1f)( CC, target, u1, u2, stride, order, pnts, retain );
+}
+
+
+void APIENTRY _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride,
+                       GLint order, const GLfloat *points )
+{
+   GLfloat *pnts;
+   GLboolean retain;
+   GET_CONTEXT;
+
+   pnts = gl_copy_map_points1f( target, stride, order, points );
+   retain = CC->CompileFlag;
+   (*CC->API.Map1f)( CC, target, u1, u2, stride, order, pnts, retain );
+}
+
+
+void APIENTRY _mesa_Map2d( GLenum target,
+                       GLdouble u1, GLdouble u2, GLint ustride, GLint uorder,
+                       GLdouble v1, GLdouble v2, GLint vstride, GLint vorder,
+                       const GLdouble *points )
+{
+   GLfloat *pnts;
+   GLboolean retain;
+   GET_CONTEXT;
+
+   pnts = gl_copy_map_points2d( target, ustride, uorder,
+                                vstride, vorder, points );
+   retain = CC->CompileFlag;
+   (*CC->API.Map2f)( CC, target, u1, u2, ustride, uorder,
+                     v1, v2, vstride, vorder, pnts, retain );
+}
+
+
+void APIENTRY _mesa_Map2f( GLenum target,
+                       GLfloat u1, GLfloat u2, GLint ustride, GLint uorder,
+                       GLfloat v1, GLfloat v2, GLint vstride, GLint vorder,
+                       const GLfloat *points )
+{
+   GLfloat *pnts;
+   GLboolean retain;
+   GET_CONTEXT;
+
+   pnts = gl_copy_map_points2f( target, ustride, uorder,
+                                vstride, vorder, points );
+   retain = CC->CompileFlag;
+   (*CC->API.Map2f)( CC, target, u1, u2, ustride, uorder,
+                     v1, v2, vstride, vorder, pnts, retain );
+}
+
+
+void APIENTRY _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 )
+{
+   GET_CONTEXT;
+          (*CC->API.MapGrid1f)( CC, un, (GLfloat) u1, (GLfloat) u2 );
+}
+
+
+void APIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 )
+{
+   GET_CONTEXT;
+          (*CC->API.MapGrid1f)( CC, un, u1, u2 );
+}
+
+
+void APIENTRY _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2,
+                           GLint vn, GLdouble v1, GLdouble v2 )
+{
+   GET_CONTEXT;
+          (*CC->API.MapGrid2f)( CC, un, (GLfloat) u1, (GLfloat) u2,
+                         vn, (GLfloat) v1, (GLfloat) v2 );
+}
+
+
+void APIENTRY _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2,
+                           GLint vn, GLfloat v1, GLfloat v2 )
+{
+   GET_CONTEXT;
+          (*CC->API.MapGrid2f)( CC, un, u1, u2, vn, v1, v2 );
+}
+
+
+void APIENTRY _mesa_Materialf( GLenum face, GLenum pname, GLfloat param )
+{
+   GET_CONTEXT;
+          (*CC->API.Materialfv)( CC, face, pname, &param );
+}
+
+
+
+void APIENTRY _mesa_Materiali( GLenum face, GLenum pname, GLint param )
+{
+   GLfloat fparam[4];
+   GET_CONTEXT;
+          fparam[0] = (GLfloat) param;
+   (*CC->API.Materialfv)( CC, face, pname, fparam );
+}
+
+
+void APIENTRY _mesa_Materialfv( GLenum face, GLenum pname, const GLfloat 
*params )
+{
+   GET_CONTEXT;
+          (*CC->API.Materialfv)( CC, face, pname, params );
+}
+
+
+void APIENTRY _mesa_Materialiv( GLenum face, GLenum pname, const GLint *params 
)
+{
+   GLfloat fparam[4];
+   GET_CONTEXT;
+          switch (pname) {
+      case GL_AMBIENT:
+      case GL_DIFFUSE:
+      case GL_SPECULAR:
+      case GL_EMISSION:
+      case GL_AMBIENT_AND_DIFFUSE:
+         fparam[0] = INT_TO_FLOAT( params[0] );
+         fparam[1] = INT_TO_FLOAT( params[1] );
+         fparam[2] = INT_TO_FLOAT( params[2] );
+         fparam[3] = INT_TO_FLOAT( params[3] );
+         break;
+      case GL_SHININESS:
+         fparam[0] = (GLfloat) params[0];
+         break;
+      case GL_COLOR_INDEXES:
+         fparam[0] = (GLfloat) params[0];
+         fparam[1] = (GLfloat) params[1];
+         fparam[2] = (GLfloat) params[2];
+         break;
+      default:
+         /* Error will be caught later in gl_Materialfv */
+         ;
+   }
+   (*CC->API.Materialfv)( CC, face, pname, fparam );
+}
+
+
+void APIENTRY _mesa_MatrixMode( GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.MatrixMode)( CC, mode );
+}
+
+
+void APIENTRY _mesa_MultMatrixd( const GLdouble *m )
+{
+   GLfloat fm[16];
+   GLuint i;
+   GET_CONTEXT;
+
+   for (i=0;i<16;i++) {
+      fm[i] = (GLfloat) m[i];
+   }
+
+   (*CC->API.MultMatrixf)( CC, fm );
+}
+
+
+void APIENTRY _mesa_MultMatrixf( const GLfloat *m )
+{
+   GET_CONTEXT;
+          (*CC->API.MultMatrixf)( CC, m );
+}
+
+
+void APIENTRY _mesa_NewList( GLuint list, GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.NewList)(CC, list, mode);
+}
+
+void APIENTRY _mesa_Normal3b( GLbyte nx, GLbyte ny, GLbyte nz )
+{
+   GET_CONTEXT;
+   (*CC->API.Normal3f)( CC, BYTE_TO_FLOAT(nx),
+                        BYTE_TO_FLOAT(ny), BYTE_TO_FLOAT(nz) );
+}
+
+
+void APIENTRY _mesa_Normal3d( GLdouble nx, GLdouble ny, GLdouble nz )
+{
+   GLfloat fx, fy, fz;
+   GET_CONTEXT;
+   if (ABSD(nx)<0.00001)   fx = 0.0F;   else  fx = nx;
+   if (ABSD(ny)<0.00001)   fy = 0.0F;   else  fy = ny;
+   if (ABSD(nz)<0.00001)   fz = 0.0F;   else  fz = nz;
+   (*CC->API.Normal3f)( CC, fx, fy, fz );
+}
+
+
+void APIENTRY _mesa_Normal3f( GLfloat nx, GLfloat ny, GLfloat nz )
+{
+   GET_CONTEXT;
+#ifdef SHORTCUT
+   if (CC->CompileFlag) {
+      (*CC->Save.Normal3f)( CC, nx, ny, nz );
+   }
+   else {
+      /* Execute */
+      CC->Current.Normal[0] = nx;
+      CC->Current.Normal[1] = ny;
+      CC->Current.Normal[2] = nz;
+      CC->VB->MonoNormal = GL_FALSE;
+   }
+#else
+   (*CC->API.Normal3f)( CC, nx, ny, nz );
+#endif
+}
+
+
+void APIENTRY _mesa_Normal3i( GLint nx, GLint ny, GLint nz )
+{
+   GET_CONTEXT;
+   (*CC->API.Normal3f)( CC, INT_TO_FLOAT(nx),
+                        INT_TO_FLOAT(ny), INT_TO_FLOAT(nz) );
+}
+
+
+void APIENTRY _mesa_Normal3s( GLshort nx, GLshort ny, GLshort nz )
+{
+   GET_CONTEXT;
+   (*CC->API.Normal3f)( CC, SHORT_TO_FLOAT(nx),
+                        SHORT_TO_FLOAT(ny), SHORT_TO_FLOAT(nz) );
+}
+
+
+void APIENTRY _mesa_Normal3bv( const GLbyte *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Normal3f)( CC, BYTE_TO_FLOAT(v[0]),
+                        BYTE_TO_FLOAT(v[1]), BYTE_TO_FLOAT(v[2]) );
+}
+
+
+void APIENTRY _mesa_Normal3dv( const GLdouble *v )
+{
+   GLfloat fx, fy, fz;
+   GET_CONTEXT;
+   if (ABSD(v[0])<0.00001)   fx = 0.0F;   else  fx = v[0];
+   if (ABSD(v[1])<0.00001)   fy = 0.0F;   else  fy = v[1];
+   if (ABSD(v[2])<0.00001)   fz = 0.0F;   else  fz = v[2];
+   (*CC->API.Normal3f)( CC, fx, fy, fz );
+}
+
+
+void APIENTRY _mesa_Normal3fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+#ifdef SHORTCUT
+   if (CC->CompileFlag) {
+      (*CC->Save.Normal3fv)( CC, v );
+   }
+   else {
+      /* Execute */
+      GLfloat *n = CC->Current.Normal;
+      n[0] = v[0];
+      n[1] = v[1];
+      n[2] = v[2];
+      CC->VB->MonoNormal = GL_FALSE;
+   }
+#else
+   (*CC->API.Normal3fv)( CC, v );
+#endif
+}
+
+
+void APIENTRY _mesa_Normal3iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Normal3f)( CC, INT_TO_FLOAT(v[0]),
+                        INT_TO_FLOAT(v[1]), INT_TO_FLOAT(v[2]) );
+}
+
+
+void APIENTRY _mesa_Normal3sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Normal3f)( CC, SHORT_TO_FLOAT(v[0]),
+                        SHORT_TO_FLOAT(v[1]), SHORT_TO_FLOAT(v[2]) );
+}
+
+
+void APIENTRY _mesa_NormalPointer( GLenum type, GLsizei stride, const GLvoid 
*ptr )
+{
+   GET_CONTEXT;
+          (*CC->API.NormalPointer)(CC, type, stride, ptr);
+}
+void APIENTRY _mesa_Ortho( GLdouble left, GLdouble right,
+                       GLdouble bottom, GLdouble top,
+                       GLdouble nearval, GLdouble farval )
+{
+   GET_CONTEXT;
+          (*CC->API.Ortho)(CC, left, right, bottom, top, nearval, farval);
+}
+
+
+void APIENTRY _mesa_PassThrough( GLfloat token )
+{
+   GET_CONTEXT;
+          (*CC->API.PassThrough)(CC, token);
+}
+
+
+void APIENTRY _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat 
*values )
+{
+   GET_CONTEXT;
+          (*CC->API.PixelMapfv)( CC, map, mapsize, values );
+}
+
+
+void APIENTRY _mesa_PixelMapuiv( GLenum map, GLint mapsize, const GLuint 
*values )
+{
+   GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
+   GLuint i;
+   GET_CONTEXT;
+
+   if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
+      for (i=0;i<mapsize;i++) {
+         fvalues[i] = (GLfloat) values[i];
+      }
+   }
+   else {
+      for (i=0;i<mapsize;i++) {
+         fvalues[i] = UINT_TO_FLOAT( values[i] );
+      }
+   }
+   (*CC->API.PixelMapfv)( CC, map, mapsize, fvalues );
+}
+
+
+
+void APIENTRY _mesa_PixelMapusv( GLenum map, GLint mapsize, const GLushort 
*values )
+{
+   GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
+   GLuint i;
+   GET_CONTEXT;
+
+   if (map==GL_PIXEL_MAP_I_TO_I || map==GL_PIXEL_MAP_S_TO_S) {
+      for (i=0;i<mapsize;i++) {
+         fvalues[i] = (GLfloat) values[i];
+      }
+   }
+   else {
+      for (i=0;i<mapsize;i++) {
+         fvalues[i] = USHORT_TO_FLOAT( values[i] );
+      }
+   }
+   (*CC->API.PixelMapfv)( CC, map, mapsize, fvalues );
+}
+
+
+void APIENTRY _mesa_PixelStoref( GLenum pname, GLfloat param )
+{
+   GET_CONTEXT;
+          (*CC->API.PixelStorei)( CC, pname, (GLint) param );
+}
+
+
+void APIENTRY _mesa_PixelStorei( GLenum pname, GLint param )
+{
+   GET_CONTEXT;
+          (*CC->API.PixelStorei)( CC, pname, param );
+}
+
+
+void APIENTRY _mesa_PixelTransferf( GLenum pname, GLfloat param )
+{
+   GET_CONTEXT;
+          (*CC->API.PixelTransferf)(CC, pname, param);
+}
+
+
+void APIENTRY _mesa_PixelTransferi( GLenum pname, GLint param )
+{
+   GET_CONTEXT;
+          (*CC->API.PixelTransferf)(CC, pname, (GLfloat) param);
+}
+
+
+void APIENTRY _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
+{
+   GET_CONTEXT;
+          (*CC->API.PixelZoom)(CC, xfactor, yfactor);
+}
+
+
+void APIENTRY _mesa_PointSize( GLfloat size )
+{
+   GET_CONTEXT;
+          (*CC->API.PointSize)(CC, size);
+}
+
+
+void APIENTRY _mesa_PolygonMode( GLenum face, GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.PolygonMode)(CC, face, mode);
+}
+
+
+void APIENTRY _mesa_PolygonOffset( GLfloat factor, GLfloat units )
+{
+   GET_CONTEXT;
+          (*CC->API.PolygonOffset)( CC, factor, units );
+}
+
+void APIENTRY _mesa_PolygonStipple( const GLubyte *mask )
+{
+   GET_CONTEXT;
+          (*CC->API.PolygonStipple)(CC, mask);
+}
+
+
+void APIENTRY _mesa_PopAttrib( void )
+{
+   GET_CONTEXT;
+          (*CC->API.PopAttrib)(CC);
+}
+
+
+void APIENTRY _mesa_PopClientAttrib( void )
+{
+   GET_CONTEXT;
+          (*CC->API.PopClientAttrib)(CC);
+}
+
+
+void APIENTRY _mesa_PopMatrix( void )
+{
+   GET_CONTEXT;
+          (*CC->API.PopMatrix)( CC );
+}
+
+
+void APIENTRY _mesa_PopName( void )
+{
+   GET_CONTEXT;
+          (*CC->API.PopName)(CC);
+}
+
+
+void APIENTRY _mesa_PrioritizeTextures( GLsizei n, const GLuint *textures,
+                                    const GLclampf *priorities )
+{
+   GET_CONTEXT;
+          (*CC->API.PrioritizeTextures)(CC, n, textures, priorities);
+}
+
+
+void APIENTRY _mesa_PushMatrix( void )
+{
+   GET_CONTEXT;
+          (*CC->API.PushMatrix)( CC );
+}
+
+
+void APIENTRY _mesa_RasterPos2d( GLdouble x, GLdouble y )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y, 0.0F, 1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos2f( GLfloat x, GLfloat y )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y, 0.0F, 1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos2i( GLint x, GLint y )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y, 0.0F, 1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos2s( GLshort x, GLshort y )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y, 0.0F, 1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos3d( GLdouble x, GLdouble y, GLdouble z )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y, (GLfloat) z, 
1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos3f( GLfloat x, GLfloat y, GLfloat z )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y, (GLfloat) z, 
1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos3i( GLint x, GLint y, GLint z )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y, (GLfloat) z, 
1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos3s( GLshort x, GLshort y, GLshort z )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y, (GLfloat) z, 
1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos4d( GLdouble x, GLdouble y, GLdouble z, GLdouble 
w )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y,
+                               (GLfloat) z, (GLfloat) w );
+}
+
+
+void APIENTRY _mesa_RasterPos4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, x, y, z, w );
+}
+
+
+void APIENTRY _mesa_RasterPos4i( GLint x, GLint y, GLint z, GLint w )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y,
+                           (GLfloat) z, (GLfloat) w );
+}
+
+
+void APIENTRY _mesa_RasterPos4s( GLshort x, GLshort y, GLshort z, GLshort w )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) x, (GLfloat) y,
+                           (GLfloat) z, (GLfloat) w );
+}
+
+
+void APIENTRY _mesa_RasterPos2dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 
1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos2fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 
1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos2iv( const GLint *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 
1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos2sv( const GLshort *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1], 0.0F, 
1.0F );
+}
+
+
+/*** 3 element vector ***/
+
+void APIENTRY _mesa_RasterPos3dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                           (GLfloat) v[2], 1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos3fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                               (GLfloat) v[2], 1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos3iv( const GLint *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                           (GLfloat) v[2], 1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos3sv( const GLshort *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                           (GLfloat) v[2], 1.0F );
+}
+
+
+void APIENTRY _mesa_RasterPos4dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                           (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+void APIENTRY _mesa_RasterPos4fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, v[0], v[1], v[2], v[3] );
+}
+
+
+void APIENTRY _mesa_RasterPos4iv( const GLint *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                           (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+void APIENTRY _mesa_RasterPos4sv( const GLshort *v )
+{
+   GET_CONTEXT;
+          (*CC->API.RasterPos4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                           (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+void APIENTRY _mesa_ReadBuffer( GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.ReadBuffer)( CC, mode );
+}
+
+
+void APIENTRY _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei 
height,
+           GLenum format, GLenum type, GLvoid *pixels )
+{
+   GET_CONTEXT;
+          (*CC->API.ReadPixels)( CC, x, y, width, height, format, type, pixels 
);
+}
+
+
+void APIENTRY _mesa_Rectd( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 )
+{
+   GET_CONTEXT;
+          (*CC->API.Rectf)( CC, (GLfloat) x1, (GLfloat) y1,
+                     (GLfloat) x2, (GLfloat) y2 );
+}
+
+
+void APIENTRY _mesa_Rectf( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 )
+{
+   GET_CONTEXT;
+          (*CC->API.Rectf)( CC, x1, y1, x2, y2 );
+}
+
+
+void APIENTRY _mesa_Recti( GLint x1, GLint y1, GLint x2, GLint y2 )
+{
+   GET_CONTEXT;
+          (*CC->API.Rectf)( CC, (GLfloat) x1, (GLfloat) y1,
+                         (GLfloat) x2, (GLfloat) y2 );
+}
+
+
+void APIENTRY _mesa_Rects( GLshort x1, GLshort y1, GLshort x2, GLshort y2 )
+{
+   GET_CONTEXT;
+          (*CC->API.Rectf)( CC, (GLfloat) x1, (GLfloat) y1,
+                     (GLfloat) x2, (GLfloat) y2 );
+}
+
+
+void APIENTRY _mesa_Rectdv( const GLdouble *v1, const GLdouble *v2 )
+{
+   GET_CONTEXT;
+          (*CC->API.Rectf)(CC, (GLfloat) v1[0], (GLfloat) v1[1],
+                    (GLfloat) v2[0], (GLfloat) v2[1]);
+}
+
+
+void APIENTRY _mesa_Rectfv( const GLfloat *v1, const GLfloat *v2 )
+{
+   GET_CONTEXT;
+          (*CC->API.Rectf)(CC, v1[0], v1[1], v2[0], v2[1]);
+}
+
+
+void APIENTRY _mesa_Rectiv( const GLint *v1, const GLint *v2 )
+{
+   GET_CONTEXT;
+          (*CC->API.Rectf)( CC, (GLfloat) v1[0], (GLfloat) v1[1],
+                     (GLfloat) v2[0], (GLfloat) v2[1] );
+}
+
+
+void APIENTRY _mesa_Rectsv( const GLshort *v1, const GLshort *v2 )
+{
+   GET_CONTEXT;
+          (*CC->API.Rectf)(CC, (GLfloat) v1[0], (GLfloat) v1[1],
+        (GLfloat) v2[0], (GLfloat) v2[1]);
+}
+
+
+void APIENTRY _mesa_Scissor( GLint x, GLint y, GLsizei width, GLsizei height)
+{
+   GET_CONTEXT;
+          (*CC->API.Scissor)(CC, x, y, width, height);
+}
+
+
+GLboolean APIENTRY _mesa_IsEnabled( GLenum cap )
+{
+   GET_CONTEXT;
+          return (*CC->API.IsEnabled)( CC, cap );
+}
+
+
+
+void APIENTRY _mesa_PushAttrib( GLbitfield mask )
+{
+   GET_CONTEXT;
+          (*CC->API.PushAttrib)(CC, mask);
+}
+
+
+void APIENTRY _mesa_PushClientAttrib( GLbitfield mask )
+{
+   GET_CONTEXT;
+          (*CC->API.PushClientAttrib)(CC, mask);
+}
+
+
+void APIENTRY _mesa_PushName( GLuint name )
+{
+   GET_CONTEXT;
+          (*CC->API.PushName)(CC, name);
+}
+
+
+GLint APIENTRY _mesa_RenderMode( GLenum mode )
+{
+   GET_CONTEXT;
+          return (*CC->API.RenderMode)(CC, mode);
+}
+
+
+void APIENTRY _mesa_Rotated( GLdouble angle, GLdouble x, GLdouble y, GLdouble 
z )
+{
+   GET_CONTEXT;
+          (*CC->API.Rotatef)( CC, (GLfloat) angle,
+                       (GLfloat) x, (GLfloat) y, (GLfloat) z );
+}
+
+
+void APIENTRY _mesa_Rotatef( GLfloat angle, GLfloat x, GLfloat y, GLfloat z )
+{
+   GET_CONTEXT;
+          (*CC->API.Rotatef)( CC, angle, x, y, z );
+}
+
+
+void APIENTRY _mesa_SelectBuffer( GLsizei size, GLuint *buffer )
+{
+   GET_CONTEXT;
+          (*CC->API.SelectBuffer)(CC, size, buffer);
+}
+
+
+void APIENTRY _mesa_Scaled( GLdouble x, GLdouble y, GLdouble z )
+{
+   GET_CONTEXT;
+          (*CC->API.Scalef)( CC, (GLfloat) x, (GLfloat) y, (GLfloat) z );
+}
+
+
+void APIENTRY _mesa_Scalef( GLfloat x, GLfloat y, GLfloat z )
+{
+   GET_CONTEXT;
+          (*CC->API.Scalef)( CC, x, y, z );
+}
+
+
+void APIENTRY _mesa_ShadeModel( GLenum mode )
+{
+   GET_CONTEXT;
+          (*CC->API.ShadeModel)(CC, mode);
+}
+
+
+void APIENTRY _mesa_StencilFunc( GLenum func, GLint ref, GLuint mask )
+{
+   GET_CONTEXT;
+          (*CC->API.StencilFunc)(CC, func, ref, mask);
+}
+
+
+void APIENTRY _mesa_StencilMask( GLuint mask )
+{
+   GET_CONTEXT;
+          (*CC->API.StencilMask)(CC, mask);
+}
+
+
+void APIENTRY _mesa_StencilOp( GLenum fail, GLenum zfail, GLenum zpass )
+{
+   GET_CONTEXT;
+          (*CC->API.StencilOp)(CC, fail, zfail, zpass);
+}
+
+
+void APIENTRY _mesa_TexCoord1d( GLdouble s )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) s, 0.0, 0.0, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord1f( GLfloat s )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, s, 0.0, 0.0, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord1i( GLint s )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) s, 0.0, 0.0, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord1s( GLshort s )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) s, 0.0, 0.0, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord2d( GLdouble s, GLdouble t )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord2f)( CC, (GLfloat) s, (GLfloat) t );
+}
+
+
+void APIENTRY _mesa_TexCoord2f( GLfloat s, GLfloat t )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord2f)( CC, s, t );
+}
+
+
+void APIENTRY _mesa_TexCoord2i( GLint s, GLint t )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord2f)( CC, (GLfloat) s, (GLfloat) t );
+}
+
+
+void APIENTRY _mesa_TexCoord2s( GLshort s, GLshort t )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord2f)( CC, (GLfloat) s, (GLfloat) t );
+}
+
+
+void APIENTRY _mesa_TexCoord3d( GLdouble s, GLdouble t, GLdouble r )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) s, (GLfloat) t, (GLfloat) r, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord3f( GLfloat s, GLfloat t, GLfloat r )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, s, t, r, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord3i( GLint s, GLint t, GLint r )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) s, (GLfloat) t,
+                               (GLfloat) r, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord3s( GLshort s, GLshort t, GLshort r )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) s, (GLfloat) t,
+                               (GLfloat) r, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord4d( GLdouble s, GLdouble t, GLdouble r, GLdouble q 
)
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) s, (GLfloat) t,
+                               (GLfloat) r, (GLfloat) q );
+}
+
+
+void APIENTRY _mesa_TexCoord4f( GLfloat s, GLfloat t, GLfloat r, GLfloat q )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, s, t, r, q );
+}
+
+
+void APIENTRY _mesa_TexCoord4i( GLint s, GLint t, GLint r, GLint q )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) s, (GLfloat) t,
+                               (GLfloat) r, (GLfloat) q );
+}
+
+
+void APIENTRY _mesa_TexCoord4s( GLshort s, GLshort t, GLshort r, GLshort q )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) s, (GLfloat) t,
+                               (GLfloat) r, (GLfloat) q );
+}
+
+
+void APIENTRY _mesa_TexCoord1dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) *v, 0.0, 0.0, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord1fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, *v, 0.0, 0.0, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord1iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, *v, 0.0, 0.0, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord1sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) *v, 0.0, 0.0, 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord2dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord2f)( CC, (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+
+void APIENTRY _mesa_TexCoord2fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord2f)( CC, v[0], v[1] );
+}
+
+
+void APIENTRY _mesa_TexCoord2iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord2f)( CC, (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+
+void APIENTRY _mesa_TexCoord2sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord2f)( CC, (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+
+void APIENTRY _mesa_TexCoord3dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                               (GLfloat) v[2], 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord3fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, v[0], v[1], v[2], 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord3iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                          (GLfloat) v[2], 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord3sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                               (GLfloat) v[2], 1.0 );
+}
+
+
+void APIENTRY _mesa_TexCoord4dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                               (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+void APIENTRY _mesa_TexCoord4fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, v[0], v[1], v[2], v[3] );
+}
+
+
+void APIENTRY _mesa_TexCoord4iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                               (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+void APIENTRY _mesa_TexCoord4sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.TexCoord4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                               (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+void APIENTRY _mesa_TexCoordPointer( GLint size, GLenum type, GLsizei stride,
+                        const GLvoid *ptr )
+{
+   GET_CONTEXT;
+          (*CC->API.TexCoordPointer)(CC, size, type, stride, ptr);
+}
+
+
+void APIENTRY _mesa_TexGend( GLenum coord, GLenum pname, GLdouble param )
+{
+   GLfloat p = (GLfloat) param;
+   GET_CONTEXT;
+          (*CC->API.TexGenfv)( CC, coord, pname, &p );
+}
+
+
+void APIENTRY _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param )
+{
+   GET_CONTEXT;
+          (*CC->API.TexGenfv)( CC, coord, pname, &param );
+}
+
+
+void APIENTRY _mesa_TexGeni( GLenum coord, GLenum pname, GLint param )
+{
+   GLfloat p = (GLfloat) param;
+   GET_CONTEXT;
+          (*CC->API.TexGenfv)( CC, coord, pname, &p );
+}
+
+
+void APIENTRY _mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble 
*params )
+{
+   GLfloat p[4];
+   GET_CONTEXT;
+          p[0] = params[0];
+   p[1] = params[1];
+   p[2] = params[2];
+   p[3] = params[3];
+   (*CC->API.TexGenfv)( CC, coord, pname, p );
+}
+
+
+void APIENTRY _mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params )
+{
+   GLfloat p[4];
+   GET_CONTEXT;
+          p[0] = params[0];
+   p[1] = params[1];
+   p[2] = params[2];
+   p[3] = params[3];
+   (*CC->API.TexGenfv)( CC, coord, pname, p );
+}
+
+
+void APIENTRY _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat 
*params )
+{
+   GET_CONTEXT;
+          (*CC->API.TexGenfv)( CC, coord, pname, params );
+}
+
+
+
+
+void APIENTRY _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param )
+{
+   GET_CONTEXT;
+          (*CC->API.TexEnvfv)( CC, target, pname, &param );
+}
+
+
+
+void APIENTRY _mesa_TexEnvi( GLenum target, GLenum pname, GLint param )
+{
+   GLfloat p[4];
+   GET_CONTEXT;
+   p[0] = (GLfloat) param;
+   p[1] = p[2] = p[3] = 0.0;
+          (*CC->API.TexEnvfv)( CC, target, pname, p );
+}
+
+
+
+void APIENTRY _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat 
*param )
+{
+   GET_CONTEXT;
+          (*CC->API.TexEnvfv)( CC, target, pname, param );
+}
+
+
+
+void APIENTRY _mesa_TexEnviv( GLenum target, GLenum pname, const GLint *param )
+{
+   GLfloat p[4];
+   GET_CONTEXT;
+   p[0] = INT_TO_FLOAT( param[0] );
+   p[1] = INT_TO_FLOAT( param[1] );
+   p[2] = INT_TO_FLOAT( param[2] );
+   p[3] = INT_TO_FLOAT( param[3] );
+          (*CC->API.TexEnvfv)( CC, target, pname, p );
+}
+
+
+void APIENTRY _mesa_TexImage1D( GLenum target, GLint level, GLint 
internalformat,
+                            GLsizei width, GLint border,
+                            GLenum format, GLenum type, const GLvoid *pixels )
+{
+   struct gl_image *teximage;
+   GET_CONTEXT;
+          teximage = gl_unpack_image( CC, width, 1, format, type, pixels );
+   (*CC->API.TexImage1D)( CC, target, level, internalformat,
+                          width, border, format, type, teximage );
+}
+
+
+
+void APIENTRY _mesa_TexImage2D( GLenum target, GLint level, GLint 
internalformat,
+                            GLsizei width, GLsizei height, GLint border,
+                            GLenum format, GLenum type, const GLvoid *pixels )
+{
+  struct gl_image *teximage;
+
+  GET_CONTEXT;
+
+  teximage = gl_unpack_image( CC, width, height, format, type, pixels );
+  (*CC->API.TexImage2D)( CC, target, level, internalformat,
+             width, height, border, format, type, teximage );
+}
+
+
+void APIENTRY _mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param )
+{
+   GET_CONTEXT;
+          (*CC->API.TexParameterfv)( CC, target, pname, &param );
+}
+
+
+void APIENTRY _mesa_TexParameteri( GLenum target, GLenum pname, GLint param )
+{
+   GLfloat fparam[4];
+   GET_CONTEXT;
+   fparam[0] = (GLfloat) param;
+   fparam[1] = fparam[2] = fparam[3] = 0.0;
+          (*CC->API.TexParameterfv)( CC, target, pname, fparam );
+}
+
+
+void APIENTRY _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat 
*params )
+{
+   GET_CONTEXT;
+          (*CC->API.TexParameterfv)( CC, target, pname, params );
+}
+
+
+void APIENTRY _mesa_TexParameteriv( GLenum target, GLenum pname, const GLint 
*params )
+{
+   GLfloat p[4];
+   GET_CONTEXT;
+          if (pname==GL_TEXTURE_BORDER_COLOR) {
+      p[0] = INT_TO_FLOAT( params[0] );
+      p[1] = INT_TO_FLOAT( params[1] );
+      p[2] = INT_TO_FLOAT( params[2] );
+      p[3] = INT_TO_FLOAT( params[3] );
+   }
+   else {
+      p[0] = (GLfloat) params[0];
+      p[1] = (GLfloat) params[1];
+      p[2] = (GLfloat) params[2];
+      p[3] = (GLfloat) params[3];
+   }
+   (*CC->API.TexParameterfv)( CC, target, pname, p );
+}
+
+
+void APIENTRY _mesa_TexSubImage1D( GLenum target, GLint level, GLint xoffset,
+                               GLsizei width, GLenum format,
+                               GLenum type, const GLvoid *pixels )
+{
+   struct gl_image *image;
+   GET_CONTEXT;
+   image = gl_unpack_texsubimage( CC, width, 1, format, type, pixels );
+   (*CC->API.TexSubImage1D)( CC, target, level, xoffset, width,
+                             format, type, image );
+}
+
+
+void APIENTRY _mesa_TexSubImage2D( GLenum target, GLint level,
+                               GLint xoffset, GLint yoffset,
+                               GLsizei width, GLsizei height,
+                               GLenum format, GLenum type,
+                               const GLvoid *pixels )
+{
+   struct gl_image *image;
+   GET_CONTEXT;
+   image = gl_unpack_texsubimage( CC, width, height, format, type, pixels );
+   (*CC->API.TexSubImage2D)( CC, target, level, xoffset, yoffset,
+                             width, height, format, type, image );
+}
+
+
+void APIENTRY _mesa_Translated( GLdouble x, GLdouble y, GLdouble z )
+{
+   GET_CONTEXT;
+   (*CC->API.Translatef)( CC, (GLfloat) x, (GLfloat) y, (GLfloat) z );
+}
+
+
+void APIENTRY _mesa_Translatef( GLfloat x, GLfloat y, GLfloat z )
+{
+   GET_CONTEXT;
+   (*CC->API.Translatef)( CC, x, y, z );
+}
+
+
+void APIENTRY _mesa_Vertex2d( GLdouble x, GLdouble y )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex2f)( CC, (GLfloat) x, (GLfloat) y );
+}
+
+
+void APIENTRY _mesa_Vertex2f( GLfloat x, GLfloat y )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex2f)( CC, x, y );
+}
+
+
+void APIENTRY _mesa_Vertex2i( GLint x, GLint y )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex2f)( CC, (GLfloat) x, (GLfloat) y );
+}
+
+
+void APIENTRY _mesa_Vertex2s( GLshort x, GLshort y )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex2f)( CC, (GLfloat) x, (GLfloat) y );
+}
+
+
+void APIENTRY _mesa_Vertex3d( GLdouble x, GLdouble y, GLdouble z )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex3f)( CC, (GLfloat) x, (GLfloat) y, (GLfloat) z );
+}
+
+
+void APIENTRY _mesa_Vertex3f( GLfloat x, GLfloat y, GLfloat z )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex3f)( CC, x, y, z );
+}
+
+
+void APIENTRY _mesa_Vertex3i( GLint x, GLint y, GLint z )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex3f)( CC, (GLfloat) x, (GLfloat) y, (GLfloat) z );
+}
+
+
+void APIENTRY _mesa_Vertex3s( GLshort x, GLshort y, GLshort z )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex3f)( CC, (GLfloat) x, (GLfloat) y, (GLfloat) z );
+}
+
+
+void APIENTRY _mesa_Vertex4d( GLdouble x, GLdouble y, GLdouble z, GLdouble w )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex4f)( CC, (GLfloat) x, (GLfloat) y,
+                            (GLfloat) z, (GLfloat) w );
+}
+
+
+void APIENTRY _mesa_Vertex4f( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex4f)( CC, x, y, z, w );
+}
+
+
+void APIENTRY _mesa_Vertex4i( GLint x, GLint y, GLint z, GLint w )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex4f)( CC, (GLfloat) x, (GLfloat) y,
+                            (GLfloat) z, (GLfloat) w );
+}
+
+
+void APIENTRY _mesa_Vertex4s( GLshort x, GLshort y, GLshort z, GLshort w )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex4f)( CC, (GLfloat) x, (GLfloat) y,
+                            (GLfloat) z, (GLfloat) w );
+}
+
+
+void APIENTRY _mesa_Vertex2dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex2f)( CC, (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+
+void APIENTRY _mesa_Vertex2fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex2f)( CC, v[0], v[1] );
+}
+
+
+void APIENTRY _mesa_Vertex2iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex2f)( CC, (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+
+void APIENTRY _mesa_Vertex2sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex2f)( CC, (GLfloat) v[0], (GLfloat) v[1] );
+}
+
+
+void APIENTRY _mesa_Vertex3dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex3f)( CC, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+
+void APIENTRY _mesa_Vertex3fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex3fv)( CC, v );
+}
+
+
+void APIENTRY _mesa_Vertex3iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex3f)( CC, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+
+void APIENTRY _mesa_Vertex3sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex3f)( CC, (GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2] );
+}
+
+
+void APIENTRY _mesa_Vertex4dv( const GLdouble *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                            (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+void APIENTRY _mesa_Vertex4fv( const GLfloat *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex4f)( CC, v[0], v[1], v[2], v[3] );
+}
+
+
+void APIENTRY _mesa_Vertex4iv( const GLint *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                            (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+void APIENTRY _mesa_Vertex4sv( const GLshort *v )
+{
+   GET_CONTEXT;
+   (*CC->API.Vertex4f)( CC, (GLfloat) v[0], (GLfloat) v[1],
+                            (GLfloat) v[2], (GLfloat) v[3] );
+}
+
+
+void APIENTRY _mesa_VertexPointer( GLint size, GLenum type, GLsizei stride,
+                               const GLvoid *ptr )
+{
+   GET_CONTEXT;
+   (*CC->API.VertexPointer)(CC, size, type, stride, ptr);
+}
+
+
+void APIENTRY _mesa_Viewport( GLint x, GLint y, GLsizei width, GLsizei height )
+{
+   GET_CONTEXT;
+   (*CC->API.Viewport)( CC, x, y, width, height );
+}
+
+/* GL_EXT_paletted_texture */
+
+void APIENTRY _mesa_ColorTableEXT( GLenum target, GLenum internalFormat,
+                               GLsizei width, GLenum format, GLenum type,
+                               const GLvoid *table )
+{
+   struct gl_image *image;
+   GET_CONTEXT;
+   image = gl_unpack_image( CC, width, 1, format, type, table );
+   (*CC->API.ColorTable)( CC, target, internalFormat, image );
+   if (image->RefCount == 0)
+      gl_free_image(image);
+}
+
+
+void APIENTRY _mesa_ColorSubTableEXT( GLenum target, GLsizei start, GLsizei 
count,
+                                  GLenum format, GLenum type,
+                                  const GLvoid *data )
+{
+   struct gl_image *image;
+   GET_CONTEXT;
+   image = gl_unpack_image( CC, count, 1, format, type, data );
+   (*CC->API.ColorSubTable)( CC, target, start, image );
+   if (image->RefCount == 0)
+      gl_free_image(image);
+}
+
+void APIENTRY _mesa_GetColorTableEXT( GLenum target, GLenum format,
+                                  GLenum type, GLvoid *table )
+{
+   GET_CONTEXT;
+   (*CC->API.GetColorTable)(CC, target, format, type, table);
+}
+
+
+void APIENTRY _mesa_GetColorTableParameterivEXT( GLenum target, GLenum pname,
+                                             GLint *params )
+{
+   GET_CONTEXT;
+   (*CC->API.GetColorTableParameteriv)(CC, target, pname, params);
+}
+
+
+void APIENTRY _mesa_GetColorTableParameterfvEXT( GLenum target, GLenum pname,
+                                             GLfloat *params )
+{
+   GLint iparams;
+   _mesa_GetColorTableParameterivEXT( target, pname, &iparams );
+   *params = (GLfloat) iparams;
+}
+/* End GL_EXT_paletted_texture */
diff --git a/dll/opengl/mesa/api.h b/dll/opengl/mesa/api.h
new file mode 100644
index 0000000000..0d0064fa7c
--- /dev/null
+++ b/dll/opengl/mesa/api.h
@@ -0,0 +1,83 @@
+/* $Id: api.h,v 1.4 1998/02/04 00:38:24 brianp Exp $ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version:  2.4
+ * Copyright (C) 1995-1997  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.
+ */
+
+
+/*
+ * $Log: api.h,v $
+ * Revision 1.4  1998/02/04 00:38:24  brianp
+ * WIN32 patch from Oleg Letsinsky
+ *
+ * Revision 1.3  1998/02/04 00:13:35  brianp
+ * updated for Cygnus (Stephane Rehel)
+ *
+ * Revision 1.2  1997/11/25 03:20:09  brianp
+ * simple clean-ups for multi-threading (John Stone)
+ *
+ * Revision 1.1  1997/08/22 01:42:26  brianp
+ * Initial revision
+ *
+ */
+
+
+/*
+ * The original api.c file has been split into two files:  api1.c and api2.c
+ * because some compilers complained that api.c was too big.
+ *
+ * This header contains stuff only included by api1.c and api2.c
+ */
+
+
+#ifndef API_H
+#define API_H
+
+
+/*
+ * Single/multiple thread context selection.
+ */
+#ifdef THREADS
+
+/* Get the context associated with the calling thread */
+#define GET_CONTEXT    GLcontext *CC = gl_get_thread_context()
+
+#else
+
+/* CC is a global pointer for all threads in the address space */
+#define GET_CONTEXT
+
+#endif /* THREADS */
+
+
+/*
+ * An optimization in a few performance-critical functions.
+ */
+#define SHORTCUT
+
+
+/*
+ * Windows 95/NT DLL stuff.
+ */
+#if !defined(WIN32) && !defined(WINDOWS_NT) && !defined(__CYGWIN32__)
+#define APIENTRY
+#endif
+
+
+#endif
diff --git a/dll/opengl/mesa/asm-386.S b/dll/opengl/mesa/asm-386.S
new file mode 100644
index 0000000000..c4979b8616
--- /dev/null
+++ b/dll/opengl/mesa/asm-386.S
@@ -0,0 +1,1644 @@
+/* $Id: asm-386.S,v 1.8 1997/12/17 00:50:51 brianp Exp $ */
+
+/*
+ * asm-386.S - special (hopefully faster) transformation functions for x86
+ *
+ * by Josh Vanderhoof
+ *
+ * This file is in the public domain.
+ */
+
+/*
+ * $Log: asm-386.S,v $
+ * Revision 1.8  1997/12/17 00:50:51  brianp
+ * applied Josh's patch to fix texture coordinate transformation bugs
+ *
+ * Revision 1.7  1997/12/17 00:27:11  brianp
+ * applied Josh's patch to fix bfris
+ *
+ * Revision 1.6  1997/12/01 01:02:41  brianp
+ * added FreeBSD patches (Daniel J. O'Connor)
+ *
+ * Revision 1.5  1997/11/19 23:52:17  brianp
+ * added missing "cld" instruction in asm_transform_points4_identity()
+ *
+ * Revision 1.4  1997/11/11 02:22:41  brianp
+ * small change per Josh to ensure U/V pairing
+ *
+ * Revision 1.3  1997/11/07 03:37:24  brianp
+ * added missing line from Stephane Rehel
+ *
+ * Revision 1.2  1997/11/07 03:30:37  brianp
+ * added Josh's 11-5-97 patches
+ *
+ * Revision 1.1  1997/10/30 06:00:33  brianp
+ * Initial revision
+ */
+
+#include <asm.inc>
+
+#define S(x)    dword ptr [esi + 4*x]
+#define D(x)    dword ptr [edi + 4*x]
+#define M(x, y) dword ptr [edx + 16*x + 4*y]
+
+.code
+
+/*
+ * void asm_transform_points3_general( GLuint n, GLfloat d[][4],
+ *                                     GLfloat m[16], GLfloat s[][4] );
+ */
+PUBLIC _asm_transform_points3_general
+_asm_transform_points3_general:
+.align 4
+       push esi
+       push edi
+
+       mov ecx, [esp + 12]         /* ecx = n */
+       mov edi, [esp + 16]     /* edi = d */
+       mov edx, [esp + 20]     /* edx = m */
+       mov esi, [esp + 24]     /* esi = s */
+
+       test ecx, ecx
+       jz _asm_transform_points3_general_end
+
+.align 4
+_asm_transform_points3_general_loop:
+       fld S(0)
+       fmul M(0, 0)
+       fld S(0)
+       fmul M(0, 1)
+       fld S(0)
+       fmul M(0, 2)
+       fld S(0)
+       fmul M(0, 3)
+
+       fld S(1)
+       fmul M(1, 0)
+       fld S(1)
+       fmul M(1, 1)
+       fld S(1)
+       fmul M(1, 2)
+       fld S(1)
+       fmul M(1, 3)
+
+       /*
+        * The FPU stack should now look like this:
+        *
+        * st(7) = S(0) * M(0, 0)
+        * st(6) = S(0) * M(0, 1)
+        * st(5) = S(0) * M(0, 2)
+        * st(4) = S(0) * M(0, 3)
+        * st(3) = S(1) * M(1, 0)
+        * st(2) = S(1) * M(1, 1)
+        * st(1) = S(1) * M(1, 2)
+        * st(0) = S(1) * M(1, 3)
+        */
+
+       fxch st(3)              /* 3 1 2 0 4 5 6 7 */
+       faddp st(7), st         /* 1 2 0 4 5 6 7 */
+       fxch st(1)              /* 2 1 0 4 5 6 7 */
+       faddp st(5), st         /* 1 0 4 5 6 7 */
+       faddp st(3), st         /* 0 4 5 6 7 */
+       faddp st(1), st         /* 4 5 6 7 */
+
+       /*
+        * st(3) = S(0) * M(0, 0) + S(1) * M(1, 0)
+        * st(2) = S(0) * M(0, 1) + S(1) * M(1, 1)
+        * st(1) = S(0) * M(0, 2) + S(1) * M(1, 2)
+        * st(0) = S(0) * M(0, 3) + S(1) * M(1, 3)
+        */
+
+       fld S(2)
+       fmul M(2, 0)
+       fld S(2)
+       fmul M(2, 1)
+       fld S(2)
+       fmul M(2, 2)
+       fld S(2)
+       fmul M(2, 3)
+
+       /*
+        * st(7) = S(0) * M(0, 0) + S(1) * M(1, 0)
+        * st(6) = S(0) * M(0, 1) + S(1) * M(1, 1)
+        * st(5) = S(0) * M(0, 2) + S(1) * M(1, 2)
+        * st(4) = S(0) * M(0, 3) + S(1) * M(1, 3)
+        * st(3) = S(2) * M(2, 0)
+        * st(2) = S(2) * M(2, 1)
+        * st(1) = S(2) * M(2, 2)
+        * st(0) = S(2) * M(2, 3)
+        */
+
+       fxch st(3)          /* 3 1 2 0 4 5 6 7 */
+       faddp st(7), st         /* 1 2 0 4 5 6 7 */
+       fxch st(1)          /* 2 1 0 4 5 6 7 */
+       faddp st(5), st     /* 1 0 4 5 6 7 */
+       faddp st(3), st     /* 0 4 5 6 7 */
+       faddp st(1), st     /* 4 5 6 7 */
+
+       /*
+        * st(3) = S(0) * M(0, 0) + S(1) * M(1, 0) + S(2) * M(2, 0)
+        * st(2) = S(0) * M(0, 1) + S(1) * M(1, 1) + S(2) * M(2, 1)
+        * st(1) = S(0) * M(0, 2) + S(1) * M(1, 2) + S(2) * M(2, 2)
+        * st(0) = S(0) * M(0, 3) + S(1) * M(1, 3) + S(2) * M(2, 3)
+        */
+
+       fxch st(3)      /* 3 1 2 0 */
+       fadd M(3, 0)
+       fxch st(2)      /* 2 1 3 0 */
+       fadd M(3, 1)
+       fxch st(1)      /* 1 2 3 0 */
+       fadd M(3, 2)
+       fxch st(3)      /* 0 2 3 1 */
+       fadd M(3, 3)
+
+       /*
+        * st(3) = S(0) * M(0, 2) + S(1) * M(1, 2) + S(2) * M(2, 2) + M(3, 2)
+        * st(2) = S(0) * M(0, 0) + S(1) * M(1, 0) + S(2) * M(2, 0) + M(3, 0)
+        * st(1) = S(0) * M(0, 1) + S(1) * M(1, 1) + S(2) * M(2, 1) + M(3, 1)
+        * st(0) = S(0) * M(0, 3) + S(1) * M(1, 3) + S(2) * M(2, 3) + M(3, 3)
+        */
+
+       fxch st(3)      /* 3 1 2 0 */
+       fstp D(2)       /* 1 2 0 */
+       fxch st(1)      /* 2 1 0 */
+       fstp D(0)       /* 1 0 */
+       lea esi, S(4)
+       fstp D(1)       /* 0 */
+       dec ecx
+       fstp D(3)       /* */
+
+       lea edi, D(4)
+
+       jnz _asm_transform_points3_general_loop
+
+_asm_transform_points3_general_end:
+       pop edi
+       pop esi
+       ret
+
+
+/*
+ * void asm_transform_points3_identity( GLuint n, GLfloat d[][4],
+ *                                      GLfloat s[][4] );
+ */
+PUBLIC _asm_transform_points3_identity
+_asm_transform_points3_identity:
+.align 4
+       push esi
+       push edi
+       mov ecx, [esp + 12]     /* ecx = n */
+       mov edi, [esp + 16]     /* edi = d */
+       mov esi, [esp + 20]     /* esi = s */
+       push ebx
+       push ebp
+
+       test ecx, ecx
+       jz _asm_transform_points3_identity_end
+
+       mov ebp, HEX(3f800000)
+
+.align 4
+_asm_transform_points3_identity_loop:
+       mov eax, S(0)
+       mov edx, S(1)
+       mov ebx, S(2)
+       lea esi, S(4)
+       mov D(0), eax
+       mov D(1), edx
+       mov D(2), ebx
+       mov D(3), ebp
+       dec ecx
+       lea edi, D(4)
+       jnz _asm_transform_points3_identity_loop
+
+_asm_transform_points3_identity_end:
+       pop ebp
+       pop ebx
+       pop edi
+       pop esi
+       ret
+
+
+/*
+ * void asm_transform_points3_2d( GLuint n, GLfloat d[][4], GLfloat m[16],
+ *                                GLfloat s[][4] );
+ */
+PUBLIC _asm_transform_points3_2d
+_asm_transform_points3_2d:
+.align 4
+       push esi
+       push edi
+       mov ecx, [esp + 12]     /* ecx = n */
+       mov edi, [esp + 16]     /* edi = d */
+       mov edx, [esp + 20]     /* edx = m */
+       mov esi, [esp + 24]     /* esi = s */
+       push ebp
+
+       mov ebp, HEX(3f800000)
+
+       test cl, DEC(1)
+       jz _asm_transform_points3_2d_step
+
+       dec ecx
+
+       fld S(0)
+       fmul M(0, 0)
+       fld S(0)
+       fmul M(0, 1)
+       fld S(1)
+       fmul M(1, 0)
+       fld S(1)
+       fmul M(1, 1)
+
+       /*
+        * st(3) = S(0) * M(0, 0)
+        * st(2) = S(0) * M(0, 1)
+        * st(1) = S(1) * M(1, 0)
+        * st(0) = S(1) * M(1, 1)
+        */
+
+       fxch st(1)      /* 1 0 2 3 */
+       fadd M(3, 0)
+       fxch st(1)      /* 0 1 2 3 */
+       fadd M(3, 1)
+       fxch st(1)      /* 1 0 2 3 */
+       faddp st(3), st         /* 0 2 3 */
+       faddp st(1), st         /* 2 3 */
+       fstp D(1)       /* 3 */
+       fstp D(0)       /* */
+       mov eax, S(2)
+       lea esi, S(4)
+       mov D(3), ebp
+       mov D(2), eax
+       lea edi, D(4)
+
+_asm_transform_points3_2d_step:
+       test ecx, ecx
+       jz _asm_transform_points3_2d_end
+
+.align 4
+_asm_transform_points3_2d_loop:
+       fld S(0)
+       fmul M(0, 0)
+       fld S(0)
+       fmul M(0, 1)
+       fld S(4)
+       fmul M(0, 0)
+       fld S(4)
+       fmul M(0, 1)
+       fld S(1)
+       fmul M(1, 0)
+       fld S(1)
+       fmul M(1, 1)
+       fld S(5)
+       fmul M(1, 0)
+       fld S(5)
+       fmul M(1, 1)
+
+       /*
+        * st(7) = S(0) * M(0, 0)
+        * st(6) = S(0) * M(0, 1)
+        * st(5) = S(4) * M(0, 0)
+        * st(4) = S(4) * M(0, 1)
+        * st(3) = S(1) * M(1, 0)
+        * st(2) = S(1) * M(1, 1)
+        * st(1) = S(5) * M(1, 0)
+        * st(0) = S(5) * M(1, 1)
+        */
+
+       fxch st(7)      /* 7 1 2 3 4 5 6 0 */
+       fadd M(3, 0)
... 187598 lines suppressed ...

Reply via email to