OSDN Git Service

Merge branch 'radeon-rewrite' of git+ssh://agd5f@git.freedesktop.org/git/mesa/mesa...
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 10 Apr 2009 21:16:08 +0000 (17:16 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Fri, 10 Apr 2009 21:16:08 +0000 (17:16 -0400)
512 files changed:
SConstruct
bin/mklib
common.py
configure.ac
docs/MESA_texture_signed_rgba.spec [new file with mode: 0644]
docs/cell.html
docs/extensions.html
docs/relnotes-7.5.html
docs/shading.html
include/EGL/eglext.h
include/EGL/eglplatform.h
include/GL/glext.h
progs/fp/fp-tri.c
progs/fp/kil-pos.txt [moved from progs/fp/kill-pos.txt with 100% similarity]
progs/fp/kil-texcoord-sgt.txt [new file with mode: 0644]
progs/glsl/.gitignore
progs/glsl/Makefile
progs/glsl/linktest.c [new file with mode: 0644]
progs/tests/.gitignore
progs/tests/SConscript
progs/tests/texcompress2.c
progs/trivial/.gitignore
progs/trivial/Makefile
progs/trivial/SConscript
progs/trivial/clear-fbo-tex.c
progs/trivial/clear-fbo.c
progs/trivial/clear-random.c
progs/trivial/clear-repeat.c
progs/trivial/clear-scissor.c
progs/trivial/clear-undefined.c
progs/trivial/clear.c
progs/trivial/createwin.c
progs/trivial/dlist-dangling.c
progs/trivial/dlist-edgeflag-dangling.c
progs/trivial/dlist-edgeflag.c
progs/trivial/line-clip.c
progs/trivial/line-cull.c
progs/trivial/line-smooth.c
progs/trivial/line-stipple-wide.c
progs/trivial/line-userclip-clip.c
progs/trivial/line-userclip-nop-clip.c
progs/trivial/line-userclip-nop.c
progs/trivial/line-userclip.c
progs/trivial/line-wide.c
progs/trivial/line.c
progs/trivial/lineloop-clip.c
progs/trivial/lineloop.c
progs/trivial/linestrip-clip.c
progs/trivial/linestrip-flat-stipple.c
progs/trivial/linestrip-stipple-wide.c
progs/trivial/linestrip-stipple.c
progs/trivial/linestrip.c
progs/trivial/long-fixed-func.c
progs/trivial/point-clip.c
progs/trivial/point-param.c
progs/trivial/point-sprite.c
progs/trivial/point-wide-smooth.c
progs/trivial/point-wide.c
progs/trivial/point.c
progs/trivial/poly-flat-clip.c
progs/trivial/poly-flat-unfilled-clip.c
progs/trivial/poly-flat.c
progs/trivial/poly-unfilled.c
progs/trivial/poly.c
progs/trivial/quad-clip-all-vertices.c
progs/trivial/quad-clip-nearplane.c
progs/trivial/quad-clip.c
progs/trivial/quad-degenerate.c
progs/trivial/quad-flat.c
progs/trivial/quad-offset-factor.c
progs/trivial/quad-offset-unfilled.c
progs/trivial/quad-offset-units.c
progs/trivial/quad-tex-2d.c
progs/trivial/quad-tex-3d.c
progs/trivial/quad-tex-alpha.c
progs/trivial/quad-tex-pbo.c
progs/trivial/quad-tex-sub.c
progs/trivial/quad-unfilled-clip.c
progs/trivial/quad-unfilled-stipple.c
progs/trivial/quad-unfilled.c
progs/trivial/quad.c
progs/trivial/quads.c
progs/trivial/quadstrip-clip.c
progs/trivial/quadstrip-cont.c
progs/trivial/quadstrip-flat.c
progs/trivial/quadstrip.c
progs/trivial/readpixels.c
progs/trivial/tri-alpha-tex.c
progs/trivial/tri-alpha.c
progs/trivial/tri-blend-color.c
progs/trivial/tri-clear.c
progs/trivial/tri-clip.c
progs/trivial/tri-cull-both.c
progs/trivial/tri-cull.c
progs/trivial/tri-dlist.c
progs/trivial/tri-edgeflag.c
progs/trivial/tri-fbo.c
progs/trivial/tri-flat-clip.c
progs/trivial/tri-flat.c
progs/trivial/tri-fog.c
progs/trivial/tri-fp-const-imm.c
progs/trivial/tri-fp.c
progs/trivial/tri-lit.c
progs/trivial/tri-logicop-none.c
progs/trivial/tri-logicop-xor.c
progs/trivial/tri-mask-tri.c
progs/trivial/tri-multitex-vbo.c [new file with mode: 0644]
progs/trivial/tri-orig.c
progs/trivial/tri-query.c
progs/trivial/tri-repeat.c
progs/trivial/tri-scissor-tri.c
progs/trivial/tri-square.c
progs/trivial/tri-stipple.c
progs/trivial/tri-tex-3d.c
progs/trivial/tri-tex.c
progs/trivial/tri-tri.c
progs/trivial/tri-unfilled-clip.c
progs/trivial/tri-unfilled-edgeflag.c
progs/trivial/tri-unfilled-fog.c
progs/trivial/tri-unfilled-point.c
progs/trivial/tri-unfilled-smooth.c
progs/trivial/tri-unfilled-tri-lit.c
progs/trivial/tri-unfilled-tri.c
progs/trivial/tri-unfilled-userclip-stip.c
progs/trivial/tri-unfilled-userclip.c
progs/trivial/tri-unfilled.c
progs/trivial/tri-userclip.c
progs/trivial/tri-viewport.c
progs/trivial/tri-z-9.c
progs/trivial/tri-z-eq.c
progs/trivial/tri.c
progs/trivial/trifan-flat-clip.c
progs/trivial/trifan-flat-unfilled-clip.c
progs/trivial/trifan-flat.c
progs/trivial/trifan-unfilled.c
progs/trivial/trifan.c
progs/trivial/tristrip-clip.c
progs/trivial/tristrip-flat.c
progs/trivial/tristrip.c
progs/vp/psiz-imm.txt [new file with mode: 0644]
progs/vp/psiz-mul-clamp.txt [new file with mode: 0644]
progs/vp/psiz-param-clamp.txt [new file with mode: 0644]
progs/vpglsl/SConscript [new file with mode: 0644]
progs/xdemos/Makefile
scons/gallium.py
scons/generic.py
scons/python.py
scons/winsdk.py [new file with mode: 0644]
src/egl/drivers/dri/Makefile
src/egl/drivers/glx/Makefile
src/egl/drivers/xdri/Makefile
src/egl/main/eglconfigutil.c
src/gallium/auxiliary/draw/draw_pipe_aapoint.c
src/gallium/auxiliary/draw/draw_vertex.h
src/gallium/auxiliary/draw/draw_vs_exec.c
src/gallium/auxiliary/indices/SConscript
src/gallium/auxiliary/pipebuffer/pb_buffer.h
src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_mm.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_pool.c
src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c
src/gallium/auxiliary/rtasm/rtasm_execmem.c
src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt
src/gallium/auxiliary/tgsi/tgsi_exec.c
src/gallium/auxiliary/tgsi/tgsi_exec.h
src/gallium/auxiliary/tgsi/tgsi_info.c
src/gallium/auxiliary/tgsi/tgsi_info.h
src/gallium/auxiliary/tgsi/tgsi_text.c
src/gallium/auxiliary/translate/translate.c
src/gallium/auxiliary/util/Makefile
src/gallium/auxiliary/util/SConscript
src/gallium/auxiliary/util/u_clear.h [new file with mode: 0644]
src/gallium/auxiliary/util/u_debug.c
src/gallium/auxiliary/util/u_debug.h
src/gallium/auxiliary/util/u_debug_stack.c
src/gallium/auxiliary/util/u_debug_symbol.c [new file with mode: 0644]
src/gallium/auxiliary/util/u_debug_symbol.h [new file with mode: 0644]
src/gallium/auxiliary/util/u_double_list.h
src/gallium/auxiliary/util/u_math.h
src/gallium/auxiliary/util/u_pack_color.h
src/gallium/auxiliary/util/u_stream_stdc.c
src/gallium/auxiliary/util/u_string.h
src/gallium/auxiliary/util/u_tile.c
src/gallium/auxiliary/util/u_time.c
src/gallium/auxiliary/util/u_time.h
src/gallium/drivers/cell/ppu/cell_clear.c
src/gallium/drivers/cell/ppu/cell_clear.h
src/gallium/drivers/cell/ppu/cell_context.c
src/gallium/drivers/i915simple/i915_clear.c
src/gallium/drivers/i915simple/i915_context.h
src/gallium/drivers/i915simple/i915_texture.c
src/gallium/drivers/i965simple/brw_defines.h
src/gallium/drivers/i965simple/brw_tex_layout.c
src/gallium/drivers/nouveau/nouveau_stateobj.h
src/gallium/drivers/nv04/nv04_miptree.c
src/gallium/drivers/nv10/nv10_clear.c
src/gallium/drivers/nv10/nv10_context.h
src/gallium/drivers/nv10/nv10_miptree.c
src/gallium/drivers/nv20/nv20_clear.c
src/gallium/drivers/nv20/nv20_context.h
src/gallium/drivers/nv20/nv20_miptree.c
src/gallium/drivers/nv30/nv30_clear.c
src/gallium/drivers/nv30/nv30_context.h
src/gallium/drivers/nv30/nv30_miptree.c
src/gallium/drivers/nv30/nv30_state_emit.c
src/gallium/drivers/nv40/nv40_clear.c
src/gallium/drivers/nv40/nv40_context.h
src/gallium/drivers/nv40/nv40_miptree.c
src/gallium/drivers/nv40/nv40_state_emit.c
src/gallium/drivers/nv50/nv50_clear.c
src/gallium/drivers/nv50/nv50_context.h
src/gallium/drivers/nv50/nv50_miptree.c
src/gallium/drivers/nv50/nv50_query.c
src/gallium/drivers/nv50/nv50_state_validate.c
src/gallium/drivers/r300/Makefile
src/gallium/drivers/r300/SConscript
src/gallium/drivers/r300/r300_chipset.c
src/gallium/drivers/r300/r300_clear.c
src/gallium/drivers/r300/r300_clear.h
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_cs.h
src/gallium/drivers/r300/r300_debug.c
src/gallium/drivers/r300/r300_debug.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_emit.h
src/gallium/drivers/r300/r300_query.c
src/gallium/drivers/r300/r300_reg.h
src/gallium/drivers/r300/r300_render.c [moved from src/gallium/drivers/r300/r300_swtcl_emit.c with 74% similarity]
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_state_inlines.h
src/gallium/drivers/r300/r300_state_invariant.c
src/gallium/drivers/r300/r300_state_invariant.h
src/gallium/drivers/r300/r300_state_shader.c
src/gallium/drivers/r300/r300_state_shader.h
src/gallium/drivers/r300/r300_state_tcl.c [new file with mode: 0644]
src/gallium/drivers/r300/r300_state_tcl.h [new file with mode: 0644]
src/gallium/drivers/r300/r300_surface.c
src/gallium/drivers/r300/r300_surface.h
src/gallium/drivers/r300/r300_texture.c
src/gallium/drivers/softpipe/sp_clear.c
src/gallium/drivers/softpipe/sp_clear.h
src/gallium/drivers/softpipe/sp_fs_exec.c
src/gallium/drivers/softpipe/sp_fs_llvm.c
src/gallium/drivers/softpipe/sp_fs_sse.c
src/gallium/drivers/softpipe/sp_quad_fs.c
src/gallium/drivers/softpipe/sp_setup.c
src/gallium/drivers/softpipe/sp_surface.c
src/gallium/drivers/softpipe/sp_texture.c
src/gallium/drivers/softpipe/sp_tile_cache.c
src/gallium/drivers/softpipe/sp_tile_cache.h
src/gallium/drivers/trace/README
src/gallium/drivers/trace/tr_context.c
src/gallium/drivers/trace/tr_dump.c
src/gallium/drivers/trace/tr_screen.c
src/gallium/drivers/trace/tr_state.c
src/gallium/drivers/trace/tr_texture.c
src/gallium/drivers/trace/tr_texture.h
src/gallium/drivers/trace/trace.xsl
src/gallium/include/pipe/p_compiler.h
src/gallium/include/pipe/p_config.h
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_format.h
src/gallium/include/pipe/p_refcnt.h
src/gallium/include/pipe/p_state.h
src/gallium/include/pipe/p_thread.h
src/gallium/state_trackers/egl/egl_surface.c
src/gallium/state_trackers/egl/egl_tracker.c
src/gallium/state_trackers/egl/egl_tracker.h
src/gallium/state_trackers/g3dvl/vl_basic_csc.c
src/gallium/state_trackers/python/README
src/gallium/state_trackers/python/gallium.i
src/gallium/state_trackers/python/p_context.i
src/gallium/state_trackers/python/p_device.i
src/gallium/state_trackers/python/p_state.i
src/gallium/state_trackers/python/p_texture.i
src/gallium/state_trackers/python/retrace/format.py
src/gallium/state_trackers/python/retrace/interpreter.py
src/gallium/state_trackers/python/retrace/model.py
src/gallium/state_trackers/python/retrace/parser.py
src/gallium/state_trackers/python/samples/tri.py
src/gallium/state_trackers/python/st_device.c
src/gallium/state_trackers/python/st_device.h
src/gallium/state_trackers/python/st_sample.c
src/gallium/state_trackers/python/st_sample.h
src/gallium/state_trackers/python/st_softpipe_winsys.c
src/gallium/state_trackers/python/tests/.gitignore [new file with mode: 0644]
src/gallium/state_trackers/python/tests/base.py [changed mode: 0644->0755]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh [new file with mode: 0644]
src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py [new file with mode: 0644]
src/gallium/state_trackers/python/tests/surface_copy.py [new file with mode: 0755]
src/gallium/state_trackers/python/tests/texture_render.py [new file with mode: 0755]
src/gallium/state_trackers/python/tests/texture_sample.py [moved from src/gallium/state_trackers/python/tests/texture.py with 74% similarity, mode: 0755]
src/gallium/state_trackers/python/tests/texture_transfer.py [new file with mode: 0755]
src/gallium/state_trackers/python/tests/tree.py [new file with mode: 0755]
src/gallium/state_trackers/wgl/shared/stw_context.c
src/gallium/state_trackers/wgl/shared/stw_device.c
src/gallium/state_trackers/wgl/shared/stw_device.h
src/gallium/state_trackers/wgl/shared/stw_framebuffer.c
src/gallium/state_trackers/wgl/shared/stw_framebuffer.h
src/gallium/winsys/drm/SConscript
src/gallium/winsys/drm/nouveau/dri/nouveau_screen.c
src/gallium/winsys/drm/radeon/SConscript
src/gallium/winsys/drm/radeon/core/SConscript [new file with mode: 0644]
src/gallium/winsys/drm/radeon/core/radeon_buffer.c
src/gallium/winsys/drm/radeon/core/radeon_buffer.h
src/gallium/winsys/drm/radeon/core/radeon_r300.c
src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c
src/gallium/winsys/drm/radeon/dri2/SConscript [new file with mode: 0644]
src/gallium/winsys/drm/radeon/python/README [new file with mode: 0644]
src/gallium/winsys/drm/radeon/python/SConscript [new file with mode: 0644]
src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c [new file with mode: 0644]
src/gallium/winsys/drm/radeon/python/xf86dri.c [new file with mode: 0644]
src/gallium/winsys/drm/radeon/python/xf86dri.h [new file with mode: 0644]
src/gallium/winsys/drm/radeon/python/xf86dristr.h [new file with mode: 0644]
src/gallium/winsys/gdi/SConscript
src/glew/Makefile
src/glx/x11/dri2_glx.c
src/glx/x11/glx_pbuffer.c
src/glx/x11/glxclient.h
src/glx/x11/glxcurrent.c
src/glx/x11/indirect.c
src/glx/x11/indirect_vertex_program.c
src/glx/x11/pixelstore.c
src/mesa/SConscript
src/mesa/drivers/common/driverfuncs.c
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/utils.c
src/mesa/drivers/dri/gamma/gamma_tex.c
src/mesa/drivers/dri/i810/i810tex.c
src/mesa/drivers/dri/i915/i830_texstate.c
src/mesa/drivers/dri/i915/i915_texstate.c
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_curbe.c
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_draw_upload.c
src/mesa/drivers/dri/i965/brw_eu.h
src/mesa/drivers/dri/i965/brw_eu_debug.c
src/mesa/drivers/dri/i965/brw_eu_emit.c
src/mesa/drivers/dri/i965/brw_program.c
src/mesa/drivers/dri/i965/brw_sf_emit.c
src/mesa/drivers/dri/i965/brw_sf_state.c
src/mesa/drivers/dri/i965/brw_tex.c
src/mesa/drivers/dri/i965/brw_vs_emit.c
src/mesa/drivers/dri/i965/brw_wm.c
src/mesa/drivers/dri/i965/brw_wm.h
src/mesa/drivers/dri/i965/brw_wm_debug.c
src/mesa/drivers/dri/i965/brw_wm_emit.c
src/mesa/drivers/dri/i965/brw_wm_fp.c
src/mesa/drivers/dri/i965/brw_wm_glsl.c
src/mesa/drivers/dri/i965/brw_wm_pass1.c
src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
src/mesa/drivers/dri/i965/brw_wm_state.c
src/mesa/drivers/dri/i965/brw_wm_surface_state.c
src/mesa/drivers/dri/intel/intel_blit.c
src/mesa/drivers/dri/intel/intel_context.c
src/mesa/drivers/dri/intel/intel_context.h
src/mesa/drivers/dri/intel/intel_decode.c
src/mesa/drivers/dri/intel/intel_extensions.c
src/mesa/drivers/dri/intel/intel_pixel.c
src/mesa/drivers/dri/intel/intel_screen.c
src/mesa/drivers/dri/intel/intel_screen.h
src/mesa/drivers/dri/intel/intel_tex_format.c
src/mesa/drivers/dri/intel/intel_tex_image.c
src/mesa/drivers/dri/mach64/mach64_tex.c
src/mesa/drivers/dri/mga/mgatex.c
src/mesa/drivers/dri/r128/r128_tex.c
src/mesa/drivers/dri/r200/r200_state.c
src/mesa/drivers/dri/r200/r200_tex.c
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_emit.c
src/mesa/drivers/dri/r300/r300_state.c
src/mesa/drivers/dri/r300/r300_swtcl.c
src/mesa/drivers/dri/r300/r300_tex.c
src/mesa/drivers/dri/radeon/radeon_bocs_wrapper.h
src/mesa/drivers/dri/radeon/radeon_lighting.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_state.c
src/mesa/drivers/dri/radeon/radeon_tex.c
src/mesa/drivers/dri/s3v/s3v_tex.c
src/mesa/drivers/dri/savage/savagetex.c
src/mesa/drivers/dri/sis/sis_texstate.c
src/mesa/glapi/gl_API.xml
src/mesa/main/attrib.c
src/mesa/main/colormac.h
src/mesa/main/compiler.h
src/mesa/main/config.h
src/mesa/main/dlist.c
src/mesa/main/drawpix.c
src/mesa/main/enums.c
src/mesa/main/extensions.c
src/mesa/main/ffvertex_prog.c
src/mesa/main/image.c
src/mesa/main/imports.c
src/mesa/main/light.c
src/mesa/main/macros.h
src/mesa/main/matrix.c
src/mesa/main/mipmap.c
src/mesa/main/mtypes.h
src/mesa/main/readpix.c
src/mesa/main/shared.c
src/mesa/main/sources
src/mesa/main/texenv.c
src/mesa/main/texenvprogram.c
src/mesa/main/texformat.c
src/mesa/main/texformat.h
src/mesa/main/texformat_tmp.h
src/mesa/main/texgetimage.c [new file with mode: 0644]
src/mesa/main/texgetimage.h [new file with mode: 0644]
src/mesa/main/teximage.c
src/mesa/main/texparam.c
src/mesa/main/texstore.c
src/mesa/main/texstore.h
src/mesa/math/m_matrix.c
src/mesa/shader/arbprogparse.c
src/mesa/shader/prog_execute.c
src/mesa/shader/prog_instruction.c
src/mesa/shader/prog_optimize.c
src/mesa/shader/prog_parameter.c
src/mesa/shader/prog_statevars.c
src/mesa/shader/slang/slang_builtin.c
src/mesa/shader/slang/slang_codegen.c
src/mesa/shader/slang/slang_codegen.h
src/mesa/shader/slang/slang_compile.c
src/mesa/shader/slang/slang_emit.c
src/mesa/shader/slang/slang_link.c
src/mesa/shader/slang/slang_typeinfo.c
src/mesa/sources.mak
src/mesa/state_tracker/st_atom_sampler.c
src/mesa/state_tracker/st_cb_clear.c
src/mesa/state_tracker/st_cb_drawpixels.c
src/mesa/state_tracker/st_cb_readpixels.c
src/mesa/state_tracker/st_cb_readpixels.h
src/mesa/state_tracker/st_cb_strings.c
src/mesa/state_tracker/st_cb_texture.c
src/mesa/state_tracker/st_framebuffer.c
src/mesa/state_tracker/st_program.c
src/mesa/state_tracker/st_public.h
src/mesa/state_tracker/st_texture.c
src/mesa/state_tracker/st_texture.h
src/mesa/swrast/s_atifragshader.c
src/mesa/swrast/s_context.c
src/mesa/swrast/s_context.h
src/mesa/swrast/s_fragprog.c
src/mesa/swrast/s_points.c
src/mesa/swrast/s_span.c
src/mesa/swrast/s_texcombine.c
src/mesa/swrast/s_texfilter.c
src/mesa/tnl/t_rasterpos.c
src/mesa/tnl/t_vb_lighttmp.h
src/mesa/tnl/t_vb_program.c
src/mesa/x86/gen_matypes.c

index 7e7f515..1e5fd71 100644 (file)
@@ -48,7 +48,7 @@ opts.Add(ListOption('statetrackers', 'state trackers to build', default_statetra
 opts.Add(ListOption('drivers', 'pipe drivers to build', default_drivers,
                      ['softpipe', 'failover', 'i915simple', 'i965simple', 'cell', 'trace', 'r300']))
 opts.Add(ListOption('winsys', 'winsys drivers to build', default_winsys,
-                     ['xlib', 'intel', 'gdi', 'amd']))
+                     ['xlib', 'intel', 'gdi', 'radeon']))
 
 opts.Add(EnumOption('MSVS_VERSION', 'MS Visual C++ version', None, allowed_values=('7.1', '8.0', '9.0')))
 
index d7b740f..a3e826a 100755 (executable)
--- a/bin/mklib
+++ b/bin/mklib
@@ -394,6 +394,30 @@ case $ARCH in
                fi
            fi
 
+           # If using Sun C++ compiler, need to tell it not to add runpaths
+           # that are specific to the build machine
+           if [ ${LINK} = "CC" ] ; then
+               OPTS="${OPTS} -norunpath"
+           fi
+
+           # Solaris linker requires explicitly listing the Standard C & C++
+           # libraries in the link path when building shared objects
+           if [ ${LINK} = "CC" ] ; then
+               DEPS="${DEPS} -lCrun"
+           fi
+           DEPS="${DEPS} -lc"
+
+           if [ $EXPORTS ] ; then
+               # Make the 'mapfile.scope' linker mapfile
+               echo "{" > mapfile.scope
+               echo "global:" >> mapfile.scope
+               sed 's/$/;/' ${EXPORTS} >> mapfile.scope
+               echo "local:" >> mapfile.scope
+               echo "    *;" >> mapfile.scope
+               echo "};" >> mapfile.scope
+               OPTS="${OPTS} -Wl,-Mmapfile.scope"
+           fi
+
            # Check if objects are SPARC v9
            # file says: ELF 64-bit MSB relocatable SPARCV9 Version 1
            set ${OBJECTS}
@@ -406,17 +430,19 @@ case $ARCH in
             if [ "${ALTOPTS}" ] ; then
                 OPTS=${ALTOPTS}
             fi
+
            # for debug:
            #echo "mklib: linker is" ${LINK} ${OPTS}
            if [ $NOPREFIX = 1 ] ; then
                rm -f ${LIBNAME}
                ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME} ${OBJECTS} ${DEPS}
+               FINAL_LIBS="${LIBNAME}"
            else
                rm -f ${LIBNAME}.${MAJOR} ${LIBNAME}
                ${LINK} ${OPTS} ${LDFLAGS} -o ${LIBNAME}.${MAJOR} -h ${LIBNAME}.${MAJOR} ${OBJECTS} ${DEPS}
                ln -s ${LIBNAME}.${MAJOR} ${LIBNAME}
+               FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
            fi
-           FINAL_LIBS="${LIBNAME}.${MAJOR} ${LIBNAME}"
        fi
        ;;
 
index 1a99df4..f1c6372 100644 (file)
--- a/common.py
+++ b/common.py
@@ -61,7 +61,7 @@ def AddOptions(opts):
        opts.Add(EnumOption('platform', 'target platform', default_platform,
                                                                                         allowed_values=('linux', 'cell', 'windows', 'winddk', 'wince')))
        opts.Add(EnumOption('toolchain', 'compiler toolchain', 'default',
-                                                                                        allowed_values=('default', 'crossmingw', 'winddk')))
+                                                                                        allowed_values=('default', 'crossmingw', 'winsdk', 'winddk')))
        opts.Add(BoolOption('llvm', 'use LLVM', 'no'))
        opts.Add(BoolOption('dri', 'build DRI drivers', default_dri))
 
index f81f349..fd0d511 100644 (file)
@@ -375,17 +375,6 @@ if test "x$enable_selinux" = "xyes"; then
     DEFINES="$DEFINES -DMESA_SELINUX"
 fi
 
-dnl OS-specific libraries
-OS_LIBS=""
-case "$host_os" in
-solaris*)
-    OS_LIBS="-lc"
-    if test "x$GXX" != xyes; then
-        OS_CPLUSPLUS_LIBS="-lCrun $OS_LIBS"
-    fi
-    ;;
-esac
-
 dnl
 dnl Driver configuration. Options are xlib, dri and osmesa right now.
 dnl More later: directfb, fbdev, ...
@@ -563,8 +552,8 @@ xlib)
         GL_PC_LIB_PRIV="$GL_LIB_DEPS"
         GL_PC_CFLAGS="$X11_INCLUDES"
     fi
-    GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread $OS_LIBS"
-    GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread $OS_LIBS"
+    GL_LIB_DEPS="$GL_LIB_DEPS $SELINUX_LIBS -lm -lpthread"
+    GL_PC_LIB_PRIV="$GL_PC_LIB_PRIV $SELINUX_LIBS -lm -lpthread"
 
     # if static, move the external libraries to the programs
     # and empty the libraries for libGL
@@ -621,12 +610,12 @@ dri)
     fi
 
     # need DRM libs, -lpthread, etc.
-    GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS $OS_LIBS"
-    GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS $OS_LIBS"
+    GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
+    GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
     ;;
 osmesa)
     # No libGL for osmesa
-    GL_LIB_DEPS="$OS_LIBS"
+    GL_LIB_DEPS=""
     ;;
 esac
 AC_SUBST([GL_LIB_DEPS])
@@ -869,9 +858,9 @@ osmesa)
     ;;
 esac
 if test "$enable_static" = no; then
-    OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS $OS_LIBS"
+    OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
 fi
-OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV $OS_LIBS"
+OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
 AC_SUBST([OSMESA_LIB_DEPS])
 AC_SUBST([OSMESA_MESA_DEPS])
 AC_SUBST([OSMESA_PC_REQ])
@@ -887,7 +876,7 @@ else
     # should check these...
     EGL_LIB_DEPS="$X_LIBS -lX11"
 fi
-EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS $OS_LIBS"
+EGL_LIB_DEPS="$EGL_LIB_DEPS $DLOPEN_LIBS"
 AC_SUBST([EGL_LIB_DEPS])
 
 dnl
@@ -997,10 +986,10 @@ if test "x$enable_glw" = xyes; then
     fi
 
     # If static, empty GLW_LIB_DEPS and add libs for programs to link
-    GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV $OS_LIBS"
+    GLW_PC_LIB_PRIV="$GLW_PC_LIB_PRIV"
     if test "$enable_static" = no; then
         GLW_MESA_DEPS='-l$(GL_LIB)'
-        GLW_LIB_DEPS="$GLW_LIB_DEPS $OS_LIBS"
+        GLW_LIB_DEPS="$GLW_LIB_DEPS"
     else
         APP_LIB_DEPS="$APP_LIB_DEPS $GLW_LIB_DEPS"
         GLW_LIB_DEPS=""
@@ -1056,8 +1045,8 @@ if test "x$enable_glut" = xyes; then
         GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
         GLUT_PC_CFLAGS="$X11_INCLUDES"
     fi
-    GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm $OS_LIBS"
-    GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm $OS_LIBS"
+    GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
+    GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
 
     # If glut is available, we can build most programs
     if test "$with_demos" = yes; then
diff --git a/docs/MESA_texture_signed_rgba.spec b/docs/MESA_texture_signed_rgba.spec
new file mode 100644 (file)
index 0000000..49c8e9e
--- /dev/null
@@ -0,0 +1,214 @@
+Name
+
+    MESA_texture_signed_rgba
+
+Name Strings
+
+    GL_MESA_texture_signed_rgba
+
+Contact
+
+
+
+Notice
+
+
+
+IP Status
+
+    No known IP issues
+
+Status
+
+
+
+Version
+
+    0.3, 2009-03-24
+
+Number
+
+    Not assigned ?
+
+Dependencies
+
+    Written based on the wording of the OpenGL 2.0 specification.
+
+    This extension trivially interacts with ARB_texture_float.
+    This extension shares some language with ARB_texture_compression_rgtc
+    but does not depend on it.
+
+Overview
+
+    OpenGL prior to 3.1 does not support any signed texture formats.
+    ARB_texture_compression_rgtc introduces some compressed red and
+    red_green signed formats but no uncompressed ones, which might
+    still be useful. NV_texture_shader adds signed texture formats,
+    but also a lot of functionality which has been superceded by fragment
+    shaders.
+    It is usually possible to get the same functionality
+    using a unsigned format by doing scale and bias in a shader, but this
+    is undesirable since modern hardware has direct support for this.
+    This extension adds a signed 4-channel texture format by backporting
+    the relevant features from OpenGL 3.1, as a means to support this in
+    OpenGL implementations only supporting older versions.
+
+Issues
+
+    1) What should this extension be called?
+
+       RESOLVED: MESA_texture_signed_rgba seems reasonable.
+       The rgba part is there because only 4 channel format is supported.
+
+
+    2) Should the full set of signed formats (alpha, luminance, rgb, etc.)
+       be supported?
+
+       RESOLVED: NO. To keep this extension simple, only add the most
+       universal format, rgba. alpha/luminance can't be trivially supported
+       since OpenGL 3.1 does not support them any longer, and there is some
+       implied dependency on ARB_texture_rg for red/red_green formats so
+       avoid all this. Likewise, only 8 bits per channel is supported.
+
+
+    3) Should this extension use new enums for the texture formats?
+
+       RESOLVED: NO. Same enums as those used in OpenGL 3.1.
+
+
+    4) How are signed integer values mapped to floating-point values?
+
+       RESOLVED: Same as described in issue 5) of
+       ARB_texture_compression_rgtc (quote):
+       A signed 8-bit two's complement value X is computed to
+       a floating-point value Xf with the formula:
+
+                { X / 127.0, X > -128
+           Xf = {
+                { -1.0,      X == -128
+
+       This conversion means -1, 0, and +1 are all exactly representable,
+       however -128 and -127 both map to -1.0.  Mapping -128 to -1.0
+       avoids the numerical awkwardness of have a representable value
+       slightly more negative than -1.0.
+
+       This conversion is intentionally NOT the "byte" conversion listed
+       in Table 2.9 for component conversions.  That conversion says:
+
+           Xf = (2*X + 1) / 255.0
+
+       The Table 2.9 conversion is incapable of exactly representing
+       zero.
+
+       (Difference to ARB_texture_compression_rgtc):
+       This is the same mapping as OpenGL 3.1 uses.
+       This is also different to what NV_texture_shader used.
+       The above mapping should be considered the reference, but there
+       is some leeway so other mappings are allowed for implementations which
+       cannot do this. Particulary the mapping given in NV_texture_shader or
+       the standard OpenGL byte/float mapping is considered acceptable too, as
+       might be a mapping which represents -1.0 by -128, 0.0 by 0 and 1.0 by
+       127 (that is, uses different scale factors for negative and positive
+       numbers).
+       Also, it is ok to store incoming GL_BYTE user data as-is, without
+       converting to GL_FLOAT (using the standard OpenGL float/byte mapping)
+       and converting back (using the mapping described here).
+       Other than those subtle issues there are no other non-standard
+       conversions used, so when using for instance CopyTexImage2D with
+       a framebuffer clamped to [0,1] all converted numbers will be in the range
+       [0, 127] (and not scaled and biased).
+
+
+    5) How will signed components resulting from RGBA8_SNORM texture
+       fetches interact with fragment coloring?
+
+       RESOLVED: Same as described in issue 6) of
+       ARB_texture_compression_rgtc (quote):
+       The specification language for this extension is silent
+       about clamping behavior leaving this to the core specification
+       and other extensions.  The clamping or lack of clamping is left
+       to the core specification and other extensions.
+
+       For assembly program extensions supporting texture fetches
+       (ARB_fragment_program, NV_fragment_program, NV_vertex_program3,
+       etc.) or the OpenGL Shading Language, these signed formats will
+       appear as expected with unclamped signed components as a result
+       of a texture fetch instruction.
+
+       If ARB_color_buffer_float is supported, its clamping controls
+       will apply.
+
+       NV_texture_shader extension, if supported, adds support for
+       fixed-point textures with signed components and relaxed the
+       fixed-function texture environment clamping appropriately.  If the
+       NV_texture_shader extension is supported, its specified behavior
+       for the texture environment applies where intermediate values
+       are clamped to [-1,1] unless stated otherwise as in the case
+       of explicitly clamped to [0,1] for GL_COMBINE.  or clamping the
+       linear interpolation weight to [0,1] for GL_DECAL and GL_BLEND.
+
+       Otherwise, the conventional core texture environment clamps
+       incoming, intermediate, and output color components to [0,1].
+
+       This implies that the conventional texture environment
+       functionality of unextended OpenGL 1.5 or OpenGL 2.0 without
+       using GLSL (and with none of the extensions referred to above)
+       is unable to make proper use of the signed texture formats added
+       by this extension because the conventional texture environment
+       requires texture source colors to be clamped to [0,1].  Texture
+       filtering of these signed formats would be still signed, but
+       negative values generated post-filtering would be clamped to
+       zero by the core texture environment functionality.  The
+       expectation is clearly that this extension would be co-implemented
+       with one of the previously referred to extensions or used with
+       GLSL for the new signed formats to be useful.
+
+
+    6) Should the RGBA_SNORM tokens also be accepted by CopyTexImage
+       functions?
+
+       RESOLVED: YES.
+
+
+    7) What to do with GetTexParameter if ARB_texture_float is supported,
+       in particular what datatype should this return for TEXTURE_RED_TYPE_ARB,
+       TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB, TEXTURE_ALPHA_TYPE_ARB?
+
+       RESOLVED: ARB_texture_float states type is either NONE,
+       UNSIGNED_NORMALIZED_ARB, or FLOAT. This extension adds a new enum,
+       SIGNED_NORMALIZED, which will be returned accordingly. This is the
+       same behaviour as in OpenGL 3.1.
+
+
+New Tokens
+
+
+    Accepted by the <internalformat> parameter of
+    TexImage1D, TexImage2D, TexImage3D, CopyTexImage1D, and CopyTexImage2D:
+
+        RGBA_SNORM                                0x8F93
+        RGBA8_SNORM                               0x8F97
+
+    Returned by the <params> parameter of GetTexLevelParameter:
+
+        SIGNED_NORMALIZED                         0x8F9C
+
+
+Additions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization):
+
+ -- Section 3.8.1, Texture Image Specification
+
+    Add to Table 3.16 (page 154): Sized internal formats
+
+    Sized             Base             R    G    B    A    L    I    D
+    Internal Format   Internal Format bits bits bits bits bits bits bits
+    ---------------   --------------- ---- ---- ---- ---- ---- ---- ----
+    RGBA8_SNORM       RGBA             8    8    8    8    0    0    0
+
+
+Dependencies on ARB_texture_float extension:
+
+    If ARB_texture_float is supported, GetTexParameter queries with <value>
+    of TEXTURE_RED_TYPE_ARB, TEXTURE_GREEN_TYPE_ARB, TEXTURE_BLUE_TYPE_ARB or
+    TEXTURE_ALPHA_TYPE_ARB return SIGNED_NORMALIZED if
+    the base internal format is RGBA_SNORM.
index 49b62ca..ada903c 100644 (file)
@@ -14,16 +14,7 @@ The Mesa
 driver is part of the 
 <a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D" target="_parent">Gallium3D</a>
 architecture.
-</p>
-
-<p>
-<a href="http://www.tungstengraphics.com/" target="_parent">Tungsten Graphics</a>
-is leading the project.
-Two phases are planned.
-First, to implement the framework for parallel rasterization using the Cell
-SPEs, including texture mapping.
-Second, to implement a full-featured OpenGL driver with support for GLSL, etc.
-The second phase is now underway.
+Tungsten Graphics did the original implementation of the Cell driver.
 </p>
 
 
@@ -60,7 +51,7 @@ Mesa tree, then set <code>LD_LIBRARY_PATH</code> like this:
 Verify that the Cell driver is being used by running
 <code>progs/xdemos/glxinfo</code> and looking for:
 <pre>
-  OpenGL renderer string: Gallium 0.2, Cell on Xlib
+  OpenGL renderer string: Gallium 0.3, Cell on Xlib
 </pre>
 
 
index dbb8eba..91ed20e 100644 (file)
@@ -24,6 +24,7 @@ The specifications follow.
 <LI><A HREF="MESA_resize_buffers.spec">MESA_resize_buffers.spec</A>
 <LI><A HREF="MESA_set_3dfx_mode.spec">MESA_set_3dfx_mode.spec</A>
 <LI><A HREF="MESA_sprite_point.spec">MESA_sprite_point.spec</A> (obsolete)
+<LI><A HREF="MESA_texture_signed_rgba.spec">MESA_texture_signed_rgba.spec</A>
 <LI><A HREF="MESA_trace.spec">MESA_trace.spec</A> (obsolete)
 <LI><A HREF="MESA_window_pos.spec">MESA_window_pos.spec</A>
 <LI><A HREF="MESA_ycbcr_texture.spec">MESA_ycbcr_texture.spec</A>
index f29553b..3c822da 100644 (file)
 
 <p>
 Mesa 7.5 is a new development release.
+People who are concerned with stability and reliability should stick
+with the 7.4.x branch or wait for Mesa 7.6.
+</p>
+<p>
+The main new feature of Mesa 7.5 is the
+<a href="http://www.tungstengraphics.com/wiki/index.php/Gallium3D"
+target="_parent">Gallium3D</a> infrastructure.
 </p>
 <p>
 Mesa 7.5 implements the OpenGL 2.1 API, but the version reported by
@@ -32,6 +39,17 @@ tbd
 
 <h2>New features</h2>
 <ul>
+<li>Gallium - this is the new architecture for OS-independent and
+    API-independent 3D drivers.
+    Gallium3D is intended for GPUs that fully support  vertex/fragment shaders.
+    The Gallium3D drivers currently included are:
+    <ul>
+    <li>softpipe - a software/reference driver
+    <li>i915 - Intel 915/945 driver
+    <li><a href="cell.html">Cell</a> - IBM/Sony/Toshiba Cell processor driver
+    <li>nouveau - preliminary driver for NVIDIA GPUs (still under development)
+    <li>r300 - preliminary driver for R300 (still under development)
+    </ul>
 <li>GL_ARB_framebuffer_object extension (software drivers, i965 driver)
 <li>Reworked two-sided stencil support.
 This allows a driver to support all three variations of two-sided stencil
@@ -45,8 +63,10 @@ including GL_ATI_separate_stencil, GL_EXT_stencil_two_side and OpenGL 2.0
 
 <h2>Bug fixes</h2>
 <ul>
+<li>Lots of i965 driver bug fixes
 </ul>
 
+
 <h2>Changes</h2>
 <ul>
 <li>Remove support for GL_SGIX_shadow, GL_SGIX_shadow_ambient and
index b77745f..77c86be 100644 (file)
@@ -22,6 +22,7 @@ Last updated on 15 December 2008.
 Contents
 </p>
 <ul>
+<li><a href="#envvars">Environment variables</a>
 <li><a href="#120">GLSL 1.20 support</a>
 <li><a href="#unsup">Unsupported Features</a>
 <li><a href="#notes">Implementation Notes</a>
@@ -33,11 +34,32 @@ Contents
 
 
 
+<a name="envvars">
+<h2>Environment Variables</h2>
+
+<p>
+The <b>MESA_GLSL</b> environment variable can be set to a comma-separated
+list of keywords to control some aspects of the GLSL compiler:
+</p>
+<ul>
+<li>dump - print GLSL shader code to stdout at link time
+<li>log - log all GLSL shaders to files.
+    The filenames will be "shader_X.vert" or "shader_X.frag" where X
+    the shader ID.
+<li>nopt - disable compiler optimizations
+<li>opt - force compiler optimizations
+<li>uniform - print message to stdout when glUniform is called
+</ul>
+<p>
+Example:  export MESA_GLSL=dump,nopt
+</p>
+
+
 <a name="120">
 <h2>GLSL 1.20 support</h2>
 
 <p>
-GLSL version 1.20 is supported in Mesa 7.3.
+GLSL version 1.20 is supported in Mesa 7.3 and later.
 Among the features/differences of GLSL 1.20 are:
 <ul>
 <li><code>mat2x3, mat2x4</code>, etc. types and functions
@@ -59,12 +81,14 @@ Among the features/differences of GLSL 1.20 are:
 <h2>Unsupported Features</h2>
 
 <p>
-The following features of the shading language are not yet supported
+The following features of the shading language are not yet fully supported
 in Mesa:
 </p>
 
 <ul>
-<li>Linking of multiple shaders is not supported
+<li>Linking of multiple shaders does not always work.  Currently, linking
+    is implemented through shader concatenation and re-compiling.  This
+    doesn't always work because of some #pragma and preprocessor issues.
 <li>gl_ClipVertex
 <li>The gl_Color and gl_SecondaryColor varying vars are interpolated
     without perspective correction
@@ -177,6 +201,8 @@ This tool is useful for:
 After building Mesa, the glslcompiler can be built by manually running:
 </p>
 <pre>
+    make realclean
+    make linux
     cd src/mesa/drivers/glslcompiler
     make
 </pre>
index a4698cc..b65f7f2 100644 (file)
@@ -136,8 +136,8 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGL
 #define EGL_INTERLACED_MESA                    0x4008
 #define EGL_SCREEN_BIT_MESA                    0x08
 
-typedef u_int32_t EGLScreenMESA;
-typedef u_int32_t EGLModeMESA;
+typedef uint32_t EGLScreenMESA;
+typedef uint32_t EGLModeMESA;
 
 #ifdef EGL_EGLEXT_PROTOTYPES
 EGLAPI EGLBoolean EGLAPIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
index d873428..83e89cd 100644 (file)
@@ -15,6 +15,7 @@
 
 #if !defined(_WIN32_WCE)
 #include <sys/types.h>
+#include <stdint.h>
 #endif
 
 /* Macros used in EGL function prototype declarations.
@@ -57,7 +58,7 @@
 #endif
 
 typedef long   int32_t;
-typedef unsigned long u_int32_t;
+typedef unsigned long uint32_t;
 typedef unsigned char uint8_t;
 #define snprintf _snprintf
 #define strcasecmp _stricmp
@@ -68,7 +69,7 @@ typedef HWND  NativeWindowType;
 typedef HBITMAP NativePixmapType;
 /** END Added for Windows **/
 
-#elif defined(__gnu_linux__) || defined(__FreeBSD__)
+#elif defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__sun)
 
 /** BEGIN Added for X (Mesa) **/
 #ifndef EGLAPI
index d3f01a2..41149c9 100644 (file)
@@ -46,9 +46,9 @@ extern "C" {
 /*************************************************************/
 
 /* Header file version number, required by OpenGL ABI for Linux */
-/* glext.h last updated 2009/03/04 */
+/* glext.h last updated 2009/03/19 */
 /* Current version at http://www.opengl.org/registry/ */
-#define GL_GLEXT_VERSION 46
+#define GL_GLEXT_VERSION 48
 
 #ifndef GL_VERSION_1_2
 #define GL_UNSIGNED_BYTE_3_3_2            0x8032
@@ -716,6 +716,24 @@ extern "C" {
 /* reuse GL_VERTEX_ARRAY_BINDING */
 #endif
 
+#ifndef GL_VERSION_3_1
+#define GL_RED_SNORM                      0x8F90
+#define GL_RG_SNORM                       0x8F91
+#define GL_RGB_SNORM                      0x8F92
+#define GL_RGBA_SNORM                     0x8F93
+#define GL_R8_SNORM                       0x8F94
+#define GL_RG8_SNORM                      0x8F95
+#define GL_RGB8_SNORM                     0x8F96
+#define GL_RGBA8_SNORM                    0x8F97
+#define GL_R16_SNORM                      0x8F98
+#define GL_RG16_SNORM                     0x8F99
+#define GL_RGB16_SNORM                    0x8F9A
+#define GL_RGBA16_SNORM                   0x8F9B
+#define GL_SIGNED_NORMALIZED              0x8F9C
+#define GL_PRIMITIVE_RESTART              0x8F9D
+#define GL_PRIMITIVE_RESTART_INDEX        0x8F9E
+#endif
+
 #ifndef GL_ARB_multitexture
 #define GL_TEXTURE0_ARB                   0x84C0
 #define GL_TEXTURE1_ARB                   0x84C1
@@ -1327,6 +1345,7 @@ extern "C" {
 #endif
 
 #ifndef GL_ARB_instanced_arrays
+#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE
 #endif
 
 #ifndef GL_ARB_map_buffer_range
@@ -1382,6 +1401,51 @@ extern "C" {
 #define GL_VERTEX_ARRAY_BINDING           0x85B5
 #endif
 
+#ifndef GL_ARB_uniform_buffer_object
+#define GL_UNIFORM_BUFFER                 0x8A11
+#define GL_UNIFORM_BUFFER_BINDING         0x8A28
+#define GL_UNIFORM_BUFFER_START           0x8A29
+#define GL_UNIFORM_BUFFER_SIZE            0x8A2A
+#define GL_MAX_VERTEX_UNIFORM_BLOCKS      0x8A2B
+#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS    0x8A2C
+#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS    0x8A2D
+#define GL_MAX_COMBINED_UNIFORM_BLOCKS    0x8A2E
+#define GL_MAX_UNIFORM_BUFFER_BINDINGS    0x8A2F
+#define GL_MAX_UNIFORM_BLOCK_SIZE         0x8A30
+#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
+#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
+#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
+#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
+#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
+#define GL_ACTIVE_UNIFORM_BLOCKS          0x8A36
+#define GL_UNIFORM_TYPE                   0x8A37
+#define GL_UNIFORM_SIZE                   0x8A38
+#define GL_UNIFORM_NAME_LENGTH            0x8A39
+#define GL_UNIFORM_BLOCK_INDEX            0x8A3A
+#define GL_UNIFORM_OFFSET                 0x8A3B
+#define GL_UNIFORM_ARRAY_STRIDE           0x8A3C
+#define GL_UNIFORM_MATRIX_STRIDE          0x8A3D
+#define GL_UNIFORM_IS_ROW_MAJOR           0x8A3E
+#define GL_UNIFORM_BLOCK_BINDING          0x8A3F
+#define GL_UNIFORM_BLOCK_DATA_SIZE        0x8A40
+#define GL_UNIFORM_BLOCK_NAME_LENGTH      0x8A41
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS  0x8A42
+#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
+#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
+#define GL_INVALID_INDEX_ARB              0xFFFFFFFFu
+#endif
+
+#ifndef GL_ARB_compatibility
+/* ARB_compatibility just defines tokens from core 3.0 */
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_COPY_READ_BUFFER               0x8F36
+#define GL_COPY_WRITE_BUFFER              0x8F37
+#endif
+
 #ifndef GL_EXT_abgr
 #define GL_ABGR_EXT                       0x8000
 #endif
@@ -3878,6 +3942,26 @@ extern "C" {
 #define GL_PERFMON_RESULT_AMD             0x8BC6
 #endif
 
+#ifndef GL_AMD_texture_texture4
+#endif
+
+#ifndef GL_AMD_vertex_shader_tesselator
+#define GL_SAMPLER_BUFFER_AMD             0x9001
+#define GL_INT_SAMPLER_BUFFER_AMD         0x9002
+#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003
+#define GL_TESSELLATION_MODE_AMD          0x9004
+#define GL_TESSELLATION_FACTOR_AMD        0x9005
+#define GL_DISCRETE_AMD                   0x9006
+#define GL_CONTINUOUS_AMD                 0x9007
+#endif
+
+#ifndef GL_EXT_provoking_vertex
+#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C
+#define GL_FIRST_VERTEX_CONVENTION_EXT    0x8E4D
+#define GL_LAST_VERTEX_CONVENTION_EXT     0x8E4E
+#define GL_PROVOKING_VERTEX_EXT           0x8E4F
+#endif
+
 
 /*************************************************************/
 
@@ -4503,8 +4587,8 @@ GLAPI void APIENTRY glBeginTransformFeedback (GLenum);
 GLAPI void APIENTRY glEndTransformFeedback (void);
 GLAPI void APIENTRY glBindBufferRange (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
 GLAPI void APIENTRY glBindBufferBase (GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLint *, GLenum);
-GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLint *);
+GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint, GLsizei, const GLchar* *, GLenum);
+GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
 GLAPI void APIENTRY glClampColor (GLenum, GLenum);
 GLAPI void APIENTRY glBeginConditionalRender (GLuint, GLenum);
 GLAPI void APIENTRY glEndConditionalRender (void);
@@ -4562,8 +4646,8 @@ typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
 typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
 typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
 typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLint *location);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
 typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
 typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
 typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
@@ -5321,6 +5405,38 @@ typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
 typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
 #endif
 
+#ifndef GL_ARB_uniform_buffer_object
+#define GL_ARB_uniform_buffer_object 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glGetUniformIndices (GLuint, GLsizei, const GLchar* *, GLuint *);
+GLAPI void APIENTRY glGetActiveUniformsiv (GLuint, GLsizei, const GLuint *, GLenum, GLint *);
+GLAPI void APIENTRY glGetActiveUniformName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint, const GLchar *);
+GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint, GLuint, GLenum, GLint *);
+GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint, GLuint, GLsizei, GLsizei *, GLchar *);
+GLAPI void APIENTRY glUniformBlockBinding (GLuint, GLuint, GLuint);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar* *uniformNames, GLuint *uniformIndices);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
+typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
+typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
+typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+#endif
+
+#ifndef GL_ARB_compatibility
+#define GL_ARB_compatibility 1
+#endif
+
+#ifndef GL_ARB_copy_buffer
+#define GL_ARB_copy_buffer 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glCopyBufferSubData (GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
+#endif
+
 #ifndef GL_EXT_abgr
 #define GL_EXT_abgr 1
 #endif
@@ -8053,16 +8169,16 @@ GLAPI void APIENTRY glEndTransformFeedbackEXT (void);
 GLAPI void APIENTRY glBindBufferRangeEXT (GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
 GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum, GLuint, GLuint, GLintptr);
 GLAPI void APIENTRY glBindBufferBaseEXT (GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLint *, GLenum);
-GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLint *);
+GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint, GLsizei, const GLchar* *, GLenum);
+GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint, GLuint, GLsizei, GLsizei *, GLsizei *, GLenum *, GLchar *);
 #endif /* GL_GLEXT_PROTOTYPES */
 typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);
 typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);
 typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
 typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
 typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLint *location);
+typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
+typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
 #endif
 
 #ifndef GL_EXT_direct_state_access
@@ -8515,6 +8631,28 @@ typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
 typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
 #endif
 
+#ifndef GL_AMD_texture_texture4
+#define GL_AMD_texture_texture4 1
+#endif
+
+#ifndef GL_AMD_vertex_shader_tesselator
+#define GL_AMD_vertex_shader_tesselator 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glTessellationFactorAMD (GLfloat);
+GLAPI void APIENTRY glTessellationModeAMD (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);
+typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);
+#endif
+
+#ifndef GL_EXT_provoking_vertex
+#define GL_EXT_provoking_vertex 1
+#ifdef GL_GLEXT_PROTOTYPES
+GLAPI void APIENTRY glProvokingVertexEXT (GLenum);
+#endif /* GL_GLEXT_PROTOTYPES */
+typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
+#endif
+
 
 #ifdef __cplusplus
 }
index bc490c0..6c15540 100644 (file)
@@ -210,11 +210,17 @@ static void Display(void)
    glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, 1.0, 1.0, 0.0, 0.0);
    glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 0.0, 0.0, 1.0, 1.0);
    glBegin(GL_TRIANGLES);
+
    glColor3f(0,0,1);
+   glTexCoord3f(1,1,0);
    glVertex3f( 0.9, -0.9, -30.0);
+
    glColor3f(1,0,0);
+   glTexCoord3f(1,-1,0);
    glVertex3f( 0.9,  0.9, -30.0);
+
    glColor3f(0,1,0);
+   glTexCoord3f(-1,0,0);
    glVertex3f(-0.9,  0.0, -30.0);
    glEnd();
 
similarity index 100%
rename from progs/fp/kill-pos.txt
rename to progs/fp/kil-pos.txt
diff --git a/progs/fp/kil-texcoord-sgt.txt b/progs/fp/kil-texcoord-sgt.txt
new file mode 100644 (file)
index 0000000..c74fd10
--- /dev/null
@@ -0,0 +1,8 @@
+!!ARBfp1.0
+TEMP R0;
+MUL R0.xy, fragment.texcoord[0], fragment.texcoord[0];
+ADD R0.x, R0.x, R0.y;
+SGE R0.y, R0.x, fragment.texcoord[0].w;
+KIL -R0.y;
+MOV result.color, fragment.color;
+END
index 5fdb4ef..d3e3116 100644 (file)
@@ -6,6 +6,7 @@ deriv
 extfuncs.h
 fragcoord
 identity
+linktest
 mandelbrot
 multinoise
 multitex
index 8061277..0f1a299 100644 (file)
@@ -17,6 +17,7 @@ PROGS = \
        deriv \
        identity \
        fragcoord \
+       linktest \
        mandelbrot \
        multinoise \
        multitex \
@@ -128,6 +129,12 @@ fragcoord: fragcoord.o shaderutil.o
        $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) fragcoord.o shaderutil.o $(LIBS) -o $@
 
 
+linktest.o: linktest.c extfuncs.h shaderutil.h
+       $(APP_CC) -c -I$(INCDIR) $(CFLAGS) linktest.c
+
+linktest: linktest.o shaderutil.o
+       $(APP_CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) linktest.o shaderutil.o $(LIBS) -o $@
+
 mandelbrot.o: mandelbrot.c extfuncs.h shaderutil.h
        $(APP_CC) -c -I$(INCDIR) $(CFLAGS) mandelbrot.c
 
diff --git a/progs/glsl/linktest.c b/progs/glsl/linktest.c
new file mode 100644 (file)
index 0000000..601b24e
--- /dev/null
@@ -0,0 +1,258 @@
+/**
+ * Test linking of multiple compilation units.
+ * Brian Paul
+ * 28 March 2009
+ */
+
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <GL/gl.h>
+#include <GL/glut.h>
+#include <GL/glext.h>
+#include "extfuncs.h"
+#include "shaderutil.h"
+
+
+static GLfloat diffuse[4] = { 0.5f, 1.0f, 0.5f, 1.0f };
+static GLfloat specular[4] = { 0.8f, 0.8f, 0.8f, 1.0f };
+static GLfloat lightPos[4] = { 0.0f, 10.0f, 20.0f, 0.0f };
+static GLfloat delta = 1.0f;
+
+static GLuint VertShader1;
+static GLuint VertShader2;
+static GLuint FragShader1;
+static GLuint FragShader2;
+static GLuint Program;
+
+static GLint uDiffuse;
+static GLint uSpecular;
+static GLint uTexture;
+
+static GLint Win = 0;
+static GLboolean anim = GL_TRUE;
+
+
+
+static const char *FragShaderSource1 =
+   "float compute_dotprod(const vec3 normal) \n"
+   "{ \n"
+   "   float dotProd = max(dot(gl_LightSource[0].position.xyz, \n"
+   "                           normalize(normal)), 0.0); \n"
+   "   return dotProd; \n"
+   "} \n";
+
+static const char *FragShaderSource2 =
+   "uniform vec4 diffuse;\n"
+   "uniform vec4 specular;\n"
+   "varying vec3 normal;\n"
+   "\n"
+   "// external function \n"
+   "float compute_dotprod(const vec3 normal); \n"
+   "\n"
+   "void main() \n"
+   "{ \n"
+   "   float dotProd = compute_dotprod(normal); \n"
+   "   gl_FragColor = diffuse * dotProd + specular * pow(dotProd, 20.0); \n"
+   "} \n";
+
+
+static const char *VertShaderSource1 =
+   "vec3 compute_normal() \n"
+   "{ \n"
+   "   return gl_NormalMatrix * gl_Normal; \n"
+   "} \n";
+
+static const char *VertShaderSource2 =
+   "varying vec3 normal;\n"
+   "\n"
+   "// external function \n"
+   "vec3 compute_normal(); \n"
+   "\n"
+   "void main() \n"
+   "{ \n"
+   "   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; \n"
+   "   normal = compute_normal(); \n"
+   "} \n";
+
+
+static void
+normalize(GLfloat *dst, const GLfloat *src)
+{
+   GLfloat len = sqrt(src[0] * src[0] + src[1] * src[1] + src[2] * src[2]);
+   dst[0] = src[0] / len;
+   dst[1] = src[1] / len;
+   dst[2] = src[2] / len;
+   dst[3] = src[3];
+}
+
+
+static void
+Redisplay(void)
+{
+   GLfloat vec[4];
+
+   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+   /* update light position */
+   normalize(vec, lightPos);
+   glLightfv(GL_LIGHT0, GL_POSITION, vec);
+   
+   glutSolidSphere(2.0, 10, 5);
+
+   glutSwapBuffers();
+}
+
+
+static void
+Idle(void)
+{
+   lightPos[0] += delta;
+   if (lightPos[0] > 25.0f || lightPos[0] < -25.0f)
+      delta = -delta;
+   glutPostRedisplay();
+}
+
+
+static void
+Reshape(int width, int height)
+{
+   glViewport(0, 0, width, height);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+   glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
+   glMatrixMode(GL_MODELVIEW);
+   glLoadIdentity();
+   glTranslatef(0.0f, 0.0f, -15.0f);
+}
+
+
+static void
+CleanUp(void)
+{
+   glDeleteShader_func(VertShader1);
+   glDeleteShader_func(VertShader2);
+   glDeleteShader_func(FragShader1);
+   glDeleteShader_func(FragShader2);
+   glDeleteProgram_func(Program);
+   glutDestroyWindow(Win);
+}
+
+
+static void
+Key(unsigned char key, int x, int y)
+{
+  (void) x;
+  (void) y;
+
+   switch(key) {
+   case ' ':
+   case 'a':
+      anim = !anim;
+      if (anim)
+         glutIdleFunc(Idle);
+      else
+         glutIdleFunc(NULL);
+      break;
+   case 'x':
+      lightPos[0] -= 1.0f;
+      break;
+   case 'X':
+      lightPos[0] += 1.0f;
+      break;
+   case 27:
+      CleanUp();
+      exit(0);
+      break;
+   }
+   glutPostRedisplay();
+}
+
+
+static void
+CheckLink(GLuint prog)
+{
+   GLint stat;
+   glGetProgramiv_func(prog, GL_LINK_STATUS, &stat);
+   if (!stat) {
+      GLchar log[1000];
+      GLsizei len;
+      glGetProgramInfoLog_func(prog, 1000, &len, log);
+      fprintf(stderr, "Linker error:\n%s\n", log);
+   }
+}
+
+
+static void
+Init(void)
+{
+   if (!ShadersSupported())
+      exit(1);
+
+   GetExtensionFuncs();
+
+   printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
+
+   VertShader1 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource1);
+   VertShader2 = CompileShaderText(GL_VERTEX_SHADER, VertShaderSource2);
+   FragShader1 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource1);
+   FragShader2 = CompileShaderText(GL_FRAGMENT_SHADER, FragShaderSource2);
+
+   Program = glCreateProgram_func();
+   glAttachShader_func(Program, VertShader1);
+   glAttachShader_func(Program, VertShader2);
+   glAttachShader_func(Program, FragShader1);
+   glAttachShader_func(Program, FragShader2);
+
+   glLinkProgram_func(Program);
+
+   CheckLink(Program);
+
+   glUseProgram_func(Program);
+
+   uDiffuse = glGetUniformLocation_func(Program, "diffuse");
+   uSpecular = glGetUniformLocation_func(Program, "specular");
+   uTexture = glGetUniformLocation_func(Program, "texture");
+   printf("DiffusePos %d  SpecularPos %d  TexturePos %d\n",
+          uDiffuse, uSpecular, uTexture);
+
+   glUniform4fv_func(uDiffuse, 1, diffuse);
+   glUniform4fv_func(uSpecular, 1, specular);
+
+   glClearColor(0.3f, 0.3f, 0.3f, 0.0f);
+   glEnable(GL_DEPTH_TEST);
+
+   glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diffuse);
+   glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specular);
+   glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 10.0f);
+
+   assert(glIsProgram_func(Program));
+   assert(glIsShader_func(VertShader1));
+   assert(glIsShader_func(VertShader2));
+   assert(glIsShader_func(FragShader1));
+   assert(glIsShader_func(FragShader2));
+
+   glColor3f(1, 0, 0);
+}
+
+
+int
+main(int argc, char *argv[])
+{
+   glutInit(&argc, argv);
+   glutInitWindowPosition( 0, 0);
+   glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+   Win = glutCreateWindow(argv[0]);
+   glutReshapeFunc(Reshape);
+   glutKeyboardFunc(Key);
+   glutDisplayFunc(Redisplay);
+   if (anim)
+      glutIdleFunc(Idle);
+   Init();
+   glutMainLoop();
+   return 0;
+}
+
+
index 0ed3a88..e6369de 100644 (file)
@@ -45,7 +45,10 @@ invert
 jkrahntest
 lineclip
 manytex
+mapbufrange
+mapvbo
 minmag
+mipgen
 mipmap_limits
 mipmap_view
 multipal
@@ -54,10 +57,12 @@ packedpixels
 pbo
 prog_parameter
 projtex
+quads
 random
 readrate
 readtex.c
 readtex.h
+rubberband
 seccolor
 sharedtex
 shader_api
index cfeb9d1..bf1e7f8 100644 (file)
@@ -105,6 +105,7 @@ progs = [
     'subtexrate',
     'tex1d',
     'texcmp',
+    'texcompress2',
     'texfilt',
     'texgenmix',
     'texline',
index 3e8e990..cbb8f1d 100644 (file)
@@ -7,7 +7,6 @@
 #include <stdio.h>
 #include <GL/glew.h>
 #include <GL/glut.h>
-#include <GL/glx.h>
 #include "readtex.c"
 
 #define IMAGE_FILE "../images/arch.rgb"
index aec4c94..8dcb20a 100644 (file)
@@ -96,6 +96,7 @@ tri-lit
 tri-logicop-none
 tri-logicop-xor
 tri-mask-tri
+tri-multitex-vbo
 tri-orig
 tri-query
 tri-repeat
index 082387d..69c71cb 100644 (file)
@@ -111,6 +111,7 @@ SOURCES = \
        tri-scissor-tri.c \
        tri-stencil.c \
        tri-stipple.c \
+       tri-multitex-vbo.c \
        tri-tex.c \
        tri-tex-3d.c \
        tri-tri.c \
index 6a9ffaf..480630e 100644 (file)
@@ -107,6 +107,7 @@ progs = [
        'tri-scissor-tri',
        'tri-stencil',
        'tri-stipple',
+       'tri-multitex-vbo',
        'tri-tex',
        'tri-tex-3d',
        'tri-tri',
index eccfde5..a206676 100644 (file)
@@ -27,6 +27,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
 
    if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
index 64b2543..0aeb454 100644 (file)
@@ -23,6 +23,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
 
    if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
index f3a67db..e3da23a 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
 }
 
index 9c618d4..f966adb 100644 (file)
@@ -38,6 +38,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.3, 0.1, 0.3, 0.0);
 }
index 5e2025b..0173532 100644 (file)
@@ -16,6 +16,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 }
 
 static void Reshape(int width, int height)
index ce066bf..5ec33bf 100644 (file)
@@ -17,6 +17,7 @@ static void Init(void)
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
    fprintf(stderr, "Top right corner should be red\n");
+   fflush(stderr);
 }
 
 static void Reshape(int width, int height)
index 37cfd54..03857b4 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 44d5b1b..f2cc6f1 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 64054ec..de10628 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 
index 1b66244..3d3aaeb 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 
index 3501006..8002129 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 
index bcee32e..5276baf 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 9821873..1e1b77a 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index f030de9..9c4b9a0 100644 (file)
@@ -44,10 +44,12 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
    glGetFloatv(GL_LINE_WIDTH_RANGE, aarange);
    glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, range);
    printf("Non-AA line width range: %f .. %f\n", range[0], range[1]);
    printf("AA line width range: %f .. %f\n", aarange[0], aarange[1]);
+   fflush(stdout);
 }
 
 
index 28d96c7..1804ffa 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 1b9f059..8e030b4 100644 (file)
@@ -41,6 +41,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);   
    glClipPlane(GL_CLIP_PLANE0, plane);
index 9f144a6..6fcd4bc 100644 (file)
@@ -41,6 +41,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);   
    glClipPlane(GL_CLIP_PLANE0, plane);
index 7588fae..e59fd13 100644 (file)
@@ -41,6 +41,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);   
    glClipPlane(GL_CLIP_PLANE0, plane);
index 77d8228..e30be55 100644 (file)
@@ -41,6 +41,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);   
    glClipPlane(GL_CLIP_PLANE0, plane);
index f205053..b74021d 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 7ccbce3..e1d7328 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index fbeca98..45fa474 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 5863df6..c290dbd 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index dae27c3..f252822 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index ee79f15..5caa724 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index c6307d5..701c82c 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 2b40b5f..df2eef9 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 865a752..0219b1a 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index f2a29a9..4b6c412 100644 (file)
@@ -53,6 +53,7 @@ Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.3, 0.1, 0.3, 0.0);
 
index 6aaee0d..4c89ba5 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 1edeec3..6f43720 100644 (file)
@@ -38,6 +38,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 2f8226e..5d29a6a 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
 
 #define SIZE 16
index 63f83ba..f6e9b8d 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 725edae..8abd64c 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 3c472c1..49959dc 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index d58a3a3..5490068 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 74249eb..26b90ef 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 82098bc..a4e3cdb 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 5cc8523..2ad443d 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 8944f14..e5b788e 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 6559adf..60c87fc 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 0e4f4c9..9380e4f 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    fprintf(stderr, "Press z/Z to translate quad\n");
 
index fd3522a..063de61 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 29fb277..fdc142b 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 570eb6b..e3147b3 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 2c4946a..dfe99bb 100644 (file)
@@ -34,6 +34,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(1.0, 1.0, 1.0, 0.0);
 }
index 4076282..0659002 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(1.0, 1.0, 1.0, 0.0);
 }
index b4b138b..922529d 100644 (file)
@@ -34,6 +34,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(1.0, 1.0, 1.0, 0.0);
 }
index ed6f4a0..8a886ef 100644 (file)
@@ -38,6 +38,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 
index 84acb35..d05131d 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 
index be24255..eebaf91 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 
index dcb4ae0..ad41a9a 100644 (file)
@@ -42,6 +42,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 
index aabbb9e..5620dbc 100644 (file)
@@ -89,6 +89,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 
index e25a34b..761878b 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index d33e591..cd7d276 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index b60af3e..d64f17f 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index c4773ec..d360e30 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 5bc6221..fe11fef 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 82a6d4e..4cea81a 100644 (file)
@@ -34,6 +34,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 62208df..3295235 100644 (file)
@@ -34,6 +34,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 9011ee0..228c6c2 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 6923afc..d49a9a5 100644 (file)
@@ -34,6 +34,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 88aac26..5671618 100644 (file)
@@ -17,6 +17,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
    glClearColor(0.3, 0.1, 0.3, 0.0);
 }
 
index 382d7b2..780ebe6 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 
index 1a65371..aec1cbb 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index db831e3..92f0192 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
 }
 
index a3908e3..f49186b 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 0d31086..e1deca1 100644 (file)
@@ -37,6 +37,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
    glClearColor(0.0, 0.0, 1.0, 0.0);
 }
 
index 73c5583..864be71 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
    glCullFace(GL_FRONT_AND_BACK);
index c6bcf44..c71ad9a 100644 (file)
@@ -60,6 +60,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
    glClearColor(0.0, 0.0, 1.0, 0.0);
    cull();
 }
index 1c0e320..c410be2 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 
index e1278dd..4c8736a 100644 (file)
@@ -35,6 +35,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 }
 
 static void Reshape(int width, int height)
index 7a38f21..1ed177f 100644 (file)
@@ -23,6 +23,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
 
    if (!glutExtensionSupported("GL_EXT_framebuffer_object")) {
index 3235100..2aab5ba 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.5, 0.5, 0.5, 0.0);
 }
index a7fdaa1..ea703ec 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.5, 0.5, 0.5, 0.0);
 }
index 0099a90..0cea3d3 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 
index 2b14999..d2df442 100644 (file)
@@ -51,6 +51,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    /* Setup the fragment program */
    glGenProgramsARB(1, &prognum);
index b30f9b7..4d15081 100644 (file)
@@ -49,6 +49,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    /* Setup the fragment program */
    glGenProgramsARB(1, &prognum);
index 91fac1a..15a7ad2 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
index aba3614..53c2614 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.3, 0.1, 0.3, 0.0);
 }
index e2c94f9..f018a85 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.3, 0.1, 0.3, 0.0);
 }
index 449125a..d626209 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
    glClearColor(0.0, 0.0, 1.0, 0.0);
 }
 
diff --git a/progs/trivial/tri-multitex-vbo.c b/progs/trivial/tri-multitex-vbo.c
new file mode 100644 (file)
index 0000000..e319447
--- /dev/null
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the name of
+ * Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Silicon Graphics.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
+ * ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <GL/glew.h>
+#include <GL/glut.h>
+
+#define NR_VERTS 4
+
+struct {
+   GLfloat position[NR_VERTS][4];
+   GLubyte color[NR_VERTS][4];
+   GLfloat tex0[NR_VERTS][2];
+   GLfloat tex1[NR_VERTS][2];
+} verts = {
+
+   { {  0.9, -0.9, 0.0, 1.0 },
+     {  0.9,  0.9, 0.0, 1.0 },
+     { -0.9,  0.9, 0.0, 1.0 },
+     { -0.9, -0.9, 0.0, 1.0 } },
+
+   { { 0x00, 0x00, 0xff, 0x00 },
+     { 0x00, 0xff, 0x00, 0x00 },
+     { 0xff, 0x00, 0x00, 0x00 },
+     { 0xff, 0xff, 0xff, 0x00 }
+   },
+
+   { {  1, -1 },
+     {  1,  1 },
+     { -1,  1 },
+     { -1, -1 } },
+
+   { { 3, 0 },
+     { 0, 3 },
+     { -3, 0 },
+     {  0, -3} },
+
+};
+
+GLuint indices[] = { 0, 1, 2, 3 };
+
+GLuint arrayObj, elementObj;
+
+
+GLenum doubleBuffer;
+
+
+#define Offset(ptr, member) (void *)((const char *)&((ptr)->member) - (const char *)(ptr))
+
+static void Init(void)
+{
+   GLuint texObj[2];
+
+   fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
+   fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
+   fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
+
+    glClearColor(0.0, 0.0, 1.0, 0.0);
+
+   glGenTextures(2, texObj);
+
+#define SIZE 32
+   {
+      GLubyte tex2d[SIZE][SIZE][3];
+      GLint s, t;
+
+      for (s = 0; s < SIZE; s++) {
+        for (t = 0; t < SIZE; t++) {
+           tex2d[t][s][0] = s*255/(SIZE-1);
+           tex2d[t][s][1] = t*255/(SIZE-1);
+           tex2d[t][s][2] = 0;
+        }
+      }
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+      glActiveTextureARB(GL_TEXTURE0_ARB);
+      glBindTexture(GL_TEXTURE_2D, texObj[0]);
+
+
+      glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0,
+                   GL_RGB, GL_UNSIGNED_BYTE, tex2d);
+
+      glEnable(GL_TEXTURE_2D);
+      glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT);
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+   }
+
+   {
+      GLubyte tex2d[SIZE][SIZE][3];
+      GLint s, t;
+
+      for (s = 0; s < SIZE; s++) {
+        for (t = 0; t < SIZE; t++) {
+            GLboolean on = ((s/4) ^ (t/4)) & 1;
+           tex2d[t][s][0] = on ? 128 : 0;
+           tex2d[t][s][1] = on ? 128 : 0;
+           tex2d[t][s][2] = on ? 128 : 0;
+        }
+      }
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+      glActiveTextureARB(GL_TEXTURE1_ARB);
+      glBindTexture(GL_TEXTURE_2D, texObj[1]);
+
+      glTexImage2D(GL_TEXTURE_2D, 0, 3, SIZE, SIZE, 0,
+                   GL_RGB, GL_UNSIGNED_BYTE, tex2d);
+
+      glEnable(GL_TEXTURE_2D);
+      glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_R, GL_REPEAT);
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+      glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+      glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
+   }
+
+   glActiveTextureARB( GL_TEXTURE0_ARB );
+
+
+   {
+
+      glGenBuffersARB(1, &arrayObj);
+      glGenBuffersARB(1, &elementObj);
+   
+      glBindBufferARB(GL_ARRAY_BUFFER_ARB, arrayObj);
+      glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementObj);
+
+      glBufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), &verts, GL_STATIC_DRAW_ARB);
+      glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(indices), indices, GL_STATIC_DRAW_ARB);
+
+      glEnableClientState( GL_VERTEX_ARRAY );
+      glVertexPointer( 4, GL_FLOAT, 0, Offset(&verts, position) );
+
+      glEnableClientState( GL_COLOR_ARRAY );
+      glColorPointer( 4, GL_UNSIGNED_BYTE, 0, Offset(&verts, color) );
+
+      glClientActiveTextureARB( GL_TEXTURE0_ARB );
+      glEnableClientState( GL_TEXTURE_COORD_ARRAY );
+      glTexCoordPointer( 2, GL_FLOAT, 0, Offset(&verts, tex0) );
+
+      glClientActiveTextureARB( GL_TEXTURE1_ARB );
+      glEnableClientState( GL_TEXTURE_COORD_ARRAY );
+      glTexCoordPointer( 2, GL_FLOAT, 0, Offset(&verts, tex1) );
+
+      glClientActiveTextureARB( GL_TEXTURE0_ARB );
+   }
+}
+
+static void Reshape(int width, int height)
+{
+
+    glViewport(0, 0, (GLint)width, (GLint)height);
+
+    glMatrixMode(GL_PROJECTION);
+    glLoadIdentity();
+/*     glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0); */
+    glMatrixMode(GL_MODELVIEW);
+}
+
+static void Key(unsigned char key, int x, int y)
+{
+
+    switch (key) {
+      case 27:
+       exit(1);
+      default:
+       return;
+    }
+
+    glutPostRedisplay();
+}
+
+static void Draw(void)
+{
+   glClear(GL_COLOR_BUFFER_BIT); 
+
+   glDrawElements( GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL );
+
+   glFlush();
+
+   if (doubleBuffer) {
+      glutSwapBuffers();
+   }
+}
+
+static GLenum Args(int argc, char **argv)
+{
+    GLint i;
+
+    doubleBuffer = GL_FALSE;
+
+    for (i = 1; i < argc; i++) {
+        if (strcmp(argv[i], "-sb") == 0) {
+           doubleBuffer = GL_FALSE;
+       } else if (strcmp(argv[i], "-db") == 0) {
+           doubleBuffer = GL_TRUE;
+       } else {
+           fprintf(stderr, "%s (Bad option).\n", argv[i]);
+           return GL_FALSE;
+       }
+    }
+    return GL_TRUE;
+}
+
+int main(int argc, char **argv)
+{
+    GLenum type;
+
+    glutInit(&argc, argv);
+
+    if (Args(argc, argv) == GL_FALSE) {
+       exit(1);
+    }
+
+    glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
+
+    type = GLUT_RGB | GLUT_ALPHA;
+    type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
+    glutInitDisplayMode(type);
+
+    if (glutCreateWindow(*argv) == GL_FALSE) {
+       exit(1);
+    }
+
+    glewInit();
+    Init();
+
+    glutReshapeFunc(Reshape);
+    glutKeyboardFunc(Key);
+    glutDisplayFunc(Draw);
+    glutMainLoop();
+       return 0;
+}
index 6861ff6..e7cfee3 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 9b319ba..85e39df 100644 (file)
@@ -42,6 +42,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 
index a271fab..91e355c 100644 (file)
@@ -38,6 +38,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.3, 0.1, 0.3, 0.0);
 }
index 2b5536e..608ebf2 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 9102888..0b82a1d 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 33e6dd1..aa94fa2 100644 (file)
@@ -51,6 +51,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glEnable (GL_POLYGON_STIPPLE);
     glPolygonStipple (fly);
index 4f276af..3ccbe12 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 
index 1dbbe6a..56afb47 100644 (file)
@@ -36,6 +36,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 
index 8b0c2da..f996bd0 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 438899d..2fd894a 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 78c5ae8..11c21d1 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 113b8d0..c6ecc70 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index b050280..750a254 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 9306af8..eddae17 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 775c353..1d42b40 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
   glEnable(GL_LIGHTING);
   glEnable(GL_LIGHT0);
index ce78925..695cc89 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 6835b53..ddc0dff 100644 (file)
@@ -41,6 +41,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);   
    glClipPlane(GL_CLIP_PLANE0, plane);
index aab5abc..0dec0bf 100644 (file)
@@ -41,6 +41,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);   
    glClipPlane(GL_CLIP_PLANE0, plane);
index 4f50d08..b98cb9a 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 43d19ce..8f37e0f 100644 (file)
@@ -41,6 +41,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.0, 0.0, 1.0, 0.0);   
    glClipPlane(GL_CLIP_PLANE0, plane);
index 3205b9e..8e5f155 100644 (file)
@@ -35,6 +35,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.3, 0.1, 0.3, 0.0);
 }
index e7d4184..099e89f 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
 }
 
index 4ec55ac..b81c992 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
 }
 
index d99d587..d44cb6a 100644 (file)
@@ -40,6 +40,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
    glClearColor(0.3, 0.1, 0.3, 0.0);
 }
index ec7a50a..199f91a 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 4887b5a..ea3e155 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index cf75d4c..d69b488 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 491fe5b..91447e4 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index ee9854d..84eb417 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index eeab676..343e293 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 49bb432..02da97e 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
index 023e647..77bf2fa 100644 (file)
@@ -39,6 +39,7 @@ static void Init(void)
    fprintf(stderr, "GL_RENDERER   = %s\n", (char *) glGetString(GL_RENDERER));
    fprintf(stderr, "GL_VERSION    = %s\n", (char *) glGetString(GL_VERSION));
    fprintf(stderr, "GL_VENDOR     = %s\n", (char *) glGetString(GL_VENDOR));
+   fflush(stderr);
 
     glClearColor(0.0, 0.0, 1.0, 0.0);
 }
diff --git a/progs/vp/psiz-imm.txt b/progs/vp/psiz-imm.txt
new file mode 100644 (file)
index 0000000..18de249
--- /dev/null
@@ -0,0 +1,5 @@
+!!ARBvp1.0
+MOV result.color, vertex.color; 
+MOV result.pointsize, {2.0, 0, 0, 1};
+MOV  result.position, vertex.position;
+END
diff --git a/progs/vp/psiz-mul-clamp.txt b/progs/vp/psiz-mul-clamp.txt
new file mode 100644 (file)
index 0000000..284c032
--- /dev/null
@@ -0,0 +1,9 @@
+!!ARBvp1.0
+TEMP R0;
+MOV result.color, vertex.color; 
+MUL R0.x, vertex.color.x, {10.0}.x; 
+MAX R0.x, R0.x, {2.0}.x; 
+MIN result.pointsize.x, R0.x, {4.0}.x; 
+MOV  result.position, vertex.position;
+END
+
diff --git a/progs/vp/psiz-param-clamp.txt b/progs/vp/psiz-param-clamp.txt
new file mode 100644 (file)
index 0000000..7f83fc4
--- /dev/null
@@ -0,0 +1,10 @@
+!!ARBvp1.0
+TEMP R0;
+TEMP R1;
+MOV result.color, vertex.color; 
+MUL R0.x, vertex.color.x, {10.0}.x; 
+MAX R0.x, R0.x, {2.0}.x; 
+MIN result.pointsize.x, R0.x, {4.0}.x; 
+MOV  result.position, vertex.position;
+END
+
diff --git a/progs/vpglsl/SConscript b/progs/vpglsl/SConscript
new file mode 100644 (file)
index 0000000..640c5dd
--- /dev/null
@@ -0,0 +1,13 @@
+Import('env')
+
+if not env['GLUT']:
+    Return()
+
+env = env.Clone()
+
+env.Prepend(LIBS = ['$GLUT_LIB'])
+
+env.Program(
+        target = 'vp-tris',
+        source = ['vp-tris.c'],
+    )
index bb353e3..6581df8 100644 (file)
@@ -99,7 +99,7 @@ xrotfontdemo.o: xrotfontdemo.c xuserotfont.h
        $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) xrotfontdemo.c
 
 corender: corender.o ipc.o
-       $(APP_CC) $(CFLAGS) corender.o ipc.o $(LIBS) -o $@
+       $(APP_CC) $(CFLAGS) $(LDFLAGS) corender.o ipc.o $(LIBS) -o $@
 
 corender.o: corender.c ipc.h
        $(APP_CC) -c -I. -I$(INCDIR) $(X11_INCLUDES) $(CFLAGS) corender.c
index ecdeef0..e2cd054 100644 (file)
@@ -198,14 +198,17 @@ def generate(env):
             env['toolchain'] = 'wcesdk'
     env.Tool(env['toolchain'])
 
+    env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
+    env['msvc'] = env['CC'] == 'cl'
+
     # shortcuts
     debug = env['debug']
     machine = env['machine']
     platform = env['platform']
     x86 = env['machine'] == 'x86'
     ppc = env['machine'] == 'ppc'
-    gcc = env['platform'] in ('linux', 'freebsd', 'darwin') or env['toolchain'] == 'crossmingw'
-    msvc = env['platform'] in ('windows', 'winddk', 'wince') and env['toolchain'] != 'crossmingw'
+    gcc = env['gcc']
+    msvc = env['msvc']
 
     # Put build output in a separate dir, which depends on the current
     # configuration. See also http://www.scons.org/wiki/AdvancedBuildExample
@@ -248,9 +251,12 @@ def generate(env):
             ('WINVER', '0x0501'),
             # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
             'WIN32_LEAN_AND_MEAN',
-            'VC_EXTRALEAN',
-            '_CRT_SECURE_NO_DEPRECATE',
         ]
+        if msvc:
+            cppdefines += [
+                'VC_EXTRALEAN',
+                '_CRT_SECURE_NO_DEPRECATE',
+            ]
         if debug:
             cppdefines += ['_DEBUG']
     if platform == 'winddk':
index 01a374e..03563e4 100644 (file)
@@ -303,14 +303,17 @@ def generate(env):
     # Load tool chain
     env.Tool(env['toolchain'])
 
+    env['gcc'] = 'gcc' in os.path.basename(env['CC']).split('-')
+    env['msvc'] = env['CC'] == 'cl'
+
     # shortcuts
     debug = env['debug']
     machine = env['machine']
     platform = env['platform']
     x86 = env['machine'] == 'x86'
     ppc = env['machine'] == 'ppc'
-    gcc = env['platform'] in ('linux', 'freebsd', 'darwin') or env['toolchain'] == 'crossmingw'
-    msvc = env['platform'] in ('windows', 'winddk', 'wince') and env['toolchain'] != 'crossmingw'
+    gcc = env['gcc']
+    msvc = env['msvc']
 
     # C preprocessor options
     cppdefines = []
@@ -328,9 +331,12 @@ def generate(env):
             #'UNICODE',
             # http://msdn2.microsoft.com/en-us/library/6dwk3a1z.aspx,
             #'WIN32_LEAN_AND_MEAN',
-            'VC_EXTRALEAN',
-            '_CRT_SECURE_NO_DEPRECATE',
         ]
+        if msvc:
+            cppdefines += [
+                'VC_EXTRALEAN',
+                '_CRT_SECURE_NO_DEPRECATE',
+            ]
         if debug:
             cppdefines += ['_DEBUG']
     if platform == 'winddk':
index 539184d..9e94d05 100644 (file)
@@ -38,7 +38,7 @@ import os.path
 def generate(env):
     # See http://www.scons.org/wiki/PythonExtensions
     
-    if sys.platform in ['windows']:
+    if sys.platform in ['win32']:
         python_root = sys.prefix
         python_version = '%u%u' % sys.version_info[:2]
         python_include = os.path.join(python_root, 'include')
@@ -56,6 +56,8 @@ def generate(env):
         cppdefines = env['CPPDEFINES']
         cppdefines = [define for define in cppdefines if define != '_DEBUG']
         env.Replace(CPPDEFINES = cppdefines)
+        env.AppendUnique(CPPFLAGS = ['/U_DEBUG'])
+        env.AppendUnique(LINKFLAGS = ['/nodefaultlib:python25_d.lib'])
     else:
         #env.ParseConfig('python-config --cflags --ldflags --libs')
         env.AppendUnique(CPPPATH = [distutils.sysconfig.get_python_inc()])
diff --git a/scons/winsdk.py b/scons/winsdk.py
new file mode 100644 (file)
index 0000000..255f9c5
--- /dev/null
@@ -0,0 +1,139 @@
+"""winsdk
+
+Tool-specific initialization for Microsoft Windows SDK.
+
+"""
+
+#
+# Copyright (c) 2001-2007 The SCons Foundation
+# Copyright (c) 2008 Tungsten Graphics, Inc.
+# Copyright (c) 2009 VMware, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+import os.path
+import platform
+
+import SCons.Errors
+import SCons.Util
+
+import msvc_sa
+import mslib_sa
+import mslink_sa
+
+
+def get_vs_root(env):
+    # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7 
+    path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0')
+    return path 
+
+def get_vs_paths(env):
+    vs_root = get_vs_root(env)
+    if vs_root is None:
+        raise SCons.Errors.InternalError, "WINSDK compiler not found"
+
+    tool_path = os.path.join(vs_root, 'Common7', 'IDE')
+
+    env.PrependENVPath('PATH', tool_path)
+
+def get_vc_root(env):
+    # TODO: Check HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VC7 
+    path = os.path.join(os.getenv('ProgramFiles', r'C:\Program Files'), 'Microsoft Visual Studio 9.0', 'VC')
+    return path 
+
+def get_vc_paths(env):
+    vc_root = get_vc_root(env)
+    if vc_root is None:
+        raise SCons.Errors.InternalError, "WINSDK compiler not found"
+
+    target_cpu = env['machine']
+
+    if target_cpu in ('generic', 'x86'):
+        bin_dir = 'bin'
+        lib_dir = 'lib'
+    elif target_cpu == 'x86_64':
+        # TODO: take in consideration the host cpu
+        bin_dir = r'bin\x86_amd64'
+        lib_dir = r'lib\amd64'
+    else:
+        raise SCons.Errors.InternalError, "Unsupported target machine"
+    include_dir = 'include'
+
+    exe_path     = os.path.join(vc_root, bin_dir)
+    include_path = os.path.join(vc_root, include_dir)
+    lib_path     = os.path.join(vc_root, lib_dir)
+
+    env.PrependENVPath('INCLUDE', include_path)
+    env.PrependENVPath('LIB', lib_path)
+    env.PrependENVPath('PATH', exe_path)
+
+def get_sdk_root(env):
+    if SCons.Util.can_read_reg:
+        key = r'SOFTWARE\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder'
+        try:
+            path, t = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, key)
+        except SCons.Util.RegError:
+            pass
+        else:
+            return path
+
+    return None 
+
+def get_sdk_paths(env):
+    sdk_root = get_sdk_root(env)
+    if sdk_root is None:
+        raise SCons.Errors.InternalError, "WINSDK not found"
+
+    target_cpu = env['machine']
+
+    bin_dir = 'Bin'
+    if target_cpu in ('generic', 'x86'):
+        lib_dir = 'Lib'
+    elif target_cpu == 'x86_64':
+        lib_dir = 'Lib/x64'
+    else:
+        raise SCons.Errors.InternalError, "Unsupported target machine"
+    include_dir = 'Include'
+
+    exe_path     = os.path.join(sdk_root, bin_dir)
+    include_path = os.path.join(sdk_root, include_dir)
+    lib_path     = os.path.join(sdk_root, lib_dir)
+
+    env.PrependENVPath('INCLUDE', include_path)
+    env.PrependENVPath('LIB', lib_path)
+    env.PrependENVPath('PATH', exe_path)
+
+def generate(env):
+    if not env.has_key('ENV'):
+        env['ENV'] = {}
+    
+    get_vs_paths(env)
+    get_vc_paths(env)
+    get_sdk_paths(env)
+
+    msvc_sa.generate(env)
+    mslib_sa.generate(env)
+    mslink_sa.generate(env)
+
+def exists(env):
+    return get_vc_root(env) is not None and get_sdk_root(env) is not None
+
+# vim:set ts=4 sw=4 et:
index be2f9b6..4041d5c 100644 (file)
@@ -48,7 +48,8 @@ $(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
                -major 1 -minor 0 \
                -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
 
-install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
+install:
+       $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
        $(INSTALL) $(TOP)/$(LIB_DIR)/libEGLdri.so $(DESTDIR)$(INSTALL_LIB_DIR)
 
 clean:
index 090a230..5f041a2 100644 (file)
@@ -56,7 +56,8 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
                -install $(TOP)/$(LIB_DIR) \
                $(OBJECTS) $(DRM_LIB) $(MISC_LIBS)
 
-install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
+install:
+       $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
        $(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
 
 clean:
index db4b710..eb83867 100644 (file)
@@ -52,7 +52,8 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
                -install $(TOP)/$(LIB_DIR) \
                $(OBJECTS) $(DRM_LIB) $(MISC_LIBS)
 
-install: $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
+install:
+       $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
        $(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
 
 clean:
index 7061df6..138dc72 100644 (file)
@@ -192,8 +192,8 @@ _eglFillInConfigs(_EGLConfig * configs,
 
    if ( bytes_per_pixel[index] == 0 ) {
       _eglLog(_EGL_INFO,
-              "[%s:%u] Framebuffer type 0x%04x has 0 bytes per pixel.",
-              __FUNCTION__, __LINE__, fb_type);
+              "[_eglFillInConfigs:%u] Framebuffer type 0x%04x has 0 bytes per pixel.",
+              __LINE__, fb_type);
       return GL_FALSE;
    }
 
@@ -227,8 +227,8 @@ _eglFillInConfigs(_EGLConfig * configs,
 
    default:
       _eglLog(_EGL_WARNING,
-              "[%s:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.",
-              __FUNCTION__, __LINE__, fb_format);
+              "[_eglFillInConfigs:%u] Framebuffer format 0x%04x is not GL_RGB, GL_RGBA, GL_BGR, or GL_BGRA.",
+              __LINE__, fb_format);
       return GL_FALSE;
    }
 
index 5008086..3133abe 100644 (file)
@@ -286,7 +286,7 @@ aa_transform_inst(struct tgsi_transform_context *ctx,
       ctx->emit_instruction(ctx, &newInst);
 #endif
 
-      /* SGT t0.y, t0.xxxx, t0.wwww;  # bool b = d > 1 (NOTE t0.w == 1) */
+      /* SGT t0.y, t0.xxxx, tex.wwww;  # bool b = d > 1 (NOTE tex.w == 1) */
       newInst = tgsi_default_full_instruction();
       newInst.Instruction.Opcode = TGSI_OPCODE_SGT;
       newInst.Instruction.NumDstRegs = 1;
index c143cf2..554f4ac 100644 (file)
@@ -87,18 +87,17 @@ struct vertex_info
    } attrib[PIPE_MAX_SHADER_INPUTS];
 };
 
-static INLINE int
+static INLINE size_t
 draw_vinfo_size( const struct vertex_info *a )
 {
-   return ((const char *)&a->attrib[a->num_attribs] -
-           (const char *)a);
+   return offsetof(const struct vertex_info, attrib[a->num_attribs]);
 }
 
 static INLINE int
 draw_vinfo_compare( const struct vertex_info *a,
                     const struct vertex_info *b )
 {
-   unsigned sizea = draw_vinfo_size( a );
+   size_t sizea = draw_vinfo_size( a );
    return memcmp( a, b, sizea );
 }
 
@@ -106,7 +105,7 @@ static INLINE void
 draw_vinfo_copy( struct vertex_info *dst,
                  const struct vertex_info *src )
 {
-   unsigned size = draw_vinfo_size( src );
+   size_t size = draw_vinfo_size( src );
    memcpy( dst, src, size );
 }
 
index b3200df..dbbc33f 100644 (file)
@@ -151,6 +151,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
                         output[slot][1],
                         output[slot][2],
                         output[slot][3]);
+            assert(!util_is_inf_or_nan(output[slot][0]));
          }
 #endif
 
index e5f7ee9..712e215 100644 (file)
@@ -1,17 +1,19 @@
 Import('*')
 
+from sys import executable as python_cmd
+
 env.CodeGenerate(
        target = 'u_indices_gen.c', 
        script = 'u_indices_gen.py', 
        source = [],
-       command = 'python $SCRIPT > $TARGET'
+       command = python_cmd + ' $SCRIPT > $TARGET'
 )
 
 env.CodeGenerate(
        target = 'u_unfilled_gen.c', 
        script = 'u_unfilled_gen.py', 
        source = [],
-       command = 'python $SCRIPT > $TARGET'
+       command = python_cmd + ' $SCRIPT > $TARGET'
 )
 
 indices = env.ConvenienceLibrary(
index 2a13159..92b6fd0 100644 (file)
@@ -158,7 +158,7 @@ pb_map(struct pb_buffer *buf,
    assert(buf);
    if(!buf)
       return NULL;
-   assert(p_atomic_read(&buf->base.reference.count) > 0);
+   assert(pipe_is_referenced(&buf->base.reference));
    return buf->vtbl->map(buf, flags);
 }
 
@@ -169,7 +169,7 @@ pb_unmap(struct pb_buffer *buf)
    assert(buf);
    if(!buf)
       return;
-   assert(p_atomic_read(&buf->base.reference.count) > 0);
+   assert(pipe_is_referenced(&buf->base.reference));
    buf->vtbl->unmap(buf);
 }
 
@@ -185,7 +185,7 @@ pb_get_base_buffer( struct pb_buffer *buf,
       offset = 0;
       return;
    }
-   assert(p_atomic_read(&buf->base.reference.count) > 0);
+   assert(pipe_is_referenced(&buf->base.reference));
    assert(buf->vtbl->get_base_buffer);
    buf->vtbl->get_base_buffer(buf, base_buf, offset);
    assert(*base_buf);
@@ -221,7 +221,7 @@ pb_destroy(struct pb_buffer *buf)
    assert(buf);
    if(!buf)
       return;
-   assert(p_atomic_read(&buf->base.reference.count) == 0);
+   assert(!pipe_is_referenced(&buf->base.reference));
    buf->vtbl->destroy(buf);
 }
 
index 1bdf7a0..2cd0b8a 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
 #include <unistd.h>
 #include <sched.h>
 #endif
@@ -115,7 +115,7 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf)
 {
    struct fenced_buffer_list *fenced_list = fenced_buf->list;
 
-   assert(p_atomic_read(&fenced_buf->base.base.reference.count));
+   assert(pipe_is_referenced(&fenced_buf->base.base.reference));
    assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE);
    assert(fenced_buf->fence);
 
@@ -137,7 +137,7 @@ _fenced_buffer_destroy(struct fenced_buffer *fenced_buf)
 {
    struct fenced_buffer_list *fenced_list = fenced_buf->list;
    
-   assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0);
+   assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
    assert(!fenced_buf->fence);
 #ifdef DEBUG
    assert(fenced_buf->head.prev);
@@ -181,7 +181,7 @@ _fenced_buffer_remove(struct fenced_buffer_list *fenced_list,
     * FIXME!!!
     */
 
-   if(!p_atomic_read(&fenced_buf->base.base.reference.count))
+   if(!pipe_is_referenced(&fenced_buf->base.base.reference))
       _fenced_buffer_destroy(fenced_buf);
 }
 
@@ -257,7 +257,7 @@ fenced_buffer_destroy(struct pb_buffer *buf)
    struct fenced_buffer_list *fenced_list = fenced_buf->list;
 
    pipe_mutex_lock(fenced_list->mutex);
-   assert(p_atomic_read(&fenced_buf->base.base.reference.count) == 0);
+   assert(!pipe_is_referenced(&fenced_buf->base.base.reference));
    if (fenced_buf->fence) {
       struct pb_fence_ops *ops = fenced_list->ops;
       if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) {
@@ -573,7 +573,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
    /* Wait on outstanding fences */
    while (fenced_list->numDelayed) {
       pipe_mutex_unlock(fenced_list->mutex);
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
       sched_yield();
 #endif
       _fenced_buffer_list_check_free(fenced_list, 1);
index 010a2ec..3535843 100644 (file)
@@ -112,7 +112,7 @@ _pb_cache_buffer_destroy(struct pb_cache_buffer *buf)
    LIST_DEL(&buf->head);
    assert(mgr->numDelayed);
    --mgr->numDelayed;
-   assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+   assert(!pipe_is_referenced(&buf->base.base.reference));
    pb_reference(&buf->buffer, NULL);
    FREE(buf);
 }
@@ -153,7 +153,7 @@ pb_cache_buffer_destroy(struct pb_buffer *_buf)
    struct pb_cache_manager *mgr = buf->mgr;
 
    pipe_mutex_lock(mgr->mutex);
-   assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+   assert(!pipe_is_referenced(&buf->base.base.reference));
    
    _pb_cache_buffer_list_check_free(mgr);
    
@@ -310,7 +310,7 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr,
       return NULL;
    }
    
-   assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1);
+   assert(pipe_is_referenced(&buf->buffer->base.reference));
    assert(pb_check_alignment(desc->alignment, buf->buffer->base.alignment));
    assert(pb_check_usage(desc->usage, buf->buffer->base.usage));
    assert(buf->buffer->base.size >= size);
index 478682d..f1a05be 100644 (file)
@@ -208,7 +208,7 @@ pb_debug_buffer_destroy(struct pb_buffer *_buf)
 {
    struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
    
-   assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+   assert(!pipe_is_referenced(&buf->base.base.reference));
    
    pb_debug_buffer_check(buf);
 
@@ -315,7 +315,7 @@ pb_debug_manager_create_buffer(struct pb_manager *_mgr,
       return NULL;
    }
    
-   assert(p_atomic_read(&buf->buffer->base.reference.count) >= 1);
+   assert(pipe_is_referenced(&buf->buffer->base.reference));
    assert(pb_check_alignment(real_desc.alignment, buf->buffer->base.alignment));
    assert(pb_check_usage(real_desc.usage, buf->buffer->base.usage));
    assert(buf->buffer->base.size >= real_size);
index fb18dcc..5a342fb 100644 (file)
@@ -97,7 +97,7 @@ mm_buffer_destroy(struct pb_buffer *buf)
    struct mm_buffer *mm_buf = mm_buffer(buf);
    struct mm_pb_manager *mm = mm_buf->mgr;
    
-   assert(p_atomic_read(&mm_buf->base.base.reference.count) == 0);
+   assert(!pipe_is_referenced(&mm_buf->base.base.reference));
    
    pipe_mutex_lock(mm->mutex);
    u_mmFreeMem(mm_buf->block);
index 75b95e1..07fd1a2 100644 (file)
@@ -108,7 +108,7 @@ pool_buffer_destroy(struct pb_buffer *buf)
    struct pool_buffer *pool_buf = pool_buffer(buf);
    struct pool_pb_manager *pool = pool_buf->mgr;
    
-   assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0);
+   assert(!pipe_is_referenced(&pool_buf->base.base.reference));
 
    pipe_mutex_lock(pool->mutex);
    LIST_ADD(&pool_buf->head, &pool->free);
@@ -216,7 +216,7 @@ pool_bufmgr_create_buffer(struct pb_manager *mgr,
    pipe_mutex_unlock(pool->mutex);
    
    pool_buf = LIST_ENTRY(struct pool_buffer, item, head);
-   assert(p_atomic_read(&pool_buf->base.base.reference.count) == 0);
+   assert(!pipe_is_referenced(&pool_buf->base.base.reference));
    pipe_reference_init(&pool_buf->base.base.reference, 1);
    pool_buf->base.base.alignment = desc->alignment;
    pool_buf->base.base.usage = desc->usage;
index a431fd5..724aaad 100644 (file)
@@ -202,7 +202,7 @@ pb_slab_buffer_destroy(struct pb_buffer *_buf)
 
    pipe_mutex_lock(mgr->mutex);
    
-   assert(p_atomic_read(&buf->base.base.reference.count) == 0);
+   assert(!pipe_is_referenced(&buf->base.base.reference));
    
    buf->mapCount = 0;
 
index 1f0923b..01811d5 100644 (file)
@@ -42,7 +42,7 @@
 #endif
 
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
 
 
 /*
@@ -118,7 +118,7 @@ rtasm_exec_free(void *addr)
 }
 
 
-#else /* PIPE_OS_LINUX || PIPE_OS_BSD */
+#else /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
 
 /*
  * Just use regular memory.
@@ -138,4 +138,4 @@ rtasm_exec_free(void *addr)
 }
 
 
-#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
index 5b21a2b..a3f4947 100644 (file)
@@ -262,7 +262,7 @@ TGSI Instruction Specification
   dst.w = round(src.w)
 
 
-1.3.10  EXPBASE2 - Exponent Base 2
+1.3.10  EXPBASE2 - Exponential Base 2
 
   dst.x = pow(2.0, src.x)
   dst.y = pow(2.0, src.x)
@@ -382,9 +382,7 @@ TGSI Instruction Specification
 
 1.5.7  KILP - Predicated Discard
 
-  if (cc.x || cc.y || cc.z || cc.w)
-    discard
-  endif
+  discard
 
 
 1.5.8  LG2 - Logarithm Base 2
@@ -548,7 +546,7 @@ TGSI Instruction Specification
 
 1.6.3  BRA - Branch
 
-  TBD
+  pc = target
 
 
 1.6.4  CAL - Subroutine Call
@@ -1038,3 +1036,74 @@ TGSI Instruction Specification
 
   Alias for ARR.
 
+
+2  Explanation of symbols used
+==============================
+
+
+2.1  Functions
+--------------
+
+
+  abs(x)            Absolute value of x.
+                    |x|
+                    (x < 0.0) ? -x : x
+
+  ceil(x)           Ceiling of x.
+
+  clamp(x,y,z)      Clamp x between y and z.
+                    (x < y) ? y : (x > z) ? z : x
+
+  cos(x)            Cosine of x.
+
+  floor(x)          Floor of x.
+
+  lg2(x)            Logarithm base 2 of x.
+
+  max(x,y)          Maximum of x and y.
+                    (x > y) ? x : y
+
+  min(x,y)          Minimum of x and y.
+                    (x < y) ? x : y
+
+  partialx(x)       Derivative of x relative to fragment's X.
+
+  partialy(x)       Derivative of x relative to fragment's Y.
+
+  pop()             Pop from stack.
+
+  pow(x,y)          Raise x to power of y.
+
+  push(x)           Push x on stack.
+
+  round(x)          Round x.
+
+  sin(x)            Sine of x.
+
+  sqrt(x)           Square root of x.
+
+  trunc(x)          Truncate x.
+
+
+2.2  Keywords
+-------------
+
+
+  discard           Discard fragment.
+
+  dst               First destination register.
+
+  dst0              First destination register.
+
+  pc                Program counter.
+
+  src               First source register.
+
+  src0              First source register.
+
+  src1              Second source register.
+
+  src2              Third source register.
+
+  target            Label of target instruction.
+
index ba807e4..e8bd7cd 100644 (file)
 #define UPDATE_EXEC_MASK(MACH) \
       MACH->ExecMask = MACH->CondMask & MACH->LoopMask & MACH->ContMask & MACH->FuncMask
 
+
+static const union tgsi_exec_channel ZeroVec =
+   { { 0.0, 0.0, 0.0, 0.0 } };
+
+
+#ifdef DEBUG
+static void
+check_inf_or_nan(const union tgsi_exec_channel *chan)
+{
+   assert(!util_is_inf_or_nan(chan->f[0]));
+   assert(!util_is_inf_or_nan(chan->f[1]));
+   assert(!util_is_inf_or_nan(chan->f[2]));
+   assert(!util_is_inf_or_nan(chan->f[3]));
+}
+#endif
+
+
+#ifdef DEBUG
+static void
+print_chan(const char *msg, const union tgsi_exec_channel *chan)
+{
+   debug_printf("%s = {%f, %f, %f, %f}\n",
+                msg, chan->f[0], chan->f[1], chan->f[2], chan->f[3]);
+}
+#endif
+
+
+#ifdef DEBUG
+static void
+print_temp(const struct tgsi_exec_machine *mach, uint index)
+{
+   const struct tgsi_exec_vector *tmp = &mach->Temps[index];
+   int i;
+   debug_printf("Temp[%u] =\n", index);
+   for (i = 0; i < 4; i++) {
+      debug_printf("  %c: { %f, %f, %f, %f }\n",
+                   "XYZW"[i],
+                   tmp->xyzw[i].f[0],
+                   tmp->xyzw[i].f[1],
+                   tmp->xyzw[i].f[2],
+                   tmp->xyzw[i].f[3]);
+   }
+}
+#endif
+
+
+
 /**
  * Initialize machine state by expanding tokens to full instructions,
  * allocating temporary storage, setting up constants, etc.
@@ -278,6 +325,12 @@ tgsi_exec_machine_init(
       mach->Temps[TEMP_3_I].xyzw[TEMP_3_C].f[i] = 3.0f;
       mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C].f[i] = 0.5f;
    }
+
+#ifdef DEBUG
+   /* silence warnings */
+   (void) print_chan;
+   (void) print_temp;
+#endif
 }
 
 
@@ -1281,6 +1334,10 @@ store_dest(
    union tgsi_exec_channel *dst;
    uint execmask = mach->ExecMask;
 
+#ifdef DEBUG
+   check_inf_or_nan(chan);
+#endif
+
    switch (reg->DstRegister.File) {
    case TGSI_FILE_NULL:
       dst = &null;
@@ -1643,7 +1700,7 @@ exec_tex(struct tgsi_exec_machine *mach,
          lodBias = 0.0;
 
       fetch_texel(mach->Samplers[unit],
-                  &r[0], NULL, NULL, lodBias,  /* S, T, P, BIAS */
+                  &r[0], &ZeroVec, &ZeroVec, lodBias,  /* S, T, P, BIAS */
                   &r[0], &r[1], &r[2], &r[3]); /* R, G, B, A */
       break;
 
@@ -1847,7 +1904,7 @@ exec_instruction(
 
    switch (inst->Instruction.Opcode) {
    case TGSI_OPCODE_ARL:
-   /* TGSI_OPCODE_FLOOR */
+   case TGSI_OPCODE_FLOOR:
    /* TGSI_OPCODE_FLR */
       FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) {
          FETCH( &r[0], 0, chan_index );
index 4ffd4ef..0b4b2a6 100644 (file)
@@ -205,8 +205,8 @@ struct tgsi_exec_machine
    const float                   (*Consts)[4];
    struct tgsi_exec_vector       *Inputs;
    struct tgsi_exec_vector       *Outputs;
-   const struct tgsi_token       *Tokens;
-   unsigned                      Processor;
+   const struct tgsi_token       *Tokens;   /**< Declarations, instructions */
+   unsigned                      Processor; /**< TGSI_PROCESSOR_x */
 
    /* GEOMETRY processor only. */
    unsigned                      *Primitives;
index 2b8a6f0..37f2b66 100644 (file)
 
 static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
 {
-   { 1, 1, 0, 0, "ARL" },
-   { 1, 1, 0, 0, "MOV" },
-   { 1, 1, 0, 0, "LIT" },
-   { 1, 1, 0, 0, "RCP" },
-   { 1, 1, 0, 0, "RSQ" },
-   { 1, 1, 0, 0, "EXP" },
-   { 1, 1, 0, 0, "LOG" },
-   { 1, 2, 0, 0, "MUL" },
-   { 1, 2, 0, 0, "ADD" },
-   { 1, 2, 0, 0, "DP3" },
-   { 1, 2, 0, 0, "DP4" },
-   { 1, 2, 0, 0, "DST" },
-   { 1, 2, 0, 0, "MIN" },
-   { 1, 2, 0, 0, "MAX" },
-   { 1, 2, 0, 0, "SLT" },
-   { 1, 2, 0, 0, "SGE" },
-   { 1, 3, 0, 0, "MAD" },
-   { 1, 2, 0, 0, "SUB" },
-   { 1, 3, 0, 0, "LERP" },
-   { 1, 3, 0, 0, "CND" },
-   { 1, 3, 0, 0, "CND0" },
-   { 1, 3, 0, 0, "DOT2ADD" },
-   { 1, 2, 0, 0, "INDEX" },
-   { 1, 1, 0, 0, "NEGATE" },
-   { 1, 1, 0, 0, "FRAC" },
-   { 1, 3, 0, 0, "CLAMP" },
-   { 1, 1, 0, 0, "FLOOR" },
-   { 1, 1, 0, 0, "ROUND" },
-   { 1, 1, 0, 0, "EXPBASE2" },
-   { 1, 1, 0, 0, "LOGBASE2" },
-   { 1, 2, 0, 0, "POWER" },
-   { 1, 2, 0, 0, "CROSSPRODUCT" },
-   { 1, 2, 0, 0, "MULTIPLYMATRIX" },
-   { 1, 1, 0, 0, "ABS" },
-   { 1, 1, 0, 0, "RCC" },
-   { 1, 2, 0, 0, "DPH" },
-   { 1, 1, 0, 0, "COS" },
-   { 1, 1, 0, 0, "DDX" },
-   { 1, 1, 0, 0, "DDY" },
-   { 0, 0, 0, 0, "KILP" },
-   { 1, 1, 0, 0, "PK2H" },
-   { 1, 1, 0, 0, "PK2US" },
-   { 1, 1, 0, 0, "PK4B" },
-   { 1, 1, 0, 0, "PK4UB" },
-   { 1, 2, 0, 0, "RFL" },
-   { 1, 2, 0, 0, "SEQ" },
-   { 1, 2, 0, 0, "SFL" },
-   { 1, 2, 0, 0, "SGT" },
-   { 1, 1, 0, 0, "SIN" },
-   { 1, 2, 0, 0, "SLE" },
-   { 1, 2, 0, 0, "SNE" },
-   { 1, 2, 0, 0, "STR" },
-   { 1, 2, 1, 0, "TEX" },
-   { 1, 4, 1, 0, "TXD" },
-   { 1, 2, 1, 0, "TXP" },
-   { 1, 1, 0, 0, "UP2H" },
-   { 1, 1, 0, 0, "UP2US" },
-   { 1, 1, 0, 0, "UP4B" },
-   { 1, 1, 0, 0, "UP4UB" },
-   { 1, 3, 0, 0, "X2D" },
-   { 1, 1, 0, 0, "ARA" },
-   { 1, 1, 0, 0, "ARR" },
-   { 0, 1, 0, 0, "BRA" },
-   { 0, 0, 0, 1, "CAL" },
-   { 0, 0, 0, 0, "RET" },
-   { 1, 1, 0, 0, "SSG" },
-   { 1, 3, 0, 0, "CMP" },
-   { 1, 1, 0, 0, "SCS" },
-   { 1, 2, 1, 0, "TXB" },
-   { 1, 1, 0, 0, "NRM" },
-   { 1, 2, 0, 0, "DIV" },
-   { 1, 2, 0, 0, "DP2" },
-   { 1, 2, 1, 0, "TXL" },
-   { 0, 0, 0, 0, "BRK" },
-   { 0, 1, 0, 1, "IF" },
-   { 0, 0, 0, 0, "LOOP" },
-   { 0, 1, 0, 0, "REP" },
-   { 0, 0, 0, 1, "ELSE" },
-   { 0, 0, 0, 0, "ENDIF" },
-   { 0, 0, 0, 0, "ENDLOOP" },
-   { 0, 0, 0, 0, "ENDREP" },
-   { 0, 1, 0, 0, "PUSHA" },
-   { 1, 0, 0, 0, "POPA" },
-   { 1, 1, 0, 0, "CEIL" },
-   { 1, 1, 0, 0, "I2F" },
-   { 1, 1, 0, 0, "NOT" },
-   { 1, 1, 0, 0, "TRUNC" },
-   { 1, 2, 0, 0, "SHL" },
-   { 1, 2, 0, 0, "SHR" },
-   { 1, 2, 0, 0, "AND" },
-   { 1, 2, 0, 0, "OR" },
-   { 1, 2, 0, 0, "MOD" },
-   { 1, 2, 0, 0, "XOR" },
-   { 1, 3, 0, 0, "SAD" },
-   { 1, 2, 1, 0, "TXF" },
-   { 1, 2, 1, 0, "TXQ" },
-   { 0, 0, 0, 0, "CONT" },
-   { 0, 0, 0, 0, "EMIT" },
-   { 0, 0, 0, 0, "ENDPRIM" },
-   { 0, 0, 0, 1, "BGNLOOP2" },
-   { 0, 0, 0, 0, "BGNSUB" },
-   { 0, 0, 0, 1, "ENDLOOP2" },
-   { 0, 0, 0, 0, "ENDSUB" },
-   { 1, 1, 0, 0, "NOISE1" },
-   { 1, 1, 0, 0, "NOISE2" },
-   { 1, 1, 0, 0, "NOISE3" },
-   { 1, 1, 0, 0, "NOISE4" },
-   { 0, 0, 0, 0, "NOP" },
-   { 1, 2, 0, 0, "M4X3" },
-   { 1, 2, 0, 0, "M3X4" },
-   { 1, 2, 0, 0, "M3X3" },
-   { 1, 2, 0, 0, "M3X2" },
-   { 1, 1, 0, 0, "NRM4" },
-   { 0, 1, 0, 0, "CALLNZ" },
-   { 0, 1, 0, 0, "IFC" },
-   { 0, 1, 0, 0, "BREAKC" },
-   { 0, 1, 0, 0, "KIL" },
-   { 0, 0, 0, 0, "END" },
-   { 1, 1, 0, 0, "SWZ" }
+   { 1, 1, 0, 0, "ARL", NULL, NULL },
+   { 1, 1, 0, 0, "MOV", NULL, NULL },
+   { 1, 1, 0, 0, "LIT", NULL, NULL },
+   { 1, 1, 0, 0, "RCP", "RECIP", NULL },
+   { 1, 1, 0, 0, "RSQ", "RECIPSQRT", NULL },
+   { 1, 1, 0, 0, "EXP", "EXPP", NULL },
+   { 1, 1, 0, 0, "LOG", NULL, NULL },
+   { 1, 2, 0, 0, "MUL", NULL, NULL },
+   { 1, 2, 0, 0, "ADD", NULL, NULL },
+   { 1, 2, 0, 0, "DP3", "DOT3", NULL },
+   { 1, 2, 0, 0, "DP4", "DOT4", NULL },
+   { 1, 2, 0, 0, "DST", NULL, NULL },
+   { 1, 2, 0, 0, "MIN", NULL, NULL },
+   { 1, 2, 0, 0, "MAX", NULL, NULL },
+   { 1, 2, 0, 0, "SLT", "SETLT", NULL },
+   { 1, 2, 0, 0, "SGE", "SETGE", NULL },
+   { 1, 3, 0, 0, "MAD", "MADD", NULL },
+   { 1, 2, 0, 0, "SUB", NULL, NULL },
+   { 1, 3, 0, 0, "LRP", "LERP", NULL },
+   { 1, 3, 0, 0, "CND", NULL, NULL },
+   { 1, 3, 0, 0, "CND0", NULL, NULL },
+   { 1, 3, 0, 0, "DP2A", "DP2ADD", "DOT2ADD" },
+   { 1, 2, 0, 0, "INDEX", NULL, NULL },
+   { 1, 1, 0, 0, "NEGATE", NULL, NULL },
+   { 1, 1, 0, 0, "FRC", "FRAC", NULL },
+   { 1, 3, 0, 0, "CLAMP", NULL, NULL },
+   { 1, 1, 0, 0, "FLR", "FLOOR", NULL },
+   { 1, 1, 0, 0, "ROUND", NULL, NULL },
+   { 1, 1, 0, 0, "EX2", "EXPBASE2", NULL },
+   { 1, 1, 0, 0, "LG2", "LOGBASE2", "LOGP" },
+   { 1, 2, 0, 0, "POW", "POWER", NULL },
+   { 1, 2, 0, 0, "XPD", "CRS", "CROSSPRODUCT" },
+   { 1, 2, 0, 0, "M4X4", "MULTIPLYMATRIX", NULL },
+   { 1, 1, 0, 0, "ABS", NULL, NULL },
+   { 1, 1, 0, 0, "RCC", NULL, NULL },
+   { 1, 2, 0, 0, "DPH", NULL, NULL },
+   { 1, 1, 0, 0, "COS", NULL, NULL },
+   { 1, 1, 0, 0, "DDX", "DSX", NULL },
+   { 1, 1, 0, 0, "DDY", "DSY", NULL },
+   { 0, 0, 0, 0, "KILP", NULL, NULL },
+   { 1, 1, 0, 0, "PK2H", NULL, NULL },
+   { 1, 1, 0, 0, "PK2US", NULL, NULL },
+   { 1, 1, 0, 0, "PK4B", NULL, NULL },
+   { 1, 1, 0, 0, "PK4UB", NULL, NULL },
+   { 1, 2, 0, 0, "RFL", NULL, NULL },
+   { 1, 2, 0, 0, "SEQ", NULL, NULL },
+   { 1, 2, 0, 0, "SFL", NULL, NULL },
+   { 1, 2, 0, 0, "SGT", NULL, NULL },
+   { 1, 1, 0, 0, "SIN", NULL, NULL },
+   { 1, 2, 0, 0, "SLE", NULL, NULL },
+   { 1, 2, 0, 0, "SNE", NULL, NULL },
+   { 1, 2, 0, 0, "STR", NULL, NULL },
+   { 1, 2, 1, 0, "TEX", "TEXLD", NULL },
+   { 1, 4, 1, 0, "TXD", "TEXLDD", NULL },
+   { 1, 2, 1, 0, "TXP", NULL, NULL },
+   { 1, 1, 0, 0, "UP2H", NULL, NULL },
+   { 1, 1, 0, 0, "UP2US", NULL, NULL },
+   { 1, 1, 0, 0, "UP4B", NULL, NULL },
+   { 1, 1, 0, 0, "UP4UB", NULL, NULL },
+   { 1, 3, 0, 0, "X2D", NULL, NULL },
+   { 1, 1, 0, 0, "ARA", NULL, NULL },
+   { 1, 1, 0, 0, "ARR", "MOVA", NULL },
+   { 0, 1, 0, 0, "BRA", NULL, NULL },
+   { 0, 0, 0, 1, "CAL", "CALL", NULL },
+   { 0, 0, 0, 0, "RET", NULL, NULL },
+   { 1, 1, 0, 0, "SGN", "SSG", NULL },
+   { 1, 3, 0, 0, "CMP", NULL, NULL },
+   { 1, 1, 0, 0, "SCS", "SINCOS", NULL },
+   { 1, 2, 1, 0, "TXB", "TEXLDB", NULL },
+   { 1, 1, 0, 0, "NRM", NULL, NULL },
+   { 1, 2, 0, 0, "DIV", NULL, NULL },
+   { 1, 2, 0, 0, "DP2", NULL, NULL },
+   { 1, 2, 1, 0, "TXL", NULL, NULL },
+   { 0, 0, 0, 0, "BRK", "BREAK", NULL },
+   { 0, 1, 0, 1, "IF", NULL, NULL },
+   { 0, 0, 0, 0, "LOOP", NULL, NULL },
+   { 0, 1, 0, 0, "REP", NULL, NULL },
+   { 0, 0, 0, 1, "ELSE", NULL, NULL },
+   { 0, 0, 0, 0, "ENDIF", NULL, NULL },
+   { 0, 0, 0, 0, "ENDLOOP", NULL, NULL },
+   { 0, 0, 0, 0, "ENDREP", NULL, NULL },
+   { 0, 1, 0, 0, "PUSHA", NULL, NULL },
+   { 1, 0, 0, 0, "POPA", NULL, NULL },
+   { 1, 1, 0, 0, "CEIL", NULL, NULL },
+   { 1, 1, 0, 0, "I2F", NULL, NULL },
+   { 1, 1, 0, 0, "NOT", NULL, NULL },
+   { 1, 1, 0, 0, "INT", "TRUNC", NULL },
+   { 1, 2, 0, 0, "SHL", NULL, NULL },
+   { 1, 2, 0, 0, "SHR", NULL, NULL },
+   { 1, 2, 0, 0, "AND", NULL, NULL },
+   { 1, 2, 0, 0, "OR", NULL, NULL },
+   { 1, 2, 0, 0, "MOD", NULL, NULL },
+   { 1, 2, 0, 0, "XOR", NULL, NULL },
+   { 1, 3, 0, 0, "SAD", NULL, NULL },
+   { 1, 2, 1, 0, "TXF", NULL, NULL },
+   { 1, 2, 1, 0, "TXQ", NULL, NULL },
+   { 0, 0, 0, 0, "CONT", NULL, NULL },
+   { 0, 0, 0, 0, "EMIT", NULL, NULL },
+   { 0, 0, 0, 0, "ENDPRIM", NULL, NULL },
+   { 0, 0, 0, 1, "BGNLOOP2", NULL, NULL },
+   { 0, 0, 0, 0, "BGNSUB", NULL, NULL },
+   { 0, 0, 0, 1, "ENDLOOP2", NULL, NULL },
+   { 0, 0, 0, 0, "ENDSUB", NULL, NULL },
+   { 1, 1, 0, 0, "NOISE1", NULL, NULL },
+   { 1, 1, 0, 0, "NOISE2", NULL, NULL },
+   { 1, 1, 0, 0, "NOISE3", NULL, NULL },
+   { 1, 1, 0, 0, "NOISE4", NULL, NULL },
+   { 0, 0, 0, 0, "NOP", NULL, NULL },
+   { 1, 2, 0, 0, "M4X3", NULL, NULL },
+   { 1, 2, 0, 0, "M3X4", NULL, NULL },
+   { 1, 2, 0, 0, "M3X3", NULL, NULL },
+   { 1, 2, 0, 0, "M3X2", NULL, NULL },
+   { 1, 1, 0, 0, "NRM4", NULL, NULL },
+   { 0, 1, 0, 0, "CALLNZ", NULL, NULL },
+   { 0, 1, 0, 0, "IFC", NULL, NULL },
+   { 0, 1, 0, 0, "BREAKC", NULL, NULL },
+   { 0, 1, 0, 0, "KIL", "TEXKILL", NULL },
+   { 0, 0, 0, 0, "END", NULL, NULL },
+   { 1, 1, 0, 0, "SWZ", NULL, NULL }
 };
 
 const struct tgsi_opcode_info *
index 7230bda..077e25a 100644 (file)
@@ -41,6 +41,8 @@ struct tgsi_opcode_info
    boolean is_tex;
    boolean is_branch;
    const char *mnemonic;
+   const char *alt_mnemonic1;
+   const char *alt_mnemonic2;
 };
 
 const struct tgsi_opcode_info *
index 58fe07c..a40fcab 100644 (file)
@@ -358,9 +358,9 @@ parse_register_dst(
 
 /* Parse source register operand.
  *    <register_src> ::= <register_file_bracket_index> `]' |
- *                       <register_file_bracket> <register_dst> `]' |
- *                       <register_file_bracket> <register_dst> `+' <uint> `]' |
- *                       <register_file_bracket> <register_dst> `-' <uint> `]'
+ *                       <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `]' |
+ *                       <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `+' <uint> `]' |
+ *                       <register_file_bracket> <register_dst> [`.' (`x' | `y' | `z' | `w')] `-' <uint> `]'
  */
 static boolean
 parse_register_src(
@@ -368,11 +368,13 @@ parse_register_src(
    uint *file,
    int *index,
    uint *ind_file,
-   int *ind_index )
+   int *ind_index,
+   uint *ind_comp)
 {
    const char *cur;
    uint uindex;
 
+   *ind_comp = TGSI_SWIZZLE_X;
    if (!parse_register_file_bracket( ctx, file ))
       return FALSE;
    eat_opt_white( &ctx->cur );
@@ -381,6 +383,32 @@ parse_register_src(
       if (!parse_register_dst( ctx, ind_file, ind_index ))
          return FALSE;
       eat_opt_white( &ctx->cur );
+
+      if (*ctx->cur == '.') {
+         ctx->cur++;
+         eat_opt_white(&ctx->cur);
+
+         switch (uprcase(*ctx->cur)) {
+         case 'X':
+            *ind_comp = TGSI_SWIZZLE_X;
+            break;
+         case 'Y':
+            *ind_comp = TGSI_SWIZZLE_Y;
+            break;
+         case 'Z':
+            *ind_comp = TGSI_SWIZZLE_Z;
+            break;
+         case 'W':
+            *ind_comp = TGSI_SWIZZLE_W;
+            break;
+         default:
+            report_error(ctx, "Expected indirect register swizzle component `x', `y', `z' or `w'");
+            return FALSE;
+         }
+         ctx->cur++;
+         eat_opt_white(&ctx->cur);
+      }
+
       if (*ctx->cur == '+' || *ctx->cur == '-') {
          boolean negate;
 
@@ -561,7 +589,9 @@ parse_src_operand(
    int index;
    uint ind_file;
    int ind_index;
+   uint ind_comp;
    uint swizzle[4];
+   boolean parsed_ext_negate_paren = FALSE;
    boolean parsed_swizzle;
    boolean parsed_extswizzle;
 
@@ -574,10 +604,17 @@ parse_src_operand(
          src->SrcRegisterExtMod.Negate = 1;
          eat_opt_white( &cur );
          ctx->cur = cur;
+         parsed_ext_negate_paren = TRUE;
+      }
+      else if (*cur == '|') {
+         cur++;
+         src->SrcRegisterExtMod.Negate = 1;
+         src->SrcRegisterExtMod.Absolute = 1;
+         eat_opt_white(&cur);
+         ctx->cur = cur;
       }
    }
-
-   if (*ctx->cur == '|') {
+   else if (*ctx->cur == '|') {
       ctx->cur++;
       eat_opt_white( &ctx->cur );
       src->SrcRegisterExtMod.Absolute = 1;
@@ -635,7 +672,7 @@ parse_src_operand(
       }
    }
 
-   if (!parse_register_src( ctx, &file, &index, &ind_file, &ind_index ))
+   if (!parse_register_src(ctx, &file, &index, &ind_file, &ind_index, &ind_comp))
       return FALSE;
    src->SrcRegister.File = file;
    src->SrcRegister.Index = index;
@@ -643,6 +680,10 @@ parse_src_operand(
       src->SrcRegister.Indirect = 1;
       src->SrcRegisterInd.File = ind_file;
       src->SrcRegisterInd.Index = ind_index;
+      src->SrcRegisterInd.SwizzleX = ind_comp;
+      src->SrcRegisterInd.SwizzleY = ind_comp;
+      src->SrcRegisterInd.SwizzleZ = ind_comp;
+      src->SrcRegisterInd.SwizzleW = ind_comp;
    }
 
    /* Parse optional swizzle.
@@ -715,7 +756,7 @@ parse_src_operand(
       ctx->cur++;
    }
 
-   if (src->SrcRegisterExtMod.Negate) {
+   if (parsed_ext_negate_paren) {
       eat_opt_white( &ctx->cur );
       if (*ctx->cur != ')') {
          report_error( ctx, "Expected `)'" );
@@ -741,6 +782,26 @@ static const char *texture_names[TGSI_TEXTURE_COUNT] =
 };
 
 static boolean
+match_inst_mnemonic(const char **pcur,
+                    const struct tgsi_opcode_info *info)
+{
+   if (str_match_no_case(pcur, info->mnemonic)) {
+      return TRUE;
+   }
+   if (info->alt_mnemonic1) {
+      if (str_match_no_case(pcur, info->alt_mnemonic1)) {
+         return TRUE;
+      }
+      if (info->alt_mnemonic2) {
+         if (str_match_no_case(pcur, info->alt_mnemonic2)) {
+            return TRUE;
+         }
+      }
+   }
+   return FALSE;
+}
+
+static boolean
 parse_instruction(
    struct translate_ctx *ctx,
    boolean has_label )
@@ -758,7 +819,7 @@ parse_instruction(
       const char *cur = ctx->cur;
 
       info = tgsi_get_opcode_info( i );
-      if (str_match_no_case( &cur, info->mnemonic )) {
+      if (match_inst_mnemonic(&cur, info)) {
          if (str_match_no_case( &cur, "_SATNV" ))
             saturate = TGSI_SAT_MINUS_PLUS_ONE;
          else if (str_match_no_case( &cur, "_SAT" ))
index 7678903..a9b7253 100644 (file)
@@ -42,6 +42,8 @@ struct translate *translate_create( const struct translate_key *key )
    translate = translate_sse2_create( key );
    if (translate)
       return translate;
+#else
+   (void)translate;
 #endif
 
    return translate_generic_create( key );
index d68bdea..5035e9c 100644 (file)
@@ -5,6 +5,8 @@ LIBNAME = util
 
 C_SOURCES = \
        u_debug.c \
+       u_debug_symbol.c \
+       u_debug_stack.c \
        u_blit.c \
        u_cache.c \
        u_draw_quad.c \
index 0f15c63..8317263 100644 (file)
@@ -10,6 +10,7 @@ util = env.ConvenienceLibrary(
                'u_debug_memory.c',
                'u_debug_profile.c',
                'u_debug_stack.c',
+               'u_debug_symbol.c',
                'u_draw_quad.c',
                'u_gen_mipmap.c',
                'u_handle_table.c',
diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h
new file mode 100644 (file)
index 0000000..7c16b32
--- /dev/null
@@ -0,0 +1,60 @@
+/**************************************************************************
+ * 
+ * Copyright 2009 VMware, Inc.  All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/* Authors:
+ *    Michel Dänzer
+ */
+
+
+#include "pipe/p_context.h"
+#include "pipe/p_state.h"
+#include "util/u_pack_color.h"
+
+
+/**
+ * Clear the given buffers to the specified values.
+ * No masking, no scissor (clear entire buffer).
+ */
+static INLINE void
+util_clear(struct pipe_context *pipe,
+           struct pipe_framebuffer_state *framebuffer, unsigned buffers,
+           const float *rgba, double depth, unsigned stencil)
+{
+   if (buffers & PIPE_CLEAR_COLOR) {
+      struct pipe_surface *ps = framebuffer->cbufs[0];
+      unsigned color;
+
+      util_pack_color(rgba, ps->format, &color);
+      pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
+   }
+
+   if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+      struct pipe_surface *ps = framebuffer->zsbuf;
+
+      pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height,
+                         util_pack_z_stencil(ps->format, depth, stencil));
+   }
+}
index f96e27e..96a2222 100644 (file)
@@ -169,18 +169,18 @@ void debug_print_blob( const char *name,
 #endif
 
 
-void _debug_break(void) 
+#ifndef debug_break
+void debug_break(void) 
 {
-#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
-   __asm("int3");
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
-   _asm {int 3};
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+   DebugBreak();
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
    EngDebugBreak();
 #else
    abort();
 #endif
 }
+#endif
 
 
 #ifdef PIPE_SUBSYSTEM_WINDOWS_DISPLAY
@@ -715,78 +715,85 @@ struct bmp_rgb_quad {
    uint8_t rgbAlpha;
 };
 
-void 
+void
 debug_dump_surface_bmp(const char *filename,
                        struct pipe_surface *surface)
 {
+   struct pipe_transfer *transfer;
+   struct pipe_texture *texture = surface->texture;
+   struct pipe_screen *screen = texture->screen;
+
+   transfer = screen->get_tex_transfer(screen, texture, surface->face,
+                                       surface->level, surface->zslice,
+                                       PIPE_TRANSFER_READ, 0, 0, surface->width,
+                                       surface->height);
+
+   debug_dump_transfer_bmp(filename, transfer);
+
+   screen->tex_transfer_destroy(transfer);
+}
+
+void
+debug_dump_transfer_bmp(const char *filename,
+                        struct pipe_transfer *transfer)
+{
 #ifndef PIPE_SUBSYSTEM_WINDOWS_MINIPORT
-   struct pipe_texture *texture;
-   struct pipe_screen *screen;
    struct util_stream *stream;
-   struct pipe_transfer *transfer;
    struct bmp_file_header bmfh;
    struct bmp_info_header bmih;
    float *rgba;
    unsigned x, y;
 
-   if (!surface)
+   if (!transfer)
       goto error1;
 
-   rgba = MALLOC(surface->width*4*sizeof(float));
+   rgba = MALLOC(transfer->width*transfer->height*4*sizeof(float));
    if(!rgba)
       goto error1;
-   
+
    bmfh.bfType = 0x4d42;
-   bmfh.bfSize = 14 + 40 + surface->height*surface->width*4;
+   bmfh.bfSize = 14 + 40 + transfer->height*transfer->width*4;
    bmfh.bfReserved1 = 0;
    bmfh.bfReserved2 = 0;
    bmfh.bfOffBits = 14 + 40;
-   
+
    bmih.biSize = 40;
-   bmih.biWidth = surface->width;
-   bmih.biHeight = surface->height;
+   bmih.biWidth = transfer->width;
+   bmih.biHeight = transfer->height;
    bmih.biPlanes = 1;
    bmih.biBitCount = 32;
    bmih.biCompression = 0;
-   bmih.biSizeImage = surface->height*surface->width*4;
+   bmih.biSizeImage = transfer->height*transfer->width*4;
    bmih.biXPelsPerMeter = 0;
    bmih.biYPelsPerMeter = 0;
    bmih.biClrUsed = 0;
    bmih.biClrImportant = 0;
-   
+
    stream = util_stream_create(filename, bmfh.bfSize);
    if(!stream)
       goto error2;
-   
+
    util_stream_write(stream, &bmfh, 14);
    util_stream_write(stream, &bmih, 40);
 
-   texture = surface->texture;
-   screen = texture->screen;
-   
-   transfer = screen->get_tex_transfer(screen, texture, surface->face,
-                                       surface->level, surface->zslice,
-                                       PIPE_TRANSFER_READ, 0, 0, surface->width,
-                                       surface->height);
+   pipe_get_tile_rgba(transfer, 0, 0,
+                      transfer->width, transfer->height,
+                      rgba);
 
-   y = surface->height;
+   y = transfer->height;
    while(y--) {
-      pipe_get_tile_rgba(transfer,
-                         0, y, surface->width, 1,
-                         rgba);
-      for(x = 0; x < surface->width; ++x)
+      float *ptr = rgba + (transfer->width * y * 4);
+      for(x = 0; x < transfer->width; ++x)
       {
          struct bmp_rgb_quad pixel;
-         pixel.rgbRed   = float_to_ubyte(rgba[x*4 + 0]);
-         pixel.rgbGreen = float_to_ubyte(rgba[x*4 + 1]);
-         pixel.rgbBlue  = float_to_ubyte(rgba[x*4 + 2]);
-         pixel.rgbAlpha = float_to_ubyte(rgba[x*4 + 3]);
+         pixel.rgbRed   = float_to_ubyte(ptr[x*4 + 0]);
+         pixel.rgbGreen = float_to_ubyte(ptr[x*4 + 1]);
+         pixel.rgbBlue  = float_to_ubyte(ptr[x*4 + 2]);
+         pixel.rgbAlpha = 255;
          util_stream_write(stream, &pixel, 4);
-      }  
+      }
    }
 
-   screen->tex_transfer_destroy(transfer);
-   
    util_stream_close(stream);
 error2:
    FREE(rgba);
index 7c82970..8d703e4 100644 (file)
@@ -125,19 +125,16 @@ void debug_print_format(const char *msg, unsigned fmt );
 #endif
 
 
-void _debug_break(void);
-
-
 /**
  * Hard-coded breakpoint.
  */
 #ifdef DEBUG
-#if defined(PIPE_ARCH_X86) && defined(PIPE_CC_GCC)
+#if (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)) && defined(PIPE_CC_GCC)
 #define debug_break() __asm("int3")
-#elif defined(PIPE_ARCH_X86) && defined(PIPE_CC_MSVC)
-#define debug_break()  do { _asm {int 3} } while(0)
+#elif defined(PIPE_CC_MSVC)
+#define debug_break()  __debugbreak()
 #else
-#define debug_break() _debug_break()
+void debug_break(void);
 #endif
 #else /* !DEBUG */
 #define debug_break() ((void)0)
@@ -338,6 +335,7 @@ debug_profile_stop(void);
 
 #ifdef DEBUG
 struct pipe_surface;
+struct pipe_transfer;
 void debug_dump_image(const char *prefix,
                       unsigned format, unsigned cpp,
                       unsigned width, unsigned height,
@@ -347,6 +345,8 @@ void debug_dump_surface(const char *prefix,
                         struct pipe_surface *surface);   
 void debug_dump_surface_bmp(const char *filename,
                             struct pipe_surface *surface);
+void debug_dump_transfer_bmp(const char *filename,
+                             struct pipe_transfer *transfer);
 #else
 #define debug_dump_image(prefix, format, cpp, width, height, stride, data) ((void)0)
 #define debug_dump_surface(prefix, surface) ((void)0)
index 76068a6..e9891fd 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include "u_debug.h"
+#include "u_debug_symbol.h"
 #include "u_debug_stack.h"
 
 
@@ -49,7 +50,7 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
 
 #if defined(PIPE_CC_GCC)
    frame_pointer = ((const void **)__builtin_frame_address(1));
-#elif defined(PIPE_CC_MSVC)
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
    __asm {
       mov frame_pointer, ebp
    }
@@ -91,7 +92,7 @@ debug_backtrace_dump(const struct debug_stack_frame *backtrace,
    for(i = 0; i < nr_frames; ++i) {
       if(!backtrace[i].function)
          break;
-      debug_printf("\t%p\n", backtrace[i].function);
+      debug_symbol_print(backtrace[i].function);
    }
 }
 
diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c
new file mode 100644 (file)
index 0000000..811931f
--- /dev/null
@@ -0,0 +1,250 @@
+/**************************************************************************
+ * 
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+/**
+ * @file
+ * Symbol lookup.
+ * 
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+#include "pipe/p_compiler.h"
+
+#include "u_debug.h"
+#include "u_debug_symbol.h"
+
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86)
+   
+#include <windows.h>
+#include <stddef.h>
+#include <imagehlp.h>
+
+/*
+ * TODO: Cleanup code.
+ * TODO: Support x86_64 
+ */
+
+static BOOL bSymInitialized = FALSE;
+
+static HMODULE hModule_Imagehlp = NULL;
+
+typedef BOOL (WINAPI *PFNSYMINITIALIZE)(HANDLE, LPSTR, BOOL);
+static PFNSYMINITIALIZE pfnSymInitialize = NULL;
+
+static
+BOOL WINAPI j_SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess)
+{
+   if(
+      (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+      (pfnSymInitialize || (pfnSymInitialize = (PFNSYMINITIALIZE) GetProcAddress(hModule_Imagehlp, "SymInitialize")))
+   )
+      return pfnSymInitialize(hProcess, UserSearchPath, fInvadeProcess);
+   else
+      return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMCLEANUP)(HANDLE);
+static PFNSYMCLEANUP pfnSymCleanup = NULL;
+
+static
+BOOL WINAPI j_SymCleanup(HANDLE hProcess)
+{
+   if(
+      (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+      (pfnSymCleanup || (pfnSymCleanup = (PFNSYMCLEANUP) GetProcAddress(hModule_Imagehlp, "SymCleanup")))
+   )
+      return pfnSymCleanup(hProcess);
+   else
+      return FALSE;
+}
+
+typedef DWORD (WINAPI *PFNSYMSETOPTIONS)(DWORD);
+static PFNSYMSETOPTIONS pfnSymSetOptions = NULL;
+
+static
+DWORD WINAPI j_SymSetOptions(DWORD SymOptions)
+{
+   if(
+      (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+      (pfnSymSetOptions || (pfnSymSetOptions = (PFNSYMSETOPTIONS) GetProcAddress(hModule_Imagehlp, "SymSetOptions")))
+   )
+      return pfnSymSetOptions(SymOptions);
+   else
+      return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMUNDNAME)(PIMAGEHLP_SYMBOL, PSTR, DWORD);
+static PFNSYMUNDNAME pfnSymUnDName = NULL;
+
+static
+BOOL WINAPI j_SymUnDName(PIMAGEHLP_SYMBOL Symbol, PSTR UnDecName, DWORD UnDecNameLength)
+{
+   if(
+      (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+      (pfnSymUnDName || (pfnSymUnDName = (PFNSYMUNDNAME) GetProcAddress(hModule_Imagehlp, "SymUnDName")))
+   )
+      return pfnSymUnDName(Symbol, UnDecName, UnDecNameLength);
+   else
+      return FALSE;
+}
+
+typedef PFUNCTION_TABLE_ACCESS_ROUTINE PFNSYMFUNCTIONTABLEACCESS;
+static PFNSYMFUNCTIONTABLEACCESS pfnSymFunctionTableAccess = NULL;
+
+static
+PVOID WINAPI j_SymFunctionTableAccess(HANDLE hProcess, DWORD AddrBase)
+{
+   if(
+      (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+      (pfnSymFunctionTableAccess || (pfnSymFunctionTableAccess = (PFNSYMFUNCTIONTABLEACCESS) GetProcAddress(hModule_Imagehlp, "SymFunctionTableAccess")))
+   )
+      return pfnSymFunctionTableAccess(hProcess, AddrBase);
+   else
+      return NULL;
+}
+
+typedef PGET_MODULE_BASE_ROUTINE PFNSYMGETMODULEBASE;
+static PFNSYMGETMODULEBASE pfnSymGetModuleBase = NULL;
+
+static
+DWORD WINAPI j_SymGetModuleBase(HANDLE hProcess, DWORD dwAddr)
+{
+   if(
+      (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+      (pfnSymGetModuleBase || (pfnSymGetModuleBase = (PFNSYMGETMODULEBASE) GetProcAddress(hModule_Imagehlp, "SymGetModuleBase")))
+   )
+      return pfnSymGetModuleBase(hProcess, dwAddr);
+   else
+      return 0;
+}
+
+typedef BOOL (WINAPI *PFNSTACKWALK)(DWORD, HANDLE, HANDLE, LPSTACKFRAME, LPVOID, PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
+static PFNSTACKWALK pfnStackWalk = NULL;
+
+static
+BOOL WINAPI j_StackWalk(
+   DWORD MachineType, 
+   HANDLE hProcess, 
+   HANDLE hThread, 
+   LPSTACKFRAME StackFrame, 
+   PVOID ContextRecord, 
+   PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,  
+   PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
+   PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine, 
+   PTRANSLATE_ADDRESS_ROUTINE TranslateAddress 
+)
+{
+   if(
+      (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+      (pfnStackWalk || (pfnStackWalk = (PFNSTACKWALK) GetProcAddress(hModule_Imagehlp, "StackWalk")))
+   )
+      return pfnStackWalk(
+         MachineType, 
+         hProcess, 
+         hThread, 
+         StackFrame, 
+         ContextRecord, 
+         ReadMemoryRoutine,  
+         FunctionTableAccessRoutine,
+         GetModuleBaseRoutine, 
+         TranslateAddress 
+      );
+   else
+      return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMGETSYMFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_SYMBOL);
+static PFNSYMGETSYMFROMADDR pfnSymGetSymFromAddr = NULL;
+
+static
+BOOL WINAPI j_SymGetSymFromAddr(HANDLE hProcess, DWORD Address, PDWORD Displacement, PIMAGEHLP_SYMBOL Symbol)
+{
+   if(
+      (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+      (pfnSymGetSymFromAddr || (pfnSymGetSymFromAddr = (PFNSYMGETSYMFROMADDR) GetProcAddress(hModule_Imagehlp, "SymGetSymFromAddr")))
+   )
+      return pfnSymGetSymFromAddr(hProcess, Address, Displacement, Symbol);
+   else
+      return FALSE;
+}
+
+typedef BOOL (WINAPI *PFNSYMGETLINEFROMADDR)(HANDLE, DWORD, LPDWORD, PIMAGEHLP_LINE);
+static PFNSYMGETLINEFROMADDR pfnSymGetLineFromAddr = NULL;
+
+static
+BOOL WINAPI j_SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr, PDWORD pdwDisplacement, PIMAGEHLP_LINE Line)
+{
+   if(
+      (hModule_Imagehlp || (hModule_Imagehlp = LoadLibraryA("IMAGEHLP.DLL"))) &&
+      (pfnSymGetLineFromAddr || (pfnSymGetLineFromAddr = (PFNSYMGETLINEFROMADDR) GetProcAddress(hModule_Imagehlp, "SymGetLineFromAddr")))
+   )
+      return pfnSymGetLineFromAddr(hProcess, dwAddr, pdwDisplacement, Line);
+   else
+      return FALSE;
+}
+
+
+static INLINE boolean
+debug_symbol_print_imagehlp(const void *addr)
+{
+   HANDLE hProcess;
+   BYTE symbolBuffer[1024];
+   PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL) symbolBuffer;
+   DWORD dwDisplacement = 0;  // Displacement of the input address, relative to the start of the symbol
+
+   hProcess = GetCurrentProcess();
+
+   pSymbol->SizeOfStruct = sizeof(symbolBuffer);
+   pSymbol->MaxNameLength = sizeof(symbolBuffer) - offsetof(IMAGEHLP_SYMBOL, Name);
+
+   if(!bSymInitialized) {
+      j_SymSetOptions(/* SYMOPT_UNDNAME | */ SYMOPT_LOAD_LINES);
+      if(j_SymInitialize(hProcess, NULL, TRUE))
+         bSymInitialized = TRUE;
+   }
+      
+   if(!j_SymGetSymFromAddr(hProcess, (DWORD)addr, &dwDisplacement, pSymbol))
+      return FALSE;
+
+   debug_printf("\t%s\n", pSymbol->Name);
+
+   return TRUE;
+   
+}
+#endif
+
+
+void
+debug_symbol_print(const void *addr)
+{
+#if defined(PIPE_SUBSYSTEM_WINDOWS_USER) && defined(PIPE_ARCH_X86)
+   if(debug_symbol_print_imagehlp(addr))
+      return;
+#endif
+   
+   debug_printf("\t%p\n", addr);
+}
diff --git a/src/gallium/auxiliary/util/u_debug_symbol.h b/src/gallium/auxiliary/util/u_debug_symbol.h
new file mode 100644 (file)
index 0000000..0215869
--- /dev/null
@@ -0,0 +1,53 @@
+/**************************************************************************
+ * 
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+#ifndef U_DEBUG_SYMBOL_H_
+#define U_DEBUG_SYMBOL_H_
+
+
+/**
+ * @file
+ * Symbol lookup.
+ * 
+ * @author Jose Fonseca <jfonseca@vmware.com>
+ */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void
+debug_symbol_print(const void *addr);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* U_DEBUG_SYMBOL_H_ */
index d108d92..53bb134 100644 (file)
@@ -95,5 +95,8 @@ struct list_head
 #define LIST_ENTRY(__type, __item, __field)   \
     ((__type *)(((char *)(__item)) - offsetof(__type, __field)))
 
+#define LIST_IS_EMPTY(__list)                   \
+    ((__list)->next == (__list))
+
 
 #endif /*_U_DOUBLE_LIST_H_*/
index 1ecde7a..e5003af 100644 (file)
@@ -319,11 +319,33 @@ util_iround(float f)
 
 
 
-#if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
+/**
+ * Test if x is NaN or +/- infinity.
+ */
+static INLINE boolean
+util_is_inf_or_nan(float x)
+{
+   union fi tmp;
+   tmp.f = x;
+   return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
+}
+
+
 /**
  * Find first bit set in word.  Least significant bit is 1.
  * Return 0 if no bits set.
  */
+#if defined(_MSC_VER) && _MSC_VER >= 1300
+static INLINE
+unsigned long ffs( unsigned long u )
+{
+   unsigned long i;
+   if(_BitScanForward(&i, u))
+      return i + 1;
+   else
+      return 0;
+}
+#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
 static INLINE
 unsigned ffs( unsigned u )
 {
@@ -339,9 +361,7 @@ unsigned ffs( unsigned u )
 
    return i;
 }
-#endif
-
-#ifdef __MINGW32__
+#elif defined(__MINGW32__)
 #define ffs __builtin_ffs
 #endif
 
index e0e8aa8..eda883b 100644 (file)
@@ -434,12 +434,42 @@ util_pack_z(enum pipe_format format, double z)
       if (z == 1.0)
          return 0xffffff00;
       return ((uint) (z * 0xffffff)) << 8;
+   case PIPE_FORMAT_S8_UNORM:
+      /* this case can get it via util_pack_z_stencil() */
+      return 0;
    default:
       debug_print_format("gallium: unhandled format in util_pack_z()", format);
       assert(0);
       return 0;
    }
 }
+
+/**
+ * Pack Z and/or stencil values into a 32-bit value described by format.
+ * Note: it's assumed that z is in [0,1] and s in [0,255]
+ */
+static INLINE uint
+util_pack_z_stencil(enum pipe_format format, double z, uint s)
+{
+   unsigned packed = util_pack_z(format, z);
+
+   switch (format) {
+   case PIPE_FORMAT_S8Z24_UNORM:
+      packed |= s << 24;
+      break;
+   case PIPE_FORMAT_Z24S8_UNORM:
+      packed |= s;
+      break;
+   case PIPE_FORMAT_S8_UNORM:
+      packed |= s;
+      break;
+   default:
+      break;
+   }
+
+   return packed;
+}
 
 
 /**
index 0ead45a..d8f648e 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_OS_SOLARIS)
 
 #include <stdio.h>
 
index 08c89bb..cc7992d 100644 (file)
@@ -130,7 +130,7 @@ static INLINE char *
 util_strstr(const char *haystack, const char *needle)
 {
    const char *p = haystack;
-   int len = strlen(needle);
+   size_t len = strlen(needle);
 
    for (; (p = util_strchr(p, *needle)) != 0; p++) {
       if (util_strncmp(p, needle, len) == 0) {
index d31ca9c..f0a5a33 100644 (file)
@@ -957,6 +957,7 @@ pipe_tile_raw_to_rgba(enum pipe_format format,
       s8z24_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
       break;
    case PIPE_FORMAT_Z24S8_UNORM:
+   case PIPE_FORMAT_Z24X8_UNORM:
       z24s8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride);
       break;
    case PIPE_FORMAT_Z32_FLOAT:
@@ -1069,6 +1070,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
       /*s8z24_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
       break;
    case PIPE_FORMAT_Z24S8_UNORM:
+   case PIPE_FORMAT_Z24X8_UNORM:
       /*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/
       break;
    default:
@@ -1198,6 +1200,20 @@ pipe_put_tile_z(struct pipe_transfer *pt,
          }
       }
       break;
+   case PIPE_FORMAT_Z24S8_UNORM:
+   case PIPE_FORMAT_Z24X8_UNORM:
+      {
+         uint *pDest = (uint *) (map + y * pt->stride + x*4);
+         for (i = 0; i < h; i++) {
+            for (j = 0; j < w; j++) {
+               /* convert 32-bit Z to 24-bit Z (0 stencil) */
+               pDest[j] = ptrc[j] << 8;
+            }
+            pDest += pt->stride/4;
+            ptrc += srcStride;
+         }
+      }
+      break;
    case PIPE_FORMAT_Z16_UNORM:
       {
          ushort *pDest = (ushort *) (map + y * pt->stride + x*2);
index 357d936..8afe4fc 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
 #include <sys/time.h>
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
 #include <windows.h>
@@ -77,7 +77,7 @@ util_time_get_frequency(void)
 void 
 util_time_get(struct util_time *t)
 {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    gettimeofday(&t->tv, NULL);
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
    LONGLONG temp;
@@ -102,7 +102,7 @@ util_time_add(const struct util_time *t1,
               int64_t usecs,
               struct util_time *t2)
 {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    t2->tv.tv_sec = t1->tv.tv_sec + usecs / 1000000;
    t2->tv.tv_usec = t1->tv.tv_usec + usecs % 1000000;
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -124,7 +124,7 @@ int64_t
 util_time_diff(const struct util_time *t1, 
                const struct util_time *t2)
 {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    return (t2->tv.tv_usec - t1->tv.tv_usec) + 
           (t2->tv.tv_sec - t1->tv.tv_sec)*1000000;
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
@@ -144,7 +144,7 @@ util_time_micros( void )
    
    util_time_get(&t1);
    
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    return t1.tv.tv_usec + t1.tv.tv_sec*1000000LL;
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) || defined(PIPE_SUBSYSTEM_WINDOWS_USER) || defined(PIPE_SUBSYSTEM_WINDOWS_CE)
    util_time_get_frequency();
@@ -166,7 +166,7 @@ static INLINE int
 util_time_compare(const struct util_time *t1, 
                   const struct util_time *t2)
 {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    if (t1->tv.tv_sec < t2->tv.tv_sec)
       return -1;
    else if(t1->tv.tv_sec > t2->tv.tv_sec)
index 4346ce1..6bca607 100644 (file)
@@ -38,7 +38,7 @@
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
 #include <time.h> /* timeval */
 #include <unistd.h> /* usleep */
 #endif
@@ -58,7 +58,7 @@ extern "C" {
  */
 struct util_time 
 {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    struct timeval tv;
 #else
    int64_t counter;
@@ -89,7 +89,7 @@ util_time_timeout(const struct util_time *start,
                   const struct util_time *end,
                   const struct util_time *curr);
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
 #define util_time_sleep usleep
 #else
 void
index edc0674..79ad687 100644 (file)
 
 
 /**
- * Convert packed pixel from one format to another.
- */
-static unsigned
-convert_color(enum pipe_format srcFormat, unsigned srcColor,
-              enum pipe_format dstFormat)
-{
-   ubyte r, g, b, a;
-   unsigned dstColor;
-
-   util_unpack_color_ub(srcFormat, &srcColor, &r, &g, &b, &a);
-   util_pack_color_ub(r, g, b, a, dstFormat, &dstColor);
-
-   return dstColor;
-}
-
-
-
-/**
  * Called via pipe->clear()
  */
 void
-cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
-                   unsigned clearValue)
+cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+           double depth, unsigned stencil)
 {
    struct cell_context *cell = cell_context(pipe);
-   uint surfIndex;
 
    if (cell->dirty)
       cell_update_derived(cell);
 
-   if (ps == cell->framebuffer.zsbuf) {
-      /* clear z/stencil buffer */
-      surfIndex = 1;
-   }
-   else {
-      /* clear color buffer */
-      surfIndex = 0;
+   if (buffers & PIPE_CLEAR_COLOR) {
+      uint surfIndex = 0;
+      uint clearValue;
 
-      if (ps->format != PIPE_FORMAT_A8R8G8B8_UNORM) {
-         clearValue = convert_color(PIPE_FORMAT_A8R8G8B8_UNORM, clearValue,
-                                    ps->format);
-      }
+      util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &clearValue);
+
+      /* Build a CLEAR command and place it in the current batch buffer */
+      STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0);
+      struct cell_command_clear_surface *clr
+         = (struct cell_command_clear_surface *)
+         cell_batch_alloc16(cell, sizeof(*clr));
+      clr->opcode[0] = CELL_CMD_CLEAR_SURFACE;
+      clr->surface = surfIndex;
+      clr->value = clearValue;
    }
 
+   if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+      uint surfIndex = 1;
+      uint clearValue;
 
-   /* Build a CLEAR command and place it in the current batch buffer */
-   {
+      clearValue = util_pack_z_stencil(cell->framebuffer.zsbuf->format,
+                                       depth, stencil);
+
+      /* Build a CLEAR command and place it in the current batch buffer */
       STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0);
       struct cell_command_clear_surface *clr
          = (struct cell_command_clear_surface *)
@@ -101,17 +89,4 @@ cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
       clr->surface = surfIndex;
       clr->value = clearValue;
    }
-
-   /* Technically, the surface's contents are now known and cleared,
-    * so we could set the status to PIPE_SURFACE_STATUS_CLEAR.  But
-    * it turns out it's quite painful to recognize when any particular
-    * surface goes from PIPE_SURFACE_STATUS_CLEAR to 
-    * PIPE_SURFACE_STATUS_DEFINED (i.e. with known contents), because
-    * the drawing commands could be operating on numerous draw buffers,
-    * which we'd have to iterate through to set all their stati...
-    * For now, we cheat a bit and set the surface's status to DEFINED
-    * right here.  Later we should revisit this and set the status to
-    * CLEAR here, and find a better place to set the status to DEFINED.
-    */
-   ps->status = PIPE_SURFACE_STATUS_DEFINED;
 }
index ff47d43..08e091a 100644 (file)
 
 
 struct pipe_context;
-struct pipe_surface;
 
 
 extern void
-cell_clear_surface(struct pipe_context *pipe, struct pipe_surface *ps,
-                   unsigned clearValue);
-
+cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+           double depth, unsigned stencil);
 
 
 #endif /* CELL_CLEAR_H */
index ae82ded..808be58 100644 (file)
@@ -119,7 +119,7 @@ cell_create_context(struct pipe_screen *screen,
    cell->pipe.screen = screen;
    cell->pipe.destroy = cell_destroy_context;
 
-   cell->pipe.clear = cell_clear_surface;
+   cell->pipe.clear = cell_clear;
    cell->pipe.flush = cell_flush;
 
 #if 0
index 8a2d3ca..90530f2 100644 (file)
  * 
  **************************************************************************/
 
-/* Author:
+/* Authors:
  *    Brian Paul
  */
 
 
-#include "pipe/p_defines.h"
+#include "util/u_clear.h"
 #include "i915_context.h"
 #include "i915_state.h"
 
 
 /**
- * Clear the given surface to the specified value.
+ * Clear the given buffers to the specified values.
  * No masking, no scissor (clear entire buffer).
  */
 void
-i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-          unsigned clearValue)
+i915_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+          double depth, unsigned stencil)
 {
-   pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-   ps->status = PIPE_SURFACE_STATUS_DEFINED;
+   util_clear(pipe, &i915_context(pipe)->framebuffer, buffers, rgba, depth,
+              stencil);
 }
index 3cdabe4..b6983ba 100644 (file)
@@ -314,8 +314,8 @@ void i915_emit_hardware_state(struct i915_context *i915 );
 /***********************************************************************
  * i915_clear.c: 
  */
-void i915_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-               unsigned clearValue);
+void i915_clear( struct pipe_context *pipe, unsigned buffers, const float *rgba,
+                 double depth, unsigned stencil);
 
 
 /***********************************************************************
index 39aca9f..ca8e87a 100644 (file)
@@ -677,7 +677,6 @@ i915_get_tex_surface(struct pipe_screen *screen,
       ps->height = pt->height[level];
       ps->offset = offset;
       ps->usage = flags;
-      ps->status = PIPE_SURFACE_STATUS_DEFINED;
    }
    return ps;
 }
@@ -725,14 +724,6 @@ i915_init_texture_functions(struct i915_context *i915)
 static void
 i915_tex_surface_destroy(struct pipe_surface *surf)
 {
-   /* This really should not be possible, but it's actually
-    * happening quite a bit...  Will fix.
-    */
-   if (surf->status == PIPE_SURFACE_STATUS_CLEAR) {
-      debug_printf("XXX destroying a surface with pending clears...\n");
-      assert(0);
-   }
-
    pipe_texture_reference(&surf->texture, NULL);
    FREE(surf);
 }
index 9379a39..715d2d2 100644 (file)
 
 #define BRW_RASTRULE_UPPER_LEFT  0
 #define BRW_RASTRULE_UPPER_RIGHT 1
+/* These are listed as "Reserved, but not seen as useful"
+ * in Intel documentation (page 212, "Point Rasterization Rule",
+ * section 7.4 "SF Pipeline State Summary", of document
+ * "Intel® 965 Express Chipset Family and Intel® G35 Express
+ * Chipset Graphics Controller Programmer's Reference Manual,
+ * Volume 2: 3D/Media", Revision 1.0b as of January 2008,
+ * available at 
+ *     http://intellinuxgraphics.org/documentation.html
+ * at the time of this writing).
+ *
+ * These appear to be supported on at least some
+ * i965-family devices, and the BRW_RASTRULE_LOWER_RIGHT
+ * is useful when using OpenGL to render to a FBO
+ * (which has the pixel coordinate Y orientation inverted
+ * with respect to the normal OpenGL pixel coordinate system).
+ */
+#define BRW_RASTRULE_LOWER_LEFT  2
+#define BRW_RASTRULE_LOWER_RIGHT 3
 
 #define BRW_RENDERTARGET_CLAMPRANGE_UNORM    0
 #define BRW_RENDERTARGET_CLAMPRANGE_SNORM    1
index c921c0d..f44bd17 100644 (file)
@@ -363,7 +363,6 @@ brw_get_tex_surface_screen(struct pipe_screen *screen,
       ps->nblocksy = pt->nblocksy[level];
       ps->stride = tex->stride;
       ps->offset = offset;
-      ps->status = PIPE_SURFACE_STATUS_DEFINED;
    }
    return ps;
 }
index 9785911..a54820e 100644 (file)
@@ -46,9 +46,12 @@ static INLINE void
 so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
 {
        struct nouveau_stateobj *so = *pso;
+       int i;
 
         if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) {
                free(so->push);
+               for (i = 0; i < so->cur_reloc; i++)
+                       pipe_buffer_reference(&so->reloc[i].bo, NULL);
                free(so->reloc);
                free(so);
        }
@@ -83,7 +86,8 @@ so_reloc(struct nouveau_stateobj *so, struct pipe_buffer *bo,
 {
        struct nouveau_stateobj_reloc *r = &so->reloc[so->cur_reloc++];
        
-       r->bo = bo;
+       r->bo = NULL;
+       pipe_buffer_reference(&r->bo, bo);
        r->offset = so->cur - so->push;
        r->packet = so->cur_packet;
        r->data = data;
index 85dc017..4da833c 100644 (file)
@@ -122,7 +122,6 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index be7e09c..a39a2b5 100644 (file)
@@ -1,12 +1,14 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
+#include "util/u_clear.h"
 
 #include "nv10_context.h"
 
 void
-nv10_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-          unsigned clearValue)
+nv10_clear(struct pipe_context *pipe, unsigned buffers,
+           const float *rgba, double depth, unsigned stencil)
 {
-       pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
+       util_clear(pipe, nv10_context(pipe)->framebuffer, buffers, rgba, depth,
+                  stencil);
 }
index f3b56de..f1e003c 100644 (file)
@@ -118,8 +118,9 @@ extern void nv10_init_surface_functions(struct nv10_context *nv10);
 extern void nv10_screen_init_miptree_functions(struct pipe_screen *pscreen);
 
 /* nv10_clear.c */
-extern void nv10_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-                      unsigned clearValue);
+extern void nv10_clear(struct pipe_context *pipe, unsigned buffers,
+                      const float *rgba, double depth, unsigned stencil);
+
 
 /* nv10_draw.c */
 extern struct draw_stage *nv10_draw_render_stage(struct nv10_context *nv10);
index bb3a1c0..34e3c2e 100644 (file)
@@ -136,7 +136,6 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index 29f4afd..2b4490f 100644 (file)
@@ -1,13 +1,14 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
+#include "util/u_clear.h"
 
 #include "nv20_context.h"
 
 void
-nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-          unsigned clearValue)
+nv20_clear(struct pipe_context *pipe, unsigned buffers,
+           const float *rgba, double depth, unsigned stencil)
 {
-       pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-       ps->status = PIPE_SURFACE_STATUS_CLEAR;
+       util_clear(pipe, nv20_context(pipe)->framebuffer, buffers, rgba, depth,
+                  stencil);
 }
index 8ad926d..fc932f1 100644 (file)
@@ -118,8 +118,8 @@ extern void nv20_init_surface_functions(struct nv20_context *nv20);
 extern void nv20_screen_init_miptree_functions(struct pipe_screen *pscreen);
 
 /* nv20_clear.c */
-extern void nv20_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-                      unsigned clearValue);
+extern void nv20_clear(struct pipe_context *pipe, unsigned buffers,
+                      const float *rgba, double depth, unsigned stencil);
 
 /* nv20_draw.c */
 extern struct draw_stage *nv20_draw_render_stage(struct nv20_context *nv20);
index b2f29af..185fbf5 100644 (file)
@@ -170,7 +170,6 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index 8c3ca20..c4ba926 100644 (file)
@@ -1,13 +1,14 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
+#include "util/u_clear.h"
 
 #include "nv30_context.h"
 
 void
-nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-          unsigned clearValue)
+nv30_clear(struct pipe_context *pipe, unsigned buffers,
+           const float *rgba, double depth, unsigned stencil)
 {
-       pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-       ps->status = PIPE_SURFACE_STATUS_CLEAR;
+       util_clear(pipe, &nv30_context(pipe)->framebuffer, buffers, rgba, depth,
+                  stencil);
 }
index b933769..4229c0a 100644 (file)
@@ -206,7 +206,7 @@ extern boolean nv30_draw_elements(struct pipe_context *pipe,
                                  unsigned count);
 
 /* nv30_clear.c */
-extern void nv30_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-                      unsigned clearValue);
+extern void nv30_clear(struct pipe_context *pipe, unsigned buffers,
+                      const float *rgba, double depth, unsigned stencil);
 
 #endif
index d6dc621..7f8054d 100644 (file)
@@ -177,7 +177,6 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index f77b08f..c18be20 100644 (file)
@@ -21,14 +21,6 @@ static void
 nv30_state_do_validate(struct nv30_context *nv30,
                       struct nv30_state_entry **states)
 {
-       const struct pipe_framebuffer_state *fb = &nv30->framebuffer;
-       unsigned i;
-
-       for (i = 0; i < fb->nr_cbufs; i++)
-               fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-       if (fb->zsbuf)
-               fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
        while (*states) {
                struct nv30_state_entry *e = *states;
 
index 59efd62..ddf13ad 100644 (file)
@@ -1,13 +1,14 @@
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_state.h"
+#include "util/u_clear.h"
 
 #include "nv40_context.h"
 
 void
-nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-          unsigned clearValue)
+nv40_clear(struct pipe_context *pipe, unsigned buffers,
+           const float *rgba, double depth, unsigned stencil)
 {
-       pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
-       ps->status = PIPE_SURFACE_STATUS_CLEAR;
+       util_clear(pipe, &nv40_context(pipe)->framebuffer, buffers, rgba, depth,
+                  stencil);
 }
index adcfbdd..97bc832 100644 (file)
@@ -227,7 +227,7 @@ extern boolean nv40_draw_elements(struct pipe_context *pipe,
                                  unsigned count);
 
 /* nv40_clear.c */
-extern void nv40_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-                      unsigned clearValue);
+extern void nv40_clear(struct pipe_context *pipe, unsigned buffers,
+                      const float *rgba, double depth, unsigned stencil);
 
 #endif
index abadca8..5a201cc 100644 (file)
@@ -176,7 +176,6 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        ns->base.width = pt->width[level];
        ns->base.height = pt->height[level];
        ns->base.usage = flags;
-       ns->base.status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ns->base.reference, 1);
        ns->base.face = face;
        ns->base.level = level;
index ce859de..10aae29 100644 (file)
@@ -38,14 +38,6 @@ static void
 nv40_state_do_validate(struct nv40_context *nv40,
                       struct nv40_state_entry **states)
 {
-       const struct pipe_framebuffer_state *fb = &nv40->framebuffer;
-       unsigned i;
-
-       for (i = 0; i < fb->nr_cbufs; i++)
-               fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-       if (fb->zsbuf)
-               fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
        while (*states) {
                struct nv40_state_entry *e = *states;
 
index f9bc3b5..db44a9d 100644 (file)
@@ -86,7 +86,5 @@ nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
        pipe->set_framebuffer_state(pipe, &s_fb);
        pipe->set_scissor_state(pipe, &s_sc);
        nv50->dirty |= dirty;
-
-       ps->status = PIPE_SURFACE_STATUS_CLEAR;
 }
 
index 313e435..7b67a75 100644 (file)
@@ -184,8 +184,8 @@ extern boolean nv50_draw_elements(struct pipe_context *pipe,
 extern void nv50_vbo_validate(struct nv50_context *nv50);
 
 /* nv50_clear.c */
-extern void nv50_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-                      unsigned clearValue);
+extern void nv50_clear(struct pipe_context *pipe, unsigned buffers,
+                      const float *rgba, double depth, unsigned stencil);
 
 /* nv50_program.c */
 extern void nv50_vertprog_validate(struct nv50_context *nv50);
index dc4688c..f79a7ca 100644 (file)
@@ -163,7 +163,6 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt,
        ps->width = pt->width[level];
        ps->height = pt->height[level];
        ps->usage = flags;
-       ps->status = PIPE_SURFACE_STATUS_DEFINED;
        pipe_reference_init(&ps->reference, 1);
        ps->face = face;
        ps->level = level;
index a2c56f9..35cebdb 100644 (file)
@@ -41,7 +41,7 @@ nv50_query(struct pipe_query *pipe)
 static struct pipe_query *
 nv50_query_create(struct pipe_context *pipe, unsigned type)
 {
-       struct pipe_screen *screen = pipe->winsys;
+       struct pipe_screen *screen = pipe->screen;
        struct nv50_query *q = CALLOC_STRUCT(nv50_query);
 
        assert (q->type == PIPE_QUERY_OCCLUSION_COUNTER);
index 85098a7..c13d3de 100644 (file)
@@ -178,17 +178,10 @@ nv50_state_emit(struct nv50_context *nv50)
 boolean
 nv50_state_validate(struct nv50_context *nv50)
 {
-       const struct pipe_framebuffer_state *fb = &nv50->framebuffer;
        struct nouveau_grobj *tesla = nv50->screen->tesla;
        struct nouveau_stateobj *so;
        unsigned i;
 
-       for (i = 0; i < fb->nr_cbufs; i++)
-               fb->cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-
-       if (fb->zsbuf)
-               fb->zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-
        if (nv50->dirty & NV50_NEW_FRAMEBUFFER)
                nv50_state_validate_fb(nv50);
 
@@ -251,7 +244,7 @@ nv50_state_validate(struct nv50_context *nv50)
        }
 scissor_uptodate:
 
-       if (nv50->dirty & NV50_NEW_VIEWPORT) {
+       if (nv50->dirty & (NV50_NEW_VIEWPORT | NV50_NEW_RASTERIZER)) {
                unsigned bypass;
 
                if (!nv50->rasterizer->pipe.bypass_vs_clip_and_viewport)
@@ -288,6 +281,7 @@ scissor_uptodate:
 
                so_ref(so, &nv50->state.viewport);
                so_ref(NULL, &so);
+               nv50->state.dirty |= NV50_NEW_VIEWPORT;
        }
 viewport_uptodate:
 
index 0e4e115..e44f9b9 100644 (file)
@@ -11,13 +11,14 @@ C_SOURCES = \
        r300_emit.c \
        r300_flush.c \
        r300_query.c \
+       r300_render.c \
        r300_screen.c \
        r300_state.c \
        r300_state_derived.c \
        r300_state_invariant.c \
        r300_state_shader.c \
+       r300_state_tcl.c \
        r300_surface.c \
-       r300_swtcl_emit.c \
        r300_texture.c
 
 include ../../Makefile.template
index 18684c3..182ed2d 100644 (file)
@@ -3,15 +3,25 @@ Import('*')
 env = env.Clone()
 
 r300 = env.ConvenienceLibrary(
-       target = 'r300',
-       source = [
-               'r300_blit.c',
-               'r300_clear.c',
-               'r300_context.c',
-               'r300_screen.c',
-               'r300_state.c',
-               'r300_surface.c',
-       ])
+    target = 'r300',
+    source = [
+        'r300_chipset.c',
+        'r300_clear.c',
+        'r300_context.c',
+        'r300_debug.c',
+        'r300_emit.c',
+        'r300_flush.c',
+        'r300_query.c',
+        'r300_render.c',
+        'r300_screen.c',
+        'r300_state.c',
+        'r300_state_derived.c',
+        'r300_state_invariant.c',
+        'r300_state_shader.c',
+        'r300_state_tcl.c',
+        'r300_surface.c',
+        'r300_texture.c',
+    ])
 
 Export('r300')
 
index e01a054..9d95ad9 100644 (file)
@@ -30,7 +30,7 @@
 void r300_parse_chipset(struct r300_capabilities* caps)
 {
     /* Reasonable defaults */
-    caps->has_tcl = getenv("RADEON_NO_TCL") ? TRUE : FALSE;
+    caps->has_tcl = getenv("RADEON_NO_TCL") ? FALSE : TRUE;
     caps->is_r500 = FALSE;
     caps->num_vert_fpus = 4;
 
index fd28437..8b9cb81 100644 (file)
 
 #include "r300_clear.h"
 
-/* This gets its own file because Intel's is in its own file.
- * I assume there's a good reason. */
+/* Clears currently bound buffers. */
 void r300_clear(struct pipe_context* pipe,
-                struct pipe_surface* ps,
-                unsigned color)
+                unsigned buffers,
+                const float* rgba,
+                double depth,
+                unsigned stencil)
 {
-    pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color);
-    ps->status = PIPE_SURFACE_STATUS_DEFINED;
-}
\ No newline at end of file
+    /* XXX we can and should do one clear if both color and zs are set */
+    util_clear(pipe, &r300_context(pipe)->framebuffer_state,
+            buffers, rgba, depth, stencil);
+}
index e24a069..cd59005 100644 (file)
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
 
-#include "pipe/p_context.h"
+#ifndef R300_CLEAR_H
+#define R300_CLEAR_H
+
+#include "util/u_clear.h"
+
+#include "r300_context.h"
 
 void r300_clear(struct pipe_context* pipe,
-                struct pipe_surface* ps,
-                unsigned color);
+                unsigned buffers,
+                const float* rgba,
+                double depth,
+                unsigned stencil);
+
+#endif /* R300_CLEAR_H */
index b858470..31efe91 100644 (file)
@@ -125,7 +125,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
     r300->context.draw_range_elements = r300_draw_range_elements;
 
     r300->draw = draw_create();
-    draw_set_rasterize_stage(r300->draw, r300_draw_swtcl_stage(r300));
+    draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300));
 
     r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
     r300->rs_block = CALLOC_STRUCT(r300_rs_block);
index 0e5e471..fec2bad 100644 (file)
@@ -169,10 +169,7 @@ struct r300_fragment_shader {
     int indirections;
 
     /* Indirection node offsets */
-    int offset0;
-    int offset1;
-    int offset2;
-    int offset3;
+    int alu_offset[4];
 
     /* Machine instructions */
     struct {
@@ -234,6 +231,29 @@ struct r300_vertex_format {
     int tab[16];
 };
 
+struct r300_vertex_shader {
+    /* Parent class */
+    struct pipe_shader_state state;
+    struct tgsi_shader_info info;
+
+    /* Fallback shader, because Draw has issues */
+    struct draw_vertex_shader* draw;
+
+    /* Has this shader been translated yet? */
+    boolean translated;
+
+    /* Number of used instructions */
+    int instruction_count;
+
+    /* Machine instructions */
+    struct {
+        uint32_t inst0;
+        uint32_t inst1;
+        uint32_t inst2;
+        uint32_t inst3;
+    } instructions[128]; /*< XXX magic number */
+};
+
 struct r300_context {
     /* Parent class */
     struct pipe_context context;
@@ -273,6 +293,8 @@ struct r300_context {
     int vertex_buffer_count;
     /* Vertex information. */
     struct r300_vertex_format vertex_info;
+    /* Vertex shader. */
+    struct r300_vertex_shader* vs;
     /* Viewport state. */
     struct r300_viewport_state* viewport_state;
     /* Bitmask of dirty state objects. */
@@ -287,7 +309,7 @@ static struct r300_context* r300_context(struct pipe_context* context) {
 }
 
 /* Context initialization. */
-struct draw_stage* r300_draw_swtcl_stage(struct r300_context* r300);
+struct draw_stage* r300_draw_stage(struct r300_context* r300);
 void r300_init_state_functions(struct r300_context* r300);
 void r300_init_surface_functions(struct r300_context* r300);
 
index 9913678..5d9799d 100644 (file)
     OUT_CS(CP_PACKET3(op, count)); \
 } while (0)
 
+#define OUT_CS_INDEX_RELOC(bo, offset, count, rd, wd, flags) do { \
+    debug_printf("r300: writing relocation for index buffer %p," \
+            "offset %d\n", bo, offset); \
+    assert(bo); \
+    OUT_CS(offset); \
+    OUT_CS(count); \
+    cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \
+    cs_count -= 2; \
+} while (0)
+
 #endif /* R300_CS_H */
index f657588..dd63136 100644 (file)
 
 #include "r300_debug.h"
 
+static void r300_dump_fs(struct r300_fragment_shader* fs)
+{
+    int i;
+
+    for (i = 0; i < fs->alu_instruction_count; i++) {
+    }
+}
+
 static char* r500_fs_swiz[] = {
     " R",
     " G",
@@ -216,3 +224,15 @@ void r500_fs_dump(struct r500_fragment_shader* fs)
         }
     }
 }
+
+void r300_vs_dump(struct r300_vertex_shader* vs)
+{
+    int i;
+
+    for (i = 0; i < vs->instruction_count; i++) {
+        debug_printf("inst0: 0x%x\n", vs->instructions[i].inst0);
+        debug_printf("inst1: 0x%x\n", vs->instructions[i].inst1);
+        debug_printf("inst2: 0x%x\n", vs->instructions[i].inst2);
+        debug_printf("inst3: 0x%x\n", vs->instructions[i].inst3);
+    }
+}
index de5d701..a1f8736 100644 (file)
 
 #include "r300_reg.h"
 #include "r300_state_shader.h"
+#include "r300_state_tcl.h"
 
 void r500_fs_dump(struct r500_fragment_shader* fs);
 
+void r300_vs_dump(struct r300_vertex_shader* vs);
+
 #endif /* R300_DEBUG_H */
index 9bfb896..a3d8337 100644 (file)
@@ -82,20 +82,20 @@ void r300_emit_dsa_state(struct r300_context* r300,
 void r300_emit_fragment_shader(struct r300_context* r300,
                                struct r300_fragment_shader* fs)
 {
-    CS_LOCALS(r300);
     int i;
+    CS_LOCALS(r300);
 
     BEGIN_CS(22);
 
-    OUT_CS_REG(R300_US_CONFIG, MAX2(fs->indirections - 1, 0));
+    OUT_CS_REG(R300_US_CONFIG, fs->indirections);
     OUT_CS_REG(R300_US_PIXSIZE, fs->shader.stack_size);
     /* XXX figure out exactly how big the sizes are on this reg */
-    OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
+    OUT_CS_REG(R300_US_CODE_OFFSET, 0x40);
     /* XXX figure these ones out a bit better kthnx */
     OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
     OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
     OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
-    OUT_CS_REG(R300_US_CODE_ADDR_3, R300_RGBA_OUT);
+    OUT_CS_REG(R300_US_CODE_ADDR_3, 0x40 | R300_RGBA_OUT);
 
     for (i = 0; i < fs->alu_instruction_count; i++) {
         OUT_CS_REG(R300_US_ALU_RGB_INST_0 + (4 * i),
@@ -114,10 +114,10 @@ void r300_emit_fragment_shader(struct r300_context* r300,
 void r500_emit_fragment_shader(struct r300_context* r300,
                                struct r500_fragment_shader* fs)
 {
-    CS_LOCALS(r300);
+    int i;
     struct r300_constant_buffer* constants =
         &r300->shader_constants[PIPE_SHADER_FRAGMENT];
-    int i;
+    CS_LOCALS(r300);
 
     BEGIN_CS(9 + (fs->instruction_count * 6) + (constants->count ? 3 : 0) +
             (constants->count * 4));
@@ -156,9 +156,9 @@ void r500_emit_fragment_shader(struct r300_context* r300,
 void r300_emit_fb_state(struct r300_context* r300,
                         struct pipe_framebuffer_state* fb)
 {
-    CS_LOCALS(r300);
-    struct r300_texture* tex;
     int i;
+    struct r300_texture* tex;
+    CS_LOCALS(r300);
 
     BEGIN_CS((6 * fb->nr_cbufs) + (fb->zsbuf ? 6 : 0) + 4);
     for (i = 0; i < fb->nr_cbufs; i++) {
@@ -217,9 +217,9 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs)
 void r300_emit_rs_block_state(struct r300_context* r300,
                               struct r300_rs_block* rs)
 {
+    int i;
     struct r300_screen* r300screen = r300_screen(r300->context.screen);
     CS_LOCALS(r300);
-    int i;
 
     BEGIN_CS(21);
     if (r300screen->caps->is_r500) {
@@ -293,8 +293,8 @@ void r300_emit_texture(struct r300_context* r300,
 
 void r300_emit_vertex_format_state(struct r300_context* r300)
 {
-    CS_LOCALS(r300);
     int i;
+    CS_LOCALS(r300);
 
     BEGIN_CS(26);
     OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info.vinfo.size);
@@ -325,25 +325,80 @@ void r300_emit_vertex_format_state(struct r300_context* r300)
     END_CS;
 }
 
+void r300_emit_vertex_shader(struct r300_context* r300,
+                             struct r300_vertex_shader* vs)
+{
+    int i;
+    struct r300_screen* r300screen = r300_screen(r300->context.screen);
+    struct r300_constant_buffer* constants =
+        &r300->shader_constants[PIPE_SHADER_VERTEX];
+    CS_LOCALS(r300);
+
+    if (!r300screen->caps->has_tcl) {
+        debug_printf("r300: Implementation error: emit_vertex_shader called,"
+                " but has_tcl is FALSE!\n");
+        return;
+    }
+
+    BEGIN_CS(13 + (vs->instruction_count * 4) + (constants->count * 4));
+
+    OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, R300_PVS_FIRST_INST(0) |
+            R300_PVS_LAST_INST(vs->instruction_count - 1));
+    OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, vs->instruction_count - 1);
+
+    /* XXX */
+    OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x0);
+
+    OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0);
+    OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, vs->instruction_count * 4);
+    for (i = 0; i < vs->instruction_count; i++) {
+        OUT_CS(vs->instructions[i].inst0);
+        OUT_CS(vs->instructions[i].inst1);
+        OUT_CS(vs->instructions[i].inst2);
+        OUT_CS(vs->instructions[i].inst3);
+    }
+
+    if (constants->count) {
+        OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG,
+                (r300screen->caps->is_r500 ?
+                 R500_PVS_CONST_START : R300_PVS_CONST_START));
+        OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, constants->count * 4);
+        for (i = 0; i < constants->count; i++) {
+            OUT_CS_32F(constants->constants[i][0]);
+            OUT_CS_32F(constants->constants[i][1]);
+            OUT_CS_32F(constants->constants[i][2]);
+            OUT_CS_32F(constants->constants[i][3]);
+        }
+    }
+
+    OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(10) |
+            R300_PVS_NUM_CNTLRS(5) |
+            R300_PVS_NUM_FPUS(r300screen->caps->num_vert_fpus) |
+            R300_PVS_VF_MAX_VTX_NUM(12));
+    OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
+    END_CS;
+
+}
+
 void r300_emit_viewport_state(struct r300_context* r300,
                               struct r300_viewport_state* viewport)
 {
-    return;
     CS_LOCALS(r300);
 
-    BEGIN_CS(7);
-    OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 7);
+    BEGIN_CS(9);
+    OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
     OUT_CS_32F(viewport->xscale);
     OUT_CS_32F(viewport->xoffset);
     OUT_CS_32F(viewport->yscale);
     OUT_CS_32F(viewport->yoffset);
     OUT_CS_32F(viewport->zscale);
     OUT_CS_32F(viewport->zoffset);
-    OUT_CS(viewport->vte_control);
+
+    OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control);
     END_CS;
 }
 
-static void r300_flush_textures(struct r300_context* r300)
+void r300_flush_textures(struct r300_context* r300)
 {
     CS_LOCALS(r300);
 
index 0bc1f90..31dbc7a 100644 (file)
@@ -64,9 +64,14 @@ void r300_emit_texture(struct r300_context* r300,
 
 void r300_emit_vertex_format_state(struct r300_context* r300);
 
+void r300_emit_vertex_shader(struct r300_context* r300,
+                             struct r300_vertex_shader* vs);
+
 void r300_emit_viewport_state(struct r300_context* r300,
                               struct r300_viewport_state* viewport);
 
+void r300_flush_textures(struct r300_context* r300);
+
 /* Emit all dirty state. */
 void r300_emit_dirty_state(struct r300_context* r300);
 
index 5f5f4c4..8fc61c2 100644 (file)
@@ -46,12 +46,12 @@ static void r300_destroy_query(struct pipe_context* pipe,
 static void r300_begin_query(struct pipe_context* pipe,
                              struct pipe_query* query)
 {
+    uint32_t* map;
     struct r300_context* r300 = r300_context(pipe);
     struct r300_query* q = (struct r300_query*)query;
     CS_LOCALS(r300);
 
-    uint32_t* map = pipe_buffer_map(pipe->screen, q->buf,
-            PIPE_BUFFER_USAGE_CPU_WRITE);
+    map = pipe_buffer_map(pipe->screen, q->buf, PIPE_BUFFER_USAGE_CPU_WRITE);
     *map = ~0;
     pipe_buffer_unmap(pipe->screen, q->buf);
 
@@ -79,6 +79,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
                                      uint64_t* result)
 {
     struct r300_query* q = (struct r300_query*)query;
+    uint32_t* map;
     uint32_t temp;
 
     if (wait) {
@@ -88,8 +89,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe,
         pipe->flush(pipe, 0, NULL);
     }
 
-    uint32_t* map = pipe_buffer_map(pipe->screen, q->buf,
-            PIPE_BUFFER_USAGE_CPU_READ);
+    map = pipe_buffer_map(pipe->screen, q->buf, PIPE_BUFFER_USAGE_CPU_READ);
     temp = *map;
     pipe_buffer_unmap(pipe->screen, q->buf);
 
index 3fe45e1..660816e 100644 (file)
@@ -73,6 +73,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_PVS_NUM_CNTLRS_SHIFT                4
 #       define R300_PVS_NUM_FPUS_SHIFT                  8
 #       define R300_VF_MAX_VTX_NUM_SHIFT                18
+#       define R300_PVS_NUM_SLOTS(x)                    ((x) << 0)
+#       define R300_PVS_NUM_CNTLRS(x)                   ((x) << 4)
+#       define R300_PVS_NUM_FPUS(x)                     ((x) << 8)
+#       define R300_PVS_VF_MAX_VTX_NUM(x)               ((x) << 18)
 #       define R300_GL_CLIP_SPACE_DEF                   (0 << 22)
 #       define R300_DX_CLIP_SPACE_DEF                   (1 << 22)
 #       define R500_TCL_STATE_OPTIMIZATION              (1 << 23)
@@ -506,6 +510,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_PVS_FIRST_INST_SHIFT         0
 #       define R300_PVS_XYZW_VALID_INST_SHIFT    10
 #       define R300_PVS_LAST_INST_SHIFT          20
+#       define R300_PVS_FIRST_INST(x)            ((x) << 0)
+#       define R300_PVS_LAST_INST(x)             ((x) << 20)
 /* Addresses are relative the the vertex program parameters area. */
 #define R300_VAP_PVS_CONST_CNTL             0x22D4
 #       define R300_PVS_CONST_BASE_OFFSET_SHIFT  0
@@ -1191,6 +1197,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #       define R300_RS_INST_COUNT_MASK           0x0000000f
 #       define R300_RS_TX_OFFSET_SHIFT           5
 #      define R300_RS_TX_OFFSET_MASK            0x000000e0
+#       define R300_RS_TX_OFFSET(x)              ((x) << 5)
 
 /* gap */
 
@@ -1434,6 +1441,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_TX_MAX_ANISO_8_TO_1          (3 << 21)
 #      define R300_TX_MAX_ANISO_16_TO_1         (4 << 21)
 #      define R300_TX_MAX_ANISO_MASK            (7 << 21)
+#       define R300_TX_WRAP_S(x)                 ((x) << 0)
+#       define R300_TX_WRAP_T(x)                 ((x) << 3)
 
 #define R300_TX_FILTER1_0                      0x4440
 #      define R300_CHROMA_KEY_MODE_DISABLE    0
similarity index 74%
rename from src/gallium/drivers/r300/r300_swtcl_emit.c
rename to src/gallium/drivers/r300/r300_render.c
index 83c25f4..b7ee8fb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
+ * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -29,9 +29,9 @@
 #include "r300_reg.h"
 #include "r300_state_derived.h"
 
-/* r300_swtcl_emit: Vertex and index buffer primitive emission. No HW TCL. */
+/* r300_render: Vertex and index buffer primitive emission. */
 
-struct r300_swtcl_render {
+struct r300_render {
     /* Parent class */
     struct vbuf_render base;
     
@@ -52,16 +52,16 @@ struct r300_swtcl_render {
     size_t vbo_max_used;
 };
 
-static INLINE struct r300_swtcl_render*
-r300_swtcl_render(struct vbuf_render* render)
+static INLINE struct r300_render*
+r300_render(struct vbuf_render* render)
 {
-    return (struct r300_swtcl_render*)render;
+    return (struct r300_render*)render;
 }
 
 static const struct vertex_info*
-r300_swtcl_render_get_vertex_info(struct vbuf_render* render)
+r300_render_get_vertex_info(struct vbuf_render* render)
 {
-    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_render* r300render = r300_render(render);
     struct r300_context* r300 = r300render->r300;
 
     r300_update_derived_state(r300);
@@ -69,11 +69,11 @@ r300_swtcl_render_get_vertex_info(struct vbuf_render* render)
     return &r300->vertex_info.vinfo;
 }
 
-static boolean r300_swtcl_render_allocate_vertices(struct vbuf_render* render,
+static boolean r300_render_allocate_vertices(struct vbuf_render* render,
                                                    ushort vertex_size,
                                                    ushort count)
 {
-    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_render* r300render = r300_render(render);
     struct r300_context* r300 = r300render->r300;
     struct pipe_screen* screen = r300->context.screen;
     size_t size = (size_t)vertex_size * (size_t)count;
@@ -98,9 +98,9 @@ static boolean r300_swtcl_render_allocate_vertices(struct vbuf_render* render,
     }
 }
 
-static void* r300_swtcl_render_map_vertices(struct vbuf_render* render)
+static void* r300_render_map_vertices(struct vbuf_render* render)
 {
-    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_render* r300render = r300_render(render);
     struct pipe_screen* screen = r300render->r300->context.screen;
 
     r300render->vbo_map = pipe_buffer_map(screen, r300render->vbo,
@@ -109,11 +109,11 @@ static void* r300_swtcl_render_map_vertices(struct vbuf_render* render)
     return (unsigned char*)r300render->vbo_map + r300render->vbo_offset;
 }
 
-static void r300_swtcl_render_unmap_vertices(struct vbuf_render* render,
+static void r300_render_unmap_vertices(struct vbuf_render* render,
                                              ushort min,
                                              ushort max)
 {
-    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_render* r300render = r300_render(render);
     struct pipe_screen* screen = r300render->r300->context.screen;
 
     r300render->vbo_max_used = MAX2(r300render->vbo_max_used,
@@ -122,17 +122,17 @@ static void r300_swtcl_render_unmap_vertices(struct vbuf_render* render,
     pipe_buffer_unmap(screen, r300render->vbo);
 }
 
-static void r300_swtcl_render_release_vertices(struct vbuf_render* render)
+static void r300_render_release_vertices(struct vbuf_render* render)
 {
-    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_render* r300render = r300_render(render);
 
     pipe_buffer_reference(&r300render->vbo, NULL);
 }
 
-static boolean r300_swtcl_render_set_primitive(struct vbuf_render* render,
+static boolean r300_render_set_primitive(struct vbuf_render* render,
                                                unsigned prim)
 {
-    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_render* r300render = r300_render(render);
     r300render->prim = prim;
 
     switch (prim) {
@@ -174,7 +174,7 @@ static boolean r300_swtcl_render_set_primitive(struct vbuf_render* render,
     return TRUE;
 }
 
-static void prepare_render(struct r300_swtcl_render* render, unsigned count)
+static void prepare_render(struct r300_render* render, unsigned count)
 {
     struct r300_context* r300 = render->r300;
 
@@ -203,11 +203,11 @@ static void prepare_render(struct r300_swtcl_render* render, unsigned count)
     END_CS;
 }
 
-static void r300_swtcl_render_draw_arrays(struct vbuf_render* render,
+static void r300_render_draw_arrays(struct vbuf_render* render,
                                           unsigned start,
                                           unsigned count)
 {
-    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_render* r300render = r300_render(render);
     struct r300_context* r300 = r300render->r300;
 
     CS_LOCALS(r300);
@@ -225,11 +225,11 @@ static void r300_swtcl_render_draw_arrays(struct vbuf_render* render,
     END_CS;
 }
 
-static void r300_swtcl_render_draw(struct vbuf_render* render,
+static void r300_render_draw(struct vbuf_render* render,
                                    const ushort* indices,
                                    uint count)
 {
-    struct r300_swtcl_render* r300render = r300_swtcl_render(render);
+    struct r300_render* r300render = r300_render(render);
     struct r300_context* r300 = r300render->r300;
     struct pipe_screen* screen = r300->context.screen;
     struct pipe_buffer* index_buffer;
@@ -241,7 +241,7 @@ static void r300_swtcl_render_draw(struct vbuf_render* render,
 
     /* Send our indices into an index buffer. */
     index_buffer = pipe_buffer_create(screen, 64, PIPE_BUFFER_USAGE_VERTEX,
-                                      count);
+                                      count * 2);
     if (!index_buffer) {
         return;
     }
@@ -253,25 +253,24 @@ static void r300_swtcl_render_draw(struct vbuf_render* render,
 
     debug_printf("r300: Doing indexbuf render, count %d\n", count);
 
-    BEGIN_CS(5);
+    BEGIN_CS(6);
     OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0);
     OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) |
-           r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit);
-
+           r300render->hwprim);
     OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2);
     OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2));
-    OUT_CS_RELOC(index_buffer, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
+    OUT_CS_INDEX_RELOC(index_buffer, 0, count, RADEON_GEM_DOMAIN_GTT, 0, 0);
     END_CS;
 }
 
-static void r300_swtcl_render_destroy(struct vbuf_render* render)
+static void r300_render_destroy(struct vbuf_render* render)
 {
     FREE(render);
 }
 
-static struct vbuf_render* r300_swtcl_render_create(struct r300_context* r300)
+static struct vbuf_render* r300_render_create(struct r300_context* r300)
 {
-    struct r300_swtcl_render* r300render = CALLOC_STRUCT(r300_swtcl_render);
+    struct r300_render* r300render = CALLOC_STRUCT(r300_render);
 
     r300render->r300 = r300;
 
@@ -279,25 +278,25 @@ static struct vbuf_render* r300_swtcl_render_create(struct r300_context* r300)
     r300render->base.max_vertex_buffer_bytes = 128 * 1024;
     r300render->base.max_indices = 16 * 1024;
 
-    r300render->base.get_vertex_info = r300_swtcl_render_get_vertex_info;
-    r300render->base.allocate_vertices = r300_swtcl_render_allocate_vertices;
-    r300render->base.map_vertices = r300_swtcl_render_map_vertices;
-    r300render->base.unmap_vertices = r300_swtcl_render_unmap_vertices;
-    r300render->base.set_primitive = r300_swtcl_render_set_primitive;
-    r300render->base.draw = r300_swtcl_render_draw;
-    r300render->base.draw_arrays = r300_swtcl_render_draw_arrays;
-    r300render->base.release_vertices = r300_swtcl_render_release_vertices;
-    r300render->base.destroy = r300_swtcl_render_destroy;
+    r300render->base.get_vertex_info = r300_render_get_vertex_info;
+    r300render->base.allocate_vertices = r300_render_allocate_vertices;
+    r300render->base.map_vertices = r300_render_map_vertices;
+    r300render->base.unmap_vertices = r300_render_unmap_vertices;
+    r300render->base.set_primitive = r300_render_set_primitive;
+    r300render->base.draw = r300_render_draw;
+    r300render->base.draw_arrays = r300_render_draw_arrays;
+    r300render->base.release_vertices = r300_render_release_vertices;
+    r300render->base.destroy = r300_render_destroy;
 
     return &r300render->base;
 }
 
-struct draw_stage* r300_draw_swtcl_stage(struct r300_context* r300)
+struct draw_stage* r300_draw_stage(struct r300_context* r300)
 {
     struct vbuf_render* render;
     struct draw_stage* stage;
 
-    render = r300_swtcl_render_create(r300);
+    render = r300_render_create(r300);
 
     if (!render) {
         return NULL;
index 2a026e7..2a77fd1 100644 (file)
@@ -132,6 +132,7 @@ static void
                              const struct pipe_constant_buffer* buffer)
 {
     struct r300_context* r300 = r300_context(pipe);
+    int i = r300->shader_constants[shader].user_count;
 
     /* This entire chunk of code seems ever-so-slightly baked.
      * It's as if I've got pipe_buffer* matryoshkas... */
@@ -149,6 +150,17 @@ static void
     }
 
     r300->dirty_state |= R300_NEW_CONSTANTS;
+
+    /* If the number of constants have changed, invalidate the shader. */
+    if (r300->shader_constants[shader].user_count != i) {
+        if (shader == PIPE_SHADER_FRAGMENT && r300->fs) {
+            r300->fs->translated = FALSE;
+            r300_translate_fragment_shader(r300, r300->fs);
+        } else if (shader == PIPE_SHADER_VERTEX && r300->vs) {
+            r300->vs->translated = FALSE;
+            r300_translate_vertex_shader(r300, r300->vs);
+        }
+    }
 }
 
 /* Create a new depth, stencil, and alpha state based on the CSO dsa state.
@@ -293,11 +305,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader)
         r300->fs = NULL;
         return;
     } else if (!fs->translated) {
-        if (r300_screen(r300->context.screen)->caps->is_r500) {
-            r500_translate_fragment_shader(r300, (struct r500_fragment_shader*)fs);
-        } else {
-            r300_translate_fragment_shader(r300, (struct r300_fragment_shader*)fs);
-        }
+        r300_translate_fragment_shader(r300, fs);
     }
 
     fs->translated = TRUE;
@@ -330,9 +338,18 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
 {
     struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state);
 
-    /* XXX this is part of HW TCL */
-    /* XXX endian control */
-    rs->vap_control_status = R300_VAP_TCL_BYPASS;
+    /* Copy rasterizer state for Draw. */
+    rs->rs = *state;
+
+    /* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL.
+     * Else, enable HW TCL and force Draw's TCL off. */
+    if (state->bypass_vs_clip_and_viewport ||
+            !r300_screen(pipe->screen)->caps->has_tcl) {
+        rs->vap_control_status = R300_VAP_TCL_BYPASS;
+    } else {
+        rs->rs.bypass_vs_clip_and_viewport = TRUE;
+        rs->vap_control_status = 0;
+    }
 
     rs->point_size = pack_float_16_6x(state->point_size) |
         (pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT);
@@ -395,8 +412,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe,
         rs->color_control = R300_SHADE_MODEL_SMOOTH;
     }
 
-    rs->rs = *state;
-
     return (void*)rs;
 }
 
@@ -581,30 +596,68 @@ static void r300_set_vertex_elements(struct pipe_context* pipe,
                                     const struct pipe_vertex_element* elements)
 {
     struct r300_context* r300 = r300_context(pipe);
-    /* XXX Draw */
+
     draw_flush(r300->draw);
     draw_set_vertex_elements(r300->draw, count, elements);
 }
 
 static void* r300_create_vs_state(struct pipe_context* pipe,
-                                  const struct pipe_shader_state* state)
+                                  const struct pipe_shader_state* shader)
 {
-    struct r300_context* context = r300_context(pipe);
-    /* XXX handing this off to Draw for now */
-    return draw_create_vertex_shader(context->draw, state);
+    struct r300_context* r300 = r300_context(pipe);
+
+    if (r300_screen(pipe->screen)->caps->has_tcl) {
+        struct r300_vertex_shader* vs = CALLOC_STRUCT(r300_vertex_shader);
+        /* Copy state directly into shader. */
+        vs->state = *shader;
+
+        tgsi_scan_shader(shader->tokens, &vs->info);
+
+        /* Appease Draw. */
+        vs->draw = draw_create_vertex_shader(r300->draw, shader);
+
+        return (void*)vs;
+    } else {
+        return draw_create_vertex_shader(r300->draw, shader);
+    }
 }
 
-static void r300_bind_vs_state(struct pipe_context* pipe, void* state) {
-    struct r300_context* context = r300_context(pipe);
-    /* XXX handing this off to Draw for now */
-    draw_bind_vertex_shader(context->draw, (struct draw_vertex_shader*)state);
+static void r300_bind_vs_state(struct pipe_context* pipe, void* shader)
+{
+    struct r300_context* r300 = r300_context(pipe);
+
+    if (r300_screen(pipe->screen)->caps->has_tcl) {
+        struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
+
+        if (vs == NULL) {
+            r300->vs = NULL;
+            return;
+        } else if (!vs->translated) {
+            r300_translate_vertex_shader(r300, vs);
+        }
+
+        draw_bind_vertex_shader(r300->draw, vs->draw);
+        r300->vs = vs;
+        r300->dirty_state |= R300_NEW_VERTEX_SHADER;
+    } else {
+        draw_bind_vertex_shader(r300->draw,
+                (struct draw_vertex_shader*)shader);
+    }
 }
 
-static void r300_delete_vs_state(struct pipe_context* pipe, void* state)
+static void r300_delete_vs_state(struct pipe_context* pipe, void* shader)
 {
-    struct r300_context* context = r300_context(pipe);
-    /* XXX handing this off to Draw for now */
-    draw_delete_vertex_shader(context->draw, (struct draw_vertex_shader*)state);
+    struct r300_context* r300 = r300_context(pipe);
+
+    if (r300_screen(pipe->screen)->caps->has_tcl) {
+        struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader;
+
+        draw_delete_vertex_shader(r300->draw, vs->draw);
+        FREE(shader);
+    } else {
+        draw_delete_vertex_shader(r300->draw,
+                (struct draw_vertex_shader*)shader);
+    }
 }
 
 void r300_init_state_functions(struct r300_context* r300)
index d761a03..f1feafb 100644 (file)
@@ -30,9 +30,9 @@
  * The vertex_info struct describes the post-TCL format of vertices. It is
  * required for Draw when doing SW TCL, and also for describing the
  * dreaded RS block on R300 chipsets. */
-/* XXX this function should be able to handle vert shaders as well as draw */
 static void r300_update_vertex_layout(struct r300_context* r300)
 {
+    struct r300_screen* r300screen = r300_screen(r300->context.screen);
     struct r300_vertex_format vformat;
     struct vertex_info vinfo;
     boolean pos = FALSE, psize = FALSE, fog = FALSE;
@@ -74,6 +74,13 @@ static void r300_update_vertex_layout(struct r300_context* r300)
         }
     }
 
+    if (r300screen->caps->has_tcl) {
+        for (i = 0; i < info->num_inputs; i++) {
+            /* XXX should probably do real lookup with vert shader */
+            tab[i] = i;
+        }
+    }
+
     /* Do the actual vertex_info setup.
      *
      * vertex_info has four uints of hardware-specific data in it.
@@ -211,7 +218,6 @@ static void r300_update_rs_block(struct r300_context* r300)
             rs->ip[0] |= R500_RS_COL_FMT(R300_RS_COL_FMT_0001);
         }
 
-        /* Set up at least one texture pointer or RS will not be happy. */
         if (tex_count == 0) {
             rs->ip[0] |=
                 R500_RS_SEL_S(R500_RS_IP_PTR_K0) |
@@ -220,15 +226,20 @@ static void r300_update_rs_block(struct r300_context* r300)
                 R500_RS_SEL_Q(R500_RS_IP_PTR_K1);
         }
 
+        /* Rasterize at least one color, or bad things happen. */
+        if ((col_count == 0) && (tex_count == 0)) {
+            col_count++;
+        }
+
         for (i = 0; i < tex_count; i++) {
-            rs->inst[i] |= R500_RS_INST_TEX_ID(i) | R500_RS_INST_TEX_CN_WRITE |
-                R500_RS_INST_TEX_ADDR(fp_offset);
+            rs->inst[i] |= R500_RS_INST_TEX_ID(i) |
+                R500_RS_INST_TEX_CN_WRITE | R500_RS_INST_TEX_ADDR(fp_offset);
             fp_offset++;
         }
 
         for (i = 0; i < col_count; i++) {
-            rs->inst[i] |= R500_RS_INST_COL_ID(i) | R500_RS_INST_COL_CN_WRITE |
-                R500_RS_INST_COL_ADDR(fp_offset);
+            rs->inst[i] |= R500_RS_INST_COL_ID(i) |
+                R500_RS_INST_COL_CN_WRITE | R500_RS_INST_COL_ADDR(fp_offset);
             fp_offset++;
         }
     } else {
@@ -268,15 +279,20 @@ static void r300_update_rs_block(struct r300_context* r300)
                 R300_RS_SEL_Q(R300_RS_SEL_K1);
         }
 
+        /* Rasterize at least one color, or bad things happen. */
+        if ((col_count == 0) && (tex_count == 0)) {
+            col_count++;
+        }
+
         for (i = 0; i < tex_count; i++) {
-            rs->inst[i] |= R300_RS_INST_TEX_ID(i) | R300_RS_INST_TEX_CN_WRITE |
-                R300_RS_INST_TEX_ADDR(fp_offset);
+            rs->inst[i] |= R300_RS_INST_TEX_ID(i) |
+                R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_offset);
             fp_offset++;
         }
 
         for (i = 0; i < col_count; i++) {
-            rs->inst[i] |= R300_RS_INST_COL_ID(i) | R300_RS_INST_COL_CN_WRITE |
-                R300_RS_INST_COL_ADDR(fp_offset);
+            rs->inst[i] |= R300_RS_INST_COL_ID(i) |
+                R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(fp_offset);
             fp_offset++;
         }
     }
@@ -289,7 +305,8 @@ static void r300_update_rs_block(struct r300_context* r300)
 
 void r300_update_derived_state(struct r300_context* r300)
 {
-    if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER) {
+    if (r300->dirty_state &
+            (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) {
         r300_update_vertex_layout(r300);
     }
 
index b80ff1c..91b93fc 100644 (file)
@@ -292,6 +292,7 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
             return R300_COLOR_FORMAT_ARGB4444;
         /* 32-bit buffers */
         case PIPE_FORMAT_A8R8G8B8_UNORM:
+        case PIPE_FORMAT_Z24S8_UNORM:
             return R300_COLOR_FORMAT_ARGB8888;
         /* XXX Not in pipe_format
         case PIPE_FORMAT_A32R32G32B32:
@@ -337,6 +338,7 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format)
 {
     switch (format) {
         case PIPE_FORMAT_A8R8G8B8_UNORM:
+        case PIPE_FORMAT_Z24S8_UNORM:
             return R300_US_OUT_FMT_C4_8 |
                 R300_C0_SEL_B | R300_C1_SEL_G |
                 R300_C2_SEL_R | R300_C3_SEL_A;
index e1837b6..8bd9b41 100644 (file)
@@ -86,7 +86,7 @@ void r300_emit_invariant_state(struct r300_context* r300)
     END_CS;
 
     /* XXX unsorted stuff from surface_fill */
-    BEGIN_CS(91 + (caps->has_tcl ? 26 : 0));
+    BEGIN_CS(79 + (caps->has_tcl ? 7 : 0));
     /* Flush PVS. */
     OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0);
 
@@ -141,28 +141,11 @@ void r300_emit_invariant_state(struct r300_context* r300)
     OUT_CS_REG(R300_ZB_DEPTHCLEARVALUE, 0x00000000);
     OUT_CS_REG(R300_ZB_HIZ_OFFSET, 0x00000000);
     OUT_CS_REG(R300_ZB_HIZ_PITCH, 0x00000000);
-    if (caps->has_tcl) {
-        OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
-            (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
-            ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) |
-                R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
-    } else {
-        OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
-            (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
-            ((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) |
-                R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
-    }
-    OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0,
-            (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) |
-            (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT));
     OUT_CS_REG(R300_VAP_VTX_STATE_CNTL, 0x1);
     OUT_CS_REG(R300_VAP_VSM_VTX_ASSM, 0x405);
     OUT_CS_REG(R300_SE_VTE_CNTL, 0x0000043F);
     /* Vertex size. */
     OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8);
-    OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0, 0x00000003);
-    OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x00000000);
-    OUT_CS_REG(R300_TX_ENABLE, 0x0);
 
     /* XXX */
     OUT_CS_REG(R300_SC_CLIP_RULE, 0xaaaa);
@@ -173,33 +156,5 @@ void r300_emit_invariant_state(struct r300_context* r300)
     OUT_CS(R300_US_OUT_FMT_UNUSED);
     OUT_CS(R300_US_OUT_FMT_UNUSED);
     OUT_CS_REG(R300_US_W_FMT, R300_W_FMT_W0);
-    /* XXX these magic numbers should be explained when
-     * this becomes a cached state object */
-    if (caps->has_tcl) {
-        OUT_CS_REG(R300_VAP_CNTL, 0xA |
-            (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) |
-            (0xB << R300_VF_MAX_VTX_NUM_SHIFT) |
-            (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT));
-        OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_0, 0x00100000);
-        OUT_CS_REG(R300_VAP_PVS_CONST_CNTL, 0x00000000);
-        OUT_CS_REG(R300_VAP_PVS_CODE_CNTL_1, 0x00000001);
-        /* XXX translate these back into normal instructions */
-        OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x1);
-        OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, 0x0);
-        OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, 8);
-        OUT_CS(0x00F00203);
-        OUT_CS(0x00D10001);
-        OUT_CS(0x01248001);
-        OUT_CS(0x00000000);
-        OUT_CS(0x00F02203);
-        OUT_CS(0x00D10021);
-        OUT_CS(0x01248021);
-        OUT_CS(0x00000000);
-    } else {
-        OUT_CS_REG(R300_VAP_CNTL, 0xA |
-            (0x5 << R300_PVS_NUM_CNTLRS_SHIFT) |
-            (0x5 << R300_VF_MAX_VTX_NUM_SHIFT) |
-            (caps->num_vert_fpus << R300_PVS_NUM_FPUS_SHIFT));
-    }
     END_CS;
 }
index 8204bf9..5bea677 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef R300_STATE_INVARIANT_H
 #define R300_STATE_INVARIANT_H
 
+#include "r300_chipset.h"
 #include "r300_context.h"
 #include "r300_cs.h"
 #include "r300_reg.h"
index 20b83bd..1b02239 100644 (file)
@@ -171,6 +171,26 @@ static INLINE uint32_t r500_alpha_swiz(struct tgsi_full_src_register* reg)
         (reg->SrcRegisterExtMod.Absolute ? (1 << 10) : 0);
 }
 
+static INLINE uint32_t r300_rgb_op(unsigned op)
+{
+    switch (op) {
+        case TGSI_OPCODE_MOV:
+            return R300_ALU_OUTC_CMP;
+        default:
+            return 0;
+    }
+}
+
+static INLINE uint32_t r300_alpha_op(unsigned op)
+{
+    switch (op) {
+        case TGSI_OPCODE_MOV:
+            return R300_ALU_OUTA_CMP;
+        default:
+            return 0;
+    }
+}
+
 static INLINE uint32_t r500_rgba_op(unsigned op)
 {
     switch (op) {
@@ -249,6 +269,31 @@ static INLINE uint32_t r500_tex_op(unsigned op)
     }
 }
 
+static INLINE void r300_emit_maths(struct r300_fragment_shader* fs,
+                                   struct r300_fs_asm* assembler,
+                                   struct tgsi_full_src_register* src,
+                                   struct tgsi_full_dst_register* dst,
+                                   unsigned op,
+                                   unsigned count)
+{
+    int i = fs->alu_instruction_count;
+
+    fs->instructions[i].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
+        R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) |
+        R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) |
+        r300_rgb_op(op);
+    fs->instructions[i].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
+        R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ;
+    fs->instructions[i].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) |
+        R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) |
+        R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) |
+        r300_alpha_op(op);
+    fs->instructions[i].alu_alpha_addr = R300_ALPHA_ADDR0(0) |
+        R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT;
+
+    fs->alu_instruction_count++;
+}
+
 /* Setup an ALU operation. */
 static INLINE void r500_emit_alu(struct r500_fragment_shader* fs,
                                  struct r300_fs_asm* assembler,
@@ -367,11 +412,31 @@ static INLINE void r500_emit_tex(struct r500_fragment_shader* fs,
     }
 }
 
+static void r300_fs_instruction(struct r300_fragment_shader* fs,
+                                struct r300_fs_asm* assembler,
+                                struct tgsi_full_instruction* inst)
+{
+    switch (inst->Instruction.Opcode) {
+        case TGSI_OPCODE_MOV:
+            /* src0 -> src1 and src2 forced to zero */
+            inst->FullSrcRegisters[1] = inst->FullSrcRegisters[0];
+            inst->FullSrcRegisters[2] = r500_constant_zero;
+            r300_emit_maths(fs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode, 3);
+            break;
+        case TGSI_OPCODE_END:
+            break;
+        default:
+            debug_printf("r300: fs: Bad opcode %d\n",
+                    inst->Instruction.Opcode);
+            break;
+    }
+}
+
 static void r500_fs_instruction(struct r500_fragment_shader* fs,
                                 struct r300_fs_asm* assembler,
                                 struct tgsi_full_instruction* inst)
 {
-    int i;
     /* Switch between opcodes. When possible, prefer using the official
      * AMD/ATI names for opcodes, please, as it facilitates using the
      * documentation. */
@@ -487,35 +552,26 @@ static void r500_fs_instruction(struct r500_fragment_shader* fs,
     }
 }
 
-static void r500_fs_finalize(struct r500_fragment_shader* fs,
+static void r300_fs_finalize(struct r3xx_fragment_shader* fs,
                              struct r300_fs_asm* assembler)
 {
-    fs->shader.stack_size = assembler->temp_count + assembler->temp_offset;
+    fs->stack_size = assembler->temp_count + assembler->temp_offset;
+}
 
+static void r500_fs_finalize(struct r500_fragment_shader* fs,
+                             struct r300_fs_asm* assembler)
+{
     /* XXX should this just go with OPCODE_END? */
     fs->instructions[fs->instruction_count - 1].inst0 |=
         R500_INST_LAST;
 }
 
 void r300_translate_fragment_shader(struct r300_context* r300,
-                                    struct r300_fragment_shader* fs)
-{
-    struct tgsi_parse_context parser;
-
-    tgsi_parse_init(&parser, fs->shader.state.tokens);
-
-    while (!tgsi_parse_end_of_tokens(&parser)) {
-        tgsi_parse_token(&parser);
-    }
-
-    r300_copy_passthrough_shader(fs);
-}
-
-void r500_translate_fragment_shader(struct r300_context* r300,
-                                    struct r500_fragment_shader* fs)
+                                    struct r3xx_fragment_shader* fs)
 {
     struct tgsi_parse_context parser;
     int i;
+    boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500;
     struct r300_constant_buffer* consts =
         &r300->shader_constants[PIPE_SHADER_FRAGMENT];
 
@@ -526,7 +582,12 @@ void r500_translate_fragment_shader(struct r300_context* r300,
     /* Setup starting offset for immediates. */
     assembler->imm_offset = consts->user_count;
 
-    tgsi_parse_init(&parser, fs->shader.state.tokens);
+    /* Make sure we start at the beginning of the shader. */
+    if (is_r500) {
+        ((struct r500_fragment_shader*)fs)->instruction_count = 0;
+    }
+
+    tgsi_parse_init(&parser, fs->state.tokens);
 
     while (!tgsi_parse_end_of_tokens(&parser)) {
         tgsi_parse_token(&parser);
@@ -553,25 +614,35 @@ void r500_translate_fragment_shader(struct r300_context* r300,
                 assembler->imm_count++;
                 break;
             case TGSI_TOKEN_TYPE_INSTRUCTION:
-                r500_fs_instruction(fs, assembler,
-                        &parser.FullToken.FullInstruction);
+                if (is_r500) {
+                    r500_fs_instruction((struct r500_fragment_shader*)fs,
+                            assembler, &parser.FullToken.FullInstruction);
+                } else {
+                    r300_fs_instruction((struct r300_fragment_shader*)fs,
+                            assembler, &parser.FullToken.FullInstruction);
+                }
                 break;
         }
-
     }
 
-    debug_printf("r300: %d texs and %d colors, first free reg is %d\n",
+    debug_printf("r300: fs: %d texs and %d colors, first free reg is %d\n",
             assembler->tex_count, assembler->color_count,
             assembler->tex_count + assembler->color_count);
 
     consts->count = consts->user_count + assembler->imm_count;
-    debug_printf("r300: %d total constants, "
+    debug_printf("r300: fs: %d total constants, "
             "%d from user and %d from immediates\n", consts->count,
             consts->user_count, assembler->imm_count);
-    r500_fs_finalize(fs, assembler);
+    r300_fs_finalize(fs, assembler);
+    if (is_r500) {
+        r500_fs_finalize((struct r500_fragment_shader*)fs, assembler);
+    }
 
-    tgsi_dump(fs->shader.state.tokens);
-    r500_fs_dump(fs);
+    tgsi_dump(fs->state.tokens);
+    /* XXX finish r300 dumper too */
+    if (is_r500) {
+        r500_fs_dump((struct r500_fragment_shader*)fs);
+    }
 
     tgsi_parse_free(&parser);
     FREE(assembler);
index 06c0bb7..185fdd9 100644 (file)
@@ -102,12 +102,9 @@ struct r300_fs_asm {
 };
 
 void r300_translate_fragment_shader(struct r300_context* r300,
-                           struct r300_fragment_shader* fs);
+                           struct r3xx_fragment_shader* fs);
 
-void r500_translate_fragment_shader(struct r300_context* r300,
-                           struct r500_fragment_shader* fs);
-
-static const struct r300_fragment_shader r300_passthrough_fragment_shader = {
+static struct r300_fragment_shader r300_passthrough_fragment_shader = {
     /* XXX This is the emission code. TODO: decode
     OUT_CS_REG(R300_US_CONFIG, 0);
     OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
@@ -118,24 +115,24 @@ static const struct r300_fragment_shader r300_passthrough_fragment_shader = {
 */
     .alu_instruction_count = 1,
     .tex_instruction_count = 0,
-    .indirections = 1,
-    .shader.stack_size = 2,
+    .indirections = 0,
+    .shader.stack_size = 1,
 
     .instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
-        R300_RGB_SWIZB(R300_ALU_ARGC_ONE) |
+        R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) |
         R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) |
-        R300_ALU_OUTC_MAD,
+        R300_ALU_OUTC_CMP,
     .instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
         R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ,
     .instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) |
-        R300_ALPHA_SWIZB(R300_ALU_ARGA_ONE) |
+        R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) |
         R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) |
-        R300_ALU_OUTA_MAD,
+        R300_ALU_OUTA_CMP,
     .instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) |
         R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT,
 };
 
-static const struct r500_fragment_shader r500_passthrough_fragment_shader = {
+static struct r500_fragment_shader r500_passthrough_fragment_shader = {
     .shader.stack_size = 0,
     .instruction_count = 1,
     .instructions[0].inst0 = R500_INST_TYPE_OUT |
@@ -161,4 +158,73 @@ static const struct r500_fragment_shader r500_passthrough_fragment_shader = {
         R500_ALU_RGBA_A_SWIZ_0,
 };
 
+static struct r300_fragment_shader r300_texture_fragment_shader = {
+    /* XXX This is the emission code. TODO: decode
+    OUT_CS_REG(R300_US_CONFIG, 0);
+    OUT_CS_REG(R300_US_CODE_OFFSET, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_0, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_1, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_2, 0x0);
+    OUT_CS_REG(R300_US_CODE_ADDR_3, 0x400000);
+*/
+    .alu_instruction_count = 1,
+    .tex_instruction_count = 0,
+    .indirections = 0,
+    .shader.stack_size = 1,
+
+    .instructions[0].alu_rgb_inst = R300_RGB_SWIZA(R300_ALU_ARGC_SRC0C_XYZ) |
+        R300_RGB_SWIZB(R300_ALU_ARGC_SRC0C_XYZ) |
+        R300_RGB_SWIZC(R300_ALU_ARGC_ZERO) |
+        R300_ALU_OUTC_CMP,
+    .instructions[0].alu_rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) |
+        R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ,
+    .instructions[0].alu_alpha_inst = R300_ALPHA_SWIZA(R300_ALU_ARGA_SRC0A) |
+        R300_ALPHA_SWIZB(R300_ALU_ARGA_SRC0A) |
+        R300_ALPHA_SWIZC(R300_ALU_ARGA_ZERO) |
+        R300_ALU_OUTA_CMP,
+    .instructions[0].alu_alpha_addr = R300_ALPHA_ADDR0(0) |
+        R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT,
+};
+
+static struct r500_fragment_shader r500_texture_fragment_shader = {
+    .shader.stack_size = 1,
+    .instruction_count = 2,
+    .instructions[0].inst0 = R500_INST_TYPE_TEX |
+        R500_INST_TEX_SEM_WAIT |
+        R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK |
+        R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP,
+    .instructions[0].inst1 = R500_TEX_ID(0) | R500_TEX_INST_LD |
+        R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED,
+    .instructions[0].inst2 = R500_TEX_SRC_ADDR(0) |
+        R500_TEX_SRC_S_SWIZ_R | R500_TEX_SRC_T_SWIZ_G |
+        R500_TEX_SRC_R_SWIZ_B | R500_TEX_SRC_Q_SWIZ_A |
+        R500_TEX_DST_ADDR(0) |
+        R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G |
+        R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A,
+    .instructions[0].inst3 = 0x0,
+    .instructions[0].inst4 = 0x0,
+    .instructions[0].inst5 = 0x0,
+    .instructions[1].inst0 = R500_INST_TYPE_OUT |
+        R500_INST_TEX_SEM_WAIT | R500_INST_LAST |
+        R500_INST_RGB_OMASK_RGB | R500_INST_ALPHA_OMASK |
+        R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP,
+    .instructions[1].inst1 =
+        R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST |
+        R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST,
+    .instructions[1].inst2 =
+        R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST |
+        R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST,
+    .instructions[1].inst3 =
+        R500_ALU_RGB_SEL_A_SRC0 | R500_ALU_RGB_R_SWIZ_A_R |
+        R500_ALU_RGB_G_SWIZ_A_G | R500_ALU_RGB_B_SWIZ_A_B |
+        R500_ALU_RGB_SEL_B_SRC0 | R500_ALU_RGB_R_SWIZ_B_R |
+        R500_ALU_RGB_B_SWIZ_B_G | R500_ALU_RGB_G_SWIZ_B_B,
+    .instructions[1].inst4 =
+        R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A,
+    .instructions[1].inst5 =
+        R500_ALU_RGBA_OP_CMP | R500_ALU_RGBA_R_SWIZ_0 |
+        R500_ALU_RGBA_G_SWIZ_0 | R500_ALU_RGBA_B_SWIZ_0 |
+        R500_ALU_RGBA_A_SWIZ_0,
+};
+
 #endif /* R300_STATE_SHADER_H */
diff --git a/src/gallium/drivers/r300/r300_state_tcl.c b/src/gallium/drivers/r300/r300_state_tcl.c
new file mode 100644 (file)
index 0000000..47d6c6d
--- /dev/null
@@ -0,0 +1,285 @@
+/*
+ * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#include "r300_state_tcl.h"
+
+static void r300_vs_declare(struct r300_vs_asm* assembler,
+                            struct tgsi_full_declaration* decl)
+{
+    switch (decl->Declaration.File) {
+        case TGSI_FILE_INPUT:
+            break;
+        case TGSI_FILE_OUTPUT:
+            switch (decl->Semantic.SemanticName) {
+                case TGSI_SEMANTIC_POSITION:
+                    assembler->tab[decl->DeclarationRange.First] = 0;
+                    break;
+                case TGSI_SEMANTIC_COLOR:
+                    assembler->tab[decl->DeclarationRange.First] = 2;
+                    break;
+                case TGSI_SEMANTIC_GENERIC:
+                    /* XXX multiple? */
+                    assembler->tab[decl->DeclarationRange.First] = 6;
+                    break;
+                default:
+                    debug_printf("r300: vs: Bad semantic declaration %d\n",
+                        decl->Semantic.SemanticName);
+                    break;
+            }
+            break;
+        case TGSI_FILE_CONSTANT:
+            break;
+        case TGSI_FILE_TEMPORARY:
+            assembler->temp_count++;
+            break;
+        default:
+            debug_printf("r300: vs: Bad file %d\n", decl->Declaration.File);
+            break;
+    }
+}
+
+static INLINE unsigned r300_vs_src_type(struct r300_vs_asm* assembler,
+                                        struct tgsi_src_register* src)
+{
+    switch (src->File) {
+        case TGSI_FILE_NULL:
+            /* Probably a zero or one swizzle */
+            return R300_PVS_SRC_REG_INPUT;
+            break;
+        case TGSI_FILE_INPUT:
+            return R300_PVS_SRC_REG_INPUT;
+            break;
+        case TGSI_FILE_TEMPORARY:
+            return R300_PVS_SRC_REG_TEMPORARY;
+            break;
+        case TGSI_FILE_CONSTANT:
+            return R300_PVS_SRC_REG_CONSTANT;
+        default:
+            debug_printf("r300: vs: Unimplemented src type %d\n", src->File);
+            break;
+    }
+    return 0;
+}
+
+static INLINE unsigned r300_vs_dst_type(struct r300_vs_asm* assembler,
+                                        struct tgsi_dst_register* dst)
+{
+    switch (dst->File) {
+        case TGSI_FILE_TEMPORARY:
+            return R300_PVS_DST_REG_TEMPORARY;
+            break;
+        case TGSI_FILE_OUTPUT:
+            return R300_PVS_DST_REG_OUT;
+            break;
+        default:
+            debug_printf("r300: vs: Unimplemented dst type %d\n", dst->File);
+            break;
+    }
+    return 0;
+}
+
+static INLINE unsigned r300_vs_dst(struct r300_vs_asm* assembler,
+                                   struct tgsi_dst_register* dst)
+{
+    switch (dst->File) {
+        case TGSI_FILE_TEMPORARY:
+            return dst->Index;
+            break;
+        case TGSI_FILE_OUTPUT:
+            return assembler->tab[dst->Index];
+            break;
+        default:
+            debug_printf("r300: vs: Unimplemented dst %d\n", dst->File);
+            break;
+    }
+    return 0;
+}
+
+static uint32_t r300_vs_op(unsigned op)
+{
+    switch (op) {
+        case TGSI_OPCODE_MUL:
+            return R300_VE_MULTIPLY;
+        case TGSI_OPCODE_ADD:
+        case TGSI_OPCODE_MOV:
+        case TGSI_OPCODE_SWZ:
+            return R300_VE_ADD;
+        case TGSI_OPCODE_MAD:
+            return R300_PVS_DST_MACRO_INST | R300_PVS_MACRO_OP_2CLK_MADD;
+        default:
+            break;
+    }
+    return 0;
+}
+
+static uint32_t r300_vs_swiz(struct tgsi_full_src_register* reg)
+{
+    if (reg->SrcRegister.Extended) {
+        return reg->SrcRegisterExtSwz.ExtSwizzleX |
+            (reg->SrcRegisterExtSwz.ExtSwizzleY << 3) |
+            (reg->SrcRegisterExtSwz.ExtSwizzleZ << 6) |
+            (reg->SrcRegisterExtSwz.ExtSwizzleW << 9);
+    } else {
+        return reg->SrcRegister.SwizzleX |
+            (reg->SrcRegister.SwizzleY << 3) |
+            (reg->SrcRegister.SwizzleZ << 6) |
+            (reg->SrcRegister.SwizzleW << 9);
+    }
+}
+
+static void r300_vs_emit_inst(struct r300_vertex_shader* vs,
+                              struct r300_vs_asm* assembler,
+                              struct tgsi_full_src_register* src,
+                              struct tgsi_full_dst_register* dst,
+                              unsigned op,
+                              unsigned count)
+{
+    int i = vs->instruction_count;
+    vs->instructions[i].inst0 = R300_PVS_DST_OPCODE(r300_vs_op(op)) |
+        R300_PVS_DST_REG_TYPE(r300_vs_dst_type(assembler, &dst->DstRegister)) |
+        R300_PVS_DST_OFFSET(r300_vs_dst(assembler, &dst->DstRegister)) |
+        R300_PVS_DST_WE_XYZW;
+    switch (count) {
+        case 3:
+            vs->instructions[i].inst3 =
+                R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler,
+                            &src[2].SrcRegister)) |
+                R300_PVS_SRC_OFFSET(src[2].SrcRegister.Index) |
+                R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[2]));
+            /* Fall through */
+        case 2:
+            vs->instructions[i].inst2 =
+                R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler,
+                            &src[1].SrcRegister)) |
+                R300_PVS_SRC_OFFSET(src[1].SrcRegister.Index) |
+                R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[1]));
+            /* Fall through */
+        case 1:
+            vs->instructions[i].inst1 =
+                R300_PVS_SRC_REG_TYPE(r300_vs_src_type(assembler,
+                            &src[0].SrcRegister)) |
+                R300_PVS_SRC_OFFSET(src[0].SrcRegister.Index) |
+                R300_PVS_SRC_SWIZZLE(r300_vs_swiz(&src[0]));
+            break;
+    }
+    vs->instruction_count++;
+}
+
+static void r300_vs_instruction(struct r300_vertex_shader* vs,
+                                struct r300_vs_asm* assembler,
+                                struct tgsi_full_instruction* inst)
+{
+    switch (inst->Instruction.Opcode) {
+        case TGSI_OPCODE_ADD:
+        case TGSI_OPCODE_MUL:
+            r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode,
+                    2);
+            break;
+        case TGSI_OPCODE_MOV:
+        case TGSI_OPCODE_SWZ:
+            inst->FullSrcRegisters[1] = r300_constant_zero;
+            r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode,
+                    2);
+            break;
+        case TGSI_OPCODE_MAD:
+            r300_vs_emit_inst(vs, assembler, inst->FullSrcRegisters,
+                    &inst->FullDstRegisters[0], inst->Instruction.Opcode,
+                    3);
+            break;
+        case TGSI_OPCODE_END:
+            break;
+        default:
+            debug_printf("r300: vs: Bad opcode %d\n",
+                    inst->Instruction.Opcode);
+            break;
+    }
+}
+
+void r300_translate_vertex_shader(struct r300_context* r300,
+                                  struct r300_vertex_shader* vs)
+{
+    struct tgsi_parse_context parser;
+    int i;
+    struct r300_constant_buffer* consts =
+        &r300->shader_constants[PIPE_SHADER_VERTEX];
+
+    struct r300_vs_asm* assembler = CALLOC_STRUCT(r300_vs_asm);
+    if (assembler == NULL) {
+        return;
+    }
+    /* Setup starting offset for immediates. */
+    assembler->imm_offset = consts->user_count;
+
+    tgsi_parse_init(&parser, vs->state.tokens);
+
+    while (!tgsi_parse_end_of_tokens(&parser)) {
+        tgsi_parse_token(&parser);
+
+        /* This is seriously the lamest way to create fragment programs ever.
+         * I blame TGSI. */
+        switch (parser.FullToken.Token.Type) {
+            case TGSI_TOKEN_TYPE_DECLARATION:
+                /* Allocated registers sitting at the beginning
+                 * of the program. */
+                r300_vs_declare(assembler, &parser.FullToken.FullDeclaration);
+                break;
+            case TGSI_TOKEN_TYPE_IMMEDIATE:
+                debug_printf("r300: Emitting immediate to constant buffer, "
+                        "position %d\n",
+                        assembler->imm_offset + assembler->imm_count);
+                /* I am not amused by the length of these. */
+                for (i = 0; i < 4; i++) {
+                    consts->constants[assembler->imm_offset +
+                        assembler->imm_count][i] =
+                        parser.FullToken.FullImmediate.u.ImmediateFloat32[i]
+                        .Float;
+                }
+                assembler->imm_count++;
+                break;
+            case TGSI_TOKEN_TYPE_INSTRUCTION:
+                r300_vs_instruction(vs, assembler,
+                        &parser.FullToken.FullInstruction);
+                break;
+        }
+    }
+
+    debug_printf("r300: vs: %d texs and %d colors, first free reg is %d\n",
+            assembler->tex_count, assembler->color_count,
+            assembler->tex_count + assembler->color_count);
+
+    consts->count = consts->user_count + assembler->imm_count;
+    debug_printf("r300: vs: %d total constants, "
+            "%d from user and %d from immediates\n", consts->count,
+            consts->user_count, assembler->imm_count);
+
+    debug_printf("r300: vs: tab: %d %d %d %d\n", assembler->tab[0],
+            assembler->tab[1], assembler->tab[2], assembler->tab[3]);
+
+    tgsi_dump(vs->state.tokens);
+    /* XXX finish r300 vertex shader dumper */
+    r300_vs_dump(vs);
+
+    tgsi_parse_free(&parser);
+    FREE(assembler);
+}
diff --git a/src/gallium/drivers/r300/r300_state_tcl.h b/src/gallium/drivers/r300/r300_state_tcl.h
new file mode 100644 (file)
index 0000000..3d10e24
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2009 Corbin Simpson <MostAwesomeDude@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE. */
+
+#ifndef R300_STATE_TCL_H
+#define R300_STATE_TCL_H
+
+#include "tgsi/tgsi_parse.h"
+
+#include "r300_context.h"
+#include "r300_debug.h"
+#include "r300_reg.h"
+#include "r300_screen.h"
+
+/* XXX get these to r300_reg */
+#define R300_PVS_DST_OPCODE(x)   ((x) << 0)
+#   define R300_VE_MULTIPLY               2
+#   define R300_VE_ADD                    3
+#define R300_PVS_DST_MACRO_INST    (1 << 7)
+#   define R300_PVS_MACRO_OP_2CLK_MADD    0
+#define R300_PVS_DST_REG_TYPE(x) ((x) << 8)
+#   define R300_PVS_DST_REG_TEMPORARY     0
+#   define R300_PVS_DST_REG_A0            1
+#   define R300_PVS_DST_REG_OUT           2
+#   define R300_PVS_DST_REG_OUT_REPL_X    3
+#   define R300_PVS_DST_REG_ALT_TEMPORARY 4
+#   define R300_PVS_DST_REG_INPUT         5
+#define R300_PVS_DST_OFFSET(x)   ((x) << 13)
+#define R300_PVS_DST_WE(x)       ((x) << 20)
+#define R300_PVS_DST_WE_XYZW     (0xf << 20)
+
+#define R300_PVS_SRC_REG_TYPE(x) ((x) << 0)
+#   define R300_PVS_SRC_REG_TEMPORARY     0
+#   define R300_PVS_SRC_REG_INPUT         1
+#   define R300_PVS_SRC_REG_CONSTANT      2
+#   define R300_PVS_SRC_REG_ALT_TEMPORARY 3
+#define R300_PVS_SRC_OFFSET(x)   ((x) << 5)
+#define R300_PVS_SRC_SWIZZLE(x)  ((x) << 13)
+#   define R300_PVS_SRC_SELECT_X          0
+#   define R300_PVS_SRC_SELECT_Y          1
+#   define R300_PVS_SRC_SELECT_Z          2
+#   define R300_PVS_SRC_SELECT_W          3
+#   define R300_PVS_SRC_SELECT_FORCE_0    4
+#   define R300_PVS_SRC_SELECT_FORCE_1    5
+#   define R300_PVS_SRC_SWIZZLE_XYZW \
+    ((R300_PVS_SRC_SELECT_X | (R300_PVS_SRC_SELECT_Y << 3) | \
+     (R300_PVS_SRC_SELECT_Z << 6) | (R300_PVS_SRC_SELECT_W << 9)) << 13)
+#   define R300_PVS_SRC_SWIZZLE_ZERO \
+    ((R300_PVS_SRC_SELECT_FORCE_0 | (R300_PVS_SRC_SELECT_FORCE_0 << 3) | \
+     (R300_PVS_SRC_SELECT_FORCE_0 << 6) | \
+      (R300_PVS_SRC_SELECT_FORCE_0 << 9)) << 13)
+#   define R300_PVS_SRC_SWIZZLE_ONE \
+    ((R300_PVS_SRC_SELECT_FORCE_1 | (R300_PVS_SRC_SELECT_FORCE_1 << 3) | \
+     (R300_PVS_SRC_SELECT_FORCE_1 << 6) | \
+      (R300_PVS_SRC_SELECT_FORCE_1 << 9)) << 13)
+
+static const struct tgsi_full_src_register r300_constant_zero = {
+    .SrcRegister.Extended = TRUE,
+    .SrcRegister.File = TGSI_FILE_NULL,
+    .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ZERO,
+    .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ZERO,
+    .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ZERO,
+    .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ZERO,
+};
+
+/* Temporary struct used to hold assembly state while putting together
+ * fragment programs. */
+struct r300_vs_asm {
+    /* Pipe context. */
+    struct r300_context* r300;
+    /* Number of colors. */
+    unsigned color_count;
+    /* Number of texcoords. */
+    unsigned tex_count;
+    /* Number of requested temporary registers. */
+    unsigned temp_count;
+    /* Offset for immediate constants. Neither R300 nor R500 can do four
+     * inline constants per source, so instead we copy immediates into the
+     * constant buffer. */
+    unsigned imm_offset;
+    /* Number of immediate constants. */
+    unsigned imm_count;
+    /* Offsets into vertex output memory. */
+    unsigned tab[16];
+};
+
+static struct r300_vertex_shader r300_passthrough_vertex_shader = {
+        /* XXX translate these back into normal instructions */
+    .instruction_count = 2,
+    .instructions[0].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
+        R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
+        R300_PVS_DST_OFFSET(0) | R300_PVS_DST_WE_XYZW,
+    .instructions[0].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
+        R300_PVS_SRC_OFFSET(0) | R300_PVS_SRC_SWIZZLE_XYZW,
+    .instructions[0].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
+    .instructions[0].inst3 = 0x0,
+    .instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
+        R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
+        R300_PVS_DST_OFFSET(2) | R300_PVS_DST_WE_XYZW,
+    .instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
+        R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW,
+    .instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
+    .instructions[1].inst3 = 0x0,
+};
+
+static struct r300_vertex_shader r300_texture_vertex_shader = {
+        /* XXX translate these back into normal instructions */
+    .instruction_count = 2,
+    .instructions[0].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
+        R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
+        R300_PVS_DST_OFFSET(0) | R300_PVS_DST_WE_XYZW,
+    .instructions[0].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
+        R300_PVS_SRC_OFFSET(0) | R300_PVS_SRC_SWIZZLE_XYZW,
+    .instructions[0].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
+    .instructions[0].inst3 = 0x0,
+    .instructions[1].inst0 = R300_PVS_DST_OPCODE(R300_VE_ADD) |
+        R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) |
+        R300_PVS_DST_OFFSET(6) | R300_PVS_DST_WE_XYZW,
+    .instructions[1].inst1 = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) |
+        R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW,
+    .instructions[1].inst2 = R300_PVS_SRC_SWIZZLE_ZERO,
+    .instructions[1].inst3 = 0x0,
+};
+
+void r300_translate_vertex_shader(struct r300_context* r300,
+                                  struct r300_vertex_shader* vs);
+
+#endif /* R300_STATE_TCL_H */
index db18975..79bed03 100644 (file)
@@ -29,10 +29,10 @@ static void r300_surface_setup(struct pipe_context* pipe,
                                unsigned w, unsigned h)
 {
     struct r300_context* r300 = r300_context(pipe);
-    CS_LOCALS(r300);
     struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
     struct r300_texture* tex = (struct r300_texture*)dest->texture;
     unsigned pixpitch = tex->stride / tex->tex.block.size;
+    CS_LOCALS(r300);
 
     r300_emit_blend_state(r300, &blend_clear_state);
     r300_emit_blend_color_state(r300, &blend_color_clear_state);
@@ -80,14 +80,15 @@ static void r300_surface_fill(struct pipe_context* pipe,
                               unsigned w, unsigned h,
                               unsigned color)
 {
+    int i;
+    float r, g, b, a, depth;
     struct r300_context* r300 = r300_context(pipe);
-    CS_LOCALS(r300);
     struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
     struct r300_texture* tex = (struct r300_texture*)dest->texture;
-    int i;
-    float r, g, b, a, depth;
     unsigned pixpitch = tex->stride / tex->tex.block.size;
+    CS_LOCALS(r300);
 
+    a = (float)((color >> 24) & 0xff) / 255.0f;
     r = (float)((color >> 16) & 0xff) / 255.0f;
     g = (float)((color >>  8) & 0xff) / 255.0f;
     b = (float)((color >>  0) & 0xff) / 255.0f;
@@ -96,7 +97,7 @@ static void r300_surface_fill(struct pipe_context* pipe,
         dest, x, y, w, h, pixpitch, color);
 
     /* Fallback? */
-    if (tex->tex.format != PIPE_FORMAT_A8R8G8B8_UNORM) {
+    if (FALSE) {
         debug_printf("r300: Falling back on surface clear...");
         util_surface_fill(pipe, dest, x, y, w, h, color);
         return;
@@ -104,6 +105,19 @@ static void r300_surface_fill(struct pipe_context* pipe,
 
     r300_surface_setup(r300, dest, x, y, w, h);
 
+    /* Vertex shader setup */
+    if (caps->has_tcl) {
+        r300_emit_vertex_shader(r300, &r300_passthrough_vertex_shader);
+    } else {
+        BEGIN_CS(4);
+        OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VAP_TCL_BYPASS);
+        OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) |
+                R300_PVS_NUM_CNTLRS(5) |
+                R300_PVS_NUM_FPUS(caps->num_vert_fpus) |
+                R300_PVS_VF_MAX_VTX_NUM(12));
+        END_CS;
+    }
+
     /* Fragment shader setup */
     if (caps->is_r500) {
         r500_emit_fragment_shader(r300, &r500_passthrough_fragment_shader);
@@ -113,7 +127,32 @@ static void r300_surface_fill(struct pipe_context* pipe,
         r300_emit_rs_block_state(r300, &r300_rs_block_clear_state);
     }
 
-    BEGIN_CS(21);
+    BEGIN_CS(31);
+
+    /* VAP stream control, mapping from input memory to PVS/RS memory */
+    if (caps->has_tcl) {
+        OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+            (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
+            ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) |
+                R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
+    } else {
+        OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+            (R300_DATA_TYPE_FLOAT_4 << R300_DATA_TYPE_0_SHIFT) |
+            ((R300_LAST_VEC | (2 << R300_DST_VEC_LOC_SHIFT) |
+                R300_DATA_TYPE_FLOAT_4) << R300_DATA_TYPE_1_SHIFT));
+    }
+    OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0,
+            (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) |
+            (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT));
+
+    /* VAP format controls */
+    OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0,
+            R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT |
+            R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT);
+    OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x0);
+
+    /* Disable textures */
+    OUT_CS_REG(R300_TX_ENABLE, 0x0);
 
     /* Viewport setup */
     OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6);
@@ -132,16 +171,17 @@ static void r300_surface_fill(struct pipe_context* pipe,
     /* Packet3 with our point vertex */
     OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8);
     OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING |
-    (1 << R300_PRIM_NUM_VERTICES_SHIFT));
+            (1 << R300_PRIM_NUM_VERTICES_SHIFT));
+    /* Position */
     OUT_CS_32F(w / 2.0);
     OUT_CS_32F(h / 2.0);
-    /* XXX this should be the depth value to clear to */
     OUT_CS_32F(1.0);
     OUT_CS_32F(1.0);
+    /* Color */
     OUT_CS_32F(r);
     OUT_CS_32F(g);
     OUT_CS_32F(b);
-    OUT_CS_32F(1.0);
+    OUT_CS_32F(a);
 
     /* XXX figure out why this is 0xA and not 0x2 */
     OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
@@ -162,23 +202,100 @@ static void r300_surface_copy(struct pipe_context* pipe,
                               unsigned w, unsigned h)
 {
     struct r300_context* r300 = r300_context(pipe);
-    CS_LOCALS(r300);
+    struct r300_capabilities* caps = r300_screen(pipe->screen)->caps;
     struct r300_texture* srctex = (struct r300_texture*)src->texture;
     struct r300_texture* desttex = (struct r300_texture*)dest->texture;
-
     unsigned pixpitch = srctex->stride / srctex->tex.block.size;
+    CS_LOCALS(r300);
+
     debug_printf("r300: Copying surface %p at (%d,%d) to %p at (%d, %d),"
         " dimensions %dx%d (pixel pitch %d)\n",
         src, srcx, srcy, dest, destx, desty, w, h, pixpitch);
 
-    /* if ((srctex == desttex) &&
+    if ((srctex == desttex) &&
             ((destx < srcx + w) || (srcx < destx + w)) &&
-            ((desty < srcy + h) || (srcy < destx + h))) { */
-    if (TRUE) {
+            ((desty < srcy + h) || (srcy < desty + h))) {
         debug_printf("r300: Falling back on surface_copy\n");
-        return util_surface_copy(pipe, FALSE, dest, destx, desty, src,
+        util_surface_copy(pipe, FALSE, dest, destx, desty, src,
                 srcx, srcy, w, h);
     }
+
+    r300_emit_sampler(r300, &r300_sampler_copy_state, 0);
+    r300_emit_texture(r300, srctex, 0);
+    r300_flush_textures(r300);
+
+    /* Vertex shader setup */
+    if (caps->has_tcl) {
+        r300_emit_vertex_shader(r300, &r300_texture_vertex_shader);
+    } else {
+        BEGIN_CS(4);
+        OUT_CS_REG(R300_VAP_CNTL_STATUS, R300_VAP_TCL_BYPASS);
+        OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(5) |
+                R300_PVS_NUM_CNTLRS(5) |
+                R300_PVS_NUM_FPUS(caps->num_vert_fpus) |
+                R300_PVS_VF_MAX_VTX_NUM(12));
+        END_CS;
+    }
+
+    /* Fragment shader setup */
+    if (caps->is_r500) {
+        r500_emit_fragment_shader(r300, &r500_texture_fragment_shader);
+        r300_emit_rs_block_state(r300, &r500_rs_block_copy_state);
+    } else {
+        r300_emit_fragment_shader(r300, &r300_texture_fragment_shader);
+        r300_emit_rs_block_state(r300, &r300_rs_block_copy_state);
+    }
+
+    /* VAP stream control, mapping from input memory to PVS/RS memory */
+    if (caps->has_tcl) {
+        OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+            (R300_DATA_TYPE_FLOAT_2 << R300_DATA_TYPE_0_SHIFT) |
+            ((R300_LAST_VEC | (1 << R300_DST_VEC_LOC_SHIFT) |
+                R300_DATA_TYPE_FLOAT_2) << R300_DATA_TYPE_1_SHIFT));
+    } else {
+        OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_0,
+            (R300_DATA_TYPE_FLOAT_2 << R300_DATA_TYPE_0_SHIFT) |
+            ((R300_LAST_VEC | (6 << R300_DST_VEC_LOC_SHIFT) |
+                R300_DATA_TYPE_FLOAT_2) << R300_DATA_TYPE_1_SHIFT));
+    }
+    OUT_CS_REG(R300_VAP_PROG_STREAM_CNTL_EXT_0,
+            (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE0_SHIFT) |
+            (R300_VAP_SWIZZLE_XYZW << R300_SWIZZLE1_SHIFT));
+
+    /* VAP format controls */
+    OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_0,
+            R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT);
+    /* Two components of texture 0 */
+    OUT_CS_REG(R300_VAP_OUTPUT_VTX_FMT_1, 0x2);
+
+    /* Packet3 with our texcoords */
+    OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8);
+    OUT_CS(R300_PRIM_TYPE_QUADS | R300_PRIM_WALK_RING |
+            (4 << R300_PRIM_NUM_VERTICES_SHIFT));
+    /* (x    , y    ) */
+    OUT_CS_32F((float)destx);
+    OUT_CS_32F((float)desty);
+    OUT_CS_32F((float)srcx);
+    OUT_CS_32F((float)srcy);
+    /* (x    , y + h) */
+    OUT_CS_32F((float)destx);
+    OUT_CS_32F((float)(desty + h));
+    OUT_CS_32F((float)srcx);
+    OUT_CS_32F((float)(srcy + h));
+    /* (x + w, y + h) */
+    OUT_CS_32F((float)(destx + w));
+    OUT_CS_32F((float)(desty + h));
+    OUT_CS_32F((float)(srcx + w));
+    OUT_CS_32F((float)(srcy + h));
+    /* (x + w, y    ) */
+    OUT_CS_32F((float)(destx + w));
+    OUT_CS_32F((float)desty);
+    OUT_CS_32F((float)(srcx + w));
+    OUT_CS_32F((float)srcy);
+
+    OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA);
+
+    r300->dirty_hw++;
 }
 
 void r300_init_surface_functions(struct r300_context* r300)
index b75b3ab..894def0 100644 (file)
 #include "r300_cs.h"
 #include "r300_emit.h"
 #include "r300_state_shader.h"
+#include "r300_state_tcl.h"
 #include "r300_state_inlines.h"
 
-const struct r300_blend_state blend_clear_state = {
+static struct r300_blend_state blend_clear_state = {
     .blend_control = 0x0,
     .alpha_blend_control = 0x0,
     .rop = 0x0,
     .dither = 0x0,
 };
 
-const struct r300_blend_color_state blend_color_clear_state = {
+static struct r300_blend_color_state blend_color_clear_state = {
     .blend_color = 0x0,
     .blend_color_red_alpha = 0x0,
     .blend_color_green_blue = 0x0,
 };
 
-const struct r300_dsa_state dsa_clear_state = {
+static struct r300_dsa_state dsa_clear_state = {
     .alpha_function = 0x0,
     .alpha_reference = 0x0,
     .z_buffer_control = 0x0,
@@ -57,7 +58,7 @@ const struct r300_dsa_state dsa_clear_state = {
     .stencil_ref_bf = 0x0,
 };
 
-const struct r300_rs_state rs_clear_state = {
+static struct r300_rs_state rs_clear_state = {
     .point_minmax = 0x36000006,
     .line_control = 0x00030006,
     .depth_scale_front = 0x0,
@@ -71,7 +72,7 @@ const struct r300_rs_state rs_clear_state = {
     .color_control = R300_SHADE_MODEL_FLAT,
 };
 
-const struct r300_rs_block r300_rs_block_clear_state = {
+static struct r300_rs_block r300_rs_block_clear_state = {
     .ip[0] = R500_RS_SEL_S(R300_RS_SEL_K0) |
         R500_RS_SEL_T(R300_RS_SEL_K0) |
         R500_RS_SEL_R(R300_RS_SEL_K0) |
@@ -81,7 +82,7 @@ const struct r300_rs_block r300_rs_block_clear_state = {
     .inst_count = 0,
 };
 
-const struct r300_rs_block r500_rs_block_clear_state = {
+static struct r300_rs_block r500_rs_block_clear_state = {
     .ip[0] = R500_RS_SEL_S(R500_RS_IP_PTR_K0) |
         R500_RS_SEL_T(R500_RS_IP_PTR_K0) |
         R500_RS_SEL_R(R500_RS_IP_PTR_K0) |
@@ -91,4 +92,33 @@ const struct r300_rs_block r500_rs_block_clear_state = {
     .inst_count = 0,
 };
 
+/* The following state is used for surface_copy only. */
+
+static struct r300_rs_block r300_rs_block_copy_state = {
+    .ip[0] = R500_RS_SEL_S(R300_RS_SEL_K0) |
+        R500_RS_SEL_T(R300_RS_SEL_K0) |
+        R500_RS_SEL_R(R300_RS_SEL_K0) |
+        R500_RS_SEL_Q(R300_RS_SEL_K1),
+    .inst[0] = R300_RS_INST_COL_CN_WRITE,
+    .count = R300_IT_COUNT(2) | R300_IC_COUNT(0) | R300_HIRES_EN,
+    .inst_count = R300_RS_TX_OFFSET(6),
+};
+
+static struct r300_rs_block r500_rs_block_copy_state = {
+    .ip[0] = R500_RS_SEL_S(0) |
+        R500_RS_SEL_T(1) |
+        R500_RS_SEL_R(R500_RS_IP_PTR_K0) |
+        R500_RS_SEL_Q(R500_RS_IP_PTR_K1),
+    .inst[0] = R500_RS_INST_TEX_CN_WRITE,
+    .count = R300_IT_COUNT(2) | R300_IC_COUNT(0) | R300_HIRES_EN,
+    .inst_count = R300_RS_TX_OFFSET(6),
+};
+
+static struct r300_sampler_state r300_sampler_copy_state = {
+    .filter0 = R300_TX_WRAP_S(R300_TX_CLAMP) |
+        R300_TX_WRAP_T(R300_TX_CLAMP) |
+        R300_TX_MAG_FILTER_NEAREST |
+        R300_TX_MIN_FILTER_NEAREST,
+};
+
 #endif /* R300_SURFACE_H */
index 6cdea3d..fe91f4e 100644 (file)
@@ -147,7 +147,6 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen,
         surface->height = texture->height[level];
         surface->offset = offset;
         surface->usage = flags;
-        surface->status = PIPE_SURFACE_STATUS_DEFINED;
     }
 
     return surface;
index ad108ec..fa59277 100644 (file)
@@ -2,6 +2,7 @@
  * 
  * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
+ * Copyright 2009 VMware, Inc.  All Rights Reserved.
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
@@ -27,6 +28,7 @@
 
 /* Author:
  *    Brian Paul
+ *    Michel Dänzer
  */
 
 
 
 
 /**
- * Convert packed pixel from one format to another.
- */
-static unsigned
-convert_color(enum pipe_format srcFormat, unsigned srcColor,
-              enum pipe_format dstFormat)
-{
-   ubyte r, g, b, a;
-   unsigned dstColor;
-
-   util_unpack_color_ub(srcFormat, &srcColor, &r, &g, &b, &a);
-   util_pack_color_ub(r, g, b, a, dstFormat, &dstColor);
-
-   return dstColor;
-}
-
-
-
-/**
- * Clear the given surface to the specified value.
+ * Clear the given buffers to the specified values.
  * No masking, no scissor (clear entire buffer).
- * Note: when clearing a color buffer, the clearValue is always
- * encoded as PIPE_FORMAT_A8R8G8B8_UNORM.
  */
 void
-softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-               unsigned clearValue)
+softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+               double depth, unsigned stencil)
 {
    struct softpipe_context *softpipe = softpipe_context(pipe);
+   unsigned cv;
    uint i;
 
    if (softpipe->no_rast)
@@ -77,31 +60,30 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
    softpipe_update_derived(softpipe); /* not needed?? */
 #endif
 
-   if (ps == sp_tile_cache_get_surface(softpipe->zsbuf_cache)) {
-      sp_tile_cache_clear(softpipe->zsbuf_cache, clearValue);
-      softpipe->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_CLEAR;
-#if TILE_CLEAR_OPTIMIZATION
-      return;
-#endif
-   }
+   if (buffers & PIPE_CLEAR_COLOR) {
+      for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
+         struct pipe_surface *ps = softpipe->framebuffer.cbufs[i];
 
-   for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) {
-      if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[i])) {
-         unsigned cv;
-         if (ps->format != PIPE_FORMAT_A8R8G8B8_UNORM) {
-            cv = convert_color(PIPE_FORMAT_A8R8G8B8_UNORM, clearValue,
-                               ps->format);
-         }
-         else {
-            cv = clearValue;
-         }
-         sp_tile_cache_clear(softpipe->cbuf_cache[i], cv);
-         softpipe->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_CLEAR;
+         util_pack_color(rgba, ps->format, &cv);
+         sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, cv);
+
+#if !TILE_CLEAR_OPTIMIZATION
+         /* non-cached surface */
+         pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
+#endif
       }
    }
 
+   if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
+      static const float zero[4] = { 0.0F, 0.0F, 0.0F, 0.0F };
+      struct pipe_surface *ps = softpipe->framebuffer.zsbuf;
+
+      cv = util_pack_z_stencil(ps->format, depth, stencil);
+      sp_tile_cache_clear(softpipe->zsbuf_cache, zero, cv);
+
 #if !TILE_CLEAR_OPTIMIZATION
-   /* non-cached surface */
-   pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, clearValue);
+      /* non-cached surface */
+      pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv);
 #endif
+      }
 }
index a8ed1c4..2e45067 100644 (file)
@@ -36,8 +36,8 @@
 struct pipe_context;
 
 extern void
-softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
-               unsigned clearValue);
+softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
+               double depth, unsigned stencil);
 
 
 #endif /* SP_CLEAR_H */
index 0c14d92..9ee86fe 100644 (file)
  * 
  **************************************************************************/
 
+/**
+ * Execute fragment shader using the TGSI interpreter.
+ */
 
 #include "sp_context.h"
 #include "sp_state.h"
 #include "sp_fs.h"
 #include "sp_quad.h"
 
-
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 #include "tgsi/tgsi_exec.h"
 #include "tgsi/tgsi_parse.h"
 
+
+/**
+ * Subclass of sp_fragment_shader
+ */
 struct sp_exec_fragment_shader
 {
    struct sp_fragment_shader base;
+   /* No other members for now */
 };
 
 
@@ -106,8 +113,6 @@ exec_prepare( const struct sp_fragment_shader *base,
 }
 
 
-
-
 /* TODO: hide the machine struct in here somewhere, remove from this
  * interface:
  */
@@ -116,7 +121,6 @@ exec_run( const struct sp_fragment_shader *base,
          struct tgsi_exec_machine *machine,
          struct quad_header *quad )
 {
-
    /* Compute X, Y, Z, W vals for this quad */
    sp_setup_pos_vector(quad->posCoef, 
                       (float)quad->input.x0, (float)quad->input.y0, 
@@ -126,7 +130,6 @@ exec_run( const struct sp_fragment_shader *base,
 }
 
 
-
 static void 
 exec_delete( struct sp_fragment_shader *base )
 {
@@ -135,9 +138,6 @@ exec_delete( struct sp_fragment_shader *base )
 }
 
 
-
-
-
 struct sp_fragment_shader *
 softpipe_create_fs_exec(struct softpipe_context *softpipe,
                        const struct pipe_shader_state *templ)
@@ -160,4 +160,3 @@ softpipe_create_fs_exec(struct softpipe_context *softpipe,
 
    return &shader->base;
 }
-
index f33b3e3..95c0d98 100644 (file)
@@ -25,7 +25,9 @@
  * 
  **************************************************************************/
 
-/* Authors:
+/**
+ * Execute fragment shader using LLVM code generation.
+ * Authors:
  *   Zack Rusin
  */
 
@@ -33,7 +35,6 @@
 #include "sp_state.h"
 #include "sp_fs.h"
 
-
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
 
 #if 0
 
-struct sp_llvm_fragment_shader {
+/**
+ * Subclass of sp_fragment_shader
+ */
+struct sp_llvm_fragment_shader
+{
    struct sp_fragment_shader base;
    struct gallivm_prog *llvm_prog;
 };
 
+
 static void
 shade_quad_llvm(struct quad_stage *qs,
                 struct quad_header *quad)
@@ -160,7 +166,7 @@ delete_llvm_fs( struct sp_fragment_shader *base )
 
 struct sp_fragment_shader *
 softpipe_create_fs_llvm(struct softpipe_context *softpipe,
-                      const struct pipe_shader_state *templ)
+                        const struct pipe_shader_state *templ)
 {
    struct sp_llvm_fragment_shader *shader = NULL;
 
index 366abe2..31c3ca2 100644 (file)
  * 
  **************************************************************************/
 
+/**
+ * Execute fragment shader using runtime SSE code generation.
+ */
 
 #include "sp_context.h"
 #include "sp_state.h"
 #include "sp_fs.h"
 #include "sp_quad.h"
 
-
 #include "pipe/p_state.h"
 #include "pipe/p_defines.h"
 #include "util/u_memory.h"
@@ -56,14 +58,25 @@ typedef void (PIPE_CDECL *codegen_function)(
  );
 
 
-struct sp_sse_fragment_shader {
+/**
+ * Subclass of sp_fragment_shader
+ */
+struct sp_sse_fragment_shader
+{
    struct sp_fragment_shader base;
-   struct x86_function             sse2_program;
+   struct x86_function sse2_program;
    codegen_function func;
    float immediates[TGSI_EXEC_NUM_IMMEDIATES][4];
 };
 
 
+/** cast wrapper */
+static INLINE struct sp_sse_fragment_shader *
+sp_sse_fragment_shader(const struct sp_fragment_shader *base)
+{
+   return (struct sp_sse_fragment_shader *) base;
+}
+
 
 static void
 fs_sse_prepare( const struct sp_fragment_shader *base,
@@ -83,7 +96,7 @@ fs_sse_run( const struct sp_fragment_shader *base,
            struct tgsi_exec_machine *machine,
            struct quad_header *quad )
 {
-   struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base;
+   struct sp_sse_fragment_shader *shader = sp_sse_fragment_shader(base);
 
    /* Compute X, Y, Z, W vals for this quad -- place in temp[0] for now */
    sp_setup_pos_vector(quad->posCoef, 
@@ -110,7 +123,7 @@ fs_sse_run( const struct sp_fragment_shader *base,
 static void 
 fs_sse_delete( struct sp_fragment_shader *base )
 {
-   struct sp_sse_fragment_shader *shader = (struct sp_sse_fragment_shader *) base;
+   struct sp_sse_fragment_shader *shader = sp_sse_fragment_shader(base);
 
    x86_release_func( &shader->sse2_program );
    FREE(shader);
@@ -156,7 +169,7 @@ softpipe_create_fs_sse(struct softpipe_context *softpipe,
 
 #else
 
-/* Maybe put this varient in the header file.
+/* Maybe put this variant in the header file.
  */
 struct sp_fragment_shader *
 softpipe_create_fs_sse(struct softpipe_context *softpipe,
index adca5df..ca637a1 100644 (file)
@@ -65,14 +65,11 @@ quad_shade_stage(struct quad_stage *qs)
 }
 
 
-
 /**
  * Execute fragment shader for the four fragments in the quad.
  */
 static void
-shade_quad(
-   struct quad_stage *qs,
-   struct quad_header *quad )
+shade_quad(struct quad_stage *qs, struct quad_header *quad)
 {
    struct quad_shade_stage *qss = quad_shade_stage( qs );
    struct softpipe_context *softpipe = qs->softpipe;
@@ -85,9 +82,7 @@ shade_quad(
    machine->InterpCoefs = quad->coef;
 
    /* run shader */
-   quad->inout.mask &= softpipe->fs->run( softpipe->fs, 
-                                   &qss->machine,
-                                   quad );
+   quad->inout.mask &= softpipe->fs->run( softpipe->fs, machine, quad );
 
    /* store outputs */
    z_written = FALSE;
@@ -135,15 +130,17 @@ shade_quad(
    }
 
    /* shader may cull fragments */
-   if( quad->inout.mask ) {
+   if (quad->inout.mask) {
       qs->next->run( qs->next, quad );
    }
 }
 
+
 /**
  * Per-primitive (or per-begin?) setup
  */
-static void shade_begin(struct quad_stage *qs)
+static void
+shade_begin(struct quad_stage *qs)
 {
    struct quad_shade_stage *qss = quad_shade_stage(qs);
    struct softpipe_context *softpipe = qs->softpipe;
@@ -157,7 +154,8 @@ static void shade_begin(struct quad_stage *qs)
 }
 
 
-static void shade_destroy(struct quad_stage *qs)
+static void
+shade_destroy(struct quad_stage *qs)
 {
    struct quad_shade_stage *qss = (struct quad_shade_stage *) qs;
 
@@ -168,7 +166,8 @@ static void shade_destroy(struct quad_stage *qs)
 }
 
 
-struct quad_stage *sp_quad_shade_stage( struct softpipe_context *softpipe )
+struct quad_stage *
+sp_quad_shade_stage( struct softpipe_context *softpipe )
 {
    struct quad_shade_stage *qss = CALLOC_STRUCT(quad_shade_stage);
 
index 96cb09b..accc692 100644 (file)
@@ -252,16 +252,6 @@ static PIPE_THREAD_ROUTINE( quad_thread, param )
 
 #endif
 
-/**
- * Test if x is NaN or +/- infinity.
- */
-static INLINE boolean
-is_inf_or_nan(float x)
-{
-   union fi tmp;
-   tmp.f = x;
-   return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31);
-}
 
 
 /**
@@ -506,6 +496,9 @@ static void print_vertex(const struct setup_context *setup,
    for (i = 0; i < setup->quad.nr_attrs; i++) {
       debug_printf("     %d: %f %f %f %f\n",  i,
               v[i][0], v[i][1], v[i][2], v[i][3]);
+      if (util_is_inf_or_nan(v[i][0])) {
+         debug_printf("   NaN!\n");
+      }
    }
 }
 #endif
@@ -595,7 +588,7 @@ static boolean setup_sort_vertices( struct setup_context *setup,
       debug_printf("%s one-over-area %f  area %f  det %f\n",
                    __FUNCTION__, setup->oneoverarea, area, det );
       */
-      if (is_inf_or_nan(setup->oneoverarea))
+      if (util_is_inf_or_nan(setup->oneoverarea))
          return FALSE;
    }
 
@@ -1065,7 +1058,7 @@ setup_line_coefficients(struct setup_context *setup,
 
    /* NOTE: this is not really area but something proportional to it */
    area = setup->emaj.dx * setup->emaj.dx + setup->emaj.dy * setup->emaj.dy;
-   if (area == 0.0f || is_inf_or_nan(area))
+   if (area == 0.0f || util_is_inf_or_nan(area))
       return FALSE;
    setup->oneoverarea = 1.0f / area;
 
@@ -1489,16 +1482,6 @@ void setup_prepare( struct setup_context *setup )
       softpipe_update_derived(sp);
    }
 
-   /* Mark surfaces as defined now */
-   for (i = 0; i < sp->framebuffer.nr_cbufs; i++){
-      if (sp->framebuffer.cbufs[i]) {
-         sp->framebuffer.cbufs[i]->status = PIPE_SURFACE_STATUS_DEFINED;
-      }
-   }
-   if (sp->framebuffer.zsbuf) {
-      sp->framebuffer.zsbuf->status = PIPE_SURFACE_STATUS_DEFINED;
-   }
-
    /* Note: nr_attrs is only used for debugging (vertex printing) */
    setup->quad.nr_attrs = draw_num_vs_outputs(sp->draw);
 
index ef04843..b04c2a6 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "util/u_rect.h"
 #include "sp_context.h"
+#include "sp_surface.h"
 
 
 static void
index 48b2c22..c0113c4 100644 (file)
@@ -138,7 +138,6 @@ softpipe_texture_create(struct pipe_screen *screen,
          goto fail;
    }
     
-   assert(p_atomic_read(&spt->base.reference.count) == 1);
    return &spt->base;
 
  fail:
@@ -328,7 +327,7 @@ static void *
 softpipe_transfer_map( struct pipe_screen *screen,
                        struct pipe_transfer *transfer )
 {
-   ubyte *map;
+   ubyte *map, *xfer_map;
    struct softpipe_texture *spt;
    unsigned flags = 0;
 
@@ -358,9 +357,11 @@ softpipe_transfer_map( struct pipe_screen *screen,
       softpipe_screen(screen)->timestamp++;
    }
    
-   return map + softpipe_transfer(transfer)->offset +
+   xfer_map = map + softpipe_transfer(transfer)->offset +
       transfer->y / transfer->block.height * transfer->stride +
       transfer->x / transfer->block.width * transfer->block.size;
+   /*printf("map = %p  xfer map = %p\n", map, xfer_map);*/
+   return xfer_map;
 }
 
 
index 6929275..1f9b8f1 100644 (file)
@@ -57,9 +57,9 @@ struct softpipe_tile_cache
    struct pipe_texture *texture;  /**< if caching a texture */
    struct softpipe_cached_tile entries[NUM_ENTRIES];
    uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32];
-   float clear_color[4];
-   uint clear_val;
-   boolean depth_stencil; /** Is the surface a depth/stencil format? */
+   float clear_color[4];  /**< for color bufs */
+   uint clear_val;        /**< for z+stencil, or packed color clear value */
+   boolean depth_stencil; /**< Is the surface a depth/stencil format? */
 
    struct pipe_transfer *tex_trans;
    void *tex_trans_map;
@@ -599,40 +599,17 @@ sp_get_cached_tile_tex(struct softpipe_context *sp,
  * Save the color and set a 'clearflag' for each tile of the screen.
  */
 void
-sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue)
+sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float *rgba,
+                    uint clearValue)
 {
-   uint r, g, b, a;
    uint pos;
 
-   tc->clear_val = clearValue;
-
-   switch (tc->transfer->format) {
-   case PIPE_FORMAT_R8G8B8A8_UNORM:
-      r = (clearValue >> 24) & 0xff;
-      g = (clearValue >> 16) & 0xff;
-      b = (clearValue >>  8) & 0xff;
-      a = (clearValue      ) & 0xff;
-      break;
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
-      r = (clearValue >> 16) & 0xff;
-      g = (clearValue >>  8) & 0xff;
-      b = (clearValue      ) & 0xff;
-      a = (clearValue >> 24) & 0xff;
-      break;
-   case PIPE_FORMAT_B8G8R8A8_UNORM:
-      r = (clearValue >>  8) & 0xff;
-      g = (clearValue >> 16) & 0xff;
-      b = (clearValue >> 24) & 0xff;
-      a = (clearValue      ) & 0xff;
-      break;
-   default:
-      r = g = b = a = 0;
-   }
+   tc->clear_color[0] = rgba[0];
+   tc->clear_color[1] = rgba[1];
+   tc->clear_color[2] = rgba[2];
+   tc->clear_color[3] = rgba[3];
 
-   tc->clear_color[0] = r / 255.0f;
-   tc->clear_color[1] = g / 255.0f;
-   tc->clear_color[2] = b / 255.0f;
-   tc->clear_color[3] = a / 255.0f;
+   tc->clear_val = clearValue;
 
 #if TILE_CLEAR_OPTIMIZATION
    /* set flags to indicate all the tiles are cleared */
index 9ac3fdd..8f247d0 100644 (file)
@@ -89,7 +89,8 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
                     struct softpipe_tile_cache *tc);
 
 extern void
-sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue);
+sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float *rgba,
+                    uint clearValue);
 
 extern struct softpipe_cached_tile *
 sp_get_cached_tile(struct softpipe_context *softpipe,
index f0e1cd5..73dce20 100644 (file)
@@ -10,15 +10,14 @@ This directory contains a Gallium3D pipe driver which traces all incoming calls.
 
 To build, invoke scons on the top dir as
  
- scons statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib
+ scons dri=no statetrackers=mesa drivers=softpipe,i965simple,trace winsys=xlib
 
 
 = Usage =
 
 To use do
 
- ln -s libGL.so build/linux-x86-debug/gallium/winsys/xlib/libGL.so.1
- export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/gallium/winsys/xlib
+ export LD_LIBRARY_PATH=$PWD/build/linux-x86-debug/lib
 
 ensure the right libGL.so is being picked by doing
 
@@ -26,6 +25,7 @@ ensure the right libGL.so is being picked by doing
 
 and then try running
 
+ export XMESA_TRACE=y
  GALLIUM_TRACE=tri.trace progs/trivial/tri
 
 which should create a tri.trace file, which is an XML file. You can view copying 
index c894972..d8d5821 100644 (file)
@@ -58,16 +58,14 @@ static INLINE struct pipe_texture *
 trace_texture_unwrap(struct trace_context *tr_ctx,
                      struct pipe_texture *texture)
 {
-   struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
    struct trace_texture *tr_tex;
 
    if(!texture)
       return NULL;
 
-   tr_tex = trace_texture(tr_scr, texture);
+   tr_tex = trace_texture(texture);
 
    assert(tr_tex->texture);
-   assert(tr_tex->texture->screen == tr_scr->screen);
    return tr_tex->texture;
 }
 
@@ -77,7 +75,6 @@ trace_surface_unwrap(struct trace_context *tr_ctx,
                      struct pipe_surface *surface)
 {
    struct trace_screen *tr_scr = trace_screen(tr_ctx->base.screen);
-   struct trace_texture *tr_tex;
    struct trace_surface *tr_surf;
 
    if(!surface)
@@ -87,8 +84,7 @@ trace_surface_unwrap(struct trace_context *tr_ctx,
    if(!surface->texture)
       return surface;
 
-   tr_tex = trace_texture(tr_scr, surface->texture);
-   tr_surf = trace_surface(tr_tex, surface);
+   tr_surf = trace_surface(surface);
 
    assert(tr_surf->surface);
    assert(tr_surf->surface->texture->screen == tr_scr->screen);
@@ -973,21 +969,23 @@ trace_context_surface_fill(struct pipe_context *_pipe,
 
 static INLINE void
 trace_context_clear(struct pipe_context *_pipe,
-                    struct pipe_surface *surface,
-                    unsigned clearValue)
+                    unsigned buffers,
+                    const float *rgba,
+                    double depth,
+                    unsigned stencil)
 {
    struct trace_context *tr_ctx = trace_context(_pipe);
    struct pipe_context *pipe = tr_ctx->pipe;
 
-   surface = trace_surface_unwrap(tr_ctx, surface);
-
    trace_dump_call_begin("pipe_context", "clear");
 
    trace_dump_arg(ptr, pipe);
-   trace_dump_arg(ptr, surface);
-   trace_dump_arg(uint, clearValue);
+   trace_dump_arg(uint, buffers);
+   trace_dump_arg_array(float, rgba, 4);
+   trace_dump_arg(float, depth);
+   trace_dump_arg(uint, stencil);
 
-   pipe->clear(pipe, surface, clearValue);;
+   pipe->clear(pipe, buffers, rgba, depth, stencil);
 
    trace_dump_call_end();
 }
@@ -1037,9 +1035,9 @@ struct pipe_context *
 trace_context_create(struct pipe_screen *_screen,
                      struct pipe_context *pipe)
 {
-   struct trace_screen *tr_scr = trace_screen(_screen);
+   struct trace_screen *tr_scr;
    struct trace_context *tr_ctx;
-   struct pipe_screen *screen = tr_scr->screen;
+   struct pipe_screen *screen;
 
    if(!pipe)
       goto error1;
@@ -1047,6 +1045,9 @@ trace_context_create(struct pipe_screen *_screen,
    if(!trace_dump_enabled())
       goto error1;
 
+   tr_scr = trace_screen(_screen);
+   screen = tr_scr->screen;
+
    tr_ctx = CALLOC_STRUCT(trace_context);
    if(!tr_ctx)
       goto error1;
index 6837c94..2618883 100644 (file)
 
 #include "pipe/p_config.h"
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
 #include <stdlib.h>
 #endif
 
 #include "pipe/p_compiler.h"
+#include "pipe/p_thread.h"
 #include "util/u_debug.h"
 #include "util/u_memory.h"
 #include "util/u_string.h"
@@ -58,6 +59,8 @@
 
 static struct util_stream *stream = NULL;
 static unsigned refcount = 0;
+static pipe_mutex call_mutex;
+static long unsigned call_no = 0;
 
 
 static INLINE void
@@ -218,6 +221,8 @@ trace_dump_trace_close(void)
       util_stream_close(stream);
       stream = NULL;
       refcount = 0;
+      call_no = 0;
+      pipe_mutex_destroy(call_mutex);
    }
 }
 
@@ -235,11 +240,13 @@ boolean trace_dump_trace_begin()
       if(!stream)
          return FALSE;
 
+      pipe_mutex_init(call_mutex);
+
       trace_dump_writes("<?xml version='1.0' encoding='UTF-8'?>\n");
       trace_dump_writes("<?xml-stylesheet type='text/xsl' href='trace.xsl'?>\n");
       trace_dump_writes("<trace version='0.1'>\n");
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
       /* Linux applications rarely cleanup GL / Gallium resources so catch
        * application exit here */
       atexit(trace_dump_trace_close);
@@ -265,8 +272,16 @@ void trace_dump_trace_end(void)
 
 void trace_dump_call_begin(const char *klass, const char *method)
 {
+   pipe_mutex_lock(call_mutex);
+   ++call_no;
    trace_dump_indent(1);
-   trace_dump_tag_begin2("call", "class", klass, "method", method);
+   trace_dump_writes("<call no=\'");
+   trace_dump_writef("%lu", call_no);
+   trace_dump_writes("\' class =\'");
+   trace_dump_escape(klass);
+   trace_dump_writes("\' method=\'");
+   trace_dump_escape(method);
+   trace_dump_writes("\'>");
    trace_dump_newline();
 }
 
@@ -276,6 +291,7 @@ void trace_dump_call_end(void)
    trace_dump_tag_end("call");
    trace_dump_newline();
    util_stream_flush(stream);
+   pipe_mutex_unlock(call_mutex);
 }
 
 void trace_dump_arg_begin(const char *name)
@@ -420,8 +436,7 @@ void trace_dump_buffer_ptr(struct pipe_buffer *_buffer)
 void trace_dump_texture_ptr(struct pipe_texture *_texture)
 {
    if (_texture) {
-      struct trace_screen *tr_scr = trace_screen(_texture->screen);
-      struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+      struct trace_texture *tr_tex = trace_texture(_texture);
       trace_dump_ptr(tr_tex->texture);
    } else {
       trace_dump_null();
@@ -431,9 +446,7 @@ void trace_dump_texture_ptr(struct pipe_texture *_texture)
 void trace_dump_surface_ptr(struct pipe_surface *_surface)
 {
    if (_surface) {
-      struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
-      struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
-      struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+      struct trace_surface *tr_surf = trace_surface(_surface);
       trace_dump_ptr(tr_surf->surface);
    } else {
       trace_dump_null();
@@ -443,9 +456,7 @@ void trace_dump_surface_ptr(struct pipe_surface *_surface)
 void trace_dump_transfer_ptr(struct pipe_transfer *_transfer)
 {
    if (_transfer) {
-      struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
-      struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
-      struct trace_transfer *tr_tran = trace_transfer(tr_tex, _transfer);
+      struct trace_transfer *tr_tran = trace_transfer(_transfer);
       trace_dump_ptr(tr_tran->transfer);
    } else {
       trace_dump_null();
index 954576d..6792505 100644 (file)
@@ -159,8 +159,7 @@ trace_screen_flush_frontbuffer(struct pipe_screen *_screen,
                                void *context_private)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
-   struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+   struct trace_surface *tr_surf = trace_surface(_surface);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_surface *surface = tr_surf->surface;
 
@@ -242,7 +241,7 @@ static void
 trace_screen_texture_destroy(struct pipe_texture *_texture)
 {
    struct trace_screen *tr_scr = trace_screen(_texture->screen);
-   struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+   struct trace_texture *tr_tex = trace_texture(_texture);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_texture *texture = tr_tex->texture;
 
@@ -255,7 +254,7 @@ trace_screen_texture_destroy(struct pipe_texture *_texture)
 
    trace_dump_call_end();
 
-   trace_texture_destroy(tr_scr, _texture);
+   trace_texture_destroy(tr_tex);
 }
 
 
@@ -272,7 +271,7 @@ trace_screen_get_tex_surface(struct pipe_screen *_screen,
                              unsigned usage)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+   struct trace_texture *tr_tex = trace_texture(_texture);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_texture *texture = tr_tex->texture;
    struct pipe_surface *result = NULL;
@@ -304,8 +303,7 @@ static void
 trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
 {
    struct trace_screen *tr_scr = trace_screen(_surface->texture->screen);
-   struct trace_texture *tr_tex = trace_texture(tr_scr, _surface->texture);
-   struct trace_surface *tr_surf = trace_surface(tr_tex, _surface);
+   struct trace_surface *tr_surf = trace_surface(_surface);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_surface *surface = tr_surf->surface;
 
@@ -316,7 +314,7 @@ trace_screen_tex_surface_destroy(struct pipe_surface *_surface)
 
    trace_dump_call_end();
 
-   trace_surface_destroy(tr_tex, _surface);
+   trace_surface_destroy(tr_surf);
 }
 
 
@@ -334,7 +332,7 @@ trace_screen_get_tex_transfer(struct pipe_screen *_screen,
                               unsigned x, unsigned y, unsigned w, unsigned h)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_texture *tr_tex = trace_texture(tr_scr, _texture);
+   struct trace_texture *tr_tex = trace_texture(_texture);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_texture *texture = tr_tex->texture;
    struct pipe_transfer *result = NULL;
@@ -372,10 +370,9 @@ static void
 trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
 {
    struct trace_screen *tr_scr = trace_screen(_transfer->texture->screen);
-   struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
-   struct trace_transfer *tr_tran = trace_transfer(tr_tex, _transfer);
+   struct trace_transfer *tr_trans = trace_transfer(_transfer);
    struct pipe_screen *screen = tr_scr->screen;
-   struct pipe_transfer *transfer = tr_tran->transfer;
+   struct pipe_transfer *transfer = tr_trans->transfer;
 
    trace_dump_call_begin("pipe_screen", "tex_transfer_destroy");
 
@@ -384,7 +381,7 @@ trace_screen_tex_transfer_destroy(struct pipe_transfer *_transfer)
 
    trace_dump_call_end();
 
-   trace_transfer_destroy(tr_tex, _transfer);
+   trace_transfer_destroy(tr_trans);
 }
 
 
@@ -393,8 +390,7 @@ trace_screen_transfer_map(struct pipe_screen *_screen,
                           struct pipe_transfer *_transfer)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
-   struct trace_transfer *tr_trans = trace_transfer(tr_tex, _transfer);
+   struct trace_transfer *tr_trans = trace_transfer(_transfer);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_transfer *transfer = tr_trans->transfer;
    void *map;
@@ -416,8 +412,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen,
                            struct pipe_transfer *_transfer)
 {
    struct trace_screen *tr_scr = trace_screen(_screen);
-   struct trace_texture *tr_tex = trace_texture(tr_scr, _transfer->texture);
-   struct trace_transfer *tr_trans = trace_transfer(tr_tex, _transfer);
+   struct trace_transfer *tr_trans = trace_transfer(_transfer);
    struct pipe_screen *screen = tr_scr->screen;
    struct pipe_transfer *transfer = tr_trans->transfer;
 
@@ -706,7 +701,7 @@ trace_screen_buffer_unmap(struct pipe_screen *_screen,
    struct pipe_buffer *buffer = tr_buf->buffer;
 
    if (tr_buf->map && !tr_buf->range_flushed)
-      buffer_write(screen, buffer, tr_buf->map, 0, buffer->size);
+      buffer_write(screen, buffer, 0, tr_buf->map, buffer->size);
    tr_buf->map = NULL;
    tr_buf->range_flushed = FALSE;
    screen->buffer_unmap(screen, buffer);
index f9fbe9a..a9570c1 100644 (file)
@@ -406,8 +406,6 @@ void trace_dump_surface(const struct pipe_surface *state)
    trace_dump_reference(&state->reference);
 
    trace_dump_member(format, state, format);
-   trace_dump_member(uint, state, status);
-   trace_dump_member(uint, state, clear_value);
    trace_dump_member(uint, state, width);
    trace_dump_member(uint, state, height);
 
index 7b392f0..f4e4337 100644 (file)
@@ -62,10 +62,8 @@ error:
 
 
 void
-trace_texture_destroy(struct trace_screen *tr_scr,
-                      struct pipe_texture *texture)
+trace_texture_destroy(struct trace_texture *tr_tex)
 {
-   struct trace_texture *tr_tex = trace_texture(tr_scr, texture);
    pipe_texture_reference(&tr_tex->texture, NULL);
    FREE(tr_tex);
 }
@@ -102,10 +100,8 @@ error:
 
 
 void
-trace_surface_destroy(struct trace_texture *tr_tex,
-                      struct pipe_surface *surface)
+trace_surface_destroy(struct trace_surface *tr_surf)
 {
-   struct trace_surface *tr_surf = trace_surface(tr_tex, surface);
    pipe_texture_reference(&tr_surf->base.texture, NULL);
    pipe_surface_reference(&tr_surf->surface, NULL);
    FREE(tr_surf);
@@ -143,10 +139,8 @@ error:
 
 
 void
-trace_transfer_destroy(struct trace_texture *tr_tex,
-                      struct pipe_transfer *transfer)
+trace_transfer_destroy(struct trace_transfer *tr_trans)
 {
-   struct trace_transfer *tr_trans = trace_transfer(tr_tex, transfer);
    struct pipe_screen *screen = tr_trans->transfer->texture->screen;
    pipe_texture_reference(&tr_trans->base.texture, NULL);
    screen->tex_transfer_destroy(tr_trans->transfer);
index 9c21bc7..14dafd8 100644 (file)
@@ -62,37 +62,31 @@ struct trace_transfer
 
 
 static INLINE struct trace_texture *
-trace_texture(struct trace_screen *tr_scr,
-              struct pipe_texture *texture)
+trace_texture(struct pipe_texture *texture)
 {
    if(!texture)
       return NULL;
-   assert(tr_scr);
-   assert(texture->screen == &tr_scr->base);
+   (void)trace_screen(texture->screen);
    return (struct trace_texture *)texture;
 }
 
 
 static INLINE struct trace_surface *
-trace_surface(struct trace_texture *tr_tex,
-              struct pipe_surface *surface)
+trace_surface(struct pipe_surface *surface)
 {
    if(!surface)
       return NULL;
-   assert(tr_tex);
-   assert(surface->texture == &tr_tex->base);
+   (void)trace_texture(surface->texture);
    return (struct trace_surface *)surface;
 }
 
 
 static INLINE struct trace_transfer *
-trace_transfer(struct trace_texture *tr_tex,
-               struct pipe_transfer *transfer)
+trace_transfer(struct pipe_transfer *transfer)
 {
    if(!transfer)
       return NULL;
-   assert(tr_tex);
-   assert(transfer->texture == &tr_tex->base);
+   (void)trace_texture(transfer->texture);
    return (struct trace_transfer *)transfer;
 }
 
@@ -102,24 +96,21 @@ trace_texture_create(struct trace_screen *tr_scr,
                      struct pipe_texture *texture);
 
 void
-trace_texture_destroy(struct trace_screen *tr_scr,
-                      struct pipe_texture *texture);
+trace_texture_destroy(struct trace_texture *tr_tex);
 
 struct pipe_surface *
 trace_surface_create(struct trace_texture *tr_tex,
                      struct pipe_surface *surface);
 
 void
-trace_surface_destroy(struct trace_texture *tr_tex,
-                      struct pipe_surface *surface);
+trace_surface_destroy(struct trace_surface *tr_surf);
 
 struct pipe_transfer *
 trace_transfer_create(struct trace_texture *tr_tex,
                       struct pipe_transfer *transfer);
 
 void
-trace_transfer_destroy(struct trace_texture *tr_tex,
-                       struct pipe_transfer *transfer);
+trace_transfer_destroy(struct trace_transfer *tr_trans);
 
 
 #endif /* TR_TEXTURE_H_ */
index 9cd621e..7be95e0 100644 (file)
@@ -68,6 +68,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
        <xsl:template match="call">
                <li>
+                       <xsl:attribute name="value">
+                               <xsl:apply-templates select="@no"/>
+                       </xsl:attribute>
                        <span class="fun">
                                <xsl:value-of select="@class"/>
                                <xsl:text>::</xsl:text>
index bc2a0a7..e6a67f8 100644 (file)
@@ -124,11 +124,30 @@ typedef unsigned char boolean;
 #    define INLINE inline
 #  elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
 #    define INLINE __inline
+#  elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
+#    define INLINE inline
+#  elif (__STDC_VERSION__ >= 199901L) /* C99 */
+#    define INLINE inline
 #  else
 #    define INLINE
 #  endif
 #endif
 
+/* The __FUNCTION__ gcc variable is generally only used for debugging.
+ * If we're not using gcc, define __FUNCTION__ as a cpp symbol here.
+ */
+#ifndef __FUNCTION__
+# if (!defined(__GNUC__) || (__GNUC__ < 2))
+#  if (__STDC_VERSION__ >= 199901L) /* C99 */ || \
+    (defined(__SUNPRO_C) && defined(__C99FEATURES__))
+#   define __FUNCTION__ __func__
+#  else
+#   define __FUNCTION__ "<unknown>"
+#  endif
+# endif
+#endif
+
+
 
 /* This should match linux gcc cdecl semantics everywhere, so that we
  * just codegen one calling convention on all platforms.
index 7f76570..63238ea 100644 (file)
  * Processor architecture
  */
 
-#if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386)
+#if defined(__i386__) /* gcc */ || defined(_M_IX86) /* msvc */ || defined(_X86_) || defined(__386__) || defined(i386) || defined(__i386) /* Sun cc */
 #define PIPE_ARCH_X86
 #endif
 
-#if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */
+#if defined(__x86_64__) /* gcc */ || defined(_M_X64) /* msvc */ || defined(_M_AMD64) /* msvc */ || defined(__x86_64) /* Sun cc */
 #define PIPE_ARCH_X86_64
 #endif
 
 #define PIPE_OS_BSD
 #endif
 
+#if defined(__sun)
+#define PIPE_OS_SOLARIS
+#endif
+
 #if defined(_WIN32) || defined(WIN32)
 #define PIPE_OS_WINDOWS
 #endif
  * NOTE: There is no way to auto-detect most of these.
  */
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
 #define PIPE_SUBSYSTEM_DRI
-#endif /* PIPE_OS_LINUX || PIPE_OS_BSD */
+#endif /* PIPE_OS_LINUX || PIPE_OS_BSD || PIPE_OS_SOLARIS */
 
 #if defined(PIPE_OS_WINDOWS)
 #if defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY)
index 2452bf3..29095dc 100644 (file)
@@ -205,12 +205,20 @@ struct pipe_context {
                        unsigned dstx, unsigned dsty,
                        unsigned width, unsigned height,
                        unsigned value);
-
-   void (*clear)(struct pipe_context *pipe, 
-                struct pipe_surface *ps,
-                unsigned clearValue);
    /*@}*/
 
+   /**
+    * Clear the specified set of currently bound buffers to specified values.
+    *
+    * buffers is a bitfield of PIPE_CLEAR_* values.
+    *
+    * rgba is a pointer to an array of one float for each of r, g, b, a.
+    */
+   void (*clear)(struct pipe_context *pipe,
+                 unsigned buffers,
+                const float *rgba,
+                 double depth,
+                unsigned stencil);
 
    /** Flush rendering (flags = bitmask of PIPE_FLUSH_x tokens) */
    void (*flush)( struct pipe_context *pipe,
index 52d4439..81defa4 100644 (file)
@@ -186,11 +186,12 @@ enum pipe_texture_target {
 
 
 /**
- * Surface status
+ * Clear buffer bits
  */
-#define PIPE_SURFACE_STATUS_UNDEFINED  0
-#define PIPE_SURFACE_STATUS_DEFINED    1
-#define PIPE_SURFACE_STATUS_CLEAR      2
+/** All color buffers currently bound */
+#define PIPE_CLEAR_COLOR        (1 << 0)
+/** Depth/stencil combined */
+#define PIPE_CLEAR_DEPTHSTENCIL (1 << 1)
 
 
 /**
index 3f65a60..a279eef 100644 (file)
@@ -537,6 +537,13 @@ pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned h
 }
 
 static INLINE boolean 
+pf_is_depth_stencil( enum pipe_format format )
+{
+   return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) +
+           pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0;
+}
+
+static INLINE boolean 
 pf_is_compressed( enum pipe_format format )
 {
    return pf_layout(format) == PIPE_FORMAT_LAYOUT_DXT ? TRUE : FALSE;
index 60844e4..1f89453 100644 (file)
@@ -51,6 +51,13 @@ pipe_reference_init(struct pipe_reference *reference, unsigned count)
 }
 
 
+static INLINE bool
+pipe_is_referenced(struct pipe_reference *reference)
+{
+   return p_atomic_read(&reference->count) != 0;
+}
+
+
 /**
  * Set 'ptr' to point to 'reference' and update reference counting.
  * The old thing pointed to, if any, will be unreferenced first.
@@ -65,12 +72,12 @@ pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference)
 
    /* bump the reference.count first */
    if (reference) {
-      assert(p_atomic_read(&reference->count) != 0);
+      assert(pipe_is_referenced(reference));
       p_atomic_inc(&reference->count);
    }
 
    if (*ptr) {
-      assert(p_atomic_read(&(*ptr)->count) != 0);
+      assert(pipe_is_referenced(*ptr));
       if (p_atomic_dec_zero(&(*ptr)->count)) {
          destroy = TRUE;
       }
@@ -81,6 +88,7 @@ pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference)
    return destroy;
 }
 
+
 #ifdef __cplusplus
 }
 #endif
index 9c7baa3..705ae68 100644 (file)
@@ -281,8 +281,6 @@ struct pipe_surface
 {
    struct pipe_reference reference;
    enum pipe_format format;      /**< PIPE_FORMAT_x */
-   unsigned status;              /**< PIPE_SURFACE_STATUS_x */
-   unsigned clear_value;         /**< XXX may be temporary */
    unsigned width;               /**< logical width in pixels */
    unsigned height;              /**< logical height in pixels */
    unsigned layout;              /**< PIPE_SURFACE_LAYOUT_x */
index a9cd775..de55e99 100644 (file)
@@ -38,7 +38,7 @@
 #include "pipe/p_compiler.h"
 
 
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
 
 #include <pthread.h> /* POSIX threads headers */
 #include <stdio.h> /* for perror() */
@@ -210,7 +210,7 @@ typedef unsigned pipe_condvar;
  */
 
 typedef struct {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    pthread_key_t key;
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
    DWORD key;
@@ -225,7 +225,7 @@ typedef struct {
 static INLINE void
 pipe_tsd_init(pipe_tsd *tsd)
 {
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    if (pthread_key_create(&tsd->key, NULL/*free*/) != 0) {
       perror("pthread_key_create(): failed to allocate key for thread specific data");
       exit(-1);
@@ -242,7 +242,7 @@ pipe_tsd_get(pipe_tsd *tsd)
    if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
       pipe_tsd_init(tsd);
    }
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    return pthread_getspecific(tsd->key);
 #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
    assert(0);
@@ -259,7 +259,7 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
    if (tsd->initMagic != (int) PIPE_TSD_INIT_MAGIC) {
       pipe_tsd_init(tsd);
    }
-#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
+#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
    if (pthread_setspecific(tsd->key, value) != 0) {
       perror("pthread_set_specific() failed");
       exit(-1);
index e6e80b9..489aa8d 100644 (file)
@@ -330,6 +330,13 @@ drm_show_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy,
        if (ret)
                goto err_crtc;
 
+
+       if (scrn->dpms)
+               drmModeConnectorSetProperty(dev->drmFD,
+                                           scrn->connectorID,
+                                           scrn->dpms->prop_id,
+                                           DRM_MODE_DPMS_ON);
+
        surf->screen = scrn;
 
        scrn->surf = surf;
@@ -399,8 +406,6 @@ drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
                        surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
                        /* TODO stuff here */
                }
-
-               st_notify_swapbuffers_complete(surf->stfb);
        }
 
        return EGL_TRUE;
index a22ef38..abdf845 100644 (file)
@@ -66,10 +66,13 @@ drm_get_device_id(struct drm_device *device)
 {
        char path[512];
        FILE *file;
+       char *ret;
 
        /* TODO get the real minor */
        int minor = 0;
 
+       device->deviceID = 0;
+
        snprintf(path, sizeof(path), "/sys/class/drm/card%d/device/device", minor);
        file = fopen(path, "r");
        if (!file) {
@@ -77,7 +80,10 @@ drm_get_device_id(struct drm_device *device)
                return;
        }
 
-       fgets(path, sizeof( path ), file);
+       ret = fgets(path, sizeof( path ), file);
+       if (!ret)
+               return;
+
        sscanf(path, "%x", &device->deviceID);
        fclose(file);
 }
@@ -101,6 +107,25 @@ drm_add_modes_from_connector(_EGLScreen *screen, drmModeConnectorPtr connector)
        }
 }
 
+static void
+drm_find_dpms(struct drm_device *dev, struct drm_screen *screen)
+{
+       drmModeConnectorPtr c = screen->connector;
+       drmModePropertyPtr p;
+       int i;
+
+       for (i = 0; i < c->count_props; i++) {
+               p = drmModeGetProperty(dev->drmFD, c->props[i]);
+               if (!strcmp(p->name, "DPMS"))
+                       break;
+
+               drmModeFreeProperty(p);
+               p = NULL;
+       }
+
+       screen->dpms = p;
+}
+
 EGLBoolean
 drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
 {
@@ -154,6 +179,7 @@ drm_initialize(_EGLDriver *drv, EGLDisplay dpy, EGLint *major, EGLint *minor)
                _eglInitScreen(&screen->base);
                _eglAddScreen(disp, &screen->base);
                drm_add_modes_from_connector(&screen->base, connector);
+               drm_find_dpms(dev, screen);
                dev->screens[num_screens++] = screen;
        }
        dev->count_screens = num_screens;
@@ -200,6 +226,7 @@ drm_terminate(_EGLDriver *drv, EGLDisplay dpy)
                if (screen->shown)
                        drm_takedown_shown_screen(drv, screen);
 
+               drmModeFreeProperty(screen->dpms);
                drmModeFreeConnector(screen->connector);
                _eglDestroyScreen(&screen->base);
                dev->screens[i] = NULL;
index 908bab5..ce2717d 100644 (file)
@@ -114,6 +114,9 @@ struct drm_screen
        drmModeConnectorPtr connector;
        uint32_t connectorID;
 
+       /* dpms property */
+       drmModePropertyPtr dpms;
+
        /* Has this screen been shown */
        int shown;
 
index b61b49a..16d4f1e 100644 (file)
@@ -98,7 +98,8 @@ static int vlResizeFrameBuffer
        );
 
        /* Clear to black, in case video doesn't fill the entire window */
-       pipe->clear(pipe, basic_csc->framebuffer.cbufs[0], 0);
+       pipe->set_framebuffer_state(pipe, &basic_csc->framebuffer);
+       pipe->clear(pipe, PIPE_CLEAR_COLOR, 0, 0.0f, 0);
 
        return 0;
 }
index 8f45fb6..e03d546 100644 (file)
@@ -6,16 +6,27 @@ the python script perspective.
 To build you'll need:
 * Python (with development packages)
 * SCons
-* SWIG
-* Python Imaging Library with TK support (for the samples)
+* SWIG, http://www.swig.org/download.html
+* Python Imaging Library with TK support, http://www.pythonware.com/products/pil/, 
+  for the samples
+
+On a debian-based distro you can simply do:
+
+  aptitude install python-dev scons swig python-imaging python-imaging-tk
+
+On a Windows machine ensure the swig command is in your PATH.
 
 Invoke scons on the top dir as
  
- scons statetrackers=python
+  scons debug=yes statetrackers=python drivers=softpipe,trace winsys=none
+
+To use it set PYTHONPATH appropriately, e.g, in Linux do:
+
+  export PYTHONPATH=$PWD/build/linux-x86-debug/gallium/state_trackers/python
 
-To use do
+or (in Windows)
 
export PYTHONPATH=build/XXXX-XXXX-XXXX/gallium/state_trackers/python
 set PYTHONPATH=%CD%\build\windows-x86-debug\gallium\state_trackers\python
 
 and then try running
 
@@ -27,7 +38,6 @@ which should show a triangle.
 This is still work in progress:
 - errors are not handled properly and almost always result in crash
 - state atoms with array members are awkward to set
-- there no efficient way to view images
 
 --
-Jose Fonseca <jrfonseca@tungstengraphics.com>
+Jose Fonseca <jfonseca@vmware.com>
index 79e68de..3f79cc1 100644 (file)
 %{
 
 #include <stdio.h>
-#include <Python.h>
 
 #include "pipe/p_screen.h"
 #include "pipe/p_context.h"
 #include "pipe/p_inlines.h"
 #include "pipe/p_shader_tokens.h"
-#include "pipe/internal/p_winsys_screen.h"
 #include "cso_cache/cso_context.h"
 #include "util/u_draw_quad.h"
 #include "util/u_tile.h"
@@ -58,7 +56,7 @@
 %}
 
 %include "typemaps.i"
-
+%include "exception.i"
 %include "cstring.i"
 
 %include "carrays.i"
@@ -71,8 +69,8 @@
 %rename(Device) st_device;
 %rename(Context) st_context;
 %rename(Texture) pipe_texture;
-%rename(Surface) pipe_surface;
-%rename(Buffer) st_buffer;
+%rename(Surface) st_surface;
+%rename(Buffer) pipe_buffer;
 
 %rename(BlendColor) pipe_blend_color;
 %rename(Blend) pipe_blend_state;
index 1fdbdf9..a40aa1e 100644 (file)
@@ -116,15 +116,17 @@ struct st_context {
    }
 
    void set_constant_buffer(unsigned shader, unsigned index,
-                            struct st_buffer *buffer ) 
+                            struct pipe_buffer *buffer ) 
    {
       struct pipe_constant_buffer state;
       memset(&state, 0, sizeof(state));
-      state.buffer = buffer ? buffer->buffer : NULL;
+      state.buffer = buffer;
       $self->pipe->set_constant_buffer($self->pipe, shader, index, &state);
    }
 
-   void set_framebuffer(const struct pipe_framebuffer_state *state ) {
+   void set_framebuffer(const struct pipe_framebuffer_state *state ) 
+   {
+      memcpy(&$self->framebuffer, state, sizeof *state);
       cso_set_framebuffer($self->cso, state);
    }
 
@@ -151,19 +153,19 @@ struct st_context {
    }
 
    void set_vertex_buffer(unsigned index,
-                          unsigned pitch
+                          unsigned stride
                           unsigned max_index,
                           unsigned buffer_offset,
-                          struct st_buffer *buffer)
+                          struct pipe_buffer *buffer)
    {
       unsigned i;
       struct pipe_vertex_buffer state;
       
       memset(&state, 0, sizeof(state));
-      state.stride = pitch;
+      state.stride = stride;
       state.max_index = max_index;
       state.buffer_offset = buffer_offset;
-      state.buffer = buffer ? buffer->buffer : NULL;
+      state.buffer = buffer;
 
       memcpy(&$self->vertex_buffers[index], &state, sizeof(state));
       
@@ -198,22 +200,22 @@ struct st_context {
       $self->pipe->draw_arrays($self->pipe, mode, start, count);
    }
 
-   void draw_elements( struct st_buffer *indexBuffer,
+   void draw_elements( struct pipe_buffer *indexBuffer,
                        unsigned indexSize,
                        unsigned mode, unsigned start, unsigned count) 
    {
       $self->pipe->draw_elements($self->pipe, 
-                                 indexBuffer->buffer
+                                 indexBuffer, 
                                  indexSize, 
                                  mode, start, count);
    }
 
-   void draw_range_elements( struct st_buffer *indexBuffer,
+   void draw_range_elements( struct pipe_buffer *indexBuffer,
                              unsigned indexSize, unsigned minIndex, unsigned maxIndex,
                              unsigned mode, unsigned start, unsigned count)
    {
       $self->pipe->draw_range_elements($self->pipe, 
-                                       indexBuffer->buffer
+                                       indexBuffer, 
                                        indexSize, minIndex, maxIndex,
                                        mode, start, count);
    }
@@ -256,32 +258,62 @@ error1:
    flush(unsigned flags = 0) {
       struct pipe_fence_handle *fence = NULL; 
       $self->pipe->flush($self->pipe, flags | PIPE_FLUSH_RENDER_CACHE, &fence);
-      /* TODO: allow asynchronous operation */ 
-      $self->pipe->winsys->fence_finish( $self->pipe->winsys, fence, 0 );
-      $self->pipe->winsys->fence_reference( $self->pipe->winsys, &fence, NULL );
+      if(fence) {
+         /* TODO: allow asynchronous operation */ 
+         $self->pipe->screen->fence_finish( $self->pipe->screen, fence, 0 );
+         $self->pipe->screen->fence_reference( $self->pipe->screen, &fence, NULL );
+      }
    }
 
    /*
     * Surface functions
     */
    
-   void surface_copy(struct pipe_surface *dest,
+   void surface_copy(struct st_surface *dst,
                      unsigned destx, unsigned desty,
-                     struct pipe_surface *src,
+                     struct st_surface *src,
                      unsigned srcx, unsigned srcy,
-                     unsigned width, unsigned height) {
-      $self->pipe->surface_copy($self->pipe, dest, destx, desty, src, srcx, srcy, width, height);
+                     unsigned width, unsigned height) 
+   {
+      struct pipe_surface *_dst = NULL;
+      struct pipe_surface *_src = NULL;
+      
+      _dst = st_pipe_surface(dst, PIPE_BUFFER_USAGE_GPU_WRITE);
+      if(!_dst)
+         SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
+
+      _src = st_pipe_surface(src, PIPE_BUFFER_USAGE_GPU_READ);
+      if(!_src)
+         SWIG_exception(SWIG_ValueError, "couldn't acquire source surface for reading");
+      
+      $self->pipe->surface_copy($self->pipe, _dst, destx, desty, _src, srcx, srcy, width, height);
+      
+   fail:
+      pipe_surface_reference(&_src, NULL);
+      pipe_surface_reference(&_dst, NULL);
    }
 
-   void surface_fill(struct pipe_surface *dst,
+   void surface_fill(struct st_surface *dst,
                      unsigned x, unsigned y,
                      unsigned width, unsigned height,
-                     unsigned value) {
-      $self->pipe->surface_fill($self->pipe, dst, x, y, width, height, value);
+                     unsigned value) 
+   {
+      struct pipe_surface *_dst = NULL;
+      
+      _dst = st_pipe_surface(dst, PIPE_BUFFER_USAGE_GPU_WRITE);
+      if(!_dst)
+         SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing");
+
+      $self->pipe->surface_fill($self->pipe, _dst, x, y, width, height, value);
+      
+   fail:
+      pipe_surface_reference(&_dst, NULL);
    }
 
-   void surface_clear(struct pipe_surface *surface, unsigned value = 0) {
-      $self->pipe->clear($self->pipe, surface, value);
+   void clear(unsigned buffers, const float *rgba, double depth = 0.0f,
+              unsigned stencil = 0)
+   {
+      $self->pipe->clear($self->pipe, buffers, rgba, depth, stencil);
    }
 
 };
index 84fd2e4..f16fe5b 100644 (file)
@@ -122,9 +122,9 @@ struct st_device {
       return $self->screen->texture_create($self->screen, &templat);
    }
    
-   struct st_buffer *
+   struct pipe_buffer *
    buffer_create(unsigned size, unsigned alignment = 0, unsigned usage = 0) {
-      return st_buffer_create($self, alignment, usage, size);
+      return pipe_buffer_create($self->screen, alignment, usage, size);
    }
 
 };
index 110b3d5..90f157e 100644 (file)
    }
    
    void
-   set_cbuf(unsigned index, struct pipe_surface *surface) {
-      pipe_surface_reference(&$self->cbufs[index], surface);
+   set_cbuf(unsigned index, struct st_surface *surface) 
+   {
+      struct pipe_surface *_surface = NULL;
+
+      if(index >= PIPE_MAX_COLOR_BUFS)
+         SWIG_exception(SWIG_ValueError, "index out of bounds");
+      
+      if(surface) {
+         _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE);
+         if(!_surface)
+            SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
+      }
+
+      pipe_surface_reference(&$self->cbufs[index], _surface);
+      
+   fail:
+      return;
    }
    
    void
-   set_zsbuf(struct pipe_surface *surface) {
-      pipe_surface_reference(&$self->zsbuf, surface);
+   set_zsbuf(struct st_surface *surface) 
+   {
+      struct pipe_surface *_surface = NULL;
+
+      if(surface) {
+         _surface = st_pipe_surface(surface, PIPE_BUFFER_USAGE_GPU_WRITE);
+         if(!_surface)
+            SWIG_exception(SWIG_ValueError, "couldn't acquire surface for writing");
+      }
+
+      pipe_surface_reference(&$self->zsbuf, _surface);
+
+   fail:
+      return;
    }
    
 };
index 1e64fc8..f41a95e 100644 (file)
 
 
 %nodefaultctor pipe_texture;
-%nodefaultctor pipe_surface;
-%nodefaultctor st_buffer;
+%nodefaultctor st_surface;
+%nodefaultctor pipe_buffer;
 
 %nodefaultdtor pipe_texture;
-%nodefaultdtor pipe_surface;
-%nodefaultdtor st_buffer;
+%nodefaultdtor st_surface;
+%nodefaultdtor pipe_buffer;
 
 %ignore pipe_texture::screen;
 
-%ignore pipe_surface::winsys;
-%immutable pipe_surface::texture;
-%immutable pipe_surface::buffer;
+%immutable st_surface::texture;
+%immutable st_surface::face;
+%immutable st_surface::level;
+%immutable st_surface::zslice;
 
 %newobject pipe_texture::get_surface;
 
    }
    
    /** Get a surface which is a "view" into a texture */
-   struct pipe_surface *
-   get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0, unsigned usage=0 )
+   struct st_surface *
+   get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0)
    {
-      struct pipe_screen *screen = $self->screen;
-      return screen->get_tex_surface(screen, $self, face, level, zslice, usage);
+      struct st_surface *surface;
+      
+      if(face >= ($self->target == PIPE_TEXTURE_CUBE ? 6U : 1U))
+         SWIG_exception(SWIG_ValueError, "face out of bounds");
+      if(level > $self->last_level)
+         SWIG_exception(SWIG_ValueError, "level out of bounds");
+      if(zslice >= $self->depth[level])
+         SWIG_exception(SWIG_ValueError, "zslice out of bounds");
+      
+      surface = CALLOC_STRUCT(st_surface);
+      if(!surface)
+         return NULL;
+      
+      pipe_texture_reference(&surface->texture, $self);
+      surface->face = face;
+      surface->level = level;
+      surface->zslice = zslice;
+      
+      return surface;
+
+   fail:
+      return NULL;
    }
    
 };
 
+struct st_surface
+{
+   %immutable;
+   
+   struct pipe_texture *texture;
+   unsigned face;
+   unsigned level;
+   unsigned zslice;
+   
+};
 
-%extend pipe_surface {
+%extend st_surface {
+   
+   %immutable;
    
-   ~pipe_surface() {
-      struct pipe_surface *ptr = $self;
-      pipe_surface_reference(&ptr, NULL);
+   unsigned format;
+   unsigned width;
+   unsigned height;
+   unsigned nblocksx;
+   unsigned nblocksy;
+   
+   ~st_surface() {
+      pipe_texture_reference(&$self->texture, NULL);
+      FREE($self);
    }
    
-   // gets mapped to pipe_surface_map automatically
-   void * map( unsigned flags );
+   %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
+   void get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH)
+   {
+      struct pipe_texture *texture = $self->texture;
+      struct pipe_screen *screen = texture->screen;
+      struct pipe_transfer *transfer;
+      unsigned stride;
 
-   // gets mapped to pipe_surface_unmap automatically
-   void unmap( void );
+      stride = pf_get_nblocksx(&texture->block, w) * texture->block.size;
+      *LENGTH = pf_get_nblocksy(&texture->block, h) * stride;
+      *STRING = (char *) malloc(*LENGTH);
+      if(!*STRING)
+         return;
 
-   void
-   get_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, char *raw, unsigned stride) {
-      pipe_get_tile_raw($self, x, y, w, h, raw, stride);
+      transfer = screen->get_tex_transfer(screen,
+                                          $self->texture,
+                                          $self->face,
+                                          $self->level,
+                                          $self->zslice,
+                                          PIPE_TRANSFER_READ,
+                                          x, y, w, h);
+      if(transfer) {
+         pipe_get_tile_raw(transfer, 0, 0, w, h, *STRING, stride);
+         screen->tex_transfer_destroy(transfer);
+      }
    }
 
-   void
-   put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *raw, unsigned stride) {
-      pipe_put_tile_raw($self, x, y, w, h, raw, stride);
+   %cstring_input_binary(const char *STRING, unsigned LENGTH);
+   void put_tile_raw(unsigned x, unsigned y, unsigned w, unsigned h, const char *STRING, unsigned LENGTH, unsigned stride = 0)
+   {
+      struct pipe_texture *texture = $self->texture;
+      struct pipe_screen *screen = texture->screen;
+      struct pipe_transfer *transfer;
+     
+      if(stride == 0)
+         stride = pf_get_nblocksx(&texture->block, w) * texture->block.size;
+      
+      if(LENGTH < pf_get_nblocksy(&texture->block, h) * stride)
+         SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
+         
+      transfer = screen->get_tex_transfer(screen,
+                                          $self->texture,
+                                          $self->face,
+                                          $self->level,
+                                          $self->zslice,
+                                          PIPE_TRANSFER_WRITE,
+                                          x, y, w, h);
+      if(!transfer)
+         SWIG_exception(SWIG_MemoryError, "couldn't initiate transfer");
+         
+      pipe_put_tile_raw(transfer, 0, 0, w, h, STRING, stride);
+      screen->tex_transfer_destroy(transfer);
+
+   fail:
+      return;
    }
 
    void
-   get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba) {
-      pipe_get_tile_rgba($self, x, y, w, h, rgba);
+   get_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, float *rgba) 
+   {
+      struct pipe_screen *screen = $self->texture->screen;
+      struct pipe_transfer *transfer;
+      transfer = screen->get_tex_transfer(screen,
+                                          $self->texture,
+                                          $self->face,
+                                          $self->level,
+                                          $self->zslice,
+                                          PIPE_TRANSFER_READ,
+                                          x, y, w, h);
+      if(transfer) {
+         pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba);
+         screen->tex_transfer_destroy(transfer);
+      }
    }
 
    void
-   put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba) {
-      pipe_put_tile_rgba($self, x, y, w, h, rgba);
+   put_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba)
+   {
+      struct pipe_screen *screen = $self->texture->screen;
+      struct pipe_transfer *transfer;
+      transfer = screen->get_tex_transfer(screen,
+                                          $self->texture,
+                                          $self->face,
+                                          $self->level,
+                                          $self->zslice,
+                                          PIPE_TRANSFER_WRITE,
+                                          x, y, w, h);
+      if(transfer) {
+         pipe_put_tile_rgba(transfer, 0, 0, w, h, rgba);
+         screen->tex_transfer_destroy(transfer);
+      }
    }
 
    %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
    void
    get_tile_rgba8(unsigned x, unsigned y, unsigned w, unsigned h, char **STRING, int *LENGTH) 
    {
-      unsigned surface_usage;
+      struct pipe_screen *screen = $self->texture->screen;
+      struct pipe_transfer *transfer;
       float *rgba;
       unsigned char *rgba8;
       unsigned i, j, k;
       if(!*STRING)
          return;
       
-      rgba = malloc(w*4*sizeof(float));
+      rgba = malloc(h*w*4*sizeof(float));
       if(!rgba)
          return;
       
       rgba8 = (unsigned char *) *STRING;
 
-      /* XXX: force mappable surface */
-      surface_usage = $self->usage;
-      $self->usage |= PIPE_BUFFER_USAGE_CPU_READ;
-
-      for(j = 0; j < h; ++j) {
-         pipe_get_tile_rgba($self,
-                            x, y + j, w, 1,
-                            rgba);
-         for(i = 0; i < w; ++i)
-            for(k = 0; k <4; ++k)
-               rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[i*4 + k]);
+      transfer = screen->get_tex_transfer(screen,
+                                          $self->texture,
+                                          $self->face,
+                                          $self->level,
+                                          $self->zslice,
+                                          PIPE_TRANSFER_READ,
+                                          x, y,
+                                          w, h);
+      if(transfer) {
+         pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba);
+         for(j = 0; j < h; ++j) {
+            for(i = 0; i < w; ++i)
+               for(k = 0; k <4; ++k)
+                  rgba8[j*w*4 + i*4 + k] = float_to_ubyte(rgba[j*w*4 + i*4 + k]);
+         }
+         screen->tex_transfer_destroy(transfer);
       }
       
-      $self->usage = surface_usage;
-      
       free(rgba);
    }
 
    void
-   get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z) {
-      pipe_get_tile_z($self, x, y, w, h, z);
+   get_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, unsigned *z)
+   {
+      struct pipe_screen *screen = $self->texture->screen;
+      struct pipe_transfer *transfer;
+      transfer = screen->get_tex_transfer(screen,
+                                          $self->texture,
+                                          $self->face,
+                                          $self->level,
+                                          $self->zslice,
+                                          PIPE_TRANSFER_READ,
+                                          x, y, w, h);
+      if(transfer) {
+         pipe_get_tile_z(transfer, 0, 0, w, h, z);
+         screen->tex_transfer_destroy(transfer);
+      }
    }
 
    void
-   put_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z) {
-      pipe_put_tile_z($self, x, y, w, h, z);
+   put_tile_z(unsigned x, unsigned y, unsigned w, unsigned h, const unsigned *z)
+   {
+      struct pipe_screen *screen = $self->texture->screen;
+      struct pipe_transfer *transfer;
+      transfer = screen->get_tex_transfer(screen,
+                                          $self->texture,
+                                          $self->face,
+                                          $self->level,
+                                          $self->zslice,
+                                          PIPE_TRANSFER_WRITE,
+                                          x, y, w, h);
+      if(transfer) {
+         pipe_put_tile_z(transfer, 0, 0, w, h, z);
+         screen->tex_transfer_destroy(transfer);
+      }
    }
    
    void
    unsigned
    compare_tile_rgba(unsigned x, unsigned y, unsigned w, unsigned h, const float *rgba, float tol = 0.0) 
    {
+      struct pipe_screen *screen = $self->texture->screen;
+      struct pipe_transfer *transfer;
       float *rgba2;
       const float *p1;
       const float *p2;
       if(!rgba2)
          return ~0;
 
-      pipe_get_tile_rgba($self, x, y, w, h, rgba2);
+      transfer = screen->get_tex_transfer(screen,
+                                          $self->texture,
+                                          $self->face,
+                                          $self->level,
+                                          $self->zslice,
+                                          PIPE_TRANSFER_READ,
+                                          x, y, w, h);
+      if(!transfer) {
+         FREE(rgba2);
+         return ~0;
+      }
+
+      pipe_get_tile_rgba(transfer, 0, 0, w, h, rgba2);
+      screen->tex_transfer_destroy(transfer);
 
       p1 = rgba;
       p2 = rgba2;
 
 };
 
-struct st_buffer {
-};
+%{
+   static enum pipe_format
+   st_surface_format_get(struct st_surface *surface)
+   {
+      return surface->texture->format;
+   }
+   
+   static unsigned
+   st_surface_width_get(struct st_surface *surface)
+   {
+      return surface->texture->width[surface->level];
+   }
+   
+   static unsigned
+   st_surface_height_get(struct st_surface *surface)
+   {
+      return surface->texture->height[surface->level];
+   }
+
+   static unsigned
+   st_surface_nblocksx_get(struct st_surface *surface)
+   {
+      return surface->texture->nblocksx[surface->level];
+   }
+   
+   static unsigned
+   st_surface_nblocksy_get(struct st_surface *surface)
+   {
+      return surface->texture->nblocksy[surface->level];
+   }
+%}
+
+/* Avoid naming conflict with p_inlines.h's pipe_buffer_read/write */ 
+%rename(read) read_; 
+%rename(write) write_; 
 
-%extend st_buffer {
+%extend pipe_buffer {
    
-   ~st_buffer() {
-      st_buffer_destroy($self);
+   ~pipe_buffer() {
+      struct pipe_buffer *ptr = $self;
+      pipe_buffer_reference(&ptr, NULL);
    }
    
    unsigned __len__(void) 
    {
-      assert(p_atomic_read(&$self->buffer->reference.count) > 0);
-      return $self->buffer->size;
+      assert(p_atomic_read(&$self->reference.count) > 0);
+      return $self->size;
    }
    
    %cstring_output_allocate_size(char **STRING, int *LENGTH, free(*$1));
-   void read(char **STRING, int *LENGTH)
+   void read_(char **STRING, int *LENGTH)
    {
-      struct pipe_screen *screen = $self->st_dev->screen;
-      const char *map;
+      struct pipe_screen *screen = $self->screen;
       
-      assert(p_atomic_read(&$self->buffer->reference.count) > 0);
+      assert(p_atomic_read(&$self->reference.count) > 0);
       
-      *LENGTH = $self->buffer->size;
-      *STRING = (char *) malloc($self->buffer->size);
+      *LENGTH = $self->size;
+      *STRING = (char *) malloc($self->size);
       if(!*STRING)
          return;
       
-      map = pipe_buffer_map(screen, $self->buffer, PIPE_BUFFER_USAGE_CPU_READ);
-      if(map) {
-         memcpy(*STRING, map, $self->buffer->size);
-         pipe_buffer_unmap(screen, $self->buffer);
-      }
+      pipe_buffer_read(screen, $self, 0, $self->size, STRING);
    }
    
    %cstring_input_binary(const char *STRING, unsigned LENGTH);
-   void write(const char *STRING, unsigned LENGTH, unsigned offset = 0) 
+   void write_(const char *STRING, unsigned LENGTH, unsigned offset = 0) 
    {
-      struct pipe_screen *screen = $self->st_dev->screen;
-      char *map;
+      struct pipe_screen *screen = $self->screen;
       
-      assert(p_atomic_read(&$self->buffer->reference.count) > 0);
+      assert(p_atomic_read(&$self->reference.count) > 0);
       
-      if(offset > $self->buffer->size) {
-         PyErr_SetString(PyExc_ValueError, "offset must be smaller than buffer size");
-         return;
-      }
+      if(offset > $self->size)
+         SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size");
 
-      if(offset + LENGTH > $self->buffer->size) {
-         PyErr_SetString(PyExc_ValueError, "data length must fit inside the buffer");
-         return;
-      }
+      if(offset + LENGTH > $self->size)
+         SWIG_exception(SWIG_ValueError, "data length must fit inside the buffer");
 
-      map = pipe_buffer_map(screen, $self->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
-      if(map) {
-         memcpy(map + offset, STRING, LENGTH);
-         pipe_buffer_unmap(screen, $self->buffer);
-      }
+      pipe_buffer_write(screen, $self, offset, LENGTH, STRING);
+
+fail:
+      return;
    }
 };
index 0bf6baf..a4285bf 100755 (executable)
@@ -27,6 +27,9 @@
 ##########################################################################
 
 
+import sys
+
+
 class Formatter:
     '''Plain formatter'''
 
@@ -91,10 +94,80 @@ class AnsiFormatter(Formatter):
         self._escape(self._normal)
 
 
+class WindowsConsoleFormatter(Formatter):
+    '''Formatter for the Windows Console. See 
+    http://code.activestate.com/recipes/496901/ for more information.
+    '''
+
+    STD_INPUT_HANDLE  = -10
+    STD_OUTPUT_HANDLE = -11
+    STD_ERROR_HANDLE  = -12
+
+    FOREGROUND_BLUE      = 0x01
+    FOREGROUND_GREEN     = 0x02
+    FOREGROUND_RED       = 0x04
+    FOREGROUND_INTENSITY = 0x08
+    BACKGROUND_BLUE      = 0x10
+    BACKGROUND_GREEN     = 0x20
+    BACKGROUND_RED       = 0x40
+    BACKGROUND_INTENSITY = 0x80
+
+    _normal = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED
+    _bold = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY
+    _italic = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED
+    _red = FOREGROUND_RED | FOREGROUND_INTENSITY
+    _green = FOREGROUND_GREEN | FOREGROUND_INTENSITY
+    _blue = FOREGROUND_BLUE | FOREGROUND_INTENSITY
+
+    def __init__(self, stream):
+        Formatter.__init__(self, stream)
+
+        if stream is sys.stdin:
+            nStdHandle = self.STD_INPUT_HANDLE
+        elif stream is sys.stdout:
+            nStdHandle = self.STD_OUTPUT_HANDLE
+        elif stream is sys.stderr:
+            nStdHandle = self.STD_ERROR_HANDLE
+        else:
+            nStdHandle = None
+
+        if nStdHandle:
+            import ctypes
+            self.handle = ctypes.windll.kernel32.GetStdHandle(nStdHandle)
+        else:
+            self.handle = None
+
+    def _attribute(self, attr):
+        if self.handle:
+            import ctypes
+            ctypes.windll.kernel32.SetConsoleTextAttribute(self.handle, attr)
+
+    def function(self, name):
+        self._attribute(self._bold)
+        Formatter.function(self, name)
+        self._attribute(self._normal)
+
+    def variable(self, name):
+        self._attribute(self._italic)
+        Formatter.variable(self, name)
+        self._attribute(self._normal)
+
+    def literal(self, value):
+        self._attribute(self._blue)
+        Formatter.literal(self, value)
+        self._attribute(self._normal)
+
+    def address(self, value):
+        self._attribute(self._green)
+        Formatter.address(self, value)
+        self._attribute(self._normal)
+
 
 def DefaultFormatter(stream):
-    if stream.isatty():
+    if sys.platform in ('linux2', 'cygwin'):
         return AnsiFormatter(stream)
+    elif sys.platform in ('win32',):
+        return WindowsConsoleFormatter(stream)
     else:
         return Formatter(stream)
 
index e6999a2..5ea0772 100755 (executable)
@@ -54,14 +54,14 @@ def save_image(filename, surface):
     outimage = make_image(surface)
     outimage.save(filename, "PNG")
 
-def show_image(surface):
+def show_image(surface, title):
     outimage = make_image(surface)
     
     import Tkinter as tk
     from PIL import Image, ImageTk
     root = tk.Tk()
     
-    root.title('background image')
+    root.title(title)
     
     image1 = ImageTk.PhotoImage(outimage)
     w = image1.width()
@@ -75,9 +75,6 @@ def show_image(surface):
     root.mainloop()
 
 
-verbose = 1
-
-
 class Struct:
     """C-like struct"""
 
@@ -184,8 +181,12 @@ class Global(Object):
     def pipe_winsys_create(self):
         return Winsys(self.interpreter, gallium.Device())
 
-    def pipe_screen_create(self, winsys):
-        return Screen(self.interpreter, winsys.real)
+    def pipe_screen_create(self, winsys=None):
+        if winsys is None:
+            real = gallium.Device()
+        else:
+            real = winsys.real
+        return Screen(self.interpreter, real)
     
     def pipe_context_create(self, screen):
         context = screen.real.context_create()
@@ -237,6 +238,16 @@ class Winsys(Object):
         pass
 
 
+class Transfer:
+
+    def __init__(self, surface, x, y, w, h):
+        self.surface = surface
+        self.x = x
+        self.y = y
+        self.w = w
+        self.h = h
+
+
 class Screen(Object):
     
     def destroy(self):
@@ -257,15 +268,15 @@ class Screen(Object):
     def is_format_supported(self, format, target, tex_usage, geom_flags):
         return self.real.is_format_supported(format, target, tex_usage, geom_flags)
     
-    def texture_create(self, template):
+    def texture_create(self, templat):
         return self.real.texture_create(
-            format = template.format,
-            width = template.width[0],
-            height = template.height[0],
-            depth = template.depth[0],
-            last_level = template.last_level,
-            target = template.target,
-            tex_usage = template.tex_usage,
+            format = templat.format,
+            width = templat.width[0],
+            height = templat.height[0],
+            depth = templat.depth[0],
+            last_level = templat.last_level,
+            target = templat.target,
+            tex_usage = templat.tex_usage,
         )
 
     def texture_destroy(self, texture):
@@ -275,7 +286,9 @@ class Screen(Object):
         pass
 
     def get_tex_surface(self, texture, face, level, zslice, usage):
-        return texture.get_surface(face, level, zslice, usage)
+        if texture is None:
+            return None
+        return texture.get_surface(face, level, zslice)
     
     def tex_surface_destroy(self, surface):
         self.interpreter.unregister_object(surface)
@@ -284,9 +297,53 @@ class Screen(Object):
         pass
 
     def surface_write(self, surface, data, stride, size):
+        if surface is None:
+            return
         assert surface.nblocksy * stride == size 
         surface.put_tile_raw(0, 0, surface.width, surface.height, data, stride)
 
+    def get_tex_transfer(self, texture, face, level, zslice, usage, x, y, w, h):
+        if texture is None:
+            return None
+        return Transfer(texture.get_surface(face, level, zslice), x, y, w, h)
+    
+    def tex_transfer_destroy(self, transfer):
+        self.interpreter.unregister_object(transfer)
+
+    def transfer_write(self, transfer, stride, data, size):
+        if transfer is None:
+            return
+        transfer.surface.put_tile_raw(transfer.x, transfer.y, transfer.w, transfer.h, data, stride)
+
+    def user_buffer_create(self, data, size):
+        # We don't really care to distinguish between user and regular buffers
+        buffer = self.real.buffer_create(size, 
+                                         4, 
+                                         gallium.PIPE_BUFFER_USAGE_CPU_READ |
+                                         gallium.PIPE_BUFFER_USAGE_CPU_WRITE )
+        assert size == len(data)
+        buffer.write(data)
+        return buffer
+    
+    def buffer_create(self, alignment, usage, size):
+        return self.real.buffer_create(size, alignment, usage)
+    
+    def buffer_destroy(self, buffer):
+        pass
+    
+    def buffer_write(self, buffer, data, size, offset=0):
+        assert size == len(data)
+        buffer.write(data)
+        
+    def fence_finish(self, fence, flags):
+        pass
+    
+    def fence_reference(self, dst, src):
+        pass
+    
+    def flush_frontbuffer(self, surface):
+        pass
+
 
 class Context(Object):
     
@@ -317,8 +374,8 @@ class Context(Object):
     def delete_sampler_state(self, state):
         pass
 
-    def bind_sampler_states(self, n, states):
-        for i in range(n):
+    def bind_sampler_states(self, num_states, states):
+        for i in range(num_states):
             self.real.set_sampler(i, states[i])
         
     def create_rasterizer_state(self, state):
@@ -375,7 +432,7 @@ class Context(Object):
         self.real.set_clip(_state)
 
     def dump_constant_buffer(self, buffer):
-        if verbose < 2:
+        if not self.interpreter.verbosity(2):
             return
 
         data = buffer.read()
@@ -386,17 +443,17 @@ class Context(Object):
             sys.stdout.write('\tCONST[%2u] = {%10.4f, %10.4f, %10.4f, %10.4f}\n' % (index, x, y, z, w))
             index += 1
 
-    def set_constant_buffer(self, shader, index, state):
-        if state is not None:
-            self.real.set_constant_buffer(shader, index, state.buffer)
+    def set_constant_buffer(self, shader, index, buffer):
+        if buffer is not None:
+            self.real.set_constant_buffer(shader, index, buffer.buffer)
 
-            self.dump_constant_buffer(state.buffer)
+            self.dump_constant_buffer(buffer.buffer)
 
     def set_framebuffer_state(self, state):
         _state = gallium.Framebuffer()
         _state.width = state.width
         _state.height = state.height
-        _state.num_cbufs = state.num_cbufs
+        _state.nr_cbufs = state.nr_cbufs
         for i in range(len(state.cbufs)):
             _state.set_cbuf(i, state.cbufs[i])
         _state.set_zsbuf(state.zsbuf)    
@@ -414,34 +471,34 @@ class Context(Object):
     def set_viewport_state(self, state):
         self.real.set_viewport(state)
 
-    def set_sampler_textures(self, n, textures):
-        for i in range(n):
+    def set_sampler_textures(self, num_textures, textures):
+        for i in range(num_textures):
             self.real.set_sampler_texture(i, textures[i])
 
-    def set_vertex_buffers(self, n, vbufs):
-        self.vbufs = vbufs[0:n]
-        for i in range(n):
-            vbuf = vbufs[i]
+    def set_vertex_buffers(self, num_buffers, buffers):
+        self.vbufs = buffers[0:num_buffers]
+        for i in range(num_buffers):
+            vbuf = buffers[i]
             self.real.set_vertex_buffer(
                 i,
-                pitch = vbuf.pitch,
+                stride = vbuf.stride,
                 max_index = vbuf.max_index,
                 buffer_offset = vbuf.buffer_offset,
                 buffer = vbuf.buffer,
             )
 
-    def set_vertex_elements(self, n, elements):
-        self.velems = elements[0:n]
-        for i in range(n):
+    def set_vertex_elements(self, num_elements, elements):
+        self.velems = elements[0:num_elements]
+        for i in range(num_elements):
             self.real.set_vertex_element(i, elements[i])
-        self.real.set_vertex_elements(n)
+        self.real.set_vertex_elements(num_elements)
 
     def set_edgeflags(self, bitfield):
         # FIXME
         pass
     
     def dump_vertices(self, start, count):
-        if verbose < 2:
+        if not self.interpreter.verbosity(2):
             return
 
         for index in range(start, start + count):
@@ -452,7 +509,7 @@ class Context(Object):
             for velem in self.velems:
                 vbuf = self.vbufs[velem.vertex_buffer_index]
 
-                offset = vbuf.buffer_offset + velem.src_offset + vbuf.pitch*index
+                offset = vbuf.buffer_offset + velem.src_offset + vbuf.stride*index
                 format = {
                     gallium.PIPE_FORMAT_R32_FLOAT: 'f',
                     gallium.PIPE_FORMAT_R32G32_FLOAT: '2f',
@@ -468,7 +525,7 @@ class Context(Object):
             sys.stdout.write('\t},\n')
 
     def dump_indices(self, ibuf, isize, start, count):
-        if verbose < 2:
+        if not self.interpreter.verbosity(2):
             return
 
         format = {
@@ -500,45 +557,51 @@ class Context(Object):
         self.dump_vertices(start, count)
             
         self.real.draw_arrays(mode, start, count)
-
-        self.dirty = True
+        self._set_dirty()
     
     def draw_elements(self, indexBuffer, indexSize, mode, start, count):
-        if verbose >= 2:
+        if self.interpreter.verbosity(2):
             minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count)
             self.dump_vertices(minindex, maxindex - minindex)
 
         self.real.draw_elements(indexBuffer, indexSize, mode, start, count)
-
-        self.dirty = True
+        self._set_dirty()
         
     def draw_range_elements(self, indexBuffer, indexSize, minIndex, maxIndex, mode, start, count):
-        if verbose >= 2:
+        if self.interpreter.verbosity(2):
             minindex, maxindex = self.dump_indices(indexBuffer, indexSize, start, count)
             minindex = min(minindex, minIndex)
             maxindex = min(maxindex, maxIndex)
             self.dump_vertices(minindex, maxindex - minindex)
 
         self.real.draw_range_elements(indexBuffer, indexSize, minIndex, maxIndex, mode, start, count)
-
-        self.dirty = True
+        self._set_dirty()
         
+    def _set_dirty(self):
+        if self.interpreter.options.step:
+            self._present()
+        else:
+            self.dirty = True
+
     def flush(self, flags):
         self.real.flush(flags)
         if self.dirty:
             if flags & gallium.PIPE_FLUSH_FRAME:
-                self._update()
+                self._present()
             self.dirty = False
         return None
 
-    def clear(self, surface, value):
-        self.real.surface_clear(surface, value)
+    def clear(self, buffers, rgba, depth, stencil):
+        _rgba = gallium.FloatArray(4)
+        for i in range(4):
+            _rgba[i] = rgba[i]
+        self.real.clear(buffers, _rgba, depth, stencil)
         
-    def _update(self):
+    def _present(self):
         self.real.flush()
     
         if self.cbufs and self.cbufs[0]:
-            show_image(self.cbufs[0])
+            self.interpreter.present(self.cbufs[0], "cbuf")
     
 
 class Interpreter(parser.TraceDumper):
@@ -549,11 +612,13 @@ class Interpreter(parser.TraceDumper):
             ('pipe_screen', 'get_paramf'),
     ))
 
-    def __init__(self, stream):
+    def __init__(self, stream, options):
         parser.TraceDumper.__init__(self, stream)
+        self.options = options
         self.objects = {}
         self.result = None
         self.globl = Global(self, None)
+        self.call_no = None
 
     def register_object(self, address, object):
         self.objects[address] = object
@@ -570,31 +635,70 @@ class Interpreter(parser.TraceDumper):
             self.interpret_call(call)
 
     def handle_call(self, call):
+        if self.options.stop and call.no >= self.options.stop:
+            sys.exit(0)
 
         if (call.klass, call.method) in self.ignore_calls:
             return
 
-        if verbose >= 1:
+        self.call_no = call.no
+
+        if self.verbosity(1):
             parser.TraceDumper.handle_call(self, call)
         
-        args = [self.interpret_arg(arg) for name, arg in call.args] 
+        args = [(str(name), self.interpret_arg(arg)) for name, arg in call.args] 
         
         if call.klass:
-            obj = args[0]
+            name, obj = args[0]
             args = args[1:]
         else:
             obj = self.globl
             
         method = getattr(obj, call.method)
-        ret = method(*args)
+        ret = method(**dict(args))
         
         if call.ret and isinstance(call.ret, model.Pointer):
+            if ret is None:
+                sys.stderr.write('warning: NULL returned\n')
             self.register_object(call.ret.address, ret)
 
+        self.call_no = None
+
     def interpret_arg(self, node):
         translator = Translator(self)
         return translator.visit(node)
+
+    def verbosity(self, level):
+        return self.options.verbosity >= level
+
+    def present(self, surface, description):
+        if self.call_no < self.options.start:
+            return
+
+        if self.options.images:
+            filename = '%s_%04u.png' % (description, self.call_no)
+            save_image(filename, surface)
+        else:
+            title = '%u. %s' % (self.call_no, description)
+            show_image(surface, title)
     
 
+class Main(parser.Main):
+
+    def get_optparser(self):
+        optparser = parser.Main.get_optparser(self)
+        optparser.add_option("-q", "--quiet", action="store_const", const=0, dest="verbosity", help="no messages")
+        optparser.add_option("-v", "--verbose", action="count", dest="verbosity", default=1, help="increase verbosity level")
+        optparser.add_option("-i", "--images", action="store_true", dest="images", default=False, help="save images instead of showing them")
+        optparser.add_option("-s", "--step", action="store_true", dest="step", default=False, help="step trhough every draw")
+        optparser.add_option("-f", "--from", action="store", type="int", dest="start", default=0, help="from call no")
+        optparser.add_option("-t", "--to", action="store", type="int", dest="stop", default=0, help="until call no")
+        return optparser
+
+    def process_arg(self, stream, options):
+        parser = Interpreter(stream, options)
+        parser.parse()
+
+
 if __name__ == '__main__':
-    parser.main(Interpreter)
+    Main().main()
index ae0f432..d4a079f 100755 (executable)
@@ -101,7 +101,8 @@ class Pointer(Node):
 
 class Call:
     
-    def __init__(self, klass, method, args, ret):
+    def __init__(self, no, klass, method, args, ret):
+        self.no = no
         self.klass = klass
         self.method = method
         self.args = args
@@ -187,6 +188,7 @@ class PrettyPrinter:
         self.formatter.address(node.address)
     
     def visit_call(self, node):
+        self.formatter.text('%s ' % node.no)
         if node.klass is not None:
             self.formatter.function(node.klass + '::' + node.method)
         else:
index 5205f2d..b0f3e8a 100755 (executable)
@@ -30,6 +30,7 @@
 import sys
 import xml.parsers.expat
 import binascii
+import optparse
 
 from model import *
 
@@ -189,6 +190,10 @@ class XmlParser:
 
 class TraceParser(XmlParser):
 
+    def __init__(self, fp):
+        XmlParser.__init__(self, fp)
+        self.last_call_no = 0
+    
     def parse(self):
         self.element_start('trace')
         while self.token.type not in (ELEMENT_END, EOF):
@@ -199,6 +204,13 @@ class TraceParser(XmlParser):
 
     def parse_call(self):
         attrs = self.element_start('call')
+        try:
+            no = int(attrs['no'])
+        except KeyError:
+            self.last_call_no += 1
+            no = self.last_call_no
+        else:
+            self.last_call_no = no
         klass = attrs['class']
         method = attrs['method']
         args = []
@@ -216,7 +228,7 @@ class TraceParser(XmlParser):
                 raise TokenMismatch("<arg ...> or <ret ...>", self.token)
         self.element_end('call')
         
-        return Call(klass, method, args, ret)
+        return Call(no, klass, method, args, ret)
 
     def parse_arg(self):
         attrs = self.element_start('arg')
@@ -342,16 +354,39 @@ class TraceDumper(TraceParser):
         self.formatter.newline()
         
 
-def main(ParserFactory):
-    for arg in sys.argv[1:]:
-        if arg.endswith('.gz'):
-            import gzip
-            stream = gzip.GzipFile(arg, 'rt')
+class Main:
+    '''Common main class for all retrace command line utilities.''' 
+
+    def __init__(self):
+        pass
+
+    def main(self):
+        optparser = self.get_optparser()
+        (options, args) = optparser.parse_args(sys.argv[1:])
+    
+        if args:
+            for arg in args:
+                if arg.endswith('.gz'):
+                    from gzip import GzipFile
+                    stream = GzipFile(arg, 'rt')
+                elif arg.endswith('.bz2'):
+                    from bz2 import BZ2File
+                    stream = BZ2File(arg, 'rt')
+                else:
+                    stream = open(arg, 'rt')
+                self.process_arg(stream, options)
         else:
-            stream = open(arg, 'rt')
-        parser = ParserFactory(stream)
+            self.process_arg(stream, options)
+
+    def get_optparser(self):
+        optparser = optparse.OptionParser(
+            usage="\n\t%prog [options] [traces] ...")
+        return optparser
+
+    def process_arg(self, stream, options):
+        parser = TraceDumper(stream)
         parser.parse()
 
 
 if __name__ == '__main__':
-    main(TraceDumper)
+    Main().main()
index d3ccb6c..4b96598 100644 (file)
@@ -67,6 +67,8 @@ def test(dev):
 
     width = 255
     height = 255
+    minz = 0.0
+    maxz = 1.0
 
     # disabled blending/masking
     blend = Blend()
@@ -77,31 +79,32 @@ def test(dev):
     blend.colormask = PIPE_MASK_RGBA
     ctx.set_blend(blend)
 
-    # no-op depth/stencil/alpha
+    # depth/stencil/alpha
     depth_stencil_alpha = DepthStencilAlpha()
+    depth_stencil_alpha.depth.enabled = 1
+    depth_stencil_alpha.depth.writemask = 1
+    depth_stencil_alpha.depth.func = PIPE_FUNC_LESS
     ctx.set_depth_stencil_alpha(depth_stencil_alpha)
 
     # rasterizer
     rasterizer = Rasterizer()
     rasterizer.front_winding = PIPE_WINDING_CW
     rasterizer.cull_mode = PIPE_WINDING_NONE
-    rasterizer.bypass_clipping = 1
     rasterizer.scissor = 1
-    #rasterizer.bypass_vs = 1
     ctx.set_rasterizer(rasterizer)
 
-    # viewport (identity, we setup vertices in wincoords)
+    # viewport
     viewport = Viewport()
     scale = FloatArray(4)
-    scale[0] = 1.0
-    scale[1] = 1.0
-    scale[2] = 1.0
+    scale[0] = width / 2.0
+    scale[1] = -height / 2.0
+    scale[2] = (maxz - minz) / 2.0
     scale[3] = 1.0
     viewport.scale = scale
     translate = FloatArray(4)
-    translate[0] = 0.0
-    translate[1] = 0.0
-    translate[2] = 0.0
+    translate[0] = width / 2.0
+    translate[1] = height / 2.0
+    translate[2] = (maxz - minz) / 2.0
     translate[3] = 0.0
     viewport.translate = translate
     ctx.set_viewport(viewport)
@@ -134,17 +137,25 @@ def test(dev):
         PIPE_FORMAT_X8R8G8B8_UNORM, 
         width, height,
         tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
-    )
-    _cbuf = cbuf.get_surface(usage = PIPE_BUFFER_USAGE_GPU_READ|PIPE_BUFFER_USAGE_GPU_WRITE)
+    ).get_surface()
+    zbuf = dev.texture_create(
+        PIPE_FORMAT_Z32_UNORM, 
+        width, height,
+        tex_usage=PIPE_TEXTURE_USAGE_DEPTH_STENCIL,
+    ).get_surface()
     fb = Framebuffer()
     fb.width = width
     fb.height = height
-    fb.num_cbufs = 1
-    fb.set_cbuf(0, _cbuf)
+    fb.nr_cbufs = 1
+    fb.set_cbuf(0, cbuf)
+    fb.set_zsbuf(zbuf)
     ctx.set_framebuffer(fb)
-    _cbuf.clear_value = 0x00000000
-    ctx.surface_clear(_cbuf, _cbuf.clear_value)
-    del _cbuf
+    rgba = FloatArray(4);
+    rgba[0] = 0.0
+    rgba[1] = 0.0
+    rgba[2] = 0.0
+    rgba[3] = 0.0
+    ctx.clear(PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL, rgba, 1.0, 0xff)
     
     # vertex shader
     vs = Shader('''
@@ -173,25 +184,25 @@ def test(dev):
     nattrs = 2
     verts = FloatArray(nverts * nattrs * 4)
 
-    verts[ 0] = 128.0 # x1
-    verts[ 1] =  32.0 # y1
-    verts[ 2] =   0.0 # z1
+    verts[ 0] =   0.0 # x1
+    verts[ 1] =   0.8 # y1
+    verts[ 2] =   0.2 # z1
     verts[ 3] =   1.0 # w1
     verts[ 4] =   1.0 # r1
     verts[ 5] =   0.0 # g1
     verts[ 6] =   0.0 # b1
     verts[ 7] =   1.0 # a1
-    verts[ 8] =  32.0 # x2
-    verts[ 9] = 224.0 # y2
-    verts[10] =   0.0 # z2
+    verts[ 8] =  -0.8 # x2
+    verts[ 9] =  -0.8 # y2
+    verts[10] =   0.5 # z2
     verts[11] =   1.0 # w2
     verts[12] =   0.0 # r2
     verts[13] =   1.0 # g2
     verts[14] =   0.0 # b2
     verts[15] =   1.0 # a2
-    verts[16] = 224.0 # x3
-    verts[17] = 224.0 # y3
-    verts[18] =   0.0 # z3
+    verts[16] =   0.8 # x3
+    verts[17] =  -0.8 # y3
+    verts[18] =   0.8 # z3
     verts[19] =   1.0 # w3
     verts[20] =   0.0 # r3
     verts[21] =   0.0 # g3
@@ -205,8 +216,10 @@ def test(dev):
 
     ctx.flush()
     
-    show_image(cbuf.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE))
-    #save_image('tri.png', cbuf.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE))
+    show_image(cbuf)
+    #show_image(zbuf)
+    #save_image('cbuf.png', cbuf)
+    #save_image('zbuf.png', zbuf)
 
 
 
index 366d4eb..8246b37 100644 (file)
@@ -192,10 +192,16 @@ st_context_create(struct st_device *st_dev)
       memset(&rasterizer, 0, sizeof(rasterizer));
       rasterizer.front_winding = PIPE_WINDING_CW;
       rasterizer.cull_mode = PIPE_WINDING_NONE;
-      rasterizer.bypass_vs_clip_and_viewport = 1;
       cso_set_rasterizer(st_ctx->cso, &rasterizer);
    }
 
+   /* clip */
+   {
+      struct pipe_clip_state clip;
+      memset(&clip, 0, sizeof(clip));
+      st_ctx->pipe->set_clip_state(st_ctx->pipe, &clip);
+   }
+
    /* identity viewport */
    {
       struct pipe_viewport_state viewport;
@@ -291,37 +297,3 @@ st_context_create(struct st_device *st_dev)
 
    return st_ctx;
 }
-
-
-void
-st_buffer_destroy(struct st_buffer *st_buf)
-{
-   if(st_buf) {
-      pipe_buffer_reference(&st_buf->buffer, NULL);
-      FREE(st_buf);
-   }
-}
-
-
-struct st_buffer *
-st_buffer_create(struct st_device *st_dev,
-                 unsigned alignment, unsigned usage, unsigned size)
-{
-   struct pipe_screen *screen = st_dev->screen;
-   struct st_buffer *st_buf;
-   
-   st_buf = CALLOC_STRUCT(st_buffer);
-   if(!st_buf)
-      return NULL;
-
-   st_buf->st_dev = st_dev;
-   
-   st_buf->buffer = pipe_buffer_create(screen, alignment, usage, size);
-   if(!st_buf->buffer) {
-      st_buffer_destroy(st_buf);
-      return NULL;
-   }
-   
-   return st_buf;
-}
-
index 0641aff..a246b6a 100644 (file)
@@ -38,10 +38,12 @@ struct pipe_context;
 struct st_winsys; 
 
 
-struct st_buffer {
-   struct st_device *st_dev;
-   
-   struct pipe_buffer *buffer;
+struct st_surface
+{
+   struct pipe_texture *texture;
+   unsigned face;
+   unsigned level;
+   unsigned zslice;
 };
 
 
@@ -64,6 +66,8 @@ struct st_context {
    
    unsigned num_vertex_elements;
    struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS];
+   
+   struct pipe_framebuffer_state framebuffer;
 };
 
 
@@ -78,12 +82,13 @@ struct st_device {
 };
 
 
-struct st_buffer *
-st_buffer_create(struct st_device *st_dev,
-                 unsigned alignment, unsigned usage, unsigned size);
-
-void
-st_buffer_destroy(struct st_buffer *st_buf);
+static INLINE struct pipe_surface *
+st_pipe_surface(struct st_surface *surface, unsigned usage) 
+{
+   struct pipe_texture *texture = surface->texture;
+   struct pipe_screen *screen = texture->screen;
+   return screen->get_tex_surface(screen, texture, surface->face, surface->level, surface->zslice, usage);
+}
 
 struct st_context *
 st_context_create(struct st_device *st_dev);
index c2ffe9f..53a0189 100644 (file)
@@ -34,6 +34,7 @@
 #include "util/u_math.h"
 #include "util/u_memory.h"
 
+#include "st_device.h"
 #include "st_sample.h"
 
 
@@ -523,10 +524,13 @@ st_sample_pixel_block(enum pipe_format format,
 
 
 void
-st_sample_surface(struct pipe_surface *surface, float *rgba) 
+st_sample_surface(struct st_surface *surface, float *rgba) 
 {
-   struct pipe_screen *screen = surface->texture->screen;
-   uint rgba_stride = surface->width * 4;
+   struct pipe_texture *texture = surface->texture;
+   struct pipe_screen *screen = texture->screen;
+   unsigned width = texture->width[surface->level];
+   unsigned height = texture->height[surface->level];
+   uint rgba_stride = width * 4;
    struct pipe_transfer *transfer;
    void *raw;
 
@@ -535,27 +539,27 @@ st_sample_surface(struct pipe_surface *surface, float *rgba)
                                        surface->face,
                                        surface->level,
                                        surface->zslice,
-                                       PIPE_TRANSFER_READ,
+                                       PIPE_TRANSFER_WRITE,
                                        0, 0,
-                                       surface->width,
-                                       surface->height);
+                                       width,
+                                       height);
    if (!transfer)
       return;
 
    raw = screen->transfer_map(screen, transfer);
    if (raw) {
-      const struct pipe_format_block *block = &transfer->block;
+      const struct pipe_format_block *block = &texture->block;
       uint x, y;
 
       for (y = 0; y < transfer->nblocksy; ++y) {
          for (x = 0; x < transfer->nblocksx; ++x) {
-            st_sample_pixel_block(surface->format,
+            st_sample_pixel_block(texture->format,
                                   block,
                                   (uint8_t *) raw + y * transfer->stride + x * block->size,
                                   rgba + y * block->height * rgba_stride + x * block->width * 4,
                                   rgba_stride,
-                                  MIN2(block->width, surface->width - x*block->width),
-                                  MIN2(block->height, surface->height - y*block->height));
+                                  MIN2(block->width, width - x*block->width),
+                                  MIN2(block->height, height - y*block->height));
          }
       }
 
index ff04a12..0a27083 100644 (file)
@@ -41,7 +41,7 @@ st_sample_pixel_block(enum pipe_format format,
                       unsigned w, unsigned h);
 
 void
-st_sample_surface(struct pipe_surface *surface, float *rgba);
+st_sample_surface(struct st_surface *surface, float *rgba);
 
 
 #endif /* ST_SAMPLE_H_ */
index 426f347..41cdeaa 100644 (file)
@@ -84,8 +84,7 @@ st_softpipe_buffer_unmap(struct pipe_winsys *winsys,
 
 
 static void
-st_softpipe_buffer_destroy(struct pipe_winsys *winsys,
-                           struct pipe_buffer *buf)
+st_softpipe_buffer_destroy(struct pipe_buffer *buf)
 {
    struct st_softpipe_buffer *oldBuf = st_softpipe_buffer(buf);
 
diff --git a/src/gallium/state_trackers/python/tests/.gitignore b/src/gallium/state_trackers/python/tests/.gitignore
new file mode 100644 (file)
index 0000000..0dbbaee
--- /dev/null
@@ -0,0 +1,3 @@
+*.txt
+*.tsv
+*.dot
old mode 100644 (file)
new mode 100755 (executable)
index 8477aa5..1fa7fe6
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 ##########################################################################
 # 
+# Copyright 2009 VMware, Inc.
 # Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
 # All Rights Reserved.
 # 
@@ -19,7 +20,7 @@
 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
 # ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -33,6 +34,9 @@ Loosely inspired on Python's unittest module.
 """
 
 
+import os.path
+import sys
+
 from gallium import *
 
 
@@ -115,17 +119,77 @@ class Test:
         self._run(result)
         result.summary()
 
+    def assert_rgba(self, surface, x, y, w, h, expected_rgba, pixel_tol=4.0/256, surface_tol=0.85):
+        total = h*w
+        different = surface.compare_tile_rgba(x, y, w, h, expected_rgba, tol=pixel_tol)
+        if different:
+            sys.stderr.write("%u out of %u pixels differ\n" % (different, total))
+
+        if float(total - different)/float(total) < surface_tol:
+            if 0:
+                rgba = FloatArray(h*w*4)
+                surface.get_tile_rgba(x, y, w, h, rgba)
+                show_image(w, h, Result=rgba, Expected=expected_rgba)
+                save_image(w, h, rgba, "result.png")
+                save_image(w, h, expected_rgba, "expected.png")
+            #sys.exit(0)
+            
+            raise TestFailure
+
 
 class TestCase(Test):
     
+    tags = ()
+
     def __init__(self, dev, **kargs):
         Test.__init__(self)
         self.dev = dev
         self.__dict__.update(kargs)
 
     def description(self):
-        raise NotImplementedError
-        
+        descriptions = []
+        for tag in self.tags:
+            value = self.get(tag)
+            if value is not None and value != '':
+                descriptions.append(tag + '=' + str(value))
+        return ' '.join(descriptions)
+
+    def get(self, tag):
+        try:
+            method = getattr(self, '_get_' + tag)
+        except AttributeError:
+            return getattr(self, tag, None)
+        else:
+            return method()
+
+    def _get_target(self):
+        return {
+            PIPE_TEXTURE_1D: "1d", 
+            PIPE_TEXTURE_2D: "2d", 
+            PIPE_TEXTURE_3D: "3d", 
+            PIPE_TEXTURE_CUBE: "cube",
+        }[self.target]
+
+    def _get_format(self):
+        name = formats[self.format]
+        if name.startswith('PIPE_FORMAT_'):
+            name  = name[12:]
+        name = name.lower()
+        return name
+
+    def _get_face(self):
+        if self.target == PIPE_TEXTURE_CUBE:
+            return {
+                PIPE_TEX_FACE_POS_X: "+x",
+                PIPE_TEX_FACE_NEG_X: "-x",
+                PIPE_TEX_FACE_POS_Y: "+y",
+                PIPE_TEX_FACE_NEG_Y: "-y", 
+                PIPE_TEX_FACE_POS_Z: "+z", 
+                PIPE_TEX_FACE_NEG_Z: "-z",
+            }[self.face]
+        else:
+            return ''
+
     def test(self):
         raise NotImplementedError
     
@@ -167,27 +231,106 @@ class TestResult:
         self.passed = 0
         self.skipped = 0
         self.failed = 0
-        self.failed_descriptions = []
+
+        self.names = ['result']
+        self.types = ['pass skip fail']
+        self.rows = []
     
     def test_start(self, test):
+        sys.stdout.write("Running %s...\n" % test.description())
+        sys.stdout.flush()
         self.tests += 1
-        print "Running %s..." % test.description()
     
     def test_passed(self, test):
+        sys.stdout.write("PASS\n")
+        sys.stdout.flush()
         self.passed += 1
-        print "PASS"
+        self.log_result(test, 'pass')
             
     def test_skipped(self, test):
+        sys.stdout.write("SKIP\n")
+        sys.stdout.flush()
         self.skipped += 1
-        print "SKIP"
+        #self.log_result(test, 'skip')
         
     def test_failed(self, test):
+        sys.stdout.write("FAIL\n")
+        sys.stdout.flush()
         self.failed += 1
-        self.failed_descriptions.append(test.description())
-        print "FAIL"
+        self.log_result(test, 'fail')
+
+    def log_result(self, test, result):
+        row = ['']*len(self.names)
+
+        # add result
+        assert self.names[0] == 'result'
+        assert result in ('pass', 'skip', 'fail')
+        row[0] = result
+
+        # add tags
+        for tag in test.tags:
+            value = test.get(tag)
+
+            # infer type
+            if value is None:
+                continue
+            elif isinstance(value, (int, float)):
+                value = str(value)
+                type = 'c' # continous
+            elif isinstance(value, basestring):
+                type = 'd' # discrete
+            else:
+                assert False
+                value = str(value)
+                type = 'd' # discrete
+
+            # insert value
+            try:
+                col = self.names.index(tag, 1)
+            except ValueError:
+                self.names.append(tag)
+                self.types.append(type)
+                row.append(value)
+            else:
+                row[col] = value
+                assert self.types[col] == type
+        
+        self.rows.append(row)
 
     def summary(self):
-        print "%u tests, %u passed, %u skipped, %u failed" % (self.tests, self.passed, self.skipped, self.failed)
-        for description in self.failed_descriptions:
-            print "  %s" % description
\ No newline at end of file
+        sys.stdout.write("%u tests, %u passed, %u skipped, %u failed\n\n" % (self.tests, self.passed, self.skipped, self.failed))
+        sys.stdout.flush()
+
+        name, ext = os.path.splitext(os.path.basename(sys.argv[0]))
+        filename = name + '.tsv'
+        stream = file(filename, 'wt')
+
+        # header
+        stream.write('\t'.join(self.names) + '\n')
+        stream.write('\t'.join(self.types) + '\n')
+        stream.write('class\n')
+
+        # rows
+        for row in self.rows:
+            row += ['']*(len(self.names) - len(row))
+            stream.write('\t'.join(row) + '\n')
+
+        stream.close()
+
+        # See http://www.ailab.si/orange/doc/ofb/c_otherclass.htm
+        try:
+            import orange
+            import orngTree
+        except ImportError:
+            sys.stderr.write('Install Orange from http://www.ailab.si/orange/ for a classification tree.\n')
+            return
+
+        data = orange.ExampleTable(filename)
+
+        tree = orngTree.TreeLearner(data, sameMajorityPruning=1, mForPruning=2)
+
+        orngTree.printTxt(tree, maxDepth=4)
+
+        file(name+'.txt', 'wt').write(orngTree.dumpTree(tree))
+
+        orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box')
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-abs.sh
new file mode 100644 (file)
index 0000000..7a0006b
--- /dev/null
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.5, -0.4, -0.6, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+ABS OUT[0], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-add.sh
new file mode 100644 (file)
index 0000000..f7836c8
--- /dev/null
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+ADD OUT[0], IN[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp3.sh
new file mode 100644 (file)
index 0000000..c89cd74
--- /dev/null
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DP3 OUT[0], IN[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dp4.sh
new file mode 100644 (file)
index 0000000..6517e3c
--- /dev/null
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DP4 OUT[0], IN[0].xyzx, IN[0].xyzx
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-dst.sh
new file mode 100644 (file)
index 0000000..464880b
--- /dev/null
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DST OUT[0], IN[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-ex2.sh
new file mode 100644 (file)
index 0000000..2684076
--- /dev/null
@@ -0,0 +1,11 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+EX2 TEMP[0], IN[0].xxxx
+MUL OUT[0], TEMP[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-flr.sh
new file mode 100644 (file)
index 0000000..ad11e28
--- /dev/null
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 2.5, 4.0,  2.0, 1.0 }
+IMM FLT32 { 0.4, 0.25, 0.5, 1.0 }
+
+MUL TEMP[0], IN[0], IMM[0]
+FLR TEMP[0], TEMP[0]
+MUL OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-frc.sh
new file mode 100644 (file)
index 0000000..4f3aa30
--- /dev/null
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 2.7, 3.1, 4.5, 1.0 }
+
+MUL TEMP[0], IN[0], IMM[0]
+FRC OUT[0], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lg2.sh
new file mode 100644 (file)
index 0000000..54c7c64
--- /dev/null
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 0.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+LG2 TEMP[0].x, TEMP[0].xxxx
+ADD OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lit.sh
new file mode 100644 (file)
index 0000000..0e78ef8
--- /dev/null
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+LIT OUT[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-lrp.sh
new file mode 100644 (file)
index 0000000..e9ee0f8
--- /dev/null
@@ -0,0 +1,11 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+ABS TEMP[0], IN[0]
+LRP OUT[0], TEMP[0], IN[0].xxxx, IN[0].yyyy
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mad.sh
new file mode 100644 (file)
index 0000000..439acd5
--- /dev/null
@@ -0,0 +1,11 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.5, 0.4, 0.6, 1.0 }
+IMM FLT32 { 0.5, 0.4, 0.6, 0.0 }
+
+MAD OUT[0], IN[0], IMM[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-max.sh
new file mode 100644 (file)
index 0000000..ab21b24
--- /dev/null
@@ -0,0 +1,10 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.4, 0.4, 0.4, 0.0 }
+
+MAX OUT[0], IN[0], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-min.sh
new file mode 100644 (file)
index 0000000..969ae73
--- /dev/null
@@ -0,0 +1,10 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.6, 0.6, 0.6, 1.0 }
+
+MIN OUT[0], IN[0], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mov.sh
new file mode 100644 (file)
index 0000000..612975e
--- /dev/null
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+MOV OUT[0], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-mul.sh
new file mode 100644 (file)
index 0000000..ed158b0
--- /dev/null
@@ -0,0 +1,10 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+IMM FLT32 { 0.5, 0.6, 0.7, 1.0 }
+
+MUL OUT[0], IN[0], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rcp.sh
new file mode 100644 (file)
index 0000000..cc9feef
--- /dev/null
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RCP TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-rsq.sh
new file mode 100644 (file)
index 0000000..695621f
--- /dev/null
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RSQ TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sge.sh
new file mode 100644 (file)
index 0000000..9505bc3
--- /dev/null
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 0.6, 0.6, 0.6, 0.0 }
+
+SGE TEMP[0], IN[0], IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-slt.sh
new file mode 100644 (file)
index 0000000..f2a1521
--- /dev/null
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 0.6, 0.6, 0.6, 0.0 }
+
+SLT TEMP[0], IN[0], IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-abs.sh
new file mode 100644 (file)
index 0000000..9cd4b68
--- /dev/null
@@ -0,0 +1,13 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.3, -0.5, -0.4, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV OUT[0], |TEMP[0]|
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-absneg.sh
new file mode 100644 (file)
index 0000000..acd6aa7
--- /dev/null
@@ -0,0 +1,15 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.2, -0.3, -0.4, 0.0 }
+IMM FLT32 { -1.0, -1.0, -1.0, -1.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV TEMP[0], -|TEMP[0]|
+MUL OUT[0], TEMP[0], IMM[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-neg.sh
new file mode 100644 (file)
index 0000000..ba1b615
--- /dev/null
@@ -0,0 +1,11 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+DCL TEMP[0]
+
+SUB TEMP[0], IN[0], IN[0].yzxw
+MOV OUT[0], -TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-srcmod-swz.sh
new file mode 100644 (file)
index 0000000..192aa7b
--- /dev/null
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+MOV OUT[0], IN[0].yxzw
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-sub.sh
new file mode 100644 (file)
index 0000000..83441fa
--- /dev/null
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+SUB OUT[0], IN[0], IN[0].yzxw
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh b/src/gallium/state_trackers/python/tests/regress/fragment-shader/frag-xpd.sh
new file mode 100644 (file)
index 0000000..d6f66c4
--- /dev/null
@@ -0,0 +1,8 @@
+FRAG1.1
+
+DCL IN[0], COLOR, LINEAR
+DCL OUT[0], COLOR
+
+XPD OUT[0], IN[0], IN[0].yzxw
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py b/src/gallium/state_trackers/python/tests/regress/fragment-shader/fragment-shader.py
new file mode 100644 (file)
index 0000000..d60fb38
--- /dev/null
@@ -0,0 +1,218 @@
+#!/usr/bin/env python
+##########################################################################
+# 
+# Copyright 2009 VMware, Inc.
+# All Rights Reserved.
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sub license, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+# 
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial portions
+# of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# 
+##########################################################################
+
+
+from gallium import *
+
+def make_image(surface):
+    data = surface.get_tile_rgba8(0, 0, surface.width, surface.height)
+
+    import Image
+    outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1)
+    return outimage
+
+def save_image(filename, surface):
+    outimage = make_image(surface)
+    outimage.save(filename, "PNG")
+
+def test(dev, name):
+    ctx = dev.context_create()
+
+    width = 320
+    height = 320
+    minz = 0.0
+    maxz = 1.0
+
+    # disabled blending/masking
+    blend = Blend()
+    blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
+    blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
+    blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
+    blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
+    blend.colormask = PIPE_MASK_RGBA
+    ctx.set_blend(blend)
+
+    # depth/stencil/alpha
+    depth_stencil_alpha = DepthStencilAlpha()
+    depth_stencil_alpha.depth.enabled = 0
+    depth_stencil_alpha.depth.writemask = 1
+    depth_stencil_alpha.depth.func = PIPE_FUNC_LESS
+    ctx.set_depth_stencil_alpha(depth_stencil_alpha)
+
+    # rasterizer
+    rasterizer = Rasterizer()
+    rasterizer.front_winding = PIPE_WINDING_CW
+    rasterizer.cull_mode = PIPE_WINDING_NONE
+    rasterizer.scissor = 1
+    ctx.set_rasterizer(rasterizer)
+
+    # viewport
+    viewport = Viewport()
+    scale = FloatArray(4)
+    scale[0] = width / 2.0
+    scale[1] = -height / 2.0
+    scale[2] = (maxz - minz) / 2.0
+    scale[3] = 1.0
+    viewport.scale = scale
+    translate = FloatArray(4)
+    translate[0] = width / 2.0
+    translate[1] = height / 2.0
+    translate[2] = (maxz - minz) / 2.0
+    translate[3] = 0.0
+    viewport.translate = translate
+    ctx.set_viewport(viewport)
+
+    # samplers
+    sampler = Sampler()
+    sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+    sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+    sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+    sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE
+    sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+    sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+    sampler.normalized_coords = 1
+    ctx.set_sampler(0, sampler)
+
+    # scissor
+    scissor = Scissor()
+    scissor.minx = 0
+    scissor.miny = 0
+    scissor.maxx = width
+    scissor.maxy = height
+    ctx.set_scissor(scissor)
+
+    clip = Clip()
+    clip.nr = 0
+    ctx.set_clip(clip)
+
+    # framebuffer
+    cbuf = dev.texture_create(
+        PIPE_FORMAT_X8R8G8B8_UNORM,
+        width, height,
+        tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
+    ).get_surface()
+    fb = Framebuffer()
+    fb.width = width
+    fb.height = height
+    fb.nr_cbufs = 1
+    fb.set_cbuf(0, cbuf)
+    ctx.set_framebuffer(fb)
+    rgba = FloatArray(4);
+    rgba[0] = 0.5
+    rgba[1] = 0.5
+    rgba[2] = 0.5
+    rgba[3] = 0.5
+    ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
+
+    # vertex shader
+    vs = Shader('''
+        VERT1.1
+        DCL IN[0], POSITION
+        DCL IN[1], COLOR
+        DCL OUT[0], POSITION
+        DCL OUT[1], COLOR
+        MOV OUT[0], IN[0]
+        MOV OUT[1], IN[1]
+        END
+    ''')
+    ctx.set_vertex_shader(vs)
+
+    # fragment shader
+    fs = Shader(file('frag-' + name + '.sh', 'rt').read())
+    ctx.set_fragment_shader(fs)
+
+    xy = [
+        -0.8, -0.8,
+         0.8, -0.8,
+         0.0,  0.8,
+    ]
+    color = [
+        1.0, 0.0, 0.0,
+        0.0, 1.0, 0.0,
+        0.0, 0.0, 1.0,
+    ]
+
+    nverts = 3
+    nattrs = 2
+    verts = FloatArray(nverts * nattrs * 4)
+
+    for i in range(0, nverts):
+        verts[i * nattrs * 4 + 0] = xy[i * 2 + 0] # x
+        verts[i * nattrs * 4 + 1] = xy[i * 2 + 1] # y
+        verts[i * nattrs * 4 + 2] = 0.5 # z
+        verts[i * nattrs * 4 + 3] = 1.0 # w
+        verts[i * nattrs * 4 + 4] = color[i * 3 + 0] # r
+        verts[i * nattrs * 4 + 5] = color[i * 3 + 1] # g
+        verts[i * nattrs * 4 + 6] = color[i * 3 + 2] # b
+        verts[i * nattrs * 4 + 7] = 1.0 # a
+
+    ctx.draw_vertices(PIPE_PRIM_TRIANGLES,
+                      nverts,
+                      nattrs,
+                      verts)
+
+    ctx.flush()
+
+    save_image('frag-' + name + '.png', cbuf)
+
+def main():
+    tests = [
+        'abs',
+        'add',
+        'dp3',
+        'dp4',
+        'dst',
+        'ex2',
+        'flr',
+        'frc',
+        'lg2',
+        'lit',
+        'lrp',
+        'mad',
+        'max',
+        'min',
+        'mov',
+        'mul',
+        'rcp',
+        'rsq',
+        'sge',
+        'slt',
+        'srcmod-abs',
+        'srcmod-absneg',
+        'srcmod-neg',
+        'srcmod-swz',
+        'sub',
+        'xpd',
+    ]
+
+    dev = Device()
+    for t in tests:
+        test(dev, t)
+
+if __name__ == '__main__':
+    main()
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-abs.sh
new file mode 100644 (file)
index 0000000..f0d0d5d
--- /dev/null
@@ -0,0 +1,15 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { 0.2, 0.2, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+ABS OUT[0], TEMP[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-add.sh
new file mode 100644 (file)
index 0000000..936c851
--- /dev/null
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.2, -0.1, 0.0, 0.0 }
+
+ADD OUT[0], IN[0], IMM[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arl.sh
new file mode 100644 (file)
index 0000000..7638e96
--- /dev/null
@@ -0,0 +1,23 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+DCL ADDR[0]
+
+IMM FLT32 { 3.0, 1.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 0.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 1.0, 1.0 }
+
+MOV OUT[0], IN[0]
+MUL TEMP[0], IN[0], IMM[0]
+ARL ADDR[0].x, TEMP[0]
+MOV OUT[1], IMM[ADDR[0].x + 3]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-arr.sh
new file mode 100644 (file)
index 0000000..28ce6f9
--- /dev/null
@@ -0,0 +1,23 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+DCL ADDR[0]
+
+IMM FLT32 { 3.0, 1.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 0.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 1.0, 1.0 }
+
+MOV OUT[0], IN[0]
+MUL TEMP[0], IN[0], IMM[0]
+ARR ADDR[0].x, TEMP[0]
+MOV OUT[1], IMM[ADDR[0].x + 3]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh
new file mode 100644 (file)
index 0000000..b57d685
--- /dev/null
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+
+DP3 TEMP[0].xy, IN[0], IN[0]
+MOV TEMP[0].zw, IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh
new file mode 100644 (file)
index 0000000..0eb3171
--- /dev/null
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+
+DP4 TEMP[0].xy, IN[0], IN[0]
+MOV TEMP[0].zw, IMM[0]
+MUL OUT[0], IN[0], TEMP[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-dst.sh
new file mode 100644 (file)
index 0000000..dc5e0eb
--- /dev/null
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0]
+DST OUT[1], IN[1], IN[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh
new file mode 100644 (file)
index 0000000..34057af
--- /dev/null
@@ -0,0 +1,18 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0..1]
+
+IMM FLT32 { 0.3, 0.3, 0.3, 1.0 }
+
+EX2 TEMP[0], IN[0]
+EX2 TEMP[1], IN[1].yyyy
+MUL TEMP[0], TEMP[0], IMM[0]
+MOV OUT[0], IN[0]
+MUL OUT[1], TEMP[0], TEMP[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-flr.sh
new file mode 100644 (file)
index 0000000..44ad708
--- /dev/null
@@ -0,0 +1,23 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+DCL ADDR[0]
+
+IMM FLT32 { 3.0, 1.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 0.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 0.0, 1.0, 1.0 }
+IMM FLT32 { 1.0, 1.0, 0.0, 1.0 }
+IMM FLT32 { 0.0, 1.0, 1.0, 1.0 }
+
+MOV OUT[0], IN[0]
+MUL TEMP[0], IN[0], IMM[0]
+FLR ADDR[0].x, TEMP[0]
+MOV OUT[1], IMM[ADDR[0].x + 3]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-frc.sh
new file mode 100644 (file)
index 0000000..d179749
--- /dev/null
@@ -0,0 +1,15 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 2.7, 3.1, 4.5, 1.0 }
+
+MUL TEMP[0], IN[0].xyxw, IMM[0]
+MOV OUT[0], IN[0]
+FRC OUT[1], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh
new file mode 100644 (file)
index 0000000..f6e08d0
--- /dev/null
@@ -0,0 +1,18 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 0.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+LG2 TEMP[0].x, TEMP[0].xxxx
+ADD OUT[0], TEMP[0], IMM[1]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lit.sh
new file mode 100644 (file)
index 0000000..da98f30
--- /dev/null
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0]
+LIT OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh
new file mode 100644 (file)
index 0000000..8c26258
--- /dev/null
@@ -0,0 +1,14 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+ABS TEMP[0], IN[0]
+MOV OUT[0], IN[0]
+LRP OUT[1], TEMP[0], IN[1].xxxx, IN[1].yyyy
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mad.sh
new file mode 100644 (file)
index 0000000..eb07a3b
--- /dev/null
@@ -0,0 +1,14 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.5, 1.0, 1.0, 1.0 }
+IMM FLT32 { 0.5, 0.0, 0.0, 0.0 }
+
+MAD OUT[0], IN[0], IMM[0], IMM[1]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-max.sh
new file mode 100644 (file)
index 0000000..2d8b1fe
--- /dev/null
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.5, 0.5, 0.5, 0.0 }
+
+MOV OUT[0], IN[0]
+MAX OUT[1], IN[1], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-min.sh
new file mode 100644 (file)
index 0000000..84af0e2
--- /dev/null
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.5, 0.5, 0.5, 0.0 }
+
+MOV OUT[0], IN[0]
+MIN OUT[1], IN[1], IMM[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mov.sh
new file mode 100644 (file)
index 0000000..bcdec07
--- /dev/null
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-mul.sh
new file mode 100644 (file)
index 0000000..f3b57c3
--- /dev/null
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.6, 0.6, 1.0, 1.0 }
+
+MUL OUT[0], IN[0], IMM[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh
new file mode 100644 (file)
index 0000000..78af589
--- /dev/null
@@ -0,0 +1,18 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RCP TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh
new file mode 100644 (file)
index 0000000..1675c7d
--- /dev/null
@@ -0,0 +1,18 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 1.0, 0.0, 0.0, 0.0 }
+IMM FLT32 { 1.5, 0.0, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+RSQ TEMP[0].x, TEMP[0].xxxx
+SUB OUT[0], TEMP[0], IMM[1]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sge.sh
new file mode 100644 (file)
index 0000000..3d92cd5
--- /dev/null
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { -0.1, -0.1, 1.0, 0.0 }
+
+SGE TEMP[0], IN[0], IMM[0]
+MOV OUT[0], IN[0]
+MUL OUT[1], IN[1], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-slt.sh
new file mode 100644 (file)
index 0000000..85c60ff
--- /dev/null
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+DCL TEMP[0]
+
+IMM FLT32 { 0.6, 0.6, 0.0, 0.0 }
+
+SLT TEMP[0], IN[0], IMM[0]
+MOV OUT[0], IN[0]
+MUL OUT[1], IN[1], TEMP[0]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-abs.sh
new file mode 100644 (file)
index 0000000..6db417a
--- /dev/null
@@ -0,0 +1,15 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { 0.1, 0.1, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV OUT[0], |TEMP[0]|
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-absneg.sh
new file mode 100644 (file)
index 0000000..fc83238
--- /dev/null
@@ -0,0 +1,16 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+DCL TEMP[0]
+
+IMM FLT32 { -0.2, -0.2, 0.0, 0.0 }
+
+ADD TEMP[0], IN[0], IMM[0]
+MOV OUT[0].xy, -|TEMP[0]|
+MOV OUT[0].zw, IN[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-neg.sh
new file mode 100644 (file)
index 0000000..ce4e90b
--- /dev/null
@@ -0,0 +1,12 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0].xy, -IN[0]
+MOV OUT[0].zw, IN[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-srcmod-swz.sh
new file mode 100644 (file)
index 0000000..c03de4c
--- /dev/null
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0].yxzw
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-sub.sh
new file mode 100644 (file)
index 0000000..a583b95
--- /dev/null
@@ -0,0 +1,13 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+IMM FLT32 { 0.1, 0.1, 0.0, 0.0 }
+
+SUB OUT[0], IN[0], IMM[0]
+MOV OUT[1], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh
new file mode 100644 (file)
index 0000000..8def894
--- /dev/null
@@ -0,0 +1,11 @@
+VERT1.1
+
+DCL IN[0], POSITION
+DCL IN[1], COLOR
+DCL OUT[0], POSITION
+DCL OUT[1], COLOR
+
+MOV OUT[0], IN[0]
+XPD OUT[1], IN[0], IN[1]
+
+END
diff --git a/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py b/src/gallium/state_trackers/python/tests/regress/vertex-shader/vertex-shader.py
new file mode 100644 (file)
index 0000000..472769f
--- /dev/null
@@ -0,0 +1,247 @@
+#!/usr/bin/env python
+##########################################################################
+# 
+# Copyright 2009 VMware, Inc.
+# All Rights Reserved.
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sub license, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+# 
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial portions
+# of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# 
+##########################################################################
+
+
+from gallium import *
+
+def make_image(surface):
+    data = surface.get_tile_rgba8(0, 0, surface.width, surface.height)
+
+    import Image
+    outimage = Image.fromstring('RGBA', (surface.width, surface.height), data, "raw", 'RGBA', 0, 1)
+    return outimage
+
+def save_image(filename, surface):
+    outimage = make_image(surface)
+    outimage.save(filename, "PNG")
+
+def test(dev, name):
+    ctx = dev.context_create()
+
+    width = 320
+    height = 320
+    minz = 0.0
+    maxz = 1.0
+
+    # disabled blending/masking
+    blend = Blend()
+    blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
+    blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
+    blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
+    blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
+    blend.colormask = PIPE_MASK_RGBA
+    ctx.set_blend(blend)
+
+    # depth/stencil/alpha
+    depth_stencil_alpha = DepthStencilAlpha()
+    depth_stencil_alpha.depth.enabled = 0
+    depth_stencil_alpha.depth.writemask = 1
+    depth_stencil_alpha.depth.func = PIPE_FUNC_LESS
+    ctx.set_depth_stencil_alpha(depth_stencil_alpha)
+
+    # rasterizer
+    rasterizer = Rasterizer()
+    rasterizer.front_winding = PIPE_WINDING_CW
+    rasterizer.cull_mode = PIPE_WINDING_NONE
+    rasterizer.scissor = 1
+    ctx.set_rasterizer(rasterizer)
+
+    # viewport
+    viewport = Viewport()
+    scale = FloatArray(4)
+    scale[0] = width / 2.0
+    scale[1] = -height / 2.0
+    scale[2] = (maxz - minz) / 2.0
+    scale[3] = 1.0
+    viewport.scale = scale
+    translate = FloatArray(4)
+    translate[0] = width / 2.0
+    translate[1] = height / 2.0
+    translate[2] = (maxz - minz) / 2.0
+    translate[3] = 0.0
+    viewport.translate = translate
+    ctx.set_viewport(viewport)
+
+    # samplers
+    sampler = Sampler()
+    sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+    sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+    sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+    sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE
+    sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+    sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+    sampler.normalized_coords = 1
+    ctx.set_sampler(0, sampler)
+
+    # scissor
+    scissor = Scissor()
+    scissor.minx = 0
+    scissor.miny = 0
+    scissor.maxx = width
+    scissor.maxy = height
+    ctx.set_scissor(scissor)
+
+    clip = Clip()
+    clip.nr = 0
+    ctx.set_clip(clip)
+
+    # framebuffer
+    cbuf = dev.texture_create(
+        PIPE_FORMAT_X8R8G8B8_UNORM,
+        width, height,
+        tex_usage=PIPE_TEXTURE_USAGE_DISPLAY_TARGET,
+    ).get_surface()
+    fb = Framebuffer()
+    fb.width = width
+    fb.height = height
+    fb.nr_cbufs = 1
+    fb.set_cbuf(0, cbuf)
+    ctx.set_framebuffer(fb)
+    rgba = FloatArray(4);
+    rgba[0] = 0.5
+    rgba[1] = 0.5
+    rgba[2] = 0.5
+    rgba[3] = 0.5
+    ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
+
+    # vertex shader
+    vs = Shader(file('vert-' + name + '.sh', 'rt').read())
+    ctx.set_vertex_shader(vs)
+
+    # fragment shader
+    fs = Shader('''
+        FRAG1.1
+        DCL IN[0], COLOR, LINEAR
+        DCL OUT[0], COLOR, CONSTANT
+        0:MOV OUT[0], IN[0]
+        1:END
+    ''')
+    ctx.set_fragment_shader(fs)
+
+    xy = [
+         0.0,  0.8,
+        -0.2,  0.4,
+         0.2,  0.4,
+        -0.4,  0.0,
+         0.0,  0.0,
+         0.4,  0.0,
+        -0.6, -0.4,
+        -0.2, -0.4,
+         0.2, -0.4,
+         0.6, -0.4,
+        -0.8, -0.8,
+        -0.4, -0.8,
+         0.0, -0.8,
+         0.4, -0.8,
+         0.8, -0.8,
+    ]
+    color = [
+        1.0, 0.0, 0.0,
+        0.0, 1.0, 0.0,
+        0.0, 0.0, 1.0,
+    ]
+    tri = [
+         1,  2,  0,
+         3,  4,  1,
+         4,  2,  1,
+         4,  5,  2,
+         6,  7,  3,
+         7,  4,  3,
+         7,  8,  4,
+         8,  5,  4,
+         8,  9,  5,
+        10, 11,  6,
+        11,  7,  6,
+        11, 12,  7,
+        12,  8,  7,
+        12, 13,  8,
+        13,  9,  8,
+        13, 14,  9,
+    ]
+
+    nverts = 16 * 3
+    nattrs = 2
+    verts = FloatArray(nverts * nattrs * 4)
+
+    for i in range(0, nverts):
+        verts[i * nattrs * 4 + 0] = xy[tri[i] * 2 + 0] # x
+        verts[i * nattrs * 4 + 1] = xy[tri[i] * 2 + 1] # y
+        verts[i * nattrs * 4 + 2] = 0.5 # z
+        verts[i * nattrs * 4 + 3] = 1.0 # w
+        verts[i * nattrs * 4 + 4] = color[(i % 3) * 3 + 0] # r
+        verts[i * nattrs * 4 + 5] = color[(i % 3) * 3 + 1] # g
+        verts[i * nattrs * 4 + 6] = color[(i % 3) * 3 + 2] # b
+        verts[i * nattrs * 4 + 7] = 1.0 # a
+
+    ctx.draw_vertices(PIPE_PRIM_TRIANGLES,
+                      nverts,
+                      nattrs,
+                      verts)
+
+    ctx.flush()
+
+    save_image('vert-' + name + '.png', cbuf)
+
+def main():
+    tests = [
+        'abs',
+        'add',
+        'arl',
+        'arr',
+        'dp3',
+        'dp4',
+        'dst',
+        'ex2',
+        'flr',
+        'frc',
+        'lg2',
+        'lit',
+        'lrp',
+        'mad',
+        'max',
+        'min',
+        'mov',
+        'mul',
+        'rcp',
+        'rsq',
+        'sge',
+        'slt',
+        'srcmod-abs',
+        'srcmod-absneg',
+        'srcmod-neg',
+        'srcmod-swz',
+        'sub',
+        'xpd',
+    ]
+
+    dev = Device()
+    for t in tests:
+        test(dev, t)
+
+if __name__ == '__main__':
+    main()
diff --git a/src/gallium/state_trackers/python/tests/surface_copy.py b/src/gallium/state_trackers/python/tests/surface_copy.py
new file mode 100755 (executable)
index 0000000..3ceecbb
--- /dev/null
@@ -0,0 +1,199 @@
+#!/usr/bin/env python
+##########################################################################
+# 
+# Copyright 2009 VMware, Inc.
+# All Rights Reserved.
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sub license, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+# 
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial portions
+# of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# 
+##########################################################################
+
+
+from gallium import *
+from base import *
+
+
+def lods(*dims):
+    size = max(dims)
+    lods = 0
+    while size:
+        lods += 1
+        size >>= 1
+    return lods
+
+
+class TextureTest(TestCase):
+    
+    tags = (
+        'target',
+        'format',
+        'width',
+        'height',
+        'depth',
+        'last_level',
+        'face',
+        'level',
+        'zslice',
+    )
+
+    def test(self):
+        dev = self.dev
+        
+        target = self.target
+        format = self.format
+        width = self.width
+        height = self.height
+        depth = self.depth
+        last_level = self.last_level
+        face = self.face
+        level = self.level
+        zslice = self.zslice
+        
+        #  textures
+        dst_texture = dev.texture_create(
+            target = target,
+            format = format, 
+            width = width, 
+            height = height,
+            depth = depth, 
+            last_level = last_level,
+            tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
+        )
+        if dst_texture is None:
+            raise TestSkip
+
+        dst_surface = dst_texture.get_surface(face = face, level = level, zslice = zslice)
+        
+        src_texture = dev.texture_create(
+            target = target,
+            format = format, 
+            width = dst_surface.width, 
+            height = dst_surface.height,
+            depth = 1, 
+            last_level = 0,
+            tex_usage = PIPE_TEXTURE_USAGE_SAMPLER,
+        )
+
+        src_surface = src_texture.get_surface()
+        
+        x = 0
+        y = 0
+        w = dst_surface.width
+        h = dst_surface.height
+    
+        stride = dst_surface.nblocksx * dst_texture.block.size
+        size = dst_surface.nblocksy * stride
+        src_raw = os.urandom(size)
+
+        src_surface.put_tile_raw(0, 0, w, h, src_raw, stride)
+
+        ctx = self.dev.context_create()
+    
+        ctx.surface_copy(dst_surface, 0, 0, 
+                         src_surface, 0, 0, w, h)
+    
+        ctx.flush()
+
+        dst_raw = dst_surface.get_tile_raw(0, 0, w, h)
+
+        if dst_raw != src_raw:
+            raise TestFailure
+        
+
+
+def main():
+    dev = Device()
+    suite = TestSuite()
+    
+    targets = [
+        PIPE_TEXTURE_2D,
+        PIPE_TEXTURE_CUBE,
+        #PIPE_TEXTURE_3D,
+    ]
+    
+    formats = [
+        PIPE_FORMAT_A8R8G8B8_UNORM,
+        PIPE_FORMAT_X8R8G8B8_UNORM,
+        PIPE_FORMAT_A8R8G8B8_SRGB,
+        PIPE_FORMAT_R5G6B5_UNORM,
+        PIPE_FORMAT_A1R5G5B5_UNORM,
+        PIPE_FORMAT_A4R4G4B4_UNORM,
+        PIPE_FORMAT_Z32_UNORM,
+        PIPE_FORMAT_Z24S8_UNORM,
+        PIPE_FORMAT_Z24X8_UNORM,
+        PIPE_FORMAT_Z16_UNORM,
+        PIPE_FORMAT_S8_UNORM,
+        PIPE_FORMAT_A8_UNORM,
+        PIPE_FORMAT_L8_UNORM,
+        PIPE_FORMAT_DXT1_RGB,
+        PIPE_FORMAT_DXT1_RGBA,
+        PIPE_FORMAT_DXT3_RGBA,
+        PIPE_FORMAT_DXT5_RGBA,
+    ]
+    
+    sizes = [64, 32, 16, 8, 4, 2, 1]
+    #sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
+    #sizes = [64]
+    #sizes = [63]
+    
+    faces = [
+        PIPE_TEX_FACE_POS_X,
+        PIPE_TEX_FACE_NEG_X,
+        PIPE_TEX_FACE_POS_Y,
+        PIPE_TEX_FACE_NEG_Y, 
+        PIPE_TEX_FACE_POS_Z, 
+        PIPE_TEX_FACE_NEG_Z,
+    ]
+
+    for target in targets:
+        for format in formats:
+            for size in sizes:
+                if target == PIPE_TEXTURE_3D:
+                    depth = size
+                else:
+                    depth = 1
+                for face in faces:
+                    if target != PIPE_TEXTURE_CUBE and face:
+                        continue
+                    levels = lods(size)
+                    for last_level in range(levels):
+                        for level in range(0, last_level + 1):
+                            zslice = 0
+                            while zslice < depth >> level:
+                                test = TextureTest(
+                                    dev = dev,
+                                    target = target,
+                                    format = format, 
+                                    width = size,
+                                    height = size,
+                                    depth = depth,
+                                    last_level = last_level,
+                                    face = face,
+                                    level = level,
+                                    zslice = zslice,
+                                )
+                                suite.add_test(test)
+                                zslice = (zslice + 1)*2 - 1
+    suite.run()
+
+
+if __name__ == '__main__':
+    main()
diff --git a/src/gallium/state_trackers/python/tests/texture_render.py b/src/gallium/state_trackers/python/tests/texture_render.py
new file mode 100755 (executable)
index 0000000..0b76932
--- /dev/null
@@ -0,0 +1,320 @@
+#!/usr/bin/env python
+##########################################################################
+# 
+# Copyright 2009 VMware, Inc.
+# All Rights Reserved.
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sub license, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+# 
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial portions
+# of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# 
+##########################################################################
+
+
+from gallium import *
+from base import *
+
+
+def lods(*dims):
+    size = max(dims)
+    lods = 0
+    while size:
+        lods += 1
+        size >>= 1
+    return lods
+
+
+class TextureTest(TestCase):
+    
+    tags = (
+        'target',
+        'format',
+        'width',
+        'height',
+        'depth',
+        'last_level',
+        'face',
+        'level',
+        'zslice',
+    )
+
+    def test(self):
+        dev = self.dev
+        
+        target = self.target
+        format = self.format
+        width = self.width
+        height = self.height
+        depth = self.depth
+        last_level = self.last_level
+        face = self.face
+        level = self.level
+        zslice = self.zslice
+        
+        #  textures
+        dst_texture = dev.texture_create(
+            target = target,
+            format = format, 
+            width = width, 
+            height = height,
+            depth = depth, 
+            last_level = last_level,
+            tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
+        )
+        if dst_texture is None:
+            raise TestSkip
+
+        dst_surface = dst_texture.get_surface(face = face, level = level, zslice = zslice)
+        
+        ref_texture = dev.texture_create(
+            target = target,
+            format = format, 
+            width = dst_surface.width, 
+            height = dst_surface.height,
+            depth = 1, 
+            last_level = 0,
+            tex_usage = PIPE_TEXTURE_USAGE_SAMPLER,
+        )
+
+        ref_surface = ref_texture.get_surface()
+        
+        src_texture = dev.texture_create(
+            target = target,
+            format = PIPE_FORMAT_A8R8G8B8_UNORM, 
+            width = dst_surface.width, 
+            height = dst_surface.height,
+            depth = 1, 
+            last_level = 0,
+            tex_usage = PIPE_TEXTURE_USAGE_SAMPLER,
+        )
+
+        src_surface = src_texture.get_surface()
+        
+        expected_rgba = FloatArray(height*width*4) 
+        ref_surface.sample_rgba(expected_rgba)
+
+        src_surface.put_tile_rgba(0, 0, src_surface.width, src_surface.height, expected_rgba)
+        
+        ctx = self.dev.context_create()
+    
+        # disabled blending/masking
+        blend = Blend()
+        blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE
+        blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE
+        blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO
+        blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO
+        blend.colormask = PIPE_MASK_RGBA
+        ctx.set_blend(blend)
+    
+        # no-op depth/stencil/alpha
+        depth_stencil_alpha = DepthStencilAlpha()
+        ctx.set_depth_stencil_alpha(depth_stencil_alpha)
+    
+        # rasterizer
+        rasterizer = Rasterizer()
+        rasterizer.front_winding = PIPE_WINDING_CW
+        rasterizer.cull_mode = PIPE_WINDING_NONE
+        rasterizer.bypass_vs_clip_and_viewport = 1
+        ctx.set_rasterizer(rasterizer)
+    
+        # samplers
+        sampler = Sampler()
+        sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+        sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+        sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE
+        sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST
+        sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+        sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST
+        sampler.normalized_coords = 1
+        sampler.min_lod = 0
+        sampler.max_lod = PIPE_MAX_TEXTURE_LEVELS - 1
+        ctx.set_sampler(0, sampler)
+        ctx.set_sampler_texture(0, src_texture)
+
+        #  framebuffer 
+        cbuf_tex = dev.texture_create(
+            PIPE_FORMAT_A8R8G8B8_UNORM, 
+            width, 
+            height,
+            tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
+        )
+
+        fb = Framebuffer()
+        fb.width = dst_surface.width
+        fb.height = dst_surface.height
+        fb.nr_cbufs = 1
+        fb.set_cbuf(0, dst_surface)
+        ctx.set_framebuffer(fb)
+        rgba = FloatArray(4);
+        rgba[0] = 0.0
+        rgba[1] = 0.0
+        rgba[2] = 0.0
+        rgba[3] = 0.0
+        ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
+        del fb
+    
+        # vertex shader
+        vs = Shader('''
+            VERT1.1
+            DCL IN[0], POSITION, CONSTANT
+            DCL IN[1], GENERIC, CONSTANT
+            DCL OUT[0], POSITION, CONSTANT
+            DCL OUT[1], GENERIC, CONSTANT
+            0:MOV OUT[0], IN[0]
+            1:MOV OUT[1], IN[1]
+            2:END
+        ''')
+        #vs.dump()
+        ctx.set_vertex_shader(vs)
+    
+        # fragment shader
+        fs = Shader('''
+            FRAG1.1
+            DCL IN[0], GENERIC[0], LINEAR
+            DCL OUT[0], COLOR, CONSTANT
+            DCL SAMP[0], CONSTANT
+            0:TEX OUT[0], IN[0], SAMP[0], 2D
+            1:END
+        ''')
+        #fs.dump()
+        ctx.set_fragment_shader(fs)
+
+        nverts = 4
+        nattrs = 2
+        verts = FloatArray(nverts * nattrs * 4)
+    
+        x = 0
+        y = 0
+        w = dst_surface.width
+        h = dst_surface.height
+    
+        pos = [
+            [x, y],
+            [x+w, y],
+            [x+w, y+h],
+            [x, y+h],
+        ]
+    
+        tex = [
+            [0.0, 0.0], 
+            [1.0, 0.0], 
+            [1.0, 1.0], 
+            [0.0, 1.0],
+        ]
+    
+        for i in range(0, 4):
+            j = 8*i
+            verts[j + 0] = pos[i][0] # x
+            verts[j + 1] = pos[i][1] # y
+            verts[j + 2] = 0.0 # z
+            verts[j + 3] = 1.0 # w
+            verts[j + 4] = tex[i][0] # s
+            verts[j + 5] = tex[i][1] # r
+            verts[j + 6] = 0.0
+            verts[j + 7] = 1.0
+    
+        ctx.draw_vertices(PIPE_PRIM_TRIANGLE_FAN,
+                          nverts, 
+                          nattrs, 
+                          verts)
+    
+        ctx.flush()
+    
+        self.assert_rgba(dst_surface, x, y, w, h, expected_rgba, 4.0/256, 0.85)
+        
+
+
+def main():
+    dev = Device()
+    suite = TestSuite()
+    
+    targets = [
+        PIPE_TEXTURE_2D,
+        PIPE_TEXTURE_CUBE,
+        #PIPE_TEXTURE_3D,
+    ]
+    
+    formats = [
+        PIPE_FORMAT_A8R8G8B8_UNORM,
+        PIPE_FORMAT_X8R8G8B8_UNORM,
+        #PIPE_FORMAT_A8R8G8B8_SRGB,
+        PIPE_FORMAT_R5G6B5_UNORM,
+        PIPE_FORMAT_A1R5G5B5_UNORM,
+        PIPE_FORMAT_A4R4G4B4_UNORM,
+        #PIPE_FORMAT_Z32_UNORM,
+        #PIPE_FORMAT_Z24S8_UNORM,
+        #PIPE_FORMAT_Z24X8_UNORM,
+        #PIPE_FORMAT_Z16_UNORM,
+        #PIPE_FORMAT_S8_UNORM,
+        PIPE_FORMAT_A8_UNORM,
+        PIPE_FORMAT_L8_UNORM,
+        #PIPE_FORMAT_DXT1_RGB,
+        #PIPE_FORMAT_DXT1_RGBA,
+        #PIPE_FORMAT_DXT3_RGBA,
+        #PIPE_FORMAT_DXT5_RGBA,
+    ]
+    
+    sizes = [64, 32, 16, 8, 4, 2, 1]
+    #sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
+    #sizes = [64]
+    #sizes = [63]
+    
+    faces = [
+        PIPE_TEX_FACE_POS_X,
+        PIPE_TEX_FACE_NEG_X,
+        PIPE_TEX_FACE_POS_Y,
+        PIPE_TEX_FACE_NEG_Y, 
+        PIPE_TEX_FACE_POS_Z, 
+        PIPE_TEX_FACE_NEG_Z,
+    ]
+
+    for target in targets:
+        for format in formats:
+            for size in sizes:
+                if target == PIPE_TEXTURE_3D:
+                    depth = size
+                else:
+                    depth = 1
+                for face in faces:
+                    if target != PIPE_TEXTURE_CUBE and face:
+                        continue
+                    levels = lods(size)
+                    for last_level in range(levels):
+                        for level in range(0, last_level + 1):
+                            zslice = 0
+                            while zslice < depth >> level:
+                                test = TextureTest(
+                                    dev = dev,
+                                    target = target,
+                                    format = format, 
+                                    width = size,
+                                    height = size,
+                                    depth = depth,
+                                    last_level = last_level,
+                                    face = face,
+                                    level = level,
+                                    zslice = zslice,
+                                )
+                                suite.add_test(test)
+                                zslice = (zslice + 1)*2 - 1
+    suite.run()
+
+
+if __name__ == '__main__':
+    main()
old mode 100644 (file)
new mode 100755 (executable)
similarity index 74%
rename from src/gallium/state_trackers/python/tests/texture.py
rename to src/gallium/state_trackers/python/tests/texture_sample.py
index 880a613..a382424
@@ -1,6 +1,7 @@
 #!/usr/bin/env python
 ##########################################################################
 # 
+# Copyright 2009 VMware, Inc.
 # Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
 # All Rights Reserved.
 # 
@@ -19,7 +20,7 @@
 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-# IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
 # ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -27,7 +28,6 @@
 ##########################################################################
 
 
-import sys
 from gallium import *
 from base import *
 
@@ -101,31 +101,18 @@ def is_pot(n):
                 
 class TextureTest(TestCase):
     
-    def description(self):
-        target = {
-            PIPE_TEXTURE_1D: "1d", 
-            PIPE_TEXTURE_2D: "2d", 
-            PIPE_TEXTURE_3D: "3d", 
-            PIPE_TEXTURE_CUBE: "cube",
-        }[self.target]
-        format = formats[self.format]
-        if self.target == PIPE_TEXTURE_CUBE:
-            face = {
-                PIPE_TEX_FACE_POS_X: "+x",
-                PIPE_TEX_FACE_NEG_X: "-x",
-                PIPE_TEX_FACE_POS_Y: "+y",
-                PIPE_TEX_FACE_NEG_Y: "-y", 
-                PIPE_TEX_FACE_POS_Z: "+z", 
-                PIPE_TEX_FACE_NEG_Z: "-z",
-            }[self.face]
-        else:
-            face = ""
-        return "%s %s %ux%ux%u last_level=%u face=%s level=%u zslice=%u" % (
-            target, format, 
-            self.width, self.height, self.depth, self.last_level, 
-            face, self.level, self.zslice, 
-        )
-    
+    tags = (
+        'target',
+        'format',
+        'width',
+        'height',
+        'depth',
+        'last_level',
+        'face',
+        'level',
+        'zslice',
+    )
+
     def test(self):
         dev = self.dev
         
@@ -168,26 +155,9 @@ class TextureTest(TestCase):
         rasterizer = Rasterizer()
         rasterizer.front_winding = PIPE_WINDING_CW
         rasterizer.cull_mode = PIPE_WINDING_NONE
-        rasterizer.bypass_clipping = 1
-        #rasterizer.bypass_vs = 1
+        rasterizer.bypass_vs_clip_and_viewport = 1
         ctx.set_rasterizer(rasterizer)
     
-        # viewport (identity, we setup vertices in wincoords)
-        viewport = Viewport()
-        scale = FloatArray(4)
-        scale[0] = 1.0
-        scale[1] = 1.0
-        scale[2] = 1.0
-        scale[3] = 1.0
-        viewport.scale = scale
-        translate = FloatArray(4)
-        translate[0] = 0.0
-        translate[1] = 0.0
-        translate[2] = 0.0
-        translate[3] = 0.0
-        viewport.translate = translate
-        ctx.set_viewport(viewport)
-    
         # samplers
         sampler = Sampler()
         sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE
@@ -214,7 +184,6 @@ class TextureTest(TestCase):
         
         expected_rgba = FloatArray(height*width*4) 
         texture.get_surface(
-            usage = PIPE_BUFFER_USAGE_CPU_READ|PIPE_BUFFER_USAGE_CPU_WRITE,
             face = face,
             level = level,
             zslice = zslice,
@@ -230,14 +199,19 @@ class TextureTest(TestCase):
             tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET,
         )
 
-        cbuf = cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_GPU_WRITE|PIPE_BUFFER_USAGE_GPU_READ)
+        cbuf = cbuf_tex.get_surface()
         fb = Framebuffer()
         fb.width = width
         fb.height = height
-        fb.num_cbufs = 1
+        fb.nr_cbufs = 1
         fb.set_cbuf(0, cbuf)
         ctx.set_framebuffer(fb)
-        ctx.surface_clear(cbuf, 0x00000000)
+        rgba = FloatArray(4);
+        rgba[0] = 0.5
+        rgba[1] = 0.5
+        rgba[2] = 0.5
+        rgba[3] = 0.5
+        ctx.clear(PIPE_CLEAR_COLOR, rgba, 0.0, 0)
         del fb
     
         # vertex shader
@@ -307,26 +281,9 @@ class TextureTest(TestCase):
     
         ctx.flush()
     
-        cbuf = cbuf_tex.get_surface(usage = PIPE_BUFFER_USAGE_CPU_READ)
+        cbuf = cbuf_tex.get_surface()
         
-        total = h*w
-        different = cbuf.compare_tile_rgba(x, y, w, h, expected_rgba, tol=4.0/256)
-        if different:
-            sys.stderr.write("%u out of %u pixels differ\n" % (different, total))
-
-        if float(total - different)/float(total) < 0.85:
-        
-            if 0:
-                rgba = FloatArray(h*w*4)
-                cbuf.get_tile_rgba(x, y, w, h, rgba)
-                show_image(w, h, Result=rgba, Expected=expected_rgba)
-                save_image(w, h, rgba, "result.png")
-                save_image(w, h, expected_rgba, "expected.png")
-            #sys.exit(0)
-            
-            raise TestFailure
-
-        del ctx
+        self.assert_rgba(cbuf, x, y, w, h, expected_rgba, 4.0/256, 0.85)
         
 
 
@@ -334,43 +291,57 @@ def main():
     dev = Device()
     suite = TestSuite()
     
-    targets = []
-    targets += [PIPE_TEXTURE_2D]
-    targets += [PIPE_TEXTURE_CUBE]
-    targets += [PIPE_TEXTURE_3D]
+    targets = [
+        PIPE_TEXTURE_2D,
+        PIPE_TEXTURE_CUBE,
+        PIPE_TEXTURE_3D,
+    ]
     
-    formats = []
-    formats += [PIPE_FORMAT_A8R8G8B8_UNORM]
-    formats += [PIPE_FORMAT_R5G6B5_UNORM]
-    formats += [PIPE_FORMAT_L8_UNORM]
-    formats += [PIPE_FORMAT_YCBCR]
-    formats += [PIPE_FORMAT_DXT1_RGB]
+    formats = [
+        PIPE_FORMAT_A8R8G8B8_UNORM,
+        PIPE_FORMAT_X8R8G8B8_UNORM,
+        #PIPE_FORMAT_A8R8G8B8_SRGB,
+        PIPE_FORMAT_R5G6B5_UNORM,
+        PIPE_FORMAT_A1R5G5B5_UNORM,
+        PIPE_FORMAT_A4R4G4B4_UNORM,
+        #PIPE_FORMAT_Z32_UNORM,
+        #PIPE_FORMAT_Z24S8_UNORM,
+        #PIPE_FORMAT_Z24X8_UNORM,
+        #PIPE_FORMAT_Z16_UNORM,
+        #PIPE_FORMAT_S8_UNORM,
+        PIPE_FORMAT_A8_UNORM,
+        PIPE_FORMAT_L8_UNORM,
+        PIPE_FORMAT_YCBCR,
+        PIPE_FORMAT_DXT1_RGB,
+        #PIPE_FORMAT_DXT1_RGBA,
+        #PIPE_FORMAT_DXT3_RGBA,
+        #PIPE_FORMAT_DXT5_RGBA,
+    ]
     
     sizes = [64, 32, 16, 8, 4, 2, 1]
     #sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
     #sizes = [64]
     #sizes = [63]
     
+    faces = [
+        PIPE_TEX_FACE_POS_X,
+        PIPE_TEX_FACE_NEG_X,
+        PIPE_TEX_FACE_POS_Y,
+        PIPE_TEX_FACE_NEG_Y, 
+        PIPE_TEX_FACE_POS_Z, 
+        PIPE_TEX_FACE_NEG_Z,
+    ]
+
     for target in targets:
         for format in formats:
             for size in sizes:
-                if target == PIPE_TEXTURE_CUBE:
-                    faces = [
-                        PIPE_TEX_FACE_POS_X,
-                        PIPE_TEX_FACE_NEG_X,
-                        PIPE_TEX_FACE_POS_Y,
-                        PIPE_TEX_FACE_NEG_Y, 
-                        PIPE_TEX_FACE_POS_Z, 
-                        PIPE_TEX_FACE_NEG_Z,
-                    ]
-                    #faces = [PIPE_TEX_FACE_NEG_X]
-                else:
-                    faces = [0]
                 if target == PIPE_TEXTURE_3D:
                     depth = size
                 else:
                     depth = 1
                 for face in faces:
+                    if target != PIPE_TEXTURE_CUBE and face:
+                        continue
                     levels = lods(size)
                     for last_level in range(levels):
                         for level in range(0, last_level + 1):
diff --git a/src/gallium/state_trackers/python/tests/texture_transfer.py b/src/gallium/state_trackers/python/tests/texture_transfer.py
new file mode 100755 (executable)
index 0000000..e65b425
--- /dev/null
@@ -0,0 +1,179 @@
+#!/usr/bin/env python
+##########################################################################
+# 
+# Copyright 2009 VMware, Inc.
+# Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+# All Rights Reserved.
+# 
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sub license, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+# 
+# The above copyright notice and this permission notice (including the
+# next paragraph) shall be included in all copies or substantial portions
+# of the Software.
+# 
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+# IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+# 
+##########################################################################
+
+
+import os
+
+from gallium import *
+from base import *
+
+
+def lods(*dims):
+    size = max(dims)
+    lods = 0
+    while size:
+        lods += 1
+        size >>= 1
+    return lods
+
+
+class TextureTest(TestCase):
+    
+    tags = (
+        'target',
+        'format',
+        'width',
+        'height',
+        'depth',
+        'last_level',
+        'face',
+        'level',
+        'zslice',
+    )
+
+    def test(self):
+        dev = self.dev
+        
+        target = self.target
+        format = self.format
+        width = self.width
+        height = self.height
+        depth = self.depth
+        last_level = self.last_level
+        face = self.face
+        level = self.level
+        zslice = self.zslice
+        
+        tex_usage = 0
+        
+        texture = dev.texture_create(
+            target = target,
+            format = format, 
+            width = width, 
+            height = height,
+            depth = depth, 
+            last_level = last_level,
+            tex_usage = tex_usage,
+        )
+        if texture is None:
+            raise TestSkip
+        
+        surface = texture.get_surface(face, level, zslice)
+        
+        stride = surface.nblocksx * texture.block.size
+        size = surface.nblocksy * stride
+
+        in_raw = os.urandom(size)
+
+        surface.put_tile_raw(0, 0, surface.width, surface.height, in_raw, stride)
+
+        out_raw = surface.get_tile_raw(0, 0, surface.width, surface.height)
+
+        if in_raw != out_raw:
+            raise TestFailure
+
+
+def main():
+    dev = Device()
+    suite = TestSuite()
+    
+    targets = [
+        PIPE_TEXTURE_2D,
+        PIPE_TEXTURE_CUBE,
+        PIPE_TEXTURE_3D,
+    ]
+    
+    formats = [
+        PIPE_FORMAT_A8R8G8B8_UNORM,
+        PIPE_FORMAT_X8R8G8B8_UNORM,
+        PIPE_FORMAT_A8R8G8B8_SRGB,
+        PIPE_FORMAT_R5G6B5_UNORM,
+        PIPE_FORMAT_A1R5G5B5_UNORM,
+        PIPE_FORMAT_A4R4G4B4_UNORM,
+        PIPE_FORMAT_Z32_UNORM,
+        PIPE_FORMAT_Z24S8_UNORM,
+        PIPE_FORMAT_Z24X8_UNORM,
+        PIPE_FORMAT_Z16_UNORM,
+        PIPE_FORMAT_S8_UNORM,
+        PIPE_FORMAT_A8_UNORM,
+        PIPE_FORMAT_L8_UNORM,
+        PIPE_FORMAT_DXT1_RGB,
+        PIPE_FORMAT_DXT1_RGBA,
+        PIPE_FORMAT_DXT3_RGBA,
+        PIPE_FORMAT_DXT5_RGBA,
+    ]
+    
+    sizes = [64, 32, 16, 8, 4, 2, 1]
+    #sizes = [1020, 508, 252, 62, 30, 14, 6, 3]
+    #sizes = [64]
+    #sizes = [63]
+    
+    faces = [
+        PIPE_TEX_FACE_POS_X,
+        PIPE_TEX_FACE_NEG_X,
+        PIPE_TEX_FACE_POS_Y,
+        PIPE_TEX_FACE_NEG_Y, 
+        PIPE_TEX_FACE_POS_Z, 
+        PIPE_TEX_FACE_NEG_Z,
+    ]
+
+    for target in targets:
+        for format in formats:
+            for size in sizes:
+                if target == PIPE_TEXTURE_3D:
+                    depth = size
+                else:
+                    depth = 1
+                for face in faces:
+                    if target != PIPE_TEXTURE_CUBE and face:
+                        continue
+                    levels = lods(size)
+                    for last_level in range(levels):
+                        for level in range(0, last_level + 1):
+                            zslice = 0
+                            while zslice < depth >> level:
+                                test = TextureTest(
+                                    dev = dev,
+                                    target = target,
+                                    format = format, 
+                                    width = size,
+                                    height = size,
+                                    depth = depth,
+                                    last_level = last_level,
+                                    face = face,
+                                    level = level,
+                                    zslice = zslice,
+                                )
+                                suite.add_test(test)
+                                zslice = (zslice + 1)*2 - 1
+    suite.run()
+
+
+if __name__ == '__main__':
+    main()
diff --git a/src/gallium/state_trackers/python/tests/tree.py b/src/gallium/state_trackers/python/tests/tree.py
new file mode 100755 (executable)
index 0000000..0c1bcda
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+# 
+# See also:
+#  http://www.ailab.si/orange/doc/ofb/c_otherclass.htm
+
+import os.path
+import sys
+
+import orange
+import orngTree
+
+for arg in sys.argv[1:]:
+    name, ext = os.path.splitext(arg)
+
+    data = orange.ExampleTable(arg)
+
+    tree = orngTree.TreeLearner(data, sameMajorityPruning=1, mForPruning=2)
+
+    orngTree.printTxt(tree)
+
+    file(name+'.txt', 'wt').write(orngTree.dumpTree(tree) + '\n')
+
+    orngTree.printDot(tree, fileName=name+'.dot', nodeShape='ellipse', leafShape='box')
index 89df8b0..f890225 100644 (file)
 #include "pipe/p_context.h"
 #include "state_tracker/st_context.h"
 #include "state_tracker/st_public.h"
+
+#ifdef DEBUG
+#include "trace/tr_screen.h"
+#include "trace/tr_context.h"
+#endif
+
 #include "shared/stw_device.h"
 #include "shared/stw_winsys.h"
 #include "shared/stw_framebuffer.h"
@@ -77,6 +83,7 @@ stw_create_layer_context(
    const struct pixelformat_info *pf = NULL;
    struct stw_context *ctx = NULL;
    GLvisual *visual = NULL;
+   struct pipe_screen *screen = NULL;
    struct pipe_context *pipe = NULL;
    UINT_PTR hglrc = 0;
 
@@ -120,10 +127,24 @@ stw_create_layer_context(
    if (visual == NULL) 
       goto fail;
 
-   pipe = stw_dev->stw_winsys->create_context( stw_dev->screen );
+   screen = stw_dev->screen;
+
+#ifdef DEBUG
+   /* Unwrap screen */
+   if(stw_dev->trace_running)
+      screen = trace_screen(screen)->screen;
+#endif
+
+   pipe = stw_dev->stw_winsys->create_context( screen );
    if (pipe == NULL) 
       goto fail;
 
+#ifdef DEBUG
+   /* Wrap context */
+   if(stw_dev->trace_running)
+      pipe = trace_context_create(stw_dev->screen, pipe);
+#endif
+
    assert(!pipe->priv);
    pipe->priv = hdc;
 
@@ -317,10 +338,6 @@ stw_make_current(
       fb = framebuffer_create( hdc, visual, width, height );
       if (fb == NULL)
          return FALSE;
-
-      fb->dib_hDC = CreateCompatibleDC( hdc );
-      fb->hbmDIB = NULL;
-      fb->pbPixels = NULL;
    }
 
    if (ctx && fb) {
index 3c1eb1a..51936c2 100644 (file)
 #include "util/u_debug.h"
 #include "pipe/p_screen.h"
 
+#ifdef DEBUG
+#include "trace/tr_screen.h"
+#include "trace/tr_texture.h"
+#endif
+
 #include "shared/stw_device.h"
 #include "shared/stw_winsys.h"
 #include "shared/stw_pixelformat.h"
@@ -52,13 +57,20 @@ struct stw_device *stw_dev = NULL;
  */
 static void 
 st_flush_frontbuffer(struct pipe_screen *screen,
-                     struct pipe_surface *surf,
+                     struct pipe_surface *surface,
                      void *context_private )
 {
    const struct stw_winsys *stw_winsys = stw_dev->stw_winsys;
    HDC hdc = (HDC)context_private;
    
-   stw_winsys->flush_frontbuffer(screen, surf, hdc);
+#ifdef DEBUG
+   if(stw_dev->trace_running) {
+      screen = trace_screen(screen)->screen;
+      surface = trace_surface(surface)->surface;
+   }
+#endif
+   
+   stw_winsys->flush_frontbuffer(screen, surface, hdc);
 }
 
 
@@ -66,6 +78,7 @@ boolean
 st_init(const struct stw_winsys *stw_winsys)
 {
    static struct stw_device stw_dev_storage;
+   struct pipe_screen *screen;
 
    debug_printf("%s\n", __FUNCTION__);
    
@@ -86,10 +99,17 @@ st_init(const struct stw_winsys *stw_winsys)
    _glthread_INIT_MUTEX(OneTimeLock);
 #endif
 
-   stw_dev->screen = stw_winsys->create_screen();
-   if(!stw_dev->screen)
+   screen = stw_winsys->create_screen();
+   if(!screen)
       goto error1;
 
+#ifdef DEBUG
+   stw_dev->screen = trace_screen_create(screen);
+   stw_dev->trace_running = stw_dev->screen != screen ? TRUE : FALSE;
+#else
+   stw_dev->screen = screen;
+#endif
+   
    stw_dev->screen->flush_frontbuffer = st_flush_frontbuffer;
    
    pipe_mutex_init( stw_dev->mutex );
@@ -130,7 +150,7 @@ st_cleanup_thread(void)
 void
 st_cleanup(void)
 {
-   UINT_PTR i;
+   unsigned i;
 
    debug_printf("%s\n", __FUNCTION__);
 
index 6a9cee0..703cb67 100644 (file)
@@ -39,8 +39,13 @@ struct pipe_screen;
 struct stw_device
 {
    const struct stw_winsys *stw_winsys;
+   
    struct pipe_screen *screen;
    
+#ifdef DEBUG
+   boolean trace_running;
+#endif
+   
    pipe_mutex mutex;
 
    struct handle_table *ctx_table;
index 17c96c4..c96c4b8 100644 (file)
 #include "pipe/p_screen.h"
 #include "state_tracker/st_context.h"
 #include "state_tracker/st_public.h"
+
+#ifdef DEBUG
+#include "trace/tr_screen.h"
+#include "trace/tr_texture.h"
+#endif
+
 #include "stw_framebuffer.h"
 #include "stw_device.h"
 #include "stw_public.h"
@@ -44,16 +50,6 @@ framebuffer_resize(
    GLuint width,
    GLuint height )
 {
-   if (fb->hbmDIB == NULL || fb->stfb->Base.Width != width || fb->stfb->Base.Height != height) {
-      if (fb->hbmDIB)
-         DeleteObject( fb->hbmDIB );
-
-      fb->hbmDIB = CreateCompatibleBitmap(
-         fb->hDC,
-         width,
-         height );
-   }
-
    st_resize_framebuffer( fb->stfb, width, height );
 }
 
@@ -80,6 +76,14 @@ window_proc(
 }
 
 static INLINE boolean
+stw_is_supported_color(enum pipe_format format)
+{
+   struct pipe_screen *screen = stw_dev->screen;
+   return screen->is_format_supported(screen, format, PIPE_TEXTURE_2D, 
+                                      PIPE_TEXTURE_USAGE_RENDER_TARGET, 0);
+}
+
+static INLINE boolean
 stw_is_supported_depth_stencil(enum pipe_format format)
 {
    struct pipe_screen *screen = stw_dev->screen;
@@ -99,13 +103,33 @@ framebuffer_create(
    struct stw_framebuffer *fb;
    enum pipe_format colorFormat, depthFormat, stencilFormat;
 
-   fb = CALLOC_STRUCT( stw_framebuffer );
-   if (fb == NULL)
-      return NULL;
-
    /* Determine PIPE_FORMATs for buffers.
     */
-   colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
+
+   if(visual->alphaBits <= 0 && visual->redBits <= 5 && visual->blueBits <= 6 && visual->greenBits <= 5 && 
+      stw_is_supported_color(PIPE_FORMAT_R5G6B5_UNORM)) {
+      colorFormat = PIPE_FORMAT_R5G6B5_UNORM;
+   }
+   else if(visual->alphaBits <= 0 && visual->redBits <= 8 && visual->blueBits <= 8 && visual->greenBits <= 8 && 
+      stw_is_supported_color(PIPE_FORMAT_X8R8G8B8_UNORM)) {
+      colorFormat = PIPE_FORMAT_X8R8G8B8_UNORM;
+   }
+   else if(visual->alphaBits <= 1 && visual->redBits <= 5 && visual->blueBits <= 5 && visual->greenBits <= 5 &&
+      stw_is_supported_color(PIPE_FORMAT_A1R5G5B5_UNORM)) {
+      colorFormat = PIPE_FORMAT_A1R5G5B5_UNORM;
+   }
+   else if(visual->alphaBits <= 4 && visual->redBits <= 4 && visual->blueBits <= 4 && visual->greenBits <= 4 && 
+      stw_is_supported_color(PIPE_FORMAT_A4R4G4B4_UNORM)) {
+      colorFormat = PIPE_FORMAT_A4R4G4B4_UNORM;
+   }
+   else if(visual->alphaBits <= 8 && visual->redBits <= 8 && visual->blueBits <= 8 && visual->greenBits <= 8 && 
+      stw_is_supported_color(PIPE_FORMAT_A8R8G8B8_UNORM)) {
+      colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM;
+   }
+   else {
+      assert(0);
+      return NULL;
+   }
 
    if (visual->depthBits == 0)
       depthFormat = PIPE_FORMAT_NONE;
@@ -151,6 +175,10 @@ framebuffer_create(
       stencilFormat = PIPE_FORMAT_NONE;
    }
 
+   fb = CALLOC_STRUCT( stw_framebuffer );
+   if (fb == NULL)
+      return NULL;
+
    fb->stfb = st_create_framebuffer(
       visual,
       colorFormat,
@@ -167,10 +195,10 @@ framebuffer_create(
     */
    fb->hWnd = WindowFromDC( hdc );
    if (fb->hWnd != NULL) {
-      fb->WndProc = (WNDPROC) SetWindowLong(
+      fb->WndProc = (WNDPROC) SetWindowLongPtr(
          fb->hWnd,
-         GWL_WNDPROC,
-         (LONG) window_proc );
+         GWLP_WNDPROC,
+         (LONG_PTR) window_proc );
    }
 
    fb->next = fb_head;
@@ -188,10 +216,10 @@ framebuffer_destroy(
    while (pfb != NULL) {
       if (pfb == fb) {
          if (fb->hWnd != NULL) {
-            SetWindowLong(
+            SetWindowLongPtr(
                fb->hWnd,
-               GWL_WNDPROC,
-               (LONG) fb->WndProc );
+               GWLP_WNDPROC,
+               (LONG_PTR) fb->WndProc );
          }
 
          *link = fb->next;
@@ -224,7 +252,8 @@ stw_swap_buffers(
    HDC hdc )
 {
    struct stw_framebuffer *fb;
-   struct pipe_surface *surf;
+   struct pipe_screen *screen;
+   struct pipe_surface *surface;
 
    fb = framebuffer_from_hdc( hdc );
    if (fb == NULL)
@@ -235,11 +264,20 @@ stw_swap_buffers(
     */
    st_notify_swapbuffers( fb->stfb );
 
-   st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surf );
+   screen = stw_dev->screen;
+   
+   if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surface ))
+      /* FIXME: this shouldn't happen, but does on glean */
+      return FALSE;
 
-   stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen,
-                                          surf,
-                                          hdc );
+#ifdef DEBUG
+   if(stw_dev->trace_running) {
+      screen = trace_screen(screen)->screen;
+      surface = trace_surface(surface)->surface;
+   }
+#endif
 
+   stw_dev->stw_winsys->flush_frontbuffer( screen, surface, hdc );
+   
    return TRUE;
 }
index 2e16e42..5abdf18 100644 (file)
@@ -36,12 +36,7 @@ struct stw_framebuffer
 {
    struct st_framebuffer *stfb;
    HDC hDC;
-   int pixelformat;
    BYTE cColorBits;
-   HDC dib_hDC;
-   HBITMAP hbmDIB;
-   HBITMAP hOldBitmap;
-   PBYTE pbPixels;
    HWND hWnd;
    WNDPROC WndProc;
    struct stw_framebuffer *next;
index aef5210..a9e9f26 100644 (file)
@@ -52,3 +52,8 @@ if env['dri']:
                SConscript([
                        'intel/SConscript',
                ])
+
+       if 'radeon' in env['winsys']:
+               SConscript([
+                       'radeon/SConscript',
+               ])
index c4cbbc2..0b45b1f 100644 (file)
@@ -199,7 +199,8 @@ dri_surface_from_handle(struct pipe_screen *screen,
       return NULL;
 
    memset(&templat, 0, sizeof(templat));
-   templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
+   templat.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY |
+                       NOUVEAU_TEXTURE_USAGE_LINEAR;
    templat.target = PIPE_TEXTURE_2D;
    templat.last_level = 0;
    templat.depth[0] = 1;
index 2435211..8f99055 100644 (file)
@@ -1,29 +1,7 @@
 Import('*')
 
-if 'mesa' in env['statetrackers']:
-
-       env = drienv.Clone()
-
-       DRIVER_SOURCES = [
-               'radeon_buffer.c',
-               'radeon_context.c',
-               'radeon_screen.c',
-               'radeon_winsys_softpipe.c',
-       ]
+SConscript(['core/SConscript',])
 
-       sources = \
-               COMMON_GALLIUM_SOURCES + \
-               DRIVER_SOURCES
-
-       drivers = [
-               softpipe,
-               r300
-       ]
-
-       # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions
-       env.SharedLibrary(
-               target ='radeon_dri.so',
-               source = sources,
-               LIBS = drivers + mesa + auxiliaries + env['LIBS'],
-       )
+if 'mesa' in env['statetrackers']:
 
+    SConscript(['dri2/SConscript'])
diff --git a/src/gallium/winsys/drm/radeon/core/SConscript b/src/gallium/winsys/drm/radeon/core/SConscript
new file mode 100644 (file)
index 0000000..578174e
--- /dev/null
@@ -0,0 +1,17 @@
+Import('*')
+
+env = drienv.Clone()
+
+radeon_sources = [
+    'radeon_buffer.c',
+    'radeon_drm.c',
+    'radeon_r300.c',
+    'radeon_winsys_softpipe.c',
+]
+
+env.Append(CPPPATH = '#/src/gallium/drivers/r300')
+
+env.ConvenienceLibrary(
+    target ='radeonwinsys',
+    source = radeon_sources,
+)
index 9dca510..611ee68 100644 (file)
@@ -82,7 +82,8 @@ static struct pipe_buffer *radeon_buffer_user_create(struct pipe_winsys *ws,
 {
     struct radeon_pipe_buffer *radeon_buffer;
 
-    radeon_buffer = (struct radeon_pipe_buffer*)radeon_buffer_create(ws, 0, 0, bytes);
+    radeon_buffer =
+        (struct radeon_pipe_buffer*)radeon_buffer_create(ws, 0, 0, bytes);
     if (radeon_buffer == NULL) {
         return NULL;
     }
@@ -94,7 +95,8 @@ static struct pipe_buffer *radeon_buffer_user_create(struct pipe_winsys *ws,
 
 static void radeon_buffer_del(struct pipe_buffer *buffer)
 {
-    struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer;
+    struct radeon_pipe_buffer *radeon_buffer =
+        (struct radeon_pipe_buffer*)buffer;
 
     radeon_bo_unref(radeon_buffer->bo);
     free(radeon_buffer);
@@ -104,7 +106,8 @@ static void *radeon_buffer_map(struct pipe_winsys *ws,
                                struct pipe_buffer *buffer,
                                unsigned flags)
 {
-    struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer;
+    struct radeon_pipe_buffer *radeon_buffer =
+        (struct radeon_pipe_buffer*)buffer;
     int write = 0;
 
     if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) {
@@ -120,9 +123,11 @@ static void *radeon_buffer_map(struct pipe_winsys *ws,
     return radeon_buffer->bo->ptr;
 }
 
-static void radeon_buffer_unmap(struct pipe_winsys *ws, struct pipe_buffer *buffer)
+static void radeon_buffer_unmap(struct pipe_winsys *ws,
+                                struct pipe_buffer *buffer)
 {
-    struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer;
+    struct radeon_pipe_buffer *radeon_buffer =
+        (struct radeon_pipe_buffer*)buffer;
 
     radeon_bo_unmap(radeon_buffer->bo);
 }
@@ -151,7 +156,7 @@ static void radeon_flush_frontbuffer(struct pipe_winsys *pipe_winsys,
                                      struct pipe_surface *pipe_surface,
                                      void *context_private)
 {
-    /* TODO: call dri2CopyRegion */
+    /* XXX TODO: call dri2CopyRegion */
 }
 
 struct radeon_winsys* radeon_pipe_winsys(int fd)
index 40ad0fc..163422f 100644 (file)
@@ -59,9 +59,10 @@ struct radeon_winsys {
 };
 
 struct radeon_winsys* radeon_pipe_winsys(int fb);
+#if 0
 struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_context,
                                              uint32_t handle,
                                              enum pipe_format format,
                                              int w, int h, int pitch);
-
+#endif
 #endif
index c7b6813..293b6c2 100644 (file)
@@ -39,7 +39,13 @@ static void radeon_r300_write_cs_reloc(struct radeon_cs* cs,
 
 static void radeon_r300_flush_cs(struct radeon_cs* cs)
 {
-    radeon_cs_emit(cs);
+    int retval = 0;
+
+    retval = radeon_cs_emit(cs);
+    if (retval) {
+        debug_printf("radeon: Bad CS, dumping...\n");
+        radeon_cs_print(cs, stderr);
+    }
     radeon_cs_erase(cs);
 }
 
@@ -79,10 +85,15 @@ struct r300_winsys*
 radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys)
 {
     struct r300_winsys* winsys = CALLOC_STRUCT(r300_winsys);
+    struct radeon_cs_manager* csm;
+
+    if (winsys == NULL) {
+        return NULL;
+    }
 
     do_ioctls(winsys, fd);
 
-    struct radeon_cs_manager* csm = radeon_cs_manager_gem_ctor(fd);
+    csm = radeon_cs_manager_gem_ctor(fd);
 
     winsys->cs = radeon_cs_create(csm, 1024 * 64 / 4);
 
index 226e166..33f9ac1 100644 (file)
@@ -39,16 +39,17 @@ struct radeon_softpipe_winsys {
 /**
  * Return list of surface formats supported by this driver.
  */
-static boolean radeon_is_format_supported(struct softpipe_winsys *sws, uint format)
+static boolean radeon_is_format_supported(struct softpipe_winsys *sws,
+                                          uint format)
 {
     switch (format) {
-    case PIPE_FORMAT_A8R8G8B8_UNORM:
-    case PIPE_FORMAT_R5G6B5_UNORM:
-    case PIPE_FORMAT_Z24S8_UNORM:
-        return TRUE;
-    default:
-        break;
-    };
+        case PIPE_FORMAT_A8R8G8B8_UNORM:
+        case PIPE_FORMAT_R5G6B5_UNORM:
+        case PIPE_FORMAT_Z24S8_UNORM:
+            return TRUE;
+        default:
+            break;
+    }
     return FALSE;
 }
 
diff --git a/src/gallium/winsys/drm/radeon/dri2/SConscript b/src/gallium/winsys/drm/radeon/dri2/SConscript
new file mode 100644 (file)
index 0000000..f2cdee9
--- /dev/null
@@ -0,0 +1,14 @@
+Import('*')
+
+env = drienv.Clone()
+
+drivers = [
+    softpipe,
+    r300
+]
+
+env.SharedLibrary(
+    target ='radeon_dri.so',
+    source = COMMON_GALLIUM_SOURCES,
+    LIBS = drivers + mesa + auxiliaries + env['LIBS'],
+)
diff --git a/src/gallium/winsys/drm/radeon/python/README b/src/gallium/winsys/drm/radeon/python/README
new file mode 100644 (file)
index 0000000..d9e49bc
--- /dev/null
@@ -0,0 +1,15 @@
+Python bindings for the radeon gallium driver.
+
+
+See gallium/src/gallium/state_trackers/python/README for more information.
+
+
+Build as:
+
+  scons debug=1 statetrackers=python winsys=drm/radeon/python
+  
+Run as:
+
+  export PYTHONPATH=$PWD/build/linux-x86-debug/gallium/winsys/drm/radeon/python:$PWD/build/linux-x86-debug/gallium/state_trackers/python 
+  python src/gallium/state_trackers/python/samples/tri.py
diff --git a/src/gallium/winsys/drm/radeon/python/SConscript b/src/gallium/winsys/drm/radeon/python/SConscript
new file mode 100644 (file)
index 0000000..3200fd8
--- /dev/null
@@ -0,0 +1,33 @@
+import os.path
+
+Import('*')
+
+if env['platform'] == 'linux':
+
+    env = env.Clone()
+    
+    env.Tool('python')
+    
+    env.ParseConfig('pkg-config --cflags --libs libdrm')
+    
+    env.Prepend(CPPPATH = [
+        '#src/gallium/state_trackers/python',
+        '../core',
+    ])
+    
+    drivers = [
+        softpipe,
+        radeon,
+        trace,
+    ]
+    
+    sources = [
+        'radeon_hardpipe_winsys.c',
+        'xf86dri.c',
+    ]
+    
+    env.SharedLibrary(
+        target ='_gallium',
+        source = sources,
+        LIBS = [pyst] + drivers + auxiliaries + env['LIBS'],
+    )
diff --git a/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c b/src/gallium/winsys/drm/radeon/python/radeon_hardpipe_winsys.c
new file mode 100644 (file)
index 0000000..c3ec24a
--- /dev/null
@@ -0,0 +1,140 @@
+ /**************************************************************************
+ * 
+ * Copyright 2009 VMware, Inc.
+ * All Rights Reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ **************************************************************************/
+
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <drm/drm.h>
+
+#include "pipe/p_screen.h"
+#include "pipe/p_context.h"
+
+#include "st_winsys.h"
+
+#include "radeon_winsys.h"
+
+#include "xf86dri.h"
+
+
+/* XXX: Force init_gallium symbol to be linked */
+extern void init_gallium(void);
+void (*force_init_gallium_linkage)(void) = &init_gallium;
+
+
+static struct pipe_screen *
+radeon_hardpipe_screen_create(void)
+{
+   Display *dpy;
+   Window rootWin;
+   XWindowAttributes winAttr;
+   int isCapable;
+   int screen;
+   char *driverName;
+   char *curBusID;
+   unsigned magic;
+   int ddxDriverMajor;
+   int ddxDriverMinor;
+   int ddxDriverPatch;
+   drm_handle_t sAreaOffset;
+   int ret;
+   int drmFD;
+   drm_context_t hHWContext;
+   XID id;
+
+   dpy = XOpenDisplay(":0");
+   if (!dpy) {
+      fprintf(stderr, "Open Display Failed\n");
+      return NULL;
+   }
+
+   screen = DefaultScreen(dpy);
+   rootWin = RootWindow(dpy, screen);
+   XGetWindowAttributes(dpy, rootWin, &winAttr);
+
+   ret = uniDRIQueryDirectRenderingCapable(dpy, screen, &isCapable);
+   if (!ret || !isCapable) {
+      fprintf(stderr, "No DRI on this display:sceen\n");
+      goto error;
+   }
+
+   if (!uniDRIOpenConnection(dpy, screen, &sAreaOffset,
+                             &curBusID)) {
+      fprintf(stderr, "Could not open DRI connection.\n");
+      goto error;
+   }
+
+   if (!uniDRIGetClientDriverName(dpy, screen, &ddxDriverMajor,
+                                  &ddxDriverMinor, &ddxDriverPatch,
+                                  &driverName)) {
+      fprintf(stderr, "Could not get DRI driver name.\n");
+      goto error;
+   }
+
+   if ((drmFD = drmOpen(NULL, curBusID)) < 0) {
+      perror("DRM Device could not be opened");
+      goto error;
+   }
+
+   drmGetMagic(drmFD, &magic);
+   if (!uniDRIAuthConnection(dpy, screen, magic)) {
+      fprintf(stderr, "Could not get X server to authenticate us.\n");
+      goto error;
+   }
+
+   if (!uniDRICreateContext(dpy, screen, winAttr.visual,
+                            &id, &hHWContext)) {
+      fprintf(stderr, "Could not create DRI context.\n");
+      goto error;
+   }
+
+   /* FIXME: create a radeon pipe_screen from drmFD and hHWContext */
+
+   return NULL;
+   
+error:
+   return NULL;
+}
+
+
+static struct pipe_context *
+radeon_hardpipe_context_create(struct pipe_screen *screen)
+{
+   /* FIXME: create a radon pipe_context from screen */
+
+   return NULL;
+}
+
+
+const struct st_winsys st_hardpipe_winsys = {
+   &radeon_hardpipe_screen_create,
+   &radeon_hardpipe_context_create,
+};
+
diff --git a/src/gallium/winsys/drm/radeon/python/xf86dri.c b/src/gallium/winsys/drm/radeon/python/xf86dri.c
new file mode 100644 (file)
index 0000000..1736f1e
--- /dev/null
@@ -0,0 +1,605 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Kevin E. Martin <martin@valinux.com>
+ *   Jens Owen <jens@tungstengraphics.com>
+ *   Rickard E. (Rik) Faith <faith@valinux.com>
+ *
+ */
+
+/* THIS IS NOT AN X CONSORTIUM STANDARD */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define NEED_REPLIES
+#include <X11/Xlibint.h>
+#include <X11/extensions/Xext.h>
+#include <X11/extensions/extutil.h>
+#include "xf86dristr.h"
+
+static XExtensionInfo _xf86dri_info_data;
+static XExtensionInfo *xf86dri_info = &_xf86dri_info_data;
+static char xf86dri_extension_name[] = XF86DRINAME;
+
+#define uniDRICheckExtension(dpy,i,val) \
+  XextCheckExtension (dpy, i, xf86dri_extension_name, val)
+
+/*****************************************************************************
+ *                                                                           *
+ *                        private utility routines                          *
+ *                                                                           *
+ *****************************************************************************/
+
+static int close_display(Display * dpy, XExtCodes * extCodes);
+static /* const */ XExtensionHooks xf86dri_extension_hooks = {
+    NULL,                             /* create_gc */
+    NULL,                             /* copy_gc */
+    NULL,                             /* flush_gc */
+    NULL,                             /* free_gc */
+    NULL,                             /* create_font */
+    NULL,                             /* free_font */
+    close_display,                    /* close_display */
+    NULL,                             /* wire_to_event */
+    NULL,                             /* event_to_wire */
+    NULL,                             /* error */
+    NULL,                             /* error_string */
+};
+
+static
+XEXT_GENERATE_FIND_DISPLAY(find_display, xf86dri_info,
+                          xf86dri_extension_name, &xf86dri_extension_hooks,
+                          0, NULL)
+
+    static XEXT_GENERATE_CLOSE_DISPLAY(close_display, xf86dri_info)
+
+/*****************************************************************************
+ *                                                                           *
+ *                 public XFree86-DRI Extension routines                    *
+ *                                                                           *
+ *****************************************************************************/
+#if 0
+#include <stdio.h>
+#define TRACE(msg)  fprintf(stderr,"uniDRI%s\n", msg);
+#else
+#define TRACE(msg)
+#endif
+    Bool uniDRIQueryExtension(dpy, event_basep, error_basep)
+    Display *dpy;
+    int *event_basep, *error_basep;
+{
+    XExtDisplayInfo *info = find_display(dpy);
+
+    TRACE("QueryExtension...");
+    if (XextHasExtension(info)) {
+       *event_basep = info->codes->first_event;
+       *error_basep = info->codes->first_error;
+       TRACE("QueryExtension... return True");
+       return True;
+    } else {
+       TRACE("QueryExtension... return False");
+       return False;
+    }
+}
+
+Bool
+uniDRIQueryVersion(dpy, majorVersion, minorVersion, patchVersion)
+    Display *dpy;
+    int *majorVersion;
+    int *minorVersion;
+    int *patchVersion;
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRIQueryVersionReply rep;
+    xXF86DRIQueryVersionReq *req;
+
+    TRACE("QueryVersion...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRIQueryVersion, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRIQueryVersion;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("QueryVersion... return False");
+       return False;
+    }
+    *majorVersion = rep.majorVersion;
+    *minorVersion = rep.minorVersion;
+    *patchVersion = rep.patchVersion;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("QueryVersion... return True");
+    return True;
+}
+
+Bool
+uniDRIQueryDirectRenderingCapable(dpy, screen, isCapable)
+    Display *dpy;
+    int screen;
+    Bool *isCapable;
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRIQueryDirectRenderingCapableReply rep;
+    xXF86DRIQueryDirectRenderingCapableReq *req;
+
+    TRACE("QueryDirectRenderingCapable...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRIQueryDirectRenderingCapable, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRIQueryDirectRenderingCapable;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("QueryDirectRenderingCapable... return False");
+       return False;
+    }
+    *isCapable = rep.isCapable;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("QueryDirectRenderingCapable... return True");
+    return True;
+}
+
+Bool
+uniDRIOpenConnection(dpy, screen, hSAREA, busIdString)
+    Display *dpy;
+    int screen;
+    drm_handle_t *hSAREA;
+    char **busIdString;
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRIOpenConnectionReply rep;
+    xXF86DRIOpenConnectionReq *req;
+
+    TRACE("OpenConnection...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRIOpenConnection, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRIOpenConnection;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("OpenConnection... return False");
+       return False;
+    }
+
+    *hSAREA = rep.hSAREALow;
+#ifdef LONG64
+    if (sizeof(drm_handle_t) == 8) {
+       *hSAREA |= ((unsigned long)rep.hSAREAHigh) << 32;
+    }
+#endif
+    if (rep.length) {
+       if (!(*busIdString = (char *)Xcalloc(rep.busIdStringLength + 1, 1))) {
+           _XEatData(dpy, ((rep.busIdStringLength + 3) & ~3));
+           UnlockDisplay(dpy);
+           SyncHandle();
+           TRACE("OpenConnection... return False");
+           return False;
+       }
+       _XReadPad(dpy, *busIdString, rep.busIdStringLength);
+    } else {
+       *busIdString = NULL;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("OpenConnection... return True");
+    return True;
+}
+
+Bool
+uniDRIAuthConnection(dpy, screen, magic)
+    Display *dpy;
+    int screen;
+    drm_magic_t magic;
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRIAuthConnectionReq *req;
+    xXF86DRIAuthConnectionReply rep;
+
+    TRACE("AuthConnection...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRIAuthConnection, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRIAuthConnection;
+    req->screen = screen;
+    req->magic = magic;
+    rep.authenticated = 0;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse) || !rep.authenticated) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("AuthConnection... return False");
+       return False;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("AuthConnection... return True");
+    return True;
+}
+
+Bool
+uniDRICloseConnection(dpy, screen)
+    Display *dpy;
+    int screen;
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRICloseConnectionReq *req;
+
+    TRACE("CloseConnection...");
+
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRICloseConnection, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRICloseConnection;
+    req->screen = screen;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("CloseConnection... return True");
+    return True;
+}
+
+Bool
+uniDRIGetClientDriverName(dpy, screen, ddxDriverMajorVersion,
+                         ddxDriverMinorVersion, ddxDriverPatchVersion,
+                         clientDriverName)
+    Display *dpy;
+    int screen;
+    int *ddxDriverMajorVersion;
+    int *ddxDriverMinorVersion;
+    int *ddxDriverPatchVersion;
+    char **clientDriverName;
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRIGetClientDriverNameReply rep;
+    xXF86DRIGetClientDriverNameReq *req;
+
+    TRACE("GetClientDriverName...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRIGetClientDriverName, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRIGetClientDriverName;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("GetClientDriverName... return False");
+       return False;
+    }
+
+    *ddxDriverMajorVersion = rep.ddxDriverMajorVersion;
+    *ddxDriverMinorVersion = rep.ddxDriverMinorVersion;
+    *ddxDriverPatchVersion = rep.ddxDriverPatchVersion;
+
+    if (rep.length) {
+       if (!(*clientDriverName =
+             (char *)Xcalloc(rep.clientDriverNameLength + 1, 1))) {
+           _XEatData(dpy, ((rep.clientDriverNameLength + 3) & ~3));
+           UnlockDisplay(dpy);
+           SyncHandle();
+           TRACE("GetClientDriverName... return False");
+           return False;
+       }
+       _XReadPad(dpy, *clientDriverName, rep.clientDriverNameLength);
+    } else {
+       *clientDriverName = NULL;
+    }
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("GetClientDriverName... return True");
+    return True;
+}
+
+Bool
+uniDRICreateContextWithConfig(dpy, screen, configID, context, hHWContext)
+    Display *dpy;
+    int screen;
+    int configID;
+    XID *context;
+    drm_context_t *hHWContext;
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRICreateContextReply rep;
+    xXF86DRICreateContextReq *req;
+
+    TRACE("CreateContext...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRICreateContext, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRICreateContext;
+    req->visual = configID;
+    req->screen = screen;
+    *context = XAllocID(dpy);
+    req->context = *context;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("CreateContext... return False");
+       return False;
+    }
+    *hHWContext = rep.hHWContext;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("CreateContext... return True");
+    return True;
+}
+
+Bool
+uniDRICreateContext(dpy, screen, visual, context, hHWContext)
+    Display *dpy;
+    int screen;
+    Visual *visual;
+    XID *context;
+    drm_context_t *hHWContext;
+{
+    return uniDRICreateContextWithConfig(dpy, screen, visual->visualid,
+                                        context, hHWContext);
+}
+
+Bool
+uniDRIDestroyContext(Display * ndpy, int screen, XID context)
+{
+    Display *const dpy = (Display *) ndpy;
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRIDestroyContextReq *req;
+
+    TRACE("DestroyContext...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRIDestroyContext, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRIDestroyContext;
+    req->screen = screen;
+    req->context = context;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("DestroyContext... return True");
+    return True;
+}
+
+Bool
+uniDRICreateDrawable(Display * ndpy, int screen,
+                    Drawable drawable, drm_drawable_t * hHWDrawable)
+{
+    Display *const dpy = (Display *) ndpy;
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRICreateDrawableReply rep;
+    xXF86DRICreateDrawableReq *req;
+
+    TRACE("CreateDrawable...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRICreateDrawable, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRICreateDrawable;
+    req->screen = screen;
+    req->drawable = drawable;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("CreateDrawable... return False");
+       return False;
+    }
+    *hHWDrawable = rep.hHWDrawable;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("CreateDrawable... return True");
+    return True;
+}
+
+Bool
+uniDRIDestroyDrawable(Display * ndpy, int screen, Drawable drawable)
+{
+    Display *const dpy = (Display *) ndpy;
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRIDestroyDrawableReq *req;
+
+    TRACE("DestroyDrawable...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRIDestroyDrawable, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRIDestroyDrawable;
+    req->screen = screen;
+    req->drawable = drawable;
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("DestroyDrawable... return True");
+    return True;
+}
+
+Bool
+uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
+                     unsigned int *index, unsigned int *stamp,
+                     int *X, int *Y, int *W, int *H,
+                     int *numClipRects, drm_clip_rect_t ** pClipRects,
+                     int *backX, int *backY,
+                     int *numBackClipRects,
+                     drm_clip_rect_t ** pBackClipRects)
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRIGetDrawableInfoReply rep;
+    xXF86DRIGetDrawableInfoReq *req;
+    int total_rects;
+
+    TRACE("GetDrawableInfo...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRIGetDrawableInfo, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRIGetDrawableInfo;
+    req->screen = screen;
+    req->drawable = drawable;
+
+    if (!_XReply(dpy, (xReply *) & rep, 1, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("GetDrawableInfo... return False");
+       return False;
+    }
+    *index = rep.drawableTableIndex;
+    *stamp = rep.drawableTableStamp;
+    *X = (int)rep.drawableX;
+    *Y = (int)rep.drawableY;
+    *W = (int)rep.drawableWidth;
+    *H = (int)rep.drawableHeight;
+    *numClipRects = rep.numClipRects;
+    total_rects = *numClipRects;
+
+    *backX = rep.backX;
+    *backY = rep.backY;
+    *numBackClipRects = rep.numBackClipRects;
+    total_rects += *numBackClipRects;
+
+#if 0
+    /* Because of the fix in Xserver/GL/dri/xf86dri.c, this check breaks
+     * backwards compatibility (Because of the >> 2 shift) but the fix
+     * enables multi-threaded apps to work.
+     */
+    if (rep.length != ((((SIZEOF(xXF86DRIGetDrawableInfoReply) -
+                         SIZEOF(xGenericReply) +
+                         total_rects * sizeof(drm_clip_rect_t)) +
+                        3) & ~3) >> 2)) {
+       _XEatData(dpy, rep.length);
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("GetDrawableInfo... return False");
+       return False;
+    }
+#endif
+
+    if (*numClipRects) {
+       int len = sizeof(drm_clip_rect_t) * (*numClipRects);
+
+       *pClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
+       if (*pClipRects)
+           _XRead(dpy, (char *)*pClipRects, len);
+    } else {
+       *pClipRects = NULL;
+    }
+
+    if (*numBackClipRects) {
+       int len = sizeof(drm_clip_rect_t) * (*numBackClipRects);
+
+       *pBackClipRects = (drm_clip_rect_t *) Xcalloc(len, 1);
+       if (*pBackClipRects)
+           _XRead(dpy, (char *)*pBackClipRects, len);
+    } else {
+       *pBackClipRects = NULL;
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("GetDrawableInfo... return True");
+    return True;
+}
+
+Bool
+uniDRIGetDeviceInfo(dpy, screen, hFrameBuffer,
+                   fbOrigin, fbSize, fbStride, devPrivateSize, pDevPrivate)
+    Display *dpy;
+    int screen;
+    drm_handle_t *hFrameBuffer;
+    int *fbOrigin;
+    int *fbSize;
+    int *fbStride;
+    int *devPrivateSize;
+    void **pDevPrivate;
+{
+    XExtDisplayInfo *info = find_display(dpy);
+    xXF86DRIGetDeviceInfoReply rep;
+    xXF86DRIGetDeviceInfoReq *req;
+
+    TRACE("GetDeviceInfo...");
+    uniDRICheckExtension(dpy, info, False);
+
+    LockDisplay(dpy);
+    GetReq(XF86DRIGetDeviceInfo, req);
+    req->reqType = info->codes->major_opcode;
+    req->driReqType = X_XF86DRIGetDeviceInfo;
+    req->screen = screen;
+    if (!_XReply(dpy, (xReply *) & rep, 0, xFalse)) {
+       UnlockDisplay(dpy);
+       SyncHandle();
+       TRACE("GetDeviceInfo... return False");
+       return False;
+    }
+
+    *hFrameBuffer = rep.hFrameBufferLow;
+#ifdef LONG64
+    if (sizeof(drm_handle_t) == 8) {
+       *hFrameBuffer |= ((unsigned long)rep.hFrameBufferHigh) << 32;
+    }
+#endif
+
+    *fbOrigin = rep.framebufferOrigin;
+    *fbSize = rep.framebufferSize;
+    *fbStride = rep.framebufferStride;
+    *devPrivateSize = rep.devPrivateSize;
+
+    if (rep.length) {
+       if (!(*pDevPrivate = (void *)Xcalloc(rep.devPrivateSize, 1))) {
+           _XEatData(dpy, ((rep.devPrivateSize + 3) & ~3));
+           UnlockDisplay(dpy);
+           SyncHandle();
+           TRACE("GetDeviceInfo... return False");
+           return False;
+       }
+       _XRead(dpy, (char *)*pDevPrivate, rep.devPrivateSize);
+    } else {
+       *pDevPrivate = NULL;
+    }
+
+    UnlockDisplay(dpy);
+    SyncHandle();
+    TRACE("GetDeviceInfo... return True");
+    return True;
+}
diff --git a/src/gallium/winsys/drm/radeon/python/xf86dri.h b/src/gallium/winsys/drm/radeon/python/xf86dri.h
new file mode 100644 (file)
index 0000000..bf6de37
--- /dev/null
@@ -0,0 +1,123 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/**
+ * \file xf86dri.h
+ * Protocol numbers and function prototypes for DRI X protocol.
+ *
+ * \author Kevin E. Martin <martin@valinux.com>
+ * \author Jens Owen <jens@tungstengraphics.com>
+ * \author Rickard E. (Rik) Faith <faith@valinux.com>
+ */
+
+#ifndef _XF86DRI_H_
+#define _XF86DRI_H_
+
+#include <stdint.h>
+#include <X11/Xfuncproto.h>
+#include <drm/drm.h>
+
+#define X_XF86DRIQueryVersion                  0
+#define X_XF86DRIQueryDirectRenderingCapable   1
+#define X_XF86DRIOpenConnection                        2
+#define X_XF86DRICloseConnection               3
+#define X_XF86DRIGetClientDriverName           4
+#define X_XF86DRICreateContext                 5
+#define X_XF86DRIDestroyContext                        6
+#define X_XF86DRICreateDrawable                        7
+#define X_XF86DRIDestroyDrawable               8
+#define X_XF86DRIGetDrawableInfo               9
+#define X_XF86DRIGetDeviceInfo                 10
+#define X_XF86DRIAuthConnection                 11
+#define X_XF86DRIOpenFullScreen                 12     /* Deprecated */
+#define X_XF86DRICloseFullScreen                13     /* Deprecated */
+
+#define XF86DRINumberEvents            0
+
+#define XF86DRIClientNotLocal          0
+#define XF86DRIOperationNotSupported   1
+#define XF86DRINumberErrors            (XF86DRIOperationNotSupported + 1)
+
+#ifndef _XF86DRI_SERVER_
+
+_XFUNCPROTOBEGIN
+    Bool uniDRIQueryExtension(Display * dpy, int *event_base,
+                             int *error_base);
+
+Bool uniDRIQueryVersion(Display * dpy, int *majorVersion, int *minorVersion,
+                       int *patchVersion);
+
+Bool uniDRIQueryDirectRenderingCapable(Display * dpy, int screen,
+                                      Bool * isCapable);
+
+Bool uniDRIOpenConnection(Display * dpy, int screen, drm_handle_t * hSAREA,
+                         char **busIDString);
+
+Bool uniDRIAuthConnection(Display * dpy, int screen, drm_magic_t magic);
+
+Bool uniDRICloseConnection(Display * dpy, int screen);
+
+Bool uniDRIGetClientDriverName(Display * dpy, int screen,
+                              int *ddxDriverMajorVersion,
+                              int *ddxDriverMinorVersion,
+                              int *ddxDriverPatchVersion,
+                              char **clientDriverName);
+
+Bool uniDRICreateContext(Display * dpy, int screen, Visual * visual,
+                        XID * ptr_to_returned_context_id,
+                        drm_context_t * hHWContext);
+
+Bool uniDRICreateContextWithConfig(Display * dpy, int screen, int configID,
+                                  XID * ptr_to_returned_context_id,
+                                  drm_context_t * hHWContext);
+
+extern Bool uniDRIDestroyContext(Display * dpy, int screen, XID context_id);
+
+extern Bool uniDRICreateDrawable(Display * dpy, int screen,
+                                Drawable drawable,
+                                drm_drawable_t * hHWDrawable);
+
+extern Bool uniDRIDestroyDrawable(Display * dpy, int screen,
+                                 Drawable drawable);
+
+Bool uniDRIGetDrawableInfo(Display * dpy, int screen, Drawable drawable,
+                          unsigned int *index, unsigned int *stamp,
+                          int *X, int *Y, int *W, int *H,
+                          int *numClipRects, drm_clip_rect_t ** pClipRects,
+                          int *backX, int *backY,
+                          int *numBackClipRects,
+                          drm_clip_rect_t ** pBackClipRects);
+
+Bool uniDRIGetDeviceInfo(Display * dpy, int screen,
+                        drm_handle_t * hFrameBuffer, int *fbOrigin,
+                        int *fbSize, int *fbStride, int *devPrivateSize,
+                        void **pDevPrivate);
+
+_XFUNCPROTOEND
+#endif /* _XF86DRI_SERVER_ */
+#endif /* _XF86DRI_H_ */
diff --git a/src/gallium/winsys/drm/radeon/python/xf86dristr.h b/src/gallium/winsys/drm/radeon/python/xf86dristr.h
new file mode 100644 (file)
index 0000000..d898996
--- /dev/null
@@ -0,0 +1,389 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+Copyright 2000 VA Linux Systems, Inc.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ *   Kevin E. Martin <martin@valinux.com>
+ *   Jens Owen <jens@tungstengraphics.com>
+ *   Rickard E. (Rik) Fiath <faith@valinux.com>
+ *
+ */
+
+#ifndef _XF86DRISTR_H_
+#define _XF86DRISTR_H_
+
+#include "xf86dri.h"
+
+#define XF86DRINAME "XFree86-DRI"
+
+/* The DRI version number.  This was originally set to be the same of the
+ * XFree86 version number.  However, this version is really indepedent of
+ * the XFree86 version.
+ *
+ * Version History:
+ *    4.0.0: Original
+ *    4.0.1: Patch to bump clipstamp when windows are destroyed, 28 May 02
+ *    4.1.0: Add transition from single to multi in DRMInfo rec, 24 Jun 02
+ */
+#define XF86DRI_MAJOR_VERSION  4
+#define XF86DRI_MINOR_VERSION  1
+#define XF86DRI_PATCH_VERSION  0
+
+typedef struct _XF86DRIQueryVersion
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRIQueryVersion */
+    CARD16 length B16;
+} xXF86DRIQueryVersionReq;
+
+#define sz_xXF86DRIQueryVersionReq     4
+
+typedef struct
+{
+    BYTE type;                        /* X_Reply */
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD16 majorVersion B16;          /* major version of DRI protocol */
+    CARD16 minorVersion B16;          /* minor version of DRI protocol */
+    CARD32 patchVersion B32;          /* patch version of DRI protocol */
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+} xXF86DRIQueryVersionReply;
+
+#define sz_xXF86DRIQueryVersionReply   32
+
+typedef struct _XF86DRIQueryDirectRenderingCapable
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* X_DRIQueryDirectRenderingCapable */
+    CARD16 length B16;
+    CARD32 screen B32;
+} xXF86DRIQueryDirectRenderingCapableReq;
+
+#define sz_xXF86DRIQueryDirectRenderingCapableReq      8
+
+typedef struct
+{
+    BYTE type;                        /* X_Reply */
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    BOOL isCapable;
+    BOOL pad2;
+    BOOL pad3;
+    BOOL pad4;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    CARD32 pad8 B32;
+    CARD32 pad9 B32;
+} xXF86DRIQueryDirectRenderingCapableReply;
+
+#define sz_xXF86DRIQueryDirectRenderingCapableReply    32
+
+typedef struct _XF86DRIOpenConnection
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRIOpenConnection */
+    CARD16 length B16;
+    CARD32 screen B32;
+} xXF86DRIOpenConnectionReq;
+
+#define sz_xXF86DRIOpenConnectionReq   8
+
+typedef struct
+{
+    BYTE type;                        /* X_Reply */
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 hSAREALow B32;
+    CARD32 hSAREAHigh B32;
+    CARD32 busIdStringLength B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+    CARD32 pad8 B32;
+} xXF86DRIOpenConnectionReply;
+
+#define sz_xXF86DRIOpenConnectionReply 32
+
+typedef struct _XF86DRIAuthConnection
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRICloseConnection */
+    CARD16 length B16;
+    CARD32 screen B32;
+    CARD32 magic B32;
+} xXF86DRIAuthConnectionReq;
+
+#define sz_xXF86DRIAuthConnectionReq   12
+
+typedef struct
+{
+    BYTE type;
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 authenticated B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+} xXF86DRIAuthConnectionReply;
+
+#define zx_xXF86DRIAuthConnectionReply  32
+
+typedef struct _XF86DRICloseConnection
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRICloseConnection */
+    CARD16 length B16;
+    CARD32 screen B32;
+} xXF86DRICloseConnectionReq;
+
+#define sz_xXF86DRICloseConnectionReq  8
+
+typedef struct _XF86DRIGetClientDriverName
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRIGetClientDriverName */
+    CARD16 length B16;
+    CARD32 screen B32;
+} xXF86DRIGetClientDriverNameReq;
+
+#define sz_xXF86DRIGetClientDriverNameReq      8
+
+typedef struct
+{
+    BYTE type;                        /* X_Reply */
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 ddxDriverMajorVersion B32;
+    CARD32 ddxDriverMinorVersion B32;
+    CARD32 ddxDriverPatchVersion B32;
+    CARD32 clientDriverNameLength B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+} xXF86DRIGetClientDriverNameReply;
+
+#define sz_xXF86DRIGetClientDriverNameReply    32
+
+typedef struct _XF86DRICreateContext
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRICreateContext */
+    CARD16 length B16;
+    CARD32 screen B32;
+    CARD32 visual B32;
+    CARD32 context B32;
+} xXF86DRICreateContextReq;
+
+#define sz_xXF86DRICreateContextReq    16
+
+typedef struct
+{
+    BYTE type;                        /* X_Reply */
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 hHWContext B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+} xXF86DRICreateContextReply;
+
+#define sz_xXF86DRICreateContextReply  32
+
+typedef struct _XF86DRIDestroyContext
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRIDestroyContext */
+    CARD16 length B16;
+    CARD32 screen B32;
+    CARD32 context B32;
+} xXF86DRIDestroyContextReq;
+
+#define sz_xXF86DRIDestroyContextReq   12
+
+typedef struct _XF86DRICreateDrawable
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRICreateDrawable */
+    CARD16 length B16;
+    CARD32 screen B32;
+    CARD32 drawable B32;
+} xXF86DRICreateDrawableReq;
+
+#define sz_xXF86DRICreateDrawableReq   12
+
+typedef struct
+{
+    BYTE type;                        /* X_Reply */
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 hHWDrawable B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+} xXF86DRICreateDrawableReply;
+
+#define sz_xXF86DRICreateDrawableReply 32
+
+typedef struct _XF86DRIDestroyDrawable
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRIDestroyDrawable */
+    CARD16 length B16;
+    CARD32 screen B32;
+    CARD32 drawable B32;
+} xXF86DRIDestroyDrawableReq;
+
+#define sz_xXF86DRIDestroyDrawableReq  12
+
+typedef struct _XF86DRIGetDrawableInfo
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRIGetDrawableInfo */
+    CARD16 length B16;
+    CARD32 screen B32;
+    CARD32 drawable B32;
+} xXF86DRIGetDrawableInfoReq;
+
+#define sz_xXF86DRIGetDrawableInfoReq  12
+
+typedef struct
+{
+    BYTE type;                        /* X_Reply */
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 drawableTableIndex B32;
+    CARD32 drawableTableStamp B32;
+    INT16 drawableX B16;
+    INT16 drawableY B16;
+    INT16 drawableWidth B16;
+    INT16 drawableHeight B16;
+    CARD32 numClipRects B32;
+    INT16 backX B16;
+    INT16 backY B16;
+    CARD32 numBackClipRects B32;
+} xXF86DRIGetDrawableInfoReply;
+
+#define sz_xXF86DRIGetDrawableInfoReply        36
+
+typedef struct _XF86DRIGetDeviceInfo
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRIGetDeviceInfo */
+    CARD16 length B16;
+    CARD32 screen B32;
+} xXF86DRIGetDeviceInfoReq;
+
+#define sz_xXF86DRIGetDeviceInfoReq    8
+
+typedef struct
+{
+    BYTE type;                        /* X_Reply */
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 hFrameBufferLow B32;
+    CARD32 hFrameBufferHigh B32;
+    CARD32 framebufferOrigin B32;
+    CARD32 framebufferSize B32;
+    CARD32 framebufferStride B32;
+    CARD32 devPrivateSize B32;
+} xXF86DRIGetDeviceInfoReply;
+
+#define sz_xXF86DRIGetDeviceInfoReply  32
+
+typedef struct _XF86DRIOpenFullScreen
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRIOpenFullScreen */
+    CARD16 length B16;
+    CARD32 screen B32;
+    CARD32 drawable B32;
+} xXF86DRIOpenFullScreenReq;
+
+#define sz_xXF86DRIOpenFullScreenReq    12
+
+typedef struct
+{
+    BYTE type;
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 isFullScreen B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+} xXF86DRIOpenFullScreenReply;
+
+#define sz_xXF86DRIOpenFullScreenReply  32
+
+typedef struct _XF86DRICloseFullScreen
+{
+    CARD8 reqType;                    /* always DRIReqCode */
+    CARD8 driReqType;                 /* always X_DRICloseFullScreen */
+    CARD16 length B16;
+    CARD32 screen B32;
+    CARD32 drawable B32;
+} xXF86DRICloseFullScreenReq;
+
+#define sz_xXF86DRICloseFullScreenReq   12
+
+typedef struct
+{
+    BYTE type;
+    BOOL pad1;
+    CARD16 sequenceNumber B16;
+    CARD32 length B32;
+    CARD32 pad2 B32;
+    CARD32 pad3 B32;
+    CARD32 pad4 B32;
+    CARD32 pad5 B32;
+    CARD32 pad6 B32;
+    CARD32 pad7 B32;
+} xXF86DRICloseFullScreenReply;
+
+#define sz_xXF86DRICloseFullScreenReply  32
+
+#endif /* _XF86DRISTR_H_ */
index 72b5df8..aabab95 100644 (file)
@@ -21,12 +21,13 @@ if env['platform'] == 'windows':
                'gdi_softpipe_winsys.c',
        ]
        
-       if env['toolchain'] == 'crossmingw':
+       if env['gcc']:
                sources += ['#src/gallium/state_trackers/wgl/opengl32.mingw.def']
        else:
                sources += ['#src/gallium/state_trackers/wgl/opengl32.def']
                
        drivers = [
+               trace,
                softpipe,
        ]
 
index 8e6ccb4..cd692f3 100644 (file)
@@ -6,7 +6,7 @@ include $(TOP)/configs/current
 
 ##### MACROS #####
 
-GLEW_LIB_NAME = libglew.a
+GLEW_LIB_NAME = libGLEW.a
 
 MAJOR = 1
 MINOR = 5
index 0ef5d3a..9c8f110 100644 (file)
@@ -60,9 +60,6 @@ struct __GLXDRIdisplayPrivateRec {
     int driMajor;
     int driMinor;
     int driPatch;
-
-    unsigned long configureSeqno;
-    Bool (*oldConfigProc)(Display *, XEvent *, xEvent *);
 };
 
 struct __GLXDRIcontextPrivateRec {
@@ -76,7 +73,6 @@ struct __GLXDRIdrawablePrivateRec {
     __DRIbuffer buffers[5];
     int bufferCount;
     int width, height;
-    unsigned long configureSeqno;
     int have_back;
     int have_front;
     int have_fake_front;
@@ -174,7 +170,6 @@ static __GLXDRIdrawable *dri2CreateDrawable(__GLXscreenConfigs *psc,
     pdraw->base.drawable = drawable;
     pdraw->base.psc = psc;
     pdraw->bufferCount = 0;
-    pdraw->configureSeqno = ~0;
 
     DRI2CreateDrawable(psc->dpy, xDrawable);
 
@@ -293,30 +288,9 @@ dri2GetBuffers(__DRIdrawable *driDrawable,
               int *out_count, void *loaderPrivate)
 {
     __GLXDRIdrawablePrivate *pdraw = loaderPrivate;
-    __GLXdisplayPrivate *dpyPriv = __glXInitialize(pdraw->base.psc->dpy);
-    __GLXDRIdisplayPrivate *pdp = (__GLXDRIdisplayPrivate *)dpyPriv->dri2Display;
     DRI2Buffer *buffers;
     int i;
 
-    /**
-     * Check if a ConfigureNotify has come in since we last asked for the
-     * buffers associated with this drawable.  If not, we can assume that they're
-     * the same set at glViewport time, and save a synchronous round-trip to the
-     * X Server.
-     */
-    if (pdraw->configureSeqno == pdp->configureSeqno &&
-       count == pdraw->bufferCount) {
-       for (i = 0; i < count; i++) {
-           if (pdraw->buffers[i].attachment != attachments[i])
-               break;
-       }
-       if (i == count) {
-           *out_count = pdraw->bufferCount;
-           return pdraw->buffers;
-       }
-    }
-    pdraw->configureSeqno = pdp->configureSeqno;
-
     buffers = DRI2GetBuffers(pdraw->base.psc->dpy, pdraw->base.xDrawable,
                             width, height, attachments, count, out_count);
     if (buffers == NULL)
@@ -468,28 +442,6 @@ static void dri2DestroyDisplay(__GLXDRIdisplay *dpy)
     Xfree(dpy);
 }
 
-/**
- * Makes a note on receiving ConfigureNotify that we need to re-check the
- * DRI2 buffers, as window sizes may have resulted in reallocation.
- */
-static Bool dri2ConfigureNotifyProc(Display *dpy, XEvent *re, xEvent *event)
-{
-    __GLXdisplayPrivate *dpyPriv = __glXInitialize(dpy);
-    __GLXDRIdisplayPrivate *pdp;
-    Bool ret;
-
-    /* We should always be able to find our pdp, as it only gets torn down
-     * when the Display is torn down.
-     */
-    pdp = (__GLXDRIdisplayPrivate *)dpyPriv->dri2Display;
-
-    ret = pdp->oldConfigProc(dpy, re, event);
-
-    pdp->configureSeqno = re->xconfigure.serial;
-
-    return ret;
-}
-
 /*
  * Allocate, initialize and return a __DRIdisplayPrivate object.
  * This is called from __glXInitialize() when we are given a new
@@ -512,11 +464,7 @@ _X_HIDDEN __GLXDRIdisplay *dri2CreateDisplay(Display *dpy)
        return NULL;
     }
 
-    pdp->oldConfigProc = XESetWireToEvent(dpy, ConfigureNotify,
-                                         dri2ConfigureNotifyProc);
-
     pdp->driPatch = 0;
-    pdp->configureSeqno = 0;
 
     pdp->base.destroyDisplay = dri2DestroyDisplay;
     pdp->base.createScreen = dri2CreateScreen;
index 6bcf965..a06331f 100644 (file)
@@ -194,7 +194,6 @@ determineTextureTarget(const int *attribs, int numAttribs)
 static GLenum
 determineTextureFormat(const int *attribs, int numAttribs)
 {
-   GLenum target = 0;
    int i;
 
    for (i = 0; i < numAttribs; i++) {
index c42e80a..bf68d0f 100644 (file)
@@ -426,6 +426,11 @@ struct __GLXcontextRec {
    int server_minor;        /**< Minor version number. */
     /*@}*/
 
+   /**
+    * Thread ID we're currently current in. Zero if none.
+    */
+   unsigned long thread_id;
+
     char gl_extension_bits[ __GL_EXT_BYTES ];
 };
 
@@ -609,7 +614,6 @@ extern void __glXSendLargeCommand(__GLXcontext *, const GLvoid *, GLint,
                                  const GLvoid *, GLint);
 
 /* Initialize the GLX extension for dpy */
-extern __GLXdisplayPrivate * __glXGetPrivateFromDisplay(Display *dpy);
 extern __GLXdisplayPrivate *__glXInitialize(Display*);
 
 extern void __glXPreferEGL(int state);
index 4d0a7c6..01f4233 100644 (file)
@@ -339,6 +339,20 @@ FetchDRIDrawable(Display * dpy, GLXDrawable glxDrawable, GLXContext gc)
 }
 #endif /* GLX_DIRECT_RENDERING */
 
+static void
+__glXGenerateError(Display *dpy, GLXContext gc, XID resource,
+                  BYTE errorCode, CARD16 minorCode)
+{
+   xError error;
+
+   error.errorCode = errorCode;
+   error.resourceID = resource;
+   error.sequenceNumber = dpy->request;
+   error.type = X_Error;
+   error.majorCode = gc->majorOpcode;
+   error.minorCode = minorCode;
+   _XError(dpy, &error);
+}
 
 /**
  * Make a particular context current.
@@ -369,8 +383,26 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
       return GL_FALSE;
    }
 
+   if (gc == NULL && (draw != None || read != None)) {
+      __glXGenerateError(dpy, gc, (draw != None) ? draw : read,
+                        BadMatch, X_GLXMakeContextCurrent);
+      return False;
+   }
+   if (gc != NULL && (draw == None || read == None)) {
+      __glXGenerateError(dpy, gc, None,
+                        BadMatch, X_GLXMakeContextCurrent);
+      return False;
+   }
+
    _glapi_check_multithread();
 
+   if (gc != NULL && gc->thread_id != 0 &&
+       gc->thread_id != _glthread_GetID()) {
+      __glXGenerateError(dpy, gc, gc->xid,
+                        BadAccess, X_GLXMakeContextCurrent);
+      return False;
+   }
+
 #ifdef GLX_DIRECT_RENDERING
    /* Bind the direct rendering context to the drawable */
    if (gc && gc->driContext) {
@@ -378,21 +410,17 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
       __GLXDRIdrawable *pread = FetchDRIDrawable(dpy, read, gc);
 
       if ((pdraw == NULL) || (pread == NULL)) {
-         xError error;
-
-         error.errorCode = GLXBadDrawable;
-         error.resourceID = (pdraw == NULL) ? draw : read;
-         error.sequenceNumber = dpy->request;
-         error.type = X_Error;
-         error.majorCode = gc->majorOpcode;
-         error.minorCode = X_GLXMakeContextCurrent;
-         _XError(dpy, &error);
+         __glXGenerateError(dpy, gc, (pdraw == NULL) ? draw : read,
+                           GLXBadDrawable, X_GLXMakeContextCurrent);
          return False;
       }
 
       bindReturnValue =
          (gc->driContext->bindContext) (gc->driContext, pdraw, pread);
    }
+   else if (!gc && oldGC && oldGC->driContext) {
+      bindReturnValue = True;
+   }
    else
 #endif
    {
@@ -453,6 +481,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
          oldGC->currentDrawable = None;
          oldGC->currentReadable = None;
          oldGC->currentContextTag = 0;
+         oldGC->thread_id = 0;
 
          if (oldGC->xid == None) {
             /* We are switching away from a context that was
@@ -477,6 +506,7 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw,
          gc->currentDpy = dpy;
          gc->currentDrawable = draw;
          gc->currentReadable = read;
+         gc->thread_id = _glthread_GetID();
 
 #ifdef GLX_DIRECT_RENDERING
          if (!gc->driContext) {
index 08d52ae..aea117e 100644 (file)
@@ -5198,9 +5198,13 @@ glDeleteTexturesEXT(GLsizei n, const GLuint * textures)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING
     if (gc->driContext) {
         CALL_DeleteTextures(GET_DISPATCH(), (n, textures));
     } else {
+#else
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 4 + __GLX_PAD((n * 4));
@@ -5266,9 +5270,13 @@ glGenTexturesEXT(GLsizei n, GLuint * textures)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GenTextures(GET_DISPATCH(), (n, textures));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 4;
@@ -5328,9 +5336,13 @@ glIsTextureEXT(GLuint texture)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         return CALL_IsTexture(GET_DISPATCH(), (texture));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         GLboolean retval = (GLboolean) 0;
@@ -5641,9 +5653,13 @@ glGetColorTableEXT(GLenum target, GLenum format, GLenum type, GLvoid * table)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetColorTable(GET_DISPATCH(), (target, format, type, table));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         const __GLXattribute *const state = gc->client_state_private;
         Display *const dpy = gc->currentDpy;
@@ -5714,10 +5730,14 @@ glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetColorTableParameterfv(GET_DISPATCH(),
                                       (target, pname, params));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 8;
@@ -5784,10 +5804,14 @@ glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetColorTableParameteriv(GET_DISPATCH(),
                                       (target, pname, params));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 8;
@@ -6107,10 +6131,14 @@ gl_dispatch_stub_356(GLenum target, GLenum format, GLenum type,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetConvolutionFilter(GET_DISPATCH(),
                                   (target, format, type, image));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         const __GLXattribute *const state = gc->client_state_private;
         Display *const dpy = gc->currentDpy;
@@ -6182,10 +6210,14 @@ gl_dispatch_stub_357(GLenum target, GLenum pname, GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetConvolutionParameterfv(GET_DISPATCH(),
                                        (target, pname, params));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 8;
@@ -6252,10 +6284,14 @@ gl_dispatch_stub_358(GLenum target, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetConvolutionParameteriv(GET_DISPATCH(),
                                        (target, pname, params));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 8;
@@ -6329,10 +6365,14 @@ gl_dispatch_stub_361(GLenum target, GLboolean reset, GLenum format,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetHistogram(GET_DISPATCH(),
                           (target, reset, format, type, values));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         const __GLXattribute *const state = gc->client_state_private;
         Display *const dpy = gc->currentDpy;
@@ -6403,9 +6443,13 @@ gl_dispatch_stub_362(GLenum target, GLenum pname, GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetHistogramParameterfv(GET_DISPATCH(), (target, pname, params));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 8;
@@ -6471,9 +6515,13 @@ gl_dispatch_stub_363(GLenum target, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetHistogramParameteriv(GET_DISPATCH(), (target, pname, params));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 8;
@@ -6543,9 +6591,13 @@ gl_dispatch_stub_364(GLenum target, GLboolean reset, GLenum format,
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetMinmax(GET_DISPATCH(), (target, reset, format, type, values));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         const __GLXattribute *const state = gc->client_state_private;
         Display *const dpy = gc->currentDpy;
@@ -6614,9 +6666,13 @@ gl_dispatch_stub_365(GLenum target, GLenum pname, GLfloat * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetMinmaxParameterfv(GET_DISPATCH(), (target, pname, params));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 8;
@@ -6679,9 +6735,13 @@ gl_dispatch_stub_366(GLenum target, GLenum pname, GLint * params)
 {
     __GLXcontext *const gc = __glXGetCurrentContext();
 
+#ifdef GLX_DIRECT_RENDERING    
     if (gc->driContext) {
         CALL_GetMinmaxParameteriv(GET_DISPATCH(), (target, pname, params));
     } else {
+#else 
+    {
+#endif
         __GLXcontext *const gc = __glXGetCurrentContext();
         Display *const dpy = gc->currentDpy;
         const GLuint cmdlen = 8;
index 865a4b1..3313ac0 100644 (file)
 #include "indirect_vertex_array.h"
 #include <GL/glxproto.h>
 
+#if !defined __GNUC__ || __GNUC__ < 3
+#  define __builtin_expect(x, y) x
+#endif
+
 static void
 do_vertex_attrib_enable(GLuint index, GLboolean val)
 {
index 0eb31bf..8b51b5d 100644 (file)
 #include "glxclient.h"
 #include "indirect.h"
 
+#if !defined __GNUC__ || __GNUC__ < 3
+#  define __builtin_expect(x, y) x
+#endif
+
 /**
  * Send glPixelStore command to the server
  * 
index d1b9e93..9ffc15e 100644 (file)
@@ -91,6 +91,7 @@ if env['platform'] != 'winddk':
                'main/texenvprogram.c',
                'main/texformat.c',
                'main/texgen.c',
+               'main/texgetimage.c',
                'main/teximage.c',
                'main/texobj.c',
                'main/texparam.c',
index 44adaf8..276da41 100644 (file)
@@ -34,6 +34,7 @@
 #include "main/renderbuffer.h"
 #include "main/texcompress.h"
 #include "main/texformat.h"
+#include "main/texgetimage.h"
 #include "main/teximage.h"
 #include "main/texobj.h"
 #include "main/texstore.h"
index ae79055..38c2e7b 100644 (file)
@@ -163,21 +163,18 @@ static int driBindContext(__DRIcontext *pcp,
 {
     __DRIscreenPrivate *psp = pcp->driScreenPriv;
 
-    /*
-    ** Assume error checking is done properly in glXMakeCurrent before
-    ** calling driBindContext.
-    */
-
-    if (pcp == NULL || pdp == None || prp == None)
-       return GL_FALSE;
-
     /* Bind the drawable to the context */
-    pcp->driDrawablePriv = pdp;
-    pcp->driReadablePriv = prp;
-    pdp->driContextPriv = pcp;
-    pdp->refcount++;
-    if ( pdp != prp ) {
-       prp->refcount++;
+
+    if (pcp) {
+       pcp->driDrawablePriv = pdp;
+       pcp->driReadablePriv = prp;
+       if (pdp) {
+           pdp->driContextPriv = pcp;
+           pdp->refcount++;
+       }
+       if ( prp && pdp != prp ) {
+           prp->refcount++;
+       }
     }
 
     /*
@@ -186,23 +183,21 @@ static int driBindContext(__DRIcontext *pcp,
     */
 
     if (!psp->dri2.enabled) {
-       if (!pdp->pStamp || *pdp->pStamp != pdp->lastStamp) {
+       if (pdp && !pdp->pStamp) {
            DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
            __driUtilUpdateDrawableInfo(pdp);
            DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
        }
-       
-       if ((pdp != prp) && (!prp->pStamp || *prp->pStamp != prp->lastStamp)) {
+       if (prp && pdp != prp && !prp->pStamp) {
            DRM_SPINLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
            __driUtilUpdateDrawableInfo(prp);
            DRM_SPINUNLOCK(&psp->pSAREA->drawable_lock, psp->drawLockID);
-       }
+        }
     }
 
     /* Call device-specific MakeCurrent */
-    (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp);
 
-    return GL_TRUE;
+    return (*psp->DriverAPI.MakeCurrent)(pcp, pdp, prp);
 }
 
 /*@}*/
index c9acd81..66f277c 100644 (file)
@@ -481,7 +481,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
                 const uint8_t * depth_bits, const uint8_t * stencil_bits,
                 unsigned num_depth_stencil_bits,
                 const GLenum * db_modes, unsigned num_db_modes,
-                const u_int8_t * msaa_samples, unsigned num_msaa_modes)
+                const uint8_t * msaa_samples, unsigned num_msaa_modes)
 {
    static const uint8_t bits_table[4][4] = {
      /* R  G  B  A */
index ca33c17..97797d4 100644 (file)
@@ -107,9 +107,14 @@ static void gammaSetTexFilter(gammaContextPtr gmesa,
 
 static void gammaSetTexBorderColor(gammaContextPtr gmesa,
                                  gammaTextureObjectPtr t, 
-                                 GLubyte color[4])
+                                  const GLfloat color[4])
 {
-    t->TextureBorderColor = PACK_COLOR_8888(color[0], color[1], color[2], color[3]);
+   GLubyte c[4];
+   CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+   CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+   CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+   CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
+   t->TextureBorderColor = PACK_COLOR_8888(c[0], c[1], c[2], c[3]);
 }
 
 
@@ -143,7 +148,7 @@ static void gammaTexParameter( GLcontext *ctx, GLenum target,
       break;
   
    case GL_TEXTURE_BORDER_COLOR:
-      gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan );
+      gammaSetTexBorderColor( gmesa, t, tObj->BorderColor );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
@@ -347,7 +352,7 @@ static void gammaBindTexture( GLcontext *ctx, GLenum target,
 
         gammaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
         gammaSetTexFilter( gmesa, t, tObj->MinFilter, tObj->MagFilter, bias );
-        gammaSetTexBorderColor( gmesa, t, tObj->_BorderChan );
+        gammaSetTexBorderColor( gmesa, t, tObj->BorderColor );
       }
 }
 
index ba4e6b5..cd6e1a8 100644 (file)
@@ -162,7 +162,7 @@ static void i810SetTexFilter(i810ContextPtr imesa,
 
 
 static void
-i810SetTexBorderColor( i810TextureObjectPtr t, GLubyte color[4] )
+i810SetTexBorderColor( i810TextureObjectPtr t, const GLfloat color[4] )
 {
    /* Need a fallback.
     */
@@ -211,7 +211,7 @@ i810AllocTexObj( GLcontext *ctx, struct gl_texture_object *texObj )
       i810SetTexWrapping( t, texObj->WrapS, texObj->WrapT );
       /*i830SetTexMaxAnisotropy( t, texObj->MaxAnisotropy );*/
       i810SetTexFilter( imesa, t, texObj->MinFilter, texObj->MagFilter, bias );
-      i810SetTexBorderColor( t, texObj->_BorderChan );
+      i810SetTexBorderColor( t, texObj->BorderColor );
    }
 
    return t;
@@ -252,7 +252,7 @@ static void i810TexParameter( GLcontext *ctx, GLenum target,
       break;
   
    case GL_TEXTURE_BORDER_COLOR:
-      i810SetTexBorderColor( t, tObj->_BorderChan );
+      i810SetTexBorderColor( t, tObj->BorderColor );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
index df43b77..753c25b 100644 (file)
@@ -122,6 +122,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
    struct gl_texture_image *firstImage;
    GLuint *state = i830->state.Tex[unit], format, pitch;
    GLint lodbias;
+   GLubyte border[4];
 
    memset(state, 0, sizeof(state));
 
@@ -294,11 +295,16 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
                                                      (ws)));
    }
 
+   /* convert border color from float to ubyte */
+   CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->BorderColor[0]);
+   CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor[1]);
+   CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor[2]);
+   CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor[3]);
 
-   state[I830_TEXREG_TM0S4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0],
-                                                  tObj->_BorderChan[1],
-                                                  tObj->_BorderChan[2],
-                                                  tObj->_BorderChan[3]);
+   state[I830_TEXREG_TM0S4] = INTEL_PACKCOLOR8888(border[0],
+                                                  border[1],
+                                                  border[2],
+                                                  border[3]);
 
 
    I830_ACTIVESTATE(i830, I830_UPLOAD_TEX(unit), GL_TRUE);
index 6d25f8d..43f6539 100644 (file)
@@ -133,6 +133,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
    struct gl_texture_image *firstImage;
    GLuint *state = i915->state.Tex[unit], format, pitch;
    GLint lodbias;
+   GLubyte border[4];
 
    memset(state, 0, sizeof(state));
 
@@ -318,21 +319,26 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
       state[I915_TEXREG_SS3] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT);
    }
 
+   /* convert border color from float to ubyte */
+   CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->BorderColor[0]);
+   CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->BorderColor[1]);
+   CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor[2]);
+   CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor[3]);
 
    if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
       /* GL specs that border color for depth textures is taken from the
        * R channel, while the hardware uses A.  Spam R into all the channels
        * for safety.
        */
-      state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0],
-                                                  tObj->_BorderChan[0],
-                                                  tObj->_BorderChan[0],
-                                                  tObj->_BorderChan[0]);
+      state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0],
+                                                  border[0],
+                                                  border[0],
+                                                  border[0]);
    } else {
-      state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(tObj->_BorderChan[0],
-                                                  tObj->_BorderChan[1],
-                                                  tObj->_BorderChan[2],
-                                                  tObj->_BorderChan[3]);
+      state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0],
+                                                  border[1],
+                                                  border[2],
+                                                  border[3]);
    }
 
 
index 48ed432..01e07c9 100644 (file)
@@ -167,6 +167,9 @@ struct brw_fragment_program {
    struct gl_fragment_program program;
    GLuint id;  /**< serial no. to identify frag progs, never re-used */
    GLboolean isGLSL;  /**< really, any IF/LOOP/CONT/BREAK instructions */
+
+   /** Program constant buffer/surface */
+   dri_bo *const_buffer;
 };
 
 
@@ -238,8 +241,16 @@ struct brw_vs_ouput_sizes {
 };
 
 
+/** Number of texture sampler units */
 #define BRW_MAX_TEX_UNIT 16
-#define BRW_WM_MAX_SURF BRW_MAX_TEX_UNIT + MAX_DRAW_BUFFERS
+
+/**
+ * Size of our surface binding table.
+ * This contains pointers to the drawing surfaces and current texture
+ * objects and shader constant buffer (+1).
+ */
+#define BRW_WM_MAX_SURF (MAX_DRAW_BUFFERS + BRW_MAX_TEX_UNIT + 1)
+
 
 enum brw_cache_id {
    BRW_CC_VP,
@@ -513,8 +524,8 @@ struct brw_context
    /* BRW_NEW_CURBE_OFFSETS: 
     */
    struct {
-      GLuint wm_start;
-      GLuint wm_size;
+      GLuint wm_start;  /**< pos of first wm const in CURBE buffer */
+      GLuint wm_size;   /**< number of float[4] consts, multiple of 16 */
       GLuint clip_start;
       GLuint clip_size;
       GLuint vs_start;
@@ -588,7 +599,7 @@ struct brw_context
       GLuint nr_surfaces;      
 
       GLuint max_threads;
-      dri_bo *scratch_buffer;
+      dri_bo *scratch_bo;
 
       GLuint sampler_count;
       dri_bo *sampler_bo;
index 545dedd..a6bfb75 100644 (file)
@@ -38,6 +38,7 @@
 #include "shader/prog_parameter.h"
 #include "shader/prog_statevars.h"
 #include "intel_batchbuffer.h"
+#include "intel_regions.h"
 #include "brw_context.h"
 #include "brw_defines.h"
 #include "brw_state.h"
@@ -251,6 +252,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
 
       _mesa_load_state_parameters(ctx, vp->program.Base.Parameters); 
 
+      /* XXX just use a memcpy here */
       for (i = 0; i < nr; i++) {
          const GLfloat *value = vp->program.Base.Parameters->ParameterValues[i];
         buf[offset + i * 4 + 0] = value[0];
@@ -330,11 +332,39 @@ static void prepare_constant_buffer(struct brw_context *brw)
 }
 
 
+/**
+ * Vertex/fragment shader constants are stored in a pseudo 1D texture.
+ * This function updates the constants in that buffer.
+ */
+static void
+update_texture_constant_buffer(struct brw_context *brw)
+{
+   struct brw_fragment_program *fp =
+      (struct brw_fragment_program *) brw->fragment_program;
+   const struct gl_program_parameter_list *params = fp->program.Base.Parameters;
+   const int size = params->NumParameters * 4 * sizeof(GLfloat);
+
+   assert(fp->const_buffer);
+   assert(fp->const_buffer->size >= size);
+
+   /* copy constants into the buffer */
+   if (size > 0) {
+      GLubyte *map;
+      dri_bo_map(fp->const_buffer, GL_TRUE);
+      map = fp->const_buffer->virtual;
+      memcpy(map, params->ParameterValues, size);
+      dri_bo_unmap(fp->const_buffer);
+   }
+}
+
+
 static void emit_constant_buffer(struct brw_context *brw)
 {
    struct intel_context *intel = &brw->intel;
    GLuint sz = brw->curbe.total_size;
 
+   update_texture_constant_buffer(brw);
+
    BEGIN_BATCH(2, IGNORE_CLIPRECTS);
    if (sz == 0) {
       OUT_BATCH((CMD_CONST_BUFFER << 16) | (2 - 2));
index 590b064..98fc909 100644 (file)
 
 #define BRW_RASTRULE_UPPER_LEFT  0    
 #define BRW_RASTRULE_UPPER_RIGHT 1
+/* These are listed as "Reserved, but not seen as useful"
+ * in Intel documentation (page 212, "Point Rasterization Rule",
+ * section 7.4 "SF Pipeline State Summary", of document
+ * "Intel® 965 Express Chipset Family and Intel® G35 Express
+ * Chipset Graphics Controller Programmer's Reference Manual,
+ * Volume 2: 3D/Media", Revision 1.0b as of January 2008,
+ * available at 
+ *     http://intellinuxgraphics.org/documentation.html
+ * at the time of this writing).
+ *
+ * These appear to be supported on at least some
+ * i965-family devices, and the BRW_RASTRULE_LOWER_RIGHT
+ * is useful when using OpenGL to render to a FBO
+ * (which has the pixel coordinate Y orientation inverted
+ * with respect to the normal OpenGL pixel coordinate system).
+ */
+#define BRW_RASTRULE_LOWER_LEFT  2
+#define BRW_RASTRULE_LOWER_RIGHT 3
 
 #define BRW_RENDERTARGET_CLAMPRANGE_UNORM    0
 #define BRW_RENDERTARGET_CLAMPRANGE_SNORM    1
 #define BRW_SURFACEFORMAT_L8A8_UNORM                     0x114 
 #define BRW_SURFACEFORMAT_I16_FLOAT                      0x115
 #define BRW_SURFACEFORMAT_L16_FLOAT                      0x116
-#define BRW_SURFACEFORMAT_A16_FLOAT                      0x117 
-#define BRW_SURFACEFORMAT_R5G5_SNORM_B6_UNORM            0x119 
-#define BRW_SURFACEFORMAT_B5G5R5X1_UNORM                 0x11A 
+#define BRW_SURFACEFORMAT_A16_FLOAT                      0x117
+#define BRW_SURFACEFORMAT_L8A8_UNORM_SRGB                0x118
+#define BRW_SURFACEFORMAT_R5G5_SNORM_B6_UNORM            0x119
+#define BRW_SURFACEFORMAT_B5G5R5X1_UNORM                 0x11A
 #define BRW_SURFACEFORMAT_B5G5R5X1_UNORM_SRGB            0x11B
 #define BRW_SURFACEFORMAT_R8G8_SSCALED                   0x11C
 #define BRW_SURFACEFORMAT_R8G8_USCALED                   0x11D
 #define BRW_SURFACEFORMAT_A4P4_UNORM                     0x148
 #define BRW_SURFACEFORMAT_R8_SSCALED                     0x149
 #define BRW_SURFACEFORMAT_R8_USCALED                     0x14A
+#define BRW_SURFACEFORMAT_L8_UNORM_SRGB                  0x14C
 #define BRW_SURFACEFORMAT_R1_UINT                        0x181 
 #define BRW_SURFACEFORMAT_YCRCB_NORMAL                   0x182 
 #define BRW_SURFACEFORMAT_YCRCB_SWAPUVY                  0x183 
index 02998d5..b91b20b 100644 (file)
@@ -277,6 +277,7 @@ copy_array_to_vbo_array( struct brw_context *brw,
                         struct brw_vertex_element *element,
                         GLuint dst_stride)
 {
+   struct intel_context *intel = &brw->intel;
    GLuint size = element->count * dst_stride;
 
    get_space(brw, size, &element->bo, &element->offset);
@@ -289,29 +290,52 @@ copy_array_to_vbo_array( struct brw_context *brw,
    }
 
    if (dst_stride == element->glarray->StrideB) {
-      dri_bo_subdata(element->bo,
-                    element->offset,
-                    size,
-                    element->glarray->Ptr);
+      if (intel->intelScreen->kernel_exec_fencing) {
+        drm_intel_gem_bo_map_gtt(element->bo);
+        memcpy((char *)element->bo->virtual + element->offset,
+               element->glarray->Ptr, size);
+        drm_intel_gem_bo_unmap_gtt(element->bo);
+      } else {
+        dri_bo_subdata(element->bo,
+                       element->offset,
+                       size,
+                       element->glarray->Ptr);
+      }
    } else {
-      void *data;
       char *dest;
       const unsigned char *src = element->glarray->Ptr;
       int i;
 
-      data = _mesa_malloc(dst_stride * element->count);
-      dest = data;
-      for (i = 0; i < element->count; i++) {
-        memcpy(dest, src, dst_stride);
-        src += element->glarray->StrideB;
-        dest += dst_stride;
-      }
+      if (intel->intelScreen->kernel_exec_fencing) {
+        drm_intel_gem_bo_map_gtt(element->bo);
+        dest = element->bo->virtual;
+        dest += element->offset;
 
-      dri_bo_subdata(element->bo,
-                    element->offset,
-                    size,
-                    data);
-      _mesa_free(data);
+        for (i = 0; i < element->count; i++) {
+           memcpy(dest, src, dst_stride);
+           src += element->glarray->StrideB;
+           dest += dst_stride;
+        }
+
+        drm_intel_gem_bo_unmap_gtt(element->bo);
+      } else {
+        void *data;
+
+        data = _mesa_malloc(dst_stride * element->count);
+        dest = data;
+        for (i = 0; i < element->count; i++) {
+           memcpy(dest, src, dst_stride);
+           src += element->glarray->StrideB;
+           dest += dst_stride;
+        }
+
+        dri_bo_subdata(element->bo,
+                       element->offset,
+                       size,
+                       data);
+
+        _mesa_free(data);
+      }
    }
 }
 
@@ -563,7 +587,13 @@ static void brw_prepare_indices(struct brw_context *brw)
 
       /* Straight upload
        */
-      dri_bo_subdata(bo, offset, ib_size, index_buffer->ptr);
+      if (intel->intelScreen->kernel_exec_fencing) {
+        drm_intel_gem_bo_map_gtt(bo);
+        memcpy((char *)bo->virtual + offset, index_buffer->ptr, ib_size);
+        drm_intel_gem_bo_unmap_gtt(bo);
+      } else {
+        dri_bo_subdata(bo, offset, ib_size, index_buffer->ptr);
+      }
    } else {
       offset = (GLuint) (unsigned long) index_buffer->ptr;
 
index eb99c21..d05f2e6 100644 (file)
@@ -730,6 +730,13 @@ static INLINE struct brw_indirect brw_indirect( GLuint addr_subnr, GLint offset
    return ptr;
 }
 
+/** Do two brw_regs refer to the same register? */
+static INLINE GLboolean
+brw_same_reg(struct brw_reg r1, struct brw_reg r2)
+{
+   return r1.file == r2.file && r1.nr == r2.nr;
+}
+
 static INLINE struct brw_instruction *current_insn( struct brw_compile *p)
 {
    return &p->store[p->nr_insn];
@@ -851,6 +858,13 @@ void brw_dp_READ_16( struct brw_compile *p,
                     GLuint msg_reg_nr,
                     GLuint scratch_offset );
 
+void brw_dp_READ_4( struct brw_compile *p,
+                    struct brw_reg dest,
+                    GLuint msg_reg_nr,
+                    GLboolean relAddr,
+                    GLuint scratch_offset,
+                    GLuint bind_table_index );
+
 void brw_dp_WRITE_16( struct brw_compile *p,
                      struct brw_reg src,
                      GLuint msg_reg_nr,
index 91dbbd5..29f3f6d 100644 (file)
@@ -65,6 +65,7 @@ void brw_print_reg( struct brw_reg hwreg )
        hwreg.width == BRW_WIDTH_8 &&
        hwreg.hstride == BRW_HORIZONTAL_STRIDE_1 &&
        hwreg.type == BRW_REGISTER_TYPE_F) {
+      /* vector register */
       _mesa_printf("vec%d", hwreg.nr);
    }
    else if (hwreg.file == BRW_GENERAL_REGISTER_FILE &&
@@ -72,8 +73,12 @@ void brw_print_reg( struct brw_reg hwreg )
            hwreg.width == BRW_WIDTH_1 &&
            hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 &&
            hwreg.type == BRW_REGISTER_TYPE_F) {      
+      /* "scalar" register */
       _mesa_printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4);
    }
+   else if (hwreg.file == BRW_IMMEDIATE_VALUE) {
+      _mesa_printf("imm %f", hwreg.dw1.f);
+   }
    else {
       _mesa_printf("%s%d.%d<%d;%d,%d>:%s", 
                   file[hwreg.file],
index 6dce1ca..21ce836 100644 (file)
@@ -320,14 +320,15 @@ static void brw_set_dp_read_message( struct brw_instruction *insn,
 {
    brw_set_src1(insn, brw_imm_d(0));
 
-   insn->bits3.dp_read.binding_table_index = binding_table_index;
-   insn->bits3.dp_read.msg_control = msg_control;
-   insn->bits3.dp_read.msg_type = msg_type;
-   insn->bits3.dp_read.target_cache = target_cache;
-   insn->bits3.dp_read.response_length = response_length;
-   insn->bits3.dp_read.msg_length = msg_length;
-   insn->bits3.dp_read.msg_target = BRW_MESSAGE_TARGET_DATAPORT_READ;
-   insn->bits3.dp_read.end_of_thread = end_of_thread;
+   insn->bits3.dp_read.binding_table_index = binding_table_index; /*0:7*/
+   insn->bits3.dp_read.msg_control = msg_control;  /*8:11*/
+   insn->bits3.dp_read.msg_type = msg_type;  /*12:13*/
+   insn->bits3.dp_read.target_cache = target_cache;  /*14:15*/
+   insn->bits3.dp_read.response_length = response_length;  /*16:19*/
+   insn->bits3.dp_read.msg_length = msg_length;  /*20:23*/
+   insn->bits3.dp_read.msg_target = BRW_MESSAGE_TARGET_DATAPORT_READ; /*24:27*/
+   insn->bits3.dp_read.pad1 = 0;  /*28:30*/
+   insn->bits3.dp_read.end_of_thread = end_of_thread;  /*31*/
 }
 
 static void brw_set_sampler_message(struct brw_context *brw,
@@ -770,7 +771,7 @@ void brw_CMP(struct brw_compile *p,
  * Helpers for the various SEND message types:
  */
 
-/* Invert 8 values
+/** Extended math function, float[8].
  */
 void brw_math( struct brw_compile *p,
               struct brw_reg dest,
@@ -802,7 +803,9 @@ void brw_math( struct brw_compile *p,
                        data_type);
 }
 
-/* Use 2 send instructions to invert 16 elements
+/**
+ * Extended math function, float[16].
+ * Use 2 send instructions.
  */
 void brw_math_16( struct brw_compile *p,
                  struct brw_reg dest,
@@ -855,8 +858,11 @@ void brw_math_16( struct brw_compile *p,
 }
 
 
-
-
+/**
+ * Write block of 16 dwords/floats to the data port Render Cache scratch buffer.
+ * Scratch offset should be a multiple of 64.
+ * Used for register spilling.
+ */
 void brw_dp_WRITE_16( struct brw_compile *p,
                      struct brw_reg src,
                      GLuint msg_reg_nr,
@@ -867,6 +873,7 @@ void brw_dp_WRITE_16( struct brw_compile *p,
       brw_set_mask_control(p, BRW_MASK_DISABLE);
       brw_set_compression_control(p, BRW_COMPRESSION_NONE);
 
+      /* set message header global offset field (reg 0, element 2) */
       brw_MOV(p,
              retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D),
              brw_imm_d(scratch_offset));
@@ -887,7 +894,7 @@ void brw_dp_WRITE_16( struct brw_compile *p,
       brw_set_src0(insn, src);
 
       brw_set_dp_write_message(insn,
-                              255, /* bti */
+                              255, /* binding table index (255=stateless) */
                               BRW_DATAPORT_OWORD_BLOCK_4_OWORDS, /* msg_control */
                               BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE, /* msg_type */
                               msg_length,
@@ -895,10 +902,14 @@ void brw_dp_WRITE_16( struct brw_compile *p,
                               0, /* response_length */
                               0); /* eot */
    }
-
 }
 
 
+/**
+ * Read block of 16 dwords/floats from the data port Render Cache scratch buffer.
+ * Scratch offset should be a multiple of 64.
+ * Used for register spilling.
+ */
 void brw_dp_READ_16( struct brw_compile *p,
                      struct brw_reg dest,
                      GLuint msg_reg_nr,
@@ -909,6 +920,7 @@ void brw_dp_READ_16( struct brw_compile *p,
       brw_set_compression_control(p, BRW_COMPRESSION_NONE);
       brw_set_mask_control(p, BRW_MASK_DISABLE);
 
+      /* set message header global offset field (reg 0, element 2) */
       brw_MOV(p,
              retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D),
              brw_imm_d(scratch_offset));
@@ -927,10 +939,10 @@ void brw_dp_READ_16( struct brw_compile *p,
       brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW));
 
       brw_set_dp_read_message(insn,
-                             255, /* bti */
-                             3,  /* msg_control */
+                             255, /* binding table index (255=stateless) */
+                             3,  /* msg_control (3 means 4 Owords) */
                              BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */
-                             1, /* target cache */
+                             1, /* target cache (render/scratch) */
                              1, /* msg_length */
                              2, /* response_length */
                              0); /* eot */
@@ -938,6 +950,56 @@ void brw_dp_READ_16( struct brw_compile *p,
 }
 
 
+/**
+ * Read a float[4] vector from the data port Data Cache (const buffer).
+ * Scratch offset should be a multiple of 16.
+ * Used for fetching shader constants.
+ * If relAddr is true, we'll do an indirect fetch using the address register.
+ */
+void brw_dp_READ_4( struct brw_compile *p,
+                    struct brw_reg dest,
+                    GLuint msg_reg_nr,
+                    GLboolean relAddr,
+                    GLuint scratch_offset,
+                    GLuint bind_table_index )
+{
+   {
+      brw_push_insn_state(p);
+      brw_set_compression_control(p, BRW_COMPRESSION_NONE);
+      brw_set_mask_control(p, BRW_MASK_DISABLE);
+
+      /* set message header global offset field (reg 0, element 2) */
+      brw_MOV(p,
+             retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_UD),
+             brw_imm_d(scratch_offset));
+      brw_pop_insn_state(p);
+   }
+
+   {
+      struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND);
+   
+      insn->header.predicate_control = 0; /* XXX */
+      insn->header.compression_control = BRW_COMPRESSION_NONE; 
+      insn->header.destreg__conditonalmod = msg_reg_nr;
+  
+      /* cast dest to a uword[8] vector */
+      dest = retype(vec8(dest), BRW_REGISTER_TYPE_UW);
+
+      brw_set_dest(insn, dest);
+      brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW));
+
+      brw_set_dp_read_message(insn,
+                             bind_table_index, /* binding table index (255=stateless) */
+                             0,  /* msg_control (0 means 1 Oword) */
+                             BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */
+                             0, /* source cache = data cache */
+                             1, /* msg_length */
+                             1, /* response_length (1 Oword) */
+                             0); /* eot */
+   }
+}
+
+
 void brw_fb_WRITE(struct brw_compile *p,
                   struct brw_reg dest,
                   GLuint msg_reg_nr,
@@ -966,7 +1028,11 @@ void brw_fb_WRITE(struct brw_compile *p,
 }
 
 
-
+/**
+ * Texture sample instruction.
+ * Note: the msg_type plus msg_length values determine exactly what kind
+ * of sampling operation is performed.  See volume 4, page 161 of docs.
+ */
 void brw_SAMPLE(struct brw_compile *p,
                struct brw_reg dest,
                GLuint msg_reg_nr,
@@ -1061,7 +1127,7 @@ void brw_SAMPLE(struct brw_compile *p,
       /*  mov (8) r9.0<1>:f    r9.0<8;8,1>:f    { Align1 }
        */
       brw_push_insn_state(p);
-      brw_set_compression_control(p, GL_FALSE);
+      brw_set_compression_control(p, BRW_COMPRESSION_NONE);
       brw_MOV(p, reg, reg);          
       brw_pop_insn_state(p);
    }
index d90bd82..457bc2f 100644 (file)
@@ -111,6 +111,8 @@ static void brwProgramStringNotify( GLcontext *ctx,
                                    struct gl_program *prog )
 {
    struct brw_context *brw = brw_context(ctx);
+   struct intel_context *intel = &brw->intel;
+
    if (target == GL_FRAGMENT_PROGRAM_ARB) {
       struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
       struct brw_fragment_program *newFP = brw_fragment_program(fprog);
@@ -126,6 +128,24 @@ static void brwProgramStringNotify( GLcontext *ctx,
         brw->state.dirty.brw |= BRW_NEW_FRAGMENT_PROGRAM;
       newFP->id = brw->program_id++;      
       newFP->isGLSL = brw_wm_is_glsl(fprog);
+
+      /* alloc constant buffer/surface */
+      {
+         const struct gl_program_parameter_list *params = prog->Parameters;
+         const int size = params->NumParameters * 4 * sizeof(GLfloat);
+
+         /* free old const buffer if too small */
+         if (newFP->const_buffer && newFP->const_buffer->size < size) {
+            dri_bo_unreference(newFP->const_buffer);
+            newFP->const_buffer = NULL;
+         }
+
+         if (!newFP->const_buffer) {
+            newFP->const_buffer = drm_intel_bo_alloc(intel->bufmgr,
+                                                     "fp_const_buffer",
+                                                     size, 64);
+         }
+      }
    }
    else if (target == GL_VERTEX_PROGRAM_ARB) {
       struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog;
index ffdb0ae..862835f 100644 (file)
@@ -59,37 +59,6 @@ static GLboolean have_attr(struct brw_sf_compile *c,
    return (c->key.attrs & (1<<attr)) ? 1 : 0;
 }
 
-/**
- * Sets VERT_RESULT_FOGC.Y  for gl_FrontFacing
- *
- * This is currently executed if the fragment program uses VERT_RESULT_FOGC
- * at all, but this could be eliminated with a scan of the FP contents.
- */
-static void
-do_front_facing( struct brw_sf_compile *c )
-{
-   struct brw_compile *p = &c->func; 
-   int i;
-
-   if (!have_attr(c, VERT_RESULT_FOGC))
-      return;
-
-   brw_push_insn_state(p);
-   brw_CMP(p, brw_null_reg(), 
-        c->key.frontface_ccw ? BRW_CONDITIONAL_G : BRW_CONDITIONAL_L,
-        c->det, brw_imm_f(0));
-   brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-   for (i = 0; i < 3; i++) {
-       struct brw_reg fogc = get_vert_attr(c, c->vert[i],FRAG_ATTRIB_FOGC);
-       brw_MOV(p, get_element(fogc, 1), brw_imm_f(0));
-       brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
-       brw_MOV(p, get_element(fogc, 1), brw_imm_f(1));
-       brw_set_predicate_control(p, BRW_PREDICATE_NONE);
-   }
-   brw_pop_insn_state(p);
-}
-
-                        
 /*********************************************************************** 
  * Twoside lighting
  */
@@ -384,7 +353,6 @@ void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate)
 
    invert_det(c);
    copy_z_inv_w(c);
-   do_front_facing(c);
 
    if (c->key.do_twoside_color) 
       do_twoside_color(c);
index 93a9686..fc4eddd 100644 (file)
@@ -231,7 +231,33 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
        sf.sf6.line_width = 0;
 
    /* _NEW_POINT */
-   sf.sf6.point_rast_rule = BRW_RASTRULE_UPPER_RIGHT;  /* opengl conventions */
+   key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
+   if (!key->render_to_fbo) {
+      /* Rendering to an OpenGL window */
+      sf.sf6.point_rast_rule = BRW_RASTRULE_UPPER_RIGHT;
+   }
+   else {
+      /* If rendering to an FBO, the pixel coordinate system is
+       * inverted with respect to the normal OpenGL coordinate
+       * system, so BRW_RASTRULE_LOWER_RIGHT is correct.
+       * But this value is listed as "Reserved, but not seen as useful"
+       * in Intel documentation (page 212, "Point Rasterization Rule",
+       * section 7.4 "SF Pipeline State Summary", of document
+       * "Intel® 965 Express Chipset Family and Intel® G35 Express
+       * Chipset Graphics Controller Programmer's Reference Manual,
+       * Volume 2: 3D/Media", Revision 1.0b as of January 2008,
+       * available at 
+       *     http://intellinuxgraphics.org/documentation.html
+       * at the time of this writing).
+       *
+       * It does work on at least some devices, if not all;
+       * if devices that don't support it can be identified,
+       * the likely failure case is that points are rasterized
+       * incorrectly, which is no worse than occurs without
+       * the value, so we're using it here.
+       */
+      sf.sf6.point_rast_rule = BRW_RASTRULE_LOWER_RIGHT;
+   }
    /* XXX clamp max depends on AA vs. non-AA */
 
    sf.sf7.sprite_point = key->point_sprite;
index ef99e9c..71bff16 100644 (file)
 
 #include "main/glheader.h"
 #include "main/mtypes.h"
-#include "main/imports.h"
-#include "main/simple_list.h"
-#include "main/enums.h"
-#include "main/image.h"
 #include "main/teximage.h"
-#include "main/texstore.h"
-#include "main/texformat.h"
-
-#include "texmem.h"
 
 #include "intel_context.h"
 #include "intel_regions.h"
 #include "intel_tex.h"
 #include "brw_context.h"
-#include "brw_defines.h"
 
 
 void brw_FrameBufferTexInit( struct brw_context *brw,
index 3807dff..0d6c6ab 100644 (file)
@@ -49,7 +49,8 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
 
    /* r0 -- reserved as usual
     */
-   c->r0 = brw_vec8_grf(reg, 0); reg++;
+   c->r0 = brw_vec8_grf(reg, 0);
+   reg++;
 
    /* User clip planes from curbe: 
     */
@@ -60,7 +61,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
 
       /* Deal with curbe alignment:
        */
-      reg += ((6+c->key.nr_userclip+3)/4)*2;
+      reg += ((6 + c->key.nr_userclip + 3) / 4) * 2;
    }
 
    /* Vertex program parameters from curbe:
@@ -69,7 +70,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
    for (i = 0; i < nr_params; i++) {
       c->regs[PROGRAM_STATE_VAR][i] = stride( brw_vec4_grf(reg+i/2, (i%2) * 4), 0, 4, 1);
    }     
-   reg += (nr_params+1)/2;
+   reg += (nr_params + 1) / 2;
 
    c->prog_data.curb_read_length = reg - 1;
 
@@ -77,7 +78,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
     */
    c->nr_inputs = 0;
    for (i = 0; i < VERT_ATTRIB_MAX; i++) {
-      if (c->prog_data.inputs_read & (1<<i)) {
+      if (c->prog_data.inputs_read & (1 << i)) {
         c->nr_inputs++;
         c->regs[PROGRAM_INPUT][i] = brw_vec8_grf(reg, 0);
         reg++;
@@ -91,7 +92,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
    c->first_output = reg;
    mrf = 4;
    for (i = 0; i < VERT_RESULT_MAX; i++) {
-      if (c->prog_data.outputs_written & (1<<i)) {
+      if (c->prog_data.outputs_written & (1 << i)) {
         c->nr_outputs++;
         if (i == VERT_RESULT_HPOS) {
            c->regs[PROGRAM_OUTPUT][i] = brw_vec8_grf(reg, 0);
@@ -133,16 +134,15 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
    }
 
    for (i = 0; i < 128; i++) {
-       if (c->output_regs[i].used_in_src) {
-            c->output_regs[i].reg = brw_vec8_grf(reg, 0);
-            reg++;
-        }
+      if (c->output_regs[i].used_in_src) {
+         c->output_regs[i].reg = brw_vec8_grf(reg, 0);
+         reg++;
+      }
    }
 
    c->stack =  brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg, 0);
    reg += 2;
-   
+
    /* Some opcodes need an internal temporary:
     */
    c->first_tmp = reg;
@@ -152,9 +152,9 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
     * urb_read_length is the number of registers read from *each*
     * vertex urb, so is half the amount:
     */
-   c->prog_data.urb_read_length = (c->nr_inputs+1)/2;
+   c->prog_data.urb_read_length = (c->nr_inputs + 1) / 2;
 
-   c->prog_data.urb_entry_size = (c->nr_outputs+2+3)/4;
+   c->prog_data.urb_entry_size = (c->nr_outputs + 2 + 3) / 4;
    c->prog_data.total_grf = reg;
 
    if (INTEL_DEBUG & DEBUG_VS) {
@@ -187,6 +187,10 @@ static void release_tmps( struct brw_vs_compile *c )
 }
 
 
+/**
+ * If an instruction uses a temp reg both as a src and the dest, we
+ * sometimes need to allocate an intermediate temporary.
+ */
 static void unalias1( struct brw_vs_compile *c,
                      struct brw_reg dst,
                      struct brw_reg arg0,
@@ -206,6 +210,10 @@ static void unalias1( struct brw_vs_compile *c,
    }
 }
 
+/**
+ * \sa unalias2
+ * Checkes if 2-operand instruction needs an intermediate temporary.
+ */
 static void unalias2( struct brw_vs_compile *c,
                      struct brw_reg dst,
                      struct brw_reg arg0,
@@ -228,6 +236,10 @@ static void unalias2( struct brw_vs_compile *c,
    }
 }
 
+/**
+ * \sa unalias2
+ * Checkes if 3-operand instruction needs an intermediate temporary.
+ */
 static void unalias3( struct brw_vs_compile *c,
                      struct brw_reg dst,
                      struct brw_reg arg0,
@@ -981,7 +993,7 @@ post_vs_emit( struct brw_vs_compile *c,
 }
 
 
-/* Emit the fragment program instructions here.
+/* Emit the vertex program instructions here.
  */
 void brw_vs_emit(struct brw_vs_compile *c )
 {
@@ -1038,7 +1050,7 @@ void brw_vs_emit(struct brw_vs_compile *c )
              struct prog_src_register *src = &inst->SrcReg[i];
              index = src->Index;
              file = src->File; 
-             if (file == PROGRAM_OUTPUT&&c->output_regs[index].used_in_src)
+             if (file == PROGRAM_OUTPUT && c->output_regs[index].used_in_src)
                  args[i] = c->output_regs[index].reg;
              else
                  args[i] = get_arg(c, src);
index 1645ca0..90d74c2 100644 (file)
@@ -40,6 +40,8 @@
 GLuint brw_wm_nr_args( GLuint opcode )
 {
    switch (opcode) {
+   case WM_FRONTFACING:
+      return 0;
    case WM_PIXELXY:
    case WM_CINTERP:
    case WM_WPOSXY:
@@ -103,12 +105,17 @@ brw_wm_non_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c)
    brw_wm_pass1(c);
 
    /* Register allocation.
+    * Divide by two because we operate on 16 pixels at a time and require
+    * two GRF entries for each logical shader register.
     */
    c->grf_limit = BRW_WM_MAX_GRF / 2;
 
    brw_wm_pass2(c);
 
+   /* how many general-purpose registers are used */
    c->prog_data.total_grf = c->max_wm_grf;
+
+   /* Scratch space is used for register spilling */
    if (c->last_scratch) {
       c->prog_data.total_scratch = c->last_scratch + 0x40;
    }
index 7f0e570..d0ab3bd 100644 (file)
@@ -172,7 +172,8 @@ struct brw_wm_instruction {
 #define WM_CINTERP        (MAX_OPCODE + 5)
 #define WM_WPOSXY         (MAX_OPCODE + 6)
 #define WM_FB_WRITE       (MAX_OPCODE + 7)
-#define MAX_WM_OPCODE     (MAX_OPCODE + 8)
+#define WM_FRONTFACING    (MAX_OPCODE + 8)
+#define MAX_WM_OPCODE     (MAX_OPCODE + 9)
 
 #define PROGRAM_PAYLOAD   (PROGRAM_FILE_MAX)
 #define PAYLOAD_DEPTH     (FRAG_ATTRIB_MAX)
@@ -241,8 +242,8 @@ struct brw_wm_compile {
 
    /** Mapping from Mesa registers to hardware registers */
    struct {
-       GLboolean inited;
-       struct brw_reg reg;
+      GLboolean inited;
+      struct brw_reg reg;
    } wm_regs[PROGRAM_PAYLOAD+1][256][4];
 
    struct brw_reg stack;
@@ -252,6 +253,14 @@ struct brw_wm_compile {
    GLuint tmp_index;
    GLuint tmp_max;
    GLuint subroutines[BRW_WM_MAX_SUBROUTINE];
+
+   /** using a real constant buffer? */
+   GLboolean use_const_buffer;
+   /** we may need up to 3 constants per instruction (if use_const_buffer) */
+   struct {
+      GLint index;
+      struct brw_reg reg;
+   } current_const[3];
 };
 
 
index 8f07f89..2208210 100644 (file)
@@ -130,6 +130,9 @@ void brw_wm_print_insn( struct brw_wm_compile *c,
    case WM_FB_WRITE:
       _mesa_printf(" = FB_WRITE");
       break;
+   case WM_FRONTFACING:
+      _mesa_printf(" = FRONTFACING");
+      break;
    default:
       _mesa_printf(" = %s", _mesa_opcode_string(inst->opcode));
       break;
index f2dca9c..d65b133 100644 (file)
@@ -254,6 +254,34 @@ static void emit_cinterp( struct brw_compile *p,
    }
 }
 
+/* Sets the destination channels to 1.0 or 0.0 according to glFrontFacing. */
+static void emit_frontfacing( struct brw_compile *p,
+                             const struct brw_reg *dst,
+                             GLuint mask )
+{
+   struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD);
+   GLuint i;
+
+   if (!(mask & WRITEMASK_XYZW))
+      return;
+
+   for (i = 0; i < 4; i++) {
+      if (mask & (1<<i)) {
+        brw_MOV(p, dst[i], brw_imm_f(0.0));
+      }
+   }
+
+   /* bit 31 is "primitive is back face", so checking < (1 << 31) gives
+    * us front face
+    */
+   brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, r1_6ud, brw_imm_ud(1 << 31));
+   for (i = 0; i < 4; i++) {
+      if (mask & (1<<i)) {
+        brw_MOV(p, dst[i], brw_imm_f(1.0));
+      }
+   }
+   brw_set_predicate_control_flag_value(p, 0xff);
+}
 
 static void emit_alu1( struct brw_compile *p, 
                       struct brw_instruction *(*func)(struct brw_compile *, 
@@ -996,8 +1024,8 @@ static void emit_fb_write( struct brw_wm_compile *c,
 }
 
 
-/* Post-fragment-program processing.  Send the results to the
- * framebuffer.
+/**
+ * Move a GPR to scratch memory. 
  */
 static void emit_spill( struct brw_wm_compile *c,
                        struct brw_reg reg,
@@ -1021,6 +1049,9 @@ static void emit_spill( struct brw_wm_compile *c,
 }
 
 
+/**
+ * Load a GPR from scratch memory. 
+ */
 static void emit_unspill( struct brw_wm_compile *c,
                          struct brw_reg reg,
                          GLuint slot )
@@ -1041,13 +1072,14 @@ static void emit_unspill( struct brw_wm_compile *c,
 
    brw_dp_READ_16(p,
                  retype(vec16(reg), BRW_REGISTER_TYPE_UW),
-                 1, 
+                 1,
                  slot);
 }
 
 
 /**
- * Retrieve upto 4 GEN4 register pairs for the given wm reg:
+ * Retrieve up to 4 GEN4 register pairs for the given wm reg:
+ * Args with unspill_reg != 0 will be loaded from scratch memory.
  */
 static void get_argument_regs( struct brw_wm_compile *c,
                               struct brw_wm_ref *arg[],
@@ -1057,13 +1089,12 @@ static void get_argument_regs( struct brw_wm_compile *c,
 
    for (i = 0; i < 4; i++) {
       if (arg[i]) {
-
-        if (arg[i]->unspill_reg) 
-           emit_unspill(c, 
+        if (arg[i]->unspill_reg)
+           emit_unspill(c,
                         brw_vec8_grf(arg[i]->unspill_reg, 0),
                         arg[i]->value->spill_slot);
 
-        regs[i] = arg[i]->hw_reg;       
+        regs[i] = arg[i]->hw_reg;
       }
       else {
         regs[i] = brw_null_reg();
@@ -1072,6 +1103,9 @@ static void get_argument_regs( struct brw_wm_compile *c,
 }
 
 
+/**
+ * For values that have a spill_slot!=0, write those regs to scratch memory.
+ */
 static void spill_values( struct brw_wm_compile *c,
                          struct brw_wm_value *values,
                          GLuint nr )
@@ -1160,6 +1194,10 @@ void brw_wm_emit( struct brw_wm_compile *c )
         emit_fb_write(c, args[0], args[1], args[2], inst->target, inst->eot);
         break;
 
+      case WM_FRONTFACING:
+        emit_frontfacing(p, dst, dst_flags);
+        break;
+
         /* Straightforward arithmetic:
          */
       case OPCODE_ADD:
index 533be38..a7f5f1b 100644 (file)
@@ -58,7 +58,8 @@ static const char *wm_opcode_strings[] = {
    "PINTERP",
    "CINTERP",
    "WPOSXY",
-   "FB_WRITE"
+   "FB_WRITE",
+   "FRONTFACING",
 };
 
 #if 0
@@ -313,18 +314,13 @@ static void emit_interp( struct brw_wm_compile *c,
    struct prog_dst_register dst = dst_reg(PROGRAM_INPUT, idx);
    struct prog_src_register interp = src_reg(PROGRAM_PAYLOAD, idx);
    struct prog_src_register deltas = get_delta_xy(c);
-   struct prog_src_register arg2;
-   GLuint opcode;
-   
+
    /* Need to use PINTERP on attributes which have been
     * multiplied by 1/W in the SF program, and LINTERP on those
     * which have not:
     */
    switch (idx) {
    case FRAG_ATTRIB_WPOS:
-      opcode = WM_LINTERP;
-      arg2 = src_undef();
-
       /* Have to treat wpos.xy specially:
        */
       emit_op(c,
@@ -345,7 +341,7 @@ static void emit_interp( struct brw_wm_compile *c,
              0,
              interp,
              deltas,
-             arg2);
+             src_undef());
       break;
    case FRAG_ATTRIB_COL0:
    case FRAG_ATTRIB_COL1:
@@ -368,6 +364,56 @@ static void emit_interp( struct brw_wm_compile *c,
                 src_undef());
       }
       break;
+   case FRAG_ATTRIB_FOGC:
+      /* The FOGC input is really special.  When a program uses glFogFragCoord,
+       * the results returned are supposed to be (f,0,0,1).  But for Mesa GLSL,
+       * the glFrontFacing and glPointCoord values are also stashed in FOGC.
+       * So, write the interpolated fog value to X, then either 0, 1, or the
+       * stashed values to Y, Z, W.  Note that this means that
+       * glFogFragCoord.yzw can be wrong in those cases!
+       */
+
+      /* Interpolate the fog coordinate */
+      emit_op(c,
+             WM_PINTERP,
+             dst_mask(dst, WRITEMASK_X),
+             0,
+             interp,
+             deltas,
+             get_pixel_w(c));
+
+      /* Move the front facing value into FOGC.y if it's needed. */
+      if (c->fp->program.UsesFrontFacing) {
+        emit_op(c,
+                WM_FRONTFACING,
+                dst_mask(dst, WRITEMASK_Y),
+                0,
+                src_undef(),
+                src_undef(),
+                src_undef());
+      } else {
+        emit_op(c,
+                OPCODE_MOV,
+                dst_mask(dst, WRITEMASK_Y),
+                0,
+                src_swizzle1(interp, SWIZZLE_ZERO),
+                src_undef(),
+                src_undef());
+      }
+
+      /* Should do the PointCoord thing here. */
+      emit_op(c,
+             OPCODE_MOV,
+             dst_mask(dst, WRITEMASK_ZW),
+             0,
+             src_swizzle(interp,
+                         SWIZZLE_ZERO,
+                         SWIZZLE_ZERO,
+                         SWIZZLE_ZERO,
+                         SWIZZLE_ONE),
+             src_undef(),
+             src_undef());
+      break;
    default:
       emit_op(c,
              WM_PINTERP,
index 4cf0922..575cd45 100644 (file)
@@ -192,28 +192,42 @@ static void prealloc_reg(struct brw_wm_compile *c)
     /* constants */
     {
         const int nr_params = c->fp->program.Base.Parameters->NumParameters;
-        const struct gl_program_parameter_list *plist = 
-           c->fp->program.Base.Parameters;
-       int index = 0;
-
-        /* number of float constants */
-       c->prog_data.nr_params = 4 * nr_params;
-
-        /* loop over program constants (float[4]) */
-       for (i = 0; i < nr_params; i++) {
-            /* loop over XYZW channels */
-            for (j = 0; j < 4; j++, index++) {
-                reg = brw_vec1_grf(c->reg_index + index / 8, index % 8);
-                /* Save pointer to parameter/constant value.
-                 * Constants will be copied in prepare_constant_buffer()
-                 */
-                c->prog_data.param[index] = &plist->ParameterValues[i][j];
-                set_reg(c, PROGRAM_STATE_VAR, i, j, reg);
-           }
-       }
-        /* number of constant regs used (each reg is float[8]) */
-       c->nr_creg = 2 * ((4 * nr_params + 15) / 16);
-       c->reg_index += c->nr_creg;
+
+        /* use a real constant buffer, or just use a section of the GRF? */
+        c->use_const_buffer = GL_FALSE; /* (nr_params > 8);*/
+
+        if (c->use_const_buffer) {
+           /* We'll use a real constant buffer and fetch constants from
+            * it with a dataport read message.
+            */
+
+           /* number of float constants in CURBE */
+           c->prog_data.nr_params = 0;
+        }
+        else {
+           const struct gl_program_parameter_list *plist = 
+              c->fp->program.Base.Parameters;
+           int index = 0;
+
+           /* number of float constants in CURBE */
+           c->prog_data.nr_params = 4 * nr_params;
+
+           /* loop over program constants (float[4]) */
+           for (i = 0; i < nr_params; i++) {
+              /* loop over XYZW channels */
+              for (j = 0; j < 4; j++, index++) {
+                 reg = brw_vec1_grf(c->reg_index + index / 8, index % 8);
+                 /* Save pointer to parameter/constant value.
+                  * Constants will be copied in prepare_constant_buffer()
+                  */
+                 c->prog_data.param[index] = &plist->ParameterValues[i][j];
+                 set_reg(c, PROGRAM_STATE_VAR, i, j, reg);
+              }
+           }
+           /* number of constant regs used (each reg is float[8]) */
+           c->nr_creg = 2 * ((4 * nr_params + 15) / 16);
+           c->reg_index += c->nr_creg;
+        }
     }
 
     /* fragment shader inputs */
@@ -234,6 +248,81 @@ static void prealloc_reg(struct brw_wm_compile *c)
     c->reg_index++;
     c->stack =  brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0);
     c->reg_index += 2;
+
+    /* An instruction may reference up to three constants.
+     * They'll be found in these registers.
+     * XXX alloc these on demand!
+     */
+    if (c->use_const_buffer) {
+       c->current_const[0].reg = alloc_tmp(c);
+       c->current_const[1].reg = alloc_tmp(c);
+       c->current_const[2].reg = alloc_tmp(c);
+    }
+    /*
+    printf("USE CONST BUFFER? %d\n", c->use_const_buffer);
+    printf("AFTER PRE_ALLOC, reg_index = %d\n", c->reg_index);
+    */
+}
+
+
+/**
+ * Check if any of the instruction's src registers are constants, uniforms,
+ * or statevars.  If so, fetch any constants that we don't already have in
+ * the three GRF slots.
+ */
+static void fetch_constants(struct brw_wm_compile *c,
+                            const struct prog_instruction *inst)
+{
+   struct brw_compile *p = &c->func;
+   GLuint i;
+
+   /* loop over instruction src regs */
+   for (i = 0; i < 3; i++) {
+      const struct prog_src_register *src = &inst->SrcReg[i];
+      if (src->File == PROGRAM_STATE_VAR ||
+          src->File == PROGRAM_CONSTANT ||
+          src->File == PROGRAM_UNIFORM) {
+         if (c->current_const[i].index != src->Index) {
+
+            c->current_const[i].index = src->Index;
+            /*c->current_const[i].reg = alloc_tmp(c);*/
+
+            /*
+            printf("  fetch const[%d] for arg %d into reg %d\n",
+                   src->Index, i, c->current_const[i].reg.nr);
+            */
+
+            /* need to fetch the constant now */
+            brw_dp_READ_4(p,
+                          c->current_const[i].reg,  /* writeback dest */
+                          1,                        /* msg_reg */
+                          src->RelAddr,             /* relative indexing? */
+                          16 * src->Index,          /* byte offset */
+                          BRW_WM_MAX_SURF - 1       /* binding table index */
+                          );
+
+#if 0
+            /* dependency stall */
+            {
+               int response_length = 1;
+               int mark = mark_tmps( c );
+               struct brw_reg src = c->current_const[i].reg;
+               struct brw_reg tmp = alloc_tmp(c);
+
+               /*  mov (8) r9.0<1>:f    r9.0<8;8,1>:f    { Align1 }
+                */
+               brw_push_insn_state(p);
+               brw_set_compression_control(p, BRW_COMPRESSION_NONE);
+               brw_MOV(p, tmp, src);         
+               brw_MOV(p, src, tmp);         
+               brw_pop_insn_state(p);
+
+               release_tmps( c, mark );
+            }
+#endif
+         }
+      }
+   }
 }
 
 
@@ -241,24 +330,112 @@ static void prealloc_reg(struct brw_wm_compile *c)
  * Convert Mesa dst register to brw register.
  */
 static struct brw_reg get_dst_reg(struct brw_wm_compile *c, 
-       struct prog_instruction *inst, int component, int nr)
+                                  const struct prog_instruction *inst,
+                                  GLuint component)
 {
+    const int nr = 1;
     return get_reg(c, inst->DstReg.File, inst->DstReg.Index, component, nr,
            0, 0);
 }
 
 
+static struct brw_reg
+get_src_reg_const(struct brw_wm_compile *c,
+                  const struct prog_instruction *inst,
+                  GLuint srcRegIndex, GLuint component)
+{
+   /* We should have already fetched the constant from the constant
+    * buffer in fetch_constants().  Now we just have to return a
+    * register description that extracts the needed component and
+    * smears it across all eight vector components.
+    */
+   const struct prog_src_register *src = &inst->SrcReg[srcRegIndex];
+   struct brw_reg const_reg;
+
+   assert(component < 4);
+   assert(srcRegIndex < 3);
+   assert(c->current_const[srcRegIndex].index != -1);
+   const_reg = c->current_const[srcRegIndex].reg;
+
+   /* extract desired float from the const_reg, and smear */
+   const_reg = stride(const_reg, 0, 1, 0);
+   const_reg.subnr = component * 4;
+
+   if (src->NegateBase)
+      const_reg = negate(const_reg);
+   if (src->Abs)
+      const_reg = brw_abs(const_reg);
+
+   /*
+   printf("  form const[%d] for arg %d, comp %d, reg %d\n",
+          c->current_const[srcRegIndex].index,
+          srcRegIndex,
+          component,
+          const_reg.nr);
+   */
+
+   return const_reg;
+}
+
+
 /**
  * Convert Mesa src register to brw register.
  */
 static struct brw_reg get_src_reg(struct brw_wm_compile *c, 
-       struct prog_src_register *src, int index, int nr)
-{
-    int component = GET_SWZ(src->Swizzle, index);
-    return get_reg(c, src->File, src->Index, component, nr, 
-           src->NegateBase, src->Abs);
+                                  const struct prog_instruction *inst,
+                                  GLuint srcRegIndex, GLuint channel)
+{
+    const struct prog_src_register *src = &inst->SrcReg[srcRegIndex];
+    const GLuint nr = 1;
+    const GLuint component = GET_SWZ(src->Swizzle, channel);
+
+    if (c->use_const_buffer &&
+        (src->File == PROGRAM_STATE_VAR ||
+         src->File == PROGRAM_CONSTANT ||
+         src->File == PROGRAM_UNIFORM)) {
+       return get_src_reg_const(c, inst, srcRegIndex, component);
+    }
+    else {
+       /* other type of source register */
+       return get_reg(c, src->File, src->Index, component, nr, 
+                      src->NegateBase, src->Abs);
+    }
+}
+
+
+/**
+ * Same as \sa get_src_reg() but if the register is a literal, emit
+ * a brw_reg encoding the literal.
+ * Note that a brw instruction only allows one src operand to be a literal.
+ * For instructions with more than one operand, only the second can be a
+ * literal.  This means that we treat some literals as constants/uniforms
+ * (which why PROGRAM_CONSTANT is checked in fetch_constants()).
+ * 
+ */
+static struct brw_reg get_src_reg_imm(struct brw_wm_compile *c, 
+                                      const struct prog_instruction *inst,
+                                      GLuint srcRegIndex, GLuint channel)
+{
+    const struct prog_src_register *src = &inst->SrcReg[srcRegIndex];
+    if (src->File == PROGRAM_CONSTANT) {
+       /* a literal */
+       const int component = GET_SWZ(src->Swizzle, channel);
+       const GLfloat *param =
+          c->fp->program.Base.Parameters->ParameterValues[src->Index];
+       GLfloat value = param[component];
+       if (src->NegateBase)
+          value = -value;
+       if (src->Abs)
+          value = FABSF(value);
+       /*printf("  form imm reg %f\n", value);*/
+       return brw_imm_f(value);
+    }
+    else {
+       return get_src_reg(c, inst, srcRegIndex, channel);
+    }
 }
 
+
 /**
  * Subroutines are minimal support for resusable instruction sequences.
  * They are implemented as simply as possible to minimise overhead: there
@@ -332,8 +509,8 @@ static void emit_abs( struct brw_wm_compile *c,
     for (i = 0; i < 4; i++) {
        if (inst->DstReg.WriteMask & (1<<i)) {
            struct brw_reg src, dst;
-           dst = get_dst_reg(c, inst, i, 1);
-           src = get_src_reg(c, &inst->SrcReg[0], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src = get_src_reg(c, inst, 0, i);
            brw_MOV(p, dst, brw_abs(src));
        }
     }
@@ -350,8 +527,8 @@ static void emit_trunc( struct brw_wm_compile *c,
     for (i = 0; i < 4; i++) {
        if (mask & (1<<i)) {
            struct brw_reg src, dst;
-           dst = get_dst_reg(c, inst, i, 1) ;
-           src = get_src_reg(c, &inst->SrcReg[0], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src = get_src_reg(c, inst, 0, i);
            brw_RNDZ(p, dst, src);
        }
     }
@@ -368,8 +545,8 @@ static void emit_mov( struct brw_wm_compile *c,
     for (i = 0; i < 4; i++) {
        if (mask & (1<<i)) {
            struct brw_reg src, dst;
-           dst = get_dst_reg(c, inst, i, 1);
-           src = get_src_reg(c, &inst->SrcReg[0], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src = get_src_reg_imm(c, inst, 0, i);
            brw_MOV(p, dst, src);
        }
     }
@@ -386,8 +563,8 @@ static void emit_pixel_xy(struct brw_wm_compile *c,
     struct brw_compile *p = &c->func;
     GLuint mask = inst->DstReg.WriteMask;
 
-    dst0 = get_dst_reg(c, inst, 0, 1);
-    dst1 = get_dst_reg(c, inst, 1, 1);
+    dst0 = get_dst_reg(c, inst, 0);
+    dst1 = get_dst_reg(c, inst, 1);
     /* Calculate pixel centers by adding 1 or 0 to each of the
      * micro-tile coordinates passed in r1.
      */
@@ -414,10 +591,10 @@ static void emit_delta_xy(struct brw_wm_compile *c,
     struct brw_compile *p = &c->func;
     GLuint mask = inst->DstReg.WriteMask;
 
-    dst0 = get_dst_reg(c, inst, 0, 1);
-    dst1 = get_dst_reg(c, inst, 1, 1);
-    src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
-    src1 = get_src_reg(c, &inst->SrcReg[0], 1, 1);
+    dst0 = get_dst_reg(c, inst, 0);
+    dst1 = get_dst_reg(c, inst, 1);
+    src0 = get_src_reg(c, inst, 0, 0);
+    src1 = get_src_reg(c, inst, 0, 1);
     /* Calc delta X,Y by subtracting origin in r1 from the pixel
      * centers.
      */
@@ -482,7 +659,7 @@ static void emit_fb_write(struct brw_wm_compile *c,
 
     brw_push_insn_state(p);
     for (channel = 0; channel < 4; channel++) {
-        src0 = get_src_reg(c,  &inst->SrcReg[0], channel, 1);
+        src0 = get_src_reg(c,  inst, 0, channel);
         /*  mov (8) m2.0<1>:ud   r28.0<8;8,1>:ud  { Align1 } */
         /*  mov (8) m6.0<1>:ud   r29.0<8;8,1>:ud  { Align1 SecHalf } */
         brw_MOV(p, brw_message_reg(nr + channel), src0);
@@ -493,11 +670,11 @@ static void emit_fb_write(struct brw_wm_compile *c,
 
     if (c->key.source_depth_to_render_target) {
        if (c->key.computes_depth) {
-          src0 = get_src_reg(c, &inst->SrcReg[2], 2, 1);
+          src0 = get_src_reg(c, inst, 2, 2);
           brw_MOV(p, brw_message_reg(nr), src0);
        }
        else {
-          src0 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
+          src0 = get_src_reg(c, inst, 1, 1);
           brw_MOV(p, brw_message_reg(nr), src0);
        }
 
@@ -524,7 +701,7 @@ static void emit_fb_write(struct brw_wm_compile *c,
         else
 #endif
         {
-           struct brw_reg src =  get_src_reg(c, &inst->SrcReg[1], 1, 1);
+           struct brw_reg src =  get_src_reg(c, inst, 1, 1);
            brw_MOV(p, brw_message_reg(nr), src);
         }
         nr += 2;
@@ -544,10 +721,10 @@ static void emit_pixel_w( struct brw_wm_compile *c,
        struct brw_reg dst, src0, delta0, delta1;
        struct brw_reg interp3;
 
-       dst = get_dst_reg(c, inst, 3, 1);
-       src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
-       delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
-       delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
+       dst = get_dst_reg(c, inst, 3);
+       src0 = get_src_reg(c, inst, 0, 0);
+       delta0 = get_src_reg(c, inst, 1, 0);
+       delta1 = get_src_reg(c, inst, 1, 1);
 
        interp3 = brw_vec1_grf(src0.nr+1, 4);
        /* Calc 1/w - just linterp wpos[3] optimized by putting the
@@ -575,9 +752,9 @@ static void emit_linterp(struct brw_wm_compile *c,
     struct brw_reg src0;
     GLuint nr, i;
 
-    src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
-    delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
-    delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
+    src0 = get_src_reg(c, inst, 0, 0);
+    delta0 = get_src_reg(c, inst, 1, 0);
+    delta1 = get_src_reg(c, inst, 1, 1);
     nr = src0.nr;
 
     interp[0] = brw_vec1_grf(nr, 0);
@@ -587,7 +764,7 @@ static void emit_linterp(struct brw_wm_compile *c,
 
     for(i = 0; i < 4; i++ ) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
+           dst = get_dst_reg(c, inst, i);
            brw_LINE(p, brw_null_reg(), interp[i], delta0);
            brw_MAC(p, dst, suboffset(interp[i],1), delta1);
        }
@@ -604,7 +781,7 @@ static void emit_cinterp(struct brw_wm_compile *c,
     struct brw_reg dst, src0;
     GLuint nr, i;
 
-    src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+    src0 = get_src_reg(c, inst, 0, 0);
     nr = src0.nr;
 
     interp[0] = brw_vec1_grf(nr, 0);
@@ -614,7 +791,7 @@ static void emit_cinterp(struct brw_wm_compile *c,
 
     for(i = 0; i < 4; i++ ) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
+           dst = get_dst_reg(c, inst, i);
            brw_MOV(p, dst, suboffset(interp[i],3));
        }
     }
@@ -631,10 +808,10 @@ static void emit_pinterp(struct brw_wm_compile *c,
     struct brw_reg src0, w;
     GLuint nr, i;
 
-    src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
-    delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
-    delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
-    w = get_src_reg(c, &inst->SrcReg[2], 3, 1);
+    src0 = get_src_reg(c, inst, 0, 0);
+    delta0 = get_src_reg(c, inst, 1, 0);
+    delta1 = get_src_reg(c, inst, 1, 1);
+    w = get_src_reg(c, inst, 2, 3);
     nr = src0.nr;
 
     interp[0] = brw_vec1_grf(nr, 0);
@@ -644,7 +821,7 @@ static void emit_pinterp(struct brw_wm_compile *c,
 
     for(i = 0; i < 4; i++ ) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
+           dst = get_dst_reg(c, inst, i);
            brw_LINE(p, brw_null_reg(), interp[i], delta0);
            brw_MAC(p, dst, suboffset(interp[i],1), 
                    delta1);
@@ -653,6 +830,36 @@ static void emit_pinterp(struct brw_wm_compile *c,
     }
 }
 
+/* Sets the destination channels to 1.0 or 0.0 according to glFrontFacing. */
+static void emit_frontfacing(struct brw_wm_compile *c,
+                            struct prog_instruction *inst)
+{
+    struct brw_compile *p = &c->func;
+    struct brw_reg r1_6ud = retype(brw_vec1_grf(1, 6), BRW_REGISTER_TYPE_UD);
+    struct brw_reg dst;
+    GLuint mask = inst->DstReg.WriteMask;
+    int i;
+
+    for (i = 0; i < 4; i++) {
+       if (mask & (1<<i)) {
+           dst = get_dst_reg(c, inst, i);
+           brw_MOV(p, dst, brw_imm_f(0.0));
+       }
+    }
+
+    /* bit 31 is "primitive is back face", so checking < (1 << 31) gives
+     * us front face
+     */
+    brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, r1_6ud, brw_imm_ud(1 << 31));
+    for (i = 0; i < 4; i++) {
+       if (mask & (1<<i)) {
+           dst = get_dst_reg(c, inst, i);
+           brw_MOV(p, dst, brw_imm_f(1.0));
+       }
+    }
+    brw_set_predicate_control_flag_value(p, 0xff);
+}
+
 static void emit_xpd(struct brw_wm_compile *c,
                struct prog_instruction *inst)
 {
@@ -664,12 +871,12 @@ static void emit_xpd(struct brw_wm_compile *c,
        GLuint i1 = (i+1)%3;
        if (mask & (1<<i)) {
            struct brw_reg src0, src1, dst;
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = negate(get_src_reg(c, &inst->SrcReg[0], i2, 1));
-           src1 = get_src_reg(c, &inst->SrcReg[1], i1, 1);
+           dst = get_dst_reg(c, inst, i);
+           src0 = negate(get_src_reg(c, inst, 0, i2));
+           src1 = get_src_reg_imm(c, inst, 1, i1);
            brw_MUL(p, brw_null_reg(), src0, src1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i1, 1);
-           src1 = get_src_reg(c, &inst->SrcReg[1], i2, 1);
+           src0 = get_src_reg(c, inst, 0, i1);
+           src1 = get_src_reg_imm(c, inst, 1, i2);
            brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF);
            brw_MAC(p, dst, src0, src1);
            brw_set_saturate(p, 0);
@@ -685,11 +892,11 @@ static void emit_dp3(struct brw_wm_compile *c,
     int i;
     struct brw_compile *p = &c->func;
     for (i = 0; i < 3; i++) {
-       src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
-       src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1);
+       src0[i] = get_src_reg(c, inst, 0, i);
+       src1[i] = get_src_reg_imm(c, inst, 1, i);
     }
 
-    dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
+    dst = get_dst_reg(c, inst, get_scalar_dst_index(inst));
     brw_MUL(p, brw_null_reg(), src0[0], src1[0]);
     brw_MAC(p, brw_null_reg(), src0[1], src1[1]);
     brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
@@ -704,10 +911,10 @@ static void emit_dp4(struct brw_wm_compile *c,
     int i;
     struct brw_compile *p = &c->func;
     for (i = 0; i < 4; i++) {
-       src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
-       src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1);
+       src0[i] = get_src_reg(c, inst, 0, i);
+       src1[i] = get_src_reg_imm(c, inst, 1, i);
     }
-    dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
+    dst = get_dst_reg(c, inst, get_scalar_dst_index(inst));
     brw_MUL(p, brw_null_reg(), src0[0], src1[0]);
     brw_MAC(p, brw_null_reg(), src0[1], src1[1]);
     brw_MAC(p, brw_null_reg(), src0[2], src1[2]);
@@ -723,10 +930,10 @@ static void emit_dph(struct brw_wm_compile *c,
     int i;
     struct brw_compile *p = &c->func;
     for (i = 0; i < 4; i++) {
-       src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
-       src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1);
+       src0[i] = get_src_reg(c, inst, 0, i);
+       src1[i] = get_src_reg_imm(c, inst, 1, i);
     }
-    dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
+    dst = get_dst_reg(c, inst, get_scalar_dst_index(inst));
     brw_MUL(p, brw_null_reg(), src0[0], src1[0]);
     brw_MAC(p, brw_null_reg(), src0[1], src1[1]);
     brw_MAC(p, dst, src0[2], src1[2]);
@@ -751,7 +958,7 @@ static void emit_math1(struct brw_wm_compile *c,
     tmp = alloc_tmp(c);
 
     /* Get first component of source register */
-    src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+    src0 = get_src_reg(c, inst, 0, 0);
 
     /* tmp = func(src0) */
     brw_MOV(p, brw_message_reg(2), src0);
@@ -769,7 +976,7 @@ static void emit_math1(struct brw_wm_compile *c,
     /* replicate tmp value across enabled dest channels */
     for (i = 0; i < 4; i++) {
        if (inst->DstReg.WriteMask & (1 << i)) {
-          dst = get_dst_reg(c, inst, i, 1);    
+          dst = get_dst_reg(c, inst, i);
           brw_MOV(p, dst, tmp);
        }
     }
@@ -823,15 +1030,28 @@ static void emit_add(struct brw_wm_compile *c,
     brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
     for (i = 0 ; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
-           src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src0 = get_src_reg(c, inst, 0, i);
+           src1 = get_src_reg_imm(c, inst, 1, i);
            brw_ADD(p, dst, src0, src1);
        }
     }
     brw_set_saturate(p, 0);
 }
 
+static void emit_arl(struct brw_wm_compile *c,
+                     struct prog_instruction *inst)
+{
+    struct brw_compile *p = &c->func;
+    struct brw_reg src0, addr_reg;
+    brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+    addr_reg = brw_uw8_reg(BRW_ARCHITECTURE_REGISTER_FILE, 
+                           BRW_ARF_ADDRESS, 0);
+    src0 = get_src_reg(c, inst, 0, 0); /* channel 0 */
+    brw_MOV(p, addr_reg, src0);
+    brw_set_saturate(p, 0);
+}
+
 static void emit_sub(struct brw_wm_compile *c,
                struct prog_instruction *inst)
 {
@@ -842,9 +1062,9 @@ static void emit_sub(struct brw_wm_compile *c,
     brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
     for (i = 0 ; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
-           src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src0 = get_src_reg(c, inst, 0, i);
+           src1 = get_src_reg_imm(c, inst, 1, i);
            brw_ADD(p, dst, src0, negate(src1));
        }
     }
@@ -861,9 +1081,9 @@ static void emit_mul(struct brw_wm_compile *c,
     brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
     for (i = 0 ; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
-           src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src0 = get_src_reg(c, inst, 0, i);
+           src1 = get_src_reg_imm(c, inst, 1, i);
            brw_MUL(p, dst, src0, src1);
        }
     }
@@ -880,8 +1100,8 @@ static void emit_frc(struct brw_wm_compile *c,
     brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
     for (i = 0 ; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src0 = get_src_reg_imm(c, inst, 0, i);
            brw_FRC(p, dst, src0);
        }
     }
@@ -899,68 +1119,61 @@ static void emit_flr(struct brw_wm_compile *c,
     brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
     for (i = 0 ; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src0 = get_src_reg_imm(c, inst, 0, i);
            brw_RNDD(p, dst, src0);
        }
     }
     brw_set_saturate(p, 0);
 }
 
-static void emit_max(struct brw_wm_compile *c,
-               struct prog_instruction *inst)
-{
-    struct brw_compile *p = &c->func;
-    GLuint mask = inst->DstReg.WriteMask;
-    struct brw_reg src0, src1, dst;
-    int i;
-    brw_push_insn_state(p);
-    for (i = 0; i < 4; i++) {
-       if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
-           src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
-           brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
-           brw_MOV(p, dst, src0);
-           brw_set_saturate(p, 0);
-
-           brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src0, src1);
-           brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
-           brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
-           brw_MOV(p, dst, src1);
-           brw_set_saturate(p, 0);
-           brw_set_predicate_control_flag_value(p, 0xff);
-       }
-    }
-    brw_pop_insn_state(p);
-}
 
-static void emit_min(struct brw_wm_compile *c,
-               struct prog_instruction *inst)
+static void emit_min_max(struct brw_wm_compile *c,
+                         const struct prog_instruction *inst)
 {
     struct brw_compile *p = &c->func;
-    GLuint mask = inst->DstReg.WriteMask;
-    struct brw_reg src0, src1, dst;
+    const GLuint mask = inst->DstReg.WriteMask;
+    const int mark = mark_tmps(c);
     int i;
     brw_push_insn_state(p);
     for (i = 0; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
-           src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+            struct brw_reg real_dst = get_dst_reg(c, inst, i);
+           struct brw_reg src0 = get_src_reg(c, inst, 0, i);
+           struct brw_reg src1 = get_src_reg(c, inst, 1, i);
+            struct brw_reg dst;
+            /* if dst==src0 or dst==src1 we need to use a temp reg */
+            GLboolean use_temp = brw_same_reg(dst, src0) ||
+                                 brw_same_reg(dst, src1);
+            if (use_temp)
+               dst = alloc_tmp(c);
+            else
+               dst = real_dst;
+
+            /*
+            printf("  Min/max: dst %d  src0 %d  src1 %d\n",
+                   dst.nr, src0.nr, src1.nr);
+            */
            brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
            brw_MOV(p, dst, src0);
            brw_set_saturate(p, 0);
 
-           brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src1, src0);
+            if (inst->Opcode == OPCODE_MIN)
+               brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src1, src0);
+            else
+               brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_G, src1, src0);
+
            brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
            brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
            brw_MOV(p, dst, src1);
            brw_set_saturate(p, 0);
            brw_set_predicate_control_flag_value(p, 0xff);
+            if (use_temp)
+               brw_MOV(p, real_dst, dst);
        }
     }
     brw_pop_insn_state(p);
+    release_tmps(c, mark);
 }
 
 static void emit_pow(struct brw_wm_compile *c,
@@ -968,9 +1181,9 @@ static void emit_pow(struct brw_wm_compile *c,
 {
     struct brw_compile *p = &c->func;
     struct brw_reg dst, src0, src1;
-    dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
-    src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
-    src1 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
+    dst = get_dst_reg(c, inst, get_scalar_dst_index(inst));
+    src0 = get_src_reg_imm(c, inst, 0, 0);
+    src1 = get_src_reg_imm(c, inst, 1, 0);
 
     brw_MOV(p, brw_message_reg(2), src0);
     brw_MOV(p, brw_message_reg(3), src1);
@@ -995,10 +1208,10 @@ static void emit_lrp(struct brw_wm_compile *c,
     int mark = mark_tmps(c);
     for (i = 0; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src0 = get_src_reg(c, inst, 0, i);
 
-           src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+           src1 = get_src_reg_imm(c, inst, 1, i);
 
            if (src1.nr == dst.nr) {
                tmp1 = alloc_tmp(c);
@@ -1006,7 +1219,7 @@ static void emit_lrp(struct brw_wm_compile *c,
            } else
                tmp1 = src1;
 
-           src2 = get_src_reg(c, &inst->SrcReg[2], i, 1);
+           src2 = get_src_reg(c, inst, 2, i);
            if (src2.nr == dst.nr) {
                tmp2 = alloc_tmp(c);
                brw_MOV(p, tmp2, src2);
@@ -1048,10 +1261,10 @@ static void emit_mad(struct brw_wm_compile *c,
 
     for (i = 0; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
-           src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
-           src2 = get_src_reg(c, &inst->SrcReg[2], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src0 = get_src_reg(c, inst, 0, i);
+           src1 = get_src_reg_imm(c, inst, 1, i);
+           src2 = get_src_reg_imm(c, inst, 2, i);
            brw_MUL(p, dst, src0, src1);
 
            brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
@@ -1071,9 +1284,9 @@ static void emit_sop(struct brw_wm_compile *c,
 
     for (i = 0; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
-           src0 = get_src_reg(c, &inst->SrcReg[0], i, 1);
-           src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+           dst = get_dst_reg(c, inst, i);
+           src0 = get_src_reg(c, inst, 0, i);
+           src1 = get_src_reg_imm(c, inst, 1, i);
            brw_push_insn_state(p);
            brw_CMP(p, brw_null_reg(), cond, src0, src1);
            brw_set_predicate_control(p, BRW_PREDICATE_NONE);
@@ -1130,8 +1343,8 @@ static void emit_ddx(struct brw_wm_compile *c,
     struct brw_reg dst;
     struct brw_reg src0, w;
     GLuint nr, i;
-    src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
-    w = get_src_reg(c, &inst->SrcReg[1], 3, 1);
+    src0 = get_src_reg(c, inst, 0, 0);
+    w = get_src_reg(c, inst, 1, 3);
     nr = src0.nr;
     interp[0] = brw_vec1_grf(nr, 0);
     interp[1] = brw_vec1_grf(nr, 4);
@@ -1140,7 +1353,7 @@ static void emit_ddx(struct brw_wm_compile *c,
     brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF);
     for(i = 0; i < 4; i++ ) {
         if (mask & (1<<i)) {
-            dst = get_dst_reg(c, inst, i, 1);
+            dst = get_dst_reg(c, inst, i);
             brw_MOV(p, dst, interp[i]);
             brw_MUL(p, dst, dst, w);
         }
@@ -1158,9 +1371,9 @@ static void emit_ddy(struct brw_wm_compile *c,
     struct brw_reg src0, w;
     GLuint nr, i;
 
-    src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+    src0 = get_src_reg(c, inst, 0, 0);
     nr = src0.nr;
-    w = get_src_reg(c, &inst->SrcReg[1], 3, 1);
+    w = get_src_reg(c, inst, 1, 3);
     interp[0] = brw_vec1_grf(nr, 0);
     interp[1] = brw_vec1_grf(nr, 4);
     interp[2] = brw_vec1_grf(nr+1, 0);
@@ -1168,7 +1381,7 @@ static void emit_ddy(struct brw_wm_compile *c,
     brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF);
     for(i = 0; i < 4; i++ ) {
         if (mask & (1<<i)) {
-            dst = get_dst_reg(c, inst, i, 1);
+            dst = get_dst_reg(c, inst, i);
             brw_MOV(p, dst, suboffset(interp[i], 1));
             brw_MUL(p, dst, dst, w);
         }
@@ -1302,7 +1515,7 @@ static void emit_noise1( struct brw_wm_compile *c,
 
     assert( mark == 0 );
     
-    src = get_src_reg( c, inst->SrcReg, 0, 1 );
+    src = get_src_reg( c, inst, 0, 0 );
 
     param = alloc_tmp( c );
 
@@ -1314,7 +1527,7 @@ static void emit_noise1( struct brw_wm_compile *c,
     brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE );
     for (i = 0 ; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
+           dst = get_dst_reg(c, inst, i);
            brw_MOV( p, dst, param );
        }
     }
@@ -1472,8 +1685,8 @@ static void emit_noise2( struct brw_wm_compile *c,
 
     assert( mark == 0 );
     
-    src0 = get_src_reg( c, inst->SrcReg, 0, 1 );
-    src1 = get_src_reg( c, inst->SrcReg, 1, 1 );
+    src0 = get_src_reg( c, inst, 0, 0 );
+    src1 = get_src_reg( c, inst, 0, 1 );
 
     param0 = alloc_tmp( c );
     param1 = alloc_tmp( c );
@@ -1487,7 +1700,7 @@ static void emit_noise2( struct brw_wm_compile *c,
     brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE );
     for (i = 0 ; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
+           dst = get_dst_reg(c, inst, i);
            brw_MOV( p, dst, param0 );
        }
     }
@@ -1775,9 +1988,9 @@ static void emit_noise3( struct brw_wm_compile *c,
 
     assert( mark == 0 );
     
-    src0 = get_src_reg( c, inst->SrcReg, 0, 1 );
-    src1 = get_src_reg( c, inst->SrcReg, 1, 1 );
-    src2 = get_src_reg( c, inst->SrcReg, 2, 1 );
+    src0 = get_src_reg( c, inst, 0, 0 );
+    src1 = get_src_reg( c, inst, 0, 1 );
+    src2 = get_src_reg( c, inst, 0, 2 );
 
     param0 = alloc_tmp( c );
     param1 = alloc_tmp( c );
@@ -1793,7 +2006,7 @@ static void emit_noise3( struct brw_wm_compile *c,
     brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE );
     for (i = 0 ; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
+           dst = get_dst_reg(c, inst, i);
            brw_MOV( p, dst, param0 );
        }
     }
@@ -2198,10 +2411,10 @@ static void emit_noise4( struct brw_wm_compile *c,
 
     assert( mark == 0 );
     
-    src0 = get_src_reg( c, inst->SrcReg, 0, 1 );
-    src1 = get_src_reg( c, inst->SrcReg, 1, 1 );
-    src2 = get_src_reg( c, inst->SrcReg, 2, 1 );
-    src3 = get_src_reg( c, inst->SrcReg, 3, 1 );
+    src0 = get_src_reg( c, inst, 0, 0 );
+    src1 = get_src_reg( c, inst, 0, 1 );
+    src2 = get_src_reg( c, inst, 0, 2 );
+    src3 = get_src_reg( c, inst, 0, 3 );
 
     param0 = alloc_tmp( c );
     param1 = alloc_tmp( c );
@@ -2219,7 +2432,7 @@ static void emit_noise4( struct brw_wm_compile *c,
     brw_set_saturate( p, inst->SaturateMode == SATURATE_ZERO_ONE );
     for (i = 0 ; i < 4; i++) {
        if (mask & (1<<i)) {
-           dst = get_dst_reg(c, inst, i, 1);
+           dst = get_dst_reg(c, inst, i);
            brw_MOV( p, dst, param0 );
        }
     }
@@ -2236,11 +2449,11 @@ static void emit_wpos_xy(struct brw_wm_compile *c,
     GLuint mask = inst->DstReg.WriteMask;
     struct brw_reg src0[2], dst[2];
 
-    dst[0] = get_dst_reg(c, inst, 0, 1);
-    dst[1] = get_dst_reg(c, inst, 1, 1);
+    dst[0] = get_dst_reg(c, inst, 0);
+    dst[1] = get_dst_reg(c, inst, 1);
 
-    src0[0] = get_src_reg(c, &inst->SrcReg[0], 0, 1);
-    src0[1] = get_src_reg(c, &inst->SrcReg[0], 1, 1);
+    src0[0] = get_src_reg(c, inst, 0, 0);
+    src0[1] = get_src_reg(c, inst, 0, 1);
 
     /* Calculate the pixel offset from window bottom left into destination
      * X and Y channels.
@@ -2263,7 +2476,7 @@ static void emit_wpos_xy(struct brw_wm_compile *c,
 }
 
 /* TODO
-   BIAS on SIMD8 not workind yet...
+   BIAS on SIMD8 not working yet...
  */    
 static void emit_txb(struct brw_wm_compile *c,
                struct prog_instruction *inst)
@@ -2271,19 +2484,20 @@ static void emit_txb(struct brw_wm_compile *c,
     struct brw_compile *p = &c->func;
     struct brw_reg dst[4], src[4], payload_reg;
     GLuint unit = c->fp->program.Base.SamplerUnits[inst->TexSrcUnit];
-
     GLuint i;
+
     payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0);
+
     for (i = 0; i < 4; i++) 
-       dst[i] = get_dst_reg(c, inst, i, 1);
+       dst[i] = get_dst_reg(c, inst, i);
     for (i = 0; i < 4; i++)
-       src[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
+       src[i] = get_src_reg(c, inst, 0, i);
 
     switch (inst->TexSrcTarget) {
        case TEXTURE_1D_INDEX:
-           brw_MOV(p, brw_message_reg(2), src[0]);
-           brw_MOV(p, brw_message_reg(3), brw_imm_f(0));
-           brw_MOV(p, brw_message_reg(4), brw_imm_f(0));
+           brw_MOV(p, brw_message_reg(2), src[0]);         /* s coord */
+           brw_MOV(p, brw_message_reg(3), brw_imm_f(0));   /* t coord */
+           brw_MOV(p, brw_message_reg(4), brw_imm_f(0));   /* r coord */
            break;
        case TEXTURE_2D_INDEX:
        case TEXTURE_RECT_INDEX:
@@ -2297,28 +2511,28 @@ static void emit_txb(struct brw_wm_compile *c,
            brw_MOV(p, brw_message_reg(4), src[2]);
            break;
     }
-    brw_MOV(p, brw_message_reg(5), src[3]);
-    brw_MOV(p, brw_message_reg(6), brw_imm_f(0));
+    brw_MOV(p, brw_message_reg(5), src[3]);          /* bias */
+    brw_MOV(p, brw_message_reg(6), brw_imm_f(0));    /* ref (unused?) */
     brw_SAMPLE(p,
-           retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW),
-           1,
-           retype(payload_reg, BRW_REGISTER_TYPE_UW),
-           unit + MAX_DRAW_BUFFERS, /* surface */
-           unit,     /* sampler */
-           inst->DstReg.WriteMask,
-           BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS,
-           4,
-           4,
-           0);
+               retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW),  /* dest */
+               1,                                           /* msg_reg_nr */
+               retype(payload_reg, BRW_REGISTER_TYPE_UW),   /* src0 */
+               unit + MAX_DRAW_BUFFERS,                     /* surface */
+               unit,                                        /* sampler */
+               inst->DstReg.WriteMask,                      /* writemask */
+               BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS,      /* msg_type */
+               4,                                           /* response_length */
+               4,                                           /* msg_length */
+               0);                                          /* eot */
 }
 
+
 static void emit_tex(struct brw_wm_compile *c,
                struct prog_instruction *inst)
 {
     struct brw_compile *p = &c->func;
     struct brw_reg dst[4], src[4], payload_reg;
     GLuint unit = c->fp->program.Base.SamplerUnits[inst->TexSrcUnit];
-
     GLuint msg_len;
     GLuint i, nr;
     GLuint emit;
@@ -2327,10 +2541,9 @@ static void emit_tex(struct brw_wm_compile *c,
     payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0);
 
     for (i = 0; i < 4; i++) 
-       dst[i] = get_dst_reg(c, inst, i, 1);
+       dst[i] = get_dst_reg(c, inst, i);
     for (i = 0; i < 4; i++)
-       src[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
-
+       src[i] = get_src_reg(c, inst, 0, i);
 
     switch (inst->TexSrcTarget) {
        case TEXTURE_1D_INDEX:
@@ -2349,6 +2562,7 @@ static void emit_tex(struct brw_wm_compile *c,
     }
     msg_len = 1;
 
+    /* move/load S, T, R coords */
     for (i = 0; i < nr; i++) {
        static const GLuint swz[4] = {0,1,2,2};
        if (emit & (1<<i))
@@ -2359,26 +2573,27 @@ static void emit_tex(struct brw_wm_compile *c,
     }
 
     if (shadow) {
-       brw_MOV(p, brw_message_reg(5), brw_imm_f(0));
-       brw_MOV(p, brw_message_reg(6), src[2]);
+       brw_MOV(p, brw_message_reg(5), brw_imm_f(0));  /* lod / bias */
+       brw_MOV(p, brw_message_reg(6), src[2]);        /* ref value / R coord */
     }
 
     brw_SAMPLE(p,
-           retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW),
-           1,
-           retype(payload_reg, BRW_REGISTER_TYPE_UW),
-           unit + MAX_DRAW_BUFFERS, /* surface */
-           unit,     /* sampler */
-           inst->DstReg.WriteMask,
-           BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE,
-           4,
-           shadow ? 6 : 4,
-           0);
+               retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), /* dest */
+               1,                                          /* msg_reg_nr */
+               retype(payload_reg, BRW_REGISTER_TYPE_UW),  /* src0 */
+               unit + MAX_DRAW_BUFFERS,                    /* surface */
+               unit,                                       /* sampler */
+               inst->DstReg.WriteMask,                     /* writemask */
+               BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE,           /* msg_type */
+               4,                                          /* response_length */
+               shadow ? 6 : 4,                             /* msg_length */
+               0);                                         /* eot */
 
     if (shadow)
        brw_MOV(p, dst[3], brw_imm_f(1.0));
 }
 
+
 /**
  * Resolve subroutine calls after code emit is done.
  */
@@ -2410,6 +2625,15 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
        else
            brw_set_conditionalmod(p, BRW_CONDITIONAL_NONE);
 
+        /*
+        _mesa_printf("Inst %d: ", i);
+        _mesa_print_instruction(inst);
+        */
+
+        /* fetch any constants that this instruction needs */
+        if (c->use_const_buffer)
+           fetch_constants(c, inst);
+
        switch (inst->Opcode) {
            case WM_PIXELXY:
                emit_pixel_xy(c, inst);
@@ -2435,12 +2659,18 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
            case WM_FB_WRITE:
                emit_fb_write(c, inst);
                break;
+           case WM_FRONTFACING:
+               emit_frontfacing(c, inst);
+               break;
            case OPCODE_ABS:
                emit_abs(c, inst);
                break;
            case OPCODE_ADD:
                emit_add(c, inst);
                break;
+           case OPCODE_ARL:
+               emit_arl(c, inst);
+               break;
            case OPCODE_SUB:
                emit_sub(c, inst);
                break;
@@ -2489,11 +2719,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
            case OPCODE_LG2:
                emit_lg2(c, inst);
                break;
-           case OPCODE_MAX:    
-               emit_max(c, inst);
-               break;
            case OPCODE_MIN:    
-               emit_min(c, inst);
+           case OPCODE_MAX:    
+               emit_min_max(c, inst);
                break;
            case OPCODE_DDX:
                emit_ddx(c, inst);
index cf03189..ab9aa2f 100644 (file)
@@ -268,6 +268,7 @@ void brw_wm_pass1( struct brw_wm_compile *c )
         break;
 
       case OPCODE_DST:
+      case WM_FRONTFACING:
       default:
         break;
       }
index 68a9296..1fc9f01 100644 (file)
@@ -217,6 +217,7 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key,
    sampler->ss2.default_color_pointer = sdc_bo->offset >> 5; /* reloc */
 }
 
+
 /** Sets up the cache key for sampler state for all texture units */
 static void
 brw_wm_sampler_populate_key(struct brw_context *brw,
index 63fc8a0..58fa6aa 100644 (file)
@@ -113,7 +113,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
    /* temporary sanity check assertion */
    ASSERT(bfp->isGLSL == brw_wm_is_glsl(fp));
 
-   /* XXX: This needs a flag to indicate when it changes. */
+   /* _NEW_DEPTH */
    key->stats_wm = intel->stats_wm;
 
    /* _NEW_LINE */
@@ -125,6 +125,9 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key)
    key->offset_factor = ctx->Polygon.OffsetFactor;
 }
 
+/**
+ * Setup wm hardware state.  See page 225 of Volume 2
+ */
 static dri_bo *
 wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
                        dri_bo **reloc_bufs)
@@ -142,7 +145,7 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
 
    if (key->total_scratch != 0) {
       wm.thread2.scratch_space_base_pointer =
-        brw->wm.scratch_buffer->offset >> 10; /* reloc */
+        brw->wm.scratch_bo->offset >> 10; /* reloc */
       wm.thread2.per_thread_scratch_space = key->total_scratch / 1024 - 1;
    } else {
       wm.thread2.scratch_space_base_pointer = 0;
@@ -151,9 +154,9 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
 
    wm.thread3.dispatch_grf_start_reg = key->dispatch_grf_start_reg;
    wm.thread3.urb_entry_read_length = key->urb_entry_read_length;
+   wm.thread3.urb_entry_read_offset = 0;
    wm.thread3.const_urb_entry_read_length = key->curb_entry_read_length;
    wm.thread3.const_urb_entry_read_offset = key->curbe_offset * 2;
-   wm.thread3.urb_entry_read_offset = 0;
 
    wm.wm4.sampler_count = (key->sampler_count + 1) / 4;
    if (brw->wm.sampler_bo != NULL) {
@@ -220,7 +223,7 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
                        0, 0,
                        wm.thread2.per_thread_scratch_space,
                        offsetof(struct brw_wm_unit_state, thread2),
-                       brw->wm.scratch_buffer);
+                       brw->wm.scratch_bo);
    }
 
    /* Emit sampler state relocation */
@@ -251,20 +254,20 @@ static void upload_wm_unit( struct brw_context *brw )
    if (key.total_scratch) {
       GLuint total = key.total_scratch * key.max_threads;
 
-      if (brw->wm.scratch_buffer && total > brw->wm.scratch_buffer->size) {
-        dri_bo_unreference(brw->wm.scratch_buffer);
-        brw->wm.scratch_buffer = NULL;
+      if (brw->wm.scratch_bo && total > brw->wm.scratch_bo->size) {
+        dri_bo_unreference(brw->wm.scratch_bo);
+        brw->wm.scratch_bo = NULL;
       }
-      if (brw->wm.scratch_buffer == NULL) {
-        brw->wm.scratch_buffer = dri_bo_alloc(intel->bufmgr,
-                                              "wm scratch",
-                                              total,
-                                              4096);
+      if (brw->wm.scratch_bo == NULL) {
+        brw->wm.scratch_bo = dri_bo_alloc(intel->bufmgr,
+                                           "wm scratch",
+                                           total,
+                                           4096);
       }
    }
 
    reloc_bufs[0] = brw->wm.prog_bo;
-   reloc_bufs[1] = brw->wm.scratch_buffer;
+   reloc_bufs[1] = brw->wm.scratch_bo;
    reloc_bufs[2] = brw->wm.sampler_bo;
 
    dri_bo_unreference(brw->wm.state_bo);
@@ -282,7 +285,8 @@ const struct brw_tracked_state brw_wm_unit = {
       .mesa = (_NEW_POLYGON | 
               _NEW_POLYGONSTIPPLE | 
               _NEW_LINE | 
-              _NEW_COLOR),
+              _NEW_COLOR |
+              _NEW_DEPTH),
 
       .brw = (BRW_NEW_FRAGMENT_PROGRAM | 
              BRW_NEW_CURBE_OFFSETS |
index e6113ef..e7d55d5 100644 (file)
@@ -33,6 +33,7 @@
 #include "main/mtypes.h"
 #include "main/texformat.h"
 #include "main/texstore.h"
+#include "shader/prog_parameter.h"
 
 #include "intel_mipmap_tree.h"
 #include "intel_batchbuffer.h"
@@ -140,8 +141,15 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format,
    case MESA_FORMAT_RGBA_DXT5:
        return BRW_SURFACEFORMAT_BC3_UNORM;
 
-   case MESA_FORMAT_SRGBA8:
-      return BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB;
+   case MESA_FORMAT_SARGB8:
+      return BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB;
+
+   case MESA_FORMAT_SLA8:
+      return BRW_SURFACEFORMAT_L8A8_UNORM_SRGB;
+
+   case MESA_FORMAT_SL8:
+      return BRW_SURFACEFORMAT_L8_UNORM_SRGB;
+
    case MESA_FORMAT_SRGB_DXT1:
       return BRW_SURFACEFORMAT_BC1_UNORM_SRGB;
 
@@ -159,6 +167,9 @@ static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format,
    case MESA_FORMAT_DUDV8:
       return BRW_SURFACEFORMAT_R8G8_SNORM;
 
+   case MESA_FORMAT_SIGNED_RGBA8888_REV:
+      return BRW_SURFACEFORMAT_R8G8B8A8_SNORM;
+
    default:
       assert(0);
       return 0;
@@ -277,6 +288,7 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit )
    struct intel_texture_object *intelObj = intel_texture_object(tObj);
    struct gl_texture_image *firstImage = tObj->Image[0][intelObj->firstLevel];
    struct brw_wm_surface_key key;
+   const GLuint j = MAX_DRAW_BUFFERS + unit;
 
    memset(&key, 0, sizeof(key));
 
@@ -303,16 +315,111 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit )
    key.cpp = intelObj->mt->cpp;
    key.tiling = intelObj->mt->region->tiling;
 
-   dri_bo_unreference(brw->wm.surf_bo[unit + MAX_DRAW_BUFFERS]);
-   brw->wm.surf_bo[unit + MAX_DRAW_BUFFERS] = brw_search_cache(&brw->cache, BRW_SS_SURFACE,
-                                                              &key, sizeof(key),
-                                                              &key.bo, key.bo ? 1 : 0,
-                                                              NULL);
-   if (brw->wm.surf_bo[unit + MAX_DRAW_BUFFERS] == NULL) {
-      brw->wm.surf_bo[unit + MAX_DRAW_BUFFERS] = brw_create_texture_surface(brw, &key);
+   dri_bo_unreference(brw->wm.surf_bo[j]);
+   brw->wm.surf_bo[j] = brw_search_cache(&brw->cache, BRW_SS_SURFACE,
+                                         &key, sizeof(key),
+                                         &key.bo, key.bo ? 1 : 0,
+                                         NULL);
+   if (brw->wm.surf_bo[j] == NULL) {
+      brw->wm.surf_bo[j] = brw_create_texture_surface(brw, &key);
+   }
+}
+
+
+
+/**
+ * Create the constant buffer surface.  Fragment shader constanst will be
+ * read from this buffer with Data Port Read instructions/messages.
+ */
+static dri_bo *
+brw_create_constant_surface( struct brw_context *brw,
+                             struct brw_wm_surface_key *key )
+{
+   const GLint w = key->width - 1;
+   struct brw_surface_state surf;
+   dri_bo *bo;
+
+   memset(&surf, 0, sizeof(surf));
+
+   surf.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
+   surf.ss0.surface_type = BRW_SURFACE_BUFFER;
+   surf.ss0.surface_format = BRW_SURFACEFORMAT_R32G32B32A32_FLOAT;
+
+   /* This is ok for all textures with channel width 8bit or less:
+    */
+   assert(key->bo);
+   if (key->bo)
+      surf.ss1.base_addr = key->bo->offset; /* reloc */
+   else
+      surf.ss1.base_addr = key->offset;
+
+   surf.ss2.width = w & 0x7f;            /* bits 6:0 of size or width */
+   surf.ss2.height = (w >> 7) & 0x1fff;  /* bits 19:7 of size or width */
+   surf.ss3.depth = (w >> 20) & 0x7f;    /* bits 26:20 of size or width */
+   surf.ss3.pitch = (key->pitch * key->cpp) - 1;
+   brw_set_surface_tiling(&surf, key->tiling);
+   bo = brw_upload_cache(&brw->cache, BRW_SS_SURFACE,
+                        key, sizeof(*key),
+                        &key->bo, key->bo ? 1 : 0,
+                        &surf, sizeof(surf),
+                        NULL, NULL);
+
+   if (key->bo) {
+      /* Emit relocation to surface contents */
+      dri_bo_emit_reloc(bo,
+                       I915_GEM_DOMAIN_SAMPLER, 0,
+                       0,
+                       offsetof(struct brw_surface_state, ss1),
+                       key->bo);
    }
+
+   return bo;
 }
 
+
+/**
+ * Update the constant buffer surface.
+ */
+static void
+brw_update_constant_surface( GLcontext *ctx,
+                             const struct brw_fragment_program *fp )
+{
+   struct brw_context *brw = brw_context(ctx);
+   struct brw_wm_surface_key key;
+   const GLuint j = BRW_WM_MAX_SURF - 1;
+   const GLuint numParams = fp->program.Base.Parameters->NumParameters;
+
+   memset(&key, 0, sizeof(key));
+
+   key.format = MESA_FORMAT_RGBA_FLOAT32;
+   key.internal_format = GL_RGBA;
+   key.bo = fp->const_buffer;
+
+   key.depthmode = GL_NONE;
+   key.pitch = numParams;
+   key.width = numParams;
+   key.height = 1;
+   key.depth = 1;
+   key.cpp = 16;
+
+   /*
+   printf("%s:\n", __FUNCTION__);
+   printf("  width %d  height %d  depth %d  cpp %d  pitch %d\n",
+          key.width, key.height, key.depth, key.cpp, key.pitch);
+   */
+
+   dri_bo_unreference(brw->wm.surf_bo[j]);
+   brw->wm.surf_bo[j] = brw_search_cache(&brw->cache, BRW_SS_SURFACE,
+                                         &key, sizeof(key),
+                                         &key.bo, key.bo ? 1 : 0,
+                                         NULL);
+   if (brw->wm.surf_bo[j] == NULL) {
+      brw->wm.surf_bo[j] = brw_create_constant_surface(brw, &key);
+   }
+}
+
+
 /**
  * Sets up a surface state structure to point at the given region.
  * While it is only used for the front/back buffer currently, it should be
@@ -467,7 +574,8 @@ static void prepare_wm_surfaces(struct brw_context *brw )
    GLuint i;
    int old_nr_surfaces;
 
-   if (brw->state.nr_color_regions  > 1) {
+   /* Update surfaces for drawing buffers */
+   if (brw->state.nr_color_regions > 1) {
       for (i = 0; i < brw->state.nr_color_regions; i++) {
          brw_update_region_surface(brw, brw->state.color_regions[i], i,
                                   GL_FALSE);
@@ -479,27 +587,41 @@ static void prepare_wm_surfaces(struct brw_context *brw )
    old_nr_surfaces = brw->wm.nr_surfaces;
    brw->wm.nr_surfaces = MAX_DRAW_BUFFERS;
 
+   /* Update surfaces for textures */
    for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
-      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+      const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+      const GLuint j = MAX_DRAW_BUFFERS + i;
 
       /* _NEW_TEXTURE, BRW_NEW_TEXDATA */
-      if(texUnit->_ReallyEnabled) {
+      if (texUnit->_ReallyEnabled) {
          if (texUnit->_Current == intel->frame_buffer_texobj) {
-            dri_bo_unreference(brw->wm.surf_bo[i+MAX_DRAW_BUFFERS]);
-            brw->wm.surf_bo[i+MAX_DRAW_BUFFERS] = brw->wm.surf_bo[0];
-            dri_bo_reference(brw->wm.surf_bo[i+MAX_DRAW_BUFFERS]);
-            brw->wm.nr_surfaces = i + MAX_DRAW_BUFFERS + 1;
+            /* render to texture */
+            dri_bo_unreference(brw->wm.surf_bo[j]);
+            brw->wm.surf_bo[j] = brw->wm.surf_bo[0];
+            dri_bo_reference(brw->wm.surf_bo[j]);
+            brw->wm.nr_surfaces = j + 1;
          } else {
+            /* regular texture */
             brw_update_texture_surface(ctx, i);
-            brw->wm.nr_surfaces = i + MAX_DRAW_BUFFERS + 1;
+            brw->wm.nr_surfaces = j + 1;
          }
       } else {
-         dri_bo_unreference(brw->wm.surf_bo[i+MAX_DRAW_BUFFERS]);
-         brw->wm.surf_bo[i+MAX_DRAW_BUFFERS] = NULL;
+         dri_bo_unreference(brw->wm.surf_bo[j]);
+         brw->wm.surf_bo[j] = NULL;
       }
+   }
+
+   /* Update surface for fragment shader constant buffer */
+   {
+      const GLuint j = BRW_WM_MAX_SURF - 1;
+      const struct brw_fragment_program *fp =
+         brw_fragment_program_const(brw->fragment_program);
 
+      brw_update_constant_surface(ctx, fp);
+      brw->wm.nr_surfaces = j + 1;
    }
 
+
    dri_bo_unreference(brw->wm.bind_bo);
    brw->wm.bind_bo = brw_wm_get_binding_table(brw);
 
index 4e03308..4ae9b11 100644 (file)
@@ -98,11 +98,11 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv,
       ASSERT(src->cpp == dst->cpp);
 
       if (cpp == 2) {
-        BR13 = (0xCC << 16) | (1 << 24);
+        BR13 = (0xCC << 16) | BR13_565;
         CMD = XY_SRC_COPY_BLT_CMD;
       }
       else {
-        BR13 = (0xCC << 16) | (1 << 24) | (1 << 25);
+        BR13 = (0xCC << 16) | BR13_8888;
         CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
       }
 
@@ -194,13 +194,15 @@ intelEmitFillBlit(struct intel_context *intel,
 
    switch (cpp) {
    case 1:
+      BR13 = (0xF0 << 16);
+      CMD = XY_COLOR_BLT_CMD;
+      break;
    case 2:
-   case 3:
-      BR13 = (0xF0 << 16) | (1 << 24);
+      BR13 = (0xF0 << 16) | BR13_565;
       CMD = XY_COLOR_BLT_CMD;
       break;
    case 4:
-      BR13 = (0xF0 << 16) | (1 << 24) | (1 << 25);
+      BR13 = (0xF0 << 16) | BR13_8888;
       CMD = XY_COLOR_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
       break;
    default:
@@ -335,12 +337,11 @@ intelEmitCopyBlit(struct intel_context *intel,
       CMD = XY_SRC_COPY_BLT_CMD;
       break;
    case 2:
-   case 3:
-      BR13 |= (1 << 24);
+      BR13 |= BR13_565;
       CMD = XY_SRC_COPY_BLT_CMD;
       break;
    case 4:
-      BR13 |= (1 << 24) | (1 << 25);
+      BR13 |= BR13_8888;
       CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB;
       break;
    default:
@@ -510,7 +511,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
 
                /* Setup the blit command */
                if (cpp == 4) {
-                  BR13 |= (1 << 24) | (1 << 25);
+                  BR13 |= BR13_8888;
                   if (buf == BUFFER_DEPTH || buf == BUFFER_STENCIL) {
                      if (clearMask & BUFFER_BIT_DEPTH)
                         CMD |= XY_BLT_WRITE_RGB;
@@ -523,8 +524,8 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask)
                   }
                }
                else {
-                  ASSERT(cpp == 2 || cpp == 0);
-                  BR13 |= (1 << 24);
+                  ASSERT(cpp == 2);
+                  BR13 |= BR13_565;
                }
 
 #ifndef I915
index 888bb3f..a664e74 100644 (file)
@@ -307,9 +307,11 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h)
     if (!driContext->driScreenPriv->dri2.enabled)
        return;
 
-    intel_update_renderbuffers(driContext, driContext->driDrawablePriv);
-    if (driContext->driDrawablePriv != driContext->driReadablePriv)
-       intel_update_renderbuffers(driContext, driContext->driReadablePriv);
+    if (!intel->internal_viewport_call) {
+       intel_update_renderbuffers(driContext, driContext->driDrawablePriv);
+       if (driContext->driDrawablePriv != driContext->driReadablePriv)
+         intel_update_renderbuffers(driContext, driContext->driReadablePriv);
+    }
 
     old_viewport = ctx->Driver.Viewport;
     ctx->Driver.Viewport = NULL;
index e520ecf..d635f3f 100644 (file)
@@ -180,6 +180,7 @@ struct intel_context
    struct intel_region *front_region;
    struct intel_region *back_region;
    struct intel_region *depth_region;
+   GLboolean internal_viewport_call;
 
    /**
     * This value indicates that the kernel memory manager is being used
index f2e2e61..f046382 100644 (file)
@@ -1513,7 +1513,7 @@ decode_3d_965(uint32_t *data, int count, uint32_t hw_offset, int *failures)
 
        for (i = 1; i < len;) {
            instr_out(data, hw_offset, i, "buffer %d: %svalid, type 0x%04x, "
-                     "src offset 0x%04xd bytes\n",
+                     "src offset 0x%04x bytes\n",
                      data[i] >> 27,
                      data[i] & (1 << 26) ? "" : "in",
                      (data[i] >> 16) & 0x1ff,
index 8dd0b24..9ec1b4e 100644 (file)
@@ -132,6 +132,7 @@ static const struct dri_extension brw_extensions[] = {
    { "GL_ARB_shading_language_100",       GL_VERSION_2_0_functions },
    { "GL_ARB_shading_language_120",       GL_VERSION_2_1_functions },
    { "GL_ARB_shadow",                     NULL },
+   { "GL_MESA_texture_signed_rgba",       NULL },
    { "GL_ARB_texture_non_power_of_two",   NULL },
    { "GL_ARB_vertex_shader",              GL_ARB_vertex_shader_functions },
    { "GL_EXT_shadow_funcs",               NULL },
index 7041ff3..fc0ac0b 100644 (file)
@@ -184,7 +184,9 @@ intel_meta_set_passthrough_transform(struct intel_context *intel)
    intel->meta.saved_vp_height = ctx->Viewport.Height;
    intel->meta.saved_matrix_mode = ctx->Transform.MatrixMode;
 
+   intel->internal_viewport_call = GL_TRUE;
    _mesa_Viewport(0, 0, ctx->DrawBuffer->Width, ctx->DrawBuffer->Height);
+   intel->internal_viewport_call = GL_FALSE;
 
    _mesa_MatrixMode(GL_PROJECTION);
    _mesa_PushMatrix();
@@ -206,8 +208,10 @@ intel_meta_restore_transform(struct intel_context *intel)
 
    _mesa_MatrixMode(intel->meta.saved_matrix_mode);
 
+   intel->internal_viewport_call = GL_TRUE;
    _mesa_Viewport(intel->meta.saved_vp_x, intel->meta.saved_vp_y,
                  intel->meta.saved_vp_width, intel->meta.saved_vp_height);
+   intel->internal_viewport_call = GL_FALSE;
 }
 
 /**
index d20ea15..65e6294 100644 (file)
@@ -563,6 +563,7 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen)
    GLboolean gem_supported;
    struct drm_i915_getparam gp;
    __DRIscreenPrivate *spriv = intelScreen->driScrnPriv;
+   int num_fences;
 
    intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;
 
@@ -613,8 +614,10 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen)
                                &intelScreen->sarea->last_dispatch);
    }
 
-   /* XXX bufmgr should be per-screen, not per-context */
-   intelScreen->ttm = intelScreen->ttm;
+   if (intel_get_param(spriv, I915_PARAM_NUM_FENCES_AVAIL, &num_fences))
+      intelScreen->kernel_exec_fencing = !!num_fences;
+   else
+      intelScreen->kernel_exec_fencing = GL_FALSE;
 
    return GL_TRUE;
 }
index e1036de..a9b9e10 100644 (file)
@@ -79,6 +79,7 @@ typedef struct
    GLboolean no_vbo;
    int ttm;
    dri_bufmgr *bufmgr;
+   GLboolean kernel_exec_fencing;
 
    /**
    * Configuration cache with default values for all contexts
index 8732354..3322a71 100644 (file)
@@ -1,5 +1,6 @@
 #include "intel_context.h"
 #include "intel_tex.h"
+#include "intel_chipset.h"
 #include "main/texformat.h"
 #include "main/enums.h"
 
@@ -160,24 +161,36 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat,
    case GL_SRGB8_EXT:
    case GL_SRGB_ALPHA_EXT:
    case GL_SRGB8_ALPHA8_EXT:
-   case GL_SLUMINANCE_EXT:
-   case GL_SLUMINANCE8_EXT:
-   case GL_SLUMINANCE_ALPHA_EXT:
-   case GL_SLUMINANCE8_ALPHA8_EXT:
    case GL_COMPRESSED_SRGB_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_EXT:
    case GL_COMPRESSED_SLUMINANCE_EXT:
    case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
-       return &_mesa_texformat_srgba8;
+      return &_mesa_texformat_sargb8;
+   case GL_SLUMINANCE_EXT:
+   case GL_SLUMINANCE8_EXT:
+      if (IS_G4X(intel->intelScreen->deviceID))
+         return &_mesa_texformat_sl8;
+      else
+         return &_mesa_texformat_sargb8;
+   case GL_SLUMINANCE_ALPHA_EXT:
+   case GL_SLUMINANCE8_ALPHA8_EXT:
+      if (IS_G4X(intel->intelScreen->deviceID))
+         return &_mesa_texformat_sla8;
+      else
+         return &_mesa_texformat_sargb8;
    case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
    case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
       return &_mesa_texformat_srgb_dxt1;
 
+   /* i915 could also do this */
    case GL_DUDV_ATI:
    case GL_DU8DV8_ATI:
       return &_mesa_texformat_dudv8;
+   case GL_RGBA_SNORM:
+   case GL_RGBA8_SNORM:
+      return &_mesa_texformat_signed_rgba8888_rev;
 #endif
 
    default:
index e902187..71561cf 100644 (file)
@@ -12,6 +12,7 @@
 #include "main/simple_list.h"
 #include "main/texcompress.h"
 #include "main/texformat.h"
+#include "main/texgetimage.h"
 #include "main/texobj.h"
 #include "main/texstore.h"
 #include "main/teximage.h"
@@ -482,12 +483,13 @@ intelTexImage(GLcontext * ctx,
    LOCK_HARDWARE(intel);
 
    if (intelImage->mt) {
-      texImage->Data = intel_miptree_image_map(intel,
-                                               intelImage->mt,
-                                               intelImage->face,
-                                               intelImage->level,
-                                               &dstRowStride,
-                                               intelImage->base.ImageOffsets);
+      if (pixels)
+         texImage->Data = intel_miptree_image_map(intel,
+                                                  intelImage->mt,
+                                                  intelImage->face,
+                                                  intelImage->level,
+                                                  &dstRowStride,
+                                                  intelImage->base.ImageOffsets);
       texImage->RowStride = dstRowStride / intelImage->mt->cpp;
    }
    else {
@@ -537,17 +539,18 @@ intelTexImage(GLcontext * ctx,
                                                   format, type, pixels, unpack)) {
           _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
        }
-   }
 
-   /* GL_SGIS_generate_mipmap */
-   if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      intel_generate_mipmap(ctx, target, texObj);
+       /* GL_SGIS_generate_mipmap */
+       if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
+         intel_generate_mipmap(ctx, target, texObj);
+       }
    }
 
    _mesa_unmap_teximage_pbo(ctx, unpack);
 
    if (intelImage->mt) {
-      intel_miptree_image_unmap(intel, intelImage->mt);
+      if (pixels)
+         intel_miptree_image_unmap(intel, intelImage->mt);
       texImage->Data = NULL;
    }
 
index 9fe267e..225d231 100644 (file)
@@ -99,7 +99,7 @@ static void mach64SetTexFilter( mach64TexObjPtr t,
    }
 }
 
-static void mach64SetTexBorderColor( mach64TexObjPtr t, GLubyte c[4] )
+static void mach64SetTexBorderColor( mach64TexObjPtr t, const GLfloat c[4] )
 {
 #if 0
    GLuint border = mach64PackColor( 4, c[0], c[1], c[2], c[3] );
@@ -131,7 +131,7 @@ mach64AllocTexObj( struct gl_texture_object *texObj )
 
    mach64SetTexWrap( t, texObj->WrapS, texObj->WrapT );
    mach64SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
-   mach64SetTexBorderColor( t, texObj->_BorderChan );
+   mach64SetTexBorderColor( t, texObj->BorderColor );
 
    return t;
 }
@@ -471,7 +471,7 @@ static void mach64DDTexParameter( GLcontext *ctx, GLenum target,
 
    case GL_TEXTURE_BORDER_COLOR:
       if ( t->base.bound ) FLUSH_BATCH( mmesa );
-      mach64SetTexBorderColor( t, tObj->_BorderChan );
+      mach64SetTexBorderColor( t, tObj->BorderColor );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
index 2392622..33eb0be 100644 (file)
@@ -153,10 +153,14 @@ mgaSetTexFilter( mgaTextureObjectPtr t, GLenum minf, GLenum magf )
    t->setup.texfilter |= val;
 }
 
-static void mgaSetTexBorderColor(mgaTextureObjectPtr t, GLubyte color[4])
+static void mgaSetTexBorderColor(mgaTextureObjectPtr t, const GLfloat color[4])
 {
-   t->setup.texbordercol = PACK_COLOR_8888(color[3], color[0], 
-                                          color[1], color[2] );
+   GLubyte c[4];
+   CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+   CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+   CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+   CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
+   t->setup.texbordercol = PACK_COLOR_8888(c[3], c[0], c[1], c[2] );
 }
 
 
@@ -329,7 +333,7 @@ mgaAllocTexObj( struct gl_texture_object *tObj )
 
       mgaSetTexWrapping( t, tObj->WrapS, tObj->WrapT );
       mgaSetTexFilter( t, tObj->MinFilter, tObj->MagFilter );
-      mgaSetTexBorderColor( t, tObj->_BorderChan );
+      mgaSetTexBorderColor( t, tObj->BorderColor );
    }
 
    return( t );
@@ -458,7 +462,7 @@ mgaTexParameter( GLcontext *ctx, GLenum target,
 
    case GL_TEXTURE_BORDER_COLOR:
       FLUSH_BATCH(mmesa);
-      mgaSetTexBorderColor(t, tObj->_BorderChan);
+      mgaSetTexBorderColor(t, tObj->BorderColor);
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
index 3fc9c06..0920270 100644 (file)
@@ -135,8 +135,13 @@ static void r128SetTexFilter( r128TexObjPtr t, GLenum minf, GLenum magf )
    }
 }
 
-static void r128SetTexBorderColor( r128TexObjPtr t, GLubyte c[4] )
+static void r128SetTexBorderColor( r128TexObjPtr t, const GLfloat color[4] )
 {
+   GLubyte c[4];
+   CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+   CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+   CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+   CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
    t->setup.tex_border_color = r128PackColor( 4, c[0], c[1], c[2], c[3] );
 }
 
@@ -165,7 +170,7 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj )
 
       r128SetTexWrap( t, texObj->WrapS, texObj->WrapT );
       r128SetTexFilter( t, texObj->MinFilter, texObj->MagFilter );
-      r128SetTexBorderColor( t, texObj->_BorderChan );
+      r128SetTexBorderColor( t, texObj->BorderColor );
    }
 
    return t;
@@ -531,7 +536,7 @@ static void r128TexParameter( GLcontext *ctx, GLenum target,
 
    case GL_TEXTURE_BORDER_COLOR:
       if ( t->base.bound ) FLUSH_BATCH( rmesa );
-      r128SetTexBorderColor( t, tObj->_BorderChan );
+      r128SetTexBorderColor( t, tObj->BorderColor );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
index 1b9724d..ebf389e 100644 (file)
@@ -1117,7 +1117,7 @@ void r200UpdateMaterial( GLcontext *ctx )
  *       _VP_inf_norm
  *       _h_inf_norm
  *       _Position
- *       _NormDirection
+ *       _NormSpotDirection
  *       _ModelViewInvScale
  *       _NeedEyeCoords
  *       _EyeZDir
@@ -1174,9 +1174,9 @@ static void update_light( GLcontext *ctx )
               fcmd[LIT_DIRECTION_W] = 0;
            } else {
               COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
-              fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0];
-              fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1];
-              fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2];
+              fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0];
+              fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1];
+              fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2];
               fcmd[LIT_DIRECTION_W] = 0;
            }
 
index fc2caab..9f79157 100644 (file)
@@ -270,15 +270,16 @@ static void r200SetTexFilter( radeonTexObjPtr t, GLenum minf, GLenum magf )
    }
 }
 
-static void r200SetTexBorderColor( radeonTexObjPtr t, GLubyte c[4] )
+static void r200SetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] )
 {
+   GLubyte c[4];
+   CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+   CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+   CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+   CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
    t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
 }
 
-
-
-
-
 static void r200TexEnv( GLcontext *ctx, GLenum target,
                          GLenum pname, const GLfloat *param )
 {
@@ -378,7 +379,7 @@ static void r200TexParameter( GLcontext *ctx, GLenum target,
       break;
 
    case GL_TEXTURE_BORDER_COLOR:
-      r200SetTexBorderColor( t, texObj->_BorderChan );
+      r200SetTexBorderColor( t, texObj->BorderColor );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
@@ -481,7 +482,7 @@ static struct gl_texture_object *r200NewTextureObject(GLcontext * ctx,
    r200SetTexWrap( t, t->base.WrapS, t->base.WrapT, t->base.WrapR );
    r200SetTexMaxAnisotropy( t, t->base.MaxAnisotropy );
    r200SetTexFilter(t, t->base.MinFilter, t->base.MagFilter);
-   r200SetTexBorderColor(t, t->base._BorderChan);
+   r200SetTexBorderColor(t, t->base.BorderColor);
 
    return &t->base;
 }
index 2dd2c6a..c575c9a 100644 (file)
@@ -214,6 +214,7 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom)
        struct radeon_renderbuffer *rrb;
        uint32_t cbpitch;
        uint32_t offset = r300->radeon.state.color.draw_offset;
+       uint32_t dw = 6;
 
        rrb = radeon_get_colorbuffer(&r300->radeon);
        if (!rrb || !rrb->bo) {
@@ -230,11 +231,16 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom)
        if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE)
                cbpitch |= R300_COLOR_TILE_ENABLE;
 
-       BEGIN_BATCH_NO_AUTOSTATE(8);
+       if (r300->radeon.radeonScreen->kernel_mm)
+               dw += 2;
+       BEGIN_BATCH_NO_AUTOSTATE(dw);
        OUT_BATCH_REGSEQ(R300_RB3D_COLOROFFSET0, 1);
        OUT_BATCH_RELOC(offset, rrb->bo, offset, 0, RADEON_GEM_DOMAIN_VRAM, 0);
        OUT_BATCH_REGSEQ(R300_RB3D_COLORPITCH0, 1);
-       OUT_BATCH_RELOC(cbpitch, rrb->bo, cbpitch, 0, RADEON_GEM_DOMAIN_VRAM, 0);
+       if (!r300->radeon.radeonScreen->kernel_mm)
+               OUT_BATCH(cbpitch);
+       else
+               OUT_BATCH_RELOC(cbpitch, rrb->bo, cbpitch, 0, RADEON_GEM_DOMAIN_VRAM, 0);
        END_BATCH();
     if (r300->radeon.radeonScreen->driScreen->dri2.enabled) {
         if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
index 06db7ab..5f279d6 100644 (file)
@@ -345,10 +345,10 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
        ctx->Const.MaxTextureMaxAnisotropy = 16.0;
        ctx->Const.MaxTextureLodBias = 16.0;
 
-       if (screen->chip_family >= CHIP_FAMILY_RV515) {
+       if (screen->chip_family >= CHIP_FAMILY_RV515)
            ctx->Const.MaxTextureLevels = 13;
-           ctx->Const.MaxTextureRectSize = 4096;
-       }
+       else
+           ctx->Const.MaxTextureLevels = 12;
 
        ctx->Const.MinPointSize = 1.0;
        ctx->Const.MinPointSizeAA = 1.0;
index 86e68e3..602f86b 100644 (file)
@@ -76,8 +76,6 @@ typedef struct r300_context *r300ContextPtr;
 
 
 
-/************ DMA BUFFERS **************/
-
 /* The blit width for texture uploads
  */
 #define R300_BLIT_WIDTH_BYTES 1024
index bcf8803..4fd6ba9 100644 (file)
@@ -191,7 +191,7 @@ GLuint r300VAPOutputCntl1(GLcontext * ctx, GLuint OutputsWritten)
                        fprintf(stderr, "\tout of free texcoords to write fog coord\n");
                        _mesa_exit(-1);
                }
-               ret |= 4 << (3 * first_free_texcoord);
+               ret |= 1 << (3 * first_free_texcoord);
        }
 
        return ret;
index 6796d36..46c3df7 100644 (file)
@@ -1510,9 +1510,9 @@ static void r300SetupRSUnit(GLcontext * ctx)
 
                /* with TCL we always seem to route 4 components */
                if (hw_tcl_on)
-                 count = 4;
+                       count = 4;
                else
-                 count = VB->AttribPtr[_TNL_ATTRIB_TEX(i)]->size;
+                       count = VB->AttribPtr[_TNL_ATTRIB_TEX(i)]->size;
 
                switch(count) {
                case 4: swiz = R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3); break;
@@ -1530,12 +1530,22 @@ static void r300SetupRSUnit(GLcontext * ctx)
                ++fp_reg;
        }
 
+       if (InputsRead & FRAG_BIT_WPOS) {
+               r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3) | R300_RS_TEX_PTR(rs_tex_count);
+               r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg);
+               InputsRead &= ~FRAG_BIT_WPOS;
+               rs_tex_count += 4;
+               ++tex_ip;
+               ++fp_reg;
+       }
+
        if (InputsRead & FRAG_BIT_FOGC) {
                if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_FOGC, _TNL_ATTRIB_FOG)) {
-                       r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |=  R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3) |  R300_RS_TEX_PTR(rs_tex_count);
+                       r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= R300_RS_SEL_S(0) | R300_RS_SEL_T(R300_RS_SEL_K0) | R300_RS_SEL_R(R300_RS_SEL_K0);
+                       r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |= R300_RS_SEL_Q(R300_RS_SEL_K1) | R300_RS_TEX_PTR(rs_tex_count);
                        r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg);
                        InputsRead &= ~FRAG_BIT_FOGC;
-                       rs_tex_count += 4;
+                       rs_tex_count += 1;
                        ++tex_ip;
                        ++fp_reg;
                } else {
@@ -1543,16 +1553,6 @@ static void r300SetupRSUnit(GLcontext * ctx)
                }
        }
 
-       if (InputsRead & FRAG_BIT_WPOS) {
-               r300->hw.ri.cmd[R300_RI_INTERP_0 + tex_ip] |=  R300_RS_SEL_S(0) | R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3) |  R300_RS_TEX_PTR(rs_tex_count);
-               r300->hw.rr.cmd[R300_RR_INST_0 + tex_ip] |= R300_RS_INST_TEX_ID(tex_ip) | R300_RS_INST_TEX_CN_WRITE | R300_RS_INST_TEX_ADDR(fp_reg);
-               InputsRead &= ~FRAG_BIT_WPOS;
-               rs_tex_count += 4;
-               ++tex_ip;
-               ++fp_reg;
-       }
-       InputsRead &= ~FRAG_BIT_WPOS;
-
        /* Setup default color if no color or tex was set */
        if (rs_tex_count == 0 && col_ip == 0) {
                r300->hw.rr.cmd[R300_RR_INST_0] = R300_RS_INST_COL_ID(0) | R300_RS_INST_COL_CN_WRITE | R300_RS_INST_COL_ADDR(0) | R300_RS_COL_FMT(R300_RS_COL_FMT_0001);
@@ -1560,10 +1560,10 @@ static void r300SetupRSUnit(GLcontext * ctx)
        }
 
        high_rr = (col_ip > tex_ip) ? col_ip : tex_ip;
-       r300->hw.rc.cmd[1] |= (rs_tex_count << R300_IT_COUNT_SHIFT)  | (col_ip << R300_IC_COUNT_SHIFT) | R300_HIRES_EN;
+       r300->hw.rc.cmd[1] |= (rs_tex_count << R300_IT_COUNT_SHIFT) | (col_ip << R300_IC_COUNT_SHIFT) | R300_HIRES_EN;
        r300->hw.rc.cmd[2] |= high_rr - 1;
 
-        r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_RS_INST_0, high_rr);
+       r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_RS_INST_0, high_rr);
 
        if (InputsRead)
                WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead);
index d8a68f7..03c1521 100644 (file)
@@ -63,7 +63,7 @@ do { \
        ++num_attrs; \
 } while (0)
 
-static void r300SwtclVAPSetup(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten)
+static void r300SwtclVAPSetup(GLcontext *ctx, GLuint InputsRead, GLuint OutputsWritten, GLuint vap_out_fmt_1)
 {
        r300ContextPtr rmesa = R300_CONTEXT( ctx );
        TNLcontext *tnl = TNL_CONTEXT(ctx);
@@ -139,7 +139,12 @@ static void r300SwtclVAPSetup(GLcontext *ctx, GLuint InputsRead, GLuint OutputsW
        rmesa->hw.vic.cmd[R300_VIC_CNTL_0] = r300VAPInputCntl0(ctx, InputsRead);
        rmesa->hw.vic.cmd[R300_VIC_CNTL_1] = r300VAPInputCntl1(ctx, InputsRead);
        rmesa->hw.vof.cmd[R300_VOF_CNTL_0] = r300VAPOutputCntl0(ctx, OutputsWritten);
-       rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = r300VAPOutputCntl1(ctx, OutputsWritten);
+       /**
+         * Can't use r300VAPOutputCntl1 function because it assumes
+         * that all texture coords have 4 components and that's the case
+         * for HW TCL path, but not for SW TCL.
+         */
+       rmesa->hw.vof.cmd[R300_VOF_CNTL_1] = vap_out_fmt_1;
 
        vte = rmesa->hw.vte.cmd[1];
        vte &= ~(R300_VTX_XY_FMT | R300_VTX_Z_FMT | R300_VTX_W0_FMT);
@@ -166,7 +171,7 @@ static void r300SetVertexFormat( GLcontext *ctx )
        r300ContextPtr rmesa = R300_CONTEXT( ctx );
        TNLcontext *tnl = TNL_CONTEXT(ctx);
        struct vertex_buffer *VB = &tnl->vb;
-       int fog_id = -1;
+       int first_free_tex = 0, vap_out_fmt_1 = 0;
        GLuint InputsRead = 0;
        GLuint OutputsWritten = 0;
        int num_attrs = 0;
@@ -217,34 +222,8 @@ static void r300SetVertexFormat( GLcontext *ctx )
                ADD_ATTR(VERT_ATTRIB_POINT_SIZE, EMIT_1F, SWTCL_OVM_POINT_SIZE, swiz, MASK_X);
        }
 
-       if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_FOG)) {
-               /* find first free tex coord slot */
-               if (RENDERINPUTS_TEST_RANGE(tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
-                       int i;
-                       for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-                               if (!RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) )) {
-                                       fog_id = i;
-                                       break;
-                               }
-                       }
-               } else {
-                       fog_id = 0;
-               }
-
-               if (fog_id == -1) {
-                       fprintf(stderr, "\tout of free texcoords to do fog\n");
-                       _mesa_exit(-1);
-               }
-
-               InputsRead |= 1 << VERT_ATTRIB_FOG;
-               OutputsWritten |= 1 << VERT_RESULT_FOGC;
-               GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO);
-               EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F );
-               ADD_ATTR(VERT_ATTRIB_FOG, EMIT_1F, SWTCL_OVM_TEX(fog_id), swiz, MASK_X);
-       }
-
        if (RENDERINPUTS_TEST_RANGE(tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
-               int i;
+               int i, size;
                GLuint swiz, mask, format;
                for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
                        if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) )) {
@@ -254,16 +233,19 @@ static void r300SetVertexFormat( GLcontext *ctx )
                                                format = EMIT_2F;
                                                swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_ZERO, SWIZZLE_ZERO);
                                                mask = MASK_X | MASK_Y;
+                                               size = 2;
                                                break;
                                        case 3:
                                                format = EMIT_3F;
                                                swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO);
                                                mask = MASK_X | MASK_Y | MASK_Z;
+                                               size = 3;
                                                break;
                                        case 4:
                                                format = EMIT_4F;
                                                swiz = SWIZZLE_XYZW;
                                                mask = MASK_XYZW;
+                                               size = 4;
                                                break;
                                        default:
                                                continue;
@@ -272,42 +254,43 @@ static void r300SetVertexFormat( GLcontext *ctx )
                                OutputsWritten |= 1 << (VERT_RESULT_TEX0 + i);
                                EMIT_ATTR(_TNL_ATTRIB_TEX(i), format);
                                ADD_ATTR(VERT_ATTRIB_TEX0 + i, format, SWTCL_OVM_TEX(i), swiz, mask);
+                               vap_out_fmt_1 |= size << (i * 3);
+                               ++first_free_tex;
                        }
                }
        }
 
        /* RS can't put fragment position on the pixel stack, so stuff it in texcoord if needed */
        if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_POS) && (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_WPOS)) {
-               int first_free_tex = -1;
-               if (fog_id >= 0) {
-                       first_free_tex = fog_id+1;
-               } else {
-                       if (RENDERINPUTS_TEST_RANGE(tnl->render_inputs_bitset, _TNL_FIRST_TEX, _TNL_LAST_TEX )) {
-                               int i;
-                               for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-                                       if (!RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX(i) )) {
-                                               first_free_tex = i;
-                                               break;
-                                       }
-                               }
-                       } else {
-                               first_free_tex = 0;
-                       }
-               }
-
-               if (first_free_tex == -1) {
+               if (first_free_tex >= ctx->Const.MaxTextureUnits) {
                        fprintf(stderr, "\tout of free texcoords to write w pos\n");
                        _mesa_exit(-1);
                }
 
                InputsRead |= 1 << (VERT_ATTRIB_TEX0 + first_free_tex);
                OutputsWritten |= 1 << (VERT_RESULT_TEX0 + first_free_tex);
-               EMIT_ATTR( _TNL_ATTRIB_TEX(first_free_tex), EMIT_4F );
-               ADD_ATTR(VERT_ATTRIB_TEX0 + first_free_tex, EMIT_4F, SWTCL_OVM_TEX(first_free_tex), SWIZZLE_XYZW, MASK_XYZW);
+               EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F );
+               ADD_ATTR(VERT_ATTRIB_POS, EMIT_4F, SWTCL_OVM_TEX(first_free_tex), SWIZZLE_XYZW, MASK_XYZW);
+               vap_out_fmt_1 |= 4 << (first_free_tex * 3);
+               ++first_free_tex;
+       }
+
+       if (RENDERINPUTS_TEST(tnl->render_inputs_bitset, _TNL_ATTRIB_FOG)) {
+               if (first_free_tex >= ctx->Const.MaxTextureUnits) {
+                       fprintf(stderr, "\tout of free texcoords to write fog coordinate\n");
+                       _mesa_exit(-1);
+               }
+
+               InputsRead |= 1 << VERT_ATTRIB_FOG;
+               OutputsWritten |= 1 << VERT_RESULT_FOGC;
+               GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO);
+               EMIT_ATTR( _TNL_ATTRIB_FOG, EMIT_1F );
+               ADD_ATTR(VERT_ATTRIB_FOG, EMIT_1F, SWTCL_OVM_TEX(first_free_tex), swiz, MASK_X);
+               vap_out_fmt_1 |=  1 << (first_free_tex * 3);
        }
 
        R300_NEWPRIM(rmesa);
-       r300SwtclVAPSetup(ctx, InputsRead, OutputsWritten);
+       r300SwtclVAPSetup(ctx, InputsRead, OutputsWritten, vap_out_fmt_1);
 
        rmesa->radeon.swtcl.vertex_size =
                _tnl_install_attrs( ctx,
@@ -460,7 +443,7 @@ do { \
 
 #define LOCAL_VARS(n)                                                  \
    r300ContextPtr rmesa = R300_CONTEXT(ctx);                   \
-   GLuint color[n] = { 0, }, spec[n] = { 0, };                                         \
+   GLuint color[n] = { 0, }, spec[n] = { 0, };                         \
    GLuint coloroffset = rmesa->swtcl.coloroffset;      \
    GLuint specoffset = rmesa->swtcl.specoffset;                        \
    (void) color; (void) spec; (void) coloroffset; (void) specoffset;
index 0cbb2bc..0af5bb4 100644 (file)
@@ -176,8 +176,13 @@ static void r300SetTexFilter(radeonTexObjPtr t, GLenum minf, GLenum magf, GLfloa
        }
 }
 
-static void r300SetTexBorderColor(radeonTexObjPtr t, GLubyte c[4])
+static void r300SetTexBorderColor(radeonTexObjPtr t, const GLfloat color[4])
 {
+       GLubyte c[4];
+       CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+       CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+       CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+       CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
        t->pp_border_color = PACK_COLOR_8888(c[3], c[0], c[1], c[2]);
 }
 
@@ -211,7 +216,7 @@ static void r300TexParameter(GLcontext * ctx, GLenum target,
                break;
 
        case GL_TEXTURE_BORDER_COLOR:
-               r300SetTexBorderColor(t, texObj->_BorderChan);
+               r300SetTexBorderColor(t, texObj->BorderColor);
                break;
 
        case GL_TEXTURE_BASE_LEVEL:
@@ -308,7 +313,7 @@ static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx,
        /* Initialize hardware state */
        r300UpdateTexWrap(t);
        r300SetTexFilter(t, t->base.MinFilter, t->base.MagFilter, t->base.MaxAnisotropy);
-       r300SetTexBorderColor(t, t->base._BorderChan);
+       r300SetTexBorderColor(t, t->base.BorderColor);
 
        return &t->base;
 }
index 9921d35..6f1a0b4 100644 (file)
@@ -5,6 +5,17 @@
 #define RADEON_PARAM_DEVICE_ID 16
 #endif
 
+#ifndef RADEON_INFO_DEVICE_ID
+#define RADEON_INFO_DEVICE_ID 0
+#endif
+#ifndef RADEON_INFO_NUM_GB_PIPES
+#define RADEON_INFO_NUM_GB_PIPES 0
+#endif
+
+#ifndef DRM_RADEON_INFO
+#define DRM_RADEON_INFO 0x1
+#endif
+
 #ifdef HAVE_LIBDRM_RADEON
 
 #include "radeon_bo.h"
 #define DRM_RADEON_GEM_INFO 0x1c
 
 struct drm_radeon_gem_info {
-        uint64_t gart_start;
         uint64_t gart_size;
-        uint64_t vram_start;
         uint64_t vram_size;
         uint64_t vram_visible;
 };
+
+struct drm_radeon_info {
+       uint32_t request;
+       uint32_t pad;
+       uint32_t value;
+};
 #endif
 
 
index 6d9ccfa..ac3b94e 100644 (file)
@@ -246,7 +246,7 @@ void radeonUpdateMaterial( GLcontext *ctx )
  *       _VP_inf_norm
  *       _h_inf_norm
  *       _Position
- *       _NormDirection
+ *       _NormSpotDirection
  *       _ModelViewInvScale
  *       _NeedEyeCoords
  *       _EyeZDir
@@ -308,9 +308,9 @@ void radeonUpdateLighting( GLcontext *ctx )
               fcmd[LIT_DIRECTION_W] = 0;
            } else {
               COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
-              fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0];
-              fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1];
-              fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2];
+              fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0];
+              fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1];
+              fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2];
               fcmd[LIT_DIRECTION_W] = 0;
            }
 
index 08a24a2..df0128c 100644 (file)
@@ -287,8 +287,6 @@ radeonFillInModes( __DRIscreenPrivate *psp,
     __GLcontextModes *m;
     unsigned depth_buffer_factor;
     unsigned back_buffer_factor;
-    GLenum fb_format;
-    GLenum fb_type;
     int i;
 
     /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy
@@ -319,20 +317,27 @@ radeonFillInModes( __DRIscreenPrivate *psp,
     depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
     back_buffer_factor  = (have_back_buffer) ? 2 : 1;
 
-    if ( pixel_bits == 16 ) {
-        fb_format = GL_RGB;
-        fb_type = GL_UNSIGNED_SHORT_5_6_5;
-    }
-    else {
-        fb_format = GL_BGRA;
-        fb_type = GL_UNSIGNED_INT_8_8_8_8_REV;
-    }
+    if (pixel_bits == 16) {
+       __DRIconfig **configs_a8r8g8b8;
+       __DRIconfig **configs_r5g6b5;
+
+       configs_r5g6b5 = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
+                                         depth_bits_array, stencil_bits_array,
+                                         depth_buffer_factor, back_buffer_modes,
+                                         back_buffer_factor, msaa_samples_array,
+                                         1);
+       configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
+                                           depth_bits_array, stencil_bits_array,
+                                           1, back_buffer_modes, 1,
+                                           msaa_samples_array, 1);
+       configs = driConcatConfigs(configs_r5g6b5, configs_a8r8g8b8);
+   } else
+       configs = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
+                                  depth_bits_array, stencil_bits_array,
+                                  depth_buffer_factor,
+                                  back_buffer_modes, back_buffer_factor,
+                                  msaa_samples_array, 1);
 
-    configs = driCreateConfigs(fb_format, fb_type,
-                              depth_bits_array, stencil_bits_array,
-                              depth_buffer_factor,
-                              back_buffer_modes, back_buffer_factor,
-                              msaa_samples_array, 1);
     if (configs == NULL) {
        fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
                 __func__, __LINE__ );
index 80cfdaa..d9a7ef6 100644 (file)
@@ -873,7 +873,7 @@ void radeonUpdateMaterial( GLcontext *ctx )
  *       _VP_inf_norm
  *       _h_inf_norm
  *       _Position
- *       _NormDirection
+ *       _NormSpotDirection
  *       _ModelViewInvScale
  *       _NeedEyeCoords
  *       _EyeZDir
@@ -934,9 +934,9 @@ static void update_light( GLcontext *ctx )
               fcmd[LIT_DIRECTION_W] = 0;
            } else {
               COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
-              fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0];
-              fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1];
-              fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2];
+              fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0];
+              fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1];
+              fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2];
               fcmd[LIT_DIRECTION_W] = 0;
            }
 
index 21509c6..2549d5c 100644 (file)
@@ -243,8 +243,13 @@ static void radeonSetTexFilter( radeonTexObjPtr t, GLenum minf, GLenum magf )
    }
 }
 
-static void radeonSetTexBorderColor( radeonTexObjPtr t, GLubyte c[4] )
+static void radeonSetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] )
 {
+   GLubyte c[4];
+   CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+   CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+   CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+   CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
    t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] );
 }
 
@@ -339,7 +344,7 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target,
       break;
 
    case GL_TEXTURE_BORDER_COLOR:
-      radeonSetTexBorderColor( t, texObj->_BorderChan );
+      radeonSetTexBorderColor( t, texObj->BorderColor );
       break;
 
    case GL_TEXTURE_BASE_LEVEL:
@@ -439,7 +444,7 @@ radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
    radeonSetTexWrap( t, t->base.WrapS, t->base.WrapT );
    radeonSetTexMaxAnisotropy( t, t->base.MaxAnisotropy );
    radeonSetTexFilter( t, t->base.MinFilter, t->base.MagFilter );
-   radeonSetTexBorderColor( t, t->base._BorderChan );
+   radeonSetTexBorderColor( t, t->base.BorderColor );
    return &t->base;
 }
 
index db66026..9b92519 100644 (file)
@@ -132,8 +132,14 @@ static void s3vSetTexFilter(s3vContextPtr vmesa,
 
 static void s3vSetTexBorderColor(s3vContextPtr vmesa,
                                  s3vTextureObjectPtr t, 
-                                 GLubyte color[4])
+                                 const GLfloat color[4])
 {
+       GLubyte c[4];
+       CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]);
+       CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]);
+       CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]);
+       CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]);
+
 #if TEX_DEBUG_ON
        static unsigned int times=0;
        DEBUG_TEX(("*** s3vSetTexBorderColor: #%i ***\n", ++times));
@@ -143,8 +149,7 @@ static void s3vSetTexBorderColor(s3vContextPtr vmesa,
        /* switch(t0 ... t->TextureColorMode) */
 
        /* case TEX_COL_ARGB1555: */
-       t->TextureBorderColor =
-               S3VIRGEPACKCOLOR555(color[0], color[1], color[2], color[3]);
+       t->TextureBorderColor = S3VIRGEPACKCOLOR555(c[0], c[1], c[2], c[3]);
 
        DEBUG(("TextureBorderColor = 0x%x\n", t->TextureBorderColor));
 
@@ -182,7 +187,7 @@ static void s3vTexParameter( GLcontext *ctx, GLenum target,
                break;
   
        case GL_TEXTURE_BORDER_COLOR:
-               s3vSetTexBorderColor( vmesa, t, tObj->_BorderChan );
+               s3vSetTexBorderColor( vmesa, t, tObj->BorderColor );
                break;
 
        case GL_TEXTURE_BASE_LEVEL:
index a3bebfa..fe239e1 100644 (file)
@@ -474,7 +474,7 @@ static void savageSetTexFilter(savageTexObjPtr t, GLenum minf, GLenum magf)
 
 /* Need a fallback ?
  */
-static void savageSetTexBorderColor(savageTexObjPtr t, GLubyte color[4])
+static void savageSetTexBorderColor(savageTexObjPtr t, const GLfloat color[4])
 {
 /*    t->Setup[SAVAGE_TEXREG_TEXBORDERCOL] =  */
     /*t->setup.borderColor = SAVAGEPACKCOLOR8888(color[0],color[1],color[2],color[3]); */
@@ -512,7 +512,7 @@ savageAllocTexObj( struct gl_texture_object *texObj )
 
       savageSetTexWrapping(t,texObj->WrapS,texObj->WrapT);
       savageSetTexFilter(t,texObj->MinFilter,texObj->MagFilter);
-      savageSetTexBorderColor(t,texObj->_BorderChan);
+      savageSetTexBorderColor(t,texObj->BorderColor);
    }
 
    return t;
@@ -2018,7 +2018,7 @@ static void savageTexParameter( GLcontext *ctx, GLenum target,
       break;
   
    case GL_TEXTURE_BORDER_COLOR:
-      savageSetTexBorderColor(t,tObj->_BorderChan);
+      savageSetTexBorderColor(t,tObj->BorderColor);
       break;
 
    default:
index 63f23fc..46417ce 100644 (file)
@@ -456,11 +456,16 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
       break;
    }
 
-   current->texture[hw_unit].hwTextureBorderColor = 
-      ((GLuint) texObj->_BorderChan[3] << 24) + 
-      ((GLuint) texObj->_BorderChan[0] << 16) + 
-      ((GLuint) texObj->_BorderChan[1] << 8) + 
-      ((GLuint) texObj->_BorderChan[2]);
+   {
+      GLubyte c[4];
+      CLAMPED_FLOAT_TO_UBYTE(c[0], texObj->BorderColor[0]);
+      CLAMPED_FLOAT_TO_UBYTE(c[1], texObj->BorderColor[1]);
+      CLAMPED_FLOAT_TO_UBYTE(c[2], texObj->BorderColor[2]);
+      CLAMPED_FLOAT_TO_UBYTE(c[3], texObj->BorderColor[3]);
+
+      current->texture[hw_unit].hwTextureBorderColor = 
+         PACK_COLOR_8888(c[3], c[0], c[1], c[2]);
+   }
 
    if (current->texture[hw_unit].hwTextureBorderColor !=
        prev->texture[hw_unit].hwTextureBorderColor) 
index cc3e3ae..4b66793 100644 (file)
 
     <type name="char"   size="1" glx_name="CARD8"/>
 
-    <enum name="GL_BLEND_EQUATION_RGB"            value="0x8009"/>
+    <enum name="BLEND_EQUATION_RGB"            value="0x8009"/>
     <enum name="VERTEX_ATTRIB_ARRAY_ENABLED"      value="0x8622"/>
     <enum name="VERTEX_ATTRIB_ARRAY_SIZE"         value="0x8623"/>
     <enum name="VERTEX_ATTRIB_ARRAY_STRIDE"       value="0x8624"/>
     <!-- XXX some of the enums and functions probably need additional -->
     <!-- flags/attributes. -->
 
-    <enum name="GL_CURRENT_RASTER_SECONDARY_COLOR" value="0x845F"/>
-    <enum name="GL_PIXEL_PACK_BUFFER"              value="0x88EB"/>
-    <enum name="GL_PIXEL_UNPACK_BUFFER"            value="0x88EC"/>
-    <enum name="GL_PIXEL_PACK_BUFFER_BINDING"      value="0x88ED"/>
-    <enum name="GL_PIXEL_UNPACK_BUFFER_BINDING"    value="0x88EF"/>
-    <enum name="GL_FLOAT_MAT2x3"                   value="0x8B65"/>
-    <enum name="GL_FLOAT_MAT2x4"                   value="0x8B66"/>
-    <enum name="GL_FLOAT_MAT3x2"                   value="0x8B67"/>
-    <enum name="GL_FLOAT_MAT3x4"                   value="0x8B68"/>
-    <enum name="GL_FLOAT_MAT4x2"                   value="0x8B69"/>
-    <enum name="GL_FLOAT_MAT4x3"                   value="0x8B6A"/>
-    <enum name="GL_SRGB"                           value="0x8C40"/>
-    <enum name="GL_SRGB8"                          value="0x8C41"/>
-    <enum name="GL_SRGB_ALPHA"                     value="0x8C42"/>
-    <enum name="GL_SRGB8_ALPHA8"                   value="0x8C43"/>
-    <enum name="GL_SLUMINANCE_ALPHA"               value="0x8C44"/>
-    <enum name="GL_SLUMINANCE8_ALPHA8"             value="0x8C45"/>
-    <enum name="GL_SLUMINANCE"                     value="0x8C46"/>
-    <enum name="GL_SLUMINANCE8"                    value="0x8C47"/>
-    <enum name="GL_COMPRESSED_SRGB"                value="0x8C48"/>
-    <enum name="GL_COMPRESSED_SRGB_ALPHA"          value="0x8C49"/>
-    <enum name="GL_COMPRESSED_SLUMINANCE"          value="0x8C4A"/>
-    <enum name="GL_COMPRESSED_SLUMINANCE_ALPHA"    value="0x8C4B"/>
+    <enum name="CURRENT_RASTER_SECONDARY_COLOR" value="0x845F"/>
+    <enum name="PIXEL_PACK_BUFFER"              value="0x88EB"/>
+    <enum name="PIXEL_UNPACK_BUFFER"            value="0x88EC"/>
+    <enum name="PIXEL_PACK_BUFFER_BINDING"      value="0x88ED"/>
+    <enum name="PIXEL_UNPACK_BUFFER_BINDING"    value="0x88EF"/>
+    <enum name="FLOAT_MAT2x3"                   value="0x8B65"/>
+    <enum name="FLOAT_MAT2x4"                   value="0x8B66"/>
+    <enum name="FLOAT_MAT3x2"                   value="0x8B67"/>
+    <enum name="FLOAT_MAT3x4"                   value="0x8B68"/>
+    <enum name="FLOAT_MAT4x2"                   value="0x8B69"/>
+    <enum name="FLOAT_MAT4x3"                   value="0x8B6A"/>
+    <enum name="SRGB"                           value="0x8C40"/>
+    <enum name="SRGB8"                          value="0x8C41"/>
+    <enum name="SRGB_ALPHA"                     value="0x8C42"/>
+    <enum name="SRGB8_ALPHA8"                   value="0x8C43"/>
+    <enum name="SLUMINANCE_ALPHA"               value="0x8C44"/>
+    <enum name="SLUMINANCE8_ALPHA8"             value="0x8C45"/>
+    <enum name="SLUMINANCE"                     value="0x8C46"/>
+    <enum name="SLUMINANCE8"                    value="0x8C47"/>
+    <enum name="COMPRESSED_SRGB"                value="0x8C48"/>
+    <enum name="COMPRESSED_SRGB_ALPHA"          value="0x8C49"/>
+    <enum name="COMPRESSED_SLUMINANCE"          value="0x8C4A"/>
+    <enum name="COMPRESSED_SLUMINANCE_ALPHA"    value="0x8C4B"/>
 
     <function name="UniformMatrix2x3fv" offset="assign">
         <param name="location" type="GLint"/>
     </function>
 </category>
 
+<category name="GL_MESA_texture_signed_rgba">
+    <enum name="SIGNED_NORMALIZED"                        value="0x8F9C"/>
+    <enum name="RGBA_SNORM"                               value="0x8F93"/>
+    <enum name="RGBA8_SNORM"                              value="0x8F97"/>
+</category>
+
 <category name="GL_MESA_shader_debug">
     <enum name="DEBUG_OBJECT_MESA"                        value="0x8759"/>
     <enum name="DEBUG_PRINT_MESA"                         value="0x875A"/>
index 1d2c460..d5d0a55 100644 (file)
@@ -1104,7 +1104,7 @@ _mesa_PopAttrib(void)
                  _mesa_light(ctx, i, GL_DIFFUSE, l->Diffuse);
                  _mesa_light(ctx, i, GL_SPECULAR, l->Specular );
                  _mesa_light(ctx, i, GL_POSITION, l->EyePosition);
-                 _mesa_light(ctx, i, GL_SPOT_DIRECTION, l->EyeDirection);
+                 _mesa_light(ctx, i, GL_SPOT_DIRECTION, l->SpotDirection);
                  _mesa_light(ctx, i, GL_SPOT_EXPONENT, &l->SpotExponent);
                  _mesa_light(ctx, i, GL_SPOT_CUTOFF, &l->SpotCutoff);
                  _mesa_light(ctx, i, GL_CONSTANT_ATTENUATION,
index 74692e9..815624e 100644 (file)
@@ -71,9 +71,6 @@
 /** \def COPY_CHAN4
  * Copy a GLchan[4] array */
 
-/** \def CHAN_PRODUCT
- * Scaled product (usually approximated) between two GLchan arguments */
-
 #if CHAN_BITS == 8
 
 #define BYTE_TO_CHAN(b)   ((b) < 0 ? 0 : (GLchan) (b))
@@ -91,8 +88,6 @@
 
 #define COPY_CHAN4(DST, SRC)  COPY_4UBV(DST, SRC)
 
-#define CHAN_PRODUCT(a, b)  ((GLubyte) (((GLint)(a) * ((GLint)(b) + 1)) >> 8))
-
 #elif CHAN_BITS == 16
 
 #define BYTE_TO_CHAN(b)   ((b) < 0 ? 0 : (((GLchan) (b)) * 516))
 
 #define COPY_CHAN4(DST, SRC)  COPY_4V(DST, SRC)
 
-#define CHAN_PRODUCT(a, b) ((GLchan) ((((GLuint) (a)) * ((GLuint) (b))) / 65535))
-
 #elif CHAN_BITS == 32
 
 /* XXX floating-point color channels not fully thought-out */
 
 #define COPY_CHAN4(DST, SRC)  COPY_4V(DST, SRC)
 
-#define CHAN_PRODUCT(a, b)    ((a) * (b))
-
 #else
 
 #error unexpected CHAN_BITS size
index 39b19bb..93103fe 100644 (file)
@@ -230,7 +230,10 @@ extern "C" {
 #if defined(__linux__)
 #include <byteswap.h>
 #define CPU_TO_LE32( x )       bswap_32( x )
-#else /*__linux__*/
+#elif defined(__APPLE__)
+#include <CoreFoundation/CFByteOrder.h>
+#define CPU_TO_LE32( x )       CFSwapInt32HostToLittle( x )
+#else /*__linux__ __APPLE__*/
 #include <sys/endian.h>
 #define CPU_TO_LE32( x )       bswap32( x )
 #endif /*__linux__*/
index fc31155..2a9fdf9 100644 (file)
 #define MAX_PROGRAM_MATRICES 8
 #define MAX_PROGRAM_MATRIX_STACK_DEPTH 4
 #define MAX_PROGRAM_CALL_DEPTH 8
-#define MAX_PROGRAM_TEMPS 128
+#define MAX_PROGRAM_TEMPS 256
 #define MAX_PROGRAM_ADDRESS_REGS 2
 #define MAX_UNIFORMS 1024  /**< number of vec4 uniforms */
 #define MAX_VARYING 8      /**< number of float[4] vectors */
index 8f7f703..537ff58 100644 (file)
@@ -975,7 +975,7 @@ _mesa_save_CallList(GLuint list)
    ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN;
 
    if (ctx->ExecuteFlag) {
-      CALL_CallList(ctx->Exec, (list));
+      _mesa_CallList(list);
    }
 }
 
index e9de0c0..6682b5e 100644 (file)
@@ -77,28 +77,30 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
    }
 
    if (ctx->RenderMode == GL_RENDER) {
-      /* Round, to satisfy conformance tests (matches SGI's OpenGL) */
-      GLint x = IROUND(ctx->Current.RasterPos[0]);
-      GLint y = IROUND(ctx->Current.RasterPos[1]);
-
-      if (ctx->Unpack.BufferObj->Name) {
-         /* unpack from PBO */
-         if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
-                                        format, type, pixels)) {
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glDrawPixels(invalid PBO access)");
-            return;
+      if (width > 0 && height > 0) {
+         /* Round, to satisfy conformance tests (matches SGI's OpenGL) */
+         GLint x = IROUND(ctx->Current.RasterPos[0]);
+         GLint y = IROUND(ctx->Current.RasterPos[1]);
+
+         if (ctx->Unpack.BufferObj->Name) {
+            /* unpack from PBO */
+            if (!_mesa_validate_pbo_access(2, &ctx->Unpack, width, height, 1,
+                                           format, type, pixels)) {
+               _mesa_error(ctx, GL_INVALID_OPERATION,
+                           "glDrawPixels(invalid PBO access)");
+               return;
+            }
+            if (ctx->Unpack.BufferObj->Pointer) {
+               /* buffer is mapped - that's an error */
+               _mesa_error(ctx, GL_INVALID_OPERATION,
+                           "glDrawPixels(PBO is mapped)");
+               return;
+            }
          }
-         if (ctx->Unpack.BufferObj->Pointer) {
-            /* buffer is mapped - that's an error */
-            _mesa_error(ctx, GL_INVALID_OPERATION,
-                        "glDrawPixels(PBO is mapped)");
-            return;
-         }
-      }
 
-      ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
-                            &ctx->Unpack, pixels);
+         ctx->Driver.DrawPixels(ctx, x, y, width, height, format, type,
+                                &ctx->Unpack, pixels);
+      }
    }
    else if (ctx->RenderMode == GL_FEEDBACK) {
       /* Feedback the current raster pos info */
@@ -159,10 +161,12 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height,
 
    if (ctx->RenderMode == GL_RENDER) {
       /* Round to satisfy conformance tests (matches SGI's OpenGL) */
-      GLint destx = IROUND(ctx->Current.RasterPos[0]);
-      GLint desty = IROUND(ctx->Current.RasterPos[1]);
-      ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
-                             type );
+      if (width > 0 && height > 0) {
+         GLint destx = IROUND(ctx->Current.RasterPos[0]);
+         GLint desty = IROUND(ctx->Current.RasterPos[1]);
+         ctx->Driver.CopyPixels( ctx, srcx, srcy, width, height, destx, desty,
+                                 type );
+      }
    }
    else if (ctx->RenderMode == GL_FEEDBACK) {
       FLUSH_CURRENT( ctx, 0 );
index e63a04e..c077bc0 100644 (file)
@@ -120,6 +120,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_BLEND_EQUATION_ALPHA\0"
    "GL_BLEND_EQUATION_ALPHA_EXT\0"
    "GL_BLEND_EQUATION_EXT\0"
+   "GL_BLEND_EQUATION_RGB\0"
    "GL_BLEND_EQUATION_RGB_EXT\0"
    "GL_BLEND_SRC\0"
    "GL_BLEND_SRC_ALPHA\0"
@@ -297,6 +298,10 @@ LONGSTRING static const char enum_string_table[] =
    "GL_COMPRESSED_RGB_ARB\0"
    "GL_COMPRESSED_RGB_FXT1_3DFX\0"
    "GL_COMPRESSED_RGB_S3TC_DXT1_EXT\0"
+   "GL_COMPRESSED_SLUMINANCE\0"
+   "GL_COMPRESSED_SLUMINANCE_ALPHA\0"
+   "GL_COMPRESSED_SRGB\0"
+   "GL_COMPRESSED_SRGB_ALPHA\0"
    "GL_COMPRESSED_TEXTURE_FORMATS\0"
    "GL_CONSTANT\0"
    "GL_CONSTANT_ALPHA\0"
@@ -355,6 +360,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_CURRENT_RASTER_INDEX\0"
    "GL_CURRENT_RASTER_POSITION\0"
    "GL_CURRENT_RASTER_POSITION_VALID\0"
+   "GL_CURRENT_RASTER_SECONDARY_COLOR\0"
    "GL_CURRENT_RASTER_TEXTURE_COORDS\0"
    "GL_CURRENT_SECONDARY_COLOR\0"
    "GL_CURRENT_TEXTURE_COORDS\0"
@@ -510,10 +516,16 @@ LONGSTRING static const char enum_string_table[] =
    "GL_FLOAT\0"
    "GL_FLOAT_MAT2\0"
    "GL_FLOAT_MAT2_ARB\0"
+   "GL_FLOAT_MAT2x3\0"
+   "GL_FLOAT_MAT2x4\0"
    "GL_FLOAT_MAT3\0"
    "GL_FLOAT_MAT3_ARB\0"
+   "GL_FLOAT_MAT3x2\0"
+   "GL_FLOAT_MAT3x4\0"
    "GL_FLOAT_MAT4\0"
    "GL_FLOAT_MAT4_ARB\0"
+   "GL_FLOAT_MAT4x2\0"
+   "GL_FLOAT_MAT4x3\0"
    "GL_FLOAT_VEC2\0"
    "GL_FLOAT_VEC2_ARB\0"
    "GL_FLOAT_VEC3\0"
@@ -607,30 +619,6 @@ LONGSTRING static const char enum_string_table[] =
    "GL_GENERATE_MIPMAP_HINT_SGIS\0"
    "GL_GENERATE_MIPMAP_SGIS\0"
    "GL_GEQUAL\0"
-   "GL_GL_BLEND_EQUATION_RGB\0"
-   "GL_GL_COMPRESSED_SLUMINANCE\0"
-   "GL_GL_COMPRESSED_SLUMINANCE_ALPHA\0"
-   "GL_GL_COMPRESSED_SRGB\0"
-   "GL_GL_COMPRESSED_SRGB_ALPHA\0"
-   "GL_GL_CURRENT_RASTER_SECONDARY_COLOR\0"
-   "GL_GL_FLOAT_MAT2x3\0"
-   "GL_GL_FLOAT_MAT2x4\0"
-   "GL_GL_FLOAT_MAT3x2\0"
-   "GL_GL_FLOAT_MAT3x4\0"
-   "GL_GL_FLOAT_MAT4x2\0"
-   "GL_GL_FLOAT_MAT4x3\0"
-   "GL_GL_PIXEL_PACK_BUFFER\0"
-   "GL_GL_PIXEL_PACK_BUFFER_BINDING\0"
-   "GL_GL_PIXEL_UNPACK_BUFFER\0"
-   "GL_GL_PIXEL_UNPACK_BUFFER_BINDING\0"
-   "GL_GL_SLUMINANCE\0"
-   "GL_GL_SLUMINANCE8\0"
-   "GL_GL_SLUMINANCE8_ALPHA8\0"
-   "GL_GL_SLUMINANCE_ALPHA\0"
-   "GL_GL_SRGB\0"
-   "GL_GL_SRGB8\0"
-   "GL_GL_SRGB8_ALPHA8\0"
-   "GL_GL_SRGB_ALPHA\0"
    "GL_GREATER\0"
    "GL_GREEN\0"
    "GL_GREEN_BIAS\0"
@@ -1152,8 +1140,12 @@ LONGSTRING static const char enum_string_table[] =
    "GL_PIXEL_MAP_S_TO_S\0"
    "GL_PIXEL_MAP_S_TO_S_SIZE\0"
    "GL_PIXEL_MODE_BIT\0"
+   "GL_PIXEL_PACK_BUFFER\0"
+   "GL_PIXEL_PACK_BUFFER_BINDING\0"
    "GL_PIXEL_PACK_BUFFER_BINDING_EXT\0"
    "GL_PIXEL_PACK_BUFFER_EXT\0"
+   "GL_PIXEL_UNPACK_BUFFER\0"
+   "GL_PIXEL_UNPACK_BUFFER_BINDING\0"
    "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT\0"
    "GL_PIXEL_UNPACK_BUFFER_EXT\0"
    "GL_POINT\0"
@@ -1385,9 +1377,11 @@ LONGSTRING static const char enum_string_table[] =
    "GL_RGBA4_S3TC\0"
    "GL_RGBA8\0"
    "GL_RGBA8_EXT\0"
+   "GL_RGBA8_SNORM\0"
    "GL_RGBA_DXT5_S3TC\0"
    "GL_RGBA_MODE\0"
    "GL_RGBA_S3TC\0"
+   "GL_RGBA_SNORM\0"
    "GL_RGB_S3TC\0"
    "GL_RGB_SCALE\0"
    "GL_RGB_SCALE_ARB\0"
@@ -1444,9 +1438,14 @@ LONGSTRING static const char enum_string_table[] =
    "GL_SHARED_TEXTURE_PALETTE_EXT\0"
    "GL_SHININESS\0"
    "GL_SHORT\0"
+   "GL_SIGNED_NORMALIZED\0"
    "GL_SINGLE_COLOR\0"
    "GL_SINGLE_COLOR_EXT\0"
    "GL_SLICE_ACCUM_SUN\0"
+   "GL_SLUMINANCE\0"
+   "GL_SLUMINANCE8\0"
+   "GL_SLUMINANCE8_ALPHA8\0"
+   "GL_SLUMINANCE_ALPHA\0"
    "GL_SMOOTH\0"
    "GL_SMOOTH_LINE_WIDTH_GRANULARITY\0"
    "GL_SMOOTH_LINE_WIDTH_RANGE\0"
@@ -1487,6 +1486,9 @@ LONGSTRING static const char enum_string_table[] =
    "GL_SRC_ALPHA_SATURATE\0"
    "GL_SRC_COLOR\0"
    "GL_SRGB\0"
+   "GL_SRGB8\0"
+   "GL_SRGB8_ALPHA8\0"
+   "GL_SRGB_ALPHA\0"
    "GL_STACK_OVERFLOW\0"
    "GL_STACK_UNDERFLOW\0"
    "GL_STATIC_COPY\0"
@@ -1856,7 +1858,7 @@ LONGSTRING static const char enum_string_table[] =
    "GL_ZOOM_Y\0"
    ;
 
-static const enum_elt all_enums[1818] =
+static const enum_elt all_enums[1820] =
 {
    {     0, 0x00000600 }, /* GL_2D */
    {     6, 0x00001407 }, /* GL_2_BYTES */
@@ -1942,3059 +1944,3064 @@ static const enum_elt all_enums[1818] =
    {  1320, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA */
    {  1344, 0x0000883D }, /* GL_BLEND_EQUATION_ALPHA_EXT */
    {  1372, 0x00008009 }, /* GL_BLEND_EQUATION_EXT */
-   {  1394, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */
-   {  1420, 0x00000BE1 }, /* GL_BLEND_SRC */
-   {  1433, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */
-   {  1452, 0x000080C9 }, /* GL_BLEND_SRC_RGB */
-   {  1469, 0x00001905 }, /* GL_BLUE */
-   {  1477, 0x00000D1B }, /* GL_BLUE_BIAS */
-   {  1490, 0x00000D54 }, /* GL_BLUE_BITS */
-   {  1503, 0x00000D1A }, /* GL_BLUE_SCALE */
-   {  1517, 0x00008B56 }, /* GL_BOOL */
-   {  1525, 0x00008B56 }, /* GL_BOOL_ARB */
-   {  1537, 0x00008B57 }, /* GL_BOOL_VEC2 */
-   {  1550, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */
-   {  1567, 0x00008B58 }, /* GL_BOOL_VEC3 */
-   {  1580, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */
-   {  1597, 0x00008B59 }, /* GL_BOOL_VEC4 */
-   {  1610, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */
-   {  1627, 0x000088BB }, /* GL_BUFFER_ACCESS */
-   {  1644, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */
-   {  1665, 0x000088BC }, /* GL_BUFFER_MAPPED */
-   {  1682, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */
-   {  1703, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */
-   {  1725, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */
-   {  1751, 0x00008764 }, /* GL_BUFFER_SIZE */
-   {  1766, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */
-   {  1785, 0x00008765 }, /* GL_BUFFER_USAGE */
-   {  1801, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */
-   {  1821, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */
-   {  1840, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */
-   {  1866, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */
-   {  1889, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
-   {  1917, 0x0000877C }, /* GL_BUMP_TARGET_ATI */
-   {  1936, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */
-   {  1958, 0x00001400 }, /* GL_BYTE */
-   {  1966, 0x00002A24 }, /* GL_C3F_V3F */
-   {  1977, 0x00002A26 }, /* GL_C4F_N3F_V3F */
-   {  1992, 0x00002A22 }, /* GL_C4UB_V2F */
-   {  2004, 0x00002A23 }, /* GL_C4UB_V3F */
-   {  2016, 0x00000901 }, /* GL_CCW */
-   {  2023, 0x00002900 }, /* GL_CLAMP */
-   {  2032, 0x0000812D }, /* GL_CLAMP_TO_BORDER */
-   {  2051, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */
-   {  2074, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */
-   {  2098, 0x0000812F }, /* GL_CLAMP_TO_EDGE */
-   {  2115, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */
-   {  2137, 0x00001500 }, /* GL_CLEAR */
-   {  2146, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */
-   {  2171, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */
-   {  2200, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */
-   {  2226, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
-   {  2255, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */
-   {  2281, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */
-   {  2308, 0x00003000 }, /* GL_CLIP_PLANE0 */
-   {  2323, 0x00003001 }, /* GL_CLIP_PLANE1 */
-   {  2338, 0x00003002 }, /* GL_CLIP_PLANE2 */
-   {  2353, 0x00003003 }, /* GL_CLIP_PLANE3 */
-   {  2368, 0x00003004 }, /* GL_CLIP_PLANE4 */
-   {  2383, 0x00003005 }, /* GL_CLIP_PLANE5 */
-   {  2398, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
-   {  2431, 0x00000A00 }, /* GL_COEFF */
-   {  2440, 0x00001800 }, /* GL_COLOR */
-   {  2449, 0x00008076 }, /* GL_COLOR_ARRAY */
-   {  2464, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */
-   {  2494, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */
-   {  2528, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */
-   {  2551, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */
-   {  2571, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */
-   {  2593, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */
-   {  2613, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */
-   {  2634, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */
-   {  2659, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */
-   {  2680, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */
-   {  2702, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */
-   {  2728, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */
-   {  2750, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */
-   {  2776, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */
-   {  2798, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */
-   {  2824, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */
-   {  2846, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */
-   {  2872, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */
-   {  2894, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */
-   {  2920, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */
-   {  2942, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */
-   {  2968, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */
-   {  2993, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */
-   {  3014, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */
-   {  3039, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */
-   {  3060, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */
-   {  3085, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */
-   {  3106, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */
-   {  3131, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */
-   {  3152, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */
-   {  3177, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */
-   {  3198, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */
-   {  3223, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */
-   {  3244, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */
-   {  3269, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */
-   {  3290, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */
-   {  3315, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */
-   {  3336, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */
-   {  3361, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */
-   {  3381, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */
-   {  3402, 0x00001900 }, /* GL_COLOR_INDEX */
-   {  3417, 0x00001603 }, /* GL_COLOR_INDEXES */
-   {  3434, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */
-   {  3452, 0x00000B57 }, /* GL_COLOR_MATERIAL */
-   {  3470, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */
-   {  3493, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */
-   {  3521, 0x000080B1 }, /* GL_COLOR_MATRIX */
-   {  3537, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */
-   {  3557, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */
-   {  3585, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */
-   {  3617, 0x00008458 }, /* GL_COLOR_SUM */
-   {  3630, 0x00008458 }, /* GL_COLOR_SUM_ARB */
-   {  3647, 0x000080D0 }, /* GL_COLOR_TABLE */
-   {  3662, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */
-   {  3688, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */
-   {  3718, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */
-   {  3748, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */
-   {  3768, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */
-   {  3792, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */
-   {  3817, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */
-   {  3846, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */
-   {  3875, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */
-   {  3897, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */
-   {  3923, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */
-   {  3949, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */
-   {  3975, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */
-   {  4005, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */
-   {  4035, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */
-   {  4065, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */
-   {  4099, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */
-   {  4133, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
-   {  4163, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */
-   {  4197, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */
-   {  4231, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */
-   {  4255, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */
-   {  4283, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */
-   {  4311, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */
-   {  4332, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */
-   {  4357, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */
-   {  4378, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */
-   {  4403, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */
-   {  4428, 0x00000C23 }, /* GL_COLOR_WRITEMASK */
-   {  4447, 0x00008570 }, /* GL_COMBINE */
-   {  4458, 0x00008503 }, /* GL_COMBINE4 */
-   {  4470, 0x00008572 }, /* GL_COMBINE_ALPHA */
-   {  4487, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */
-   {  4508, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */
-   {  4529, 0x00008570 }, /* GL_COMBINE_ARB */
-   {  4544, 0x00008570 }, /* GL_COMBINE_EXT */
-   {  4559, 0x00008571 }, /* GL_COMBINE_RGB */
-   {  4574, 0x00008571 }, /* GL_COMBINE_RGB_ARB */
-   {  4593, 0x00008571 }, /* GL_COMBINE_RGB_EXT */
-   {  4612, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */
-   {  4648, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */
-   {  4672, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */
-   {  4700, 0x00001300 }, /* GL_COMPILE */
-   {  4711, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */
-   {  4734, 0x00008B81 }, /* GL_COMPILE_STATUS */
-   {  4752, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */
-   {  4772, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */
-   {  4796, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */
-   {  4820, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */
-   {  4848, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */
-   {  4872, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */
-   {  4902, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */
-   {  4936, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */
-   {  4964, 0x000084ED }, /* GL_COMPRESSED_RGB */
-   {  4982, 0x000084EE }, /* GL_COMPRESSED_RGBA */
-   {  5001, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */
-   {  5024, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
-   {  5053, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
-   {  5086, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
-   {  5119, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
-   {  5152, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */
-   {  5174, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */
-   {  5202, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
-   {  5234, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */
-   {  5264, 0x00008576 }, /* GL_CONSTANT */
-   {  5276, 0x00008003 }, /* GL_CONSTANT_ALPHA */
-   {  5294, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */
-   {  5316, 0x00008576 }, /* GL_CONSTANT_ARB */
-   {  5332, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */
-   {  5356, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */
-   {  5378, 0x00008001 }, /* GL_CONSTANT_COLOR */
-   {  5396, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */
-   {  5418, 0x00008576 }, /* GL_CONSTANT_EXT */
-   {  5434, 0x00008010 }, /* GL_CONVOLUTION_1D */
-   {  5452, 0x00008011 }, /* GL_CONVOLUTION_2D */
-   {  5470, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */
-   {  5498, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */
-   {  5529, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */
-   {  5556, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */
-   {  5587, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */
-   {  5614, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */
-   {  5645, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */
-   {  5673, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */
-   {  5705, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */
-   {  5727, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */
-   {  5753, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */
-   {  5775, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */
-   {  5801, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */
-   {  5822, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */
-   {  5847, 0x00008862 }, /* GL_COORD_REPLACE */
-   {  5864, 0x00008862 }, /* GL_COORD_REPLACE_ARB */
-   {  5885, 0x00008862 }, /* GL_COORD_REPLACE_NV */
-   {  5905, 0x00001503 }, /* GL_COPY */
-   {  5913, 0x0000150C }, /* GL_COPY_INVERTED */
-   {  5930, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */
-   {  5950, 0x00000B44 }, /* GL_CULL_FACE */
-   {  5963, 0x00000B45 }, /* GL_CULL_FACE_MODE */
-   {  5981, 0x000081AA }, /* GL_CULL_VERTEX_EXT */
-   {  6000, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
-   {  6032, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
-   {  6067, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */
-   {  6088, 0x00000001 }, /* GL_CURRENT_BIT */
-   {  6103, 0x00000B00 }, /* GL_CURRENT_COLOR */
-   {  6120, 0x00008453 }, /* GL_CURRENT_FOG_COORD */
-   {  6141, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */
-   {  6167, 0x00000B01 }, /* GL_CURRENT_INDEX */
-   {  6184, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */
-   {  6206, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */
-   {  6234, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */
-   {  6255, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
-   {  6289, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */
-   {  6322, 0x00000B02 }, /* GL_CURRENT_NORMAL */
-   {  6340, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */
-   {  6370, 0x00008B8D }, /* GL_CURRENT_PROGRAM */
-   {  6389, 0x00008865 }, /* GL_CURRENT_QUERY */
-   {  6406, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */
-   {  6427, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */
-   {  6451, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */
-   {  6478, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */
-   {  6502, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */
-   {  6529, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */
-   {  6562, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
-   {  6595, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */
-   {  6622, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */
-   {  6648, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */
-   {  6673, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */
-   {  6702, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */
-   {  6724, 0x00000900 }, /* GL_CW */
-   {  6730, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */
-   {  6751, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */
-   {  6772, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */
-   {  6792, 0x00002101 }, /* GL_DECAL */
-   {  6801, 0x00001E03 }, /* GL_DECR */
-   {  6809, 0x00008508 }, /* GL_DECR_WRAP */
-   {  6822, 0x00008508 }, /* GL_DECR_WRAP_EXT */
-   {  6839, 0x00008B80 }, /* GL_DELETE_STATUS */
-   {  6856, 0x00001801 }, /* GL_DEPTH */
-   {  6865, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */
-   {  6885, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
-   {  6905, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
-   {  6929, 0x00000D1F }, /* GL_DEPTH_BIAS */
-   {  6943, 0x00000D56 }, /* GL_DEPTH_BITS */
-   {  6957, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
-   {  6977, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
-   {  7002, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
-   {  7022, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
-   {  7040, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
-   {  7061, 0x00001902 }, /* GL_DEPTH_COMPONENT */
-   {  7080, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
-   {  7101, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
-   {  7126, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
-   {  7152, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
-   {  7173, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
-   {  7198, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
-   {  7224, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
-   {  7245, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
-   {  7270, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
-   {  7296, 0x00000B74 }, /* GL_DEPTH_FUNC */
-   {  7310, 0x00000B70 }, /* GL_DEPTH_RANGE */
-   {  7325, 0x00000D1E }, /* GL_DEPTH_SCALE */
-   {  7340, 0x000084F9 }, /* GL_DEPTH_STENCIL */
-   {  7357, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
-   {  7385, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
-   {  7405, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
-   {  7433, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
-   {  7461, 0x00000B71 }, /* GL_DEPTH_TEST */
-   {  7475, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
-   {  7497, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
-   {  7523, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
-   {  7542, 0x00001201 }, /* GL_DIFFUSE */
-   {  7553, 0x00000BD0 }, /* GL_DITHER */
-   {  7563, 0x00000A02 }, /* GL_DOMAIN */
-   {  7573, 0x00001100 }, /* GL_DONT_CARE */
-   {  7586, 0x000086AE }, /* GL_DOT3_RGB */
-   {  7598, 0x000086AF }, /* GL_DOT3_RGBA */
-   {  7611, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
-   {  7628, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
-   {  7645, 0x000086AE }, /* GL_DOT3_RGB_ARB */
-   {  7661, 0x00008740 }, /* GL_DOT3_RGB_EXT */
-   {  7677, 0x0000140A }, /* GL_DOUBLE */
-   {  7687, 0x00000C32 }, /* GL_DOUBLEBUFFER */
-   {  7703, 0x00000C01 }, /* GL_DRAW_BUFFER */
-   {  7718, 0x00008825 }, /* GL_DRAW_BUFFER0 */
-   {  7734, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
-   {  7754, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
-   {  7774, 0x00008826 }, /* GL_DRAW_BUFFER1 */
-   {  7790, 0x0000882F }, /* GL_DRAW_BUFFER10 */
-   {  7807, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
-   {  7828, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
-   {  7849, 0x00008830 }, /* GL_DRAW_BUFFER11 */
-   {  7866, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
-   {  7887, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
-   {  7908, 0x00008831 }, /* GL_DRAW_BUFFER12 */
-   {  7925, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
-   {  7946, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
-   {  7967, 0x00008832 }, /* GL_DRAW_BUFFER13 */
-   {  7984, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
-   {  8005, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
-   {  8026, 0x00008833 }, /* GL_DRAW_BUFFER14 */
-   {  8043, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
-   {  8064, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
-   {  8085, 0x00008834 }, /* GL_DRAW_BUFFER15 */
-   {  8102, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
-   {  8123, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
-   {  8144, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
-   {  8164, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
-   {  8184, 0x00008827 }, /* GL_DRAW_BUFFER2 */
-   {  8200, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
-   {  8220, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
-   {  8240, 0x00008828 }, /* GL_DRAW_BUFFER3 */
-   {  8256, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
-   {  8276, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
-   {  8296, 0x00008829 }, /* GL_DRAW_BUFFER4 */
-   {  8312, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
-   {  8332, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
-   {  8352, 0x0000882A }, /* GL_DRAW_BUFFER5 */
-   {  8368, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
-   {  8388, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
-   {  8408, 0x0000882B }, /* GL_DRAW_BUFFER6 */
-   {  8424, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
-   {  8444, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
-   {  8464, 0x0000882C }, /* GL_DRAW_BUFFER7 */
-   {  8480, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
-   {  8500, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
-   {  8520, 0x0000882D }, /* GL_DRAW_BUFFER8 */
-   {  8536, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
-   {  8556, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
-   {  8576, 0x0000882E }, /* GL_DRAW_BUFFER9 */
-   {  8592, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
-   {  8612, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
-   {  8632, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
-   {  8652, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
-   {  8684, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
-   {  8708, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
-   {  8728, 0x00000304 }, /* GL_DST_ALPHA */
-   {  8741, 0x00000306 }, /* GL_DST_COLOR */
-   {  8754, 0x0000877A }, /* GL_DU8DV8_ATI */
-   {  8768, 0x00008779 }, /* GL_DUDV_ATI */
-   {  8780, 0x000088EA }, /* GL_DYNAMIC_COPY */
-   {  8796, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
-   {  8816, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
-   {  8832, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
-   {  8852, 0x000088E9 }, /* GL_DYNAMIC_READ */
-   {  8868, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
-   {  8888, 0x00000B43 }, /* GL_EDGE_FLAG */
-   {  8901, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
-   {  8920, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
-   {  8954, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
-   {  8992, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
-   {  9019, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
-   {  9045, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
-   {  9069, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
-   {  9101, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
-   {  9137, 0x00001600 }, /* GL_EMISSION */
-   {  9149, 0x00002000 }, /* GL_ENABLE_BIT */
-   {  9163, 0x00000202 }, /* GL_EQUAL */
-   {  9172, 0x00001509 }, /* GL_EQUIV */
-   {  9181, 0x00010000 }, /* GL_EVAL_BIT */
-   {  9193, 0x00000800 }, /* GL_EXP */
-   {  9200, 0x00000801 }, /* GL_EXP2 */
-   {  9208, 0x00001F03 }, /* GL_EXTENSIONS */
-   {  9222, 0x00002400 }, /* GL_EYE_LINEAR */
-   {  9236, 0x00002502 }, /* GL_EYE_PLANE */
-   {  9249, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
-   {  9274, 0x0000855B }, /* GL_EYE_RADIAL_NV */
-   {  9291, 0x00000000 }, /* GL_FALSE */
-   {  9300, 0x00001101 }, /* GL_FASTEST */
-   {  9311, 0x00001C01 }, /* GL_FEEDBACK */
-   {  9323, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
-   {  9350, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
-   {  9374, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
-   {  9398, 0x00001B02 }, /* GL_FILL */
-   {  9406, 0x00001D00 }, /* GL_FLAT */
-   {  9414, 0x00001406 }, /* GL_FLOAT */
-   {  9423, 0x00008B5A }, /* GL_FLOAT_MAT2 */
-   {  9437, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
-   {  9455, 0x00008B5B }, /* GL_FLOAT_MAT3 */
-   {  9469, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
-   {  9487, 0x00008B5C }, /* GL_FLOAT_MAT4 */
-   {  9501, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
-   {  9519, 0x00008B50 }, /* GL_FLOAT_VEC2 */
-   {  9533, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
-   {  9551, 0x00008B51 }, /* GL_FLOAT_VEC3 */
-   {  9565, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
-   {  9583, 0x00008B52 }, /* GL_FLOAT_VEC4 */
-   {  9597, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
-   {  9615, 0x00000B60 }, /* GL_FOG */
-   {  9622, 0x00000080 }, /* GL_FOG_BIT */
-   {  9633, 0x00000B66 }, /* GL_FOG_COLOR */
-   {  9646, 0x00008451 }, /* GL_FOG_COORD */
-   {  9659, 0x00008451 }, /* GL_FOG_COORDINATE */
-   {  9677, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
-   {  9701, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
-   {  9740, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
-   {  9783, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
-   {  9815, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
-   {  9846, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
-   {  9875, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
-   {  9900, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
-   {  9919, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
-   {  9953, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
-   {  9980, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
-   { 10006, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
-   { 10030, 0x00008450 }, /* GL_FOG_COORD_SRC */
-   { 10047, 0x00000B62 }, /* GL_FOG_DENSITY */
-   { 10062, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
-   { 10086, 0x00000B64 }, /* GL_FOG_END */
-   { 10097, 0x00000C54 }, /* GL_FOG_HINT */
-   { 10109, 0x00000B61 }, /* GL_FOG_INDEX */
-   { 10122, 0x00000B65 }, /* GL_FOG_MODE */
-   { 10134, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
-   { 10153, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
-   { 10178, 0x00000B63 }, /* GL_FOG_START */
-   { 10191, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
-   { 10209, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
-   { 10233, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
-   { 10252, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
-   { 10275, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
-   { 10310, 0x00008D40 }, /* GL_FRAMEBUFFER */
-   { 10325, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
-   { 10362, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
-   { 10398, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
-   { 10439, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
-   { 10480, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
-   { 10517, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
-   { 10554, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
-   { 10592, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
-   { 10634, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
-   { 10672, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
-   { 10714, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
-   { 10749, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
-   { 10788, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
-   { 10837, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
-   { 10885, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
-   { 10937, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
-   { 10977, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
-   { 11021, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
-   { 11061, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
-   { 11105, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
-   { 11132, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
-   { 11156, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
-   { 11184, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
-   { 11207, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
-   { 11226, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
-   { 11263, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
-   { 11304, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
-   { 11345, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
-   { 11387, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
-   { 11438, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
-   { 11476, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
-   { 11521, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
-   { 11570, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
-   { 11608, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
-   { 11650, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
-   { 11682, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
-   { 11707, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
-   { 11734, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
-   { 11765, 0x00000404 }, /* GL_FRONT */
-   { 11774, 0x00000408 }, /* GL_FRONT_AND_BACK */
-   { 11792, 0x00000B46 }, /* GL_FRONT_FACE */
-   { 11806, 0x00000400 }, /* GL_FRONT_LEFT */
-   { 11820, 0x00000401 }, /* GL_FRONT_RIGHT */
-   { 11835, 0x00008006 }, /* GL_FUNC_ADD */
-   { 11847, 0x00008006 }, /* GL_FUNC_ADD_EXT */
-   { 11863, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
-   { 11888, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
-   { 11917, 0x0000800A }, /* GL_FUNC_SUBTRACT */
-   { 11934, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
-   { 11955, 0x00008191 }, /* GL_GENERATE_MIPMAP */
-   { 11974, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
-   { 11998, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
-   { 12027, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
-   { 12051, 0x00000206 }, /* GL_GEQUAL */
-   { 12061, 0x00008009 }, /* GL_GL_BLEND_EQUATION_RGB */
-   { 12086, 0x00008C4A }, /* GL_GL_COMPRESSED_SLUMINANCE */
-   { 12114, 0x00008C4B }, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */
-   { 12148, 0x00008C48 }, /* GL_GL_COMPRESSED_SRGB */
-   { 12170, 0x00008C49 }, /* GL_GL_COMPRESSED_SRGB_ALPHA */
-   { 12198, 0x0000845F }, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */
-   { 12235, 0x00008B65 }, /* GL_GL_FLOAT_MAT2x3 */
-   { 12254, 0x00008B66 }, /* GL_GL_FLOAT_MAT2x4 */
-   { 12273, 0x00008B67 }, /* GL_GL_FLOAT_MAT3x2 */
-   { 12292, 0x00008B68 }, /* GL_GL_FLOAT_MAT3x4 */
-   { 12311, 0x00008B69 }, /* GL_GL_FLOAT_MAT4x2 */
-   { 12330, 0x00008B6A }, /* GL_GL_FLOAT_MAT4x3 */
-   { 12349, 0x000088EB }, /* GL_GL_PIXEL_PACK_BUFFER */
-   { 12373, 0x000088ED }, /* GL_GL_PIXEL_PACK_BUFFER_BINDING */
-   { 12405, 0x000088EC }, /* GL_GL_PIXEL_UNPACK_BUFFER */
-   { 12431, 0x000088EF }, /* GL_GL_PIXEL_UNPACK_BUFFER_BINDING */
-   { 12465, 0x00008C46 }, /* GL_GL_SLUMINANCE */
-   { 12482, 0x00008C47 }, /* GL_GL_SLUMINANCE8 */
-   { 12500, 0x00008C45 }, /* GL_GL_SLUMINANCE8_ALPHA8 */
-   { 12525, 0x00008C44 }, /* GL_GL_SLUMINANCE_ALPHA */
-   { 12548, 0x00008C40 }, /* GL_GL_SRGB */
-   { 12559, 0x00008C41 }, /* GL_GL_SRGB8 */
-   { 12571, 0x00008C43 }, /* GL_GL_SRGB8_ALPHA8 */
-   { 12590, 0x00008C42 }, /* GL_GL_SRGB_ALPHA */
-   { 12607, 0x00000204 }, /* GL_GREATER */
-   { 12618, 0x00001904 }, /* GL_GREEN */
-   { 12627, 0x00000D19 }, /* GL_GREEN_BIAS */
-   { 12641, 0x00000D53 }, /* GL_GREEN_BITS */
-   { 12655, 0x00000D18 }, /* GL_GREEN_SCALE */
-   { 12670, 0x00008000 }, /* GL_HINT_BIT */
-   { 12682, 0x00008024 }, /* GL_HISTOGRAM */
-   { 12695, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
-   { 12719, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
-   { 12747, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
-   { 12770, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
-   { 12797, 0x00008024 }, /* GL_HISTOGRAM_EXT */
-   { 12814, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
-   { 12834, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
-   { 12858, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
-   { 12882, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
-   { 12910, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
-   { 12938, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
-   { 12970, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
-   { 12992, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
-   { 13018, 0x0000802D }, /* GL_HISTOGRAM_SINK */
-   { 13036, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
-   { 13058, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
-   { 13077, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
-   { 13100, 0x0000862A }, /* GL_IDENTITY_NV */
-   { 13115, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
-   { 13135, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
-   { 13175, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
-   { 13213, 0x00001E02 }, /* GL_INCR */
-   { 13221, 0x00008507 }, /* GL_INCR_WRAP */
-   { 13234, 0x00008507 }, /* GL_INCR_WRAP_EXT */
-   { 13251, 0x00008222 }, /* GL_INDEX */
-   { 13260, 0x00008077 }, /* GL_INDEX_ARRAY */
-   { 13275, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
-   { 13305, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
-   { 13339, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
-   { 13362, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
-   { 13384, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
-   { 13404, 0x00000D51 }, /* GL_INDEX_BITS */
-   { 13418, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
-   { 13439, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
-   { 13457, 0x00000C30 }, /* GL_INDEX_MODE */
-   { 13471, 0x00000D13 }, /* GL_INDEX_OFFSET */
-   { 13487, 0x00000D12 }, /* GL_INDEX_SHIFT */
-   { 13502, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
-   { 13521, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
-   { 13540, 0x00001404 }, /* GL_INT */
-   { 13547, 0x00008049 }, /* GL_INTENSITY */
-   { 13560, 0x0000804C }, /* GL_INTENSITY12 */
-   { 13575, 0x0000804C }, /* GL_INTENSITY12_EXT */
-   { 13594, 0x0000804D }, /* GL_INTENSITY16 */
-   { 13609, 0x0000804D }, /* GL_INTENSITY16_EXT */
-   { 13628, 0x0000804A }, /* GL_INTENSITY4 */
-   { 13642, 0x0000804A }, /* GL_INTENSITY4_EXT */
-   { 13660, 0x0000804B }, /* GL_INTENSITY8 */
-   { 13674, 0x0000804B }, /* GL_INTENSITY8_EXT */
-   { 13692, 0x00008049 }, /* GL_INTENSITY_EXT */
-   { 13709, 0x00008575 }, /* GL_INTERPOLATE */
-   { 13724, 0x00008575 }, /* GL_INTERPOLATE_ARB */
-   { 13743, 0x00008575 }, /* GL_INTERPOLATE_EXT */
-   { 13762, 0x00008B53 }, /* GL_INT_VEC2 */
-   { 13774, 0x00008B53 }, /* GL_INT_VEC2_ARB */
-   { 13790, 0x00008B54 }, /* GL_INT_VEC3 */
-   { 13802, 0x00008B54 }, /* GL_INT_VEC3_ARB */
-   { 13818, 0x00008B55 }, /* GL_INT_VEC4 */
-   { 13830, 0x00008B55 }, /* GL_INT_VEC4_ARB */
-   { 13846, 0x00000500 }, /* GL_INVALID_ENUM */
-   { 13862, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
-   { 13895, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
-   { 13932, 0x00000502 }, /* GL_INVALID_OPERATION */
-   { 13953, 0x00000501 }, /* GL_INVALID_VALUE */
-   { 13970, 0x0000862B }, /* GL_INVERSE_NV */
-   { 13984, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
-   { 14008, 0x0000150A }, /* GL_INVERT */
-   { 14018, 0x00001E00 }, /* GL_KEEP */
-   { 14026, 0x00000406 }, /* GL_LEFT */
-   { 14034, 0x00000203 }, /* GL_LEQUAL */
-   { 14044, 0x00000201 }, /* GL_LESS */
-   { 14052, 0x00004000 }, /* GL_LIGHT0 */
-   { 14062, 0x00004001 }, /* GL_LIGHT1 */
-   { 14072, 0x00004002 }, /* GL_LIGHT2 */
-   { 14082, 0x00004003 }, /* GL_LIGHT3 */
-   { 14092, 0x00004004 }, /* GL_LIGHT4 */
-   { 14102, 0x00004005 }, /* GL_LIGHT5 */
-   { 14112, 0x00004006 }, /* GL_LIGHT6 */
-   { 14122, 0x00004007 }, /* GL_LIGHT7 */
-   { 14132, 0x00000B50 }, /* GL_LIGHTING */
-   { 14144, 0x00000040 }, /* GL_LIGHTING_BIT */
-   { 14160, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
-   { 14183, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
-   { 14212, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
-   { 14245, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
-   { 14273, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
-   { 14297, 0x00001B01 }, /* GL_LINE */
-   { 14305, 0x00002601 }, /* GL_LINEAR */
-   { 14315, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
-   { 14337, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
-   { 14367, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
-   { 14398, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
-   { 14422, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
-   { 14447, 0x00000001 }, /* GL_LINES */
-   { 14456, 0x00000004 }, /* GL_LINE_BIT */
-   { 14468, 0x00000002 }, /* GL_LINE_LOOP */
-   { 14481, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
-   { 14501, 0x00000B20 }, /* GL_LINE_SMOOTH */
-   { 14516, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
-   { 14536, 0x00000B24 }, /* GL_LINE_STIPPLE */
-   { 14552, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
-   { 14576, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
-   { 14599, 0x00000003 }, /* GL_LINE_STRIP */
-   { 14613, 0x00000702 }, /* GL_LINE_TOKEN */
-   { 14627, 0x00000B21 }, /* GL_LINE_WIDTH */
-   { 14641, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
-   { 14667, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
-   { 14687, 0x00008B82 }, /* GL_LINK_STATUS */
-   { 14702, 0x00000B32 }, /* GL_LIST_BASE */
-   { 14715, 0x00020000 }, /* GL_LIST_BIT */
-   { 14727, 0x00000B33 }, /* GL_LIST_INDEX */
-   { 14741, 0x00000B30 }, /* GL_LIST_MODE */
-   { 14754, 0x00000101 }, /* GL_LOAD */
-   { 14762, 0x00000BF1 }, /* GL_LOGIC_OP */
-   { 14774, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
-   { 14791, 0x00008CA1 }, /* GL_LOWER_LEFT */
-   { 14805, 0x00001909 }, /* GL_LUMINANCE */
-   { 14818, 0x00008041 }, /* GL_LUMINANCE12 */
-   { 14833, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
-   { 14856, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
-   { 14883, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
-   { 14905, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
-   { 14931, 0x00008041 }, /* GL_LUMINANCE12_EXT */
-   { 14950, 0x00008042 }, /* GL_LUMINANCE16 */
-   { 14965, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
-   { 14988, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
-   { 15015, 0x00008042 }, /* GL_LUMINANCE16_EXT */
-   { 15034, 0x0000803F }, /* GL_LUMINANCE4 */
-   { 15048, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
-   { 15069, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
-   { 15094, 0x0000803F }, /* GL_LUMINANCE4_EXT */
-   { 15112, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
-   { 15133, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
-   { 15158, 0x00008040 }, /* GL_LUMINANCE8 */
-   { 15172, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
-   { 15193, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
-   { 15218, 0x00008040 }, /* GL_LUMINANCE8_EXT */
-   { 15236, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
-   { 15255, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
-   { 15271, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
-   { 15291, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
-   { 15313, 0x00000D91 }, /* GL_MAP1_INDEX */
-   { 15327, 0x00000D92 }, /* GL_MAP1_NORMAL */
-   { 15342, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
-   { 15366, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
-   { 15390, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
-   { 15414, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
-   { 15438, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
-   { 15455, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
-   { 15472, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
-   { 15500, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
-   { 15529, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
-   { 15558, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
-   { 15587, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
-   { 15616, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
-   { 15645, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
-   { 15674, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
-   { 15702, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
-   { 15730, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
-   { 15758, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
-   { 15786, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
-   { 15814, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
-   { 15842, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
-   { 15870, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
-   { 15898, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
-   { 15926, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
-   { 15942, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
-   { 15962, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
-   { 15984, 0x00000DB1 }, /* GL_MAP2_INDEX */
-   { 15998, 0x00000DB2 }, /* GL_MAP2_NORMAL */
-   { 16013, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
-   { 16037, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
-   { 16061, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
-   { 16085, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
-   { 16109, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
-   { 16126, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
-   { 16143, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
-   { 16171, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
-   { 16200, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
-   { 16229, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
-   { 16258, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
-   { 16287, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
-   { 16316, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
-   { 16345, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
-   { 16373, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
-   { 16401, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
-   { 16429, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
-   { 16457, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
-   { 16485, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
-   { 16513, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
-   { 16541, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
-   { 16569, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
-   { 16597, 0x00000D10 }, /* GL_MAP_COLOR */
-   { 16610, 0x00000D11 }, /* GL_MAP_STENCIL */
-   { 16625, 0x000088C0 }, /* GL_MATRIX0_ARB */
-   { 16640, 0x00008630 }, /* GL_MATRIX0_NV */
-   { 16654, 0x000088CA }, /* GL_MATRIX10_ARB */
-   { 16670, 0x000088CB }, /* GL_MATRIX11_ARB */
-   { 16686, 0x000088CC }, /* GL_MATRIX12_ARB */
-   { 16702, 0x000088CD }, /* GL_MATRIX13_ARB */
-   { 16718, 0x000088CE }, /* GL_MATRIX14_ARB */
-   { 16734, 0x000088CF }, /* GL_MATRIX15_ARB */
-   { 16750, 0x000088D0 }, /* GL_MATRIX16_ARB */
-   { 16766, 0x000088D1 }, /* GL_MATRIX17_ARB */
-   { 16782, 0x000088D2 }, /* GL_MATRIX18_ARB */
-   { 16798, 0x000088D3 }, /* GL_MATRIX19_ARB */
-   { 16814, 0x000088C1 }, /* GL_MATRIX1_ARB */
-   { 16829, 0x00008631 }, /* GL_MATRIX1_NV */
-   { 16843, 0x000088D4 }, /* GL_MATRIX20_ARB */
-   { 16859, 0x000088D5 }, /* GL_MATRIX21_ARB */
-   { 16875, 0x000088D6 }, /* GL_MATRIX22_ARB */
-   { 16891, 0x000088D7 }, /* GL_MATRIX23_ARB */
-   { 16907, 0x000088D8 }, /* GL_MATRIX24_ARB */
-   { 16923, 0x000088D9 }, /* GL_MATRIX25_ARB */
-   { 16939, 0x000088DA }, /* GL_MATRIX26_ARB */
-   { 16955, 0x000088DB }, /* GL_MATRIX27_ARB */
-   { 16971, 0x000088DC }, /* GL_MATRIX28_ARB */
-   { 16987, 0x000088DD }, /* GL_MATRIX29_ARB */
-   { 17003, 0x000088C2 }, /* GL_MATRIX2_ARB */
-   { 17018, 0x00008632 }, /* GL_MATRIX2_NV */
-   { 17032, 0x000088DE }, /* GL_MATRIX30_ARB */
-   { 17048, 0x000088DF }, /* GL_MATRIX31_ARB */
-   { 17064, 0x000088C3 }, /* GL_MATRIX3_ARB */
-   { 17079, 0x00008633 }, /* GL_MATRIX3_NV */
-   { 17093, 0x000088C4 }, /* GL_MATRIX4_ARB */
-   { 17108, 0x00008634 }, /* GL_MATRIX4_NV */
-   { 17122, 0x000088C5 }, /* GL_MATRIX5_ARB */
-   { 17137, 0x00008635 }, /* GL_MATRIX5_NV */
-   { 17151, 0x000088C6 }, /* GL_MATRIX6_ARB */
-   { 17166, 0x00008636 }, /* GL_MATRIX6_NV */
-   { 17180, 0x000088C7 }, /* GL_MATRIX7_ARB */
-   { 17195, 0x00008637 }, /* GL_MATRIX7_NV */
-   { 17209, 0x000088C8 }, /* GL_MATRIX8_ARB */
-   { 17224, 0x000088C9 }, /* GL_MATRIX9_ARB */
-   { 17239, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
-   { 17265, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
-   { 17299, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
-   { 17330, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
-   { 17363, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
-   { 17394, 0x00000BA0 }, /* GL_MATRIX_MODE */
-   { 17409, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
-   { 17431, 0x00008008 }, /* GL_MAX */
-   { 17438, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
-   { 17461, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
-   { 17493, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
-   { 17519, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
-   { 17552, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
-   { 17578, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-   { 17612, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
-   { 17631, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
-   { 17660, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
-   { 17692, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
-   { 17728, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
-   { 17764, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
-   { 17804, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
-   { 17830, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
-   { 17860, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
-   { 17885, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
-   { 17914, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
-   { 17943, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
-   { 17976, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
-   { 17996, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
-   { 18020, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
-   { 18044, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
-   { 18068, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
-   { 18093, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
-   { 18111, 0x00008008 }, /* GL_MAX_EXT */
-   { 18122, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
-   { 18157, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
-   { 18196, 0x00000D31 }, /* GL_MAX_LIGHTS */
-   { 18210, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
-   { 18230, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
-   { 18268, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
-   { 18297, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
-   { 18321, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
-   { 18349, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
-   { 18372, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
-   { 18409, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
-   { 18445, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
-   { 18472, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
-   { 18501, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
-   { 18535, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
-   { 18571, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
-   { 18598, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
-   { 18630, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
-   { 18666, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
-   { 18695, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
-   { 18724, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
-   { 18752, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
-   { 18790, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-   { 18834, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-   { 18877, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
-   { 18911, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-   { 18950, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
-   { 18987, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
-   { 19025, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-   { 19068, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-   { 19111, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
-   { 19141, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
-   { 19172, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
-   { 19208, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
-   { 19244, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
-   { 19274, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
-   { 19308, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
-   { 19341, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
-   { 19370, 0x00008D57 }, /* GL_MAX_SAMPLES */
-   { 19385, 0x00008504 }, /* GL_MAX_SHININESS_NV */
-   { 19405, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
-   { 19429, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
-   { 19451, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
-   { 19477, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
-   { 19504, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
-   { 19535, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
-   { 19559, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
-   { 19593, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
-   { 19613, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
-   { 19640, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
-   { 19661, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
-   { 19686, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
-   { 19711, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
-   { 19746, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
-   { 19768, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
-   { 19794, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
-   { 19816, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
-   { 19842, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
-   { 19876, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
-   { 19914, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
-   { 19947, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
-   { 19984, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
-   { 20008, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
-   { 20029, 0x00008007 }, /* GL_MIN */
-   { 20036, 0x0000802E }, /* GL_MINMAX */
-   { 20046, 0x0000802E }, /* GL_MINMAX_EXT */
-   { 20060, 0x0000802F }, /* GL_MINMAX_FORMAT */
-   { 20077, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
-   { 20098, 0x00008030 }, /* GL_MINMAX_SINK */
-   { 20113, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
-   { 20132, 0x00008007 }, /* GL_MIN_EXT */
-   { 20143, 0x00008370 }, /* GL_MIRRORED_REPEAT */
-   { 20162, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
-   { 20185, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
-   { 20208, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
-   { 20228, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
-   { 20248, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
-   { 20278, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
-   { 20306, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
-   { 20334, 0x00001700 }, /* GL_MODELVIEW */
-   { 20347, 0x00001700 }, /* GL_MODELVIEW0_ARB */
-   { 20365, 0x0000872A }, /* GL_MODELVIEW10_ARB */
-   { 20384, 0x0000872B }, /* GL_MODELVIEW11_ARB */
-   { 20403, 0x0000872C }, /* GL_MODELVIEW12_ARB */
-   { 20422, 0x0000872D }, /* GL_MODELVIEW13_ARB */
-   { 20441, 0x0000872E }, /* GL_MODELVIEW14_ARB */
-   { 20460, 0x0000872F }, /* GL_MODELVIEW15_ARB */
-   { 20479, 0x00008730 }, /* GL_MODELVIEW16_ARB */
-   { 20498, 0x00008731 }, /* GL_MODELVIEW17_ARB */
-   { 20517, 0x00008732 }, /* GL_MODELVIEW18_ARB */
-   { 20536, 0x00008733 }, /* GL_MODELVIEW19_ARB */
-   { 20555, 0x0000850A }, /* GL_MODELVIEW1_ARB */
-   { 20573, 0x00008734 }, /* GL_MODELVIEW20_ARB */
-   { 20592, 0x00008735 }, /* GL_MODELVIEW21_ARB */
-   { 20611, 0x00008736 }, /* GL_MODELVIEW22_ARB */
-   { 20630, 0x00008737 }, /* GL_MODELVIEW23_ARB */
-   { 20649, 0x00008738 }, /* GL_MODELVIEW24_ARB */
-   { 20668, 0x00008739 }, /* GL_MODELVIEW25_ARB */
-   { 20687, 0x0000873A }, /* GL_MODELVIEW26_ARB */
-   { 20706, 0x0000873B }, /* GL_MODELVIEW27_ARB */
-   { 20725, 0x0000873C }, /* GL_MODELVIEW28_ARB */
-   { 20744, 0x0000873D }, /* GL_MODELVIEW29_ARB */
-   { 20763, 0x00008722 }, /* GL_MODELVIEW2_ARB */
-   { 20781, 0x0000873E }, /* GL_MODELVIEW30_ARB */
-   { 20800, 0x0000873F }, /* GL_MODELVIEW31_ARB */
-   { 20819, 0x00008723 }, /* GL_MODELVIEW3_ARB */
-   { 20837, 0x00008724 }, /* GL_MODELVIEW4_ARB */
-   { 20855, 0x00008725 }, /* GL_MODELVIEW5_ARB */
-   { 20873, 0x00008726 }, /* GL_MODELVIEW6_ARB */
-   { 20891, 0x00008727 }, /* GL_MODELVIEW7_ARB */
-   { 20909, 0x00008728 }, /* GL_MODELVIEW8_ARB */
-   { 20927, 0x00008729 }, /* GL_MODELVIEW9_ARB */
-   { 20945, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
-   { 20965, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
-   { 20992, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
-   { 21017, 0x00002100 }, /* GL_MODULATE */
-   { 21029, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
-   { 21049, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
-   { 21076, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
-   { 21101, 0x00000103 }, /* GL_MULT */
-   { 21109, 0x0000809D }, /* GL_MULTISAMPLE */
-   { 21124, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
-   { 21144, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
-   { 21163, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
-   { 21182, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
-   { 21206, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
-   { 21229, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
-   { 21259, 0x00002A25 }, /* GL_N3F_V3F */
-   { 21270, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
-   { 21290, 0x0000150E }, /* GL_NAND */
-   { 21298, 0x00002600 }, /* GL_NEAREST */
-   { 21309, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
-   { 21340, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
-   { 21372, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
-   { 21397, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
-   { 21423, 0x00000200 }, /* GL_NEVER */
-   { 21432, 0x00001102 }, /* GL_NICEST */
-   { 21442, 0x00000000 }, /* GL_NONE */
-   { 21450, 0x00001505 }, /* GL_NOOP */
-   { 21458, 0x00001508 }, /* GL_NOR */
-   { 21465, 0x00000BA1 }, /* GL_NORMALIZE */
-   { 21478, 0x00008075 }, /* GL_NORMAL_ARRAY */
-   { 21494, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
-   { 21525, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
-   { 21560, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
-   { 21584, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
-   { 21607, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
-   { 21628, 0x00008511 }, /* GL_NORMAL_MAP */
-   { 21642, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
-   { 21660, 0x00008511 }, /* GL_NORMAL_MAP_NV */
-   { 21677, 0x00000205 }, /* GL_NOTEQUAL */
-   { 21689, 0x00000000 }, /* GL_NO_ERROR */
-   { 21701, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
-   { 21735, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
-   { 21773, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
-   { 21805, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
-   { 21847, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
-   { 21877, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
-   { 21917, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
-   { 21948, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
-   { 21977, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
-   { 22005, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
-   { 22035, 0x00002401 }, /* GL_OBJECT_LINEAR */
-   { 22052, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
-   { 22078, 0x00002501 }, /* GL_OBJECT_PLANE */
-   { 22094, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
-   { 22129, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
-   { 22151, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
-   { 22170, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
-   { 22200, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
-   { 22221, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
-   { 22249, 0x00000001 }, /* GL_ONE */
-   { 22256, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
-   { 22284, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
-   { 22316, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
-   { 22344, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
-   { 22376, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
-   { 22399, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
-   { 22422, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
-   { 22445, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
-   { 22468, 0x00008598 }, /* GL_OPERAND0_ALPHA */
-   { 22486, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
-   { 22508, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
-   { 22530, 0x00008590 }, /* GL_OPERAND0_RGB */
-   { 22546, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
-   { 22566, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
-   { 22586, 0x00008599 }, /* GL_OPERAND1_ALPHA */
-   { 22604, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
-   { 22626, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
-   { 22648, 0x00008591 }, /* GL_OPERAND1_RGB */
-   { 22664, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
-   { 22684, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
-   { 22704, 0x0000859A }, /* GL_OPERAND2_ALPHA */
-   { 22722, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
-   { 22744, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
-   { 22766, 0x00008592 }, /* GL_OPERAND2_RGB */
-   { 22782, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
-   { 22802, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
-   { 22822, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
-   { 22843, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
-   { 22862, 0x00001507 }, /* GL_OR */
-   { 22868, 0x00000A01 }, /* GL_ORDER */
-   { 22877, 0x0000150D }, /* GL_OR_INVERTED */
-   { 22892, 0x0000150B }, /* GL_OR_REVERSE */
-   { 22906, 0x00000505 }, /* GL_OUT_OF_MEMORY */
-   { 22923, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
-   { 22941, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
-   { 22962, 0x00008758 }, /* GL_PACK_INVERT_MESA */
-   { 22982, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
-   { 23000, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
-   { 23019, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
-   { 23039, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
-   { 23059, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
-   { 23077, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
-   { 23096, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
-   { 23121, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
-   { 23145, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
-   { 23166, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
-   { 23188, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
-   { 23210, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
-   { 23235, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
-   { 23259, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
-   { 23280, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
-   { 23302, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
-   { 23324, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
-   { 23346, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
-   { 23377, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
-   { 23397, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
-   { 23422, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
-   { 23442, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
-   { 23467, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
-   { 23487, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
-   { 23512, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
-   { 23532, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
-   { 23557, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
-   { 23577, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
-   { 23602, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
-   { 23622, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
-   { 23647, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
-   { 23667, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
-   { 23692, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
-   { 23712, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
-   { 23737, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
-   { 23757, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
-   { 23782, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
-   { 23802, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
-   { 23827, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
-   { 23845, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
-   { 23878, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
-   { 23903, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
-   { 23938, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
-   { 23965, 0x00001B00 }, /* GL_POINT */
-   { 23974, 0x00000000 }, /* GL_POINTS */
-   { 23984, 0x00000002 }, /* GL_POINT_BIT */
-   { 23997, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
-   { 24027, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
-   { 24061, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
-   { 24095, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
-   { 24130, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
-   { 24159, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
-   { 24192, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
-   { 24225, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
-   { 24259, 0x00000B11 }, /* GL_POINT_SIZE */
-   { 24273, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
-   { 24299, 0x00008127 }, /* GL_POINT_SIZE_MAX */
-   { 24317, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
-   { 24339, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
-   { 24361, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
-   { 24384, 0x00008126 }, /* GL_POINT_SIZE_MIN */
-   { 24402, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
-   { 24424, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
-   { 24446, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
-   { 24469, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
-   { 24489, 0x00000B10 }, /* GL_POINT_SMOOTH */
-   { 24505, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
-   { 24526, 0x00008861 }, /* GL_POINT_SPRITE */
-   { 24542, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
-   { 24562, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
-   { 24591, 0x00008861 }, /* GL_POINT_SPRITE_NV */
-   { 24610, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
-   { 24636, 0x00000701 }, /* GL_POINT_TOKEN */
-   { 24651, 0x00000009 }, /* GL_POLYGON */
-   { 24662, 0x00000008 }, /* GL_POLYGON_BIT */
-   { 24677, 0x00000B40 }, /* GL_POLYGON_MODE */
-   { 24693, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
-   { 24716, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
-   { 24741, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
-   { 24764, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
-   { 24787, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
-   { 24811, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
-   { 24835, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
-   { 24853, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
-   { 24876, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
-   { 24895, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
-   { 24918, 0x00000703 }, /* GL_POLYGON_TOKEN */
-   { 24935, 0x00001203 }, /* GL_POSITION */
-   { 24947, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
-   { 24979, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
-   { 25015, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
-   { 25048, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
-   { 25085, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
-   { 25116, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
-   { 25151, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
-   { 25183, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
-   { 25219, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
-   { 25252, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
-   { 25284, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
-   { 25320, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
-   { 25353, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
-   { 25390, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
-   { 25420, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
-   { 25454, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
-   { 25485, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
-   { 25520, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
-   { 25551, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
-   { 25586, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
-   { 25618, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
-   { 25654, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
-   { 25684, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
-   { 25718, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
-   { 25749, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
-   { 25784, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
-   { 25816, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
-   { 25847, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
-   { 25882, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
-   { 25914, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
-   { 25950, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
-   { 25979, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
-   { 26012, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
-   { 26042, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
-   { 26076, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
-   { 26115, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
-   { 26148, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
-   { 26188, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
-   { 26222, 0x00008578 }, /* GL_PREVIOUS */
-   { 26234, 0x00008578 }, /* GL_PREVIOUS_ARB */
-   { 26250, 0x00008578 }, /* GL_PREVIOUS_EXT */
-   { 26266, 0x00008577 }, /* GL_PRIMARY_COLOR */
-   { 26283, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
-   { 26304, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
-   { 26325, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
-   { 26358, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
-   { 26390, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
-   { 26413, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
-   { 26436, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
-   { 26466, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
-   { 26495, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
-   { 26523, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
-   { 26545, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
-   { 26573, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
-   { 26601, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
-   { 26623, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
-   { 26644, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-   { 26684, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-   { 26723, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
-   { 26753, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-   { 26788, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
-   { 26821, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
-   { 26855, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-   { 26894, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-   { 26933, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
-   { 26955, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
-   { 26981, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
-   { 27005, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
-   { 27028, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
-   { 27050, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
-   { 27071, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
-   { 27092, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
-   { 27119, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
-   { 27151, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
-   { 27183, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
-   { 27218, 0x00001701 }, /* GL_PROJECTION */
-   { 27232, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
-   { 27253, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
-   { 27279, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
-   { 27300, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
-   { 27319, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
-   { 27342, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
-   { 27381, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
-   { 27419, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
-   { 27439, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
-   { 27469, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
-   { 27493, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
-   { 27513, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
-   { 27543, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
-   { 27567, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
-   { 27587, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
-   { 27620, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
-   { 27646, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
-   { 27676, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
-   { 27707, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
-   { 27737, 0x00002003 }, /* GL_Q */
-   { 27742, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
-   { 27767, 0x00000007 }, /* GL_QUADS */
-   { 27776, 0x00008614 }, /* GL_QUAD_MESH_SUN */
-   { 27793, 0x00000008 }, /* GL_QUAD_STRIP */
-   { 27807, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
-   { 27829, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
-   { 27855, 0x00008866 }, /* GL_QUERY_RESULT */
-   { 27871, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
-   { 27891, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
-   { 27917, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
-   { 27947, 0x00002002 }, /* GL_R */
-   { 27952, 0x00002A10 }, /* GL_R3_G3_B2 */
-   { 27964, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
-   { 27997, 0x00000C02 }, /* GL_READ_BUFFER */
-   { 28012, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
-   { 28032, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
-   { 28064, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
-   { 28088, 0x000088B8 }, /* GL_READ_ONLY */
-   { 28101, 0x000088B8 }, /* GL_READ_ONLY_ARB */
-   { 28118, 0x000088BA }, /* GL_READ_WRITE */
-   { 28132, 0x000088BA }, /* GL_READ_WRITE_ARB */
-   { 28150, 0x00001903 }, /* GL_RED */
-   { 28157, 0x00008016 }, /* GL_REDUCE */
-   { 28167, 0x00008016 }, /* GL_REDUCE_EXT */
-   { 28181, 0x00000D15 }, /* GL_RED_BIAS */
-   { 28193, 0x00000D52 }, /* GL_RED_BITS */
-   { 28205, 0x00000D14 }, /* GL_RED_SCALE */
-   { 28218, 0x00008512 }, /* GL_REFLECTION_MAP */
-   { 28236, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
-   { 28258, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
-   { 28279, 0x00001C00 }, /* GL_RENDER */
-   { 28289, 0x00008D41 }, /* GL_RENDERBUFFER */
-   { 28305, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
-   { 28332, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
-   { 28360, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
-   { 28386, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
-   { 28413, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
-   { 28433, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
-   { 28460, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
-   { 28483, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
-   { 28510, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
-   { 28542, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
-   { 28578, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
-   { 28603, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
-   { 28627, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
-   { 28656, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
-   { 28678, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
-   { 28704, 0x00001F01 }, /* GL_RENDERER */
-   { 28716, 0x00000C40 }, /* GL_RENDER_MODE */
-   { 28731, 0x00002901 }, /* GL_REPEAT */
-   { 28741, 0x00001E01 }, /* GL_REPLACE */
-   { 28752, 0x00008062 }, /* GL_REPLACE_EXT */
-   { 28767, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
-   { 28790, 0x0000803A }, /* GL_RESCALE_NORMAL */
-   { 28808, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
-   { 28830, 0x00000102 }, /* GL_RETURN */
-   { 28840, 0x00001907 }, /* GL_RGB */
-   { 28847, 0x00008052 }, /* GL_RGB10 */
-   { 28856, 0x00008059 }, /* GL_RGB10_A2 */
-   { 28868, 0x00008059 }, /* GL_RGB10_A2_EXT */
-   { 28884, 0x00008052 }, /* GL_RGB10_EXT */
-   { 28897, 0x00008053 }, /* GL_RGB12 */
-   { 28906, 0x00008053 }, /* GL_RGB12_EXT */
-   { 28919, 0x00008054 }, /* GL_RGB16 */
-   { 28928, 0x00008054 }, /* GL_RGB16_EXT */
-   { 28941, 0x0000804E }, /* GL_RGB2_EXT */
-   { 28953, 0x0000804F }, /* GL_RGB4 */
-   { 28961, 0x0000804F }, /* GL_RGB4_EXT */
-   { 28973, 0x000083A1 }, /* GL_RGB4_S3TC */
-   { 28986, 0x00008050 }, /* GL_RGB5 */
-   { 28994, 0x00008057 }, /* GL_RGB5_A1 */
-   { 29005, 0x00008057 }, /* GL_RGB5_A1_EXT */
-   { 29020, 0x00008050 }, /* GL_RGB5_EXT */
-   { 29032, 0x00008051 }, /* GL_RGB8 */
-   { 29040, 0x00008051 }, /* GL_RGB8_EXT */
-   { 29052, 0x00001908 }, /* GL_RGBA */
-   { 29060, 0x0000805A }, /* GL_RGBA12 */
-   { 29070, 0x0000805A }, /* GL_RGBA12_EXT */
-   { 29084, 0x0000805B }, /* GL_RGBA16 */
-   { 29094, 0x0000805B }, /* GL_RGBA16_EXT */
-   { 29108, 0x00008055 }, /* GL_RGBA2 */
-   { 29117, 0x00008055 }, /* GL_RGBA2_EXT */
-   { 29130, 0x00008056 }, /* GL_RGBA4 */
-   { 29139, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
-   { 29158, 0x00008056 }, /* GL_RGBA4_EXT */
-   { 29171, 0x000083A3 }, /* GL_RGBA4_S3TC */
-   { 29185, 0x00008058 }, /* GL_RGBA8 */
-   { 29194, 0x00008058 }, /* GL_RGBA8_EXT */
-   { 29207, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
-   { 29225, 0x00000C31 }, /* GL_RGBA_MODE */
-   { 29238, 0x000083A2 }, /* GL_RGBA_S3TC */
-   { 29251, 0x000083A0 }, /* GL_RGB_S3TC */
-   { 29263, 0x00008573 }, /* GL_RGB_SCALE */
-   { 29276, 0x00008573 }, /* GL_RGB_SCALE_ARB */
-   { 29293, 0x00008573 }, /* GL_RGB_SCALE_EXT */
-   { 29310, 0x00000407 }, /* GL_RIGHT */
-   { 29319, 0x00002000 }, /* GL_S */
-   { 29324, 0x00008B5D }, /* GL_SAMPLER_1D */
-   { 29338, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
-   { 29359, 0x00008B5E }, /* GL_SAMPLER_2D */
-   { 29373, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
-   { 29394, 0x00008B5F }, /* GL_SAMPLER_3D */
-   { 29408, 0x00008B60 }, /* GL_SAMPLER_CUBE */
-   { 29424, 0x000080A9 }, /* GL_SAMPLES */
-   { 29435, 0x000086B4 }, /* GL_SAMPLES_3DFX */
-   { 29451, 0x000080A9 }, /* GL_SAMPLES_ARB */
-   { 29466, 0x00008914 }, /* GL_SAMPLES_PASSED */
-   { 29484, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
-   { 29506, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
-   { 29534, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
-   { 29566, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
-   { 29589, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
-   { 29616, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
-   { 29634, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
-   { 29657, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
-   { 29679, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
-   { 29698, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
-   { 29721, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
-   { 29747, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
-   { 29777, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
-   { 29802, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
-   { 29831, 0x00080000 }, /* GL_SCISSOR_BIT */
-   { 29846, 0x00000C10 }, /* GL_SCISSOR_BOX */
-   { 29861, 0x00000C11 }, /* GL_SCISSOR_TEST */
-   { 29877, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
-   { 29902, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
-   { 29942, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
-   { 29986, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
-   { 30019, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
-   { 30049, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
-   { 30081, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
-   { 30111, 0x00001C02 }, /* GL_SELECT */
-   { 30121, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
-   { 30149, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
-   { 30174, 0x00008012 }, /* GL_SEPARABLE_2D */
-   { 30190, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
-   { 30217, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
-   { 30248, 0x0000150F }, /* GL_SET */
-   { 30255, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
-   { 30276, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
-   { 30300, 0x00008B4F }, /* GL_SHADER_TYPE */
-   { 30315, 0x00000B54 }, /* GL_SHADE_MODEL */
-   { 30330, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
-   { 30358, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
-   { 30381, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
-   { 30411, 0x00001601 }, /* GL_SHININESS */
-   { 30424, 0x00001402 }, /* GL_SHORT */
-   { 30433, 0x000081F9 }, /* GL_SINGLE_COLOR */
-   { 30449, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
-   { 30469, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
-   { 30488, 0x00001D01 }, /* GL_SMOOTH */
-   { 30498, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
-   { 30531, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
-   { 30558, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
-   { 30591, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
-   { 30618, 0x00008588 }, /* GL_SOURCE0_ALPHA */
-   { 30635, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
-   { 30656, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
-   { 30677, 0x00008580 }, /* GL_SOURCE0_RGB */
-   { 30692, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
-   { 30711, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
-   { 30730, 0x00008589 }, /* GL_SOURCE1_ALPHA */
-   { 30747, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
-   { 30768, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
-   { 30789, 0x00008581 }, /* GL_SOURCE1_RGB */
-   { 30804, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
-   { 30823, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
-   { 30842, 0x0000858A }, /* GL_SOURCE2_ALPHA */
-   { 30859, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
-   { 30880, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
-   { 30901, 0x00008582 }, /* GL_SOURCE2_RGB */
-   { 30916, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
-   { 30935, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
-   { 30954, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
-   { 30974, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
-   { 30992, 0x00001202 }, /* GL_SPECULAR */
-   { 31004, 0x00002402 }, /* GL_SPHERE_MAP */
-   { 31018, 0x00001206 }, /* GL_SPOT_CUTOFF */
-   { 31033, 0x00001204 }, /* GL_SPOT_DIRECTION */
-   { 31051, 0x00001205 }, /* GL_SPOT_EXPONENT */
-   { 31068, 0x00008588 }, /* GL_SRC0_ALPHA */
-   { 31082, 0x00008580 }, /* GL_SRC0_RGB */
-   { 31094, 0x00008589 }, /* GL_SRC1_ALPHA */
-   { 31108, 0x00008581 }, /* GL_SRC1_RGB */
-   { 31120, 0x0000858A }, /* GL_SRC2_ALPHA */
-   { 31134, 0x00008582 }, /* GL_SRC2_RGB */
-   { 31146, 0x00000302 }, /* GL_SRC_ALPHA */
-   { 31159, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
-   { 31181, 0x00000300 }, /* GL_SRC_COLOR */
-   { 31194, 0x00008C40 }, /* GL_SRGB */
-   { 31202, 0x00000503 }, /* GL_STACK_OVERFLOW */
-   { 31220, 0x00000504 }, /* GL_STACK_UNDERFLOW */
-   { 31239, 0x000088E6 }, /* GL_STATIC_COPY */
-   { 31254, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
-   { 31273, 0x000088E4 }, /* GL_STATIC_DRAW */
-   { 31288, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
-   { 31307, 0x000088E5 }, /* GL_STATIC_READ */
-   { 31322, 0x000088E5 }, /* GL_STATIC_READ_ARB */
-   { 31341, 0x00001802 }, /* GL_STENCIL */
-   { 31352, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
-   { 31374, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
-   { 31400, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
-   { 31421, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
-   { 31446, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
-   { 31467, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
-   { 31492, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
-   { 31524, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
-   { 31560, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
-   { 31592, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
-   { 31628, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
-   { 31648, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
-   { 31675, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
-   { 31701, 0x00000D57 }, /* GL_STENCIL_BITS */
-   { 31717, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
-   { 31739, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
-   { 31762, 0x00000B94 }, /* GL_STENCIL_FAIL */
-   { 31778, 0x00000B92 }, /* GL_STENCIL_FUNC */
-   { 31794, 0x00001901 }, /* GL_STENCIL_INDEX */
-   { 31811, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
-   { 31834, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
-   { 31856, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
-   { 31878, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
-   { 31900, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
-   { 31921, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
-   { 31948, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
-   { 31975, 0x00000B97 }, /* GL_STENCIL_REF */
-   { 31990, 0x00000B90 }, /* GL_STENCIL_TEST */
-   { 32006, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
-   { 32035, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
-   { 32057, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
-   { 32078, 0x00000C33 }, /* GL_STEREO */
-   { 32088, 0x000088E2 }, /* GL_STREAM_COPY */
-   { 32103, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
-   { 32122, 0x000088E0 }, /* GL_STREAM_DRAW */
-   { 32137, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
-   { 32156, 0x000088E1 }, /* GL_STREAM_READ */
-   { 32171, 0x000088E1 }, /* GL_STREAM_READ_ARB */
-   { 32190, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
-   { 32207, 0x000084E7 }, /* GL_SUBTRACT */
-   { 32219, 0x000084E7 }, /* GL_SUBTRACT_ARB */
-   { 32235, 0x00002001 }, /* GL_T */
-   { 32240, 0x00002A2A }, /* GL_T2F_C3F_V3F */
-   { 32255, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
-   { 32274, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
-   { 32290, 0x00002A2B }, /* GL_T2F_N3F_V3F */
-   { 32305, 0x00002A27 }, /* GL_T2F_V3F */
-   { 32316, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
-   { 32335, 0x00002A28 }, /* GL_T4F_V4F */
-   { 32346, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
-   { 32369, 0x00001702 }, /* GL_TEXTURE */
-   { 32380, 0x000084C0 }, /* GL_TEXTURE0 */
-   { 32392, 0x000084C0 }, /* GL_TEXTURE0_ARB */
-   { 32408, 0x000084C1 }, /* GL_TEXTURE1 */
-   { 32420, 0x000084CA }, /* GL_TEXTURE10 */
-   { 32433, 0x000084CA }, /* GL_TEXTURE10_ARB */
-   { 32450, 0x000084CB }, /* GL_TEXTURE11 */
-   { 32463, 0x000084CB }, /* GL_TEXTURE11_ARB */
-   { 32480, 0x000084CC }, /* GL_TEXTURE12 */
-   { 32493, 0x000084CC }, /* GL_TEXTURE12_ARB */
-   { 32510, 0x000084CD }, /* GL_TEXTURE13 */
-   { 32523, 0x000084CD }, /* GL_TEXTURE13_ARB */
-   { 32540, 0x000084CE }, /* GL_TEXTURE14 */
-   { 32553, 0x000084CE }, /* GL_TEXTURE14_ARB */
-   { 32570, 0x000084CF }, /* GL_TEXTURE15 */
-   { 32583, 0x000084CF }, /* GL_TEXTURE15_ARB */
-   { 32600, 0x000084D0 }, /* GL_TEXTURE16 */
-   { 32613, 0x000084D0 }, /* GL_TEXTURE16_ARB */
-   { 32630, 0x000084D1 }, /* GL_TEXTURE17 */
-   { 32643, 0x000084D1 }, /* GL_TEXTURE17_ARB */
-   { 32660, 0x000084D2 }, /* GL_TEXTURE18 */
-   { 32673, 0x000084D2 }, /* GL_TEXTURE18_ARB */
-   { 32690, 0x000084D3 }, /* GL_TEXTURE19 */
-   { 32703, 0x000084D3 }, /* GL_TEXTURE19_ARB */
-   { 32720, 0x000084C1 }, /* GL_TEXTURE1_ARB */
-   { 32736, 0x000084C2 }, /* GL_TEXTURE2 */
-   { 32748, 0x000084D4 }, /* GL_TEXTURE20 */
-   { 32761, 0x000084D4 }, /* GL_TEXTURE20_ARB */
-   { 32778, 0x000084D5 }, /* GL_TEXTURE21 */
-   { 32791, 0x000084D5 }, /* GL_TEXTURE21_ARB */
-   { 32808, 0x000084D6 }, /* GL_TEXTURE22 */
-   { 32821, 0x000084D6 }, /* GL_TEXTURE22_ARB */
-   { 32838, 0x000084D7 }, /* GL_TEXTURE23 */
-   { 32851, 0x000084D7 }, /* GL_TEXTURE23_ARB */
-   { 32868, 0x000084D8 }, /* GL_TEXTURE24 */
-   { 32881, 0x000084D8 }, /* GL_TEXTURE24_ARB */
-   { 32898, 0x000084D9 }, /* GL_TEXTURE25 */
-   { 32911, 0x000084D9 }, /* GL_TEXTURE25_ARB */
-   { 32928, 0x000084DA }, /* GL_TEXTURE26 */
-   { 32941, 0x000084DA }, /* GL_TEXTURE26_ARB */
-   { 32958, 0x000084DB }, /* GL_TEXTURE27 */
-   { 32971, 0x000084DB }, /* GL_TEXTURE27_ARB */
-   { 32988, 0x000084DC }, /* GL_TEXTURE28 */
-   { 33001, 0x000084DC }, /* GL_TEXTURE28_ARB */
-   { 33018, 0x000084DD }, /* GL_TEXTURE29 */
-   { 33031, 0x000084DD }, /* GL_TEXTURE29_ARB */
-   { 33048, 0x000084C2 }, /* GL_TEXTURE2_ARB */
-   { 33064, 0x000084C3 }, /* GL_TEXTURE3 */
-   { 33076, 0x000084DE }, /* GL_TEXTURE30 */
-   { 33089, 0x000084DE }, /* GL_TEXTURE30_ARB */
-   { 33106, 0x000084DF }, /* GL_TEXTURE31 */
-   { 33119, 0x000084DF }, /* GL_TEXTURE31_ARB */
-   { 33136, 0x000084C3 }, /* GL_TEXTURE3_ARB */
-   { 33152, 0x000084C4 }, /* GL_TEXTURE4 */
-   { 33164, 0x000084C4 }, /* GL_TEXTURE4_ARB */
-   { 33180, 0x000084C5 }, /* GL_TEXTURE5 */
-   { 33192, 0x000084C5 }, /* GL_TEXTURE5_ARB */
-   { 33208, 0x000084C6 }, /* GL_TEXTURE6 */
-   { 33220, 0x000084C6 }, /* GL_TEXTURE6_ARB */
-   { 33236, 0x000084C7 }, /* GL_TEXTURE7 */
-   { 33248, 0x000084C7 }, /* GL_TEXTURE7_ARB */
-   { 33264, 0x000084C8 }, /* GL_TEXTURE8 */
-   { 33276, 0x000084C8 }, /* GL_TEXTURE8_ARB */
-   { 33292, 0x000084C9 }, /* GL_TEXTURE9 */
-   { 33304, 0x000084C9 }, /* GL_TEXTURE9_ARB */
-   { 33320, 0x00000DE0 }, /* GL_TEXTURE_1D */
-   { 33334, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
-   { 33358, 0x00000DE1 }, /* GL_TEXTURE_2D */
-   { 33372, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
-   { 33396, 0x0000806F }, /* GL_TEXTURE_3D */
-   { 33410, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
-   { 33432, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
-   { 33458, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
-   { 33480, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
-   { 33502, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
-   { 33534, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
-   { 33556, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
-   { 33588, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
-   { 33610, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
-   { 33638, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
-   { 33670, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
-   { 33703, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
-   { 33735, 0x00040000 }, /* GL_TEXTURE_BIT */
-   { 33750, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
-   { 33771, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
-   { 33796, 0x00001005 }, /* GL_TEXTURE_BORDER */
-   { 33814, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
-   { 33838, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
-   { 33869, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
-   { 33899, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
-   { 33929, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
-   { 33964, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
-   { 33995, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-   { 34033, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
-   { 34060, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
-   { 34092, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
-   { 34126, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
-   { 34150, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
-   { 34178, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
-   { 34202, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
-   { 34230, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
-   { 34263, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
-   { 34287, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
-   { 34309, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
-   { 34331, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
-   { 34357, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
-   { 34391, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
-   { 34424, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
-   { 34461, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
-   { 34489, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
-   { 34521, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
-   { 34544, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
-   { 34582, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
-   { 34624, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
-   { 34655, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
-   { 34683, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
-   { 34713, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
-   { 34741, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
-   { 34761, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
-   { 34785, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
-   { 34816, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
-   { 34851, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
-   { 34882, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
-   { 34917, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
-   { 34948, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
-   { 34983, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
-   { 35014, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
-   { 35049, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
-   { 35080, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
-   { 35115, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
-   { 35146, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
-   { 35181, 0x00008071 }, /* GL_TEXTURE_DEPTH */
-   { 35198, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
-   { 35220, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
-   { 35246, 0x00002300 }, /* GL_TEXTURE_ENV */
-   { 35261, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
-   { 35282, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
-   { 35302, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
-   { 35328, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
-   { 35348, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
-   { 35365, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
-   { 35382, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
-   { 35399, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
-   { 35416, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
-   { 35441, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
-   { 35463, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
-   { 35489, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
-   { 35507, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
-   { 35533, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
-   { 35559, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
-   { 35589, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
-   { 35616, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
-   { 35641, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
-   { 35661, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
-   { 35685, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
-   { 35712, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
-   { 35739, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
-   { 35766, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
-   { 35792, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
-   { 35822, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
-   { 35844, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
-   { 35862, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
-   { 35892, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
-   { 35920, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
-   { 35948, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
-   { 35976, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
-   { 35997, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
-   { 36016, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
-   { 36038, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
-   { 36057, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
-   { 36077, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
-   { 36102, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
-   { 36126, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
-   { 36146, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
-   { 36170, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
-   { 36190, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
-   { 36213, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
-   { 36237, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
-   { 36262, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
-   { 36296, 0x00001000 }, /* GL_TEXTURE_WIDTH */
-   { 36313, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
-   { 36331, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
-   { 36349, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
-   { 36367, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
-   { 36387, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
-   { 36406, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
-   { 36435, 0x00001000 }, /* GL_TRANSFORM_BIT */
-   { 36452, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
-   { 36478, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
-   { 36508, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
-   { 36540, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
-   { 36570, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
-   { 36604, 0x0000862C }, /* GL_TRANSPOSE_NV */
-   { 36620, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
-   { 36651, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
-   { 36686, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
-   { 36714, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
-   { 36746, 0x00000004 }, /* GL_TRIANGLES */
-   { 36759, 0x00000006 }, /* GL_TRIANGLE_FAN */
-   { 36775, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
-   { 36796, 0x00000005 }, /* GL_TRIANGLE_STRIP */
-   { 36814, 0x00000001 }, /* GL_TRUE */
-   { 36822, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
-   { 36842, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
-   { 36865, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
-   { 36885, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
-   { 36906, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
-   { 36928, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
-   { 36950, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
-   { 36970, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
-   { 36991, 0x00001401 }, /* GL_UNSIGNED_BYTE */
-   { 37008, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
-   { 37035, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
-   { 37058, 0x00001405 }, /* GL_UNSIGNED_INT */
-   { 37074, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
-   { 37101, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
-   { 37122, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
-   { 37146, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
-   { 37177, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
-   { 37201, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
-   { 37229, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
-   { 37252, 0x00001403 }, /* GL_UNSIGNED_SHORT */
-   { 37270, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
-   { 37300, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
-   { 37326, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
-   { 37356, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
-   { 37382, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
-   { 37406, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
-   { 37434, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
-   { 37462, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
-   { 37489, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
-   { 37521, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
-   { 37552, 0x00008CA2 }, /* GL_UPPER_LEFT */
-   { 37566, 0x00002A20 }, /* GL_V2F */
-   { 37573, 0x00002A21 }, /* GL_V3F */
-   { 37580, 0x00008B83 }, /* GL_VALIDATE_STATUS */
-   { 37599, 0x00001F00 }, /* GL_VENDOR */
-   { 37609, 0x00001F02 }, /* GL_VERSION */
-   { 37620, 0x00008074 }, /* GL_VERTEX_ARRAY */
-   { 37636, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
-   { 37666, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
-   { 37697, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
-   { 37732, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
-   { 37756, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
-   { 37777, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
-   { 37800, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
-   { 37821, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
-   { 37848, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
-   { 37876, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
-   { 37904, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
-   { 37932, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
-   { 37960, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
-   { 37988, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
-   { 38016, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
-   { 38043, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
-   { 38070, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
-   { 38097, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
-   { 38124, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
-   { 38151, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
-   { 38178, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
-   { 38205, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
-   { 38232, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
-   { 38259, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
-   { 38297, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
-   { 38339, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
-   { 38370, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
-   { 38405, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
-   { 38439, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
-   { 38477, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
-   { 38508, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
-   { 38543, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
-   { 38571, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
-   { 38603, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
-   { 38633, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
-   { 38667, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
-   { 38695, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
-   { 38727, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
-   { 38747, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
-   { 38769, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
-   { 38798, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
-   { 38819, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
-   { 38848, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
-   { 38881, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
-   { 38913, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
-   { 38940, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
-   { 38971, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
-   { 39001, 0x00008B31 }, /* GL_VERTEX_SHADER */
-   { 39018, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
-   { 39039, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
-   { 39066, 0x00000BA2 }, /* GL_VIEWPORT */
-   { 39078, 0x00000800 }, /* GL_VIEWPORT_BIT */
-   { 39094, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
-   { 39114, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
-   { 39145, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
-   { 39180, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
-   { 39208, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
-   { 39233, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
-   { 39260, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
-   { 39285, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
-   { 39309, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
-   { 39328, 0x000088B9 }, /* GL_WRITE_ONLY */
-   { 39342, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
-   { 39360, 0x00001506 }, /* GL_XOR */
-   { 39367, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
-   { 39386, 0x00008757 }, /* GL_YCBCR_MESA */
-   { 39400, 0x00000000 }, /* GL_ZERO */
-   { 39408, 0x00000D16 }, /* GL_ZOOM_X */
-   { 39418, 0x00000D17 }, /* GL_ZOOM_Y */
+   {  1394, 0x00008009 }, /* GL_BLEND_EQUATION_RGB */
+   {  1416, 0x00008009 }, /* GL_BLEND_EQUATION_RGB_EXT */
+   {  1442, 0x00000BE1 }, /* GL_BLEND_SRC */
+   {  1455, 0x000080CB }, /* GL_BLEND_SRC_ALPHA */
+   {  1474, 0x000080C9 }, /* GL_BLEND_SRC_RGB */
+   {  1491, 0x00001905 }, /* GL_BLUE */
+   {  1499, 0x00000D1B }, /* GL_BLUE_BIAS */
+   {  1512, 0x00000D54 }, /* GL_BLUE_BITS */
+   {  1525, 0x00000D1A }, /* GL_BLUE_SCALE */
+   {  1539, 0x00008B56 }, /* GL_BOOL */
+   {  1547, 0x00008B56 }, /* GL_BOOL_ARB */
+   {  1559, 0x00008B57 }, /* GL_BOOL_VEC2 */
+   {  1572, 0x00008B57 }, /* GL_BOOL_VEC2_ARB */
+   {  1589, 0x00008B58 }, /* GL_BOOL_VEC3 */
+   {  1602, 0x00008B58 }, /* GL_BOOL_VEC3_ARB */
+   {  1619, 0x00008B59 }, /* GL_BOOL_VEC4 */
+   {  1632, 0x00008B59 }, /* GL_BOOL_VEC4_ARB */
+   {  1649, 0x000088BB }, /* GL_BUFFER_ACCESS */
+   {  1666, 0x000088BB }, /* GL_BUFFER_ACCESS_ARB */
+   {  1687, 0x000088BC }, /* GL_BUFFER_MAPPED */
+   {  1704, 0x000088BC }, /* GL_BUFFER_MAPPED_ARB */
+   {  1725, 0x000088BD }, /* GL_BUFFER_MAP_POINTER */
+   {  1747, 0x000088BD }, /* GL_BUFFER_MAP_POINTER_ARB */
+   {  1773, 0x00008764 }, /* GL_BUFFER_SIZE */
+   {  1788, 0x00008764 }, /* GL_BUFFER_SIZE_ARB */
+   {  1807, 0x00008765 }, /* GL_BUFFER_USAGE */
+   {  1823, 0x00008765 }, /* GL_BUFFER_USAGE_ARB */
+   {  1843, 0x0000877B }, /* GL_BUMP_ENVMAP_ATI */
+   {  1862, 0x00008777 }, /* GL_BUMP_NUM_TEX_UNITS_ATI */
+   {  1888, 0x00008775 }, /* GL_BUMP_ROT_MATRIX_ATI */
+   {  1911, 0x00008776 }, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
+   {  1939, 0x0000877C }, /* GL_BUMP_TARGET_ATI */
+   {  1958, 0x00008778 }, /* GL_BUMP_TEX_UNITS_ATI */
+   {  1980, 0x00001400 }, /* GL_BYTE */
+   {  1988, 0x00002A24 }, /* GL_C3F_V3F */
+   {  1999, 0x00002A26 }, /* GL_C4F_N3F_V3F */
+   {  2014, 0x00002A22 }, /* GL_C4UB_V2F */
+   {  2026, 0x00002A23 }, /* GL_C4UB_V3F */
+   {  2038, 0x00000901 }, /* GL_CCW */
+   {  2045, 0x00002900 }, /* GL_CLAMP */
+   {  2054, 0x0000812D }, /* GL_CLAMP_TO_BORDER */
+   {  2073, 0x0000812D }, /* GL_CLAMP_TO_BORDER_ARB */
+   {  2096, 0x0000812D }, /* GL_CLAMP_TO_BORDER_SGIS */
+   {  2120, 0x0000812F }, /* GL_CLAMP_TO_EDGE */
+   {  2137, 0x0000812F }, /* GL_CLAMP_TO_EDGE_SGIS */
+   {  2159, 0x00001500 }, /* GL_CLEAR */
+   {  2168, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE */
+   {  2193, 0x000084E1 }, /* GL_CLIENT_ACTIVE_TEXTURE_ARB */
+   {  2222, 0xFFFFFFFF }, /* GL_CLIENT_ALL_ATTRIB_BITS */
+   {  2248, 0x00000BB1 }, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
+   {  2277, 0x00000001 }, /* GL_CLIENT_PIXEL_STORE_BIT */
+   {  2303, 0x00000002 }, /* GL_CLIENT_VERTEX_ARRAY_BIT */
+   {  2330, 0x00003000 }, /* GL_CLIP_PLANE0 */
+   {  2345, 0x00003001 }, /* GL_CLIP_PLANE1 */
+   {  2360, 0x00003002 }, /* GL_CLIP_PLANE2 */
+   {  2375, 0x00003003 }, /* GL_CLIP_PLANE3 */
+   {  2390, 0x00003004 }, /* GL_CLIP_PLANE4 */
+   {  2405, 0x00003005 }, /* GL_CLIP_PLANE5 */
+   {  2420, 0x000080F0 }, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
+   {  2453, 0x00000A00 }, /* GL_COEFF */
+   {  2462, 0x00001800 }, /* GL_COLOR */
+   {  2471, 0x00008076 }, /* GL_COLOR_ARRAY */
+   {  2486, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING */
+   {  2516, 0x00008898 }, /* GL_COLOR_ARRAY_BUFFER_BINDING_ARB */
+   {  2550, 0x00008090 }, /* GL_COLOR_ARRAY_POINTER */
+   {  2573, 0x00008081 }, /* GL_COLOR_ARRAY_SIZE */
+   {  2593, 0x00008083 }, /* GL_COLOR_ARRAY_STRIDE */
+   {  2615, 0x00008082 }, /* GL_COLOR_ARRAY_TYPE */
+   {  2635, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0 */
+   {  2656, 0x00008CE0 }, /* GL_COLOR_ATTACHMENT0_EXT */
+   {  2681, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1 */
+   {  2702, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10 */
+   {  2724, 0x00008CEA }, /* GL_COLOR_ATTACHMENT10_EXT */
+   {  2750, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11 */
+   {  2772, 0x00008CEB }, /* GL_COLOR_ATTACHMENT11_EXT */
+   {  2798, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12 */
+   {  2820, 0x00008CEC }, /* GL_COLOR_ATTACHMENT12_EXT */
+   {  2846, 0x00008CED }, /* GL_COLOR_ATTACHMENT13 */
+   {  2868, 0x00008CED }, /* GL_COLOR_ATTACHMENT13_EXT */
+   {  2894, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14 */
+   {  2916, 0x00008CEE }, /* GL_COLOR_ATTACHMENT14_EXT */
+   {  2942, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15 */
+   {  2964, 0x00008CEF }, /* GL_COLOR_ATTACHMENT15_EXT */
+   {  2990, 0x00008CE1 }, /* GL_COLOR_ATTACHMENT1_EXT */
+   {  3015, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2 */
+   {  3036, 0x00008CE2 }, /* GL_COLOR_ATTACHMENT2_EXT */
+   {  3061, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3 */
+   {  3082, 0x00008CE3 }, /* GL_COLOR_ATTACHMENT3_EXT */
+   {  3107, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4 */
+   {  3128, 0x00008CE4 }, /* GL_COLOR_ATTACHMENT4_EXT */
+   {  3153, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5 */
+   {  3174, 0x00008CE5 }, /* GL_COLOR_ATTACHMENT5_EXT */
+   {  3199, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6 */
+   {  3220, 0x00008CE6 }, /* GL_COLOR_ATTACHMENT6_EXT */
+   {  3245, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7 */
+   {  3266, 0x00008CE7 }, /* GL_COLOR_ATTACHMENT7_EXT */
+   {  3291, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8 */
+   {  3312, 0x00008CE8 }, /* GL_COLOR_ATTACHMENT8_EXT */
+   {  3337, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9 */
+   {  3358, 0x00008CE9 }, /* GL_COLOR_ATTACHMENT9_EXT */
+   {  3383, 0x00004000 }, /* GL_COLOR_BUFFER_BIT */
+   {  3403, 0x00000C22 }, /* GL_COLOR_CLEAR_VALUE */
+   {  3424, 0x00001900 }, /* GL_COLOR_INDEX */
+   {  3439, 0x00001603 }, /* GL_COLOR_INDEXES */
+   {  3456, 0x00000BF2 }, /* GL_COLOR_LOGIC_OP */
+   {  3474, 0x00000B57 }, /* GL_COLOR_MATERIAL */
+   {  3492, 0x00000B55 }, /* GL_COLOR_MATERIAL_FACE */
+   {  3515, 0x00000B56 }, /* GL_COLOR_MATERIAL_PARAMETER */
+   {  3543, 0x000080B1 }, /* GL_COLOR_MATRIX */
+   {  3559, 0x000080B1 }, /* GL_COLOR_MATRIX_SGI */
+   {  3579, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH */
+   {  3607, 0x000080B2 }, /* GL_COLOR_MATRIX_STACK_DEPTH_SGI */
+   {  3639, 0x00008458 }, /* GL_COLOR_SUM */
+   {  3652, 0x00008458 }, /* GL_COLOR_SUM_ARB */
+   {  3669, 0x000080D0 }, /* GL_COLOR_TABLE */
+   {  3684, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE */
+   {  3710, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_EXT */
+   {  3740, 0x000080DD }, /* GL_COLOR_TABLE_ALPHA_SIZE_SGI */
+   {  3770, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS */
+   {  3790, 0x000080D7 }, /* GL_COLOR_TABLE_BIAS_SGI */
+   {  3814, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE */
+   {  3839, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_EXT */
+   {  3868, 0x000080DC }, /* GL_COLOR_TABLE_BLUE_SIZE_SGI */
+   {  3897, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT */
+   {  3919, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_EXT */
+   {  3945, 0x000080D8 }, /* GL_COLOR_TABLE_FORMAT_SGI */
+   {  3971, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE */
+   {  3997, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_EXT */
+   {  4027, 0x000080DB }, /* GL_COLOR_TABLE_GREEN_SIZE_SGI */
+   {  4057, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE */
+   {  4087, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_EXT */
+   {  4121, 0x000080DF }, /* GL_COLOR_TABLE_INTENSITY_SIZE_SGI */
+   {  4155, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
+   {  4185, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_EXT */
+   {  4219, 0x000080DE }, /* GL_COLOR_TABLE_LUMINANCE_SIZE_SGI */
+   {  4253, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE */
+   {  4277, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_EXT */
+   {  4305, 0x000080DA }, /* GL_COLOR_TABLE_RED_SIZE_SGI */
+   {  4333, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE */
+   {  4354, 0x000080D6 }, /* GL_COLOR_TABLE_SCALE_SGI */
+   {  4379, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH */
+   {  4400, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_EXT */
+   {  4425, 0x000080D9 }, /* GL_COLOR_TABLE_WIDTH_SGI */
+   {  4450, 0x00000C23 }, /* GL_COLOR_WRITEMASK */
+   {  4469, 0x00008570 }, /* GL_COMBINE */
+   {  4480, 0x00008503 }, /* GL_COMBINE4 */
+   {  4492, 0x00008572 }, /* GL_COMBINE_ALPHA */
+   {  4509, 0x00008572 }, /* GL_COMBINE_ALPHA_ARB */
+   {  4530, 0x00008572 }, /* GL_COMBINE_ALPHA_EXT */
+   {  4551, 0x00008570 }, /* GL_COMBINE_ARB */
+   {  4566, 0x00008570 }, /* GL_COMBINE_EXT */
+   {  4581, 0x00008571 }, /* GL_COMBINE_RGB */
+   {  4596, 0x00008571 }, /* GL_COMBINE_RGB_ARB */
+   {  4615, 0x00008571 }, /* GL_COMBINE_RGB_EXT */
+   {  4634, 0x0000884E }, /* GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT */
+   {  4670, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE */
+   {  4694, 0x0000884E }, /* GL_COMPARE_R_TO_TEXTURE_ARB */
+   {  4722, 0x00001300 }, /* GL_COMPILE */
+   {  4733, 0x00001301 }, /* GL_COMPILE_AND_EXECUTE */
+   {  4756, 0x00008B81 }, /* GL_COMPILE_STATUS */
+   {  4774, 0x000084E9 }, /* GL_COMPRESSED_ALPHA */
+   {  4794, 0x000084E9 }, /* GL_COMPRESSED_ALPHA_ARB */
+   {  4818, 0x000084EC }, /* GL_COMPRESSED_INTENSITY */
+   {  4842, 0x000084EC }, /* GL_COMPRESSED_INTENSITY_ARB */
+   {  4870, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE */
+   {  4894, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA */
+   {  4924, 0x000084EB }, /* GL_COMPRESSED_LUMINANCE_ALPHA_ARB */
+   {  4958, 0x000084EA }, /* GL_COMPRESSED_LUMINANCE_ARB */
+   {  4986, 0x000084ED }, /* GL_COMPRESSED_RGB */
+   {  5004, 0x000084EE }, /* GL_COMPRESSED_RGBA */
+   {  5023, 0x000084EE }, /* GL_COMPRESSED_RGBA_ARB */
+   {  5046, 0x000086B1 }, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
+   {  5075, 0x000083F1 }, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
+   {  5108, 0x000083F2 }, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
+   {  5141, 0x000083F3 }, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
+   {  5174, 0x000084ED }, /* GL_COMPRESSED_RGB_ARB */
+   {  5196, 0x000086B0 }, /* GL_COMPRESSED_RGB_FXT1_3DFX */
+   {  5224, 0x000083F0 }, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
+   {  5256, 0x00008C4A }, /* GL_COMPRESSED_SLUMINANCE */
+   {  5281, 0x00008C4B }, /* GL_COMPRESSED_SLUMINANCE_ALPHA */
+   {  5312, 0x00008C48 }, /* GL_COMPRESSED_SRGB */
+   {  5331, 0x00008C49 }, /* GL_COMPRESSED_SRGB_ALPHA */
+   {  5356, 0x000086A3 }, /* GL_COMPRESSED_TEXTURE_FORMATS */
+   {  5386, 0x00008576 }, /* GL_CONSTANT */
+   {  5398, 0x00008003 }, /* GL_CONSTANT_ALPHA */
+   {  5416, 0x00008003 }, /* GL_CONSTANT_ALPHA_EXT */
+   {  5438, 0x00008576 }, /* GL_CONSTANT_ARB */
+   {  5454, 0x00001207 }, /* GL_CONSTANT_ATTENUATION */
+   {  5478, 0x00008151 }, /* GL_CONSTANT_BORDER_HP */
+   {  5500, 0x00008001 }, /* GL_CONSTANT_COLOR */
+   {  5518, 0x00008001 }, /* GL_CONSTANT_COLOR_EXT */
+   {  5540, 0x00008576 }, /* GL_CONSTANT_EXT */
+   {  5556, 0x00008010 }, /* GL_CONVOLUTION_1D */
+   {  5574, 0x00008011 }, /* GL_CONVOLUTION_2D */
+   {  5592, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR */
+   {  5620, 0x00008154 }, /* GL_CONVOLUTION_BORDER_COLOR_HP */
+   {  5651, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE */
+   {  5678, 0x00008013 }, /* GL_CONVOLUTION_BORDER_MODE_EXT */
+   {  5709, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS */
+   {  5736, 0x00008015 }, /* GL_CONVOLUTION_FILTER_BIAS_EXT */
+   {  5767, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE */
+   {  5795, 0x00008014 }, /* GL_CONVOLUTION_FILTER_SCALE_EXT */
+   {  5827, 0x00008017 }, /* GL_CONVOLUTION_FORMAT */
+   {  5849, 0x00008017 }, /* GL_CONVOLUTION_FORMAT_EXT */
+   {  5875, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT */
+   {  5897, 0x00008019 }, /* GL_CONVOLUTION_HEIGHT_EXT */
+   {  5923, 0x00008018 }, /* GL_CONVOLUTION_WIDTH */
+   {  5944, 0x00008018 }, /* GL_CONVOLUTION_WIDTH_EXT */
+   {  5969, 0x00008862 }, /* GL_COORD_REPLACE */
+   {  5986, 0x00008862 }, /* GL_COORD_REPLACE_ARB */
+   {  6007, 0x00008862 }, /* GL_COORD_REPLACE_NV */
+   {  6027, 0x00001503 }, /* GL_COPY */
+   {  6035, 0x0000150C }, /* GL_COPY_INVERTED */
+   {  6052, 0x00000706 }, /* GL_COPY_PIXEL_TOKEN */
+   {  6072, 0x00000B44 }, /* GL_CULL_FACE */
+   {  6085, 0x00000B45 }, /* GL_CULL_FACE_MODE */
+   {  6103, 0x000081AA }, /* GL_CULL_VERTEX_EXT */
+   {  6122, 0x000081AC }, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
+   {  6154, 0x000081AB }, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
+   {  6189, 0x00008626 }, /* GL_CURRENT_ATTRIB_NV */
+   {  6210, 0x00000001 }, /* GL_CURRENT_BIT */
+   {  6225, 0x00000B00 }, /* GL_CURRENT_COLOR */
+   {  6242, 0x00008453 }, /* GL_CURRENT_FOG_COORD */
+   {  6263, 0x00008453 }, /* GL_CURRENT_FOG_COORDINATE */
+   {  6289, 0x00000B01 }, /* GL_CURRENT_INDEX */
+   {  6306, 0x00008641 }, /* GL_CURRENT_MATRIX_ARB */
+   {  6328, 0x00008845 }, /* GL_CURRENT_MATRIX_INDEX_ARB */
+   {  6356, 0x00008641 }, /* GL_CURRENT_MATRIX_NV */
+   {  6377, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
+   {  6411, 0x00008640 }, /* GL_CURRENT_MATRIX_STACK_DEPTH_NV */
+   {  6444, 0x00000B02 }, /* GL_CURRENT_NORMAL */
+   {  6462, 0x00008843 }, /* GL_CURRENT_PALETTE_MATRIX_ARB */
+   {  6492, 0x00008B8D }, /* GL_CURRENT_PROGRAM */
+   {  6511, 0x00008865 }, /* GL_CURRENT_QUERY */
+   {  6528, 0x00008865 }, /* GL_CURRENT_QUERY_ARB */
+   {  6549, 0x00000B04 }, /* GL_CURRENT_RASTER_COLOR */
+   {  6573, 0x00000B09 }, /* GL_CURRENT_RASTER_DISTANCE */
+   {  6600, 0x00000B05 }, /* GL_CURRENT_RASTER_INDEX */
+   {  6624, 0x00000B07 }, /* GL_CURRENT_RASTER_POSITION */
+   {  6651, 0x00000B08 }, /* GL_CURRENT_RASTER_POSITION_VALID */
+   {  6684, 0x0000845F }, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
+   {  6718, 0x00000B06 }, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
+   {  6751, 0x00008459 }, /* GL_CURRENT_SECONDARY_COLOR */
+   {  6778, 0x00000B03 }, /* GL_CURRENT_TEXTURE_COORDS */
+   {  6804, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB */
+   {  6829, 0x00008626 }, /* GL_CURRENT_VERTEX_ATTRIB_ARB */
+   {  6858, 0x000086A8 }, /* GL_CURRENT_WEIGHT_ARB */
+   {  6880, 0x00000900 }, /* GL_CW */
+   {  6886, 0x0000875B }, /* GL_DEBUG_ASSERT_MESA */
+   {  6907, 0x00008759 }, /* GL_DEBUG_OBJECT_MESA */
+   {  6928, 0x0000875A }, /* GL_DEBUG_PRINT_MESA */
+   {  6948, 0x00002101 }, /* GL_DECAL */
+   {  6957, 0x00001E03 }, /* GL_DECR */
+   {  6965, 0x00008508 }, /* GL_DECR_WRAP */
+   {  6978, 0x00008508 }, /* GL_DECR_WRAP_EXT */
+   {  6995, 0x00008B80 }, /* GL_DELETE_STATUS */
+   {  7012, 0x00001801 }, /* GL_DEPTH */
+   {  7021, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */
+   {  7041, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */
+   {  7061, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */
+   {  7085, 0x00000D1F }, /* GL_DEPTH_BIAS */
+   {  7099, 0x00000D56 }, /* GL_DEPTH_BITS */
+   {  7113, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */
+   {  7133, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */
+   {  7158, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */
+   {  7178, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */
+   {  7196, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */
+   {  7217, 0x00001902 }, /* GL_DEPTH_COMPONENT */
+   {  7236, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */
+   {  7257, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */
+   {  7282, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */
+   {  7308, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */
+   {  7329, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */
+   {  7354, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */
+   {  7380, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */
+   {  7401, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */
+   {  7426, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */
+   {  7452, 0x00000B74 }, /* GL_DEPTH_FUNC */
+   {  7466, 0x00000B70 }, /* GL_DEPTH_RANGE */
+   {  7481, 0x00000D1E }, /* GL_DEPTH_SCALE */
+   {  7496, 0x000084F9 }, /* GL_DEPTH_STENCIL */
+   {  7513, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */
+   {  7541, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */
+   {  7561, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+   {  7589, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+   {  7617, 0x00000B71 }, /* GL_DEPTH_TEST */
+   {  7631, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */
+   {  7653, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */
+   {  7679, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */
+   {  7698, 0x00001201 }, /* GL_DIFFUSE */
+   {  7709, 0x00000BD0 }, /* GL_DITHER */
+   {  7719, 0x00000A02 }, /* GL_DOMAIN */
+   {  7729, 0x00001100 }, /* GL_DONT_CARE */
+   {  7742, 0x000086AE }, /* GL_DOT3_RGB */
+   {  7754, 0x000086AF }, /* GL_DOT3_RGBA */
+   {  7767, 0x000086AF }, /* GL_DOT3_RGBA_ARB */
+   {  7784, 0x00008741 }, /* GL_DOT3_RGBA_EXT */
+   {  7801, 0x000086AE }, /* GL_DOT3_RGB_ARB */
+   {  7817, 0x00008740 }, /* GL_DOT3_RGB_EXT */
+   {  7833, 0x0000140A }, /* GL_DOUBLE */
+   {  7843, 0x00000C32 }, /* GL_DOUBLEBUFFER */
+   {  7859, 0x00000C01 }, /* GL_DRAW_BUFFER */
+   {  7874, 0x00008825 }, /* GL_DRAW_BUFFER0 */
+   {  7890, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */
+   {  7910, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */
+   {  7930, 0x00008826 }, /* GL_DRAW_BUFFER1 */
+   {  7946, 0x0000882F }, /* GL_DRAW_BUFFER10 */
+   {  7963, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */
+   {  7984, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */
+   {  8005, 0x00008830 }, /* GL_DRAW_BUFFER11 */
+   {  8022, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */
+   {  8043, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */
+   {  8064, 0x00008831 }, /* GL_DRAW_BUFFER12 */
+   {  8081, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */
+   {  8102, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */
+   {  8123, 0x00008832 }, /* GL_DRAW_BUFFER13 */
+   {  8140, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */
+   {  8161, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */
+   {  8182, 0x00008833 }, /* GL_DRAW_BUFFER14 */
+   {  8199, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */
+   {  8220, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */
+   {  8241, 0x00008834 }, /* GL_DRAW_BUFFER15 */
+   {  8258, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */
+   {  8279, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */
+   {  8300, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */
+   {  8320, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */
+   {  8340, 0x00008827 }, /* GL_DRAW_BUFFER2 */
+   {  8356, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */
+   {  8376, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */
+   {  8396, 0x00008828 }, /* GL_DRAW_BUFFER3 */
+   {  8412, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */
+   {  8432, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */
+   {  8452, 0x00008829 }, /* GL_DRAW_BUFFER4 */
+   {  8468, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */
+   {  8488, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */
+   {  8508, 0x0000882A }, /* GL_DRAW_BUFFER5 */
+   {  8524, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */
+   {  8544, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */
+   {  8564, 0x0000882B }, /* GL_DRAW_BUFFER6 */
+   {  8580, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */
+   {  8600, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */
+   {  8620, 0x0000882C }, /* GL_DRAW_BUFFER7 */
+   {  8636, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */
+   {  8656, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */
+   {  8676, 0x0000882D }, /* GL_DRAW_BUFFER8 */
+   {  8692, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */
+   {  8712, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */
+   {  8732, 0x0000882E }, /* GL_DRAW_BUFFER9 */
+   {  8748, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */
+   {  8768, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */
+   {  8788, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */
+   {  8808, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
+   {  8840, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */
+   {  8864, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */
+   {  8884, 0x00000304 }, /* GL_DST_ALPHA */
+   {  8897, 0x00000306 }, /* GL_DST_COLOR */
+   {  8910, 0x0000877A }, /* GL_DU8DV8_ATI */
+   {  8924, 0x00008779 }, /* GL_DUDV_ATI */
+   {  8936, 0x000088EA }, /* GL_DYNAMIC_COPY */
+   {  8952, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */
+   {  8972, 0x000088E8 }, /* GL_DYNAMIC_DRAW */
+   {  8988, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */
+   {  9008, 0x000088E9 }, /* GL_DYNAMIC_READ */
+   {  9024, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */
+   {  9044, 0x00000B43 }, /* GL_EDGE_FLAG */
+   {  9057, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */
+   {  9076, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+   {  9110, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */
+   {  9148, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */
+   {  9175, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+   {  9201, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */
+   {  9225, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+   {  9257, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */
+   {  9293, 0x00001600 }, /* GL_EMISSION */
+   {  9305, 0x00002000 }, /* GL_ENABLE_BIT */
+   {  9319, 0x00000202 }, /* GL_EQUAL */
+   {  9328, 0x00001509 }, /* GL_EQUIV */
+   {  9337, 0x00010000 }, /* GL_EVAL_BIT */
+   {  9349, 0x00000800 }, /* GL_EXP */
+   {  9356, 0x00000801 }, /* GL_EXP2 */
+   {  9364, 0x00001F03 }, /* GL_EXTENSIONS */
+   {  9378, 0x00002400 }, /* GL_EYE_LINEAR */
+   {  9392, 0x00002502 }, /* GL_EYE_PLANE */
+   {  9405, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */
+   {  9430, 0x0000855B }, /* GL_EYE_RADIAL_NV */
+   {  9447, 0x00000000 }, /* GL_FALSE */
+   {  9456, 0x00001101 }, /* GL_FASTEST */
+   {  9467, 0x00001C01 }, /* GL_FEEDBACK */
+   {  9479, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */
+   {  9506, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */
+   {  9530, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */
+   {  9554, 0x00001B02 }, /* GL_FILL */
+   {  9562, 0x00001D00 }, /* GL_FLAT */
+   {  9570, 0x00001406 }, /* GL_FLOAT */
+   {  9579, 0x00008B5A }, /* GL_FLOAT_MAT2 */
+   {  9593, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */
+   {  9611, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */
+   {  9627, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */
+   {  9643, 0x00008B5B }, /* GL_FLOAT_MAT3 */
+   {  9657, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */
+   {  9675, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */
+   {  9691, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */
+   {  9707, 0x00008B5C }, /* GL_FLOAT_MAT4 */
+   {  9721, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */
+   {  9739, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */
+   {  9755, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */
+   {  9771, 0x00008B50 }, /* GL_FLOAT_VEC2 */
+   {  9785, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */
+   {  9803, 0x00008B51 }, /* GL_FLOAT_VEC3 */
+   {  9817, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */
+   {  9835, 0x00008B52 }, /* GL_FLOAT_VEC4 */
+   {  9849, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */
+   {  9867, 0x00000B60 }, /* GL_FOG */
+   {  9874, 0x00000080 }, /* GL_FOG_BIT */
+   {  9885, 0x00000B66 }, /* GL_FOG_COLOR */
+   {  9898, 0x00008451 }, /* GL_FOG_COORD */
+   {  9911, 0x00008451 }, /* GL_FOG_COORDINATE */
+   {  9929, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */
+   {  9953, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+   {  9992, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */
+   { 10035, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+   { 10067, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+   { 10098, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+   { 10127, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */
+   { 10152, 0x00008457 }, /* GL_FOG_COORD_ARRAY */
+   { 10171, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */
+   { 10205, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */
+   { 10232, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */
+   { 10258, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */
+   { 10282, 0x00008450 }, /* GL_FOG_COORD_SRC */
+   { 10299, 0x00000B62 }, /* GL_FOG_DENSITY */
+   { 10314, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */
+   { 10338, 0x00000B64 }, /* GL_FOG_END */
+   { 10349, 0x00000C54 }, /* GL_FOG_HINT */
+   { 10361, 0x00000B61 }, /* GL_FOG_INDEX */
+   { 10374, 0x00000B65 }, /* GL_FOG_MODE */
+   { 10386, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */
+   { 10405, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */
+   { 10430, 0x00000B63 }, /* GL_FOG_START */
+   { 10443, 0x00008452 }, /* GL_FRAGMENT_DEPTH */
+   { 10461, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */
+   { 10485, 0x00008B30 }, /* GL_FRAGMENT_SHADER */
+   { 10504, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */
+   { 10527, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+   { 10562, 0x00008D40 }, /* GL_FRAMEBUFFER */
+   { 10577, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+   { 10614, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+   { 10650, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+   { 10691, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+   { 10732, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+   { 10769, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+   { 10806, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+   { 10844, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */
+   { 10886, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+   { 10924, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */
+   { 10966, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+   { 11001, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+   { 11040, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */
+   { 11089, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+   { 11137, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */
+   { 11189, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+   { 11229, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */
+   { 11273, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+   { 11313, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */
+   { 11357, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */
+   { 11384, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */
+   { 11408, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */
+   { 11436, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */
+   { 11459, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */
+   { 11478, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+   { 11515, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */
+   { 11556, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+   { 11597, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
+   { 11639, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+   { 11690, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+   { 11728, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+   { 11773, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */
+   { 11822, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+   { 11860, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
+   { 11902, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+   { 11934, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */
+   { 11959, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */
+   { 11986, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */
+   { 12017, 0x00000404 }, /* GL_FRONT */
+   { 12026, 0x00000408 }, /* GL_FRONT_AND_BACK */
+   { 12044, 0x00000B46 }, /* GL_FRONT_FACE */
+   { 12058, 0x00000400 }, /* GL_FRONT_LEFT */
+   { 12072, 0x00000401 }, /* GL_FRONT_RIGHT */
+   { 12087, 0x00008006 }, /* GL_FUNC_ADD */
+   { 12099, 0x00008006 }, /* GL_FUNC_ADD_EXT */
+   { 12115, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */
+   { 12140, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */
+   { 12169, 0x0000800A }, /* GL_FUNC_SUBTRACT */
+   { 12186, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */
+   { 12207, 0x00008191 }, /* GL_GENERATE_MIPMAP */
+   { 12226, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */
+   { 12250, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */
+   { 12279, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */
+   { 12303, 0x00000206 }, /* GL_GEQUAL */
+   { 12313, 0x00000204 }, /* GL_GREATER */
+   { 12324, 0x00001904 }, /* GL_GREEN */
+   { 12333, 0x00000D19 }, /* GL_GREEN_BIAS */
+   { 12347, 0x00000D53 }, /* GL_GREEN_BITS */
+   { 12361, 0x00000D18 }, /* GL_GREEN_SCALE */
+   { 12376, 0x00008000 }, /* GL_HINT_BIT */
+   { 12388, 0x00008024 }, /* GL_HISTOGRAM */
+   { 12401, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */
+   { 12425, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */
+   { 12453, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */
+   { 12476, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */
+   { 12503, 0x00008024 }, /* GL_HISTOGRAM_EXT */
+   { 12520, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */
+   { 12540, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */
+   { 12564, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */
+   { 12588, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */
+   { 12616, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+   { 12644, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */
+   { 12676, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */
+   { 12698, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */
+   { 12724, 0x0000802D }, /* GL_HISTOGRAM_SINK */
+   { 12742, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */
+   { 12764, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */
+   { 12783, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */
+   { 12806, 0x0000862A }, /* GL_IDENTITY_NV */
+   { 12821, 0x00008150 }, /* GL_IGNORE_BORDER_HP */
+   { 12841, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+   { 12881, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+   { 12919, 0x00001E02 }, /* GL_INCR */
+   { 12927, 0x00008507 }, /* GL_INCR_WRAP */
+   { 12940, 0x00008507 }, /* GL_INCR_WRAP_EXT */
+   { 12957, 0x00008222 }, /* GL_INDEX */
+   { 12966, 0x00008077 }, /* GL_INDEX_ARRAY */
+   { 12981, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+   { 13011, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */
+   { 13045, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */
+   { 13068, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */
+   { 13090, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */
+   { 13110, 0x00000D51 }, /* GL_INDEX_BITS */
+   { 13124, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */
+   { 13145, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */
+   { 13163, 0x00000C30 }, /* GL_INDEX_MODE */
+   { 13177, 0x00000D13 }, /* GL_INDEX_OFFSET */
+   { 13193, 0x00000D12 }, /* GL_INDEX_SHIFT */
+   { 13208, 0x00000C21 }, /* GL_INDEX_WRITEMASK */
+   { 13227, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */
+   { 13246, 0x00001404 }, /* GL_INT */
+   { 13253, 0x00008049 }, /* GL_INTENSITY */
+   { 13266, 0x0000804C }, /* GL_INTENSITY12 */
+   { 13281, 0x0000804C }, /* GL_INTENSITY12_EXT */
+   { 13300, 0x0000804D }, /* GL_INTENSITY16 */
+   { 13315, 0x0000804D }, /* GL_INTENSITY16_EXT */
+   { 13334, 0x0000804A }, /* GL_INTENSITY4 */
+   { 13348, 0x0000804A }, /* GL_INTENSITY4_EXT */
+   { 13366, 0x0000804B }, /* GL_INTENSITY8 */
+   { 13380, 0x0000804B }, /* GL_INTENSITY8_EXT */
+   { 13398, 0x00008049 }, /* GL_INTENSITY_EXT */
+   { 13415, 0x00008575 }, /* GL_INTERPOLATE */
+   { 13430, 0x00008575 }, /* GL_INTERPOLATE_ARB */
+   { 13449, 0x00008575 }, /* GL_INTERPOLATE_EXT */
+   { 13468, 0x00008B53 }, /* GL_INT_VEC2 */
+   { 13480, 0x00008B53 }, /* GL_INT_VEC2_ARB */
+   { 13496, 0x00008B54 }, /* GL_INT_VEC3 */
+   { 13508, 0x00008B54 }, /* GL_INT_VEC3_ARB */
+   { 13524, 0x00008B55 }, /* GL_INT_VEC4 */
+   { 13536, 0x00008B55 }, /* GL_INT_VEC4_ARB */
+   { 13552, 0x00000500 }, /* GL_INVALID_ENUM */
+   { 13568, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+   { 13601, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */
+   { 13638, 0x00000502 }, /* GL_INVALID_OPERATION */
+   { 13659, 0x00000501 }, /* GL_INVALID_VALUE */
+   { 13676, 0x0000862B }, /* GL_INVERSE_NV */
+   { 13690, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */
+   { 13714, 0x0000150A }, /* GL_INVERT */
+   { 13724, 0x00001E00 }, /* GL_KEEP */
+   { 13732, 0x00000406 }, /* GL_LEFT */
+   { 13740, 0x00000203 }, /* GL_LEQUAL */
+   { 13750, 0x00000201 }, /* GL_LESS */
+   { 13758, 0x00004000 }, /* GL_LIGHT0 */
+   { 13768, 0x00004001 }, /* GL_LIGHT1 */
+   { 13778, 0x00004002 }, /* GL_LIGHT2 */
+   { 13788, 0x00004003 }, /* GL_LIGHT3 */
+   { 13798, 0x00004004 }, /* GL_LIGHT4 */
+   { 13808, 0x00004005 }, /* GL_LIGHT5 */
+   { 13818, 0x00004006 }, /* GL_LIGHT6 */
+   { 13828, 0x00004007 }, /* GL_LIGHT7 */
+   { 13838, 0x00000B50 }, /* GL_LIGHTING */
+   { 13850, 0x00000040 }, /* GL_LIGHTING_BIT */
+   { 13866, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */
+   { 13889, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+   { 13918, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */
+   { 13951, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+   { 13979, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */
+   { 14003, 0x00001B01 }, /* GL_LINE */
+   { 14011, 0x00002601 }, /* GL_LINEAR */
+   { 14021, 0x00001208 }, /* GL_LINEAR_ATTENUATION */
+   { 14043, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+   { 14073, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+   { 14104, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */
+   { 14128, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */
+   { 14153, 0x00000001 }, /* GL_LINES */
+   { 14162, 0x00000004 }, /* GL_LINE_BIT */
+   { 14174, 0x00000002 }, /* GL_LINE_LOOP */
+   { 14187, 0x00000707 }, /* GL_LINE_RESET_TOKEN */
+   { 14207, 0x00000B20 }, /* GL_LINE_SMOOTH */
+   { 14222, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */
+   { 14242, 0x00000B24 }, /* GL_LINE_STIPPLE */
+   { 14258, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */
+   { 14282, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */
+   { 14305, 0x00000003 }, /* GL_LINE_STRIP */
+   { 14319, 0x00000702 }, /* GL_LINE_TOKEN */
+   { 14333, 0x00000B21 }, /* GL_LINE_WIDTH */
+   { 14347, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */
+   { 14373, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */
+   { 14393, 0x00008B82 }, /* GL_LINK_STATUS */
+   { 14408, 0x00000B32 }, /* GL_LIST_BASE */
+   { 14421, 0x00020000 }, /* GL_LIST_BIT */
+   { 14433, 0x00000B33 }, /* GL_LIST_INDEX */
+   { 14447, 0x00000B30 }, /* GL_LIST_MODE */
+   { 14460, 0x00000101 }, /* GL_LOAD */
+   { 14468, 0x00000BF1 }, /* GL_LOGIC_OP */
+   { 14480, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */
+   { 14497, 0x00008CA1 }, /* GL_LOWER_LEFT */
+   { 14511, 0x00001909 }, /* GL_LUMINANCE */
+   { 14524, 0x00008041 }, /* GL_LUMINANCE12 */
+   { 14539, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */
+   { 14562, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */
+   { 14589, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */
+   { 14611, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */
+   { 14637, 0x00008041 }, /* GL_LUMINANCE12_EXT */
+   { 14656, 0x00008042 }, /* GL_LUMINANCE16 */
+   { 14671, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */
+   { 14694, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */
+   { 14721, 0x00008042 }, /* GL_LUMINANCE16_EXT */
+   { 14740, 0x0000803F }, /* GL_LUMINANCE4 */
+   { 14754, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */
+   { 14775, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */
+   { 14800, 0x0000803F }, /* GL_LUMINANCE4_EXT */
+   { 14818, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */
+   { 14839, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */
+   { 14864, 0x00008040 }, /* GL_LUMINANCE8 */
+   { 14878, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */
+   { 14899, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */
+   { 14924, 0x00008040 }, /* GL_LUMINANCE8_EXT */
+   { 14942, 0x0000190A }, /* GL_LUMINANCE_ALPHA */
+   { 14961, 0x00000D90 }, /* GL_MAP1_COLOR_4 */
+   { 14977, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */
+   { 14997, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */
+   { 15019, 0x00000D91 }, /* GL_MAP1_INDEX */
+   { 15033, 0x00000D92 }, /* GL_MAP1_NORMAL */
+   { 15048, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */
+   { 15072, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */
+   { 15096, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */
+   { 15120, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */
+   { 15144, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */
+   { 15161, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */
+   { 15178, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+   { 15206, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+   { 15235, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+   { 15264, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+   { 15293, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+   { 15322, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+   { 15351, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+   { 15380, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+   { 15408, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+   { 15436, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+   { 15464, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+   { 15492, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+   { 15520, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+   { 15548, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+   { 15576, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+   { 15604, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+   { 15632, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */
+   { 15648, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */
+   { 15668, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */
+   { 15690, 0x00000DB1 }, /* GL_MAP2_INDEX */
+   { 15704, 0x00000DB2 }, /* GL_MAP2_NORMAL */
+   { 15719, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */
+   { 15743, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */
+   { 15767, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */
+   { 15791, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */
+   { 15815, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */
+   { 15832, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */
+   { 15849, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+   { 15877, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+   { 15906, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+   { 15935, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+   { 15964, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+   { 15993, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+   { 16022, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+   { 16051, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+   { 16079, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+   { 16107, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+   { 16135, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+   { 16163, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+   { 16191, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+   { 16219, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */
+   { 16247, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+   { 16275, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+   { 16303, 0x00000D10 }, /* GL_MAP_COLOR */
+   { 16316, 0x00000D11 }, /* GL_MAP_STENCIL */
+   { 16331, 0x000088C0 }, /* GL_MATRIX0_ARB */
+   { 16346, 0x00008630 }, /* GL_MATRIX0_NV */
+   { 16360, 0x000088CA }, /* GL_MATRIX10_ARB */
+   { 16376, 0x000088CB }, /* GL_MATRIX11_ARB */
+   { 16392, 0x000088CC }, /* GL_MATRIX12_ARB */
+   { 16408, 0x000088CD }, /* GL_MATRIX13_ARB */
+   { 16424, 0x000088CE }, /* GL_MATRIX14_ARB */
+   { 16440, 0x000088CF }, /* GL_MATRIX15_ARB */
+   { 16456, 0x000088D0 }, /* GL_MATRIX16_ARB */
+   { 16472, 0x000088D1 }, /* GL_MATRIX17_ARB */
+   { 16488, 0x000088D2 }, /* GL_MATRIX18_ARB */
+   { 16504, 0x000088D3 }, /* GL_MATRIX19_ARB */
+   { 16520, 0x000088C1 }, /* GL_MATRIX1_ARB */
+   { 16535, 0x00008631 }, /* GL_MATRIX1_NV */
+   { 16549, 0x000088D4 }, /* GL_MATRIX20_ARB */
+   { 16565, 0x000088D5 }, /* GL_MATRIX21_ARB */
+   { 16581, 0x000088D6 }, /* GL_MATRIX22_ARB */
+   { 16597, 0x000088D7 }, /* GL_MATRIX23_ARB */
+   { 16613, 0x000088D8 }, /* GL_MATRIX24_ARB */
+   { 16629, 0x000088D9 }, /* GL_MATRIX25_ARB */
+   { 16645, 0x000088DA }, /* GL_MATRIX26_ARB */
+   { 16661, 0x000088DB }, /* GL_MATRIX27_ARB */
+   { 16677, 0x000088DC }, /* GL_MATRIX28_ARB */
+   { 16693, 0x000088DD }, /* GL_MATRIX29_ARB */
+   { 16709, 0x000088C2 }, /* GL_MATRIX2_ARB */
+   { 16724, 0x00008632 }, /* GL_MATRIX2_NV */
+   { 16738, 0x000088DE }, /* GL_MATRIX30_ARB */
+   { 16754, 0x000088DF }, /* GL_MATRIX31_ARB */
+   { 16770, 0x000088C3 }, /* GL_MATRIX3_ARB */
+   { 16785, 0x00008633 }, /* GL_MATRIX3_NV */
+   { 16799, 0x000088C4 }, /* GL_MATRIX4_ARB */
+   { 16814, 0x00008634 }, /* GL_MATRIX4_NV */
+   { 16828, 0x000088C5 }, /* GL_MATRIX5_ARB */
+   { 16843, 0x00008635 }, /* GL_MATRIX5_NV */
+   { 16857, 0x000088C6 }, /* GL_MATRIX6_ARB */
+   { 16872, 0x00008636 }, /* GL_MATRIX6_NV */
+   { 16886, 0x000088C7 }, /* GL_MATRIX7_ARB */
+   { 16901, 0x00008637 }, /* GL_MATRIX7_NV */
+   { 16915, 0x000088C8 }, /* GL_MATRIX8_ARB */
+   { 16930, 0x000088C9 }, /* GL_MATRIX9_ARB */
+   { 16945, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */
+   { 16971, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+   { 17005, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+   { 17036, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+   { 17069, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+   { 17100, 0x00000BA0 }, /* GL_MATRIX_MODE */
+   { 17115, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */
+   { 17137, 0x00008008 }, /* GL_MAX */
+   { 17144, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */
+   { 17167, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+   { 17199, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */
+   { 17225, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+   { 17258, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+   { 17284, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+   { 17318, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */
+   { 17337, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+   { 17366, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+   { 17398, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */
+   { 17434, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+   { 17470, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */
+   { 17510, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */
+   { 17536, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */
+   { 17566, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */
+   { 17591, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */
+   { 17620, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+   { 17649, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */
+   { 17682, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */
+   { 17702, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */
+   { 17726, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */
+   { 17750, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */
+   { 17774, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */
+   { 17799, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */
+   { 17817, 0x00008008 }, /* GL_MAX_EXT */
+   { 17828, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+   { 17863, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */
+   { 17902, 0x00000D31 }, /* GL_MAX_LIGHTS */
+   { 17916, 0x00000B31 }, /* GL_MAX_LIST_NESTING */
+   { 17936, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+   { 17974, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+   { 18003, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */
+   { 18027, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */
+   { 18055, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */
+   { 18078, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+   { 18115, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+   { 18151, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+   { 18178, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+   { 18207, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+   { 18241, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+   { 18277, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+   { 18304, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+   { 18336, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+   { 18372, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+   { 18401, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+   { 18430, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */
+   { 18458, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+   { 18496, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+   { 18540, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+   { 18583, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+   { 18617, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+   { 18656, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+   { 18693, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+   { 18731, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+   { 18774, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+   { 18817, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+   { 18847, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+   { 18878, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+   { 18914, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+   { 18950, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */
+   { 18980, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+   { 19014, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */
+   { 19047, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+   { 19076, 0x00008D57 }, /* GL_MAX_SAMPLES */
+   { 19091, 0x00008504 }, /* GL_MAX_SHININESS_NV */
+   { 19111, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */
+   { 19135, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */
+   { 19157, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */
+   { 19183, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+   { 19210, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */
+   { 19241, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */
+   { 19265, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+   { 19299, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */
+   { 19319, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */
+   { 19346, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */
+   { 19367, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */
+   { 19392, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */
+   { 19417, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */
+   { 19452, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */
+   { 19474, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */
+   { 19500, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */
+   { 19522, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */
+   { 19548, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+   { 19582, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
+   { 19620, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+   { 19653, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */
+   { 19690, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */
+   { 19714, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */
+   { 19735, 0x00008007 }, /* GL_MIN */
+   { 19742, 0x0000802E }, /* GL_MINMAX */
+   { 19752, 0x0000802E }, /* GL_MINMAX_EXT */
+   { 19766, 0x0000802F }, /* GL_MINMAX_FORMAT */
+   { 19783, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */
+   { 19804, 0x00008030 }, /* GL_MINMAX_SINK */
+   { 19819, 0x00008030 }, /* GL_MINMAX_SINK_EXT */
+   { 19838, 0x00008007 }, /* GL_MIN_EXT */
+   { 19849, 0x00008370 }, /* GL_MIRRORED_REPEAT */
+   { 19868, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */
+   { 19891, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */
+   { 19914, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */
+   { 19934, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */
+   { 19954, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+   { 19984, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */
+   { 20012, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+   { 20040, 0x00001700 }, /* GL_MODELVIEW */
+   { 20053, 0x00001700 }, /* GL_MODELVIEW0_ARB */
+   { 20071, 0x0000872A }, /* GL_MODELVIEW10_ARB */
+   { 20090, 0x0000872B }, /* GL_MODELVIEW11_ARB */
+   { 20109, 0x0000872C }, /* GL_MODELVIEW12_ARB */
+   { 20128, 0x0000872D }, /* GL_MODELVIEW13_ARB */
+   { 20147, 0x0000872E }, /* GL_MODELVIEW14_ARB */
+   { 20166, 0x0000872F }, /* GL_MODELVIEW15_ARB */
+   { 20185, 0x00008730 }, /* GL_MODELVIEW16_ARB */
+   { 20204, 0x00008731 }, /* GL_MODELVIEW17_ARB */
+   { 20223, 0x00008732 }, /* GL_MODELVIEW18_ARB */
+   { 20242, 0x00008733 }, /* GL_MODELVIEW19_ARB */
+   { 20261, 0x0000850A }, /* GL_MODELVIEW1_ARB */
+   { 20279, 0x00008734 }, /* GL_MODELVIEW20_ARB */
+   { 20298, 0x00008735 }, /* GL_MODELVIEW21_ARB */
+   { 20317, 0x00008736 }, /* GL_MODELVIEW22_ARB */
+   { 20336, 0x00008737 }, /* GL_MODELVIEW23_ARB */
+   { 20355, 0x00008738 }, /* GL_MODELVIEW24_ARB */
+   { 20374, 0x00008739 }, /* GL_MODELVIEW25_ARB */
+   { 20393, 0x0000873A }, /* GL_MODELVIEW26_ARB */
+   { 20412, 0x0000873B }, /* GL_MODELVIEW27_ARB */
+   { 20431, 0x0000873C }, /* GL_MODELVIEW28_ARB */
+   { 20450, 0x0000873D }, /* GL_MODELVIEW29_ARB */
+   { 20469, 0x00008722 }, /* GL_MODELVIEW2_ARB */
+   { 20487, 0x0000873E }, /* GL_MODELVIEW30_ARB */
+   { 20506, 0x0000873F }, /* GL_MODELVIEW31_ARB */
+   { 20525, 0x00008723 }, /* GL_MODELVIEW3_ARB */
+   { 20543, 0x00008724 }, /* GL_MODELVIEW4_ARB */
+   { 20561, 0x00008725 }, /* GL_MODELVIEW5_ARB */
+   { 20579, 0x00008726 }, /* GL_MODELVIEW6_ARB */
+   { 20597, 0x00008727 }, /* GL_MODELVIEW7_ARB */
+   { 20615, 0x00008728 }, /* GL_MODELVIEW8_ARB */
+   { 20633, 0x00008729 }, /* GL_MODELVIEW9_ARB */
+   { 20651, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */
+   { 20671, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */
+   { 20698, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */
+   { 20723, 0x00002100 }, /* GL_MODULATE */
+   { 20735, 0x00008744 }, /* GL_MODULATE_ADD_ATI */
+   { 20755, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */
+   { 20782, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */
+   { 20807, 0x00000103 }, /* GL_MULT */
+   { 20815, 0x0000809D }, /* GL_MULTISAMPLE */
+   { 20830, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */
+   { 20850, 0x0000809D }, /* GL_MULTISAMPLE_ARB */
+   { 20869, 0x20000000 }, /* GL_MULTISAMPLE_BIT */
+   { 20888, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */
+   { 20912, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */
+   { 20935, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+   { 20965, 0x00002A25 }, /* GL_N3F_V3F */
+   { 20976, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */
+   { 20996, 0x0000150E }, /* GL_NAND */
+   { 21004, 0x00002600 }, /* GL_NEAREST */
+   { 21015, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+   { 21046, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+   { 21078, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */
+   { 21103, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */
+   { 21129, 0x00000200 }, /* GL_NEVER */
+   { 21138, 0x00001102 }, /* GL_NICEST */
+   { 21148, 0x00000000 }, /* GL_NONE */
+   { 21156, 0x00001505 }, /* GL_NOOP */
+   { 21164, 0x00001508 }, /* GL_NOR */
+   { 21171, 0x00000BA1 }, /* GL_NORMALIZE */
+   { 21184, 0x00008075 }, /* GL_NORMAL_ARRAY */
+   { 21200, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+   { 21231, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */
+   { 21266, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */
+   { 21290, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */
+   { 21313, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */
+   { 21334, 0x00008511 }, /* GL_NORMAL_MAP */
+   { 21348, 0x00008511 }, /* GL_NORMAL_MAP_ARB */
+   { 21366, 0x00008511 }, /* GL_NORMAL_MAP_NV */
+   { 21383, 0x00000205 }, /* GL_NOTEQUAL */
+   { 21395, 0x00000000 }, /* GL_NO_ERROR */
+   { 21407, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+   { 21441, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */
+   { 21479, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */
+   { 21511, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */
+   { 21553, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */
+   { 21583, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */
+   { 21623, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */
+   { 21654, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */
+   { 21683, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */
+   { 21711, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */
+   { 21741, 0x00002401 }, /* GL_OBJECT_LINEAR */
+   { 21758, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */
+   { 21784, 0x00002501 }, /* GL_OBJECT_PLANE */
+   { 21800, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */
+   { 21835, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */
+   { 21857, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */
+   { 21876, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */
+   { 21906, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */
+   { 21927, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */
+   { 21955, 0x00000001 }, /* GL_ONE */
+   { 21962, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+   { 21990, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */
+   { 22022, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */
+   { 22050, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */
+   { 22082, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */
+   { 22105, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */
+   { 22128, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */
+   { 22151, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */
+   { 22174, 0x00008598 }, /* GL_OPERAND0_ALPHA */
+   { 22192, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */
+   { 22214, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */
+   { 22236, 0x00008590 }, /* GL_OPERAND0_RGB */
+   { 22252, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */
+   { 22272, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */
+   { 22292, 0x00008599 }, /* GL_OPERAND1_ALPHA */
+   { 22310, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */
+   { 22332, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */
+   { 22354, 0x00008591 }, /* GL_OPERAND1_RGB */
+   { 22370, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */
+   { 22390, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */
+   { 22410, 0x0000859A }, /* GL_OPERAND2_ALPHA */
+   { 22428, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */
+   { 22450, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */
+   { 22472, 0x00008592 }, /* GL_OPERAND2_RGB */
+   { 22488, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */
+   { 22508, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */
+   { 22528, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */
+   { 22549, 0x00008593 }, /* GL_OPERAND3_RGB_NV */
+   { 22568, 0x00001507 }, /* GL_OR */
+   { 22574, 0x00000A01 }, /* GL_ORDER */
+   { 22583, 0x0000150D }, /* GL_OR_INVERTED */
+   { 22598, 0x0000150B }, /* GL_OR_REVERSE */
+   { 22612, 0x00000505 }, /* GL_OUT_OF_MEMORY */
+   { 22629, 0x00000D05 }, /* GL_PACK_ALIGNMENT */
+   { 22647, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */
+   { 22668, 0x00008758 }, /* GL_PACK_INVERT_MESA */
+   { 22688, 0x00000D01 }, /* GL_PACK_LSB_FIRST */
+   { 22706, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */
+   { 22725, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */
+   { 22745, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */
+   { 22765, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */
+   { 22783, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */
+   { 22802, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */
+   { 22827, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */
+   { 22851, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */
+   { 22872, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */
+   { 22894, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */
+   { 22916, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */
+   { 22941, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */
+   { 22965, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */
+   { 22986, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */
+   { 23008, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */
+   { 23030, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */
+   { 23052, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */
+   { 23083, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */
+   { 23103, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+   { 23128, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */
+   { 23148, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+   { 23173, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */
+   { 23193, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+   { 23218, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */
+   { 23238, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+   { 23263, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */
+   { 23283, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+   { 23308, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */
+   { 23328, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+   { 23353, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */
+   { 23373, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+   { 23398, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */
+   { 23418, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+   { 23443, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */
+   { 23463, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+   { 23488, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */
+   { 23508, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+   { 23533, 0x00000020 }, /* GL_PIXEL_MODE_BIT */
+   { 23551, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */
+   { 23572, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */
+   { 23601, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */
+   { 23634, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */
+   { 23659, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */
+   { 23682, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+   { 23713, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */
+   { 23748, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */
+   { 23775, 0x00001B00 }, /* GL_POINT */
+   { 23784, 0x00000000 }, /* GL_POINTS */
+   { 23794, 0x00000002 }, /* GL_POINT_BIT */
+   { 23807, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */
+   { 23837, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */
+   { 23871, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */
+   { 23905, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */
+   { 23940, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */
+   { 23969, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */
+   { 24002, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */
+   { 24035, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */
+   { 24069, 0x00000B11 }, /* GL_POINT_SIZE */
+   { 24083, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */
+   { 24109, 0x00008127 }, /* GL_POINT_SIZE_MAX */
+   { 24127, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */
+   { 24149, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */
+   { 24171, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */
+   { 24194, 0x00008126 }, /* GL_POINT_SIZE_MIN */
+   { 24212, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */
+   { 24234, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */
+   { 24256, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */
+   { 24279, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */
+   { 24299, 0x00000B10 }, /* GL_POINT_SMOOTH */
+   { 24315, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */
+   { 24336, 0x00008861 }, /* GL_POINT_SPRITE */
+   { 24352, 0x00008861 }, /* GL_POINT_SPRITE_ARB */
+   { 24372, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */
+   { 24401, 0x00008861 }, /* GL_POINT_SPRITE_NV */
+   { 24420, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */
+   { 24446, 0x00000701 }, /* GL_POINT_TOKEN */
+   { 24461, 0x00000009 }, /* GL_POLYGON */
+   { 24472, 0x00000008 }, /* GL_POLYGON_BIT */
+   { 24487, 0x00000B40 }, /* GL_POLYGON_MODE */
+   { 24503, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */
+   { 24526, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */
+   { 24551, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */
+   { 24574, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */
+   { 24597, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */
+   { 24621, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */
+   { 24645, 0x00000B41 }, /* GL_POLYGON_SMOOTH */
+   { 24663, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */
+   { 24686, 0x00000B42 }, /* GL_POLYGON_STIPPLE */
+   { 24705, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */
+   { 24728, 0x00000703 }, /* GL_POLYGON_TOKEN */
+   { 24745, 0x00001203 }, /* GL_POSITION */
+   { 24757, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+   { 24789, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */
+   { 24825, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+   { 24858, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */
+   { 24895, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+   { 24926, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */
+   { 24961, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+   { 24993, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */
+   { 25029, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+   { 25062, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+   { 25094, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */
+   { 25130, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+   { 25163, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */
+   { 25200, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+   { 25230, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */
+   { 25264, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+   { 25295, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */
+   { 25330, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+   { 25361, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */
+   { 25396, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+   { 25428, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */
+   { 25464, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+   { 25494, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */
+   { 25528, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+   { 25559, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */
+   { 25594, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+   { 25626, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+   { 25657, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */
+   { 25692, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+   { 25724, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */
+   { 25760, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */
+   { 25789, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */
+   { 25822, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */
+   { 25852, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */
+   { 25886, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+   { 25925, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+   { 25958, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+   { 25998, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+   { 26032, 0x00008578 }, /* GL_PREVIOUS */
+   { 26044, 0x00008578 }, /* GL_PREVIOUS_ARB */
+   { 26060, 0x00008578 }, /* GL_PREVIOUS_EXT */
+   { 26076, 0x00008577 }, /* GL_PRIMARY_COLOR */
+   { 26093, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */
+   { 26114, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */
+   { 26135, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+   { 26168, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+   { 26200, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */
+   { 26223, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */
+   { 26246, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */
+   { 26276, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */
+   { 26305, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */
+   { 26333, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */
+   { 26355, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+   { 26383, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+   { 26411, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */
+   { 26433, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */
+   { 26454, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+   { 26494, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+   { 26533, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+   { 26563, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+   { 26598, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+   { 26631, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+   { 26665, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+   { 26704, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+   { 26743, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */
+   { 26765, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */
+   { 26791, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */
+   { 26815, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */
+   { 26838, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */
+   { 26860, 0x00008628 }, /* GL_PROGRAM_STRING_NV */
+   { 26881, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */
+   { 26902, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */
+   { 26929, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+   { 26961, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+   { 26993, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+   { 27028, 0x00001701 }, /* GL_PROJECTION */
+   { 27042, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */
+   { 27063, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */
+   { 27089, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */
+   { 27110, 0x00008025 }, /* GL_PROXY_HISTOGRAM */
+   { 27129, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */
+   { 27152, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+   { 27191, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+   { 27229, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */
+   { 27249, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+   { 27279, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */
+   { 27303, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */
+   { 27323, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+   { 27353, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */
+   { 27377, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */
+   { 27397, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+   { 27430, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */
+   { 27456, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */
+   { 27486, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+   { 27517, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */
+   { 27547, 0x00002003 }, /* GL_Q */
+   { 27552, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */
+   { 27577, 0x00000007 }, /* GL_QUADS */
+   { 27586, 0x00008614 }, /* GL_QUAD_MESH_SUN */
+   { 27603, 0x00000008 }, /* GL_QUAD_STRIP */
+   { 27617, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */
+   { 27639, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */
+   { 27665, 0x00008866 }, /* GL_QUERY_RESULT */
+   { 27681, 0x00008866 }, /* GL_QUERY_RESULT_ARB */
+   { 27701, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */
+   { 27727, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */
+   { 27757, 0x00002002 }, /* GL_R */
+   { 27762, 0x00002A10 }, /* GL_R3_G3_B2 */
+   { 27774, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+   { 27807, 0x00000C02 }, /* GL_READ_BUFFER */
+   { 27822, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */
+   { 27842, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
+   { 27874, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */
+   { 27898, 0x000088B8 }, /* GL_READ_ONLY */
+   { 27911, 0x000088B8 }, /* GL_READ_ONLY_ARB */
+   { 27928, 0x000088BA }, /* GL_READ_WRITE */
+   { 27942, 0x000088BA }, /* GL_READ_WRITE_ARB */
+   { 27960, 0x00001903 }, /* GL_RED */
+   { 27967, 0x00008016 }, /* GL_REDUCE */
+   { 27977, 0x00008016 }, /* GL_REDUCE_EXT */
+   { 27991, 0x00000D15 }, /* GL_RED_BIAS */
+   { 28003, 0x00000D52 }, /* GL_RED_BITS */
+   { 28015, 0x00000D14 }, /* GL_RED_SCALE */
+   { 28028, 0x00008512 }, /* GL_REFLECTION_MAP */
+   { 28046, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */
+   { 28068, 0x00008512 }, /* GL_REFLECTION_MAP_NV */
+   { 28089, 0x00001C00 }, /* GL_RENDER */
+   { 28099, 0x00008D41 }, /* GL_RENDERBUFFER */
+   { 28115, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */
+   { 28142, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */
+   { 28170, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */
+   { 28196, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */
+   { 28223, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */
+   { 28243, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */
+   { 28270, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */
+   { 28293, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */
+   { 28320, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+   { 28352, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */
+   { 28388, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */
+   { 28413, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */
+   { 28437, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */
+   { 28466, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */
+   { 28488, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */
+   { 28514, 0x00001F01 }, /* GL_RENDERER */
+   { 28526, 0x00000C40 }, /* GL_RENDER_MODE */
+   { 28541, 0x00002901 }, /* GL_REPEAT */
+   { 28551, 0x00001E01 }, /* GL_REPLACE */
+   { 28562, 0x00008062 }, /* GL_REPLACE_EXT */
+   { 28577, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */
+   { 28600, 0x0000803A }, /* GL_RESCALE_NORMAL */
+   { 28618, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */
+   { 28640, 0x00000102 }, /* GL_RETURN */
+   { 28650, 0x00001907 }, /* GL_RGB */
+   { 28657, 0x00008052 }, /* GL_RGB10 */
+   { 28666, 0x00008059 }, /* GL_RGB10_A2 */
+   { 28678, 0x00008059 }, /* GL_RGB10_A2_EXT */
+   { 28694, 0x00008052 }, /* GL_RGB10_EXT */
+   { 28707, 0x00008053 }, /* GL_RGB12 */
+   { 28716, 0x00008053 }, /* GL_RGB12_EXT */
+   { 28729, 0x00008054 }, /* GL_RGB16 */
+   { 28738, 0x00008054 }, /* GL_RGB16_EXT */
+   { 28751, 0x0000804E }, /* GL_RGB2_EXT */
+   { 28763, 0x0000804F }, /* GL_RGB4 */
+   { 28771, 0x0000804F }, /* GL_RGB4_EXT */
+   { 28783, 0x000083A1 }, /* GL_RGB4_S3TC */
+   { 28796, 0x00008050 }, /* GL_RGB5 */
+   { 28804, 0x00008057 }, /* GL_RGB5_A1 */
+   { 28815, 0x00008057 }, /* GL_RGB5_A1_EXT */
+   { 28830, 0x00008050 }, /* GL_RGB5_EXT */
+   { 28842, 0x00008051 }, /* GL_RGB8 */
+   { 28850, 0x00008051 }, /* GL_RGB8_EXT */
+   { 28862, 0x00001908 }, /* GL_RGBA */
+   { 28870, 0x0000805A }, /* GL_RGBA12 */
+   { 28880, 0x0000805A }, /* GL_RGBA12_EXT */
+   { 28894, 0x0000805B }, /* GL_RGBA16 */
+   { 28904, 0x0000805B }, /* GL_RGBA16_EXT */
+   { 28918, 0x00008055 }, /* GL_RGBA2 */
+   { 28927, 0x00008055 }, /* GL_RGBA2_EXT */
+   { 28940, 0x00008056 }, /* GL_RGBA4 */
+   { 28949, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */
+   { 28968, 0x00008056 }, /* GL_RGBA4_EXT */
+   { 28981, 0x000083A3 }, /* GL_RGBA4_S3TC */
+   { 28995, 0x00008058 }, /* GL_RGBA8 */
+   { 29004, 0x00008058 }, /* GL_RGBA8_EXT */
+   { 29017, 0x00008F97 }, /* GL_RGBA8_SNORM */
+   { 29032, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */
+   { 29050, 0x00000C31 }, /* GL_RGBA_MODE */
+   { 29063, 0x000083A2 }, /* GL_RGBA_S3TC */
+   { 29076, 0x00008F93 }, /* GL_RGBA_SNORM */
+   { 29090, 0x000083A0 }, /* GL_RGB_S3TC */
+   { 29102, 0x00008573 }, /* GL_RGB_SCALE */
+   { 29115, 0x00008573 }, /* GL_RGB_SCALE_ARB */
+   { 29132, 0x00008573 }, /* GL_RGB_SCALE_EXT */
+   { 29149, 0x00000407 }, /* GL_RIGHT */
+   { 29158, 0x00002000 }, /* GL_S */
+   { 29163, 0x00008B5D }, /* GL_SAMPLER_1D */
+   { 29177, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */
+   { 29198, 0x00008B5E }, /* GL_SAMPLER_2D */
+   { 29212, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */
+   { 29233, 0x00008B5F }, /* GL_SAMPLER_3D */
+   { 29247, 0x00008B60 }, /* GL_SAMPLER_CUBE */
+   { 29263, 0x000080A9 }, /* GL_SAMPLES */
+   { 29274, 0x000086B4 }, /* GL_SAMPLES_3DFX */
+   { 29290, 0x000080A9 }, /* GL_SAMPLES_ARB */
+   { 29305, 0x00008914 }, /* GL_SAMPLES_PASSED */
+   { 29323, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */
+   { 29345, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+   { 29373, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */
+   { 29405, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */
+   { 29428, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */
+   { 29455, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */
+   { 29473, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */
+   { 29496, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */
+   { 29518, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */
+   { 29537, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */
+   { 29560, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */
+   { 29586, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */
+   { 29616, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */
+   { 29641, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */
+   { 29670, 0x00080000 }, /* GL_SCISSOR_BIT */
+   { 29685, 0x00000C10 }, /* GL_SCISSOR_BOX */
+   { 29700, 0x00000C11 }, /* GL_SCISSOR_TEST */
+   { 29716, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */
+   { 29741, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+   { 29781, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */
+   { 29825, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+   { 29858, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+   { 29888, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+   { 29920, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+   { 29950, 0x00001C02 }, /* GL_SELECT */
+   { 29960, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */
+   { 29988, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */
+   { 30013, 0x00008012 }, /* GL_SEPARABLE_2D */
+   { 30029, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */
+   { 30056, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */
+   { 30087, 0x0000150F }, /* GL_SET */
+   { 30094, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */
+   { 30115, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */
+   { 30139, 0x00008B4F }, /* GL_SHADER_TYPE */
+   { 30154, 0x00000B54 }, /* GL_SHADE_MODEL */
+   { 30169, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */
+   { 30197, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */
+   { 30220, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+   { 30250, 0x00001601 }, /* GL_SHININESS */
+   { 30263, 0x00001402 }, /* GL_SHORT */
+   { 30272, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */
+   { 30293, 0x000081F9 }, /* GL_SINGLE_COLOR */
+   { 30309, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */
+   { 30329, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */
+   { 30348, 0x00008C46 }, /* GL_SLUMINANCE */
+   { 30362, 0x00008C47 }, /* GL_SLUMINANCE8 */
+   { 30377, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */
+   { 30399, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */
+   { 30419, 0x00001D01 }, /* GL_SMOOTH */
+   { 30429, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */
+   { 30462, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */
+   { 30489, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */
+   { 30522, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */
+   { 30549, 0x00008588 }, /* GL_SOURCE0_ALPHA */
+   { 30566, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */
+   { 30587, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */
+   { 30608, 0x00008580 }, /* GL_SOURCE0_RGB */
+   { 30623, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */
+   { 30642, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */
+   { 30661, 0x00008589 }, /* GL_SOURCE1_ALPHA */
+   { 30678, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */
+   { 30699, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */
+   { 30720, 0x00008581 }, /* GL_SOURCE1_RGB */
+   { 30735, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */
+   { 30754, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */
+   { 30773, 0x0000858A }, /* GL_SOURCE2_ALPHA */
+   { 30790, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */
+   { 30811, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */
+   { 30832, 0x00008582 }, /* GL_SOURCE2_RGB */
+   { 30847, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */
+   { 30866, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */
+   { 30885, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */
+   { 30905, 0x00008583 }, /* GL_SOURCE3_RGB_NV */
+   { 30923, 0x00001202 }, /* GL_SPECULAR */
+   { 30935, 0x00002402 }, /* GL_SPHERE_MAP */
+   { 30949, 0x00001206 }, /* GL_SPOT_CUTOFF */
+   { 30964, 0x00001204 }, /* GL_SPOT_DIRECTION */
+   { 30982, 0x00001205 }, /* GL_SPOT_EXPONENT */
+   { 30999, 0x00008588 }, /* GL_SRC0_ALPHA */
+   { 31013, 0x00008580 }, /* GL_SRC0_RGB */
+   { 31025, 0x00008589 }, /* GL_SRC1_ALPHA */
+   { 31039, 0x00008581 }, /* GL_SRC1_RGB */
+   { 31051, 0x0000858A }, /* GL_SRC2_ALPHA */
+   { 31065, 0x00008582 }, /* GL_SRC2_RGB */
+   { 31077, 0x00000302 }, /* GL_SRC_ALPHA */
+   { 31090, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */
+   { 31112, 0x00000300 }, /* GL_SRC_COLOR */
+   { 31125, 0x00008C40 }, /* GL_SRGB */
+   { 31133, 0x00008C41 }, /* GL_SRGB8 */
+   { 31142, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */
+   { 31158, 0x00008C42 }, /* GL_SRGB_ALPHA */
+   { 31172, 0x00000503 }, /* GL_STACK_OVERFLOW */
+   { 31190, 0x00000504 }, /* GL_STACK_UNDERFLOW */
+   { 31209, 0x000088E6 }, /* GL_STATIC_COPY */
+   { 31224, 0x000088E6 }, /* GL_STATIC_COPY_ARB */
+   { 31243, 0x000088E4 }, /* GL_STATIC_DRAW */
+   { 31258, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */
+   { 31277, 0x000088E5 }, /* GL_STATIC_READ */
+   { 31292, 0x000088E5 }, /* GL_STATIC_READ_ARB */
+   { 31311, 0x00001802 }, /* GL_STENCIL */
+   { 31322, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */
+   { 31344, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */
+   { 31370, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */
+   { 31391, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */
+   { 31416, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */
+   { 31437, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */
+   { 31462, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+   { 31494, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */
+   { 31530, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+   { 31562, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */
+   { 31598, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */
+   { 31618, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */
+   { 31645, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */
+   { 31671, 0x00000D57 }, /* GL_STENCIL_BITS */
+   { 31687, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */
+   { 31709, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */
+   { 31732, 0x00000B94 }, /* GL_STENCIL_FAIL */
+   { 31748, 0x00000B92 }, /* GL_STENCIL_FUNC */
+   { 31764, 0x00001901 }, /* GL_STENCIL_INDEX */
+   { 31781, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */
+   { 31804, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */
+   { 31826, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */
+   { 31848, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */
+   { 31870, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */
+   { 31891, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */
+   { 31918, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */
+   { 31945, 0x00000B97 }, /* GL_STENCIL_REF */
+   { 31960, 0x00000B90 }, /* GL_STENCIL_TEST */
+   { 31976, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+   { 32005, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */
+   { 32027, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */
+   { 32048, 0x00000C33 }, /* GL_STEREO */
+   { 32058, 0x000088E2 }, /* GL_STREAM_COPY */
+   { 32073, 0x000088E2 }, /* GL_STREAM_COPY_ARB */
+   { 32092, 0x000088E0 }, /* GL_STREAM_DRAW */
+   { 32107, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */
+   { 32126, 0x000088E1 }, /* GL_STREAM_READ */
+   { 32141, 0x000088E1 }, /* GL_STREAM_READ_ARB */
+   { 32160, 0x00000D50 }, /* GL_SUBPIXEL_BITS */
+   { 32177, 0x000084E7 }, /* GL_SUBTRACT */
+   { 32189, 0x000084E7 }, /* GL_SUBTRACT_ARB */
+   { 32205, 0x00002001 }, /* GL_T */
+   { 32210, 0x00002A2A }, /* GL_T2F_C3F_V3F */
+   { 32225, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */
+   { 32244, 0x00002A29 }, /* GL_T2F_C4UB_V3F */
+   { 32260, 0x00002A2B }, /* GL_T2F_N3F_V3F */
+   { 32275, 0x00002A27 }, /* GL_T2F_V3F */
+   { 32286, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */
+   { 32305, 0x00002A28 }, /* GL_T4F_V4F */
+   { 32316, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */
+   { 32339, 0x00001702 }, /* GL_TEXTURE */
+   { 32350, 0x000084C0 }, /* GL_TEXTURE0 */
+   { 32362, 0x000084C0 }, /* GL_TEXTURE0_ARB */
+   { 32378, 0x000084C1 }, /* GL_TEXTURE1 */
+   { 32390, 0x000084CA }, /* GL_TEXTURE10 */
+   { 32403, 0x000084CA }, /* GL_TEXTURE10_ARB */
+   { 32420, 0x000084CB }, /* GL_TEXTURE11 */
+   { 32433, 0x000084CB }, /* GL_TEXTURE11_ARB */
+   { 32450, 0x000084CC }, /* GL_TEXTURE12 */
+   { 32463, 0x000084CC }, /* GL_TEXTURE12_ARB */
+   { 32480, 0x000084CD }, /* GL_TEXTURE13 */
+   { 32493, 0x000084CD }, /* GL_TEXTURE13_ARB */
+   { 32510, 0x000084CE }, /* GL_TEXTURE14 */
+   { 32523, 0x000084CE }, /* GL_TEXTURE14_ARB */
+   { 32540, 0x000084CF }, /* GL_TEXTURE15 */
+   { 32553, 0x000084CF }, /* GL_TEXTURE15_ARB */
+   { 32570, 0x000084D0 }, /* GL_TEXTURE16 */
+   { 32583, 0x000084D0 }, /* GL_TEXTURE16_ARB */
+   { 32600, 0x000084D1 }, /* GL_TEXTURE17 */
+   { 32613, 0x000084D1 }, /* GL_TEXTURE17_ARB */
+   { 32630, 0x000084D2 }, /* GL_TEXTURE18 */
+   { 32643, 0x000084D2 }, /* GL_TEXTURE18_ARB */
+   { 32660, 0x000084D3 }, /* GL_TEXTURE19 */
+   { 32673, 0x000084D3 }, /* GL_TEXTURE19_ARB */
+   { 32690, 0x000084C1 }, /* GL_TEXTURE1_ARB */
+   { 32706, 0x000084C2 }, /* GL_TEXTURE2 */
+   { 32718, 0x000084D4 }, /* GL_TEXTURE20 */
+   { 32731, 0x000084D4 }, /* GL_TEXTURE20_ARB */
+   { 32748, 0x000084D5 }, /* GL_TEXTURE21 */
+   { 32761, 0x000084D5 }, /* GL_TEXTURE21_ARB */
+   { 32778, 0x000084D6 }, /* GL_TEXTURE22 */
+   { 32791, 0x000084D6 }, /* GL_TEXTURE22_ARB */
+   { 32808, 0x000084D7 }, /* GL_TEXTURE23 */
+   { 32821, 0x000084D7 }, /* GL_TEXTURE23_ARB */
+   { 32838, 0x000084D8 }, /* GL_TEXTURE24 */
+   { 32851, 0x000084D8 }, /* GL_TEXTURE24_ARB */
+   { 32868, 0x000084D9 }, /* GL_TEXTURE25 */
+   { 32881, 0x000084D9 }, /* GL_TEXTURE25_ARB */
+   { 32898, 0x000084DA }, /* GL_TEXTURE26 */
+   { 32911, 0x000084DA }, /* GL_TEXTURE26_ARB */
+   { 32928, 0x000084DB }, /* GL_TEXTURE27 */
+   { 32941, 0x000084DB }, /* GL_TEXTURE27_ARB */
+   { 32958, 0x000084DC }, /* GL_TEXTURE28 */
+   { 32971, 0x000084DC }, /* GL_TEXTURE28_ARB */
+   { 32988, 0x000084DD }, /* GL_TEXTURE29 */
+   { 33001, 0x000084DD }, /* GL_TEXTURE29_ARB */
+   { 33018, 0x000084C2 }, /* GL_TEXTURE2_ARB */
+   { 33034, 0x000084C3 }, /* GL_TEXTURE3 */
+   { 33046, 0x000084DE }, /* GL_TEXTURE30 */
+   { 33059, 0x000084DE }, /* GL_TEXTURE30_ARB */
+   { 33076, 0x000084DF }, /* GL_TEXTURE31 */
+   { 33089, 0x000084DF }, /* GL_TEXTURE31_ARB */
+   { 33106, 0x000084C3 }, /* GL_TEXTURE3_ARB */
+   { 33122, 0x000084C4 }, /* GL_TEXTURE4 */
+   { 33134, 0x000084C4 }, /* GL_TEXTURE4_ARB */
+   { 33150, 0x000084C5 }, /* GL_TEXTURE5 */
+   { 33162, 0x000084C5 }, /* GL_TEXTURE5_ARB */
+   { 33178, 0x000084C6 }, /* GL_TEXTURE6 */
+   { 33190, 0x000084C6 }, /* GL_TEXTURE6_ARB */
+   { 33206, 0x000084C7 }, /* GL_TEXTURE7 */
+   { 33218, 0x000084C7 }, /* GL_TEXTURE7_ARB */
+   { 33234, 0x000084C8 }, /* GL_TEXTURE8 */
+   { 33246, 0x000084C8 }, /* GL_TEXTURE8_ARB */
+   { 33262, 0x000084C9 }, /* GL_TEXTURE9 */
+   { 33274, 0x000084C9 }, /* GL_TEXTURE9_ARB */
+   { 33290, 0x00000DE0 }, /* GL_TEXTURE_1D */
+   { 33304, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */
+   { 33328, 0x00000DE1 }, /* GL_TEXTURE_2D */
+   { 33342, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */
+   { 33366, 0x0000806F }, /* GL_TEXTURE_3D */
+   { 33380, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */
+   { 33402, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */
+   { 33428, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */
+   { 33450, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */
+   { 33472, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+   { 33504, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */
+   { 33526, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+   { 33558, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */
+   { 33580, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */
+   { 33608, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */
+   { 33640, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+   { 33673, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */
+   { 33705, 0x00040000 }, /* GL_TEXTURE_BIT */
+   { 33720, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */
+   { 33741, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */
+   { 33766, 0x00001005 }, /* GL_TEXTURE_BORDER */
+   { 33784, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */
+   { 33808, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+   { 33839, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+   { 33869, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+   { 33899, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+   { 33934, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+   { 33965, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+   { 34003, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */
+   { 34030, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+   { 34062, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+   { 34096, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */
+   { 34120, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */
+   { 34148, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */
+   { 34172, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */
+   { 34200, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+   { 34233, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */
+   { 34257, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */
+   { 34279, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */
+   { 34301, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */
+   { 34327, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */
+   { 34361, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+   { 34394, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */
+   { 34431, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */
+   { 34459, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */
+   { 34491, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */
+   { 34514, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+   { 34552, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */
+   { 34594, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+   { 34625, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+   { 34653, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+   { 34683, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+   { 34711, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */
+   { 34731, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */
+   { 34755, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+   { 34786, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */
+   { 34821, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+   { 34852, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */
+   { 34887, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+   { 34918, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */
+   { 34953, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+   { 34984, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */
+   { 35019, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+   { 35050, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */
+   { 35085, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+   { 35116, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */
+   { 35151, 0x00008071 }, /* GL_TEXTURE_DEPTH */
+   { 35168, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */
+   { 35190, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */
+   { 35216, 0x00002300 }, /* GL_TEXTURE_ENV */
+   { 35231, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */
+   { 35252, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */
+   { 35272, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */
+   { 35298, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */
+   { 35318, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */
+   { 35335, 0x00000C62 }, /* GL_TEXTURE_GEN_R */
+   { 35352, 0x00000C60 }, /* GL_TEXTURE_GEN_S */
+   { 35369, 0x00000C61 }, /* GL_TEXTURE_GEN_T */
+   { 35386, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */
+   { 35411, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */
+   { 35433, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */
+   { 35459, 0x00001001 }, /* GL_TEXTURE_HEIGHT */
+   { 35477, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */
+   { 35503, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */
+   { 35529, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */
+   { 35559, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */
+   { 35586, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */
+   { 35611, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */
+   { 35631, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */
+   { 35655, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+   { 35682, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+   { 35709, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+   { 35736, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */
+   { 35762, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */
+   { 35792, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */
+   { 35814, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */
+   { 35832, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+   { 35862, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+   { 35890, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+   { 35918, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+   { 35946, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */
+   { 35967, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */
+   { 35986, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */
+   { 36008, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */
+   { 36027, 0x00008066 }, /* GL_TEXTURE_PRIORITY */
+   { 36047, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */
+   { 36072, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */
+   { 36096, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */
+   { 36116, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */
+   { 36140, 0x00008067 }, /* GL_TEXTURE_RESIDENT */
+   { 36160, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */
+   { 36183, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */
+   { 36207, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */
+   { 36232, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+   { 36266, 0x00001000 }, /* GL_TEXTURE_WIDTH */
+   { 36283, 0x00008072 }, /* GL_TEXTURE_WRAP_R */
+   { 36301, 0x00002802 }, /* GL_TEXTURE_WRAP_S */
+   { 36319, 0x00002803 }, /* GL_TEXTURE_WRAP_T */
+   { 36337, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */
+   { 36357, 0x00008648 }, /* GL_TRACK_MATRIX_NV */
+   { 36376, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+   { 36405, 0x00001000 }, /* GL_TRANSFORM_BIT */
+   { 36422, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */
+   { 36448, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */
+   { 36478, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+   { 36510, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+   { 36540, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */
+   { 36574, 0x0000862C }, /* GL_TRANSPOSE_NV */
+   { 36590, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+   { 36621, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */
+   { 36656, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+   { 36684, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */
+   { 36716, 0x00000004 }, /* GL_TRIANGLES */
+   { 36729, 0x00000006 }, /* GL_TRIANGLE_FAN */
+   { 36745, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */
+   { 36766, 0x00000005 }, /* GL_TRIANGLE_STRIP */
+   { 36784, 0x00000001 }, /* GL_TRUE */
+   { 36792, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */
+   { 36812, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */
+   { 36835, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */
+   { 36855, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */
+   { 36876, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */
+   { 36898, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */
+   { 36920, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */
+   { 36940, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */
+   { 36961, 0x00001401 }, /* GL_UNSIGNED_BYTE */
+   { 36978, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+   { 37005, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */
+   { 37028, 0x00001405 }, /* GL_UNSIGNED_INT */
+   { 37044, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */
+   { 37071, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */
+   { 37092, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */
+   { 37116, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+   { 37147, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */
+   { 37171, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+   { 37199, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */
+   { 37222, 0x00001403 }, /* GL_UNSIGNED_SHORT */
+   { 37240, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+   { 37270, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+   { 37296, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+   { 37326, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+   { 37352, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */
+   { 37376, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+   { 37404, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+   { 37432, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */
+   { 37459, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+   { 37491, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */
+   { 37522, 0x00008CA2 }, /* GL_UPPER_LEFT */
+   { 37536, 0x00002A20 }, /* GL_V2F */
+   { 37543, 0x00002A21 }, /* GL_V3F */
+   { 37550, 0x00008B83 }, /* GL_VALIDATE_STATUS */
+   { 37569, 0x00001F00 }, /* GL_VENDOR */
+   { 37579, 0x00001F02 }, /* GL_VERSION */
+   { 37590, 0x00008074 }, /* GL_VERTEX_ARRAY */
+   { 37606, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */
+   { 37636, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+   { 37667, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */
+   { 37702, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */
+   { 37726, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */
+   { 37747, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */
+   { 37770, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */
+   { 37791, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+   { 37818, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+   { 37846, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+   { 37874, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+   { 37902, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+   { 37930, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+   { 37958, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+   { 37986, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+   { 38013, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+   { 38040, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+   { 38067, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+   { 38094, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+   { 38121, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+   { 38148, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+   { 38175, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+   { 38202, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+   { 38229, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+   { 38267, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */
+   { 38309, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+   { 38340, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */
+   { 38375, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+   { 38409, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */
+   { 38447, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+   { 38478, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */
+   { 38513, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+   { 38541, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */
+   { 38573, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+   { 38603, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */
+   { 38637, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+   { 38665, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */
+   { 38697, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */
+   { 38717, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */
+   { 38739, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */
+   { 38768, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */
+   { 38789, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+   { 38818, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */
+   { 38851, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */
+   { 38883, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+   { 38910, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */
+   { 38941, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */
+   { 38971, 0x00008B31 }, /* GL_VERTEX_SHADER */
+   { 38988, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */
+   { 39009, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */
+   { 39036, 0x00000BA2 }, /* GL_VIEWPORT */
+   { 39048, 0x00000800 }, /* GL_VIEWPORT_BIT */
+   { 39064, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */
+   { 39084, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+   { 39115, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */
+   { 39150, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+   { 39178, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+   { 39203, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+   { 39230, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+   { 39255, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */
+   { 39279, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */
+   { 39298, 0x000088B9 }, /* GL_WRITE_ONLY */
+   { 39312, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */
+   { 39330, 0x00001506 }, /* GL_XOR */
+   { 39337, 0x000085B9 }, /* GL_YCBCR_422_APPLE */
+   { 39356, 0x00008757 }, /* GL_YCBCR_MESA */
+   { 39370, 0x00000000 }, /* GL_ZERO */
+   { 39378, 0x00000D16 }, /* GL_ZOOM_X */
+   { 39388, 0x00000D17 }, /* GL_ZOOM_Y */
 };
 
-static const unsigned reduced_enums[1316] =
+static const unsigned reduced_enums[1319] =
 {
-       463, /* GL_FALSE */
-       695, /* GL_LINES */
-       697, /* GL_LINE_LOOP */
-       704, /* GL_LINE_STRIP */
-      1707, /* GL_TRIANGLES */
-      1710, /* GL_TRIANGLE_STRIP */
-      1708, /* GL_TRIANGLE_FAN */
-      1262, /* GL_QUADS */
-      1264, /* GL_QUAD_STRIP */
-      1150, /* GL_POLYGON */
-      1162, /* GL_POLYGON_STIPPLE_BIT */
-      1115, /* GL_PIXEL_MODE_BIT */
-       682, /* GL_LIGHTING_BIT */
-       485, /* GL_FOG_BIT */
+       469, /* GL_FALSE */
+       683, /* GL_LINES */
+       685, /* GL_LINE_LOOP */
+       692, /* GL_LINE_STRIP */
+      1709, /* GL_TRIANGLES */
+      1712, /* GL_TRIANGLE_STRIP */
+      1710, /* GL_TRIANGLE_FAN */
+      1254, /* GL_QUADS */
+      1256, /* GL_QUAD_STRIP */
+      1142, /* GL_POLYGON */
+      1154, /* GL_POLYGON_STIPPLE_BIT */
+      1103, /* GL_PIXEL_MODE_BIT */
+       670, /* GL_LIGHTING_BIT */
+       497, /* GL_FOG_BIT */
          8, /* GL_ACCUM */
-       714, /* GL_LOAD */
-      1316, /* GL_RETURN */
-       988, /* GL_MULT */
+       702, /* GL_LOAD */
+      1308, /* GL_RETURN */
+       976, /* GL_MULT */
         23, /* GL_ADD */
-      1004, /* GL_NEVER */
-       672, /* GL_LESS */
-       453, /* GL_EQUAL */
-       671, /* GL_LEQUAL */
-       595, /* GL_GREATER */
-      1019, /* GL_NOTEQUAL */
-       570, /* GL_GEQUAL */
+       992, /* GL_NEVER */
+       660, /* GL_LESS */
+       459, /* GL_EQUAL */
+       659, /* GL_LEQUAL */
+       583, /* GL_GREATER */
+      1007, /* GL_NOTEQUAL */
+       582, /* GL_GEQUAL */
         46, /* GL_ALWAYS */
-      1449, /* GL_SRC_COLOR */
-      1048, /* GL_ONE_MINUS_SRC_COLOR */
-      1447, /* GL_SRC_ALPHA */
-      1047, /* GL_ONE_MINUS_SRC_ALPHA */
-       432, /* GL_DST_ALPHA */
-      1045, /* GL_ONE_MINUS_DST_ALPHA */
-       433, /* GL_DST_COLOR */
-      1046, /* GL_ONE_MINUS_DST_COLOR */
-      1448, /* GL_SRC_ALPHA_SATURATE */
-       558, /* GL_FRONT_LEFT */
-       559, /* GL_FRONT_RIGHT */
+      1448, /* GL_SRC_COLOR */
+      1036, /* GL_ONE_MINUS_SRC_COLOR */
+      1446, /* GL_SRC_ALPHA */
+      1035, /* GL_ONE_MINUS_SRC_ALPHA */
+       438, /* GL_DST_ALPHA */
+      1033, /* GL_ONE_MINUS_DST_ALPHA */
+       439, /* GL_DST_COLOR */
+      1034, /* GL_ONE_MINUS_DST_COLOR */
+      1447, /* GL_SRC_ALPHA_SATURATE */
+       570, /* GL_FRONT_LEFT */
+       571, /* GL_FRONT_RIGHT */
         68, /* GL_BACK_LEFT */
         69, /* GL_BACK_RIGHT */
-       555, /* GL_FRONT */
+       567, /* GL_FRONT */
         67, /* GL_BACK */
-       670, /* GL_LEFT */
-      1356, /* GL_RIGHT */
-       556, /* GL_FRONT_AND_BACK */
+       658, /* GL_LEFT */
+      1350, /* GL_RIGHT */
+       568, /* GL_FRONT_AND_BACK */
         62, /* GL_AUX0 */
         63, /* GL_AUX1 */
         64, /* GL_AUX2 */
         65, /* GL_AUX3 */
-       661, /* GL_INVALID_ENUM */
-       665, /* GL_INVALID_VALUE */
-       664, /* GL_INVALID_OPERATION */
-      1451, /* GL_STACK_OVERFLOW */
-      1452, /* GL_STACK_UNDERFLOW */
-      1073, /* GL_OUT_OF_MEMORY */
-       662, /* GL_INVALID_FRAMEBUFFER_OPERATION */
+       649, /* GL_INVALID_ENUM */
+       653, /* GL_INVALID_VALUE */
+       652, /* GL_INVALID_OPERATION */
+      1453, /* GL_STACK_OVERFLOW */
+      1454, /* GL_STACK_UNDERFLOW */
+      1061, /* GL_OUT_OF_MEMORY */
+       650, /* GL_INVALID_FRAMEBUFFER_OPERATION */
          0, /* GL_2D */
          2, /* GL_3D */
          3, /* GL_3D_COLOR */
          4, /* GL_3D_COLOR_TEXTURE */
          6, /* GL_4D_COLOR_TEXTURE */
-      1093, /* GL_PASS_THROUGH_TOKEN */
-      1149, /* GL_POINT_TOKEN */
-       705, /* GL_LINE_TOKEN */
-      1163, /* GL_POLYGON_TOKEN */
+      1081, /* GL_PASS_THROUGH_TOKEN */
+      1141, /* GL_POINT_TOKEN */
+       693, /* GL_LINE_TOKEN */
+      1155, /* GL_POLYGON_TOKEN */
         73, /* GL_BITMAP_TOKEN */
-       431, /* GL_DRAW_PIXEL_TOKEN */
-       292, /* GL_COPY_PIXEL_TOKEN */
-       698, /* GL_LINE_RESET_TOKEN */
-       456, /* GL_EXP */
-       457, /* GL_EXP2 */
-       325, /* GL_CW */
-       121, /* GL_CCW */
-       142, /* GL_COEFF */
-      1070, /* GL_ORDER */
-       369, /* GL_DOMAIN */
-       300, /* GL_CURRENT_COLOR */
-       303, /* GL_CURRENT_INDEX */
-       309, /* GL_CURRENT_NORMAL */
-       321, /* GL_CURRENT_TEXTURE_COORDS */
-       314, /* GL_CURRENT_RASTER_COLOR */
-       316, /* GL_CURRENT_RASTER_INDEX */
-       319, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
-       317, /* GL_CURRENT_RASTER_POSITION */
-       318, /* GL_CURRENT_RASTER_POSITION_VALID */
-       315, /* GL_CURRENT_RASTER_DISTANCE */
-      1142, /* GL_POINT_SMOOTH */
-      1131, /* GL_POINT_SIZE */
-      1141, /* GL_POINT_SIZE_RANGE */
-      1132, /* GL_POINT_SIZE_GRANULARITY */
-       699, /* GL_LINE_SMOOTH */
-       706, /* GL_LINE_WIDTH */
-       708, /* GL_LINE_WIDTH_RANGE */
-       707, /* GL_LINE_WIDTH_GRANULARITY */
-       701, /* GL_LINE_STIPPLE */
-       702, /* GL_LINE_STIPPLE_PATTERN */
-       703, /* GL_LINE_STIPPLE_REPEAT */
-       713, /* GL_LIST_MODE */
-       872, /* GL_MAX_LIST_NESTING */
-       710, /* GL_LIST_BASE */
-       712, /* GL_LIST_INDEX */
-      1152, /* GL_POLYGON_MODE */
-      1159, /* GL_POLYGON_SMOOTH */
-      1161, /* GL_POLYGON_STIPPLE */
-       442, /* GL_EDGE_FLAG */
-       293, /* GL_CULL_FACE */
-       294, /* GL_CULL_FACE_MODE */
-       557, /* GL_FRONT_FACE */
-       681, /* GL_LIGHTING */
-       686, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
-       687, /* GL_LIGHT_MODEL_TWO_SIDE */
-       683, /* GL_LIGHT_MODEL_AMBIENT */
-      1402, /* GL_SHADE_MODEL */
-       189, /* GL_COLOR_MATERIAL_FACE */
-       190, /* GL_COLOR_MATERIAL_PARAMETER */
-       188, /* GL_COLOR_MATERIAL */
-       484, /* GL_FOG */
-       506, /* GL_FOG_INDEX */
-       502, /* GL_FOG_DENSITY */
-       510, /* GL_FOG_START */
-       504, /* GL_FOG_END */
-       507, /* GL_FOG_MODE */
-       486, /* GL_FOG_COLOR */
-       356, /* GL_DEPTH_RANGE */
-       363, /* GL_DEPTH_TEST */
-       366, /* GL_DEPTH_WRITEMASK */
-       344, /* GL_DEPTH_CLEAR_VALUE */
-       355, /* GL_DEPTH_FUNC */
+       437, /* GL_DRAW_PIXEL_TOKEN */
+       297, /* GL_COPY_PIXEL_TOKEN */
+       686, /* GL_LINE_RESET_TOKEN */
+       462, /* GL_EXP */
+       463, /* GL_EXP2 */
+       331, /* GL_CW */
+       122, /* GL_CCW */
+       143, /* GL_COEFF */
+      1058, /* GL_ORDER */
+       375, /* GL_DOMAIN */
+       305, /* GL_CURRENT_COLOR */
+       308, /* GL_CURRENT_INDEX */
+       314, /* GL_CURRENT_NORMAL */
+       327, /* GL_CURRENT_TEXTURE_COORDS */
+       319, /* GL_CURRENT_RASTER_COLOR */
+       321, /* GL_CURRENT_RASTER_INDEX */
+       325, /* GL_CURRENT_RASTER_TEXTURE_COORDS */
+       322, /* GL_CURRENT_RASTER_POSITION */
+       323, /* GL_CURRENT_RASTER_POSITION_VALID */
+       320, /* GL_CURRENT_RASTER_DISTANCE */
+      1134, /* GL_POINT_SMOOTH */
+      1123, /* GL_POINT_SIZE */
+      1133, /* GL_POINT_SIZE_RANGE */
+      1124, /* GL_POINT_SIZE_GRANULARITY */
+       687, /* GL_LINE_SMOOTH */
+       694, /* GL_LINE_WIDTH */
+       696, /* GL_LINE_WIDTH_RANGE */
+       695, /* GL_LINE_WIDTH_GRANULARITY */
+       689, /* GL_LINE_STIPPLE */
+       690, /* GL_LINE_STIPPLE_PATTERN */
+       691, /* GL_LINE_STIPPLE_REPEAT */
+       701, /* GL_LIST_MODE */
+       860, /* GL_MAX_LIST_NESTING */
+       698, /* GL_LIST_BASE */
+       700, /* GL_LIST_INDEX */
+      1144, /* GL_POLYGON_MODE */
+      1151, /* GL_POLYGON_SMOOTH */
+      1153, /* GL_POLYGON_STIPPLE */
+       448, /* GL_EDGE_FLAG */
+       298, /* GL_CULL_FACE */
+       299, /* GL_CULL_FACE_MODE */
+       569, /* GL_FRONT_FACE */
+       669, /* GL_LIGHTING */
+       674, /* GL_LIGHT_MODEL_LOCAL_VIEWER */
+       675, /* GL_LIGHT_MODEL_TWO_SIDE */
+       671, /* GL_LIGHT_MODEL_AMBIENT */
+      1396, /* GL_SHADE_MODEL */
+       190, /* GL_COLOR_MATERIAL_FACE */
+       191, /* GL_COLOR_MATERIAL_PARAMETER */
+       189, /* GL_COLOR_MATERIAL */
+       496, /* GL_FOG */
+       518, /* GL_FOG_INDEX */
+       514, /* GL_FOG_DENSITY */
+       522, /* GL_FOG_START */
+       516, /* GL_FOG_END */
+       519, /* GL_FOG_MODE */
+       498, /* GL_FOG_COLOR */
+       362, /* GL_DEPTH_RANGE */
+       369, /* GL_DEPTH_TEST */
+       372, /* GL_DEPTH_WRITEMASK */
+       350, /* GL_DEPTH_CLEAR_VALUE */
+       361, /* GL_DEPTH_FUNC */
         12, /* GL_ACCUM_CLEAR_VALUE */
-      1487, /* GL_STENCIL_TEST */
-      1475, /* GL_STENCIL_CLEAR_VALUE */
-      1477, /* GL_STENCIL_FUNC */
-      1489, /* GL_STENCIL_VALUE_MASK */
-      1476, /* GL_STENCIL_FAIL */
-      1484, /* GL_STENCIL_PASS_DEPTH_FAIL */
-      1485, /* GL_STENCIL_PASS_DEPTH_PASS */
-      1486, /* GL_STENCIL_REF */
-      1490, /* GL_STENCIL_WRITEMASK */
-       841, /* GL_MATRIX_MODE */
-      1009, /* GL_NORMALIZE */
-      1799, /* GL_VIEWPORT */
-       983, /* GL_MODELVIEW_STACK_DEPTH */
-      1242, /* GL_PROJECTION_STACK_DEPTH */
-      1685, /* GL_TEXTURE_STACK_DEPTH */
-       981, /* GL_MODELVIEW_MATRIX */
-      1241, /* GL_PROJECTION_MATRIX */
-      1670, /* GL_TEXTURE_MATRIX */
+      1489, /* GL_STENCIL_TEST */
+      1477, /* GL_STENCIL_CLEAR_VALUE */
+      1479, /* GL_STENCIL_FUNC */
+      1491, /* GL_STENCIL_VALUE_MASK */
+      1478, /* GL_STENCIL_FAIL */
+      1486, /* GL_STENCIL_PASS_DEPTH_FAIL */
+      1487, /* GL_STENCIL_PASS_DEPTH_PASS */
+      1488, /* GL_STENCIL_REF */
+      1492, /* GL_STENCIL_WRITEMASK */
+       829, /* GL_MATRIX_MODE */
+       997, /* GL_NORMALIZE */
+      1801, /* GL_VIEWPORT */
+       971, /* GL_MODELVIEW_STACK_DEPTH */
+      1234, /* GL_PROJECTION_STACK_DEPTH */
+      1687, /* GL_TEXTURE_STACK_DEPTH */
+       969, /* GL_MODELVIEW_MATRIX */
+      1233, /* GL_PROJECTION_MATRIX */
+      1672, /* GL_TEXTURE_MATRIX */
         60, /* GL_ATTRIB_STACK_DEPTH */
-       132, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
+       133, /* GL_CLIENT_ATTRIB_STACK_DEPTH */
         43, /* GL_ALPHA_TEST */
         44, /* GL_ALPHA_TEST_FUNC */
         45, /* GL_ALPHA_TEST_REF */
-       368, /* GL_DITHER */
+       374, /* GL_DITHER */
         77, /* GL_BLEND_DST */
-        85, /* GL_BLEND_SRC */
+        86, /* GL_BLEND_SRC */
         74, /* GL_BLEND */
-       716, /* GL_LOGIC_OP_MODE */
-       635, /* GL_INDEX_LOGIC_OP */
-       187, /* GL_COLOR_LOGIC_OP */
+       704, /* GL_LOGIC_OP_MODE */
+       623, /* GL_INDEX_LOGIC_OP */
+       188, /* GL_COLOR_LOGIC_OP */
         66, /* GL_AUX_BUFFERS */
-       379, /* GL_DRAW_BUFFER */
-      1274, /* GL_READ_BUFFER */
-      1383, /* GL_SCISSOR_BOX */
-      1384, /* GL_SCISSOR_TEST */
-       634, /* GL_INDEX_CLEAR_VALUE */
-       639, /* GL_INDEX_WRITEMASK */
-       184, /* GL_COLOR_CLEAR_VALUE */
-       226, /* GL_COLOR_WRITEMASK */
-       636, /* GL_INDEX_MODE */
-      1350, /* GL_RGBA_MODE */
-       378, /* GL_DOUBLEBUFFER */
-      1491, /* GL_STEREO */
-      1309, /* GL_RENDER_MODE */
-      1094, /* GL_PERSPECTIVE_CORRECTION_HINT */
-      1143, /* GL_POINT_SMOOTH_HINT */
-       700, /* GL_LINE_SMOOTH_HINT */
-      1160, /* GL_POLYGON_SMOOTH_HINT */
-       505, /* GL_FOG_HINT */
-      1651, /* GL_TEXTURE_GEN_S */
-      1652, /* GL_TEXTURE_GEN_T */
-      1650, /* GL_TEXTURE_GEN_R */
-      1649, /* GL_TEXTURE_GEN_Q */
-      1107, /* GL_PIXEL_MAP_I_TO_I */
-      1113, /* GL_PIXEL_MAP_S_TO_S */
-      1109, /* GL_PIXEL_MAP_I_TO_R */
-      1105, /* GL_PIXEL_MAP_I_TO_G */
-      1103, /* GL_PIXEL_MAP_I_TO_B */
-      1101, /* GL_PIXEL_MAP_I_TO_A */
-      1111, /* GL_PIXEL_MAP_R_TO_R */
-      1099, /* GL_PIXEL_MAP_G_TO_G */
-      1097, /* GL_PIXEL_MAP_B_TO_B */
-      1095, /* GL_PIXEL_MAP_A_TO_A */
-      1108, /* GL_PIXEL_MAP_I_TO_I_SIZE */
-      1114, /* GL_PIXEL_MAP_S_TO_S_SIZE */
-      1110, /* GL_PIXEL_MAP_I_TO_R_SIZE */
-      1106, /* GL_PIXEL_MAP_I_TO_G_SIZE */
-      1104, /* GL_PIXEL_MAP_I_TO_B_SIZE */
-      1102, /* GL_PIXEL_MAP_I_TO_A_SIZE */
-      1112, /* GL_PIXEL_MAP_R_TO_R_SIZE */
-      1100, /* GL_PIXEL_MAP_G_TO_G_SIZE */
-      1098, /* GL_PIXEL_MAP_B_TO_B_SIZE */
-      1096, /* GL_PIXEL_MAP_A_TO_A_SIZE */
-      1719, /* GL_UNPACK_SWAP_BYTES */
-      1714, /* GL_UNPACK_LSB_FIRST */
-      1715, /* GL_UNPACK_ROW_LENGTH */
-      1718, /* GL_UNPACK_SKIP_ROWS */
-      1717, /* GL_UNPACK_SKIP_PIXELS */
-      1712, /* GL_UNPACK_ALIGNMENT */
-      1082, /* GL_PACK_SWAP_BYTES */
-      1077, /* GL_PACK_LSB_FIRST */
-      1078, /* GL_PACK_ROW_LENGTH */
-      1081, /* GL_PACK_SKIP_ROWS */
-      1080, /* GL_PACK_SKIP_PIXELS */
-      1074, /* GL_PACK_ALIGNMENT */
-       794, /* GL_MAP_COLOR */
-       795, /* GL_MAP_STENCIL */
-       638, /* GL_INDEX_SHIFT */
-       637, /* GL_INDEX_OFFSET */
-      1287, /* GL_RED_SCALE */
-      1285, /* GL_RED_BIAS */
-      1816, /* GL_ZOOM_X */
-      1817, /* GL_ZOOM_Y */
-       599, /* GL_GREEN_SCALE */
-       597, /* GL_GREEN_BIAS */
-        91, /* GL_BLUE_SCALE */
-        89, /* GL_BLUE_BIAS */
+       385, /* GL_DRAW_BUFFER */
+      1266, /* GL_READ_BUFFER */
+      1377, /* GL_SCISSOR_BOX */
+      1378, /* GL_SCISSOR_TEST */
+       622, /* GL_INDEX_CLEAR_VALUE */
+       627, /* GL_INDEX_WRITEMASK */
+       185, /* GL_COLOR_CLEAR_VALUE */
+       227, /* GL_COLOR_WRITEMASK */
+       624, /* GL_INDEX_MODE */
+      1343, /* GL_RGBA_MODE */
+       384, /* GL_DOUBLEBUFFER */
+      1493, /* GL_STEREO */
+      1301, /* GL_RENDER_MODE */
+      1082, /* GL_PERSPECTIVE_CORRECTION_HINT */
+      1135, /* GL_POINT_SMOOTH_HINT */
+       688, /* GL_LINE_SMOOTH_HINT */
+      1152, /* GL_POLYGON_SMOOTH_HINT */
+       517, /* GL_FOG_HINT */
+      1653, /* GL_TEXTURE_GEN_S */
+      1654, /* GL_TEXTURE_GEN_T */
+      1652, /* GL_TEXTURE_GEN_R */
+      1651, /* GL_TEXTURE_GEN_Q */
+      1095, /* GL_PIXEL_MAP_I_TO_I */
+      1101, /* GL_PIXEL_MAP_S_TO_S */
+      1097, /* GL_PIXEL_MAP_I_TO_R */
+      1093, /* GL_PIXEL_MAP_I_TO_G */
+      1091, /* GL_PIXEL_MAP_I_TO_B */
+      1089, /* GL_PIXEL_MAP_I_TO_A */
+      1099, /* GL_PIXEL_MAP_R_TO_R */
+      1087, /* GL_PIXEL_MAP_G_TO_G */
+      1085, /* GL_PIXEL_MAP_B_TO_B */
+      1083, /* GL_PIXEL_MAP_A_TO_A */
+      1096, /* GL_PIXEL_MAP_I_TO_I_SIZE */
+      1102, /* GL_PIXEL_MAP_S_TO_S_SIZE */
+      1098, /* GL_PIXEL_MAP_I_TO_R_SIZE */
+      1094, /* GL_PIXEL_MAP_I_TO_G_SIZE */
+      1092, /* GL_PIXEL_MAP_I_TO_B_SIZE */
+      1090, /* GL_PIXEL_MAP_I_TO_A_SIZE */
+      1100, /* GL_PIXEL_MAP_R_TO_R_SIZE */
+      1088, /* GL_PIXEL_MAP_G_TO_G_SIZE */
+      1086, /* GL_PIXEL_MAP_B_TO_B_SIZE */
+      1084, /* GL_PIXEL_MAP_A_TO_A_SIZE */
+      1721, /* GL_UNPACK_SWAP_BYTES */
+      1716, /* GL_UNPACK_LSB_FIRST */
+      1717, /* GL_UNPACK_ROW_LENGTH */
+      1720, /* GL_UNPACK_SKIP_ROWS */
+      1719, /* GL_UNPACK_SKIP_PIXELS */
+      1714, /* GL_UNPACK_ALIGNMENT */
+      1070, /* GL_PACK_SWAP_BYTES */
+      1065, /* GL_PACK_LSB_FIRST */
+      1066, /* GL_PACK_ROW_LENGTH */
+      1069, /* GL_PACK_SKIP_ROWS */
+      1068, /* GL_PACK_SKIP_PIXELS */
+      1062, /* GL_PACK_ALIGNMENT */
+       782, /* GL_MAP_COLOR */
+       783, /* GL_MAP_STENCIL */
+       626, /* GL_INDEX_SHIFT */
+       625, /* GL_INDEX_OFFSET */
+      1279, /* GL_RED_SCALE */
+      1277, /* GL_RED_BIAS */
+      1818, /* GL_ZOOM_X */
+      1819, /* GL_ZOOM_Y */
+       587, /* GL_GREEN_SCALE */
+       585, /* GL_GREEN_BIAS */
+        92, /* GL_BLUE_SCALE */
+        90, /* GL_BLUE_BIAS */
         42, /* GL_ALPHA_SCALE */
         40, /* GL_ALPHA_BIAS */
-       357, /* GL_DEPTH_SCALE */
-       338, /* GL_DEPTH_BIAS */
-       867, /* GL_MAX_EVAL_ORDER */
-       871, /* GL_MAX_LIGHTS */
-       850, /* GL_MAX_CLIP_PLANES */
-       916, /* GL_MAX_TEXTURE_SIZE */
-       877, /* GL_MAX_PIXEL_MAP_TABLE */
-       846, /* GL_MAX_ATTRIB_STACK_DEPTH */
-       874, /* GL_MAX_MODELVIEW_STACK_DEPTH */
-       875, /* GL_MAX_NAME_STACK_DEPTH */
-       903, /* GL_MAX_PROJECTION_STACK_DEPTH */
-       917, /* GL_MAX_TEXTURE_STACK_DEPTH */
-       931, /* GL_MAX_VIEWPORT_DIMS */
-       847, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
-      1498, /* GL_SUBPIXEL_BITS */
-       633, /* GL_INDEX_BITS */
-      1286, /* GL_RED_BITS */
-       598, /* GL_GREEN_BITS */
-        90, /* GL_BLUE_BITS */
+       363, /* GL_DEPTH_SCALE */
+       344, /* GL_DEPTH_BIAS */
+       855, /* GL_MAX_EVAL_ORDER */
+       859, /* GL_MAX_LIGHTS */
+       838, /* GL_MAX_CLIP_PLANES */
+       904, /* GL_MAX_TEXTURE_SIZE */
+       865, /* GL_MAX_PIXEL_MAP_TABLE */
+       834, /* GL_MAX_ATTRIB_STACK_DEPTH */
+       862, /* GL_MAX_MODELVIEW_STACK_DEPTH */
+       863, /* GL_MAX_NAME_STACK_DEPTH */
+       891, /* GL_MAX_PROJECTION_STACK_DEPTH */
+       905, /* GL_MAX_TEXTURE_STACK_DEPTH */
+       919, /* GL_MAX_VIEWPORT_DIMS */
+       835, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */
+      1500, /* GL_SUBPIXEL_BITS */
+       621, /* GL_INDEX_BITS */
+      1278, /* GL_RED_BITS */
+       586, /* GL_GREEN_BITS */
+        91, /* GL_BLUE_BITS */
         41, /* GL_ALPHA_BITS */
-       339, /* GL_DEPTH_BITS */
-      1473, /* GL_STENCIL_BITS */
+       345, /* GL_DEPTH_BITS */
+      1475, /* GL_STENCIL_BITS */
         14, /* GL_ACCUM_RED_BITS */
         13, /* GL_ACCUM_GREEN_BITS */
         10, /* GL_ACCUM_BLUE_BITS */
          9, /* GL_ACCUM_ALPHA_BITS */
-       997, /* GL_NAME_STACK_DEPTH */
+       985, /* GL_NAME_STACK_DEPTH */
         61, /* GL_AUTO_NORMAL */
-       740, /* GL_MAP1_COLOR_4 */
-       743, /* GL_MAP1_INDEX */
-       744, /* GL_MAP1_NORMAL */
-       745, /* GL_MAP1_TEXTURE_COORD_1 */
-       746, /* GL_MAP1_TEXTURE_COORD_2 */
-       747, /* GL_MAP1_TEXTURE_COORD_3 */
-       748, /* GL_MAP1_TEXTURE_COORD_4 */
-       749, /* GL_MAP1_VERTEX_3 */
-       750, /* GL_MAP1_VERTEX_4 */
-       767, /* GL_MAP2_COLOR_4 */
-       770, /* GL_MAP2_INDEX */
-       771, /* GL_MAP2_NORMAL */
-       772, /* GL_MAP2_TEXTURE_COORD_1 */
-       773, /* GL_MAP2_TEXTURE_COORD_2 */
-       774, /* GL_MAP2_TEXTURE_COORD_3 */
-       775, /* GL_MAP2_TEXTURE_COORD_4 */
-       776, /* GL_MAP2_VERTEX_3 */
-       777, /* GL_MAP2_VERTEX_4 */
-       741, /* GL_MAP1_GRID_DOMAIN */
-       742, /* GL_MAP1_GRID_SEGMENTS */
-       768, /* GL_MAP2_GRID_DOMAIN */
-       769, /* GL_MAP2_GRID_SEGMENTS */
-      1575, /* GL_TEXTURE_1D */
-      1577, /* GL_TEXTURE_2D */
-       466, /* GL_FEEDBACK_BUFFER_POINTER */
-       467, /* GL_FEEDBACK_BUFFER_SIZE */
-       468, /* GL_FEEDBACK_BUFFER_TYPE */
-      1393, /* GL_SELECTION_BUFFER_POINTER */
-      1394, /* GL_SELECTION_BUFFER_SIZE */
-      1689, /* GL_TEXTURE_WIDTH */
-      1656, /* GL_TEXTURE_HEIGHT */
-      1612, /* GL_TEXTURE_COMPONENTS */
-      1596, /* GL_TEXTURE_BORDER_COLOR */
-      1595, /* GL_TEXTURE_BORDER */
-       370, /* GL_DONT_CARE */
-       464, /* GL_FASTEST */
-      1005, /* GL_NICEST */
+       728, /* GL_MAP1_COLOR_4 */
+       731, /* GL_MAP1_INDEX */
+       732, /* GL_MAP1_NORMAL */
+       733, /* GL_MAP1_TEXTURE_COORD_1 */
+       734, /* GL_MAP1_TEXTURE_COORD_2 */
+       735, /* GL_MAP1_TEXTURE_COORD_3 */
+       736, /* GL_MAP1_TEXTURE_COORD_4 */
+       737, /* GL_MAP1_VERTEX_3 */
+       738, /* GL_MAP1_VERTEX_4 */
+       755, /* GL_MAP2_COLOR_4 */
+       758, /* GL_MAP2_INDEX */
+       759, /* GL_MAP2_NORMAL */
+       760, /* GL_MAP2_TEXTURE_COORD_1 */
+       761, /* GL_MAP2_TEXTURE_COORD_2 */
+       762, /* GL_MAP2_TEXTURE_COORD_3 */
+       763, /* GL_MAP2_TEXTURE_COORD_4 */
+       764, /* GL_MAP2_VERTEX_3 */
+       765, /* GL_MAP2_VERTEX_4 */
+       729, /* GL_MAP1_GRID_DOMAIN */
+       730, /* GL_MAP1_GRID_SEGMENTS */
+       756, /* GL_MAP2_GRID_DOMAIN */
+       757, /* GL_MAP2_GRID_SEGMENTS */
+      1577, /* GL_TEXTURE_1D */
+      1579, /* GL_TEXTURE_2D */
+       472, /* GL_FEEDBACK_BUFFER_POINTER */
+       473, /* GL_FEEDBACK_BUFFER_SIZE */
+       474, /* GL_FEEDBACK_BUFFER_TYPE */
+      1387, /* GL_SELECTION_BUFFER_POINTER */
+      1388, /* GL_SELECTION_BUFFER_SIZE */
+      1691, /* GL_TEXTURE_WIDTH */
+      1658, /* GL_TEXTURE_HEIGHT */
+      1614, /* GL_TEXTURE_COMPONENTS */
+      1598, /* GL_TEXTURE_BORDER_COLOR */
+      1597, /* GL_TEXTURE_BORDER */
+       376, /* GL_DONT_CARE */
+       470, /* GL_FASTEST */
+       993, /* GL_NICEST */
         47, /* GL_AMBIENT */
-       367, /* GL_DIFFUSE */
-      1436, /* GL_SPECULAR */
-      1164, /* GL_POSITION */
-      1439, /* GL_SPOT_DIRECTION */
-      1440, /* GL_SPOT_EXPONENT */
-      1438, /* GL_SPOT_CUTOFF */
-       266, /* GL_CONSTANT_ATTENUATION */
-       690, /* GL_LINEAR_ATTENUATION */
-      1261, /* GL_QUADRATIC_ATTENUATION */
-       240, /* GL_COMPILE */
-       241, /* GL_COMPILE_AND_EXECUTE */
-       116, /* GL_BYTE */
-      1720, /* GL_UNSIGNED_BYTE */
-      1407, /* GL_SHORT */
-      1731, /* GL_UNSIGNED_SHORT */
-       641, /* GL_INT */
-      1723, /* GL_UNSIGNED_INT */
-       471, /* GL_FLOAT */
+       373, /* GL_DIFFUSE */
+      1435, /* GL_SPECULAR */
+      1156, /* GL_POSITION */
+      1438, /* GL_SPOT_DIRECTION */
+      1439, /* GL_SPOT_EXPONENT */
+      1437, /* GL_SPOT_CUTOFF */
+       271, /* GL_CONSTANT_ATTENUATION */
+       678, /* GL_LINEAR_ATTENUATION */
+      1253, /* GL_QUADRATIC_ATTENUATION */
+       241, /* GL_COMPILE */
+       242, /* GL_COMPILE_AND_EXECUTE */
+       117, /* GL_BYTE */
+      1722, /* GL_UNSIGNED_BYTE */
+      1401, /* GL_SHORT */
+      1733, /* GL_UNSIGNED_SHORT */
+       629, /* GL_INT */
+      1725, /* GL_UNSIGNED_INT */
+       477, /* GL_FLOAT */
          1, /* GL_2_BYTES */
          5, /* GL_3_BYTES */
          7, /* GL_4_BYTES */
-       377, /* GL_DOUBLE */
-       128, /* GL_CLEAR */
+       383, /* GL_DOUBLE */
+       129, /* GL_CLEAR */
         49, /* GL_AND */
         51, /* GL_AND_REVERSE */
-       290, /* GL_COPY */
+       295, /* GL_COPY */
         50, /* GL_AND_INVERTED */
-      1007, /* GL_NOOP */
-      1812, /* GL_XOR */
-      1069, /* GL_OR */
-      1008, /* GL_NOR */
-       454, /* GL_EQUIV */
-       668, /* GL_INVERT */
-      1072, /* GL_OR_REVERSE */
-       291, /* GL_COPY_INVERTED */
-      1071, /* GL_OR_INVERTED */
-       998, /* GL_NAND */
-      1398, /* GL_SET */
-       451, /* GL_EMISSION */
-      1406, /* GL_SHININESS */
+       995, /* GL_NOOP */
+      1814, /* GL_XOR */
+      1057, /* GL_OR */
+       996, /* GL_NOR */
+       460, /* GL_EQUIV */
+       656, /* GL_INVERT */
+      1060, /* GL_OR_REVERSE */
+       296, /* GL_COPY_INVERTED */
+      1059, /* GL_OR_INVERTED */
+       986, /* GL_NAND */
+      1392, /* GL_SET */
+       457, /* GL_EMISSION */
+      1400, /* GL_SHININESS */
         48, /* GL_AMBIENT_AND_DIFFUSE */
-       186, /* GL_COLOR_INDEXES */
-       948, /* GL_MODELVIEW */
-      1240, /* GL_PROJECTION */
-      1510, /* GL_TEXTURE */
-       143, /* GL_COLOR */
-       334, /* GL_DEPTH */
-      1459, /* GL_STENCIL */
-       185, /* GL_COLOR_INDEX */
-      1478, /* GL_STENCIL_INDEX */
-       345, /* GL_DEPTH_COMPONENT */
-      1282, /* GL_RED */
-       596, /* GL_GREEN */
-        88, /* GL_BLUE */
+       187, /* GL_COLOR_INDEXES */
+       936, /* GL_MODELVIEW */
+      1232, /* GL_PROJECTION */
+      1512, /* GL_TEXTURE */
+       144, /* GL_COLOR */
+       340, /* GL_DEPTH */
+      1461, /* GL_STENCIL */
+       186, /* GL_COLOR_INDEX */
+      1480, /* GL_STENCIL_INDEX */
+       351, /* GL_DEPTH_COMPONENT */
+      1274, /* GL_RED */
+       584, /* GL_GREEN */
+        89, /* GL_BLUE */
         31, /* GL_ALPHA */
-      1317, /* GL_RGB */
-      1336, /* GL_RGBA */
-       718, /* GL_LUMINANCE */
-       739, /* GL_LUMINANCE_ALPHA */
+      1309, /* GL_RGB */
+      1328, /* GL_RGBA */
+       706, /* GL_LUMINANCE */
+       727, /* GL_LUMINANCE_ALPHA */
         72, /* GL_BITMAP */
-      1120, /* GL_POINT */
-       688, /* GL_LINE */
-       469, /* GL_FILL */
-      1291, /* GL_RENDER */
-       465, /* GL_FEEDBACK */
-      1392, /* GL_SELECT */
-       470, /* GL_FLAT */
-      1411, /* GL_SMOOTH */
-       669, /* GL_KEEP */
-      1311, /* GL_REPLACE */
-       623, /* GL_INCR */
-       330, /* GL_DECR */
-      1746, /* GL_VENDOR */
-      1308, /* GL_RENDERER */
-      1747, /* GL_VERSION */
-       458, /* GL_EXTENSIONS */
-      1357, /* GL_S */
-      1501, /* GL_T */
-      1271, /* GL_R */
-      1260, /* GL_Q */
-       984, /* GL_MODULATE */
-       329, /* GL_DECAL */
-      1646, /* GL_TEXTURE_ENV_MODE */
-      1645, /* GL_TEXTURE_ENV_COLOR */
-      1644, /* GL_TEXTURE_ENV */
-       459, /* GL_EYE_LINEAR */
-      1031, /* GL_OBJECT_LINEAR */
-      1437, /* GL_SPHERE_MAP */
-      1648, /* GL_TEXTURE_GEN_MODE */
-      1033, /* GL_OBJECT_PLANE */
-       460, /* GL_EYE_PLANE */
-       999, /* GL_NEAREST */
-       689, /* GL_LINEAR */
-      1003, /* GL_NEAREST_MIPMAP_NEAREST */
-       694, /* GL_LINEAR_MIPMAP_NEAREST */
-      1002, /* GL_NEAREST_MIPMAP_LINEAR */
-       693, /* GL_LINEAR_MIPMAP_LINEAR */
-      1669, /* GL_TEXTURE_MAG_FILTER */
-      1677, /* GL_TEXTURE_MIN_FILTER */
-      1691, /* GL_TEXTURE_WRAP_S */
-      1692, /* GL_TEXTURE_WRAP_T */
-       122, /* GL_CLAMP */
-      1310, /* GL_REPEAT */
-      1158, /* GL_POLYGON_OFFSET_UNITS */
-      1157, /* GL_POLYGON_OFFSET_POINT */
-      1156, /* GL_POLYGON_OFFSET_LINE */
-      1272, /* GL_R3_G3_B2 */
-      1743, /* GL_V2F */
-      1744, /* GL_V3F */
-       119, /* GL_C4UB_V2F */
-       120, /* GL_C4UB_V3F */
-       117, /* GL_C3F_V3F */
-       996, /* GL_N3F_V3F */
-       118, /* GL_C4F_N3F_V3F */
-      1506, /* GL_T2F_V3F */
-      1508, /* GL_T4F_V4F */
-      1504, /* GL_T2F_C4UB_V3F */
-      1502, /* GL_T2F_C3F_V3F */
-      1505, /* GL_T2F_N3F_V3F */
-      1503, /* GL_T2F_C4F_N3F_V3F */
-      1507, /* GL_T4F_C4F_N3F_V4F */
-       135, /* GL_CLIP_PLANE0 */
-       136, /* GL_CLIP_PLANE1 */
-       137, /* GL_CLIP_PLANE2 */
-       138, /* GL_CLIP_PLANE3 */
-       139, /* GL_CLIP_PLANE4 */
-       140, /* GL_CLIP_PLANE5 */
-       673, /* GL_LIGHT0 */
-       674, /* GL_LIGHT1 */
-       675, /* GL_LIGHT2 */
-       676, /* GL_LIGHT3 */
-       677, /* GL_LIGHT4 */
-       678, /* GL_LIGHT5 */
-       679, /* GL_LIGHT6 */
-       680, /* GL_LIGHT7 */
-       600, /* GL_HINT_BIT */
-       268, /* GL_CONSTANT_COLOR */
-      1043, /* GL_ONE_MINUS_CONSTANT_COLOR */
-       263, /* GL_CONSTANT_ALPHA */
-      1041, /* GL_ONE_MINUS_CONSTANT_ALPHA */
+      1112, /* GL_POINT */
+       676, /* GL_LINE */
+       475, /* GL_FILL */
+      1283, /* GL_RENDER */
+       471, /* GL_FEEDBACK */
+      1386, /* GL_SELECT */
+       476, /* GL_FLAT */
+      1410, /* GL_SMOOTH */
+       657, /* GL_KEEP */
+      1303, /* GL_REPLACE */
+       611, /* GL_INCR */
+       336, /* GL_DECR */
+      1748, /* GL_VENDOR */
+      1300, /* GL_RENDERER */
+      1749, /* GL_VERSION */
+       464, /* GL_EXTENSIONS */
+      1351, /* GL_S */
+      1503, /* GL_T */
+      1263, /* GL_R */
+      1252, /* GL_Q */
+       972, /* GL_MODULATE */
+       335, /* GL_DECAL */
+      1648, /* GL_TEXTURE_ENV_MODE */
+      1647, /* GL_TEXTURE_ENV_COLOR */
+      1646, /* GL_TEXTURE_ENV */
+       465, /* GL_EYE_LINEAR */
+      1019, /* GL_OBJECT_LINEAR */
+      1436, /* GL_SPHERE_MAP */
+      1650, /* GL_TEXTURE_GEN_MODE */
+      1021, /* GL_OBJECT_PLANE */
+       466, /* GL_EYE_PLANE */
+       987, /* GL_NEAREST */
+       677, /* GL_LINEAR */
+       991, /* GL_NEAREST_MIPMAP_NEAREST */
+       682, /* GL_LINEAR_MIPMAP_NEAREST */
+       990, /* GL_NEAREST_MIPMAP_LINEAR */
+       681, /* GL_LINEAR_MIPMAP_LINEAR */
+      1671, /* GL_TEXTURE_MAG_FILTER */
+      1679, /* GL_TEXTURE_MIN_FILTER */
+      1693, /* GL_TEXTURE_WRAP_S */
+      1694, /* GL_TEXTURE_WRAP_T */
+       123, /* GL_CLAMP */
+      1302, /* GL_REPEAT */
+      1150, /* GL_POLYGON_OFFSET_UNITS */
+      1149, /* GL_POLYGON_OFFSET_POINT */
+      1148, /* GL_POLYGON_OFFSET_LINE */
+      1264, /* GL_R3_G3_B2 */
+      1745, /* GL_V2F */
+      1746, /* GL_V3F */
+       120, /* GL_C4UB_V2F */
+       121, /* GL_C4UB_V3F */
+       118, /* GL_C3F_V3F */
+       984, /* GL_N3F_V3F */
+       119, /* GL_C4F_N3F_V3F */
+      1508, /* GL_T2F_V3F */
+      1510, /* GL_T4F_V4F */
+      1506, /* GL_T2F_C4UB_V3F */
+      1504, /* GL_T2F_C3F_V3F */
+      1507, /* GL_T2F_N3F_V3F */
+      1505, /* GL_T2F_C4F_N3F_V3F */
+      1509, /* GL_T4F_C4F_N3F_V4F */
+       136, /* GL_CLIP_PLANE0 */
+       137, /* GL_CLIP_PLANE1 */
+       138, /* GL_CLIP_PLANE2 */
+       139, /* GL_CLIP_PLANE3 */
+       140, /* GL_CLIP_PLANE4 */
+       141, /* GL_CLIP_PLANE5 */
+       661, /* GL_LIGHT0 */
+       662, /* GL_LIGHT1 */
+       663, /* GL_LIGHT2 */
+       664, /* GL_LIGHT3 */
+       665, /* GL_LIGHT4 */
+       666, /* GL_LIGHT5 */
+       667, /* GL_LIGHT6 */
+       668, /* GL_LIGHT7 */
+       588, /* GL_HINT_BIT */
+       273, /* GL_CONSTANT_COLOR */
+      1031, /* GL_ONE_MINUS_CONSTANT_COLOR */
+       268, /* GL_CONSTANT_ALPHA */
+      1029, /* GL_ONE_MINUS_CONSTANT_ALPHA */
         75, /* GL_BLEND_COLOR */
-       560, /* GL_FUNC_ADD */
-       932, /* GL_MIN */
-       843, /* GL_MAX */
+       572, /* GL_FUNC_ADD */
+       920, /* GL_MIN */
+       831, /* GL_MAX */
         80, /* GL_BLEND_EQUATION */
-       564, /* GL_FUNC_SUBTRACT */
-       562, /* GL_FUNC_REVERSE_SUBTRACT */
-       271, /* GL_CONVOLUTION_1D */
-       272, /* GL_CONVOLUTION_2D */
-      1395, /* GL_SEPARABLE_2D */
-       275, /* GL_CONVOLUTION_BORDER_MODE */
-       279, /* GL_CONVOLUTION_FILTER_SCALE */
-       277, /* GL_CONVOLUTION_FILTER_BIAS */
-      1283, /* GL_REDUCE */
-       281, /* GL_CONVOLUTION_FORMAT */
-       285, /* GL_CONVOLUTION_WIDTH */
-       283, /* GL_CONVOLUTION_HEIGHT */
-       858, /* GL_MAX_CONVOLUTION_WIDTH */
-       856, /* GL_MAX_CONVOLUTION_HEIGHT */
-      1197, /* GL_POST_CONVOLUTION_RED_SCALE */
-      1193, /* GL_POST_CONVOLUTION_GREEN_SCALE */
-      1188, /* GL_POST_CONVOLUTION_BLUE_SCALE */
-      1184, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
-      1195, /* GL_POST_CONVOLUTION_RED_BIAS */
-      1191, /* GL_POST_CONVOLUTION_GREEN_BIAS */
-      1186, /* GL_POST_CONVOLUTION_BLUE_BIAS */
-      1182, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
-       601, /* GL_HISTOGRAM */
-      1244, /* GL_PROXY_HISTOGRAM */
-       617, /* GL_HISTOGRAM_WIDTH */
-       607, /* GL_HISTOGRAM_FORMAT */
-       613, /* GL_HISTOGRAM_RED_SIZE */
-       609, /* GL_HISTOGRAM_GREEN_SIZE */
-       604, /* GL_HISTOGRAM_BLUE_SIZE */
-       602, /* GL_HISTOGRAM_ALPHA_SIZE */
-       611, /* GL_HISTOGRAM_LUMINANCE_SIZE */
-       615, /* GL_HISTOGRAM_SINK */
-       933, /* GL_MINMAX */
-       935, /* GL_MINMAX_FORMAT */
-       937, /* GL_MINMAX_SINK */
-      1509, /* GL_TABLE_TOO_LARGE_EXT */
-      1722, /* GL_UNSIGNED_BYTE_3_3_2 */
-      1733, /* GL_UNSIGNED_SHORT_4_4_4_4 */
-      1735, /* GL_UNSIGNED_SHORT_5_5_5_1 */
-      1728, /* GL_UNSIGNED_INT_8_8_8_8 */
-      1724, /* GL_UNSIGNED_INT_10_10_10_2 */
-      1155, /* GL_POLYGON_OFFSET_FILL */
-      1154, /* GL_POLYGON_OFFSET_FACTOR */
-      1153, /* GL_POLYGON_OFFSET_BIAS */
-      1314, /* GL_RESCALE_NORMAL */
+       576, /* GL_FUNC_SUBTRACT */
+       574, /* GL_FUNC_REVERSE_SUBTRACT */
+       276, /* GL_CONVOLUTION_1D */
+       277, /* GL_CONVOLUTION_2D */
+      1389, /* GL_SEPARABLE_2D */
+       280, /* GL_CONVOLUTION_BORDER_MODE */
+       284, /* GL_CONVOLUTION_FILTER_SCALE */
+       282, /* GL_CONVOLUTION_FILTER_BIAS */
+      1275, /* GL_REDUCE */
+       286, /* GL_CONVOLUTION_FORMAT */
+       290, /* GL_CONVOLUTION_WIDTH */
+       288, /* GL_CONVOLUTION_HEIGHT */
+       846, /* GL_MAX_CONVOLUTION_WIDTH */
+       844, /* GL_MAX_CONVOLUTION_HEIGHT */
+      1189, /* GL_POST_CONVOLUTION_RED_SCALE */
+      1185, /* GL_POST_CONVOLUTION_GREEN_SCALE */
+      1180, /* GL_POST_CONVOLUTION_BLUE_SCALE */
+      1176, /* GL_POST_CONVOLUTION_ALPHA_SCALE */
+      1187, /* GL_POST_CONVOLUTION_RED_BIAS */
+      1183, /* GL_POST_CONVOLUTION_GREEN_BIAS */
+      1178, /* GL_POST_CONVOLUTION_BLUE_BIAS */
+      1174, /* GL_POST_CONVOLUTION_ALPHA_BIAS */
+       589, /* GL_HISTOGRAM */
+      1236, /* GL_PROXY_HISTOGRAM */
+       605, /* GL_HISTOGRAM_WIDTH */
+       595, /* GL_HISTOGRAM_FORMAT */
+       601, /* GL_HISTOGRAM_RED_SIZE */
+       597, /* GL_HISTOGRAM_GREEN_SIZE */
+       592, /* GL_HISTOGRAM_BLUE_SIZE */
+       590, /* GL_HISTOGRAM_ALPHA_SIZE */
+       599, /* GL_HISTOGRAM_LUMINANCE_SIZE */
+       603, /* GL_HISTOGRAM_SINK */
+       921, /* GL_MINMAX */
+       923, /* GL_MINMAX_FORMAT */
+       925, /* GL_MINMAX_SINK */
+      1511, /* GL_TABLE_TOO_LARGE_EXT */
+      1724, /* GL_UNSIGNED_BYTE_3_3_2 */
+      1735, /* GL_UNSIGNED_SHORT_4_4_4_4 */
+      1737, /* GL_UNSIGNED_SHORT_5_5_5_1 */
+      1730, /* GL_UNSIGNED_INT_8_8_8_8 */
+      1726, /* GL_UNSIGNED_INT_10_10_10_2 */
+      1147, /* GL_POLYGON_OFFSET_FILL */
+      1146, /* GL_POLYGON_OFFSET_FACTOR */
+      1145, /* GL_POLYGON_OFFSET_BIAS */
+      1306, /* GL_RESCALE_NORMAL */
         36, /* GL_ALPHA4 */
         38, /* GL_ALPHA8 */
         32, /* GL_ALPHA12 */
         34, /* GL_ALPHA16 */
-       729, /* GL_LUMINANCE4 */
-       735, /* GL_LUMINANCE8 */
-       719, /* GL_LUMINANCE12 */
-       725, /* GL_LUMINANCE16 */
-       730, /* GL_LUMINANCE4_ALPHA4 */
-       733, /* GL_LUMINANCE6_ALPHA2 */
-       736, /* GL_LUMINANCE8_ALPHA8 */
-       722, /* GL_LUMINANCE12_ALPHA4 */
-       720, /* GL_LUMINANCE12_ALPHA12 */
-       726, /* GL_LUMINANCE16_ALPHA16 */
-       642, /* GL_INTENSITY */
-       647, /* GL_INTENSITY4 */
-       649, /* GL_INTENSITY8 */
-       643, /* GL_INTENSITY12 */
-       645, /* GL_INTENSITY16 */
-      1326, /* GL_RGB2_EXT */
-      1327, /* GL_RGB4 */
-      1330, /* GL_RGB5 */
-      1334, /* GL_RGB8 */
-      1318, /* GL_RGB10 */
-      1322, /* GL_RGB12 */
-      1324, /* GL_RGB16 */
-      1341, /* GL_RGBA2 */
-      1343, /* GL_RGBA4 */
-      1331, /* GL_RGB5_A1 */
-      1347, /* GL_RGBA8 */
-      1319, /* GL_RGB10_A2 */
-      1337, /* GL_RGBA12 */
-      1339, /* GL_RGBA16 */
-      1682, /* GL_TEXTURE_RED_SIZE */
-      1654, /* GL_TEXTURE_GREEN_SIZE */
-      1593, /* GL_TEXTURE_BLUE_SIZE */
-      1580, /* GL_TEXTURE_ALPHA_SIZE */
-      1667, /* GL_TEXTURE_LUMINANCE_SIZE */
-      1658, /* GL_TEXTURE_INTENSITY_SIZE */
-      1312, /* GL_REPLACE_EXT */
-      1248, /* GL_PROXY_TEXTURE_1D */
-      1251, /* GL_PROXY_TEXTURE_2D */
-      1687, /* GL_TEXTURE_TOO_LARGE_EXT */
-      1679, /* GL_TEXTURE_PRIORITY */
-      1684, /* GL_TEXTURE_RESIDENT */
-      1583, /* GL_TEXTURE_BINDING_1D */
-      1585, /* GL_TEXTURE_BINDING_2D */
-      1587, /* GL_TEXTURE_BINDING_3D */
-      1079, /* GL_PACK_SKIP_IMAGES */
-      1075, /* GL_PACK_IMAGE_HEIGHT */
-      1716, /* GL_UNPACK_SKIP_IMAGES */
-      1713, /* GL_UNPACK_IMAGE_HEIGHT */
-      1579, /* GL_TEXTURE_3D */
-      1254, /* GL_PROXY_TEXTURE_3D */
-      1641, /* GL_TEXTURE_DEPTH */
-      1690, /* GL_TEXTURE_WRAP_R */
-       844, /* GL_MAX_3D_TEXTURE_SIZE */
-      1748, /* GL_VERTEX_ARRAY */
-      1010, /* GL_NORMAL_ARRAY */
-       144, /* GL_COLOR_ARRAY */
-       627, /* GL_INDEX_ARRAY */
-      1620, /* GL_TEXTURE_COORD_ARRAY */
-       443, /* GL_EDGE_FLAG_ARRAY */
-      1753, /* GL_VERTEX_ARRAY_SIZE */
-      1755, /* GL_VERTEX_ARRAY_TYPE */
-      1754, /* GL_VERTEX_ARRAY_STRIDE */
-      1015, /* GL_NORMAL_ARRAY_TYPE */
-      1014, /* GL_NORMAL_ARRAY_STRIDE */
-       148, /* GL_COLOR_ARRAY_SIZE */
-       150, /* GL_COLOR_ARRAY_TYPE */
-       149, /* GL_COLOR_ARRAY_STRIDE */
-       632, /* GL_INDEX_ARRAY_TYPE */
-       631, /* GL_INDEX_ARRAY_STRIDE */
-      1624, /* GL_TEXTURE_COORD_ARRAY_SIZE */
-      1626, /* GL_TEXTURE_COORD_ARRAY_TYPE */
-      1625, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
-       447, /* GL_EDGE_FLAG_ARRAY_STRIDE */
-      1752, /* GL_VERTEX_ARRAY_POINTER */
-      1013, /* GL_NORMAL_ARRAY_POINTER */
-       147, /* GL_COLOR_ARRAY_POINTER */
-       630, /* GL_INDEX_ARRAY_POINTER */
-      1623, /* GL_TEXTURE_COORD_ARRAY_POINTER */
-       446, /* GL_EDGE_FLAG_ARRAY_POINTER */
-       989, /* GL_MULTISAMPLE */
-      1369, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
-      1371, /* GL_SAMPLE_ALPHA_TO_ONE */
-      1376, /* GL_SAMPLE_COVERAGE */
-      1373, /* GL_SAMPLE_BUFFERS */
-      1364, /* GL_SAMPLES */
-      1380, /* GL_SAMPLE_COVERAGE_VALUE */
-      1378, /* GL_SAMPLE_COVERAGE_INVERT */
-       191, /* GL_COLOR_MATRIX */
-       193, /* GL_COLOR_MATRIX_STACK_DEPTH */
-       852, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
-      1180, /* GL_POST_COLOR_MATRIX_RED_SCALE */
-      1176, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
-      1171, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
-      1167, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
-      1178, /* GL_POST_COLOR_MATRIX_RED_BIAS */
-      1174, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
-      1169, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
-      1165, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
-      1603, /* GL_TEXTURE_COLOR_TABLE_SGI */
-      1255, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
-      1605, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
+       717, /* GL_LUMINANCE4 */
+       723, /* GL_LUMINANCE8 */
+       707, /* GL_LUMINANCE12 */
+       713, /* GL_LUMINANCE16 */
+       718, /* GL_LUMINANCE4_ALPHA4 */
+       721, /* GL_LUMINANCE6_ALPHA2 */
+       724, /* GL_LUMINANCE8_ALPHA8 */
+       710, /* GL_LUMINANCE12_ALPHA4 */
+       708, /* GL_LUMINANCE12_ALPHA12 */
+       714, /* GL_LUMINANCE16_ALPHA16 */
+       630, /* GL_INTENSITY */
+       635, /* GL_INTENSITY4 */
+       637, /* GL_INTENSITY8 */
+       631, /* GL_INTENSITY12 */
+       633, /* GL_INTENSITY16 */
+      1318, /* GL_RGB2_EXT */
+      1319, /* GL_RGB4 */
+      1322, /* GL_RGB5 */
+      1326, /* GL_RGB8 */
+      1310, /* GL_RGB10 */
+      1314, /* GL_RGB12 */
+      1316, /* GL_RGB16 */
+      1333, /* GL_RGBA2 */
+      1335, /* GL_RGBA4 */
+      1323, /* GL_RGB5_A1 */
+      1339, /* GL_RGBA8 */
+      1311, /* GL_RGB10_A2 */
+      1329, /* GL_RGBA12 */
+      1331, /* GL_RGBA16 */
+      1684, /* GL_TEXTURE_RED_SIZE */
+      1656, /* GL_TEXTURE_GREEN_SIZE */
+      1595, /* GL_TEXTURE_BLUE_SIZE */
+      1582, /* GL_TEXTURE_ALPHA_SIZE */
+      1669, /* GL_TEXTURE_LUMINANCE_SIZE */
+      1660, /* GL_TEXTURE_INTENSITY_SIZE */
+      1304, /* GL_REPLACE_EXT */
+      1240, /* GL_PROXY_TEXTURE_1D */
+      1243, /* GL_PROXY_TEXTURE_2D */
+      1689, /* GL_TEXTURE_TOO_LARGE_EXT */
+      1681, /* GL_TEXTURE_PRIORITY */
+      1686, /* GL_TEXTURE_RESIDENT */
+      1585, /* GL_TEXTURE_BINDING_1D */
+      1587, /* GL_TEXTURE_BINDING_2D */
+      1589, /* GL_TEXTURE_BINDING_3D */
+      1067, /* GL_PACK_SKIP_IMAGES */
+      1063, /* GL_PACK_IMAGE_HEIGHT */
+      1718, /* GL_UNPACK_SKIP_IMAGES */
+      1715, /* GL_UNPACK_IMAGE_HEIGHT */
+      1581, /* GL_TEXTURE_3D */
+      1246, /* GL_PROXY_TEXTURE_3D */
+      1643, /* GL_TEXTURE_DEPTH */
+      1692, /* GL_TEXTURE_WRAP_R */
+       832, /* GL_MAX_3D_TEXTURE_SIZE */
+      1750, /* GL_VERTEX_ARRAY */
+       998, /* GL_NORMAL_ARRAY */
+       145, /* GL_COLOR_ARRAY */
+       615, /* GL_INDEX_ARRAY */
+      1622, /* GL_TEXTURE_COORD_ARRAY */
+       449, /* GL_EDGE_FLAG_ARRAY */
+      1755, /* GL_VERTEX_ARRAY_SIZE */
+      1757, /* GL_VERTEX_ARRAY_TYPE */
+      1756, /* GL_VERTEX_ARRAY_STRIDE */
+      1003, /* GL_NORMAL_ARRAY_TYPE */
+      1002, /* GL_NORMAL_ARRAY_STRIDE */
+       149, /* GL_COLOR_ARRAY_SIZE */
+       151, /* GL_COLOR_ARRAY_TYPE */
+       150, /* GL_COLOR_ARRAY_STRIDE */
+       620, /* GL_INDEX_ARRAY_TYPE */
+       619, /* GL_INDEX_ARRAY_STRIDE */
+      1626, /* GL_TEXTURE_COORD_ARRAY_SIZE */
+      1628, /* GL_TEXTURE_COORD_ARRAY_TYPE */
+      1627, /* GL_TEXTURE_COORD_ARRAY_STRIDE */
+       453, /* GL_EDGE_FLAG_ARRAY_STRIDE */
+      1754, /* GL_VERTEX_ARRAY_POINTER */
+      1001, /* GL_NORMAL_ARRAY_POINTER */
+       148, /* GL_COLOR_ARRAY_POINTER */
+       618, /* GL_INDEX_ARRAY_POINTER */
+      1625, /* GL_TEXTURE_COORD_ARRAY_POINTER */
+       452, /* GL_EDGE_FLAG_ARRAY_POINTER */
+       977, /* GL_MULTISAMPLE */
+      1363, /* GL_SAMPLE_ALPHA_TO_COVERAGE */
+      1365, /* GL_SAMPLE_ALPHA_TO_ONE */
+      1370, /* GL_SAMPLE_COVERAGE */
+      1367, /* GL_SAMPLE_BUFFERS */
+      1358, /* GL_SAMPLES */
+      1374, /* GL_SAMPLE_COVERAGE_VALUE */
+      1372, /* GL_SAMPLE_COVERAGE_INVERT */
+       192, /* GL_COLOR_MATRIX */
+       194, /* GL_COLOR_MATRIX_STACK_DEPTH */
+       840, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */
+      1172, /* GL_POST_COLOR_MATRIX_RED_SCALE */
+      1168, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */
+      1163, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */
+      1159, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */
+      1170, /* GL_POST_COLOR_MATRIX_RED_BIAS */
+      1166, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */
+      1161, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */
+      1157, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */
+      1605, /* GL_TEXTURE_COLOR_TABLE_SGI */
+      1247, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */
+      1607, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */
         79, /* GL_BLEND_DST_RGB */
-        87, /* GL_BLEND_SRC_RGB */
+        88, /* GL_BLEND_SRC_RGB */
         78, /* GL_BLEND_DST_ALPHA */
-        86, /* GL_BLEND_SRC_ALPHA */
-       197, /* GL_COLOR_TABLE */
-      1190, /* GL_POST_CONVOLUTION_COLOR_TABLE */
-      1173, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
-      1243, /* GL_PROXY_COLOR_TABLE */
-      1247, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
-      1246, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
-       221, /* GL_COLOR_TABLE_SCALE */
-       201, /* GL_COLOR_TABLE_BIAS */
-       206, /* GL_COLOR_TABLE_FORMAT */
-       223, /* GL_COLOR_TABLE_WIDTH */
-       218, /* GL_COLOR_TABLE_RED_SIZE */
-       209, /* GL_COLOR_TABLE_GREEN_SIZE */
-       203, /* GL_COLOR_TABLE_BLUE_SIZE */
-       198, /* GL_COLOR_TABLE_ALPHA_SIZE */
-       215, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
-       212, /* GL_COLOR_TABLE_INTENSITY_SIZE */
+        87, /* GL_BLEND_SRC_ALPHA */
+       198, /* GL_COLOR_TABLE */
+      1182, /* GL_POST_CONVOLUTION_COLOR_TABLE */
+      1165, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */
+      1235, /* GL_PROXY_COLOR_TABLE */
+      1239, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */
+      1238, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */
+       222, /* GL_COLOR_TABLE_SCALE */
+       202, /* GL_COLOR_TABLE_BIAS */
+       207, /* GL_COLOR_TABLE_FORMAT */
+       224, /* GL_COLOR_TABLE_WIDTH */
+       219, /* GL_COLOR_TABLE_RED_SIZE */
+       210, /* GL_COLOR_TABLE_GREEN_SIZE */
+       204, /* GL_COLOR_TABLE_BLUE_SIZE */
+       199, /* GL_COLOR_TABLE_ALPHA_SIZE */
+       216, /* GL_COLOR_TABLE_LUMINANCE_SIZE */
+       213, /* GL_COLOR_TABLE_INTENSITY_SIZE */
         70, /* GL_BGR */
         71, /* GL_BGRA */
-       866, /* GL_MAX_ELEMENTS_VERTICES */
-       865, /* GL_MAX_ELEMENTS_INDICES */
-      1657, /* GL_TEXTURE_INDEX_SIZE_EXT */
-       141, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
-      1137, /* GL_POINT_SIZE_MIN */
-      1133, /* GL_POINT_SIZE_MAX */
-      1127, /* GL_POINT_FADE_THRESHOLD_SIZE */
-      1123, /* GL_POINT_DISTANCE_ATTENUATION */
-       123, /* GL_CLAMP_TO_BORDER */
-       126, /* GL_CLAMP_TO_EDGE */
-      1678, /* GL_TEXTURE_MIN_LOD */
-      1676, /* GL_TEXTURE_MAX_LOD */
-      1582, /* GL_TEXTURE_BASE_LEVEL */
-      1675, /* GL_TEXTURE_MAX_LEVEL */
-       620, /* GL_IGNORE_BORDER_HP */
-       267, /* GL_CONSTANT_BORDER_HP */
-      1313, /* GL_REPLICATE_BORDER_HP */
-       273, /* GL_CONVOLUTION_BORDER_COLOR */
-      1038, /* GL_OCCLUSION_TEST_HP */
-      1039, /* GL_OCCLUSION_TEST_RESULT_HP */
-       691, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
-      1597, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
-      1599, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
-      1601, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
-      1602, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-      1600, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
-      1598, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
-       848, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
-       849, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
-      1200, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
-      1202, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
-      1199, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
-      1201, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
-      1665, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
-      1666, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
-      1664, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
-       566, /* GL_GENERATE_MIPMAP */
-       567, /* GL_GENERATE_MIPMAP_HINT */
-       508, /* GL_FOG_OFFSET_SGIX */
-       509, /* GL_FOG_OFFSET_VALUE_SGIX */
-      1611, /* GL_TEXTURE_COMPARE_SGIX */
-      1610, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
-      1661, /* GL_TEXTURE_LEQUAL_R_SGIX */
-      1653, /* GL_TEXTURE_GEQUAL_R_SGIX */
-       346, /* GL_DEPTH_COMPONENT16 */
-       349, /* GL_DEPTH_COMPONENT24 */
-       352, /* GL_DEPTH_COMPONENT32 */
-       295, /* GL_CULL_VERTEX_EXT */
-       297, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
-       296, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
-      1809, /* GL_WRAP_BORDER_SUN */
-      1604, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
-       684, /* GL_LIGHT_MODEL_COLOR_CONTROL */
-      1408, /* GL_SINGLE_COLOR */
-      1396, /* GL_SEPARATE_SPECULAR_COLOR */
-      1405, /* GL_SHARED_TEXTURE_PALETTE_EXT */
-       519, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
-       520, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
-       527, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
-       522, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
-       518, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
-       517, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
-       521, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
-       528, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
-       539, /* GL_FRAMEBUFFER_DEFAULT */
-       552, /* GL_FRAMEBUFFER_UNDEFINED */
-       359, /* GL_DEPTH_STENCIL_ATTACHMENT */
-       626, /* GL_INDEX */
-      1721, /* GL_UNSIGNED_BYTE_2_3_3_REV */
-      1736, /* GL_UNSIGNED_SHORT_5_6_5 */
-      1737, /* GL_UNSIGNED_SHORT_5_6_5_REV */
-      1734, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
-      1732, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
-      1729, /* GL_UNSIGNED_INT_8_8_8_8_REV */
-      1727, /* GL_UNSIGNED_INT_2_10_10_10_REV */
-      1673, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
-      1674, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
-      1672, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
-       940, /* GL_MIRRORED_REPEAT */
-      1352, /* GL_RGB_S3TC */
-      1329, /* GL_RGB4_S3TC */
-      1351, /* GL_RGBA_S3TC */
-      1346, /* GL_RGBA4_S3TC */
-      1349, /* GL_RGBA_DXT5_S3TC */
-      1344, /* GL_RGBA4_DXT5_S3TC */
-       260, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
-       255, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
-       256, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
-       257, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
-      1001, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
-      1000, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
-       692, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
-       495, /* GL_FOG_COORDINATE_SOURCE */
-       487, /* GL_FOG_COORD */
-       511, /* GL_FRAGMENT_DEPTH */
-       301, /* GL_CURRENT_FOG_COORD */
-       494, /* GL_FOG_COORDINATE_ARRAY_TYPE */
-       493, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
-       492, /* GL_FOG_COORDINATE_ARRAY_POINTER */
-       489, /* GL_FOG_COORDINATE_ARRAY */
-       195, /* GL_COLOR_SUM */
-       320, /* GL_CURRENT_SECONDARY_COLOR */
-      1389, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
-      1391, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
-      1390, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
-      1388, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
-      1385, /* GL_SECONDARY_COLOR_ARRAY */
-       576, /* GL_GL_CURRENT_RASTER_SECONDARY_COLOR */
+       854, /* GL_MAX_ELEMENTS_VERTICES */
+       853, /* GL_MAX_ELEMENTS_INDICES */
+      1659, /* GL_TEXTURE_INDEX_SIZE_EXT */
+       142, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */
+      1129, /* GL_POINT_SIZE_MIN */
+      1125, /* GL_POINT_SIZE_MAX */
+      1119, /* GL_POINT_FADE_THRESHOLD_SIZE */
+      1115, /* GL_POINT_DISTANCE_ATTENUATION */
+       124, /* GL_CLAMP_TO_BORDER */
+       127, /* GL_CLAMP_TO_EDGE */
+      1680, /* GL_TEXTURE_MIN_LOD */
+      1678, /* GL_TEXTURE_MAX_LOD */
+      1584, /* GL_TEXTURE_BASE_LEVEL */
+      1677, /* GL_TEXTURE_MAX_LEVEL */
+       608, /* GL_IGNORE_BORDER_HP */
+       272, /* GL_CONSTANT_BORDER_HP */
+      1305, /* GL_REPLICATE_BORDER_HP */
+       278, /* GL_CONVOLUTION_BORDER_COLOR */
+      1026, /* GL_OCCLUSION_TEST_HP */
+      1027, /* GL_OCCLUSION_TEST_RESULT_HP */
+       679, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */
+      1599, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */
+      1601, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */
+      1603, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */
+      1604, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+      1602, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */
+      1600, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */
+       836, /* GL_MAX_CLIPMAP_DEPTH_SGIX */
+       837, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */
+      1192, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */
+      1194, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */
+      1191, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */
+      1193, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */
+      1667, /* GL_TEXTURE_LOD_BIAS_S_SGIX */
+      1668, /* GL_TEXTURE_LOD_BIAS_T_SGIX */
+      1666, /* GL_TEXTURE_LOD_BIAS_R_SGIX */
+       578, /* GL_GENERATE_MIPMAP */
+       579, /* GL_GENERATE_MIPMAP_HINT */
+       520, /* GL_FOG_OFFSET_SGIX */
+       521, /* GL_FOG_OFFSET_VALUE_SGIX */
+      1613, /* GL_TEXTURE_COMPARE_SGIX */
+      1612, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */
+      1663, /* GL_TEXTURE_LEQUAL_R_SGIX */
+      1655, /* GL_TEXTURE_GEQUAL_R_SGIX */
+       352, /* GL_DEPTH_COMPONENT16 */
+       355, /* GL_DEPTH_COMPONENT24 */
+       358, /* GL_DEPTH_COMPONENT32 */
+       300, /* GL_CULL_VERTEX_EXT */
+       302, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */
+       301, /* GL_CULL_VERTEX_EYE_POSITION_EXT */
+      1811, /* GL_WRAP_BORDER_SUN */
+      1606, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */
+       672, /* GL_LIGHT_MODEL_COLOR_CONTROL */
+      1403, /* GL_SINGLE_COLOR */
+      1390, /* GL_SEPARATE_SPECULAR_COLOR */
+      1399, /* GL_SHARED_TEXTURE_PALETTE_EXT */
+       531, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */
+       532, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */
+       539, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */
+       534, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */
+       530, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */
+       529, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */
+       533, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */
+       540, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */
+       551, /* GL_FRAMEBUFFER_DEFAULT */
+       564, /* GL_FRAMEBUFFER_UNDEFINED */
+       365, /* GL_DEPTH_STENCIL_ATTACHMENT */
+       614, /* GL_INDEX */
+      1723, /* GL_UNSIGNED_BYTE_2_3_3_REV */
+      1738, /* GL_UNSIGNED_SHORT_5_6_5 */
+      1739, /* GL_UNSIGNED_SHORT_5_6_5_REV */
+      1736, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */
+      1734, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */
+      1731, /* GL_UNSIGNED_INT_8_8_8_8_REV */
+      1729, /* GL_UNSIGNED_INT_2_10_10_10_REV */
+      1675, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */
+      1676, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */
+      1674, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */
+       928, /* GL_MIRRORED_REPEAT */
+      1346, /* GL_RGB_S3TC */
+      1321, /* GL_RGB4_S3TC */
+      1344, /* GL_RGBA_S3TC */
+      1338, /* GL_RGBA4_S3TC */
+      1342, /* GL_RGBA_DXT5_S3TC */
+      1336, /* GL_RGBA4_DXT5_S3TC */
+       261, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */
+       256, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */
+       257, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */
+       258, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */
+       989, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */
+       988, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */
+       680, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */
+       507, /* GL_FOG_COORDINATE_SOURCE */
+       499, /* GL_FOG_COORD */
+       523, /* GL_FRAGMENT_DEPTH */
+       306, /* GL_CURRENT_FOG_COORD */
+       506, /* GL_FOG_COORDINATE_ARRAY_TYPE */
+       505, /* GL_FOG_COORDINATE_ARRAY_STRIDE */
+       504, /* GL_FOG_COORDINATE_ARRAY_POINTER */
+       501, /* GL_FOG_COORDINATE_ARRAY */
+       196, /* GL_COLOR_SUM */
+       326, /* GL_CURRENT_SECONDARY_COLOR */
+      1383, /* GL_SECONDARY_COLOR_ARRAY_SIZE */
+      1385, /* GL_SECONDARY_COLOR_ARRAY_TYPE */
+      1384, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */
+      1382, /* GL_SECONDARY_COLOR_ARRAY_POINTER */
+      1379, /* GL_SECONDARY_COLOR_ARRAY */
+       324, /* GL_CURRENT_RASTER_SECONDARY_COLOR */
         28, /* GL_ALIASED_POINT_SIZE_RANGE */
         27, /* GL_ALIASED_LINE_WIDTH_RANGE */
-      1511, /* GL_TEXTURE0 */
-      1513, /* GL_TEXTURE1 */
-      1535, /* GL_TEXTURE2 */
-      1557, /* GL_TEXTURE3 */
-      1563, /* GL_TEXTURE4 */
-      1565, /* GL_TEXTURE5 */
-      1567, /* GL_TEXTURE6 */
-      1569, /* GL_TEXTURE7 */
-      1571, /* GL_TEXTURE8 */
-      1573, /* GL_TEXTURE9 */
-      1514, /* GL_TEXTURE10 */
-      1516, /* GL_TEXTURE11 */
-      1518, /* GL_TEXTURE12 */
-      1520, /* GL_TEXTURE13 */
-      1522, /* GL_TEXTURE14 */
-      1524, /* GL_TEXTURE15 */
-      1526, /* GL_TEXTURE16 */
-      1528, /* GL_TEXTURE17 */
-      1530, /* GL_TEXTURE18 */
-      1532, /* GL_TEXTURE19 */
-      1536, /* GL_TEXTURE20 */
-      1538, /* GL_TEXTURE21 */
-      1540, /* GL_TEXTURE22 */
-      1542, /* GL_TEXTURE23 */
-      1544, /* GL_TEXTURE24 */
-      1546, /* GL_TEXTURE25 */
-      1548, /* GL_TEXTURE26 */
-      1550, /* GL_TEXTURE27 */
-      1552, /* GL_TEXTURE28 */
-      1554, /* GL_TEXTURE29 */
-      1558, /* GL_TEXTURE30 */
-      1560, /* GL_TEXTURE31 */
+      1513, /* GL_TEXTURE0 */
+      1515, /* GL_TEXTURE1 */
+      1537, /* GL_TEXTURE2 */
+      1559, /* GL_TEXTURE3 */
+      1565, /* GL_TEXTURE4 */
+      1567, /* GL_TEXTURE5 */
+      1569, /* GL_TEXTURE6 */
+      1571, /* GL_TEXTURE7 */
+      1573, /* GL_TEXTURE8 */
+      1575, /* GL_TEXTURE9 */
+      1516, /* GL_TEXTURE10 */
+      1518, /* GL_TEXTURE11 */
+      1520, /* GL_TEXTURE12 */
+      1522, /* GL_TEXTURE13 */
+      1524, /* GL_TEXTURE14 */
+      1526, /* GL_TEXTURE15 */
+      1528, /* GL_TEXTURE16 */
+      1530, /* GL_TEXTURE17 */
+      1532, /* GL_TEXTURE18 */
+      1534, /* GL_TEXTURE19 */
+      1538, /* GL_TEXTURE20 */
+      1540, /* GL_TEXTURE21 */
+      1542, /* GL_TEXTURE22 */
+      1544, /* GL_TEXTURE23 */
+      1546, /* GL_TEXTURE24 */
+      1548, /* GL_TEXTURE25 */
+      1550, /* GL_TEXTURE26 */
+      1552, /* GL_TEXTURE27 */
+      1554, /* GL_TEXTURE28 */
+      1556, /* GL_TEXTURE29 */
+      1560, /* GL_TEXTURE30 */
+      1562, /* GL_TEXTURE31 */
         18, /* GL_ACTIVE_TEXTURE */
-       129, /* GL_CLIENT_ACTIVE_TEXTURE */
-       918, /* GL_MAX_TEXTURE_UNITS */
-      1700, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
-      1703, /* GL_TRANSPOSE_PROJECTION_MATRIX */
-      1705, /* GL_TRANSPOSE_TEXTURE_MATRIX */
-      1697, /* GL_TRANSPOSE_COLOR_MATRIX */
-      1499, /* GL_SUBTRACT */
-       906, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
-       243, /* GL_COMPRESSED_ALPHA */
-       247, /* GL_COMPRESSED_LUMINANCE */
-       248, /* GL_COMPRESSED_LUMINANCE_ALPHA */
-       245, /* GL_COMPRESSED_INTENSITY */
-       251, /* GL_COMPRESSED_RGB */
-       252, /* GL_COMPRESSED_RGBA */
-      1618, /* GL_TEXTURE_COMPRESSION_HINT */
-      1680, /* GL_TEXTURE_RECTANGLE_ARB */
-      1590, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
-      1258, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
-       904, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
-       358, /* GL_DEPTH_STENCIL */
-      1725, /* GL_UNSIGNED_INT_24_8 */
-       914, /* GL_MAX_TEXTURE_LOD_BIAS */
-      1671, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
-       915, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
-      1647, /* GL_TEXTURE_FILTER_CONTROL */
-      1662, /* GL_TEXTURE_LOD_BIAS */
-       228, /* GL_COMBINE4 */
-       908, /* GL_MAX_SHININESS_NV */
-       909, /* GL_MAX_SPOT_EXPONENT_NV */
-       624, /* GL_INCR_WRAP */
-       331, /* GL_DECR_WRAP */
-       960, /* GL_MODELVIEW1_ARB */
-      1016, /* GL_NORMAL_MAP */
-      1288, /* GL_REFLECTION_MAP */
-      1627, /* GL_TEXTURE_CUBE_MAP */
-      1588, /* GL_TEXTURE_BINDING_CUBE_MAP */
-      1635, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
-      1629, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
-      1637, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
-      1631, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
-      1639, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
-      1633, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
-      1256, /* GL_PROXY_TEXTURE_CUBE_MAP */
-       860, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
-       995, /* GL_MULTISAMPLE_FILTER_HINT_NV */
-       503, /* GL_FOG_DISTANCE_MODE_NV */
-       462, /* GL_EYE_RADIAL_NV */
-       461, /* GL_EYE_PLANE_ABSOLUTE_NV */
-       227, /* GL_COMBINE */
-       234, /* GL_COMBINE_RGB */
-       229, /* GL_COMBINE_ALPHA */
-      1353, /* GL_RGB_SCALE */
+       130, /* GL_CLIENT_ACTIVE_TEXTURE */
+       906, /* GL_MAX_TEXTURE_UNITS */
+      1702, /* GL_TRANSPOSE_MODELVIEW_MATRIX */
+      1705, /* GL_TRANSPOSE_PROJECTION_MATRIX */
+      1707, /* GL_TRANSPOSE_TEXTURE_MATRIX */
+      1699, /* GL_TRANSPOSE_COLOR_MATRIX */
+      1501, /* GL_SUBTRACT */
+       894, /* GL_MAX_RENDERBUFFER_SIZE_EXT */
+       244, /* GL_COMPRESSED_ALPHA */
+       248, /* GL_COMPRESSED_LUMINANCE */
+       249, /* GL_COMPRESSED_LUMINANCE_ALPHA */
+       246, /* GL_COMPRESSED_INTENSITY */
+       252, /* GL_COMPRESSED_RGB */
+       253, /* GL_COMPRESSED_RGBA */
+      1620, /* GL_TEXTURE_COMPRESSION_HINT */
+      1682, /* GL_TEXTURE_RECTANGLE_ARB */
+      1592, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */
+      1250, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */
+       892, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */
+       364, /* GL_DEPTH_STENCIL */
+      1727, /* GL_UNSIGNED_INT_24_8 */
+       902, /* GL_MAX_TEXTURE_LOD_BIAS */
+      1673, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */
+       903, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */
+      1649, /* GL_TEXTURE_FILTER_CONTROL */
+      1664, /* GL_TEXTURE_LOD_BIAS */
+       229, /* GL_COMBINE4 */
+       896, /* GL_MAX_SHININESS_NV */
+       897, /* GL_MAX_SPOT_EXPONENT_NV */
+       612, /* GL_INCR_WRAP */
+       337, /* GL_DECR_WRAP */
+       948, /* GL_MODELVIEW1_ARB */
+      1004, /* GL_NORMAL_MAP */
+      1280, /* GL_REFLECTION_MAP */
+      1629, /* GL_TEXTURE_CUBE_MAP */
+      1590, /* GL_TEXTURE_BINDING_CUBE_MAP */
+      1637, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */
+      1631, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */
+      1639, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */
+      1633, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */
+      1641, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */
+      1635, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */
+      1248, /* GL_PROXY_TEXTURE_CUBE_MAP */
+       848, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */
+       983, /* GL_MULTISAMPLE_FILTER_HINT_NV */
+       515, /* GL_FOG_DISTANCE_MODE_NV */
+       468, /* GL_EYE_RADIAL_NV */
+       467, /* GL_EYE_PLANE_ABSOLUTE_NV */
+       228, /* GL_COMBINE */
+       235, /* GL_COMBINE_RGB */
+       230, /* GL_COMBINE_ALPHA */
+      1347, /* GL_RGB_SCALE */
         24, /* GL_ADD_SIGNED */
-       652, /* GL_INTERPOLATE */
-       262, /* GL_CONSTANT */
-      1206, /* GL_PRIMARY_COLOR */
-      1203, /* GL_PREVIOUS */
-      1419, /* GL_SOURCE0_RGB */
-      1425, /* GL_SOURCE1_RGB */
-      1431, /* GL_SOURCE2_RGB */
-      1435, /* GL_SOURCE3_RGB_NV */
-      1416, /* GL_SOURCE0_ALPHA */
-      1422, /* GL_SOURCE1_ALPHA */
-      1428, /* GL_SOURCE2_ALPHA */
-      1434, /* GL_SOURCE3_ALPHA_NV */
-      1052, /* GL_OPERAND0_RGB */
-      1058, /* GL_OPERAND1_RGB */
-      1064, /* GL_OPERAND2_RGB */
-      1068, /* GL_OPERAND3_RGB_NV */
-      1049, /* GL_OPERAND0_ALPHA */
-      1055, /* GL_OPERAND1_ALPHA */
-      1061, /* GL_OPERAND2_ALPHA */
-      1067, /* GL_OPERAND3_ALPHA_NV */
-      1749, /* GL_VERTEX_ARRAY_BINDING_APPLE */
-      1813, /* GL_YCBCR_422_APPLE */
-      1738, /* GL_UNSIGNED_SHORT_8_8_APPLE */
-      1740, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
-      1410, /* GL_SLICE_ACCUM_SUN */
-      1263, /* GL_QUAD_MESH_SUN */
-      1709, /* GL_TRIANGLE_MESH_SUN */
-      1787, /* GL_VERTEX_PROGRAM_ARB */
-      1798, /* GL_VERTEX_STATE_PROGRAM_NV */
-      1774, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
-      1780, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
-      1782, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
-      1784, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
-       322, /* GL_CURRENT_VERTEX_ATTRIB */
-      1219, /* GL_PROGRAM_LENGTH_ARB */
-      1233, /* GL_PROGRAM_STRING_ARB */
-       982, /* GL_MODELVIEW_PROJECTION_NV */
-       619, /* GL_IDENTITY_NV */
-       666, /* GL_INVERSE_NV */
-      1702, /* GL_TRANSPOSE_NV */
-       667, /* GL_INVERSE_TRANSPOSE_NV */
-       890, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
-       889, /* GL_MAX_PROGRAM_MATRICES_ARB */
-       797, /* GL_MATRIX0_NV */
-       809, /* GL_MATRIX1_NV */
-       821, /* GL_MATRIX2_NV */
-       825, /* GL_MATRIX3_NV */
-       827, /* GL_MATRIX4_NV */
-       829, /* GL_MATRIX5_NV */
-       831, /* GL_MATRIX6_NV */
-       833, /* GL_MATRIX7_NV */
-       307, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
-       304, /* GL_CURRENT_MATRIX_ARB */
-      1790, /* GL_VERTEX_PROGRAM_POINT_SIZE */
-      1793, /* GL_VERTEX_PROGRAM_TWO_SIDE */
-      1231, /* GL_PROGRAM_PARAMETER_NV */
-      1778, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
-      1235, /* GL_PROGRAM_TARGET_NV */
-      1232, /* GL_PROGRAM_RESIDENT_NV */
-      1694, /* GL_TRACK_MATRIX_NV */
-      1695, /* GL_TRACK_MATRIX_TRANSFORM_NV */
-      1788, /* GL_VERTEX_PROGRAM_BINDING_NV */
-      1213, /* GL_PROGRAM_ERROR_POSITION_ARB */
-       343, /* GL_DEPTH_CLAMP_NV */
-      1756, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
-      1763, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
-      1764, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
-      1765, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
-      1766, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
-      1767, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
-      1768, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
-      1769, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
-      1770, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
-      1771, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
-      1757, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
-      1758, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
-      1759, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
-      1760, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
-      1761, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
-      1762, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
-       751, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
-       758, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
-       759, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
-       760, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
-       761, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
-       762, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
-       763, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
-       764, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
-       765, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
-       766, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
-       752, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
-       753, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
-       754, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
-       755, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
-       756, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
-       757, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
-       778, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
-       785, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
-       786, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
-       787, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
-       788, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
-       789, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
-       790, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
-      1212, /* GL_PROGRAM_BINDING_ARB */
-       792, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
-       793, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
-       779, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
-       780, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
-       781, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
-       782, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
-       783, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
-       784, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
-      1616, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
-      1613, /* GL_TEXTURE_COMPRESSED */
-      1021, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
-       261, /* GL_COMPRESSED_TEXTURE_FORMATS */
-       930, /* GL_MAX_VERTEX_UNITS_ARB */
+       640, /* GL_INTERPOLATE */
+       267, /* GL_CONSTANT */
+      1198, /* GL_PRIMARY_COLOR */
+      1195, /* GL_PREVIOUS */
+      1418, /* GL_SOURCE0_RGB */
+      1424, /* GL_SOURCE1_RGB */
+      1430, /* GL_SOURCE2_RGB */
+      1434, /* GL_SOURCE3_RGB_NV */
+      1415, /* GL_SOURCE0_ALPHA */
+      1421, /* GL_SOURCE1_ALPHA */
+      1427, /* GL_SOURCE2_ALPHA */
+      1433, /* GL_SOURCE3_ALPHA_NV */
+      1040, /* GL_OPERAND0_RGB */
+      1046, /* GL_OPERAND1_RGB */
+      1052, /* GL_OPERAND2_RGB */
+      1056, /* GL_OPERAND3_RGB_NV */
+      1037, /* GL_OPERAND0_ALPHA */
+      1043, /* GL_OPERAND1_ALPHA */
+      1049, /* GL_OPERAND2_ALPHA */
+      1055, /* GL_OPERAND3_ALPHA_NV */
+      1751, /* GL_VERTEX_ARRAY_BINDING_APPLE */
+      1815, /* GL_YCBCR_422_APPLE */
+      1740, /* GL_UNSIGNED_SHORT_8_8_APPLE */
+      1742, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */
+      1405, /* GL_SLICE_ACCUM_SUN */
+      1255, /* GL_QUAD_MESH_SUN */
+      1711, /* GL_TRIANGLE_MESH_SUN */
+      1789, /* GL_VERTEX_PROGRAM_ARB */
+      1800, /* GL_VERTEX_STATE_PROGRAM_NV */
+      1776, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */
+      1782, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */
+      1784, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */
+      1786, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */
+       328, /* GL_CURRENT_VERTEX_ATTRIB */
+      1211, /* GL_PROGRAM_LENGTH_ARB */
+      1225, /* GL_PROGRAM_STRING_ARB */
+       970, /* GL_MODELVIEW_PROJECTION_NV */
+       607, /* GL_IDENTITY_NV */
+       654, /* GL_INVERSE_NV */
+      1704, /* GL_TRANSPOSE_NV */
+       655, /* GL_INVERSE_TRANSPOSE_NV */
+       878, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */
+       877, /* GL_MAX_PROGRAM_MATRICES_ARB */
+       785, /* GL_MATRIX0_NV */
+       797, /* GL_MATRIX1_NV */
+       809, /* GL_MATRIX2_NV */
+       813, /* GL_MATRIX3_NV */
+       815, /* GL_MATRIX4_NV */
+       817, /* GL_MATRIX5_NV */
+       819, /* GL_MATRIX6_NV */
+       821, /* GL_MATRIX7_NV */
+       312, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */
+       309, /* GL_CURRENT_MATRIX_ARB */
+      1792, /* GL_VERTEX_PROGRAM_POINT_SIZE */
+      1795, /* GL_VERTEX_PROGRAM_TWO_SIDE */
+      1223, /* GL_PROGRAM_PARAMETER_NV */
+      1780, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */
+      1227, /* GL_PROGRAM_TARGET_NV */
+      1224, /* GL_PROGRAM_RESIDENT_NV */
+      1696, /* GL_TRACK_MATRIX_NV */
+      1697, /* GL_TRACK_MATRIX_TRANSFORM_NV */
+      1790, /* GL_VERTEX_PROGRAM_BINDING_NV */
+      1205, /* GL_PROGRAM_ERROR_POSITION_ARB */
+       349, /* GL_DEPTH_CLAMP_NV */
+      1758, /* GL_VERTEX_ATTRIB_ARRAY0_NV */
+      1765, /* GL_VERTEX_ATTRIB_ARRAY1_NV */
+      1766, /* GL_VERTEX_ATTRIB_ARRAY2_NV */
+      1767, /* GL_VERTEX_ATTRIB_ARRAY3_NV */
+      1768, /* GL_VERTEX_ATTRIB_ARRAY4_NV */
+      1769, /* GL_VERTEX_ATTRIB_ARRAY5_NV */
+      1770, /* GL_VERTEX_ATTRIB_ARRAY6_NV */
+      1771, /* GL_VERTEX_ATTRIB_ARRAY7_NV */
+      1772, /* GL_VERTEX_ATTRIB_ARRAY8_NV */
+      1773, /* GL_VERTEX_ATTRIB_ARRAY9_NV */
+      1759, /* GL_VERTEX_ATTRIB_ARRAY10_NV */
+      1760, /* GL_VERTEX_ATTRIB_ARRAY11_NV */
+      1761, /* GL_VERTEX_ATTRIB_ARRAY12_NV */
+      1762, /* GL_VERTEX_ATTRIB_ARRAY13_NV */
+      1763, /* GL_VERTEX_ATTRIB_ARRAY14_NV */
+      1764, /* GL_VERTEX_ATTRIB_ARRAY15_NV */
+       739, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */
+       746, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */
+       747, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */
+       748, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */
+       749, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */
+       750, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */
+       751, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */
+       752, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */
+       753, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */
+       754, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */
+       740, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */
+       741, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */
+       742, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */
+       743, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */
+       744, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */
+       745, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */
+       766, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */
+       773, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */
+       774, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */
+       775, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */
+       776, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */
+       777, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */
+       778, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */
+      1204, /* GL_PROGRAM_BINDING_ARB */
+       780, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */
+       781, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */
+       767, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */
+       768, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */
+       769, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */
+       770, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */
+       771, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */
+       772, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */
+      1618, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */
+      1615, /* GL_TEXTURE_COMPRESSED */
+      1009, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */
+       266, /* GL_COMPRESSED_TEXTURE_FORMATS */
+       918, /* GL_MAX_VERTEX_UNITS_ARB */
         22, /* GL_ACTIVE_VERTEX_UNITS_ARB */
-      1808, /* GL_WEIGHT_SUM_UNITY_ARB */
-      1786, /* GL_VERTEX_BLEND_ARB */
-       324, /* GL_CURRENT_WEIGHT_ARB */
-      1807, /* GL_WEIGHT_ARRAY_TYPE_ARB */
-      1806, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
-      1805, /* GL_WEIGHT_ARRAY_SIZE_ARB */
-      1804, /* GL_WEIGHT_ARRAY_POINTER_ARB */
-      1801, /* GL_WEIGHT_ARRAY_ARB */
-       371, /* GL_DOT3_RGB */
-       372, /* GL_DOT3_RGBA */
-       259, /* GL_COMPRESSED_RGB_FXT1_3DFX */
-       254, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
-       990, /* GL_MULTISAMPLE_3DFX */
-      1374, /* GL_SAMPLE_BUFFERS_3DFX */
-      1365, /* GL_SAMPLES_3DFX */
-       971, /* GL_MODELVIEW2_ARB */
-       974, /* GL_MODELVIEW3_ARB */
-       975, /* GL_MODELVIEW4_ARB */
-       976, /* GL_MODELVIEW5_ARB */
-       977, /* GL_MODELVIEW6_ARB */
-       978, /* GL_MODELVIEW7_ARB */
-       979, /* GL_MODELVIEW8_ARB */
-       980, /* GL_MODELVIEW9_ARB */
-       950, /* GL_MODELVIEW10_ARB */
-       951, /* GL_MODELVIEW11_ARB */
-       952, /* GL_MODELVIEW12_ARB */
-       953, /* GL_MODELVIEW13_ARB */
-       954, /* GL_MODELVIEW14_ARB */
-       955, /* GL_MODELVIEW15_ARB */
-       956, /* GL_MODELVIEW16_ARB */
-       957, /* GL_MODELVIEW17_ARB */
-       958, /* GL_MODELVIEW18_ARB */
-       959, /* GL_MODELVIEW19_ARB */
-       961, /* GL_MODELVIEW20_ARB */
-       962, /* GL_MODELVIEW21_ARB */
-       963, /* GL_MODELVIEW22_ARB */
-       964, /* GL_MODELVIEW23_ARB */
-       965, /* GL_MODELVIEW24_ARB */
-       966, /* GL_MODELVIEW25_ARB */
-       967, /* GL_MODELVIEW26_ARB */
-       968, /* GL_MODELVIEW27_ARB */
-       969, /* GL_MODELVIEW28_ARB */
-       970, /* GL_MODELVIEW29_ARB */
-       972, /* GL_MODELVIEW30_ARB */
-       973, /* GL_MODELVIEW31_ARB */
-       376, /* GL_DOT3_RGB_EXT */
-       374, /* GL_DOT3_RGBA_EXT */
-       944, /* GL_MIRROR_CLAMP_EXT */
-       947, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
-       985, /* GL_MODULATE_ADD_ATI */
-       986, /* GL_MODULATE_SIGNED_ADD_ATI */
-       987, /* GL_MODULATE_SUBTRACT_ATI */
-      1814, /* GL_YCBCR_MESA */
-      1076, /* GL_PACK_INVERT_MESA */
-       327, /* GL_DEBUG_OBJECT_MESA */
-       328, /* GL_DEBUG_PRINT_MESA */
-       326, /* GL_DEBUG_ASSERT_MESA */
-       106, /* GL_BUFFER_SIZE */
-       108, /* GL_BUFFER_USAGE */
-       112, /* GL_BUMP_ROT_MATRIX_ATI */
-       113, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
-       111, /* GL_BUMP_NUM_TEX_UNITS_ATI */
-       115, /* GL_BUMP_TEX_UNITS_ATI */
-       435, /* GL_DUDV_ATI */
-       434, /* GL_DU8DV8_ATI */
-       110, /* GL_BUMP_ENVMAP_ATI */
-       114, /* GL_BUMP_TARGET_ATI */
-      1464, /* GL_STENCIL_BACK_FUNC */
-      1462, /* GL_STENCIL_BACK_FAIL */
-      1466, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
-      1468, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
-       512, /* GL_FRAGMENT_PROGRAM_ARB */
-      1210, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
-      1238, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
-      1237, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
-      1222, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-      1228, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-      1227, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-       879, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
-       902, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
-       901, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
-       892, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
-       898, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
-       897, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
-       862, /* GL_MAX_DRAW_BUFFERS */
-       380, /* GL_DRAW_BUFFER0 */
-       383, /* GL_DRAW_BUFFER1 */
-       404, /* GL_DRAW_BUFFER2 */
-       407, /* GL_DRAW_BUFFER3 */
-       410, /* GL_DRAW_BUFFER4 */
-       413, /* GL_DRAW_BUFFER5 */
-       416, /* GL_DRAW_BUFFER6 */
-       419, /* GL_DRAW_BUFFER7 */
-       422, /* GL_DRAW_BUFFER8 */
-       425, /* GL_DRAW_BUFFER9 */
-       384, /* GL_DRAW_BUFFER10 */
-       387, /* GL_DRAW_BUFFER11 */
-       390, /* GL_DRAW_BUFFER12 */
-       393, /* GL_DRAW_BUFFER13 */
-       396, /* GL_DRAW_BUFFER14 */
-       399, /* GL_DRAW_BUFFER15 */
+      1810, /* GL_WEIGHT_SUM_UNITY_ARB */
+      1788, /* GL_VERTEX_BLEND_ARB */
+       330, /* GL_CURRENT_WEIGHT_ARB */
+      1809, /* GL_WEIGHT_ARRAY_TYPE_ARB */
+      1808, /* GL_WEIGHT_ARRAY_STRIDE_ARB */
+      1807, /* GL_WEIGHT_ARRAY_SIZE_ARB */
+      1806, /* GL_WEIGHT_ARRAY_POINTER_ARB */
+      1803, /* GL_WEIGHT_ARRAY_ARB */
+       377, /* GL_DOT3_RGB */
+       378, /* GL_DOT3_RGBA */
+       260, /* GL_COMPRESSED_RGB_FXT1_3DFX */
+       255, /* GL_COMPRESSED_RGBA_FXT1_3DFX */
+       978, /* GL_MULTISAMPLE_3DFX */
+      1368, /* GL_SAMPLE_BUFFERS_3DFX */
+      1359, /* GL_SAMPLES_3DFX */
+       959, /* GL_MODELVIEW2_ARB */
+       962, /* GL_MODELVIEW3_ARB */
+       963, /* GL_MODELVIEW4_ARB */
+       964, /* GL_MODELVIEW5_ARB */
+       965, /* GL_MODELVIEW6_ARB */
+       966, /* GL_MODELVIEW7_ARB */
+       967, /* GL_MODELVIEW8_ARB */
+       968, /* GL_MODELVIEW9_ARB */
+       938, /* GL_MODELVIEW10_ARB */
+       939, /* GL_MODELVIEW11_ARB */
+       940, /* GL_MODELVIEW12_ARB */
+       941, /* GL_MODELVIEW13_ARB */
+       942, /* GL_MODELVIEW14_ARB */
+       943, /* GL_MODELVIEW15_ARB */
+       944, /* GL_MODELVIEW16_ARB */
+       945, /* GL_MODELVIEW17_ARB */
+       946, /* GL_MODELVIEW18_ARB */
+       947, /* GL_MODELVIEW19_ARB */
+       949, /* GL_MODELVIEW20_ARB */
+       950, /* GL_MODELVIEW21_ARB */
+       951, /* GL_MODELVIEW22_ARB */
+       952, /* GL_MODELVIEW23_ARB */
+       953, /* GL_MODELVIEW24_ARB */
+       954, /* GL_MODELVIEW25_ARB */
+       955, /* GL_MODELVIEW26_ARB */
+       956, /* GL_MODELVIEW27_ARB */
+       957, /* GL_MODELVIEW28_ARB */
+       958, /* GL_MODELVIEW29_ARB */
+       960, /* GL_MODELVIEW30_ARB */
+       961, /* GL_MODELVIEW31_ARB */
+       382, /* GL_DOT3_RGB_EXT */
+       380, /* GL_DOT3_RGBA_EXT */
+       932, /* GL_MIRROR_CLAMP_EXT */
+       935, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */
+       973, /* GL_MODULATE_ADD_ATI */
+       974, /* GL_MODULATE_SIGNED_ADD_ATI */
+       975, /* GL_MODULATE_SUBTRACT_ATI */
+      1816, /* GL_YCBCR_MESA */
+      1064, /* GL_PACK_INVERT_MESA */
+       333, /* GL_DEBUG_OBJECT_MESA */
+       334, /* GL_DEBUG_PRINT_MESA */
+       332, /* GL_DEBUG_ASSERT_MESA */
+       107, /* GL_BUFFER_SIZE */
+       109, /* GL_BUFFER_USAGE */
+       113, /* GL_BUMP_ROT_MATRIX_ATI */
+       114, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */
+       112, /* GL_BUMP_NUM_TEX_UNITS_ATI */
+       116, /* GL_BUMP_TEX_UNITS_ATI */
+       441, /* GL_DUDV_ATI */
+       440, /* GL_DU8DV8_ATI */
+       111, /* GL_BUMP_ENVMAP_ATI */
+       115, /* GL_BUMP_TARGET_ATI */
+      1466, /* GL_STENCIL_BACK_FUNC */
+      1464, /* GL_STENCIL_BACK_FAIL */
+      1468, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */
+      1470, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */
+       524, /* GL_FRAGMENT_PROGRAM_ARB */
+      1202, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */
+      1230, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */
+      1229, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */
+      1214, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+      1220, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+      1219, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+       867, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */
+       890, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */
+       889, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */
+       880, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */
+       886, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */
+       885, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */
+       850, /* GL_MAX_DRAW_BUFFERS */
+       386, /* GL_DRAW_BUFFER0 */
+       389, /* GL_DRAW_BUFFER1 */
+       410, /* GL_DRAW_BUFFER2 */
+       413, /* GL_DRAW_BUFFER3 */
+       416, /* GL_DRAW_BUFFER4 */
+       419, /* GL_DRAW_BUFFER5 */
+       422, /* GL_DRAW_BUFFER6 */
+       425, /* GL_DRAW_BUFFER7 */
+       428, /* GL_DRAW_BUFFER8 */
+       431, /* GL_DRAW_BUFFER9 */
+       390, /* GL_DRAW_BUFFER10 */
+       393, /* GL_DRAW_BUFFER11 */
+       396, /* GL_DRAW_BUFFER12 */
+       399, /* GL_DRAW_BUFFER13 */
+       402, /* GL_DRAW_BUFFER14 */
+       405, /* GL_DRAW_BUFFER15 */
         81, /* GL_BLEND_EQUATION_ALPHA */
-       842, /* GL_MATRIX_PALETTE_ARB */
-       873, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
-       876, /* GL_MAX_PALETTE_MATRICES_ARB */
-       310, /* GL_CURRENT_PALETTE_MATRIX_ARB */
-       836, /* GL_MATRIX_INDEX_ARRAY_ARB */
-       305, /* GL_CURRENT_MATRIX_INDEX_ARB */
-       838, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
-       840, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
-       839, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
-       837, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
-      1642, /* GL_TEXTURE_DEPTH_SIZE */
-       364, /* GL_DEPTH_TEXTURE_MODE */
-      1608, /* GL_TEXTURE_COMPARE_MODE */
-      1606, /* GL_TEXTURE_COMPARE_FUNC */
-       238, /* GL_COMPARE_R_TO_TEXTURE */
-      1144, /* GL_POINT_SPRITE */
-       287, /* GL_COORD_REPLACE */
-      1148, /* GL_POINT_SPRITE_R_MODE_NV */
-      1265, /* GL_QUERY_COUNTER_BITS */
-       312, /* GL_CURRENT_QUERY */
-      1267, /* GL_QUERY_RESULT */
-      1269, /* GL_QUERY_RESULT_AVAILABLE */
-       924, /* GL_MAX_VERTEX_ATTRIBS */
-      1776, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
-       362, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
-       361, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
-       910, /* GL_MAX_TEXTURE_COORDS */
-       912, /* GL_MAX_TEXTURE_IMAGE_UNITS */
-      1215, /* GL_PROGRAM_ERROR_STRING_ARB */
-      1217, /* GL_PROGRAM_FORMAT_ASCII_ARB */
-      1216, /* GL_PROGRAM_FORMAT_ARB */
-      1688, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
-       341, /* GL_DEPTH_BOUNDS_TEST_EXT */
-       340, /* GL_DEPTH_BOUNDS_EXT */
+       830, /* GL_MATRIX_PALETTE_ARB */
+       861, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */
+       864, /* GL_MAX_PALETTE_MATRICES_ARB */
+       315, /* GL_CURRENT_PALETTE_MATRIX_ARB */
+       824, /* GL_MATRIX_INDEX_ARRAY_ARB */
+       310, /* GL_CURRENT_MATRIX_INDEX_ARB */
+       826, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */
+       828, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */
+       827, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */
+       825, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */
+      1644, /* GL_TEXTURE_DEPTH_SIZE */
+       370, /* GL_DEPTH_TEXTURE_MODE */
+      1610, /* GL_TEXTURE_COMPARE_MODE */
+      1608, /* GL_TEXTURE_COMPARE_FUNC */
+       239, /* GL_COMPARE_R_TO_TEXTURE */
+      1136, /* GL_POINT_SPRITE */
+       292, /* GL_COORD_REPLACE */
+      1140, /* GL_POINT_SPRITE_R_MODE_NV */
+      1257, /* GL_QUERY_COUNTER_BITS */
+       317, /* GL_CURRENT_QUERY */
+      1259, /* GL_QUERY_RESULT */
+      1261, /* GL_QUERY_RESULT_AVAILABLE */
+       912, /* GL_MAX_VERTEX_ATTRIBS */
+      1778, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */
+       368, /* GL_DEPTH_STENCIL_TO_RGBA_NV */
+       367, /* GL_DEPTH_STENCIL_TO_BGRA_NV */
+       898, /* GL_MAX_TEXTURE_COORDS */
+       900, /* GL_MAX_TEXTURE_IMAGE_UNITS */
+      1207, /* GL_PROGRAM_ERROR_STRING_ARB */
+      1209, /* GL_PROGRAM_FORMAT_ASCII_ARB */
+      1208, /* GL_PROGRAM_FORMAT_ARB */
+      1690, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */
+       347, /* GL_DEPTH_BOUNDS_TEST_EXT */
+       346, /* GL_DEPTH_BOUNDS_EXT */
         52, /* GL_ARRAY_BUFFER */
-       448, /* GL_ELEMENT_ARRAY_BUFFER */
+       454, /* GL_ELEMENT_ARRAY_BUFFER */
         53, /* GL_ARRAY_BUFFER_BINDING */
-       449, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
-      1750, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
-      1011, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
-       145, /* GL_COLOR_ARRAY_BUFFER_BINDING */
-       628, /* GL_INDEX_ARRAY_BUFFER_BINDING */
-      1621, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
-       444, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
-      1386, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
-       490, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
-      1802, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
-      1772, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
-      1218, /* GL_PROGRAM_INSTRUCTIONS_ARB */
-       885, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
-      1224, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-       894, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
-      1236, /* GL_PROGRAM_TEMPORARIES_ARB */
-       900, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
-      1226, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
-       896, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
-      1230, /* GL_PROGRAM_PARAMETERS_ARB */
-       899, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
-      1225, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
-       895, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
-      1211, /* GL_PROGRAM_ATTRIBS_ARB */
-       880, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
-      1223, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
-       893, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
-      1209, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
-       878, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
-      1221, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-       891, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
-       886, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
-       882, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
-      1239, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
-      1699, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
-      1278, /* GL_READ_ONLY */
-      1810, /* GL_WRITE_ONLY */
-      1280, /* GL_READ_WRITE */
-       100, /* GL_BUFFER_ACCESS */
-       102, /* GL_BUFFER_MAPPED */
-       104, /* GL_BUFFER_MAP_POINTER */
-      1693, /* GL_TIME_ELAPSED_EXT */
-       796, /* GL_MATRIX0_ARB */
-       808, /* GL_MATRIX1_ARB */
-       820, /* GL_MATRIX2_ARB */
-       824, /* GL_MATRIX3_ARB */
-       826, /* GL_MATRIX4_ARB */
-       828, /* GL_MATRIX5_ARB */
-       830, /* GL_MATRIX6_ARB */
-       832, /* GL_MATRIX7_ARB */
-       834, /* GL_MATRIX8_ARB */
-       835, /* GL_MATRIX9_ARB */
-       798, /* GL_MATRIX10_ARB */
-       799, /* GL_MATRIX11_ARB */
-       800, /* GL_MATRIX12_ARB */
-       801, /* GL_MATRIX13_ARB */
-       802, /* GL_MATRIX14_ARB */
-       803, /* GL_MATRIX15_ARB */
-       804, /* GL_MATRIX16_ARB */
-       805, /* GL_MATRIX17_ARB */
-       806, /* GL_MATRIX18_ARB */
-       807, /* GL_MATRIX19_ARB */
-       810, /* GL_MATRIX20_ARB */
-       811, /* GL_MATRIX21_ARB */
-       812, /* GL_MATRIX22_ARB */
-       813, /* GL_MATRIX23_ARB */
-       814, /* GL_MATRIX24_ARB */
-       815, /* GL_MATRIX25_ARB */
-       816, /* GL_MATRIX26_ARB */
-       817, /* GL_MATRIX27_ARB */
-       818, /* GL_MATRIX28_ARB */
-       819, /* GL_MATRIX29_ARB */
-       822, /* GL_MATRIX30_ARB */
-       823, /* GL_MATRIX31_ARB */
-      1494, /* GL_STREAM_DRAW */
-      1496, /* GL_STREAM_READ */
-      1492, /* GL_STREAM_COPY */
-      1455, /* GL_STATIC_DRAW */
-      1457, /* GL_STATIC_READ */
-      1453, /* GL_STATIC_COPY */
-       438, /* GL_DYNAMIC_DRAW */
-       440, /* GL_DYNAMIC_READ */
-       436, /* GL_DYNAMIC_COPY */
-       583, /* GL_GL_PIXEL_PACK_BUFFER */
-       585, /* GL_GL_PIXEL_UNPACK_BUFFER */
-       584, /* GL_GL_PIXEL_PACK_BUFFER_BINDING */
-       586, /* GL_GL_PIXEL_UNPACK_BUFFER_BINDING */
-       335, /* GL_DEPTH24_STENCIL8 */
-      1686, /* GL_TEXTURE_STENCIL_SIZE */
-       883, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
-       881, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
-       884, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
-       888, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
-       887, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
-       845, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
-      1488, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
+       455, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */
+      1752, /* GL_VERTEX_ARRAY_BUFFER_BINDING */
+       999, /* GL_NORMAL_ARRAY_BUFFER_BINDING */
+       146, /* GL_COLOR_ARRAY_BUFFER_BINDING */
+       616, /* GL_INDEX_ARRAY_BUFFER_BINDING */
+      1623, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */
+       450, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */
+      1380, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */
+       502, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */
+      1804, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */
+      1774, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */
+      1210, /* GL_PROGRAM_INSTRUCTIONS_ARB */
+       873, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */
+      1216, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+       882, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */
+      1228, /* GL_PROGRAM_TEMPORARIES_ARB */
+       888, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */
+      1218, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */
+       884, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */
+      1222, /* GL_PROGRAM_PARAMETERS_ARB */
+       887, /* GL_MAX_PROGRAM_PARAMETERS_ARB */
+      1217, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */
+       883, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */
+      1203, /* GL_PROGRAM_ATTRIBS_ARB */
+       868, /* GL_MAX_PROGRAM_ATTRIBS_ARB */
+      1215, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */
+       881, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */
+      1201, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */
+       866, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */
+      1213, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+       879, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */
+       874, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */
+       870, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */
+      1231, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */
+      1701, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */
+      1270, /* GL_READ_ONLY */
+      1812, /* GL_WRITE_ONLY */
+      1272, /* GL_READ_WRITE */
+       101, /* GL_BUFFER_ACCESS */
+       103, /* GL_BUFFER_MAPPED */
+       105, /* GL_BUFFER_MAP_POINTER */
+      1695, /* GL_TIME_ELAPSED_EXT */
+       784, /* GL_MATRIX0_ARB */
+       796, /* GL_MATRIX1_ARB */
+       808, /* GL_MATRIX2_ARB */
+       812, /* GL_MATRIX3_ARB */
+       814, /* GL_MATRIX4_ARB */
+       816, /* GL_MATRIX5_ARB */
+       818, /* GL_MATRIX6_ARB */
+       820, /* GL_MATRIX7_ARB */
+       822, /* GL_MATRIX8_ARB */
+       823, /* GL_MATRIX9_ARB */
+       786, /* GL_MATRIX10_ARB */
+       787, /* GL_MATRIX11_ARB */
+       788, /* GL_MATRIX12_ARB */
+       789, /* GL_MATRIX13_ARB */
+       790, /* GL_MATRIX14_ARB */
+       791, /* GL_MATRIX15_ARB */
+       792, /* GL_MATRIX16_ARB */
+       793, /* GL_MATRIX17_ARB */
+       794, /* GL_MATRIX18_ARB */
+       795, /* GL_MATRIX19_ARB */
+       798, /* GL_MATRIX20_ARB */
+       799, /* GL_MATRIX21_ARB */
+       800, /* GL_MATRIX22_ARB */
+       801, /* GL_MATRIX23_ARB */
+       802, /* GL_MATRIX24_ARB */
+       803, /* GL_MATRIX25_ARB */
+       804, /* GL_MATRIX26_ARB */
+       805, /* GL_MATRIX27_ARB */
+       806, /* GL_MATRIX28_ARB */
+       807, /* GL_MATRIX29_ARB */
+       810, /* GL_MATRIX30_ARB */
+       811, /* GL_MATRIX31_ARB */
+      1496, /* GL_STREAM_DRAW */
+      1498, /* GL_STREAM_READ */
+      1494, /* GL_STREAM_COPY */
+      1457, /* GL_STATIC_DRAW */
+      1459, /* GL_STATIC_READ */
+      1455, /* GL_STATIC_COPY */
+       444, /* GL_DYNAMIC_DRAW */
+       446, /* GL_DYNAMIC_READ */
+       442, /* GL_DYNAMIC_COPY */
+      1104, /* GL_PIXEL_PACK_BUFFER */
+      1108, /* GL_PIXEL_UNPACK_BUFFER */
+      1105, /* GL_PIXEL_PACK_BUFFER_BINDING */
+      1109, /* GL_PIXEL_UNPACK_BUFFER_BINDING */
+       341, /* GL_DEPTH24_STENCIL8 */
+      1688, /* GL_TEXTURE_STENCIL_SIZE */
+       871, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
+       869, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */
+       872, /* GL_MAX_PROGRAM_IF_DEPTH_NV */
+       876, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */
+       875, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */
+       833, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */
+      1490, /* GL_STENCIL_TEST_TWO_SIDE_EXT */
         17, /* GL_ACTIVE_STENCIL_FACE_EXT */
-       945, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
-      1367, /* GL_SAMPLES_PASSED */
-       513, /* GL_FRAGMENT_SHADER */
-      1796, /* GL_VERTEX_SHADER */
-      1229, /* GL_PROGRAM_OBJECT_ARB */
-      1399, /* GL_SHADER_OBJECT_ARB */
-       869, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
-       928, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
-       922, /* GL_MAX_VARYING_FLOATS */
-       926, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
-       854, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
-      1036, /* GL_OBJECT_TYPE_ARB */
-      1401, /* GL_SHADER_TYPE */
-       478, /* GL_FLOAT_VEC2 */
-       480, /* GL_FLOAT_VEC3 */
-       482, /* GL_FLOAT_VEC4 */
-       655, /* GL_INT_VEC2 */
-       657, /* GL_INT_VEC3 */
-       659, /* GL_INT_VEC4 */
-        92, /* GL_BOOL */
-        94, /* GL_BOOL_VEC2 */
-        96, /* GL_BOOL_VEC3 */
-        98, /* GL_BOOL_VEC4 */
-       472, /* GL_FLOAT_MAT2 */
-       474, /* GL_FLOAT_MAT3 */
-       476, /* GL_FLOAT_MAT4 */
-      1358, /* GL_SAMPLER_1D */
-      1360, /* GL_SAMPLER_2D */
-      1362, /* GL_SAMPLER_3D */
-      1363, /* GL_SAMPLER_CUBE */
-      1359, /* GL_SAMPLER_1D_SHADOW */
-      1361, /* GL_SAMPLER_2D_SHADOW */
-       577, /* GL_GL_FLOAT_MAT2x3 */
-       578, /* GL_GL_FLOAT_MAT2x4 */
-       579, /* GL_GL_FLOAT_MAT3x2 */
-       580, /* GL_GL_FLOAT_MAT3x4 */
-       581, /* GL_GL_FLOAT_MAT4x2 */
-       582, /* GL_GL_FLOAT_MAT4x3 */
-       333, /* GL_DELETE_STATUS */
-       242, /* GL_COMPILE_STATUS */
-       709, /* GL_LINK_STATUS */
-      1745, /* GL_VALIDATE_STATUS */
-       640, /* GL_INFO_LOG_LENGTH */
+       933, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */
+      1361, /* GL_SAMPLES_PASSED */
+       525, /* GL_FRAGMENT_SHADER */
+      1798, /* GL_VERTEX_SHADER */
+      1221, /* GL_PROGRAM_OBJECT_ARB */
+      1393, /* GL_SHADER_OBJECT_ARB */
+       857, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */
+       916, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */
+       910, /* GL_MAX_VARYING_FLOATS */
+       914, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */
+       842, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */
+      1024, /* GL_OBJECT_TYPE_ARB */
+      1395, /* GL_SHADER_TYPE */
+       490, /* GL_FLOAT_VEC2 */
+       492, /* GL_FLOAT_VEC3 */
+       494, /* GL_FLOAT_VEC4 */
+       643, /* GL_INT_VEC2 */
+       645, /* GL_INT_VEC3 */
+       647, /* GL_INT_VEC4 */
+        93, /* GL_BOOL */
+        95, /* GL_BOOL_VEC2 */
+        97, /* GL_BOOL_VEC3 */
+        99, /* GL_BOOL_VEC4 */
+       478, /* GL_FLOAT_MAT2 */
+       482, /* GL_FLOAT_MAT3 */
+       486, /* GL_FLOAT_MAT4 */
+      1352, /* GL_SAMPLER_1D */
+      1354, /* GL_SAMPLER_2D */
+      1356, /* GL_SAMPLER_3D */
+      1357, /* GL_SAMPLER_CUBE */
+      1353, /* GL_SAMPLER_1D_SHADOW */
+      1355, /* GL_SAMPLER_2D_SHADOW */
+       480, /* GL_FLOAT_MAT2x3 */
+       481, /* GL_FLOAT_MAT2x4 */
+       484, /* GL_FLOAT_MAT3x2 */
+       485, /* GL_FLOAT_MAT3x4 */
+       488, /* GL_FLOAT_MAT4x2 */
+       489, /* GL_FLOAT_MAT4x3 */
+       339, /* GL_DELETE_STATUS */
+       243, /* GL_COMPILE_STATUS */
+       697, /* GL_LINK_STATUS */
+      1747, /* GL_VALIDATE_STATUS */
+       628, /* GL_INFO_LOG_LENGTH */
         55, /* GL_ATTACHED_SHADERS */
         20, /* GL_ACTIVE_UNIFORMS */
         21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */
-      1400, /* GL_SHADER_SOURCE_LENGTH */
+      1394, /* GL_SHADER_SOURCE_LENGTH */
         15, /* GL_ACTIVE_ATTRIBUTES */
         16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */
-       515, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
-      1403, /* GL_SHADING_LANGUAGE_VERSION */
-       311, /* GL_CURRENT_PROGRAM */
-      1085, /* GL_PALETTE4_RGB8_OES */
-      1087, /* GL_PALETTE4_RGBA8_OES */
-      1083, /* GL_PALETTE4_R5_G6_B5_OES */
-      1086, /* GL_PALETTE4_RGBA4_OES */
-      1084, /* GL_PALETTE4_RGB5_A1_OES */
-      1090, /* GL_PALETTE8_RGB8_OES */
-      1092, /* GL_PALETTE8_RGBA8_OES */
-      1088, /* GL_PALETTE8_R5_G6_B5_OES */
-      1091, /* GL_PALETTE8_RGBA4_OES */
-      1089, /* GL_PALETTE8_RGB5_A1_OES */
-       622, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
-       621, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
-      1730, /* GL_UNSIGNED_NORMALIZED */
-      1576, /* GL_TEXTURE_1D_ARRAY_EXT */
-      1249, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
-      1578, /* GL_TEXTURE_2D_ARRAY_EXT */
-      1252, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
-      1584, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
-      1586, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
-       591, /* GL_GL_SRGB */
-       592, /* GL_GL_SRGB8 */
-       594, /* GL_GL_SRGB_ALPHA */
-       593, /* GL_GL_SRGB8_ALPHA8 */
-       590, /* GL_GL_SLUMINANCE_ALPHA */
-       589, /* GL_GL_SLUMINANCE8_ALPHA8 */
-       587, /* GL_GL_SLUMINANCE */
-       588, /* GL_GL_SLUMINANCE8 */
-       574, /* GL_GL_COMPRESSED_SRGB */
-       575, /* GL_GL_COMPRESSED_SRGB_ALPHA */
-       572, /* GL_GL_COMPRESSED_SLUMINANCE */
-       573, /* GL_GL_COMPRESSED_SLUMINANCE_ALPHA */
-      1146, /* GL_POINT_SPRITE_COORD_ORIGIN */
-       717, /* GL_LOWER_LEFT */
-      1742, /* GL_UPPER_LEFT */
-      1470, /* GL_STENCIL_BACK_REF */
-      1471, /* GL_STENCIL_BACK_VALUE_MASK */
-      1472, /* GL_STENCIL_BACK_WRITEMASK */
-       429, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
-      1294, /* GL_RENDERBUFFER_BINDING_EXT */
-      1275, /* GL_READ_FRAMEBUFFER */
-       428, /* GL_DRAW_FRAMEBUFFER */
-      1276, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
-      1304, /* GL_RENDERBUFFER_SAMPLES */
-       525, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
-       523, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
-       534, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
-       530, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
-       532, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
-       537, /* GL_FRAMEBUFFER_COMPLETE */
-       541, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
-       547, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
-       545, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
-       543, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
-       546, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
-       544, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
-       550, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
-       553, /* GL_FRAMEBUFFER_UNSUPPORTED */
-       551, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
-       851, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
-       151, /* GL_COLOR_ATTACHMENT0 */
-       153, /* GL_COLOR_ATTACHMENT1 */
-       167, /* GL_COLOR_ATTACHMENT2 */
-       169, /* GL_COLOR_ATTACHMENT3 */
-       171, /* GL_COLOR_ATTACHMENT4 */
-       173, /* GL_COLOR_ATTACHMENT5 */
-       175, /* GL_COLOR_ATTACHMENT6 */
-       177, /* GL_COLOR_ATTACHMENT7 */
-       179, /* GL_COLOR_ATTACHMENT8 */
-       181, /* GL_COLOR_ATTACHMENT9 */
-       154, /* GL_COLOR_ATTACHMENT10 */
-       156, /* GL_COLOR_ATTACHMENT11 */
-       158, /* GL_COLOR_ATTACHMENT12 */
-       160, /* GL_COLOR_ATTACHMENT13 */
-       162, /* GL_COLOR_ATTACHMENT14 */
-       164, /* GL_COLOR_ATTACHMENT15 */
-       336, /* GL_DEPTH_ATTACHMENT */
-      1460, /* GL_STENCIL_ATTACHMENT */
-       516, /* GL_FRAMEBUFFER */
-      1292, /* GL_RENDERBUFFER */
-      1306, /* GL_RENDERBUFFER_WIDTH */
-      1299, /* GL_RENDERBUFFER_HEIGHT */
-      1301, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
-      1483, /* GL_STENCIL_INDEX_EXT */
-      1480, /* GL_STENCIL_INDEX1_EXT */
-      1481, /* GL_STENCIL_INDEX4_EXT */
-      1482, /* GL_STENCIL_INDEX8_EXT */
-      1479, /* GL_STENCIL_INDEX16_EXT */
-      1303, /* GL_RENDERBUFFER_RED_SIZE */
-      1298, /* GL_RENDERBUFFER_GREEN_SIZE */
-      1295, /* GL_RENDERBUFFER_BLUE_SIZE */
-      1293, /* GL_RENDERBUFFER_ALPHA_SIZE */
-      1296, /* GL_RENDERBUFFER_DEPTH_SIZE */
-      1305, /* GL_RENDERBUFFER_STENCIL_SIZE */
-       549, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
-       907, /* GL_MAX_SAMPLES */
-       455, /* GL_EVAL_BIT */
-      1273, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
-       711, /* GL_LIST_BIT */
-      1592, /* GL_TEXTURE_BIT */
-      1382, /* GL_SCISSOR_BIT */
+       527, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */
+      1397, /* GL_SHADING_LANGUAGE_VERSION */
+       316, /* GL_CURRENT_PROGRAM */
+      1073, /* GL_PALETTE4_RGB8_OES */
+      1075, /* GL_PALETTE4_RGBA8_OES */
+      1071, /* GL_PALETTE4_R5_G6_B5_OES */
+      1074, /* GL_PALETTE4_RGBA4_OES */
+      1072, /* GL_PALETTE4_RGB5_A1_OES */
+      1078, /* GL_PALETTE8_RGB8_OES */
+      1080, /* GL_PALETTE8_RGBA8_OES */
+      1076, /* GL_PALETTE8_R5_G6_B5_OES */
+      1079, /* GL_PALETTE8_RGBA4_OES */
+      1077, /* GL_PALETTE8_RGB5_A1_OES */
+       610, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */
+       609, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */
+      1732, /* GL_UNSIGNED_NORMALIZED */
+      1578, /* GL_TEXTURE_1D_ARRAY_EXT */
+      1241, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */
+      1580, /* GL_TEXTURE_2D_ARRAY_EXT */
+      1244, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */
+      1586, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */
+      1588, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */
+      1449, /* GL_SRGB */
+      1450, /* GL_SRGB8 */
+      1452, /* GL_SRGB_ALPHA */
+      1451, /* GL_SRGB8_ALPHA8 */
+      1409, /* GL_SLUMINANCE_ALPHA */
+      1408, /* GL_SLUMINANCE8_ALPHA8 */
+      1406, /* GL_SLUMINANCE */
+      1407, /* GL_SLUMINANCE8 */
+       264, /* GL_COMPRESSED_SRGB */
+       265, /* GL_COMPRESSED_SRGB_ALPHA */
+       262, /* GL_COMPRESSED_SLUMINANCE */
+       263, /* GL_COMPRESSED_SLUMINANCE_ALPHA */
+      1138, /* GL_POINT_SPRITE_COORD_ORIGIN */
+       705, /* GL_LOWER_LEFT */
+      1744, /* GL_UPPER_LEFT */
+      1472, /* GL_STENCIL_BACK_REF */
+      1473, /* GL_STENCIL_BACK_VALUE_MASK */
+      1474, /* GL_STENCIL_BACK_WRITEMASK */
+       435, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */
+      1286, /* GL_RENDERBUFFER_BINDING_EXT */
+      1267, /* GL_READ_FRAMEBUFFER */
+       434, /* GL_DRAW_FRAMEBUFFER */
+      1268, /* GL_READ_FRAMEBUFFER_BINDING_EXT */
+      1296, /* GL_RENDERBUFFER_SAMPLES */
+       537, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */
+       535, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */
+       546, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */
+       542, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */
+       544, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */
+       549, /* GL_FRAMEBUFFER_COMPLETE */
+       553, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */
+       559, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */
+       557, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */
+       555, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */
+       558, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */
+       556, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */
+       562, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */
+       565, /* GL_FRAMEBUFFER_UNSUPPORTED */
+       563, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */
+       839, /* GL_MAX_COLOR_ATTACHMENTS_EXT */
+       152, /* GL_COLOR_ATTACHMENT0 */
+       154, /* GL_COLOR_ATTACHMENT1 */
+       168, /* GL_COLOR_ATTACHMENT2 */
+       170, /* GL_COLOR_ATTACHMENT3 */
+       172, /* GL_COLOR_ATTACHMENT4 */
+       174, /* GL_COLOR_ATTACHMENT5 */
+       176, /* GL_COLOR_ATTACHMENT6 */
+       178, /* GL_COLOR_ATTACHMENT7 */
+       180, /* GL_COLOR_ATTACHMENT8 */
+       182, /* GL_COLOR_ATTACHMENT9 */
+       155, /* GL_COLOR_ATTACHMENT10 */
+       157, /* GL_COLOR_ATTACHMENT11 */
+       159, /* GL_COLOR_ATTACHMENT12 */
+       161, /* GL_COLOR_ATTACHMENT13 */
+       163, /* GL_COLOR_ATTACHMENT14 */
+       165, /* GL_COLOR_ATTACHMENT15 */
+       342, /* GL_DEPTH_ATTACHMENT */
+      1462, /* GL_STENCIL_ATTACHMENT */
+       528, /* GL_FRAMEBUFFER */
+      1284, /* GL_RENDERBUFFER */
+      1298, /* GL_RENDERBUFFER_WIDTH */
+      1291, /* GL_RENDERBUFFER_HEIGHT */
+      1293, /* GL_RENDERBUFFER_INTERNAL_FORMAT */
+      1485, /* GL_STENCIL_INDEX_EXT */
+      1482, /* GL_STENCIL_INDEX1_EXT */
+      1483, /* GL_STENCIL_INDEX4_EXT */
+      1484, /* GL_STENCIL_INDEX8_EXT */
+      1481, /* GL_STENCIL_INDEX16_EXT */
+      1295, /* GL_RENDERBUFFER_RED_SIZE */
+      1290, /* GL_RENDERBUFFER_GREEN_SIZE */
+      1287, /* GL_RENDERBUFFER_BLUE_SIZE */
+      1285, /* GL_RENDERBUFFER_ALPHA_SIZE */
+      1288, /* GL_RENDERBUFFER_DEPTH_SIZE */
+      1297, /* GL_RENDERBUFFER_STENCIL_SIZE */
+       561, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */
+       895, /* GL_MAX_SAMPLES */
+      1345, /* GL_RGBA_SNORM */
+      1341, /* GL_RGBA8_SNORM */
+      1402, /* GL_SIGNED_NORMALIZED */
+       461, /* GL_EVAL_BIT */
+      1265, /* GL_RASTER_POSITION_UNCLIPPED_IBM */
+       699, /* GL_LIST_BIT */
+      1594, /* GL_TEXTURE_BIT */
+      1376, /* GL_SCISSOR_BIT */
         29, /* GL_ALL_ATTRIB_BITS */
-       992, /* GL_MULTISAMPLE_BIT */
+       980, /* GL_MULTISAMPLE_BIT */
         30, /* GL_ALL_CLIENT_ATTRIB_BITS */
 };
 
index 2d2bf51..147d923 100644 (file)
@@ -150,6 +150,7 @@ static const struct {
    { OFF, "GL_MESA_packed_depth_stencil",      F(MESA_packed_depth_stencil) },
    { OFF, "GL_MESA_resize_buffers",            F(MESA_resize_buffers) },
    { OFF, "GL_MESA_texture_array",             F(MESA_texture_array) },
+   { OFF, "GL_MESA_texture_signed_rgba",       F(MESA_texture_signed_rgba) },
    { OFF, "GL_MESA_ycbcr_texture",             F(MESA_ycbcr_texture) },
    { ON,  "GL_MESA_window_pos",                F(ARB_window_pos) },
    { OFF, "GL_NV_blend_square",                F(NV_blend_square) },
index 72b880e..03f4270 100644 (file)
@@ -363,7 +363,7 @@ struct tnl_program {
 };
 
 
-static const struct ureg undef = { 
+static const struct ureg undef = {
    PROGRAM_UNDEFINED,
    0,
    0,
@@ -398,7 +398,7 @@ static struct ureg negate( struct ureg reg )
 {
    reg.negate ^= 1;
    return reg;
-} 
+}
 
 
 static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w )
@@ -407,7 +407,6 @@ static struct ureg swizzle( struct ureg reg, int x, int y, int z, int w )
                           GET_SWZ(reg.swz, y),
                           GET_SWZ(reg.swz, z),
                           GET_SWZ(reg.swz, w));
-
    return reg;
 }
 
@@ -898,8 +897,7 @@ static void build_hpos( struct tnl_program *p )
 
 static GLuint material_attrib( GLuint side, GLuint property )
 {
-   return ((property - STATE_AMBIENT) * 2 + 
-          side);
+   return (property - STATE_AMBIENT) * 2 + side;
 }
 
 
@@ -960,7 +958,7 @@ static struct ureg get_scenecolor( struct tnl_program *p, GLuint side )
       struct ureg material_ambient = get_material(p, side, STATE_AMBIENT);
       struct ureg material_diffuse = get_material(p, side, STATE_DIFFUSE);
       struct ureg tmp = make_temp(p, material_diffuse);
-      emit_op3(p, OPCODE_MAD, tmp,  WRITEMASK_XYZ, lm_ambient, 
+      emit_op3(p, OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient, 
               material_ambient, material_emission);
       return tmp;
    }
@@ -978,7 +976,7 @@ static struct ureg get_lightprod( struct tnl_program *p, GLuint light,
         register_param3(p, STATE_LIGHT, light, property);
       struct ureg material_value = get_material(p, side, property);
       struct ureg tmp = get_temp(p);
-      emit_op2(p, OPCODE_MUL, tmp,  0, light_value, material_value);
+      emit_op2(p, OPCODE_MUL, tmp, 0, light_value, material_value);
       return tmp;
    }
    else
@@ -1015,7 +1013,6 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p,
    /* Calculate distance attenuation:
     */
    if (p->state->unit[i].light_attenuated) {
-
       /* 1/d,d,d,1/d */
       emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist); 
       /* 1,d,d*d,1/d */
@@ -1028,7 +1025,8 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p,
         emit_op1(p, OPCODE_RCP, dist, 0, dist); 
         /* spot-atten * dist-atten */
         emit_op2(p, OPCODE_MUL, att, 0, dist, att);    
-      } else {
+      }
+      else {
         /* dist-atten */
         emit_op1(p, OPCODE_RCP, att, 0, dist); 
       }
@@ -1082,10 +1080,10 @@ static void build_lighting( struct tnl_program *p )
 
    /*
     * NOTE:
-    * dot.x = dot(normal, VPpli)
-    * dot.y = dot(normal, halfAngle)
-    * dot.z = back.shininess
-    * dot.w = front.shininess
+    * dots.x = dot(normal, VPpli)
+    * dots.y = dot(normal, halfAngle)
+    * dots.z = back.shininess
+    * dots.w = front.shininess
     */
 
    for (i = 0; i < MAX_LIGHTS; i++) 
@@ -1097,7 +1095,7 @@ static void build_lighting( struct tnl_program *p )
    {
       if (!p->state->material_shininess_is_zero) {
          struct ureg shininess = get_material(p, 0, STATE_SHININESS);
-         emit_op1(p, OPCODE_MOV, dots,  WRITEMASK_W, swizzle1(shininess,X));
+         emit_op1(p, OPCODE_MOV, dots, WRITEMASK_W, swizzle1(shininess,X));
          release_temp(p, shininess);
       }
 
@@ -1106,11 +1104,13 @@ static void build_lighting( struct tnl_program *p )
         _col1 = make_temp(p, get_identity_param(p));
       else
         _col1 = _col0;
-
    }
 
    if (twoside) {
       if (!p->state->material_shininess_is_zero) {
+         /* Note that we negate the back-face specular exponent here.
+          * The negation will be un-done later in the back-face code below.
+          */
          struct ureg shininess = get_material(p, 1, STATE_SHININESS);
          emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z, 
                   negate(swizzle1(shininess,X)));
@@ -1171,12 +1171,13 @@ static void build_lighting( struct tnl_program *p )
                   half = get_temp(p);
                   emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
                   emit_normalize_vec3(p, half, half);
-               } else {
+               }
+               else {
                   half = register_param3(p, STATE_INTERNAL, 
                                          STATE_LIGHT_HALF_VECTOR, i);
                }
             }
-        } 
+        }
         else {
            struct ureg Ppli = register_param3(p, STATE_INTERNAL, 
                                               STATE_LIGHT_POSITION, i); 
@@ -1255,7 +1256,8 @@ static void build_lighting( struct tnl_program *p )
                  res0 = _col0;
                  res1 = register_output( p, VERT_RESULT_COL0 );
               }
-           } else {
+           }
+            else {
               mask0 = 0;
               mask1 = 0;
               res0 = _col0;
@@ -1267,12 +1269,12 @@ static void build_lighting( struct tnl_program *p )
                emit_op1(p, OPCODE_LIT, lit, 0, dots);
                emit_op2(p, OPCODE_MUL, lit, 0, lit, att);
                emit_op3(p, OPCODE_MAD, _col0, 0, swizzle1(lit,X), ambient, _col0);
-            } 
+            }
             else if (!p->state->material_shininess_is_zero) {
                /* there's a non-zero specular term */
                emit_op1(p, OPCODE_LIT, lit, 0, dots);
                emit_op2(p, OPCODE_ADD, _col0, 0, ambient, _col0);
-            } 
+            }
             else {
                /* no attenutation, no specular */
                emit_degenerate_lit(p, lit, dots);
@@ -1309,13 +1311,19 @@ static void build_lighting( struct tnl_program *p )
                  res0 = _bfc0;
                  res1 = register_output( p, VERT_RESULT_BFC0 );
               }
-           } else {
+           }
+            else {
               res0 = _bfc0;
               res1 = _bfc1;
               mask0 = 0;
               mask1 = 0;
            }
 
+            /* For the back face we need to negate the X and Y component
+             * dot products.  dots.Z has the negated back-face specular
+             * exponent.  We swizzle that into the W position.  This
+             * negation makes the back-face specular term positive again.
+             */
             dots = negate(swizzle(dots,X,Y,W,Z));
 
            if (!is_undef(att)) {
@@ -1325,8 +1333,8 @@ static void build_lighting( struct tnl_program *p )
             }
             else if (!p->state->material_shininess_is_zero) {
                emit_op1(p, OPCODE_LIT, lit, 0, dots);
-               emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0);
-            } 
+               emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0); /**/
+            }
             else {
                emit_degenerate_lit(p, lit, dots);
                emit_op2(p, OPCODE_ADD, _bfc0, 0, ambient, _bfc0);
@@ -1334,8 +1342,10 @@ static void build_lighting( struct tnl_program *p )
 
            emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _bfc0);
            emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _bfc1);
-            /* restore negate flag for next lighting */
-            dots = negate(dots);
+            /* restore dots to its original state for subsequent lights
+             * by negating and swizzling again.
+             */
+            dots = negate(swizzle(dots,X,Y,W,Z));
 
            release_temp(p, ambient);
            release_temp(p, diffuse);
@@ -1578,7 +1588,7 @@ static void build_texture_transform( struct tnl_program *p )
         }
 
         release_temps(p);
-      } 
+      }
       else {
         emit_passthrough(p, VERT_ATTRIB_TEX0+i, VERT_RESULT_TEX0+i);
       }
@@ -1647,7 +1657,8 @@ static void build_array_pointsize( struct tnl_program *p )
 
 
 static void build_tnl_program( struct tnl_program *p )
-{   /* Emit the program, starting with modelviewproject:
+{
+   /* Emit the program, starting with modelviewproject:
     */
    build_hpos(p);
 
index fa3149d..ddae456 100644 (file)
@@ -1677,7 +1677,6 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n,
  * Used to pack an array [][4] of RGBA float colors as specified
  * by the dstFormat, dstType and dstPacking.  Used by glReadPixels,
  * glGetConvolutionFilter(), etc.
- * Incoming colors will be clamped to [0,1] if needed.
  * Note: the rgba values will be modified by this function when any pixel
  * transfer ops are enabled.
  */
@@ -1691,19 +1690,12 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
    GLfloat luminance[MAX_WIDTH];
    const GLint comps = _mesa_components_in_format(dstFormat);
    GLuint i;
-   /* clamping only applies to colors, not the dudv values, but still need
-      it if converting to unsigned values (which doesn't make much sense) */
-   if (dstFormat == GL_DUDV_ATI || dstFormat == GL_DU8DV8_ATI) {
-      switch (dstType) {
-         case GL_UNSIGNED_BYTE:
-         case GL_UNSIGNED_SHORT:
-         case GL_UNSIGNED_INT:
-            transferOps |= IMAGE_CLAMP_BIT;
-            break;
-            /* actually might want clamp to [-1,1] otherwise but shouldn't matter? */
-      }
-   }
-   else if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
+
+   /* XXX
+    * This test should probably go away.  Have the caller set/clear the
+    * IMAGE_CLAMP_BIT as needed.
+    */
+   if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
       /* need to clamp to [0, 1] */
       transferOps |= IMAGE_CLAMP_BIT;
    }
@@ -4554,6 +4546,17 @@ _mesa_unpack_depth_span( const GLcontext *ctx, GLuint n,
          }
          return;
       }
+      if (srcType == GL_UNSIGNED_INT_24_8
+          && dstType == GL_UNSIGNED_INT
+          && depthMax == 0xffffff) {
+         const GLuint *src = (const GLuint *) source;
+         GLuint *dst = (GLuint *) dest;
+         GLuint i;
+         for (i = 0; i < n; i++) {
+            dst[i] = src[i] >> 8;
+         }
+         return;
+      }
       /* XXX may want to add additional cases here someday */
    }
 
index 20b8342..2ac93a5 100644 (file)
@@ -979,6 +979,35 @@ _mesa_vsprintf( char *str, const char *fmt, va_list args )
 /** \name Diagnostics */
 /*@{*/
 
+static void
+output_if_debug(const char *prefixString, const char *outputString)
+{
+   static int debug = -1;
+
+   /* Check the MESA_DEBUG environment variable if it hasn't
+    * been checked yet.  We only have to check it once...
+    */
+   if (debug == -1) {
+      char *env = _mesa_getenv("MESA_DEBUG");
+
+      /* In a debug build, we print warning messages *unless*
+       * MESA_DEBUG is 0.  In a non-debug build, we don't
+       * print warning messages *unless* MESA_DEBUG is
+       * set *to any value*.
+       */
+#ifdef DEBUG
+      debug = (env != NULL && _mesa_atoi(env) == 0) ? 0 : 1;
+#else
+      debug = (env != NULL) ? 1 : 0;
+#endif
+   }
+
+   /* Now only print the string if we're required to do so. */
+   if (debug) {
+      fprintf(stderr, "%s: %s\n", prefixString, outputString);
+   }
+}
+
 /**
  * Report a warning (a recoverable error condition) to stderr if
  * either DEBUG is defined or the MESA_DEBUG env var is set.
@@ -989,21 +1018,14 @@ _mesa_vsprintf( char *str, const char *fmt, va_list args )
 void
 _mesa_warning( GLcontext *ctx, const char *fmtString, ... )
 {
-   GLboolean debug;
    char str[MAXSTRING];
    va_list args;
    (void) ctx;
    va_start( args, fmtString );  
    (void) vsnprintf( str, MAXSTRING, fmtString, args );
    va_end( args );
-#ifdef DEBUG
-   debug = GL_TRUE; /* always print warning */
-#else
-   debug = _mesa_getenv("MESA_DEBUG") ? GL_TRUE : GL_FALSE;
-#endif
-   if (debug) {
-      fprintf(stderr, "Mesa warning: %s\n", str);
-   }
+
+   output_if_debug("Mesa warning", str);
 }
 
 /**
@@ -1123,7 +1145,7 @@ _mesa_debug( const GLcontext *ctx, const char *fmtString, ... )
    va_start(args, fmtString);
    vsnprintf(s, MAXSTRING, fmtString, args);
    va_end(args);
-   fprintf(stderr, "Mesa: %s", s);
+   output_if_debug("Mesa", s);
 #endif /* DEBUG */
    (void) ctx;
    (void) fmtString;
index a15c1f0..ac604fd 100644 (file)
@@ -110,10 +110,10 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params)
       break;
    case GL_SPOT_DIRECTION:
       /* NOTE: Direction already transformed by inverse ModelView! */
-      if (TEST_EQ_3V(light->EyeDirection, params))
+      if (TEST_EQ_3V(light->SpotDirection, params))
         return;
       FLUSH_VERTICES(ctx, _NEW_LIGHT);
-      COPY_3V(light->EyeDirection, params);
+      COPY_3V(light->SpotDirection, params);
       break;
    case GL_SPOT_EXPONENT:
       ASSERT(params[0] >= 0.0);
@@ -209,7 +209,6 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params )
         _math_matrix_analyse(ctx->ModelviewMatrixStack.Top);
       }
       TRANSFORM_DIRECTION(temp, params, ctx->ModelviewMatrixStack.Top->m);
-      NORMALIZE_3FV(temp);
       params = temp;
       break;
    case GL_SPOT_EXPONENT:
@@ -326,7 +325,7 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params )
          COPY_4V( params, ctx->Light.Light[l].EyePosition );
          break;
       case GL_SPOT_DIRECTION:
-         COPY_3V( params, ctx->Light.Light[l].EyeDirection );
+         COPY_3V( params, ctx->Light.Light[l].SpotDirection );
          break;
       case GL_SPOT_EXPONENT:
          params[0] = ctx->Light.Light[l].SpotExponent;
@@ -388,9 +387,9 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params )
          params[3] = (GLint) ctx->Light.Light[l].EyePosition[3];
          break;
       case GL_SPOT_DIRECTION:
-         params[0] = (GLint) ctx->Light.Light[l].EyeDirection[0];
-         params[1] = (GLint) ctx->Light.Light[l].EyeDirection[1];
-         params[2] = (GLint) ctx->Light.Light[l].EyeDirection[2];
+         params[0] = (GLint) ctx->Light.Light[l].SpotDirection[0];
+         params[1] = (GLint) ctx->Light.Light[l].SpotDirection[1];
+         params[2] = (GLint) ctx->Light.Light[l].SpotDirection[2];
          break;
       case GL_SPOT_EXPONENT:
          params[0] = (GLint) ctx->Light.Light[l].SpotExponent;
@@ -1137,20 +1136,26 @@ compute_light_positions( GLcontext *ctx )
       }
 
       if (light->_Flags & LIGHT_SPOT) {
+         /* Note: we normalize the spot direction now */
+
         if (ctx->_NeedEyeCoords) {
-           COPY_3V( light->_NormDirection, light->EyeDirection );
+           COPY_3V( light->_NormSpotDirection, light->SpotDirection );
+            NORMALIZE_3FV( light->_NormSpotDirection );
         }
          else {
-           TRANSFORM_NORMAL( light->_NormDirection,
-                             light->EyeDirection,
+            GLfloat spotDir[3];
+            COPY_3V(spotDir, light->SpotDirection);
+            NORMALIZE_3FV(spotDir);
+           TRANSFORM_NORMAL( light->_NormSpotDirection,
+                             spotDir,
                              ctx->ModelviewMatrixStack.Top->m);
         }
 
-        NORMALIZE_3FV( light->_NormDirection );
+        NORMALIZE_3FV( light->_NormSpotDirection );
 
         if (!(light->_Flags & LIGHT_POSITIONAL)) {
            GLfloat PV_dot_dir = - DOT3(light->_VP_inf_norm,
-                                       light->_NormDirection);
+                                       light->_NormSpotDirection);
 
            if (PV_dot_dir > light->_CosCutoff) {
               double x = PV_dot_dir * (EXP_TABLE_SIZE-1);
@@ -1274,7 +1279,7 @@ init_light( struct gl_light *l, GLuint n )
       ASSIGN_4V( l->Specular, 0.0, 0.0, 0.0, 1.0 );
    }
    ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 );
-   ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 );
+   ASSIGN_3V( l->SpotDirection, 0.0, 0.0, -1.0 );
    l->SpotExponent = 0.0;
    _mesa_invalidate_spot_exp_table( l );
    l->SpotCutoff = 180.0;
index bfd7408..01d59dd 100644 (file)
@@ -54,12 +54,20 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
 #define FLOAT_TO_BYTE(X)    ( (((GLint) (255.0F * (X))) - 1) / 2 )
 
 
+/** Convert GLbyte in [-128,127] to GLfloat in [-1.0,1.0], texture/fb data */
+#define BYTE_TO_FLOAT_TEX(B)    ((B) == -128 ? -1.0 : (B) * (1.0F/127.0F))
+
+/** Convert GLfloat in [-1.0,1.0] to GLbyte in [-128,127], texture/fb data */
+#define FLOAT_TO_BYTE_TEX(X)    ( (GLint) (127.0F * (X)) )
+
+
 /** Convert GLushort in [0,65535] to GLfloat in [0.0,1.0] */
 #define USHORT_TO_FLOAT(S)  ((GLfloat) (S) * (1.0F / 65535.0F))
 
 /** Convert GLfloat in [0.0,1.0] to GLushort in [0, 65535] */
 #define FLOAT_TO_USHORT(X)   ((GLuint) ((X) * 65535.0))
 
+
 /** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0] */
 #define SHORT_TO_FLOAT(S)   ((2.0F * (S) + 1.0F) * (1.0F/65535.0F))
 
@@ -67,6 +75,13 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
 #define FLOAT_TO_SHORT(X)   ( (((GLint) (65535.0F * (X))) - 1) / 2 )
 
 
+/** Convert GLshort in [-32768,32767] to GLfloat in [-1.0,1.0], texture/fb data */
+#define SHORT_TO_FLOAT_TEX(S)    ((S) == -32768 ? -1.0 : (S) * (1.0F/32767.0F))
+
+/** Convert GLfloat in [-1.0,1.0] to GLshort in [-32768,32767], texture/fb data */
+#define FLOAT_TO_SHORT_TEX(X)    ( (GLint) (32767.0F * (X)) )
+
+
 /** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */
 #define UINT_TO_FLOAT(U)    ((GLfloat) (U) * (1.0F / 4294967295.0F))
 
@@ -85,6 +100,13 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
 #define FLOAT_TO_INT(X)     ( (GLint) (2147483647.0 * (X)) )
 
 
+/** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0], texture/fb data */
+#define INT_TO_FLOAT_TEX(I)    ((I) == -2147483648 ? -1.0 : (I) * (1.0F/2147483647.0))
+
+/** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647], texture/fb data */
+#define FLOAT_TO_INT_TEX(X)    ( (GLint) (2147483647.0F * (X)) )
+
+
 #define BYTE_TO_UBYTE(b)   ((GLubyte) ((b) < 0 ? 0 : (GLubyte) (b)))
 #define SHORT_TO_UBYTE(s)  ((GLubyte) ((s) < 0 ? 0 : (GLubyte) ((s) >> 7)))
 #define USHORT_TO_UBYTE(s) ((GLubyte) ((s) >> 8))
index aebf481..7388276 100644 (file)
@@ -161,7 +161,8 @@ _mesa_MatrixMode( GLenum mode )
       break;
    case GL_TEXTURE:
       if (ctx->Texture.CurrentUnit >= ctx->Const.MaxTextureCoordUnits) {
-         _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(texcoord unit)");
+         _mesa_error(ctx, GL_INVALID_OPERATION, "glMatrixMode(invalid unit %d)",
+                     ctx->Texture.CurrentUnit);
          return;
       }
       ctx->CurrentStack = &ctx->TextureMatrixStack[ctx->Texture.CurrentUnit];
index 4a79430..bc8658b 100644 (file)
@@ -86,6 +86,21 @@ bytes_per_pixel(GLenum datatype, GLuint comps)
                                 rowD[j][e], rowD[k][e]); \
    } while(0)
 
+#define FILTER_SUM_3D_SIGNED(Aj, Ak, Bj, Bk, Cj, Ck, Dj, Dk) \
+   (Aj + Ak \
+    + Bj + Bk \
+    + Cj + Ck \
+    + Dj + Dk \
+    + 4) / 8
+
+#define FILTER_3D_SIGNED(e) \
+   do { \
+      dst[i][e] = FILTER_SUM_3D_SIGNED(rowA[j][e], rowA[k][e], \
+                                       rowB[j][e], rowB[k][e], \
+                                       rowC[j][e], rowC[k][e], \
+                                       rowD[j][e], rowD[k][e]); \
+   } while(0)
+
 #define FILTER_F_3D(e) \
    do { \
       dst[i][e] = (rowA[j][e] + rowA[k][e] \
@@ -180,6 +195,53 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
       }
    }
 
+   else if (datatype == GL_BYTE && comps == 4) {
+      GLuint i, j, k;
+      const GLbyte(*rowA)[4] = (const GLbyte(*)[4]) srcRowA;
+      const GLbyte(*rowB)[4] = (const GLbyte(*)[4]) srcRowB;
+      GLbyte(*dst)[4] = (GLbyte(*)[4]) dstRow;
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
+         dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
+         dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
+         dst[i][3] = (rowA[j][3] + rowA[k][3] + rowB[j][3] + rowB[k][3]) / 4;
+      }
+   }
+   else if (datatype == GL_BYTE && comps == 3) {
+      GLuint i, j, k;
+      const GLbyte(*rowA)[3] = (const GLbyte(*)[3]) srcRowA;
+      const GLbyte(*rowB)[3] = (const GLbyte(*)[3]) srcRowB;
+      GLbyte(*dst)[3] = (GLbyte(*)[3]) dstRow;
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
+         dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
+         dst[i][2] = (rowA[j][2] + rowA[k][2] + rowB[j][2] + rowB[k][2]) / 4;
+      }
+   }
+   else if (datatype == GL_BYTE && comps == 2) {
+      GLuint i, j, k;
+      const GLbyte(*rowA)[2] = (const GLbyte(*)[2]) srcRowA;
+      const GLbyte(*rowB)[2] = (const GLbyte(*)[2]) srcRowB;
+      GLbyte(*dst)[2] = (GLbyte(*)[2]) dstRow;
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) / 4;
+         dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) / 4;
+      }
+   }
+   else if (datatype == GL_BYTE && comps == 1) {
+      GLuint i, j, k;
+      const GLbyte *rowA = (const GLbyte *) srcRowA;
+      const GLbyte *rowB = (const GLbyte *) srcRowB;
+      GLbyte *dst = (GLbyte *) dstRow;
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         dst[i] = (rowA[j] + rowA[k] + rowB[j] + rowB[k]) / 4;
+      }
+   }
+
    else if (datatype == GL_UNSIGNED_SHORT && comps == 4) {
       GLuint i, j, k;
       const GLushort(*rowA)[4] = (const GLushort(*)[4]) srcRowA;
@@ -470,17 +532,6 @@ do_row(GLenum datatype, GLuint comps, GLint srcWidth,
          dst[i] = (blue << 5) | (green << 2) | red;
       }
    }
-   else if (datatype == GL_BYTE && comps == 2) {
-      GLuint i, j, k;
-      const GLbyte(*rowA)[2] = (const GLbyte(*)[2]) srcRowA;
-      const GLbyte(*rowB)[2] = (const GLbyte(*)[2]) srcRowB;
-      GLbyte(*dst)[2] = (GLbyte(*)[2]) dstRow;
-      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
-           i++, j += colStride, k += colStride) {
-         dst[i][0] = (rowA[j][0] + rowA[k][0] + rowB[j][0] + rowB[k][0]) >> 2;
-         dst[i][1] = (rowA[j][1] + rowA[k][1] + rowB[j][1] + rowB[k][1]) >> 2;
-      }
-   }
    else {
       _mesa_problem(NULL, "bad format in do_row()");
    }
@@ -555,6 +606,44 @@ do_row_3D(GLenum datatype, GLuint comps, GLint srcWidth,
          FILTER_3D(0);
       }
    }
+   if ((datatype == GL_BYTE) && (comps == 4)) {
+      DECLARE_ROW_POINTERS(GLbyte, 4);
+
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         FILTER_3D_SIGNED(0);
+         FILTER_3D_SIGNED(1);
+         FILTER_3D_SIGNED(2);
+         FILTER_3D_SIGNED(3);
+      }
+   }
+   else if ((datatype == GL_BYTE) && (comps == 3)) {
+      DECLARE_ROW_POINTERS(GLbyte, 3);
+
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         FILTER_3D_SIGNED(0);
+         FILTER_3D_SIGNED(1);
+         FILTER_3D_SIGNED(2);
+      }
+   }
+   else if ((datatype == GL_BYTE) && (comps == 2)) {
+      DECLARE_ROW_POINTERS(GLbyte, 2);
+
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         FILTER_3D_SIGNED(0);
+         FILTER_3D_SIGNED(1);
+       }
+   }
+   else if ((datatype == GL_BYTE) && (comps == 1)) {
+      DECLARE_ROW_POINTERS(GLbyte, 1);
+
+      for (i = j = 0, k = k0; i < (GLuint) dstWidth;
+           i++, j += colStride, k += colStride) {
+         FILTER_3D_SIGNED(0);
+      }
+   }
    else if ((datatype == GL_UNSIGNED_SHORT) && (comps == 4)) {
       DECLARE_ROW_POINTERS(GLushort, 4);
 
index 5293009..3f31590 100644 (file)
@@ -460,7 +460,7 @@ struct gl_light
    GLfloat Diffuse[4];         /**< diffuse color */
    GLfloat Specular[4];                /**< specular color */
    GLfloat EyePosition[4];     /**< position in eye coordinates */
-   GLfloat EyeDirection[4];    /**< spotlight dir in eye coordinates */
+   GLfloat SpotDirection[4];   /**< spotlight direction in eye coordinates */
    GLfloat SpotExponent;
    GLfloat SpotCutoff;         /**< in degrees */
    GLfloat _CosCutoffNeg;      /**< = cos(SpotCutoff) */
@@ -479,7 +479,7 @@ struct gl_light
    GLfloat _Position[4];       /**< position in eye/obj coordinates */
    GLfloat _VP_inf_norm[3];    /**< Norm direction to infinite light */
    GLfloat _h_inf_norm[3];     /**< Norm( _VP_inf_norm + <0,0,1> ) */
-   GLfloat _NormDirection[4];  /**< normalized spotlight direction */
+   GLfloat _NormSpotDirection[4]; /**< normalized spotlight direction */
    GLfloat _VP_inf_spot_attenuation;
 
    GLfloat _SpotExpTable[EXP_TABLE_SIZE][2];  /**< to replace a pow() call */
@@ -1296,7 +1296,6 @@ struct gl_texture_object
    GLenum Target;               /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */
    GLfloat Priority;           /**< in [0,1] */
    GLfloat BorderColor[4];     /**< unclamped */
-   GLchan _BorderChan[4];      /**< clamped, as GLchan */
    GLenum WrapS;               /**< S-axis texture image wrap mode */
    GLenum WrapT;               /**< T-axis texture image wrap mode */
    GLenum WrapR;               /**< R-axis texture image wrap mode */
@@ -1338,18 +1337,23 @@ struct gl_texture_object
 };
 
 
+/** Up to four combiner sources are possible with GL_NV_texture_env_combine4 */
+#define MAX_COMBINER_TERMS 4
+
+
 /**
  * Texture combine environment state.
- * Up to four combiner sources are possible with GL_NV_texture_env_combine4.
  */
 struct gl_tex_env_combine_state
 {
    GLenum ModeRGB;       /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
    GLenum ModeA;         /**< GL_REPLACE, GL_DECAL, GL_ADD, etc. */
-   GLenum SourceRGB[4];  /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
-   GLenum SourceA[4];    /**< GL_PRIMARY_COLOR, GL_TEXTURE, etc. */
-   GLenum OperandRGB[4]; /**< SRC_COLOR, ONE_MINUS_SRC_COLOR, etc */
-   GLenum OperandA[4];   /**< SRC_ALPHA, ONE_MINUS_SRC_ALPHA, etc */
+   /** Source terms: GL_PRIMARY_COLOR, GL_TEXTURE, etc */
+   GLenum SourceRGB[MAX_COMBINER_TERMS];
+   GLenum SourceA[MAX_COMBINER_TERMS];
+   /** Source operands: GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, etc */
+   GLenum OperandRGB[MAX_COMBINER_TERMS];
+   GLenum OperandA[MAX_COMBINER_TERMS];
    GLuint ScaleShiftRGB; /**< 0, 1 or 2 */
    GLuint ScaleShiftA;   /**< 0, 1 or 2 */
    GLuint _NumArgsRGB;   /**< Number of inputs used for the RGB combiner */
@@ -1974,6 +1978,7 @@ struct gl_shader
    GLboolean DeletePending;
    GLboolean CompileStatus;
    GLboolean Main;  /**< shader defines main() */
+   GLboolean UnresolvedRefs;
    const GLchar *Source;  /**< Source code string */
    struct gl_program *Program;  /**< Post-compile assembly code */
    GLchar *InfoLog;
@@ -2503,6 +2508,7 @@ struct gl_extensions
    GLboolean MESA_resize_buffers;
    GLboolean MESA_ycbcr_texture;
    GLboolean MESA_texture_array;
+   GLboolean MESA_texture_signed_rgba;
    GLboolean NV_blend_square;
    GLboolean NV_fragment_program;
    GLboolean NV_light_max_exponent;
index dfdd297..2326776 100644 (file)
@@ -170,6 +170,9 @@ _mesa_ReadPixels( GLint x, GLint y, GLsizei width, GLsizei height,
       return;
    }
 
+   if (width == 0 || height == 0)
+      return; /* nothing to do */
+
    if (ctx->Pack.BufferObj->Name) {
       if (!_mesa_validate_pbo_access(2, &ctx->Pack, width, height, 1,
                                      format, type, pixels)) {
index fa45e46..193ac89 100644 (file)
@@ -159,9 +159,11 @@ delete_program_cb(GLuint id, void *data, void *userData)
 {
    struct gl_program *prog = (struct gl_program *) data;
    GLcontext *ctx = (GLcontext *) userData;
-   ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */
-   prog->RefCount = 0;  /* now going away */
-   ctx->Driver.DeleteProgram(ctx, prog);
+   if(prog != &_mesa_DummyProgram) {
+      ASSERT(prog->RefCount == 1); /* should only be referenced by hash table */
+      prog->RefCount = 0;  /* now going away */
+      ctx->Driver.DeleteProgram(ctx, prog);
+   }
 }
 
 
index 4e58702..5d9d990 100644 (file)
@@ -63,6 +63,7 @@ texenv.c \
 texenvprogram.c \
 texformat.c \
 texgen.c \
+texgetimage.c \
 teximage.c \
 texobj.c \
 texparam.c \
index c2960fc..4d511f2 100644 (file)
@@ -184,7 +184,7 @@ set_combiner_source(GLcontext *ctx,
                     struct gl_texture_unit *texUnit,
                     GLenum pname, GLenum param)
 {
-   GLuint src;
+   GLuint term;
    GLboolean alpha, legal;
 
    if (!ctx->Extensions.EXT_texture_env_combine &&
@@ -194,24 +194,24 @@ set_combiner_source(GLcontext *ctx,
    }
 
    /*
-    * Translate pname to (src, alpha).
+    * Translate pname to (term, alpha).
     */
    switch (pname) {
    case GL_SOURCE0_RGB:
-      src = 0;
+      term = 0;
       alpha = GL_FALSE;
       break;
    case GL_SOURCE1_RGB:
-      src = 1;
+      term = 1;
       alpha = GL_FALSE;
       break;
    case GL_SOURCE2_RGB:
-      src = 2;
+      term = 2;
       alpha = GL_FALSE;
       break;
    case GL_SOURCE3_RGB_NV:
       if (ctx->Extensions.NV_texture_env_combine4) {
-         src = 3;
+         term = 3;
          alpha = GL_FALSE;
       }
       else {
@@ -220,20 +220,20 @@ set_combiner_source(GLcontext *ctx,
       }
       break;
    case GL_SOURCE0_ALPHA:
-      src = 0;
+      term = 0;
       alpha = GL_TRUE;
       break;
    case GL_SOURCE1_ALPHA:
-      src = 1;
+      term = 1;
       alpha = GL_TRUE;
       break;
    case GL_SOURCE2_ALPHA:
-      src = 2;
+      term = 2;
       alpha = GL_TRUE;
       break;
    case GL_SOURCE3_ALPHA_NV:
       if (ctx->Extensions.NV_texture_env_combine4) {
-         src = 3;
+         term = 3;
          alpha = GL_TRUE;
       }
       else {
@@ -246,7 +246,7 @@ set_combiner_source(GLcontext *ctx,
       return;
    }
 
-   assert(src < 4);
+   assert(term < MAX_COMBINER_TERMS);
 
    /*
     * Error-check param (the source term)
@@ -288,9 +288,9 @@ set_combiner_source(GLcontext *ctx,
    FLUSH_VERTICES(ctx, _NEW_TEXTURE);
 
    if (alpha)
-      texUnit->Combine.SourceA[src] = param;
+      texUnit->Combine.SourceA[term] = param;
    else
-      texUnit->Combine.SourceRGB[src] = param;
+      texUnit->Combine.SourceRGB[term] = param;
 }
 
 
@@ -300,7 +300,7 @@ set_combiner_operand(GLcontext *ctx,
                      struct gl_texture_unit *texUnit,
                      GLenum pname, GLenum param)
 {
-   GLuint op;
+   GLuint term;
    GLboolean alpha, legal;
 
    if (!ctx->Extensions.EXT_texture_env_combine &&
@@ -311,16 +311,16 @@ set_combiner_operand(GLcontext *ctx,
 
    switch (pname) {
    case GL_OPERAND0_RGB:
-      op = 0;
+      term = 0;
       alpha = GL_FALSE;
       break;
    case GL_OPERAND1_RGB:
-      op = 1;
+      term = 1;
       alpha = GL_FALSE;
       break;
    case GL_OPERAND2_RGB:
       if (ctx->Extensions.ARB_texture_env_combine) {
-         op = 2;
+         term = 2;
          alpha = GL_FALSE;
       }
       else {
@@ -330,7 +330,7 @@ set_combiner_operand(GLcontext *ctx,
       break;
    case GL_OPERAND3_RGB_NV:
       if (ctx->Extensions.NV_texture_env_combine4) {
-         op = 3;
+         term = 3;
          alpha = GL_FALSE;
       }
       else {
@@ -339,16 +339,16 @@ set_combiner_operand(GLcontext *ctx,
       }
       break;
    case GL_OPERAND0_ALPHA:
-      op = 0;
+      term = 0;
       alpha = GL_TRUE;
       break;
    case GL_OPERAND1_ALPHA:
-      op = 1;
+      term = 1;
       alpha = GL_TRUE;
       break;
    case GL_OPERAND2_ALPHA:
       if (ctx->Extensions.ARB_texture_env_combine) {
-         op = 2;
+         term = 2;
          alpha = GL_TRUE;
       }
       else {
@@ -358,7 +358,7 @@ set_combiner_operand(GLcontext *ctx,
       break;
    case GL_OPERAND3_ALPHA_NV:
       if (ctx->Extensions.NV_texture_env_combine4) {
-         op = 3;
+         term = 3;
          alpha = GL_TRUE;
       }
       else {
@@ -371,7 +371,7 @@ set_combiner_operand(GLcontext *ctx,
       return;
    }
 
-   assert(op < 4);
+   assert(term < MAX_COMBINER_TERMS);
 
    /*
     * Error-check param (the source operand)
@@ -397,9 +397,9 @@ set_combiner_operand(GLcontext *ctx,
    FLUSH_VERTICES(ctx, _NEW_TEXTURE);
 
    if (alpha)
-      texUnit->Combine.OperandA[op] = param;
+      texUnit->Combine.OperandA[term] = param;
    else
-      texUnit->Combine.OperandRGB[op] = param;
+      texUnit->Combine.OperandRGB[term] = param;
 }
 
 
index 3fbd119..4a124bf 100644 (file)
@@ -39,9 +39,6 @@
 #include "texenvprogram.h"
 
 
-#define MAX_TERMS 4
-
-
 /*
  * Note on texture units:
  *
@@ -95,11 +92,11 @@ struct state_key {
 
       GLuint NumArgsRGB:3;
       GLuint ModeRGB:5;
-      struct mode_opt OptRGB[MAX_TERMS];
+      struct mode_opt OptRGB[MAX_COMBINER_TERMS];
 
       GLuint NumArgsA:3;
       GLuint ModeA:5;
-      struct mode_opt OptA[MAX_TERMS];
+      struct mode_opt OptA[MAX_COMBINER_TERMS];
    } unit[8];
 };
 
@@ -389,7 +386,7 @@ static void make_state_key( GLcontext *ctx,  struct state_key *key )
       key->unit[i].ScaleShiftRGB = texUnit->_CurrentCombine->ScaleShiftRGB;
       key->unit[i].ScaleShiftA = texUnit->_CurrentCombine->ScaleShiftA;
 
-      for (j = 0; j < MAX_TERMS; j++) {
+      for (j = 0; j < MAX_COMBINER_TERMS; j++) {
          key->unit[i].OptRGB[j].Operand =
            translate_operand(texUnit->_CurrentCombine->OperandRGB[j]);
          key->unit[i].OptA[j].Operand =
@@ -972,11 +969,11 @@ static struct ureg emit_combine( struct texenv_fragment_program *p,
                                 GLuint mode,
                                 const struct mode_opt *opt)
 {
-   struct ureg src[MAX_TERMS];
+   struct ureg src[MAX_COMBINER_TERMS];
    struct ureg tmp, half;
    GLuint i;
 
-   assert(nr <= MAX_TERMS);
+   assert(nr <= MAX_COMBINER_TERMS);
 
    tmp = undef; /* silence warning (bug 5318) */
 
index c372b49..c709004 100644 (file)
@@ -154,9 +154,9 @@ const struct gl_texture_format _mesa_texformat_rgba = {
    0,                                  /* StencilBits */
    4 * sizeof(GLchan),                 /* TexelBytes */
    _mesa_texstore_rgba,                        /* StoreTexImageFunc */
-   fetch_texel_1d_rgba,                        /* FetchTexel1D */
-   fetch_texel_2d_rgba,                        /* FetchTexel2D */
-   fetch_texel_3d_rgba,                        /* FetchTexel3D */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
    fetch_texel_1d_f_rgba,              /* FetchTexel1Df */
    fetch_texel_2d_f_rgba,              /* FetchTexel2Df */
    fetch_texel_3d_f_rgba,              /* FetchTexel3Df */
@@ -178,9 +178,9 @@ const struct gl_texture_format _mesa_texformat_rgb = {
    0,                                  /* StencilBits */
    3 * sizeof(GLchan),                 /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_rgb,                 /* FetchTexel1D */
-   fetch_texel_2d_rgb,                 /* FetchTexel2D */
-   fetch_texel_3d_rgb,                 /* FetchTexel3D */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
    fetch_texel_1d_f_rgb,               /* FetchTexel1Df */
    fetch_texel_2d_f_rgb,               /* FetchTexel2Df */
    fetch_texel_3d_f_rgb,               /* FetchTexel3Df */
@@ -202,12 +202,12 @@ const struct gl_texture_format _mesa_texformat_alpha = {
    0,                                  /* StencilBits */
    sizeof(GLchan),                     /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_alpha,               /* FetchTexel1D */
-   fetch_texel_2d_alpha,               /* FetchTexel2D */
-   fetch_texel_3d_alpha,               /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_alpha,             /* FetchTexel1Df */
+   fetch_texel_2d_f_alpha,             /* FetchTexel2Df */
+   fetch_texel_3d_f_alpha,             /* FetchTexel3Df */
    store_texel_alpha                   /* StoreTexel */
 };
 
@@ -226,12 +226,12 @@ const struct gl_texture_format _mesa_texformat_luminance = {
    0,                                  /* StencilBits */
    sizeof(GLchan),                     /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_luminance,           /* FetchTexel1D */
-   fetch_texel_2d_luminance,           /* FetchTexel2D */
-   fetch_texel_3d_luminance,           /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_luminance,         /* FetchTexel1Df */
+   fetch_texel_2d_f_luminance,         /* FetchTexel2Df */
+   fetch_texel_3d_f_luminance,         /* FetchTexel3Df */
    store_texel_luminance               /* StoreTexel */
 };
 
@@ -250,12 +250,12 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = {
    0,                                  /* StencilBits */
    2 * sizeof(GLchan),                 /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_luminance_alpha,     /* FetchTexel1D */
-   fetch_texel_2d_luminance_alpha,     /* FetchTexel2D */
-   fetch_texel_3d_luminance_alpha,     /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_luminance_alpha,   /* FetchTexel1Df */
+   fetch_texel_2d_f_luminance_alpha,   /* FetchTexel2Df */
+   fetch_texel_3d_f_luminance_alpha,   /* FetchTexel3Df */
    store_texel_luminance_alpha         /* StoreTexel */
 };
 
@@ -274,12 +274,12 @@ const struct gl_texture_format _mesa_texformat_intensity = {
    0,                                  /* StencilBits */
    sizeof(GLchan),                     /* TexelBytes */
    _mesa_texstore_rgba,/*yes*/         /* StoreTexImageFunc */
-   fetch_texel_1d_intensity,           /* FetchTexel1D */
-   fetch_texel_2d_intensity,           /* FetchTexel2D */
-   fetch_texel_3d_intensity,           /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_intensity,         /* FetchTexel1Df */
+   fetch_texel_2d_f_intensity,         /* FetchTexel2Df */
+   fetch_texel_3d_f_intensity,         /* FetchTexel3Df */
    store_texel_intensity               /* StoreTexel */
 };
 
@@ -382,6 +382,7 @@ const struct gl_texture_format _mesa_texformat_sl8 = {
    store_texel_sl8                     /* StoreTexel */
 };
 
+/* Note: this format name looks like a misnomer, make it sal8? */
 const struct gl_texture_format _mesa_texformat_sla8 = {
    MESA_FORMAT_SLA8,                   /* MesaFormat */
    GL_LUMINANCE_ALPHA,                 /* BaseFormat */
@@ -699,9 +700,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = {
 const struct gl_texture_format _mesa_texformat_dudv8 = {
    MESA_FORMAT_DUDV8,                  /* MesaFormat */
    GL_DUDV_ATI,                                /* BaseFormat */
-   /* FIXME: spec doesn't say since that parameter didn't exist then,
-      but this should be something like SIGNED_NORMALIZED */
-   GL_UNSIGNED_NORMALIZED_ARB,         /* DataType */
+   GL_SIGNED_NORMALIZED,               /* DataType */
    /* maybe should add dudvBits field, but spec seems to be
       lacking the ability to query with GetTexLevelParameter anyway */
    0,                                  /* RedBits */
@@ -724,6 +723,54 @@ const struct gl_texture_format _mesa_texformat_dudv8 = {
    NULL                                        /* StoreTexel */
 };
 
+const struct gl_texture_format _mesa_texformat_signed_rgba8888 = {
+   MESA_FORMAT_SIGNED_RGBA8888,                /* MesaFormat */
+   GL_RGBA,                            /* BaseFormat */
+   GL_SIGNED_NORMALIZED,               /* DataType */
+   8,                                  /* RedBits */
+   8,                                  /* GreenBits */
+   8,                                  /* BlueBits */
+   8,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   0,                                  /* StencilBits */
+   4,                                  /* TexelBytes */
+   _mesa_texstore_signed_rgba8888,     /* StoreTexImageFunc */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_signed_rgba8888,     /* FetchTexel1Df */
+   fetch_texel_2d_signed_rgba8888,     /* FetchTexel2Df */
+   fetch_texel_3d_signed_rgba8888,     /* FetchTexel3Df */
+   store_texel_signed_rgba8888         /* StoreTexel */
+};
+
+const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = {
+   MESA_FORMAT_SIGNED_RGBA8888_REV,    /* MesaFormat */
+   GL_RGBA,                            /* BaseFormat */
+   GL_SIGNED_NORMALIZED,               /* DataType */
+   8,                                  /* RedBits */
+   8,                                  /* GreenBits */
+   8,                                  /* BlueBits */
+   8,                                  /* AlphaBits */
+   0,                                  /* LuminanceBits */
+   0,                                  /* IntensityBits */
+   0,                                  /* IndexBits */
+   0,                                  /* DepthBits */
+   0,                                  /* StencilBits */
+   4,                                  /* TexelBytes */
+   _mesa_texstore_signed_rgba8888,     /* StoreTexImageFunc */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_signed_rgba8888_rev, /* FetchTexel1Df */
+   fetch_texel_2d_signed_rgba8888_rev, /* FetchTexel2Df */
+   fetch_texel_3d_signed_rgba8888_rev, /* FetchTexel3Df */
+   store_texel_signed_rgba8888_rev             /* StoreTexel */
+};
+
 /*@}*/
 
 
@@ -746,12 +793,12 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = {
    0,                                  /* StencilBits */
    4,                                  /* TexelBytes */
    _mesa_texstore_rgba8888,            /* StoreTexImageFunc */
-   fetch_texel_1d_rgba8888,            /* FetchTexel1D */
-   fetch_texel_2d_rgba8888,            /* FetchTexel2D */
-   fetch_texel_3d_rgba8888,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgba8888,          /* FetchTexel1Df */
+   fetch_texel_2d_f_rgba8888,          /* FetchTexel2Df */
+   fetch_texel_3d_f_rgba8888,          /* FetchTexel3Df */
    store_texel_rgba8888                        /* StoreTexel */
 };
 
@@ -770,12 +817,12 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = {
    0,                                  /* StencilBits */
    4,                                  /* TexelBytes */
    _mesa_texstore_rgba8888,            /* StoreTexImageFunc */
-   fetch_texel_1d_rgba8888_rev,                /* FetchTexel1D */
-   fetch_texel_2d_rgba8888_rev,                /* FetchTexel2D */
-   fetch_texel_3d_rgba8888_rev,                /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgba8888_rev,      /* FetchTexel1Df */
+   fetch_texel_2d_f_rgba8888_rev,      /* FetchTexel2Df */
+   fetch_texel_3d_f_rgba8888_rev,      /* FetchTexel3Df */
    store_texel_rgba8888_rev            /* StoreTexel */
 };
 
@@ -794,12 +841,12 @@ const struct gl_texture_format _mesa_texformat_argb8888 = {
    0,                                  /* StencilBits */
    4,                                  /* TexelBytes */
    _mesa_texstore_argb8888,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb8888,            /* FetchTexel1D */
-   fetch_texel_2d_argb8888,            /* FetchTexel2D */
-   fetch_texel_3d_argb8888,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_argb8888,          /* FetchTexel1Df */
+   fetch_texel_2d_f_argb8888,          /* FetchTexel2Df */
+   fetch_texel_3d_f_argb8888,          /* FetchTexel3Df */
    store_texel_argb8888                        /* StoreTexel */
 };
 
@@ -818,12 +865,12 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = {
    0,                                  /* StencilBits */
    4,                                  /* TexelBytes */
    _mesa_texstore_argb8888,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb8888_rev,                /* FetchTexel1D */
-   fetch_texel_2d_argb8888_rev,                /* FetchTexel2D */
-   fetch_texel_3d_argb8888_rev,                /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_argb8888_rev,      /* FetchTexel1Df */
+   fetch_texel_2d_f_argb8888_rev,      /* FetchTexel2Df */
+   fetch_texel_3d_f_argb8888_rev,      /* FetchTexel3Df */
    store_texel_argb8888_rev            /* StoreTexel */
 };
 
@@ -842,12 +889,12 @@ const struct gl_texture_format _mesa_texformat_rgb888 = {
    0,                                  /* StencilBits */
    3,                                  /* TexelBytes */
    _mesa_texstore_rgb888,              /* StoreTexImageFunc */
-   fetch_texel_1d_rgb888,              /* FetchTexel1D */
-   fetch_texel_2d_rgb888,              /* FetchTexel2D */
-   fetch_texel_3d_rgb888,              /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgb888,            /* FetchTexel1Df */
+   fetch_texel_2d_f_rgb888,            /* FetchTexel2Df */
+   fetch_texel_3d_f_rgb888,            /* FetchTexel3Df */
    store_texel_rgb888                  /* StoreTexel */
 };
 
@@ -866,12 +913,12 @@ const struct gl_texture_format _mesa_texformat_bgr888 = {
    0,                                  /* StencilBits */
    3,                                  /* TexelBytes */
    _mesa_texstore_bgr888,              /* StoreTexImageFunc */
-   fetch_texel_1d_bgr888,              /* FetchTexel1D */
-   fetch_texel_2d_bgr888,              /* FetchTexel2D */
-   fetch_texel_3d_bgr888,              /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_bgr888,            /* FetchTexel1Df */
+   fetch_texel_2d_f_bgr888,            /* FetchTexel2Df */
+   fetch_texel_3d_f_bgr888,            /* FetchTexel3Df */
    store_texel_bgr888                  /* StoreTexel */
 };
 
@@ -890,12 +937,12 @@ const struct gl_texture_format _mesa_texformat_rgb565 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_rgb565,              /* StoreTexImageFunc */
-   fetch_texel_1d_rgb565,              /* FetchTexel1D */
-   fetch_texel_2d_rgb565,              /* FetchTexel2D */
-   fetch_texel_3d_rgb565,              /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgb565,            /* FetchTexel1Df */
+   fetch_texel_2d_f_rgb565,            /* FetchTexel2Df */
+   fetch_texel_3d_f_rgb565,            /* FetchTexel3Df */
    store_texel_rgb565                  /* StoreTexel */
 };
 
@@ -914,12 +961,12 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_rgb565,              /* StoreTexImageFunc */
-   fetch_texel_1d_rgb565_rev,          /* FetchTexel1D */
-   fetch_texel_2d_rgb565_rev,          /* FetchTexel2D */
-   fetch_texel_3d_rgb565_rev,          /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgb565_rev,                /* FetchTexel1Df */
+   fetch_texel_2d_f_rgb565_rev,                /* FetchTexel2Df */
+   fetch_texel_3d_f_rgb565_rev,                /* FetchTexel3Df */
    store_texel_rgb565_rev              /* StoreTexel */
 };
 
@@ -938,12 +985,12 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_rgba4444,            /* StoreTexImageFunc */
-   fetch_texel_1d_rgba4444,            /* FetchTexel1D */
-   fetch_texel_2d_rgba4444,            /* FetchTexel2D */
-   fetch_texel_3d_rgba4444,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgba4444,          /* FetchTexel1Df */
+   fetch_texel_2d_f_rgba4444,          /* FetchTexel2Df */
+   fetch_texel_3d_f_rgba4444,          /* FetchTexel3Df */
    store_texel_rgba4444                        /* StoreTexel */
 };
 
@@ -962,12 +1009,12 @@ const struct gl_texture_format _mesa_texformat_argb4444 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_argb4444,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb4444,            /* FetchTexel1D */
-   fetch_texel_2d_argb4444,            /* FetchTexel2D */
-   fetch_texel_3d_argb4444,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_argb4444,          /* FetchTexel1Df */
+   fetch_texel_2d_f_argb4444,          /* FetchTexel2Df */
+   fetch_texel_3d_f_argb4444,          /* FetchTexel3Df */
    store_texel_argb4444                        /* StoreTexel */
 };
 
@@ -986,12 +1033,12 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_argb4444,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb4444_rev,                /* FetchTexel1D */
-   fetch_texel_2d_argb4444_rev,                /* FetchTexel2D */
-   fetch_texel_3d_argb4444_rev,                /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_argb4444_rev,      /* FetchTexel1Df */
+   fetch_texel_2d_f_argb4444_rev,      /* FetchTexel2Df */
+   fetch_texel_3d_f_argb4444_rev,      /* FetchTexel3Df */
    store_texel_argb4444_rev            /* StoreTexel */
 };
 
@@ -1010,12 +1057,12 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_rgba5551,            /* StoreTexImageFunc */
-   fetch_texel_1d_rgba5551,            /* FetchTexel1D */
-   fetch_texel_2d_rgba5551,            /* FetchTexel2D */
-   fetch_texel_3d_rgba5551,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgba5551,          /* FetchTexel1Df */
+   fetch_texel_2d_f_rgba5551,          /* FetchTexel2Df */
+   fetch_texel_3d_f_rgba5551,          /* FetchTexel3Df */
    store_texel_rgba5551                        /* StoreTexel */
 };
 
@@ -1034,12 +1081,12 @@ const struct gl_texture_format _mesa_texformat_argb1555 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_argb1555,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb1555,            /* FetchTexel1D */
-   fetch_texel_2d_argb1555,            /* FetchTexel2D */
-   fetch_texel_3d_argb1555,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_argb1555,          /* FetchTexel1Df */
+   fetch_texel_2d_f_argb1555,          /* FetchTexel2Df */
+   fetch_texel_3d_f_argb1555,          /* FetchTexel3Df */
    store_texel_argb1555                        /* StoreTexel */
 };
 
@@ -1058,12 +1105,12 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_argb1555,            /* StoreTexImageFunc */
-   fetch_texel_1d_argb1555_rev,                /* FetchTexel1D */
-   fetch_texel_2d_argb1555_rev,                /* FetchTexel2D */
-   fetch_texel_3d_argb1555_rev,                /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_argb1555_rev,      /* FetchTexel1Df */
+   fetch_texel_2d_f_argb1555_rev,      /* FetchTexel2Df */
+   fetch_texel_3d_f_argb1555_rev,      /* FetchTexel3Df */
    store_texel_argb1555_rev            /* StoreTexel */
 };
 
@@ -1082,12 +1129,12 @@ const struct gl_texture_format _mesa_texformat_al88 = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_al88,                        /* StoreTexImageFunc */
-   fetch_texel_1d_al88,                        /* FetchTexel1D */
-   fetch_texel_2d_al88,                        /* FetchTexel2D */
-   fetch_texel_3d_al88,                        /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_al88,              /* FetchTexel1Df */
+   fetch_texel_2d_f_al88,              /* FetchTexel2Df */
+   fetch_texel_3d_f_al88,              /* FetchTexel3Df */
    store_texel_al88                    /* StoreTexel */
 };
 
@@ -1106,12 +1153,12 @@ const struct gl_texture_format _mesa_texformat_al88_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_al88,                        /* StoreTexImageFunc */
-   fetch_texel_1d_al88_rev,            /* FetchTexel1D */
-   fetch_texel_2d_al88_rev,            /* FetchTexel2D */
-   fetch_texel_3d_al88_rev,            /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_al88_rev,          /* FetchTexel1Df */
+   fetch_texel_2d_f_al88_rev,          /* FetchTexel2Df */
+   fetch_texel_3d_f_al88_rev,          /* FetchTexel3Df */
    store_texel_al88_rev                        /* StoreTexel */
 };
 
@@ -1130,12 +1177,12 @@ const struct gl_texture_format _mesa_texformat_rgb332 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_rgb332,              /* StoreTexImageFunc */
-   fetch_texel_1d_rgb332,              /* FetchTexel1D */
-   fetch_texel_2d_rgb332,              /* FetchTexel2D */
-   fetch_texel_3d_rgb332,              /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_rgb332,            /* FetchTexel1Df */
+   fetch_texel_2d_f_rgb332,            /* FetchTexel2Df */
+   fetch_texel_3d_f_rgb332,            /* FetchTexel3Df */
    store_texel_rgb332                  /* StoreTexel */
 };
 
@@ -1154,12 +1201,12 @@ const struct gl_texture_format _mesa_texformat_a8 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_a8,                  /* StoreTexImageFunc */
-   fetch_texel_1d_a8,                  /* FetchTexel1D */
-   fetch_texel_2d_a8,                  /* FetchTexel2D */
-   fetch_texel_3d_a8,                  /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_a8,                        /* FetchTexel1Df */
+   fetch_texel_2d_f_a8,                        /* FetchTexel2Df */
+   fetch_texel_3d_f_a8,                        /* FetchTexel3Df */
    store_texel_a8                      /* StoreTexel */
 };
 
@@ -1178,12 +1225,12 @@ const struct gl_texture_format _mesa_texformat_l8 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_a8,/*yes*/           /* StoreTexImageFunc */
-   fetch_texel_1d_l8,                  /* FetchTexel1D */
-   fetch_texel_2d_l8,                  /* FetchTexel2D */
-   fetch_texel_3d_l8,                  /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_l8,                        /* FetchTexel1Df */
+   fetch_texel_2d_f_l8,                        /* FetchTexel2Df */
+   fetch_texel_3d_f_l8,                        /* FetchTexel3Df */
    store_texel_l8                      /* StoreTexel */
 };
 
@@ -1202,12 +1249,12 @@ const struct gl_texture_format _mesa_texformat_i8 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_a8,/*yes*/           /* StoreTexImageFunc */
-   fetch_texel_1d_i8,                  /* FetchTexel1D */
-   fetch_texel_2d_i8,                  /* FetchTexel2D */
-   fetch_texel_3d_i8,                  /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_i8,                        /* FetchTexel1Df */
+   fetch_texel_2d_f_i8,                        /* FetchTexel2Df */
+   fetch_texel_3d_f_i8,                        /* FetchTexel3Df */
    store_texel_i8                      /* StoreTexel */
 };
 
@@ -1226,12 +1273,12 @@ const struct gl_texture_format _mesa_texformat_ci8 = {
    0,                                  /* StencilBits */
    1,                                  /* TexelBytes */
    _mesa_texstore_ci8,                 /* StoreTexImageFunc */
-   fetch_texel_1d_ci8,                 /* FetchTexel1D */
-   fetch_texel_2d_ci8,                 /* FetchTexel2D */
-   fetch_texel_3d_ci8,                 /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_ci8,               /* FetchTexel1Df */
+   fetch_texel_2d_f_ci8,               /* FetchTexel2Df */
+   fetch_texel_3d_f_ci8,               /* FetchTexel3Df */
    store_texel_ci8                     /* StoreTexel */
 };
 
@@ -1250,12 +1297,12 @@ const struct gl_texture_format _mesa_texformat_ycbcr = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_ycbcr,               /* StoreTexImageFunc */
-   fetch_texel_1d_ycbcr,               /* FetchTexel1D */
-   fetch_texel_2d_ycbcr,               /* FetchTexel2D */
-   fetch_texel_3d_ycbcr,               /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_ycbcr,             /* FetchTexel1Df */
+   fetch_texel_2d_f_ycbcr,             /* FetchTexel2Df */
+   fetch_texel_3d_f_ycbcr,             /* FetchTexel3Df */
    store_texel_ycbcr                   /* StoreTexel */
 };
 
@@ -1274,12 +1321,12 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = {
    0,                                  /* StencilBits */
    2,                                  /* TexelBytes */
    _mesa_texstore_ycbcr,               /* StoreTexImageFunc */
-   fetch_texel_1d_ycbcr_rev,           /* FetchTexel1D */
-   fetch_texel_2d_ycbcr_rev,           /* FetchTexel2D */
-   fetch_texel_3d_ycbcr_rev,           /* FetchTexel3D */
-   NULL,                               /* FetchTexel1Df */
-   NULL,                               /* FetchTexel2Df */
-   NULL,                               /* FetchTexel3Df */
+   NULL,                               /* FetchTexel1D */
+   NULL,                               /* FetchTexel2D */
+   NULL,                               /* FetchTexel3D */
+   fetch_texel_1d_f_ycbcr_rev,         /* FetchTexel1Df */
+   fetch_texel_2d_f_ycbcr_rev,         /* FetchTexel2Df */
+   fetch_texel_3d_f_ycbcr_rev,         /* FetchTexel3Df */
    store_texel_ycbcr_rev               /* StoreTexel */
 };
 
@@ -1671,6 +1718,17 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat,
       }
    }
 
+   if (ctx->Extensions.MESA_texture_signed_rgba) {
+      switch (internalFormat) {
+         case GL_RGBA_SNORM:
+         case GL_RGBA8_SNORM:
+            return &_mesa_texformat_signed_rgba8888;
+         default:
+            ; /* fallthrough */
+      }
+   }
+
+
 #if FEATURE_EXT_texture_sRGB
    if (ctx->Extensions.EXT_texture_sRGB) {
       switch (internalFormat) {
@@ -1820,6 +1878,12 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format,
       *comps = 2;
       return;
 
+   case MESA_FORMAT_SIGNED_RGBA8888:
+   case MESA_FORMAT_SIGNED_RGBA8888_REV:
+      *datatype = GL_BYTE;
+      *comps = 4;
+      return;
+
 #if FEATURE_EXT_texture_sRGB
    case MESA_FORMAT_SRGB8:
       *datatype = GL_UNSIGNED_BYTE;
index 7fa70ad..5aa1d75 100644 (file)
@@ -168,7 +168,9 @@ enum _format {
     * \name Signed fixed point texture formats.
     */
    /*@{*/
-   MESA_FORMAT_DUDV8
+   MESA_FORMAT_DUDV8,
+   MESA_FORMAT_SIGNED_RGBA8888,
+   MESA_FORMAT_SIGNED_RGBA8888_REV
    /*@}*/
 };
 
@@ -219,6 +221,8 @@ extern const struct gl_texture_format _mesa_texformat_intensity_float16;
 /** Signed fixed point texture formats */
 /*@{*/
 extern const struct gl_texture_format _mesa_texformat_dudv8;
+extern const struct gl_texture_format _mesa_texformat_signed_rgba8888;
+extern const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev;
 /*@}*/
 
 /** \name Assorted hardware-friendly formats */
index 0f6a172..f3b2fb9 100644 (file)
 
 /* MESA_FORMAT_RGBA **********************************************************/
 
-/* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLchans */
-static void FETCH(rgba)( const struct gl_texture_image *texImage,
-                        GLint i, GLint j, GLint k, GLchan *texel )
-{
-   const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 4);
-   COPY_CHAN4( texel, src );
-}
-
 /* Fetch texel from 1D, 2D or 3D RGBA texture, returning 4 GLfloats */
 static void FETCH(f_rgba)( const struct gl_texture_image *texImage,
                            GLint i, GLint j, GLint k, GLfloat *texel )
@@ -107,17 +99,6 @@ static void store_texel_rgba(struct gl_texture_image *texImage,
 
 /* MESA_FORMAT_RGB ***********************************************************/
 
-/* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLchans */
-static void FETCH(rgb)( const struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, GLchan *texel )
-{
-   const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 3);
-   texel[RCOMP] = src[0];
-   texel[GCOMP] = src[1];
-   texel[BCOMP] = src[2];
-   texel[ACOMP] = CHAN_MAX;
-}
-
 /* Fetch texel from 1D, 2D or 3D RGB texture, returning 4 GLfloats */
 static void FETCH(f_rgb)( const struct gl_texture_image *texImage,
                           GLint i, GLint j, GLint k, GLfloat *texel )
@@ -144,14 +125,14 @@ static void store_texel_rgb(struct gl_texture_image *texImage,
 /* MESA_FORMAT_ALPHA *********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */
-static void FETCH(alpha)( const struct gl_texture_image *texImage,
-                         GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_alpha)( const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
    texel[RCOMP] =
    texel[GCOMP] =
-   texel[BCOMP] = 0;
-   texel[ACOMP] = src[0];
+   texel[BCOMP] = 0.0F;
+   texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
 }
 
 #if DIM == 3
@@ -167,14 +148,14 @@ static void store_texel_alpha(struct gl_texture_image *texImage,
 /* MESA_FORMAT_LUMINANCE *****************************************************/
 
 /* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */
-static void FETCH(luminance)( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_luminance)( const struct gl_texture_image *texImage,
+                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
    texel[RCOMP] =
    texel[GCOMP] =
-   texel[BCOMP] = src[0];
-   texel[ACOMP] = CHAN_MAX;
+   texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -190,14 +171,14 @@ static void store_texel_luminance(struct gl_texture_image *texImage,
 /* MESA_FORMAT_LUMINANCE_ALPHA ***********************************************/
 
 /* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */
-static void FETCH(luminance_alpha)( const struct gl_texture_image *texImage,
-                                   GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_luminance_alpha)(const struct gl_texture_image *texImage,
+                                     GLint i, GLint j, GLint k, GLfloat *texel)
 {
    const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 2);
-   texel[RCOMP] = src[0];
-   texel[GCOMP] = src[0];
-   texel[BCOMP] = src[0];
-   texel[ACOMP] = src[1];
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] = CHAN_TO_FLOAT(src[0]);
+   texel[ACOMP] = CHAN_TO_FLOAT(src[1]);
 }
 
 #if DIM == 3
@@ -214,14 +195,14 @@ static void store_texel_luminance_alpha(struct gl_texture_image *texImage,
 /* MESA_FORMAT_INTENSITY *****************************************************/
 
 /* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */
-static void FETCH(intensity)( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_intensity)( const struct gl_texture_image *texImage,
+                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 1);
-   texel[RCOMP] = src[0];
-   texel[GCOMP] = src[0];
-   texel[BCOMP] = src[0];
-   texel[ACOMP] = src[0];
+   texel[RCOMP] =
+   texel[GCOMP] =
+   texel[BCOMP] =
+   texel[ACOMP] = CHAN_TO_FLOAT(src[0]);
 }
 
 #if DIM == 3
@@ -606,17 +587,19 @@ static void store_texel_intensity_f16(struct gl_texture_image *texImage,
 
 /* MESA_FORMAT_RGBA8888 ******************************************************/
 
-/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLchans */
-static void FETCH(rgba8888)( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D rgba8888 texture, return 4 GLfloats */
+static void FETCH(f_rgba8888)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_CHAN( (s >> 24)        );
-   texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
-   texel[BCOMP] = UBYTE_TO_CHAN( (s >>  8) & 0xff );
-   texel[ACOMP] = UBYTE_TO_CHAN( (s      ) & 0xff );
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
 }
 
+
+
 #if DIM == 3
 static void store_texel_rgba8888(struct gl_texture_image *texImage,
                                  GLint i, GLint j, GLint k, const void *texel)
@@ -631,14 +614,14 @@ static void store_texel_rgba8888(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RGBA888_REV ***************************************************/
 
 /* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */
-static void FETCH(rgba8888_rev)( const struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_rgba8888_rev)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_CHAN( (s      ) & 0xff );
-   texel[GCOMP] = UBYTE_TO_CHAN( (s >>  8) & 0xff );
-   texel[BCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
-   texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24)        );
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
 }
 
 #if DIM == 3
@@ -655,14 +638,14 @@ static void store_texel_rgba8888_rev(struct gl_texture_image *texImage,
 /* MESA_FORMAT_ARGB8888 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */
-static void FETCH(argb8888)( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_argb8888)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
-   texel[GCOMP] = UBYTE_TO_CHAN( (s >>  8) & 0xff );
-   texel[BCOMP] = UBYTE_TO_CHAN( (s      ) & 0xff );
-   texel[ACOMP] = UBYTE_TO_CHAN( (s >> 24)        );
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
 }
 
 #if DIM == 3
@@ -678,15 +661,15 @@ static void store_texel_argb8888(struct gl_texture_image *texImage,
 
 /* MESA_FORMAT_ARGB8888_REV **************************************************/
 
-/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLchans */
-static void FETCH(argb8888_rev)( const struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D argb8888_rev texture, return 4 GLfloats */
+static void FETCH(f_argb8888_rev)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_CHAN( (s >>  8) & 0xff );
-   texel[GCOMP] = UBYTE_TO_CHAN( (s >> 16) & 0xff );
-   texel[BCOMP] = UBYTE_TO_CHAN( (s >> 24)        );
-   texel[ACOMP] = UBYTE_TO_CHAN( (s      ) & 0xff );
+   texel[RCOMP] = UBYTE_TO_FLOAT( (s >>  8) & 0xff );
+   texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24)        );
+   texel[ACOMP] = UBYTE_TO_FLOAT( (s      ) & 0xff );
 }
 
 #if DIM == 3
@@ -703,14 +686,14 @@ static void store_texel_argb8888_rev(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RGB888 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */
-static void FETCH(rgb888)( const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_rgb888)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   texel[RCOMP] = UBYTE_TO_CHAN( src[2] );
-   texel[GCOMP] = UBYTE_TO_CHAN( src[1] );
-   texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
-   texel[ACOMP] = CHAN_MAX;
+   texel[RCOMP] = UBYTE_TO_FLOAT( src[2] );
+   texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
+   texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -729,14 +712,14 @@ static void store_texel_rgb888(struct gl_texture_image *texImage,
 /* MESA_FORMAT_BGR888 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */
-static void FETCH(bgr888)( const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_bgr888)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   texel[RCOMP] = UBYTE_TO_CHAN( src[0] );
-   texel[GCOMP] = UBYTE_TO_CHAN( src[1] );
-   texel[BCOMP] = UBYTE_TO_CHAN( src[2] );
-   texel[ACOMP] = CHAN_MAX;
+   texel[RCOMP] = UBYTE_TO_FLOAT( src[0] );
+   texel[GCOMP] = UBYTE_TO_FLOAT( src[1] );
+   texel[BCOMP] = UBYTE_TO_FLOAT( src[2] );
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -758,15 +741,15 @@ static void store_texel_bgr888(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RGB565 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */
-static void FETCH(rgb565)( const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_rgb565)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    const GLushort s = *src;
-   texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) );
-   texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >>  9) & 0x3) );
-   texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >>  2) & 0x7) );
-   texel[ACOMP] = CHAN_MAX;
+   texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
+   texel[GCOMP] = ((s >> 5 ) & 0x3f) * (1.0F / 63.0F);
+   texel[BCOMP] = ((s      ) & 0x1f) * (1.0F / 31.0F);
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -783,15 +766,15 @@ static void store_texel_rgb565(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RGB565_REV ****************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */
-static void FETCH(rgb565_rev)( const struct gl_texture_image *texImage,
-                               GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_rgb565_rev)( const struct gl_texture_image *texImage,
+                                 GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    const GLushort s = (*src >> 8) | (*src << 8); /* byte swap */
-   texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) );
-   texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 3) & 0xfc) | ((s >>  9) & 0x3) );
-   texel[BCOMP] = UBYTE_TO_CHAN( ((s << 3) & 0xf8) | ((s >>  2) & 0x7) );
-   texel[ACOMP] = CHAN_MAX;
+   texel[RCOMP] = UBYTE_TO_FLOAT( ((s >> 8) & 0xf8) | ((s >> 13) & 0x7) );
+   texel[GCOMP] = UBYTE_TO_FLOAT( ((s >> 3) & 0xfc) | ((s >>  9) & 0x3) );
+   texel[BCOMP] = UBYTE_TO_FLOAT( ((s << 3) & 0xf8) | ((s >>  2) & 0x7) );
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -807,15 +790,15 @@ static void store_texel_rgb565_rev(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RGBA4444 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
-static void FETCH(rgba4444)( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_rgba4444)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    const GLushort s = *src;
-   texel[RCOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) );
-   texel[GCOMP] = UBYTE_TO_CHAN( ((s >>  8) & 0xf) | ((s >> 4) & 0xf0) );
-   texel[BCOMP] = UBYTE_TO_CHAN( ((s >>  4) & 0xf) | ((s     ) & 0xf0) );
-   texel[ACOMP] = UBYTE_TO_CHAN( ((s      ) & 0xf) | ((s << 4) & 0xf0) );
+   texel[RCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
+   texel[GCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
+   texel[BCOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
+   texel[ACOMP] = ((s      ) & 0xf) * (1.0F / 15.0F);
 }
 
 #if DIM == 3
@@ -832,15 +815,15 @@ static void store_texel_rgba4444(struct gl_texture_image *texImage,
 /* MESA_FORMAT_ARGB4444 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */
-static void FETCH(argb4444)( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_argb4444)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    const GLushort s = *src;
-   texel[RCOMP] = UBYTE_TO_CHAN( ((s >>  8) & 0xf) | ((s >> 4) & 0xf0) );
-   texel[GCOMP] = UBYTE_TO_CHAN( ((s >>  4) & 0xf) | ((s     ) & 0xf0) );
-   texel[BCOMP] = UBYTE_TO_CHAN( ((s      ) & 0xf) | ((s << 4) & 0xf0) );
-   texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) );
+   texel[RCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
+   texel[GCOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
+   texel[BCOMP] = ((s      ) & 0xf) * (1.0F / 15.0F);
+   texel[ACOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
 }
 
 #if DIM == 3
@@ -857,14 +840,14 @@ static void store_texel_argb4444(struct gl_texture_image *texImage,
 /* MESA_FORMAT_ARGB4444_REV **************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */
-static void FETCH(argb4444_rev)( const struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_argb4444_rev)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
-   texel[RCOMP] = UBYTE_TO_CHAN( ((s      ) & 0xf) | ((s << 4) & 0xf0) );
-   texel[GCOMP] = UBYTE_TO_CHAN( ((s >> 12) & 0xf) | ((s >> 8) & 0xf0) );
-   texel[BCOMP] = UBYTE_TO_CHAN( ((s >>  8) & 0xf) | ((s >> 4) & 0xf0) );
-   texel[ACOMP] = UBYTE_TO_CHAN( ((s >>  4) & 0xf) | ((s     ) & 0xf0) );
+   texel[RCOMP] = ((s      ) & 0xf) * (1.0F / 15.0F);
+   texel[GCOMP] = ((s >> 12) & 0xf) * (1.0F / 15.0F);
+   texel[BCOMP] = ((s >>  8) & 0xf) * (1.0F / 15.0F);
+   texel[ACOMP] = ((s >>  4) & 0xf) * (1.0F / 15.0F);
 }
 
 #if DIM == 3
@@ -880,15 +863,15 @@ static void store_texel_argb4444_rev(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RGBA5551 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(rgba5551)( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_rgba5551)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    const GLushort s = *src;
-   texel[RCOMP] = UBYTE_TO_CHAN( ((s >>  8) & 0xf8) | ((s >> 13) & 0x7) );
-   texel[GCOMP] = UBYTE_TO_CHAN( ((s >>  3) & 0xf8) | ((s >>  8) & 0x7) );
-   texel[BCOMP] = UBYTE_TO_CHAN( ((s <<  2) & 0xf8) | ((s >>  3) & 0x7) );
-   texel[ACOMP] = UBYTE_TO_CHAN( ((s) & 0x01) ? 255 : 0);
+   texel[RCOMP] = ((s >> 11) & 0x1f) * (1.0F / 31.0F);
+   texel[GCOMP] = ((s >>  6) & 0x1f) * (1.0F / 31.0F);
+   texel[BCOMP] = ((s >>  1) & 0x1f) * (1.0F / 31.0F);
+   texel[ACOMP] = ((s      ) & 0x01) * 1.0F;
 }
 
 #if DIM == 3
@@ -904,15 +887,15 @@ static void store_texel_rgba5551(struct gl_texture_image *texImage,
 /* MESA_FORMAT_ARGB1555 ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */
-static void FETCH(argb1555)( const struct gl_texture_image *texImage,
-                            GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_argb1555)( const struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    const GLushort s = *src;
-   texel[RCOMP] = UBYTE_TO_CHAN( ((s >>  7) & 0xf8) | ((s >> 12) & 0x7) );
-   texel[GCOMP] = UBYTE_TO_CHAN( ((s >>  2) & 0xf8) | ((s >>  7) & 0x7) );
-   texel[BCOMP] = UBYTE_TO_CHAN( ((s <<  3) & 0xf8) | ((s >>  2) & 0x7) );
-   texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 );
+   texel[RCOMP] = ((s >> 10) & 0x1f) * (1.0F / 31.0F);
+   texel[GCOMP] = ((s >>  5) & 0x1f) * (1.0F / 31.0F);
+   texel[BCOMP] = ((s >>  0) & 0x1f) * (1.0F / 31.0F);
+   texel[ACOMP] = ((s >> 15) & 0x01) * 1.0F;
 }
 
 #if DIM == 3
@@ -929,15 +912,15 @@ static void store_texel_argb1555(struct gl_texture_image *texImage,
 /* MESA_FORMAT_ARGB1555_REV **************************************************/
 
 /* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */
-static void FETCH(argb1555_rev)( const struct gl_texture_image *texImage,
-                                 GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_argb1555_rev)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    const GLushort s = (*src << 8) | (*src >> 8); /* byteswap */
-   texel[RCOMP] = UBYTE_TO_CHAN( ((s >>  7) & 0xf8) | ((s >> 12) & 0x7) );
-   texel[GCOMP] = UBYTE_TO_CHAN( ((s >>  2) & 0xf8) | ((s >>  7) & 0x7) );
-   texel[BCOMP] = UBYTE_TO_CHAN( ((s <<  3) & 0xf8) | ((s >>  2) & 0x7) );
-   texel[ACOMP] = UBYTE_TO_CHAN( ((s >> 15) & 0x01) * 255 );
+   texel[RCOMP] = UBYTE_TO_FLOAT( ((s >>  7) & 0xf8) | ((s >> 12) & 0x7) );
+   texel[GCOMP] = UBYTE_TO_FLOAT( ((s >>  2) & 0xf8) | ((s >>  7) & 0x7) );
+   texel[BCOMP] = UBYTE_TO_FLOAT( ((s <<  3) & 0xf8) | ((s >>  2) & 0x7) );
+   texel[ACOMP] = UBYTE_TO_FLOAT( ((s >> 15) & 0x01) * 255 );
 }
 
 #if DIM == 3
@@ -954,14 +937,14 @@ static void store_texel_argb1555_rev(struct gl_texture_image *texImage,
 /* MESA_FORMAT_AL88 **********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */
-static void FETCH(al88)( const struct gl_texture_image *texImage,
-                        GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_al88)( const struct gl_texture_image *texImage,
+                           GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    texel[RCOMP] = 
    texel[GCOMP] = 
-   texel[BCOMP] = UBYTE_TO_CHAN( s & 0xff );
-   texel[ACOMP] = UBYTE_TO_CHAN( s >> 8 );
+   texel[BCOMP] = UBYTE_TO_FLOAT( s & 0xff );
+   texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 );
 }
 
 #if DIM == 3
@@ -978,14 +961,14 @@ static void store_texel_al88(struct gl_texture_image *texImage,
 /* MESA_FORMAT_AL88_REV ******************************************************/
 
 /* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */
-static void FETCH(al88_rev)( const struct gl_texture_image *texImage,
-                             GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_al88_rev)( const struct gl_texture_image *texImage,
+                               GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1);
    texel[RCOMP] = 
    texel[GCOMP] = 
-   texel[BCOMP] = UBYTE_TO_CHAN( s >> 8 );
-   texel[ACOMP] = UBYTE_TO_CHAN( s & 0xff );
+   texel[BCOMP] = UBYTE_TO_FLOAT( s >> 8 );
+   texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff );
 }
 
 #if DIM == 3
@@ -1002,17 +985,15 @@ static void store_texel_al88_rev(struct gl_texture_image *texImage,
 /* MESA_FORMAT_RGB332 ********************************************************/
 
 /* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */
-static void FETCH(rgb332)( const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_rgb332)( const struct gl_texture_image *texImage,
+                             GLint i, GLint j, GLint k, GLfloat *texel )
 {
-   static const GLubyte lut2to8[4] = {0, 85, 170, 255};
-   static const GLubyte lut3to8[8] = {0, 36, 73, 109, 146, 182, 219, 255};
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
    const GLubyte s = *src;
-   texel[RCOMP] = UBYTE_TO_CHAN( lut3to8[(s >> 5) & 0x7] );
-   texel[GCOMP] = UBYTE_TO_CHAN( lut3to8[(s >> 2) & 0x7] );
-   texel[BCOMP] = UBYTE_TO_CHAN( lut2to8[(s     ) & 0x3] );
-   texel[ACOMP] = CHAN_MAX;
+   texel[RCOMP] = ((s >> 5) & 0x7) * (1.0F / 7.0F);
+   texel[GCOMP] = ((s >> 2) & 0x7) * (1.0F / 7.0F);
+   texel[BCOMP] = ((s     ) & 0x3) * (1.0F / 3.0F);
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -1029,14 +1010,14 @@ static void store_texel_rgb332(struct gl_texture_image *texImage,
 /* MESA_FORMAT_A8 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */
-static void FETCH(a8)( const struct gl_texture_image *texImage,
-                      GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_a8)( const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
    texel[RCOMP] =
    texel[GCOMP] =
-   texel[BCOMP] = 0;
-   texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
+   texel[BCOMP] = 0.0F;
+   texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
 }
 
 #if DIM == 3
@@ -1053,14 +1034,14 @@ static void store_texel_a8(struct gl_texture_image *texImage,
 /* MESA_FORMAT_L8 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */
-static void FETCH(l8)( const struct gl_texture_image *texImage,
-                      GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_l8)( const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
    texel[RCOMP] =
    texel[GCOMP] =
-   texel[BCOMP] = UBYTE_TO_CHAN( src[0] );
-   texel[ACOMP] = CHAN_MAX;
+   texel[BCOMP] = UBYTE_TO_FLOAT( src[0] );
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -1077,14 +1058,14 @@ static void store_texel_l8(struct gl_texture_image *texImage,
 /* MESA_FORMAT_I8 ************************************************************/
 
 /* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */
-static void FETCH(i8)( const struct gl_texture_image *texImage,
-                      GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_i8)( const struct gl_texture_image *texImage,
+                         GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
    texel[RCOMP] =
    texel[GCOMP] =
    texel[BCOMP] =
-   texel[ACOMP] = UBYTE_TO_CHAN( src[0] );
+   texel[ACOMP] = UBYTE_TO_FLOAT( src[0] );
 }
 
 #if DIM == 3
@@ -1103,12 +1084,11 @@ static void store_texel_i8(struct gl_texture_image *texImage,
 /* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a
  * color table, and return 4 GLchans.
  */
-static void FETCH(ci8)( const struct gl_texture_image *texImage,
-                       GLint i, GLint j, GLint k, GLchan *texel )
+static void FETCH(f_ci8)( const struct gl_texture_image *texImage,
+                          GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1);
    const struct gl_color_table *palette;
-   GLubyte texelUB[4];
    GLuint index;
    GET_CURRENT_CONTEXT(ctx);
 
@@ -1125,61 +1105,48 @@ static void FETCH(ci8)( const struct gl_texture_image *texImage,
    index = (*src) & (palette->Size - 1);
 
    {
-      const GLubyte *table = palette->TableUB;
+      const GLfloat *table = palette->TableF;
       switch (palette->_BaseFormat) {
       case GL_ALPHA:
-         texelUB[RCOMP] =
-         texelUB[GCOMP] =
-         texelUB[BCOMP] = 0;
-         texelUB[ACOMP] = table[index];
-         break;;
+         texel[RCOMP] =
+         texel[GCOMP] =
+         texel[BCOMP] = 0.0F;
+         texel[ACOMP] = table[index];
+         break;
       case GL_LUMINANCE:
-         texelUB[RCOMP] =
-         texelUB[GCOMP] =
-         texelUB[BCOMP] = table[index];
-         texelUB[ACOMP] = 255;
+         texel[RCOMP] =
+         texel[GCOMP] =
+         texel[BCOMP] = table[index];
+         texel[ACOMP] = 1.0F;
          break;
       case GL_INTENSITY:
-         texelUB[RCOMP] =
-         texelUB[GCOMP] =
-         texelUB[BCOMP] =
-         texelUB[ACOMP] = table[index];
-         break;;
+         texel[RCOMP] =
+         texel[GCOMP] =
+         texel[BCOMP] =
+         texel[ACOMP] = table[index];
+         break;
       case GL_LUMINANCE_ALPHA:
-         texelUB[RCOMP] =
-         texelUB[GCOMP] =
-         texelUB[BCOMP] = table[index * 2 + 0];
-         texelUB[ACOMP] = table[index * 2 + 1];
-         break;;
+         texel[RCOMP] =
+         texel[GCOMP] =
+         texel[BCOMP] = table[index * 2 + 0];
+         texel[ACOMP] = table[index * 2 + 1];
+         break;
       case GL_RGB:
-         texelUB[RCOMP] = table[index * 3 + 0];
-         texelUB[GCOMP] = table[index * 3 + 1];
-         texelUB[BCOMP] = table[index * 3 + 2];
-         texelUB[ACOMP] = 255;
-         break;;
+         texel[RCOMP] = table[index * 3 + 0];
+         texel[GCOMP] = table[index * 3 + 1];
+         texel[BCOMP] = table[index * 3 + 2];
+         texel[ACOMP] = 1.0F;
+         break;
       case GL_RGBA:
-         texelUB[RCOMP] = table[index * 4 + 0];
-         texelUB[GCOMP] = table[index * 4 + 1];
-         texelUB[BCOMP] = table[index * 4 + 2];
-         texelUB[ACOMP] = table[index * 4 + 3];
-         break;;
+         texel[RCOMP] = table[index * 4 + 0];
+         texel[GCOMP] = table[index * 4 + 1];
+         texel[BCOMP] = table[index * 4 + 2];
+         texel[ACOMP] = table[index * 4 + 3];
+         break;
       default:
          _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8");
          return;
       }
-#if CHAN_TYPE == GL_UNSIGNED_BYTE
-      COPY_4UBV(texel, texelUB);
-#elif CHAN_TYPE == GL_UNSIGNED_SHORT
-      texel[0] = UBYTE_TO_USHORT(texelUB[0]);
-      texel[1] = UBYTE_TO_USHORT(texelUB[1]);
-      texel[2] = UBYTE_TO_USHORT(texelUB[2]);
-      texel[3] = UBYTE_TO_USHORT(texelUB[3]);
-#else
-      texel[0] = UBYTE_TO_FLOAT(texelUB[0]);
-      texel[1] = UBYTE_TO_FLOAT(texelUB[1]);
-      texel[2] = UBYTE_TO_FLOAT(texelUB[2]);
-      texel[3] = UBYTE_TO_FLOAT(texelUB[3]);
-#endif
    }
 }
 
@@ -1197,14 +1164,15 @@ static void store_texel_ci8(struct gl_texture_image *texImage,
 #if FEATURE_EXT_texture_sRGB
 
 /* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */
+/* Note: component order is same as for MESA_FORMAT_RGB888 */
 static void FETCH(srgb8)(const struct gl_texture_image *texImage,
                          GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   texel[RCOMP] = nonlinear_to_linear(src[0]);
+   texel[RCOMP] = nonlinear_to_linear(src[2]);
    texel[GCOMP] = nonlinear_to_linear(src[1]);
-   texel[BCOMP] = nonlinear_to_linear(src[2]);
-   texel[ACOMP] = CHAN_MAX;
+   texel[BCOMP] = nonlinear_to_linear(src[0]);
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -1213,9 +1181,9 @@ static void store_texel_srgb8(struct gl_texture_image *texImage,
 {
    const GLubyte *rgba = (const GLubyte *) texel;
    GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3);
-   dst[0] = rgba[RCOMP]; /* no conversion */
+   dst[0] = rgba[BCOMP]; /* no conversion */
    dst[1] = rgba[GCOMP];
-   dst[2] = rgba[BCOMP];
+   dst[2] = rgba[RCOMP];
 }
 #endif
 
@@ -1321,14 +1289,57 @@ static void FETCH(dudv8)(const struct gl_texture_image *texImage,
    texel[ACOMP] = 0;
 }
 
+/* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/
+
+static void FETCH(signed_rgba8888)( const struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s >> 24)        );
+   texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff );
+   texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >>  8) & 0xff );
+   texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s      ) & 0xff );
+}
+
+#if DIM == 3
+static void store_texel_signed_rgba8888(struct gl_texture_image *texImage,
+                                        GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLbyte *rgba = (const GLbyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
+}
+#endif
+
+static void FETCH(signed_rgba8888_rev)( const struct gl_texture_image *texImage,
+                                        GLint i, GLint j, GLint k, GLfloat *texel )
+{
+   const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   texel[RCOMP] = BYTE_TO_FLOAT_TEX( (s      ) & 0xff );
+   texel[GCOMP] = BYTE_TO_FLOAT_TEX( (s >>  8) & 0xff );
+   texel[BCOMP] = BYTE_TO_FLOAT_TEX( (s >> 16) & 0xff );
+   texel[ACOMP] = BYTE_TO_FLOAT_TEX( (s >> 24)        );
+}
+
+#if DIM == 3
+static void store_texel_signed_rgba8888_rev(struct gl_texture_image *texImage,
+                                            GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLubyte *rgba = (const GLubyte *) texel;
+   GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1);
+   *dst = PACK_COLOR_8888_REV(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]);
+}
+#endif
+
+
 
 /* MESA_FORMAT_YCBCR *********************************************************/
 
-/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLchans */
-/* We convert YCbCr to RGB here */
-/* XXX this may break if GLchan != GLubyte */
-static void FETCH(ycbcr)( const struct gl_texture_image *texImage,
-                          GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D ycbcr texture, return 4 GLfloats.
+ * We convert YCbCr to RGB here.
+ */
+static void FETCH(f_ycbcr)( const struct gl_texture_image *texImage,
+                            GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
    const GLushort *src1 = src0 + 1;                               /* odd */
@@ -1336,23 +1347,17 @@ static void FETCH(ycbcr)( const struct gl_texture_image *texImage,
    const GLubyte cb = *src0 & 0xff;         /* chroma U */
    const GLubyte y1 = (*src1 >> 8) & 0xff;  /* luminance */
    const GLubyte cr = *src1 & 0xff;         /* chroma V */
-   GLint r, g, b;
-   if (i & 1) {
-      /* odd pixel: use y1,cr,cb */
-      r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128));
-      g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
-      b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128));
-   }
-   else {
-      /* even pixel: use y0,cr,cb */
-      r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128));
-      g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
-      b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128));
-   }
-   texel[RCOMP] = CLAMP(r, 0, CHAN_MAX);
-   texel[GCOMP] = CLAMP(g, 0, CHAN_MAX);
-   texel[BCOMP] = CLAMP(b, 0, CHAN_MAX);
-   texel[ACOMP] = CHAN_MAX;
+   const GLfloat y = (i & 1) ? y1 : y0;     /* choose even/odd luminance */
+   GLfloat r = 1.164 * (y - 16) + 1.596 * (cr - 128);
+   GLfloat g = 1.164 * (y - 16) - 0.813 * (cr - 128) - 0.391 * (cb - 128);
+   GLfloat b = 1.164 * (y - 16) + 2.018 * (cb - 128);
+   r *= (1.0 / 255.0F);
+   g *= (1.0 / 255.0F);
+   b *= (1.0 / 255.0F);
+   texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
+   texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
+   texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
@@ -1371,11 +1376,11 @@ static void store_texel_ycbcr(struct gl_texture_image *texImage,
 
 /* MESA_FORMAT_YCBCR_REV *****************************************************/
 
-/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLchans */
-/* We convert YCbCr to RGB here */
-/* XXX this may break if GLchan != GLubyte */
-static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage,
-                              GLint i, GLint j, GLint k, GLchan *texel )
+/* Fetch texel from 1D, 2D or 3D ycbcr_rev texture, return 4 GLfloats.
+ * We convert YCbCr to RGB here.
+ */
+static void FETCH(f_ycbcr_rev)( const struct gl_texture_image *texImage,
+                                GLint i, GLint j, GLint k, GLfloat *texel )
 {
    const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */
    const GLushort *src1 = src0 + 1;                               /* odd */
@@ -1383,23 +1388,17 @@ static void FETCH(ycbcr_rev)( const struct gl_texture_image *texImage,
    const GLubyte cr = (*src0 >> 8) & 0xff;  /* chroma V */
    const GLubyte y1 = *src1 & 0xff;         /* luminance */
    const GLubyte cb = (*src1 >> 8) & 0xff;  /* chroma U */
-   GLint r, g, b;
-   if (i & 1) {
-      /* odd pixel: use y1,cr,cb */
-      r = (GLint) (1.164 * (y1-16) + 1.596 * (cr-128));
-      g = (GLint) (1.164 * (y1-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
-      b = (GLint) (1.164 * (y1-16) + 2.018 * (cb-128));
-   }
-   else {
-      /* even pixel: use y0,cr,cb */
-      r = (GLint) (1.164 * (y0-16) + 1.596 * (cr-128));
-      g = (GLint) (1.164 * (y0-16) - 0.813 * (cr-128) - 0.391 * (cb-128));
-      b = (GLint) (1.164 * (y0-16) + 2.018 * (cb-128));
-   }
-   texel[RCOMP] = CLAMP(r, 0, CHAN_MAX);
-   texel[GCOMP] = CLAMP(g, 0, CHAN_MAX);
-   texel[BCOMP] = CLAMP(b, 0, CHAN_MAX);
-   texel[ACOMP] = CHAN_MAX;
+   const GLfloat y = (i & 1) ? y1 : y0;     /* choose even/odd luminance */
+   GLfloat r = 1.164 * (y - 16) + 1.596 * (cr - 128);
+   GLfloat g = 1.164 * (y - 16) - 0.813 * (cr - 128) - 0.391 * (cb - 128);
+   GLfloat b = 1.164 * (y - 16) + 2.018 * (cb - 128);
+   r *= (1.0 / 255.0F);
+   g *= (1.0 / 255.0F);
+   b *= (1.0 / 255.0F);
+   texel[RCOMP] = CLAMP(r, 0.0F, 1.0F);
+   texel[GCOMP] = CLAMP(g, 0.0F, 1.0F);
+   texel[BCOMP] = CLAMP(b, 0.0F, 1.0F);
+   texel[ACOMP] = 1.0F;
 }
 
 #if DIM == 3
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
new file mode 100644 (file)
index 0000000..70a2508
--- /dev/null
@@ -0,0 +1,356 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2009 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * Code for glGetTexImage() and glGetCompressedTexImage().
+ */
+
+
+#include "glheader.h"
+#include "context.h"
+#include "image.h"
+#include "texcompress.h"
+#include "texformat.h"
+#include "texgetimage.h"
+
+
+
+#if FEATURE_EXT_texture_sRGB
+
+/**
+ * Test if given texture image is an sRGB format.
+ */
+static GLboolean
+is_srgb_teximage(const struct gl_texture_image *texImage)
+{
+   switch (texImage->TexFormat->MesaFormat) {
+   case MESA_FORMAT_SRGB8:
+   case MESA_FORMAT_SRGBA8:
+   case MESA_FORMAT_SARGB8:
+   case MESA_FORMAT_SL8:
+   case MESA_FORMAT_SLA8:
+   case MESA_FORMAT_SRGB_DXT1:
+   case MESA_FORMAT_SRGBA_DXT1:
+   case MESA_FORMAT_SRGBA_DXT3:
+   case MESA_FORMAT_SRGBA_DXT5:
+      return GL_TRUE;
+   default:
+      return GL_FALSE;
+   }
+}
+
+
+/**
+ * Convert a float value from linear space to a
+ * non-linear sRGB value in [0, 255].
+ * Not terribly efficient.
+ */
+static INLINE GLfloat
+linear_to_nonlinear(GLfloat cl)
+{
+   /* can't have values outside [0, 1] */
+   GLfloat cs;
+   if (cl < 0.0031308) {
+      cs = 12.92 * cl;
+   }
+   else {
+      cs = 1.055 * _mesa_pow(cl, 0.41666) - 0.055;
+   }
+   return cs;
+}
+
+#endif /* FEATURE_EXT_texture_sRGB */
+
+
+/**
+ * Can the given type represent negative values?
+ */
+static INLINE GLboolean
+type_with_negative_values(GLenum type)
+{
+   switch (type) {
+   case GL_BYTE:
+   case GL_SHORT:
+   case GL_INT:
+   case GL_FLOAT:
+   case GL_HALF_FLOAT_ARB:
+      return GL_TRUE;
+   default:
+      return GL_FALSE;
+   }
+}
+
+
+/**
+ * This is the software fallback for Driver.GetTexImage().
+ * All error checking will have been done before this routine is called.
+ */
+void
+_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
+                   GLenum format, GLenum type, GLvoid *pixels,
+                   struct gl_texture_object *texObj,
+                   struct gl_texture_image *texImage)
+{
+   const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2;
+
+   if (ctx->Pack.BufferObj->Name) {
+      /* Packing texture image into a PBO.
+       * Map the (potentially) VRAM-based buffer into our process space so
+       * we can write into it with the code below.
+       * A hardware driver might use a sophisticated blit to move the
+       * texture data to the PBO if the PBO is in VRAM along with the texture.
+       */
+      GLubyte *buf = (GLubyte *)
+         ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
+                               GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
+      if (!buf) {
+         /* buffer is already mapped - that's an error */
+         _mesa_error(ctx, GL_INVALID_OPERATION,"glGetTexImage(PBO is mapped)");
+         return;
+      }
+      /* <pixels> was an offset into the PBO.
+       * Now make it a real, client-side pointer inside the mapped region.
+       */
+      pixels = ADD_POINTERS(buf, pixels);
+   }
+   else if (!pixels) {
+      /* not an error */
+      return;
+   }
+
+   {
+      const GLint width = texImage->Width;
+      const GLint height = texImage->Height;
+      const GLint depth = texImage->Depth;
+      GLint img, row;
+      for (img = 0; img < depth; img++) {
+         for (row = 0; row < height; row++) {
+            /* compute destination address in client memory */
+            GLvoid *dest = _mesa_image_address( dimensions, &ctx->Pack, pixels,
+                                                width, height, format, type,
+                                                img, row, 0);
+            assert(dest);
+
+            if (format == GL_COLOR_INDEX) {
+               GLuint indexRow[MAX_WIDTH];
+               GLint col;
+               /* Can't use FetchTexel here because that returns RGBA */
+               if (texImage->TexFormat->IndexBits == 8) {
+                  const GLubyte *src = (const GLubyte *) texImage->Data;
+                  src += width * (img * texImage->Height + row);
+                  for (col = 0; col < width; col++) {
+                     indexRow[col] = src[col];
+                  }
+               }
+               else if (texImage->TexFormat->IndexBits == 16) {
+                  const GLushort *src = (const GLushort *) texImage->Data;
+                  src += width * (img * texImage->Height + row);
+                  for (col = 0; col < width; col++) {
+                     indexRow[col] = src[col];
+                  }
+               }
+               else {
+                  _mesa_problem(ctx,
+                                "Color index problem in _mesa_GetTexImage");
+               }
+               _mesa_pack_index_span(ctx, width, type, dest,
+                                     indexRow, &ctx->Pack,
+                                     0 /* no image transfer */);
+            }
+            else if (format == GL_DEPTH_COMPONENT) {
+               GLfloat depthRow[MAX_WIDTH];
+               GLint col;
+               for (col = 0; col < width; col++) {
+                  (*texImage->FetchTexelf)(texImage, col, row, img,
+                                           depthRow + col);
+               }
+               _mesa_pack_depth_span(ctx, width, dest, type,
+                                     depthRow, &ctx->Pack);
+            }
+            else if (format == GL_DEPTH_STENCIL_EXT) {
+               /* XXX Note: we're bypassing texImage->FetchTexel()! */
+               const GLuint *src = (const GLuint *) texImage->Data;
+               src += width * row + width * height * img;
+               _mesa_memcpy(dest, src, width * sizeof(GLuint));
+               if (ctx->Pack.SwapBytes) {
+                  _mesa_swap4((GLuint *) dest, width);
+               }
+            }
+            else if (format == GL_YCBCR_MESA) {
+               /* No pixel transfer */
+               const GLint rowstride = texImage->RowStride;
+               MEMCPY(dest,
+                      (const GLushort *) texImage->Data + row * rowstride,
+                      width * sizeof(GLushort));
+               /* check for byte swapping */
+               if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR
+                    && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
+                   (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV
+                    && type == GL_UNSIGNED_SHORT_8_8_MESA)) {
+                  if (!ctx->Pack.SwapBytes)
+                     _mesa_swap2((GLushort *) dest, width);
+               }
+               else if (ctx->Pack.SwapBytes) {
+                  _mesa_swap2((GLushort *) dest, width);
+               }
+            }
+#if FEATURE_EXT_texture_sRGB
+            else if (is_srgb_teximage(texImage)) {
+               /* special case this since need to backconvert values */
+               /* convert row to RGBA format */
+               GLfloat rgba[MAX_WIDTH][4];
+               GLint col;
+               GLbitfield transferOps = 0x0;
+
+               for (col = 0; col < width; col++) {
+                  (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
+                  if (texImage->_BaseFormat == GL_LUMINANCE) {
+                     rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
+                     rgba[col][GCOMP] = 0.0;
+                     rgba[col][BCOMP] = 0.0;
+                  }
+                  else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
+                     rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
+                     rgba[col][GCOMP] = 0.0;
+                     rgba[col][BCOMP] = 0.0;
+                  }
+                  else if (texImage->_BaseFormat == GL_RGB ||
+                     texImage->_BaseFormat == GL_RGBA) {
+                     rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
+                     rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]);
+                     rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]);
+                  }
+               }
+               _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
+                                          format, type, dest,
+                                          &ctx->Pack, transferOps);
+            }
+#endif /* FEATURE_EXT_texture_sRGB */
+            else {
+               /* general case:  convert row to RGBA format */
+               GLfloat rgba[MAX_WIDTH][4];
+               GLint col;
+               GLbitfield transferOps = 0x0;
+
+               /* clamp does not apply to GetTexImage (final conversion)?
+                * Looks like we need clamp though when going from format
+                * containing negative values to unsigned format.
+                */
+               if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA)
+                  transferOps |= IMAGE_CLAMP_BIT;
+               else if (!type_with_negative_values(type) &&
+                        (texImage->TexFormat->DataType == GL_FLOAT ||
+                         texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED))
+                  transferOps |= IMAGE_CLAMP_BIT;
+
+               for (col = 0; col < width; col++) {
+                  (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
+                  if (texImage->_BaseFormat == GL_ALPHA) {
+                     rgba[col][RCOMP] = 0.0;
+                     rgba[col][GCOMP] = 0.0;
+                     rgba[col][BCOMP] = 0.0;
+                  }
+                  else if (texImage->_BaseFormat == GL_LUMINANCE) {
+                     rgba[col][GCOMP] = 0.0;
+                     rgba[col][BCOMP] = 0.0;
+                     rgba[col][ACOMP] = 1.0;
+                  }
+                  else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) {
+                     rgba[col][GCOMP] = 0.0;
+                     rgba[col][BCOMP] = 0.0;
+                  }
+                  else if (texImage->_BaseFormat == GL_INTENSITY) {
+                     rgba[col][GCOMP] = 0.0;
+                     rgba[col][BCOMP] = 0.0;
+                     rgba[col][ACOMP] = 1.0;
+                  }
+               }
+               _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
+                                          format, type, dest,
+                                          &ctx->Pack, transferOps);
+            } /* format */
+         } /* row */
+      } /* img */
+   }
+
+   if (ctx->Pack.BufferObj->Name) {
+      ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
+                              ctx->Pack.BufferObj);
+   }
+}
+
+
+
+/**
+ * This is the software fallback for Driver.GetCompressedTexImage().
+ * All error checking will have been done before this routine is called.
+ */
+void
+_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
+                              GLvoid *img,
+                              struct gl_texture_object *texObj,
+                              struct gl_texture_image *texImage)
+{
+   GLuint size;
+
+   if (ctx->Pack.BufferObj->Name) {
+      /* pack texture image into a PBO */
+      GLubyte *buf;
+      if ((const GLubyte *) img + texImage->CompressedSize >
+          (const GLubyte *) ctx->Pack.BufferObj->Size) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetCompressedTexImage(invalid PBO access)");
+         return;
+      }
+      buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
+                                              GL_WRITE_ONLY_ARB,
+                                              ctx->Pack.BufferObj);
+      if (!buf) {
+         /* buffer is already mapped - that's an error */
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glGetCompressedTexImage(PBO is mapped)");
+         return;
+      }
+      img = ADD_POINTERS(buf, img);
+   }
+   else if (!img) {
+      /* not an error */
+      return;
+   }
+
+   /* don't use texImage->CompressedSize since that may be padded out */
+   size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height,
+                                        texImage->Depth,
+                                        texImage->TexFormat->MesaFormat);
+
+   /* just memcpy, no pixelstore or pixel transfer */
+   _mesa_memcpy(img, texImage->Data, size);
+
+   if (ctx->Pack.BufferObj->Name) {
+      ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
+                              ctx->Pack.BufferObj);
+   }
+}
diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h
new file mode 100644 (file)
index 0000000..01f486e
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Mesa 3-D graphics library
+ * Version:  7.5
+ *
+ * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
+ * Copyright (c) 2009 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXGETIMAGE_H
+#define TEXGETIMAGE_H
+
+
+extern void
+_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
+                   GLenum format, GLenum type, GLvoid *pixels,
+                   struct gl_texture_object *texObj,
+                   struct gl_texture_image *texImage);
+
+
+extern void
+_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
+                              GLvoid *img,
+                              struct gl_texture_object *texObj,
+                              struct gl_texture_image *texImage);
+
+
+
+#endif /* TEXGETIMAGE_H */
index 4f29773..8c03c36 100644 (file)
@@ -349,6 +349,15 @@ _mesa_base_tex_format( GLcontext *ctx, GLint internalFormat )
       }
    }
 
+   if (ctx->Extensions.MESA_texture_signed_rgba) {
+      switch (internalFormat) {
+         case GL_RGBA_SNORM:
+         case GL_RGBA8_SNORM:
+            return GL_RGBA;
+         default:
+            ; /* fallthrough */
+      }
+   }
 
    if (ctx->Extensions.EXT_packed_depth_stencil) {
       switch (internalFormat) {
@@ -502,6 +511,10 @@ _mesa_is_color_format(GLenum format)
       case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
 #endif /* FEATURE_EXT_texture_sRGB */
          return GL_TRUE;
+      /* signed texture formats */
+      case GL_RGBA_SNORM:
+      case GL_RGBA8_SNORM:
+         return GL_TRUE;
       case GL_YCBCR_MESA:  /* not considered to be RGB */
          /* fall-through */
       default:
index 50f867e..515a35c 100644 (file)
@@ -179,8 +179,11 @@ flush(GLcontext *ctx, struct gl_texture_object *texObj)
 }
 
 
-/** Set an integer-valued texture parameter */
-static void
+/**
+ * Set an integer-valued texture parameter
+ * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
+ */
+static GLboolean
 set_tex_parameteri(GLcontext *ctx,
                    struct gl_texture_object *texObj,
                    GLenum pname, const GLint *params)
@@ -188,13 +191,13 @@ set_tex_parameteri(GLcontext *ctx,
    switch (pname) {
    case GL_TEXTURE_MIN_FILTER:
       if (texObj->MinFilter == params[0])
-         return;
+         return GL_FALSE;
       switch (params[0]) {
       case GL_NEAREST:
       case GL_LINEAR:
          flush(ctx, texObj);
          texObj->MinFilter = params[0];
-         return;
+         return GL_TRUE;
       case GL_NEAREST_MIPMAP_NEAREST:
       case GL_LINEAR_MIPMAP_NEAREST:
       case GL_NEAREST_MIPMAP_LINEAR:
@@ -202,90 +205,95 @@ set_tex_parameteri(GLcontext *ctx,
          if (texObj->Target != GL_TEXTURE_RECTANGLE_NV) {
             flush(ctx, texObj);
             texObj->MinFilter = params[0];
-            return;
+            return GL_TRUE;
          }
          /* fall-through */
       default:
          _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
       }
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_MAG_FILTER:
       if (texObj->MagFilter == params[0])
-         return;
+         return GL_FALSE;
       switch (params[0]) {
       case GL_NEAREST:
       case GL_LINEAR:
          flush(ctx, texObj);
          texObj->MagFilter = params[0];
-         return;
+         return GL_TRUE;
       default:
          _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
       }
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_WRAP_S:
       if (texObj->WrapS == params[0])
-         return;
+         return GL_FALSE;
       if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
          flush(ctx, texObj);
          texObj->WrapS = params[0];
+         return GL_TRUE;
       }
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_WRAP_T:
       if (texObj->WrapT == params[0])
-         return;
+         return GL_FALSE;
       if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
          flush(ctx, texObj);
          texObj->WrapT = params[0];
+         return GL_TRUE;
       }
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_WRAP_R:
       if (texObj->WrapR == params[0])
-         return;
+         return GL_FALSE;
       if (validate_texture_wrap_mode(ctx, texObj->Target, params[0])) {
          flush(ctx, texObj);
          texObj->WrapR = params[0];
+         return GL_TRUE;
       }
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_BASE_LEVEL:
       if (texObj->BaseLevel == params[0])
-         return;
+         return GL_FALSE;
       if (params[0] < 0 ||
           (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) {
          _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)");
-         return;
+         return GL_FALSE;
       }
       flush(ctx, texObj);
       texObj->BaseLevel = params[0];
-      return;
+      return GL_TRUE;
 
    case GL_TEXTURE_MAX_LEVEL:
       if (texObj->MaxLevel == params[0])
-         return;
+         return GL_FALSE;
       if (params[0] < 0 || texObj->Target == GL_TEXTURE_RECTANGLE_ARB) {
          _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(param)");
-         return;
+         return GL_FALSE;
       }
       flush(ctx, texObj);
       texObj->MaxLevel = params[0];
-      return;
+      return GL_TRUE;
 
    case GL_GENERATE_MIPMAP_SGIS:
       if (ctx->Extensions.SGIS_generate_mipmap) {
          if (texObj->GenerateMipmap != params[0]) {
             flush(ctx, texObj);
             texObj->GenerateMipmap = params[0] ? GL_TRUE : GL_FALSE;
+            return GL_TRUE;
          }
+         return GL_FALSE;
       }
       else {
          _mesa_error(ctx, GL_INVALID_ENUM,
                      "glTexParameter(pname=GL_GENERATE_MIPMAP_SGIS)");
       }
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_COMPARE_MODE_ARB:
       if (ctx->Extensions.ARB_shadow &&
@@ -294,24 +302,26 @@ set_tex_parameteri(GLcontext *ctx,
          if (texObj->CompareMode != params[0]) {
             flush(ctx, texObj);
             texObj->CompareMode = params[0];
+            return GL_TRUE;
          }
+         return GL_FALSE;
       }
       else {
          _mesa_error(ctx, GL_INVALID_ENUM,
                      "glTexParameter(GL_TEXTURE_COMPARE_MODE_ARB)");
       }
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_COMPARE_FUNC_ARB:
       if (ctx->Extensions.ARB_shadow) {
          if (texObj->CompareFunc == params[0])
-            return;
+            return GL_FALSE;
          switch (params[0]) {
          case GL_LEQUAL:
          case GL_GEQUAL:
             flush(ctx, texObj);
             texObj->CompareFunc = params[0];
-            return;
+            return GL_TRUE;
          case GL_EQUAL:
          case GL_NOTEQUAL:
          case GL_LESS:
@@ -321,7 +331,7 @@ set_tex_parameteri(GLcontext *ctx,
             if (ctx->Extensions.EXT_shadow_funcs) {
                flush(ctx, texObj);
                texObj->CompareFunc = params[0];
-               return;
+               return GL_TRUE;
             }
             /* fall-through */
          default:
@@ -332,7 +342,7 @@ set_tex_parameteri(GLcontext *ctx,
       else {
          _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param)");
       }
-      return;
+      return GL_FALSE;
 
    case GL_DEPTH_TEXTURE_MODE_ARB:
       if (ctx->Extensions.ARB_depth_texture &&
@@ -342,13 +352,14 @@ set_tex_parameteri(GLcontext *ctx,
          if (texObj->DepthMode != params[0]) {
             flush(ctx, texObj);
             texObj->DepthMode = params[0];
+            return GL_TRUE;
          }
       }
       else {
          _mesa_error(ctx, GL_INVALID_ENUM,
                      "glTexParameter(GL_DEPTH_TEXTURE_MODE_ARB)");
       }
-      return;
+      return GL_FALSE;
 
 #ifdef FEATURE_OES_draw_texture
    case GL_TEXTURE_CROP_RECT_OES:
@@ -356,7 +367,7 @@ set_tex_parameteri(GLcontext *ctx,
       texObj->CropRect[1] = params[1];
       texObj->CropRect[2] = params[2];
       texObj->CropRect[3] = params[3];
-      return;
+      return GL_TRUE;
 #endif
 
    case GL_TEXTURE_SWIZZLE_R_EXT:
@@ -369,18 +380,18 @@ set_tex_parameteri(GLcontext *ctx,
          if (swz < 0) {
             _mesa_error(ctx, GL_INVALID_OPERATION,
                         "glTexParameter(swizzle 0x%x)", params[0]);
-            return;
+            return GL_FALSE;
          }
          ASSERT(comp < 4);
          if (swz >= 0) {
             flush(ctx, texObj);
             texObj->Swizzle[comp] = params[0];
             set_swizzle_component(&texObj->_Swizzle, comp, swz);
-            return;
+            return GL_TRUE;
          }
       }
       _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_SWIZZLE_RGBA_EXT:
       if (ctx->Extensions.EXT_texture_swizzle) {
@@ -395,22 +406,26 @@ set_tex_parameteri(GLcontext *ctx,
             else {
                _mesa_error(ctx, GL_INVALID_OPERATION,
                            "glTexParameter(swizzle 0x%x)", params[comp]);
-               return;
+               return GL_FALSE;
             }
          }
-         return;
+         return GL_TRUE;
       }
       _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
-      return;
+      return GL_FALSE;
 
    default:
       _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
    }
+   return GL_FALSE;
 }
 
 
-/** Set a float-valued texture parameter */
-static void
+/**
+ * Set a float-valued texture parameter
+ * \return GL_TRUE if legal AND the value changed, GL_FALSE otherwise
+ */
+static GLboolean
 set_tex_parameterf(GLcontext *ctx,
                    struct gl_texture_object *texObj,
                    GLenum pname, const GLfloat *params)
@@ -418,54 +433,56 @@ set_tex_parameterf(GLcontext *ctx,
    switch (pname) {
    case GL_TEXTURE_MIN_LOD:
       if (texObj->MinLod == params[0])
-         return;
+         return GL_FALSE;
       flush(ctx, texObj);
       texObj->MinLod = params[0];
-      return;
+      return GL_TRUE;
 
    case GL_TEXTURE_MAX_LOD:
       if (texObj->MaxLod == params[0])
-         return;
+         return GL_FALSE;
       flush(ctx, texObj);
       texObj->MaxLod = params[0];
-      return;
+      return GL_TRUE;
 
    case GL_TEXTURE_PRIORITY:
       flush(ctx, texObj);
       texObj->Priority = CLAMP(params[0], 0.0F, 1.0F);
-      return;
+      return GL_TRUE;
 
    case GL_TEXTURE_MAX_ANISOTROPY_EXT:
       if (ctx->Extensions.EXT_texture_filter_anisotropic) {
          if (texObj->MaxAnisotropy == params[0])
-            return;
+            return GL_FALSE;
          if (params[0] < 1.0) {
             _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
-            return;
+            return GL_FALSE;
          }
          flush(ctx, texObj);
          /* clamp to max, that's what NVIDIA does */
          texObj->MaxAnisotropy = MIN2(params[0],
                                       ctx->Const.MaxTextureMaxAnisotropy);
+         return GL_TRUE;
       }
       else {
          _mesa_error(ctx, GL_INVALID_ENUM,
                      "glTexParameter(pname=GL_TEXTURE_MAX_ANISOTROPY_EXT)");
       }
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB:
       if (ctx->Extensions.ARB_shadow_ambient) {
          if (texObj->CompareFailValue != params[0]) {
             flush(ctx, texObj);
             texObj->CompareFailValue = CLAMP(params[0], 0.0F, 1.0F);
+            return GL_TRUE;
          }
       }
       else {
          _mesa_error(ctx, GL_INVALID_ENUM,
                     "glTexParameter(pname=GL_TEXTURE_COMPARE_FAIL_VALUE_ARB)");
       }
-      return;
+      return GL_FALSE;
 
    case GL_TEXTURE_LOD_BIAS:
       /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias */
@@ -473,7 +490,9 @@ set_tex_parameterf(GLcontext *ctx,
          if (texObj->LodBias != params[0]) {
             flush(ctx, texObj);
             texObj->LodBias = params[0];
+            return GL_TRUE;
          }
+         return GL_FALSE;
       }
       break;
 
@@ -483,21 +502,19 @@ set_tex_parameterf(GLcontext *ctx,
       texObj->BorderColor[GCOMP] = params[1];
       texObj->BorderColor[BCOMP] = params[2];
       texObj->BorderColor[ACOMP] = params[3];
-      UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[RCOMP], params[0]);
-      UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[GCOMP], params[1]);
-      UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[BCOMP], params[2]);
-      UNCLAMPED_FLOAT_TO_CHAN(texObj->_BorderChan[ACOMP], params[3]);
-      return;
+      return GL_TRUE;
 
    default:
       _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=0x%x)", pname);
    }
+   return GL_FALSE;
 }
 
 
 void GLAPIENTRY
 _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
 {
+   GLboolean need_update;
    struct gl_texture_object *texObj;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -521,15 +538,15 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
       {
          /* convert float param to int */
          GLint p = (GLint) param;
-         set_tex_parameteri(ctx, texObj, pname, &p);
+         need_update = set_tex_parameteri(ctx, texObj, pname, &p);
       }
-      return;
+      break;
    default:
       /* this will generate an error if pname is illegal */
-      set_tex_parameterf(ctx, texObj, pname, &param);
+      need_update = set_tex_parameterf(ctx, texObj, pname, &param);
    }
 
-   if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
+   if (ctx->Driver.TexParameter && need_update) {
       ctx->Driver.TexParameter(ctx, target, texObj, pname, &param);
    }
 }
@@ -538,6 +555,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
 void GLAPIENTRY
 _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 {
+   GLboolean need_update;
    struct gl_texture_object *texObj;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -561,7 +579,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
       {
          /* convert float param to int */
          GLint p = (GLint) params[0];
-         set_tex_parameteri(ctx, texObj, pname, &p);
+         need_update = set_tex_parameteri(ctx, texObj, pname, &p);
       }
       break;
 
@@ -574,17 +592,17 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
          iparams[1] = (GLint) params[1];
          iparams[2] = (GLint) params[2];
          iparams[3] = (GLint) params[3];
-         set_tex_parameteri(ctx, target, iparams);
+         need_update = set_tex_parameteri(ctx, target, iparams);
       }
       break;
 #endif
 
    default:
       /* this will generate an error if pname is illegal */
-      set_tex_parameterf(ctx, texObj, pname, params);
+      need_update = set_tex_parameterf(ctx, texObj, pname, params);
    }
 
-   if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
+   if (ctx->Driver.TexParameter && need_update) {
       ctx->Driver.TexParameter(ctx, target, texObj, pname, params);
    }
 }
@@ -593,6 +611,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
 void GLAPIENTRY
 _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
 {
+   GLboolean need_update;
    struct gl_texture_object *texObj;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -611,15 +630,15 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
       {
          GLfloat fparam = (GLfloat) param;
          /* convert int param to float */
-         set_tex_parameterf(ctx, texObj, pname, &fparam);
+         need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
       }
       break;
    default:
       /* this will generate an error if pname is illegal */
-      set_tex_parameteri(ctx, texObj, pname, &param);
+      need_update = set_tex_parameteri(ctx, texObj, pname, &param);
    }
 
-   if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
+   if (ctx->Driver.TexParameter && need_update) {
       GLfloat fparam = (GLfloat) param;
       ctx->Driver.TexParameter(ctx, target, texObj, pname, &fparam);
    }
@@ -629,6 +648,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
 void GLAPIENTRY
 _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
 {
+   GLboolean need_update;
    struct gl_texture_object *texObj;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);
@@ -646,7 +666,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
          fparams[1] = INT_TO_FLOAT(params[1]);
          fparams[2] = INT_TO_FLOAT(params[2]);
          fparams[3] = INT_TO_FLOAT(params[3]);
-         set_tex_parameterf(ctx, texObj, pname, fparams);
+         need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
       }
       break;
    case GL_TEXTURE_MIN_LOD:
@@ -658,15 +678,15 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
       {
          /* convert int param to float */
          GLfloat fparam = (GLfloat) params[0];
-         set_tex_parameterf(ctx, texObj, pname, &fparam);
+         need_update = set_tex_parameterf(ctx, texObj, pname, &fparam);
       }
       break;
    default:
       /* this will generate an error if pname is illegal */
-      set_tex_parameteri(ctx, texObj, pname, params);
+      need_update = set_tex_parameteri(ctx, texObj, pname, params);
    }
 
-   if (ctx->Driver.TexParameter && ctx->ErrorValue == GL_NO_ERROR) {
+   if (ctx->Driver.TexParameter && need_update) {
       GLfloat fparams[4];
       fparams[0] = INT_TO_FLOAT(params[0]);
       if (pname == GL_TEXTURE_BORDER_COLOR ||
index cc3c695..f3739f9 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * Mesa 3-D graphics library
- * Version:  7.3
+ * Version:  7.5
  *
  * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
- * Copyright (c) 2008 VMware, Inc.
+ * Copyright (c) 2008-2009  VMware, Inc.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -798,6 +798,7 @@ static const GLubyte *
 type_mapping( GLenum srcType )
 {
    switch (srcType) {
+   case GL_BYTE:
    case GL_UNSIGNED_BYTE:
       return map_identity;
    case GL_UNSIGNED_INT_8_8_8_8:
@@ -819,6 +820,7 @@ byteswap_mapping( GLboolean swapBytes,
       return map_identity;
 
    switch (srcType) {
+   case GL_BYTE:
    case GL_UNSIGNED_BYTE:
       return map_identity;
    case GL_UNSIGNED_INT_8_8_8_8:
@@ -2561,6 +2563,124 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS)
    return GL_TRUE;
 }
 
+/**
+ * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or MESA_FORMAT_SIGNED_RGBA8888_REV
+ */
+GLboolean
+_mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
+{
+   const GLboolean littleEndian = _mesa_little_endian();
+
+   ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888 ||
+          dstFormat == &_mesa_texformat_signed_rgba8888_rev);
+   ASSERT(dstFormat->TexelBytes == 4);
+
+   if (!ctx->_ImageTransferState &&
+       !srcPacking->SwapBytes &&
+       dstFormat == &_mesa_texformat_signed_rgba8888 &&
+       baseInternalFormat == GL_RGBA &&
+      ((srcFormat == GL_RGBA && srcType == GL_BYTE && !littleEndian) ||
+       (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && littleEndian))) {
+       /* simple memcpy path */
+      memcpy_texture(ctx, dims,
+                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+                     dstRowStride,
+                     dstImageOffsets,
+                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+                     srcAddr, srcPacking);
+   }
+   else if (!ctx->_ImageTransferState &&
+       !srcPacking->SwapBytes &&
+       dstFormat == &_mesa_texformat_signed_rgba8888_rev &&
+       baseInternalFormat == GL_RGBA &&
+      ((srcFormat == GL_RGBA && srcType == GL_BYTE && littleEndian) ||
+       (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) {
+      /* simple memcpy path */
+      memcpy_texture(ctx, dims,
+                     dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset,
+                     dstRowStride,
+                     dstImageOffsets,
+                     srcWidth, srcHeight, srcDepth, srcFormat, srcType,
+                     srcAddr, srcPacking);
+   }
+   else if (!ctx->_ImageTransferState &&
+           (srcType == GL_BYTE) &&
+           can_swizzle(baseInternalFormat) &&
+           can_swizzle(srcFormat)) {
+
+      GLubyte dstmap[4];
+
+      /* dstmap - how to swizzle from RGBA to dst format:
+       */
+      if ((littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) ||
+         (!littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888_rev)) {
+        dstmap[3] = 0;
+        dstmap[2] = 1;
+        dstmap[1] = 2;
+        dstmap[0] = 3;
+      }
+      else {
+        dstmap[3] = 3;
+        dstmap[2] = 2;
+        dstmap[1] = 1;
+        dstmap[0] = 0;
+      }
+      
+      _mesa_swizzle_ubyte_image(ctx, dims,
+                               srcFormat,
+                               srcType,
+                               baseInternalFormat,
+                               dstmap, 4,
+                               dstAddr, dstXoffset, dstYoffset, dstZoffset,
+                               dstRowStride, dstImageOffsets,
+                               srcWidth, srcHeight, srcDepth, srcAddr,
+                               srcPacking);      
+   }
+   else {
+      /* general path */
+      const GLfloat *tempImage = make_temp_float_image(ctx, dims,
+                                                 baseInternalFormat,
+                                                 dstFormat->BaseFormat,
+                                                 srcWidth, srcHeight, srcDepth,
+                                                 srcFormat, srcType, srcAddr,
+                                                 srcPacking);
+      const GLfloat *srcRow = tempImage;
+      GLint img, row, col;
+      if (!tempImage)
+         return GL_FALSE;
+      _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight);
+      for (img = 0; img < srcDepth; img++) {
+         GLubyte *dstRow = (GLubyte *) dstAddr
+            + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes
+            + dstYoffset * dstRowStride
+            + dstXoffset * dstFormat->TexelBytes;
+         for (row = 0; row < srcHeight; row++) {
+            GLuint *dstUI = (GLuint *) dstRow;
+            if (dstFormat == &_mesa_texformat_signed_rgba8888) {
+               for (col = 0; col < srcWidth; col++) {
+                  dstUI[col] = PACK_COLOR_8888( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]),
+                                                FLOAT_TO_BYTE_TEX(srcRow[GCOMP]),
+                                                FLOAT_TO_BYTE_TEX(srcRow[BCOMP]),
+                                                FLOAT_TO_BYTE_TEX(srcRow[ACOMP]) );
+                  srcRow += 4;
+               }
+            }
+            else {
+               for (col = 0; col < srcWidth; col++) {
+                  dstUI[col] = PACK_COLOR_8888_REV( FLOAT_TO_BYTE_TEX(srcRow[RCOMP]),
+                                                    FLOAT_TO_BYTE_TEX(srcRow[GCOMP]),
+                                                    FLOAT_TO_BYTE_TEX(srcRow[BCOMP]),
+                                                    FLOAT_TO_BYTE_TEX(srcRow[ACOMP]) );
+                  srcRow += 4;
+               }
+            }
+            dstRow += dstRowStride;
+         }
+      }
+      _mesa_free((void *) tempImage);
+   }
+   return GL_TRUE;
+}
 
 /**
  * Store a combined depth/stencil texture image.
@@ -3770,298 +3890,3 @@ _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
    (void) texObj;
    (void) texImage;
 }
-
-
-
-
-#if FEATURE_EXT_texture_sRGB
-
-/**
- * Test if given texture image is an sRGB format.
- */
-static GLboolean
-is_srgb_teximage(const struct gl_texture_image *texImage)
-{
-   switch (texImage->TexFormat->MesaFormat) {
-   case MESA_FORMAT_SRGB8:
-   case MESA_FORMAT_SRGBA8:
-   case MESA_FORMAT_SARGB8:
-   case MESA_FORMAT_SL8:
-   case MESA_FORMAT_SLA8:
-   case MESA_FORMAT_SRGB_DXT1:
-   case MESA_FORMAT_SRGBA_DXT1:
-   case MESA_FORMAT_SRGBA_DXT3:
-   case MESA_FORMAT_SRGBA_DXT5:
-      return GL_TRUE;
-   default:
-      return GL_FALSE;
-   }
-}
-
-
-/**
- * Convert a float value from linear space to a
- * non-linear sRGB value in [0, 255].
- * Not terribly efficient.
- */
-static INLINE GLfloat
-linear_to_nonlinear(GLfloat cl)
-{
-   /* can't have values outside [0, 1] */
-   GLfloat cs;
-   if (cl < 0.0031308) {
-      cs = 12.92 * cl;
-   }
-   else {
-      cs = 1.055 * _mesa_pow(cl, 0.41666) - 0.055;
-   }
-   return cs;
-}
-
-#endif /* FEATURE_EXT_texture_sRGB */
-
-/**
- * This is the software fallback for Driver.GetTexImage().
- * All error checking will have been done before this routine is called.
- */
-void
-_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
-                   GLenum format, GLenum type, GLvoid *pixels,
-                   struct gl_texture_object *texObj,
-                   struct gl_texture_image *texImage)
-{
-   const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2;
-
-   if (ctx->Pack.BufferObj->Name) {
-      /* Packing texture image into a PBO.
-       * Map the (potentially) VRAM-based buffer into our process space so
-       * we can write into it with the code below.
-       * A hardware driver might use a sophisticated blit to move the
-       * texture data to the PBO if the PBO is in VRAM along with the texture.
-       */
-      GLubyte *buf = (GLubyte *)
-         ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
-                               GL_WRITE_ONLY_ARB, ctx->Pack.BufferObj);
-      if (!buf) {
-         /* buffer is already mapped - that's an error */
-         _mesa_error(ctx, GL_INVALID_OPERATION,"glGetTexImage(PBO is mapped)");
-         return;
-      }
-      /* <pixels> was an offset into the PBO.
-       * Now make it a real, client-side pointer inside the mapped region.
-       */
-      pixels = ADD_POINTERS(buf, pixels);
-   }
-   else if (!pixels) {
-      /* not an error */
-      return;
-   }
-
-   {
-      const GLint width = texImage->Width;
-      const GLint height = texImage->Height;
-      const GLint depth = texImage->Depth;
-      GLint img, row;
-      for (img = 0; img < depth; img++) {
-         for (row = 0; row < height; row++) {
-            /* compute destination address in client memory */
-            GLvoid *dest = _mesa_image_address( dimensions, &ctx->Pack, pixels,
-                                                width, height, format, type,
-                                                img, row, 0);
-            assert(dest);
-
-            if (format == GL_COLOR_INDEX) {
-               GLuint indexRow[MAX_WIDTH];
-               GLint col;
-               /* Can't use FetchTexel here because that returns RGBA */
-               if (texImage->TexFormat->IndexBits == 8) {
-                  const GLubyte *src = (const GLubyte *) texImage->Data;
-                  src += width * (img * texImage->Height + row);
-                  for (col = 0; col < width; col++) {
-                     indexRow[col] = src[col];
-                  }
-               }
-               else if (texImage->TexFormat->IndexBits == 16) {
-                  const GLushort *src = (const GLushort *) texImage->Data;
-                  src += width * (img * texImage->Height + row);
-                  for (col = 0; col < width; col++) {
-                     indexRow[col] = src[col];
-                  }
-               }
-               else {
-                  _mesa_problem(ctx,
-                                "Color index problem in _mesa_GetTexImage");
-               }
-               _mesa_pack_index_span(ctx, width, type, dest,
-                                     indexRow, &ctx->Pack,
-                                     0 /* no image transfer */);
-            }
-            else if (format == GL_DEPTH_COMPONENT) {
-               GLfloat depthRow[MAX_WIDTH];
-               GLint col;
-               for (col = 0; col < width; col++) {
-                  (*texImage->FetchTexelf)(texImage, col, row, img,
-                                           depthRow + col);
-               }
-               _mesa_pack_depth_span(ctx, width, dest, type,
-                                     depthRow, &ctx->Pack);
-            }
-            else if (format == GL_DEPTH_STENCIL_EXT) {
-               /* XXX Note: we're bypassing texImage->FetchTexel()! */
-               const GLuint *src = (const GLuint *) texImage->Data;
-               src += width * row + width * height * img;
-               _mesa_memcpy(dest, src, width * sizeof(GLuint));
-               if (ctx->Pack.SwapBytes) {
-                  _mesa_swap4((GLuint *) dest, width);
-               }
-            }
-            else if (format == GL_YCBCR_MESA) {
-               /* No pixel transfer */
-               const GLint rowstride = texImage->RowStride;
-               MEMCPY(dest,
-                      (const GLushort *) texImage->Data + row * rowstride,
-                      width * sizeof(GLushort));
-               /* check for byte swapping */
-               if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR
-                    && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) ||
-                   (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV
-                    && type == GL_UNSIGNED_SHORT_8_8_MESA)) {
-                  if (!ctx->Pack.SwapBytes)
-                     _mesa_swap2((GLushort *) dest, width);
-               }
-               else if (ctx->Pack.SwapBytes) {
-                  _mesa_swap2((GLushort *) dest, width);
-               }
-            }
-#if FEATURE_EXT_texture_sRGB
-            else if (is_srgb_teximage(texImage)) {
-               /* special case this since need to backconvert values */
-               /* convert row to RGBA format */
-               GLfloat rgba[MAX_WIDTH][4];
-               GLint col;
-               GLbitfield transferOps = 0x0;
-
-               for (col = 0; col < width; col++) {
-                  (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
-                  if (texImage->TexFormat->BaseFormat == GL_LUMINANCE) {
-                     rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                  }
-                  else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE_ALPHA) {
-                     rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                  }
-                  else if (texImage->TexFormat->BaseFormat == GL_RGB ||
-                     texImage->TexFormat->BaseFormat == GL_RGBA) {
-                     rgba[col][RCOMP] = linear_to_nonlinear(rgba[col][RCOMP]);
-                     rgba[col][GCOMP] = linear_to_nonlinear(rgba[col][GCOMP]);
-                     rgba[col][BCOMP] = linear_to_nonlinear(rgba[col][BCOMP]);
-                  }
-               }
-               _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
-                                          format, type, dest,
-                                          &ctx->Pack, transferOps /*image xfer ops*/);
-            }
-#endif /* FEATURE_EXT_texture_sRGB */
-            else {
-               /* general case:  convert row to RGBA format */
-               GLfloat rgba[MAX_WIDTH][4];
-               GLint col;
-               GLbitfield transferOps = 0x0;
-
-               if (type == GL_FLOAT && texImage->TexFormat->BaseFormat != GL_DUDV_ATI &&
-                   ((ctx->Color.ClampReadColor == GL_TRUE) ||
-                    (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB &&
-                     texImage->TexFormat->DataType != GL_FLOAT)))
-                  transferOps |= IMAGE_CLAMP_BIT;
-
-               for (col = 0; col < width; col++) {
-                  (*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
-                  if (texImage->TexFormat->BaseFormat == GL_ALPHA) {
-                     rgba[col][RCOMP] = 0.0;
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                  }
-                  else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE) {
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                     rgba[col][ACOMP] = 1.0;
-                  }
-                  else if (texImage->TexFormat->BaseFormat == GL_LUMINANCE_ALPHA) {
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                  }
-                  else if (texImage->TexFormat->BaseFormat == GL_INTENSITY) {
-                     rgba[col][GCOMP] = 0.0;
-                     rgba[col][BCOMP] = 0.0;
-                     rgba[col][ACOMP] = 1.0;
-                  }
-               }
-               _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
-                                          format, type, dest,
-                                          &ctx->Pack, transferOps /*image xfer ops*/);
-            } /* format */
-         } /* row */
-      } /* img */
-   }
-
-   if (ctx->Pack.BufferObj->Name) {
-      ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
-                              ctx->Pack.BufferObj);
-   }
-}
-
-
-
-/**
- * This is the software fallback for Driver.GetCompressedTexImage().
- * All error checking will have been done before this routine is called.
- */
-void
-_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
-                              GLvoid *img,
-                              struct gl_texture_object *texObj,
-                              struct gl_texture_image *texImage)
-{
-   GLuint size;
-
-   if (ctx->Pack.BufferObj->Name) {
-      /* pack texture image into a PBO */
-      GLubyte *buf;
-      if ((const GLubyte *) img + texImage->CompressedSize >
-          (const GLubyte *) ctx->Pack.BufferObj->Size) {
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glGetCompressedTexImage(invalid PBO access)");
-         return;
-      }
-      buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
-                                              GL_WRITE_ONLY_ARB,
-                                              ctx->Pack.BufferObj);
-      if (!buf) {
-         /* buffer is already mapped - that's an error */
-         _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glGetCompressedTexImage(PBO is mapped)");
-         return;
-      }
-      img = ADD_POINTERS(buf, img);
-   }
-   else if (!img) {
-      /* not an error */
-      return;
-   }
-
-   /* don't use texImage->CompressedSize since that may be padded out */
-   size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height,
-                                        texImage->Depth,
-                                        texImage->TexFormat->MesaFormat);
-
-   /* just memcpy, no pixelstore or pixel transfer */
-   _mesa_memcpy(img, texImage->Data, size);
-
-   if (ctx->Pack.BufferObj->Name) {
-      ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT,
-                              ctx->Pack.BufferObj);
-   }
-}
index c9e639b..313f2d6 100644 (file)
@@ -79,6 +79,7 @@ extern GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS);
 extern GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS);
 #endif
 extern GLboolean _mesa_texstore_dudv8(TEXSTORE_PARAMS);
+extern GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS);
 
 extern GLchan *
 _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
@@ -209,19 +210,6 @@ _mesa_store_compressed_texsubimage3d(GLcontext *ctx, GLenum target,
                                 struct gl_texture_image *texImage);
 
 
-extern void
-_mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
-                   GLenum format, GLenum type, GLvoid *pixels,
-                   struct gl_texture_object *texObj,
-                   struct gl_texture_image *texImage);
-
-
-extern void
-_mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level,
-                              GLvoid *img,
-                              struct gl_texture_object *texObj,
-                              struct gl_texture_image *texImage);
-
 extern const GLvoid *
 _mesa_validate_pbo_teximage(GLcontext *ctx, GLuint dimensions,
                            GLsizei width, GLsizei height, GLsizei depth,
index 58cae88..da6956e 100644 (file)
@@ -1379,11 +1379,10 @@ _math_matrix_analyse( GLmatrix *mat )
 
    if (mat->inv && (mat->flags & MAT_DIRTY_INVERSE)) {
       matrix_invert( mat );
+      mat->flags &= ~MAT_DIRTY_INVERSE;
    }
 
-   mat->flags &= ~(MAT_DIRTY_FLAGS|
-                  MAT_DIRTY_TYPE|
-                  MAT_DIRTY_INVERSE);
+   mat->flags &= ~(MAT_DIRTY_FLAGS | MAT_DIRTY_TYPE);
 }
 
 /*@}*/
index a4d0fc3..35253da 100644 (file)
@@ -1840,7 +1840,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
                if (param_var->param_binding_begin == ~0U)
                   param_var->param_binding_begin = idx;
                param_var->param_binding_length++;
-               Program->Base.NumParameters++;
             }
          }
          else {
@@ -1849,7 +1848,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
             if (param_var->param_binding_begin == ~0U)
                param_var->param_binding_begin = idx;
             param_var->param_binding_length++;
-            Program->Base.NumParameters++;
          }
          break;
 
@@ -1860,7 +1858,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
          if (param_var->param_binding_begin == ~0U)
             param_var->param_binding_begin = idx;
          param_var->param_binding_length++;
-         Program->Base.NumParameters++;
 
          /* Check if there is more: 0 -> we're done, else its an integer */
          if (**inst) {
@@ -1896,7 +1893,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
                idx = _mesa_add_state_reference(Program->Base.Parameters,
                                                state_tokens);
                param_var->param_binding_length++;
-               Program->Base.NumParameters++;
             }
          }
          else {
@@ -1918,7 +1914,6 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
           * instruction register type appropriately.
           */
          param_var->param_binding_length++;
-         Program->Base.NumParameters++;
          break;
 
       default:
@@ -1927,12 +1922,14 @@ parse_param_elements (GLcontext * ctx, const GLubyte ** inst,
          return 1;
    }
 
+   Program->Base.NumParameters = Program->Base.Parameters->NumParameters;
+
    /* Make sure we haven't blown past our parameter limits */
    if (((Program->Base.Target == GL_VERTEX_PROGRAM_ARB) &&
-        (Program->Base.NumParameters >=
+        (Program->Base.NumParameters >
          ctx->Const.VertexProgram.MaxLocalParams))
        || ((Program->Base.Target == GL_FRAGMENT_PROGRAM_ARB)
-           && (Program->Base.NumParameters >=
+           && (Program->Base.NumParameters >
                ctx->Const.FragmentProgram.MaxLocalParams))) {
       program_error(ctx, Program->Position, "Too many parameter variables");
       return 1;
index a60cda6..bdac1d4 100644 (file)
@@ -836,7 +836,7 @@ _mesa_execute_program(GLcontext * ctx,
                 * result.z = result.x * APPX(result.y)
                 * We do what the ARB extension says.
                 */
-               q[2] = (GLfloat) pow(2.0, t[0]);
+               q[2] = (GLfloat) _mesa_pow(2.0, t[0]);
             }
             q[1] = t[0] - floor_t0;
             q[3] = 1.0F;
@@ -949,7 +949,7 @@ _mesa_execute_program(GLcontext * ctx,
                if (a[1] == 0.0 && a[3] == 0.0)
                   result[2] = 1.0;
                else
-                  result[2] = EXPF(a[3] * LOGF(a[1]));
+                  result[2] = (GLfloat) _mesa_pow(a[1], a[3]);
             }
             else {
                result[2] = 0.0;
@@ -1540,8 +1540,8 @@ _mesa_execute_program(GLcontext * ctx,
       case OPCODE_TXB:         /* GL_ARB_fragment_program only */
          /* Texel lookup with LOD bias */
          {
-            const struct gl_texture_unit *texUnit
-               = &ctx->Texture.Unit[inst->TexSrcUnit];
+            const GLuint unit = machine->Samplers[inst->TexSrcUnit];
+            const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
             GLfloat texcoord[4], color[4], lodBias;
 
             fetch_vector4(&inst->SrcReg[0], machine, texcoord);
index 6a21152..ca7565c 100644 (file)
@@ -291,7 +291,9 @@ _mesa_is_tex_instruction(gl_inst_opcode opcode)
 const char *
 _mesa_opcode_string(gl_inst_opcode opcode)
 {
-   ASSERT(opcode < MAX_OPCODE);
-   return InstInfo[opcode].Name;
+   if (opcode < MAX_OPCODE)
+      return InstInfo[opcode].Name;
+   else
+      return "OP?";
 }
 
index 458a69f..5f35dbf 100644 (file)
@@ -803,11 +803,11 @@ _mesa_optimize_program(GLcontext *ctx, struct gl_program *program)
    if (1)
       _mesa_remove_dead_code(program);
 
-   if (0) /* not test much yet */
+   if (0) /* not tested much yet */
       _mesa_remove_extra_moves(program);
 
-   if (1)
+   if (0)
       _mesa_consolidate_registers(program);
-   else /*NEW*/
+   else
       _mesa_reallocate_registers(program);
 }
index 66edae9..e9ed398 100644 (file)
@@ -178,15 +178,20 @@ _mesa_add_named_constant(struct gl_program_parameter_list *paramList,
                          const char *name, const GLfloat values[4],
                          GLuint size)
 {
-#if 0 /* disable this for now -- we need to save the name! */
+   /* first check if this is a duplicate constant */
    GLint pos;
-   GLuint swizzle;
-   ASSERT(size == 4); /* XXX future feature */
-   /* check if we already have this constant */
-   if (_mesa_lookup_parameter_constant(paramList, values, 4, &pos, &swizzle)) {
-      return pos;
+   for (pos = 0; pos < paramList->NumParameters; pos++) {
+      const GLfloat *pvals = paramList->ParameterValues[pos];
+      if (pvals[0] == values[0] &&
+          pvals[1] == values[1] &&
+          pvals[2] == values[2] &&
+          pvals[3] == values[3] &&
+          _mesa_strcmp(paramList->Parameters[pos].Name, name) == 0) {
+         /* Same name and value is already in the param list - reuse it */
+         return pos;
+      }
    }
-#endif
+   /* not found, add new parameter */
    return _mesa_add_parameter(paramList, PROGRAM_CONSTANT, name,
                               size, GL_NONE, values, NULL, 0x0);
 }
index aeb7cf6..37a3f1f 100644 (file)
@@ -112,7 +112,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
             value[3] = ctx->Light.Light[ln].SpotExponent;
             return;
          case STATE_SPOT_DIRECTION:
-            COPY_3V(value, ctx->Light.Light[ln].EyeDirection);
+            COPY_3V(value, ctx->Light.Light[ln].SpotDirection);
             value[3] = ctx->Light.Light[ln]._CosCutoff;
             return;
          case STATE_SPOT_CUTOFF:
@@ -359,10 +359,10 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
          switch (state[1]) {
             case STATE_ENV:
                COPY_4V(value, ctx->FragmentProgram.Parameters[idx]);
-               break;
+               return;
             case STATE_LOCAL:
                COPY_4V(value, ctx->FragmentProgram.Current->Base.LocalParams[idx]);
-               break;
+               return;
             default:
                _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
                return;
@@ -378,10 +378,10 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
          switch (state[1]) {
             case STATE_ENV:
                COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
-               break;
+               return;
             case STATE_LOCAL:
                COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]);
-               break;
+               return;
             default:
                _mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
                return;
@@ -395,11 +395,12 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
 
    case STATE_INTERNAL:
       switch (state[1]) {
-      case STATE_CURRENT_ATTRIB: {
-         const GLuint idx = (GLuint) state[2];
-         COPY_4V(value, ctx->Current.Attrib[idx]);
+      case STATE_CURRENT_ATTRIB:
+         {
+            const GLuint idx = (GLuint) state[2];
+            COPY_4V(value, ctx->Current.Attrib[idx]);
+         }
          return;
-      }                                                  
 
       case STATE_NORMAL_SCALE:
          ASSIGN_4V(value, 
@@ -408,19 +409,25 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
                    ctx->_ModelViewInvScale, 
                    1);
          return;
+
       case STATE_TEXRECT_SCALE:
+         /* Value = { 1/texWidth, 1/texHeight, 0, 1 }.
+          * Used to convert unnormalized texcoords to normalized texcoords.
+          */
          {
             const int unit = (int) state[2];
             const struct gl_texture_object *texObj
                = ctx->Texture.Unit[unit]._Current;
             if (texObj) {
                struct gl_texture_image *texImage = texObj->Image[0][0];
-               ASSIGN_4V(value, (GLfloat) (1.0 / texImage->Width),
-                         (GLfloat)(1.0 / texImage->Height),
+               ASSIGN_4V(value,
+                         (GLfloat) (1.0 / texImage->Width),
+                         (GLfloat) (1.0 / texImage->Height),
                          0.0f, 1.0f);
             }
          }
          return;
+
       case STATE_FOG_PARAMS_OPTIMIZED:
          /* for simpler per-vertex/pixel fog calcs. POW (for EXP/EXP2 fog)
           * might be more expensive than EX2 on some hw, plus it needs
@@ -437,62 +444,69 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
          value[3] = (GLfloat)(ctx->Fog.Density * ONE_DIV_SQRT_LN2);
          return;
 
-      case STATE_LIGHT_SPOT_DIR_NORMALIZED: {
-         /* here, state[2] is the light number */
-         /* pre-normalize spot dir */
-         const GLuint ln = (GLuint) state[2];
-         COPY_3V(value, ctx->Light.Light[ln]._NormDirection);
-         value[3] = ctx->Light.Light[ln]._CosCutoff;
+      case STATE_LIGHT_SPOT_DIR_NORMALIZED:
+         {
+            /* here, state[2] is the light number */
+            /* pre-normalize spot dir */
+            const GLuint ln = (GLuint) state[2];
+            COPY_3V(value, ctx->Light.Light[ln]._NormSpotDirection);
+            value[3] = ctx->Light.Light[ln]._CosCutoff;
+         }
          return;
-      }
 
-      case STATE_LIGHT_POSITION: {
-         const GLuint ln = (GLuint) state[2];
-         COPY_4V(value, ctx->Light.Light[ln]._Position);
+      case STATE_LIGHT_POSITION:
+         {
+            const GLuint ln = (GLuint) state[2];
+            COPY_4V(value, ctx->Light.Light[ln]._Position);
+         }
          return;
-      }
 
-      case STATE_LIGHT_POSITION_NORMALIZED: {
-         const GLuint ln = (GLuint) state[2];
-         COPY_4V(value, ctx->Light.Light[ln]._Position);
-         NORMALIZE_3FV( value );
+      case STATE_LIGHT_POSITION_NORMALIZED:
+         {
+            const GLuint ln = (GLuint) state[2];
+            COPY_4V(value, ctx->Light.Light[ln]._Position);
+            NORMALIZE_3FV( value );
+         }
          return;
-      }
 
-      case STATE_LIGHT_HALF_VECTOR: {
-         const GLuint ln = (GLuint) state[2];
-         GLfloat p[3];
-         /* Compute infinite half angle vector:
-          *   halfVector = normalize(normalize(lightPos) + (0, 0, 1))
-          * light.EyePosition.w should be 0 for infinite lights.
-          */
-         COPY_3V(p, ctx->Light.Light[ln]._Position);
-         NORMALIZE_3FV(p);
-         ADD_3V(value, p, ctx->_EyeZDir);
-         NORMALIZE_3FV(value);
-         value[3] = 1.0;
+      case STATE_LIGHT_HALF_VECTOR:
+         {
+            const GLuint ln = (GLuint) state[2];
+            GLfloat p[3];
+            /* Compute infinite half angle vector:
+             *   halfVector = normalize(normalize(lightPos) + (0, 0, 1))
+             * light.EyePosition.w should be 0 for infinite lights.
+             */
+            COPY_3V(p, ctx->Light.Light[ln]._Position);
+            NORMALIZE_3FV(p);
+            ADD_3V(value, p, ctx->_EyeZDir);
+            NORMALIZE_3FV(value);
+            value[3] = 1.0;
+         }
          return;
-      }                                                  
-
 
       case STATE_PT_SCALE:
          value[0] = ctx->Pixel.RedScale;
          value[1] = ctx->Pixel.GreenScale;
          value[2] = ctx->Pixel.BlueScale;
          value[3] = ctx->Pixel.AlphaScale;
-         break;
+         return;
+
       case STATE_PT_BIAS:
          value[0] = ctx->Pixel.RedBias;
          value[1] = ctx->Pixel.GreenBias;
          value[2] = ctx->Pixel.BlueBias;
          value[3] = ctx->Pixel.AlphaBias;
-         break;
+         return;
+
       case STATE_PCM_SCALE:
          COPY_4V(value, ctx->Pixel.PostColorMatrixScale);
-         break;
+         return;
+
       case STATE_PCM_BIAS:
          COPY_4V(value, ctx->Pixel.PostColorMatrixBias);
-         break;
+         return;
+
       case STATE_SHADOW_AMBIENT:
          {
             const int unit = (int) state[2];
@@ -506,6 +520,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
             }
          }
          return;
+
       case STATE_FB_SIZE:
          value[0] = (GLfloat) (ctx->DrawBuffer->Width - 1);
          value[1] = (GLfloat) (ctx->DrawBuffer->Height - 1);
@@ -522,7 +537,8 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
             value[2] = 0.0;
             value[3] = 0.0;
          }
-         break;
+         return;
+
       case STATE_ROT_MATRIX_1:
          {
             const int unit = (int) state[2];
@@ -532,14 +548,14 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[],
             value[2] = 0.0;
             value[3] = 0.0;
          }
-         break;
+         return;
 
-         /* XXX: make sure new tokens added here are also handled in the 
-          * _mesa_program_state_flags() switch, below.
-          */
+      /* XXX: make sure new tokens added here are also handled in the 
+       * _mesa_program_state_flags() switch, below.
+       */
       default:
-         /* unknown state indexes are silently ignored
-          *  should be handled by the driver.
+         /* Unknown state indexes are silently ignored here.
+          * Drivers may do something special.
           */
          return;
       }
@@ -760,28 +776,28 @@ append_token(char *dst, gl_state_index k)
       append(dst, ".spot.cutoff");
       break;
    case STATE_TEXGEN_EYE_S:
-      append(dst, "eye.s");
+      append(dst, ".eye.s");
       break;
    case STATE_TEXGEN_EYE_T:
-      append(dst, "eye.t");
+      append(dst, ".eye.t");
       break;
    case STATE_TEXGEN_EYE_R:
-      append(dst, "eye.r");
+      append(dst, ".eye.r");
       break;
    case STATE_TEXGEN_EYE_Q:
-      append(dst, "eye.q");
+      append(dst, ".eye.q");
       break;
    case STATE_TEXGEN_OBJECT_S:
-      append(dst, "object.s");
+      append(dst, ".object.s");
       break;
    case STATE_TEXGEN_OBJECT_T:
-      append(dst, "object.t");
+      append(dst, ".object.t");
       break;
    case STATE_TEXGEN_OBJECT_R:
-      append(dst, "object.r");
+      append(dst, ".object.r");
       break;
    case STATE_TEXGEN_OBJECT_Q:
-      append(dst, "object.q");
+      append(dst, ".object.q");
       break;
    case STATE_TEXENV_COLOR:
       append(dst, "texenv");
index 9858a0f..83e76b7 100644 (file)
@@ -457,28 +457,36 @@ emit_statevars(const char *name, int array_len,
          tokens[0] = STATE_TEXENV_COLOR;
       }
       else if (strcmp(name, "gl_EyePlaneS") == 0) {
-         tokens[0] = STATE_TEXGEN_EYE_S;
+         tokens[0] = STATE_TEXGEN;
+         tokens[2] = STATE_TEXGEN_EYE_S;
       }
       else if (strcmp(name, "gl_EyePlaneT") == 0) {
-         tokens[0] = STATE_TEXGEN_EYE_T;
+         tokens[0] = STATE_TEXGEN;
+         tokens[2] = STATE_TEXGEN_EYE_T;
       }
       else if (strcmp(name, "gl_EyePlaneR") == 0) {
-         tokens[0] = STATE_TEXGEN_EYE_R;
+         tokens[0] = STATE_TEXGEN;
+         tokens[2] = STATE_TEXGEN_EYE_R;
       }
       else if (strcmp(name, "gl_EyePlaneQ") == 0) {
-         tokens[0] = STATE_TEXGEN_EYE_Q;
+         tokens[0] = STATE_TEXGEN;
+         tokens[2] = STATE_TEXGEN_EYE_Q;
       }
       else if (strcmp(name, "gl_ObjectPlaneS") == 0) {
-         tokens[0] = STATE_TEXGEN_OBJECT_S;
+         tokens[0] = STATE_TEXGEN;
+         tokens[2] = STATE_TEXGEN_OBJECT_S;
       }
       else if (strcmp(name, "gl_ObjectPlaneT") == 0) {
-         tokens[0] = STATE_TEXGEN_OBJECT_T;
+         tokens[0] = STATE_TEXGEN;
+         tokens[2] = STATE_TEXGEN_OBJECT_T;
       }
       else if (strcmp(name, "gl_ObjectPlaneR") == 0) {
-         tokens[0] = STATE_TEXGEN_OBJECT_R;
+         tokens[0] = STATE_TEXGEN;
+         tokens[2] = STATE_TEXGEN_OBJECT_R;
       }
       else if (strcmp(name, "gl_ObjectPlaneQ") == 0) {
-         tokens[0] = STATE_TEXGEN_OBJECT_Q;
+         tokens[0] = STATE_TEXGEN;
+         tokens[2] = STATE_TEXGEN_OBJECT_Q;
       }
       else {
          return -1; /* invalid array name */
index a7cfc45..6d693c9 100644 (file)
@@ -2199,12 +2199,13 @@ _slang_gen_function_call_name(slang_assemble_ctx *A, const char *name,
                            name);
       return NULL;
    }
+
    if (!fun->body) {
-      slang_info_log_error(A->log,
-                           "Function '%s' prototyped but not defined.  "
-                           "Separate compilation units not supported.",
-                           name);
-      return NULL;
+      /* The function body may be in another compilation unit.
+       * We'll try concatenating the shaders and recompile at link time.
+       */
+      A->UnresolvedRefs = GL_TRUE;
+      return new_node1(IR_NOP, NULL);
    }
 
    /* type checking to be sure function's return type matches 'dest' type */
@@ -4648,6 +4649,14 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun)
    printf("************* End codegen function ************\n\n");
 #endif
 
+   if (A->UnresolvedRefs) {
+      /* Can't codegen at this time.
+       * At link time we'll concatenate all the vertex shaders and/or all
+       * the fragment shaders and try recompiling.
+       */
+      return GL_TRUE;
+   }
+
    /* Emit program instructions */
    success = _slang_emit_code(n, A->vartable, A->program, A->pragmas, GL_TRUE, A->log);
    _slang_free_ir_tree(n);
index e812c1f..d80013a 100644 (file)
@@ -43,6 +43,7 @@ typedef struct slang_assemble_ctx_
    struct slang_ir_node_ *CurLoop;
    struct slang_function_ *CurFunction;
    GLuint UnrollLoop;
+   GLboolean UnresolvedRefs;
 } slang_assemble_ctx;
 
 
index fb71288..ba2fc4f 100644 (file)
@@ -2435,6 +2435,8 @@ parse_code_unit(slang_parse_ctx * C, slang_code_unit * unit,
       _slang_codegen_function(&A, mainFunc);
 
       shader->Main = GL_TRUE; /* this shader defines main() */
+
+      shader->UnresolvedRefs = A.UnresolvedRefs;
    }
 
    _slang_pop_var_table(o.vartable);
@@ -2799,7 +2801,8 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
    shader->CompileStatus = success;
 
    if (success) {
-      if (shader->Pragmas.Optimize) {
+      if (shader->Pragmas.Optimize &&
+          (ctx->Shader.Flags & GLSL_NO_OPT) == 0) {
          _mesa_optimize_program(ctx, shader->Program);
       }
    }
index 1b1edb4..8493c49 100644 (file)
@@ -62,6 +62,8 @@ typedef struct
 
    GLuint MaxInstructions;  /**< size of prog->Instructions[] buffer */
 
+   GLboolean UnresolvedFunctions;
+
    /* code-gen options */
    GLboolean EmitHighLevelInstructions;
    GLboolean EmitCondCodes;
@@ -872,6 +874,7 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n)
    emit(emitInfo, n->Children[1]);
 
    if (n->Children[0]->Store->Size != n->Children[1]->Store->Size) {
+      /* XXX this error should have been caught in slang_codegen.c */
       slang_info_log_error(emitInfo->log, "invalid operands to == or !=");
       n->Store = NULL;
       return NULL;
@@ -1356,7 +1359,8 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n)
    inst = emit(emitInfo, n->Children[1]);
 
    if (!n->Children[1]->Store || n->Children[1]->Store->Index < 0) {
-      if (!emitInfo->log->text) {
+      if (!emitInfo->log->text && !emitInfo->UnresolvedFunctions) {
+         /* XXX this error should have been caught in slang_codegen.c */
          slang_info_log_error(emitInfo->log, "invalid assignment");
       }
       return NULL;
@@ -2155,6 +2159,7 @@ emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n)
       if (index < 0) {
          /* error */
          char s[100];
+         /* XXX isn't this really an out of memory/resources error? */
          _mesa_snprintf(s, sizeof(s), "Undefined variable '%s'",
                         (char *) n->Var->a_name);
          slang_info_log_error(emitInfo->log, s);
index f984348..1fdf4db 100644 (file)
@@ -534,6 +534,111 @@ _slang_update_inputs_outputs(struct gl_program *prog)
 }
 
 
+
+
+
+/**
+ * Return a new shader whose source code is the concatenation of
+ * all the shader sources of the given type.
+ */
+static struct gl_shader *
+concat_shaders(struct gl_shader_program *shProg, GLenum shaderType)
+{
+   struct gl_shader *newShader;
+   const struct gl_shader *firstShader = NULL;
+   GLuint shaderLengths[100];
+   GLchar *source;
+   GLuint totalLen = 0, len = 0;
+   GLuint i;
+
+   /* compute total size of new shader source code */
+   for (i = 0; i < shProg->NumShaders; i++) {
+      const struct gl_shader *shader = shProg->Shaders[i];
+      if (shader->Type == shaderType) {
+         shaderLengths[i] = _mesa_strlen(shader->Source);
+         totalLen += shaderLengths[i];
+         if (!firstShader)
+            firstShader = shader;
+      }
+   }
+
+   if (totalLen == 0)
+      return NULL;
+
+   source = (GLchar *) _mesa_malloc(totalLen + 1);
+   if (!source)
+      return NULL;
+
+   /* concatenate shaders */
+   for (i = 0; i < shProg->NumShaders; i++) {
+      const struct gl_shader *shader = shProg->Shaders[i];
+      if (shader->Type == shaderType) {
+         _mesa_memcpy(source + len, shader->Source, shaderLengths[i]);
+         len += shaderLengths[i];
+      }
+   }
+   source[len] = '\0';
+   /*
+   _mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source);
+   */
+
+   newShader = CALLOC_STRUCT(gl_shader);
+   newShader->Type = shaderType;
+   newShader->Source = source;
+   newShader->Pragmas = firstShader->Pragmas;
+
+   return newShader;
+}
+
+
+/**
+ * Search the shader program's list of shaders to find the one that
+ * defines main().
+ * This will involve shader concatenation and recompilation if needed.
+ */
+static struct gl_shader *
+get_main_shader(GLcontext *ctx,
+                struct gl_shader_program *shProg, GLenum type)
+{
+   struct gl_shader *shader = NULL;
+   GLuint i;
+
+   /*
+    * Look for a shader that defines main() and has no unresolved references.
+    */
+   for (i = 0; i < shProg->NumShaders; i++) {
+      shader = shProg->Shaders[i];
+      if (shader->Type == type &&
+          shader->Main &&
+          !shader->UnresolvedRefs) {
+         /* All set! */
+         return shader;
+      }
+   }
+
+   /*
+    * There must have been unresolved references during the original
+    * compilation.  Try concatenating all the shaders of the given type
+    * and recompile that.
+    */
+   shader = concat_shaders(shProg, type);
+
+   if (shader) {
+      _slang_compile(ctx, shader);
+
+      /* Finally, check if recompiling failed */
+      if (!shader->CompileStatus ||
+          !shader->Main ||
+          shader->UnresolvedRefs) {
+         link_error(shProg, "Unresolved symbols");
+         return NULL;
+      }
+   }
+
+   return shader;
+}
+
+
 /**
  * Shader linker.  Currently:
  *
@@ -550,13 +655,16 @@ _slang_link(GLcontext *ctx,
             GLhandleARB programObj,
             struct gl_shader_program *shProg)
 {
-   const struct gl_vertex_program *vertProg;
-   const struct gl_fragment_program *fragProg;
+   const struct gl_vertex_program *vertProg = NULL;
+   const struct gl_fragment_program *fragProg = NULL;
    GLuint numSamplers = 0;
    GLuint i;
 
    _mesa_clear_shader_program_data(ctx, shProg);
 
+   /* Initialize LinkStatus to "success".  Will be cleared if error. */
+   shProg->LinkStatus = GL_TRUE;
+
    /* check that all programs compiled successfully */
    for (i = 0; i < shProg->NumShaders; i++) {
       if (!shProg->Shaders[i]->CompileStatus) {
@@ -568,24 +676,19 @@ _slang_link(GLcontext *ctx,
    shProg->Uniforms = _mesa_new_uniform_list();
    shProg->Varying = _mesa_new_parameter_list();
 
-   /**
-    * Find attached vertex, fragment shaders defining main()
+   /*
+    * Find the vertex and fragment shaders which define main()
     */
-   vertProg = NULL;
-   fragProg = NULL;
-   for (i = 0; i < shProg->NumShaders; i++) {
-      struct gl_shader *shader = shProg->Shaders[i];
-      if (shader->Type == GL_VERTEX_SHADER) {
-         if (shader->Main)
-            vertProg = vertex_program(shader->Program);
-      }
-      else if (shader->Type == GL_FRAGMENT_SHADER) {
-         if (shader->Main)
-            fragProg = fragment_program(shader->Program);
-      }
-      else {
-         _mesa_problem(ctx, "unexpected shader target in slang_link()");
-      }
+   {
+      struct gl_shader *vertShader, *fragShader;
+      vertShader = get_main_shader(ctx, shProg, GL_VERTEX_SHADER);
+      fragShader = get_main_shader(ctx, shProg, GL_FRAGMENT_SHADER);
+      if (vertShader)
+         vertProg = vertex_program(vertShader->Program);
+      if (fragShader)
+         fragProg = fragment_program(fragShader->Program);
+      if (!shProg->LinkStatus)
+         return;
    }
 
 #if FEATURE_es2_glsl
index 1ef43f5..4a48bc8 100644 (file)
@@ -790,6 +790,7 @@ _slang_typeof_operation(slang_operation * op,
                return GL_FALSE;
             }
             ti->can_be_referenced = _ti.can_be_referenced;
+            ti->array_len = field->array_len;
          }
          else {
             GLuint rows;
index 6913d9f..78ca60f 100644 (file)
@@ -68,6 +68,7 @@ MAIN_SOURCES = \
        main/texenvprogram.c \
        main/texformat.c \
        main/texgen.c \
+       main/texgetimage.c \
        main/teximage.c \
        main/texobj.c \
        main/texparam.c \
index d7b9043..50ce828 100644 (file)
@@ -48,7 +48,7 @@
  * Convert GLenum texcoord wrap tokens to pipe tokens.
  */
 static GLuint
-gl_wrap_to_sp(GLenum wrap)
+gl_wrap_xlate(GLenum wrap)
 {
    switch (wrap) {
    case GL_REPEAT:
@@ -118,6 +118,37 @@ gl_filter_to_img_filter(GLenum filter)
 }
 
 
+static void
+xlate_border_color(const GLfloat *colorIn, GLenum baseFormat, GLfloat *colorOut)
+{
+   switch (baseFormat) {
+   case GL_RGB:
+      colorOut[0] = colorIn[0];
+      colorOut[1] = colorIn[1];
+      colorOut[2] = colorIn[2];
+      colorOut[3] = 1.0F;
+      break;
+   case GL_ALPHA:
+      colorOut[0] = colorOut[1] = colorOut[2] = 0.0;
+      colorOut[3] = colorIn[3];
+      break;
+   case GL_LUMINANCE:
+      colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0];
+      colorOut[3] = 1.0;
+      break;
+   case GL_LUMINANCE_ALPHA:
+      colorOut[0] = colorOut[1] = colorOut[2] = colorIn[0];
+      colorOut[3] = colorIn[3];
+      break;
+   case GL_INTENSITY:
+      colorOut[0] = colorOut[1] = colorOut[2] = colorOut[3] = colorIn[0];
+      break;
+   default:
+      COPY_4V(colorOut, colorIn);
+   }
+}
+
+
 static void 
 update_samplers(struct st_context *st)
 {
@@ -137,6 +168,7 @@ update_samplers(struct st_context *st)
 
       if (samplersUsed & (1 << su)) {
          struct gl_texture_object *texobj;
+         struct gl_texture_image *teximg;
          GLuint texUnit;
 
          if (fprog->Base.SamplersUsed & (1 << su))
@@ -149,9 +181,11 @@ update_samplers(struct st_context *st)
             texobj = st_get_default_texture(st);
          }
 
-         sampler->wrap_s = gl_wrap_to_sp(texobj->WrapS);
-         sampler->wrap_t = gl_wrap_to_sp(texobj->WrapT);
-         sampler->wrap_r = gl_wrap_to_sp(texobj->WrapR);
+         teximg = texobj->Image[0][texobj->BaseLevel];
+
+         sampler->wrap_s = gl_wrap_xlate(texobj->WrapS);
+         sampler->wrap_t = gl_wrap_xlate(texobj->WrapT);
+         sampler->wrap_r = gl_wrap_xlate(texobj->WrapR);
 
          sampler->min_img_filter = gl_filter_to_img_filter(texobj->MinFilter);
          sampler->min_mip_filter = gl_filter_to_mip_filter(texobj->MinFilter);
@@ -174,10 +208,9 @@ update_samplers(struct st_context *st)
             assert(sampler->min_lod <= sampler->max_lod);
          }
 
-         sampler->border_color[0] = texobj->BorderColor[RCOMP];
-         sampler->border_color[1] = texobj->BorderColor[GCOMP];
-         sampler->border_color[2] = texobj->BorderColor[BCOMP];
-         sampler->border_color[3] = texobj->BorderColor[ACOMP];
+         xlate_border_color(texobj->BorderColor,
+                            teximg ? teximg->TexFormat->BaseFormat : GL_RGBA,
+                            sampler->border_color);
 
         sampler->max_anisotropy = texobj->MaxAnisotropy;
          if (sampler->max_anisotropy > 1.0) {
index dd9ba28..5bdc6a1 100644 (file)
@@ -2,6 +2,7 @@
  * 
  * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
+ * Copyright 2009 VMware, Inc.  All Rights Reserved.
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
@@ -29,6 +30,7 @@
   * Authors:
   *   Keith Whitwell <keith@tungstengraphics.com>
   *   Brian Paul
+  *   Michel Dänzer
   */
 
 #include "main/glheader.h"
@@ -291,11 +293,6 @@ clear_with_quad(GLcontext *ctx,
 static INLINE GLboolean
 check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
 {
-   const struct st_renderbuffer *strb = st_renderbuffer(rb);
-
-   if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
-      return FALSE;
-
    if (ctx->Scissor.Enabled)
       return TRUE;
 
@@ -312,14 +309,10 @@ check_clear_color_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
 static INLINE GLboolean
 check_clear_depth_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
 {
-   const struct st_renderbuffer *strb = st_renderbuffer(rb);
    const GLuint stencilMax = (1 << rb->StencilBits) - 1;
    GLboolean maskStencil
       = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
 
-   if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
-      return FALSE;
-
    if (ctx->Scissor.Enabled)
       return TRUE;
 
@@ -339,14 +332,10 @@ check_clear_depth_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
    const struct st_renderbuffer *strb = st_renderbuffer(rb);
    const GLboolean isDS = is_depth_stencil_format(strb->surface->format);
 
-   if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
-      return FALSE;
-
    if (ctx->Scissor.Enabled)
       return TRUE;
 
    if (isDS && 
-       strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
        ctx->DrawBuffer->Visual.stencilBits > 0)
       return TRUE;
 
@@ -366,9 +355,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
    const GLboolean maskStencil
       = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax;
 
-   if (strb->surface->status == PIPE_SURFACE_STATUS_UNDEFINED)
-      return FALSE;
-
    if (maskStencil) 
       return TRUE;
 
@@ -381,7 +367,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
     * current state.
     */
    if (isDS && 
-       strb->surface->status == PIPE_SURFACE_STATUS_DEFINED &&
        ctx->DrawBuffer->Visual.depthBits > 0)
       return TRUE;
 
@@ -390,111 +375,6 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb)
 
 
 
-static void
-clear_color_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
-   struct st_renderbuffer *strb = st_renderbuffer(rb);
-
-   if (!strb->surface)
-      return;
-
-   if (check_clear_color_with_quad( ctx, rb )) {
-      /* masking or scissoring */
-      clear_with_quad(ctx, GL_TRUE, GL_FALSE, GL_FALSE);
-   }
-   else {
-      /* clear whole buffer w/out masking */
-      uint clearValue;
-      /* NOTE: we always pass the clear color as PIPE_FORMAT_A8R8G8B8_UNORM
-       * at this time!
-       */
-      util_pack_color(ctx->Color.ClearColor, PIPE_FORMAT_A8R8G8B8_UNORM, &clearValue);
-      ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
-   }
-}
-
-
-static void
-clear_depth_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
-   struct st_renderbuffer *strb = st_renderbuffer(rb);
-
-   if (!strb->surface)
-      return;
-
-   if (check_clear_depth_with_quad(ctx, rb)) {
-      /* scissoring or we have a combined depth/stencil buffer */
-      clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_FALSE);
-   }
-   else {
-      /* simple clear of whole buffer */
-      uint clearValue = util_pack_z(strb->surface->format, ctx->Depth.Clear);
-      ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
-   }
-}
-
-
-static void
-clear_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
-   struct st_renderbuffer *strb = st_renderbuffer(rb);
-
-   if (!strb->surface)
-      return;
-
-   if (check_clear_stencil_with_quad(ctx, rb)) {
-      /* masking or scissoring or combined depth/stencil buffer */
-      clear_with_quad(ctx, GL_FALSE, GL_FALSE, GL_TRUE);
-   }
-   else {
-      /* simple clear of whole buffer */
-      GLuint clearValue = ctx->Stencil.Clear;
-
-      switch (strb->surface->format) {
-      case PIPE_FORMAT_S8Z24_UNORM:
-         clearValue <<= 24;
-         break;
-      default:
-         ; /* no-op, stencil value is in least significant bits */
-      }  
-
-      ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
-   }
-}
-
-
-static void
-clear_depth_stencil_buffer(GLcontext *ctx, struct gl_renderbuffer *rb)
-{
-   struct st_renderbuffer *strb = st_renderbuffer(rb);
-
-   if (!strb->surface)
-      return;
-
-   if (check_clear_depth_stencil_with_quad(ctx, rb)) {
-      /* masking or scissoring */
-      clear_with_quad(ctx, GL_FALSE, GL_TRUE, GL_TRUE);
-   }
-   else {
-      /* clear whole buffer w/out masking */
-      GLuint clearValue = util_pack_z(strb->surface->format, ctx->Depth.Clear);
-
-      switch (strb->surface->format) {
-      case PIPE_FORMAT_S8Z24_UNORM:
-         clearValue |= ctx->Stencil.Clear << 24;
-         break;
-      case PIPE_FORMAT_Z24S8_UNORM:
-         clearValue |= ctx->Stencil.Clear;
-         break;
-      default:
-         assert(0);
-      }  
-
-      ctx->st->pipe->clear(ctx->st->pipe, strb->surface, clearValue);
-   }
-}
-
-
 void st_flush_clear( struct st_context *st )
 {
    /* Release vertex buffer to avoid synchronous rendering if we were
@@ -520,51 +400,89 @@ static void st_clear(GLcontext *ctx, GLbitfield mask)
       = ctx->DrawBuffer->Attachment[BUFFER_DEPTH].Renderbuffer;
    struct gl_renderbuffer *stencilRb
       = ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
-   GLbitfield cmask = mask & BUFFER_BITS_COLOR;
+   GLbitfield quad_buffers = 0;
+   GLbitfield clear_buffers = 0;
+   GLuint i;
 
-   /* This makes sure the softpipe has the latest scissor, etc values */
+   /* This makes sure the pipe has the latest scissor, etc values */
    st_validate_state( st );
 
-   /*
-    * XXX TO-DO:
-    * If we're going to use clear_with_quad() for any reason, use it to
-    * clear as many other buffers as possible.
-    * As it is now, we sometimes call clear_with_quad() three times to clear
-    * color/depth/stencil individually...
-    */
+   if (mask & BUFFER_BITS_COLOR) {
+      for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
+         GLuint b = ctx->DrawBuffer->_ColorDrawBufferIndexes[i];
 
-   if (cmask) {
-      GLuint b;
-      for (b = 0; cmask; b++) {
-         if (cmask & (1 << b)) {
+         if (mask & (1 << b)) {
             struct gl_renderbuffer *rb
                = ctx->DrawBuffer->Attachment[b].Renderbuffer;
+            struct st_renderbuffer *strb;
+
             assert(rb);
-            clear_color_buffer(ctx, rb);
-            cmask &= ~(1 << b); /* turn off bit */
+
+            strb = st_renderbuffer(rb);
+
+            if (!strb->surface)
+               continue;
+
+            if (check_clear_color_with_quad( ctx, rb ))
+               quad_buffers |= PIPE_CLEAR_COLOR;
+            else
+               clear_buffers |= PIPE_CLEAR_COLOR;
          }
-         assert(b < BUFFER_COUNT);
       }
    }
 
-   if (mask & BUFFER_BIT_ACCUM) {
-      st_clear_accum_buffer(ctx,
-                       ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer);
-   }
-
    if ((mask & BUFFER_BITS_DS) == BUFFER_BITS_DS && depthRb == stencilRb) {
       /* clearing combined depth + stencil */
-      clear_depth_stencil_buffer(ctx, depthRb);
+      struct st_renderbuffer *strb = st_renderbuffer(depthRb);
+
+      if (strb->surface) {
+         if (check_clear_depth_stencil_with_quad(ctx, depthRb))
+            quad_buffers |= PIPE_CLEAR_DEPTHSTENCIL;
+         else
+            clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL;
+      }
    }
    else {
       /* separate depth/stencil clears */
       if (mask & BUFFER_BIT_DEPTH) {
-         clear_depth_buffer(ctx, depthRb);
+         struct st_renderbuffer *strb = st_renderbuffer(depthRb);
+
+         if (strb->surface) {
+            if (check_clear_depth_with_quad(ctx, depthRb))
+               quad_buffers |= PIPE_CLEAR_DEPTHSTENCIL;
+            else
+               clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL;
+         }
       }
       if (mask & BUFFER_BIT_STENCIL) {
-         clear_stencil_buffer(ctx, stencilRb);
+         struct st_renderbuffer *strb = st_renderbuffer(stencilRb);
+
+         if (strb->surface) {
+            if (check_clear_stencil_with_quad(ctx, stencilRb))
+               quad_buffers |= PIPE_CLEAR_DEPTHSTENCIL;
+            else
+               clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL;
+         }
       }
    }
+
+   /*
+    * If we're going to use clear_with_quad() for any reason, use it for
+    * everything possible.
+    */
+   if (quad_buffers) {
+      quad_buffers |= clear_buffers;
+      clear_with_quad(ctx,
+                      quad_buffers & PIPE_CLEAR_COLOR,
+                      mask & BUFFER_BIT_DEPTH,
+                      mask & BUFFER_BIT_STENCIL);
+   } else if (clear_buffers)
+      ctx->st->pipe->clear(ctx->st->pipe, clear_buffers, ctx->Color.ClearColor,
+                           ctx->Depth.Clear, ctx->Stencil.Clear);
+
+   if (mask & BUFFER_BIT_ACCUM)
+      st_clear_accum_buffer(ctx,
+                            ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer);
 }
 
 
index 821ea67..ebb1d11 100644 (file)
@@ -309,6 +309,8 @@ _mesa_base_format(GLenum format)
    switch (format) {
    case GL_DEPTH_COMPONENT:
       return GL_DEPTH_COMPONENT;
+   case GL_DEPTH_STENCIL:
+      return GL_DEPTH_STENCIL;
    case GL_STENCIL_INDEX:
       return GL_STENCIL_INDEX;
    default:
@@ -617,7 +619,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
 
 static void
 draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
-                    GLsizei width, GLsizei height, GLenum type,
+                    GLsizei width, GLsizei height, GLenum format, GLenum type,
                     const struct gl_pixelstore_attrib *unpack,
                     const GLvoid *pixels)
 {
@@ -634,12 +636,20 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
 
    strb = st_renderbuffer(ctx->DrawBuffer->
                           Attachment[BUFFER_STENCIL].Renderbuffer);
+
+   if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
+      y = ctx->DrawBuffer->Height - y - height;
+   }
+
    pt = screen->get_tex_transfer(screen, strb->texture, 0, 0, 0,
                                  PIPE_TRANSFER_WRITE, x, y,
                                  width, height);
 
    stmap = screen->transfer_map(screen, pt);
 
+   pixels = _mesa_map_drawpix_pbo(ctx, unpack, pixels);
+   assert(pixels);
+
    /* if width > MAX_WIDTH, have to process image in chunks */
    skipPixels = 0;
    while (skipPixels < width) {
@@ -647,42 +657,74 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
       const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH);
       GLint row;
       for (row = 0; row < height; row++) {
-         GLint spanY = row;
-         GLubyte values[MAX_WIDTH];
+         GLubyte sValues[MAX_WIDTH];
+         GLuint zValues[MAX_WIDTH];
          GLenum destType = GL_UNSIGNED_BYTE;
          const GLvoid *source = _mesa_image_address2d(unpack, pixels,
                                                       width, height,
-                                                      GL_COLOR_INDEX, type,
+                                                      format, type,
                                                       row, skipPixels);
-         _mesa_unpack_stencil_span(ctx, spanWidth, destType, values,
+         _mesa_unpack_stencil_span(ctx, spanWidth, destType, sValues,
                                    type, source, unpack,
                                    ctx->_ImageTransferState);
+
+         if (format == GL_DEPTH_STENCIL) {
+            _mesa_unpack_depth_span(ctx, spanWidth, GL_UNSIGNED_INT, zValues,
+                                    (1 << 24) - 1, type, source, unpack);
+         }
+
          if (zoom) {
-            /*
-            _swrast_write_zoomed_stencil_span(ctx, 0, 0, spanWidth,
-                                              spanX, spanY, values);
-            */
+            _mesa_problem(ctx, "Gallium glDrawPixels(GL_STENCIL) with "
+                          "zoom not complete");
          }
-         else {
+
+         {
+            GLint spanY;
+
             if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
-               spanY = height - spanY - 1;
+               spanY = height - row - 1;
+            }
+            else {
+               spanY = row;
             }
 
+            /* now pack the stencil (and Z) values in the dest format */
             switch (pt->format) {
             case PIPE_FORMAT_S8_UNORM:
                {
                   ubyte *dest = stmap + spanY * pt->stride + spanX;
-                  memcpy(dest, values, spanWidth);
+                  memcpy(dest, sValues, spanWidth);
                }
                break;
             case PIPE_FORMAT_S8Z24_UNORM:
-               {
+               if (format == GL_DEPTH_STENCIL) {
                   uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4);
                   GLint k;
                   for (k = 0; k < spanWidth; k++) {
-                     uint p = dest[k];
-                     p = (p & 0xffffff) | (values[k] << 24);
-                     dest[k] = p;
+                     dest[k] = zValues[k] | (sValues[k] << 24);
+                  }
+               }
+               else {
+                  uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4);
+                  GLint k;
+                  for (k = 0; k < spanWidth; k++) {
+                     dest[k] = (dest[k] & 0xffffff) | (sValues[k] << 24);
+                  }
+               }
+               break;
+            case PIPE_FORMAT_Z24S8_UNORM:
+               if (format == GL_DEPTH_STENCIL) {
+                  uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4);
+                  GLint k;
+                  for (k = 0; k < spanWidth; k++) {
+                     dest[k] = zValues[k] | (sValues[k] << 24);
+                  }
+               }
+               else {
+                  uint *dest = (uint *) (stmap + spanY * pt->stride + spanX*4);
+                  GLint k;
+                  for (k = 0; k < spanWidth; k++) {
+                     dest[k] = (dest[k] & 0xffffff00) | (sValues[k] & 0xff);
                   }
                }
                break;
@@ -694,6 +736,8 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
       skipPixels += spanWidth;
    }
 
+   _mesa_unmap_drawpix_pbo(ctx, unpack);
+
    /* unmap the stencil buffer */
    screen->transfer_unmap(screen, pt);
    screen->tex_transfer_destroy(pt);
@@ -715,8 +759,10 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
    GLuint bufferFormat;
    const GLfloat *color;
 
-   if (format == GL_STENCIL_INDEX) {
-      draw_stencil_pixels(ctx, x, y, width, height, type, unpack, pixels);
+   if (format == GL_STENCIL_INDEX ||
+       format == GL_DEPTH_STENCIL) {
+      draw_stencil_pixels(ctx, x, y, width, height, format, type,
+                          unpack, pixels);
       return;
    }
 
@@ -731,11 +777,6 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
       stvp = st_make_passthrough_vertex_shader(ctx->st, GL_TRUE);
       color = ctx->Current.RasterColor;
    }
-   else if (format == GL_STENCIL_INDEX) {
-      ps = st->state.framebuffer.zsbuf;
-      /* XXX special case - can't use texture map */
-      color = NULL;
-   }
    else {
       ps = st->state.framebuffer.cbufs[0];
       stfp = combined_drawpix_fragment_program(ctx);
@@ -781,7 +822,8 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
    }
 
    /* this will do stencil pixel transfer ops */
-   st_read_stencil_pixels(ctx, srcx, srcy, width, height, GL_UNSIGNED_BYTE,
+   st_read_stencil_pixels(ctx, srcx, srcy, width, height,
+                          GL_STENCIL_INDEX, GL_UNSIGNED_BYTE,
                           &ctx->DefaultPacking, buffer);
 
    ptDraw = screen->get_tex_transfer(screen, rbDraw->texture, 0, 0, 0,
@@ -821,6 +863,16 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
             }
          }
          break;
+      case PIPE_FORMAT_Z24S8_UNORM:
+         {
+            uint *dst4 = (uint *) dst;
+            int j;
+            for (j = 0; j < width; j++) {
+               *dst4 = (*dst4 & 0xffffff00) | (src[j] & 0xff);
+               dst4++;
+            }
+         }
+         break;
       case PIPE_FORMAT_S8_UNORM:
          memcpy(dst, src, width);
          break;
index 2a4becc..9ce5f3f 100644 (file)
@@ -56,7 +56,8 @@
  */
 void
 st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
-                       GLsizei width, GLsizei height, GLenum type,
+                       GLsizei width, GLsizei height,
+                       GLenum format, GLenum type,
                        const struct gl_pixelstore_attrib *packing,
                        GLvoid *pixels)
 {
@@ -68,7 +69,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
    GLint j;
 
    if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
-      y = ctx->DrawBuffer->Height - y - 1;
+      y = ctx->DrawBuffer->Height - y - height;
    }
 
    /* Create a read transfer from the renderbuffer's texture */
@@ -84,7 +85,8 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
    /* process image row by row */
    for (j = 0; j < height; j++) {
       GLvoid *dest;
-      GLstencil values[MAX_WIDTH];
+      GLstencil sValues[MAX_WIDTH];
+      GLfloat zValues[MAX_WIDTH];
       GLint srcY;
 
       if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {
@@ -94,29 +96,47 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
          srcY = j;
       }
 
-      /* get stencil values */
+      /* get stencil (and Z) values */
       switch (pt->format) {
       case PIPE_FORMAT_S8_UNORM:
          {
             const ubyte *src = stmap + srcY * pt->stride;
-            memcpy(values, src, width);
+            memcpy(sValues, src, width);
          }
          break;
       case PIPE_FORMAT_S8Z24_UNORM:
-         {
+         if (format == GL_DEPTH_STENCIL) {
             const uint *src = (uint *) (stmap + srcY * pt->stride);
+            const GLfloat scale = 1.0 / (0xffffff);
             GLint k;
             for (k = 0; k < width; k++) {
-               values[k] = src[k] >> 24;
+               sValues[k] = src[k] >> 24;
+               zValues[k] = (src[k] & 0xffffff) * scale;
+            }
+         }
+         else {
+            const uint *src = (uint *) (stmap + srcY * pt->stride);
+            GLint k;
+            for (k = 0; k < width; k++) {
+               sValues[k] = src[k] >> 24;
             }
          }
          break;
       case PIPE_FORMAT_Z24S8_UNORM:
-         {
+         if (format == GL_DEPTH_STENCIL) {
+            const uint *src = (uint *) (stmap + srcY * pt->stride);
+            const GLfloat scale = 1.0 / (0xffffff);
+            GLint k;
+            for (k = 0; k < width; k++) {
+               sValues[k] = src[k] & 0xff;
+               zValues[k] = (src[k] >> 8) * scale;
+            }
+         }
+         else {
             const uint *src = (uint *) (stmap + srcY * pt->stride);
             GLint k;
             for (k = 0; k < width; k++) {
-               values[k] = src[k] & 0xff;
+               sValues[k] = src[k] & 0xff;
             }
          }
          break;
@@ -126,12 +146,16 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
 
       /* store */
       dest = _mesa_image_address2d(packing, pixels, width, height,
-                                   GL_STENCIL_INDEX, type, j, 0);
-
-      _mesa_pack_stencil_span(ctx, width, type, dest, values, packing);
+                                   format, type, j, 0);
+      if (format == GL_DEPTH_STENCIL) {
+         _mesa_pack_depth_stencil_span(ctx, width, dest,
+                                       zValues, sValues, packing);
+      }
+      else {
+         _mesa_pack_stencil_span(ctx, width, type, dest, sValues, packing);
+      }
    }
 
-
    /* unmap the stencil buffer */
    screen->transfer_unmap(screen, pt);
    screen->tex_transfer_destroy(pt);
@@ -329,8 +353,10 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
    /* make sure rendering has completed */
    st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
 
-   if (format == GL_STENCIL_INDEX) {
-      st_read_stencil_pixels(ctx, x, y, width, height, type, pack, dest);
+   if (format == GL_STENCIL_INDEX ||
+       format == GL_DEPTH_STENCIL) {
+      st_read_stencil_pixels(ctx, x, y, width, height,
+                             format, type, pack, dest);
       return;
    }
    else if (format == GL_DEPTH_COMPONENT) {
@@ -420,6 +446,33 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height,
             }
          }
       }
+      else if (trans->format == PIPE_FORMAT_Z24S8_UNORM ||
+               trans->format == PIPE_FORMAT_Z24X8_UNORM) {
+         if (format == GL_DEPTH_COMPONENT) {
+            for (i = 0; i < height; i++) {
+               GLuint ztemp[MAX_WIDTH];
+               GLfloat zfloat[MAX_WIDTH];
+               const double scale = 1.0 / ((1 << 24) - 1);
+               pipe_get_tile_raw(trans, 0, y, width, 1, ztemp, 0);
+               y += yStep;
+               for (j = 0; j < width; j++) {
+                  zfloat[j] = (float) (scale * ((ztemp[j] >> 8) & 0xffffff));
+               }
+               _mesa_pack_depth_span(ctx, width, dst, type,
+                                     zfloat, &clippedPacking);
+               dst += dstStride;
+            }
+         }
+         else {
+            /* untested, but simple: */
+            assert(format == GL_DEPTH_STENCIL_EXT);
+            for (i = 0; i < height; i++) {
+               pipe_get_tile_raw(trans, 0, y, width, 1, dst, 0);
+               y += yStep;
+               dst += dstStride;
+            }
+         }
+      }
       else if (trans->format == PIPE_FORMAT_Z16_UNORM) {
          for (i = 0; i < height; i++) {
             GLushort ztemp[MAX_WIDTH];
index 9e151be..c90ef02 100644 (file)
@@ -34,7 +34,8 @@ st_get_color_read_renderbuffer(GLcontext *ctx);
 
 extern void
 st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
-                       GLsizei width, GLsizei height, GLenum type,
+                       GLsizei width, GLsizei height,
+                       GLenum format, GLenum type,
                        const struct gl_pixelstore_attrib *packing,
                        GLvoid *pixels);
 
index 2036cca..bb931f1 100644 (file)
@@ -39,7 +39,7 @@
 #include "st_context.h"
 #include "st_cb_strings.h"
 
-#define ST_VERSION_STRING "0.2"
+#define ST_VERSION_STRING "0.3"
 
 static const GLubyte *
 st_get_string(GLcontext * ctx, GLenum name)
@@ -50,18 +50,7 @@ st_get_string(GLcontext * ctx, GLenum name)
    switch (name) {
    case GL_VENDOR: {
       const char *vendor = screen->get_vendor( screen );
-      const char *tungsten = "Tungsten Graphics, Inc.";
-
-      /* Tungsten Graphics, Inc. developed the state_tracker module
-       * (and much of Mesa), but the driver itself may come from elsewhere.
-       * The additional string allows "and XyzCorp" to reflect this.
-       */
-      if (vendor && strcmp(vendor, tungsten) != 0)
-        util_snprintf(st->vendor, sizeof(st->vendor),
-                  "%s and %s", tungsten, vendor);
-      else
-        util_snprintf(st->vendor, sizeof(st->vendor), "%s", tungsten);
-
+      util_snprintf(st->vendor, sizeof(st->vendor), "%s", vendor);
       return (GLubyte *) st->vendor;
    }
 
index 311d812..8013e69 100644 (file)
@@ -37,6 +37,7 @@
 #include "main/pixel.h"
 #include "main/texcompress.h"
 #include "main/texformat.h"
+#include "main/texgetimage.h"
 #include "main/teximage.h"
 #include "main/texobj.h"
 #include "main/texstore.h"
@@ -946,7 +947,8 @@ fallback_copy_texsubimage(GLcontext *ctx,
    texDest = st_texture_image_map(ctx->st, stImage, 0, PIPE_TRANSFER_WRITE,
                                   destX, destY, width, height);
 
-   if (baseFormat == GL_DEPTH_COMPONENT) {
+   if (baseFormat == GL_DEPTH_COMPONENT ||
+       baseFormat == GL_DEPTH24_STENCIL8) {
       const GLboolean scaleOrBias = (ctx->Pixel.DepthScale != 1.0F ||
                                      ctx->Pixel.DepthBias != 0.0F);
       GLint row, yStep;
@@ -1056,7 +1058,8 @@ st_copy_texsubimage(GLcontext *ctx,
    st_finish(ctx->st);
 
    /* determine if copying depth or color data */
-   if (texBaseFormat == GL_DEPTH_COMPONENT) {
+   if (texBaseFormat == GL_DEPTH_COMPONENT ||
+       texBaseFormat == GL_DEPTH24_STENCIL8) {
       strb = st_renderbuffer(fb->_DepthBuffer);
    }
    else if (texBaseFormat == GL_DEPTH_STENCIL_EXT) {
@@ -1471,9 +1474,19 @@ st_get_default_texture(struct st_context *st)
       GLubyte pixels[16][16][4];
       struct gl_texture_object *texObj;
       struct gl_texture_image *texImg;
+      GLuint i, j;
 
-      /* init image to gray */
-      memset(pixels, 127, sizeof(pixels));
+      /* The ARB_fragment_program spec says (0,0,0,1) should be returned
+       * when attempting to sample incomplete textures.
+       */
+      for (i = 0; i < 16; i++) {
+         for (j = 0; j < 16; j++) {
+            pixels[i][j][0] = 0;
+            pixels[i][j][1] = 0;
+            pixels[i][j][2] = 0;
+            pixels[i][j][3] = 255;
+         }
+      }
 
       texObj = st->ctx->Driver.NewTextureObject(st->ctx, 0, target);
 
index 06fec20..daaad65 100644 (file)
@@ -293,32 +293,6 @@ st_notify_swapbuffers(struct st_framebuffer *stfb)
 }
 
 
-/** 
- * Quick hack - allows the winsys to inform the driver that surface
- * states are now undefined after a glXSwapBuffers or similar.
- */
-void
-st_notify_swapbuffers_complete(struct st_framebuffer *stfb)
-{
-   GET_CURRENT_CONTEXT(ctx);
-
-   if (ctx && ctx->DrawBuffer == &stfb->Base) {
-      struct st_renderbuffer *strb;
-
-      /* Mark back color buffers as undefined */
-      strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_LEFT].
-                             Renderbuffer);
-      if (strb && strb->surface)
-         strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
-
-      strb = st_renderbuffer(stfb->Base.Attachment[BUFFER_BACK_RIGHT].
-                             Renderbuffer);
-      if (strb && strb->surface)
-         strb->surface->status = PIPE_SURFACE_STATUS_UNDEFINED;
-   }
-}
-
-
 void *st_framebuffer_private( struct st_framebuffer *stfb )
 {
    return stfb->Private;
index f825204..6348e83 100644 (file)
@@ -427,11 +427,13 @@ st_translate_fragment_program(struct st_context *st,
             interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
             break;
          case FRAG_ATTRIB_FOGC:
-            if (stfp->Base.UsesPointCoord)
+            if (stfp->Base.UsesPointCoord) {
                stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
-            else
+               stfp->input_semantic_index[slot] = num_generic++;
+            } else {
                stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
-            stfp->input_semantic_index[slot] = 0;
+               stfp->input_semantic_index[slot] = 0;
+           }
             interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE;
             break;
          case FRAG_ATTRIB_TEX0:
index 414218b..0303143 100644 (file)
@@ -100,7 +100,6 @@ void st_flush( struct st_context *st, uint pipeFlushFlags,
 void st_finish( struct st_context *st );
 
 void st_notify_swapbuffers(struct st_framebuffer *stfb);
-void st_notify_swapbuffers_complete(struct st_framebuffer *stfb);
 
 int st_set_teximage(struct pipe_texture *pt, int target);
 
index 6f274d6..3f90ad5 100644 (file)
@@ -107,7 +107,7 @@ st_texture_create(struct st_context *st,
 
    newtex = screen->texture_create(screen, &pt);
 
-   assert(!newtex || p_atomic_read(&newtex->reference.count) == 1);
+   assert(!newtex || pipe_is_referenced(&newtex->reference));
 
    return newtex;
 }
index 840b7e2..28c2f58 100644 (file)
@@ -99,12 +99,6 @@ st_get_stobj_texture(struct st_texture_object *stObj)
    return stObj ? stObj->pt : NULL;
 }
 
-static INLINE GLboolean pf_is_depth_stencil( enum pipe_format format )
-{
-   return (pf_get_component_bits( format, PIPE_FORMAT_COMP_Z ) +
-           pf_get_component_bits( format, PIPE_FORMAT_COMP_S )) != 0;
-}
-
 
 extern struct pipe_texture *
 st_texture_create(struct st_context *st,
index 458fe18..5fefae6 100644 (file)
@@ -47,17 +47,12 @@ static void
 fetch_texel(GLcontext * ctx, const GLfloat texcoord[4], GLfloat lambda,
            GLuint unit, GLfloat color[4])
 {
-   GLchan rgba[4];
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
 
    /* XXX use a float-valued TextureSample routine here!!! */
    swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
                                1, (const GLfloat(*)[4]) texcoord,
-                               &lambda, &rgba);
-   color[0] = CHAN_TO_FLOAT(rgba[0]);
-   color[1] = CHAN_TO_FLOAT(rgba[1]);
-   color[2] = CHAN_TO_FLOAT(rgba[2]);
-   color[3] = CHAN_TO_FLOAT(rgba[3]);
+                               &lambda, (GLfloat (*)[4]) color);
 }
 
 static void
index 4dbccbb..a7eaf76 100644 (file)
@@ -172,19 +172,29 @@ _swrast_update_fog_hint( GLcontext *ctx )
 
 
 /**
- * Update the swrast->_AnyTextureCombine flag.
+ * Update the swrast->_TextureCombinePrimary flag.
  */
 static void
 _swrast_update_texture_env( GLcontext *ctx )
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
    GLuint i;
-   swrast->_AnyTextureCombine = GL_FALSE;
+
+   swrast->_TextureCombinePrimary = GL_FALSE;
+
    for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
-      if (ctx->Texture.Unit[i].EnvMode == GL_COMBINE_EXT ||
-          ctx->Texture.Unit[i].EnvMode == GL_COMBINE4_NV) {
-         swrast->_AnyTextureCombine = GL_TRUE;
-         return;
+      const struct gl_tex_env_combine_state *combine =
+         ctx->Texture.Unit[i]._CurrentCombine;
+      GLuint term;
+      for (term = 0; term < combine->_NumArgsRGB; term++) {
+         if (combine->SourceRGB[term] == GL_PRIMARY_COLOR) {
+            swrast->_TextureCombinePrimary = GL_TRUE;
+            return;
+         }
+         if (combine->SourceA[term] == GL_PRIMARY_COLOR) {
+            swrast->_TextureCombinePrimary = GL_TRUE;
+            return;
+         }
       }
    }
 }
@@ -265,6 +275,24 @@ _swrast_update_fragment_program(GLcontext *ctx, GLbitfield newState)
 }
 
 
+/**
+ * See if we can do early diffuse+specular (primary+secondary) color
+ * add per vertex instead of per-fragment.
+ */
+static void
+_swrast_update_specular_vertex_add(GLcontext *ctx)
+{
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   GLboolean separateSpecular = ctx->Fog.ColorSumEnabled ||
+      (ctx->Light.Enabled &&
+       ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR);
+
+   swrast->SpecularVertexAdd = (separateSpecular
+                                && ctx->Texture._EnabledUnits == 0x0
+                                && !ctx->FragmentProgram._Current
+                                && !ctx->ATIFragmentShader._Enabled);
+}
+
 
 #define _SWRAST_NEW_DERIVED (_SWRAST_NEW_RASTERMASK |  \
                             _NEW_TEXTURE |             \
@@ -326,9 +354,7 @@ _swrast_validate_triangle( GLcontext *ctx,
    swrast->choose_triangle( ctx );
    ASSERT(swrast->Triangle);
 
-   if (ctx->Texture._EnabledUnits == 0
-       && NEED_SECONDARY_COLOR(ctx)
-       && !ctx->FragmentProgram._Current) {
+   if (swrast->SpecularVertexAdd) {
       /* separate specular color, but no texture */
       swrast->SpecTriangle = swrast->Triangle;
       swrast->Triangle = _swrast_add_spec_terms_triangle;
@@ -350,9 +376,7 @@ _swrast_validate_line( GLcontext *ctx, const SWvertex *v0, const SWvertex *v1 )
    swrast->choose_line( ctx );
    ASSERT(swrast->Line);
 
-   if (ctx->Texture._EnabledUnits == 0
-       && NEED_SECONDARY_COLOR(ctx)
-       && !ctx->FragmentProgram._Current) {
+   if (swrast->SpecularVertexAdd) {
       swrast->SpecLine = swrast->Line;
       swrast->Line = _swrast_add_spec_terms_line;
    }
@@ -372,9 +396,7 @@ _swrast_validate_point( GLcontext *ctx, const SWvertex *v0 )
    _swrast_validate_derived( ctx );
    swrast->choose_point( ctx );
 
-   if (ctx->Texture._EnabledUnits == 0
-       && NEED_SECONDARY_COLOR(ctx)
-       && !ctx->FragmentProgram._Current) {
+   if (swrast->SpecularVertexAdd) {
       swrast->SpecPoint = swrast->Point;
       swrast->Point = _swrast_add_spec_terms_point;
    }
@@ -656,6 +678,12 @@ _swrast_validate_derived( GLcontext *ctx )
                               _NEW_TEXTURE))
          _swrast_update_active_attribs(ctx);
 
+      if (swrast->NewState & (_NEW_FOG | 
+                              _NEW_PROGRAM |
+                              _NEW_LIGHT |
+                              _NEW_TEXTURE))
+         _swrast_update_specular_vertex_add(ctx);
+
       swrast->NewState = 0;
       swrast->StateChanges = 0;
       swrast->InvalidateState = _swrast_invalidate_state;
@@ -820,8 +848,8 @@ _swrast_CreateContext( GLcontext *ctx )
    swrast->PointSpan.facing = 0;
    swrast->PointSpan.array = swrast->SpanArrays;
 
-   swrast->TexelBuffer = (GLchan *) MALLOC(ctx->Const.MaxTextureImageUnits *
-                                           MAX_WIDTH * 4 * sizeof(GLchan));
+   swrast->TexelBuffer = (GLfloat *) MALLOC(ctx->Const.MaxTextureImageUnits *
+                                           MAX_WIDTH * 4 * sizeof(GLfloat));
    if (!swrast->TexelBuffer) {
       FREE(swrast->SpanArrays);
       FREE(swrast);
index 6e8d080..9059f9b 100644 (file)
@@ -52,7 +52,7 @@
 typedef void (*texture_sample_func)(GLcontext *ctx,
                                     const struct gl_texture_object *tObj,
                                     GLuint n, const GLfloat texcoords[][4],
-                                    const GLfloat lambda[], GLchan rgba[][4]);
+                                    const GLfloat lambda[], GLfloat rgba[][4]);
 
 typedef void (_ASMAPIP blend_func)( GLcontext *ctx, GLuint n,
                                     const GLubyte mask[],
@@ -131,7 +131,7 @@ typedef struct
    GLfloat _BackfaceSign;      /** +1 or -1 */
    GLfloat _BackfaceCullSign;  /** +1, 0, or -1 */
    GLboolean _PreferPixelFog;    /* Compute fog blend factor per fragment? */
-   GLboolean _AnyTextureCombine;
+   GLboolean _TextureCombinePrimary;
    GLboolean _FogEnabled;
    GLboolean _DeferredTexture;
    GLenum _FogMode;  /* either GL_FOG_MODE or fragment program's fog mode */
@@ -157,6 +157,7 @@ typedef struct
    GLbitfield NewState;
    GLuint StateChanges;
    GLenum Primitive;    /* current primitive being drawn (ala glBegin) */
+   GLboolean SpecularVertexAdd; /**< Add specular/secondary color per vertex */
 
    void (*InvalidateState)( GLcontext *ctx, GLbitfield new_state );
 
@@ -221,7 +222,7 @@ typedef struct
    /** Buffer for saving the sampled texture colors.
     * Needed for GL_ARB_texture_env_crossbar implementation.
     */
-   GLchan *TexelBuffer;
+   GLfloat *TexelBuffer;
 
    validate_texture_image_func ValidateTextureImage;
 
index ae1dea1..b71fb9e 100644 (file)
  * and return results in 'colorOut'.
  */
 static INLINE void
-swizzle_texel(const GLchan texel[4], GLfloat colorOut[4], GLuint swizzle)
+swizzle_texel(const GLfloat texel[4], GLfloat colorOut[4], GLuint swizzle)
 {
    if (swizzle == SWIZZLE_NOOP) {
-      colorOut[0] = CHAN_TO_FLOAT(texel[0]);
-      colorOut[1] = CHAN_TO_FLOAT(texel[1]);
-      colorOut[2] = CHAN_TO_FLOAT(texel[2]);
-      colorOut[3] = CHAN_TO_FLOAT(texel[3]);
+      COPY_4V(colorOut, texel);
    }
    else {
       GLfloat vector[6];
-      vector[SWIZZLE_X] = CHAN_TO_FLOAT(texel[0]);
-      vector[SWIZZLE_Y] = CHAN_TO_FLOAT(texel[1]);
-      vector[SWIZZLE_Z] = CHAN_TO_FLOAT(texel[2]);
-      vector[SWIZZLE_W] = CHAN_TO_FLOAT(texel[3]);
+      vector[SWIZZLE_X] = texel[0];
+      vector[SWIZZLE_Y] = texel[1];
+      vector[SWIZZLE_Z] = texel[2];
+      vector[SWIZZLE_W] = texel[3];
       vector[SWIZZLE_ZERO] = 0.0F;
       vector[SWIZZLE_ONE] = 1.0F;
       colorOut[0] = vector[GET_SWZ(swizzle, 0)];
@@ -73,11 +70,10 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
 
    if (texObj) {
       SWcontext *swrast = SWRAST_CONTEXT(ctx);
-      GLchan rgba[4];
+      GLfloat rgba[4];
 
       lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
 
-      /* XXX use a float-valued TextureSample routine here!!! */
       swrast->TextureSample[unit](ctx, texObj, 1,
                                   (const GLfloat (*)[4]) texcoord,
                                   &lambda, &rgba);
@@ -108,7 +104,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
       const GLfloat texW = (GLfloat) texImg->WidthScale;
       const GLfloat texH = (GLfloat) texImg->HeightScale;
       GLfloat lambda;
-      GLchan rgba[4];
+      GLfloat rgba[4];
 
       lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */
                                       texdx[1], texdy[1], /* dt/dx, dt/dy */
@@ -119,7 +115,6 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4],
 
       lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod);
 
-      /* XXX use a float-valued TextureSample routine here!!! */
       swrast->TextureSample[unit](ctx, texObj, 1,
                                   (const GLfloat (*)[4]) texcoord,
                                   &lambda, &rgba);
index 61ff4d0..0a3ad97 100644 (file)
@@ -570,6 +570,9 @@ void
 _swrast_choose_point(GLcontext *ctx)
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
+   const GLfloat size = CLAMP(ctx->Point.Size,
+                              ctx->Point.MinSize,
+                              ctx->Point.MaxSize);
 
    if (ctx->RenderMode == GL_RENDER) {
       if (ctx->Point.PointSprite) {
@@ -578,7 +581,7 @@ _swrast_choose_point(GLcontext *ctx)
       else if (ctx->Point.SmoothFlag) {
          swrast->Point = smooth_point;
       }
-      else if (ctx->Point.Size > 1.0 ||
+      else if (size > 1.0 ||
                ctx->Point._Attenuated ||
                ctx->VertexProgram.PointSizeEnabled) {
          swrast->Point = large_point;
index 15a783b..cfff82b 100644 (file)
@@ -1377,12 +1377,14 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
 
    ASSERT(span->arrayMask & SPAN_RGBA);
 
-   if (!shader) {
-      /* Add base and specular colors */
-      if (ctx->Fog.ColorSumEnabled ||
-          (ctx->Light.Enabled &&
-           ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
-         add_specular(ctx, span);
+   if (span->primitive == GL_BITMAP || !swrast->SpecularVertexAdd) {
+      /* Add primary and specular (diffuse + specular) colors */
+      if (!shader) {
+         if (ctx->Fog.ColorSumEnabled ||
+             (ctx->Light.Enabled &&
+              ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) {
+            add_specular(ctx, span);
+         }
       }
    }
 
@@ -1403,11 +1405,17 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span)
    }
 
    /*
-    * Write to renderbuffers
+    * Write to renderbuffers.
+    * Depending on glDrawBuffer() state and the which color outputs are
+    * written by the fragment shader, we may either replicate one color to
+    * all renderbuffers or write a different color to each renderbuffer.
+    * multiFragOutputs=TRUE for the later case.
     */
    {
       const GLuint numBuffers = fb->_NumColorDrawBuffers;
-      const GLboolean multiFragOutputs = numBuffers > 1;
+      const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
+      const GLboolean multiFragOutputs = 
+         (fp && fp->Base.OutputsWritten >= (1 << FRAG_RESULT_DATA0));
       GLuint buf;
 
       for (buf = 0; buf < numBuffers; buf++) {
index aa28311..fae7280 100644 (file)
@@ -29,7 +29,6 @@
 #include "main/colormac.h"
 #include "main/image.h"
 #include "main/imports.h"
-#include "main/macros.h"
 #include "main/pixel.h"
 #include "shader/prog_instruction.h"
 
 #include "s_texcombine.h"
 
 
-#define PROD(A,B)   ( (GLuint)(A) * ((GLuint)(B)+1) )
-#define S_PROD(A,B) ( (GLint)(A) * ((GLint)(B)+1) )
-#if CHAN_BITS == 32
-typedef GLfloat ChanTemp;
-#else
-typedef GLuint ChanTemp;
-#endif
+/**
+ * Pointer to array of float[4]
+ * This type makes the code below more concise and avoids a lot of casting.
+ */
+typedef float (*float4_array)[4];
+
+
+/**
+ * Return array of texels for given unit.
+ */
+static INLINE float4_array
+get_texel_array(SWcontext *swrast, GLuint unit)
+{
+   return (float4_array)
+      (swrast->TexelBuffer + unit * MAX_WIDTH * 4 * sizeof(GLfloat));
+}
+
 
 
 /**
- * Do texture application for GL_ARB/EXT_texture_env_combine.
- * This function also supports GL_{EXT,ARB}_texture_env_dot3 and
- * GL_ATI_texture_env_combine3.  Since "classic" texture environments are
- * implemented using GL_ARB_texture_env_combine-like state, this same function
- * is used for classic texture environment application as well.
+ * Do texture application for:
+ *  GL_EXT_texture_env_combine
+ *  GL_ARB_texture_env_combine
+ *  GL_EXT_texture_env_dot3
+ *  GL_ARB_texture_env_dot3
+ *  GL_ATI_texture_env_combine3
+ *  GL_NV_texture_env_combine4
+ *  conventional GL texture env modes
  *
  * \param ctx          rendering context
- * \param textureUnit  the texture unit to apply
+ * \param unit         the texture combiner unit
  * \param n            number of fragments to process (span width)
  * \param primary_rgba incoming fragment color array
  * \param texelBuffer  pointer to texel colors for all texture units
  * 
- * \param rgba         incoming colors, which get modified here
+ * \param rgba         incoming/result fragment colors
  */
 static void
-texture_combine( const GLcontext *ctx, GLuint unit, GLuint n,
-                 CONST GLchan (*primary_rgba)[4],
-                 CONST GLchan *texelBuffer,
-                 GLchan (*rgba)[4] )
+texture_combine( GLcontext *ctx, GLuint unit, GLuint n,
+                 const float4_array primary_rgba,
+                 const GLfloat *texelBuffer,
+                 GLchan (*rgbaChan)[4] )
 {
+   SWcontext *swrast = SWRAST_CONTEXT(ctx);
    const struct gl_texture_unit *textureUnit = &(ctx->Texture.Unit[unit]);
-   const GLchan (*argRGB [4])[4];
-   const GLchan (*argA [4])[4];
-   const GLint RGBshift = textureUnit->_CurrentCombine->ScaleShiftRGB;
-   const GLuint Ashift   = textureUnit->_CurrentCombine->ScaleShiftA;
-#if CHAN_TYPE == GL_FLOAT
-   const GLchan RGBmult = (GLfloat) (1 << RGBshift);
-   const GLchan Amult = (GLfloat) (1 << Ashift);
-#else
-   const GLint half = (CHAN_MAX + 1) / 2;
-#endif
-   static const GLchan one[4] = { CHAN_MAX, CHAN_MAX, CHAN_MAX, CHAN_MAX };
-   static const GLchan zero[4] = { 0, 0, 0, 0 };
-   const GLuint numColorArgs = textureUnit->_CurrentCombine->_NumArgsRGB;
-   const GLuint numAlphaArgs = textureUnit->_CurrentCombine->_NumArgsA;
-   GLchan ccolor[4][MAX_WIDTH][4];
-   GLuint i, j;
-
-   ASSERT(ctx->Extensions.EXT_texture_env_combine ||
-          ctx->Extensions.ARB_texture_env_combine);
-   ASSERT(CONST_SWRAST_CONTEXT(ctx)->_AnyTextureCombine);
+   const struct gl_tex_env_combine_state *combine = textureUnit->_CurrentCombine;
+   float4_array argRGB[MAX_COMBINER_TERMS];
+   float4_array argA[MAX_COMBINER_TERMS];
+   const GLfloat scaleRGB = (GLfloat) (1 << combine->ScaleShiftRGB);
+   const GLfloat scaleA = (GLfloat) (1 << combine->ScaleShiftA);
+   const GLuint numArgsRGB = combine->_NumArgsRGB;
+   const GLuint numArgsA = combine->_NumArgsA;
+   GLfloat ccolor[MAX_COMBINER_TERMS][MAX_WIDTH][4]; /* temp color buffers */
+   GLfloat rgba[MAX_WIDTH][4];
+   GLuint i, term;
+
+   for (i = 0; i < n; i++) {
+      rgba[i][RCOMP] = CHAN_TO_FLOAT(rgbaChan[i][RCOMP]);
+      rgba[i][GCOMP] = CHAN_TO_FLOAT(rgbaChan[i][GCOMP]);
+      rgba[i][BCOMP] = CHAN_TO_FLOAT(rgbaChan[i][BCOMP]);
+      rgba[i][ACOMP] = CHAN_TO_FLOAT(rgbaChan[i][ACOMP]);
+   }
 
    /*
    printf("modeRGB 0x%x  modeA 0x%x  srcRGB1 0x%x  srcA1 0x%x  srcRGB2 0x%x  srcA2 0x%x\n",
-          textureUnit->_CurrentCombine->ModeRGB,
-          textureUnit->_CurrentCombine->ModeA,
-          textureUnit->_CurrentCombine->SourceRGB[0],
-          textureUnit->_CurrentCombine->SourceA[0],
-          textureUnit->_CurrentCombine->SourceRGB[1],
-          textureUnit->_CurrentCombine->SourceA[1]);
+          combine->ModeRGB,
+          combine->ModeA,
+          combine->SourceRGB[0],
+          combine->SourceA[0],
+          combine->SourceRGB[1],
+          combine->SourceA[1]);
    */
 
    /*
     * Do operand setup for up to 4 operands.  Loop over the terms.
     */
-   for (j = 0; j < numColorArgs; j++) {
-      const GLenum srcRGB = textureUnit->_CurrentCombine->SourceRGB[j];
+   for (term = 0; term < numArgsRGB; term++) {
+      const GLenum srcRGB = combine->SourceRGB[term];
+      const GLenum operandRGB = combine->OperandRGB[term];
 
       switch (srcRGB) {
          case GL_TEXTURE:
-            argRGB[j] = (const GLchan (*)[4])
-               (texelBuffer + unit * (n * 4 * sizeof(GLchan)));
+            argRGB[term] = get_texel_array(swrast, unit);
             break;
          case GL_PRIMARY_COLOR:
-            argRGB[j] = primary_rgba;
+            argRGB[term] = primary_rgba;
             break;
          case GL_PREVIOUS:
-            argRGB[j] = (const GLchan (*)[4]) rgba;
+            argRGB[term] = rgba;
             break;
          case GL_CONSTANT:
             {
-               GLchan (*c)[4] = ccolor[j];
-               GLchan red, green, blue, alpha;
-               UNCLAMPED_FLOAT_TO_CHAN(red,   textureUnit->EnvColor[0]);
-               UNCLAMPED_FLOAT_TO_CHAN(green, textureUnit->EnvColor[1]);
-               UNCLAMPED_FLOAT_TO_CHAN(blue,  textureUnit->EnvColor[2]);
-               UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]);
+               float4_array c = ccolor[term];
+               GLfloat red   = textureUnit->EnvColor[0];
+               GLfloat green = textureUnit->EnvColor[1];
+               GLfloat blue  = textureUnit->EnvColor[2];
+               GLfloat alpha = textureUnit->EnvColor[3];
                for (i = 0; i < n; i++) {
-                  c[i][RCOMP] = red;
-                  c[i][GCOMP] = green;
-                  c[i][BCOMP] = blue;
-                  c[i][ACOMP] = alpha;
+                  ASSIGN_4V(c[i], red, green, blue, alpha);
                }
-               argRGB[j] = (const GLchan (*)[4]) ccolor[j];
+               argRGB[term] = ccolor[term];
             }
             break;
         /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources.
          */
         case GL_ZERO:
-            argRGB[j] = & zero;
+            {
+               float4_array c = ccolor[term];
+               for (i = 0; i < n; i++) {
+                  ASSIGN_4V(c[i], 0.0F, 0.0F, 0.0F, 0.0F);
+               }
+               argRGB[term] = ccolor[term];
+            }
             break;
         case GL_ONE:
-            argRGB[j] = & one;
+            {
+               float4_array c = ccolor[term];
+               for (i = 0; i < n; i++) {
+                  ASSIGN_4V(c[i], 1.0F, 1.0F, 1.0F, 1.0F);
+               }
+               argRGB[term] = ccolor[term];
+            }
             break;
          default:
             /* ARB_texture_env_crossbar source */
@@ -148,76 +166,88 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n,
                ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
                if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled)
                   return;
-               argRGB[j] = (const GLchan (*)[4])
-                  (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan)));
+               argRGB[term] = get_texel_array(swrast, srcUnit);
             }
       }
 
-      if (textureUnit->_CurrentCombine->OperandRGB[j] != GL_SRC_COLOR) {
-         const GLchan (*src)[4] = argRGB[j];
-         GLchan (*dst)[4] = ccolor[j];
+      if (operandRGB != GL_SRC_COLOR) {
+         float4_array src = argRGB[term];
+         float4_array dst = ccolor[term];
 
-         /* point to new arg[j] storage */
-         argRGB[j] = (const GLchan (*)[4]) ccolor[j];
+         /* point to new arg[term] storage */
+         argRGB[term] = ccolor[term];
 
-         if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_ONE_MINUS_SRC_COLOR) {
+         switch (operandRGB) {
+         case GL_ONE_MINUS_SRC_COLOR:
             for (i = 0; i < n; i++) {
-               dst[i][RCOMP] = CHAN_MAX - src[i][RCOMP];
-               dst[i][GCOMP] = CHAN_MAX - src[i][GCOMP];
-               dst[i][BCOMP] = CHAN_MAX - src[i][BCOMP];
+               dst[i][RCOMP] = 1.0F - src[i][RCOMP];
+               dst[i][GCOMP] = 1.0F - src[i][GCOMP];
+               dst[i][BCOMP] = 1.0F - src[i][BCOMP];
             }
-         }
-         else if (textureUnit->_CurrentCombine->OperandRGB[j] == GL_SRC_ALPHA) {
+            break;
+         case GL_SRC_ALPHA:
             for (i = 0; i < n; i++) {
-               dst[i][RCOMP] = src[i][ACOMP];
-               dst[i][GCOMP] = src[i][ACOMP];
+               dst[i][RCOMP] =
+               dst[i][GCOMP] =
                dst[i][BCOMP] = src[i][ACOMP];
             }
-         }
-         else {
-            ASSERT(textureUnit->_CurrentCombine->OperandRGB[j] ==GL_ONE_MINUS_SRC_ALPHA);
+            break;
+         case GL_ONE_MINUS_SRC_ALPHA:
             for (i = 0; i < n; i++) {
-               dst[i][RCOMP] = CHAN_MAX - src[i][ACOMP];
-               dst[i][GCOMP] = CHAN_MAX - src[i][ACOMP];
-               dst[i][BCOMP] = CHAN_MAX - src[i][ACOMP];
+               dst[i][RCOMP] =
+               dst[i][GCOMP] =
+               dst[i][BCOMP] = 1.0F - src[i][ACOMP];
             }
+            break;
+         default:
+            _mesa_problem(ctx, "Bad operandRGB");
          }
       }
    }
 
    /*
-    * Set up the argA[i] pointers
+    * Set up the argA[term] pointers
     */
-   for (j = 0; j < numAlphaArgs; j++) {
-      const GLenum srcA = textureUnit->_CurrentCombine->SourceA[j];
+   for (term = 0; term < numArgsA; term++) {
+      const GLenum srcA = combine->SourceA[term];
+      const GLenum operandA = combine->OperandA[term];
 
       switch (srcA) {
          case GL_TEXTURE:
-            argA[j] = (const GLchan (*)[4])
-               (texelBuffer + unit * (n * 4 * sizeof(GLchan)));
+            argA[term] = get_texel_array(swrast, unit);
             break;
          case GL_PRIMARY_COLOR:
-            argA[j] = primary_rgba;
+            argA[term] = primary_rgba;
             break;
          case GL_PREVIOUS:
-            argA[j] = (const GLchan (*)[4]) rgba;
+            argA[term] = rgba;
             break;
          case GL_CONSTANT:
             {
-               GLchan alpha, (*c)[4] = ccolor[j];
-               UNCLAMPED_FLOAT_TO_CHAN(alpha, textureUnit->EnvColor[3]);
+               float4_array c = ccolor[term];
+               GLfloat alpha = textureUnit->EnvColor[3];
                for (i = 0; i < n; i++)
                   c[i][ACOMP] = alpha;
-               argA[j] = (const GLchan (*)[4]) ccolor[j];
+               argA[term] = ccolor[term];
             }
             break;
         /* GL_ATI_texture_env_combine3 allows GL_ZERO & GL_ONE as sources.
          */
         case GL_ZERO:
-            argA[j] = & zero;
+            {
+               float4_array c = ccolor[term];
+               for (i = 0; i < n; i++)
+                  c[i][ACOMP] = 0.0F;
+               argA[term] = ccolor[term];
+            }
             break;
         case GL_ONE:
-            argA[j] = & one;
+            {
+               float4_array c = ccolor[term];
+               for (i = 0; i < n; i++)
+                  c[i][ACOMP] = 1.0F;
+               argA[term] = ccolor[term];
+            }
             break;
          default:
             /* ARB_texture_env_crossbar source */
@@ -226,598 +256,258 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n,
                ASSERT(srcUnit < ctx->Const.MaxTextureUnits);
                if (!ctx->Texture.Unit[srcUnit]._ReallyEnabled)
                   return;
-               argA[j] = (const GLchan (*)[4])
-                  (texelBuffer + srcUnit * (n * 4 * sizeof(GLchan)));
+               argA[term] = get_texel_array(swrast, srcUnit);
             }
       }
 
-      if (textureUnit->_CurrentCombine->OperandA[j] == GL_ONE_MINUS_SRC_ALPHA) {
-         const GLchan (*src)[4] = argA[j];
-         GLchan (*dst)[4] = ccolor[j];
-         argA[j] = (const GLchan (*)[4]) ccolor[j];
+      if (operandA == GL_ONE_MINUS_SRC_ALPHA) {
+         float4_array src = argA[term];
+         float4_array dst = ccolor[term];
+         argA[term] = ccolor[term];
          for (i = 0; i < n; i++) {
-            dst[i][ACOMP] = CHAN_MAX - src[i][ACOMP];
+            dst[i][ACOMP] = 1.0F - src[i][ACOMP];
          }
       }
    }
 
-   /*
-    * Do the texture combine.
-    */
-   switch (textureUnit->_CurrentCombine->ModeRGB) {
+   /* RGB channel combine */
+   {
+      float4_array arg0 = argRGB[0];
+      float4_array arg1 = argRGB[1];
+      float4_array arg2 = argRGB[2];
+      float4_array arg3 = argRGB[3];
+
+      switch (combine->ModeRGB) {
       case GL_REPLACE:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            if (RGBshift) {
-               for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-                  rgba[i][RCOMP] = arg0[i][RCOMP] * RGBmult;
-                  rgba[i][GCOMP] = arg0[i][GCOMP] * RGBmult;
-                  rgba[i][BCOMP] = arg0[i][BCOMP] * RGBmult;
-#else
-                  GLuint r = (GLuint) arg0[i][RCOMP] << RGBshift;
-                  GLuint g = (GLuint) arg0[i][GCOMP] << RGBshift;
-                  GLuint b = (GLuint) arg0[i][BCOMP] << RGBshift;
-                  rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
-                  rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
-                  rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
-#endif
-               }
-            }
-            else {
-               for (i = 0; i < n; i++) {
-                  rgba[i][RCOMP] = arg0[i][RCOMP];
-                  rgba[i][GCOMP] = arg0[i][GCOMP];
-                  rgba[i][BCOMP] = arg0[i][BCOMP];
-               }
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][RCOMP] = arg0[i][RCOMP] * scaleRGB;
+            rgba[i][GCOMP] = arg0[i][GCOMP] * scaleRGB;
+            rgba[i][BCOMP] = arg0[i][BCOMP] * scaleRGB;
          }
          break;
       case GL_MODULATE:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - RGBshift;
-#endif
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * RGBmult;
-               rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * RGBmult;
-               rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * RGBmult;
-#else
-               GLuint r = PROD(arg0[i][RCOMP], arg1[i][RCOMP]) >> shift;
-               GLuint g = PROD(arg0[i][GCOMP], arg1[i][GCOMP]) >> shift;
-               GLuint b = PROD(arg0[i][BCOMP], arg1[i][BCOMP]) >> shift;
-               rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][RCOMP] = arg0[i][RCOMP] * arg1[i][RCOMP] * scaleRGB;
+            rgba[i][GCOMP] = arg0[i][GCOMP] * arg1[i][GCOMP] * scaleRGB;
+            rgba[i][BCOMP] = arg0[i][BCOMP] * arg1[i][BCOMP] * scaleRGB;
          }
          break;
       case GL_ADD:
          if (textureUnit->EnvMode == GL_COMBINE4_NV) {
             /* (a * b) + (c * d) */
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
-            const GLchan (*arg3)[4] = (const GLchan (*)[4]) argRGB[3];
             for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
                rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] +
-                                 arg2[i][RCOMP] * arg3[i][RCOMP]) * RGBmult;
+                                 arg2[i][RCOMP] * arg3[i][RCOMP]) * scaleRGB;
                rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] +
-                                 arg2[i][GCOMP] * arg3[i][GCOMP]) * RGBmult;
+                                 arg2[i][GCOMP] * arg3[i][GCOMP]) * scaleRGB;
                rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] +
-                                 arg2[i][BCOMP] * arg3[i][BCOMP]) * RGBmult;
-#else
-               const GLint shift = CHAN_BITS - RGBshift;
-               GLint r = (PROD(arg0[i][RCOMP], arg1[i][RCOMP]) >> shift) +
-                         (PROD(arg2[i][RCOMP], arg3[i][RCOMP]) >> shift);
-               GLint g = (PROD(arg0[i][GCOMP], arg1[i][GCOMP]) >> shift) +
-                         (PROD(arg2[i][GCOMP], arg3[i][GCOMP]) >> shift);
-               GLint b = (PROD(arg0[i][BCOMP], arg1[i][BCOMP]) >> shift) +
-                         (PROD(arg2[i][BCOMP], arg3[i][BCOMP]) >> shift);
-               rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
-#endif
+                                 arg2[i][BCOMP] * arg3[i][BCOMP]) * scaleRGB;
             }
          }
          else {
             /* 2-term addition */
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
             for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * RGBmult;
-               rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * RGBmult;
-               rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * RGBmult;
-#else
-               GLint r = ((GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP]) << RGBshift;
-               GLint g = ((GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP]) << RGBshift;
-               GLint b = ((GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP]) << RGBshift;
-               rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
-#endif
+               rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP]) * scaleRGB;
+               rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP]) * scaleRGB;
+               rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP]) * scaleRGB;
             }
          }
          break;
       case GL_ADD_SIGNED:
          if (textureUnit->EnvMode == GL_COMBINE4_NV) {
             /* (a * b) + (c * d) - 0.5 */
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
-            const GLchan (*arg3)[4] = (const GLchan (*)[4]) argRGB[3];
             for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] *
-                                 arg2[i][RCOMP] + arg3[i][RCOMP] - 0.5) * RGBmult;
-               rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] *
-                                 arg2[i][GCOMP] + arg3[i][GCOMP] - 0.5) * RGBmult;
-               rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] *
-                                 arg2[i][BCOMP] + arg3[i][BCOMP] - 0.5) * RGBmult;
-#else
-               GLint r = (((PROD(arg0[i][RCOMP], arg1[i][RCOMP]) +
-                            PROD(arg2[i][RCOMP], arg3[i][RCOMP])) >> CHAN_BITS) - half)
-                          << RGBshift;
-               GLint g = (((PROD(arg0[i][GCOMP], arg1[i][GCOMP]) +
-                            PROD(arg2[i][GCOMP], arg3[i][GCOMP])) >> CHAN_BITS) - half)
-                          << RGBshift;
-               GLint b = (((PROD(arg0[i][BCOMP], arg1[i][BCOMP]) +
-                            PROD(arg2[i][BCOMP], arg3[i][BCOMP])) >> CHAN_BITS) - half)
-                          << RGBshift;
-               rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
-#endif
+               rgba[i][RCOMP] = (arg0[i][RCOMP] * arg1[i][RCOMP] +
+                                 arg2[i][RCOMP] * arg3[i][RCOMP] - 0.5) * scaleRGB;
+               rgba[i][GCOMP] = (arg0[i][GCOMP] * arg1[i][GCOMP] +
+                                 arg2[i][GCOMP] * arg3[i][GCOMP] - 0.5) * scaleRGB;
+               rgba[i][BCOMP] = (arg0[i][BCOMP] * arg1[i][BCOMP] +
+                                 arg2[i][BCOMP] * arg3[i][BCOMP] - 0.5) * scaleRGB;
             }
          }
          else {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
             for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * RGBmult;
-               rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * RGBmult;
-               rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * RGBmult;
-#else
-               GLint r = (GLint) arg0[i][RCOMP] + (GLint) arg1[i][RCOMP] - half;
-               GLint g = (GLint) arg0[i][GCOMP] + (GLint) arg1[i][GCOMP] - half;
-               GLint b = (GLint) arg0[i][BCOMP] + (GLint) arg1[i][BCOMP] - half;
-               r = (r < 0) ? 0 : r << RGBshift;
-               g = (g < 0) ? 0 : g << RGBshift;
-               b = (b < 0) ? 0 : b << RGBshift;
-               rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
-#endif
+               rgba[i][RCOMP] = (arg0[i][RCOMP] + arg1[i][RCOMP] - 0.5) * scaleRGB;
+               rgba[i][GCOMP] = (arg0[i][GCOMP] + arg1[i][GCOMP] - 0.5) * scaleRGB;
+               rgba[i][BCOMP] = (arg0[i][BCOMP] + arg1[i][BCOMP] - 0.5) * scaleRGB;
             }
          }
          break;
       case GL_INTERPOLATE:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - RGBshift;
-#endif
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] +
-                      arg1[i][RCOMP] * (CHAN_MAXF - arg2[i][RCOMP])) * RGBmult;
-               rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] +
-                      arg1[i][GCOMP] * (CHAN_MAXF - arg2[i][GCOMP])) * RGBmult;
-               rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] +
-                      arg1[i][BCOMP] * (CHAN_MAXF - arg2[i][BCOMP])) * RGBmult;
-#else
-               GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP])
-                           + PROD(arg1[i][RCOMP], CHAN_MAX - arg2[i][RCOMP]))
-                              >> shift;
-               GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP])
-                           + PROD(arg1[i][GCOMP], CHAN_MAX - arg2[i][GCOMP]))
-                              >> shift;
-               GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP])
-                           + PROD(arg1[i][BCOMP], CHAN_MAX - arg2[i][BCOMP]))
-                              >> shift;
-               rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][RCOMP] = (arg0[i][RCOMP] * arg2[i][RCOMP] +
+                          arg1[i][RCOMP] * (1.0F - arg2[i][RCOMP])) * scaleRGB;
+            rgba[i][GCOMP] = (arg0[i][GCOMP] * arg2[i][GCOMP] +
+                          arg1[i][GCOMP] * (1.0F - arg2[i][GCOMP])) * scaleRGB;
+            rgba[i][BCOMP] = (arg0[i][BCOMP] * arg2[i][BCOMP] +
+                          arg1[i][BCOMP] * (1.0F - arg2[i][BCOMP])) * scaleRGB;
          }
          break;
       case GL_SUBTRACT:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * RGBmult;
-               rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * RGBmult;
-               rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * RGBmult;
-#else
-               GLint r = ((GLint) arg0[i][RCOMP] - (GLint) arg1[i][RCOMP]) << RGBshift;
-               GLint g = ((GLint) arg0[i][GCOMP] - (GLint) arg1[i][GCOMP]) << RGBshift;
-               GLint b = ((GLint) arg0[i][BCOMP] - (GLint) arg1[i][BCOMP]) << RGBshift;
-               rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][RCOMP] = (arg0[i][RCOMP] - arg1[i][RCOMP]) * scaleRGB;
+            rgba[i][GCOMP] = (arg0[i][GCOMP] - arg1[i][GCOMP]) * scaleRGB;
+            rgba[i][BCOMP] = (arg0[i][BCOMP] - arg1[i][BCOMP]) * scaleRGB;
          }
          break;
       case GL_DOT3_RGB_EXT:
       case GL_DOT3_RGBA_EXT:
-         {
-            /* Do not scale the result by 1 2 or 4 */
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) +
-                             (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) +
-                             (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F))
-                            * 4.0F;
-               dot = CLAMP(dot, 0.0F, CHAN_MAXF);
-#else
-               GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half,
-                                  (GLint)arg1[i][RCOMP] - half) +
-                           S_PROD((GLint)arg0[i][GCOMP] - half,
-                                  (GLint)arg1[i][GCOMP] - half) +
-                           S_PROD((GLint)arg0[i][BCOMP] - half,
-                                  (GLint)arg1[i][BCOMP] - half)) >> 6;
-               dot = CLAMP(dot, 0, CHAN_MAX);
-#endif
-               rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot;
-            }
+         /* Do not scale the result by 1 2 or 4 */
+         for (i = 0; i < n; i++) {
+            GLfloat dot = ((arg0[i][RCOMP] - 0.5F) * (arg1[i][RCOMP] - 0.5F) +
+                           (arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) +
+                           (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F))
+               * 4.0F;
+            dot = CLAMP(dot, 0.0F, 1.0F);
+            rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = dot;
          }
          break;
       case GL_DOT3_RGB:
       case GL_DOT3_RGBA:
-         {
-            /* DO scale the result by 1 2 or 4 */
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               GLchan dot = ((arg0[i][RCOMP]-0.5F) * (arg1[i][RCOMP]-0.5F) +
-                             (arg0[i][GCOMP]-0.5F) * (arg1[i][GCOMP]-0.5F) +
-                             (arg0[i][BCOMP]-0.5F) * (arg1[i][BCOMP]-0.5F))
-                            * 4.0F * RGBmult;
-               dot = CLAMP(dot, 0.0, CHAN_MAXF);
-#else
-               GLint dot = (S_PROD((GLint)arg0[i][RCOMP] - half,
-                                  (GLint)arg1[i][RCOMP] - half) +
-                           S_PROD((GLint)arg0[i][GCOMP] - half,
-                                  (GLint)arg1[i][GCOMP] - half) +
-                           S_PROD((GLint)arg0[i][BCOMP] - half,
-                                  (GLint)arg1[i][BCOMP] - half)) >> 6;
-               dot <<= RGBshift;
-               dot = CLAMP(dot, 0, CHAN_MAX);
-#endif
-               rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = (GLchan) dot;
-            }
+         /* DO scale the result by 1 2 or 4 */
+         for (i = 0; i < n; i++) {
+            GLfloat dot = ((arg0[i][RCOMP] - 0.5F) * (arg1[i][RCOMP] - 0.5F) +
+                           (arg0[i][GCOMP] - 0.5F) * (arg1[i][GCOMP] - 0.5F) +
+                           (arg0[i][BCOMP] - 0.5F) * (arg1[i][BCOMP] - 0.5F))
+               * 4.0F * scaleRGB;
+            dot = CLAMP(dot, 0.0, 1.0F);
+            rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = dot;
          }
          break;
       case GL_MODULATE_ADD_ATI:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - RGBshift;
-#endif
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP]) * RGBmult;
-               rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP]) * RGBmult;
-               rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP]) * RGBmult;
-#else
-               GLuint r = (PROD(arg0[i][RCOMP], arg2[i][RCOMP])
-                           + ((GLuint) arg1[i][RCOMP] << CHAN_BITS)) >> shift;
-               GLuint g = (PROD(arg0[i][GCOMP], arg2[i][GCOMP])
-                           + ((GLuint) arg1[i][GCOMP] << CHAN_BITS)) >> shift;
-               GLuint b = (PROD(arg0[i][BCOMP], arg2[i][BCOMP])
-                           + ((GLuint) arg1[i][BCOMP] << CHAN_BITS)) >> shift;
-               rgba[i][RCOMP] = (GLchan) MIN2(r, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) MIN2(g, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) MIN2(b, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) +
+                              arg1[i][RCOMP]) * scaleRGB;
+            rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) +
+                              arg1[i][GCOMP]) * scaleRGB;
+            rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) +
+                              arg1[i][BCOMP]) * scaleRGB;
         }
          break;
       case GL_MODULATE_SIGNED_ADD_ATI:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - RGBshift;
-#endif
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) + arg1[i][RCOMP] - 0.5) * RGBmult;
-               rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) + arg1[i][GCOMP] - 0.5) * RGBmult;
-               rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) + arg1[i][BCOMP] - 0.5) * RGBmult;
-#else
-               GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP])
-                         + (((GLint) arg1[i][RCOMP] - half) << CHAN_BITS))
-                   >> shift;
-               GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP])
-                         + (((GLint) arg1[i][GCOMP] - half) << CHAN_BITS))
-                   >> shift;
-               GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP])
-                         + (((GLint) arg1[i][BCOMP] - half) << CHAN_BITS))
-                   >> shift;
-               rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) +
+                              arg1[i][RCOMP] - 0.5) * scaleRGB;
+            rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) +
+                              arg1[i][GCOMP] - 0.5) * scaleRGB;
+            rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) +
+                              arg1[i][BCOMP] - 0.5) * scaleRGB;
         }
          break;
       case GL_MODULATE_SUBTRACT_ATI:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argRGB[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argRGB[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argRGB[2];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - RGBshift;
-#endif
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) - arg1[i][RCOMP]) * RGBmult;
-               rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) - arg1[i][GCOMP]) * RGBmult;
-               rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) - arg1[i][BCOMP]) * RGBmult;
-#else
-               GLint r = (S_PROD(arg0[i][RCOMP], arg2[i][RCOMP])
-                         - ((GLint) arg1[i][RCOMP] << CHAN_BITS))
-                   >> shift;
-               GLint g = (S_PROD(arg0[i][GCOMP], arg2[i][GCOMP])
-                         - ((GLint) arg1[i][GCOMP] << CHAN_BITS))
-                   >> shift;
-               GLint b = (S_PROD(arg0[i][BCOMP], arg2[i][BCOMP])
-                         - ((GLint) arg1[i][BCOMP] << CHAN_BITS))
-                   >> shift;
-               rgba[i][RCOMP] = (GLchan) CLAMP(r, 0, CHAN_MAX);
-               rgba[i][GCOMP] = (GLchan) CLAMP(g, 0, CHAN_MAX);
-               rgba[i][BCOMP] = (GLchan) CLAMP(b, 0, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][RCOMP] = ((arg0[i][RCOMP] * arg2[i][RCOMP]) -
+                              arg1[i][RCOMP]) * scaleRGB;
+            rgba[i][GCOMP] = ((arg0[i][GCOMP] * arg2[i][GCOMP]) -
+                              arg1[i][GCOMP]) * scaleRGB;
+            rgba[i][BCOMP] = ((arg0[i][BCOMP] * arg2[i][BCOMP]) -
+                              arg1[i][BCOMP]) * scaleRGB;
         }
          break;
       case GL_BUMP_ENVMAP_ATI:
-         {
-            /* this produces a fixed rgba color, and the coord calc is done elsewhere */
-            for (i = 0; i < n; i++) {
+         /* this produces a fixed rgba color, and the coord calc is done elsewhere */
+         for (i = 0; i < n; i++) {
             /* rgba result is 0,0,0,1 */
 #if CHAN_TYPE == GL_FLOAT
-               rgba[i][RCOMP] = 0.0;
-               rgba[i][GCOMP] = 0.0;
-               rgba[i][BCOMP] = 0.0;
-               rgba[i][ACOMP] = 1.0;
+            rgba[i][RCOMP] = 0.0;
+            rgba[i][GCOMP] = 0.0;
+            rgba[i][BCOMP] = 0.0;
+            rgba[i][ACOMP] = 1.0;
 #else
-               rgba[i][RCOMP] = 0;
-               rgba[i][GCOMP] = 0;
-               rgba[i][BCOMP] = 0;
-               rgba[i][ACOMP] = CHAN_MAX;
+            rgba[i][RCOMP] = 0;
+            rgba[i][GCOMP] = 0;
+            rgba[i][BCOMP] = 0;
+            rgba[i][ACOMP] = CHAN_MAX;
 #endif
-            }
         }
          return; /* no alpha processing */
       default:
          _mesa_problem(ctx, "invalid combine mode");
+      }
    }
 
-   switch (textureUnit->_CurrentCombine->ModeA) {
+   /* Alpha channel combine */
+   {
+      float4_array arg0 = argA[0];
+      float4_array arg1 = argA[1];
+      float4_array arg2 = argA[2];
+      float4_array arg3 = argA[3];
+
+      switch (combine->ModeA) {
       case GL_REPLACE:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            if (Ashift) {
-               for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-                  GLchan a = arg0[i][ACOMP] * Amult;
-#else
-                  GLuint a = (GLuint) arg0[i][ACOMP] << Ashift;
-#endif
-                  rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX);
-               }
-            }
-            else {
-               for (i = 0; i < n; i++) {
-                  rgba[i][ACOMP] = arg0[i][ACOMP];
-               }
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][ACOMP] = arg0[i][ACOMP] * scaleA;
          }
          break;
       case GL_MODULATE:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - Ashift;
-#endif
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * Amult;
-#else
-               GLuint a = (PROD(arg0[i][ACOMP], arg1[i][ACOMP]) >> shift);
-               rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][ACOMP] = arg0[i][ACOMP] * arg1[i][ACOMP] * scaleA;
          }
          break;
       case GL_ADD:
          if (textureUnit->EnvMode == GL_COMBINE4_NV) {
             /* (a * b) + (c * d) */
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
-            const GLchan (*arg3)[4] = (const GLchan (*)[4]) argA[3];
             for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
                rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] +
-                                 arg2[i][ACOMP] * arg3[i][ACOMP]) * Amult;
-#else
-               const GLint shift = CHAN_BITS - Ashift;
-               GLint a = (PROD(arg0[i][ACOMP], arg1[i][ACOMP]) >> shift) +
-                         (PROD(arg2[i][ACOMP], arg3[i][ACOMP]) >> shift);
-               rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX);
-#endif
+                                 arg2[i][ACOMP] * arg3[i][ACOMP]) * scaleA;
             }
          }
          else {
             /* two-term add */
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
             for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * Amult;
-#else
-               GLint a = ((GLint) arg0[i][ACOMP] + arg1[i][ACOMP]) << Ashift;
-               rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX);
-#endif
+               rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP]) * scaleA;
             }
          }
          break;
       case GL_ADD_SIGNED:
          if (textureUnit->EnvMode == GL_COMBINE4_NV) {
             /* (a * b) + (c * d) - 0.5 */
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
-            const GLchan (*arg3)[4] = (const GLchan (*)[4]) argA[3];
             for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
                rgba[i][ACOMP] = (arg0[i][ACOMP] * arg1[i][ACOMP] +
                                  arg2[i][ACOMP] * arg3[i][ACOMP] -
-                                 0.5) * Amult;
-#else
-               GLint a = (((PROD(arg0[i][ACOMP], arg1[i][ACOMP]) +
-                            PROD(arg2[i][ACOMP], arg3[i][ACOMP])) >> CHAN_BITS) - half)
-                          << Ashift;
-               rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
-#endif
+                                 0.5) * scaleA;
             }
          }
          else {
             /* a + b - 0.5 */
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
             for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * Amult;
-#else
-               GLint a = (GLint) arg0[i][ACOMP] + (GLint) arg1[i][ACOMP] -half;
-               a = (a < 0) ? 0 : a << Ashift;
-               rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
-#endif
+               rgba[i][ACOMP] = (arg0[i][ACOMP] + arg1[i][ACOMP] - 0.5F) * scaleA;
             }
          }
          break;
       case GL_INTERPOLATE:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - Ashift;
-#endif
-            for (i=0; i<n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][ACOMP] = (arg0[i][ACOMP] * arg2[i][ACOMP] +
-                                 arg1[i][ACOMP] * (CHAN_MAXF - arg2[i][ACOMP]))
-                                * Amult;
-#else
-               GLuint a = (PROD(arg0[i][ACOMP], arg2[i][ACOMP])
-                           + PROD(arg1[i][ACOMP], CHAN_MAX - arg2[i][ACOMP]))
-                              >> shift;
-               rgba[i][ACOMP] = (GLchan) MIN2(a, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][ACOMP] = (arg0[i][ACOMP] * arg2[i][ACOMP] +
+                              arg1[i][ACOMP] * (1.0F - arg2[i][ACOMP]))
+               * scaleA;
          }
          break;
       case GL_SUBTRACT:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][ACOMP] = (arg0[i][ACOMP] - arg1[i][ACOMP]) * Amult;
-#else
-               GLint a = ((GLint) arg0[i][ACOMP] - (GLint) arg1[i][ACOMP]) << Ashift;
-               rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][ACOMP] = (arg0[i][ACOMP] - arg1[i][ACOMP]) * scaleA;
          }
          break;
       case GL_MODULATE_ADD_ATI:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - Ashift;
-#endif
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP]) * Amult;
-#else
-               GLint a = (PROD(arg0[i][ACOMP], arg2[i][ACOMP])
-                          + ((GLuint) arg1[i][ACOMP] << CHAN_BITS))
-                   >> shift;
-               rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP])
+                              + arg1[i][ACOMP]) * scaleA;
          }
          break;
       case GL_MODULATE_SIGNED_ADD_ATI:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - Ashift;
-#endif
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) + arg1[i][ACOMP] - 0.5F) * Amult;
-#else
-               GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP])
-                         + (((GLint) arg1[i][ACOMP] - half) << CHAN_BITS))
-                   >> shift;
-               rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) +
+                              arg1[i][ACOMP] - 0.5F) * scaleA;
          }
          break;
       case GL_MODULATE_SUBTRACT_ATI:
-         {
-            const GLchan (*arg0)[4] = (const GLchan (*)[4]) argA[0];
-            const GLchan (*arg1)[4] = (const GLchan (*)[4]) argA[1];
-            const GLchan (*arg2)[4] = (const GLchan (*)[4]) argA[2];
-#if CHAN_TYPE != GL_FLOAT
-            const GLint shift = CHAN_BITS - Ashift;
-#endif
-            for (i = 0; i < n; i++) {
-#if CHAN_TYPE == GL_FLOAT
-               rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP]) - arg1[i][ACOMP]) * Amult;
-#else
-               GLint a = (S_PROD(arg0[i][ACOMP], arg2[i][ACOMP]) 
-                         - ((GLint) arg1[i][ACOMP] << CHAN_BITS))
-                   >> shift;
-               rgba[i][ACOMP] = (GLchan) CLAMP(a, 0, CHAN_MAX);
-#endif
-            }
+         for (i = 0; i < n; i++) {
+            rgba[i][ACOMP] = ((arg0[i][ACOMP] * arg2[i][ACOMP])
+                              - arg1[i][ACOMP]) * scaleA;
          }
          break;
       default:
          _mesa_problem(ctx, "invalid combine mode");
+      }
    }
 
    /* Fix the alpha component for GL_DOT3_RGBA_EXT/ARB combining.
@@ -825,14 +515,20 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n,
     * were written such that the GL_COMBINE_ALPHA value could be set to
     * GL_DOT3.
     */
-   if (textureUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA_EXT ||
-       textureUnit->_CurrentCombine->ModeRGB == GL_DOT3_RGBA) {
+   if (combine->ModeRGB == GL_DOT3_RGBA_EXT ||
+       combine->ModeRGB == GL_DOT3_RGBA) {
       for (i = 0; i < n; i++) {
         rgba[i][ACOMP] = rgba[i][RCOMP];
       }
    }
+
+   for (i = 0; i < n; i++) {
+      UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][RCOMP], rgba[i][RCOMP]);
+      UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][GCOMP], rgba[i][GCOMP]);
+      UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][BCOMP], rgba[i][BCOMP]);
+      UNCLAMPED_FLOAT_TO_CHAN(rgbaChan[i][ACOMP], rgba[i][ACOMP]);
+   }
 }
-#undef PROD
 
 
 /**
@@ -840,17 +536,17 @@ texture_combine( const GLcontext *ctx, GLuint unit, GLuint n,
  * See GL_EXT_texture_swizzle.
  */
 static void
-swizzle_texels(GLuint swizzle, GLuint count, GLchan (*texels)[4])
+swizzle_texels(GLuint swizzle, GLuint count, float4_array texels)
 {
    const GLuint swzR = GET_SWZ(swizzle, 0);
    const GLuint swzG = GET_SWZ(swizzle, 1);
    const GLuint swzB = GET_SWZ(swizzle, 2);
    const GLuint swzA = GET_SWZ(swizzle, 3);
-   GLchan vector[6];
+   GLfloat vector[6];
    GLuint i;
 
    vector[SWIZZLE_ZERO] = 0;
-   vector[SWIZZLE_ONE] = CHAN_MAX;
+   vector[SWIZZLE_ONE] = 1.0F;
 
    for (i = 0; i < count; i++) {
       vector[SWIZZLE_X] = texels[i][0];
@@ -866,394 +562,45 @@ swizzle_texels(GLuint swizzle, GLuint count, GLchan (*texels)[4])
 
 
 /**
- * Apply a conventional OpenGL texture env mode (REPLACE, ADD, BLEND,
- * MODULATE, or DECAL) to an array of fragments.
- * Input:  textureUnit - pointer to texture unit to apply
- *         format - base internal texture format
- *         n - number of fragments
- *         primary_rgba - primary colors (may alias rgba for single texture)
- *         texels - array of texel colors
- * InOut:  rgba - incoming fragment colors modified by texel colors
- *                according to the texture environment mode.
- */
-static void
-texture_apply( const GLcontext *ctx,
-               const struct gl_texture_unit *texUnit,
-               GLuint n,
-               CONST GLchan primary_rgba[][4], CONST GLchan texel[][4],
-               GLchan rgba[][4] )
-{
-   GLint baseLevel;
-   GLuint i;
-   GLchan Rc, Gc, Bc, Ac;
-   GLenum format;
-   (void) primary_rgba;
-
-   ASSERT(texUnit);
-   ASSERT(texUnit->_Current);
-
-   baseLevel = texUnit->_Current->BaseLevel;
-   ASSERT(texUnit->_Current->Image[0][baseLevel]);
-
-   format = texUnit->_Current->Image[0][baseLevel]->_BaseFormat;
-
-   if (format == GL_COLOR_INDEX || format == GL_YCBCR_MESA) {
-      format = GL_RGBA;  /* a bit of a hack */
-   }
-   else if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
-      format = texUnit->_Current->DepthMode;
-   }
-
-   switch (texUnit->EnvMode) {
-      case GL_REPLACE:
-        switch (format) {
-           case GL_ALPHA:
-              for (i=0;i<n;i++) {
-                 /* Cv = Cf */
-                  /* Av = At */
-                  rgba[i][ACOMP] = texel[i][ACOMP];
-              }
-              break;
-           case GL_LUMINANCE:
-              for (i=0;i<n;i++) {
-                 /* Cv = Lt */
-                  GLchan Lt = texel[i][RCOMP];
-                  rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = Lt;
-                  /* Av = Af */
-              }
-              break;
-           case GL_LUMINANCE_ALPHA:
-              for (i=0;i<n;i++) {
-                  GLchan Lt = texel[i][RCOMP];
-                 /* Cv = Lt */
-                 rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = Lt;
-                 /* Av = At */
-                 rgba[i][ACOMP] = texel[i][ACOMP];
-              }
-              break;
-           case GL_INTENSITY:
-              for (i=0;i<n;i++) {
-                 /* Cv = It */
-                  GLchan It = texel[i][RCOMP];
-                  rgba[i][RCOMP] = rgba[i][GCOMP] = rgba[i][BCOMP] = It;
-                  /* Av = It */
-                  rgba[i][ACOMP] = It;
-              }
-              break;
-           case GL_RGB:
-              for (i=0;i<n;i++) {
-                 /* Cv = Ct */
-                 rgba[i][RCOMP] = texel[i][RCOMP];
-                 rgba[i][GCOMP] = texel[i][GCOMP];
-                 rgba[i][BCOMP] = texel[i][BCOMP];
-                 /* Av = Af */
-              }
-              break;
-           case GL_RGBA:
-              for (i=0;i<n;i++) {
-                 /* Cv = Ct */
-                 rgba[i][RCOMP] = texel[i][RCOMP];
-                 rgba[i][GCOMP] = texel[i][GCOMP];
-                 rgba[i][BCOMP] = texel[i][BCOMP];
-                 /* Av = At */
-                 rgba[i][ACOMP] = texel[i][ACOMP];
-              }
-              break;
-            default:
-               _mesa_problem(ctx, "Bad format (GL_REPLACE) in texture_apply");
-               return;
-        }
-        break;
-
-      case GL_MODULATE:
-         switch (format) {
-           case GL_ALPHA:
-              for (i=0;i<n;i++) {
-                 /* Cv = Cf */
-                 /* Av = AfAt */
-                 rgba[i][ACOMP] = CHAN_PRODUCT( rgba[i][ACOMP], texel[i][ACOMP] );
-              }
-              break;
-           case GL_LUMINANCE:
-              for (i=0;i<n;i++) {
-                 /* Cv = LtCf */
-                  GLchan Lt = texel[i][RCOMP];
-                 rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], Lt );
-                 rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], Lt );
-                 rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], Lt );
-                 /* Av = Af */
-              }
-              break;
-           case GL_LUMINANCE_ALPHA:
-              for (i=0;i<n;i++) {
-                 /* Cv = CfLt */
-                  GLchan Lt = texel[i][RCOMP];
-                 rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], Lt );
-                 rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], Lt );
-                 rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], Lt );
-                 /* Av = AfAt */
-                 rgba[i][ACOMP] = CHAN_PRODUCT( rgba[i][ACOMP], texel[i][ACOMP] );
-              }
-              break;
-           case GL_INTENSITY:
-              for (i=0;i<n;i++) {
-                 /* Cv = CfIt */
-                  GLchan It = texel[i][RCOMP];
-                 rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], It );
-                 rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], It );
-                 rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], It );
-                 /* Av = AfIt */
-                 rgba[i][ACOMP] = CHAN_PRODUCT( rgba[i][ACOMP], It );
-              }
-              break;
-           case GL_RGB:
-              for (i=0;i<n;i++) {
-                 /* Cv = CfCt */
-                 rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], texel[i][RCOMP] );
-                 rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], texel[i][GCOMP] );
-                 rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], texel[i][BCOMP] );
-                 /* Av = Af */
-              }
-              break;
-           case GL_RGBA:
-              for (i=0;i<n;i++) {
-                 /* Cv = CfCt */
-                 rgba[i][RCOMP] = CHAN_PRODUCT( rgba[i][RCOMP], texel[i][RCOMP] );
-                 rgba[i][GCOMP] = CHAN_PRODUCT( rgba[i][GCOMP], texel[i][GCOMP] );
-                 rgba[i][BCOMP] = CHAN_PRODUCT( rgba[i][BCOMP], texel[i][BCOMP] );
-                 /* Av = AfAt */
-                 rgba[i][ACOMP] = CHAN_PRODUCT( rgba[i][ACOMP], texel[i][ACOMP] );
-              }
-              break;
-            default:
-               _mesa_problem(ctx, "Bad format (GL_MODULATE) in texture_apply");
-               return;
-        }
-        break;
-
-      case GL_DECAL:
-         switch (format) {
-            case GL_ALPHA:
-            case GL_LUMINANCE:
-            case GL_LUMINANCE_ALPHA:
-            case GL_INTENSITY:
-               /* undefined */
-               break;
-           case GL_RGB:
-              for (i=0;i<n;i++) {
-                 /* Cv = Ct */
-                 rgba[i][RCOMP] = texel[i][RCOMP];
-                 rgba[i][GCOMP] = texel[i][GCOMP];
-                 rgba[i][BCOMP] = texel[i][BCOMP];
-                 /* Av = Af */
-              }
-              break;
-           case GL_RGBA:
-              for (i=0;i<n;i++) {
-                 /* Cv = Cf(1-At) + CtAt */
-                 GLchan t = texel[i][ACOMP], s = CHAN_MAX - t;
-                 rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], s) + CHAN_PRODUCT(texel[i][RCOMP],t);
-                 rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], s) + CHAN_PRODUCT(texel[i][GCOMP],t);
-                 rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], s) + CHAN_PRODUCT(texel[i][BCOMP],t);
-                 /* Av = Af */
-              }
-              break;
-            default:
-               _mesa_problem(ctx, "Bad format (GL_DECAL) in texture_apply");
-               return;
-        }
-        break;
-
-      case GL_BLEND:
-         UNCLAMPED_FLOAT_TO_CHAN(Rc, texUnit->EnvColor[0]);
-         UNCLAMPED_FLOAT_TO_CHAN(Gc, texUnit->EnvColor[1]);
-         UNCLAMPED_FLOAT_TO_CHAN(Bc, texUnit->EnvColor[2]);
-         UNCLAMPED_FLOAT_TO_CHAN(Ac, texUnit->EnvColor[3]);
-        switch (format) {
-           case GL_ALPHA:
-              for (i=0;i<n;i++) {
-                 /* Cv = Cf */
-                 /* Av = AfAt */
-                  rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], texel[i][ACOMP]);
-              }
-              break;
-            case GL_LUMINANCE:
-              for (i=0;i<n;i++) {
-                 /* Cv = Cf(1-Lt) + CcLt */
-                 GLchan Lt = texel[i][RCOMP], s = CHAN_MAX - Lt;
-                 rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], s) + CHAN_PRODUCT(Rc, Lt);
-                 rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], s) + CHAN_PRODUCT(Gc, Lt);
-                 rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], s) + CHAN_PRODUCT(Bc, Lt);
-                 /* Av = Af */
-              }
-              break;
-           case GL_LUMINANCE_ALPHA:
-              for (i=0;i<n;i++) {
-                 /* Cv = Cf(1-Lt) + CcLt */
-                 GLchan Lt = texel[i][RCOMP], s = CHAN_MAX - Lt;
-                 rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], s) + CHAN_PRODUCT(Rc, Lt);
-                 rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], s) + CHAN_PRODUCT(Gc, Lt);
-                 rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], s) + CHAN_PRODUCT(Bc, Lt);
-                 /* Av = AfAt */
-                 rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP],texel[i][ACOMP]);
-              }
-              break;
-            case GL_INTENSITY:
-              for (i=0;i<n;i++) {
-                 /* Cv = Cf(1-It) + CcIt */
-                 GLchan It = texel[i][RCOMP], s = CHAN_MAX - It;
-                 rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], s) + CHAN_PRODUCT(Rc, It);
-                 rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], s) + CHAN_PRODUCT(Gc, It);
-                 rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], s) + CHAN_PRODUCT(Bc, It);
-                  /* Av = Af(1-It) + Ac*It */
-                  rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], s) + CHAN_PRODUCT(Ac, It);
-               }
-               break;
-           case GL_RGB:
-              for (i=0;i<n;i++) {
-                 /* Cv = Cf(1-Ct) + CcCt */
-                 rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], (CHAN_MAX-texel[i][RCOMP])) + CHAN_PRODUCT(Rc,texel[i][RCOMP]);
-                 rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], (CHAN_MAX-texel[i][GCOMP])) + CHAN_PRODUCT(Gc,texel[i][GCOMP]);
-                 rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], (CHAN_MAX-texel[i][BCOMP])) + CHAN_PRODUCT(Bc,texel[i][BCOMP]);
-                 /* Av = Af */
-              }
-              break;
-           case GL_RGBA:
-              for (i=0;i<n;i++) {
-                 /* Cv = Cf(1-Ct) + CcCt */
-                 rgba[i][RCOMP] = CHAN_PRODUCT(rgba[i][RCOMP], (CHAN_MAX-texel[i][RCOMP])) + CHAN_PRODUCT(Rc,texel[i][RCOMP]);
-                 rgba[i][GCOMP] = CHAN_PRODUCT(rgba[i][GCOMP], (CHAN_MAX-texel[i][GCOMP])) + CHAN_PRODUCT(Gc,texel[i][GCOMP]);
-                 rgba[i][BCOMP] = CHAN_PRODUCT(rgba[i][BCOMP], (CHAN_MAX-texel[i][BCOMP])) + CHAN_PRODUCT(Bc,texel[i][BCOMP]);
-                 /* Av = AfAt */
-                 rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP],texel[i][ACOMP]);
-              }
-              break;
-            default:
-               _mesa_problem(ctx, "Bad format (GL_BLEND) in texture_apply");
-               return;
-        }
-        break;
-
-     /* XXX don't clamp results if GLchan is float??? */
-
-      case GL_ADD:  /* GL_EXT_texture_add_env */
-         switch (format) {
-            case GL_ALPHA:
-               for (i=0;i<n;i++) {
-                  /* Rv = Rf */
-                  /* Gv = Gf */
-                  /* Bv = Bf */
-                  rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], texel[i][ACOMP]);
-               }
-               break;
-            case GL_LUMINANCE:
-               for (i=0;i<n;i++) {
-                  ChanTemp Lt = texel[i][RCOMP];
-                  ChanTemp r = rgba[i][RCOMP] + Lt;
-                  ChanTemp g = rgba[i][GCOMP] + Lt;
-                  ChanTemp b = rgba[i][BCOMP] + Lt;
-                  rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
-                  rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
-                  rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
-                  /* Av = Af */
-               }
-               break;
-            case GL_LUMINANCE_ALPHA:
-               for (i=0;i<n;i++) {
-                  ChanTemp Lt = texel[i][RCOMP];
-                  ChanTemp r = rgba[i][RCOMP] + Lt;
-                  ChanTemp g = rgba[i][GCOMP] + Lt;
-                  ChanTemp b = rgba[i][BCOMP] + Lt;
-                  rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
-                  rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
-                  rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
-                  rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], texel[i][ACOMP]);
-               }
-               break;
-            case GL_INTENSITY:
-               for (i=0;i<n;i++) {
-                  GLchan It = texel[i][RCOMP];
-                  ChanTemp r = rgba[i][RCOMP] + It;
-                  ChanTemp g = rgba[i][GCOMP] + It;
-                  ChanTemp b = rgba[i][BCOMP] + It;
-                  ChanTemp a = rgba[i][ACOMP] + It;
-                  rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
-                  rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
-                  rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
-                  rgba[i][ACOMP] = MIN2(a, CHAN_MAX);
-               }
-               break;
-           case GL_RGB:
-              for (i=0;i<n;i++) {
-                  ChanTemp r = rgba[i][RCOMP] + texel[i][RCOMP];
-                  ChanTemp g = rgba[i][GCOMP] + texel[i][GCOMP];
-                  ChanTemp b = rgba[i][BCOMP] + texel[i][BCOMP];
-                 rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
-                 rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
-                 rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
-                 /* Av = Af */
-              }
-              break;
-           case GL_RGBA:
-              for (i=0;i<n;i++) {
-                  ChanTemp r = rgba[i][RCOMP] + texel[i][RCOMP];
-                  ChanTemp g = rgba[i][GCOMP] + texel[i][GCOMP];
-                  ChanTemp b = rgba[i][BCOMP] + texel[i][BCOMP];
-                 rgba[i][RCOMP] = MIN2(r, CHAN_MAX);
-                 rgba[i][GCOMP] = MIN2(g, CHAN_MAX);
-                 rgba[i][BCOMP] = MIN2(b, CHAN_MAX);
-                  rgba[i][ACOMP] = CHAN_PRODUCT(rgba[i][ACOMP], texel[i][ACOMP]);
-               }
-               break;
-            default:
-               _mesa_problem(ctx, "Bad format (GL_ADD) in texture_apply");
-               return;
-        }
-        break;
-
-      default:
-         _mesa_problem(ctx, "Bad env mode in texture_apply");
-         return;
-   }
-}
-
-
-
-/**
  * Apply texture mapping to a span of fragments.
  */
 void
 _swrast_texture_span( GLcontext *ctx, SWspan *span )
 {
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
-   GLchan primary_rgba[MAX_WIDTH][4];
+   GLfloat primary_rgba[MAX_WIDTH][4];
    GLuint unit;
 
-   ASSERT(span->end < MAX_WIDTH);
+   ASSERT(span->end <= MAX_WIDTH);
 
    /*
     * Save copy of the incoming fragment colors (the GL_PRIMARY_COLOR)
     */
-   if (swrast->_AnyTextureCombine)
-      MEMCPY(primary_rgba, span->array->rgba, 4 * span->end * sizeof(GLchan));
+   if (swrast->_TextureCombinePrimary) {
+      GLuint i;
+      for (i = 0; i < span->end; i++) {
+         primary_rgba[i][RCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][RCOMP]);
+         primary_rgba[i][GCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][GCOMP]);
+         primary_rgba[i][BCOMP] = CHAN_TO_FLOAT(span->array->rgba[i][BCOMP]);
+         primary_rgba[i][ACOMP] = CHAN_TO_FLOAT(span->array->rgba[i][ACOMP]);
+      }
+   }
 
    /* First must sample all bump maps */
    for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
-      if (ctx->Texture.Unit[unit]._ReallyEnabled &&
-         ctx->Texture.Unit[unit]._CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) {
-         const GLfloat (*texcoords)[4]
-            = (const GLfloat (*)[4])
+      const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+
+      if (texUnit->_ReallyEnabled &&
+         texUnit->_CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) {
+         const GLfloat (*texcoords)[4] = (const GLfloat (*)[4])
             span->array->attribs[FRAG_ATTRIB_TEX0 + unit];
-         GLfloat (*targetcoords)[4]
-            = (GLfloat (*)[4])
+         float4_array targetcoords =
             span->array->attribs[FRAG_ATTRIB_TEX0 +
                ctx->Texture.Unit[unit].BumpTarget - GL_TEXTURE0];
 
-         const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
          const struct gl_texture_object *curObj = texUnit->_Current;
          GLfloat *lambda = span->array->lambda[unit];
-         GLchan (*texels)[4] = (GLchan (*)[4])
-            (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan)));
+         float4_array texels = get_texel_array(swrast, unit);
          GLuint i;
          GLfloat rotMatrix00 = ctx->Texture.Unit[unit].RotMatrix[0];
          GLfloat rotMatrix01 = ctx->Texture.Unit[unit].RotMatrix[1];
@@ -1293,19 +640,10 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span )
             not sure this can work correctly even ignoring
             the problem that channel is unsigned */
          for (i = 0; i < span->end; i++) {
-#if CHAN_TYPE == GL_FLOAT
             targetcoords[i][0] += (texels[i][0] * rotMatrix00 + texels[i][1] *
                                   rotMatrix01) / targetcoords[i][3];
             targetcoords[i][1] += (texels[i][0] * rotMatrix10 + texels[i][1] *
                                   rotMatrix11) / targetcoords[i][3];
-#else
-            targetcoords[i][0] += (CHAN_TO_FLOAT(texels[i][1]) * rotMatrix00 +
-                                  CHAN_TO_FLOAT(texels[i][1]) * rotMatrix01) /
-                                  targetcoords[i][3];
-            targetcoords[i][1] += (CHAN_TO_FLOAT(texels[i][0]) * rotMatrix10 + 
-                                  CHAN_TO_FLOAT(texels[i][1]) * rotMatrix11) /
-                                  targetcoords[i][3];
-#endif
          }
       }
    }
@@ -1315,16 +653,14 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span )
     * accomodate GL_ARB_texture_env_crossbar.
     */
    for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
-      if (ctx->Texture.Unit[unit]._ReallyEnabled &&
-         ctx->Texture.Unit[unit]._CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) {
-         const GLfloat (*texcoords)[4]
-            = (const GLfloat (*)[4])
+      const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
+      if (texUnit->_ReallyEnabled &&
+          texUnit->_CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) {
+         const GLfloat (*texcoords)[4] = (const GLfloat (*)[4])
             span->array->attribs[FRAG_ATTRIB_TEX0 + unit];
-         const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
          const struct gl_texture_object *curObj = texUnit->_Current;
          GLfloat *lambda = span->array->lambda[unit];
-         GLchan (*texels)[4] = (GLchan (*)[4])
-            (swrast->TexelBuffer + unit * (span->end * 4 * sizeof(GLchan)));
+         float4_array texels = get_texel_array(swrast, unit);
 
          /* adjust texture lod (lambda) */
          if (span->arrayMask & SPAN_LAMBDA) {
@@ -1357,13 +693,7 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span )
 
          /* GL_SGI_texture_color_table */
          if (texUnit->ColorTableEnabled) {
-#if CHAN_TYPE == GL_UNSIGNED_BYTE
-            _mesa_lookup_rgba_ubyte(&texUnit->ColorTable, span->end, texels);
-#elif CHAN_TYPE == GL_UNSIGNED_SHORT
-            _mesa_lookup_rgba_ubyte(&texUnit->ColorTable, span->end, texels);
-#else
             _mesa_lookup_rgba_float(&texUnit->ColorTable, span->end, texels);
-#endif
          }
 
          /* GL_EXT_texture_swizzle */
@@ -1373,31 +703,16 @@ _swrast_texture_span( GLcontext *ctx, SWspan *span )
       }
    }
 
-
    /*
     * OK, now apply the texture (aka texture combine/blend).
     * We modify the span->color.rgba values.
     */
    for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
       if (ctx->Texture.Unit[unit]._ReallyEnabled) {
-         const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
-         if (texUnit->_CurrentCombine != &texUnit->_EnvMode ) {
-            texture_combine( ctx, unit, span->end,
-                             (CONST GLchan (*)[4]) primary_rgba,
-                             swrast->TexelBuffer,
-                             span->array->rgba );
-         }
-         else {
-            /* conventional texture blend */
-            const GLchan (*texels)[4] = (const GLchan (*)[4])
-               (swrast->TexelBuffer + unit *
-                (span->end * 4 * sizeof(GLchan)));
-
-
-            texture_apply( ctx, texUnit, span->end,
-                           (CONST GLchan (*)[4]) primary_rgba, texels,
-                           span->array->rgba );
-         }
+         texture_combine( ctx, unit, span->end,
+                          primary_rgba,
+                          swrast->TexelBuffer,
+                          span->array->rgba );
       }
    }
 }
index 19317c3..a483023 100644 (file)
 #define FRAC(f)  ((f) - IFLOOR(f))
 
 
-/**
- * Constants for integer linear interpolation.
- */
-#define ILERP_SCALE 65536.0F
-#define ILERP_SHIFT 16
-
 
 /**
- * Linear interpolation macros
+ * Linear interpolation macro
  */
 #define LERP(T, A, B)  ( (A) + (T) * ((B) - (A)) )
-#define ILERP(IT, A, B)  ( (A) + (((IT) * ((B) - (A))) >> ILERP_SHIFT) )
 
 
 /**
@@ -76,21 +69,6 @@ lerp_2d(GLfloat a, GLfloat b,
 
 
 /**
- * Do 2D/biliner interpolation of integer values.
- * \sa lerp_2d
- */
-static INLINE GLint
-ilerp_2d(GLint ia, GLint ib,
-         GLint v00, GLint v10, GLint v01, GLint v11)
-{
-   /* fixed point interpolants in [0, ILERP_SCALE] */
-   const GLint temp0 = ILERP(ia, v00, v10);
-   const GLint temp1 = ILERP(ia, v01, v11);
-   return ILERP(ib, temp0, temp1);
-}
-
-
-/**
  * Do 3D/trilinear interpolation of float values.
  * \sa lerp_2d
  */
@@ -110,50 +88,15 @@ lerp_3d(GLfloat a, GLfloat b, GLfloat c,
 
 
 /**
- * Do 3D/trilinear interpolation of integer values.
- * \sa lerp_2d
- */
-static INLINE GLint
-ilerp_3d(GLint ia, GLint ib, GLint ic,
-         GLint v000, GLint v100, GLint v010, GLint v110,
-         GLint v001, GLint v101, GLint v011, GLint v111)
-{
-   /* fixed point interpolants in [0, ILERP_SCALE] */
-   const GLint temp00 = ILERP(ia, v000, v100);
-   const GLint temp10 = ILERP(ia, v010, v110);
-   const GLint temp01 = ILERP(ia, v001, v101);
-   const GLint temp11 = ILERP(ia, v011, v111);
-   const GLint temp0 = ILERP(ib, temp00, temp10);
-   const GLint temp1 = ILERP(ib, temp01, temp11);
-   return ILERP(ic, temp0, temp1);
-}
-
-
-/**
  * Do linear interpolation of colors.
  */
 static INLINE void
-lerp_rgba(GLchan result[4], GLfloat t, const GLchan a[4], const GLchan b[4])
+lerp_rgba(GLfloat result[4], GLfloat t, const GLfloat a[4], const GLfloat b[4])
 {
-#if CHAN_TYPE == GL_FLOAT
    result[0] = LERP(t, a[0], b[0]);
    result[1] = LERP(t, a[1], b[1]);
    result[2] = LERP(t, a[2], b[2]);
    result[3] = LERP(t, a[3], b[3]);
-#elif CHAN_TYPE == GL_UNSIGNED_SHORT
-   result[0] = (GLchan) (LERP(t, a[0], b[0]) + 0.5);
-   result[1] = (GLchan) (LERP(t, a[1], b[1]) + 0.5);
-   result[2] = (GLchan) (LERP(t, a[2], b[2]) + 0.5);
-   result[3] = (GLchan) (LERP(t, a[3], b[3]) + 0.5);
-#else
-   /* fixed point interpolants in [0, ILERP_SCALE] */
-   const GLint it = IROUND_POS(t * ILERP_SCALE);
-   ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE);
-   result[0] = ILERP(it, a[0], b[0]);
-   result[1] = ILERP(it, a[1], b[1]);
-   result[2] = ILERP(it, a[2], b[2]);
-   result[3] = ILERP(it, a[3], b[3]);
-#endif
 }
 
 
@@ -161,29 +104,14 @@ lerp_rgba(GLchan result[4], GLfloat t, const GLchan a[4], const GLchan b[4])
  * Do bilinear interpolation of colors.
  */
 static INLINE void
-lerp_rgba_2d(GLchan result[4], GLfloat a, GLfloat b,
-             const GLchan t00[4], const GLchan t10[4],
-             const GLchan t01[4], const GLchan t11[4])
+lerp_rgba_2d(GLfloat result[4], GLfloat a, GLfloat b,
+             const GLfloat t00[4], const GLfloat t10[4],
+             const GLfloat t01[4], const GLfloat t11[4])
 {
-#if CHAN_TYPE == GL_FLOAT
    result[0] = lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]);
    result[1] = lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]);
    result[2] = lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]);
    result[3] = lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]);
-#elif CHAN_TYPE == GL_UNSIGNED_SHORT
-   result[0] = (GLchan) (lerp_2d(a, b, t00[0], t10[0], t01[0], t11[0]) + 0.5);
-   result[1] = (GLchan) (lerp_2d(a, b, t00[1], t10[1], t01[1], t11[1]) + 0.5);
-   result[2] = (GLchan) (lerp_2d(a, b, t00[2], t10[2], t01[2], t11[2]) + 0.5);
-   result[3] = (GLchan) (lerp_2d(a, b, t00[3], t10[3], t01[3], t11[3]) + 0.5);
-#else
-   const GLint ia = IROUND_POS(a * ILERP_SCALE);
-   const GLint ib = IROUND_POS(b * ILERP_SCALE);
-   ASSERT(CHAN_TYPE == GL_UNSIGNED_BYTE);
-   result[0] = ilerp_2d(ia, ib, t00[0], t10[0], t01[0], t11[0]);
-   result[1] = ilerp_2d(ia, ib, t00[1], t10[1], t01[1], t11[1]);
-   result[2] = ilerp_2d(ia, ib, t00[2], t10[2], t01[2], t11[2]);
-   result[3] = ilerp_2d(ia, ib, t00[3], t10[3], t01[3], t11[3]);
-#endif
 }
 
 
@@ -191,34 +119,18 @@ lerp_rgba_2d(GLchan result[4], GLfloat a, GLfloat b,
  * Do trilinear interpolation of colors.
  */
 static INLINE void
-lerp_rgba_3d(GLchan result[4], GLfloat a, GLfloat b, GLfloat c,
-             const GLchan t000[4], const GLchan t100[4],
-             const GLchan t010[4], const GLchan t110[4],
-             const GLchan t001[4], const GLchan t101[4],
-             const GLchan t011[4], const GLchan t111[4])
+lerp_rgba_3d(GLfloat result[4], GLfloat a, GLfloat b, GLfloat c,
+             const GLfloat t000[4], const GLfloat t100[4],
+             const GLfloat t010[4], const GLfloat t110[4],
+             const GLfloat t001[4], const GLfloat t101[4],
+             const GLfloat t011[4], const GLfloat t111[4])
 {
    GLuint k;
    /* compiler should unroll these short loops */
-#if CHAN_TYPE == GL_FLOAT
    for (k = 0; k < 4; k++) {
       result[k] = lerp_3d(a, b, c, t000[k], t100[k], t010[k], t110[k],
                                    t001[k], t101[k], t011[k], t111[k]);
    }
-#elif CHAN_TYPE == GL_UNSIGNED_SHORT
-   for (k = 0; k < 4; k++) {
-      result[k] = (GLchan)(lerp_3d(a, b, c,
-                                   t000[k], t100[k], t010[k], t110[k],
-                                   t001[k], t101[k], t011[k], t111[k]) + 0.5F);
-   }
-#else
-   GLint ia = IROUND_POS(a * ILERP_SCALE);
-   GLint ib = IROUND_POS(b * ILERP_SCALE);
-   GLint ic = IROUND_POS(c * ILERP_SCALE);
-   for (k = 0; k < 4; k++) {
-      result[k] = ilerp_3d(ia, ib, ic, t000[k], t100[k], t010[k], t110[k],
-                                       t001[k], t101[k], t011[k], t111[k]);
-   }
-#endif
 }
 
 
@@ -502,6 +414,168 @@ linear_repeat_texel_location(GLuint size, GLfloat s,
 
 
 /**
+ * Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode.
+ */
+static INLINE GLint
+clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max)
+{
+   switch (wrapMode) {
+   case GL_CLAMP:
+      return IFLOOR( CLAMP(coord, 0.0F, max - 1) );
+   case GL_CLAMP_TO_EDGE:
+      return IFLOOR( CLAMP(coord, 0.5F, max - 0.5F) );
+   case GL_CLAMP_TO_BORDER:
+      return IFLOOR( CLAMP(coord, -0.5F, max + 0.5F) );
+   default:
+      _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_nearest");
+      return 0;
+   }
+}
+
+
+/**
+ * As above, but GL_LINEAR filtering.
+ */
+static INLINE void
+clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
+                        GLint *i0out, GLint *i1out, GLfloat *weight)
+{
+   GLfloat fcol;
+   GLint i0, i1;
+   switch (wrapMode) {
+   case GL_CLAMP:
+      /* Not exactly what the spec says, but it matches NVIDIA output */
+      fcol = CLAMP(coord - 0.5F, 0.0, max-1);
+      i0 = IFLOOR(fcol);
+      i1 = i0 + 1;
+      break;
+   case GL_CLAMP_TO_EDGE:
+      fcol = CLAMP(coord, 0.5F, max - 0.5F);
+      fcol -= 0.5F;
+      i0 = IFLOOR(fcol);
+      i1 = i0 + 1;
+      if (i1 > max - 1)
+         i1 = max - 1;
+      break;
+   case GL_CLAMP_TO_BORDER:
+      fcol = CLAMP(coord, -0.5F, max + 0.5F);
+      fcol -= 0.5F;
+      i0 = IFLOOR(fcol);
+      i1 = i0 + 1;
+   default:
+      _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_linear");
+      i0 = i1 = 0;
+      fcol = 0.0F;
+   }
+   *i0out = i0;
+   *i1out = i1;
+   *weight = FRAC(fcol);
+}
+
+
+/**
+ * Compute nearest integer texcoords for given texobj and coordinate.
+ */
+static INLINE void
+nearest_texcoord(const struct gl_texture_object *texObj,
+                 const GLfloat texcoord[4],
+                 GLint *i, GLint *j, GLint *k)
+{
+   const GLint baseLevel = texObj->BaseLevel;
+   const struct gl_texture_image *img = texObj->Image[0][baseLevel];
+   const GLint width = img->Width;
+   const GLint height = img->Height;
+   const GLint depth = img->Depth;
+
+   switch (texObj->Target) {
+   case GL_TEXTURE_RECTANGLE_ARB:
+      *i = clamp_rect_coord_nearest(texObj->WrapS, texcoord[0], width);
+      *j = clamp_rect_coord_nearest(texObj->WrapT, texcoord[1], height);
+      *k = 0;
+      break;
+   case GL_TEXTURE_1D:
+      *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]);
+      *j = 0;
+      *k = 0;
+      break;
+   case GL_TEXTURE_2D:
+      *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]);
+      *j = nearest_texel_location(texObj->WrapT, img, height, texcoord[1]);
+      *k = 0;
+      break;
+   case GL_TEXTURE_1D_ARRAY_EXT:
+      *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]);
+      *j = clamp_rect_coord_nearest(texObj->WrapT, texcoord[1], height);
+      *k = 0;
+      break;
+   case GL_TEXTURE_2D_ARRAY_EXT:
+      *i = nearest_texel_location(texObj->WrapS, img, width, texcoord[0]);
+      *j = nearest_texel_location(texObj->WrapT, img, height, texcoord[1]);
+      *k = clamp_rect_coord_nearest(texObj->WrapR, texcoord[2], depth);
+      break;
+   default:
+      *i = *j = *k = 0;
+   }
+}
+
+
+/**
+ * Compute linear integer texcoords for given texobj and coordinate.
+ */
+static INLINE void
+linear_texcoord(const struct gl_texture_object *texObj,
+                const GLfloat texcoord[4],
+                GLint *i0, GLint *i1, GLint *j0, GLint *j1, GLint *slice,
+                GLfloat *wi, GLfloat *wj)
+{
+   const GLint baseLevel = texObj->BaseLevel;
+   const struct gl_texture_image *img = texObj->Image[0][baseLevel];
+   const GLint width = img->Width;
+   const GLint height = img->Height;
+   const GLint depth = img->Depth;
+
+   switch (texObj->Target) {
+   case GL_TEXTURE_RECTANGLE_ARB:
+      clamp_rect_coord_linear(texObj->WrapS, texcoord[0],
+                              width, i0, i1, wi);
+      clamp_rect_coord_linear(texObj->WrapT, texcoord[1],
+                              height, j0, j1, wj);
+      *slice = 0;
+      break;
+
+   case GL_TEXTURE_1D:
+   case GL_TEXTURE_2D:
+      linear_texel_locations(texObj->WrapS, img, width,
+                             texcoord[0], i0, i1, wi);
+      linear_texel_locations(texObj->WrapT, img, height,
+                             texcoord[1], j0, j1, wj);
+      *slice = 0;
+      break;
+
+   case GL_TEXTURE_1D_ARRAY_EXT:
+      linear_texel_locations(texObj->WrapS, img, width,
+                             texcoord[0], i0, i1, wi);
+      *j0 = clamp_rect_coord_nearest(texObj->WrapT, texcoord[1], height);
+      *j1 = *j0;
+      *slice = 0;
+      break;
+
+   case GL_TEXTURE_2D_ARRAY_EXT:
+      linear_texel_locations(texObj->WrapS, img, width,
+                             texcoord[0], i0, i1, wi);
+      linear_texel_locations(texObj->WrapT, img, height,
+                             texcoord[1], j0, j1, wj);
+      *slice = clamp_rect_coord_nearest(texObj->WrapR, texcoord[2], depth);
+      break;
+
+   default:
+      *slice = 0;
+   }
+}
+
+
+
+/**
  * For linear interpolation between mipmap levels N and N+1, this function
  * computes N.
  */
@@ -660,6 +734,44 @@ compute_min_mag_ranges(const struct gl_texture_object *tObj,
 }
 
 
+/**
+ * When we sample the border color, it must be interpreted according to
+ * the base texture format.  Ex: if the texture base format it GL_ALPHA,
+ * we return (0,0,0,BorderAlpha).
+ */
+static INLINE void
+get_border_color(const struct gl_texture_object *tObj,
+                 const struct gl_texture_image *img,
+                 GLfloat rgba[4])
+{
+   switch (img->TexFormat->BaseFormat) {
+   case GL_RGB:
+      rgba[0] = tObj->BorderColor[0];
+      rgba[1] = tObj->BorderColor[1];
+      rgba[2] = tObj->BorderColor[2];
+      rgba[3] = 1.0F;
+      break;
+   case GL_ALPHA:
+      rgba[0] = rgba[1] = rgba[2] = 0.0;
+      rgba[3] = tObj->BorderColor[3];
+      break;
+   case GL_LUMINANCE:
+      rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor[0];
+      rgba[3] = 1.0;
+      break;
+   case GL_LUMINANCE_ALPHA:
+      rgba[0] = rgba[1] = rgba[2] = tObj->BorderColor[0];
+      rgba[3] = tObj->BorderColor[3];
+      break;
+   case GL_INTENSITY:
+      rgba[0] = rgba[1] = rgba[2] = rgba[3] = tObj->BorderColor[0];
+      break;
+   default:
+      COPY_4V(rgba, tObj->BorderColor);
+   }
+}
+
+
 /**********************************************************************/
 /*                    1-D Texture Sampling Functions                  */
 /**********************************************************************/
@@ -671,7 +783,7 @@ static INLINE void
 sample_1d_nearest(GLcontext *ctx,
                   const struct gl_texture_object *tObj,
                   const struct gl_texture_image *img,
-                  const GLfloat texcoord[4], GLchan rgba[4])
+                  const GLfloat texcoord[4], GLfloat rgba[4])
 {
    const GLint width = img->Width2;  /* without border, power of two */
    GLint i;
@@ -680,10 +792,10 @@ sample_1d_nearest(GLcontext *ctx,
    i += img->Border;
    if (i < 0 || i >= (GLint) img->Width) {
       /* Need this test for GL_CLAMP_TO_BORDER mode */
-      COPY_CHAN4(rgba, tObj->_BorderChan);
+      get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelc(img, i, 0, 0, rgba);
+      img->FetchTexelf(img, i, 0, 0, rgba);
    }
 }
 
@@ -695,13 +807,13 @@ static INLINE void
 sample_1d_linear(GLcontext *ctx,
                  const struct gl_texture_object *tObj,
                  const struct gl_texture_image *img,
-                 const GLfloat texcoord[4], GLchan rgba[4])
+                 const GLfloat texcoord[4], GLfloat rgba[4])
 {
    const GLint width = img->Width2;
    GLint i0, i1;
    GLbitfield useBorderColor = 0x0;
    GLfloat a;
-   GLchan t0[4], t1[4];  /* texels */
+   GLfloat t0[4], t1[4];  /* texels */
 
    linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a);
 
@@ -716,16 +828,16 @@ sample_1d_linear(GLcontext *ctx,
 
    /* fetch texel colors */
    if (useBorderColor & I0BIT) {
-      COPY_CHAN4(t0, tObj->_BorderChan);
+      get_border_color(tObj, img, t0);
    }
    else {
-      img->FetchTexelc(img, i0, 0, 0, t0);
+      img->FetchTexelf(img, i0, 0, 0, t0);
    }
    if (useBorderColor & I1BIT) {
-      COPY_CHAN4(t1, tObj->_BorderChan);
+      get_border_color(tObj, img, t1);
    }
    else {
-      img->FetchTexelc(img, i1, 0, 0, t1);
+      img->FetchTexelf(img, i1, 0, 0, t1);
    }
 
    lerp_rgba(rgba, a, t0, t1);
@@ -736,7 +848,7 @@ static void
 sample_1d_nearest_mipmap_nearest(GLcontext *ctx,
                                  const struct gl_texture_object *tObj,
                                  GLuint n, const GLfloat texcoord[][4],
-                                 const GLfloat lambda[], GLchan rgba[][4])
+                                 const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -751,7 +863,7 @@ static void
 sample_1d_linear_mipmap_nearest(GLcontext *ctx,
                                 const struct gl_texture_object *tObj,
                                 GLuint n, const GLfloat texcoord[][4],
-                                const GLfloat lambda[], GLchan rgba[][4])
+                                const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -766,7 +878,7 @@ static void
 sample_1d_nearest_mipmap_linear(GLcontext *ctx,
                                 const struct gl_texture_object *tObj,
                                 GLuint n, const GLfloat texcoord[][4],
-                                const GLfloat lambda[], GLchan rgba[][4])
+                                const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -777,7 +889,7 @@ sample_1d_nearest_mipmap_linear(GLcontext *ctx,
                            texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];
+         GLfloat t0[4], t1[4];
          const GLfloat f = FRAC(lambda[i]);
          sample_1d_nearest(ctx, tObj, tObj->Image[0][level  ], texcoord[i], t0);
          sample_1d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
@@ -791,7 +903,7 @@ static void
 sample_1d_linear_mipmap_linear(GLcontext *ctx,
                                const struct gl_texture_object *tObj,
                                GLuint n, const GLfloat texcoord[][4],
-                               const GLfloat lambda[], GLchan rgba[][4])
+                               const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -802,7 +914,7 @@ sample_1d_linear_mipmap_linear(GLcontext *ctx,
                           texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];
+         GLfloat t0[4], t1[4];
          const GLfloat f = FRAC(lambda[i]);
          sample_1d_linear(ctx, tObj, tObj->Image[0][level  ], texcoord[i], t0);
          sample_1d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
@@ -817,7 +929,7 @@ static void
 sample_nearest_1d( GLcontext *ctx,
                    const struct gl_texture_object *tObj, GLuint n,
                    const GLfloat texcoords[][4], const GLfloat lambda[],
-                   GLchan rgba[][4] )
+                   GLfloat rgba[][4] )
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -833,7 +945,7 @@ static void
 sample_linear_1d( GLcontext *ctx,
                   const struct gl_texture_object *tObj, GLuint n,
                   const GLfloat texcoords[][4], const GLfloat lambda[],
-                  GLchan rgba[][4] )
+                  GLfloat rgba[][4] )
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -849,7 +961,7 @@ static void
 sample_lambda_1d( GLcontext *ctx,
                   const struct gl_texture_object *tObj, GLuint n,
                   const GLfloat texcoords[][4],
-                  const GLfloat lambda[], GLchan rgba[][4] )
+                  const GLfloat lambda[], GLfloat rgba[][4] )
 {
    GLuint minStart, minEnd;  /* texels with minification */
    GLuint magStart, magEnd;  /* texels with magnification */
@@ -929,7 +1041,7 @@ sample_2d_nearest(GLcontext *ctx,
                   const struct gl_texture_object *tObj,
                   const struct gl_texture_image *img,
                   const GLfloat texcoord[4],
-                  GLchan rgba[])
+                  GLfloat rgba[])
 {
    const GLint width = img->Width2;    /* without border, power of two */
    const GLint height = img->Height2;  /* without border, power of two */
@@ -945,10 +1057,10 @@ sample_2d_nearest(GLcontext *ctx,
 
    if (i < 0 || i >= (GLint) img->Width || j < 0 || j >= (GLint) img->Height) {
       /* Need this test for GL_CLAMP_TO_BORDER mode */
-      COPY_CHAN4(rgba, tObj->_BorderChan);
+      get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelc(img, i, j, 0, rgba);
+      img->FetchTexelf(img, i, j, 0, rgba);
    }
 }
 
@@ -962,14 +1074,14 @@ sample_2d_linear(GLcontext *ctx,
                  const struct gl_texture_object *tObj,
                  const struct gl_texture_image *img,
                  const GLfloat texcoord[4],
-                 GLchan rgba[])
+                 GLfloat rgba[])
 {
    const GLint width = img->Width2;
    const GLint height = img->Height2;
    GLint i0, j0, i1, j1;
    GLbitfield useBorderColor = 0x0;
    GLfloat a, b;
-   GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */
+   GLfloat t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */
 
    linear_texel_locations(tObj->WrapS, img, width, texcoord[0],  &i0, &i1, &a);
    linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b);
@@ -989,28 +1101,28 @@ sample_2d_linear(GLcontext *ctx,
 
    /* fetch four texel colors */
    if (useBorderColor & (I0BIT | J0BIT)) {
-      COPY_CHAN4(t00, tObj->_BorderChan);
+      get_border_color(tObj, img, t00);
    }
    else {
-      img->FetchTexelc(img, i0, j0, 0, t00);
+      img->FetchTexelf(img, i0, j0, 0, t00);
    }
    if (useBorderColor & (I1BIT | J0BIT)) {
-      COPY_CHAN4(t10, tObj->_BorderChan);
+      get_border_color(tObj, img, t10);
    }
    else {
-      img->FetchTexelc(img, i1, j0, 0, t10);
+      img->FetchTexelf(img, i1, j0, 0, t10);
    }
    if (useBorderColor & (I0BIT | J1BIT)) {
-      COPY_CHAN4(t01, tObj->_BorderChan);
+      get_border_color(tObj, img, t01);
    }
    else {
-      img->FetchTexelc(img, i0, j1, 0, t01);
+      img->FetchTexelf(img, i0, j1, 0, t01);
    }
    if (useBorderColor & (I1BIT | J1BIT)) {
-      COPY_CHAN4(t11, tObj->_BorderChan);
+      get_border_color(tObj, img, t11);
    }
    else {
-      img->FetchTexelc(img, i1, j1, 0, t11);
+      img->FetchTexelf(img, i1, j1, 0, t11);
    }
 
    lerp_rgba_2d(rgba, a, b, t00, t10, t01, t11);
@@ -1026,13 +1138,13 @@ sample_2d_linear_repeat(GLcontext *ctx,
                         const struct gl_texture_object *tObj,
                         const struct gl_texture_image *img,
                         const GLfloat texcoord[4],
-                        GLchan rgba[])
+                        GLfloat rgba[])
 {
    const GLint width = img->Width2;
    const GLint height = img->Height2;
    GLint i0, j0, i1, j1;
    GLfloat wi, wj;
-   GLchan t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */
+   GLfloat t00[4], t10[4], t01[4], t11[4]; /* sampled texel colors */
 
    (void) ctx;
 
@@ -1045,10 +1157,10 @@ sample_2d_linear_repeat(GLcontext *ctx,
    linear_repeat_texel_location(width,  texcoord[0], &i0, &i1, &wi);
    linear_repeat_texel_location(height, texcoord[1], &j0, &j1, &wj);
 
-   img->FetchTexelc(img, i0, j0, 0, t00);
-   img->FetchTexelc(img, i1, j0, 0, t10);
-   img->FetchTexelc(img, i0, j1, 0, t01);
-   img->FetchTexelc(img, i1, j1, 0, t11);
+   img->FetchTexelf(img, i0, j0, 0, t00);
+   img->FetchTexelf(img, i1, j0, 0, t10);
+   img->FetchTexelf(img, i0, j1, 0, t01);
+   img->FetchTexelf(img, i1, j1, 0, t11);
 
    lerp_rgba_2d(rgba, wi, wj, t00, t10, t01, t11);
 }
@@ -1058,7 +1170,7 @@ static void
 sample_2d_nearest_mipmap_nearest(GLcontext *ctx,
                                  const struct gl_texture_object *tObj,
                                  GLuint n, const GLfloat texcoord[][4],
-                                 const GLfloat lambda[], GLchan rgba[][4])
+                                 const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    for (i = 0; i < n; i++) {
@@ -1072,7 +1184,7 @@ static void
 sample_2d_linear_mipmap_nearest(GLcontext *ctx,
                                 const struct gl_texture_object *tObj,
                                 GLuint n, const GLfloat texcoord[][4],
-                                const GLfloat lambda[], GLchan rgba[][4])
+                                const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1087,7 +1199,7 @@ static void
 sample_2d_nearest_mipmap_linear(GLcontext *ctx,
                                 const struct gl_texture_object *tObj,
                                 GLuint n, const GLfloat texcoord[][4],
-                                const GLfloat lambda[], GLchan rgba[][4])
+                                const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1098,7 +1210,7 @@ sample_2d_nearest_mipmap_linear(GLcontext *ctx,
                            texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_2d_nearest(ctx, tObj, tObj->Image[0][level  ], texcoord[i], t0);
          sample_2d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
@@ -1112,7 +1224,7 @@ static void
 sample_2d_linear_mipmap_linear( GLcontext *ctx,
                                 const struct gl_texture_object *tObj,
                                 GLuint n, const GLfloat texcoord[][4],
-                                const GLfloat lambda[], GLchan rgba[][4] )
+                                const GLfloat lambda[], GLfloat rgba[][4] )
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1123,7 +1235,7 @@ sample_2d_linear_mipmap_linear( GLcontext *ctx,
                           texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_2d_linear(ctx, tObj, tObj->Image[0][level  ], texcoord[i], t0);
          sample_2d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
@@ -1137,7 +1249,7 @@ static void
 sample_2d_linear_mipmap_linear_repeat(GLcontext *ctx,
                                       const struct gl_texture_object *tObj,
                                       GLuint n, const GLfloat texcoord[][4],
-                                      const GLfloat lambda[], GLchan rgba[][4])
+                                      const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1150,7 +1262,7 @@ sample_2d_linear_mipmap_linear_repeat(GLcontext *ctx,
                                  texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_2d_linear_repeat(ctx, tObj, tObj->Image[0][level  ],
                                  texcoord[i], t0);
@@ -1167,7 +1279,7 @@ static void
 sample_nearest_2d(GLcontext *ctx,
                   const struct gl_texture_object *tObj, GLuint n,
                   const GLfloat texcoords[][4],
-                  const GLfloat lambda[], GLchan rgba[][4])
+                  const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -1183,7 +1295,7 @@ static void
 sample_linear_2d(GLcontext *ctx,
                  const struct gl_texture_object *tObj, GLuint n,
                  const GLfloat texcoords[][4],
-                 const GLfloat lambda[], GLchan rgba[][4])
+                 const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -1279,7 +1391,7 @@ opt_sample_rgba_2d(GLcontext *ctx,
       const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask;
       const GLint pos = (row << shift) | col;
       const GLchan *texel = ((GLchan *) img->Data) + (pos << 2);    /* pos*4 */
-      COPY_CHAN4(rgba[i], texel);
+      COPY_4V(rgba[i], texel);
    }
 }
 
@@ -1289,7 +1401,7 @@ static void
 sample_lambda_2d(GLcontext *ctx,
                  const struct gl_texture_object *tObj,
                  GLuint n, const GLfloat texcoords[][4],
-                 const GLfloat lambda[], GLchan rgba[][4])
+                 const GLfloat lambda[], GLfloat rgba[][4])
 {
    const struct gl_texture_image *tImg = tObj->Image[0][tObj->BaseLevel];
    GLuint minStart, minEnd;  /* texels with minification */
@@ -1312,6 +1424,7 @@ sample_lambda_2d(GLcontext *ctx,
       case GL_NEAREST:
          if (repeatNoBorderPOT) {
             switch (tImg->TexFormat->MesaFormat) {
+#if 0
             case MESA_FORMAT_RGB:
                opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart,
                                  NULL, rgba + minStart);
@@ -1320,6 +1433,7 @@ sample_lambda_2d(GLcontext *ctx,
               opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart,
                                   NULL, rgba + minStart);
                break;
+#endif
             default:
                sample_nearest_2d(ctx, tObj, m, texcoords + minStart,
                                  NULL, rgba + minStart );
@@ -1369,6 +1483,7 @@ sample_lambda_2d(GLcontext *ctx,
       case GL_NEAREST:
          if (repeatNoBorderPOT) {
             switch (tImg->TexFormat->MesaFormat) {
+#if 0
             case MESA_FORMAT_RGB:
                opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart,
                                  NULL, rgba + magStart);
@@ -1377,6 +1492,7 @@ sample_lambda_2d(GLcontext *ctx,
               opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart,
                                   NULL, rgba + magStart);
                break;
+#endif
             default:
                sample_nearest_2d(ctx, tObj, m, texcoords + magStart,
                                  NULL, rgba + magStart );
@@ -1411,7 +1527,7 @@ sample_3d_nearest(GLcontext *ctx,
                   const struct gl_texture_object *tObj,
                   const struct gl_texture_image *img,
                   const GLfloat texcoord[4],
-                  GLchan rgba[4])
+                  GLfloat rgba[4])
 {
    const GLint width = img->Width2;     /* without border, power of two */
    const GLint height = img->Height2;   /* without border, power of two */
@@ -1427,10 +1543,10 @@ sample_3d_nearest(GLcontext *ctx,
        j < 0 || j >= (GLint) img->Height ||
        k < 0 || k >= (GLint) img->Depth) {
       /* Need this test for GL_CLAMP_TO_BORDER mode */
-      COPY_CHAN4(rgba, tObj->_BorderChan);
+      get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelc(img, i, j, k, rgba);
+      img->FetchTexelf(img, i, j, k, rgba);
    }
 }
 
@@ -1443,7 +1559,7 @@ sample_3d_linear(GLcontext *ctx,
                  const struct gl_texture_object *tObj,
                  const struct gl_texture_image *img,
                  const GLfloat texcoord[4],
-                 GLchan rgba[4])
+                 GLfloat rgba[4])
 {
    const GLint width = img->Width2;
    const GLint height = img->Height2;
@@ -1451,8 +1567,8 @@ sample_3d_linear(GLcontext *ctx,
    GLint i0, j0, k0, i1, j1, k1;
    GLbitfield useBorderColor = 0x0;
    GLfloat a, b, c;
-   GLchan t000[4], t010[4], t001[4], t011[4];
-   GLchan t100[4], t110[4], t101[4], t111[4];
+   GLfloat t000[4], t010[4], t001[4], t011[4];
+   GLfloat t100[4], t110[4], t101[4], t111[4];
 
    linear_texel_locations(tObj->WrapS, img, width, texcoord[0],  &i0, &i1, &a);
    linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b);
@@ -1478,53 +1594,53 @@ sample_3d_linear(GLcontext *ctx,
 
    /* Fetch texels */
    if (useBorderColor & (I0BIT | J0BIT | K0BIT)) {
-      COPY_CHAN4(t000, tObj->_BorderChan);
+      get_border_color(tObj, img, t000);
    }
    else {
-      img->FetchTexelc(img, i0, j0, k0, t000);
+      img->FetchTexelf(img, i0, j0, k0, t000);
    }
    if (useBorderColor & (I1BIT | J0BIT | K0BIT)) {
-      COPY_CHAN4(t100, tObj->_BorderChan);
+      get_border_color(tObj, img, t100);
    }
    else {
-      img->FetchTexelc(img, i1, j0, k0, t100);
+      img->FetchTexelf(img, i1, j0, k0, t100);
    }
    if (useBorderColor & (I0BIT | J1BIT | K0BIT)) {
-      COPY_CHAN4(t010, tObj->_BorderChan);
+      get_border_color(tObj, img, t010);
    }
    else {
-      img->FetchTexelc(img, i0, j1, k0, t010);
+      img->FetchTexelf(img, i0, j1, k0, t010);
    }
    if (useBorderColor & (I1BIT | J1BIT | K0BIT)) {
-      COPY_CHAN4(t110, tObj->_BorderChan);
+      get_border_color(tObj, img, t110);
    }
    else {
-      img->FetchTexelc(img, i1, j1, k0, t110);
+      img->FetchTexelf(img, i1, j1, k0, t110);
    }
 
    if (useBorderColor & (I0BIT | J0BIT | K1BIT)) {
-      COPY_CHAN4(t001, tObj->_BorderChan);
+      get_border_color(tObj, img, t001);
    }
    else {
-      img->FetchTexelc(img, i0, j0, k1, t001);
+      img->FetchTexelf(img, i0, j0, k1, t001);
    }
    if (useBorderColor & (I1BIT | J0BIT | K1BIT)) {
-      COPY_CHAN4(t101, tObj->_BorderChan);
+      get_border_color(tObj, img, t101);
    }
    else {
-      img->FetchTexelc(img, i1, j0, k1, t101);
+      img->FetchTexelf(img, i1, j0, k1, t101);
    }
    if (useBorderColor & (I0BIT | J1BIT | K1BIT)) {
-      COPY_CHAN4(t011, tObj->_BorderChan);
+      get_border_color(tObj, img, t011);
    }
    else {
-      img->FetchTexelc(img, i0, j1, k1, t011);
+      img->FetchTexelf(img, i0, j1, k1, t011);
    }
    if (useBorderColor & (I1BIT | J1BIT | K1BIT)) {
-      COPY_CHAN4(t111, tObj->_BorderChan);
+      get_border_color(tObj, img, t111);
    }
    else {
-      img->FetchTexelc(img, i1, j1, k1, t111);
+      img->FetchTexelf(img, i1, j1, k1, t111);
    }
 
    /* trilinear interpolation of samples */
@@ -1536,7 +1652,7 @@ static void
 sample_3d_nearest_mipmap_nearest(GLcontext *ctx,
                                  const struct gl_texture_object *tObj,
                                  GLuint n, const GLfloat texcoord[][4],
-                                 const GLfloat lambda[], GLchan rgba[][4] )
+                                 const GLfloat lambda[], GLfloat rgba[][4] )
 {
    GLuint i;
    for (i = 0; i < n; i++) {
@@ -1550,7 +1666,7 @@ static void
 sample_3d_linear_mipmap_nearest(GLcontext *ctx,
                                 const struct gl_texture_object *tObj,
                                 GLuint n, const GLfloat texcoord[][4],
-                                const GLfloat lambda[], GLchan rgba[][4])
+                                const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1565,7 +1681,7 @@ static void
 sample_3d_nearest_mipmap_linear(GLcontext *ctx,
                                 const struct gl_texture_object *tObj,
                                 GLuint n, const GLfloat texcoord[][4],
-                                const GLfloat lambda[], GLchan rgba[][4])
+                                const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1576,7 +1692,7 @@ sample_3d_nearest_mipmap_linear(GLcontext *ctx,
                            texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_3d_nearest(ctx, tObj, tObj->Image[0][level  ], texcoord[i], t0);
          sample_3d_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
@@ -1590,7 +1706,7 @@ static void
 sample_3d_linear_mipmap_linear(GLcontext *ctx,
                                const struct gl_texture_object *tObj,
                                GLuint n, const GLfloat texcoord[][4],
-                               const GLfloat lambda[], GLchan rgba[][4])
+                               const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1601,7 +1717,7 @@ sample_3d_linear_mipmap_linear(GLcontext *ctx,
                           texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_3d_linear(ctx, tObj, tObj->Image[0][level  ], texcoord[i], t0);
          sample_3d_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
@@ -1616,7 +1732,7 @@ static void
 sample_nearest_3d(GLcontext *ctx,
                   const struct gl_texture_object *tObj, GLuint n,
                   const GLfloat texcoords[][4], const GLfloat lambda[],
-                  GLchan rgba[][4])
+                  GLfloat rgba[][4])
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -1632,7 +1748,7 @@ static void
 sample_linear_3d(GLcontext *ctx,
                  const struct gl_texture_object *tObj, GLuint n,
                  const GLfloat texcoords[][4],
-                const GLfloat lambda[], GLchan rgba[][4])
+                const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -1648,7 +1764,7 @@ static void
 sample_lambda_3d(GLcontext *ctx,
                  const struct gl_texture_object *tObj, GLuint n,
                  const GLfloat texcoords[][4], const GLfloat lambda[],
-                 GLchan rgba[][4])
+                 GLfloat rgba[][4])
 {
    GLuint minStart, minEnd;  /* texels with minification */
    GLuint magStart, magEnd;  /* texels with magnification */
@@ -1799,7 +1915,7 @@ static void
 sample_nearest_cube(GLcontext *ctx,
                    const struct gl_texture_object *tObj, GLuint n,
                     const GLfloat texcoords[][4], const GLfloat lambda[],
-                    GLchan rgba[][4])
+                    GLfloat rgba[][4])
 {
    GLuint i;
    (void) lambda;
@@ -1817,7 +1933,7 @@ static void
 sample_linear_cube(GLcontext *ctx,
                   const struct gl_texture_object *tObj, GLuint n,
                    const GLfloat texcoords[][4],
-                  const GLfloat lambda[], GLchan rgba[][4])
+                  const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    (void) lambda;
@@ -1835,7 +1951,7 @@ static void
 sample_cube_nearest_mipmap_nearest(GLcontext *ctx,
                                    const struct gl_texture_object *tObj,
                                    GLuint n, const GLfloat texcoord[][4],
-                                   const GLfloat lambda[], GLchan rgba[][4])
+                                   const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1864,7 +1980,7 @@ static void
 sample_cube_linear_mipmap_nearest(GLcontext *ctx,
                                   const struct gl_texture_object *tObj,
                                   GLuint n, const GLfloat texcoord[][4],
-                                  const GLfloat lambda[], GLchan rgba[][4])
+                                  const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1883,7 +1999,7 @@ static void
 sample_cube_nearest_mipmap_linear(GLcontext *ctx,
                                   const struct gl_texture_object *tObj,
                                   GLuint n, const GLfloat texcoord[][4],
-                                  const GLfloat lambda[], GLchan rgba[][4])
+                                  const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1898,7 +2014,7 @@ sample_cube_nearest_mipmap_linear(GLcontext *ctx,
                            newCoord, rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_2d_nearest(ctx, tObj, images[level  ], newCoord, t0);
          sample_2d_nearest(ctx, tObj, images[level+1], newCoord, t1);
@@ -1912,7 +2028,7 @@ static void
 sample_cube_linear_mipmap_linear(GLcontext *ctx,
                                  const struct gl_texture_object *tObj,
                                  GLuint n, const GLfloat texcoord[][4],
-                                 const GLfloat lambda[], GLchan rgba[][4])
+                                 const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -1927,7 +2043,7 @@ sample_cube_linear_mipmap_linear(GLcontext *ctx,
                           newCoord, rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];
+         GLfloat t0[4], t1[4];
          const GLfloat f = FRAC(lambda[i]);
          sample_2d_linear(ctx, tObj, images[level  ], newCoord, t0);
          sample_2d_linear(ctx, tObj, images[level+1], newCoord, t1);
@@ -1942,7 +2058,7 @@ static void
 sample_lambda_cube(GLcontext *ctx,
                   const struct gl_texture_object *tObj, GLuint n,
                   const GLfloat texcoords[][4], const GLfloat lambda[],
-                  GLchan rgba[][4])
+                  GLfloat rgba[][4])
 {
    GLuint minStart, minEnd;  /* texels with minification */
    GLuint magStart, magEnd;  /* texels with magnification */
@@ -2012,71 +2128,11 @@ sample_lambda_cube(GLcontext *ctx,
 /**********************************************************************/
 
 
-/**
- * Do clamp/wrap for a texture rectangle coord, GL_NEAREST filter mode.
- */
-static INLINE GLint
-clamp_rect_coord_nearest(GLenum wrapMode, GLfloat coord, GLint max)
-{
-   switch (wrapMode) {
-   case GL_CLAMP:
-      return IFLOOR( CLAMP(coord, 0.0F, max - 1) );
-   case GL_CLAMP_TO_EDGE:
-      return IFLOOR( CLAMP(coord, 0.5F, max - 0.5F) );
-   case GL_CLAMP_TO_BORDER:
-      return IFLOOR( CLAMP(coord, -0.5F, max + 0.5F) );
-   default:
-      _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_nearest");
-      return 0;
-   }
-}
-
-
-/**
- * As above, but GL_LINEAR filtering.
- */
-static INLINE void
-clamp_rect_coord_linear(GLenum wrapMode, GLfloat coord, GLint max,
-                        GLint *i0out, GLint *i1out, GLfloat *weight)
-{
-   GLfloat fcol;
-   GLint i0, i1;
-   switch (wrapMode) {
-   case GL_CLAMP:
-      /* Not exactly what the spec says, but it matches NVIDIA output */
-      fcol = CLAMP(coord - 0.5F, 0.0, max-1);
-      i0 = IFLOOR(fcol);
-      i1 = i0 + 1;
-      break;
-   case GL_CLAMP_TO_EDGE:
-      fcol = CLAMP(coord, 0.5F, max - 0.5F);
-      fcol -= 0.5F;
-      i0 = IFLOOR(fcol);
-      i1 = i0 + 1;
-      if (i1 > max - 1)
-         i1 = max - 1;
-      break;
-   case GL_CLAMP_TO_BORDER:
-      fcol = CLAMP(coord, -0.5F, max + 0.5F);
-      fcol -= 0.5F;
-      i0 = IFLOOR(fcol);
-      i1 = i0 + 1;
-   default:
-      _mesa_problem(NULL, "bad wrapMode in clamp_rect_coord_linear");
-      i0 = i1 = 0;
-      fcol = 0.0F;
-   }
-   *i0out = i0;
-   *i1out = i1;
-   *weight = FRAC(fcol);
-}
-
-
 static void
 sample_nearest_rect(GLcontext *ctx,
                    const struct gl_texture_object *tObj, GLuint n,
                     const GLfloat texcoords[][4], const GLfloat lambda[],
-                    GLchan rgba[][4])
+                    GLfloat rgba[][4])
 {
    const struct gl_texture_image *img = tObj->Image[0][0];
    const GLint width = img->Width;
@@ -2099,9 +2155,9 @@ sample_nearest_rect(GLcontext *ctx,
       col = clamp_rect_coord_nearest(tObj->WrapS, texcoords[i][0], width);
       row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height);
       if (col < 0 || col >= width || row < 0 || row >= height)
-         COPY_CHAN4(rgba[i], tObj->_BorderChan);
+         get_border_color(tObj, img, rgba[i]);
       else
-         img->FetchTexelc(img, col, row, 0, rgba[i]);
+         img->FetchTexelf(img, col, row, 0, rgba[i]);
    }
 }
 
@@ -2110,7 +2166,7 @@ static void
 sample_linear_rect(GLcontext *ctx,
                   const struct gl_texture_object *tObj, GLuint n,
                    const GLfloat texcoords[][4],
-                  const GLfloat lambda[], GLchan rgba[][4])
+                  const GLfloat lambda[], GLfloat rgba[][4])
 {
    const struct gl_texture_image *img = tObj->Image[0][0];
    const GLint width = img->Width;
@@ -2130,7 +2186,7 @@ sample_linear_rect(GLcontext *ctx,
 
    for (i = 0; i < n; i++) {
       GLint i0, j0, i1, j1;
-      GLchan t00[4], t01[4], t10[4], t11[4];
+      GLfloat t00[4], t01[4], t10[4], t11[4];
       GLfloat a, b;
       GLbitfield useBorderColor = 0x0;
 
@@ -2147,24 +2203,24 @@ sample_linear_rect(GLcontext *ctx,
 
       /* get four texel samples */
       if (useBorderColor & (I0BIT | J0BIT))
-         COPY_CHAN4(t00, tObj->_BorderChan);
+         get_border_color(tObj, img, t00);
       else
-         img->FetchTexelc(img, i0, j0, 0, t00);
+         img->FetchTexelf(img, i0, j0, 0, t00);
 
       if (useBorderColor & (I1BIT | J0BIT))
-         COPY_CHAN4(t10, tObj->_BorderChan);
+         get_border_color(tObj, img, t10);
       else
-         img->FetchTexelc(img, i1, j0, 0, t10);
+         img->FetchTexelf(img, i1, j0, 0, t10);
 
       if (useBorderColor & (I0BIT | J1BIT))
-         COPY_CHAN4(t01, tObj->_BorderChan);
+         get_border_color(tObj, img, t01);
       else
-         img->FetchTexelc(img, i0, j1, 0, t01);
+         img->FetchTexelf(img, i0, j1, 0, t01);
 
       if (useBorderColor & (I1BIT | J1BIT))
-         COPY_CHAN4(t11, tObj->_BorderChan);
+         get_border_color(tObj, img, t11);
       else
-         img->FetchTexelc(img, i1, j1, 0, t11);
+         img->FetchTexelf(img, i1, j1, 0, t11);
 
       lerp_rgba_2d(rgba[i], a, b, t00, t10, t01, t11);
    }
@@ -2176,7 +2232,7 @@ static void
 sample_lambda_rect(GLcontext *ctx,
                   const struct gl_texture_object *tObj, GLuint n,
                   const GLfloat texcoords[][4], const GLfloat lambda[],
-                  GLchan rgba[][4])
+                  GLfloat rgba[][4])
 {
    GLuint minStart, minEnd, magStart, magEnd;
 
@@ -2222,7 +2278,7 @@ sample_2d_array_nearest(GLcontext *ctx,
                         const struct gl_texture_object *tObj,
                         const struct gl_texture_image *img,
                         const GLfloat texcoord[4],
-                        GLchan rgba[4])
+                        GLfloat rgba[4])
 {
    const GLint width = img->Width2;     /* without border, power of two */
    const GLint height = img->Height2;   /* without border, power of two */
@@ -2239,10 +2295,10 @@ sample_2d_array_nearest(GLcontext *ctx,
        j < 0 || j >= (GLint) img->Height ||
        array < 0 || array >= (GLint) img->Depth) {
       /* Need this test for GL_CLAMP_TO_BORDER mode */
-      COPY_CHAN4(rgba, tObj->_BorderChan);
+      get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelc(img, i, j, array, rgba);
+      img->FetchTexelf(img, i, j, array, rgba);
    }
 }
 
@@ -2255,7 +2311,7 @@ sample_2d_array_linear(GLcontext *ctx,
                        const struct gl_texture_object *tObj,
                        const struct gl_texture_image *img,
                        const GLfloat texcoord[4],
-                       GLchan rgba[4])
+                       GLfloat rgba[4])
 {
    const GLint width = img->Width2;
    const GLint height = img->Height2;
@@ -2264,14 +2320,14 @@ sample_2d_array_linear(GLcontext *ctx,
    GLint array;
    GLbitfield useBorderColor = 0x0;
    GLfloat a, b;
-   GLchan t00[4], t01[4], t10[4], t11[4];
+   GLfloat t00[4], t01[4], t10[4], t11[4];
 
    linear_texel_locations(tObj->WrapS, img, width,  texcoord[0], &i0, &i1, &a);
    linear_texel_locations(tObj->WrapT, img, height, texcoord[1], &j0, &j1, &b);
    array = clamp_rect_coord_nearest(tObj->WrapR, texcoord[2], depth);
 
    if (array < 0 || array >= depth) {
-      COPY_CHAN4(rgba, tObj->_BorderChan);
+      COPY_4V(rgba, tObj->BorderColor);
    }
    else {
       if (img->Border) {
@@ -2290,28 +2346,28 @@ sample_2d_array_linear(GLcontext *ctx,
 
       /* Fetch texels */
       if (useBorderColor & (I0BIT | J0BIT)) {
-        COPY_CHAN4(t00, tObj->_BorderChan);
+         get_border_color(tObj, img, t00);
       }
       else {
-        img->FetchTexelc(img, i0, j0, array, t00);
+        img->FetchTexelf(img, i0, j0, array, t00);
       }
       if (useBorderColor & (I1BIT | J0BIT)) {
-        COPY_CHAN4(t10, tObj->_BorderChan);
+         get_border_color(tObj, img, t10);
       }
       else {
-        img->FetchTexelc(img, i1, j0, array, t10);
+        img->FetchTexelf(img, i1, j0, array, t10);
       }
       if (useBorderColor & (I0BIT | J1BIT)) {
-        COPY_CHAN4(t01, tObj->_BorderChan);
+         get_border_color(tObj, img, t01);
       }
       else {
-        img->FetchTexelc(img, i0, j1, array, t01);
+        img->FetchTexelf(img, i0, j1, array, t01);
       }
       if (useBorderColor & (I1BIT | J1BIT)) {
-        COPY_CHAN4(t11, tObj->_BorderChan);
+         get_border_color(tObj, img, t11);
       }
       else {
-        img->FetchTexelc(img, i1, j1, array, t11);
+        img->FetchTexelf(img, i1, j1, array, t11);
       }
       
       /* trilinear interpolation of samples */
@@ -2324,7 +2380,7 @@ static void
 sample_2d_array_nearest_mipmap_nearest(GLcontext *ctx,
                                        const struct gl_texture_object *tObj,
                                        GLuint n, const GLfloat texcoord[][4],
-                                       const GLfloat lambda[], GLchan rgba[][4])
+                                       const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    for (i = 0; i < n; i++) {
@@ -2339,7 +2395,7 @@ static void
 sample_2d_array_linear_mipmap_nearest(GLcontext *ctx,
                                       const struct gl_texture_object *tObj,
                                       GLuint n, const GLfloat texcoord[][4],
-                                      const GLfloat lambda[], GLchan rgba[][4])
+                                      const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -2355,7 +2411,7 @@ static void
 sample_2d_array_nearest_mipmap_linear(GLcontext *ctx,
                                       const struct gl_texture_object *tObj,
                                       GLuint n, const GLfloat texcoord[][4],
-                                      const GLfloat lambda[], GLchan rgba[][4])
+                                      const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -2366,7 +2422,7 @@ sample_2d_array_nearest_mipmap_linear(GLcontext *ctx,
                                  texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_2d_array_nearest(ctx, tObj, tObj->Image[0][level  ],
                                  texcoord[i], t0);
@@ -2382,7 +2438,7 @@ static void
 sample_2d_array_linear_mipmap_linear(GLcontext *ctx,
                                      const struct gl_texture_object *tObj,
                                      GLuint n, const GLfloat texcoord[][4],
-                                     const GLfloat lambda[], GLchan rgba[][4])
+                                     const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -2393,7 +2449,7 @@ sample_2d_array_linear_mipmap_linear(GLcontext *ctx,
                           texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_2d_array_linear(ctx, tObj, tObj->Image[0][level  ],
                                 texcoord[i], t0);
@@ -2410,7 +2466,7 @@ static void
 sample_nearest_2d_array(GLcontext *ctx,
                         const struct gl_texture_object *tObj, GLuint n,
                         const GLfloat texcoords[][4], const GLfloat lambda[],
-                        GLchan rgba[][4])
+                        GLfloat rgba[][4])
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -2427,7 +2483,7 @@ static void
 sample_linear_2d_array(GLcontext *ctx,
                        const struct gl_texture_object *tObj, GLuint n,
                        const GLfloat texcoords[][4],
-                       const GLfloat lambda[], GLchan rgba[][4])
+                       const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -2443,7 +2499,7 @@ static void
 sample_lambda_2d_array(GLcontext *ctx,
                        const struct gl_texture_object *tObj, GLuint n,
                        const GLfloat texcoords[][4], const GLfloat lambda[],
-                       GLchan rgba[][4])
+                       GLfloat rgba[][4])
 {
    GLuint minStart, minEnd;  /* texels with minification */
    GLuint magStart, magEnd;  /* texels with magnification */
@@ -2532,7 +2588,7 @@ sample_1d_array_nearest(GLcontext *ctx,
                         const struct gl_texture_object *tObj,
                         const struct gl_texture_image *img,
                         const GLfloat texcoord[4],
-                        GLchan rgba[4])
+                        GLfloat rgba[4])
 {
    const GLint width = img->Width2;     /* without border, power of two */
    const GLint height = img->Height;
@@ -2546,10 +2602,10 @@ sample_1d_array_nearest(GLcontext *ctx,
    if (i < 0 || i >= (GLint) img->Width ||
        array < 0 || array >= (GLint) img->Height) {
       /* Need this test for GL_CLAMP_TO_BORDER mode */
-      COPY_CHAN4(rgba, tObj->_BorderChan);
+      get_border_color(tObj, img, rgba);
    }
    else {
-      img->FetchTexelc(img, i, array, 0, rgba);
+      img->FetchTexelf(img, i, array, 0, rgba);
    }
 }
 
@@ -2562,7 +2618,7 @@ sample_1d_array_linear(GLcontext *ctx,
                        const struct gl_texture_object *tObj,
                        const struct gl_texture_image *img,
                        const GLfloat texcoord[4],
-                       GLchan rgba[4])
+                       GLfloat rgba[4])
 {
    const GLint width = img->Width2;
    const GLint height = img->Height;
@@ -2570,7 +2626,7 @@ sample_1d_array_linear(GLcontext *ctx,
    GLint array;
    GLbitfield useBorderColor = 0x0;
    GLfloat a;
-   GLchan t0[4], t1[4];
+   GLfloat t0[4], t1[4];
 
    linear_texel_locations(tObj->WrapS, img, width, texcoord[0], &i0, &i1, &a);
    array = clamp_rect_coord_nearest(tObj->WrapT, texcoord[1], height);
@@ -2589,16 +2645,16 @@ sample_1d_array_linear(GLcontext *ctx,
 
    /* Fetch texels */
    if (useBorderColor & (I0BIT | K0BIT)) {
-      COPY_CHAN4(t0, tObj->_BorderChan);
+      get_border_color(tObj, img, t0);
    }
    else {
-      img->FetchTexelc(img, i0, array, 0, t0);
+      img->FetchTexelf(img, i0, array, 0, t0);
    }
    if (useBorderColor & (I1BIT | K0BIT)) {
-      COPY_CHAN4(t1, tObj->_BorderChan);
+      get_border_color(tObj, img, t1);
    }
    else {
-      img->FetchTexelc(img, i1, array, 0, t1);
+      img->FetchTexelf(img, i1, array, 0, t1);
    }
 
    /* bilinear interpolation of samples */
@@ -2610,7 +2666,7 @@ static void
 sample_1d_array_nearest_mipmap_nearest(GLcontext *ctx,
                                        const struct gl_texture_object *tObj,
                                        GLuint n, const GLfloat texcoord[][4],
-                                       const GLfloat lambda[], GLchan rgba[][4])
+                                       const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    for (i = 0; i < n; i++) {
@@ -2625,7 +2681,7 @@ static void
 sample_1d_array_linear_mipmap_nearest(GLcontext *ctx,
                                       const struct gl_texture_object *tObj,
                                       GLuint n, const GLfloat texcoord[][4],
-                                      const GLfloat lambda[], GLchan rgba[][4])
+                                      const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -2641,7 +2697,7 @@ static void
 sample_1d_array_nearest_mipmap_linear(GLcontext *ctx,
                                       const struct gl_texture_object *tObj,
                                       GLuint n, const GLfloat texcoord[][4],
-                                      const GLfloat lambda[], GLchan rgba[][4])
+                                      const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -2652,7 +2708,7 @@ sample_1d_array_nearest_mipmap_linear(GLcontext *ctx,
                                  texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_1d_array_nearest(ctx, tObj, tObj->Image[0][level  ], texcoord[i], t0);
          sample_1d_array_nearest(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
@@ -2666,7 +2722,7 @@ static void
 sample_1d_array_linear_mipmap_linear(GLcontext *ctx,
                                      const struct gl_texture_object *tObj,
                                      GLuint n, const GLfloat texcoord[][4],
-                                     const GLfloat lambda[], GLchan rgba[][4])
+                                     const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    ASSERT(lambda != NULL);
@@ -2677,7 +2733,7 @@ sample_1d_array_linear_mipmap_linear(GLcontext *ctx,
                           texcoord[i], rgba[i]);
       }
       else {
-         GLchan t0[4], t1[4];  /* texels */
+         GLfloat t0[4], t1[4];  /* texels */
          const GLfloat f = FRAC(lambda[i]);
          sample_1d_array_linear(ctx, tObj, tObj->Image[0][level  ], texcoord[i], t0);
          sample_1d_array_linear(ctx, tObj, tObj->Image[0][level+1], texcoord[i], t1);
@@ -2692,7 +2748,7 @@ static void
 sample_nearest_1d_array(GLcontext *ctx,
                         const struct gl_texture_object *tObj, GLuint n,
                         const GLfloat texcoords[][4], const GLfloat lambda[],
-                        GLchan rgba[][4])
+                        GLfloat rgba[][4])
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -2708,7 +2764,7 @@ static void
 sample_linear_1d_array(GLcontext *ctx,
                        const struct gl_texture_object *tObj, GLuint n,
                        const GLfloat texcoords[][4],
-                       const GLfloat lambda[], GLchan rgba[][4])
+                       const GLfloat lambda[], GLfloat rgba[][4])
 {
    GLuint i;
    struct gl_texture_image *image = tObj->Image[0][tObj->BaseLevel];
@@ -2724,7 +2780,7 @@ static void
 sample_lambda_1d_array(GLcontext *ctx,
                        const struct gl_texture_object *tObj, GLuint n,
                        const GLfloat texcoords[][4], const GLfloat lambda[],
-                       GLchan rgba[][4])
+                       GLfloat rgba[][4])
 {
    GLuint minStart, minEnd;  /* texels with minification */
    GLuint magStart, magEnd;  /* texels with magnification */
@@ -2796,13 +2852,109 @@ sample_lambda_1d_array(GLcontext *ctx,
 
 
 /**
+ * Compare texcoord against depth sample.  Return 1.0 or the ambient value.
+ */
+static INLINE GLfloat
+shadow_compare(GLenum function, GLfloat coord, GLfloat depthSample,
+               GLfloat ambient)
+{
+   switch (function) {
+   case GL_LEQUAL:
+      return (coord <= depthSample) ? 1.0F : ambient;
+   case GL_GEQUAL:
+      return (coord >= depthSample) ? 1.0F : ambient;
+   case GL_LESS:
+      return (coord < depthSample) ? 1.0F : ambient;
+   case GL_GREATER:
+      return (coord > depthSample) ? 1.0F : ambient;
+   case GL_EQUAL:
+      return (coord == depthSample) ? 1.0F : ambient;
+   case GL_NOTEQUAL:
+      return (coord != depthSample) ? 1.0F : ambient;
+   case GL_ALWAYS:
+      return 1.0F;
+   case GL_NEVER:
+      return ambient;
+   case GL_NONE:
+      return depthSample;
+   default:
+      _mesa_problem(NULL, "Bad compare func in shadow_compare");
+      return ambient;
+   }
+}
+
+
+/**
+ * Compare texcoord against four depth samples.
+ */
+static INLINE GLfloat
+shadow_compare4(GLenum function, GLfloat coord,
+                GLfloat depth00, GLfloat depth01,
+                GLfloat depth10, GLfloat depth11,
+                GLfloat ambient, GLfloat wi, GLfloat wj)
+{
+   const GLfloat d = (1.0F - (GLfloat) ambient) * 0.25F;
+   GLfloat luminance = 1.0F;
+
+   switch (function) {
+   case GL_LEQUAL:
+      if (depth00 <= coord)  luminance -= d;
+      if (depth01 <= coord)  luminance -= d;
+      if (depth10 <= coord)  luminance -= d;
+      if (depth11 <= coord)  luminance -= d;
+      return luminance;
+   case GL_GEQUAL:
+      if (depth00 >= coord)  luminance -= d;
+      if (depth01 >= coord)  luminance -= d;
+      if (depth10 >= coord)  luminance -= d;
+      if (depth11 >= coord)  luminance -= d;
+      return luminance;
+   case GL_LESS:
+      if (depth00 < coord)  luminance -= d;
+      if (depth01 < coord)  luminance -= d;
+      if (depth10 < coord)  luminance -= d;
+      if (depth11 < coord)  luminance -= d;
+      return luminance;
+   case GL_GREATER:
+      if (depth00 > coord)  luminance -= d;
+      if (depth01 > coord)  luminance -= d;
+      if (depth10 > coord)  luminance -= d;
+      if (depth11 > coord)  luminance -= d;
+      return luminance;
+   case GL_EQUAL:
+      if (depth00 == coord)  luminance -= d;
+      if (depth01 == coord)  luminance -= d;
+      if (depth10 == coord)  luminance -= d;
+      if (depth11 == coord)  luminance -= d;
+      return luminance;
+   case GL_NOTEQUAL:
+      if (depth00 != coord)  luminance -= d;
+      if (depth01 != coord)  luminance -= d;
+      if (depth10 != coord)  luminance -= d;
+      if (depth11 != coord)  luminance -= d;
+      return luminance;
+   case GL_ALWAYS:
+      return 0.0;
+   case GL_NEVER:
+      return ambient;
+   case GL_NONE:
+      /* ordinary bilinear filtering */
+      return lerp_2d(wi, wj, depth00, depth10, depth01, depth11);
+   default:
+      _mesa_problem(NULL, "Bad compare func in sample_depth_texture");
+      return 0.0F;
+   }
+}
+
+
+/**
  * Sample a shadow/depth texture.
  */
 static void
 sample_depth_texture( GLcontext *ctx,
                       const struct gl_texture_object *tObj, GLuint n,
                       const GLfloat texcoords[][4], const GLfloat lambda[],
-                      GLchan texel[][4] )
+                      GLfloat texel[][4] )
 {
    const GLint baseLevel = tObj->BaseLevel;
    const struct gl_texture_image *img = tObj->Image[0][baseLevel];
@@ -2811,9 +2963,9 @@ sample_depth_texture( GLcontext *ctx,
    const GLint depth = img->Depth;
    const GLuint compare_coord = (tObj->Target == GL_TEXTURE_2D_ARRAY_EXT)
        ? 3 : 2;
-   GLchan ambient;
+   GLfloat ambient;
    GLenum function;
-   GLchan result;
+   GLfloat result;
 
    (void) lambda;
 
@@ -2826,7 +2978,7 @@ sample_depth_texture( GLcontext *ctx,
           tObj->Target == GL_TEXTURE_1D_ARRAY_EXT ||
           tObj->Target == GL_TEXTURE_2D_ARRAY_EXT);
 
-   UNCLAMPED_FLOAT_TO_CHAN(ambient, tObj->CompareFailValue);
+   ambient = tObj->CompareFailValue;
 
    /* XXXX if tObj->MinFilter != tObj->MagFilter, we're ignoring lambda */
 
@@ -2839,45 +2991,7 @@ sample_depth_texture( GLcontext *ctx,
          GLfloat depthSample;
          GLint col, row, slice;
 
-         switch (tObj->Target) {
-         case GL_TEXTURE_RECTANGLE_ARB:
-            col = clamp_rect_coord_nearest(tObj->WrapS, texcoords[i][0], width);
-            row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height);
-            slice = 0;
-            break;
-            
-         case GL_TEXTURE_1D:
-            col = nearest_texel_location(tObj->WrapS, img, width,
-                                         texcoords[i][0]);
-            row = 0;
-            slice = 0;
-            break;
-
-         case GL_TEXTURE_2D:
-            col = nearest_texel_location(tObj->WrapS, img, width,
-                                         texcoords[i][0]);
-            row = nearest_texel_location(tObj->WrapT, img, height,
-                                         texcoords[i][1]);
-            slice = 0;
-            break;
-
-         case GL_TEXTURE_1D_ARRAY_EXT:
-            col = nearest_texel_location(tObj->WrapS, img, width,
-                                         texcoords[i][0]);
-            row = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height);
-            slice = 0;
-            break;
-
-         case GL_TEXTURE_2D_ARRAY_EXT:
-            col = nearest_texel_location(tObj->WrapS, img, width,
-                                         texcoords[i][0]);
-            row = nearest_texel_location(tObj->WrapT, img, height,
-                                         texcoords[i][1]);
-            slice = clamp_rect_coord_nearest(tObj->WrapR, texcoords[i][2], depth);
-            break;
-         default:
-            col = row = slice = 0;
-         }
+         nearest_texcoord(tObj, texcoords[i], &col, &row, &slice);
 
          if (col >= 0 && row >= 0 && col < width && row < height && 
              slice >= 0 && slice < depth) {
@@ -2887,57 +3001,18 @@ sample_depth_texture( GLcontext *ctx,
             depthSample = tObj->BorderColor[0];
          }
 
-         switch (function) {
-         case GL_LEQUAL:
-            result = (texcoords[i][compare_coord] <= depthSample) ? CHAN_MAX : ambient;
-            break;
-         case GL_GEQUAL:
-            result = (texcoords[i][compare_coord] >= depthSample) ? CHAN_MAX : ambient;
-            break;
-         case GL_LESS:
-            result = (texcoords[i][compare_coord] < depthSample) ? CHAN_MAX : ambient;
-            break;
-         case GL_GREATER:
-            result = (texcoords[i][compare_coord] > depthSample) ? CHAN_MAX : ambient;
-            break;
-         case GL_EQUAL:
-            result = (texcoords[i][compare_coord] == depthSample) ? CHAN_MAX : ambient;
-            break;
-         case GL_NOTEQUAL:
-            result = (texcoords[i][compare_coord] != depthSample) ? CHAN_MAX : ambient;
-            break;
-         case GL_ALWAYS:
-            result = CHAN_MAX;
-            break;
-         case GL_NEVER:
-            result = ambient;
-            break;
-         case GL_NONE:
-            CLAMPED_FLOAT_TO_CHAN(result, depthSample);
-            break;
-         default:
-            _mesa_problem(ctx, "Bad compare func in sample_depth_texture");
-            return;
-         }
+         result = shadow_compare(function, texcoords[i][compare_coord],
+                                 depthSample, ambient);
 
          switch (tObj->DepthMode) {
          case GL_LUMINANCE:
-            texel[i][RCOMP] = result;
-            texel[i][GCOMP] = result;
-            texel[i][BCOMP] = result;
-            texel[i][ACOMP] = CHAN_MAX;
+            ASSIGN_4V(texel[i], result, result, result, 1.0F);
             break;
          case GL_INTENSITY:
-            texel[i][RCOMP] = result;
-            texel[i][GCOMP] = result;
-            texel[i][BCOMP] = result;
-            texel[i][ACOMP] = result;
+            ASSIGN_4V(texel[i], result, result, result, result);
             break;
          case GL_ALPHA:
-            texel[i][RCOMP] = 0;
-            texel[i][GCOMP] = 0;
-            texel[i][BCOMP] = 0;
-            texel[i][ACOMP] = result;
+            ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result);
             break;
          default:
             _mesa_problem(ctx, "Bad depth texture mode");
@@ -2951,45 +3026,11 @@ sample_depth_texture( GLcontext *ctx,
          GLfloat depth00, depth01, depth10, depth11;
          GLint i0, i1, j0, j1;
          GLint slice;
-         GLfloat a, b;
+         GLfloat wi, wj;
          GLuint useBorderTexel;
 
-         switch (tObj->Target) {
-         case GL_TEXTURE_RECTANGLE_ARB:
-            clamp_rect_coord_linear(tObj->WrapS, texcoords[i][0],
-                                    width, &i0, &i1, &a);
-            clamp_rect_coord_linear(tObj->WrapT, texcoords[i][1],
-                                    height, &j0, &j1, &b);
-            slice = 0;
-            break;
-
-         case GL_TEXTURE_1D:
-         case GL_TEXTURE_2D:
-            linear_texel_locations(tObj->WrapS, img, width,
-                                   texcoords[i][0], &i0, &i1, &a);
-            linear_texel_locations(tObj->WrapT, img, height,
-                                   texcoords[i][1], &j0, &j1, &b);
-            slice = 0;
-            break;
-
-         case GL_TEXTURE_1D_ARRAY_EXT:
-            linear_texel_locations(tObj->WrapS, img, width,
-                                   texcoords[i][0], &i0, &i1, &a);
-            j0 = clamp_rect_coord_nearest(tObj->WrapT, texcoords[i][1], height);
-            j1 = j0;
-            slice = 0;
-            break;
-
-         case GL_TEXTURE_2D_ARRAY_EXT:
-            linear_texel_locations(tObj->WrapS, img, width,
-                                   texcoords[i][0], &i0, &i1, &a);
-            linear_texel_locations(tObj->WrapT, img, height,
-                                   texcoords[i][1], &j0, &j1, &b);
-            slice = clamp_rect_coord_nearest(tObj->WrapR, texcoords[i][2], depth);
-            break;
-         default:
-            slice = 0;
-         }
+         linear_texcoord(tObj, texcoords[i], &i0, &i1, &j0, &j1, &slice,
+                         &wi, &wj);
 
          useBorderTexel = 0;
          if (img->Border) {
@@ -3048,111 +3089,24 @@ sample_depth_texture( GLcontext *ctx,
             }
          }
 
-         if (0) {
-            /* compute a single weighted depth sample and do one comparison */
-            const GLfloat depthSample
-               = lerp_2d(a, b, depth00, depth10, depth01, depth11);
-            if ((depthSample <= texcoords[i][compare_coord] && function == GL_LEQUAL) ||
-                (depthSample >= texcoords[i][compare_coord] && function == GL_GEQUAL)) {
-               result  = ambient;
-            }
-            else {
-               result = CHAN_MAX;
-            }
-         }
-         else {
-            /* Do four depth/R comparisons and compute a weighted result.
-             * If this touches on somebody's I.P., I'll remove this code
-             * upon request.
-             */
-            const GLfloat d = (CHAN_MAXF - (GLfloat) ambient) * 0.25F;
-            GLfloat luminance = CHAN_MAXF;
-
-            switch (function) {
-            case GL_LEQUAL:
-               if (depth00 <= texcoords[i][compare_coord])  luminance -= d;
-               if (depth01 <= texcoords[i][compare_coord])  luminance -= d;
-               if (depth10 <= texcoords[i][compare_coord])  luminance -= d;
-               if (depth11 <= texcoords[i][compare_coord])  luminance -= d;
-               result = (GLchan) luminance;
-               break;
-            case GL_GEQUAL:
-               if (depth00 >= texcoords[i][compare_coord])  luminance -= d;
-               if (depth01 >= texcoords[i][compare_coord])  luminance -= d;
-               if (depth10 >= texcoords[i][compare_coord])  luminance -= d;
-               if (depth11 >= texcoords[i][compare_coord])  luminance -= d;
-               result = (GLchan) luminance;
-               break;
-            case GL_LESS:
-               if (depth00 < texcoords[i][compare_coord])  luminance -= d;
-               if (depth01 < texcoords[i][compare_coord])  luminance -= d;
-               if (depth10 < texcoords[i][compare_coord])  luminance -= d;
-               if (depth11 < texcoords[i][compare_coord])  luminance -= d;
-               result = (GLchan) luminance;
-               break;
-            case GL_GREATER:
-               if (depth00 > texcoords[i][compare_coord])  luminance -= d;
-               if (depth01 > texcoords[i][compare_coord])  luminance -= d;
-               if (depth10 > texcoords[i][compare_coord])  luminance -= d;
-               if (depth11 > texcoords[i][compare_coord])  luminance -= d;
-               result = (GLchan) luminance;
-               break;
-            case GL_EQUAL:
-               if (depth00 == texcoords[i][compare_coord])  luminance -= d;
-               if (depth01 == texcoords[i][compare_coord])  luminance -= d;
-               if (depth10 == texcoords[i][compare_coord])  luminance -= d;
-               if (depth11 == texcoords[i][compare_coord])  luminance -= d;
-               result = (GLchan) luminance;
-               break;
-            case GL_NOTEQUAL:
-               if (depth00 != texcoords[i][compare_coord])  luminance -= d;
-               if (depth01 != texcoords[i][compare_coord])  luminance -= d;
-               if (depth10 != texcoords[i][compare_coord])  luminance -= d;
-               if (depth11 != texcoords[i][compare_coord])  luminance -= d;
-               result = (GLchan) luminance;
-               break;
-            case GL_ALWAYS:
-               result = 0;
-               break;
-            case GL_NEVER:
-               result = CHAN_MAX;
-               break;
-            case GL_NONE:
-               /* ordinary bilinear filtering */
-               {
-                  const GLfloat depthSample
-                     = lerp_2d(a, b, depth00, depth10, depth01, depth11);
-                  CLAMPED_FLOAT_TO_CHAN(result, depthSample);
-               }
-               break;
-            default:
-               _mesa_problem(ctx, "Bad compare func in sample_depth_texture");
-               return;
-            }
-         }
+         result = shadow_compare4(function, texcoords[i][compare_coord],
+                                  depth00, depth01, depth10, depth11,
+                                  ambient, wi, wj);
 
          switch (tObj->DepthMode) {
          case GL_LUMINANCE:
-            texel[i][RCOMP] = result;
-            texel[i][GCOMP] = result;
-            texel[i][BCOMP] = result;
-            texel[i][ACOMP] = CHAN_MAX;
+            ASSIGN_4V(texel[i], result, result, result, 1.0F);
             break;
          case GL_INTENSITY:
-            texel[i][RCOMP] = result;
-            texel[i][GCOMP] = result;
-            texel[i][BCOMP] = result;
-            texel[i][ACOMP] = result;
+            ASSIGN_4V(texel[i], result, result, result, result);
             break;
          case GL_ALPHA:
-            texel[i][RCOMP] = 0;
-            texel[i][GCOMP] = 0;
-            texel[i][BCOMP] = 0;
-            texel[i][ACOMP] = result;
+            ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result);
             break;
          default:
             _mesa_problem(ctx, "Bad depth texture mode");
          }
+
       }  /* for */
    }  /* if filter */
 }
@@ -3168,7 +3122,7 @@ static void
 null_sample_func( GLcontext *ctx,
                  const struct gl_texture_object *tObj, GLuint n,
                  const GLfloat texcoords[][4], const GLfloat lambda[],
-                 GLchan rgba[][4])
+                 GLfloat rgba[][4])
 {
    GLuint i;
    (void) ctx;
@@ -3225,6 +3179,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx,
          }
          else {
             /* check for a few optimized cases */
+#if 0
             const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
             ASSERT(t->MinFilter == GL_NEAREST);
             if (t->WrapS == GL_REPEAT &&
@@ -3241,6 +3196,10 @@ _swrast_choose_texture_sample_func( GLcontext *ctx,
                      img->TexFormat->MesaFormat == MESA_FORMAT_RGBA) {
                return &opt_sample_rgba_2d;
             }
+#else
+            if (0)
+               ;
+#endif
             else {
                return &sample_nearest_2d;
             }
index 04fb1d8..f1fdddf 100644 (file)
@@ -167,7 +167,7 @@ shade_rastpos(GLcontext *ctx,
                                light->QuadraticAttenuation));
 
         if (light->_Flags & LIGHT_SPOT) {
-           GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection);
+           GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
 
            if (PV_dot_dir<light->_CosCutoff) {
               continue;
index a78f277..124ca3c 100644 (file)
@@ -141,7 +141,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx,
 
            /* spotlight attenuation */
            if (light->_Flags & LIGHT_SPOT) {
-              GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection);
+              GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
 
               if (PV_dot_dir<light->_CosCutoff) {
                  continue; /* this light makes no contribution */
@@ -325,7 +325,7 @@ static void TAG(light_rgba)( GLcontext *ctx,
 
            /* spotlight attenuation */
            if (light->_Flags & LIGHT_SPOT) {
-              GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection);
+              GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
 
               if (PV_dot_dir<light->_CosCutoff) {
                  continue; /* this light makes no contribution */
@@ -721,7 +721,7 @@ static void TAG(light_ci)( GLcontext *ctx,
 
            /* spotlight attenuation */
            if (light->_Flags & LIGHT_SPOT) {
-              GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection);
+              GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection);
               if (PV_dot_dir < light->_CosCutoff) {
                  continue; /* this light makes no contribution */
               }
index f99401c..1795f62 100644 (file)
@@ -176,17 +176,12 @@ static void
 vp_fetch_texel(GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda,
                GLuint unit, GLfloat color[4])
 {
-   GLchan rgba[4];
    SWcontext *swrast = SWRAST_CONTEXT(ctx);
 
    /* XXX use a float-valued TextureSample routine here!!! */
    swrast->TextureSample[unit](ctx, ctx->Texture.Unit[unit]._Current,
                                1, (const GLfloat (*)[4]) texcoord,
-                               &lambda, &rgba);
-   color[0] = CHAN_TO_FLOAT(rgba[0]);
-   color[1] = CHAN_TO_FLOAT(rgba[1]);
-   color[2] = CHAN_TO_FLOAT(rgba[2]);
-   color[3] = CHAN_TO_FLOAT(rgba[3]);
+                               &lambda,  (GLfloat (*)[4]) color);
 }
 
 
index 8c690b4..d56b701 100644 (file)
@@ -197,7 +197,7 @@ int main( int argc, char **argv )
    OFFSET( "LIGHT_DIFFUSE           ", struct gl_light, Diffuse );
    OFFSET( "LIGHT_SPECULAR          ", struct gl_light, Specular );
    OFFSET( "LIGHT_EYE_POSITION      ", struct gl_light, EyePosition );
-   OFFSET( "LIGHT_EYE_DIRECTION     ", struct gl_light, EyeDirection );
+   OFFSET( "LIGHT_SPOT_DIRECTION    ", struct gl_light, SpotDirection );
    OFFSET( "LIGHT_SPOT_EXPONENT     ", struct gl_light, SpotExponent );
    OFFSET( "LIGHT_SPOT_CUTOFF       ", struct gl_light, SpotCutoff );
    OFFSET( "LIGHT_COS_CUTOFF        ", struct gl_light, _CosCutoff );
@@ -211,7 +211,7 @@ int main( int argc, char **argv )
    OFFSET( "LIGHT_POSITION          ", struct gl_light, _Position );
    OFFSET( "LIGHT_VP_INF_NORM       ", struct gl_light, _VP_inf_norm );
    OFFSET( "LIGHT_H_INF_NORM        ", struct gl_light, _h_inf_norm );
-   OFFSET( "LIGHT_NORM_DIRECTION    ", struct gl_light, _NormDirection );
+   OFFSET( "LIGHT_NORM_DIRECTION    ", struct gl_light, _NormSpotDirection );
    OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation );
    printf( "\n" );
    OFFSET( "LIGHT_SPOT_EXP_TABLE    ", struct gl_light, _SpotExpTable );