Merge branch 'gallium-0.1' into gallium-0.2
authorKeith Whitwell <keith@tungstengraphics.com>
Thu, 11 Sep 2008 15:05:15 +0000 (16:05 +0100)
committerKeith Whitwell <keith@tungstengraphics.com>
Thu, 11 Sep 2008 15:05:15 +0000 (16:05 +0100)
A first attempt at moving gallium onto a branch directly off master...

It will be interesting to see how much work this takes to get running.

Have resolved the conflicts semi-arbitarily, not compiled or tested.

Conflicts:

.gitignore
Makefile
configs/config.mgw
configs/darwin
configs/darwin-x86ppc
configs/default
configs/freebsd-dri
configs/linux-dri
configs/linux-dri-xcb
configs/linux-fbdev
configs/linux-static
configs/linux-x86-64-static
configs/linux-x86-static
doxygen/Makefile
include/GL/gl.h
progs/demos/Makefile
progs/demos/descrip.mms
progs/demos/texenv.c
progs/egl/.gitignore
progs/egl/Makefile
progs/glsl/.gitignore
progs/glsl/Makefile
progs/glsl/convolutions.c
progs/samples/Makefile.mgw
progs/tests/.gitignore
progs/trivial/.gitignore
progs/trivial/point-param.c
progs/trivial/tri.c
progs/xdemos/.gitignore
progs/xdemos/glthreads.c
src/egl/drivers/demo/Makefile
src/egl/drivers/dri/Makefile
src/egl/main/Makefile
src/glu/Makefile
src/glu/sgi/Makefile
src/glu/sgi/Makefile.mgw
src/glut/glx/Makefile.mgw
src/glut/os2/WarpWin.cpp
src/glut/os2/glut_cindex.cpp
src/glut/os2/glut_gamemode.cpp
src/glut/os2/glut_win.cpp
src/glut/os2/glut_winmisc.cpp
src/glut/os2/os2_glx.cpp
src/glut/os2/os2_menu.cpp
src/glut/os2/os2_winproc.cpp
src/glw/Makefile
src/glx/x11/dri_glx.c
src/glx/x11/glxext.c
src/mesa/Makefile
src/mesa/Makefile.mgw
src/mesa/descrip.mms
src/mesa/drivers/beos/Makefile
src/mesa/drivers/common/descrip.mms
src/mesa/drivers/common/driverfuncs.c
src/mesa/drivers/directfb/Makefile
src/mesa/drivers/dri/Makefile.template
src/mesa/drivers/dri/common/dri_bufmgr.c
src/mesa/drivers/dri/common/dri_bufmgr.h
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/extension_helper.h
src/mesa/drivers/dri/common/mmio.h
src/mesa/drivers/dri/common/utils.c
src/mesa/drivers/dri/common/utils.h
src/mesa/drivers/dri/glcore/Makefile
src/mesa/drivers/dri/i810/i810screen.c
src/mesa/drivers/dri/i915/intel_ioctl.c
src/mesa/drivers/dri/i915/intel_ioctl.h
src/mesa/drivers/dri/i915/intel_screen.c
src/mesa/drivers/dri/i915/server/i830_common.h
src/mesa/drivers/dri/i915/server/i830_dri.h
src/mesa/drivers/dri/i965/intel_screen.c
src/mesa/drivers/dri/i965/server/i830_common.h
src/mesa/drivers/dri/i965/server/i830_dri.h
src/mesa/drivers/dri/mach64/mach64_screen.c
src/mesa/drivers/dri/nouveau/nouveau_context.h
src/mesa/drivers/dri/nouveau/nouveau_fifo.c
src/mesa/drivers/dri/nouveau/nouveau_fifo.h
src/mesa/drivers/dri/nouveau/nouveau_screen.c
src/mesa/drivers/dri/nouveau/nouveau_screen.h
src/mesa/drivers/dri/r128/r128_tex.h
src/mesa/drivers/dri/savage/savageioctl.h
src/mesa/drivers/fbdev/Makefile
src/mesa/drivers/osmesa/Makefile
src/mesa/drivers/osmesa/descrip.mms
src/mesa/drivers/x11/Makefile
src/mesa/drivers/x11/descrip.mms
src/mesa/drivers/x11/xm_dd.c
src/mesa/glapi/glapi.c
src/mesa/glapi/glthread.c
src/mesa/main/api_validate.c
src/mesa/main/attrib.c
src/mesa/main/bufferobj.c
src/mesa/main/bufferobj.h
src/mesa/main/buffers.c
src/mesa/main/config.h
src/mesa/main/context.c
src/mesa/main/descrip.mms
src/mesa/main/drawpix.c
src/mesa/main/enums.c
src/mesa/main/fbobject.c
src/mesa/main/glheader.h
src/mesa/main/imports.c
src/mesa/main/mipmap.c
src/mesa/main/mm.c
src/mesa/main/mm.h
src/mesa/main/mtypes.h
src/mesa/main/points.c
src/mesa/main/sources
src/mesa/main/state.c
src/mesa/main/texcompress_fxt1.c
src/mesa/main/texenvprogram.c
src/mesa/main/texobj.c
src/mesa/main/texstate.c
src/mesa/main/texstore.c
src/mesa/math/descrip.mms
src/mesa/shader/arbprogram.c
src/mesa/shader/descrip.mms
src/mesa/shader/prog_execute.c
src/mesa/shader/prog_statevars.c
src/mesa/shader/prog_statevars.h
src/mesa/shader/prog_uniform.c
src/mesa/shader/program.c
src/mesa/shader/program.h
src/mesa/shader/shader_api.c
src/mesa/shader/slang/descrip.mms
src/mesa/shader/slang/library/slang_vertex_builtin_gc.h
src/mesa/sources
src/mesa/swrast/descrip.mms
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_fragprog.c
src/mesa/swrast/s_readpix.c
src/mesa/swrast/s_span.c
src/mesa/swrast_setup/descrip.mms
src/mesa/tnl/descrip.mms
src/mesa/tnl/t_context.h
src/mesa/tnl/t_vp_build.c
src/mesa/tnl/tnl.h
src/mesa/vbo/descrip.mms
src/mesa/vbo/vbo_context.c
src/mesa/vbo/vbo_exec_array.c
src/mesa/x86-64/xform4.S
src/mesa/x86/rtasm/x86sse.c
src/mesa/x86/rtasm/x86sse.h
windows/VC6/progs/glut/glut.dsp
windows/VC7/mesa/gdi/gdi.vcproj
windows/VC7/mesa/glu/glu.vcproj
windows/VC7/mesa/mesa.sln
windows/VC7/mesa/mesa/mesa.vcproj
windows/VC7/mesa/osmesa/osmesa.vcproj
windows/VC7/progs/glut/glut.vcproj
windows/VC8/mesa/gdi/gdi.vcproj
windows/VC8/mesa/glu/glu.vcproj
windows/VC8/mesa/mesa.sln
windows/VC8/mesa/mesa/mesa.vcproj
windows/VC8/progs/glut/glut.vcproj

237 files changed:
1  2 
.gitignore
Makefile
configs/beos
configs/default
configs/freebsd-dri
configs/linux-directfb
configs/linux-dri
configs/linux-dri-x86
configs/linux-dri-x86-64
configs/linux-dri-xcb
configs/linux-fbdev
configs/linux-indirect
configs/linux-osmesa
configs/linux-osmesa16
configs/linux-osmesa16-static
configs/linux-osmesa32
configs/linux-solo
configs/linux-solo-x86
configs/linux-static
configs/linux-x86-64-static
configs/linux-x86-glide
configs/linux-x86-static
configs/sunos5-gcc
docs/OLD/MESA_packed_depth_stencil.spec
docs/OLD/MESA_program_debug.spec
docs/OLD/MESA_sprite_point.spec
docs/OLD/MESA_trace.spec
docs/news.html
include/GL/internal/glcore.h
progs/demos/.gitignore
progs/egl/Makefile
progs/fbdev/Makefile
progs/fp/Makefile
progs/glsl/.gitignore
progs/glsl/Makefile
progs/glsl/convolutions.c
progs/glsl/texdemo1.c
progs/miniglx/Makefile
progs/tests/.gitignore
progs/tests/Makefile
progs/tests/antialias.c
progs/tests/cva.c
progs/tests/multipal.c
progs/tests/texline.c
progs/trivial/Makefile
progs/trivial/point-param.c
progs/trivial/quad-clip-nearplane.c
progs/trivial/tri.c
src/egl/Makefile
src/egl/drivers/dri/Makefile
src/egl/main/Makefile
src/glu/mini/project.c
src/glu/sgi/libnurbs/interface/bezierPatch.cc
src/glu/sgi/libnurbs/interface/insurfeval.cc
src/glu/sgi/libutil/error.c
src/glu/sgi/libutil/project.c
src/glut/beos/Makefile
src/glut/directfb/Makefile
src/glut/fbdev/Makefile
src/glut/ggi/Makefile
src/glut/glx/Makefile
src/glut/mini/Makefile
src/glw/Makefile
src/glx/mini/Makefile
src/glx/x11/Makefile
src/glx/x11/XF86dri.c
src/glx/x11/glxclient.h
src/glx/x11/glxcmds.c
src/glx/x11/glxext.c
src/glx/x11/indirect.c
src/glx/x11/pixelstore.c
src/glx/x11/singlepix.c
src/glx/x11/xf86dri.h
src/glx/x11/xfont.c
src/mesa/Makefile
src/mesa/drivers/common/driverfuncs.c
src/mesa/drivers/dri/Makefile.template
src/mesa/drivers/dri/common/dri_util.c
src/mesa/drivers/dri/common/dri_util.h
src/mesa/drivers/dri/common/mmio.h
src/mesa/drivers/dri/common/texmem.c
src/mesa/drivers/dri/common/utils.c
src/mesa/drivers/dri/common/utils.h
src/mesa/drivers/dri/common/vblank.c
src/mesa/drivers/dri/common/vblank.h
src/mesa/drivers/dri/fb/fb_dri.c
src/mesa/drivers/dri/ffb/ffb_clear.c
src/mesa/drivers/dri/ffb/ffb_linetmp.h
src/mesa/drivers/dri/ffb/ffb_pointtmp.h
src/mesa/drivers/dri/ffb/ffb_vtxfmt.c
src/mesa/drivers/dri/ffb/ffb_xmesa.c
src/mesa/drivers/dri/gamma/gamma_context.h
src/mesa/drivers/dri/gamma/gamma_render.c
src/mesa/drivers/dri/gamma/gamma_span.c
src/mesa/drivers/dri/gamma/gamma_xmesa.c
src/mesa/drivers/dri/i810/i810context.c
src/mesa/drivers/dri/i810/i810ioctl.h
src/mesa/drivers/dri/i810/i810screen.c
src/mesa/drivers/dri/i810/i810state.c
src/mesa/drivers/dri/i810/i810tris.c
src/mesa/drivers/dri/mach64/mach64_context.c
src/mesa/drivers/dri/mach64/mach64_context.h
src/mesa/drivers/dri/mach64/mach64_ioctl.c
src/mesa/drivers/dri/mach64/mach64_ioctl.h
src/mesa/drivers/dri/mach64/mach64_lock.c
src/mesa/drivers/dri/mach64/mach64_screen.c
src/mesa/drivers/dri/mach64/mach64_screen.h
src/mesa/drivers/dri/mach64/mach64_span.c
src/mesa/drivers/dri/mach64/mach64_state.c
src/mesa/drivers/dri/mach64/mach64_tex.h
src/mesa/drivers/dri/mach64/mach64_tris.c
src/mesa/drivers/dri/mga/mga_xmesa.c
src/mesa/drivers/dri/mga/mgacontext.h
src/mesa/drivers/dri/mga/mgadd.c
src/mesa/drivers/dri/mga/mgaioctl.h
src/mesa/drivers/dri/mga/mgarender.c
src/mesa/drivers/dri/mga/mgatris.c
src/mesa/drivers/dri/r128/r128_context.c
src/mesa/drivers/dri/r128/r128_context.h
src/mesa/drivers/dri/r128/r128_ioctl.c
src/mesa/drivers/dri/r128/r128_ioctl.h
src/mesa/drivers/dri/r128/r128_screen.c
src/mesa/drivers/dri/r128/r128_screen.h
src/mesa/drivers/dri/r128/r128_span.c
src/mesa/drivers/dri/r128/r128_state.c
src/mesa/drivers/dri/r128/r128_tex.h
src/mesa/drivers/dri/r200/r200_ioctl.c
src/mesa/drivers/dri/r200/r200_state.c
src/mesa/drivers/dri/radeon/radeon_context.c
src/mesa/drivers/dri/radeon/radeon_ioctl.c
src/mesa/drivers/dri/radeon/radeon_ioctl.h
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_screen.h
src/mesa/drivers/dri/radeon/radeon_state.c
src/mesa/drivers/dri/radeon/radeon_tcl.c
src/mesa/drivers/dri/radeon/radeon_tex.h
src/mesa/drivers/dri/radeon/radeon_texmem.c
src/mesa/drivers/dri/radeon/radeon_texstate.c
src/mesa/drivers/dri/savage/savage_xmesa.c
src/mesa/drivers/dri/savage/savageioctl.h
src/mesa/drivers/dri/savage/savagestate.c
src/mesa/drivers/dri/savage/savagetex.c
src/mesa/drivers/dri/savage/savagetris.c
src/mesa/drivers/dri/sis/sis_context.h
src/mesa/drivers/dri/sis/sis_screen.c
src/mesa/drivers/dri/sis/sis_span.c
src/mesa/drivers/dri/sis/sis_state.c
src/mesa/drivers/dri/sis/sis_tex.c
src/mesa/drivers/dri/sis/sis_tris.h
src/mesa/drivers/dri/tdfx/tdfx_context.h
src/mesa/drivers/dri/tdfx/tdfx_render.c
src/mesa/drivers/dri/tdfx/tdfx_screen.c
src/mesa/drivers/dri/tdfx/tdfx_state.c
src/mesa/drivers/dri/unichrome/via_screen.c
src/mesa/drivers/dri/unichrome/via_state.c
src/mesa/drivers/svga/svgamesa24.c
src/mesa/drivers/svga/svgamesa32.c
src/mesa/drivers/windows/gdi/wgl.c
src/mesa/drivers/x11/xm_api.c
src/mesa/drivers/x11/xm_dd.c
src/mesa/drivers/x11/xm_tri.c
src/mesa/drivers/x11/xmesaP.h
src/mesa/glapi/glapi.c
src/mesa/glapi/glthread.h
src/mesa/main/api_validate.c
src/mesa/main/attrib.c
src/mesa/main/bufferobj.c
src/mesa/main/bufferobj.h
src/mesa/main/buffers.c
src/mesa/main/buffers.h
src/mesa/main/clear.c
src/mesa/main/config.h
src/mesa/main/context.c
src/mesa/main/context.h
src/mesa/main/dd.h
src/mesa/main/dlist.c
src/mesa/main/drawpix.c
src/mesa/main/enable.c
src/mesa/main/enums.c
src/mesa/main/extensions.c
src/mesa/main/fbobject.c
src/mesa/main/framebuffer.c
src/mesa/main/get.c
src/mesa/main/get_gen.py
src/mesa/main/glheader.h
src/mesa/main/image.c
src/mesa/main/imports.c
src/mesa/main/imports.h
src/mesa/main/light.c
src/mesa/main/mipmap.c
src/mesa/main/mtypes.h
src/mesa/main/points.c
src/mesa/main/state.c
src/mesa/main/texcompress_fxt1.c
src/mesa/main/texenvprogram.c
src/mesa/main/texformat.h
src/mesa/main/teximage.c
src/mesa/main/texstate.c
src/mesa/main/texstate.h
src/mesa/main/texstore.c
src/mesa/main/texstore.h
src/mesa/main/varray.c
src/mesa/main/varray.h
src/mesa/math/m_debug_util.h
src/mesa/shader/prog_execute.c
src/mesa/shader/prog_statevars.c
src/mesa/shader/prog_statevars.h
src/mesa/shader/prog_uniform.c
src/mesa/shader/program.c
src/mesa/shader/program.h
src/mesa/swrast/s_accum.c
src/mesa/swrast/s_blend.c
src/mesa/swrast/s_blit.c
src/mesa/swrast/s_buffers.c
src/mesa/swrast/s_context.c
src/mesa/swrast/s_copypix.c
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_points.c
src/mesa/swrast/s_readpix.c
src/mesa/swrast/s_span.c
src/mesa/swrast/s_stencil.c
src/mesa/swrast/s_texfilter.c
src/mesa/swrast/s_texstore.c
src/mesa/swrast/s_triangle.c
src/mesa/swrast/s_zoom.c
src/mesa/swrast_setup/ss_context.c
src/mesa/swrast_setup/ss_triangle.c
src/mesa/tnl/t_context.c
src/mesa/tnl/t_draw.c
src/mesa/tnl/t_vb_fog.c
src/mesa/tnl/t_vertex_sse.c
src/mesa/tnl/t_vp_build.c
src/mesa/tnl/tnl.h
src/mesa/vbo/vbo_context.c
src/mesa/x86-64/Makefile
src/mesa/x86/Makefile
src/mesa/x86/rtasm/x86sse.c

diff --cc .gitignore
@@@ -1,16 -1,14 +1,21 @@@
  *.a
  *.o
+ *.pyc
+ *.pyo
  *.so
  *.sw[a-z]
 +*.pc
  *~
  depend
  depend.bak
  lib
  lib64
 +configure
 +autom4te.cache
 +aclocal.m4
 +config.log
 +config.status
 +cscope*
+ .sconsign*
+ config.py
+ build
diff --cc Makefile
+++ b/Makefile
@@@ -23,19 -27,18 +25,18 @@@ clean
                        (cd $$dir && $(MAKE) clean) ; \
                fi \
        done
 +      -@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current
  
  
 -realclean:
 -      -rm -f `find . -name \*.o`
 -      -rm -f `find . -name \*.a`
 -      -rm -f `find . -name \*.so`
 -      -rm -f `find . -name depend`
 +realclean: clean
        -rm -rf lib*
 -      $(MAKE) clean
        -rm -f $(TOP)/configs/current
 +      -rm -f $(TOP)/configs/autoconf
 +      -rm -rf autom4te.cache
 +      -find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \
 +        -name depend -o -name depend.bak ')' -exec rm -f '{}' ';'
  
  
  install:
        @for dir in $(SUBDIRS) ; do \
                if [ -d $$dir ] ; then \
diff --cc configs/beos
Simple merge
diff --cc configs/default
@@@ -19,9 -18,9 +19,10 @@@ DRM_SOURCE_PATH=$(TOP)/../dr
  # Compiler and flags
  CC = cc
  CXX = CC
+ HOST_CC = $(CC)
  CFLAGS = -O
  CXXFLAGS = -O
 +LDFLAGS =
  GLU_CFLAGS = 
  
  # Misc tools and flags
@@@ -54,15 -49,9 +55,15 @@@ GLUT_LIB_NAME = lib$(GLUT_LIB).s
  GLW_LIB_NAME = lib$(GLW_LIB).so
  OSMESA_LIB_NAME = lib$(OSMESA_LIB).so
  
 +# globs used to install the lib and all symlinks
 +GL_LIB_GLOB = $(GL_LIB_NAME)*
 +GLU_LIB_GLOB = $(GLU_LIB_NAME)*
 +GLUT_LIB_GLOB = $(GLUT_LIB_NAME)*
 +GLW_LIB_GLOB = $(GLW_LIB_NAME)*
 +OSMESA_LIB_GLOB = $(OSMESA_LIB_NAME)*
  
  # Optional assembly language optimization files for libGL
- ASM_SOURCES = 
MESA_ASM_SOURCES = 
  
  # GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in
  # order to build the Motif widget too)
@@@ -78,17 -66,26 +79,28 @@@ DRIVER_DIRS 
  # Which subdirs under $(TOP)/progs/ to enter:
  PROGRAM_DIRS = demos redbook samples glsl xdemos
  
+ # EGL directories
+ EGL_DRIVERS_DIRS = demo
+ # Gallium directories and 
+ GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util
+ GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
+ GALLIUM_DRIVER_DIRS = softpipe i915simple i965simple failover
+ GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVER_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
+ GALLIUM_WINSYS_DIRS = xlib egl_xlib
  
 -# Library/program dependencies
 +# Library dependencies
  #EXTRA_LIB_PATH ?=
- GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
- OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
- GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
- GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXmu -lXi -lm
- GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lXt -lX11
+ GL_LIB_DEPS     = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
+ OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
+ GLU_LIB_DEPS    = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
+ GLUT_LIB_DEPS   = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm
+ GLW_LIB_DEPS    = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11
+ APP_LIB_DEPS    = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
  
 +# Program dependencies - specific GL/glut libraries added in Makefiles
 +APP_LIB_DEPS = -lm
  
  
  # Installation directories (for make install)
@@@ -22,11 -22,7 +22,12 @@@ CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(P
  
  CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) -Wall -ansi -pedantic $(ASM_FLAGS) $(X11_INCLUDES) 
  
 +# Work around aliasing bugs - developers should comment this out
 +CFLAGS += -fno-strict-aliasing
 +CXXFLAGS += -fno-strict-aliasing
 +
 +ASM_SOURCES = 
+ MESA_ASM_SOURCES = 
  
  # Library/program dependencies
  LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
Simple merge
@@@ -32,43 -32,31 +32,51 @@@ CFLAGS = -Wall -Wmissing-prototypes -st
  
  CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
  
 +GLUT_CFLAGS = -fexceptions
 +
 +# Work around aliasing bugs - developers should comment this out
 +CFLAGS += -fno-strict-aliasing
 +CXXFLAGS += -fno-strict-aliasing
  
- ASM_SOURCES = 
MESA_ASM_SOURCES = 
  
  # Library/program dependencies
  EXTRA_LIB_PATH=-L/usr/X11R6/lib
  
- LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
- LIBDRM_LIB = `pkg-config --libs libdrm`
+ LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
+ LIBDRM_LIB = $(shell pkg-config --libs libdrm)
  DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
  GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
 -              -lm -lpthread -ldl \
 -                $(LIBDRM_LIB)
 +              -lm -lpthread -ldl $(LIBDRM_LIB)
  
  
- # This is now 0 by default since it seems to confuse the hell out of people
- # and generate a lot of extra noise on bugzilla.  If you need to build with
- # EGL, do 'make linux-dri USING_EGL=1'
+ # Directories
+ SRC_DIRS := glx/x11 egl $(SRC_DIRS)
  
- USING_EGL=0
  
- DRIVER_DIRS = dri
- WINDOW_SYSTEM=dri
 +# Directories
 +ifeq ($(USING_EGL), 1)
 +SRC_DIRS = egl glx/x11 mesa glu glut/glx glw
 +PROGRAM_DIRS = egl xdemos
 +else
 +SRC_DIRS = glx/x11 mesa glu glut/glx glw
 +PROGRAM_DIRS = xdemos
 +endif
 +
+ # EGL directories
+ EGL_DRIVERS_DIRS = demo dri xdri
+ DRIVER_DIRS =
+ WINDOW_SYSTEM = dri
+ GALLIUM_WINSYS_DIRS = drm egl_xlib
  
  # gamma are missing because they have not been converted to use the new
  # interface.
- DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
-       savage sis tdfx trident unichrome ffb
++
++# XXX: need to figure out a way for gallium and non-gallium builds to
++# coexist:
++#
++
++#DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \
++#     savage sis tdfx trident unichrome ffb
+ DRI_DIRS = intel 
Simple merge
Simple merge
@@@ -32,21 -32,17 +32,20 @@@ CFLAGS = -Wall -Wmissing-prototypes $(O
  
  CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
  
 +# Work around aliasing bugs - developers should comment this out
 +CFLAGS += -fno-strict-aliasing
 +CXXFLAGS += -fno-strict-aliasing
  
- ASM_SOURCES = 
MESA_ASM_SOURCES = 
  
  # Library/program dependencies
- EXTRA_LIB_PATH=`pkg-config --libs-only-L x11`
+ EXTRA_LIB_PATH=$(shell pkg-config --libs-only-L x11)
  
- LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
- LIBDRM_LIB = `pkg-config --libs libdrm`
+ LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
+ LIBDRM_LIB = $(shell pkg-config --libs libdrm)
  DRI_LIB_DEPS  = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
- GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
-               -lm -lpthread -ldl $(LIBDRM_LIB) `pkg-config --libs xcb` \
-               `pkg-config --libs x11-xcb` `pkg-config --libs xcb-glx`
+ GL_LIB_DEPS   = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
+                 $(LIBDRM_LIB) $(shell pkg-config --libs xcb) $(shell pkg-config --libs x11-xcb) $(shell pkg-config --libs xcb-glx)
  
  
  # This is now 0 by default since it seems to confuse the hell out of people
@@@ -57,11 -53,11 +56,11 @@@ USING_EGL=
  
  # Directories
  ifeq ($(USING_EGL), 1)
- SRC_DIRS = egl glx/x11 mesa glu glut/glx glw
- PROGRAM_DIRS = egl xdemos
+ SRC_DIRS = egl glx/x11 gallium mesa glu glut/glx glw
+ PROGRAM_DIRS = egl
  else
- SRC_DIRS = glx/x11 mesa glu glut/glx glw
+ SRC_DIRS = glx/x11 gallium mesa glu glut/glx glw
 -PROGRAM_DIRS =
 +PROGRAM_DIRS = xdemos
  endif
  
  DRIVER_DIRS = dri
@@@ -6,10 -6,7 +6,10 @@@ CONFIG_NAME = linux-fbde
  
  CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER
  
- SRC_DIRS = mesa glu glut/fbdev
 +# Work around aliasing bugs - developers should comment this out
 +CFLAGS += -fno-strict-aliasing
 +
+ SRC_DIRS = gallium mesa glu glut/fbdev
  DRIVER_DIRS = fbdev osmesa
  PROGRAM_DIRS = fbdev demos redbook samples
  
@@@ -33,11 -33,8 +33,11 @@@ CFLAGS   = $(WARN_FLAGS) $(OPT_FLAGS) $
  
  CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
  
 +# Work around aliasing bugs - developers should comment this out
 +CFLAGS += -fno-strict-aliasing
 +CXXFLAGS += -fno-strict-aliasing
  
- ASM_SOURCES = 
MESA_ASM_SOURCES = 
  
  # Library/program dependencies
  EXTRA_LIB_PATH=-L/usr/X11R6/lib
@@@ -12,12 -12,9 +12,12 @@@ CXX = g+
  CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS
  CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
  
 +# Work around aliasing bugs - developers should comment this out
 +CFLAGS += -fno-strict-aliasing
 +CXXFLAGS += -fno-strict-aliasing
  
  # Directories
- SRC_DIRS = mesa glu
+ SRC_DIRS = gallium mesa glu
  DRIVER_DIRS = osmesa
  PROGRAM_DIRS = osdemos
  
Simple merge
Simple merge
Simple merge
@@@ -32,11 -32,8 +32,11 @@@ CFLAGS   = $(WARN_FLAGS) $(OPT_FLAGS) $
  
  CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
  
 +# Work around aliasing bugs - developers should comment this out
 +CFLAGS += -fno-strict-aliasing
 +CXXFLAGS += -fno-strict-aliasing
  
- ASM_SOURCES = 
MESA_ASM_SOURCES = 
  
  # Library/program dependencies
  DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(TOP)/$(LIB_DIR) $(PCIACCESS_LIB)
@@@ -5,6 -5,9 +5,6 @@@ include $(TOP)/configs/linux-sol
  
  CONFIG_NAME = linux-solo-x86
  
 -# Unnecessary on x86, generally.
 -PIC_FLAGS = 
 -
  ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM
- ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)
MESA_ASM_SOURCES = $(X86_SOURCES)
GLAPI_ASM_SOURCES = $(X86_API)
@@@ -22,5 -21,7 +22,7 @@@ GLUT_LIB_DEPS 
  GLW_LIB_DEPS = 
  
  # Need to specify all libraries we may need
- APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread \
-       -lstdc++ -lm
+ APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \
+       -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group -lm \
 -      -L/usr/X11R6/lib/ -lX11 -lXmu -lXi -lpthread
++      -L/usr/X11R6/lib/ -lX11 -lXext -lXmu -lXi -lpthread
@@@ -20,5 -19,8 +20,8 @@@ OSMESA_LIB_DEPS 
  GLU_LIB_DEPS = 
  GLUT_LIB_DEPS = 
  GLW_LIB_DEPS = 
- APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread \
-       -lstdc++ -lm
+ # Need to specify all libraries we may need
+ APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \
+                -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group \
 -               $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm
++               $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm
@@@ -14,12 -14,9 +14,12 @@@ CXXFLAGS = -Wall -O3 -ansi -pedantic -f
  
  GLUT_CFLAGS = -fexceptions
  
 +# Work around aliasing bugs - developers should comment this out
 +CFLAGS += -fno-strict-aliasing
 +CXXFLAGS += -fno-strict-aliasing
  
- ASM_SOURCES = $(X86_SOURCES)
ASM_API = $(X86_API)
MESA_ASM_SOURCES = $(X86_SOURCES)
GLAPI_ASM_SOURCES = $(X86_API)
  
  # Library/program dependencies
  GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -L/usr/local/glide/lib -lglide3x -lm -lpthread
@@@ -20,5 -19,8 +20,8 @@@ OSMESA_LIB_DEPS 
  GLU_LIB_DEPS = 
  GLUT_LIB_DEPS = 
  GLW_LIB_DEPS = 
- APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread \
-       -lstdc++ -lm
+ # Need to specify all libraries we may need
+ APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \
+                -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group \
 -               $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm
++               $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc docs/news.html
Simple merge
Simple merge
Simple merge
@@@ -45,8 -49,15 +49,15 @@@ demo3.o: demo3.c $(HEADERS
        $(CC) -c $(CFLAGS) -I$(TOP)/include demo3.c
  
  
 -      $(CC) $(CFLAGS) egltri.o -L$(TOP)/$(LIB_DIR) -lGL -lEGL $(LIBDRM_LIB) -o $@
+ egltri: egltri.o $(TOP)/$(LIB_DIR)/libEGL.so
++      $(CC) $(CFLAGS) egltri.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@
+ egltri.o: egltri.c $(HEADERS)
+       $(CC) -c $(CFLAGS) -I$(TOP)/include egltri.c
  eglinfo: eglinfo.o $(TOP)/$(LIB_DIR)/libEGL.so
 -      $(CC) $(CFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) -lGL -lEGL $(LIBDRM_LIB) -o $@
 +      $(CC) $(CFLAGS) $(LDFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@
  
  eglinfo.o: eglinfo.c $(HEADERS)
        $(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c
@@@ -59,7 -70,34 +70,29 @@@ eglgears.o: eglgears.c $(HEADERS
        $(CC) -c $(CFLAGS) -I$(TOP)/include eglgears.c
  
  
+ peglgears: peglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
+       $(CC) $(CFLAGS) peglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
+ peglgears.o: peglgears.c $(HEADERS)
+       $(CC) -c $(CFLAGS) -I$(TOP)/include peglgears.c
+ xeglgears: xeglgears.o $(TOP)/$(LIB_DIR)/libEGL.so
+       $(CC) $(CFLAGS) xeglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
+ xeglgears.o: xeglgears.c $(HEADERS)
+       $(CC) -c $(CFLAGS) -I$(TOP)/include xeglgears.c
+ xegl_tri: xegl_tri.o $(TOP)/$(LIB_DIR)/libEGL.so
+       $(CC) $(CFLAGS) xegl_tri.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@
+ xegl_tri.o: xegl_tri.c $(HEADERS)
+       $(CC) -c $(CFLAGS) -I$(TOP)/include xegl_tri.c
  clean:
 -      rm -f *.o *~
 -      rm -f *.so
 -      rm -f $(PROGRAMS)
 +      -rm -f *.o *~
 +      -rm -f *.so
 +      -rm -f $(PROGRAMS)
 -run:
 -      LD_LIBRARY_PATH=$(TOP)/lib ./egltri
 -
 -debug:
 -      LD_LIBRARY_PATH=$(TOP)/lib gdb ./eglgears
Simple merge
@@@ -8,44 -8,10 +8,10 @@@ TOP = ../.
  include $(TOP)/configs/current
  
  
 -LIBS = $(APP_LIB_DEPS)
 +LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
  
  SOURCES = \
-       tri-abs.c \
-       tri-add.c \
-       tri-cmp.c \
-       tri-cos.c \
-       tri-dp3.c \
-       tri-dp4.c \
-       tri-dph.c \
-       tri-dst.c \
-       tri-ex2.c \
-       tri-flr.c \
-       tri-frc.c \
-       tri-kil.c \
-       tri-lg2.c \
-       tri-lit.c \
-       tri-lrp.c \
-       tri-mad.c \
-       tri-max.c \
-       tri-min.c \
-       tri-mov.c \
-       tri-mul.c \
-       tri-pow.c \
-       tri-param.c \
-       tri-rcp.c \
-       tri-rsq.c \
-       tri-scs.c \
-       tri-sge.c \
-       tri-sge2.c \
-       tri-sin.c \
-       tri-slt.c \
-       tri-sub.c \
-       tri-swz.c \
-       tri-swz2.c \
        tri-tex.c \
-       tri-xpd.c \
-       tri-position.c \
        point-position.c \
        tri-depth.c \
        tri-depth2.c \
@@@ -1,6 -1,6 +1,7 @@@
 +bitmap
  brick
  bump
+ convolutions
  deriv
  extfuncs.h
  mandelbrot
@@@ -7,23 -7,15 +7,25 @@@ INCDIR = $(TOP)/includ
  
  LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
  
 +LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
 +
  PROGS = \
 +      bitmap \
        brick \
        bump \
 +      convolutions \
        deriv \
        mandelbrot \
 +      multitex \
        noise \
 +      points \
 +      pointcoord \
 +      texdemo1 \
        toyball \
-       trirast
 +      twoside \
++      trirast \
+       texdemo1 \
+         convolutions
  
  
  ##### RULES #####
@@@ -58,117 -49,25 +60,121 @@@ readtex.h: $(TOP)/progs/util/readtex.
  readtex.o: readtex.c readtex.h
        $(CC) -c -I$(INCDIR) $(CFLAGS) readtex.c
  
 -brick.c: extfuncs.h
  
 -bump.c: extfuncs.h
 +shaderutil.c: $(TOP)/progs/util/shaderutil.c
 +      cp $< .
 +
 +shaderutil.h: $(TOP)/progs/util/shaderutil.h
 +      cp $< .
 +
 +shaderutil.o: shaderutil.c shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) shaderutil.c
 +
 +
 +
 +bitmap.o: bitmap.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) bitmap.c
 +
 +bitmap: bitmap.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bitmap.o shaderutil.o $(LIBS) -o $@
 +
 +
 +brick.o: brick.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) brick.c
 +
 +brick: brick.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) brick.o shaderutil.o $(LIBS) -o $@
 +
 +
 +bump.o: bump.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) bump.c
 +
 +bump: bump.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bump.o shaderutil.o $(LIBS) -o $@
 +
 +
 +convolutions.o: convolutions.c readtex.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) convolutions.c
 +
 +convolutions: convolutions.o readtex.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) convolutions.o readtex.o $(LIBS) -o $@
 +
 +
 +deriv.o: deriv.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) deriv.c
  
 -mandelbrot.c: extfuncs.h
 +deriv: deriv.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) deriv.o shaderutil.o $(LIBS) -o $@
  
 -toyball.c: extfuncs.h
  
 -texdemo1: texdemo1.o readtex.o
 -      $(CC) -I$(INCDIR) $(CFLAGS) texdemo1.o readtex.o $(APP_LIB_DEPS) -o $@
 +mandelbrot.o: mandelbrot.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) mandelbrot.c
  
 -texdemo1.o: texdemo1.c readtex.h extfuncs.h
 +mandelbrot: mandelbrot.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) mandelbrot.o shaderutil.o $(LIBS) -o $@
 +
 +
 +multitex.o: multitex.c extfuncs.h readtex.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) multitex.c
 +
 +multitex: multitex.o readtex.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) multitex.o readtex.o shaderutil.o $(LIBS) -o $@
 +
 +
 +noise.o: noise.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) noise.c
 +
 +noise: noise.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) noise.o shaderutil.o $(LIBS) -o $@
 +
 +
 +points.o: points.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) points.c
 +
 +points: points.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) points.o shaderutil.o $(LIBS) -o $@
 +
 +
 +pointcoord.o: pointcoord.c readtex.h extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) pointcoord.c
 +
 +pointcoord: pointcoord.o readtex.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) pointcoord.o readtex.o shaderutil.o $(LIBS) -o $@
 +
 +
 +texdemo1.o: texdemo1.c readtex.h extfuncs.h shaderutil.h
        $(CC) -c -I$(INCDIR) $(CFLAGS) texdemo1.c
  
 +texdemo1: texdemo1.o readtex.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) texdemo1.o readtex.o shaderutil.o $(LIBS) -o $@
 +
 +
 +toyball.o: toyball.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) toyball.c
 +
 +toyball: toyball.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) toyball.o shaderutil.o $(LIBS) -o $@
 +
 +
 +twoside.o: twoside.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) twoside.c
 +
 +twoside: twoside.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) twoside.o shaderutil.o $(LIBS) -o $@
 +
 +
 +trirast.o: trirast.c extfuncs.h shaderutil.h
 +      $(CC) -c -I$(INCDIR) $(CFLAGS) trirast.c
 +
 +trirast: trirast.o shaderutil.o
 +      $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) trirast.o shaderutil.o $(LIBS) -o $@
 +
 +
+ convolutions: convolutions.o readtex.o
+       $(CC) -I$(INCDIR) $(CFLAGS) convolutions.o readtex.o $(APP_LIB_DEPS) -o $@
  
+ convolutions.o: convolutions.c readtex.h
+       $(CC) -c -I$(INCDIR) $(CFLAGS) convolutions.c
  
  
  clean:
@@@ -229,12 -222,11 +229,12 @@@ static void createProgram(const char *v
        glAttachShader(program, fragShader);
     }
  
-    glLinkProgramARB(program);
+    glLinkProgram(program);
     checkLink(program);
  
-    glUseProgramObjectARB(program);
+    glUseProgram(program);
  
 +   /*
     assert(glIsProgram(program));
     assert(glIsShader(fragShader));
     assert(glIsShader(vertShader));
@@@ -325,12 -316,6 +325,13 @@@ static void menuInit(
  
  static void init()
  {
 +   if (!glutExtensionSupported("GL_ARB_shader_objects") ||
 +       !glutExtensionSupported("GL_ARB_vertex_shader") ||
 +       !glutExtensionSupported("GL_ARB_fragment_shader")) {
 +      fprintf(stderr, "Sorry, this program requires GL_ARB_shader_objects, GL_ARB_vertex_shader, and GL_ARB_fragment_shader\n");
 +      exit(1);
 +   }
++
     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));
@@@ -49,12 -48,21 +49,13 @@@ static GLfloat TexXrot = 0, TexYrot = 0
  static GLfloat Xrot = 20.0, Yrot = 20.0, Zrot = 0.0;
  static GLfloat EyeDist = 10;
  static GLboolean Anim = GL_TRUE;
+ static int win = 0;
  
  
 -struct uniform_info {
 -   const char *name;
 -   GLuint size;
 -   GLint location;
 -   GLenum type;  /**< GL_FLOAT or GL_INT */
 -   GLfloat value[4];
 -};
 -
  static struct uniform_info ReflectUniforms[] = {
 -   { "cubeTex",  1, -1, GL_INT, { 0, 0, 0, 0 } },
 -   { "lightPos", 3, -1, GL_FLOAT, { 10, 10, 20, 0 } },
 -   { NULL, 0, 0, 0, { 0, 0, 0, 0 } }
 +   { "cubeTex",  1, GL_INT, { 0, 0, 0, 0 }, -1 },
 +   { "lightPos", 3, GL_FLOAT, { 10, 10, 20, 0 }, -1 },
 +   END_OF_UNIFORMS
  };
  
  static struct uniform_info SimpleUniforms[] = {
Simple merge
@@@ -38,9 -40,10 +41,11 @@@ getproclist.
  interleave
  invert
  jkrahntest
 +lineclip
  manytex
+ minmag
  mipmap_limits
+ mipmap_view
  multipal
  no_s3tc
  packedpixels
@@@ -53,10 -56,9 +58,12 @@@ readtex.
  readtex.h
  seccolor
  sharedtex
 +shader_api
 +stencil_twoside
 +stencil_wrap
  stencilwrap
+ stencil_wrap
+ subtex
  subtexrate
  tex1d
  texcmp
@@@ -61,11 -63,10 +65,12 @@@ SOURCES = 
        random.c \
        readrate.c \
        seccolor.c \
 +      shader_api.c \
        sharedtex.c \
 +      stencil_twoside.c \
        stencilwrap.c \
        stencil_wrap.c \
+       subtex \
        subtexrate.c \
        tex1d.c \
        texcompress2.c \
@@@ -127,40 -131,55 +134,55 @@@ arraytexture: arraytexture.o readtex.
        $(CC) $(CFLAGS) arraytexture.o readtex.o $(LIBS) -o $@
  
  arraytexture.o: arraytexture.c readtex.h
 -      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 +      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) arraytexture.c -o $@
  
  afsmultiarb: afsmultiarb.o readtex.o
 -      $(CC) $(CFLAGS) afsmultiarb.o readtex.o $(LIBS) -o $@
 +      $(CC) $(CFLAGS) $(LDFLAGS) afsmultiarb.o readtex.o $(LIBS) -o $@
  
  afsmultiarb.o: afsmultiarb.c readtex.h
 -      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 +      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) afsmultiarb.c -o $@
  
  drawbuffers: drawbuffers.o
 -      $(CC) $(CFLAGS) drawbuffers.o $(LIBS) -o $@
 +      $(CC) $(CFLAGS) $(LDFLAGS) drawbuffers.o $(LIBS) -o $@
  
  drawbuffers.o: drawbuffers.c extfuncs.h
 -      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 +      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) drawbuffers.c -o $@
  
  texrect: texrect.o readtex.o
 -      $(CC) $(CFLAGS) texrect.o readtex.o $(LIBS) -o $@
 +      $(CC) $(CFLAGS) $(LDFLAGS) texrect.o readtex.o $(LIBS) -o $@
  
  texrect.o: texrect.c readtex.h
 -      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 +      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) texrect.c -o $@
  
  bug_3195: bug_3195.o readtex.o
 -      $(CC) $(CFLAGS) bug_3195.o readtex.o $(LIBS) -o $@
 +      $(CC) $(CFLAGS) $(LDFLAGS) bug_3195.o readtex.o $(LIBS) -o $@
  
  bug_3195.o: bug_3195.c readtex.h
 -      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 +      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) bug_3195.c -o $@
  
  invert: invert.o readtex.o
 -      $(CC) $(CFLAGS) invert.o readtex.o $(LIBS) -o $@
 +      $(CC) $(CFLAGS) $(LDFLAGS) invert.o readtex.o $(LIBS) -o $@
  
  invert.o: invert.c readtex.h
 -      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 +      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) invert.c -o $@
  
+ mipmap_view: mipmap_view.o readtex.o
+       $(CC) $(CFLAGS) mipmap_view.o readtex.o $(LIBS) -o $@
+ mipmap_view.o: mipmap_view.c readtex.h
+       $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+ fillrate: fillrate.o readtex.o
+       $(CC) $(CFLAGS) fillrate.o readtex.o $(LIBS) -o $@
+ fillrate.o: fillrate.c readtex.h
+       $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
  readtex.o: readtex.c
 -      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
 +      $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) readtex.c -o $@
  
  
  readtex.h: $(TOP)/progs/util/readtex.h
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -8,12 -8,26 +8,26 @@@ TOP = ../.
  include $(TOP)/configs/current
  
  
 -LIBS = $(APP_LIB_DEPS)
 +LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS)
  
  SOURCES = \
+       clear-fbo-tex.c \
+       clear-fbo.c \
+       clear-scissor.c \
+       clear-undefined.c \
        clear.c \
+       dlist-dangling.c \
+       dlist-edgeflag-dangling.c \
+       dlist-edgeflag.c \
+       drawarrays.c \
+       drawelements.c \
+       drawrange.c \
+       flat-clip.c \
+       fs-tri.c \
        line-clip.c \
        line-cull.c \
+       line-smooth.c \
+       line-stipple-wide.c \
        line-userclip-clip.c \
        line-userclip-nop-clip.c \
        line-userclip-nop.c \
Simple merge
@@@ -130,10 -118,9 +130,10 @@@ int main(int argc, char **argv
        exit(1);
      }
  
 -    glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250);
 +    glutInitWindowPosition(0, 0);
 +    glutInitWindowSize( 250, 250);
  
-     type = GLUT_RGB;
+     type = GLUT_RGB | GLUT_ALPHA;
      type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
      glutInitDisplayMode(type);
  
@@@ -32,8 -32,7 +32,8 @@@
  #define CI_OFFSET_2 32
  
  
- GLenum doubleBuffer;
+ GLenum doubleBuffer = 1;
 +int win;
  
  static void Init(void)
  {
@@@ -60,7 -59,6 +60,10 @@@ static void Key(unsigned char key, int 
  
      switch (key) {
        case 27:
++<<<<<<< HEAD:progs/trivial/tri.c
 +         glutDestroyWindow(win);
++=======
++>>>>>>> gallium-0.1:progs/trivial/tri.c
        exit(0);
        default:
        return;
Simple merge
@@@ -42,9 -44,8 +44,9 @@@ default: depend library Makefil
  library: $(TOP)/$(LIB_DIR)/libEGLdri.so
  
  $(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
 -      $(TOP)/bin/mklib -o EGLdri -major 1 -minor 0 \
 -              -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(DRM_LIB)
 +      $(MKLIB) -o EGLdri -linker '$(CC)' -ldflags '$(LDFLAGS)' \
 +              -major 1 -minor 0 \
-               -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS)
++              -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
  
  
  clean:
@@@ -46,9 -61,8 +61,9 @@@ default: depend librar
  library: $(TOP)/$(LIB_DIR)/libEGL.so
  
  $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS)
 -      $(TOP)/bin/mklib -o EGL -major 1 -minor 0 \
 +      $(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \
 +              -major 1 -minor 0 \
-               -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS)
+               -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS)
  
  
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -127,8 -113,9 +127,9 @@@ clean
  
  depend: $(SOURCES)
        @ echo "running $(MKDEP)"
+       @ rm -f depend
        @ touch depend
        @ $(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(SOURCES) \
 -              > /dev/null 
 +              $(X11_INCLUDES) > /dev/null 
  
  include depend
Simple merge
@@@ -61,9 -49,10 +61,10 @@@ $(TOP)/$(LIB_DIR)/$(GLW_LIB_NAME): $(OB
  # by any source file.
  # 
  depend: $(GLW_SOURCES)
+       rm -f depend
        touch depend
        $(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(GLW_SOURCES) \
 -              > /dev/null 
 +              $(X11_INCLUDES) > /dev/null
  
  
  include depend
Simple merge
@@@ -31,17 -29,13 +31,17 @@@ SOURCES = 
          xfont.c \
          glx_pbuffer.c \
          glx_query.c \
 -        glx_texture_compression.c \
 +        drisw_glx.c \
 +        dri_common.c \
          dri_glx.c \
 -        XF86dri.c
 +        XF86dri.c \
 +        glxhash.c \
 +        dri2_glx.c \
 +        dri2.c
  
- include $(TOP)/src/mesa/sources
+ include $(TOP)/src/mesa/sources.mak
  
- MESA_ASM_API = $(addprefix $(TOP)/src/mesa/, $(ASM_API))
+ MESA_GLAPI_ASM_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_ASM_SOURCES))
  MESA_GLAPI_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_SOURCES))
  MESA_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/, $(GLAPI_OBJECTS))
  
@@@ -71,16 -65,16 +72,17 @@@ default: depend $(TOP)/$(LIB_DIR)/$(GL_
  
  # Make libGL
  $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME):  $(OBJECTS) Makefile
 -      $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \
 +      $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
                -major 1 -minor 2 $(MKLIB_OPTIONS) \
 -              -install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS)
 +              -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \
 +              $(GL_LIB_DEPS) $(OBJECTS)
  
  
- depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_ASM_API) Makefile
+ depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) Makefile
+       rm -f depend
        touch depend
        $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \
-               $(MESA_GLAPI_SOURCES) $(MESA_ASM_API
+               $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES
  
  
  # Emacs tags
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -3,9 -3,9 +3,8 @@@
  TOP = ../..
  include $(TOP)/configs/current
  
 -include sources.mak
 -
 +include sources
  
  .SUFFIXES : .cpp
  
  .c.o:
  
  
  
 -GLAPI_LIB = libglapi.a
 +# Default: build dependencies, then asm_subdirs, then convenience
 +# libs (.a) and finally the device drivers:
 +default: depend asm_subdirs libmesa.a libglapi.a driver_subdirs
  
  
+ # Default: build dependencies, then asm_subdirs, then convenience
+ # libs (.a) and finally the device drivers:
+ default: depend asm_subdirs libmesa.a $(GLAPI_LIB) driver_subdirs
  
 -
 -
  ######################################################################
  # Helper libraries used by many drivers:
  
  # Make archive of core mesa object files
  libmesa.a: $(MESA_OBJECTS)
 -      @ $(TOP)/bin/mklib -o mesa -static $(MESA_OBJECTS)
 +      @ $(MKLIB) -o mesa -static $(MESA_OBJECTS)
 +
 +# Make archive of gl* API dispatcher functions only
 +libglapi.a: $(GLAPI_OBJECTS)
 +      @ $(MKLIB) -o glapi -static $(GLAPI_OBJECTS)
  
+ # Make archive of gl* API dispatcher functions only
+ $(GLAPI_LIB): $(GLAPI_OBJECTS)
+       @if [ "${WINDOW_SYSTEM}" = "dri" ] ; then \
+               touch libglapi.a ; \
+       else \
+               $(TOP)/bin/mklib -o glapi -static $(GLAPI_OBJECTS) ; \
+       fi
  
 -
  ######################################################################
  # Device drivers
 -driver_subdirs: libmesa.a $(GLAPI_LIB)
 +driver_subdirs: libmesa.a libglapi.a
        (cd drivers && $(MAKE))
  
  
Simple merge
@@@ -2,14 -2,22 +2,17 @@@
  
  MESA_MODULES = $(TOP)/src/mesa/libmesa.a
  
- COMMON_SOURCES = \
+ COMMON_GALLIUM_SOURCES = \
          ../common/utils.c \
-         ../common/texmem.c \
          ../common/vblank.c \
          ../common/dri_util.c \
-         ../common/xmlconfig.c \
-         ../common/drirenderbuffer.c 
+         ../common/xmlconfig.c
+ COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \
+         ../../common/driverfuncs.c \
+         ../common/texmem.c \
+         ../common/drirenderbuffer.c
  
 -COMMON_BM_SOURCES = \
 -      ../common/dri_bufmgr.c \
 -      ../common/dri_drmpool.c
 -
 -
  ifeq ($(WINDOW_SYSTEM),dri)
  WINOBJ=
  WINLIB=
@@@ -59,12 -72,12 +62,12 @@@ SHARED_INCLUDES = 
  
  ##### TARGETS #####
  
 -default: depend symlinks $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
 +default: symlinks depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME)
  
  
- $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
+ $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template
 -      $(TOP)/bin/mklib -noprefix -o $@ \
 -              $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES)  $(WINOBJ) $(DRI_LIB_DEPS)
 +      $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-               $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
++              $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS)
  
  
  $(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME)
  
  
  depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS)
+       rm -f depend
        touch depend
        $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \
 -              $(ASM_SOURCES) 2> /dev/null
 +              $(ASM_SOURCES)
  
  
  # Emacs tags
@@@ -67,19 -111,64 +91,58 @@@ __driUtilMessage(const char *f, ...
      }
  }
  
 -
 -/*****************************************************************/
 -/** \name Drawable list management */
 -/*****************************************************************/
 -/*@{*/
 -
 -static GLboolean __driAddDrawable(void *drawHash, __DRIdrawable *pdraw)
 +GLint
 +driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 )
  {
 -    __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private;
 +   if (rect2.x1 > rect1.x1) rect1.x1 = rect2.x1;
 +   if (rect2.x2 < rect1.x2) rect1.x2 = rect2.x2;
 +   if (rect2.y1 > rect1.y1) rect1.y1 = rect2.y1;
 +   if (rect2.y2 < rect1.y2) rect1.y2 = rect2.y2;
  
 -    if (drmHashInsert(drawHash, pdp->draw, pdraw))
 -      return GL_FALSE;
 +   if (rect1.x1 > rect1.x2 || rect1.y1 > rect1.y2) return 0;
  
 -    return GL_TRUE;
 +   return (rect1.x2 - rect1.x1) * (rect1.y2 - rect1.y1);
  }
  
 -/*@}*/
 -
 -
+ static __DRIdrawable *__driFindDrawable(void *drawHash, __DRIid draw)
+ {
+     int retcode;
+     __DRIdrawable *pdraw;
+     retcode = drmHashLookup(drawHash, draw, (void *)&pdraw);
+     if (retcode)
+       return NULL;
+     return pdraw;
+ }
+ /**
+  * Find drawables in the local hash that have been destroyed on the
+  * server.
+  * 
+  * \param drawHash  Hash-table containing all known drawables.
+  */
+ static void __driGarbageCollectDrawables(void *drawHash)
+ {
+     __DRIid draw;
+     __DRInativeDisplay *dpy;
+     __DRIdrawable *pdraw;
+     if (drmHashFirst(drawHash, &draw, (void *)&pdraw) == 1) {
+       do {
+           __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private;
+           dpy = pdp->driScreenPriv->display;
+           if (! (*dri_interface->windowExists)(dpy, draw)) {
+               /* Destroy the local drawable data, if the drawable no
+                  longer exists in the Xserver */
+               (*pdraw->destroyDrawable)(dpy, pdraw->private);
+               _mesa_free(pdraw);
+           }
+       } while (drmHashNext(drawHash, &draw, (void *)&pdraw) == 1);
+     }
+ }
  /*****************************************************************/
  /** \name Context (un)binding functions                          */
  /*****************************************************************/
  
  #if defined( __powerpc__ )
  
- static INLINE u_int32_t
 -static __inline__ uint32_t
++static INLINE uint32_t
  read_MMIO_LE32( volatile void * base, unsigned long offset )
  {
-    u_int32_t val;
+    uint32_t val;
  
     __asm__ __volatile__( "lwbrx       %0, %1, %2 ; eieio"
                         : "=r" (val)
  
  #else
  
- static INLINE u_int32_t
 -static __inline__ uint32_t
++static INLINE uint32_t
  read_MMIO_LE32( volatile void * base, unsigned long offset )
  {
-    volatile u_int32_t * p = (volatile u_int32_t *) (((volatile char *) base) + offset);
+    volatile uint32_t * p = (volatile uint32_t *) (((volatile char *) base) + offset);
     return LE32_TO_CPU( p[0] );
  }
  
Simple merge
@@@ -519,15 -541,17 +524,19 @@@ GLboolean driClipRectToFramebuffer( con
   * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32, 
   * \c GL_4HALF_16_16_16_16, etc.  We can cross that bridge when we come to it.
   */
 -GLboolean
 -driFillInModes( __GLcontextModes ** ptr_to_modes,
 -              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,
 -              int visType )
++
++/* XXX: need to re-add msaa support after gallium-0.1 merge
++ */
++
 +__DRIconfig **
 +driCreateConfigs(GLenum fb_format, GLenum fb_type,
 +               const u_int8_t * depth_bits, const u_int8_t * stencil_bits,
 +               unsigned num_depth_stencil_bits,
 +               const GLenum * db_modes, unsigned num_db_modes)
  {
 -   static const uint8_t bits_table[3][4] = {
 +   static const u_int8_t bits_table[4][4] = {
       /* R  G  B  A */
 +      { 3, 3, 2, 0 }, /* Any GL_UNSIGNED_BYTE_3_3_2 */
        { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */
        { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */
        { 8, 8, 8, 8 }  /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1,6 -1,5 +1,5 @@@
- /* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */
  
 -static __inline void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0, 
 +static INLINE void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0, 
                                   ffb_vertex *v1 )
  {
        ffbContextPtr fmesa = FFB_CONTEXT(ctx);
@@@ -1,6 -1,5 +1,5 @@@
- /* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h,v 1.3 2002/02/22 21:32:59 dawes Exp $ */
  
 -static __inline void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp )
 +static INLINE void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp )
  {
        ffbContextPtr fmesa = FFB_CONTEXT(ctx);
        ffb_fbcPtr ffb = fmesa->regs;
Simple merge
@@@ -624,9 -641,10 +624,9 @@@ ffbFillInModes( __DRIscreenPrivate *psp
        GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
     };
  
-    u_int8_t depth_bits_array[3];
-    u_int8_t stencil_bits_array[3];
+    uint8_t depth_bits_array[3];
+    uint8_t stencil_bits_array[3];
  
 -
     depth_bits_array[0] = 0;
     depth_bits_array[1] = depth_bits;
     depth_bits_array[2] = depth_bits;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -45,10 -44,10 +44,10 @@@ USE OR OTHER DEALINGS IN THE SOFTWARE
  extern drmBufPtr r128GetBufferLocked( r128ContextPtr rmesa );
  extern void r128FlushVerticesLocked( r128ContextPtr rmesa );
  
 -static __inline void *r128AllocDmaLow( r128ContextPtr rmesa, int count,
 +static INLINE void *r128AllocDmaLow( r128ContextPtr rmesa, int count,
                                       int vert_size )
  {
-    u_int32_t *head;
+    uint32_t *head;
     int bytes = count * vert_size;
  
     if ( !rmesa->vert_buf ) {
Simple merge
@@@ -68,9 -67,9 +67,9 @@@ extern void r128InitTextureFuncs( struc
  #define R128PACKCOLOR4444( r, g, b, a )                                       \
     ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4))
  
- static INLINE u_int32_t r128PackColor( GLuint cpp,
-                                        GLubyte r, GLubyte g,
-                                        GLubyte b, GLubyte a )
 -static __inline__ uint32_t r128PackColor( GLuint cpp,
 -                                      GLubyte r, GLubyte g,
 -                                      GLubyte b, GLubyte a )
++static INLINE uint32_t r128PackColor( GLuint cpp,
++                                      GLubyte r, GLubyte g,
++                                      GLubyte b, GLubyte a )
  {
      switch ( cpp ) {
      case 2:
@@@ -76,11 -76,11 +76,11 @@@ GLboolean savageHaveIndexedVerts( savag
      return (imesa->firstElt != -1);
  }
  
 -static __inline
 +static INLINE
- u_int32_t *savageAllocVtxBuf( savageContextPtr imesa, GLuint words )
+ uint32_t *savageAllocVtxBuf( savageContextPtr imesa, GLuint words )
  {
     struct savage_vtxbuf_t *buffer = imesa->vtxBuf;
-    u_int32_t *head;
+    uint32_t *head;
  
     if (buffer == &imesa->dmaVtxBuf) {
         if (!buffer->total) {
     return head;
  }
  
 -static __inline
 +static INLINE
- u_int32_t *savageAllocIndexedVerts( savageContextPtr imesa, GLuint n )
+ uint32_t *savageAllocIndexedVerts( savageContextPtr imesa, GLuint n )
  {
-     u_int32_t *ret;
+     uint32_t *ret;
      savageFlushVertices(imesa);
      ret = savageAllocVtxBuf(imesa, n*imesa->HwVertexSize);
      imesa->firstElt = imesa->vtxBuf->flushed / imesa->HwVertexSize;
@@@ -171,10 -171,10 +171,10 @@@ drm_savage_cmd_header_t *savageAllocCmd
   *   incomplete indexed drawing command yet
   * - increments the number of elts. Final allocation is done in savageFlushElts
   */
 -static __inline
 +static INLINE
- u_int16_t *savageAllocElts( savageContextPtr imesa, GLuint n )
+ uint16_t *savageAllocElts( savageContextPtr imesa, GLuint n )
  {
-     u_int16_t *ret;
+     uint16_t *ret;
      GLuint qwords;
      assert (savageHaveIndexedVerts(imesa));
  
@@@ -638,15 -638,13 +638,15 @@@ static void savageDDScissor( GLcontext 
  static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode )
  {
      savageContextPtr imesa = SAVAGE_CONTEXT(ctx);
-     u_int32_t destCtrl = imesa->regs.s4.destCtrl.ui;
+     uint32_t destCtrl = imesa->regs.s4.destCtrl.ui;
  
 -    /*
 -     * _DrawDestMask is easier to cope with than <mode>.
 -     */
 -    switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) {
 -    case BUFFER_BIT_FRONT_LEFT:
 +    if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
 +      FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_TRUE );
 +        return;
 +    }
 +
 +    switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) {
 +    case BUFFER_FRONT_LEFT:
          imesa->IsDouble = GL_FALSE;
        imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->frontOffset>>11;
        break;
@@@ -125,10 -125,10 +125,10 @@@ static void INLINE savage_draw_quad (sa
     EMIT_VERT (j, vb, vertsize, 0, v3);
  }
  
 -static __inline__ void savage_draw_point (savageContextPtr imesa,
 +static INLINE void savage_draw_point (savageContextPtr imesa,
                                          savageVertexPtr tmp) {
     GLuint vertsize = imesa->HwVertexSize;
-    u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
+    uint32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
     const GLfloat x = tmp->v.x;
     const GLfloat y = tmp->v.y;
     const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
@@@ -281,10 -281,10 +281,10 @@@ static INLINE void savage_ptex_line (sa
     EMIT_VERT (j, vb, vertsize, 2, &tmp1);
  } 
  
 -static __inline__ void savage_ptex_point (savageContextPtr imesa,
 +static INLINE void savage_ptex_point (savageContextPtr imesa,
                                          savageVertexPtr v0) {
     GLuint vertsize = imesa->HwVertexSize;
-    u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
+    uint32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize);
     const GLfloat x = v0->v.x;
     const GLfloat y = v0->v.y;
     const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -340,10 -365,13 +340,10 @@@ viaFillInModes( __DRIscreenPrivate *psp
      /* The 32-bit depth-buffer mode isn't supported yet, so don't actually
       * enable it.
       */
-     static const u_int8_t depth_bits_array[4]   = { 0, 16, 24, 32 };
-     static const u_int8_t stencil_bits_array[4] = { 0,  0,  8,  0 };
+     static const uint8_t depth_bits_array[4]   = { 0, 16, 24, 32 };
+     static const uint8_t stencil_bits_array[4] = { 0,  0,  8,  0 };
      const unsigned depth_buffer_factor = 3;
  
 -
 -    num_modes = depth_buffer_factor * back_buffer_factor * 4;
 -
      if ( pixel_bits == 16 ) {
          fb_format = GL_RGB;
          fb_type = GL_UNSIGNED_SHORT_5_6_5;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
  
  
  
- #include "glheader.h"
 +#ifdef HAVE_DIX_CONFIG_H
 +
 +#include <dix-config.h>
 +#define PUBLIC
 +
 +#else
 +
+ #include "main/glheader.h"
 +
 +#endif
 +
 +#include <stdlib.h>
 +#include <string.h>
 +#ifdef DEBUG
 +#include <assert.h>
 +#endif
 +
  #include "glapi.h"
  #include "glapioffsets.h"
  #include "glapitable.h"
Simple merge
@@@ -116,9 -67,16 +116,15 @@@ _mesa_validate_DrawElements(GLcontext *
  
     /* Vertex buffer object tests */
     if (ctx->Array.ElementArrayBufferObj->Name) {
 +      /* use indices in the buffer object */
        GLuint indexBytes;
  
 -      /* use indices in the buffer object */
+       if (!ctx->Array.ElementArrayBufferObj->Size) {
+          _mesa_warning(ctx,
+                        "glDrawElements called with empty array elements buffer");
+          return GL_FALSE;
+       }
 -      /* make sure count doesn't go outside buffer bounds */
        if (type == GL_UNSIGNED_INT) {
           indexBytes = count * sizeof(GLuint);
        }
           indexBytes = count * sizeof(GLushort);
        }
  
-       if (indexBytes > ctx->Array.ElementArrayBufferObj->Size) {
 +      /* make sure count doesn't go outside buffer bounds */
+       if (indexBytes > (GLuint) ctx->Array.ElementArrayBufferObj->Size) {
           _mesa_warning(ctx, "glDrawElements index out of buffer bounds");
           return GL_FALSE;
        }
  #include "light.h"
  #include "lines.h"
  #include "matrix.h"
+ #include "multisample.h"
  #include "points.h"
  #include "polygon.h"
+ #include "scissor.h"
  #include "simple_list.h"
  #include "stencil.h"
+ #include "texenv.h"
+ #include "texgen.h"
  #include "texobj.h"
+ #include "texparam.h"
  #include "texstate.h"
 +#include "varray.h"
  #include "mtypes.h"
  #include "math/m_xform.h"
  
Simple merge
@@@ -104,10 -101,10 +104,9 @@@ _mesa_map_drawpix_pbo(GLcontext *ctx
                        const GLvoid *pixels);
  
  extern void
- _mesa_unmap_drapix_pbo(GLcontext *ctx,
-                        const struct gl_pixelstore_attrib *unpack);
+ _mesa_unmap_drawpix_pbo(GLcontext *ctx,
+                         const struct gl_pixelstore_attrib *unpack);
  
 -
  extern void *
  _mesa_map_readpix_pbo(GLcontext *ctx,
                        const struct gl_pixelstore_attrib *pack,
@@@ -522,49 -376,16 +377,49 @@@ _mesa_drawbuffers(GLcontext *ctx, GLuin
        destMask = mask;
     }
  
 -   for (output = 0; output < n; output++) {
 -      set_color_output(ctx, output, buffers[output], destMask[output]);
 +   if (n == 1) {
 +      GLuint buf, count = 0;
 +      /* init to -1 to help catch errors */
 +      fb->_ColorDrawBufferIndexes[0] = -1;
 +      for (buf = 0; buf < BUFFER_COUNT; buf++) {
 +         if (destMask[0] & (1 << buf)) {
 +            fb->_ColorDrawBufferIndexes[count] = buf;
 +            count++;
 +         }
 +      }
 +      fb->ColorDrawBuffer[0] = buffers[0];
 +      fb->_NumColorDrawBuffers = count;
 +   }
 +   else {
 +      GLuint buf, count = 0;
 +      for (buf = 0; buf < n; buf++ ) {
 +         if (destMask[buf]) {
 +            fb->_ColorDrawBufferIndexes[buf] = _mesa_ffs(destMask[buf]) - 1;
 +            fb->ColorDrawBuffer[buf] = buffers[buf];
 +            count = buf + 1;
 +         }
 +         else {
 +            fb->_ColorDrawBufferIndexes[buf] = -1;
 +         }
 +      }
 +      /* set remaining outputs to -1 (GL_NONE) */
 +      while (buf < ctx->Const.MaxDrawBuffers) {
 +         fb->_ColorDrawBufferIndexes[buf] = -1;
 +         fb->ColorDrawBuffer[buf] = GL_NONE;
 +         buf++;
 +      }
 +      fb->_NumColorDrawBuffers = count;
     }
  
 -   /* set remaining color outputs to NONE */
 -   for (output = n; output < ctx->Const.MaxDrawBuffers; output++) {
 -      set_color_output(ctx, output, GL_NONE, 0x0);
 +   if (fb->Name == 0) {
 +      /* also set context drawbuffer state */
 +      GLuint buf;
 +      for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
 +         ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf];
 +      }
     }
  
-    ctx->NewState |= _NEW_COLOR;
+    ctx->NewState |= _NEW_BUFFERS;
  }
  
  
@@@ -611,34 -443,10 +466,35 @@@ _mesa_ReadBuffer(GLenum buffer
     if (MESA_VERBOSE & VERBOSE_API)
        _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
  
 -   if (!_mesa_readbuffer_update_fields(ctx, buffer))
 -      return;
 +   fb = ctx->ReadBuffer;
 +
 +   if (MESA_VERBOSE & VERBOSE_API)
 +      _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
 +
 +   if (fb->Name > 0 && buffer == GL_NONE) {
 +      /* This is legal for user-created framebuffer objects */
 +      srcBuffer = -1;
 +   }
 +   else {
 +      /* general case / window-system framebuffer */
 +      srcBuffer = read_buffer_enum_to_index(buffer);
 +      if (srcBuffer == -1) {
 +         _mesa_error(ctx, GL_INVALID_ENUM,
 +                     "glReadBuffer(buffer=0x%x)", buffer);
 +         return;
 +      }
 +      supportedMask = supported_buffer_bitmask(ctx, fb);
 +      if (((1 << srcBuffer) & supportedMask) == 0) {
 +         _mesa_error(ctx, GL_INVALID_OPERATION,
 +                     "glReadBuffer(buffer=0x%x)", buffer);
 +         return;
 +      }
 +   }
 +
 +   /* OK, all error checking has been completed now */
  
 +   _mesa_readbuffer(ctx, buffer, srcBuffer);
+    ctx->NewState |= _NEW_BUFFERS;
  
     /*
      * Call device driver function.
Simple merge
index 0000000,4346859..a6257f9
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,179 +1,182 @@@
 -   FLUSH_CURRENT(ctx, 0);
 -
+ /*
+  * Mesa 3-D graphics library
+  * Version:  7.1
+  *
+  * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.
+  *
+  * Permission is hereby granted, free of charge, to any person obtaining a
+  * copy of this software and associated documentation files (the "Software"),
+  * to deal in the Software without restriction, including without limitation
+  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+  * and/or sell copies of the Software, and to permit persons to whom the
+  * Software is furnished to do so, subject to the following conditions:
+  *
+  * The above copyright notice and this permission notice shall be included
+  * in all copies or substantial portions of the Software.
+  *
+  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+  */
+ /**
+  * \file clear.c
+  * glClearColor, glClearIndex, glClear() functions.
+  */
+ #include "glheader.h"
+ #include "clear.h"
+ #include "context.h"
+ #include "colormac.h"
+ #include "state.h"
+ #if _HAVE_FULL_GL
+ void GLAPIENTRY
+ _mesa_ClearIndex( GLfloat c )
+ {
+    GET_CURRENT_CONTEXT(ctx);
+    ASSERT_OUTSIDE_BEGIN_END(ctx);
+    if (ctx->Color.ClearIndex == (GLuint) c)
+       return;
+    FLUSH_VERTICES(ctx, _NEW_COLOR);
+    ctx->Color.ClearIndex = (GLuint) c;
+    if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) {
+       /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */
+       (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex );
+    }
+ }
+ #endif
+ /**
+  * Specify the clear values for the color buffers.
+  *
+  * \param red red color component.
+  * \param green green color component.
+  * \param blue blue color component.
+  * \param alpha alpha component.
+  *
+  * \sa glClearColor().
+  *
+  * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor.  On a
+  * change, flushes the vertices and notifies the driver via the
+  * dd_function_table::ClearColor callback.
+  */
+ void GLAPIENTRY
+ _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha )
+ {
+    GLfloat tmp[4];
+    GET_CURRENT_CONTEXT(ctx);
+    ASSERT_OUTSIDE_BEGIN_END(ctx);
+    tmp[0] = CLAMP(red,   0.0F, 1.0F);
+    tmp[1] = CLAMP(green, 0.0F, 1.0F);
+    tmp[2] = CLAMP(blue,  0.0F, 1.0F);
+    tmp[3] = CLAMP(alpha, 0.0F, 1.0F);
+    if (TEST_EQ_4V(tmp, ctx->Color.ClearColor))
+       return; /* no change */
+    FLUSH_VERTICES(ctx, _NEW_COLOR);
+    COPY_4V(ctx->Color.ClearColor, tmp);
+    if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) {
+       /* it's OK to call glClearColor in CI mode but it should be a NOP */
+       (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor);
+    }
+ }
+ /**
+  * Clear buffers.
+  * 
+  * \param mask bit-mask indicating the buffers to be cleared.
+  *
+  * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState
+  * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin,
+  * etc. If the rasterization mode is set to GL_RENDER then requests the driver
+  * to clear the buffers, via the dd_function_table::Clear callback.
+  */ 
+ void GLAPIENTRY
+ _mesa_Clear( GLbitfield mask )
+ {
+    GET_CURRENT_CONTEXT(ctx);
+    ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
 -   if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0)
+    if (MESA_VERBOSE & VERBOSE_API)
+       _mesa_debug(ctx, "glClear 0x%x\n", mask);
+    if (mask & ~(GL_COLOR_BUFFER_BIT |
+                 GL_DEPTH_BUFFER_BIT |
+                 GL_STENCIL_BUFFER_BIT |
+                 GL_ACCUM_BUFFER_BIT)) {
+       /* invalid bit set */
+       _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask);
+       return;
+    }
+    if (ctx->NewState) {
+       _mesa_update_state( ctx );      /* update _Xmin, etc */
+    }
+    if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
+       _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
+                   "glClear(incomplete framebuffer)");
+       return;
+    }
 -         bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0];
++   if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0 ||
++       ctx->DrawBuffer->_Xmin >= ctx->DrawBuffer->_Xmax ||
++       ctx->DrawBuffer->_Ymin >= ctx->DrawBuffer->_Ymax)
+       return;
+    if (ctx->RenderMode == GL_RENDER) {
+       GLbitfield bufferMask;
+       /* don't clear depth buffer if depth writing disabled */
+       if (!ctx->Depth.Mask)
+          mask &= ~GL_DEPTH_BUFFER_BIT;
+       /* Build the bitmask to send to device driver's Clear function.
+        * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4
+        * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the
+        * BUFFER_BIT_COLORn flags.
+        */
+       bufferMask = 0;
+       if (mask & GL_COLOR_BUFFER_BIT) {
++         GLuint i;
++         for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
++            bufferMask |= (1 << ctx->DrawBuffer->_ColorDrawBufferIndexes[i]);
++         }
+       }
+       if ((mask & GL_DEPTH_BUFFER_BIT)
+           && ctx->DrawBuffer->Visual.haveDepthBuffer) {
+          bufferMask |= BUFFER_BIT_DEPTH;
+       }
+       if ((mask & GL_STENCIL_BUFFER_BIT)
+           && ctx->DrawBuffer->Visual.haveStencilBuffer) {
+          bufferMask |= BUFFER_BIT_STENCIL;
+       }
+       if ((mask & GL_ACCUM_BUFFER_BIT)
+           && ctx->DrawBuffer->Visual.haveAccumBuffer) {
+          bufferMask |= BUFFER_BIT_ACCUM;
+       }
+       ASSERT(ctx->Driver.Clear);
+       ctx->Driver.Clear(ctx, bufferMask);
+    }
+ }
Simple merge
@@@ -1261,9 -1294,10 +1316,11 @@@ _mesa_free_context_data( GLcontext *ct
     _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
     _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL);
  
 +   _mesa_free_attrib_data(ctx);
     _mesa_free_lighting_data( ctx );
+ #if FEATURE_evaluators
     _mesa_free_eval_data( ctx );
+ #endif
     _mesa_free_texture_data( ctx );
     _mesa_free_matrix_data( ctx );
     _mesa_free_viewport_data( ctx );
@@@ -1572,7 -1614,20 +1633,22 @@@ _mesa_make_current( GLcontext *newCtx, 
            * or not bound to a user-created FBO.
            */
           if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) {
 -         /* fix up the fb fields - these will end up wrong otherwise
 -          * if the DRIdrawable changes, and everything relies on them.
 -          * This is a bit messy (same as needed in _mesa_BindFramebufferEXT)
 -        */
++            /* KW: merge conflict here, revisit. 
++             */
++            /* fix up the fb fields - these will end up wrong otherwise
++             * if the DRIdrawable changes, and everything relies on them.
++             * This is a bit messy (same as needed in _mesa_BindFramebufferEXT)
++             */
+             unsigned int i;
+             GLenum buffers[MAX_DRAW_BUFFERS];
              _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer);
+             for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) {
+                buffers[i] = newCtx->Color.DrawBuffer[i];
+             }
+             _mesa_drawbuffers(newCtx, newCtx->Const.MaxDrawBuffers, buffers, NULL);
           }
           if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) {
              _mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer);
Simple merge
Simple merge
Simple merge
@@@ -374,7 -218,7 +218,7 @@@ _mesa_Bitmap( GLsizei width, GLsizei he
  
     if (ctx->RenderMode == GL_RENDER) {
        /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */
-       const GLfloat epsilon = 0.0001;
 -      const GLfloat epsilon = (const GLfloat)0.0001;
++      const GLfloat epsilon = 0.0001F;
        GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig);
        GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig);
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
  #include <stdarg.h>
  
  
- /* Get typedefs for uintptr_t and friends */
- #if defined(__MINGW32__) || defined(__NetBSD__)
- #  include <stdint.h>
- #elif defined(_WIN32)
- #  include <BaseTsd.h>
- #  if _MSC_VER == 1200
-      typedef UINT_PTR uintptr_t;
- #  endif 
- #elif defined(__INTERIX)
- /* Interix 3.x has a gcc that shadows this. */
- #  ifndef _UINTPTR_T_DEFINED
-      typedef unsigned long uintptr_t;
- #  define _UINTPTR_T_DEFINED
+ /* Get standard integer types */
+ #if defined(_MSC_VER)
+    typedef __int8             int8_t;
+    typedef unsigned __int8    uint8_t;
+    typedef __int16            int16_t;
+    typedef unsigned __int16   uint16_t;
+ #  ifndef __eglplatform_h_
+      typedef __int32            int32_t;
  #  endif
+    typedef unsigned __int32   uint32_t;
+    typedef __int64            int64_t;
+    typedef unsigned __int64   uint64_t;
+ #  if defined(_WIN64)
+      typedef __int64            intptr_t;
+      typedef unsigned __int64   uintptr_t;
+ #  else
+      typedef __int32            intptr_t;
+      typedef unsigned __int32   uintptr_t;
+ #  endif
+ #  define INT64_C(__val) __val##i64
+ #  define UINT64_C(__val) __val##ui64
  #else
- #  include <inttypes.h>
+ #  include <stdint.h>
  #endif
  
 +/* For platforms that have the C99 standard uint*_t,
 +   but not the commonly used u_int*_t */
 +#if defined(__sun)
 +# define u_int8_t uint8_t
 +# define u_int16_t uint16_t
 +# define u_int32_t uint32_t
 +# define u_int64_t uint64_t
 +# define u_intptr_t uintptr_t
 +#endif
 +
 +/* Sun compilers define __i386 instead of the gcc-style __i386__ */
 +#ifdef __SUNPRO_C
 +# if !defined(__i386__) && defined(__i386)
 +#  define __i386__
 +# elif !defined(__amd64__) && defined(__amd64)
 +#  define __amd64__
 +# elif !defined(__sparc__) && defined(__sparc)
 +#  define __sparc__
 +# endif
 +# if !defined(__volatile)
 +#  define __volatile volatile
 +# endif
 +#endif
 +
  #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP)
  #  define __WIN32__
  #  define finite _finite
  #else
  #  define ASSERT(X)
  #endif
+ #endif
  
  
 -#if !defined __GNUC__ || __GNUC__ < 3
 +#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 900)
  #  define __builtin_expect(x, y) x
  #endif
  
Simple merge
@@@ -557,30 -539,27 +557,30 @@@ _mesa_pow(double x, double y
   * Find the first bit set in a word.
   */
  int
- _mesa_ffs(int i)
+ _mesa_ffs(int32_t i)
  {
  #if (defined(_WIN32) && !defined(__MINGW32__) ) || defined(__IBMC__) || defined(__IBMCPP__)
 -   register int32_t bit = 1;
 -   if ((i & 0xffff) == 0) {
 -      bit += 16;
 -      i >>= 16;
 -   }
 -   if ((i & 0xff) == 0) {
 -      bit += 8;
 -      i >>= 8;
 -   }
 -   if ((i & 0xf) == 0) {
 -      bit += 4;
 -      i >>= 4;
 -   }
 -   if ((i & 0x3) == 0) {
 -      bit += 2;
 -      i >>= 2;
 +   register int bit = 0;
 +   if (i != 0) {
 +      if ((i & 0xffff) == 0) {
 +         bit += 16;
 +         i >>= 16;
 +      }
 +      if ((i & 0xff) == 0) {
 +         bit += 8;
 +         i >>= 8;
 +      }
 +      if ((i & 0xf) == 0) {
 +         bit += 4;
 +         i >>= 4;
 +      }
 +      while ((i & 1) == 0) {
 +         bit++;
 +         i >>= 1;
 +      }
 +      bit++;
     }
 -   return (i) ? (bit + ((i + 1) & 0x01)) : 0;
 +   return bit;
  #else
     return ffs(i);
  #endif
Simple merge
Simple merge
@@@ -557,11 -479,11 +479,11 @@@ make_2d_mipmap(GLenum datatype, GLuint 
     dst = dstPtr + border * ((dstWidth + 1) * bpt);
  
     for (row = 0; row < dstHeightNB; row++) {
-       do_row(format, srcWidthNB, srcA, srcB,
+       do_row(datatype, comps, srcWidthNB, srcA, srcB,
               dstWidthNB, dst);
 -      srcA += 2 * srcRowStride;
 -      srcB += 2 * srcRowStride;
 -      dst += dstRowStride;
 +      srcA += 2 * srcRowBytes;
 +      srcB += 2 * srcRowBytes;
 +      dst += dstRowBytes;
     }
  
     /* This is ugly but probably won't be used much */
@@@ -816,10 -742,10 +742,10 @@@ make_1d_stack_mipmap(GLenum datatype, G
     dst = dstPtr + border * ((dstWidth + 1) * bpt);
  
     for (row = 0; row < dstHeightNB; row++) {
-       do_row(format, srcWidthNB, src, src,
+       do_row(datatype, comps, srcWidthNB, src, src,
               dstWidthNB, dst);
 -      src += srcRowStride;
 -      dst += dstRowStride;
 +      src += srcRowBytes;
 +      dst += dstRowBytes;
     }
  
     if (border) {
@@@ -867,11 -799,11 +799,11 @@@ make_2d_stack_mipmap(GLenum datatype, G
  
     for (layer = 0; layer < dstDepthNB; layer++) {
        for (row = 0; row < dstHeightNB; row++) {
-          do_row(format, srcWidthNB, srcA, srcB,
+          do_row(datatype, comps, srcWidthNB, srcA, srcB,
                  dstWidthNB, dst);
 -         srcA += 2 * srcRowStride;
 -         srcB += 2 * srcRowStride;
 -         dst += dstRowStride;
 +         srcA += 2 * srcRowBytes;
 +         srcB += 2 * srcRowBytes;
 +         dst += dstRowBytes;
        }
  
        /* This is ugly but probably won't be used much */
@@@ -1546,16 -1560,6 +1549,7 @@@ struct gl_texture_uni
  };
  
  
- struct texenvprog_cache_item;
- struct texenvprog_cache
- {
-    struct texenvprog_cache_item **items;
-    GLuint size, n_items;
-    GLcontext *ctx;
- };
 +
  /**
   * Texture attribute group (GL_TEXTURE_BIT).
   */
@@@ -1575,8 -1579,17 +1569,7 @@@ struct gl_texture_attri
  
     struct gl_texture_unit Unit[MAX_TEXTURE_UNITS];
  
-    /** Proxy texture objects */
 -#if 0
 -   struct gl_texture_object *Proxy1D;
 -   struct gl_texture_object *Proxy2D;
 -   struct gl_texture_object *Proxy3D;
 -   struct gl_texture_object *ProxyCubeMap;
 -   struct gl_texture_object *ProxyRect;
 -   struct gl_texture_object *Proxy1DArray;
 -   struct gl_texture_object *Proxy2DArray;
 -#else
     struct gl_texture_object *ProxyTex[NUM_TEXTURE_TARGETS];
 -#endif
  
     /** GL_EXT_shared_texture_palette */
     GLboolean SharedPalette;
@@@ -76,19 -74,11 +74,16 @@@ _mesa_PointParameteri( GLenum pname, GL
  }
  
  
- /*
-  * Added by GL_NV_point_sprite
-  */
  void GLAPIENTRY
- _mesa_PointParameterivNV( GLenum pname, const GLint *params )
+ _mesa_PointParameteriv( GLenum pname, const GLint *params )
  {
 -   const GLfloat value = (GLfloat) params[0];
 -   _mesa_PointParameterfv(pname, &value);
 +   GLfloat p[3];
 +   p[0] = (GLfloat) params[0];
 +   if (pname == GL_DISTANCE_ATTENUATION_EXT) {
 +      p[1] = (GLfloat) params[1];
 +      p[2] = (GLfloat) params[2];
 +   }
-    _mesa_PointParameterfvEXT(pname, p);
++   _mesa_PointParameterfv(pname, p);
  }
  
  
   * \file state.c
   * State management.
   * 
-  * This file manages recalculation of derived values in the __GLcontextRec.
-  * Also, this is where we initialize the API dispatch table.
+  * This file manages recalculation of derived values in GLcontext.
   */
  
  #include "glheader.h"
- #include "accum.h"
- #include "api_loopback.h"
- #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
- #include "shader/arbprogram.h"
- #endif
- #if FEATURE_ATI_fragment_shader
- #include "shader/atifragshader.h"
- #endif
- #include "attrib.h"
- #include "blend.h"
- #if FEATURE_ARB_vertex_buffer_object
- #include "bufferobj.h"
- #endif
- #include "arrayobj.h"
- #include "buffers.h"
- #include "clip.h"
- #include "colortab.h"
+ #include "mtypes.h"
  #include "context.h"
- #include "convolve.h"
- #include "depth.h"
- #include "dlist.h"
- #include "drawpix.h"
- #include "enable.h"
- #include "eval.h"
- #include "get.h"
- #include "feedback.h"
- #include "fog.h"
- #if FEATURE_EXT_framebuffer_object
- #include "fbobject.h"
- #endif
+ #include "debug.h"
+ #include "macros.h"
+ #include "ffvertex_prog.h"
  #include "framebuffer.h"
- #include "hint.h"
- #include "histogram.h"
- #include "imports.h"
  #include "light.h"
- #include "lines.h"
- #include "macros.h"
  #include "matrix.h"
+ #if FEATURE_pixel_transfer
  #include "pixel.h"
- #include "points.h"
- #include "polygon.h"
- #if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query
- #include "queryobj.h"
  #endif
- #include "rastpos.h"
+ #include "shader/program.h"
  #include "state.h"
  #include "stencil.h"
- #include "teximage.h"
+ #include "texenvprogram.h"
  #include "texobj.h"
  #include "texstate.h"
- #include "mtypes.h"
- #include "varray.h"
- #if FEATURE_NV_vertex_program
- #include "shader/nvprogram.h"
- #endif
- #if FEATURE_NV_fragment_program
- #include "shader/nvprogram.h"
- #include "shader/program.h"
- #include "texenvprogram.h"
- #endif
- #if FEATURE_ARB_shader_objects
- #include "shaders.h"
- #endif
- #include "debug.h"
- #include "glapi/dispatch.h"
  
  
- /**
-  * Initialize a dispatch table with pointers to Mesa's immediate-mode
-  * commands.
-  *
-  * Pointers to glBegin()/glEnd() object commands and a few others
-  * are provided via the GLvertexformat interface.
-  *
-  * \param ctx  GL context to which \c exec belongs.
-  * \param exec dispatch table.
-  */
- void
- _mesa_init_exec_table(struct _glapi_table *exec)
- {
- #if _HAVE_FULL_GL
-    _mesa_loopback_init_api_table( exec );
- #endif
-    /* load the dispatch slots we understand */
-    SET_AlphaFunc(exec, _mesa_AlphaFunc);
-    SET_BlendFunc(exec, _mesa_BlendFunc);
-    SET_Clear(exec, _mesa_Clear);
-    SET_ClearColor(exec, _mesa_ClearColor);
-    SET_ClearStencil(exec, _mesa_ClearStencil);
-    SET_ColorMask(exec, _mesa_ColorMask);
-    SET_CullFace(exec, _mesa_CullFace);
-    SET_Disable(exec, _mesa_Disable);
-    SET_DrawBuffer(exec, _mesa_DrawBuffer);
-    SET_Enable(exec, _mesa_Enable);
-    SET_Finish(exec, _mesa_Finish);
-    SET_Flush(exec, _mesa_Flush);
-    SET_FrontFace(exec, _mesa_FrontFace);
-    SET_Frustum(exec, _mesa_Frustum);
-    SET_GetError(exec, _mesa_GetError);
-    SET_GetFloatv(exec, _mesa_GetFloatv);
-    SET_GetString(exec, _mesa_GetString);
-    SET_InitNames(exec, _mesa_InitNames);
-    SET_LineStipple(exec, _mesa_LineStipple);
-    SET_LineWidth(exec, _mesa_LineWidth);
-    SET_LoadIdentity(exec, _mesa_LoadIdentity);
-    SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
-    SET_LoadName(exec, _mesa_LoadName);
-    SET_LogicOp(exec, _mesa_LogicOp);
-    SET_MatrixMode(exec, _mesa_MatrixMode);
-    SET_MultMatrixf(exec, _mesa_MultMatrixf);
-    SET_Ortho(exec, _mesa_Ortho);
-    SET_PixelStorei(exec, _mesa_PixelStorei);
-    SET_PopMatrix(exec, _mesa_PopMatrix);
-    SET_PopName(exec, _mesa_PopName);
-    SET_PushMatrix(exec, _mesa_PushMatrix);
-    SET_PushName(exec, _mesa_PushName);
-    SET_RasterPos2f(exec, _mesa_RasterPos2f);
-    SET_RasterPos2fv(exec, _mesa_RasterPos2fv);
-    SET_RasterPos2i(exec, _mesa_RasterPos2i);
-    SET_RasterPos2iv(exec, _mesa_RasterPos2iv);
-    SET_ReadBuffer(exec, _mesa_ReadBuffer);
-    SET_RenderMode(exec, _mesa_RenderMode);
-    SET_Rotatef(exec, _mesa_Rotatef);
-    SET_Scalef(exec, _mesa_Scalef);
-    SET_Scissor(exec, _mesa_Scissor);
-    SET_SelectBuffer(exec, _mesa_SelectBuffer);
-    SET_ShadeModel(exec, _mesa_ShadeModel);
-    SET_StencilFunc(exec, _mesa_StencilFunc);
-    SET_StencilMask(exec, _mesa_StencilMask);
-    SET_StencilOp(exec, _mesa_StencilOp);
-    SET_TexEnvfv(exec, _mesa_TexEnvfv);
-    SET_TexEnvi(exec, _mesa_TexEnvi);
-    SET_TexImage2D(exec, _mesa_TexImage2D);
-    SET_TexParameteri(exec, _mesa_TexParameteri);
-    SET_Translatef(exec, _mesa_Translatef);
-    SET_Viewport(exec, _mesa_Viewport);
- #if _HAVE_FULL_GL
-    SET_Accum(exec, _mesa_Accum);
-    SET_Bitmap(exec, _mesa_Bitmap);
-    SET_CallList(exec, _mesa_CallList);
-    SET_CallLists(exec, _mesa_CallLists);
-    SET_ClearAccum(exec, _mesa_ClearAccum);
-    SET_ClearDepth(exec, _mesa_ClearDepth);
-    SET_ClearIndex(exec, _mesa_ClearIndex);
-    SET_ClipPlane(exec, _mesa_ClipPlane);
-    SET_ColorMaterial(exec, _mesa_ColorMaterial);
-    SET_CopyPixels(exec, _mesa_CopyPixels);
-    SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT);
-    SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT);
-    SET_DeleteLists(exec, _mesa_DeleteLists);
-    SET_DepthFunc(exec, _mesa_DepthFunc);
-    SET_DepthMask(exec, _mesa_DepthMask);
-    SET_DepthRange(exec, _mesa_DepthRange);
-    SET_DrawPixels(exec, _mesa_DrawPixels);
-    SET_EndList(exec, _mesa_EndList);
-    SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer);
-    SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
-    SET_Fogf(exec, _mesa_Fogf);
-    SET_Fogfv(exec, _mesa_Fogfv);
-    SET_Fogi(exec, _mesa_Fogi);
-    SET_Fogiv(exec, _mesa_Fogiv);
-    SET_GenLists(exec, _mesa_GenLists);
-    SET_GetClipPlane(exec, _mesa_GetClipPlane);
-    SET_GetBooleanv(exec, _mesa_GetBooleanv);
-    SET_GetDoublev(exec, _mesa_GetDoublev);
-    SET_GetIntegerv(exec, _mesa_GetIntegerv);
-    SET_GetLightfv(exec, _mesa_GetLightfv);
-    SET_GetLightiv(exec, _mesa_GetLightiv);
-    SET_GetMapdv(exec, _mesa_GetMapdv);
-    SET_GetMapfv(exec, _mesa_GetMapfv);
-    SET_GetMapiv(exec, _mesa_GetMapiv);
-    SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
-    SET_GetMaterialiv(exec, _mesa_GetMaterialiv);
-    SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv);
-    SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv);
-    SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv);
-    SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
-    SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
-    SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
-    SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
-    SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
-    SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
-    SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
-    SET_GetTexGendv(exec, _mesa_GetTexGendv);
-    SET_GetTexGenfv(exec, _mesa_GetTexGenfv);
-    SET_GetTexGeniv(exec, _mesa_GetTexGeniv);
-    SET_GetTexImage(exec, _mesa_GetTexImage);
-    SET_Hint(exec, _mesa_Hint);
-    SET_IndexMask(exec, _mesa_IndexMask);
-    SET_IsEnabled(exec, _mesa_IsEnabled);
-    SET_IsList(exec, _mesa_IsList);
-    SET_LightModelf(exec, _mesa_LightModelf);
-    SET_LightModelfv(exec, _mesa_LightModelfv);
-    SET_LightModeli(exec, _mesa_LightModeli);
-    SET_LightModeliv(exec, _mesa_LightModeliv);
-    SET_Lightf(exec, _mesa_Lightf);
-    SET_Lightfv(exec, _mesa_Lightfv);
-    SET_Lighti(exec, _mesa_Lighti);
-    SET_Lightiv(exec, _mesa_Lightiv);
-    SET_ListBase(exec, _mesa_ListBase);
-    SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
-    SET_Map1d(exec, _mesa_Map1d);
-    SET_Map1f(exec, _mesa_Map1f);
-    SET_Map2d(exec, _mesa_Map2d);
-    SET_Map2f(exec, _mesa_Map2f);
-    SET_MapGrid1d(exec, _mesa_MapGrid1d);
-    SET_MapGrid1f(exec, _mesa_MapGrid1f);
-    SET_MapGrid2d(exec, _mesa_MapGrid2d);
-    SET_MapGrid2f(exec, _mesa_MapGrid2f);
-    SET_MultMatrixd(exec, _mesa_MultMatrixd);
-    SET_NewList(exec, _mesa_NewList);
-    SET_PassThrough(exec, _mesa_PassThrough);
-    SET_PixelMapfv(exec, _mesa_PixelMapfv);
-    SET_PixelMapuiv(exec, _mesa_PixelMapuiv);
-    SET_PixelMapusv(exec, _mesa_PixelMapusv);
-    SET_PixelStoref(exec, _mesa_PixelStoref);
-    SET_PixelTransferf(exec, _mesa_PixelTransferf);
-    SET_PixelTransferi(exec, _mesa_PixelTransferi);
-    SET_PixelZoom(exec, _mesa_PixelZoom);
-    SET_PointSize(exec, _mesa_PointSize);
-    SET_PolygonMode(exec, _mesa_PolygonMode);
-    SET_PolygonOffset(exec, _mesa_PolygonOffset);
-    SET_PolygonStipple(exec, _mesa_PolygonStipple);
-    SET_PopAttrib(exec, _mesa_PopAttrib);
-    SET_PushAttrib(exec, _mesa_PushAttrib);
-    SET_RasterPos2d(exec, _mesa_RasterPos2d);
-    SET_RasterPos2dv(exec, _mesa_RasterPos2dv);
-    SET_RasterPos2s(exec, _mesa_RasterPos2s);
-    SET_RasterPos2sv(exec, _mesa_RasterPos2sv);
-    SET_RasterPos3d(exec, _mesa_RasterPos3d);
-    SET_RasterPos3dv(exec, _mesa_RasterPos3dv);
-    SET_RasterPos3f(exec, _mesa_RasterPos3f);
-    SET_RasterPos3fv(exec, _mesa_RasterPos3fv);
-    SET_RasterPos3i(exec, _mesa_RasterPos3i);
-    SET_RasterPos3iv(exec, _mesa_RasterPos3iv);
-    SET_RasterPos3s(exec, _mesa_RasterPos3s);
-    SET_RasterPos3sv(exec, _mesa_RasterPos3sv);
-    SET_RasterPos4d(exec, _mesa_RasterPos4d);
-    SET_RasterPos4dv(exec, _mesa_RasterPos4dv);
-    SET_RasterPos4f(exec, _mesa_RasterPos4f);
-    SET_RasterPos4fv(exec, _mesa_RasterPos4fv);
-    SET_RasterPos4i(exec, _mesa_RasterPos4i);
-    SET_RasterPos4iv(exec, _mesa_RasterPos4iv);
-    SET_RasterPos4s(exec, _mesa_RasterPos4s);
-    SET_RasterPos4sv(exec, _mesa_RasterPos4sv);
-    SET_ReadPixels(exec, _mesa_ReadPixels);
-    SET_Rotated(exec, _mesa_Rotated);
-    SET_Scaled(exec, _mesa_Scaled);
-    SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
-    SET_TexEnvf(exec, _mesa_TexEnvf);
-    SET_TexEnviv(exec, _mesa_TexEnviv);
-    SET_TexGend(exec, _mesa_TexGend);
-    SET_TexGendv(exec, _mesa_TexGendv);
-    SET_TexGenf(exec, _mesa_TexGenf);
-    SET_TexGenfv(exec, _mesa_TexGenfv);
-    SET_TexGeni(exec, _mesa_TexGeni);
-    SET_TexGeniv(exec, _mesa_TexGeniv);
-    SET_TexImage1D(exec, _mesa_TexImage1D);
-    SET_TexParameterf(exec, _mesa_TexParameterf);
-    SET_TexParameterfv(exec, _mesa_TexParameterfv);
-    SET_TexParameteriv(exec, _mesa_TexParameteriv);
-    SET_Translated(exec, _mesa_Translated);
- #endif
-    /* 1.1 */
-    SET_BindTexture(exec, _mesa_BindTexture);
-    SET_DeleteTextures(exec, _mesa_DeleteTextures);
-    SET_GenTextures(exec, _mesa_GenTextures);
- #if _HAVE_FULL_GL
-    SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
-    SET_ColorPointer(exec, _mesa_ColorPointer);
-    SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
-    SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
-    SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
-    SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
-    SET_DisableClientState(exec, _mesa_DisableClientState);
-    SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
-    SET_EnableClientState(exec, _mesa_EnableClientState);
-    SET_GetPointerv(exec, _mesa_GetPointerv);
-    SET_IndexPointer(exec, _mesa_IndexPointer);
-    SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
-    SET_IsTexture(exec, _mesa_IsTexture);
-    SET_NormalPointer(exec, _mesa_NormalPointer);
-    SET_PopClientAttrib(exec, _mesa_PopClientAttrib);
-    SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
-    SET_PushClientAttrib(exec, _mesa_PushClientAttrib);
-    SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
-    SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
-    SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
-    SET_VertexPointer(exec, _mesa_VertexPointer);
- #endif
-    /* 1.2 */
- #if _HAVE_FULL_GL
-    SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
-    SET_TexImage3D(exec, _mesa_TexImage3D);
-    SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
- #endif
-    /* OpenGL 1.2  GL_ARB_imaging */
- #if _HAVE_FULL_GL
-    SET_BlendColor(exec, _mesa_BlendColor);
-    SET_BlendEquation(exec, _mesa_BlendEquation);
-    SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
-    SET_ColorSubTable(exec, _mesa_ColorSubTable);
-    SET_ColorTable(exec, _mesa_ColorTable);
-    SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv);
-    SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv);
-    SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D);
-    SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D);
-    SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf);
-    SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv);
-    SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri);
-    SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv);
-    SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable);
-    SET_CopyColorTable(exec, _mesa_CopyColorTable);
-    SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D);
-    SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D);
-    SET_GetColorTable(exec, _mesa_GetColorTable);
-    SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv);
-    SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv);
-    SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter);
-    SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv);
-    SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv);
-    SET_GetHistogram(exec, _mesa_GetHistogram);
-    SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv);
-    SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv);
-    SET_GetMinmax(exec, _mesa_GetMinmax);
-    SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv);
-    SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv);
-    SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter);
-    SET_Histogram(exec, _mesa_Histogram);
-    SET_Minmax(exec, _mesa_Minmax);
-    SET_ResetHistogram(exec, _mesa_ResetHistogram);
-    SET_ResetMinmax(exec, _mesa_ResetMinmax);
-    SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D);
- #endif
-    /* OpenGL 2.0 */
-    SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);
-    SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate);
-    SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate);
- #if FEATURE_ARB_shader_objects
-    SET_AttachShader(exec, _mesa_AttachShader);
-    SET_CreateProgram(exec, _mesa_CreateProgram);
-    SET_CreateShader(exec, _mesa_CreateShader);
-    SET_DeleteProgram(exec, _mesa_DeleteProgram);
-    SET_DeleteShader(exec, _mesa_DeleteShader);
-    SET_DetachShader(exec, _mesa_DetachShader);
-    SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
-    SET_GetProgramiv(exec, _mesa_GetProgramiv);
-    SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
-    SET_GetShaderiv(exec, _mesa_GetShaderiv);
-    SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
-    SET_IsProgram(exec, _mesa_IsProgram);
-    SET_IsShader(exec, _mesa_IsShader);
- #endif
-    /* OpenGL 2.1 */
- #if FEATURE_ARB_shader_objects
-    SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
-    SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
-    SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
-    SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv);
-    SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv);
-    SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv);
- #endif
-    /* 2. GL_EXT_blend_color */
- #if 0
- /*    SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */
- #endif
-    /* 3. GL_EXT_polygon_offset */
- #if _HAVE_FULL_GL
-    SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT);
- #endif
-    /* 6. GL_EXT_texture3d */
- #if 0
- /*    SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */
- /*    SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */
- /*    SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */
- #endif
-    /* 11. GL_EXT_histogram */
- #if 0
-    SET_GetHistogramEXT(exec, _mesa_GetHistogram);
-    SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv);
-    SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv);
-    SET_GetMinmaxEXT(exec, _mesa_GetMinmax);
-    SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv);
-    SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv);
- #endif
-    /* 14. SGI_color_table */
- #if 0
-    SET_ColorTableSGI(exec, _mesa_ColorTable);
-    SET_ColorSubTableSGI(exec, _mesa_ColorSubTable);
-    SET_GetColorTableSGI(exec, _mesa_GetColorTable);
-    SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv);
-    SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv);
- #endif
-    /* 30. GL_EXT_vertex_array */
- #if _HAVE_FULL_GL
-    SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT);
-    SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT);
-    SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT);
-    SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT);
-    SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT);
-    SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT);
- #endif
-    /* 37. GL_EXT_blend_minmax */
- #if 0
-    SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT);
- #endif
-    /* 54. GL_EXT_point_parameters */
- #if _HAVE_FULL_GL
-    SET_PointParameterfEXT(exec, _mesa_PointParameterfEXT);
-    SET_PointParameterfvEXT(exec, _mesa_PointParameterfvEXT);
- #endif
-    /* 97. GL_EXT_compiled_vertex_array */
- #if _HAVE_FULL_GL
-    SET_LockArraysEXT(exec, _mesa_LockArraysEXT);
-    SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT);
- #endif
-    /* 148. GL_EXT_multi_draw_arrays */
- #if _HAVE_FULL_GL
-    SET_MultiDrawArraysEXT(exec, _mesa_MultiDrawArraysEXT);
-    SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElementsEXT);
- #endif
-    /* 173. GL_INGR_blend_func_separate */
- #if _HAVE_FULL_GL
-    SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT);
- #endif
-    /* 196. GL_MESA_resize_buffers */
- #if _HAVE_FULL_GL
-    SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA);
- #endif
-    /* 197. GL_MESA_window_pos */
- #if _HAVE_FULL_GL
-    SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA);
-    SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA);
-    SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA);
-    SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA);
-    SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA);
-    SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA);
-    SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA);
-    SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA);
-    SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA);
-    SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA);
-    SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA);
-    SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA);
-    SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA);
-    SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA);
-    SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA);
-    SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA);
-    SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA);
-    SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA);
-    SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA);
-    SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA);
-    SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA);
-    SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA);
-    SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA);
-    SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA);
- #endif
-    /* 200. GL_IBM_multimode_draw_arrays */
- #if _HAVE_FULL_GL
-    SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
-    SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
- #endif
-    /* 233. GL_NV_vertex_program */
- #if FEATURE_NV_vertex_program
-    SET_BindProgramNV(exec, _mesa_BindProgram);
-    SET_DeleteProgramsNV(exec, _mesa_DeletePrograms);
-    SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV);
-    SET_GenProgramsNV(exec, _mesa_GenPrograms);
-    SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV);
-    SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV);
-    SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV);
-    SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV);
-    SET_GetProgramivNV(exec, _mesa_GetProgramivNV);
-    SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV);
-    SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV);
-    SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV);
-    SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV);
-    SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV);
-    SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV);
-    SET_IsProgramNV(exec, _mesa_IsProgramARB);
-    SET_LoadProgramNV(exec, _mesa_LoadProgramNV);
-    SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */
-    SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);  /* alias to ProgramParameter4dvNV */
-    SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB);  /* alias to ProgramParameter4fNV */
-    SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB);  /* alias to ProgramParameter4fvNV */
-    SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV);
-    SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV);
-    SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV);
-    SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV);
-    /* glVertexAttrib*NV functions handled in api_loopback.c */
- #endif
-    /* 273. GL_APPLE_vertex_array_object */
-    SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE);
-    SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
-    SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
-    SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
-    /* 282. GL_NV_fragment_program */
- #if FEATURE_NV_fragment_program
-    SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV);
-    SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV);
-    SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV);
-    SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV);
-    SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV);
-    SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV);
-    SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
-    SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
-    SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
-    SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
-    SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
-    SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
- #endif
-    /* 262. GL_NV_point_sprite */
- #if _HAVE_FULL_GL
-    SET_PointParameteriNV(exec, _mesa_PointParameteriNV);
-    SET_PointParameterivNV(exec, _mesa_PointParameterivNV);
- #endif
-    /* 268. GL_EXT_stencil_two_side */
- #if _HAVE_FULL_GL
-    SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT);
- #endif
-    /* ???. GL_EXT_depth_bounds_test */
-    SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
-    /* ARB 1. GL_ARB_multitexture */
- #if _HAVE_FULL_GL
-    SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB);
-    SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB);
- #endif
-    /* ARB 3. GL_ARB_transpose_matrix */
- #if _HAVE_FULL_GL
-    SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB);
-    SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB);
-    SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB);
-    SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB);
- #endif
-    /* ARB 5. GL_ARB_multisample */
- #if _HAVE_FULL_GL
-    SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB);
- #endif
-    /* ARB 12. GL_ARB_texture_compression */
- #if _HAVE_FULL_GL
-    SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB);
-    SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB);
-    SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
-    SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB);
-    SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB);
-    SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
-    SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
- #endif
-    /* ARB 14. GL_ARB_point_parameters */
-    /* reuse EXT_point_parameters functions */
-    /* ARB 26. GL_ARB_vertex_program */
-    /* ARB 27. GL_ARB_fragment_program */
- #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-    /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */
-    /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */
-    /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */
-    /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */
-    /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */
-    /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */
-    /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */
-    /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */
-    /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */
-    /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */
-    /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */
-    /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */
-    /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */
-    /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */
-    /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */
-    /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */
-    /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */
-    /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */
-    /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */
-    /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */
-    /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */
-    /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */
-    /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */
-    /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */
-    /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */
-    /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */
-    /* glVertexAttrib4bvARB handled in api_loopback.c */
-    /* glVertexAttrib4ivARB handled in api_loopback.c */
-    /* glVertexAttrib4ubvARB handled in api_loopback.c */
-    /* glVertexAttrib4usvARB handled in api_loopback.c */
-    /* glVertexAttrib4uivARB handled in api_loopback.c */
-    /* glVertexAttrib4NbvARB handled in api_loopback.c */
-    /* glVertexAttrib4NsvARB handled in api_loopback.c */
-    /* glVertexAttrib4NivARB handled in api_loopback.c */
-    /* glVertexAttrib4NusvARB handled in api_loopback.c */
-    /* glVertexAttrib4NuivARB handled in api_loopback.c */
-    SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB);
-    SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB);
-    SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB);
-    SET_ProgramStringARB(exec, _mesa_ProgramStringARB);
-    /* glBindProgramARB aliases glBindProgramNV */
-    /* glDeleteProgramsARB aliases glDeleteProgramsNV */
-    /* glGenProgramsARB aliases glGenProgramsNV */
-    /* glIsProgramARB aliases glIsProgramNV */
-    SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB);
-    SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
-    SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
-    /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
-    SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB);
-    SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);
-    SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB);
-    SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB);
-    SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB);
-    SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB);
-    SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB);
-    SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB);
-    SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB);
-    SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB);
-    SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB);
-    SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB);
-    SET_GetProgramivARB(exec, _mesa_GetProgramivARB);
-    SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB);
- #endif
-    /* ARB 28. GL_ARB_vertex_buffer_object */
- #if FEATURE_ARB_vertex_buffer_object
-    SET_BindBufferARB(exec, _mesa_BindBufferARB);
-    SET_BufferDataARB(exec, _mesa_BufferDataARB);
-    SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB);
-    SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB);
-    SET_GenBuffersARB(exec, _mesa_GenBuffersARB);
-    SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB);
-    SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB);
-    SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB);
-    SET_IsBufferARB(exec, _mesa_IsBufferARB);
-    SET_MapBufferARB(exec, _mesa_MapBufferARB);
-    SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB);
- #endif
-    /* ARB 29. GL_ARB_occlusion_query */
- #if FEATURE_ARB_occlusion_query
-    SET_GenQueriesARB(exec, _mesa_GenQueriesARB);
-    SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB);
-    SET_IsQueryARB(exec, _mesa_IsQueryARB);
-    SET_BeginQueryARB(exec, _mesa_BeginQueryARB);
-    SET_EndQueryARB(exec, _mesa_EndQueryARB);
-    SET_GetQueryivARB(exec, _mesa_GetQueryivARB);
-    SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB);
-    SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB);
- #endif
-    /* ARB 37. GL_ARB_draw_buffers */
-    SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);
-    
- #if FEATURE_ARB_shader_objects
-    SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
-    SET_GetHandleARB(exec, _mesa_GetHandleARB);
-    SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
-    SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB);
-    SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);
-    SET_CompileShaderARB(exec, _mesa_CompileShaderARB);
-    SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB);
-    SET_AttachObjectARB(exec, _mesa_AttachObjectARB);
-    SET_LinkProgramARB(exec, _mesa_LinkProgramARB);
-    SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);
-    SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);
-    SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
-    SET_Uniform2fARB(exec, _mesa_Uniform2fARB);
-    SET_Uniform3fARB(exec, _mesa_Uniform3fARB);
-    SET_Uniform4fARB(exec, _mesa_Uniform4fARB);
-    SET_Uniform1iARB(exec, _mesa_Uniform1iARB);
-    SET_Uniform2iARB(exec, _mesa_Uniform2iARB);
-    SET_Uniform3iARB(exec, _mesa_Uniform3iARB);
-    SET_Uniform4iARB(exec, _mesa_Uniform4iARB);
-    SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB);
-    SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB);
-    SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB);
-    SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB);
-    SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB);
-    SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB);
-    SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB);
-    SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB);
-    SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB);
-    SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB);
-    SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB);
-    SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB);
-    SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB);
-    SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB);
-    SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
-    SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB);
-    SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB);
-    SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB);
-    SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
-    SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);
- #endif    /* FEATURE_ARB_shader_objects */
- #if FEATURE_ARB_vertex_shader
-    SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB);
-    SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);
-    SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);
- #endif    /* FEATURE_ARB_vertex_shader */
-   /* GL_ATI_fragment_shader */
- #if FEATURE_ATI_fragment_shader
-    SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI);
-    SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI);
-    SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI);
-    SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI);
-    SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI);
-    SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI);
-    SET_SampleMapATI(exec, _mesa_SampleMapATI);
-    SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI);
-    SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI);
-    SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI);
-    SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI);
-    SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI);
-    SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI);
-    SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI);
- #endif
- #if FEATURE_EXT_framebuffer_object
-    SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT);
-    SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT);
-    SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT);
-    SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT);
-    SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT);
-    SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT);
-    SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT);
-    SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT);
-    SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT);
-    SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT);
-    SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT);
-    SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);
-    SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT);
-    SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT);
-    SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT);
-    SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT);
-    SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT);
- #endif
- #if FEATURE_EXT_timer_query
-    SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT);
-    SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT);
- #endif
- #if FEATURE_EXT_framebuffer_blit
-    SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
- #endif
-    /* GL_EXT_gpu_program_parameters */
- #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
-    SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT);
-    SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT);
- #endif
-    /* GL_MESA_texture_array / GL_EXT_texture_array */
- #if FEATURE_EXT_framebuffer_object
-    SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);
- #endif
-    /* GL_ATI_separate_stencil */
-    SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI);
- }
- /**********************************************************************/
- /** \name State update logic */
- /*@{*/
 +
 +
 +static void
 +update_separate_specular(GLcontext *ctx)
 +{
 +   if (NEED_SECONDARY_COLOR(ctx))
 +      ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR;
 +   else
 +      ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR;
 +}
 +
 +
  /**
   * Update state dependent on vertex arrays.
   */
@@@ -976,17 -188,21 +200,21 @@@ update_program(GLcontext *ctx
      *   1. OpenGL 2.0/ARB vertex/fragment shaders
      *   2. ARB/NV vertex/fragment programs
      *   3. Programs derived from fixed-function state.
+     *
+     * Note: it's possible for a vertex shader to get used with a fragment
+     * program (and vice versa) here, but in practice that shouldn't ever
+     * come up, or matter.
      */
  
 -   /**
 -    ** Fragment program
 -    **/
 -#if 1
 -   /* XXX get rid of this someday? */
 -   ctx->FragmentProgram._Active = GL_FALSE;
 -#endif
 -   if (shProg && shProg->LinkStatus && shProg->FragmentProgram) {
 -      /* user-defined fragment shader */
 +   _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL);
 +
 +   if (shProg && shProg->LinkStatus) {
 +      /* Use shader programs */
 +      /* XXX this isn't quite right, since we may have either a vertex
 +       * _or_ fragment shader (not always both).
 +       */
 +      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
 +                               shProg->VertexProgram);
        _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current,
                                 shProg->FragmentProgram);
     }
@@@ -1225,12 -428,11 +451,14 @@@ _mesa_update_state_locked( GLcontext *c
     if (new_state & _NEW_STENCIL)
        _mesa_update_stencil( ctx );
  
+ #if FEATURE_pixel_transfer
     if (new_state & _IMAGE_NEW_TRANSFER_STATE)
        _mesa_update_pixel( ctx, new_state );
+ #endif
  
 +   if (new_state & _DD_NEW_SEPARATE_SPECULAR)
 +      update_separate_specular( ctx );
 +
     if (new_state & (_NEW_ARRAY | _NEW_PROGRAM))
        update_arrays( ctx );
  
     if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT
                      | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR))
        update_tricaps( ctx, new_state );
 +#endif
  
-    if (ctx->FragmentProgram._MaintainTexEnvProgram) {
-       if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG))
-        _mesa_UpdateTexEnvProgram(ctx);
-    }
     /* ctx->_NeedEyeCoords is now up to date.
      *
      * If the truth value of this variable has changed, update for the
Simple merge
  #include "glheader.h"
  #include "macros.h"
  #include "enums.h"
 +#include "shader/program.h"
  #include "shader/prog_parameter.h"
+ #include "shader/prog_cache.h"
  #include "shader/prog_instruction.h"
  #include "shader/prog_print.h"
  #include "shader/prog_statevars.h"
+ #include "shader/programopt.h"
  #include "texenvprogram.h"
  
 +
 +struct texenvprog_cache_item
 +{
 +   GLuint hash;
 +   void *key;
 +   struct gl_fragment_program *data;
 +   struct texenvprog_cache_item *next;
 +};
 +
 +
  /**
   * This MAX is probably a bit generous, but that's OK.  There can be
   * up to four instructions per texture unit (TEX + 3 for combine),
@@@ -951,9 -940,13 +953,17 @@@ static void load_texture( struct texenv
         p->src_texture[unit] = emit_texld( p, OPCODE_TXP,
                                            tmp, WRITEMASK_XYZW, 
                                            unit, dim, texcoord );
-       } else
++
 +       if (p->state->unit[unit].shadow)
 +          p->program->Base.ShadowSamplers |= 1 << unit;
++
+          p->program->Base.SamplersUsed |= (1 << unit);
+          /* This identity mapping should already be in place
+           * (see _mesa_init_program_struct()) but let's be safe.
+           */
+          p->program->Base.SamplerUnits[unit] = unit;
+       }
+       else
         p->src_texture[unit] = get_zero(p);
     }
  }
@@@ -1256,36 -1183,13 +1200,16 @@@ _mesa_UpdateTexEnvProgram( GLcontext *c
  
     /* If a conventional fragment program/shader isn't in effect... */
     if (!ctx->FragmentProgram._Enabled &&
-        (!ctx->Shader.CurrentProgram || !ctx->Shader.CurrentProgram->FragmentProgram)) {
+        (!ctx->Shader.CurrentProgram ||
 -        !ctx->Shader.CurrentProgram->FragmentProgram) ) {
++        !ctx->Shader.CurrentProgram->FragmentProgram) ) 
++   {
 +      struct gl_fragment_program *newProg;
 +
-       make_state_key(ctx, &key);
-       hash = hash_key(&key);
-       
-       newProg = search_cache(&ctx->Texture.env_fp_cache, hash, &key, sizeof(key));
-       if (!newProg) {
-          /* create new tex env program */
-          if (0)
-             _mesa_printf("Building new texenv proggy for key %x\n", hash);
-          newProg = (struct gl_fragment_program *) 
-             ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0);
-          create_new_program(ctx, &key, newProg);
-          /* Our ownership of newProg is transferred to the cache */
-          cache_item(ctx, &ctx->Texture.env_fp_cache, hash, &key, newProg);
-       }
++      newProg = _mesa_get_fixed_func_fragment_program(ctx);
  
 -      ctx->FragmentProgram._Current
 -         = ctx->FragmentProgram._TexEnvProgram
 -         = _mesa_get_fixed_func_fragment_program(ctx);
 +      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, newProg);
 +      _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, newProg);
     } 
-    else {
-       /* _Current pointer has been updated in update_program */
-       /* ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; */
-    }
  
     /* Tell the driver about the change.  Could define a new target for
      * this?
Simple merge
Simple merge
@@@ -3211,32 -811,12 +819,36 @@@ _mesa_free_texture_data(GLcontext *ctx
     for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++)
        ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]);
  
-    for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++)
-       _mesa_free_colortable_data( &ctx->Texture.Unit[u].ColorTable );
  
-    _mesa_TexEnvProgramCacheDestroy( ctx );
+ #if FEATURE_colortable
+    {
+       GLuint i;
+       for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
+          _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable );
+    }
+ #endif
  }
 +
 +
 +/**
 + * Update the default texture objects in the given context to reference those
 + * specified in the shared state and release those referencing the old 
 + * shared state.
 + */
 +void
 +_mesa_update_default_objects_texture(GLcontext *ctx)
 +{
 +   GLuint i;
 +
 +   for (i = 0; i < MAX_TEXTURE_UNITS; i++) {
 +      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
 +
 +      _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D);
 +      _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D);
 +      _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D);
 +      _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap);
 +      _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect);
 +      _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->Default1DArray);
 +      _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->Default2DArray);
 +   }
 +}
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -146,12 -150,21 +150,26 @@@ _mesa_MultiModeDrawElementsIBM( const G
                                GLenum type, const GLvoid * const * indices,
                                GLsizei primcount, GLint modestride );
  
 +extern void GLAPIENTRY
 +_mesa_LockArraysEXT(GLint first, GLsizei count);
 +
 +extern void GLAPIENTRY
 +_mesa_UnlockArraysEXT( void );
  
+ extern void GLAPIENTRY
+ _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
+ extern void GLAPIENTRY
+ _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
+                    const GLvoid *indices);
+ extern void GLAPIENTRY
+ _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
+                         GLenum type, const GLvoid *indices);
  extern void
  _mesa_init_varray( GLcontext * ctx );
  
Simple merge
@@@ -90,10 -90,9 +90,10 @@@ get_register_pointer(const struct prog_
           const struct gl_program_parameter_list *params;
           ASSERT(source->File == PROGRAM_LOCAL_PARAM ||
                  source->File == PROGRAM_CONSTANT ||
 -                source->File == PROGRAM_STATE_VAR);
 +                source->File == PROGRAM_STATE_VAR ||
 +                source->File == PROGRAM_UNIFORM);
           params = machine->CurProgram->Parameters;
-          if (reg < 0 || reg >= params->NumParameters)
+          if (reg < 0 || reg >= (GLint)params->NumParameters)
              return ZeroVec;
           else
              return params->ParameterValues[reg];
@@@ -132,12 -131,8 +131,8 @@@ _mesa_fetch_state(GLcontext *ctx, cons
               ADD_3V(value, p, eye_z);
               NORMALIZE_3FV(value);
               value[3] = 1.0;
 -            }                                           
 +            }
              return;
-        case STATE_POSITION_NORMALIZED:
-             COPY_4V(value, ctx->Light.Light[ln].EyePosition);
-           NORMALIZE_3FV( value );
-             return;
           default:
              _mesa_problem(ctx, "Invalid light state in fetch_state");
              return;
           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);
+          return;
+       }
+       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;
+          return;
+       }                                                 
        case STATE_PT_SCALE:
           value[0] = ctx->Pixel.RedScale;
           value[1] = ctx->Pixel.GreenScale;
Simple merge
@@@ -134,8 -134,8 +134,8 @@@ _mesa_longest_uniform_name(const struc
     GLint max = 0;
     GLuint i;
     for (i = 0; list && i < list->NumUniforms; i++) {
--      GLuint len = _mesa_strlen(list->Uniforms[i].Name);
 -      if (len > (GLuint)max)
++      GLint len = (GLint)_mesa_strlen(list->Uniforms[i].Name);
 +      if (len > max)
           max = len;
     }
     return max;
@@@ -540,53 -504,6 +550,52 @@@ _mesa_insert_instructions(struct gl_pro
     return GL_TRUE;
  }
  
 +/**
 + * Delete 'count' instructions at 'start' in the given program.
 + * Adjust branch targets accordingly.
 + */
 +GLboolean
 +_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count)
 +{
 +   const GLuint origLen = prog->NumInstructions;
 +   const GLuint newLen = origLen - count;
 +   struct prog_instruction *newInst;
 +   GLuint i;
 +
 +   /* adjust branches */
 +   for (i = 0; i < prog->NumInstructions; i++) {
 +      struct prog_instruction *inst = prog->Instructions + i;
 +      if (inst->BranchTarget > 0) {
 +         if (inst->BranchTarget >= start) {
 +            inst->BranchTarget -= count;
 +         }
 +      }
 +   }
 +
 +   /* Alloc storage for new instructions */
 +   newInst = _mesa_alloc_instructions(newLen);
 +   if (!newInst) {
 +      return GL_FALSE;
 +   }
 +
 +   /* Copy 'start' instructions into new instruction buffer */
 +   _mesa_copy_instructions(newInst, prog->Instructions, start);
 +
 +   /* Copy the remaining/tail instructions to new inst buffer */
 +   _mesa_copy_instructions(newInst + start,
 +                           prog->Instructions + start + count,
 +                           newLen - start);
 +
 +   /* free old instructions */
 +   _mesa_free_instructions(prog->Instructions, origLen);
 +
 +   /* install new instructions */
 +   prog->Instructions = newInst;
 +   prog->NumInstructions = newLen;
 +
 +   return GL_TRUE;
 +}
 +
  
  /**
   * Search instructions for registers that match (oldFile, oldIndex),
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
   *    Brian Paul
   */
  
- #include "imports.h"
+ #include "main/imports.h"
  #include "bufferobj.h"
- #include "context.h"
- #include "colormac.h"
- #include "mtypes.h"
+ #include "main/context.h"
+ #include "main/colormac.h"
+ #include "main/mtypes.h"
  #include "teximage.h"
  #include "swrast.h"
 +#include "shader/prog_parameter.h"
  #include "shader/prog_statevars.h"
  #include "s_blend.h"
  #include "s_context.h"
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1543,42 -44,9 +44,12 @@@ void _tnl_UpdateFixedFunctionProgram( G
  
     if (!ctx->VertexProgram._Current ||
         ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
 -      ctx->VertexProgram._Current
 -         = ctx->VertexProgram._TnlProgram
 -         = _mesa_get_fixed_func_vertex_program(ctx);
 +      struct gl_vertex_program *newProg;
 +
-       /* Grab all the relevent state and put it in a single structure:
-        */
-       key = make_state_key(ctx);
-       hash = hash_key(key);
-       /* Look for an already-prepared program for this state:
-        */
-       newProg = search_cache( tnl->vp_cache, hash, key, sizeof(*key));
-    
-       /* OK, we'll have to build a new one:
-        */
-       if (!newProg) {
-        if (0)
-           _mesa_printf("Build new TNL program\n");
-        
-        newProg = (struct gl_vertex_program *)
-           ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); 
-        create_new_program( key, newProg, ctx->Const.VertexProgram.MaxTemps );
-        if (ctx->Driver.ProgramStringNotify)
-           ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB, 
-                                              &newProg->Base );
-          /* Our ownership of newProg is transferred to the cache */
-        cache_item(ctx, tnl->vp_cache, hash, key, newProg);
-       }
-       else {
-        FREE(key);
-       }
++      newProg = _mesa_get_fixed_func_vertex_program(ctx);
 +
 +      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, newProg);
 +      _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, newProg);
     }
  
     /* Tell the driver about the change.  Could define a new target for
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge