aboutsummaryrefslogtreecommitdiff
path: root/mesalib
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-07-15 11:32:48 +0200
committermarha <marha@users.sourceforge.net>2011-07-15 11:32:48 +0200
commit3fbadc13acf6beb4a2497970367e2c2c1b6039ca (patch)
tree44bc51faf9ba2bf08022a268f1a85c55fc4431ca /mesalib
parent4b424e0ba999b47ca62298e8104f76f940aac4d8 (diff)
parent2ce12f084113a0097fa1a0d67e2f8fe1ab70092b (diff)
downloadvcxsrv-3fbadc13acf6beb4a2497970367e2c2c1b6039ca.tar.gz
vcxsrv-3fbadc13acf6beb4a2497970367e2c2c1b6039ca.tar.bz2
vcxsrv-3fbadc13acf6beb4a2497970367e2c2c1b6039ca.zip
Merge remote-tracking branch 'origin/released'
Conflicts: libX11/configure.ac mesalib/configs/linux-dri mesalib/docs/download.html mesalib/src/SConscript mesalib/src/mesa/main/bufferobj.c mesalib/src/mesa/main/bufferobj.h mesalib/src/mesa/main/framebuffer.c mesalib/src/mesa/main/renderbuffer.c mesalib/src/mesa/main/renderbuffer.h mesalib/src/mesa/main/texobj.c mesalib/src/mesa/program/program.c mesalib/src/mesa/vbo/vbo_exec_array.c xorg-server/dix/window.c xorg-server/xkb/xkb.c xorg-server/xkb/xkmread.c
Diffstat (limited to 'mesalib')
-rw-r--r--mesalib/Makefile365
-rw-r--r--mesalib/configs/aix2
-rw-r--r--mesalib/configs/aix-642
-rw-r--r--mesalib/configs/aix-64-static1
-rw-r--r--mesalib/configs/aix-gcc1
-rw-r--r--mesalib/configs/aix-static1
-rw-r--r--mesalib/configs/autoconf.in9
-rw-r--r--mesalib/configs/beos3
-rw-r--r--mesalib/configs/darwin5
-rw-r--r--mesalib/configs/default11
-rw-r--r--mesalib/configs/freebsd1
-rw-r--r--mesalib/configs/freebsd-dri105
-rw-r--r--mesalib/configs/hpux10-gcc1
-rw-r--r--mesalib/configs/hpux10-static2
-rw-r--r--mesalib/configs/hpux11-322
-rw-r--r--mesalib/configs/hpux11-32-static1
-rw-r--r--mesalib/configs/hpux11-32-static-nothreads1
-rw-r--r--mesalib/configs/hpux11-642
-rw-r--r--mesalib/configs/hpux11-64-static1
-rw-r--r--mesalib/configs/hpux11-ia642
-rw-r--r--mesalib/configs/hpux11-ia64-static1
-rw-r--r--mesalib/configs/irix6-64-static1
-rw-r--r--mesalib/configs/irix6-n32-static3
-rw-r--r--mesalib/configs/irix6-o32-static3
-rw-r--r--mesalib/configs/linux1
-rw-r--r--mesalib/configs/linux-alpha2
-rw-r--r--mesalib/configs/linux-alpha-static3
-rw-r--r--mesalib/configs/linux-cell2
-rw-r--r--mesalib/configs/linux-dri1
-rw-r--r--mesalib/configs/linux-dri-xcb112
-rw-r--r--mesalib/configs/linux-fbdev2
-rw-r--r--mesalib/configs/linux-ia64-icc2
-rw-r--r--mesalib/configs/linux-ia64-icc-static3
-rw-r--r--mesalib/configs/linux-icc2
-rw-r--r--mesalib/configs/linux-icc-static3
-rw-r--r--mesalib/configs/linux-indirect104
-rw-r--r--mesalib/configs/linux-osmesa-static2
-rw-r--r--mesalib/configs/linux-ppc-static1
-rw-r--r--mesalib/configs/linux-static2
-rw-r--r--mesalib/configs/linux-x86-64-static2
-rw-r--r--mesalib/configs/linux-x86-static2
-rw-r--r--mesalib/configs/netbsd1
-rw-r--r--mesalib/configs/openbsd1
-rw-r--r--mesalib/configs/osf11
-rw-r--r--mesalib/configs/osf1-static1
-rw-r--r--mesalib/configs/solaris-x863
-rw-r--r--mesalib/configs/solaris-x86-gcc2
-rw-r--r--mesalib/configs/solaris-x86-gcc-static3
-rw-r--r--mesalib/configs/sunos4-gcc1
-rw-r--r--mesalib/configs/sunos4-static2
-rw-r--r--mesalib/configs/sunos52
-rw-r--r--mesalib/configs/sunos5-gcc2
-rw-r--r--mesalib/configs/sunos5-smp2
-rw-r--r--mesalib/configs/sunos5-v82
-rw-r--r--mesalib/configs/sunos5-v8-static1
-rw-r--r--mesalib/configs/sunos5-v92
-rw-r--r--mesalib/configs/sunos5-v9-cc-g++2
-rw-r--r--mesalib/configs/sunos5-v9-static1
-rw-r--r--mesalib/configs/ultrix-gcc2
-rw-r--r--mesalib/configure.ac107
-rw-r--r--mesalib/docs/autoconf.html8
-rw-r--r--mesalib/docs/devinfo.html436
-rw-r--r--mesalib/docs/download.html5
-rw-r--r--mesalib/docs/faq.html6
-rw-r--r--mesalib/docs/license.html8
-rw-r--r--mesalib/docs/sourcetree.html331
-rw-r--r--mesalib/include/GL/glut.h665
-rw-r--r--mesalib/include/GL/glutf90.h81
-rw-r--r--mesalib/src/SConscript1
-rw-r--r--mesalib/src/gallium/auxiliary/util/u_video.h1
-rw-r--r--mesalib/src/mesa/main/bufferobj.c3835
-rw-r--r--mesalib/src/mesa/main/bufferobj.h12
-rw-r--r--mesalib/src/mesa/main/framebuffer.c12
-rw-r--r--mesalib/src/mesa/main/framebuffer.h212
-rw-r--r--mesalib/src/mesa/main/renderbuffer.c12
-rw-r--r--mesalib/src/mesa/main/renderbuffer.h11
-rw-r--r--mesalib/src/mesa/main/texobj.c10
-rw-r--r--mesalib/src/mesa/main/texobj.h258
-rw-r--r--mesalib/src/mesa/program/program.c14
-rw-r--r--mesalib/src/mesa/program/program.h429
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c6
81 files changed, 3067 insertions, 4196 deletions
diff --git a/mesalib/Makefile b/mesalib/Makefile
index 0a3deb816..b0a2d8065 100644
--- a/mesalib/Makefile
+++ b/mesalib/Makefile
@@ -183,298 +183,46 @@ ultrix-gcc:
# Rules for making release tarballs
-VERSION=7.12-devel
-DIRECTORY = Mesa-$(VERSION)
-LIB_NAME = MesaLib-$(VERSION)
-GLUT_NAME = MesaGLUT-$(VERSION)
-
-# This is part of MAIN_FILES
-MAIN_ES_FILES = \
- $(DIRECTORY)/src/mesa/main/*.xml \
- $(DIRECTORY)/src/mesa/main/*.py \
- $(DIRECTORY)/src/mesa/main/*.dtd
-
-MAIN_FILES = \
- $(DIRECTORY)/Makefile* \
- $(DIRECTORY)/configure \
- $(DIRECTORY)/configure.ac \
- $(DIRECTORY)/acinclude.m4 \
- $(DIRECTORY)/aclocal.m4 \
- $(DIRECTORY)/SConstruct \
- $(DIRECTORY)/common.py \
- $(DIRECTORY)/scons/*py \
- $(DIRECTORY)/bin/config.guess \
- $(DIRECTORY)/bin/config.sub \
- $(DIRECTORY)/bin/extract_git_sha1 \
- $(DIRECTORY)/bin/install-sh \
- $(DIRECTORY)/bin/mklib \
- $(DIRECTORY)/bin/minstall \
- $(DIRECTORY)/bin/version.mk \
- $(DIRECTORY)/configs/[a-z]* \
- $(DIRECTORY)/docs/*.html \
- $(DIRECTORY)/docs/COPYING \
- $(DIRECTORY)/docs/README.* \
- $(DIRECTORY)/docs/RELNOTES* \
- $(DIRECTORY)/docs/*.spec \
- $(DIRECTORY)/include/GL/gl.h \
- $(DIRECTORY)/include/GL/glext.h \
- $(DIRECTORY)/include/GL/gl_mangle.h \
- $(DIRECTORY)/include/GL/glu.h \
- $(DIRECTORY)/include/GL/glu_mangle.h \
- $(DIRECTORY)/include/GL/glx.h \
- $(DIRECTORY)/include/GL/glxext.h \
- $(DIRECTORY)/include/GL/glx_mangle.h \
- $(DIRECTORY)/include/GL/glfbdev.h \
- $(DIRECTORY)/include/GL/mesa_wgl.h \
- $(DIRECTORY)/include/GL/osmesa.h \
- $(DIRECTORY)/include/GL/vms_x_fix.h \
- $(DIRECTORY)/include/GL/wglext.h \
- $(DIRECTORY)/include/GL/wmesa.h \
- $(DIRECTORY)/include/pci_ids/*.h \
- $(DIRECTORY)/include/c99/*.h \
- $(DIRECTORY)/src/getopt/SConscript \
- $(DIRECTORY)/src/getopt/getopt*.[ch] \
- $(DIRECTORY)/src/glsl/Makefile \
- $(DIRECTORY)/src/glsl/Makefile.template \
- $(DIRECTORY)/src/glsl/SConscript \
- $(DIRECTORY)/src/glsl/*.[ch] \
- $(DIRECTORY)/src/glsl/*.ll \
- $(DIRECTORY)/src/glsl/*.yy \
- $(DIRECTORY)/src/glsl/*.[cly]pp \
- $(DIRECTORY)/src/glsl/README \
- $(DIRECTORY)/src/glsl/glcpp/*.[chly] \
- $(DIRECTORY)/src/glsl/glcpp/README \
- $(DIRECTORY)/src/glsl/builtins \
- $(DIRECTORY)/src/Makefile \
- $(DIRECTORY)/src/SConscript \
- $(DIRECTORY)/src/mesa/Makefile* \
- $(DIRECTORY)/src/mesa/SConscript \
- $(DIRECTORY)/src/mesa/sources.mak \
- $(DIRECTORY)/src/mesa/descrip.mms \
- $(DIRECTORY)/src/mesa/gl.pc.in \
- $(DIRECTORY)/src/mesa/osmesa.pc.in \
- $(DIRECTORY)/src/mesa/depend \
- $(MAIN_ES_FILES) \
- $(DIRECTORY)/src/mesa/main/*.[chS] \
- $(DIRECTORY)/src/mesa/main/*.cpp \
- $(DIRECTORY)/src/mesa/main/descrip.mms \
- $(DIRECTORY)/src/mesa/math/*.[ch] \
- $(DIRECTORY)/src/mesa/math/descrip.mms \
- $(DIRECTORY)/src/mesa/program/*.[chly] \
- $(DIRECTORY)/src/mesa/program/*.cpp \
- $(DIRECTORY)/src/mesa/program/descrip.mms \
- $(DIRECTORY)/src/mesa/swrast/*.[ch] \
- $(DIRECTORY)/src/mesa/swrast/descrip.mms \
- $(DIRECTORY)/src/mesa/swrast_setup/*.[ch] \
- $(DIRECTORY)/src/mesa/swrast_setup/descrip.mms \
- $(DIRECTORY)/src/mesa/vbo/*.[chS] \
- $(DIRECTORY)/src/mesa/vbo/descrip.mms \
- $(DIRECTORY)/src/mesa/tnl/*.[chS] \
- $(DIRECTORY)/src/mesa/tnl/descrip.mms \
- $(DIRECTORY)/src/mesa/tnl_dd/*.[ch] \
- $(DIRECTORY)/src/mesa/tnl_dd/imm/*.[ch] \
- $(DIRECTORY)/src/mesa/tnl_dd/imm/NOTES.imm \
- $(DIRECTORY)/src/mesa/drivers/Makefile \
- $(DIRECTORY)/src/mesa/drivers/beos/*.cpp \
- $(DIRECTORY)/src/mesa/drivers/beos/Makefile \
- $(DIRECTORY)/src/mesa/drivers/common/*.[ch] \
- $(DIRECTORY)/src/mesa/drivers/common/descrip.mms \
- $(DIRECTORY)/src/mesa/drivers/fbdev/Makefile \
- $(DIRECTORY)/src/mesa/drivers/fbdev/glfbdev.c \
- $(DIRECTORY)/src/mesa/drivers/osmesa/Makefile \
- $(DIRECTORY)/src/mesa/drivers/osmesa/Makefile.win \
- $(DIRECTORY)/src/mesa/drivers/osmesa/descrip.mms \
- $(DIRECTORY)/src/mesa/drivers/osmesa/osmesa.def \
- $(DIRECTORY)/src/mesa/drivers/osmesa/*.[ch] \
- $(DIRECTORY)/src/mesa/drivers/dri/r300/compiler/*.[ch] \
- $(DIRECTORY)/src/mesa/drivers/dri/r300/compiler/Makefile \
- $(DIRECTORY)/src/mesa/drivers/dri/r300/compiler/SConscript \
- $(DIRECTORY)/src/mesa/drivers/windows/*/*.[ch] \
- $(DIRECTORY)/src/mesa/drivers/windows/*/*.def \
- $(DIRECTORY)/src/mesa/drivers/x11/Makefile \
- $(DIRECTORY)/src/mesa/drivers/x11/descrip.mms \
- $(DIRECTORY)/src/mesa/drivers/x11/*.[ch] \
- $(DIRECTORY)/src/mesa/ppc/*.[ch] \
- $(DIRECTORY)/src/mesa/sparc/*.[chS] \
- $(DIRECTORY)/src/mesa/x86/Makefile \
- $(DIRECTORY)/src/mesa/x86/*.[ch] \
- $(DIRECTORY)/src/mesa/x86/*.S \
- $(DIRECTORY)/src/mesa/x86/rtasm/*.[ch] \
- $(DIRECTORY)/src/mesa/x86-64/*.[chS] \
- $(DIRECTORY)/src/mesa/x86-64/Makefile
-
-MAPI_FILES = \
- $(DIRECTORY)/include/GLES/*.h \
- $(DIRECTORY)/include/GLES2/*.h \
- $(DIRECTORY)/include/VG/*.h \
- $(DIRECTORY)/src/mapi/es?api/Makefile \
- $(DIRECTORY)/src/mapi/es?api/*.pc.in \
- $(DIRECTORY)/src/mapi/glapi/gen/Makefile \
- $(DIRECTORY)/src/mapi/glapi/gen/*.xml \
- $(DIRECTORY)/src/mapi/glapi/gen/*.py \
- $(DIRECTORY)/src/mapi/glapi/gen/*.dtd \
- $(DIRECTORY)/src/mapi/glapi/gen-es/Makefile \
- $(DIRECTORY)/src/mapi/glapi/gen-es/*.xml \
- $(DIRECTORY)/src/mapi/glapi/gen-es/*.py \
- $(DIRECTORY)/src/mapi/glapi/Makefile \
- $(DIRECTORY)/src/mapi/glapi/SConscript \
- $(DIRECTORY)/src/mapi/glapi/sources.mak \
- $(DIRECTORY)/src/mapi/glapi/*.[chS] \
- $(DIRECTORY)/src/mapi/mapi/mapi_abi.py \
- $(DIRECTORY)/src/mapi/mapi/sources.mak \
- $(DIRECTORY)/src/mapi/mapi/*.[ch] \
- $(DIRECTORY)/src/mapi/shared-glapi/SConscript \
- $(DIRECTORY)/src/mapi/shared-glapi/Makefile \
- $(DIRECTORY)/src/mapi/vgapi/Makefile \
- $(DIRECTORY)/src/mapi/vgapi/SConscript \
- $(DIRECTORY)/src/mapi/vgapi/vgapi.csv \
- $(DIRECTORY)/src/mapi/vgapi/vg.pc.in
-
-EGL_FILES = \
- $(DIRECTORY)/include/KHR/*.h \
- $(DIRECTORY)/include/EGL/*.h \
- $(DIRECTORY)/src/egl/Makefile \
- $(DIRECTORY)/src/egl/*/Makefile \
- $(DIRECTORY)/src/egl/*/Makefile.template \
- $(DIRECTORY)/src/egl/*/*.[ch] \
- $(DIRECTORY)/src/egl/*/*/Makefile \
- $(DIRECTORY)/src/egl/*/*/*.[ch] \
- $(DIRECTORY)/src/egl/wayland/wayland-drm/protocol/*.xml \
- $(DIRECTORY)/src/egl/wayland/wayland-egl/*.pc.in \
- $(DIRECTORY)/src/egl/main/SConscript \
- $(DIRECTORY)/src/egl/main/*.pc.in \
- $(DIRECTORY)/src/egl/main/*.def
-
-GBM_FILES = \
- $(DIRECTORY)/src/gbm/Makefile \
- $(DIRECTORY)/src/gbm/main/*.pc.in \
- $(DIRECTORY)/src/gbm/main/*.[ch] \
- $(DIRECTORY)/src/gbm/main/Makefile \
- $(DIRECTORY)/src/gbm/backends/Makefile \
- $(DIRECTORY)/src/gbm/backends/Makefile.template \
- $(DIRECTORY)/src/gbm/backends/*/*.[ch] \
- $(DIRECTORY)/src/gbm/backends/*/Makefile \
-
-GALLIUM_FILES = \
- $(DIRECTORY)/src/mesa/state_tracker/*[ch] \
- $(DIRECTORY)/src/gallium/Makefile \
- $(DIRECTORY)/src/gallium/Makefile.template \
- $(DIRECTORY)/src/gallium/SConscript \
- $(DIRECTORY)/src/gallium/targets/Makefile.dri \
- $(DIRECTORY)/src/gallium/targets/Makefile.xorg \
- $(DIRECTORY)/src/gallium/targets/SConscript.dri \
- $(DIRECTORY)/src/gallium/*/Makefile \
- $(DIRECTORY)/src/gallium/*/SConscript \
- $(DIRECTORY)/src/gallium/*/*/Makefile \
- $(DIRECTORY)/src/gallium/*/*/SConscript \
- $(DIRECTORY)/src/gallium/*/*/*.[ch] \
- $(DIRECTORY)/src/gallium/auxiliary/gallivm/*.cpp \
- $(DIRECTORY)/src/gallium/*/*/*.py \
- $(DIRECTORY)/src/gallium/*/*/*.csv \
- $(DIRECTORY)/src/gallium/*/*/*/Makefile \
- $(DIRECTORY)/src/gallium/*/*/*/SConscript \
- $(DIRECTORY)/src/gallium/*/*/*/*.[ch] \
- $(DIRECTORY)/src/gallium/*/*/*/*.py
-
-APPLE_DRI_FILES = \
- $(DIRECTORY)/src/glx/apple/Makefile \
- $(DIRECTORY)/src/glx/apple/*.[ch]
-
-DRI_FILES = \
- $(DIRECTORY)/include/GL/internal/dri_interface.h \
- $(DIRECTORY)/include/GL/internal/sarea.h \
- $(DIRECTORY)/src/glx/Makefile \
- $(DIRECTORY)/src/glx/*.[ch] \
- $(APPLE_DRI_FILES) \
- $(DIRECTORY)/src/mesa/drivers/dri/Makefile* \
- $(DIRECTORY)/src/mesa/drivers/dri/dri.pc.in \
- $(DIRECTORY)/src/mesa/drivers/dri/common/xmlpool/*.po \
- $(DIRECTORY)/src/mesa/drivers/dri/*/*.[chS] \
- $(DIRECTORY)/src/mesa/drivers/dri/*/*.cpp \
- $(DIRECTORY)/src/mesa/drivers/dri/*/*/*.[chS] \
- $(DIRECTORY)/src/mesa/drivers/dri/*/Makefile \
- $(DIRECTORY)/src/mesa/drivers/dri/*/*/Makefile \
- $(DIRECTORY)/src/mesa/drivers/dri/*/Doxyfile
-
-SGI_GLU_FILES = \
- $(DIRECTORY)/src/glu/Makefile \
- $(DIRECTORY)/src/glu/glu.pc.in \
- $(DIRECTORY)/src/glu/sgi/Makefile \
- $(DIRECTORY)/src/glu/sgi/Makefile.mgw \
- $(DIRECTORY)/src/glu/sgi/Makefile.win \
- $(DIRECTORY)/src/glu/sgi/glu.def \
- $(DIRECTORY)/src/glu/sgi/dummy.cc \
- $(DIRECTORY)/src/glu/sgi/glu.exports \
- $(DIRECTORY)/src/glu/sgi/glu.exports.darwin \
- $(DIRECTORY)/src/glu/sgi/mesaglu.opt \
- $(DIRECTORY)/src/glu/sgi/include/gluos.h \
- $(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.h \
- $(DIRECTORY)/src/glu/sgi/libnurbs/interface/*.cc \
- $(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.h \
- $(DIRECTORY)/src/glu/sgi/libnurbs/internals/*.cc \
- $(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.h \
- $(DIRECTORY)/src/glu/sgi/libnurbs/nurbtess/*.cc \
- $(DIRECTORY)/src/glu/sgi/libtess/README \
- $(DIRECTORY)/src/glu/sgi/libtess/alg-outline \
- $(DIRECTORY)/src/glu/sgi/libtess/*.[ch] \
- $(DIRECTORY)/src/glu/sgi/libutil/*.[ch]
-
-GLW_FILES = \
- $(DIRECTORY)/src/glw/*.[ch] \
- $(DIRECTORY)/src/glw/Makefile* \
- $(DIRECTORY)/src/glw/README \
- $(DIRECTORY)/src/glw/glw.pc.in \
- $(DIRECTORY)/src/glw/depend
-
-GLUT_FILES = \
- $(DIRECTORY)/include/GL/glut.h \
- $(DIRECTORY)/include/GL/glutf90.h \
- $(DIRECTORY)/src/glut/glx/Makefile* \
- $(DIRECTORY)/src/glut/glx/SConscript \
- $(DIRECTORY)/src/glut/glx/depend \
- $(DIRECTORY)/src/glut/glx/glut.pc.in \
- $(DIRECTORY)/src/glut/glx/*def \
- $(DIRECTORY)/src/glut/glx/*.[ch] \
- $(DIRECTORY)/src/glut/beos/*.[ch] \
- $(DIRECTORY)/src/glut/beos/*.cpp \
- $(DIRECTORY)/src/glut/beos/Makefile
+PACKAGE_VERSION=7.12-devel
+PACKAGE_DIR = Mesa-$(PACKAGE_VERSION)
+PACKAGE_NAME = MesaLib-$(PACKAGE_VERSION)
+
+EXTRA_FILES = \
+ aclocal.m4 \
+ configure \
+ src/glsl/glsl_parser.cpp \
+ src/glsl/glsl_parser.h \
+ src/glsl/glsl_lexer.cpp \
+ src/glsl/glcpp/glcpp-lex.c \
+ src/glsl/glcpp/glcpp-parse.c \
+ src/glsl/glcpp/glcpp-parse.h \
+ src/mesa/program/lex.yy.c \
+ src/mesa/program/program_parse.tab.c \
+ src/mesa/program/program_parse.tab.h
+
+IGNORE_FILES = \
+ -x autogen.sh
DEPEND_FILES = \
- $(TOP)/src/mesa/depend \
- $(TOP)/src/glx/depend \
- $(TOP)/src/glw/depend \
- $(TOP)/src/glut/glx/depend \
- $(TOP)/src/glu/sgi/depend
-
-
-LIB_FILES = \
- $(MAIN_FILES) \
- $(MAPI_FILES) \
- $(ES_FILES) \
- $(EGL_FILES) \
- $(GBM_FILES) \
- $(GALLIUM_FILES) \
- $(DRI_FILES) \
- $(SGI_GLU_FILES) \
- $(GLW_FILES)
+ src/mesa/depend \
+ src/glx/depend \
+ src/glw/depend \
+ src/glu/sgi/depend
parsers: configure
-@touch $(TOP)/configs/current
$(MAKE) -C src/glsl glsl_parser.cpp glsl_parser.h glsl_lexer.cpp
$(MAKE) -C src/glsl/glcpp glcpp-lex.c glcpp-parse.c glcpp-parse.h
- $(MAKE) -C src/mesa/program lex.yy.c program_parse.tab.c program_parse.tab.h
+ $(MAKE) -C src/mesa program/lex.yy.c program/program_parse.tab.c program/program_parse.tab.h
# Everything for new a Mesa release:
-ARCHIVES = $(LIB_NAME).tar.gz \
- $(LIB_NAME).tar.bz2 \
- $(LIB_NAME).zip \
- $(GLUT_NAME).tar.gz \
- $(GLUT_NAME).tar.bz2 \
- $(GLUT_NAME).zip
+ARCHIVES = $(PACKAGE_NAME).tar.gz \
+ $(PACKAGE_NAME).tar.bz2 \
+ $(PACKAGE_NAME).zip \
tarballs: md5
- rm -f ../$(LIB_NAME).tar
+ rm -f ../$(PACKAGE_DIR) $(PACKAGE_NAME).tar
# Helper for autoconf builds
ACLOCAL = aclocal
@@ -492,46 +240,33 @@ rm_depend:
touch $$dep ; \
done
-rm_config: parsers
- rm -f configs/current
- rm -f configs/autoconf
-
-$(LIB_NAME).tar: rm_config
- cd .. ; tar -cf $(DIRECTORY)/$(LIB_NAME).tar $(LIB_FILES)
-
-$(LIB_NAME).tar.gz: $(LIB_NAME).tar
- gzip --stdout --best $(LIB_NAME).tar > $(LIB_NAME).tar.gz
+manifest.txt: .git
+ ( \
+ ls -1 $(EXTRA_FILES) ; \
+ git ls-files $(IGNORE_FILES) \
+ ) | sed -e '/^\(.*\/\)\?\./d' -e "s@^@$(PACKAGE_DIR)/@" > $@
-$(GLUT_NAME).tar: rm_depend
- cd .. ; tar -cf $(DIRECTORY)/$(GLUT_NAME).tar $(GLUT_FILES)
+../$(PACKAGE_DIR):
+ ln -s $(PWD) $@
-$(GLUT_NAME).tar.gz: $(GLUT_NAME).tar
- gzip --stdout --best $(GLUT_NAME).tar > $(GLUT_NAME).tar.gz
+$(PACKAGE_NAME).tar: parsers ../$(PACKAGE_DIR) manifest.txt
+ cd .. ; tar -cf $(PACKAGE_DIR)/$(PACKAGE_NAME).tar -T $(PACKAGE_DIR)/manifest.txt
-$(LIB_NAME).tar.bz2: $(LIB_NAME).tar
- bzip2 --stdout --best $(LIB_NAME).tar > $(LIB_NAME).tar.bz2
+$(PACKAGE_NAME).tar.gz: $(PACKAGE_NAME).tar ../$(PACKAGE_DIR)
+ gzip --stdout --best $(PACKAGE_NAME).tar > $(PACKAGE_NAME).tar.gz
-$(GLUT_NAME).tar.bz2: $(GLUT_NAME).tar
- bzip2 --stdout --best $(GLUT_NAME).tar > $(GLUT_NAME).tar.bz2
+$(PACKAGE_NAME).tar.bz2: $(PACKAGE_NAME).tar
+ bzip2 --stdout --best $(PACKAGE_NAME).tar > $(PACKAGE_NAME).tar.bz2
-$(LIB_NAME).zip: rm_config
- rm -f $(LIB_NAME).zip ; \
+$(PACKAGE_NAME).zip: parsers ../$(PACKAGE_DIR) manifest.txt
+ rm -f $(PACKAGE_NAME).zip ; \
cd .. ; \
- zip -qr $(LIB_NAME).zip $(LIB_FILES) ; \
- mv $(LIB_NAME).zip $(DIRECTORY)
-
-$(GLUT_NAME).zip:
- rm -f $(GLUT_NAME).zip ; \
- cd .. ; \
- zip -qr $(GLUT_NAME).zip $(GLUT_FILES) ; \
- mv $(GLUT_NAME).zip $(DIRECTORY)
+ zip -q -@ $(PACKAGE_NAME).zip < $(PACKAGE_DIR)/manifest.txt ; \
+ mv $(PACKAGE_NAME).zip $(PACKAGE_DIR)
md5: $(ARCHIVES)
- @-md5sum $(LIB_NAME).tar.gz
- @-md5sum $(LIB_NAME).tar.bz2
- @-md5sum $(LIB_NAME).zip
- @-md5sum $(GLUT_NAME).tar.gz
- @-md5sum $(GLUT_NAME).tar.bz2
- @-md5sum $(GLUT_NAME).zip
-
-.PHONY: tarballs rm_depend rm_config md5
+ @-md5sum $(PACKAGE_NAME).tar.gz
+ @-md5sum $(PACKAGE_NAME).tar.bz2
+ @-md5sum $(PACKAGE_NAME).zip
+
+.PHONY: tarballs rm_depend md5
diff --git a/mesalib/configs/aix b/mesalib/configs/aix
index ebbf58374..5d346d51d 100644
--- a/mesalib/configs/aix
+++ b/mesalib/configs/aix
@@ -17,13 +17,11 @@ MKLIB_OPTIONS =
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS = -lX11 -lXext -lpthread -lm
GLU_LIB_DEPS = -L$(TOP)/lib -l$(GL_LIB) -lm -lC
-GLUT_LIB_DEPS = -L$(TOP)/lib -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu -lX11 -lm
GLW_LIB_DEPS = -L$(TOP)/lib -l$(GL_LIB) -lXm -lXt -lX11
OSMESA_LIB_DEPS = -L$(TOP)/lib -l$(GL_LIB)
APP_LIB_DEPS = -L$(TOP)/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lpthread -lm -lC
diff --git a/mesalib/configs/aix-64 b/mesalib/configs/aix-64
index 5d2edc587..a048c55a9 100644
--- a/mesalib/configs/aix-64
+++ b/mesalib/configs/aix-64
@@ -15,13 +15,11 @@ LIB_DIR = lib64
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS = -lX11 -lXext -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lC
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu -lX11 -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXm -lXt -lX11
APP_LIB_DEPS = -L$(TOP)/lib64 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lm -lpthread -lC
diff --git a/mesalib/configs/aix-64-static b/mesalib/configs/aix-64-static
index 6910e890d..ee4147f9e 100644
--- a/mesalib/configs/aix-64-static
+++ b/mesalib/configs/aix-64-static
@@ -16,7 +16,6 @@ LIB_DIR = lib64
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/aix-gcc b/mesalib/configs/aix-gcc
index 3b964f351..223e809b3 100644
--- a/mesalib/configs/aix-gcc
+++ b/mesalib/configs/aix-gcc
@@ -18,6 +18,5 @@ CXXFLAGS += -fno-strict-aliasing
MKLIB_OPTIONS = -arch aix-gcc
GL_LIB_DEPS = -lX11 -lXext -lm
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lXi -lXmu
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -Wl,-brtl -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lX11 -lXext -lXmu -lXi
diff --git a/mesalib/configs/aix-static b/mesalib/configs/aix-static
index 563184344..33508481c 100644
--- a/mesalib/configs/aix-static
+++ b/mesalib/configs/aix-static
@@ -15,7 +15,6 @@ MKLIB_OPTIONS = -static
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/autoconf.in b/mesalib/configs/autoconf.in
index 584f5fd77..37b7ea5bd 100644
--- a/mesalib/configs/autoconf.in
+++ b/mesalib/configs/autoconf.in
@@ -36,7 +36,6 @@ LLVM_CFLAGS = @LLVM_CFLAGS@
LLVM_LDFLAGS = @LLVM_LDFLAGS@
LLVM_LIBS = @LLVM_LIBS@
GLW_CFLAGS = @GLW_CFLAGS@
-GLUT_CFLAGS = @GLUT_CFLAGS@
GLX_TLS = @GLX_TLS@
DRI_CFLAGS = @DRI_CFLAGS@
DRI_CXXFLAGS = @DRI_CXXFLAGS@
@@ -67,7 +66,6 @@ BISON = @BISON@
# Library names (base name)
GL_LIB = GL
GLU_LIB = GLU
-GLUT_LIB = glut
GLW_LIB = GLw
OSMESA_LIB = @OSMESA_LIB@
GLESv1_CM_LIB = GLESv1_CM
@@ -80,7 +78,6 @@ GBM_LIB = gbm
# Library names (actual file names)
GL_LIB_NAME = @GL_LIB_NAME@
GLU_LIB_NAME = @GLU_LIB_NAME@
-GLUT_LIB_NAME = @GLUT_LIB_NAME@
GLW_LIB_NAME = @GLW_LIB_NAME@
OSMESA_LIB_NAME = @OSMESA_LIB_NAME@
EGL_LIB_NAME = @EGL_LIB_NAME@
@@ -94,7 +91,6 @@ GBM_LIB_NAME = @GBM_LIB_NAME@
# Globs used to install the lib and all symlinks
GL_LIB_GLOB = @GL_LIB_GLOB@
GLU_LIB_GLOB = @GLU_LIB_GLOB@
-GLUT_LIB_GLOB = @GLUT_LIB_GLOB@
GLW_LIB_GLOB = @GLW_LIB_GLOB@
OSMESA_LIB_GLOB = @OSMESA_LIB_GLOB@
EGL_LIB_GLOB = @EGL_LIB_GLOB@
@@ -142,8 +138,6 @@ OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @OSMESA_MESA_DEPS@ \
EGL_LIB_DEPS = $(EXTRA_LIB_PATH) @EGL_LIB_DEPS@
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLU_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @GLU_LIB_DEPS@
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \
- $(EXTRA_LIB_PATH) @GLUT_LIB_DEPS@
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \
$(EXTRA_LIB_PATH) @GLW_LIB_DEPS@
APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
@@ -201,9 +195,6 @@ GLU_PC_REQ = @GLU_PC_REQ@
GLU_PC_REQ_PRIV = @GLU_PC_REQ_PRIV@
GLU_PC_LIB_PRIV = @GLU_PC_LIB_PRIV@
GLU_PC_CFLAGS = @GLU_PC_CFLAGS@
-GLUT_PC_REQ_PRIV = @GLUT_PC_REQ_PRIV@
-GLUT_PC_LIB_PRIV = @GLUT_PC_LIB_PRIV@
-GLUT_PC_CFLAGS = @GLUT_PC_CFLAGS@
GLW_PC_REQ_PRIV = @GLW_PC_REQ_PRIV@
GLW_PC_LIB_PRIV = @GLW_PC_LIB_PRIV@
GLW_PC_CFLAGS = @GLW_PC_CFLAGS@
diff --git a/mesalib/configs/beos b/mesalib/configs/beos
index ac8d6fc6f..91ea6f768 100644
--- a/mesalib/configs/beos
+++ b/mesalib/configs/beos
@@ -90,7 +90,7 @@ else
endif
# Directories
-SRC_DIRS = gallium mesa glu glut/beos
+SRC_DIRS = gallium mesa glu
GLU_DIRS = sgi
DRIVER_DIRS = beos
@@ -98,6 +98,5 @@ DRIVER_DIRS = beos
GL_LIB_DEPS =
OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS =
-GLUT_LIB_DEPS = -lgame -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
APP_LIB_DEPS = -lbe -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -l$(GLUT_LIB)
diff --git a/mesalib/configs/darwin b/mesalib/configs/darwin
index 9527f61bd..41e7ba800 100644
--- a/mesalib/configs/darwin
+++ b/mesalib/configs/darwin
@@ -33,7 +33,6 @@ CXXFLAGS = -ggdb3 -Os -Wall -fno-strict-aliasing -fvisibility=hidden \
# Library names (actual file names)
GL_LIB_NAME = lib$(GL_LIB).dylib
GLU_LIB_NAME = lib$(GLU_LIB).dylib
-GLUT_LIB_NAME = lib$(GLUT_LIB).dylib
GLW_LIB_NAME = lib$(GLW_LIB).dylib
OSMESA_LIB_NAME = lib$(OSMESA_LIB).dylib
VG_LIB_NAME = lib$(VG_LIB).dylib
@@ -41,7 +40,6 @@ VG_LIB_NAME = lib$(VG_LIB).dylib
# globs used to install the lib and all symlinks
GL_LIB_GLOB = lib$(GL_LIB).*dylib
GLU_LIB_GLOB = lib$(GLU_LIB).*dylib
-GLUT_LIB_GLOB = lib$(GLUT_LIB).*dylib
GLW_LIB_GLOB = lib$(GLW_LIB).*dylib
OSMESA_LIB_GLOB = lib$(OSMESA_LIB).*dylib
VG_LIB_GLOB = lib$(VG_LIB).*dylib
@@ -49,12 +47,11 @@ VG_LIB_GLOB = lib$(VG_LIB).*dylib
GL_LIB_DEPS = -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXext -lm -lpthread
OSMESA_LIB_DEPS =
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXi -lXext
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXt
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L$(INSTALL_DIR)/$(LIB_DIR) -L$(X11_DIR)/$(LIB_DIR) -lX11 -lXmu -lXt -lXi -lm
# omit glw lib for now:
-SRC_DIRS = glsl mapi/glapi mapi/vgapi glx/apple mesa gallium glu glut/glx
+SRC_DIRS = glsl mapi/glapi mapi/vgapi glx/apple mesa gallium glu
GLU_DIRS = sgi
DRIVER_DIRS = osmesa
#DRIVER_DIRS = dri
diff --git a/mesalib/configs/default b/mesalib/configs/default
index 132ccbee3..e839a1e50 100644
--- a/mesalib/configs/default
+++ b/mesalib/configs/default
@@ -54,7 +54,6 @@ INDENT_FLAGS = -i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool
# Library names (base name)
GL_LIB = GL
GLU_LIB = GLU
-GLUT_LIB = glut
GLW_LIB = GLw
OSMESA_LIB = OSMesa
EGL_LIB = EGL
@@ -68,7 +67,6 @@ GBM_LIB = gbm
# Library names (actual file names)
GL_LIB_NAME = lib$(GL_LIB).so
GLU_LIB_NAME = lib$(GLU_LIB).so
-GLUT_LIB_NAME = lib$(GLUT_LIB).so
GLW_LIB_NAME = lib$(GLW_LIB).so
OSMESA_LIB_NAME = lib$(OSMESA_LIB).so
EGL_LIB_NAME = lib$(EGL_LIB).so
@@ -82,7 +80,6 @@ GBM_LIB_NAME = lib$(GBM_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)*
EGL_LIB_GLOB = $(EGL_LIB_NAME)*
@@ -108,7 +105,7 @@ MOTIF_CFLAGS = -I/usr/include/Motif1.2
# Directories to build
LIB_DIR = lib
SRC_DIRS = glsl mapi/glapi mapi/vgapi mesa \
- gallium egl gallium/winsys gallium/targets glu glut/glx glw
+ gallium egl gallium/winsys gallium/targets glu glw
GLU_DIRS = sgi
DRIVER_DIRS = x11 osmesa
@@ -137,7 +134,6 @@ GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread
EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -ldl -lpthread
OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
-GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm
GLW_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11
APP_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
@@ -147,7 +143,7 @@ GLAPI_LIB_DEPS = $(EXTRA_LIB_PATH) -lpthread
WAYLAND_EGL_LIB_DEPS = $(EXTRA_LIB_PATH) -lwayland-client -ldrm
GBM_LIB_DEPS = $(EXTRA_LIB_PATH) -ludev -ldl
-# Program dependencies - specific GL/glut libraries added in Makefiles
+# Program dependencies - specific GL libraries added in Makefiles
APP_LIB_DEPS = -lm
X11_LIBS = -lX11
@@ -180,9 +176,6 @@ GLU_PC_REQ = gl
GLU_PC_REQ_PRIV =
GLU_PC_LIB_PRIV =
GLU_PC_CFLAGS =
-GLUT_PC_REQ_PRIV =
-GLUT_PC_LIB_PRIV =
-GLUT_PC_CFLAGS =
GLW_PC_REQ_PRIV =
GLW_PC_LIB_PRIV =
GLW_PC_CFLAGS =
diff --git a/mesalib/configs/freebsd b/mesalib/configs/freebsd
index 976ddd19e..00d46be88 100644
--- a/mesalib/configs/freebsd
+++ b/mesalib/configs/freebsd
@@ -21,7 +21,6 @@ CFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES) -ff
CXXFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES)
-GLUT_CFLAGS = -fexceptions
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
diff --git a/mesalib/configs/freebsd-dri b/mesalib/configs/freebsd-dri
index 3330ff1aa..fdf4b293a 100644
--- a/mesalib/configs/freebsd-dri
+++ b/mesalib/configs/freebsd-dri
@@ -1,53 +1,52 @@
-# -*-makefile-*-
-# Configuration for freebsd-dri: FreeBSD DRI hardware drivers
-
-include $(TOP)/configs/freebsd
-
-CONFIG_NAME = freebsd-dri
-
-# Compiler and flags
-CC = gcc
-CXX = g++
-WARN_FLAGS = -Wall
-OPT_FLAGS = -O -g
-
-EXPAT_INCLUDES = -I/usr/local/include
-X11_INCLUDES = -I/usr/local/include
-DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
- -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
- -DHAVE_ALIAS
-
-CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) -Wmissing-prototypes -std=c99 -Wundef -ffast-math \
- $(ASM_FLAGS) $(X11_INCLUDES) $(DEFINES)
-
-CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) -Wall -ansi -pedantic $(ASM_FLAGS) $(X11_INCLUDES)
-
-# Work around aliasing bugs - developers should comment this out
-CFLAGS += -fno-strict-aliasing
-CXXFLAGS += -fno-strict-aliasing
-
-ASM_SOURCES =
-MESA_ASM_SOURCES =
-
-# Library/program dependencies
-MESA_MODULES = $(TOP)/src/mesa/libmesa.a
-
-LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
-LIBDRM_LIB = `pkg-config --libs libdrm`
-DRI_LIB_DEPS = $(MESA_MODULES) -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
-GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
- -lm -pthread $(LIBDRM_LIB)
-
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGLU -lGL -lX11 -lXmu -lXt -lXi -lm
-GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11
-
-
-# Directories
-SRC_DIRS = glx gallium mesa glu glut/glx glw
-DRIVER_DIRS = dri
-
-DRM_SOURCE_PATH=$(TOP)/../drm
-
-DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
- unichrome savage sis
-
+# -*-makefile-*-
+# Configuration for freebsd-dri: FreeBSD DRI hardware drivers
+
+include $(TOP)/configs/freebsd
+
+CONFIG_NAME = freebsd-dri
+
+# Compiler and flags
+CC = gcc
+CXX = g++
+WARN_FLAGS = -Wall
+OPT_FLAGS = -O -g
+
+EXPAT_INCLUDES = -I/usr/local/include
+X11_INCLUDES = -I/usr/local/include
+DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
+ -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
+ -DHAVE_ALIAS
+
+CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) -Wmissing-prototypes -std=c99 -Wundef -ffast-math \
+ $(ASM_FLAGS) $(X11_INCLUDES) $(DEFINES)
+
+CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) -Wall -ansi -pedantic $(ASM_FLAGS) $(X11_INCLUDES)
+
+# Work around aliasing bugs - developers should comment this out
+CFLAGS += -fno-strict-aliasing
+CXXFLAGS += -fno-strict-aliasing
+
+ASM_SOURCES =
+MESA_ASM_SOURCES =
+
+# Library/program dependencies
+MESA_MODULES = $(TOP)/src/mesa/libmesa.a
+
+LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
+LIBDRM_LIB = `pkg-config --libs libdrm`
+DRI_LIB_DEPS = $(MESA_MODULES) -L/usr/local/lib -lm -pthread -lexpat $(LIBDRM_LIB)
+GL_LIB_DEPS = -L/usr/local/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
+ -lm -pthread $(LIBDRM_LIB)
+
+GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/local/lib -lGL -lXt -lX11
+
+
+# Directories
+SRC_DIRS = glx gallium mesa glu glw
+DRIVER_DIRS = dri
+
+DRM_SOURCE_PATH=$(TOP)/../drm
+
+DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon tdfx \
+ unichrome savage sis
+
diff --git a/mesalib/configs/hpux10-gcc b/mesalib/configs/hpux10-gcc
index be396f854..40f243c23 100644
--- a/mesalib/configs/hpux10-gcc
+++ b/mesalib/configs/hpux10-gcc
@@ -10,7 +10,6 @@ CXX = g++
CFLAGS = -ansi -O3 -D_HPUX_SOURCE -I/usr/include/X11R6 -I/usr/contrib/X11R6/include -DUSE_XSHM
CXXFLAGS = -ansi -O3 -D_HPUX_SOURCE
-GLUT_CFLAGS = -fexceptions
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
diff --git a/mesalib/configs/hpux10-static b/mesalib/configs/hpux10-static
index 6101a4ece..18847d927 100644
--- a/mesalib/configs/hpux10-static
+++ b/mesalib/configs/hpux10-static
@@ -16,7 +16,6 @@ MKLIB_OPTIONS = -static
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
@@ -24,7 +23,6 @@ OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS =
OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
-GLUT_LIB_DEPS =
GLW_LIB_DEPS =
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lpthread -lm -lstdc++
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/lib/X11R6 -L/usr/contrib/X11R6/lib -lXext -lXmu -lXi -lX11 -lm -lstdc++
diff --git a/mesalib/configs/hpux11-32 b/mesalib/configs/hpux11-32
index 035ef796d..d783ae021 100644
--- a/mesalib/configs/hpux11-32
+++ b/mesalib/configs/hpux11-32
@@ -18,7 +18,6 @@ MKLIB_OPTIONS =
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
@@ -26,5 +25,4 @@ OSMESA_LIB_NAME = libOSMesa.a
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB)
GL_LIB_DEPS = -L/usr/lib/X11R6/ -L/usr/contrib/X11R6/lib/ -lXext -lXt -lXi -lX11 -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCsup -lcl
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(GL_LIB_DEPS)
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(GL_LIB_DEPS)
diff --git a/mesalib/configs/hpux11-32-static b/mesalib/configs/hpux11-32-static
index b8e843618..58a1c638f 100644
--- a/mesalib/configs/hpux11-32-static
+++ b/mesalib/configs/hpux11-32-static
@@ -18,7 +18,6 @@ MKLIB_OPTIONS = -static
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/hpux11-32-static-nothreads b/mesalib/configs/hpux11-32-static-nothreads
index cba166a08..fa3d4c2d7 100644
--- a/mesalib/configs/hpux11-32-static-nothreads
+++ b/mesalib/configs/hpux11-32-static-nothreads
@@ -18,7 +18,6 @@ MKLIB_OPTIONS = -static
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/hpux11-64 b/mesalib/configs/hpux11-64
index 3833c07c6..0f963e2e5 100644
--- a/mesalib/configs/hpux11-64
+++ b/mesalib/configs/hpux11-64
@@ -19,7 +19,6 @@ LIB_DIR = lib64
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
@@ -27,5 +26,4 @@ OSMESA_LIB_NAME = libOSMesa.a
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB)
GL_LIB_DEPS = -L/usr/lib/X11R6/pa20_64 -L/usr/contrib/X11R6/lib/pa20_64 -lXext -lXmu -lXt -lXi -lX11 -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCsup -lcl
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(GL_LIB_DEPS)
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(GL_LIB_DEPS)
diff --git a/mesalib/configs/hpux11-64-static b/mesalib/configs/hpux11-64-static
index 32944f928..4161d535f 100644
--- a/mesalib/configs/hpux11-64-static
+++ b/mesalib/configs/hpux11-64-static
@@ -19,7 +19,6 @@ LIB_DIR = lib64
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/hpux11-ia64 b/mesalib/configs/hpux11-ia64
index b94560baf..e27a22101 100644
--- a/mesalib/configs/hpux11-ia64
+++ b/mesalib/configs/hpux11-ia64
@@ -19,12 +19,10 @@ LIB_DIR = lib64
# Library names (actual file names)
GL_LIB_NAME = libGL.so
GLU_LIB_NAME = libGLU.so
-GLUT_LIB_NAME = libglut.so
GLW_LIB_NAME = libGLw.so
OSMESA_LIB_NAME = libOSMesa.so
# Library/program dependencies
GL_LIB_DEPS = -L/usr/lib/X11R6/ -L/usr/contrib/X11R6/lib/ -lXext -lXmu -lXt -lXi -lX11 -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCsup -lcl
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(GL_LIB_DEPS)
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(GL_LIB_DEPS)
diff --git a/mesalib/configs/hpux11-ia64-static b/mesalib/configs/hpux11-ia64-static
index e094c9f87..de24a1514 100644
--- a/mesalib/configs/hpux11-ia64-static
+++ b/mesalib/configs/hpux11-ia64-static
@@ -19,7 +19,6 @@ LIB_DIR = lib64
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/irix6-64-static b/mesalib/configs/irix6-64-static
index ea9dabcc0..e61f6247b 100644
--- a/mesalib/configs/irix6-64-static
+++ b/mesalib/configs/irix6-64-static
@@ -19,7 +19,6 @@ APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -64 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -l
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/irix6-n32-static b/mesalib/configs/irix6-n32-static
index fe47ccdcb..47b5e5067 100644
--- a/mesalib/configs/irix6-n32-static
+++ b/mesalib/configs/irix6-n32-static
@@ -15,11 +15,10 @@ GLW_SOURCES = GLwDrawA.c GLwMDrawA.c
LIB_DIR = lib32
-APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -n32 -glut -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lpthread -lm -lC
+APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -n32 -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lpthread -lm -lC
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/irix6-o32-static b/mesalib/configs/irix6-o32-static
index 2d265df98..58fbe4e8e 100644
--- a/mesalib/configs/irix6-o32-static
+++ b/mesalib/configs/irix6-o32-static
@@ -15,11 +15,10 @@ GLW_SOURCES = GLwDrawA.c GLwMDrawA.c
LIB_DIR = lib32
-APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -32 -glut -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lm -lC
+APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -32 -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lm -lC
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/linux b/mesalib/configs/linux
index c60f0d8ac..2560973fa 100644
--- a/mesalib/configs/linux
+++ b/mesalib/configs/linux
@@ -33,6 +33,5 @@ CXXFLAGS = -Wall -Wpointer-arith $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
CFLAGS += -fno-strict-aliasing
CXXFLAGS += -fno-strict-aliasing
-GLUT_CFLAGS = -fexceptions
EXTRA_LIB_PATH = -L/usr/X11R6/lib
diff --git a/mesalib/configs/linux-alpha b/mesalib/configs/linux-alpha
index 65bf0c2ab..803873979 100644
--- a/mesalib/configs/linux-alpha
+++ b/mesalib/configs/linux-alpha
@@ -9,14 +9,12 @@ CC = gcc
CXX = g++
CFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -fPIC -D_XOPEN_SOURCE -DUSE_XSHM
CXXFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -fPIC -D_XOPEN_SOURCE
-GLUT_CFLAGS = -fexceptions
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
CXXFLAGS += -fno-strict-aliasing
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
diff --git a/mesalib/configs/linux-alpha-static b/mesalib/configs/linux-alpha-static
index 53808d77c..33938e85b 100644
--- a/mesalib/configs/linux-alpha-static
+++ b/mesalib/configs/linux-alpha-static
@@ -9,7 +9,6 @@ CC = gcc
CXX = g++
CFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -D_XOPEN_SOURCE -DUSE_XSHM
CXXFLAGS = -O3 -mcpu=ev5 -ansi -mieee -pedantic -D_XOPEN_SOURCE
-GLUT_CFLAGS = -fexceptions
MKLIB_OPTIONS = -static
PIC_FLAGS =
@@ -20,12 +19,10 @@ CXXFLAGS += -fno-strict-aliasing
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/X11R6/lib -lXt -lX11
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -L/usr/X11R6/lib -lX11 -lm
diff --git a/mesalib/configs/linux-cell b/mesalib/configs/linux-cell
index 606a11a8c..e87e69a80 100644
--- a/mesalib/configs/linux-cell
+++ b/mesalib/configs/linux-cell
@@ -38,7 +38,7 @@ CXXFLAGS = $(COMMON_C_CPP_FLAGS)
# Omitting glw here:
SRC_DIRS = glsl mapi/glapi mapi/vgapi mesa \
- gallium gallium/winsys gallium/targets glu glut/glx
+ gallium gallium/winsys gallium/targets glu
# Build no traditional Mesa drivers:
DRIVER_DIRS =
diff --git a/mesalib/configs/linux-dri b/mesalib/configs/linux-dri
index 8ea40b94f..4c885d632 100644
--- a/mesalib/configs/linux-dri
+++ b/mesalib/configs/linux-dri
@@ -32,7 +32,6 @@ CFLAGS = -Wall -Wmissing-prototypes -std=c99 -ffast-math \
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
diff --git a/mesalib/configs/linux-dri-xcb b/mesalib/configs/linux-dri-xcb
index 292788990..021aa3e8b 100644
--- a/mesalib/configs/linux-dri-xcb
+++ b/mesalib/configs/linux-dri-xcb
@@ -1,56 +1,56 @@
-# -*-makefile-*-
-# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
-
-include $(TOP)/configs/default
-
-CONFIG_NAME = linux-dri-xcb
-
-# Compiler and flags
-CC = gcc
-CXX = g++
-
-#MKDEP = /usr/X11R6/bin/makedepend
-#MKDEP = gcc -M
-#MKDEP_OPTIONS = -MF depend
-
-OPT_FLAGS = -g
-PIC_FLAGS = -fPIC
-
-# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
-ARCH_FLAGS ?=
-
-DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
- -D_BSD_SOURCE -D_GNU_SOURCE \
- -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
- -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
- -DHAVE_ALIAS -DUSE_XCB -DHAVE_POSIX_MEMALIGN
-
-X11_INCLUDES = $(shell pkg-config --cflags-only-I x11) $(shell pkg-config --cflags-only-I xcb) $(shell pkg-config --cflags-only-I x11-xcb) $(shell pkg-config --cflags-only-I xcb-glx)
-
-CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
- $(DEFINES) $(ASM_FLAGS) -std=c99 -ffast-math
-
-CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
-
-# Work around aliasing bugs - developers should comment this out
-CFLAGS += -fno-strict-aliasing
-CXXFLAGS += -fno-strict-aliasing
-
-MESA_ASM_SOURCES =
-
-# Library/program dependencies
-EXTRA_LIB_PATH=$(shell pkg-config --libs-only-L x11)
-
-MESA_MODULES = $(TOP)/src/mesa/libmesa.a
-
-LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
-LIBDRM_LIB = $(shell pkg-config --libs libdrm)
-DRI_LIB_DEPS = $(MESA_MODULES) $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
-GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
- $(LIBDRM_LIB) $(shell pkg-config --libs xcb) $(shell pkg-config --libs x11-xcb) $(shell pkg-config --libs xcb-glx)
-
-SRC_DIRS = glx gallium mesa glu glut/glx glw
-
-DRIVER_DIRS = dri
-DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon \
- savage sis tdfx unichrome
+# -*-makefile-*-
+# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
+
+include $(TOP)/configs/default
+
+CONFIG_NAME = linux-dri-xcb
+
+# Compiler and flags
+CC = gcc
+CXX = g++
+
+#MKDEP = /usr/X11R6/bin/makedepend
+#MKDEP = gcc -M
+#MKDEP_OPTIONS = -MF depend
+
+OPT_FLAGS = -g
+PIC_FLAGS = -fPIC
+
+# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
+ARCH_FLAGS ?=
+
+DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
+ -D_BSD_SOURCE -D_GNU_SOURCE \
+ -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
+ -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
+ -DHAVE_ALIAS -DUSE_XCB -DHAVE_POSIX_MEMALIGN
+
+X11_INCLUDES = $(shell pkg-config --cflags-only-I x11) $(shell pkg-config --cflags-only-I xcb) $(shell pkg-config --cflags-only-I x11-xcb) $(shell pkg-config --cflags-only-I xcb-glx)
+
+CFLAGS = -Wall -Wmissing-prototypes $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) \
+ $(DEFINES) $(ASM_FLAGS) -std=c99 -ffast-math
+
+CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
+
+# Work around aliasing bugs - developers should comment this out
+CFLAGS += -fno-strict-aliasing
+CXXFLAGS += -fno-strict-aliasing
+
+MESA_ASM_SOURCES =
+
+# Library/program dependencies
+EXTRA_LIB_PATH=$(shell pkg-config --libs-only-L x11)
+
+MESA_MODULES = $(TOP)/src/mesa/libmesa.a
+
+LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm)
+LIBDRM_LIB = $(shell pkg-config --libs libdrm)
+DRI_LIB_DEPS = $(MESA_MODULES) $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB)
+GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \
+ $(LIBDRM_LIB) $(shell pkg-config --libs xcb) $(shell pkg-config --libs x11-xcb) $(shell pkg-config --libs xcb-glx)
+
+SRC_DIRS = glx gallium mesa glu glw
+
+DRIVER_DIRS = dri
+DRI_DIRS = i810 i915 mach64 mga r128 r200 r300 radeon \
+ savage sis tdfx unichrome
diff --git a/mesalib/configs/linux-fbdev b/mesalib/configs/linux-fbdev
index 4fc638404..45b482a91 100644
--- a/mesalib/configs/linux-fbdev
+++ b/mesalib/configs/linux-fbdev
@@ -9,10 +9,8 @@ CFLAGS += -DUSE_GLFBDEV_DRIVER
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
-SRC_DIRS += glut/fbdev
DRIVER_DIRS = fbdev osmesa
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread
OSMESA_LIB_DEPS = -lm -lpthread
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lgpm -lm
diff --git a/mesalib/configs/linux-ia64-icc b/mesalib/configs/linux-ia64-icc
index bd1189775..1594256c5 100644
--- a/mesalib/configs/linux-ia64-icc
+++ b/mesalib/configs/linux-ia64-icc
@@ -9,12 +9,10 @@ CC = icc
CXX = icpc
CFLAGS = -O3 -ansi -KPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include
CXXFLAGS = -O3 -ansi -KPIC -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include
-GLUT_CFLAGS = -fexceptions
MKLIB_OPTIONS = -arch icc-istatic
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(GL_LIB_DEPS)
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB)
diff --git a/mesalib/configs/linux-ia64-icc-static b/mesalib/configs/linux-ia64-icc-static
index ce8daf1d7..b5c33a525 100644
--- a/mesalib/configs/linux-ia64-icc-static
+++ b/mesalib/configs/linux-ia64-icc-static
@@ -9,19 +9,16 @@ CC = icc
CXX = icpc
CFLAGS = -O3 -ansi -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include
CXXFLAGS = -O3 -ansi -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include
-GLUT_CFLAGS = -fexceptions
MKLIB_OPTIONS = -static -arch icc-istatic
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS =
GLU_LIB_DEPS =
-GLUT_LIB_DEPS =
GLW_LIB_DEPS =
APP_LIB_DEPS = -i-static -cxxlib-icc -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lpthread -lm -lcxa -lunwind
diff --git a/mesalib/configs/linux-icc b/mesalib/configs/linux-icc
index d90a1dab3..2cfb2025f 100644
--- a/mesalib/configs/linux-icc
+++ b/mesalib/configs/linux-icc
@@ -9,11 +9,9 @@ CC = icc
CXX = g++
CFLAGS = -O3 -tpp6 -axK -KPIC -D_GCC_LIMITS_H_ -D__GNUC__ -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -I/usr/X11R6/include
CXXFLAGS = -O3
-GLUT_CFLAGS = -fexceptions
MKLIB_OPTIONS = -arch icc
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
MESA_ASM_SOURCES = $(X86_SOURCES)
diff --git a/mesalib/configs/linux-icc-static b/mesalib/configs/linux-icc-static
index 384db3bfe..d0311962a 100644
--- a/mesalib/configs/linux-icc-static
+++ b/mesalib/configs/linux-icc-static
@@ -9,18 +9,15 @@ CC = icc
CXX = icpc
CFLAGS = -O3 -tpp6 -axK -D_GCC_LIMITS_H_ -D__GNUC__ -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM -DPTHREADS -I/usr/X11R6/include
CXXFLAGS = -O3 -tpp6 -axK -DPTHREADS
-GLUT_CFLAGS = -fexceptions
MKLIB_OPTIONS = -static -arch icc
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS =
-GLUT_LIB_DEPS =
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm -lpthread -lcxa -lunwind
MESA_ASM_SOURCES = $(X86_SOURCES)
diff --git a/mesalib/configs/linux-indirect b/mesalib/configs/linux-indirect
index 8a31bcd87..82868c4a1 100644
--- a/mesalib/configs/linux-indirect
+++ b/mesalib/configs/linux-indirect
@@ -1,52 +1,52 @@
-# -*-makefile-*-
-# Configuration for linux-indirect: Builds a libGL capable of indirect
-# rendering, but *NOT* capable of direct rendering.
-
-include $(TOP)/configs/default
-
-CONFIG_NAME = linux-dri
-
-# Compiler and flags
-CC = gcc
-CXX = g++
-
-#MKDEP = /usr/X11R6/bin/makedepend
-#MKDEP = gcc -M
-#MKDEP_OPTIONS = -MF depend
-
-WARN_FLAGS = -Wall
-OPT_FLAGS = -O -g
-PIC_FLAGS = -fPIC
-
-# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
-ARCH_FLAGS ?=
-
-DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
- -D_BSD_SOURCE -D_GNU_SOURCE \
- -DGLX_INDIRECT_RENDERING \
- -DPTHREADS -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
-
-X11_INCLUDES = -I/usr/X11R6/include
-
-CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
- $(ASM_FLAGS) -std=c99 -ffast-math
-
-CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
-
-# Work around aliasing bugs - developers should comment this out
-CFLAGS += -fno-strict-aliasing
-CXXFLAGS += -fno-strict-aliasing
-
-MESA_ASM_SOURCES =
-
-# Library/program dependencies
-EXTRA_LIB_PATH=-L/usr/X11R6/lib
-
-MESA_MODULES = $(TOP)/src/mesa/libmesa.a
-DRI_LIB_DEPS = $(MESA_MODULES) $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl
-GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
-
-
-# Directories
-SRC_DIRS = glx glu glut/glx glw
-DRIVER_DIRS =
+# -*-makefile-*-
+# Configuration for linux-indirect: Builds a libGL capable of indirect
+# rendering, but *NOT* capable of direct rendering.
+
+include $(TOP)/configs/default
+
+CONFIG_NAME = linux-dri
+
+# Compiler and flags
+CC = gcc
+CXX = g++
+
+#MKDEP = /usr/X11R6/bin/makedepend
+#MKDEP = gcc -M
+#MKDEP_OPTIONS = -MF depend
+
+WARN_FLAGS = -Wall
+OPT_FLAGS = -O -g
+PIC_FLAGS = -fPIC
+
+# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
+ARCH_FLAGS ?=
+
+DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
+ -D_BSD_SOURCE -D_GNU_SOURCE \
+ -DGLX_INDIRECT_RENDERING \
+ -DPTHREADS -DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
+
+X11_INCLUDES = -I/usr/X11R6/include
+
+CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
+ $(ASM_FLAGS) -std=c99 -ffast-math
+
+CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
+
+# Work around aliasing bugs - developers should comment this out
+CFLAGS += -fno-strict-aliasing
+CXXFLAGS += -fno-strict-aliasing
+
+MESA_ASM_SOURCES =
+
+# Library/program dependencies
+EXTRA_LIB_PATH=-L/usr/X11R6/lib
+
+MESA_MODULES = $(TOP)/src/mesa/libmesa.a
+DRI_LIB_DEPS = $(MESA_MODULES) $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl
+GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
+
+
+# Directories
+SRC_DIRS = glx glu glw
+DRIVER_DIRS =
diff --git a/mesalib/configs/linux-osmesa-static b/mesalib/configs/linux-osmesa-static
index 722079463..d3af7a9d3 100644
--- a/mesalib/configs/linux-osmesa-static
+++ b/mesalib/configs/linux-osmesa-static
@@ -17,7 +17,6 @@ MKLIB_OPTIONS = -static
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
@@ -30,7 +29,6 @@ DRIVER_DIRS = osmesa
GL_LIB_DEPS =
OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
-GLUT_LIB_DEPS =
GLW_LIB_DEPS =
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) \
$(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm
diff --git a/mesalib/configs/linux-ppc-static b/mesalib/configs/linux-ppc-static
index 3f3dc5564..0a4ba43cc 100644
--- a/mesalib/configs/linux-ppc-static
+++ b/mesalib/configs/linux-ppc-static
@@ -10,6 +10,5 @@ PIC_FLAGS =
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/linux-static b/mesalib/configs/linux-static
index 907904bda..2b97daad8 100644
--- a/mesalib/configs/linux-static
+++ b/mesalib/configs/linux-static
@@ -10,7 +10,6 @@ PIC_FLAGS =
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
@@ -18,7 +17,6 @@ OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS =
OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
-GLUT_LIB_DEPS =
GLW_LIB_DEPS =
# Need to specify all libraries we may need
diff --git a/mesalib/configs/linux-x86-64-static b/mesalib/configs/linux-x86-64-static
index 626d579ac..89a0e3e03 100644
--- a/mesalib/configs/linux-x86-64-static
+++ b/mesalib/configs/linux-x86-64-static
@@ -10,7 +10,6 @@ PIC_FLAGS =
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
@@ -18,7 +17,6 @@ OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS =
OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
-GLUT_LIB_DEPS =
GLW_LIB_DEPS =
# Need to specify all libraries we may need
diff --git a/mesalib/configs/linux-x86-static b/mesalib/configs/linux-x86-static
index 16c8731c1..dba6299e4 100644
--- a/mesalib/configs/linux-x86-static
+++ b/mesalib/configs/linux-x86-static
@@ -10,7 +10,6 @@ PIC_FLAGS =
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
@@ -18,7 +17,6 @@ OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS =
OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
-GLUT_LIB_DEPS =
GLW_LIB_DEPS =
# Need to specify all libraries we may need
diff --git a/mesalib/configs/netbsd b/mesalib/configs/netbsd
index aec456950..c65e90199 100644
--- a/mesalib/configs/netbsd
+++ b/mesalib/configs/netbsd
@@ -9,7 +9,6 @@ CC = gcc
CXX = g++
CFLAGS = -O2 -fPIC -DUSE_XSHM -I/usr/X11R6/include -DHZ=100
CXXFLAGS = -O2 -fPIC
-GLUT_CFLAGS = -fexceptions
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -lXext -lXmu -lXi -lX11 -lm
# Work around aliasing bugs - developers should comment this out
diff --git a/mesalib/configs/openbsd b/mesalib/configs/openbsd
index bd19fa84d..982675fa2 100644
--- a/mesalib/configs/openbsd
+++ b/mesalib/configs/openbsd
@@ -17,6 +17,5 @@ CXXFLAGS += -fno-strict-aliasing
GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm
OSMESA_LIB_DEPS = -lm
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lm
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/X11R6/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
diff --git a/mesalib/configs/osf1 b/mesalib/configs/osf1
index 88a2ecc73..5a2e1f2ec 100644
--- a/mesalib/configs/osf1
+++ b/mesalib/configs/osf1
@@ -12,5 +12,4 @@ CXXFLAGS = -O2 -std ansi -ieee -DPTHREADS -D_REENTRANT
GL_LIB_DEPS = -lX11 -lXext -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXt -lXi -lm
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXext -lXmu -lXi -lpthread -lm
diff --git a/mesalib/configs/osf1-static b/mesalib/configs/osf1-static
index e00f7ce01..f20005da1 100644
--- a/mesalib/configs/osf1-static
+++ b/mesalib/configs/osf1-static
@@ -13,5 +13,4 @@ MKLIB_OPTIONS = -static
GL_LIB_DEPS =
GLU_LIB_DEPS =
-GLUT_LIB_DEPS =
APP_LIB_DEPS = -noso -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -so_archive -lX11 -lXext -lXmu -lXi -lpthread -lm -lcxx
diff --git a/mesalib/configs/solaris-x86 b/mesalib/configs/solaris-x86
index a5a7a63fa..3c64d35a1 100644
--- a/mesalib/configs/solaris-x86
+++ b/mesalib/configs/solaris-x86
@@ -9,10 +9,9 @@ CC = cc
CFLAGS = -Xa -xO3 -xpentium -KPIC -I/usr/openwin/include -DUSE_XSHM
MKLIB_OPTIONS = -static
-APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm -lglut -lGLU -lGL
+APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/openwin/lib -R/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm -lGLU -lGL
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/solaris-x86-gcc b/mesalib/configs/solaris-x86-gcc
index 616bfdfd7..065ce369f 100644
--- a/mesalib/configs/solaris-x86-gcc
+++ b/mesalib/configs/solaris-x86-gcc
@@ -9,7 +9,6 @@ CC = gcc
CXX = g++
CFLAGS = -O3 -march=i486 -fPIC -I/usr/openwin/include -DUSE_XSHM
CXXFLAGS = -O3 -march=i486 -fPIC
-GLUT_CFLAGS = -fexceptions
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
@@ -17,5 +16,4 @@ CXXFLAGS += -fno-strict-aliasing
GL_LIB_DEPS = -L/usr/openwin/lib -lX11 -lXext -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lX11 -lXmu -lXt -lXi -lm
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/openwin/lib -R/usr/openwin/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lX11 -lXext -lXi -lXmu
diff --git a/mesalib/configs/solaris-x86-gcc-static b/mesalib/configs/solaris-x86-gcc-static
index 4850284a5..dd12084b7 100644
--- a/mesalib/configs/solaris-x86-gcc-static
+++ b/mesalib/configs/solaris-x86-gcc-static
@@ -9,7 +9,6 @@ CC = gcc
CXX = g++
CFLAGS = -O3 -march=i486 -fPIC -I/usr/openwin/include -DUSE_XSHM
CXXFLAGS = -O3 -march=i486 -fPIC
-GLUT_CFLAGS = -fexceptions
MKLIB_OPTIONS = -static
# Work around aliasing bugs - developers should comment this out
@@ -18,11 +17,9 @@ CXXFLAGS += -fno-strict-aliasing
GL_LIB_DEPS = -L/usr/openwin/lib -lX11 -lXext -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lX11 -lXmu -lXt -lXi -lm
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/openwin/lib -R/usr/openwin/lib -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lX11 -lXext -lXi -lXmu
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configs/sunos4-gcc b/mesalib/configs/sunos4-gcc
index 094229158..85439c93b 100644
--- a/mesalib/configs/sunos4-gcc
+++ b/mesalib/configs/sunos4-gcc
@@ -9,7 +9,6 @@ CC = gcc
CXX = g++
CFLAGS = -fPIC -O3 -I/usr/openwin/include -I/usr/include/X11R5 -I/usr/include/X11R5 -DUSE_XSHM -DSUNOS4
CXXFLAGS = -fPIC -O3 -I/usr/openwin/include -DSUNOS4
-GLUT_CFLAGS = -fexceptions -DSOLARIS_2_4_BUG
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
diff --git a/mesalib/configs/sunos4-static b/mesalib/configs/sunos4-static
index 9135fa7df..b05184d46 100644
--- a/mesalib/configs/sunos4-static
+++ b/mesalib/configs/sunos4-static
@@ -12,7 +12,6 @@ MKLIB_OPTIONS = -static
# Library names (actual file names)
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
@@ -20,6 +19,5 @@ OSMESA_LIB_NAME = libOSMesa.a
GL_LIB_DEPS =
OSMESA_LIB_DEPS =
GLU_LIB_DEPS =
-GLUT_LIB_DEPS =
GLW_LIB_DEPS =
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXext -lXmu -lXt -lXi -lpthread -lm
diff --git a/mesalib/configs/sunos5 b/mesalib/configs/sunos5
index 6dd7539c6..b3d3fc6ed 100644
--- a/mesalib/configs/sunos5
+++ b/mesalib/configs/sunos5
@@ -9,10 +9,8 @@ CC = cc
CXX = c++
CFLAGS = -KPIC -Xa -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM
CXXFLAGS = -KPIC -Xa -O -I/usr/openwin/include -I/usr/dt/include
-GLUT_CFLAGS = -DSOLARIS_2_4_BUG
GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lCrun -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
diff --git a/mesalib/configs/sunos5-gcc b/mesalib/configs/sunos5-gcc
index 571ff24a2..e4d340363 100644
--- a/mesalib/configs/sunos5-gcc
+++ b/mesalib/configs/sunos5-gcc
@@ -26,7 +26,6 @@ CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
-I/usr/openwin/include
-GLUT_CFLAGS = -fexceptions -DSOLARIS_2_4_BUG
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
@@ -36,5 +35,4 @@ CXXFLAGS += -fno-strict-aliasing
EXTRA_LIB_PATH=-L/usr/openwin/lib
GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXi -lm
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
diff --git a/mesalib/configs/sunos5-smp b/mesalib/configs/sunos5-smp
index 274080590..93132b643 100644
--- a/mesalib/configs/sunos5-smp
+++ b/mesalib/configs/sunos5-smp
@@ -9,11 +9,9 @@ CC = cc
CXX = c++
CFLAGS = -KPIC -Xa -native -fast -xO5 -xlibmil -xsafe=mem -xdepend -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DSOLARIS_2_4_BUG
CXXFLAGS = -KPIC -Xa -native -fast -xO5 -xlibmil -xsafe=mem -xdepend -I/usr/openwin/include -I/usr/dt/include
-GLUT_CFLAGS = -DSOLARIS_2_4_BUG
GL_LIB_DEPS = -L/usr/openwin/lib -lX11 -lXext -lXmu -lXi -lm
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm -lCrun
diff --git a/mesalib/configs/sunos5-v8 b/mesalib/configs/sunos5-v8
index cdaf3eee7..19ff67b15 100644
--- a/mesalib/configs/sunos5-v8
+++ b/mesalib/configs/sunos5-v8
@@ -9,10 +9,8 @@ CC = cc
CXX = CC
CFLAGS = -xarch=v8 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS
CXXFLAGS = -xarch=v8 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS
-GLUT_CFLAGS = -DSOLARIS_2_4_BUG
GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCstd -lCrun
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
diff --git a/mesalib/configs/sunos5-v8-static b/mesalib/configs/sunos5-v8-static
index 5e428b1a5..edb3227c5 100644
--- a/mesalib/configs/sunos5-v8-static
+++ b/mesalib/configs/sunos5-v8-static
@@ -11,6 +11,5 @@ CC = cc
CXX = CC
CFLAGS = -xarch=v8 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS
CXXFLAGS = -xarch=v8 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS
-GLUT_CFLAGS = -DSOLARIS_2_4_BUG
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11 -lXext -lXmu -lXi -lpthread -lm -lCstd -lCrun
diff --git a/mesalib/configs/sunos5-v9 b/mesalib/configs/sunos5-v9
index ea2ab23e2..28b402ee1 100644
--- a/mesalib/configs/sunos5-v9
+++ b/mesalib/configs/sunos5-v9
@@ -13,11 +13,9 @@ CC = cc
CXX = CC
CFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS
CXXFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS
-GLUT_CFLAGS = -DSOLARIS_2_4_BUG
GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCstd -lCrun
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
diff --git a/mesalib/configs/sunos5-v9-cc-g++ b/mesalib/configs/sunos5-v9-cc-g++
index 8656251e3..a303f891d 100644
--- a/mesalib/configs/sunos5-v9-cc-g++
+++ b/mesalib/configs/sunos5-v9-cc-g++
@@ -26,10 +26,8 @@ CXXFLAGS += -fno-strict-aliasing
CFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS
#CXXFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS
-GLUT_CFLAGS = -DSOLARIS_2_4_BUG
GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCstd -lCrun
-GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
diff --git a/mesalib/configs/sunos5-v9-static b/mesalib/configs/sunos5-v9-static
index 4919570c7..ccf5eb3ce 100644
--- a/mesalib/configs/sunos5-v9-static
+++ b/mesalib/configs/sunos5-v9-static
@@ -13,6 +13,5 @@ CC = cc
CXX = CC
CFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS
CXXFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS
-GLUT_CFLAGS = -DSOLARIS_2_4_BUG
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11 -lXext -lXmu -lXi -lpthread -lm -lCstd -lCrun
diff --git a/mesalib/configs/ultrix-gcc b/mesalib/configs/ultrix-gcc
index 455b6932d..4414e7acd 100644
--- a/mesalib/configs/ultrix-gcc
+++ b/mesalib/configs/ultrix-gcc
@@ -9,7 +9,6 @@ CC = gcc
CXX = g++
CFLAGS = -pedantic -O2
CXXFLAGS = -pedantic -O2
-GLUT_CFLAGS = -fexceptions
MKLIB_OPTIONS = -static
# Work around aliasing bugs - developers should comment this out
@@ -18,7 +17,6 @@ CXXFLAGS += -fno-strict-aliasing
GL_LIB_NAME = libGL.a
GLU_LIB_NAME = libGLU.a
-GLUT_LIB_NAME = libglut.a
GLW_LIB_NAME = libGLw.a
OSMESA_LIB_NAME = libOSMesa.a
diff --git a/mesalib/configure.ac b/mesalib/configure.ac
index c3047d622..5c76c2865 100644
--- a/mesalib/configure.ac
+++ b/mesalib/configure.ac
@@ -17,6 +17,10 @@ AC_INIT([Mesa],[mesa_version],
AC_CONFIG_AUX_DIR([bin])
AC_CANONICAL_HOST
+dnl Save user CFLAGS and CXXFLAGS so one can override the default ones
+USER_CFLAGS="$CFLAGS"
+USER_CXXFLAGS="$CXXFLAGS"
+
dnl Versions for external dependencies
LIBDRM_REQUIRED=2.4.24
LIBDRM_RADEON_REQUIRED=2.4.24
@@ -85,7 +89,7 @@ if test "x$GCC" = xyes -a "x$CLANG" = xno; then
GCC_VERSION=`$CC -dumpversion`
if test $? -eq 0; then
major=`echo $GCC_VERSION | cut -d. -f1`
- minor=`echo $GCC_VERSION | cut -d. -f1`
+ minor=`echo $GCC_VERSION | cut -d. -f2`
fi
if test $major -lt 3 -o $major -eq 3 -a $minor -lt 3 ; then
@@ -807,6 +811,7 @@ xyesyes)
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS libgl-xlib"
GALLIUM_STATE_TRACKERS_DIRS="glx $GALLIUM_STATE_TRACKERS_DIRS"
+ HAVE_WINSYS_XLIB="yes"
;;
xyesno)
# DRI-based GLX
@@ -1511,42 +1516,39 @@ if test "x$enable_gallium_g3dvl" = xyes; then
fi
if test "x$enable_xvmc" = xauto; then
- enable_xvmc=yes
+ PKG_CHECK_EXISTS([xvmc], [enable_xvmc=yes], [enable_xvmc=no])
fi
if test "x$enable_vdpau" = xauto; then
- enable_vdpau=yes
+ PKG_CHECK_EXISTS([vdpau], [enable_vdpau=yes], [enable_vdpau=no])
fi
if test "x$enable_va" = xauto; then
+ #don't enable vaapi state tracker even if package exists
+ #PKG_CHECK_EXISTS([libva], [enable_vdpau=yes], [enable_vdpau=no])
enable_va=no
fi
fi
-#TODO: Check for xvmc libs/headers
if test "x$enable_xvmc" = xyes; then
+ PKG_CHECK_MODULES([XVMC], [xvmc >= 1.0.6 xorg-server])
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS xorg/xvmc"
HAVE_ST_XVMC="yes"
fi
-#TODO: Check for vdpau libs/headers
if test "x$enable_vdpau" = xyes; then
+ PKG_CHECK_MODULES([VDPAU], [vdpau >= 0.4.1])
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS vdpau"
HAVE_ST_VDPAU="yes"
fi
-#TODO: Check for va libs/headers
if test "x$enable_va" = xyes; then
+ PKG_CHECK_MODULES([LIBVA], [libva = 0.31.1])
+ AC_MSG_WARN([vaapi state tracker currently unmaintained])
GALLIUM_STATE_TRACKERS_DIRS="$GALLIUM_STATE_TRACKERS_DIRS va"
HAVE_ST_VA="yes"
fi
-if test "x$enable_xvmc" = xyes ||
- test "x$enable_vdpau" = xyes ||
- test "x$enable_va" = xyes; then
- GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS g3dvl/dri"
-fi
-
dnl
dnl GLU configuration
dnl
@@ -1672,65 +1674,6 @@ AC_SUBST([GLW_PC_LIB_PRIV])
AC_SUBST([GLW_PC_CFLAGS])
dnl
-dnl GLUT configuration
-dnl
-if test -f "$srcdir/include/GL/glut.h"; then
- default_glut=yes
-else
- default_glut=no
-fi
-AC_ARG_ENABLE([glut],
- [AS_HELP_STRING([--disable-glut],
- [enable GLUT library @<:@default=enabled if source available@:>@])],
- [enable_glut="$enableval"],
- [enable_glut="$default_glut"])
-
-dnl Don't build glut without GLX
-if test "x$enable_glut" = xyes -a "x$enable_glx" = xno; then
- AC_MSG_NOTICE([Disabling glut since there is no OpenGL driver])
- enable_glut=no
-fi
-dnl Can't build glut if GLU not available
-if test "x$enable_glu$enable_glut" = xnoyes; then
- AC_MSG_WARN([Disabling glut since GLU is disabled])
- enable_glut=no
-fi
-
-if test "x$enable_glut" = xyes; then
- SRC_DIRS="$SRC_DIRS glut/glx"
- if test "$x11_pkgconfig" = yes; then
- PKG_CHECK_MODULES([GLUT],[x11 xmu xi])
- GLUT_PC_REQ_PRIV="x11 xmu xi"
- GLUT_LIB_DEPS="$GLUT_LIBS"
- else
- # should check these...
- GLUT_LIB_DEPS="$X_LIBS -lX11 -lXmu -lXi"
- GLUT_PC_LIB_PRIV="$GLUT_LIB_DEPS"
- GLUT_PC_CFLAGS="$X11_INCLUDES"
- fi
- if test "x$GCC" = xyes; then
- GLUT_CFLAGS="$GLUT_CFLAGS -fexceptions"
- fi
- GLUT_LIB_DEPS="$GLUT_LIB_DEPS -lm"
- GLUT_PC_LIB_PRIV="$GLUT_PC_LIB_PRIV -lm"
-
- # If static, empty GLUT_LIB_DEPS and add libs for programs to link
- if test "$enable_static" = no; then
- GLUT_MESA_DEPS='-l$(GLU_LIB) -l$(GL_LIB)'
- else
- APP_LIB_DEPS="$APP_LIB_DEPS $GLUT_LIB_DEPS"
- GLUT_LIB_DEPS=""
- GLUT_MESA_DEPS=""
- fi
-fi
-AC_SUBST([GLUT_LIB_DEPS])
-AC_SUBST([GLUT_MESA_DEPS])
-AC_SUBST([GLUT_CFLAGS])
-AC_SUBST([GLUT_PC_REQ_PRIV])
-AC_SUBST([GLUT_PC_LIB_PRIV])
-AC_SUBST([GLUT_PC_CFLAGS])
-
-dnl
dnl Program library dependencies
dnl Only libm is added here if necessary as the libraries should
dnl be pulled in by the linker
@@ -1932,12 +1875,15 @@ gallium_check_st() {
fi
if test "x$HAVE_ST_XVMC" = xyes && test "x$5" != x; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
+ NEED_G3DVL_DRI="yes"
fi
if test "x$HAVE_ST_VDPAU" = xyes && test "x$6" != x; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $6"
+ NEED_G3DVL_DRI="yes"
fi
if test "x$HAVE_ST_VA" = xyes && test "x$7" != x; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $7"
+ NEED_G3DVL_DRI="yes"
fi
}
@@ -2004,6 +1950,16 @@ if test "x$with_gallium_drivers" != x; then
if test "x$HAVE_ST_VA" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS va-softpipe"
fi
+ if test "x$HAVE_ST_VDPAU" == xyes ||
+ test "x$HAVE_ST_XVMC" == xyes ||
+ test "x$HAVE_ST_VA" == xyes; then
+ if test "x$HAVE_WINSYS_XLIB" != xyes; then
+ GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS sw/xlib"
+ fi
+ if test "x$HAVE_ST_DRI" != xyes; then
+ GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS softpipe"
+ fi
+ fi
;;
*)
AC_MSG_ERROR([Unknown Gallium driver: $driver])
@@ -2012,6 +1968,10 @@ if test "x$with_gallium_drivers" != x; then
done
fi
+if test "x$NEED_G3DVL_DRI" = xyes; then
+ GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS g3dvl/dri"
+fi
+
dnl prepend CORE_DIRS to SRC_DIRS
SRC_DIRS="$CORE_DIRS $SRC_DIRS"
@@ -2019,6 +1979,10 @@ dnl Restore LDFLAGS and CPPFLAGS
LDFLAGS="$_SAVE_LDFLAGS"
CPPFLAGS="$_SAVE_CPPFLAGS"
+dnl Add user CFLAGS and CXXFLAGS
+CFLAGS="$CFLAGS $USER_CFLAGS"
+CXXFLAGS="$CXXFLAGS $USER_CXXFLAGS"
+
dnl Substitute the config
AC_CONFIG_FILES([configs/autoconf])
@@ -2088,7 +2052,6 @@ esac
echo ""
echo " GLU: $enable_glu"
echo " GLw: $enable_glw (Motif: $enable_motif)"
-echo " glut: $enable_glut"
dnl EGL
echo ""
diff --git a/mesalib/docs/autoconf.html b/mesalib/docs/autoconf.html
index 936ddcffe..64bcbd48a 100644
--- a/mesalib/docs/autoconf.html
+++ b/mesalib/docs/autoconf.html
@@ -21,7 +21,6 @@
<ul>
<li><a href="#glu">GLU</a></li>
<li><a href="#glw">GLw</a></li>
- <li><a href="#glut">GLUT</a></li>
</ul>
<li><a href="#demos">Demo Program Options</a></li>
</ol>
@@ -252,13 +251,6 @@ on all drivers. This can be disable with the option
if libGLU has been enabled. This can be disable with the option
<code>--disable-glw</code>.
</li>
-
-<a name="glut">
-<li><b><em>GLUT</em></b> - The libglut library will be built by default
-if libGLU has been enabled and the glut source code from the MesaGLUT
-tarball is available. This can be disable with the option
-<code>--disable-glut</code>.
-</li>
</ul>
</p>
diff --git a/mesalib/docs/devinfo.html b/mesalib/docs/devinfo.html
index b2cbf17b4..8887dd026 100644
--- a/mesalib/docs/devinfo.html
+++ b/mesalib/docs/devinfo.html
@@ -1,221 +1,215 @@
-<HTML>
-
-<TITLE>Development Notes</TITLE>
-
-<link rel="stylesheet" type="text/css" href="mesa.css"></head>
-
-<BODY>
-
-<H1>Development Notes</H1>
-
-
-<H2>Adding Extentions</H2>
-
-<p>
-To add a new GL extension to Mesa you have to do at least the following.
-
-<ul>
-<li>
- If glext.h doesn't define the extension, edit include/GL/gl.h and add
- code like this:
- <pre>
- #ifndef GL_EXT_the_extension_name
- #define GL_EXT_the_extension_name 1
- /* declare the new enum tokens */
- /* prototype the new functions */
- /* TYPEDEFS for the new functions */
- #endif
- </pre>
-</li>
-<li>
- In the src/mesa/glapi/ directory, add the new extension functions and
- enums to the gl_API.xml file.
- Then, a bunch of source files must be regenerated by executing the
- corresponding Python scripts.
-</li>
-<li>
- Add a new entry to the <code>gl_extensions</code> struct in mtypes.h
-</li>
-<li>
- Update the <code>extensions.c</code> file.
-</li>
-<li>
- From this point, the best way to proceed is to find another extension,
- similar to the new one, that's already implemented in Mesa and use it
- as an example.
-</li>
-<li>
- If the new extension adds new GL state, the functions in get.c, enable.c
- and attrib.c will most likely require new code.
-</li>
-</ul>
-
-
-
-<H2>Coding Style</H2>
-
-<p>
-Mesa's code style has changed over the years. Here's the latest.
-</p>
-
-<p>
-Comment your code! It's extremely important that open-source code be
-well documented. Also, strive to write clean, easily understandable code.
-</p>
-
-<p>
-3-space indentation
-</p>
-
-<p>
-If you use tabs, set them to 8 columns
-</p>
-
-<p>
-Brace example:
-</p>
-<pre>
- if (condition) {
- foo;
- }
- else {
- bar;
- }
-</pre>
-
-<p>
-Here's the GNU indent command which will best approximate my preferred style:
-</p>
-<pre>
- indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
-</pre>
-
-
-<p>
-Local variable name example: localVarName (no underscores)
-</p>
-
-<p>
-Constants and macros are ALL_UPPERCASE, with _ between words
-</p>
-
-<p>
-Global variables are not allowed.
-</p>
-
-<p>
-Function name examples:
-</p>
-<pre>
- glFooBar() - a public GL entry point (in glapi_dispatch.c)
- _mesa_FooBar() - the internal immediate mode function
- save_FooBar() - retained mode (display list) function in dlist.c
- foo_bar() - a static (private) function
- _mesa_foo_bar() - an internal non-static Mesa function
-</pre>
-
-
-<H2>Making a New Mesa Release</H2>
-
-<p>
-These are the instructions for making a new Mesa release.
-</p>
-
-<H3>Get latest source files</H3>
-<p>
-Use git to get the latest Mesa files from the git repository, from whatever
-branch is relevant.
-</p>
-
-
-<H3>Verify and update version info</H3>
-<p>
-Create/edit the docs/relnotes-x.y.html file to document what's new in the release.
-Add the new relnotes-x.y.html file to <a href="relnotes.html">relnotes.html</a>.
-</p>
-
-<p>
-Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
-configs/default.
-Also update the VERSION line in the top-level Makefile.
-</p>
-
-<p>
-Make sure the values in src/mesa/main/version.h are correct.
-</p>
-
-<p>
-Update docs/news.html.
-</p>
-
-<p>
-Check in all updates to git.
-</p>
-
-<p>
-Tag the files with the release name (in the form <b>mesa_X_Y</b>)
-with: <code>git tag -a mesa_X_Y</code>
-Then: <code>git push origin mesa_X_Y</code>
-</p>
-
-
-<H3>Make the tarballs</H3>
-<p>
-Make a symbolic link from $(DIRECTORY) to 'Mesa'. For example,
-<code>ln -s Mesa Mesa-7.5</code>
-This is needed in order to make a correct tar file in the next step.
-</p>
-
-<p>
-Make the distribution files. From inside the Mesa directory:
-<pre>
- make tarballs
-</pre>
-
-<p>
-After the tarballs are created, the md5 checksums for the files will
-be computed.
-Add them to the docs/relnotes-X.Y.html file.
-</p>
-
-<p>
-Copy the distribution files to a temporary directory, unpack them,
-compile everything, and run some demos to be sure everything works.
-</p>
-
-<H3>Update the website and announce the release</H3>
-<p>
-Follow the directions on SourceForge for creating a new "release" and
-uploading the tarballs.
-</p>
-
-<p>
-Basically, to upload the tarball files with:
-<br>
-<code>
-rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/
-</code>
-</p>
-
-<p>
-Update the web site by copying the docs/ directory's files to
-/home/users/b/br/brianp/mesa-www/htdocs/ with:
-<br>
-<code>
-sftp USERNAME,mesa3d@web.sourceforge.net
-</code>
-</p>
-
-<p>
-Make an announcement on the mailing lists:
-
-<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>,
-<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
-and
-<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
-</p>
-
-
-
-</body>
-</html>
+<HTML>
+
+<TITLE>Development Notes</TITLE>
+
+<link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<BODY>
+
+<H1>Development Notes</H1>
+
+
+<H2>Adding Extentions</H2>
+
+<p>
+To add a new GL extension to Mesa you have to do at least the following.
+
+<ul>
+<li>
+ If glext.h doesn't define the extension, edit include/GL/gl.h and add
+ code like this:
+ <pre>
+ #ifndef GL_EXT_the_extension_name
+ #define GL_EXT_the_extension_name 1
+ /* declare the new enum tokens */
+ /* prototype the new functions */
+ /* TYPEDEFS for the new functions */
+ #endif
+ </pre>
+</li>
+<li>
+ In the src/mesa/glapi/ directory, add the new extension functions and
+ enums to the gl_API.xml file.
+ Then, a bunch of source files must be regenerated by executing the
+ corresponding Python scripts.
+</li>
+<li>
+ Add a new entry to the <code>gl_extensions</code> struct in mtypes.h
+</li>
+<li>
+ Update the <code>extensions.c</code> file.
+</li>
+<li>
+ From this point, the best way to proceed is to find another extension,
+ similar to the new one, that's already implemented in Mesa and use it
+ as an example.
+</li>
+<li>
+ If the new extension adds new GL state, the functions in get.c, enable.c
+ and attrib.c will most likely require new code.
+</li>
+</ul>
+
+
+
+<H2>Coding Style</H2>
+
+<p>
+Mesa's code style has changed over the years. Here's the latest.
+</p>
+
+<p>
+Comment your code! It's extremely important that open-source code be
+well documented. Also, strive to write clean, easily understandable code.
+</p>
+
+<p>
+3-space indentation
+</p>
+
+<p>
+If you use tabs, set them to 8 columns
+</p>
+
+<p>
+Brace example:
+</p>
+<pre>
+ if (condition) {
+ foo;
+ }
+ else {
+ bar;
+ }
+</pre>
+
+<p>
+Here's the GNU indent command which will best approximate my preferred style:
+</p>
+<pre>
+ indent -br -i3 -npcs --no-tabs infile.c -o outfile.c
+</pre>
+
+
+<p>
+Local variable name example: localVarName (no underscores)
+</p>
+
+<p>
+Constants and macros are ALL_UPPERCASE, with _ between words
+</p>
+
+<p>
+Global variables are not allowed.
+</p>
+
+<p>
+Function name examples:
+</p>
+<pre>
+ glFooBar() - a public GL entry point (in glapi_dispatch.c)
+ _mesa_FooBar() - the internal immediate mode function
+ save_FooBar() - retained mode (display list) function in dlist.c
+ foo_bar() - a static (private) function
+ _mesa_foo_bar() - an internal non-static Mesa function
+</pre>
+
+
+<H2>Making a New Mesa Release</H2>
+
+<p>
+These are the instructions for making a new Mesa release.
+</p>
+
+<H3>Get latest source files</H3>
+<p>
+Use git to get the latest Mesa files from the git repository, from whatever
+branch is relevant.
+</p>
+
+
+<H3>Verify and update version info</H3>
+<p>
+Create/edit the docs/relnotes-x.y.html file to document what's new in the release.
+Add the new relnotes-x.y.html file to <a href="relnotes.html">relnotes.html</a>.
+</p>
+
+<p>
+Update the MESA_MAJOR, MESA_MINOR and MESA_TINY version numbers in
+configs/default.
+Also update the VERSION line in the top-level Makefile.
+</p>
+
+<p>
+Make sure the values in src/mesa/main/version.h are correct.
+</p>
+
+<p>
+Update docs/news.html.
+</p>
+
+<p>
+Check in all updates to git.
+</p>
+
+<p>
+Tag the files with the release name (in the form <b>mesa_X_Y</b>)
+with: <code>git tag -a mesa_X_Y</code>
+Then: <code>git push origin mesa_X_Y</code>
+</p>
+
+
+<H3>Make the tarballs</H3>
+<p>
+Make the distribution files. From inside the Mesa directory:
+<pre>
+ make tarballs
+</pre>
+
+<p>
+After the tarballs are created, the md5 checksums for the files will
+be computed.
+Add them to the docs/relnotes-X.Y.html file.
+</p>
+
+<p>
+Copy the distribution files to a temporary directory, unpack them,
+compile everything, and run some demos to be sure everything works.
+</p>
+
+<H3>Update the website and announce the release</H3>
+<p>
+Follow the directions on SourceForge for creating a new "release" and
+uploading the tarballs.
+</p>
+
+<p>
+Basically, to upload the tarball files with:
+<br>
+<code>
+rsync -avP ssh Mesa*-X.Y.* USERNAME@frs.sourceforge.net:uploads/
+</code>
+</p>
+
+<p>
+Update the web site by copying the docs/ directory's files to
+/home/users/b/br/brianp/mesa-www/htdocs/ with:
+<br>
+<code>
+sftp USERNAME,mesa3d@web.sourceforge.net
+</code>
+</p>
+
+<p>
+Make an announcement on the mailing lists:
+
+<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>d</em><em>e</em><em>v</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>,
+<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>u</em><em>s</em><em>e</em><em>r</em><em>s</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
+and
+<em>m</em><em>e</em><em>s</em><em>a</em><em>-</em><em>a</em><em>n</em><em>n</em><em>o</em><em>u</em><em>n</em><em>c</em><em>e</em><em>@</em><em>l</em><em>i</em><em>s</em><em>t</em><em>s</em><em>.</em><em>f</em><em>r</em><em>e</em><em>e</em><em>d</em><em>e</em><em>s</em><em>k</em><em>t</em><em>o</em><em>p</em><em>.</em><em>o</em><em>r</em><em>g</em>
+</p>
+
+
+
+</body>
+</html>
diff --git a/mesalib/docs/download.html b/mesalib/docs/download.html
index 2174bf0d9..df4f7a728 100644
--- a/mesalib/docs/download.html
+++ b/mesalib/docs/download.html
@@ -25,9 +25,8 @@ The Mesa package is named MesaLib-x.y.z.{tar.bz2, tar.gz, zip} where x.y.z
is the version. There are three types of compressed archives.
</p>
<p>
-There's also the MesaGLUT-x.y.z.{tar.bz2, tar.gz, zip} packages which
-contain Mark Kilgard's GLUT library.
-This is optional.
+In the past, there was also MesaGLUT-x.y.z.{tar.bz2, tar.gz, zip} packages which
+contained Mark Kilgard's GLUT library.
Most Linux distributions include an implementation of GLUT (such as freeglut).
</p>
<p>
diff --git a/mesalib/docs/faq.html b/mesalib/docs/faq.html
index 65e279aac..071381c5a 100644
--- a/mesalib/docs/faq.html
+++ b/mesalib/docs/faq.html
@@ -198,9 +198,9 @@ Mesa's not the solution.
<h2><a name="part2">2.3 Where is the GLUT library?</a></h2>
<p>
-<a name="part2">GLUT (OpenGL Utility Toolkit) is in the separate MesaGLUT-x.y.z.tar.gz file.
-If you don't already have GLUT installed, you should grab the MesaGLUT
-package and compile it with the rest of Mesa.
+<a name="part2">GLUT (OpenGL Utility Toolkit) is no longer in the separate MesaGLUT-x.y.z.tar.gz file.
+If you don't already have GLUT installed, you should grab
+<a href="http://freeglut.sourceforge.net/">freeglut</a>.
</a></p>
diff --git a/mesalib/docs/license.html b/mesalib/docs/license.html
index 44b980d93..5da8ef1de 100644
--- a/mesalib/docs/license.html
+++ b/mesalib/docs/license.html
@@ -38,10 +38,10 @@ target="_parent">Silicon Graphics Incorporated</a>.
<p>
The Mesa distribution consists of several components. Different copyrights
-and licenses apply to different components. For example, GLUT is copyrighted
-by Mark Kilgard, some demo programs are copyrighted by SGI, some of the Mesa
-device drivers are copyrighted by their authors. See below for a list of
-Mesa's main components and the license for each.
+and licenses apply to different components. For example, some demo programs
+are copyrighted by SGI, some of the Mesa device drivers are copyrighted by
+their authors. See below for a list of Mesa's main components and the license
+for each.
</p>
<p>
The core Mesa library is licensed according to the terms of the MIT license.
diff --git a/mesalib/docs/sourcetree.html b/mesalib/docs/sourcetree.html
index 67e0494b1..2e2d1d3f2 100644
--- a/mesalib/docs/sourcetree.html
+++ b/mesalib/docs/sourcetree.html
@@ -1,166 +1,165 @@
-<HTML>
-
-<TITLE>Mesa Source Tree</TITLE>
-
-<link rel="stylesheet" type="text/css" href="mesa.css"></head>
-
-<BODY>
-
-<h1>Mesa source code tree overview</h1>
-
-<p>
-This is a brief summary of Mesa's directory tree and what's contained in
-each directory.
-</p>
-
-
-<ul>
-<li><b>docs</b> - Documentation
-<li><b>include</b> - Public OpenGL header files
-<li><b>src</b>
- <ul>
- <li><b>egl</b> - EGL library sources
- <ul>
- <li><b>docs</b> - EGL documentation
- <li><b>drivers</b> - EGL drivers
- <li><b>glsl</b> - the GLSL compiler
- <li><b>main</b> - main EGL library implementation. This is where all
- the EGL API functions are implemented, like eglCreateContext().
- </ul>
- <li><b>mesa</b> - Main Mesa sources
- <ul>
- <li><b>glapi</b> - OpenGL API dispatch layer. This is where all the
- GL entrypoints like glClear, glBegin, etc. are generated, as well as
- the GL dispatch table. All GL function calls jump through the
- dispatch table to functions found in main/.
- <li><b>main</b> - The core Mesa code (mainly state management)
- <li><b>drivers</b> - Mesa drivers (not used with Gallium)
- <ul>
- <li><b>common</b> - code which may be shared by all drivers
- <li><b>dri</b> - Direct Rendering Infrastructure drivers
- <ul>
- <li><b>common</b> - code shared by all DRI drivers
- <li><b>i915</b> - driver for Intel i915/i945
- <li><b>i965</b> - driver for Intel i965
- <li>XXX more
- </ul>
- <li><b>x11</b> - Xlib-based software driver
- <li><b>osmesa</b> - off-screen software driver
- <li><b>glslcompiler</b> - a stand-alone GLSL compiler driver
- <li>XXX more
- </ul>
- <li><b>es</b> - OpenGL ES overlay, parallelly buildable with the core Mesa
- <li><b>math</b> - vertex array translation and transformation code
- (not used with Gallium)
- <li><b>ppc</b> - Assembly code/optimizations for PPC systems
- (not used with Gallium)
- <li><b>shader</b> - Vertex/fragment shader and GLSL compiler code
- <li><b>sparc</b> - Assembly code/optimizations for SPARC systems
- (not used with Gallium)
- <li><b>state_tracker</b> - State tracker / driver for Gallium. This
- is basically a Mesa device driver that speaks to Gallium. This
- directory may be moved to src/mesa/drivers/gallium at some point.
- <li><b>swrast</b> - Software rasterization module. For drawing points,
- lines, triangles, bitmaps, images, etc. in software.
- (not used with Gallium)
- <li><b>swrast_setup</b> - Software primitive setup. Does things like
- polygon culling, glPolygonMode, polygon offset, etc.
- (not used with Gallium)
- <li><b>tnl</b> - Software vertex Transformation 'n Lighting.
- (not used with Gallium)
- <li><b>tnl_dd</b> - TNL code for device drivers.
- (not used with Gallium)
- <li><b>vbo</b> - Vertex Buffer Object code. All drawing with
- glBegin/glEnd, glDrawArrays, display lists, etc. goes through this
- module. The results is a well-defined set of vertex arrays which
- are passed to the device driver (or tnl module) for rendering.
- <li><b>vf</b> - vertex format conversion (currently unused)
- <li><b>x86</b> - Assembly code/optimizations for 32-bit x86 systems
- (not used with Gallium)
- <li><b>x86-64</b> - Assembly code/optimizations for 64-bit x86 systems
- (not used with Gallium)
- </ul>
- <li><b>gallium</b> - Gallium3D source code
- <ul>
- <li><b>include</b> - Gallium3D header files which define the Gallium3D
- interfaces
- <li><b>drivers</b> - Gallium3D device drivers
- <ul>
- <li><b>cell</b> - Driver for Cell processor.
- <li><b>i915</b> - Driver for Intel i915/i945.
- <li><b>i965</b> - Driver for Intel i965.
- <li><b>llvmpipe</b> - Software driver using LLVM for runtime code generation.
- <li><b>nv*</b> - Drivers for NVIDIA GPUs.
- <li><b>r300</b> - Driver for ATI/AMD R300.
- <li><b>softpipe</b> - Software reference driver.
- <li><b>svga</b> - Driver for VMware's SVGA virtual GPU.
- <li><b>trace</b> - Driver for tracing Gallium calls.
- <li>XXX more
- </ul>
- <li><b>auxiliary</b> - Gallium support code
- <ul>
- <li><b>draw</b> - Software vertex processing and primitive assembly
- module. This includes vertex program execution, clipping, culling
- and optional stages for drawing wide lines, stippled lines,
- polygon stippling, two-sided lighting, etc.
- Intended for use by drivers for hardware that does not have
- vertex shaders.
- Geometry shaders will also be implemented in this module.
- <li><b>cso_cache</b> - Constant State Objects Cache. Used to filter out
- redundant state changes between state trackers and drivers.
- <li><b>gallivm</b> - LLVM module for Gallium. For LLVM-based
- compilation, optimization and code generation for TGSI shaders.
- Incomplete.
- <li><b>pipebuffer</b> - utility module for managing buffers
- <li><b>rbug</b> - Gallium remote debug utility
- <li><b>rtasm</b> - run-time assembly/machine code generation.
- Currently there's run-time code generation for x86/SSE, PowerPC
- and Cell SPU.
- <li><b>tgsi</b> - TG Shader Infrastructure. Code for encoding,
- manipulating and interpretting GPU programs.
- <li><b>translate</b> - module for translating vertex data from one format
- to another.
- <li><b>util</b> - assorted utilities for arithmetic, hashing, surface
- creation, memory management, 2D blitting, simple rendering, etc.
- </ul>
- <li><b>state_trackers</b> -
- <ul>
- <li><b>dri</b> - Meta state tracker for DRI drivers
- <li><b>egl</b> - Meta state tracker for EGL drivers
- <li><b>es</b> - OpenGL ES 1.x and 2.x state trackers
- <li><b>g3dvl</b> -
- <li><b>glx</b> - Meta state tracker for GLX
- <li><b>python</b> -
- <li><b>vega</b> - OpenVG 1.x state tracker
- <li><b>wgl</b> -
- <li><b>xorg</b> - Meta state tracker for Xorg video drivers
- </ul>
- <li><b>winsys</b> -
- <ul>
- <li><b>drm</b> -
- <li><b>g3dvl</b> -
- <li><b>gdi</b> -
- <li><b>xlib</b> -
- </ul>
- </ul>
- </ul>
- <ul>
- <li><b>glu</b> - The OpenGL Utility library
- <ul>
- <li><b>sgi</b> - GLU from SGI
- <li><b>mesa</b> - Mesa version of GLU (deprecated)
- </ul>
- <li><b>glut</b> - Mark Kilgard's OpenGL OpenGL Utility Toolkit library
- <li><b>glx</b> - The GLX library code for building libGL. This is used for
- direct rendering drivers. It will dynamically load one of the
- xxx_dri.so drivers.
- <li><b>glw</b> - Widgets for Xt/Motif.
- <li><b>glew</b> - OpenGL Extension Wrangler library (used by demo programs)
- </ul>
-<li><b>progs</b> - OpenGL test and demonstration programs
-<li><b>lib</b> - where the GL libraries are placed
-</ul>
-
-
-</BODY>
-</HTML>
+<HTML>
+
+<TITLE>Mesa Source Tree</TITLE>
+
+<link rel="stylesheet" type="text/css" href="mesa.css"></head>
+
+<BODY>
+
+<h1>Mesa source code tree overview</h1>
+
+<p>
+This is a brief summary of Mesa's directory tree and what's contained in
+each directory.
+</p>
+
+
+<ul>
+<li><b>docs</b> - Documentation
+<li><b>include</b> - Public OpenGL header files
+<li><b>src</b>
+ <ul>
+ <li><b>egl</b> - EGL library sources
+ <ul>
+ <li><b>docs</b> - EGL documentation
+ <li><b>drivers</b> - EGL drivers
+ <li><b>glsl</b> - the GLSL compiler
+ <li><b>main</b> - main EGL library implementation. This is where all
+ the EGL API functions are implemented, like eglCreateContext().
+ </ul>
+ <li><b>mesa</b> - Main Mesa sources
+ <ul>
+ <li><b>glapi</b> - OpenGL API dispatch layer. This is where all the
+ GL entrypoints like glClear, glBegin, etc. are generated, as well as
+ the GL dispatch table. All GL function calls jump through the
+ dispatch table to functions found in main/.
+ <li><b>main</b> - The core Mesa code (mainly state management)
+ <li><b>drivers</b> - Mesa drivers (not used with Gallium)
+ <ul>
+ <li><b>common</b> - code which may be shared by all drivers
+ <li><b>dri</b> - Direct Rendering Infrastructure drivers
+ <ul>
+ <li><b>common</b> - code shared by all DRI drivers
+ <li><b>i915</b> - driver for Intel i915/i945
+ <li><b>i965</b> - driver for Intel i965
+ <li>XXX more
+ </ul>
+ <li><b>x11</b> - Xlib-based software driver
+ <li><b>osmesa</b> - off-screen software driver
+ <li><b>glslcompiler</b> - a stand-alone GLSL compiler driver
+ <li>XXX more
+ </ul>
+ <li><b>es</b> - OpenGL ES overlay, parallelly buildable with the core Mesa
+ <li><b>math</b> - vertex array translation and transformation code
+ (not used with Gallium)
+ <li><b>ppc</b> - Assembly code/optimizations for PPC systems
+ (not used with Gallium)
+ <li><b>shader</b> - Vertex/fragment shader and GLSL compiler code
+ <li><b>sparc</b> - Assembly code/optimizations for SPARC systems
+ (not used with Gallium)
+ <li><b>state_tracker</b> - State tracker / driver for Gallium. This
+ is basically a Mesa device driver that speaks to Gallium. This
+ directory may be moved to src/mesa/drivers/gallium at some point.
+ <li><b>swrast</b> - Software rasterization module. For drawing points,
+ lines, triangles, bitmaps, images, etc. in software.
+ (not used with Gallium)
+ <li><b>swrast_setup</b> - Software primitive setup. Does things like
+ polygon culling, glPolygonMode, polygon offset, etc.
+ (not used with Gallium)
+ <li><b>tnl</b> - Software vertex Transformation 'n Lighting.
+ (not used with Gallium)
+ <li><b>tnl_dd</b> - TNL code for device drivers.
+ (not used with Gallium)
+ <li><b>vbo</b> - Vertex Buffer Object code. All drawing with
+ glBegin/glEnd, glDrawArrays, display lists, etc. goes through this
+ module. The results is a well-defined set of vertex arrays which
+ are passed to the device driver (or tnl module) for rendering.
+ <li><b>vf</b> - vertex format conversion (currently unused)
+ <li><b>x86</b> - Assembly code/optimizations for 32-bit x86 systems
+ (not used with Gallium)
+ <li><b>x86-64</b> - Assembly code/optimizations for 64-bit x86 systems
+ (not used with Gallium)
+ </ul>
+ <li><b>gallium</b> - Gallium3D source code
+ <ul>
+ <li><b>include</b> - Gallium3D header files which define the Gallium3D
+ interfaces
+ <li><b>drivers</b> - Gallium3D device drivers
+ <ul>
+ <li><b>cell</b> - Driver for Cell processor.
+ <li><b>i915</b> - Driver for Intel i915/i945.
+ <li><b>i965</b> - Driver for Intel i965.
+ <li><b>llvmpipe</b> - Software driver using LLVM for runtime code generation.
+ <li><b>nv*</b> - Drivers for NVIDIA GPUs.
+ <li><b>r300</b> - Driver for ATI/AMD R300.
+ <li><b>softpipe</b> - Software reference driver.
+ <li><b>svga</b> - Driver for VMware's SVGA virtual GPU.
+ <li><b>trace</b> - Driver for tracing Gallium calls.
+ <li>XXX more
+ </ul>
+ <li><b>auxiliary</b> - Gallium support code
+ <ul>
+ <li><b>draw</b> - Software vertex processing and primitive assembly
+ module. This includes vertex program execution, clipping, culling
+ and optional stages for drawing wide lines, stippled lines,
+ polygon stippling, two-sided lighting, etc.
+ Intended for use by drivers for hardware that does not have
+ vertex shaders.
+ Geometry shaders will also be implemented in this module.
+ <li><b>cso_cache</b> - Constant State Objects Cache. Used to filter out
+ redundant state changes between state trackers and drivers.
+ <li><b>gallivm</b> - LLVM module for Gallium. For LLVM-based
+ compilation, optimization and code generation for TGSI shaders.
+ Incomplete.
+ <li><b>pipebuffer</b> - utility module for managing buffers
+ <li><b>rbug</b> - Gallium remote debug utility
+ <li><b>rtasm</b> - run-time assembly/machine code generation.
+ Currently there's run-time code generation for x86/SSE, PowerPC
+ and Cell SPU.
+ <li><b>tgsi</b> - TG Shader Infrastructure. Code for encoding,
+ manipulating and interpretting GPU programs.
+ <li><b>translate</b> - module for translating vertex data from one format
+ to another.
+ <li><b>util</b> - assorted utilities for arithmetic, hashing, surface
+ creation, memory management, 2D blitting, simple rendering, etc.
+ </ul>
+ <li><b>state_trackers</b> -
+ <ul>
+ <li><b>dri</b> - Meta state tracker for DRI drivers
+ <li><b>egl</b> - Meta state tracker for EGL drivers
+ <li><b>es</b> - OpenGL ES 1.x and 2.x state trackers
+ <li><b>g3dvl</b> -
+ <li><b>glx</b> - Meta state tracker for GLX
+ <li><b>python</b> -
+ <li><b>vega</b> - OpenVG 1.x state tracker
+ <li><b>wgl</b> -
+ <li><b>xorg</b> - Meta state tracker for Xorg video drivers
+ </ul>
+ <li><b>winsys</b> -
+ <ul>
+ <li><b>drm</b> -
+ <li><b>g3dvl</b> -
+ <li><b>gdi</b> -
+ <li><b>xlib</b> -
+ </ul>
+ </ul>
+ </ul>
+ <ul>
+ <li><b>glu</b> - The OpenGL Utility library
+ <ul>
+ <li><b>sgi</b> - GLU from SGI
+ <li><b>mesa</b> - Mesa version of GLU (deprecated)
+ </ul>
+ <li><b>glx</b> - The GLX library code for building libGL. This is used for
+ direct rendering drivers. It will dynamically load one of the
+ xxx_dri.so drivers.
+ <li><b>glw</b> - Widgets for Xt/Motif.
+ <li><b>glew</b> - OpenGL Extension Wrangler library (used by demo programs)
+ </ul>
+<li><b>progs</b> - OpenGL test and demonstration programs
+<li><b>lib</b> - where the GL libraries are placed
+</ul>
+
+
+</BODY>
+</HTML>
diff --git a/mesalib/include/GL/glut.h b/mesalib/include/GL/glut.h
deleted file mode 100644
index dfbd86977..000000000
--- a/mesalib/include/GL/glut.h
+++ /dev/null
@@ -1,665 +0,0 @@
-#ifndef __glut_h__
-#define __glut_h__
-
-/* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
-
-/* This program is freely distributable without licensing fees and is
- provided without guarantee or warrantee expressed or implied. This
- program is -not- in the public domain. */
-
-#if defined(_WIN32)
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN 1
-# endif
-# include <windows.h>
-#endif
-
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(_WIN32)
-
-/* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
- in your compile preprocessor options. */
-# if defined(_MSC_VER) && !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
-# pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */
-/* To enable automatic SGI OpenGL for Windows library usage for GLUT,
- define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */
-# ifdef GLUT_USE_SGI_OPENGL
-# pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */
-# pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */
-# pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */
-# else
-# pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */
-# pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */
-# pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */
-# endif
-# endif
-
-/* To disable supression of annoying warnings about floats being promoted
- to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
- options. */
-# if defined(_MSC_VER) && !defined(GLUT_NO_WARNING_DISABLE)
-# pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */
-# pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
-# endif
-
-/* Win32 has an annoying issue where there are multiple C run-time
- libraries (CRTs). If the executable is linked with a different CRT
- from the GLUT DLL, the GLUT DLL will not share the same CRT static
- data seen by the executable. In particular, atexit callbacks registered
- in the executable will not be called if GLUT calls its (different)
- exit routine). GLUT is typically built with the
- "/MD" option (the CRT with multithreading DLL support), but the Visual
- C++ linker default is "/ML" (the single threaded CRT).
-
- One workaround to this issue is requiring users to always link with
- the same CRT as GLUT is compiled with. That requires users supply a
- non-standard option. GLUT 3.7 has its own built-in workaround where
- the executable's "exit" function pointer is covertly passed to GLUT.
- GLUT then calls the executable's exit function pointer to ensure that
- any "atexit" calls registered by the application are called if GLUT
- needs to exit.
-
- Note that the __glut*WithExit routines should NEVER be called directly.
- To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
-
-/* XXX This is from Win32's <process.h> */
-# if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__cdecl)
- /* Define __cdecl for non-Microsoft compilers. */
-# define __cdecl
-# define GLUT_DEFINED___CDECL
-# endif
-#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
-#include <stdlib.h>
-#endif
-
-/* GLUT callback calling convention for Win32. */
-# define GLUTCALLBACK __cdecl
-
-/* for callback/function pointer defs */
-# define GLUTAPIENTRYV __cdecl
-
-/* glut-win32 specific macros, defined to prevent collision with
- and redifinition of Windows system defs, also removes requirement of
- pretty much any standard windows header from this file */
-
-#if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
-# define GLUTAPIENTRY __stdcall
-#else
-# define GLUTAPIENTRY
-#endif
-
-/* GLUT API entry point declarations for Win32. */
-#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && !defined(GLUT_STATIC)
-# define GLUTAPI __declspec(dllexport)
-#elif !defined(GLUT_STATIC)
-# define GLUTAPI __declspec(dllimport)
-#else
-# define GLUTAPI extern
-#endif
-
-#elif defined(__GNUC__)
-
-# define GLUTAPIENTRY
-# define GLUTAPIENTRYV
-# define GLUTCALLBACK
-# define GLUTAPI extern __attribute__((visibility("default")))
-
-#else
-
-/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing */
-# define GLUTAPIENTRY
-# define GLUTAPIENTRYV
-# define GLUTCALLBACK
-# define GLUTAPI extern
-
-#endif
-
-
-/**
- GLUT API revision history:
-
- GLUT_API_VERSION is updated to reflect incompatible GLUT
- API changes (interface changes, semantic changes, deletions,
- or additions).
-
- GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
-
- GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
- extension. Supports new input devices like tablet, dial and button
- box, and Spaceball. Easy to query OpenGL extensions.
-
- GLUT_API_VERSION=3 glutMenuStatus added.
-
- GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer,
- glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
- video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
- glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
- glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!).
-
- GLUT_API_VERSION=5 glutGetProcAddress (added by BrianP)
-**/
-#ifndef GLUT_API_VERSION /* allow this to be overriden */
-#define GLUT_API_VERSION 5
-#endif
-
-/**
- GLUT implementation revision history:
-
- GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
- API revisions and implementation revisions (ie, bug fixes).
-
- GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
- GLUT Xlib-based implementation. 11/29/94
-
- GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
- GLUT Xlib-based implementation providing GLUT version 2
- interfaces.
-
- GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
-
- GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
-
- GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
-
- GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
-
- GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
- and video resize. 1/3/97
-
- GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
-
- GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
-
- GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
-
- GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
-
- GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
-
- GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa <GL/glut.h>
-**/
-#ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
-#define GLUT_XLIB_IMPLEMENTATION 15
-#endif
-
-/* Display mode bit masks. */
-#define GLUT_RGB 0
-#define GLUT_RGBA GLUT_RGB
-#define GLUT_INDEX 1
-#define GLUT_SINGLE 0
-#define GLUT_DOUBLE 2
-#define GLUT_ACCUM 4
-#define GLUT_ALPHA 8
-#define GLUT_DEPTH 16
-#define GLUT_STENCIL 32
-#if (GLUT_API_VERSION >= 2)
-#define GLUT_MULTISAMPLE 128
-#define GLUT_STEREO 256
-#endif
-#if (GLUT_API_VERSION >= 3)
-#define GLUT_LUMINANCE 512
-#endif
-
-/* Mouse buttons. */
-#define GLUT_LEFT_BUTTON 0
-#define GLUT_MIDDLE_BUTTON 1
-#define GLUT_RIGHT_BUTTON 2
-
-/* Mouse button state. */
-#define GLUT_DOWN 0
-#define GLUT_UP 1
-
-#if (GLUT_API_VERSION >= 2)
-/* function keys */
-#define GLUT_KEY_F1 1
-#define GLUT_KEY_F2 2
-#define GLUT_KEY_F3 3
-#define GLUT_KEY_F4 4
-#define GLUT_KEY_F5 5
-#define GLUT_KEY_F6 6
-#define GLUT_KEY_F7 7
-#define GLUT_KEY_F8 8
-#define GLUT_KEY_F9 9
-#define GLUT_KEY_F10 10
-#define GLUT_KEY_F11 11
-#define GLUT_KEY_F12 12
-/* directional keys */
-#define GLUT_KEY_LEFT 100
-#define GLUT_KEY_UP 101
-#define GLUT_KEY_RIGHT 102
-#define GLUT_KEY_DOWN 103
-#define GLUT_KEY_PAGE_UP 104
-#define GLUT_KEY_PAGE_DOWN 105
-#define GLUT_KEY_HOME 106
-#define GLUT_KEY_END 107
-#define GLUT_KEY_INSERT 108
-#endif
-
-/* Entry/exit state. */
-#define GLUT_LEFT 0
-#define GLUT_ENTERED 1
-
-/* Menu usage state. */
-#define GLUT_MENU_NOT_IN_USE 0
-#define GLUT_MENU_IN_USE 1
-
-/* Visibility state. */
-#define GLUT_NOT_VISIBLE 0
-#define GLUT_VISIBLE 1
-
-/* Window status state. */
-#define GLUT_HIDDEN 0
-#define GLUT_FULLY_RETAINED 1
-#define GLUT_PARTIALLY_RETAINED 2
-#define GLUT_FULLY_COVERED 3
-
-/* Color index component selection values. */
-#define GLUT_RED 0
-#define GLUT_GREEN 1
-#define GLUT_BLUE 2
-
-/* Layers for use. */
-#define GLUT_NORMAL 0
-#define GLUT_OVERLAY 1
-
-#if defined(_WIN32) || defined (GLUT_IMPORT_LIB)
-/* Stroke font constants (use these in GLUT program). */
-#define GLUT_STROKE_ROMAN ((void*)0)
-#define GLUT_STROKE_MONO_ROMAN ((void*)1)
-
-/* Bitmap font constants (use these in GLUT program). */
-#define GLUT_BITMAP_9_BY_15 ((void*)2)
-#define GLUT_BITMAP_8_BY_13 ((void*)3)
-#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
-#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
-#if (GLUT_API_VERSION >= 3)
-#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
-#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
-#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
-#endif
-#else
-/* Stroke font opaque addresses (use constants instead in source code). */
-GLUTAPI void *glutStrokeRoman;
-GLUTAPI void *glutStrokeMonoRoman;
-
-/* Stroke font constants (use these in GLUT program). */
-#define GLUT_STROKE_ROMAN (&glutStrokeRoman)
-#define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
-
-/* Bitmap font opaque addresses (use constants instead in source code). */
-GLUTAPI void *glutBitmap9By15;
-GLUTAPI void *glutBitmap8By13;
-GLUTAPI void *glutBitmapTimesRoman10;
-GLUTAPI void *glutBitmapTimesRoman24;
-GLUTAPI void *glutBitmapHelvetica10;
-GLUTAPI void *glutBitmapHelvetica12;
-GLUTAPI void *glutBitmapHelvetica18;
-
-/* Bitmap font constants (use these in GLUT program). */
-#define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
-#define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
-#define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
-#define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
-#if (GLUT_API_VERSION >= 3)
-#define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
-#define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
-#define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
-#endif
-#endif
-
-/* glutGet parameters. */
-#define GLUT_WINDOW_X 100
-#define GLUT_WINDOW_Y 101
-#define GLUT_WINDOW_WIDTH 102
-#define GLUT_WINDOW_HEIGHT 103
-#define GLUT_WINDOW_BUFFER_SIZE 104
-#define GLUT_WINDOW_STENCIL_SIZE 105
-#define GLUT_WINDOW_DEPTH_SIZE 106
-#define GLUT_WINDOW_RED_SIZE 107
-#define GLUT_WINDOW_GREEN_SIZE 108
-#define GLUT_WINDOW_BLUE_SIZE 109
-#define GLUT_WINDOW_ALPHA_SIZE 110
-#define GLUT_WINDOW_ACCUM_RED_SIZE 111
-#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
-#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
-#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
-#define GLUT_WINDOW_DOUBLEBUFFER 115
-#define GLUT_WINDOW_RGBA 116
-#define GLUT_WINDOW_PARENT 117
-#define GLUT_WINDOW_NUM_CHILDREN 118
-#define GLUT_WINDOW_COLORMAP_SIZE 119
-#if (GLUT_API_VERSION >= 2)
-#define GLUT_WINDOW_NUM_SAMPLES 120
-#define GLUT_WINDOW_STEREO 121
-#endif
-#if (GLUT_API_VERSION >= 3)
-#define GLUT_WINDOW_CURSOR 122
-#endif
-#define GLUT_SCREEN_WIDTH 200
-#define GLUT_SCREEN_HEIGHT 201
-#define GLUT_SCREEN_WIDTH_MM 202
-#define GLUT_SCREEN_HEIGHT_MM 203
-#define GLUT_MENU_NUM_ITEMS 300
-#define GLUT_DISPLAY_MODE_POSSIBLE 400
-#define GLUT_INIT_WINDOW_X 500
-#define GLUT_INIT_WINDOW_Y 501
-#define GLUT_INIT_WINDOW_WIDTH 502
-#define GLUT_INIT_WINDOW_HEIGHT 503
-#define GLUT_INIT_DISPLAY_MODE 504
-#if (GLUT_API_VERSION >= 2)
-#define GLUT_ELAPSED_TIME 700
-#endif
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
-#define GLUT_WINDOW_FORMAT_ID 123
-#endif
-
-#if (GLUT_API_VERSION >= 2)
-/* glutDeviceGet parameters. */
-#define GLUT_HAS_KEYBOARD 600
-#define GLUT_HAS_MOUSE 601
-#define GLUT_HAS_SPACEBALL 602
-#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
-#define GLUT_HAS_TABLET 604
-#define GLUT_NUM_MOUSE_BUTTONS 605
-#define GLUT_NUM_SPACEBALL_BUTTONS 606
-#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
-#define GLUT_NUM_DIALS 608
-#define GLUT_NUM_TABLET_BUTTONS 609
-#endif
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
-#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
-#define GLUT_DEVICE_KEY_REPEAT 611
-#define GLUT_HAS_JOYSTICK 612
-#define GLUT_OWNS_JOYSTICK 613
-#define GLUT_JOYSTICK_BUTTONS 614
-#define GLUT_JOYSTICK_AXES 615
-#define GLUT_JOYSTICK_POLL_RATE 616
-#endif
-
-#if (GLUT_API_VERSION >= 3)
-/* glutLayerGet parameters. */
-#define GLUT_OVERLAY_POSSIBLE 800
-#define GLUT_LAYER_IN_USE 801
-#define GLUT_HAS_OVERLAY 802
-#define GLUT_TRANSPARENT_INDEX 803
-#define GLUT_NORMAL_DAMAGED 804
-#define GLUT_OVERLAY_DAMAGED 805
-
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
-/* glutVideoResizeGet parameters. */
-#define GLUT_VIDEO_RESIZE_POSSIBLE 900
-#define GLUT_VIDEO_RESIZE_IN_USE 901
-#define GLUT_VIDEO_RESIZE_X_DELTA 902
-#define GLUT_VIDEO_RESIZE_Y_DELTA 903
-#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
-#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
-#define GLUT_VIDEO_RESIZE_X 906
-#define GLUT_VIDEO_RESIZE_Y 907
-#define GLUT_VIDEO_RESIZE_WIDTH 908
-#define GLUT_VIDEO_RESIZE_HEIGHT 909
-#endif
-
-/* glutUseLayer parameters. */
-#define GLUT_NORMAL 0
-#define GLUT_OVERLAY 1
-
-/* glutGetModifiers return mask. */
-#define GLUT_ACTIVE_SHIFT 1
-#define GLUT_ACTIVE_CTRL 2
-#define GLUT_ACTIVE_ALT 4
-
-/* glutSetCursor parameters. */
-/* Basic arrows. */
-#define GLUT_CURSOR_RIGHT_ARROW 0
-#define GLUT_CURSOR_LEFT_ARROW 1
-/* Symbolic cursor shapes. */
-#define GLUT_CURSOR_INFO 2
-#define GLUT_CURSOR_DESTROY 3
-#define GLUT_CURSOR_HELP 4
-#define GLUT_CURSOR_CYCLE 5
-#define GLUT_CURSOR_SPRAY 6
-#define GLUT_CURSOR_WAIT 7
-#define GLUT_CURSOR_TEXT 8
-#define GLUT_CURSOR_CROSSHAIR 9
-/* Directional cursors. */
-#define GLUT_CURSOR_UP_DOWN 10
-#define GLUT_CURSOR_LEFT_RIGHT 11
-/* Sizing cursors. */
-#define GLUT_CURSOR_TOP_SIDE 12
-#define GLUT_CURSOR_BOTTOM_SIDE 13
-#define GLUT_CURSOR_LEFT_SIDE 14
-#define GLUT_CURSOR_RIGHT_SIDE 15
-#define GLUT_CURSOR_TOP_LEFT_CORNER 16
-#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
-#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
-#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
-/* Inherit from parent window. */
-#define GLUT_CURSOR_INHERIT 100
-/* Blank cursor. */
-#define GLUT_CURSOR_NONE 101
-/* Fullscreen crosshair (if available). */
-#define GLUT_CURSOR_FULL_CROSSHAIR 102
-#endif
-
-/* GLUT initialization sub-API. */
-GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv);
-#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
-GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
-#ifndef GLUT_BUILDING_LIB
-#define glutInit(__argcp, __argv) __glutInitWithExit(__argcp, __argv, exit)
-#endif
-#endif
-GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode);
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
-GLUTAPI void GLUTAPIENTRY glutInitDisplayString(const char *string);
-#endif
-GLUTAPI void GLUTAPIENTRY glutInitWindowPosition(int x, int y);
-GLUTAPI void GLUTAPIENTRY glutInitWindowSize(int width, int height);
-GLUTAPI void GLUTAPIENTRY glutMainLoop(void);
-
-/* GLUT window sub-API. */
-GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title);
-#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
-GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
-#ifndef GLUT_BUILDING_LIB
-#define glutCreateWindow(__title) __glutCreateWindowWithExit(__title, exit)
-#endif
-#endif
-GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
-GLUTAPI void GLUTAPIENTRY glutDestroyWindow(int win);
-GLUTAPI void GLUTAPIENTRY glutPostRedisplay(void);
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
-GLUTAPI void GLUTAPIENTRY glutPostWindowRedisplay(int win);
-#endif
-GLUTAPI void GLUTAPIENTRY glutSwapBuffers(void);
-GLUTAPI int GLUTAPIENTRY glutGetWindow(void);
-GLUTAPI void GLUTAPIENTRY glutSetWindow(int win);
-GLUTAPI void GLUTAPIENTRY glutSetWindowTitle(const char *title);
-GLUTAPI void GLUTAPIENTRY glutSetIconTitle(const char *title);
-GLUTAPI void GLUTAPIENTRY glutPositionWindow(int x, int y);
-GLUTAPI void GLUTAPIENTRY glutReshapeWindow(int width, int height);
-GLUTAPI void GLUTAPIENTRY glutPopWindow(void);
-GLUTAPI void GLUTAPIENTRY glutPushWindow(void);
-GLUTAPI void GLUTAPIENTRY glutIconifyWindow(void);
-GLUTAPI void GLUTAPIENTRY glutShowWindow(void);
-GLUTAPI void GLUTAPIENTRY glutHideWindow(void);
-#if (GLUT_API_VERSION >= 3)
-GLUTAPI void GLUTAPIENTRY glutFullScreen(void);
-GLUTAPI void GLUTAPIENTRY glutSetCursor(int cursor);
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
-GLUTAPI void GLUTAPIENTRY glutWarpPointer(int x, int y);
-#endif
-
-/* GLUT overlay sub-API. */
-GLUTAPI void GLUTAPIENTRY glutEstablishOverlay(void);
-GLUTAPI void GLUTAPIENTRY glutRemoveOverlay(void);
-GLUTAPI void GLUTAPIENTRY glutUseLayer(GLenum layer);
-GLUTAPI void GLUTAPIENTRY glutPostOverlayRedisplay(void);
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
-GLUTAPI void GLUTAPIENTRY glutPostWindowOverlayRedisplay(int win);
-#endif
-GLUTAPI void GLUTAPIENTRY glutShowOverlay(void);
-GLUTAPI void GLUTAPIENTRY glutHideOverlay(void);
-#endif
-
-/* GLUT menu sub-API. */
-GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
-#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
-GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
-#ifndef GLUT_BUILDING_LIB
-#define glutCreateMenu(__func) __glutCreateMenuWithExit(__func, exit)
-#endif
-#endif
-GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu);
-GLUTAPI int GLUTAPIENTRY glutGetMenu(void);
-GLUTAPI void GLUTAPIENTRY glutSetMenu(int menu);
-GLUTAPI void GLUTAPIENTRY glutAddMenuEntry(const char *label, int value);
-GLUTAPI void GLUTAPIENTRY glutAddSubMenu(const char *label, int submenu);
-GLUTAPI void GLUTAPIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
-GLUTAPI void GLUTAPIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
-GLUTAPI void GLUTAPIENTRY glutRemoveMenuItem(int item);
-GLUTAPI void GLUTAPIENTRY glutAttachMenu(int button);
-GLUTAPI void GLUTAPIENTRY glutDetachMenu(int button);
-
-/* GLUT window callback sub-API. */
-GLUTAPI void GLUTAPIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
-GLUTAPI void GLUTAPIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
-GLUTAPI void GLUTAPIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
-GLUTAPI void GLUTAPIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
-GLUTAPI void GLUTAPIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
-GLUTAPI void GLUTAPIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
-GLUTAPI void GLUTAPIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
-GLUTAPI void GLUTAPIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
-GLUTAPI void GLUTAPIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
-GLUTAPI void GLUTAPIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
-GLUTAPI void GLUTAPIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
-#if (GLUT_API_VERSION >= 2)
-GLUTAPI void GLUTAPIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
-GLUTAPI void GLUTAPIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
-GLUTAPI void GLUTAPIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
-GLUTAPI void GLUTAPIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
-GLUTAPI void GLUTAPIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
-GLUTAPI void GLUTAPIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
-GLUTAPI void GLUTAPIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
-GLUTAPI void GLUTAPIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
-#if (GLUT_API_VERSION >= 3)
-GLUTAPI void GLUTAPIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
-GLUTAPI void GLUTAPIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
-GLUTAPI void GLUTAPIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
-#endif
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
-GLUTAPI void GLUTAPIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
-GLUTAPI void GLUTAPIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
-GLUTAPI void GLUTAPIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);
-#endif
-#endif
-#endif
-
-/* GLUT color index sub-API. */
-GLUTAPI void GLUTAPIENTRY glutSetColor(int ndx, GLfloat red, GLfloat green, GLfloat blue);
-GLUTAPI GLfloat GLUTAPIENTRY glutGetColor(int ndx, int component);
-GLUTAPI void GLUTAPIENTRY glutCopyColormap(int win);
-
-/* GLUT state retrieval sub-API. */
-GLUTAPI int GLUTAPIENTRY glutGet(GLenum type);
-GLUTAPI int GLUTAPIENTRY glutDeviceGet(GLenum type);
-#if (GLUT_API_VERSION >= 2)
-/* GLUT extension support sub-API */
-GLUTAPI int GLUTAPIENTRY glutExtensionSupported(const char *name);
-#endif
-#if (GLUT_API_VERSION >= 3)
-GLUTAPI int GLUTAPIENTRY glutGetModifiers(void);
-GLUTAPI int GLUTAPIENTRY glutLayerGet(GLenum type);
-#endif
-#if (GLUT_API_VERSION >= 5)
-typedef void (*GLUTproc)();
-GLUTAPI GLUTproc GLUTAPIENTRY glutGetProcAddress(const char *procName);
-#endif
-
-/* GLUT font sub-API */
-GLUTAPI void GLUTAPIENTRY glutBitmapCharacter(void *font, int character);
-GLUTAPI int GLUTAPIENTRY glutBitmapWidth(void *font, int character);
-GLUTAPI void GLUTAPIENTRY glutStrokeCharacter(void *font, int character);
-GLUTAPI int GLUTAPIENTRY glutStrokeWidth(void *font, int character);
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
-GLUTAPI int GLUTAPIENTRY glutBitmapLength(void *font, const unsigned char *string);
-GLUTAPI int GLUTAPIENTRY glutStrokeLength(void *font, const unsigned char *string);
-#endif
-
-/* GLUT pre-built models sub-API */
-GLUTAPI void GLUTAPIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
-GLUTAPI void GLUTAPIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
-GLUTAPI void GLUTAPIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
-GLUTAPI void GLUTAPIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
-GLUTAPI void GLUTAPIENTRY glutWireCube(GLdouble size);
-GLUTAPI void GLUTAPIENTRY glutSolidCube(GLdouble size);
-GLUTAPI void GLUTAPIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
-GLUTAPI void GLUTAPIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
-GLUTAPI void GLUTAPIENTRY glutWireDodecahedron(void);
-GLUTAPI void GLUTAPIENTRY glutSolidDodecahedron(void);
-GLUTAPI void GLUTAPIENTRY glutWireTeapot(GLdouble size);
-GLUTAPI void GLUTAPIENTRY glutSolidTeapot(GLdouble size);
-GLUTAPI void GLUTAPIENTRY glutWireOctahedron(void);
-GLUTAPI void GLUTAPIENTRY glutSolidOctahedron(void);
-GLUTAPI void GLUTAPIENTRY glutWireTetrahedron(void);
-GLUTAPI void GLUTAPIENTRY glutSolidTetrahedron(void);
-GLUTAPI void GLUTAPIENTRY glutWireIcosahedron(void);
-GLUTAPI void GLUTAPIENTRY glutSolidIcosahedron(void);
-
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
-/* GLUT video resize sub-API. */
-GLUTAPI int GLUTAPIENTRY glutVideoResizeGet(GLenum param);
-GLUTAPI void GLUTAPIENTRY glutSetupVideoResizing(void);
-GLUTAPI void GLUTAPIENTRY glutStopVideoResizing(void);
-GLUTAPI void GLUTAPIENTRY glutVideoResize(int x, int y, int width, int height);
-GLUTAPI void GLUTAPIENTRY glutVideoPan(int x, int y, int width, int height);
-
-/* GLUT debugging sub-API. */
-GLUTAPI void GLUTAPIENTRY glutReportErrors(void);
-#endif
-
-#if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
-/* GLUT device control sub-API. */
-/* glutSetKeyRepeat modes. */
-#define GLUT_KEY_REPEAT_OFF 0
-#define GLUT_KEY_REPEAT_ON 1
-#define GLUT_KEY_REPEAT_DEFAULT 2
-
-/* Joystick button masks. */
-#define GLUT_JOYSTICK_BUTTON_A 1
-#define GLUT_JOYSTICK_BUTTON_B 2
-#define GLUT_JOYSTICK_BUTTON_C 4
-#define GLUT_JOYSTICK_BUTTON_D 8
-
-GLUTAPI void GLUTAPIENTRY glutIgnoreKeyRepeat(int ignore);
-GLUTAPI void GLUTAPIENTRY glutSetKeyRepeat(int repeatMode);
-GLUTAPI void GLUTAPIENTRY glutForceJoystickFunc(void);
-
-/* GLUT game mode sub-API. */
-/* glutGameModeGet. */
-#define GLUT_GAME_MODE_ACTIVE 0
-#define GLUT_GAME_MODE_POSSIBLE 1
-#define GLUT_GAME_MODE_WIDTH 2
-#define GLUT_GAME_MODE_HEIGHT 3
-#define GLUT_GAME_MODE_PIXEL_DEPTH 4
-#define GLUT_GAME_MODE_REFRESH_RATE 5
-#define GLUT_GAME_MODE_DISPLAY_CHANGED 6
-
-GLUTAPI void GLUTAPIENTRY glutGameModeString(const char *string);
-GLUTAPI int GLUTAPIENTRY glutEnterGameMode(void);
-GLUTAPI void GLUTAPIENTRY glutLeaveGameMode(void);
-GLUTAPI int GLUTAPIENTRY glutGameModeGet(GLenum mode);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __glut_h__ */
diff --git a/mesalib/include/GL/glutf90.h b/mesalib/include/GL/glutf90.h
deleted file mode 100644
index b5d8d47c1..000000000
--- a/mesalib/include/GL/glutf90.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef __glutf90_h__
-#define __glutf90_h__
-
-/* Copyright (c) Mark J. Kilgard & Willam F. Mitchell, 1998. */
-
-/* This program is freely distributable without licensing fees
- and is provided without guarantee or warrantee expressed or
- implied. This program is -not- in the public domain. */
-
-/* This header provides the binding interface for William Mitchell's
- f90gl Fortran 90 GLUT binding. Other GLUT language bindings
- can and should use this interace. */
-
-/* I appreciate the guidance from William Mitchell
- (mitchell@cam.nist.gov) in developing this friend interface
- for use by the f90gl package. See ../../README.fortran */
-
-#include <GL/glut.h>
-
-/* Which callback enumerants for the __glutSetFCB/__glutGetFCB routines. */
-/* NOTE These values are part of a binary interface for the f90gl Fortran
- 90 binding and so must NOT changes (additions are allowed). */
-
-/* GLUTwindow callbacks. */
-#define GLUT_FCB_DISPLAY 0 /* GLUTdisplayFCB */
-#define GLUT_FCB_RESHAPE 1 /* GLUTreshapeFCB */
-#define GLUT_FCB_MOUSE 2 /* GLUTmouseFCB */
-#define GLUT_FCB_MOTION 3 /* GLUTmotionFCB */
-#define GLUT_FCB_PASSIVE 4 /* GLUTpassiveFCB */
-#define GLUT_FCB_ENTRY 5 /* GLUTentryFCB */
-#define GLUT_FCB_KEYBOARD 6 /* GLUTkeyboardFCB */
-#define GLUT_FCB_KEYBOARD_UP 7 /* GLUTkeyboardFCB */
-#define GLUT_FCB_WINDOW_STATUS 8 /* GLUTwindowStatusFCB */
-#define GLUT_FCB_VISIBILITY 9 /* GLUTvisibilityFCB */
-#define GLUT_FCB_SPECIAL 10 /* GLUTspecialFCB */
-#define GLUT_FCB_SPECIAL_UP 11 /* GLUTspecialFCB */
-#define GLUT_FCB_BUTTON_BOX 12 /* GLUTbuttonBoxFCB */
-#define GLUT_FCB_DIALS 13 /* GLUTdialsFCB */
-#define GLUT_FCB_SPACE_MOTION 14 /* GLUTspaceMotionFCB */
-#define GLUT_FCB_SPACE_ROTATE 15 /* GLUTspaceRotateFCB */
-#define GLUT_FCB_SPACE_BUTTON 16 /* GLUTspaceButtonFCB */
-#define GLUT_FCB_TABLET_MOTION 17 /* GLUTtabletMotionFCB */
-#define GLUT_FCB_TABLET_BUTTON 18 /* GLUTtabletButtonFCB */
-#define GLUT_FCB_JOYSTICK 19 /* GLUTjoystickFCB */
-/* Non-GLUTwindow callbacks. */
-#define GLUT_FCB_OVERLAY_DISPLAY 100 /* GLUTdisplayFCB */
-#define GLUT_FCB_SELECT 101 /* GLUTselectFCB */
-#define GLUT_FCB_TIMER 102 /* GLUTtimerFCB */
-
-/* GLUT Fortran callback function types. */
-typedef void (GLUTCALLBACK *GLUTdisplayFCB) (void);
-typedef void (GLUTCALLBACK *GLUTreshapeFCB) (int *, int *);
-/* NOTE the pressed key is int, not unsigned char for Fortran! */
-typedef void (GLUTCALLBACK *GLUTkeyboardFCB) (int *, int *, int *);
-typedef void (GLUTCALLBACK *GLUTmouseFCB) (int *, int *, int *, int *);
-typedef void (GLUTCALLBACK *GLUTmotionFCB) (int *, int *);
-typedef void (GLUTCALLBACK *GLUTpassiveFCB) (int *, int *);
-typedef void (GLUTCALLBACK *GLUTentryFCB) (int *);
-typedef void (GLUTCALLBACK *GLUTwindowStatusFCB) (int *);
-typedef void (GLUTCALLBACK *GLUTvisibilityFCB) (int *);
-typedef void (GLUTCALLBACK *GLUTspecialFCB) (int *, int *, int *);
-typedef void (GLUTCALLBACK *GLUTbuttonBoxFCB) (int *, int *);
-typedef void (GLUTCALLBACK *GLUTdialsFCB) (int *, int *);
-typedef void (GLUTCALLBACK *GLUTspaceMotionFCB) (int *, int *, int *);
-typedef void (GLUTCALLBACK *GLUTspaceRotateFCB) (int *, int *, int *);
-typedef void (GLUTCALLBACK *GLUTspaceButtonFCB) (int *, int *);
-typedef void (GLUTCALLBACK *GLUTtabletMotionFCB) (int *, int *);
-typedef void (GLUTCALLBACK *GLUTtabletButtonFCB) (int *, int *, int *, int *);
-typedef void (GLUTCALLBACK *GLUTjoystickFCB) (unsigned int *buttonMask, int *x, int *y, int *z);
-
-typedef void (GLUTCALLBACK *GLUTselectFCB) (int *);
-typedef void (GLUTCALLBACK *GLUTtimerFCB) (int *);
-typedef void (GLUTCALLBACK *GLUTmenuStateFCB) (int *); /* DEPRICATED. */
-typedef void (GLUTCALLBACK *GLUTmenuStatusFCB) (int *, int *, int *);
-typedef void (GLUTCALLBACK *GLUTidleFCB) (void);
-
-/* Functions that set and return Fortran callback functions. */
-GLUTAPI GLUTproc APIENTRY __glutGetFCB(int which);
-GLUTAPI void APIENTRY __glutSetFCB(int which, GLUTproc func);
-
-#endif /* __glutf90_h__ */
diff --git a/mesalib/src/SConscript b/mesalib/src/SConscript
index fecdd9870..0f15415a5 100644
--- a/mesalib/src/SConscript
+++ b/mesalib/src/SConscript
@@ -25,7 +25,6 @@ if env['platform'] != 'embedded':
SConscript('glx/SConscript')
SConscript('egl/main/SConscript')
SConscript('glu/sgi/SConscript')
- SConscript('glut/glx/SConscript')
if env['gles']:
SConscript('mapi/shared-glapi/SConscript')
diff --git a/mesalib/src/gallium/auxiliary/util/u_video.h b/mesalib/src/gallium/auxiliary/util/u_video.h
index 46da13610..6b67881e6 100644
--- a/mesalib/src/gallium/auxiliary/util/u_video.h
+++ b/mesalib/src/gallium/auxiliary/util/u_video.h
@@ -33,6 +33,7 @@ extern "C" {
#endif
#include <pipe/p_defines.h>
+#include <pipe/p_video_enums.h>
/* u_reduce_video_profile() needs these */
#include <pipe/p_compiler.h>
diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c
index 31faaebd4..07b678373 100644
--- a/mesalib/src/mesa/main/bufferobj.c
+++ b/mesalib/src/mesa/main/bufferobj.c
@@ -1,1918 +1,1917 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.6
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file bufferobj.c
- * \brief Functions for the GL_ARB_vertex/pixel_buffer_object extensions.
- * \author Brian Paul, Ian Romanick
- */
-
-
-#include "glheader.h"
-#include "enums.h"
-#include "hash.h"
-#include "imports.h"
-#include "image.h"
-#include "context.h"
-#include "bufferobj.h"
-#include "fbobject.h"
-#include "mfeatures.h"
-#include "mtypes.h"
-#include "texobj.h"
-
-
-/* Debug flags */
-/*#define VBO_DEBUG*/
-/*#define BOUNDS_CHECK*/
-
-
-#if FEATURE_OES_mapbuffer
-#define DEFAULT_ACCESS GL_MAP_WRITE_BIT
-#else
-#define DEFAULT_ACCESS (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)
-#endif
-
-
-/**
- * Used as a placeholder for buffer objects between glGenBuffers() and
- * glBindBuffer() so that glIsBuffer() can work correctly.
- */
-static struct gl_buffer_object DummyBufferObject;
-
-
-/**
- * Return pointer to address of a buffer object target.
- * \param ctx the GL context
- * \param target the buffer object target to be retrieved.
- * \return pointer to pointer to the buffer object bound to \c target in the
- * specified context or \c NULL if \c target is invalid.
- */
-static INLINE struct gl_buffer_object **
-get_buffer_target(struct gl_context *ctx, GLenum target)
-{
- switch (target) {
- case GL_ARRAY_BUFFER_ARB:
- return &ctx->Array.ArrayBufferObj;
- case GL_ELEMENT_ARRAY_BUFFER_ARB:
- return &ctx->Array.ElementArrayBufferObj;
- case GL_PIXEL_PACK_BUFFER_EXT:
- return &ctx->Pack.BufferObj;
- case GL_PIXEL_UNPACK_BUFFER_EXT:
- return &ctx->Unpack.BufferObj;
- case GL_COPY_READ_BUFFER:
- return &ctx->CopyReadBuffer;
- case GL_COPY_WRITE_BUFFER:
- return &ctx->CopyWriteBuffer;
-#if FEATURE_EXT_transform_feedback
- case GL_TRANSFORM_FEEDBACK_BUFFER:
- if (ctx->Extensions.EXT_transform_feedback) {
- return &ctx->TransformFeedback.CurrentBuffer;
- }
- break;
-#endif
- case GL_TEXTURE_BUFFER:
- if (ctx->Extensions.ARB_texture_buffer_object) {
- return &ctx->Texture.BufferObject;
- }
- break;
- default:
- return NULL;
- }
- return NULL;
-}
-
-
-/**
- * Get the buffer object bound to the specified target in a GL context.
- * \param ctx the GL context
- * \param target the buffer object target to be retrieved.
- * \return pointer to the buffer object bound to \c target in the
- * specified context or \c NULL if \c target is invalid.
- */
-static INLINE struct gl_buffer_object *
-get_buffer(struct gl_context *ctx, GLenum target)
-{
- struct gl_buffer_object **bufObj = get_buffer_target(ctx, target);
- if (bufObj)
- return *bufObj;
- return NULL;
-}
-
-
-/**
- * Convert a GLbitfield describing the mapped buffer access flags
- * into one of GL_READ_WRITE, GL_READ_ONLY, or GL_WRITE_ONLY.
- */
-static GLenum
-simplified_access_mode(GLbitfield access)
-{
- const GLbitfield rwFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
- if ((access & rwFlags) == rwFlags)
- return GL_READ_WRITE;
- if ((access & GL_MAP_READ_BIT) == GL_MAP_READ_BIT)
- return GL_READ_ONLY;
- if ((access & GL_MAP_WRITE_BIT) == GL_MAP_WRITE_BIT)
- return GL_WRITE_ONLY;
- return GL_READ_WRITE; /* this should never happen, but no big deal */
-}
-
-
-/**
- * Tests the subdata range parameters and sets the GL error code for
- * \c glBufferSubDataARB and \c glGetBufferSubDataARB.
- *
- * \param ctx GL context.
- * \param target Buffer object target on which to operate.
- * \param offset Offset of the first byte of the subdata range.
- * \param size Size, in bytes, of the subdata range.
- * \param caller Name of calling function for recording errors.
- * \return A pointer to the buffer object bound to \c target in the
- * specified context or \c NULL if any of the parameter or state
- * conditions for \c glBufferSubDataARB or \c glGetBufferSubDataARB
- * are invalid.
- *
- * \sa glBufferSubDataARB, glGetBufferSubDataARB
- */
-static struct gl_buffer_object *
-buffer_object_subdata_range_good( struct gl_context * ctx, GLenum target,
- GLintptrARB offset, GLsizeiptrARB size,
- const char *caller )
-{
- struct gl_buffer_object *bufObj;
-
- if (size < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", caller);
- return NULL;
- }
-
- if (offset < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset < 0)", caller);
- return NULL;
- }
-
- bufObj = get_buffer(ctx, target);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", caller);
- return NULL;
- }
- if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
- return NULL;
- }
- if (offset + size > bufObj->Size) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "%s(size + offset > buffer size)", caller);
- return NULL;
- }
- if (_mesa_bufferobj_mapped(bufObj)) {
- /* Buffer is currently mapped */
- _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
- return NULL;
- }
-
- return bufObj;
-}
-
-
-/**
- * Allocate and initialize a new buffer object.
- *
- * Default callback for the \c dd_function_table::NewBufferObject() hook.
- */
-struct gl_buffer_object *
-_mesa_new_buffer_object( struct gl_context *ctx, GLuint name, GLenum target )
-{
- struct gl_buffer_object *obj;
-
- (void) ctx;
-
- obj = MALLOC_STRUCT(gl_buffer_object);
- _mesa_initialize_buffer_object(obj, name, target);
- return obj;
-}
-
-
-/**
- * Delete a buffer object.
- *
- * Default callback for the \c dd_function_table::DeleteBuffer() hook.
- */
-void
-_mesa_delete_buffer_object(struct gl_context *ctx,
- struct gl_buffer_object *bufObj)
-{
- (void) ctx;
-
- if (bufObj->Data)
- free(bufObj->Data);
-
- /* assign strange values here to help w/ debugging */
- bufObj->RefCount = -1000;
- bufObj->Name = ~0;
-
- _glthread_DESTROY_MUTEX(bufObj->Mutex);
- free(bufObj);
-}
-
-
-
-/**
- * Set ptr to bufObj w/ reference counting.
- */
-void
-_mesa_reference_buffer_object(struct gl_context *ctx,
- struct gl_buffer_object **ptr,
- struct gl_buffer_object *bufObj)
-{
- if (*ptr == bufObj)
- return;
-
- if (*ptr) {
- /* Unreference the old buffer */
- GLboolean deleteFlag = GL_FALSE;
- struct gl_buffer_object *oldObj = *ptr;
-
- _glthread_LOCK_MUTEX(oldObj->Mutex);
- ASSERT(oldObj->RefCount > 0);
- oldObj->RefCount--;
-#if 0
- printf("BufferObj %p %d DECR to %d\n",
- (void *) oldObj, oldObj->Name, oldObj->RefCount);
-#endif
- deleteFlag = (oldObj->RefCount == 0);
- _glthread_UNLOCK_MUTEX(oldObj->Mutex);
-
- if (deleteFlag) {
-
- /* some sanity checking: don't delete a buffer still in use */
-#if 0
- /* unfortunately, these tests are invalid during context tear-down */
- ASSERT(ctx->Array.ArrayBufferObj != bufObj);
- ASSERT(ctx->Array.ElementArrayBufferObj != bufObj);
- ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj);
-#endif
-
- ASSERT(ctx->Driver.DeleteBuffer);
- ctx->Driver.DeleteBuffer(ctx, oldObj);
- }
-
- *ptr = NULL;
- }
- ASSERT(!*ptr);
-
- if (bufObj) {
- /* reference new buffer */
- _glthread_LOCK_MUTEX(bufObj->Mutex);
- if (bufObj->RefCount == 0) {
- /* this buffer's being deleted (look just above) */
- /* Not sure this can every really happen. Warn if it does. */
- _mesa_problem(NULL, "referencing deleted buffer object");
- *ptr = NULL;
- }
- else {
- bufObj->RefCount++;
-#if 0
- printf("BufferObj %p %d INCR to %d\n",
- (void *) bufObj, bufObj->Name, bufObj->RefCount);
-#endif
- *ptr = bufObj;
- }
- _glthread_UNLOCK_MUTEX(bufObj->Mutex);
- }
-}
-
-
-/**
- * Initialize a buffer object to default values.
- */
-void
-_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
- GLuint name, GLenum target )
-{
- (void) target;
-
- memset(obj, 0, sizeof(struct gl_buffer_object));
- _glthread_INIT_MUTEX(obj->Mutex);
- obj->RefCount = 1;
- obj->Name = name;
- obj->Usage = GL_STATIC_DRAW_ARB;
- obj->AccessFlags = DEFAULT_ACCESS;
-}
-
-
-/**
- * Allocate space for and store data in a buffer object. Any data that was
- * previously stored in the buffer object is lost. If \c data is \c NULL,
- * memory will be allocated, but no copy will occur.
- *
- * This is the default callback for \c dd_function_table::BufferData()
- * Note that all GL error checking will have been done already.
- *
- * \param ctx GL context.
- * \param target Buffer object target on which to operate.
- * \param size Size, in bytes, of the new data store.
- * \param data Pointer to the data to store in the buffer object. This
- * pointer may be \c NULL.
- * \param usage Hints about how the data will be used.
- * \param bufObj Object to be used.
- *
- * \return GL_TRUE for success, GL_FALSE for failure
- * \sa glBufferDataARB, dd_function_table::BufferData.
- */
-GLboolean
-_mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
- const GLvoid * data, GLenum usage,
- struct gl_buffer_object * bufObj )
-{
- void * new_data;
-
- (void) ctx; (void) target;
-
- new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
- if (new_data) {
- bufObj->Data = (GLubyte *) new_data;
- bufObj->Size = size;
- bufObj->Usage = usage;
-
- if (data) {
- memcpy( bufObj->Data, data, size );
- }
-
- return GL_TRUE;
- }
- else {
- return GL_FALSE;
- }
-}
-
-
-/**
- * Replace data in a subrange of buffer object. If the data range
- * specified by \c size + \c offset extends beyond the end of the buffer or
- * if \c data is \c NULL, no copy is performed.
- *
- * This is the default callback for \c dd_function_table::BufferSubData()
- * Note that all GL error checking will have been done already.
- *
- * \param ctx GL context.
- * \param target Buffer object target on which to operate.
- * \param offset Offset of the first byte to be modified.
- * \param size Size, in bytes, of the data range.
- * \param data Pointer to the data to store in the buffer object.
- * \param bufObj Object to be used.
- *
- * \sa glBufferSubDataARB, dd_function_table::BufferSubData.
- */
-void
-_mesa_buffer_subdata( struct gl_context *ctx, GLenum target, GLintptrARB offset,
- GLsizeiptrARB size, const GLvoid * data,
- struct gl_buffer_object * bufObj )
-{
- (void) ctx; (void) target;
-
- /* this should have been caught in _mesa_BufferSubData() */
- ASSERT(size + offset <= bufObj->Size);
-
- if (bufObj->Data) {
- memcpy( (GLubyte *) bufObj->Data + offset, data, size );
- }
-}
-
-
-/**
- * Retrieve data from a subrange of buffer object. If the data range
- * specified by \c size + \c offset extends beyond the end of the buffer or
- * if \c data is \c NULL, no copy is performed.
- *
- * This is the default callback for \c dd_function_table::GetBufferSubData()
- * Note that all GL error checking will have been done already.
- *
- * \param ctx GL context.
- * \param target Buffer object target on which to operate.
- * \param offset Offset of the first byte to be fetched.
- * \param size Size, in bytes, of the data range.
- * \param data Destination for data
- * \param bufObj Object to be used.
- *
- * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData.
- */
-void
-_mesa_buffer_get_subdata( struct gl_context *ctx,
- GLenum target, GLintptrARB offset,
- GLsizeiptrARB size, GLvoid * data,
- struct gl_buffer_object * bufObj )
-{
- (void) ctx; (void) target;
-
- if (bufObj->Data && ((GLsizeiptrARB) (size + offset) <= bufObj->Size)) {
- memcpy( data, (GLubyte *) bufObj->Data + offset, size );
- }
-}
-
-
-/**
- * Default callback for \c dd_function_tabel::MapBuffer().
- *
- * The function parameters will have been already tested for errors.
- *
- * \param ctx GL context.
- * \param target Buffer object target on which to operate.
- * \param access Information about how the buffer will be accessed.
- * \param bufObj Object to be mapped.
- * \return A pointer to the object's internal data store that can be accessed
- * by the processor
- *
- * \sa glMapBufferARB, dd_function_table::MapBuffer
- */
-void *
-_mesa_buffer_map( struct gl_context *ctx, GLenum target, GLenum access,
- struct gl_buffer_object *bufObj )
-{
- (void) ctx;
- (void) target;
- (void) access;
- /* Just return a direct pointer to the data */
- if (_mesa_bufferobj_mapped(bufObj)) {
- /* already mapped! */
- return NULL;
- }
- bufObj->Pointer = bufObj->Data;
- bufObj->Length = bufObj->Size;
- bufObj->Offset = 0;
- return bufObj->Pointer;
-}
-
-
-/**
- * Default fallback for \c dd_function_table::MapBufferRange().
- * Called via glMapBufferRange().
- */
-static void *
-_mesa_buffer_map_range( struct gl_context *ctx, GLenum target, GLintptr offset,
- GLsizeiptr length, GLbitfield access,
- struct gl_buffer_object *bufObj )
-{
- (void) ctx;
- (void) target;
- assert(!_mesa_bufferobj_mapped(bufObj));
- /* Just return a direct pointer to the data */
- bufObj->Pointer = bufObj->Data + offset;
- bufObj->Length = length;
- bufObj->Offset = offset;
- bufObj->AccessFlags = access;
- return bufObj->Pointer;
-}
-
-
-/**
- * Default fallback for \c dd_function_table::FlushMappedBufferRange().
- * Called via glFlushMappedBufferRange().
- */
-static void
-_mesa_buffer_flush_mapped_range( struct gl_context *ctx, GLenum target,
- GLintptr offset, GLsizeiptr length,
- struct gl_buffer_object *obj )
-{
- (void) ctx;
- (void) target;
- (void) offset;
- (void) length;
- (void) obj;
- /* no-op */
-}
-
-
-/**
- * Default callback for \c dd_function_table::MapBuffer().
- *
- * The input parameters will have been already tested for errors.
- *
- * \sa glUnmapBufferARB, dd_function_table::UnmapBuffer
- */
-GLboolean
-_mesa_buffer_unmap( struct gl_context *ctx, GLenum target,
- struct gl_buffer_object *bufObj )
-{
- (void) ctx;
- (void) target;
- /* XXX we might assert here that bufObj->Pointer is non-null */
- bufObj->Pointer = NULL;
- bufObj->Length = 0;
- bufObj->Offset = 0;
- bufObj->AccessFlags = 0x0;
- return GL_TRUE;
-}
-
-
-/**
- * Default fallback for \c dd_function_table::CopyBufferSubData().
- * Called via glCopyBuffserSubData().
- */
-static void
-_mesa_copy_buffer_subdata(struct gl_context *ctx,
- struct gl_buffer_object *src,
- struct gl_buffer_object *dst,
- GLintptr readOffset, GLintptr writeOffset,
- GLsizeiptr size)
-{
- GLubyte *srcPtr, *dstPtr;
-
- /* buffer should not already be mapped */
- assert(!_mesa_bufferobj_mapped(src));
- assert(!_mesa_bufferobj_mapped(dst));
-
- srcPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_COPY_READ_BUFFER,
- GL_READ_ONLY, src);
- dstPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_COPY_WRITE_BUFFER,
- GL_WRITE_ONLY, dst);
-
- if (srcPtr && dstPtr)
- memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
-
- ctx->Driver.UnmapBuffer(ctx, GL_COPY_READ_BUFFER, src);
- ctx->Driver.UnmapBuffer(ctx, GL_COPY_WRITE_BUFFER, dst);
-}
-
-
-
-/**
- * Initialize the state associated with buffer objects
- */
-void
-_mesa_init_buffer_objects( struct gl_context *ctx )
-{
- memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
- _glthread_INIT_MUTEX(DummyBufferObject.Mutex);
- DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
-
- _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
- ctx->Shared->NullBufferObj);
- _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
- ctx->Shared->NullBufferObj);
-
- _mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer,
- ctx->Shared->NullBufferObj);
- _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer,
- ctx->Shared->NullBufferObj);
-}
-
-
-void
-_mesa_free_buffer_objects( struct gl_context *ctx )
-{
- _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
- _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL);
-
- _mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer, NULL);
- _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, NULL);
-}
-
-
-/**
- * Bind the specified target to buffer for the specified context.
- * Called by glBindBuffer() and other functions.
- */
-static void
-bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer)
-{
- struct gl_buffer_object *oldBufObj;
- struct gl_buffer_object *newBufObj = NULL;
- struct gl_buffer_object **bindTarget = NULL;
-
- bindTarget = get_buffer_target(ctx, target);
- if (!bindTarget) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)", target);
- return;
- }
-
- /* Get pointer to old buffer object (to be unbound) */
- oldBufObj = *bindTarget;
- if (oldBufObj && oldBufObj->Name == buffer)
- return; /* rebinding the same buffer object- no change */
-
- /*
- * Get pointer to new buffer object (newBufObj)
- */
- if (buffer == 0) {
- /* The spec says there's not a buffer object named 0, but we use
- * one internally because it simplifies things.
- */
- newBufObj = ctx->Shared->NullBufferObj;
- }
- else {
- /* non-default buffer object */
- newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
- if (!newBufObj || newBufObj == &DummyBufferObject) {
- /* If this is a new buffer object id, or one which was generated but
- * never used before, allocate a buffer object now.
- */
- ASSERT(ctx->Driver.NewBufferObject);
- newBufObj = ctx->Driver.NewBufferObject(ctx, buffer, target);
- if (!newBufObj) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB");
- return;
- }
- _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, newBufObj);
- }
- }
-
- /* bind new buffer */
- _mesa_reference_buffer_object(ctx, bindTarget, newBufObj);
-
- /* Pass BindBuffer call to device driver */
- if (ctx->Driver.BindBuffer)
- ctx->Driver.BindBuffer( ctx, target, newBufObj );
-}
-
-
-/**
- * Update the default buffer 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_buffer_objects(struct gl_context *ctx)
-{
- /* Bind the NullBufferObj to remove references to those
- * in the shared context hash table.
- */
- bind_buffer_object( ctx, GL_ARRAY_BUFFER_ARB, 0);
- bind_buffer_object( ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
- bind_buffer_object( ctx, GL_PIXEL_PACK_BUFFER_ARB, 0);
- bind_buffer_object( ctx, GL_PIXEL_UNPACK_BUFFER_ARB, 0);
-}
-
-
-
-/**
- * Return the gl_buffer_object for the given ID.
- * Always return NULL for ID 0.
- */
-struct gl_buffer_object *
-_mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer)
-{
- if (buffer == 0)
- return NULL;
- else
- return (struct gl_buffer_object *)
- _mesa_HashLookup(ctx->Shared->BufferObjects, buffer);
-}
-
-
-/**
- * If *ptr points to obj, set ptr = the Null/default buffer object.
- * This is a helper for buffer object deletion.
- * The GL spec says that deleting a buffer object causes it to get
- * unbound from all arrays in the current context.
- */
-static void
-unbind(struct gl_context *ctx,
- struct gl_buffer_object **ptr,
- struct gl_buffer_object *obj)
-{
- if (*ptr == obj) {
- _mesa_reference_buffer_object(ctx, ptr, ctx->Shared->NullBufferObj);
- }
-}
-
-
-/**
- * Plug default/fallback buffer object functions into the device
- * driver hooks.
- */
-void
-_mesa_init_buffer_object_functions(struct dd_function_table *driver)
-{
- /* GL_ARB_vertex/pixel_buffer_object */
- driver->NewBufferObject = _mesa_new_buffer_object;
- driver->DeleteBuffer = _mesa_delete_buffer_object;
- driver->BindBuffer = NULL;
- driver->BufferData = _mesa_buffer_data;
- driver->BufferSubData = _mesa_buffer_subdata;
- driver->GetBufferSubData = _mesa_buffer_get_subdata;
- driver->MapBuffer = _mesa_buffer_map;
- driver->UnmapBuffer = _mesa_buffer_unmap;
-
- /* GL_ARB_map_buffer_range */
- driver->MapBufferRange = _mesa_buffer_map_range;
- driver->FlushMappedBufferRange = _mesa_buffer_flush_mapped_range;
-
- /* GL_ARB_copy_buffer */
- driver->CopyBufferSubData = _mesa_copy_buffer_subdata;
-}
-
-
-
-/**********************************************************************/
-/* API Functions */
-/**********************************************************************/
-
-void GLAPIENTRY
-_mesa_BindBufferARB(GLenum target, GLuint buffer)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glBindBuffer(%s, %u)\n",
- _mesa_lookup_enum_by_nr(target), buffer);
-
- bind_buffer_object(ctx, target, buffer);
-}
-
-
-/**
- * Delete a set of buffer objects.
- *
- * \param n Number of buffer objects to delete.
- * \param ids Array of \c n buffer object IDs.
- */
-void GLAPIENTRY
-_mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLsizei i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
- FLUSH_VERTICES(ctx, 0);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteBuffersARB(n)");
- return;
- }
-
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
-
- for (i = 0; i < n; i++) {
- struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]);
- if (bufObj) {
- struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
- GLuint j;
-
- ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject);
-
- if (_mesa_bufferobj_mapped(bufObj)) {
- /* if mapped, unmap it now */
- ctx->Driver.UnmapBuffer(ctx, 0, bufObj);
- bufObj->AccessFlags = DEFAULT_ACCESS;
- bufObj->Pointer = NULL;
- }
-
- /* unbind any vertex pointers bound to this buffer */
- unbind(ctx, &arrayObj->Vertex.BufferObj, bufObj);
- unbind(ctx, &arrayObj->Weight.BufferObj, bufObj);
- unbind(ctx, &arrayObj->Normal.BufferObj, bufObj);
- unbind(ctx, &arrayObj->Color.BufferObj, bufObj);
- unbind(ctx, &arrayObj->SecondaryColor.BufferObj, bufObj);
- unbind(ctx, &arrayObj->FogCoord.BufferObj, bufObj);
- unbind(ctx, &arrayObj->Index.BufferObj, bufObj);
- unbind(ctx, &arrayObj->EdgeFlag.BufferObj, bufObj);
- for (j = 0; j < Elements(arrayObj->TexCoord); j++) {
- unbind(ctx, &arrayObj->TexCoord[j].BufferObj, bufObj);
- }
- for (j = 0; j < Elements(arrayObj->VertexAttrib); j++) {
- unbind(ctx, &arrayObj->VertexAttrib[j].BufferObj, bufObj);
- }
-
- if (ctx->Array.ArrayBufferObj == bufObj) {
- _mesa_BindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
- }
- if (ctx->Array.ElementArrayBufferObj == bufObj) {
- _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
- }
-
- /* unbind any pixel pack/unpack pointers bound to this buffer */
- if (ctx->Pack.BufferObj == bufObj) {
- _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 );
- }
- if (ctx->Unpack.BufferObj == bufObj) {
- _mesa_BindBufferARB( GL_PIXEL_UNPACK_BUFFER_EXT, 0 );
- }
-
- /* The ID is immediately freed for re-use */
- _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]);
- _mesa_reference_buffer_object(ctx, &bufObj, NULL);
- }
- }
-
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-}
-
-
-/**
- * Generate a set of unique buffer object IDs and store them in \c buffer.
- *
- * \param n Number of IDs to generate.
- * \param buffer Array of \c n locations to store the IDs.
- */
-void GLAPIENTRY
-_mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
-{
- GET_CURRENT_CONTEXT(ctx);
- GLuint first;
- GLint i;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glGenBuffers(%d)\n", n);
-
- if (n < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGenBuffersARB");
- return;
- }
-
- if (!buffer) {
- return;
- }
-
- /*
- * This must be atomic (generation and allocation of buffer object IDs)
- */
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
-
- first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
-
- /* Insert the ID and pointer to dummy buffer object into hash table */
- for (i = 0; i < n; i++) {
- _mesa_HashInsert(ctx->Shared->BufferObjects, first + i,
- &DummyBufferObject);
- buffer[i] = first + i;
- }
-
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-}
-
-
-/**
- * Determine if ID is the name of a buffer object.
- *
- * \param id ID of the potential buffer object.
- * \return \c GL_TRUE if \c id is the name of a buffer object,
- * \c GL_FALSE otherwise.
- */
-GLboolean GLAPIENTRY
-_mesa_IsBufferARB(GLuint id)
-{
- struct gl_buffer_object *bufObj;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
-
- _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
- bufObj = _mesa_lookup_bufferobj(ctx, id);
- _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
-
- return bufObj && bufObj != &DummyBufferObject;
-}
-
-
-void GLAPIENTRY
-_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
- const GLvoid * data, GLenum usage)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glBufferData(%s, %ld, %p, %s)\n",
- _mesa_lookup_enum_by_nr(target),
- (long int) size, data,
- _mesa_lookup_enum_by_nr(usage));
-
- if (size < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glBufferDataARB(size < 0)");
- return;
- }
-
- switch (usage) {
- case GL_STREAM_DRAW_ARB:
- case GL_STREAM_READ_ARB:
- case GL_STREAM_COPY_ARB:
- case GL_STATIC_DRAW_ARB:
- case GL_STATIC_READ_ARB:
- case GL_STATIC_COPY_ARB:
- case GL_DYNAMIC_DRAW_ARB:
- case GL_DYNAMIC_READ_ARB:
- case GL_DYNAMIC_COPY_ARB:
- /* OK */
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)");
- return;
- }
-
- bufObj = get_buffer(ctx, target);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(target)" );
- return;
- }
- if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer 0)" );
- return;
- }
-
- if (_mesa_bufferobj_mapped(bufObj)) {
- /* Unmap the existing buffer. We'll replace it now. Not an error. */
- ctx->Driver.UnmapBuffer(ctx, target, bufObj);
- bufObj->AccessFlags = DEFAULT_ACCESS;
- ASSERT(bufObj->Pointer == NULL);
- }
-
- FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT);
-
- bufObj->Written = GL_TRUE;
-
-#ifdef VBO_DEBUG
- printf("glBufferDataARB(%u, sz %ld, from %p, usage 0x%x)\n",
- bufObj->Name, size, data, usage);
-#endif
-
-#ifdef BOUNDS_CHECK
- size += 100;
-#endif
-
- ASSERT(ctx->Driver.BufferData);
- if (!ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj )) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB()");
- }
-}
-
-
-void GLAPIENTRY
-_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset,
- GLsizeiptrARB size, const GLvoid * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
- "glBufferSubDataARB" );
- if (!bufObj) {
- /* error already recorded */
- return;
- }
-
- if (size == 0)
- return;
-
- bufObj->Written = GL_TRUE;
-
- ASSERT(ctx->Driver.BufferSubData);
- ctx->Driver.BufferSubData( ctx, target, offset, size, data, bufObj );
-}
-
-
-void GLAPIENTRY
-_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset,
- GLsizeiptrARB size, void * data)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
- "glGetBufferSubDataARB" );
- if (!bufObj) {
- /* error already recorded */
- return;
- }
-
- ASSERT(ctx->Driver.GetBufferSubData);
- ctx->Driver.GetBufferSubData( ctx, target, offset, size, data, bufObj );
-}
-
-
-void * GLAPIENTRY
-_mesa_MapBufferARB(GLenum target, GLenum access)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object * bufObj;
- GLbitfield accessFlags;
- void *map;
-
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
-
- switch (access) {
- case GL_READ_ONLY_ARB:
- accessFlags = GL_MAP_READ_BIT;
- break;
- case GL_WRITE_ONLY_ARB:
- accessFlags = GL_MAP_WRITE_BIT;
- break;
- case GL_READ_WRITE_ARB:
- accessFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)");
- return NULL;
- }
-
- bufObj = get_buffer(ctx, target);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(target)" );
- return NULL;
- }
- if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB(buffer 0)" );
- return NULL;
- }
- if (_mesa_bufferobj_mapped(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB(already mapped)");
- return NULL;
- }
-
- ASSERT(ctx->Driver.MapBuffer);
- map = ctx->Driver.MapBuffer( ctx, target, access, bufObj );
- if (!map) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
- return NULL;
- }
- else {
- /* The driver callback should have set these fields.
- * This is important because other modules (like VBO) might call
- * the driver function directly.
- */
- ASSERT(bufObj->Pointer == map);
- ASSERT(bufObj->Length == bufObj->Size);
- ASSERT(bufObj->Offset == 0);
- bufObj->AccessFlags = accessFlags;
- }
-
- if (access == GL_WRITE_ONLY_ARB || access == GL_READ_WRITE_ARB)
- bufObj->Written = GL_TRUE;
-
-#ifdef VBO_DEBUG
- printf("glMapBufferARB(%u, sz %ld, access 0x%x)\n",
- bufObj->Name, bufObj->Size, access);
- if (access == GL_WRITE_ONLY_ARB) {
- GLuint i;
- GLubyte *b = (GLubyte *) bufObj->Pointer;
- for (i = 0; i < bufObj->Size; i++)
- b[i] = i & 0xff;
- }
-#endif
-
-#ifdef BOUNDS_CHECK
- {
- GLubyte *buf = (GLubyte *) bufObj->Pointer;
- GLuint i;
- /* buffer is 100 bytes larger than requested, fill with magic value */
- for (i = 0; i < 100; i++) {
- buf[bufObj->Size - i - 1] = 123;
- }
- }
-#endif
-
- return bufObj->Pointer;
-}
-
-
-GLboolean GLAPIENTRY
-_mesa_UnmapBufferARB(GLenum target)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *bufObj;
- GLboolean status = GL_TRUE;
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
-
- bufObj = get_buffer(ctx, target);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glUnmapBufferARB(target)" );
- return GL_FALSE;
- }
- if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB" );
- return GL_FALSE;
- }
- if (!_mesa_bufferobj_mapped(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB");
- return GL_FALSE;
- }
-
-#ifdef BOUNDS_CHECK
- if (bufObj->Access != GL_READ_ONLY_ARB) {
- GLubyte *buf = (GLubyte *) bufObj->Pointer;
- GLuint i;
- /* check that last 100 bytes are still = magic value */
- for (i = 0; i < 100; i++) {
- GLuint pos = bufObj->Size - i - 1;
- if (buf[pos] != 123) {
- _mesa_warning(ctx, "Out of bounds buffer object write detected"
- " at position %d (value = %u)\n",
- pos, buf[pos]);
- }
- }
- }
-#endif
-
-#ifdef VBO_DEBUG
- if (bufObj->AccessFlags & GL_MAP_WRITE_BIT) {
- GLuint i, unchanged = 0;
- GLubyte *b = (GLubyte *) bufObj->Pointer;
- GLint pos = -1;
- /* check which bytes changed */
- for (i = 0; i < bufObj->Size - 1; i++) {
- if (b[i] == (i & 0xff) && b[i+1] == ((i+1) & 0xff)) {
- unchanged++;
- if (pos == -1)
- pos = i;
- }
- }
- if (unchanged) {
- printf("glUnmapBufferARB(%u): %u of %ld unchanged, starting at %d\n",
- bufObj->Name, unchanged, bufObj->Size, pos);
- }
- }
-#endif
-
- status = ctx->Driver.UnmapBuffer( ctx, target, bufObj );
- bufObj->AccessFlags = DEFAULT_ACCESS;
- ASSERT(bufObj->Pointer == NULL);
- ASSERT(bufObj->Offset == 0);
- ASSERT(bufObj->Length == 0);
-
- return status;
-}
-
-
-void GLAPIENTRY
-_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- bufObj = get_buffer(ctx, target);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(target)" );
- return;
- }
- if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferParameterivARB" );
- return;
- }
-
- switch (pname) {
- case GL_BUFFER_SIZE_ARB:
- *params = (GLint) bufObj->Size;
- return;
- case GL_BUFFER_USAGE_ARB:
- *params = bufObj->Usage;
- return;
- case GL_BUFFER_ACCESS_ARB:
- *params = simplified_access_mode(bufObj->AccessFlags);
- return;
- case GL_BUFFER_MAPPED_ARB:
- *params = _mesa_bufferobj_mapped(bufObj);
- return;
- case GL_BUFFER_ACCESS_FLAGS:
- if (ctx->VersionMajor < 3)
- goto invalid_pname;
- *params = bufObj->AccessFlags;
- return;
- case GL_BUFFER_MAP_OFFSET:
- if (ctx->VersionMajor < 3)
- goto invalid_pname;
- *params = (GLint) bufObj->Offset;
- return;
- case GL_BUFFER_MAP_LENGTH:
- if (ctx->VersionMajor < 3)
- goto invalid_pname;
- *params = (GLint) bufObj->Length;
- return;
- default:
- ; /* fall-through */
- }
-
-invalid_pname:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname=%s)",
- _mesa_lookup_enum_by_nr(pname));
-}
-
-
-/**
- * New in GL 3.2
- * This is pretty much a duplicate of GetBufferParameteriv() but the
- * GL_BUFFER_SIZE_ARB attribute will be 64-bits on a 64-bit system.
- */
-void GLAPIENTRY
-_mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- bufObj = get_buffer(ctx, target);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(target)" );
- return;
- }
- if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferParameteri64v" );
- return;
- }
-
- switch (pname) {
- case GL_BUFFER_SIZE_ARB:
- *params = bufObj->Size;
- return;
- case GL_BUFFER_USAGE_ARB:
- *params = bufObj->Usage;
- return;
- case GL_BUFFER_ACCESS_ARB:
- *params = simplified_access_mode(bufObj->AccessFlags);
- return;
- case GL_BUFFER_ACCESS_FLAGS:
- if (ctx->VersionMajor < 3)
- goto invalid_pname;
- *params = bufObj->AccessFlags;
- return;
- case GL_BUFFER_MAPPED_ARB:
- *params = _mesa_bufferobj_mapped(bufObj);
- return;
- case GL_BUFFER_MAP_OFFSET:
- if (ctx->VersionMajor < 3)
- goto invalid_pname;
- *params = bufObj->Offset;
- return;
- case GL_BUFFER_MAP_LENGTH:
- if (ctx->VersionMajor < 3)
- goto invalid_pname;
- *params = bufObj->Length;
- return;
- default:
- ; /* fall-through */
- }
-
-invalid_pname:
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(pname=%s)",
- _mesa_lookup_enum_by_nr(pname));
-}
-
-
-void GLAPIENTRY
-_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object * bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (pname != GL_BUFFER_MAP_POINTER_ARB) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)");
- return;
- }
-
- bufObj = get_buffer(ctx, target);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(target)" );
- return;
- }
- if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferPointervARB" );
- return;
- }
-
- *params = bufObj->Pointer;
-}
-
-
-void GLAPIENTRY
-_mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
- GLintptr readOffset, GLintptr writeOffset,
- GLsizeiptr size)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *src, *dst;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- src = get_buffer(ctx, readTarget);
- if (!src || !_mesa_is_bufferobj(src)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glCopyBuffserSubData(readTarget = 0x%x)", readTarget);
- return;
- }
-
- dst = get_buffer(ctx, writeTarget);
- if (!dst || !_mesa_is_bufferobj(dst)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glCopyBuffserSubData(writeTarget = 0x%x)", writeTarget);
- return;
- }
-
- if (_mesa_bufferobj_mapped(src)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyBuffserSubData(readBuffer is mapped)");
- return;
- }
-
- if (_mesa_bufferobj_mapped(dst)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glCopyBuffserSubData(writeBuffer is mapped)");
- return;
- }
-
- if (readOffset < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyBuffserSubData(readOffset = %d)", (int) readOffset);
- return;
- }
-
- if (writeOffset < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyBuffserSubData(writeOffset = %d)", (int) writeOffset);
- return;
- }
-
- if (readOffset + size > src->Size) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyBuffserSubData(readOffset + size = %d)",
- (int) (readOffset + size));
- return;
- }
-
- if (writeOffset + size > dst->Size) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyBuffserSubData(writeOffset + size = %d)",
- (int) (writeOffset + size));
- return;
- }
-
- if (src == dst) {
- if (readOffset + size <= writeOffset) {
- /* OK */
- }
- else if (writeOffset + size <= readOffset) {
- /* OK */
- }
- else {
- /* overlapping src/dst is illegal */
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glCopyBuffserSubData(overlapping src/dst)");
- return;
- }
- }
-
- ctx->Driver.CopyBufferSubData(ctx, src, dst, readOffset, writeOffset, size);
-}
-
-
-/**
- * See GL_ARB_map_buffer_range spec
- */
-void * GLAPIENTRY
-_mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
- GLbitfield access)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *bufObj;
- void *map;
-
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
-
- if (!ctx->Extensions.ARB_map_buffer_range) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapBufferRange(extension not supported)");
- return NULL;
- }
-
- if (offset < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glMapBufferRange(offset = %ld)", (long)offset);
- return NULL;
- }
-
- if (length < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glMapBufferRange(length = %ld)", (long)length);
- return NULL;
- }
-
- if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapBufferRange(access indicates neither read or write)");
- return NULL;
- }
-
- if ((access & GL_MAP_READ_BIT) &&
- (access & (GL_MAP_INVALIDATE_RANGE_BIT |
- GL_MAP_INVALIDATE_BUFFER_BIT |
- GL_MAP_UNSYNCHRONIZED_BIT))) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapBufferRange(invalid access flags)");
- return NULL;
- }
-
- if ((access & GL_MAP_FLUSH_EXPLICIT_BIT) &&
- ((access & GL_MAP_WRITE_BIT) == 0)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapBufferRange(invalid access flags)");
- return NULL;
- }
-
- bufObj = get_buffer(ctx, target);
- if (!bufObj || !_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glMapBufferRange(target = 0x%x)", target);
- return NULL;
- }
-
- if (offset + length > bufObj->Size) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glMapBufferRange(offset + length > size)");
- return NULL;
- }
-
- if (_mesa_bufferobj_mapped(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapBufferRange(buffer already mapped)");
- return NULL;
- }
-
- ASSERT(ctx->Driver.MapBufferRange);
- map = ctx->Driver.MapBufferRange(ctx, target, offset, length,
- access, bufObj);
- if (!map) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
- }
- else {
- /* The driver callback should have set all these fields.
- * This is important because other modules (like VBO) might call
- * the driver function directly.
- */
- ASSERT(bufObj->Pointer == map);
- ASSERT(bufObj->Length == length);
- ASSERT(bufObj->Offset == offset);
- ASSERT(bufObj->AccessFlags == access);
- }
-
- return map;
-}
-
-
-/**
- * See GL_ARB_map_buffer_range spec
- */
-void GLAPIENTRY
-_mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- GET_CURRENT_CONTEXT(ctx);
- struct gl_buffer_object *bufObj;
- ASSERT_OUTSIDE_BEGIN_END(ctx);
-
- if (!ctx->Extensions.ARB_map_buffer_range) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapBufferRange(extension not supported)");
- return;
- }
-
- if (offset < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glMapBufferRange(offset = %ld)", (long)offset);
- return;
- }
-
- if (length < 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glMapBufferRange(length = %ld)", (long)length);
- return;
- }
-
- bufObj = get_buffer(ctx, target);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glMapBufferRange(target = 0x%x)", target);
- return;
- }
-
- if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapBufferRange(current buffer is 0)");
- return;
- }
-
- if (!_mesa_bufferobj_mapped(bufObj)) {
- /* buffer is not mapped */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapBufferRange(buffer is not mapped)");
- return;
- }
-
- if ((bufObj->AccessFlags & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glMapBufferRange(GL_MAP_FLUSH_EXPLICIT_BIT not set)");
- return;
- }
-
- if (offset + length > bufObj->Length) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glMapBufferRange(offset %ld + length %ld > mapped length %ld)",
- (long)offset, (long)length, (long)bufObj->Length);
- return;
- }
-
- ASSERT(bufObj->AccessFlags & GL_MAP_WRITE_BIT);
-
- if (ctx->Driver.FlushMappedBufferRange)
- ctx->Driver.FlushMappedBufferRange(ctx, target, offset, length, bufObj);
-}
-
-
-#if FEATURE_APPLE_object_purgeable
-static GLenum
-buffer_object_purgeable(struct gl_context *ctx, GLuint name, GLenum option)
-{
- struct gl_buffer_object *bufObj;
- GLenum retval;
-
- bufObj = _mesa_lookup_bufferobj(ctx, name);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectPurgeable(name = 0x%x)", name);
- return 0;
- }
- if (!_mesa_is_bufferobj(bufObj)) {
- _mesa_error(ctx, GL_INVALID_OPERATION, "glObjectPurgeable(buffer 0)" );
- return 0;
- }
-
- if (bufObj->Purgeable) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glObjectPurgeable(name = 0x%x) is already purgeable", name);
- return GL_VOLATILE_APPLE;
- }
-
- bufObj->Purgeable = GL_TRUE;
-
- retval = GL_VOLATILE_APPLE;
- if (ctx->Driver.BufferObjectPurgeable)
- retval = ctx->Driver.BufferObjectPurgeable(ctx, bufObj, option);
-
- return retval;
-}
-
-
-static GLenum
-renderbuffer_purgeable(struct gl_context *ctx, GLuint name, GLenum option)
-{
- struct gl_renderbuffer *bufObj;
- GLenum retval;
-
- bufObj = _mesa_lookup_renderbuffer(ctx, name);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectUnpurgeable(name = 0x%x)", name);
- return 0;
- }
-
- if (bufObj->Purgeable) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glObjectPurgeable(name = 0x%x) is already purgeable", name);
- return GL_VOLATILE_APPLE;
- }
-
- bufObj->Purgeable = GL_TRUE;
-
- retval = GL_VOLATILE_APPLE;
- if (ctx->Driver.RenderObjectPurgeable)
- retval = ctx->Driver.RenderObjectPurgeable(ctx, bufObj, option);
-
- return retval;
-}
-
-
-static GLenum
-texture_object_purgeable(struct gl_context *ctx, GLuint name, GLenum option)
-{
- struct gl_texture_object *bufObj;
- GLenum retval;
-
- bufObj = _mesa_lookup_texture(ctx, name);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectPurgeable(name = 0x%x)", name);
- return 0;
- }
-
- if (bufObj->Purgeable) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glObjectPurgeable(name = 0x%x) is already purgeable", name);
- return GL_VOLATILE_APPLE;
- }
-
- bufObj->Purgeable = GL_TRUE;
-
- retval = GL_VOLATILE_APPLE;
- if (ctx->Driver.TextureObjectPurgeable)
- retval = ctx->Driver.TextureObjectPurgeable(ctx, bufObj, option);
-
- return retval;
-}
-
-
-GLenum GLAPIENTRY
-_mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
-{
- GLenum retval;
-
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
-
- if (name == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectPurgeable(name = 0x%x)", name);
- return 0;
- }
-
- switch (option) {
- case GL_VOLATILE_APPLE:
- case GL_RELEASED_APPLE:
- /* legal */
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glObjectPurgeable(name = 0x%x) invalid option: %d",
- name, option);
- return 0;
- }
-
- switch (objectType) {
- case GL_TEXTURE:
- retval = texture_object_purgeable(ctx, name, option);
- break;
- case GL_RENDERBUFFER_EXT:
- retval = renderbuffer_purgeable(ctx, name, option);
- break;
- case GL_BUFFER_OBJECT_APPLE:
- retval = buffer_object_purgeable(ctx, name, option);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glObjectPurgeable(name = 0x%x) invalid type: %d",
- name, objectType);
- return 0;
- }
-
- /* In strict conformance to the spec, we must only return VOLATILE when
- * when passed the VOLATILE option. Madness.
- *
- * XXX First fix the spec, then fix me.
- */
- return option == GL_VOLATILE_APPLE ? GL_VOLATILE_APPLE : retval;
-}
-
-
-static GLenum
-buffer_object_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
-{
- struct gl_buffer_object *bufObj;
- GLenum retval;
-
- bufObj = _mesa_lookup_bufferobj(ctx, name);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectUnpurgeable(name = 0x%x)", name);
- return 0;
- }
-
- if (! bufObj->Purgeable) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glObjectUnpurgeable(name = 0x%x) object is "
- " already \"unpurged\"", name);
- return 0;
- }
-
- bufObj->Purgeable = GL_FALSE;
-
- retval = option;
- if (ctx->Driver.BufferObjectUnpurgeable)
- retval = ctx->Driver.BufferObjectUnpurgeable(ctx, bufObj, option);
-
- return retval;
-}
-
-
-static GLenum
-renderbuffer_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
-{
- struct gl_renderbuffer *bufObj;
- GLenum retval;
-
- bufObj = _mesa_lookup_renderbuffer(ctx, name);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectUnpurgeable(name = 0x%x)", name);
- return 0;
- }
-
- if (! bufObj->Purgeable) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glObjectUnpurgeable(name = 0x%x) object is "
- " already \"unpurged\"", name);
- return 0;
- }
-
- bufObj->Purgeable = GL_FALSE;
-
- retval = option;
- if (ctx->Driver.RenderObjectUnpurgeable)
- retval = ctx->Driver.RenderObjectUnpurgeable(ctx, bufObj, option);
-
- return retval;
-}
-
-
-static GLenum
-texture_object_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
-{
- struct gl_texture_object *bufObj;
- GLenum retval;
-
- bufObj = _mesa_lookup_texture(ctx, name);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectUnpurgeable(name = 0x%x)", name);
- return 0;
- }
-
- if (! bufObj->Purgeable) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glObjectUnpurgeable(name = 0x%x) object is"
- " already \"unpurged\"", name);
- return 0;
- }
-
- bufObj->Purgeable = GL_FALSE;
-
- retval = option;
- if (ctx->Driver.TextureObjectUnpurgeable)
- retval = ctx->Driver.TextureObjectUnpurgeable(ctx, bufObj, option);
-
- return retval;
-}
-
-
-GLenum GLAPIENTRY
-_mesa_ObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
-{
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
-
- if (name == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectUnpurgeable(name = 0x%x)", name);
- return 0;
- }
-
- switch (option) {
- case GL_RETAINED_APPLE:
- case GL_UNDEFINED_APPLE:
- /* legal */
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glObjectUnpurgeable(name = 0x%x) invalid option: %d",
- name, option);
- return 0;
- }
-
- switch (objectType) {
- case GL_BUFFER_OBJECT_APPLE:
- return buffer_object_unpurgeable(ctx, name, option);
- case GL_TEXTURE:
- return texture_object_unpurgeable(ctx, name, option);
- case GL_RENDERBUFFER_EXT:
- return renderbuffer_unpurgeable(ctx, name, option);
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glObjectUnpurgeable(name = 0x%x) invalid type: %d",
- name, objectType);
- return 0;
- }
-}
-
-
-static void
-get_buffer_object_parameteriv(struct gl_context *ctx, GLuint name,
- GLenum pname, GLint *params)
-{
- struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, name);
- if (!bufObj) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glGetObjectParameteriv(name = 0x%x) invalid object", name);
- return;
- }
-
- switch (pname) {
- case GL_PURGEABLE_APPLE:
- *params = bufObj->Purgeable;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetObjectParameteriv(name = 0x%x) invalid enum: %d",
- name, pname);
- break;
- }
-}
-
-
-static void
-get_renderbuffer_parameteriv(struct gl_context *ctx, GLuint name,
- GLenum pname, GLint *params)
-{
- struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, name);
- if (!rb) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectUnpurgeable(name = 0x%x)", name);
- return;
- }
-
- switch (pname) {
- case GL_PURGEABLE_APPLE:
- *params = rb->Purgeable;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetObjectParameteriv(name = 0x%x) invalid enum: %d",
- name, pname);
- break;
- }
-}
-
-
-static void
-get_texture_object_parameteriv(struct gl_context *ctx, GLuint name,
- GLenum pname, GLint *params)
-{
- struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name);
- if (!texObj) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glObjectUnpurgeable(name = 0x%x)", name);
- return;
- }
-
- switch (pname) {
- case GL_PURGEABLE_APPLE:
- *params = texObj->Purgeable;
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetObjectParameteriv(name = 0x%x) invalid enum: %d",
- name, pname);
- break;
- }
-}
-
-
-void GLAPIENTRY
-_mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname,
- GLint *params)
-{
- GET_CURRENT_CONTEXT(ctx);
-
- if (name == 0) {
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glGetObjectParameteriv(name = 0x%x)", name);
- return;
- }
-
- switch (objectType) {
- case GL_TEXTURE:
- get_texture_object_parameteriv(ctx, name, pname, params);
- break;
- case GL_BUFFER_OBJECT_APPLE:
- get_buffer_object_parameteriv(ctx, name, pname, params);
- break;
- case GL_RENDERBUFFER_EXT:
- get_renderbuffer_parameteriv(ctx, name, pname, params);
- break;
- default:
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glGetObjectParameteriv(name = 0x%x) invalid type: %d",
- name, objectType);
- }
-}
-
-#endif /* FEATURE_APPLE_object_purgeable */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.6
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file bufferobj.c
+ * \brief Functions for the GL_ARB_vertex/pixel_buffer_object extensions.
+ * \author Brian Paul, Ian Romanick
+ */
+
+
+#include "glheader.h"
+#include "enums.h"
+#include "hash.h"
+#include "imports.h"
+#include "image.h"
+#include "context.h"
+#include "bufferobj.h"
+#include "fbobject.h"
+#include "mfeatures.h"
+#include "mtypes.h"
+#include "texobj.h"
+
+
+/* Debug flags */
+/*#define VBO_DEBUG*/
+/*#define BOUNDS_CHECK*/
+
+
+#if FEATURE_OES_mapbuffer
+#define DEFAULT_ACCESS GL_MAP_WRITE_BIT
+#else
+#define DEFAULT_ACCESS (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)
+#endif
+
+
+/**
+ * Used as a placeholder for buffer objects between glGenBuffers() and
+ * glBindBuffer() so that glIsBuffer() can work correctly.
+ */
+static struct gl_buffer_object DummyBufferObject;
+
+
+/**
+ * Return pointer to address of a buffer object target.
+ * \param ctx the GL context
+ * \param target the buffer object target to be retrieved.
+ * \return pointer to pointer to the buffer object bound to \c target in the
+ * specified context or \c NULL if \c target is invalid.
+ */
+static INLINE struct gl_buffer_object **
+get_buffer_target(struct gl_context *ctx, GLenum target)
+{
+ switch (target) {
+ case GL_ARRAY_BUFFER_ARB:
+ return &ctx->Array.ArrayBufferObj;
+ case GL_ELEMENT_ARRAY_BUFFER_ARB:
+ return &ctx->Array.ElementArrayBufferObj;
+ case GL_PIXEL_PACK_BUFFER_EXT:
+ return &ctx->Pack.BufferObj;
+ case GL_PIXEL_UNPACK_BUFFER_EXT:
+ return &ctx->Unpack.BufferObj;
+ case GL_COPY_READ_BUFFER:
+ return &ctx->CopyReadBuffer;
+ case GL_COPY_WRITE_BUFFER:
+ return &ctx->CopyWriteBuffer;
+#if FEATURE_EXT_transform_feedback
+ case GL_TRANSFORM_FEEDBACK_BUFFER:
+ if (ctx->Extensions.EXT_transform_feedback) {
+ return &ctx->TransformFeedback.CurrentBuffer;
+ }
+ break;
+#endif
+ case GL_TEXTURE_BUFFER:
+ if (ctx->Extensions.ARB_texture_buffer_object) {
+ return &ctx->Texture.BufferObject;
+ }
+ break;
+ default:
+ return NULL;
+ }
+ return NULL;
+}
+
+
+/**
+ * Get the buffer object bound to the specified target in a GL context.
+ * \param ctx the GL context
+ * \param target the buffer object target to be retrieved.
+ * \return pointer to the buffer object bound to \c target in the
+ * specified context or \c NULL if \c target is invalid.
+ */
+static INLINE struct gl_buffer_object *
+get_buffer(struct gl_context *ctx, GLenum target)
+{
+ struct gl_buffer_object **bufObj = get_buffer_target(ctx, target);
+ if (bufObj)
+ return *bufObj;
+ return NULL;
+}
+
+
+/**
+ * Convert a GLbitfield describing the mapped buffer access flags
+ * into one of GL_READ_WRITE, GL_READ_ONLY, or GL_WRITE_ONLY.
+ */
+static GLenum
+simplified_access_mode(GLbitfield access)
+{
+ const GLbitfield rwFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
+ if ((access & rwFlags) == rwFlags)
+ return GL_READ_WRITE;
+ if ((access & GL_MAP_READ_BIT) == GL_MAP_READ_BIT)
+ return GL_READ_ONLY;
+ if ((access & GL_MAP_WRITE_BIT) == GL_MAP_WRITE_BIT)
+ return GL_WRITE_ONLY;
+ return GL_READ_WRITE; /* this should never happen, but no big deal */
+}
+
+
+/**
+ * Tests the subdata range parameters and sets the GL error code for
+ * \c glBufferSubDataARB and \c glGetBufferSubDataARB.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param offset Offset of the first byte of the subdata range.
+ * \param size Size, in bytes, of the subdata range.
+ * \param caller Name of calling function for recording errors.
+ * \return A pointer to the buffer object bound to \c target in the
+ * specified context or \c NULL if any of the parameter or state
+ * conditions for \c glBufferSubDataARB or \c glGetBufferSubDataARB
+ * are invalid.
+ *
+ * \sa glBufferSubDataARB, glGetBufferSubDataARB
+ */
+static struct gl_buffer_object *
+buffer_object_subdata_range_good( struct gl_context * ctx, GLenum target,
+ GLintptrARB offset, GLsizeiptrARB size,
+ const char *caller )
+{
+ struct gl_buffer_object *bufObj;
+
+ if (size < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(size < 0)", caller);
+ return NULL;
+ }
+
+ if (offset < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "%s(offset < 0)", caller);
+ return NULL;
+ }
+
+ bufObj = get_buffer(ctx, target);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(target)", caller);
+ return NULL;
+ }
+ if (!_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
+ return NULL;
+ }
+ if (offset + size > bufObj->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "%s(size + offset > buffer size)", caller);
+ return NULL;
+ }
+ if (_mesa_bufferobj_mapped(bufObj)) {
+ /* Buffer is currently mapped */
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s", caller);
+ return NULL;
+ }
+
+ return bufObj;
+}
+
+
+/**
+ * Allocate and initialize a new buffer object.
+ *
+ * Default callback for the \c dd_function_table::NewBufferObject() hook.
+ */
+struct gl_buffer_object *
+_mesa_new_buffer_object( struct gl_context *ctx, GLuint name, GLenum target )
+{
+ struct gl_buffer_object *obj;
+
+ (void) ctx;
+
+ obj = MALLOC_STRUCT(gl_buffer_object);
+ _mesa_initialize_buffer_object(obj, name, target);
+ return obj;
+}
+
+
+/**
+ * Delete a buffer object.
+ *
+ * Default callback for the \c dd_function_table::DeleteBuffer() hook.
+ */
+void
+_mesa_delete_buffer_object(struct gl_context *ctx,
+ struct gl_buffer_object *bufObj)
+{
+ (void) ctx;
+
+ if (bufObj->Data)
+ free(bufObj->Data);
+
+ /* assign strange values here to help w/ debugging */
+ bufObj->RefCount = -1000;
+ bufObj->Name = ~0;
+
+ _glthread_DESTROY_MUTEX(bufObj->Mutex);
+ free(bufObj);
+}
+
+
+
+/**
+ * Set ptr to bufObj w/ reference counting.
+ * This is normally only called from the _mesa_reference_buffer_object() macro
+ * when there's a real pointer change.
+ */
+void
+_mesa_reference_buffer_object_(struct gl_context *ctx,
+ struct gl_buffer_object **ptr,
+ struct gl_buffer_object *bufObj)
+{
+ if (*ptr) {
+ /* Unreference the old buffer */
+ GLboolean deleteFlag = GL_FALSE;
+ struct gl_buffer_object *oldObj = *ptr;
+
+ _glthread_LOCK_MUTEX(oldObj->Mutex);
+ ASSERT(oldObj->RefCount > 0);
+ oldObj->RefCount--;
+#if 0
+ printf("BufferObj %p %d DECR to %d\n",
+ (void *) oldObj, oldObj->Name, oldObj->RefCount);
+#endif
+ deleteFlag = (oldObj->RefCount == 0);
+ _glthread_UNLOCK_MUTEX(oldObj->Mutex);
+
+ if (deleteFlag) {
+
+ /* some sanity checking: don't delete a buffer still in use */
+#if 0
+ /* unfortunately, these tests are invalid during context tear-down */
+ ASSERT(ctx->Array.ArrayBufferObj != bufObj);
+ ASSERT(ctx->Array.ElementArrayBufferObj != bufObj);
+ ASSERT(ctx->Array.ArrayObj->Vertex.BufferObj != bufObj);
+#endif
+
+ ASSERT(ctx->Driver.DeleteBuffer);
+ ctx->Driver.DeleteBuffer(ctx, oldObj);
+ }
+
+ *ptr = NULL;
+ }
+ ASSERT(!*ptr);
+
+ if (bufObj) {
+ /* reference new buffer */
+ _glthread_LOCK_MUTEX(bufObj->Mutex);
+ if (bufObj->RefCount == 0) {
+ /* this buffer's being deleted (look just above) */
+ /* Not sure this can every really happen. Warn if it does. */
+ _mesa_problem(NULL, "referencing deleted buffer object");
+ *ptr = NULL;
+ }
+ else {
+ bufObj->RefCount++;
+#if 0
+ printf("BufferObj %p %d INCR to %d\n",
+ (void *) bufObj, bufObj->Name, bufObj->RefCount);
+#endif
+ *ptr = bufObj;
+ }
+ _glthread_UNLOCK_MUTEX(bufObj->Mutex);
+ }
+}
+
+
+/**
+ * Initialize a buffer object to default values.
+ */
+void
+_mesa_initialize_buffer_object( struct gl_buffer_object *obj,
+ GLuint name, GLenum target )
+{
+ (void) target;
+
+ memset(obj, 0, sizeof(struct gl_buffer_object));
+ _glthread_INIT_MUTEX(obj->Mutex);
+ obj->RefCount = 1;
+ obj->Name = name;
+ obj->Usage = GL_STATIC_DRAW_ARB;
+ obj->AccessFlags = DEFAULT_ACCESS;
+}
+
+
+/**
+ * Allocate space for and store data in a buffer object. Any data that was
+ * previously stored in the buffer object is lost. If \c data is \c NULL,
+ * memory will be allocated, but no copy will occur.
+ *
+ * This is the default callback for \c dd_function_table::BufferData()
+ * Note that all GL error checking will have been done already.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param size Size, in bytes, of the new data store.
+ * \param data Pointer to the data to store in the buffer object. This
+ * pointer may be \c NULL.
+ * \param usage Hints about how the data will be used.
+ * \param bufObj Object to be used.
+ *
+ * \return GL_TRUE for success, GL_FALSE for failure
+ * \sa glBufferDataARB, dd_function_table::BufferData.
+ */
+GLboolean
+_mesa_buffer_data( struct gl_context *ctx, GLenum target, GLsizeiptrARB size,
+ const GLvoid * data, GLenum usage,
+ struct gl_buffer_object * bufObj )
+{
+ void * new_data;
+
+ (void) ctx; (void) target;
+
+ new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
+ if (new_data) {
+ bufObj->Data = (GLubyte *) new_data;
+ bufObj->Size = size;
+ bufObj->Usage = usage;
+
+ if (data) {
+ memcpy( bufObj->Data, data, size );
+ }
+
+ return GL_TRUE;
+ }
+ else {
+ return GL_FALSE;
+ }
+}
+
+
+/**
+ * Replace data in a subrange of buffer object. If the data range
+ * specified by \c size + \c offset extends beyond the end of the buffer or
+ * if \c data is \c NULL, no copy is performed.
+ *
+ * This is the default callback for \c dd_function_table::BufferSubData()
+ * Note that all GL error checking will have been done already.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param offset Offset of the first byte to be modified.
+ * \param size Size, in bytes, of the data range.
+ * \param data Pointer to the data to store in the buffer object.
+ * \param bufObj Object to be used.
+ *
+ * \sa glBufferSubDataARB, dd_function_table::BufferSubData.
+ */
+void
+_mesa_buffer_subdata( struct gl_context *ctx, GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, const GLvoid * data,
+ struct gl_buffer_object * bufObj )
+{
+ (void) ctx; (void) target;
+
+ /* this should have been caught in _mesa_BufferSubData() */
+ ASSERT(size + offset <= bufObj->Size);
+
+ if (bufObj->Data) {
+ memcpy( (GLubyte *) bufObj->Data + offset, data, size );
+ }
+}
+
+
+/**
+ * Retrieve data from a subrange of buffer object. If the data range
+ * specified by \c size + \c offset extends beyond the end of the buffer or
+ * if \c data is \c NULL, no copy is performed.
+ *
+ * This is the default callback for \c dd_function_table::GetBufferSubData()
+ * Note that all GL error checking will have been done already.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param offset Offset of the first byte to be fetched.
+ * \param size Size, in bytes, of the data range.
+ * \param data Destination for data
+ * \param bufObj Object to be used.
+ *
+ * \sa glBufferGetSubDataARB, dd_function_table::GetBufferSubData.
+ */
+void
+_mesa_buffer_get_subdata( struct gl_context *ctx,
+ GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, GLvoid * data,
+ struct gl_buffer_object * bufObj )
+{
+ (void) ctx; (void) target;
+
+ if (bufObj->Data && ((GLsizeiptrARB) (size + offset) <= bufObj->Size)) {
+ memcpy( data, (GLubyte *) bufObj->Data + offset, size );
+ }
+}
+
+
+/**
+ * Default callback for \c dd_function_tabel::MapBuffer().
+ *
+ * The function parameters will have been already tested for errors.
+ *
+ * \param ctx GL context.
+ * \param target Buffer object target on which to operate.
+ * \param access Information about how the buffer will be accessed.
+ * \param bufObj Object to be mapped.
+ * \return A pointer to the object's internal data store that can be accessed
+ * by the processor
+ *
+ * \sa glMapBufferARB, dd_function_table::MapBuffer
+ */
+void *
+_mesa_buffer_map( struct gl_context *ctx, GLenum target, GLenum access,
+ struct gl_buffer_object *bufObj )
+{
+ (void) ctx;
+ (void) target;
+ (void) access;
+ /* Just return a direct pointer to the data */
+ if (_mesa_bufferobj_mapped(bufObj)) {
+ /* already mapped! */
+ return NULL;
+ }
+ bufObj->Pointer = bufObj->Data;
+ bufObj->Length = bufObj->Size;
+ bufObj->Offset = 0;
+ return bufObj->Pointer;
+}
+
+
+/**
+ * Default fallback for \c dd_function_table::MapBufferRange().
+ * Called via glMapBufferRange().
+ */
+static void *
+_mesa_buffer_map_range( struct gl_context *ctx, GLenum target, GLintptr offset,
+ GLsizeiptr length, GLbitfield access,
+ struct gl_buffer_object *bufObj )
+{
+ (void) ctx;
+ (void) target;
+ assert(!_mesa_bufferobj_mapped(bufObj));
+ /* Just return a direct pointer to the data */
+ bufObj->Pointer = bufObj->Data + offset;
+ bufObj->Length = length;
+ bufObj->Offset = offset;
+ bufObj->AccessFlags = access;
+ return bufObj->Pointer;
+}
+
+
+/**
+ * Default fallback for \c dd_function_table::FlushMappedBufferRange().
+ * Called via glFlushMappedBufferRange().
+ */
+static void
+_mesa_buffer_flush_mapped_range( struct gl_context *ctx, GLenum target,
+ GLintptr offset, GLsizeiptr length,
+ struct gl_buffer_object *obj )
+{
+ (void) ctx;
+ (void) target;
+ (void) offset;
+ (void) length;
+ (void) obj;
+ /* no-op */
+}
+
+
+/**
+ * Default callback for \c dd_function_table::MapBuffer().
+ *
+ * The input parameters will have been already tested for errors.
+ *
+ * \sa glUnmapBufferARB, dd_function_table::UnmapBuffer
+ */
+GLboolean
+_mesa_buffer_unmap( struct gl_context *ctx, GLenum target,
+ struct gl_buffer_object *bufObj )
+{
+ (void) ctx;
+ (void) target;
+ /* XXX we might assert here that bufObj->Pointer is non-null */
+ bufObj->Pointer = NULL;
+ bufObj->Length = 0;
+ bufObj->Offset = 0;
+ bufObj->AccessFlags = 0x0;
+ return GL_TRUE;
+}
+
+
+/**
+ * Default fallback for \c dd_function_table::CopyBufferSubData().
+ * Called via glCopyBuffserSubData().
+ */
+static void
+_mesa_copy_buffer_subdata(struct gl_context *ctx,
+ struct gl_buffer_object *src,
+ struct gl_buffer_object *dst,
+ GLintptr readOffset, GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ GLubyte *srcPtr, *dstPtr;
+
+ /* buffer should not already be mapped */
+ assert(!_mesa_bufferobj_mapped(src));
+ assert(!_mesa_bufferobj_mapped(dst));
+
+ srcPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_COPY_READ_BUFFER,
+ GL_READ_ONLY, src);
+ dstPtr = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_COPY_WRITE_BUFFER,
+ GL_WRITE_ONLY, dst);
+
+ if (srcPtr && dstPtr)
+ memcpy(dstPtr + writeOffset, srcPtr + readOffset, size);
+
+ ctx->Driver.UnmapBuffer(ctx, GL_COPY_READ_BUFFER, src);
+ ctx->Driver.UnmapBuffer(ctx, GL_COPY_WRITE_BUFFER, dst);
+}
+
+
+
+/**
+ * Initialize the state associated with buffer objects
+ */
+void
+_mesa_init_buffer_objects( struct gl_context *ctx )
+{
+ memset(&DummyBufferObject, 0, sizeof(DummyBufferObject));
+ _glthread_INIT_MUTEX(DummyBufferObject.Mutex);
+ DummyBufferObject.RefCount = 1000*1000*1000; /* never delete */
+
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj,
+ ctx->Shared->NullBufferObj);
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj,
+ ctx->Shared->NullBufferObj);
+
+ _mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer,
+ ctx->Shared->NullBufferObj);
+ _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer,
+ ctx->Shared->NullBufferObj);
+}
+
+
+void
+_mesa_free_buffer_objects( struct gl_context *ctx )
+{
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, NULL);
+ _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, NULL);
+
+ _mesa_reference_buffer_object(ctx, &ctx->CopyReadBuffer, NULL);
+ _mesa_reference_buffer_object(ctx, &ctx->CopyWriteBuffer, NULL);
+}
+
+
+/**
+ * Bind the specified target to buffer for the specified context.
+ * Called by glBindBuffer() and other functions.
+ */
+static void
+bind_buffer_object(struct gl_context *ctx, GLenum target, GLuint buffer)
+{
+ struct gl_buffer_object *oldBufObj;
+ struct gl_buffer_object *newBufObj = NULL;
+ struct gl_buffer_object **bindTarget = NULL;
+
+ bindTarget = get_buffer_target(ctx, target);
+ if (!bindTarget) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)", target);
+ return;
+ }
+
+ /* Get pointer to old buffer object (to be unbound) */
+ oldBufObj = *bindTarget;
+ if (oldBufObj && oldBufObj->Name == buffer)
+ return; /* rebinding the same buffer object- no change */
+
+ /*
+ * Get pointer to new buffer object (newBufObj)
+ */
+ if (buffer == 0) {
+ /* The spec says there's not a buffer object named 0, but we use
+ * one internally because it simplifies things.
+ */
+ newBufObj = ctx->Shared->NullBufferObj;
+ }
+ else {
+ /* non-default buffer object */
+ newBufObj = _mesa_lookup_bufferobj(ctx, buffer);
+ if (!newBufObj || newBufObj == &DummyBufferObject) {
+ /* If this is a new buffer object id, or one which was generated but
+ * never used before, allocate a buffer object now.
+ */
+ ASSERT(ctx->Driver.NewBufferObject);
+ newBufObj = ctx->Driver.NewBufferObject(ctx, buffer, target);
+ if (!newBufObj) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindBufferARB");
+ return;
+ }
+ _mesa_HashInsert(ctx->Shared->BufferObjects, buffer, newBufObj);
+ }
+ }
+
+ /* bind new buffer */
+ _mesa_reference_buffer_object(ctx, bindTarget, newBufObj);
+
+ /* Pass BindBuffer call to device driver */
+ if (ctx->Driver.BindBuffer)
+ ctx->Driver.BindBuffer( ctx, target, newBufObj );
+}
+
+
+/**
+ * Update the default buffer 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_buffer_objects(struct gl_context *ctx)
+{
+ /* Bind the NullBufferObj to remove references to those
+ * in the shared context hash table.
+ */
+ bind_buffer_object( ctx, GL_ARRAY_BUFFER_ARB, 0);
+ bind_buffer_object( ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
+ bind_buffer_object( ctx, GL_PIXEL_PACK_BUFFER_ARB, 0);
+ bind_buffer_object( ctx, GL_PIXEL_UNPACK_BUFFER_ARB, 0);
+}
+
+
+
+/**
+ * Return the gl_buffer_object for the given ID.
+ * Always return NULL for ID 0.
+ */
+struct gl_buffer_object *
+_mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer)
+{
+ if (buffer == 0)
+ return NULL;
+ else
+ return (struct gl_buffer_object *)
+ _mesa_HashLookup(ctx->Shared->BufferObjects, buffer);
+}
+
+
+/**
+ * If *ptr points to obj, set ptr = the Null/default buffer object.
+ * This is a helper for buffer object deletion.
+ * The GL spec says that deleting a buffer object causes it to get
+ * unbound from all arrays in the current context.
+ */
+static void
+unbind(struct gl_context *ctx,
+ struct gl_buffer_object **ptr,
+ struct gl_buffer_object *obj)
+{
+ if (*ptr == obj) {
+ _mesa_reference_buffer_object(ctx, ptr, ctx->Shared->NullBufferObj);
+ }
+}
+
+
+/**
+ * Plug default/fallback buffer object functions into the device
+ * driver hooks.
+ */
+void
+_mesa_init_buffer_object_functions(struct dd_function_table *driver)
+{
+ /* GL_ARB_vertex/pixel_buffer_object */
+ driver->NewBufferObject = _mesa_new_buffer_object;
+ driver->DeleteBuffer = _mesa_delete_buffer_object;
+ driver->BindBuffer = NULL;
+ driver->BufferData = _mesa_buffer_data;
+ driver->BufferSubData = _mesa_buffer_subdata;
+ driver->GetBufferSubData = _mesa_buffer_get_subdata;
+ driver->MapBuffer = _mesa_buffer_map;
+ driver->UnmapBuffer = _mesa_buffer_unmap;
+
+ /* GL_ARB_map_buffer_range */
+ driver->MapBufferRange = _mesa_buffer_map_range;
+ driver->FlushMappedBufferRange = _mesa_buffer_flush_mapped_range;
+
+ /* GL_ARB_copy_buffer */
+ driver->CopyBufferSubData = _mesa_copy_buffer_subdata;
+}
+
+
+
+/**********************************************************************/
+/* API Functions */
+/**********************************************************************/
+
+void GLAPIENTRY
+_mesa_BindBufferARB(GLenum target, GLuint buffer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glBindBuffer(%s, %u)\n",
+ _mesa_lookup_enum_by_nr(target), buffer);
+
+ bind_buffer_object(ctx, target, buffer);
+}
+
+
+/**
+ * Delete a set of buffer objects.
+ *
+ * \param n Number of buffer objects to delete.
+ * \param ids Array of \c n buffer object IDs.
+ */
+void GLAPIENTRY
+_mesa_DeleteBuffersARB(GLsizei n, const GLuint *ids)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLsizei i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+ FLUSH_VERTICES(ctx, 0);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteBuffersARB(n)");
+ return;
+ }
+
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+
+ for (i = 0; i < n; i++) {
+ struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, ids[i]);
+ if (bufObj) {
+ struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
+ GLuint j;
+
+ ASSERT(bufObj->Name == ids[i] || bufObj == &DummyBufferObject);
+
+ if (_mesa_bufferobj_mapped(bufObj)) {
+ /* if mapped, unmap it now */
+ ctx->Driver.UnmapBuffer(ctx, 0, bufObj);
+ bufObj->AccessFlags = DEFAULT_ACCESS;
+ bufObj->Pointer = NULL;
+ }
+
+ /* unbind any vertex pointers bound to this buffer */
+ unbind(ctx, &arrayObj->Vertex.BufferObj, bufObj);
+ unbind(ctx, &arrayObj->Weight.BufferObj, bufObj);
+ unbind(ctx, &arrayObj->Normal.BufferObj, bufObj);
+ unbind(ctx, &arrayObj->Color.BufferObj, bufObj);
+ unbind(ctx, &arrayObj->SecondaryColor.BufferObj, bufObj);
+ unbind(ctx, &arrayObj->FogCoord.BufferObj, bufObj);
+ unbind(ctx, &arrayObj->Index.BufferObj, bufObj);
+ unbind(ctx, &arrayObj->EdgeFlag.BufferObj, bufObj);
+ for (j = 0; j < Elements(arrayObj->TexCoord); j++) {
+ unbind(ctx, &arrayObj->TexCoord[j].BufferObj, bufObj);
+ }
+ for (j = 0; j < Elements(arrayObj->VertexAttrib); j++) {
+ unbind(ctx, &arrayObj->VertexAttrib[j].BufferObj, bufObj);
+ }
+
+ if (ctx->Array.ArrayBufferObj == bufObj) {
+ _mesa_BindBufferARB( GL_ARRAY_BUFFER_ARB, 0 );
+ }
+ if (ctx->Array.ElementArrayBufferObj == bufObj) {
+ _mesa_BindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, 0 );
+ }
+
+ /* unbind any pixel pack/unpack pointers bound to this buffer */
+ if (ctx->Pack.BufferObj == bufObj) {
+ _mesa_BindBufferARB( GL_PIXEL_PACK_BUFFER_EXT, 0 );
+ }
+ if (ctx->Unpack.BufferObj == bufObj) {
+ _mesa_BindBufferARB( GL_PIXEL_UNPACK_BUFFER_EXT, 0 );
+ }
+
+ /* The ID is immediately freed for re-use */
+ _mesa_HashRemove(ctx->Shared->BufferObjects, ids[i]);
+ _mesa_reference_buffer_object(ctx, &bufObj, NULL);
+ }
+ }
+
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+}
+
+
+/**
+ * Generate a set of unique buffer object IDs and store them in \c buffer.
+ *
+ * \param n Number of IDs to generate.
+ * \param buffer Array of \c n locations to store the IDs.
+ */
+void GLAPIENTRY
+_mesa_GenBuffersARB(GLsizei n, GLuint *buffer)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ GLuint first;
+ GLint i;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glGenBuffers(%d)\n", n);
+
+ if (n < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glGenBuffersARB");
+ return;
+ }
+
+ if (!buffer) {
+ return;
+ }
+
+ /*
+ * This must be atomic (generation and allocation of buffer object IDs)
+ */
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+
+ first = _mesa_HashFindFreeKeyBlock(ctx->Shared->BufferObjects, n);
+
+ /* Insert the ID and pointer to dummy buffer object into hash table */
+ for (i = 0; i < n; i++) {
+ _mesa_HashInsert(ctx->Shared->BufferObjects, first + i,
+ &DummyBufferObject);
+ buffer[i] = first + i;
+ }
+
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+}
+
+
+/**
+ * Determine if ID is the name of a buffer object.
+ *
+ * \param id ID of the potential buffer object.
+ * \return \c GL_TRUE if \c id is the name of a buffer object,
+ * \c GL_FALSE otherwise.
+ */
+GLboolean GLAPIENTRY
+_mesa_IsBufferARB(GLuint id)
+{
+ struct gl_buffer_object *bufObj;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ _glthread_LOCK_MUTEX(ctx->Shared->Mutex);
+ bufObj = _mesa_lookup_bufferobj(ctx, id);
+ _glthread_UNLOCK_MUTEX(ctx->Shared->Mutex);
+
+ return bufObj && bufObj != &DummyBufferObject;
+}
+
+
+void GLAPIENTRY
+_mesa_BufferDataARB(GLenum target, GLsizeiptrARB size,
+ const GLvoid * data, GLenum usage)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glBufferData(%s, %ld, %p, %s)\n",
+ _mesa_lookup_enum_by_nr(target),
+ (long int) size, data,
+ _mesa_lookup_enum_by_nr(usage));
+
+ if (size < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBufferDataARB(size < 0)");
+ return;
+ }
+
+ switch (usage) {
+ case GL_STREAM_DRAW_ARB:
+ case GL_STREAM_READ_ARB:
+ case GL_STREAM_COPY_ARB:
+ case GL_STATIC_DRAW_ARB:
+ case GL_STATIC_READ_ARB:
+ case GL_STATIC_COPY_ARB:
+ case GL_DYNAMIC_DRAW_ARB:
+ case GL_DYNAMIC_READ_ARB:
+ case GL_DYNAMIC_COPY_ARB:
+ /* OK */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(usage)");
+ return;
+ }
+
+ bufObj = get_buffer(ctx, target);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glBufferDataARB(target)" );
+ return;
+ }
+ if (!_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glBufferDataARB(buffer 0)" );
+ return;
+ }
+
+ if (_mesa_bufferobj_mapped(bufObj)) {
+ /* Unmap the existing buffer. We'll replace it now. Not an error. */
+ ctx->Driver.UnmapBuffer(ctx, target, bufObj);
+ bufObj->AccessFlags = DEFAULT_ACCESS;
+ ASSERT(bufObj->Pointer == NULL);
+ }
+
+ FLUSH_VERTICES(ctx, _NEW_BUFFER_OBJECT);
+
+ bufObj->Written = GL_TRUE;
+
+#ifdef VBO_DEBUG
+ printf("glBufferDataARB(%u, sz %ld, from %p, usage 0x%x)\n",
+ bufObj->Name, size, data, usage);
+#endif
+
+#ifdef BOUNDS_CHECK
+ size += 100;
+#endif
+
+ ASSERT(ctx->Driver.BufferData);
+ if (!ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj )) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB()");
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_BufferSubDataARB(GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, const GLvoid * data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
+ "glBufferSubDataARB" );
+ if (!bufObj) {
+ /* error already recorded */
+ return;
+ }
+
+ if (size == 0)
+ return;
+
+ bufObj->Written = GL_TRUE;
+
+ ASSERT(ctx->Driver.BufferSubData);
+ ctx->Driver.BufferSubData( ctx, target, offset, size, data, bufObj );
+}
+
+
+void GLAPIENTRY
+_mesa_GetBufferSubDataARB(GLenum target, GLintptrARB offset,
+ GLsizeiptrARB size, void * data)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ bufObj = buffer_object_subdata_range_good( ctx, target, offset, size,
+ "glGetBufferSubDataARB" );
+ if (!bufObj) {
+ /* error already recorded */
+ return;
+ }
+
+ ASSERT(ctx->Driver.GetBufferSubData);
+ ctx->Driver.GetBufferSubData( ctx, target, offset, size, data, bufObj );
+}
+
+
+void * GLAPIENTRY
+_mesa_MapBufferARB(GLenum target, GLenum access)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object * bufObj;
+ GLbitfield accessFlags;
+ void *map;
+
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
+
+ switch (access) {
+ case GL_READ_ONLY_ARB:
+ accessFlags = GL_MAP_READ_BIT;
+ break;
+ case GL_WRITE_ONLY_ARB:
+ accessFlags = GL_MAP_WRITE_BIT;
+ break;
+ case GL_READ_WRITE_ARB:
+ accessFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(access)");
+ return NULL;
+ }
+
+ bufObj = get_buffer(ctx, target);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glMapBufferARB(target)" );
+ return NULL;
+ }
+ if (!_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB(buffer 0)" );
+ return NULL;
+ }
+ if (_mesa_bufferobj_mapped(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glMapBufferARB(already mapped)");
+ return NULL;
+ }
+
+ ASSERT(ctx->Driver.MapBuffer);
+ map = ctx->Driver.MapBuffer( ctx, target, access, bufObj );
+ if (!map) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
+ return NULL;
+ }
+ else {
+ /* The driver callback should have set these fields.
+ * This is important because other modules (like VBO) might call
+ * the driver function directly.
+ */
+ ASSERT(bufObj->Pointer == map);
+ ASSERT(bufObj->Length == bufObj->Size);
+ ASSERT(bufObj->Offset == 0);
+ bufObj->AccessFlags = accessFlags;
+ }
+
+ if (access == GL_WRITE_ONLY_ARB || access == GL_READ_WRITE_ARB)
+ bufObj->Written = GL_TRUE;
+
+#ifdef VBO_DEBUG
+ printf("glMapBufferARB(%u, sz %ld, access 0x%x)\n",
+ bufObj->Name, bufObj->Size, access);
+ if (access == GL_WRITE_ONLY_ARB) {
+ GLuint i;
+ GLubyte *b = (GLubyte *) bufObj->Pointer;
+ for (i = 0; i < bufObj->Size; i++)
+ b[i] = i & 0xff;
+ }
+#endif
+
+#ifdef BOUNDS_CHECK
+ {
+ GLubyte *buf = (GLubyte *) bufObj->Pointer;
+ GLuint i;
+ /* buffer is 100 bytes larger than requested, fill with magic value */
+ for (i = 0; i < 100; i++) {
+ buf[bufObj->Size - i - 1] = 123;
+ }
+ }
+#endif
+
+ return bufObj->Pointer;
+}
+
+
+GLboolean GLAPIENTRY
+_mesa_UnmapBufferARB(GLenum target)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ GLboolean status = GL_TRUE;
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
+
+ bufObj = get_buffer(ctx, target);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glUnmapBufferARB(target)" );
+ return GL_FALSE;
+ }
+ if (!_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB" );
+ return GL_FALSE;
+ }
+ if (!_mesa_bufferobj_mapped(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glUnmapBufferARB");
+ return GL_FALSE;
+ }
+
+#ifdef BOUNDS_CHECK
+ if (bufObj->Access != GL_READ_ONLY_ARB) {
+ GLubyte *buf = (GLubyte *) bufObj->Pointer;
+ GLuint i;
+ /* check that last 100 bytes are still = magic value */
+ for (i = 0; i < 100; i++) {
+ GLuint pos = bufObj->Size - i - 1;
+ if (buf[pos] != 123) {
+ _mesa_warning(ctx, "Out of bounds buffer object write detected"
+ " at position %d (value = %u)\n",
+ pos, buf[pos]);
+ }
+ }
+ }
+#endif
+
+#ifdef VBO_DEBUG
+ if (bufObj->AccessFlags & GL_MAP_WRITE_BIT) {
+ GLuint i, unchanged = 0;
+ GLubyte *b = (GLubyte *) bufObj->Pointer;
+ GLint pos = -1;
+ /* check which bytes changed */
+ for (i = 0; i < bufObj->Size - 1; i++) {
+ if (b[i] == (i & 0xff) && b[i+1] == ((i+1) & 0xff)) {
+ unchanged++;
+ if (pos == -1)
+ pos = i;
+ }
+ }
+ if (unchanged) {
+ printf("glUnmapBufferARB(%u): %u of %ld unchanged, starting at %d\n",
+ bufObj->Name, unchanged, bufObj->Size, pos);
+ }
+ }
+#endif
+
+ status = ctx->Driver.UnmapBuffer( ctx, target, bufObj );
+ bufObj->AccessFlags = DEFAULT_ACCESS;
+ ASSERT(bufObj->Pointer == NULL);
+ ASSERT(bufObj->Offset == 0);
+ ASSERT(bufObj->Length == 0);
+
+ return status;
+}
+
+
+void GLAPIENTRY
+_mesa_GetBufferParameterivARB(GLenum target, GLenum pname, GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ bufObj = get_buffer(ctx, target);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(target)" );
+ return;
+ }
+ if (!_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferParameterivARB" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_BUFFER_SIZE_ARB:
+ *params = (GLint) bufObj->Size;
+ return;
+ case GL_BUFFER_USAGE_ARB:
+ *params = bufObj->Usage;
+ return;
+ case GL_BUFFER_ACCESS_ARB:
+ *params = simplified_access_mode(bufObj->AccessFlags);
+ return;
+ case GL_BUFFER_MAPPED_ARB:
+ *params = _mesa_bufferobj_mapped(bufObj);
+ return;
+ case GL_BUFFER_ACCESS_FLAGS:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = bufObj->AccessFlags;
+ return;
+ case GL_BUFFER_MAP_OFFSET:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = (GLint) bufObj->Offset;
+ return;
+ case GL_BUFFER_MAP_LENGTH:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = (GLint) bufObj->Length;
+ return;
+ default:
+ ; /* fall-through */
+ }
+
+invalid_pname:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameterivARB(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
+}
+
+
+/**
+ * New in GL 3.2
+ * This is pretty much a duplicate of GetBufferParameteriv() but the
+ * GL_BUFFER_SIZE_ARB attribute will be 64-bits on a 64-bit system.
+ */
+void GLAPIENTRY
+_mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ bufObj = get_buffer(ctx, target);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(target)" );
+ return;
+ }
+ if (!_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferParameteri64v" );
+ return;
+ }
+
+ switch (pname) {
+ case GL_BUFFER_SIZE_ARB:
+ *params = bufObj->Size;
+ return;
+ case GL_BUFFER_USAGE_ARB:
+ *params = bufObj->Usage;
+ return;
+ case GL_BUFFER_ACCESS_ARB:
+ *params = simplified_access_mode(bufObj->AccessFlags);
+ return;
+ case GL_BUFFER_ACCESS_FLAGS:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = bufObj->AccessFlags;
+ return;
+ case GL_BUFFER_MAPPED_ARB:
+ *params = _mesa_bufferobj_mapped(bufObj);
+ return;
+ case GL_BUFFER_MAP_OFFSET:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = bufObj->Offset;
+ return;
+ case GL_BUFFER_MAP_LENGTH:
+ if (ctx->VersionMajor < 3)
+ goto invalid_pname;
+ *params = bufObj->Length;
+ return;
+ default:
+ ; /* fall-through */
+ }
+
+invalid_pname:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferParameteri64v(pname=%s)",
+ _mesa_lookup_enum_by_nr(pname));
+}
+
+
+void GLAPIENTRY
+_mesa_GetBufferPointervARB(GLenum target, GLenum pname, GLvoid **params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object * bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (pname != GL_BUFFER_MAP_POINTER_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(pname)");
+ return;
+ }
+
+ bufObj = get_buffer(ctx, target);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBufferPointervARB(target)" );
+ return;
+ }
+ if (!_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glGetBufferPointervARB" );
+ return;
+ }
+
+ *params = bufObj->Pointer;
+}
+
+
+void GLAPIENTRY
+_mesa_CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
+ GLintptr readOffset, GLintptr writeOffset,
+ GLsizeiptr size)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *src, *dst;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ src = get_buffer(ctx, readTarget);
+ if (!src || !_mesa_is_bufferobj(src)) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glCopyBuffserSubData(readTarget = 0x%x)", readTarget);
+ return;
+ }
+
+ dst = get_buffer(ctx, writeTarget);
+ if (!dst || !_mesa_is_bufferobj(dst)) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glCopyBuffserSubData(writeTarget = 0x%x)", writeTarget);
+ return;
+ }
+
+ if (_mesa_bufferobj_mapped(src)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCopyBuffserSubData(readBuffer is mapped)");
+ return;
+ }
+
+ if (_mesa_bufferobj_mapped(dst)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glCopyBuffserSubData(writeBuffer is mapped)");
+ return;
+ }
+
+ if (readOffset < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyBuffserSubData(readOffset = %d)", (int) readOffset);
+ return;
+ }
+
+ if (writeOffset < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyBuffserSubData(writeOffset = %d)", (int) writeOffset);
+ return;
+ }
+
+ if (readOffset + size > src->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyBuffserSubData(readOffset + size = %d)",
+ (int) (readOffset + size));
+ return;
+ }
+
+ if (writeOffset + size > dst->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyBuffserSubData(writeOffset + size = %d)",
+ (int) (writeOffset + size));
+ return;
+ }
+
+ if (src == dst) {
+ if (readOffset + size <= writeOffset) {
+ /* OK */
+ }
+ else if (writeOffset + size <= readOffset) {
+ /* OK */
+ }
+ else {
+ /* overlapping src/dst is illegal */
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glCopyBuffserSubData(overlapping src/dst)");
+ return;
+ }
+ }
+
+ ctx->Driver.CopyBufferSubData(ctx, src, dst, readOffset, writeOffset, size);
+}
+
+
+/**
+ * See GL_ARB_map_buffer_range spec
+ */
+void * GLAPIENTRY
+_mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
+ GLbitfield access)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ void *map;
+
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
+
+ if (!ctx->Extensions.ARB_map_buffer_range) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(extension not supported)");
+ return NULL;
+ }
+
+ if (offset < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glMapBufferRange(offset = %ld)", (long)offset);
+ return NULL;
+ }
+
+ if (length < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glMapBufferRange(length = %ld)", (long)length);
+ return NULL;
+ }
+
+ if ((access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(access indicates neither read or write)");
+ return NULL;
+ }
+
+ if ((access & GL_MAP_READ_BIT) &&
+ (access & (GL_MAP_INVALIDATE_RANGE_BIT |
+ GL_MAP_INVALIDATE_BUFFER_BIT |
+ GL_MAP_UNSYNCHRONIZED_BIT))) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(invalid access flags)");
+ return NULL;
+ }
+
+ if ((access & GL_MAP_FLUSH_EXPLICIT_BIT) &&
+ ((access & GL_MAP_WRITE_BIT) == 0)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(invalid access flags)");
+ return NULL;
+ }
+
+ bufObj = get_buffer(ctx, target);
+ if (!bufObj || !_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glMapBufferRange(target = 0x%x)", target);
+ return NULL;
+ }
+
+ if (offset + length > bufObj->Size) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glMapBufferRange(offset + length > size)");
+ return NULL;
+ }
+
+ if (_mesa_bufferobj_mapped(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(buffer already mapped)");
+ return NULL;
+ }
+
+ ASSERT(ctx->Driver.MapBufferRange);
+ map = ctx->Driver.MapBufferRange(ctx, target, offset, length,
+ access, bufObj);
+ if (!map) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)");
+ }
+ else {
+ /* The driver callback should have set all these fields.
+ * This is important because other modules (like VBO) might call
+ * the driver function directly.
+ */
+ ASSERT(bufObj->Pointer == map);
+ ASSERT(bufObj->Length == length);
+ ASSERT(bufObj->Offset == offset);
+ ASSERT(bufObj->AccessFlags == access);
+ }
+
+ return map;
+}
+
+
+/**
+ * See GL_ARB_map_buffer_range spec
+ */
+void GLAPIENTRY
+_mesa_FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_buffer_object *bufObj;
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (!ctx->Extensions.ARB_map_buffer_range) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(extension not supported)");
+ return;
+ }
+
+ if (offset < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glMapBufferRange(offset = %ld)", (long)offset);
+ return;
+ }
+
+ if (length < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glMapBufferRange(length = %ld)", (long)length);
+ return;
+ }
+
+ bufObj = get_buffer(ctx, target);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glMapBufferRange(target = 0x%x)", target);
+ return;
+ }
+
+ if (!_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(current buffer is 0)");
+ return;
+ }
+
+ if (!_mesa_bufferobj_mapped(bufObj)) {
+ /* buffer is not mapped */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(buffer is not mapped)");
+ return;
+ }
+
+ if ((bufObj->AccessFlags & GL_MAP_FLUSH_EXPLICIT_BIT) == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glMapBufferRange(GL_MAP_FLUSH_EXPLICIT_BIT not set)");
+ return;
+ }
+
+ if (offset + length > bufObj->Length) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glMapBufferRange(offset %ld + length %ld > mapped length %ld)",
+ (long)offset, (long)length, (long)bufObj->Length);
+ return;
+ }
+
+ ASSERT(bufObj->AccessFlags & GL_MAP_WRITE_BIT);
+
+ if (ctx->Driver.FlushMappedBufferRange)
+ ctx->Driver.FlushMappedBufferRange(ctx, target, offset, length, bufObj);
+}
+
+
+#if FEATURE_APPLE_object_purgeable
+static GLenum
+buffer_object_purgeable(struct gl_context *ctx, GLuint name, GLenum option)
+{
+ struct gl_buffer_object *bufObj;
+ GLenum retval;
+
+ bufObj = _mesa_lookup_bufferobj(ctx, name);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectPurgeable(name = 0x%x)", name);
+ return 0;
+ }
+ if (!_mesa_is_bufferobj(bufObj)) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glObjectPurgeable(buffer 0)" );
+ return 0;
+ }
+
+ if (bufObj->Purgeable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glObjectPurgeable(name = 0x%x) is already purgeable", name);
+ return GL_VOLATILE_APPLE;
+ }
+
+ bufObj->Purgeable = GL_TRUE;
+
+ retval = GL_VOLATILE_APPLE;
+ if (ctx->Driver.BufferObjectPurgeable)
+ retval = ctx->Driver.BufferObjectPurgeable(ctx, bufObj, option);
+
+ return retval;
+}
+
+
+static GLenum
+renderbuffer_purgeable(struct gl_context *ctx, GLuint name, GLenum option)
+{
+ struct gl_renderbuffer *bufObj;
+ GLenum retval;
+
+ bufObj = _mesa_lookup_renderbuffer(ctx, name);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectUnpurgeable(name = 0x%x)", name);
+ return 0;
+ }
+
+ if (bufObj->Purgeable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glObjectPurgeable(name = 0x%x) is already purgeable", name);
+ return GL_VOLATILE_APPLE;
+ }
+
+ bufObj->Purgeable = GL_TRUE;
+
+ retval = GL_VOLATILE_APPLE;
+ if (ctx->Driver.RenderObjectPurgeable)
+ retval = ctx->Driver.RenderObjectPurgeable(ctx, bufObj, option);
+
+ return retval;
+}
+
+
+static GLenum
+texture_object_purgeable(struct gl_context *ctx, GLuint name, GLenum option)
+{
+ struct gl_texture_object *bufObj;
+ GLenum retval;
+
+ bufObj = _mesa_lookup_texture(ctx, name);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectPurgeable(name = 0x%x)", name);
+ return 0;
+ }
+
+ if (bufObj->Purgeable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glObjectPurgeable(name = 0x%x) is already purgeable", name);
+ return GL_VOLATILE_APPLE;
+ }
+
+ bufObj->Purgeable = GL_TRUE;
+
+ retval = GL_VOLATILE_APPLE;
+ if (ctx->Driver.TextureObjectPurgeable)
+ retval = ctx->Driver.TextureObjectPurgeable(ctx, bufObj, option);
+
+ return retval;
+}
+
+
+GLenum GLAPIENTRY
+_mesa_ObjectPurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
+{
+ GLenum retval;
+
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
+
+ if (name == 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectPurgeable(name = 0x%x)", name);
+ return 0;
+ }
+
+ switch (option) {
+ case GL_VOLATILE_APPLE:
+ case GL_RELEASED_APPLE:
+ /* legal */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glObjectPurgeable(name = 0x%x) invalid option: %d",
+ name, option);
+ return 0;
+ }
+
+ switch (objectType) {
+ case GL_TEXTURE:
+ retval = texture_object_purgeable(ctx, name, option);
+ break;
+ case GL_RENDERBUFFER_EXT:
+ retval = renderbuffer_purgeable(ctx, name, option);
+ break;
+ case GL_BUFFER_OBJECT_APPLE:
+ retval = buffer_object_purgeable(ctx, name, option);
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glObjectPurgeable(name = 0x%x) invalid type: %d",
+ name, objectType);
+ return 0;
+ }
+
+ /* In strict conformance to the spec, we must only return VOLATILE when
+ * when passed the VOLATILE option. Madness.
+ *
+ * XXX First fix the spec, then fix me.
+ */
+ return option == GL_VOLATILE_APPLE ? GL_VOLATILE_APPLE : retval;
+}
+
+
+static GLenum
+buffer_object_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
+{
+ struct gl_buffer_object *bufObj;
+ GLenum retval;
+
+ bufObj = _mesa_lookup_bufferobj(ctx, name);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectUnpurgeable(name = 0x%x)", name);
+ return 0;
+ }
+
+ if (! bufObj->Purgeable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glObjectUnpurgeable(name = 0x%x) object is "
+ " already \"unpurged\"", name);
+ return 0;
+ }
+
+ bufObj->Purgeable = GL_FALSE;
+
+ retval = option;
+ if (ctx->Driver.BufferObjectUnpurgeable)
+ retval = ctx->Driver.BufferObjectUnpurgeable(ctx, bufObj, option);
+
+ return retval;
+}
+
+
+static GLenum
+renderbuffer_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
+{
+ struct gl_renderbuffer *bufObj;
+ GLenum retval;
+
+ bufObj = _mesa_lookup_renderbuffer(ctx, name);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectUnpurgeable(name = 0x%x)", name);
+ return 0;
+ }
+
+ if (! bufObj->Purgeable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glObjectUnpurgeable(name = 0x%x) object is "
+ " already \"unpurged\"", name);
+ return 0;
+ }
+
+ bufObj->Purgeable = GL_FALSE;
+
+ retval = option;
+ if (ctx->Driver.RenderObjectUnpurgeable)
+ retval = ctx->Driver.RenderObjectUnpurgeable(ctx, bufObj, option);
+
+ return retval;
+}
+
+
+static GLenum
+texture_object_unpurgeable(struct gl_context *ctx, GLuint name, GLenum option)
+{
+ struct gl_texture_object *bufObj;
+ GLenum retval;
+
+ bufObj = _mesa_lookup_texture(ctx, name);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectUnpurgeable(name = 0x%x)", name);
+ return 0;
+ }
+
+ if (! bufObj->Purgeable) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glObjectUnpurgeable(name = 0x%x) object is"
+ " already \"unpurged\"", name);
+ return 0;
+ }
+
+ bufObj->Purgeable = GL_FALSE;
+
+ retval = option;
+ if (ctx->Driver.TextureObjectUnpurgeable)
+ retval = ctx->Driver.TextureObjectUnpurgeable(ctx, bufObj, option);
+
+ return retval;
+}
+
+
+GLenum GLAPIENTRY
+_mesa_ObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
+
+ if (name == 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectUnpurgeable(name = 0x%x)", name);
+ return 0;
+ }
+
+ switch (option) {
+ case GL_RETAINED_APPLE:
+ case GL_UNDEFINED_APPLE:
+ /* legal */
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glObjectUnpurgeable(name = 0x%x) invalid option: %d",
+ name, option);
+ return 0;
+ }
+
+ switch (objectType) {
+ case GL_BUFFER_OBJECT_APPLE:
+ return buffer_object_unpurgeable(ctx, name, option);
+ case GL_TEXTURE:
+ return texture_object_unpurgeable(ctx, name, option);
+ case GL_RENDERBUFFER_EXT:
+ return renderbuffer_unpurgeable(ctx, name, option);
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glObjectUnpurgeable(name = 0x%x) invalid type: %d",
+ name, objectType);
+ return 0;
+ }
+}
+
+
+static void
+get_buffer_object_parameteriv(struct gl_context *ctx, GLuint name,
+ GLenum pname, GLint *params)
+{
+ struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, name);
+ if (!bufObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glGetObjectParameteriv(name = 0x%x) invalid object", name);
+ return;
+ }
+
+ switch (pname) {
+ case GL_PURGEABLE_APPLE:
+ *params = bufObj->Purgeable;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetObjectParameteriv(name = 0x%x) invalid enum: %d",
+ name, pname);
+ break;
+ }
+}
+
+
+static void
+get_renderbuffer_parameteriv(struct gl_context *ctx, GLuint name,
+ GLenum pname, GLint *params)
+{
+ struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, name);
+ if (!rb) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectUnpurgeable(name = 0x%x)", name);
+ return;
+ }
+
+ switch (pname) {
+ case GL_PURGEABLE_APPLE:
+ *params = rb->Purgeable;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetObjectParameteriv(name = 0x%x) invalid enum: %d",
+ name, pname);
+ break;
+ }
+}
+
+
+static void
+get_texture_object_parameteriv(struct gl_context *ctx, GLuint name,
+ GLenum pname, GLint *params)
+{
+ struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name);
+ if (!texObj) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glObjectUnpurgeable(name = 0x%x)", name);
+ return;
+ }
+
+ switch (pname) {
+ case GL_PURGEABLE_APPLE:
+ *params = texObj->Purgeable;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetObjectParameteriv(name = 0x%x) invalid enum: %d",
+ name, pname);
+ break;
+ }
+}
+
+
+void GLAPIENTRY
+_mesa_GetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname,
+ GLint *params)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (name == 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glGetObjectParameteriv(name = 0x%x)", name);
+ return;
+ }
+
+ switch (objectType) {
+ case GL_TEXTURE:
+ get_texture_object_parameteriv(ctx, name, pname, params);
+ break;
+ case GL_BUFFER_OBJECT_APPLE:
+ get_buffer_object_parameteriv(ctx, name, pname, params);
+ break;
+ case GL_RENDERBUFFER_EXT:
+ get_renderbuffer_parameteriv(ctx, name, pname, params);
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glGetObjectParameteriv(name = 0x%x) invalid type: %d",
+ name, objectType);
+ }
+}
+
+#endif /* FEATURE_APPLE_object_purgeable */
diff --git a/mesalib/src/mesa/main/bufferobj.h b/mesalib/src/mesa/main/bufferobj.h
index f673f431f..7581b8e2c 100644
--- a/mesalib/src/mesa/main/bufferobj.h
+++ b/mesalib/src/mesa/main/bufferobj.h
@@ -75,9 +75,19 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj,
GLuint name, GLenum target );
extern void
+_mesa_reference_buffer_object_(struct gl_context *ctx,
+ struct gl_buffer_object **ptr,
+ struct gl_buffer_object *bufObj);
+
+static INLINE void
_mesa_reference_buffer_object(struct gl_context *ctx,
struct gl_buffer_object **ptr,
- struct gl_buffer_object *bufObj);
+ struct gl_buffer_object *bufObj)
+{
+ if (*ptr != bufObj)
+ _mesa_reference_buffer_object_(ctx, ptr, bufObj);
+}
+
extern void
_mesa_init_buffer_object_functions(struct dd_function_table *driver);
diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c
index ac104a2ce..a32976211 100644
--- a/mesalib/src/mesa/main/framebuffer.c
+++ b/mesalib/src/mesa/main/framebuffer.c
@@ -232,17 +232,13 @@ _mesa_free_framebuffer_data(struct gl_framebuffer *fb)
/**
* Set *ptr to point to fb, with refcounting and locking.
+ * This is normally only called from the _mesa_reference_framebuffer() macro
+ * when there's a real pointer change.
*/
void
-_mesa_reference_framebuffer(struct gl_framebuffer **ptr,
- struct gl_framebuffer *fb)
+_mesa_reference_framebuffer_(struct gl_framebuffer **ptr,
+ struct gl_framebuffer *fb)
{
- assert(ptr);
- if (*ptr == fb) {
- /* no change */
- return;
- }
-
if (*ptr) {
/* unreference old renderbuffer */
GLboolean deleteFlag = GL_FALSE;
diff --git a/mesalib/src/mesa/main/framebuffer.h b/mesalib/src/mesa/main/framebuffer.h
index 261f84515..b2b29a7a1 100644
--- a/mesalib/src/mesa/main/framebuffer.h
+++ b/mesalib/src/mesa/main/framebuffer.h
@@ -1,102 +1,110 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef FRAMEBUFFER_H
-#define FRAMEBUFFER_H
-
-#include "glheader.h"
-
-struct gl_config;
-struct gl_context;
-
-extern struct gl_framebuffer *
-_mesa_create_framebuffer(const struct gl_config *visual);
-
-extern struct gl_framebuffer *
-_mesa_new_framebuffer(struct gl_context *ctx, GLuint name);
-
-extern void
-_mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
- const struct gl_config *visual);
-
-extern void
-_mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name);
-
-extern void
-_mesa_destroy_framebuffer(struct gl_framebuffer *buffer);
-
-extern void
-_mesa_free_framebuffer_data(struct gl_framebuffer *buffer);
-
-extern void
-_mesa_reference_framebuffer(struct gl_framebuffer **ptr,
- struct gl_framebuffer *fb);
-
-extern void
-_mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint width, GLuint height);
-
-
-extern void
-_mesa_resizebuffers( struct gl_context *ctx );
-
-extern void GLAPIENTRY
-_mesa_ResizeBuffersMESA( void );
-
-
-extern void
-_mesa_update_draw_buffer_bounds(struct gl_context *ctx);
-
-extern void
-_mesa_update_framebuffer_visual(struct gl_context *ctx,
- struct gl_framebuffer *fb);
-
-extern void
-_mesa_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint attIndex);
-
-extern void
-_mesa_update_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
- GLuint attIndex);
-
-extern void
-_mesa_update_framebuffer(struct gl_context *ctx);
-
-extern GLboolean
-_mesa_source_buffer_exists(struct gl_context *ctx, GLenum format);
-
-extern GLboolean
-_mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format);
-
-extern GLenum
-_mesa_get_color_read_type(struct gl_context *ctx);
-
-extern GLenum
-_mesa_get_color_read_format(struct gl_context *ctx);
-
-extern void
-_mesa_print_framebuffer(const struct gl_framebuffer *fb);
-
-#endif /* FRAMEBUFFER_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef FRAMEBUFFER_H
+#define FRAMEBUFFER_H
+
+#include "glheader.h"
+
+struct gl_config;
+struct gl_context;
+
+extern struct gl_framebuffer *
+_mesa_create_framebuffer(const struct gl_config *visual);
+
+extern struct gl_framebuffer *
+_mesa_new_framebuffer(struct gl_context *ctx, GLuint name);
+
+extern void
+_mesa_initialize_window_framebuffer(struct gl_framebuffer *fb,
+ const struct gl_config *visual);
+
+extern void
+_mesa_initialize_user_framebuffer(struct gl_framebuffer *fb, GLuint name);
+
+extern void
+_mesa_destroy_framebuffer(struct gl_framebuffer *buffer);
+
+extern void
+_mesa_free_framebuffer_data(struct gl_framebuffer *buffer);
+
+extern void
+_mesa_reference_framebuffer_(struct gl_framebuffer **ptr,
+ struct gl_framebuffer *fb);
+
+static INLINE void
+_mesa_reference_framebuffer(struct gl_framebuffer **ptr,
+ struct gl_framebuffer *fb)
+{
+ if (*ptr != fb)
+ _mesa_reference_framebuffer_(ptr, fb);
+}
+
+extern void
+_mesa_resize_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
+ GLuint width, GLuint height);
+
+
+extern void
+_mesa_resizebuffers( struct gl_context *ctx );
+
+extern void GLAPIENTRY
+_mesa_ResizeBuffersMESA( void );
+
+
+extern void
+_mesa_update_draw_buffer_bounds(struct gl_context *ctx);
+
+extern void
+_mesa_update_framebuffer_visual(struct gl_context *ctx,
+ struct gl_framebuffer *fb);
+
+extern void
+_mesa_update_depth_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
+ GLuint attIndex);
+
+extern void
+_mesa_update_stencil_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
+ GLuint attIndex);
+
+extern void
+_mesa_update_framebuffer(struct gl_context *ctx);
+
+extern GLboolean
+_mesa_source_buffer_exists(struct gl_context *ctx, GLenum format);
+
+extern GLboolean
+_mesa_dest_buffer_exists(struct gl_context *ctx, GLenum format);
+
+extern GLenum
+_mesa_get_color_read_type(struct gl_context *ctx);
+
+extern GLenum
+_mesa_get_color_read_format(struct gl_context *ctx);
+
+extern void
+_mesa_print_framebuffer(const struct gl_framebuffer *fb);
+
+#endif /* FRAMEBUFFER_H */
diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c
index 6ae8b1f96..08bb23cb3 100644
--- a/mesalib/src/mesa/main/renderbuffer.c
+++ b/mesalib/src/mesa/main/renderbuffer.c
@@ -2530,17 +2530,13 @@ _mesa_remove_renderbuffer(struct gl_framebuffer *fb,
* Set *ptr to point to rb. If *ptr points to another renderbuffer,
* dereference that buffer first. The new renderbuffer's refcount will
* be incremented. The old renderbuffer's refcount will be decremented.
+ * This is normally only called from the _mesa_reference_renderbuffer() macro
+ * when there's a real pointer change.
*/
void
-_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
- struct gl_renderbuffer *rb)
+_mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
+ struct gl_renderbuffer *rb)
{
- assert(ptr);
- if (*ptr == rb) {
- /* no change */
- return;
- }
-
if (*ptr) {
/* Unreference the old renderbuffer */
GLboolean deleteFlag = GL_FALSE;
diff --git a/mesalib/src/mesa/main/renderbuffer.h b/mesalib/src/mesa/main/renderbuffer.h
index 4ac691824..99488c1d3 100644
--- a/mesalib/src/mesa/main/renderbuffer.h
+++ b/mesalib/src/mesa/main/renderbuffer.h
@@ -105,8 +105,17 @@ _mesa_remove_renderbuffer(struct gl_framebuffer *fb,
gl_buffer_index bufferName);
extern void
+_mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
+ struct gl_renderbuffer *rb);
+
+static INLINE void
_mesa_reference_renderbuffer(struct gl_renderbuffer **ptr,
- struct gl_renderbuffer *rb);
+ struct gl_renderbuffer *rb)
+{
+ if (*ptr != rb)
+ _mesa_reference_renderbuffer_(ptr, rb);
+}
+
#endif /* RENDERBUFFER_H */
diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c
index 9fc3d995b..a28c15ba2 100644
--- a/mesalib/src/mesa/main/texobj.c
+++ b/mesalib/src/mesa/main/texobj.c
@@ -325,16 +325,14 @@ valid_texture_object(const struct gl_texture_object *tex)
* Reference (or unreference) a texture object.
* If '*ptr', decrement *ptr's refcount (and delete if it becomes zero).
* If 'tex' is non-null, increment its refcount.
+ * This is normally only called from the _mesa_reference_texobj() macro
+ * when there's a real pointer change.
*/
void
-_mesa_reference_texobj(struct gl_texture_object **ptr,
- struct gl_texture_object *tex)
+_mesa_reference_texobj_(struct gl_texture_object **ptr,
+ struct gl_texture_object *tex)
{
assert(ptr);
- if (*ptr == tex) {
- /* no change */
- return;
- }
if (*ptr) {
/* Unreference the old texture */
diff --git a/mesalib/src/mesa/main/texobj.h b/mesalib/src/mesa/main/texobj.h
index 0bad63867..1faae6f7e 100644
--- a/mesalib/src/mesa/main/texobj.h
+++ b/mesalib/src/mesa/main/texobj.h
@@ -1,124 +1,134 @@
-/**
- * \file texobj.h
- * Texture object management.
- */
-
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef TEXTOBJ_H
-#define TEXTOBJ_H
-
-
-#include "glheader.h"
-
-struct gl_context;
-
-/**
- * \name Internal functions
- */
-/*@{*/
-
-extern struct gl_texture_object *
-_mesa_lookup_texture(struct gl_context *ctx, GLuint id);
-
-extern struct gl_texture_object *
-_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target );
-
-extern void
-_mesa_initialize_texture_object( struct gl_texture_object *obj,
- GLuint name, GLenum target );
-
-extern void
-_mesa_delete_texture_object( struct gl_context *ctx,
- struct gl_texture_object *obj );
-
-extern void
-_mesa_copy_texture_object( struct gl_texture_object *dest,
- const struct gl_texture_object *src );
-
-extern void
-_mesa_clear_texture_object(struct gl_context *ctx,
- struct gl_texture_object *obj);
-
-extern void
-_mesa_reference_texobj(struct gl_texture_object **ptr,
- struct gl_texture_object *tex);
-
-extern void
-_mesa_test_texobj_completeness( const struct gl_context *ctx,
- struct gl_texture_object *obj );
-
-extern GLboolean
-_mesa_cube_complete(const struct gl_texture_object *texObj);
-
-extern void
-_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
- GLboolean invalidate_state);
-
-extern struct gl_texture_object *
-_mesa_get_fallback_texture(struct gl_context *ctx);
-
-extern void
-_mesa_unlock_context_textures( struct gl_context *ctx );
-
-extern void
-_mesa_lock_context_textures( struct gl_context *ctx );
-
-/*@}*/
-
-/**
- * \name API functions
- */
-/*@{*/
-
-extern void GLAPIENTRY
-_mesa_GenTextures( GLsizei n, GLuint *textures );
-
-
-extern void GLAPIENTRY
-_mesa_DeleteTextures( GLsizei n, const GLuint *textures );
-
-
-extern void GLAPIENTRY
-_mesa_BindTexture( GLenum target, GLuint texture );
-
-
-extern void GLAPIENTRY
-_mesa_PrioritizeTextures( GLsizei n, const GLuint *textures,
- const GLclampf *priorities );
-
-
-extern GLboolean GLAPIENTRY
-_mesa_AreTexturesResident( GLsizei n, const GLuint *textures,
- GLboolean *residences );
-
-extern GLboolean GLAPIENTRY
-_mesa_IsTexture( GLuint texture );
-
-/*@}*/
-
-
-#endif
+/**
+ * \file texobj.h
+ * Texture object management.
+ */
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ *
+ * Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef TEXTOBJ_H
+#define TEXTOBJ_H
+
+
+#include "compiler.h"
+#include "glheader.h"
+
+struct gl_context;
+
+/**
+ * \name Internal functions
+ */
+/*@{*/
+
+extern struct gl_texture_object *
+_mesa_lookup_texture(struct gl_context *ctx, GLuint id);
+
+extern struct gl_texture_object *
+_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target );
+
+extern void
+_mesa_initialize_texture_object( struct gl_texture_object *obj,
+ GLuint name, GLenum target );
+
+extern void
+_mesa_delete_texture_object( struct gl_context *ctx,
+ struct gl_texture_object *obj );
+
+extern void
+_mesa_copy_texture_object( struct gl_texture_object *dest,
+ const struct gl_texture_object *src );
+
+extern void
+_mesa_clear_texture_object(struct gl_context *ctx,
+ struct gl_texture_object *obj);
+
+extern void
+_mesa_reference_texobj_(struct gl_texture_object **ptr,
+ struct gl_texture_object *tex);
+
+static INLINE void
+_mesa_reference_texobj(struct gl_texture_object **ptr,
+ struct gl_texture_object *tex)
+{
+ if (*ptr != tex)
+ _mesa_reference_texobj_(ptr, tex);
+}
+
+
+extern void
+_mesa_test_texobj_completeness( const struct gl_context *ctx,
+ struct gl_texture_object *obj );
+
+extern GLboolean
+_mesa_cube_complete(const struct gl_texture_object *texObj);
+
+extern void
+_mesa_dirty_texobj(struct gl_context *ctx, struct gl_texture_object *texObj,
+ GLboolean invalidate_state);
+
+extern struct gl_texture_object *
+_mesa_get_fallback_texture(struct gl_context *ctx);
+
+extern void
+_mesa_unlock_context_textures( struct gl_context *ctx );
+
+extern void
+_mesa_lock_context_textures( struct gl_context *ctx );
+
+/*@}*/
+
+/**
+ * \name API functions
+ */
+/*@{*/
+
+extern void GLAPIENTRY
+_mesa_GenTextures( GLsizei n, GLuint *textures );
+
+
+extern void GLAPIENTRY
+_mesa_DeleteTextures( GLsizei n, const GLuint *textures );
+
+
+extern void GLAPIENTRY
+_mesa_BindTexture( GLenum target, GLuint texture );
+
+
+extern void GLAPIENTRY
+_mesa_PrioritizeTextures( GLsizei n, const GLuint *textures,
+ const GLclampf *priorities );
+
+
+extern GLboolean GLAPIENTRY
+_mesa_AreTexturesResident( GLsizei n, const GLuint *textures,
+ GLboolean *residences );
+
+extern GLboolean GLAPIENTRY
+_mesa_IsTexture( GLuint texture );
+
+/*@}*/
+
+
+#endif
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c
index c39f85e89..2393a6386 100644
--- a/mesalib/src/mesa/program/program.c
+++ b/mesalib/src/mesa/program/program.c
@@ -421,12 +421,15 @@ _mesa_lookup_program(struct gl_context *ctx, GLuint id)
/**
* Reference counting for vertex/fragment programs
+ * This is normally only called from the _mesa_reference_program() macro
+ * when there's a real pointer change.
*/
void
-_mesa_reference_program(struct gl_context *ctx,
- struct gl_program **ptr,
- struct gl_program *prog)
+_mesa_reference_program_(struct gl_context *ctx,
+ struct gl_program **ptr,
+ struct gl_program *prog)
{
+#ifndef NDEBUG
assert(ptr);
if (*ptr && prog) {
/* sanity check */
@@ -438,9 +441,8 @@ _mesa_reference_program(struct gl_context *ctx,
else if ((*ptr)->Target == MESA_GEOMETRY_PROGRAM)
ASSERT(prog->Target == MESA_GEOMETRY_PROGRAM);
}
- if (*ptr == prog) {
- return; /* no change */
- }
+#endif
+
if (*ptr) {
GLboolean deleteFlag;
diff --git a/mesalib/src/mesa/program/program.h b/mesalib/src/mesa/program/program.h
index dcf8d1c25..0f32a6af7 100644
--- a/mesalib/src/mesa/program/program.h
+++ b/mesalib/src/mesa/program/program.h
@@ -1,210 +1,219 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.3
- *
- * 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 program.c
- * Vertex and fragment program support functions.
- * \author Brian Paul
- */
-
-
-/**
- * \mainpage Mesa vertex and fragment program module
- *
- * This module or directory contains most of the code for vertex and
- * fragment programs and shaders, including state management, parsers,
- * and (some) software routines for executing programs
- */
-
-#ifndef PROGRAM_H
-#define PROGRAM_H
-
-#include "main/compiler.h"
-#include "main/mtypes.h"
-
-
-extern struct gl_program _mesa_DummyProgram;
-
-
-extern void
-_mesa_init_program(struct gl_context *ctx);
-
-extern void
-_mesa_free_program_data(struct gl_context *ctx);
-
-extern void
-_mesa_update_default_objects_program(struct gl_context *ctx);
-
-extern void
-_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string);
-
-extern const GLubyte *
-_mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
- GLint *line, GLint *col);
-
-
-extern struct gl_program *
-_mesa_init_vertex_program(struct gl_context *ctx,
- struct gl_vertex_program *prog,
- GLenum target, GLuint id);
-
-extern struct gl_program *
-_mesa_init_fragment_program(struct gl_context *ctx,
- struct gl_fragment_program *prog,
- GLenum target, GLuint id);
-
-extern struct gl_program *
-_mesa_init_geometry_program(struct gl_context *ctx,
- struct gl_geometry_program *prog,
- GLenum target, GLuint id);
-
-extern struct gl_program *
-_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id);
-
-extern void
-_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog);
-
-extern struct gl_program *
-_mesa_lookup_program(struct gl_context *ctx, GLuint id);
-
-extern void
-_mesa_reference_program(struct gl_context *ctx,
- struct gl_program **ptr,
- struct gl_program *prog);
-
-static INLINE void
-_mesa_reference_vertprog(struct gl_context *ctx,
- struct gl_vertex_program **ptr,
- struct gl_vertex_program *prog)
-{
- _mesa_reference_program(ctx, (struct gl_program **) ptr,
- (struct gl_program *) prog);
-}
-
-static INLINE void
-_mesa_reference_fragprog(struct gl_context *ctx,
- struct gl_fragment_program **ptr,
- struct gl_fragment_program *prog)
-{
- _mesa_reference_program(ctx, (struct gl_program **) ptr,
- (struct gl_program *) prog);
-}
-
-static INLINE void
-_mesa_reference_geomprog(struct gl_context *ctx,
- struct gl_geometry_program **ptr,
- struct gl_geometry_program *prog)
-{
- _mesa_reference_program(ctx, (struct gl_program **) ptr,
- (struct gl_program *) prog);
-}
-
-extern struct gl_program *
-_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog);
-
-static INLINE struct gl_vertex_program *
-_mesa_clone_vertex_program(struct gl_context *ctx,
- const struct gl_vertex_program *prog)
-{
- return (struct gl_vertex_program *) _mesa_clone_program(ctx, &prog->Base);
-}
-
-static INLINE struct gl_geometry_program *
-_mesa_clone_geometry_program(struct gl_context *ctx,
- const struct gl_geometry_program *prog)
-{
- return (struct gl_geometry_program *) _mesa_clone_program(ctx, &prog->Base);
-}
-
-static INLINE struct gl_fragment_program *
-_mesa_clone_fragment_program(struct gl_context *ctx,
- const struct gl_fragment_program *prog)
-{
- return (struct gl_fragment_program *) _mesa_clone_program(ctx, &prog->Base);
-}
-
-
-extern GLboolean
-_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count);
-
-extern GLboolean
-_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count);
-
-extern struct gl_program *
-_mesa_combine_programs(struct gl_context *ctx,
- const struct gl_program *progA,
- const struct gl_program *progB);
-
-extern void
-_mesa_find_used_registers(const struct gl_program *prog,
- gl_register_file file,
- GLboolean used[], GLuint usedSize);
-
-extern GLint
-_mesa_find_free_register(const GLboolean used[],
- GLuint maxRegs, GLuint firstReg);
-
-
-extern GLboolean
-_mesa_valid_register_index(const struct gl_context *ctx,
- gl_shader_type shaderType,
- gl_register_file file, GLint index);
-
-extern void
-_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog);
-
-/* keep these in the same order as TGSI_PROCESSOR_* */
-
-static INLINE GLuint
-_mesa_program_target_to_index(GLenum v)
-{
- switch(v)
- {
- case GL_VERTEX_PROGRAM_ARB:
- return MESA_SHADER_VERTEX;
- case GL_FRAGMENT_PROGRAM_ARB:
- return MESA_SHADER_FRAGMENT;
- case GL_GEOMETRY_PROGRAM_NV:
- return MESA_SHADER_GEOMETRY;
- default:
- ASSERT(0);
- return ~0;
- }
-}
-
-static INLINE GLenum
-_mesa_program_index_to_target(GLuint i)
-{
- GLenum enums[MESA_SHADER_TYPES] = {
- GL_VERTEX_PROGRAM_ARB,
- GL_FRAGMENT_PROGRAM_ARB,
- GL_GEOMETRY_PROGRAM_NV,
- };
- if(i >= MESA_SHADER_TYPES)
- return 0;
- else
- return enums[i];
-}
-
-#endif /* PROGRAM_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.3
+ *
+ * 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 program.c
+ * Vertex and fragment program support functions.
+ * \author Brian Paul
+ */
+
+
+/**
+ * \mainpage Mesa vertex and fragment program module
+ *
+ * This module or directory contains most of the code for vertex and
+ * fragment programs and shaders, including state management, parsers,
+ * and (some) software routines for executing programs
+ */
+
+#ifndef PROGRAM_H
+#define PROGRAM_H
+
+#include "main/compiler.h"
+#include "main/mtypes.h"
+
+
+extern struct gl_program _mesa_DummyProgram;
+
+
+extern void
+_mesa_init_program(struct gl_context *ctx);
+
+extern void
+_mesa_free_program_data(struct gl_context *ctx);
+
+extern void
+_mesa_update_default_objects_program(struct gl_context *ctx);
+
+extern void
+_mesa_set_program_error(struct gl_context *ctx, GLint pos, const char *string);
+
+extern const GLubyte *
+_mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
+ GLint *line, GLint *col);
+
+
+extern struct gl_program *
+_mesa_init_vertex_program(struct gl_context *ctx,
+ struct gl_vertex_program *prog,
+ GLenum target, GLuint id);
+
+extern struct gl_program *
+_mesa_init_fragment_program(struct gl_context *ctx,
+ struct gl_fragment_program *prog,
+ GLenum target, GLuint id);
+
+extern struct gl_program *
+_mesa_init_geometry_program(struct gl_context *ctx,
+ struct gl_geometry_program *prog,
+ GLenum target, GLuint id);
+
+extern struct gl_program *
+_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id);
+
+extern void
+_mesa_delete_program(struct gl_context *ctx, struct gl_program *prog);
+
+extern struct gl_program *
+_mesa_lookup_program(struct gl_context *ctx, GLuint id);
+
+extern void
+_mesa_reference_program_(struct gl_context *ctx,
+ struct gl_program **ptr,
+ struct gl_program *prog);
+
+static INLINE void
+_mesa_reference_program(struct gl_context *ctx,
+ struct gl_program **ptr,
+ struct gl_program *prog)
+{
+ if (*ptr != prog)
+ _mesa_reference_program_(ctx, ptr, prog);
+}
+
+static INLINE void
+_mesa_reference_vertprog(struct gl_context *ctx,
+ struct gl_vertex_program **ptr,
+ struct gl_vertex_program *prog)
+{
+ _mesa_reference_program(ctx, (struct gl_program **) ptr,
+ (struct gl_program *) prog);
+}
+
+static INLINE void
+_mesa_reference_fragprog(struct gl_context *ctx,
+ struct gl_fragment_program **ptr,
+ struct gl_fragment_program *prog)
+{
+ _mesa_reference_program(ctx, (struct gl_program **) ptr,
+ (struct gl_program *) prog);
+}
+
+static INLINE void
+_mesa_reference_geomprog(struct gl_context *ctx,
+ struct gl_geometry_program **ptr,
+ struct gl_geometry_program *prog)
+{
+ _mesa_reference_program(ctx, (struct gl_program **) ptr,
+ (struct gl_program *) prog);
+}
+
+extern struct gl_program *
+_mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog);
+
+static INLINE struct gl_vertex_program *
+_mesa_clone_vertex_program(struct gl_context *ctx,
+ const struct gl_vertex_program *prog)
+{
+ return (struct gl_vertex_program *) _mesa_clone_program(ctx, &prog->Base);
+}
+
+static INLINE struct gl_geometry_program *
+_mesa_clone_geometry_program(struct gl_context *ctx,
+ const struct gl_geometry_program *prog)
+{
+ return (struct gl_geometry_program *) _mesa_clone_program(ctx, &prog->Base);
+}
+
+static INLINE struct gl_fragment_program *
+_mesa_clone_fragment_program(struct gl_context *ctx,
+ const struct gl_fragment_program *prog)
+{
+ return (struct gl_fragment_program *) _mesa_clone_program(ctx, &prog->Base);
+}
+
+
+extern GLboolean
+_mesa_insert_instructions(struct gl_program *prog, GLuint start, GLuint count);
+
+extern GLboolean
+_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count);
+
+extern struct gl_program *
+_mesa_combine_programs(struct gl_context *ctx,
+ const struct gl_program *progA,
+ const struct gl_program *progB);
+
+extern void
+_mesa_find_used_registers(const struct gl_program *prog,
+ gl_register_file file,
+ GLboolean used[], GLuint usedSize);
+
+extern GLint
+_mesa_find_free_register(const GLboolean used[],
+ GLuint maxRegs, GLuint firstReg);
+
+
+extern GLboolean
+_mesa_valid_register_index(const struct gl_context *ctx,
+ gl_shader_type shaderType,
+ gl_register_file file, GLint index);
+
+extern void
+_mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog);
+
+/* keep these in the same order as TGSI_PROCESSOR_* */
+
+static INLINE GLuint
+_mesa_program_target_to_index(GLenum v)
+{
+ switch(v)
+ {
+ case GL_VERTEX_PROGRAM_ARB:
+ return MESA_SHADER_VERTEX;
+ case GL_FRAGMENT_PROGRAM_ARB:
+ return MESA_SHADER_FRAGMENT;
+ case GL_GEOMETRY_PROGRAM_NV:
+ return MESA_SHADER_GEOMETRY;
+ default:
+ ASSERT(0);
+ return ~0;
+ }
+}
+
+static INLINE GLenum
+_mesa_program_index_to_target(GLuint i)
+{
+ GLenum enums[MESA_SHADER_TYPES] = {
+ GL_VERTEX_PROGRAM_ARB,
+ GL_FRAGMENT_PROGRAM_ARB,
+ GL_GEOMETRY_PROGRAM_NV,
+ };
+ if(i >= MESA_SHADER_TYPES)
+ return 0;
+ else
+ return enums[i];
+}
+
+#endif /* PROGRAM_H */
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index 4594356ce..b96f026dd 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -972,13 +972,13 @@ static void GLAPIENTRY
vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end,
GLsizei count, GLenum type, const GLvoid *indices)
{
- GET_CURRENT_CONTEXT(ctx);
-
- if (MESA_VERBOSE & VERBOSE_DRAW)
+ if (MESA_VERBOSE & VERBOSE_DRAW) {
+ GET_CURRENT_CONTEXT(ctx);
_mesa_debug(ctx,
"glDrawRangeElements(%s, %u, %u, %d, %s, %p)\n",
_mesa_lookup_enum_by_nr(mode), start, end, count,
_mesa_lookup_enum_by_nr(type), indices);
+ }
vbo_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type,
indices, 0);