From: Keith Whitwell Date: Thu, 11 Sep 2008 15:05:15 +0000 (+0100) Subject: Merge branch 'gallium-0.1' into gallium-0.2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0397b2bb41b0f337af2949a15bcd7d0e7e8a7dc1;p=mesa.git Merge branch 'gallium-0.1' into gallium-0.2 A first attempt at moving gallium onto a branch directly off master... It will be interesting to see how much work this takes to get running. Have resolved the conflicts semi-arbitarily, not compiled or tested. Conflicts: .gitignore Makefile configs/config.mgw configs/darwin configs/darwin-x86ppc configs/default configs/freebsd-dri configs/linux-dri configs/linux-dri-xcb configs/linux-fbdev configs/linux-static configs/linux-x86-64-static configs/linux-x86-static doxygen/Makefile include/GL/gl.h progs/demos/Makefile progs/demos/descrip.mms progs/demos/texenv.c progs/egl/.gitignore progs/egl/Makefile progs/glsl/.gitignore progs/glsl/Makefile progs/glsl/convolutions.c progs/samples/Makefile.mgw progs/tests/.gitignore progs/trivial/.gitignore progs/trivial/point-param.c progs/trivial/tri.c progs/xdemos/.gitignore progs/xdemos/glthreads.c src/egl/drivers/demo/Makefile src/egl/drivers/dri/Makefile src/egl/main/Makefile src/glu/Makefile src/glu/sgi/Makefile src/glu/sgi/Makefile.mgw src/glut/glx/Makefile.mgw src/glut/os2/WarpWin.cpp src/glut/os2/glut_cindex.cpp src/glut/os2/glut_gamemode.cpp src/glut/os2/glut_win.cpp src/glut/os2/glut_winmisc.cpp src/glut/os2/os2_glx.cpp src/glut/os2/os2_menu.cpp src/glut/os2/os2_winproc.cpp src/glw/Makefile src/glx/x11/dri_glx.c src/glx/x11/glxext.c src/mesa/Makefile src/mesa/Makefile.mgw src/mesa/descrip.mms src/mesa/drivers/beos/Makefile src/mesa/drivers/common/descrip.mms src/mesa/drivers/common/driverfuncs.c src/mesa/drivers/directfb/Makefile src/mesa/drivers/dri/Makefile.template src/mesa/drivers/dri/common/dri_bufmgr.c src/mesa/drivers/dri/common/dri_bufmgr.h src/mesa/drivers/dri/common/dri_util.c src/mesa/drivers/dri/common/extension_helper.h src/mesa/drivers/dri/common/mmio.h src/mesa/drivers/dri/common/utils.c src/mesa/drivers/dri/common/utils.h src/mesa/drivers/dri/glcore/Makefile src/mesa/drivers/dri/i810/i810screen.c src/mesa/drivers/dri/i915/intel_ioctl.c src/mesa/drivers/dri/i915/intel_ioctl.h src/mesa/drivers/dri/i915/intel_screen.c src/mesa/drivers/dri/i915/server/i830_common.h src/mesa/drivers/dri/i915/server/i830_dri.h src/mesa/drivers/dri/i965/intel_screen.c src/mesa/drivers/dri/i965/server/i830_common.h src/mesa/drivers/dri/i965/server/i830_dri.h src/mesa/drivers/dri/mach64/mach64_screen.c src/mesa/drivers/dri/nouveau/nouveau_context.h src/mesa/drivers/dri/nouveau/nouveau_fifo.c src/mesa/drivers/dri/nouveau/nouveau_fifo.h src/mesa/drivers/dri/nouveau/nouveau_screen.c src/mesa/drivers/dri/nouveau/nouveau_screen.h src/mesa/drivers/dri/r128/r128_tex.h src/mesa/drivers/dri/savage/savageioctl.h src/mesa/drivers/fbdev/Makefile src/mesa/drivers/osmesa/Makefile src/mesa/drivers/osmesa/descrip.mms src/mesa/drivers/x11/Makefile src/mesa/drivers/x11/descrip.mms src/mesa/drivers/x11/xm_dd.c src/mesa/glapi/glapi.c src/mesa/glapi/glthread.c src/mesa/main/api_validate.c src/mesa/main/attrib.c src/mesa/main/bufferobj.c src/mesa/main/bufferobj.h src/mesa/main/buffers.c src/mesa/main/config.h src/mesa/main/context.c src/mesa/main/descrip.mms src/mesa/main/drawpix.c src/mesa/main/enums.c src/mesa/main/fbobject.c src/mesa/main/glheader.h src/mesa/main/imports.c src/mesa/main/mipmap.c src/mesa/main/mm.c src/mesa/main/mm.h src/mesa/main/mtypes.h src/mesa/main/points.c src/mesa/main/sources src/mesa/main/state.c src/mesa/main/texcompress_fxt1.c src/mesa/main/texenvprogram.c src/mesa/main/texobj.c src/mesa/main/texstate.c src/mesa/main/texstore.c src/mesa/math/descrip.mms src/mesa/shader/arbprogram.c src/mesa/shader/descrip.mms src/mesa/shader/prog_execute.c src/mesa/shader/prog_statevars.c src/mesa/shader/prog_statevars.h src/mesa/shader/prog_uniform.c src/mesa/shader/program.c src/mesa/shader/program.h src/mesa/shader/shader_api.c src/mesa/shader/slang/descrip.mms src/mesa/shader/slang/library/slang_vertex_builtin_gc.h src/mesa/sources src/mesa/swrast/descrip.mms src/mesa/swrast/s_drawpix.c src/mesa/swrast/s_fragprog.c src/mesa/swrast/s_readpix.c src/mesa/swrast/s_span.c src/mesa/swrast_setup/descrip.mms src/mesa/tnl/descrip.mms src/mesa/tnl/t_context.h src/mesa/tnl/t_vp_build.c src/mesa/tnl/tnl.h src/mesa/vbo/descrip.mms src/mesa/vbo/vbo_context.c src/mesa/vbo/vbo_exec_array.c src/mesa/x86-64/xform4.S src/mesa/x86/rtasm/x86sse.c src/mesa/x86/rtasm/x86sse.h windows/VC6/progs/glut/glut.dsp windows/VC7/mesa/gdi/gdi.vcproj windows/VC7/mesa/glu/glu.vcproj windows/VC7/mesa/mesa.sln windows/VC7/mesa/mesa/mesa.vcproj windows/VC7/mesa/osmesa/osmesa.vcproj windows/VC7/progs/glut/glut.vcproj windows/VC8/mesa/gdi/gdi.vcproj windows/VC8/mesa/glu/glu.vcproj windows/VC8/mesa/mesa.sln windows/VC8/mesa/mesa/mesa.vcproj windows/VC8/progs/glut/glut.vcproj --- 0397b2bb41b0f337af2949a15bcd7d0e7e8a7dc1 diff --cc .gitignore index f5a0abcfe4b,5c9129535a1..d519cab474b --- a/.gitignore +++ b/.gitignore @@@ -1,16 -1,14 +1,21 @@@ *.a *.o + *.pyc + *.pyo *.so *.sw[a-z] +*.pc *~ depend depend.bak lib lib64 +configure +autom4te.cache +aclocal.m4 +config.log +config.status +cscope* + .sconsign* + config.py + build diff --cc Makefile index 2e86d11738f,9b3be43d505..b0cb16add00 --- a/Makefile +++ b/Makefile @@@ -23,19 -27,18 +25,18 @@@ clean (cd $$dir && $(MAKE) clean) ; \ fi \ done + -@test -s $(TOP)/configs/current || rm -f $(TOP)/configs/current -realclean: - -rm -f `find . -name \*.o` - -rm -f `find . -name \*.a` - -rm -f `find . -name \*.so` - -rm -f `find . -name depend` +realclean: clean -rm -rf lib* - $(MAKE) clean -rm -f $(TOP)/configs/current + -rm -f $(TOP)/configs/autoconf + -rm -rf autom4te.cache + -find . '(' -name '*.o' -o -name '*.a' -o -name '*.so' -o \ + -name depend -o -name depend.bak ')' -exec rm -f '{}' ';' - install: @for dir in $(SUBDIRS) ; do \ if [ -d $$dir ] ; then \ diff --cc configs/default index fe655e799b5,cd2c39c3650..76d03f5c5ae --- a/configs/default +++ b/configs/default @@@ -19,9 -18,9 +19,10 @@@ DRM_SOURCE_PATH=$(TOP)/../dr # Compiler and flags CC = cc CXX = CC + HOST_CC = $(CC) CFLAGS = -O CXXFLAGS = -O +LDFLAGS = GLU_CFLAGS = # Misc tools and flags @@@ -54,15 -49,9 +55,15 @@@ GLUT_LIB_NAME = lib$(GLUT_LIB).s GLW_LIB_NAME = lib$(GLW_LIB).so OSMESA_LIB_NAME = lib$(OSMESA_LIB).so +# globs used to install the lib and all symlinks +GL_LIB_GLOB = $(GL_LIB_NAME)* +GLU_LIB_GLOB = $(GLU_LIB_NAME)* +GLUT_LIB_GLOB = $(GLUT_LIB_NAME)* +GLW_LIB_GLOB = $(GLW_LIB_NAME)* +OSMESA_LIB_GLOB = $(OSMESA_LIB_NAME)* # Optional assembly language optimization files for libGL - ASM_SOURCES = + MESA_ASM_SOURCES = # GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in # order to build the Motif widget too) @@@ -78,17 -66,26 +79,28 @@@ DRIVER_DIRS # Which subdirs under $(TOP)/progs/ to enter: PROGRAM_DIRS = demos redbook samples glsl xdemos + # EGL directories + EGL_DRIVERS_DIRS = demo + + # Gallium directories and + GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util + GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a) + GALLIUM_DRIVER_DIRS = softpipe i915simple i965simple failover + GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVER_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a) + GALLIUM_WINSYS_DIRS = xlib egl_xlib + -# Library/program dependencies +# Library dependencies #EXTRA_LIB_PATH ?= - GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread - OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) - GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm - GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lX11 -lXmu -lXi -lm - GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lXt -lX11 + GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lm -lpthread + OSMESA_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) + GLU_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm + GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXi -lm + GLW_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lXt -lX11 + APP_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm +# Program dependencies - specific GL/glut libraries added in Makefiles +APP_LIB_DEPS = -lm # Installation directories (for make install) diff --cc configs/freebsd-dri index 9d9215483d9,6fc1abbc802..f7e1fa0c190 --- a/configs/freebsd-dri +++ b/configs/freebsd-dri @@@ -22,11 -22,7 +22,12 @@@ CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(P CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) -Wall -ansi -pedantic $(ASM_FLAGS) $(X11_INCLUDES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing + +ASM_SOURCES = + MESA_ASM_SOURCES = # Library/program dependencies LIBDRM_CFLAGS = `pkg-config --cflags libdrm` diff --cc configs/linux-dri index 8c325c7d345,d441194b08c..ac940c0f07a --- a/configs/linux-dri +++ b/configs/linux-dri @@@ -32,43 -32,31 +32,51 @@@ CFLAGS = -Wall -Wmissing-prototypes -st CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +GLUT_CFLAGS = -fexceptions + +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing - ASM_SOURCES = + MESA_ASM_SOURCES = # Library/program dependencies EXTRA_LIB_PATH=-L/usr/X11R6/lib - LIBDRM_CFLAGS = `pkg-config --cflags libdrm` - LIBDRM_LIB = `pkg-config --libs libdrm` + LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm) + LIBDRM_LIB = $(shell pkg-config --libs libdrm) DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ - -lm -lpthread -ldl \ - $(LIBDRM_LIB) + -lm -lpthread -ldl $(LIBDRM_LIB) - # This is now 0 by default since it seems to confuse the hell out of people - # and generate a lot of extra noise on bugzilla. If you need to build with - # EGL, do 'make linux-dri USING_EGL=1' + # Directories + SRC_DIRS := glx/x11 egl $(SRC_DIRS) - USING_EGL=0 +# Directories +ifeq ($(USING_EGL), 1) +SRC_DIRS = egl glx/x11 mesa glu glut/glx glw +PROGRAM_DIRS = egl xdemos +else +SRC_DIRS = glx/x11 mesa glu glut/glx glw +PROGRAM_DIRS = xdemos +endif + - DRIVER_DIRS = dri - WINDOW_SYSTEM=dri + # EGL directories + EGL_DRIVERS_DIRS = demo dri xdri + + DRIVER_DIRS = + WINDOW_SYSTEM = dri + GALLIUM_WINSYS_DIRS = drm egl_xlib # gamma are missing because they have not been converted to use the new # interface. - DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \ - savage sis tdfx trident unichrome ffb ++ ++# XXX: need to figure out a way for gallium and non-gallium builds to ++# coexist: ++# ++ ++#DRI_DIRS = i810 i915 i965 mach64 mga r128 r200 r300 radeon s3v \ ++# savage sis tdfx trident unichrome ffb + DRI_DIRS = intel diff --cc configs/linux-dri-xcb index 6d11f1744c9,fbf9b9b2687..d7b00a266ed --- a/configs/linux-dri-xcb +++ b/configs/linux-dri-xcb @@@ -32,21 -32,17 +32,20 @@@ CFLAGS = -Wall -Wmissing-prototypes $(O CXXFLAGS = -Wall $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing - ASM_SOURCES = + MESA_ASM_SOURCES = # Library/program dependencies - EXTRA_LIB_PATH=`pkg-config --libs-only-L x11` + EXTRA_LIB_PATH=$(shell pkg-config --libs-only-L x11) - LIBDRM_CFLAGS = `pkg-config --cflags libdrm` - LIBDRM_LIB = `pkg-config --libs libdrm` + LIBDRM_CFLAGS = $(shell pkg-config --cflags libdrm) + LIBDRM_LIB = $(shell pkg-config --libs libdrm) DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl $(LIBDRM_LIB) - GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \ - -lm -lpthread -ldl $(LIBDRM_LIB) `pkg-config --libs xcb` \ - `pkg-config --libs x11-xcb` `pkg-config --libs xcb-glx` + GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl \ + $(LIBDRM_LIB) $(shell pkg-config --libs xcb) $(shell pkg-config --libs x11-xcb) $(shell pkg-config --libs xcb-glx) # This is now 0 by default since it seems to confuse the hell out of people @@@ -57,11 -53,11 +56,11 @@@ USING_EGL= # Directories ifeq ($(USING_EGL), 1) - SRC_DIRS = egl glx/x11 mesa glu glut/glx glw - PROGRAM_DIRS = egl xdemos + SRC_DIRS = egl glx/x11 gallium mesa glu glut/glx glw + PROGRAM_DIRS = egl else - SRC_DIRS = glx/x11 mesa glu glut/glx glw + SRC_DIRS = glx/x11 gallium mesa glu glut/glx glw -PROGRAM_DIRS = +PROGRAM_DIRS = xdemos endif DRIVER_DIRS = dri diff --cc configs/linux-fbdev index 69d10127c8e,1ddccb3f52b..f54c73695a3 --- a/configs/linux-fbdev +++ b/configs/linux-fbdev @@@ -6,10 -6,7 +6,10 @@@ CONFIG_NAME = linux-fbde CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing + - SRC_DIRS = mesa glu glut/fbdev + SRC_DIRS = gallium mesa glu glut/fbdev DRIVER_DIRS = fbdev osmesa PROGRAM_DIRS = fbdev demos redbook samples diff --cc configs/linux-indirect index 17c7126e115,0c4805ea87c..310ae6dde63 --- a/configs/linux-indirect +++ b/configs/linux-indirect @@@ -33,11 -33,8 +33,11 @@@ CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $ CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing - ASM_SOURCES = + MESA_ASM_SOURCES = # Library/program dependencies EXTRA_LIB_PATH=-L/usr/X11R6/lib diff --cc configs/linux-osmesa index 504980b22d7,0382a19553a..c112642f899 --- a/configs/linux-osmesa +++ b/configs/linux-osmesa @@@ -12,12 -12,9 +12,12 @@@ CXX = g+ CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing # Directories - SRC_DIRS = mesa glu + SRC_DIRS = gallium mesa glu DRIVER_DIRS = osmesa PROGRAM_DIRS = osdemos diff --cc configs/linux-solo index e01f2c8a39d,3145e127757..4be7680ca59 --- a/configs/linux-solo +++ b/configs/linux-solo @@@ -32,11 -32,8 +32,11 @@@ CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $ CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing - ASM_SOURCES = + MESA_ASM_SOURCES = # Library/program dependencies DRI_LIB_DEPS = -lm -lpthread -lexpat -ldl -L$(TOP)/$(LIB_DIR) $(PCIACCESS_LIB) diff --cc configs/linux-solo-x86 index e37b9fb428d,5f5aa09c826..a9bf3882602 --- a/configs/linux-solo-x86 +++ b/configs/linux-solo-x86 @@@ -5,6 -5,9 +5,6 @@@ include $(TOP)/configs/linux-sol CONFIG_NAME = linux-solo-x86 -# Unnecessary on x86, generally. -PIC_FLAGS = - ASM_FLAGS = -DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM - ASM_SOURCES = $(X86_SOURCES) - ASM_API = $(X86_API) + MESA_ASM_SOURCES = $(X86_SOURCES) + GLAPI_ASM_SOURCES = $(X86_API) diff --cc configs/linux-static index 1ee16be73f2,d5fbe9cf651..2fc39ff83ef --- a/configs/linux-static +++ b/configs/linux-static @@@ -22,5 -21,7 +22,7 @@@ GLUT_LIB_DEPS GLW_LIB_DEPS = # Need to specify all libraries we may need - APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread \ - -lstdc++ -lm + APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \ + -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group -lm \ - -L/usr/X11R6/lib/ -lX11 -lXmu -lXi -lpthread ++ -L/usr/X11R6/lib/ -lX11 -lXext -lXmu -lXi -lpthread + diff --cc configs/linux-x86-64-static index 611abf075d1,909965da368..626d579ac0e --- a/configs/linux-x86-64-static +++ b/configs/linux-x86-64-static @@@ -20,5 -19,8 +20,8 @@@ OSMESA_LIB_DEPS GLU_LIB_DEPS = GLUT_LIB_DEPS = GLW_LIB_DEPS = - APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread \ - -lstdc++ -lm + + # Need to specify all libraries we may need + APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \ + -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group \ - $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm ++ $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm diff --cc configs/linux-x86-glide index 941efc1e598,b963fbdc66b..603b2bf758b --- a/configs/linux-x86-glide +++ b/configs/linux-x86-glide @@@ -14,12 -14,9 +14,12 @@@ CXXFLAGS = -Wall -O3 -ansi -pedantic -f GLUT_CFLAGS = -fexceptions +# Work around aliasing bugs - developers should comment this out +CFLAGS += -fno-strict-aliasing +CXXFLAGS += -fno-strict-aliasing - ASM_SOURCES = $(X86_SOURCES) - ASM_API = $(X86_API) + MESA_ASM_SOURCES = $(X86_SOURCES) + GLAPI_ASM_SOURCES = $(X86_API) # Library/program dependencies GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -L/usr/local/glide/lib -lglide3x -lm -lpthread diff --cc configs/linux-x86-static index 645196c09fa,3b281e6685e..65c92cf3524 --- a/configs/linux-x86-static +++ b/configs/linux-x86-static @@@ -20,5 -19,8 +20,8 @@@ OSMESA_LIB_DEPS GLU_LIB_DEPS = GLUT_LIB_DEPS = GLW_LIB_DEPS = - APP_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread \ - -lstdc++ -lm + + # Need to specify all libraries we may need + APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -Wl,--start-group \ + -l$(GL_LIB) $(TOP)/src/mesa/pipe/softpipe/libsoftpipe.a -Wl,--end-group \ - $(EXTRA_LIB_PATH) -lX11 -lXmu -lXt -lXi -lpthread -lstdc++ -lm ++ $(EXTRA_LIB_PATH) -lX11 -lXext -lXmu -lXt -lXi -lpthread -lstdc++ -lm diff --cc docs/OLD/MESA_packed_depth_stencil.spec index 4f7ab1e28cf,00000000000..112b730ecc2 mode 100644,000000..100644 --- a/docs/OLD/MESA_packed_depth_stencil.spec +++ b/docs/OLD/MESA_packed_depth_stencil.spec @@@ -1,231 -1,0 +1,230 @@@ +Name + + MESA_packed_depth_stencil + +Name Strings + + GL_MESA_packed_depth_stencil + +Contact + + Keith Whitwell, VA Linux Systems Inc. (keithw 'at' valinux.com) + Brian Paul, VA Linux Systems Inc. (brianp 'at' valinux.com) + +Status + + Obsolete. + +Version + - $Id: MESA_packed_depth_stencil.spec,v 1.2 2003/09/19 14:58:21 brianp Exp $ + +Number + + ??? + +Dependencies + + EXT_abgr affects the definition of this extension + SGIS_texture4D affects the definition of this extension + EXT_cmyka affects the definition of this extension + ARB_packed_pixels affects the definition of this extension + +Overview + + Provides a mechanism for DrawPixels and ReadPixels to efficiently + transfer depth and stencil image data. Specifically, we defined new + packed pixel formats and types which pack both stencil and depth + into one value. + +Issues: + + 1. Is this the right way to distinguish between 24/8 and 8/24 + pixel formats? Should we instead provide both: + + GL_DEPTH_STENCIL_MESA + GL_STENCIL_DEPTH_MESA + + And perhaps just use GL_UNSIGNED_INT, GL_UNSIGNED_SHORT ? + + 2. If not, is it correct to use _REV to indicate that stencil + preceeds depth in the 1_15 and 8_24 formats? + + 3. Do we really want the GL_UNSIGNED_SHORT formats? + + +New Procedures and Functions + + None. + +New Tokens + + Accepted by the parameter of ReadPixels and DrawPixels: + + GL_DEPTH_STENCIL_MESA 0x8750 + + Accepted by the parameter of ReadPixels and DrawPixels: + + GL_UNSIGNED_INT_24_8_MESA 0x8751 + GL_UNSIGNED_INT_8_24_REV_MESA 0x8752 + GL_UNSIGNED_SHORT_15_1_MESA 0x8753 + GL_UNSIGNED_SHORT_1_15_REV_MESA 0x8754 + +Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the 1.1 Specification (Rasterization) + + One entry is added to table 3.5 (DrawPixels and ReadPixels formats). + The new table is: + + Target + Format Name Buffer Element Meaning and Order + ----------- ------ ------------------------- + COLOR_INDEX Color Color index + STENCIL_INDEX Stencil Stencil index + DEPTH_COMPONENT Depth Depth component + RED Color R component + GREEN Color G component + BLUE Color B component + ALPHA Color A component + RGB Color R, G, B components + RGBA Color R, G, B, A components + BGRA Color B, G, R, A components + ABGR_EXT Color A, B, G, R components + CMYK_EXT Color Cyan, Magenta, Yellow, Black components + CMYKA_EXT Color Cyan, Magenta, Yellow, Black, A components + LUMINANCE Color Luminance component + LUMINANCE_ALPHA Color Luminance, A components + DEPTH_STENCIL Depth, Depth component, stencil index. + Stencil + + Table 3.5: DrawPixels and ReadPixels formats. The third column + gives a description of and the number and order of elements in a + group. + + Add to the description of packed pixel formats: + + Parameter Data of Matching + Token Name Type Elements Pixel Formats + ---------------- ---- -------- ------------- + + UNSIGNED_BYTE_3_3_2 ubyte 3 RGB + UNSIGNED_BYTE_2_3_3_REV ubyte 3 RGB + UNSIGNED_SHORT_5_6_5 ushort 3 RGB + UNSIGNED_SHORT_5_6_5_REV ushort 3 RGB + UNSIGNED_SHORT_4_4_4_4 ushort 4 RGBA,BGRA,ABGR_EXT,CMYK_EXT + UNSIGNED_SHORT_4_4_4_4_REV ushort 4 RGBA,BGRA + UNSIGNED_SHORT_5_5_5_1 ushort 4 RGBA,BGRA,ABGR_EXT,CMYK_EXT + UNSIGNED_SHORT_1_5_5_5_REV ushort 4 RGBA,BGRA + UNSIGNED_INT_8_8_8_8 uint 4 RGBA,BGRA,ABGR_EXT,CMYK_EXT + UNSIGNED_INT_8_8_8_8_REV uint 4 RGBA,BGRA + UNSIGNED_INT_10_10_10_2 uint 4 RGBA,BGRA,ABGR_EXT,CMYK_EXT + UNSIGNED_INT_2_10_10_10_REV uint 4 RGBA,BGRA + UNSIGNED_SHORT_15_1_MESA ushort 2 DEPTH_STENCIL_MESA + UNSIGNED_SHORT_1_15_REV_MESA ushort 2 DEPTH_STENCIL_MESA + UNSIGNED_SHORT_24_8_MESA ushort 2 DEPTH_STENCIL_MESA + UNSIGNED_SHORT_8_24_REV_MESA ushort 2 DEPTH_STENCIL_MESA + + UNSIGNED_INT_8_24: + + 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + +-----------------------+-----------------------------------------------------------------------+ + | | | + +-----------------------+-----------------------------------------------------------------------+ + + first second + element element + + + UNSIGNED_INT_24_8: + + 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + +----------------------------------------------------------------------+------------------------+ + | | | + +----------------------------------------------------------------------+------------------------+ + + first second + element element + + UNSIGNED_SHORT_15_1: + + 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + +-----------------------------------------------------------+---+ + | | | + +-----------------------------------------------------------+---+ + + first second + element element + + + UNSIGNED_SHORT_1_15_REV: + + 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 + +---+-----------------------------------------------------------+ + | | | + +---+-----------------------------------------------------------+ + + second first + element element + + The assignment of elements to fields in the packed pixel is as + described in the table below: + + First Second Third Fourth + Format Element Element Element Element + ------ ------- ------- ------- ------- + RGB red green blue + RGBA red green blue alpha + BGRA blue green red alpha + ABGR_EXT alpha blue green red + CMYK_EXT cyan magenta yellow black + DEPTH_STENCIL_MESA depth stencil + +Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations +and the Frame Buffer) + + The new format is added to the discussion of Obtaining Pixels from the + Framebuffer. It should read " If the is one of RED, GREEN, + BLUE, ALPHA, RGB, RGBA, ABGR_EXT, LUMINANCE, or LUMINANCE_ALPHA, and + the GL is in color index mode, then the color index is obtained." + + The new format is added to the discussion of Index Lookup. It should + read "If is one of RED, GREEN, BLUE, ALPHA, RGB, RGBA, + ABGR_EXT, LUMINANCE, or LUMINANCE_ALPHA, then the index is used to + reference 4 tables of color components: PIXEL_MAP_I_TO_R, + PIXEL_MAP_I_TO_G, PIXEL_MAP_I_TO_B, and PIXEL_MAP_I_TO_A." + + +Additions to Chapter 5 of the 1.1 Specification (Special Functions) + + None + +Additions to Chapter 6 of the 1.1 Specification (State and State Requests) + + None + +Additions to the GLX Specification + + None + +GLX Protocol + + TBD + +Errors + + None + +New State + + None + +Revision History + + Version 1.0 - 23 Sep 2000 + Keith's original version. + + Version 1.1 - 3 Nov 2000 + Brian's edits, assigned values to new enums. + diff --cc docs/OLD/MESA_program_debug.spec index 391d39fa70a,00000000000..7694fdcc425 mode 100644,000000..100644 --- a/docs/OLD/MESA_program_debug.spec +++ b/docs/OLD/MESA_program_debug.spec @@@ -1,357 -1,0 +1,356 @@@ +Name + + MESA_program_debug + +Name Strings + + GL_MESA_program_debug + +Contact + + Brian Paul (brian.paul 'at' tungstengraphics.com) + +Status + + XXX - Not complete yet!!! + +Version + + Last Modified Date: July 20, 2003 + Author Revision: 1.0 - $Date: 2004/03/25 01:42:41 $ $Revision: 1.4 $ + +Number + + TBD + +Dependencies + + OpenGL 1.4 is required + The extension is written against the OpenGL 1.4 specification. + ARB_vertex_program or ARB_fragment_program or NV_vertex_program + or NV_fragment_program is required. + +Overview + + The extension provides facilities for implementing debuggers for + vertex and fragment programs. + + The concept is that vertex and fragment program debuggers will be + implemented outside of the GL as a utility package. This extension + only provides the minimal hooks required to implement a debugger. + + There are facilities to do the following: + 1. Have the GL call a user-specified function prior to executing + each vertex or fragment instruction. + 2. Query the current program string's execution position. + 3. Query the current values of intermediate program values. + + The main feature is the ProgramCallbackMESA function. It allows the + user to register a callback function with the GL. The callback will + be called prior to executing each vertex or fragment program instruction. + + From within the callback, the user may issue Get* commands to + query current GL state. The GetProgramRegisterfvMESA function allows + current program values to be queried (such as temporaries, input + attributes, and result registers). + + There are flags for enabling/disabling the program callbacks. + + The current execution position (as an offset from the start of the + program string) can be queried with + GetIntegerv(GL_FRAGMENT_PROGRAM_POSITION_MESA, &pos) or + GetIntegerv(GL_VERTEX_PROGRAM_POSITION_MESA, &pos). + + +IP Status + + None + +Issues + + 1. Is this the right model for a debugger? + + It seems prudent to minimize the scope of this extension and leave + it up to the developer (or developer community) to write debuggers + that layer on top of this extension. + + If the debugger were fully implemented within the GL it's not + clear how terminal and GUI-based interfaces would work, for + example. + + 2. There aren't any other extensions that register callbacks with + the GL. Isn't there another solution? + + If we want to be able to single-step through vertex/fragment + programs I don't see another way to do it. + + 3. How do we prevent the user from doing something crazy in the + callback function, like trying to call glBegin (leading to + recursion)? + + The rule is that the callback function can only issue glGet*() + functions and no other GL commands. It could be difficult to + enforce this, however. Therefore, calling any non-get GL + command from within the callback will result in undefined + results. + + 4. Is this extension amenable to hardware implementation? + + Hopefully, but if not, the GL implementation will have to fall + back to a software path when debugging. This may be acceptable + for debugging. + + 5. What's the parameter to ProgramCallbackMESA for? + + It's a common programming practice to associate a user-supplied + value with callback functions. + + 6. Debuggers often allow one to modify intermediate program values, + then continue. Does this extension support that? + + No. + + +New Procedures and Functions (and datatypes) + + typedef void (*programcallbackMESA)(enum target, void *data) + + void ProgramCallbackMESA(enum target, programcallbackMESA callback, + void *data) + + void GetProgramRegisterfvMESA(enum target, sizei len, + const ubyte *registerName, float *v) + +New Tokens + + Accepted by the parameter of Enable, Disable, IsEnabled, + GetBooleanv, GetDoublev, GetFloatv and GetIntegerv: + + FRAGMENT_PROGRAM_CALLBACK_MESA 0x8bb1 + VERTEX_PROGRAM_CALLBACK_MESA 0x8bb4 + + Accepted by the parameter GetBooleanv, GetDoublev, + GetFloatv and GetIntegerv: + + FRAGMENT_PROGRAM_POSITION_MESA 0x8bb0 + VERTEX_PROGRAM_POSITION_MESA 0x8bb4 + + Accepted by the parameter of GetPointerv: + + FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x8bb2 + FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x8bb3 + VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x8bb6 + VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x8bb7 + +Additions to Chapter 2 of the OpenGL 1.4 Specification (OpenGL Operation) + + None. + +Additions to Chapter 3 of the OpenGL 1.4 Specification (Rasterization) + + None. + +Additions to Chapter 4 of the OpenGL 1.4 Specification (Per-Fragment +Operations and the Frame Buffer) + + None. + +Additions to Chapter 5 of the OpenGL 1.4 Specification (Special Functions) + + In section 5.4 "Display Lists", page 202, add the following command + to the list of those that are not compiled into display lists: + + ProgramCallbackMESA. + + + Add a new section 5.7 "Callback Functions" + + The function + + void ProgramCallbackMESA(enum target, programcallbackMESA callback, + void *data) + + registers a user-defined callback function with the GL. + may be FRAGMENT_PROGRAM_ARB or VERTEX_PROGRAM_ARB. The enabled + callback functions registered with these targets will be called + prior to executing each instruction in the current fragment or + vertex program, respectively. The callbacks are enabled and + disabled by calling Enable or Disable with + FRAGMENT_PROGRAM_ARB or VERTEX_PROGRAM_ARB. + + The callback function's signature must match the typedef + + typedef void (*programcallbackMESA)(enum target, void *data) + + When the callback function is called, will either be + FRAGMENT_PROGRAM_ARB or VERTEX_PROGRAM_ARB to indicate which + program is currently executing and will be the value + specified when ProgramCallbackMESA was called. + + From within the callback function, only the following GL commands + may be called: + + GetBooleanv + GetDoublev + GetFloatv + GetIntegerv + GetProgramLocalParameter + GetProgramEnvParameter + GetProgramRegisterfvMESA + GetProgramivARB + GetProgramStringARB + GetError + + Calling any other command from within the callback results in + undefined behaviour. + + +Additions to Chapter 6 of the OpenGL 1.4 Specification (State and +State Requests) + + Add a new section 6.1.3 "Program Value Queries": + + The command + + void GetProgramRegisterfvMESA(enum target, sizei len, + const ubyte *registerName, + float *v) + + Is used to query the value of program variables and registers + during program execution. GetProgramRegisterfvMESA may only be + called from within a callback function registered with + ProgramCallbackMESA. + + and specify the name a variable, input + attribute, temporary, or result register in the program string. + The current value of the named variable is returned as four + values in . If doesn't exist in the program string, + the error INVALID_OPERATION is generated. + +Additions to Appendix A of the OpenGL 1.4 Specification (Invariance) + + None. + +Additions to the AGL/GLX/WGL Specifications + + None. + +GLX Protocol + + XXX TBD + +Dependencies on NV_vertex_program and NV_fragment_program + + If NV_vertex_program and/or NV_fragment_program are supported, + vertex and/or fragment programs defined by those extensions may + be debugged as well. Register queries will use the syntax used + by those extensions (i.e. "v[X]" to query vertex attributes, + "o[X]" for vertex outputs, etc.) + +Errors + + INVALID_OPERATION is generated if ProgramCallbackMESA is called + between Begin and End. + + INVALID_ENUM is generated by ProgramCallbackMESA if is not + a supported vertex or fragment program type. + + Note: INVALID_OPERAION IS NOT generated by GetProgramRegisterfvMESA, + GetBooleanv, GetDoublev, GetFloatv, or GetIntegerv if called between + Begin and End when a vertex or fragment program is currently executing. + + INVALID_ENUM is generated by ProgramCallbackMESA, + GetProgramRegisterfvMESA if is not a program target supported + by ARB_vertex_program, ARB_fragment_program (or NV_vertex_program or + NV_fragment_program). + + INVALID_VALUE is generated by GetProgramRegisterfvMESA if + does not name a known program register or variable. + + INVALID_OPERATION is generated by GetProgramRegisterfvMESA when a + register query is attempted for a program target that's not currently + being executed. + + +New State + + XXX finish + +(table 6.N, p. ###) + Initial + Get Value Type Get Command Value Description Sec. Attribute + --------- ---- ----------- ----- ----------- ---- --------- + FRAGMENT_PROGRAM_CALLBACK_MESA B IsEnabled FALSE XXX XXX enable + VERTEX_PROGRAM_CALLBACK_MESA B IsEnabled FALSE XXX XXX enable + FRAGMENT_PROGRAM_POSITION_MESA Z+ GetIntegerv -1 XXX XXX - + VERTEX_PROGRAM_POSITION_MESA Z+ GetIntegerv -1 XXX XXX - + FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA P GetPointerv NULL XXX XXX - + VERTEX_PROGRAM_CALLBACK_FUNC_MESA P GetPointerv NULL XXX XXX - + FRAGMENT_PROGRAM_CALLBACK_DATA_MESA P GetPointerv NULL XXX XXX - + VERTEX_PROGRAM_CALLBACK_DATA_MESA P GetPointerv NULL XXX XXX - + + XXX more? + +New Implementation Dependent State + + None. + +Revision History + + 8 July 2003 + Initial draft. (Brian Paul) + 11 July 2003 + Second draft. (Brian Paul) + 20 July 2003 + Third draft. Lots of fundamental changes. (Brian Paul) + 23 July 2003 + Added chapter 5 and 6 spec language. (Brian Paul) + +Example Usage + + The following is a very simple example of how this extension may + be used to print the values of R0, R1, R2 and R3 while executing + vertex programs. + + + /* This is called by the GL when the vertex program is executing. + * We can only make glGet* calls from within this function! + */ + void DebugCallback(GLenum target, GLvoid *data) + { + GLint pos; + GLuint i; + + /* Get PC and current instruction string */ + glGetIntegerv(GL_VERTEX_PROGRAM_POSITION_ARB, &pos); + + printf("Current position: %d\n", pos); + + printf("Current temporary registers:\n"); + for (i = 0; i < 4; i++) { + GLfloat v[4]; + char s[10]; + sprintf(s, "R%d", i); + glGetProgramRegisterfvMESA(GL_VERTEX_PROGRAM_ARB, strlen(s), s, v); + printf("R%d = %g, %g, %g, %g\n", i, v[0], v[1], v[2], v[3]); + } + } + + + /* + * elsewhere... + */ + + /* Register our debugger callback function */ + glProgramCallbackMESA(GL_VERTEX_PROGRAM_ARB, DebugCallback, NULL); + glEnable(GL_VERTEX_PROGRAM_CALLBACK_MESA); + + /* define/bind a vertex program */ + + glEnable(GL_VERTEX_PROGRAM); + + /* render something */ + glBegin(GL_POINTS); + glVertex2f(0, 0); + glEnd(); + diff --cc docs/OLD/MESA_sprite_point.spec index 9422ff57295,00000000000..b50d78e9e7b mode 100644,000000..100644 --- a/docs/OLD/MESA_sprite_point.spec +++ b/docs/OLD/MESA_sprite_point.spec @@@ -1,191 -1,0 +1,190 @@@ +Name + + MESA_sprite_point + +Name Strings + + GL_MESA_sprite_point + +Contact + + Brian Paul, VA Linux Systems Inc. (brianp 'at' valinux.com) + +Status + + Obsolete - see GL_ARB_point_sprite. + +Version + - $Id: MESA_sprite_point.spec,v 1.2 2003/09/19 14:58:21 brianp Exp $ + +Number + + ??? + +Dependencies + + GL_EXT_point_parameters effects the definition of this extension + GL_ARB_multitexture effects the definition of this extension + +Overview + + This extension modifies the way in which points are rendered, + specifically when they're textured. When SPRITE_POINT_MESA is enabled + a point is rendered as if it were a quadrilateral with unique texture + coordinates at each vertex. This extension effectively turns points + into sprites which may be rendered more easily and quickly than using + conventional textured quadrilaterals. + + When using point size > 1 or attenuated points this extension is an + effective way to render many small sprite images for particle systems + or other effects. + +Issues: + + 1. How are the texture coordinates computed? + + The lower-left corner has texture coordinate (0,0,r,q). + The lower-right, (1,0,r,q). The upper-right, (1,1,r,q). + The upper-left, (0,1,r,q). + + 2. What about texgen and texture matrices? + + Texgen and the texture matrix have no effect on the point's s and t + texture coordinates. The r and q coordinates may have been computed + by texgen or the texture matrix. Note that with a 3D texture and/or + texgen that the r coordinate could be used to select a slice in the + 3D texture. + + 3. What about point smoothing? + + When point smoothing is enabled, a triangle fan could be rendered + to approximate a circular point. This could be problematic to + define and implement so POINT_SMOOTH is ignored when drawing sprite + points. + + Smoothed points can be approximated by using an appropriate texture + images, alpha testing and blending. + + POLYGON_SMOOTH does effect the rendering of the quadrilateral, however. + + 4. What about sprite rotation? + + There is none. Sprite points are always rendered as window-aligned + squares. One could define rotated texture images if desired. A 3D + texture and appropriate texture r coordinates could be used to + effectively specify image rotation per point. + + 5. What about POLYGON_MODE? + + POLYGON_MODE does not effect the rasterization of the quadrilateral. + + 6. What about POLYGON_CULL? + + TBD. Polygon culling is normally specified and implemented in the + transformation stage of OpenGL. However, some rasterization hardware + implements it later during triangle setup. + + Polygon culling wouldn't be useful for sprite points since the + quadrilaterals are always defined in counter-clockwise order in + window space. For that reason, polygon culling should probably be + ignored. + + 7. Should sprite points be alpha-attenuated if their size is below the + point parameter's threshold size? + + 8. Should there be an advertisized maximum sprite point size? + + No. Since we're rendering the point as a quadrilateral there's no + need to limit the size. + + +New Procedures and Functions + + None. + +New Tokens + + Accepted by the parameter of Enable, Disable, IsEnabled, + GetIntegerv, GetBooleanv, GetFloatv and GetDoublev: + + SPRITE_POINT_MESA 0x???? + MAX_SPRITE_POINT_SIZE_MESA 0x???? (need this?) + +Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) + + None + +Additions to Chapter 3 of the 1.1 Specification (Rasterization) + + Section ???. + + When SPRITE_POINT_MESA is enabled points are rasterized as screen- + aligned quadrilaterals. If the four vertices of the quadrilateral + are labeled A, B, C, and D, starting at the lower-left corner and moving + counter-clockwise around the quadrilateral, then the vertex and + texture coordinates are computed as follows: + + vertex window coordinate texture coordinate + A (x-r, y-r, z, w) (0, 0, r, q) + B (x+r, y-r, z, w) (1, 0, r, q) + C (x+r, y+r, z, w) (1, 1, r, q) + D (x-r, y+r, z, w) (0, 1, r, q) + + where x, y, z, w are the point's window coordinates, r and q are the + point's 3rd and 4th texture coordinates and r is half the point's + size. The other vertex attributes (such as the color and fog coordinate) + are simply duplicated from the original point vertex. + + Point size may either be specified with PointSize or computed + according to the EXT_point_parameters extension. + + The new texture coordinates are not effected by texgen or the texture + matrix. Note, however, that the texture r and q coordinates are passed + unchanged and may have been computed with texgen and/or the texture + matrix. + + If multiple texture units are present the same texture coordinate is + used for all texture units. + + The point is then rendered as if it were a quadrilateral using the + normal point sampling rules. POLYGON_MODE does not effect the + rasterization of the quadrilateral but POLYGON_SMOOTH does. + + POINT_SMOOTH has no effect when SPRITE_POINT_MESA is enabled. + +Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations +and the Frame Buffer) + + None. + +Additions to Chapter 5 of the 1.1 Specification (Special Functions) + + None + +Additions to Chapter 6 of the 1.1 Specification (State and State Requests) + + None + +Additions to the GLX Specification + + None + +GLX Protocol + + TBD + +Errors + + None + +New State + + Add boolean variable SPRITE_POINT_MESA to the point attribute group. + +Revision History + + Version 1.0 - 4 Dec 2000 + Original draft. + + + diff --cc docs/OLD/MESA_trace.spec index f0a79c7df99,00000000000..dc4166e6b6e mode 100644,000000..100644 --- a/docs/OLD/MESA_trace.spec +++ b/docs/OLD/MESA_trace.spec @@@ -1,360 -1,0 +1,359 @@@ +Name + + MESA_trace + +Name Strings + + GL_MESA_trace + +Contact + + Bernd Kreimeier, Loki Entertainment, bk 'at' lokigames.com + Brian Paul, VA Linux Systems, Inc., brianp 'at' valinux.com + +Status + + Obsolete. + +Version + - $Id: MESA_trace.spec,v 1.4 2004/03/25 01:42:42 brianp Exp $ + +Number + + none yet + +Dependencies + + OpenGL 1.2 is required. + The extension is written against the OpenGL 1.2 Specification + +Overview + + Provides the application with means to enable and disable logging + of GL calls including parameters as readable text. The verbosity + of the generated log can be controlled. The resulting logs are + valid (but possibly incomplete) C code and can be compiled and + linked for standalone test programs. The set of calls and the + amount of static data that is logged can be controlled at runtime. + The application can add comments and enable or disable tracing of GL + operations at any time. The data flow from the application to GL + and back is unaffected except for timing. + + Application-side implementation of these features raises namespace + and linkage issues. In the driver dispatch table a simple + "chain of responsibility" pattern (aka "composable piepline") + can be added. + +IP Status + + The extension spec is in the public domain. The current implementation + in Mesa is covered by Mesa's XFree86-style copyright by the authors above. + This extension is partially inspired by the Quake2 QGL wrapper. + +Issues + + + (1) Is this Extension obsolete because it can + be implemented as a wrapper DLL? + + RESOLVED: No. While certain operating systems (Win32) provide linkers + that facilitate this kind of solution, other operating systems + (Linux) do not support hierarchical linking, so a wrapper solution + would result in symbol collisions. + Further, IHV's might have builtin support for tracing GL execution + that enjoys privileged access, or that they do not wish to separate + the tracing code from their driver code base. + + (2) Should the Trace API explicitely support the notion of "frames? + This would require hooking into glXSwapBuffers calls as well. + + RESOLVED: No. The application can use NewTraceMESA/EndTraceMESA + and TraceComment along with external parsing tools to split the + trace into frames, in whatever way considered adequate. + + (2a) Should GLX calls be traced? + + PBuffers and other render-to-texture solutions demonstrate that + context level commands beyond SwapBuffers might have to be + traced. The GL DLL exports the entry points, so this would not + be out of the question. + + (3) Should the specification mandate the actual output format? + + RESOLVED: No. It is sufficient to guarantee that all data and commands + will be traced as requested by Enable/DisableTraceMESA, in the order + encountered. Whether the resulting trace is available as a readable + text file, binary metafile, compilable source code, much less which + indentation and formatting has been used, is up to the implementation. + For the same reason this specification does not enforce or prohibit + additional information added to the trace (statistics, profiling/timing, + warnings on possible error conditions). + + (4) Should the comment strings associated with names and pointer (ranges) + be considered persistent state? + + RESOLVED: No. The implementation is not forced to use this information + on subsequent occurences of name/pointer, and is free to consider it + transient state. + + (5) Should comment commands be prohibited between Begin/End? + + RESOLVED: Yes, with the exception of TraceCommentMESA. TraceCommentMESA + is transient, the other commands might cause storage of persistent + data in the context. There is no need to have the ability mark names + or pointers between Begin and End. + + +New Procedures and Functions + + void NewTraceMESA( bitfield mask, const ubyte * traceName ) + + void EndTraceMESA( void ) + + void EnableTraceMESA( bitfield mask ) + + void DisableTraceMESA( bitfield mask ) + + void TraceAssertAttribMESA( bitfield attribMask ) + + void TraceCommentMESA( const ubyte* comment ) + + void TraceTextureMESA( uint name, const ubyte* comment ) + + void TraceListMESA( uint name, const ubyte* comment ) + + void TracePointerMESA( void* pointer, const ubyte* comment ) + + void TracePointerRangeMESA( const void* first, + const void* last, + const ubyte* comment ) + +New Tokens + + Accepted by the parameter of EnableTrace and DisableTrace: + + TRACE_ALL_BITS_MESA 0xFFFF + TRACE_OPERATIONS_BIT_MESA 0x0001 + TRACE_PRIMITIVES_BIT_MESA 0x0002 + TRACE_ARRAYS_BIT_MESA 0x0004 + TRACE_TEXTURES_BIT_MESA 0x0008 + TRACE_PIXELS_BIT_MESA 0x0010 + TRACE_ERRORS_BIT_MESA 0x0020 + + Accepted by the parameter of GetIntegerv, GetBooleanv, + GetFloatv, and GetDoublev: + + TRACE_MASK_MESA 0x8755 + + Accepted by the parameter to GetString: + + TRACE_NAME_MESA 0x8756 + + +Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation) + + None. + +Additions to Chapter 3 of the OpenGL 1.2.1 Specification (OpenGL Operation) + + None. + +Additions to Chapter 4 of the OpenGL 1.2.1 Specification (OpenGL Operation) + + None. + +Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions) + + Add a new section: + + 5.7 Tracing + + The tracing facility is used to record the execution of a GL program + to a human-readable log. The log appears as a sequence of GL commands + using C syntax. The primary intention of tracing is to aid in program + debugging. + + A trace is started with the command + + void NewTraceMESA( bitfield mask, const GLubyte * traceName ) + + may be any value accepted by PushAttrib and specifies a set of + attribute groups. The state values included in those attribute groups + is written to the trace as a sequence of GL commands. + + specifies a name or label for the trace. It is expected + that will be interpreted as a filename in most implementations. + + A trace is ended by calling the command + + void EndTraceMESA( void ) + + It is illegal to call NewTraceMESA or EndTraceMESA between Begin and End. + + The commands + + void EnableTraceMESA( bitfield mask ) + void DisableTraceMESA( bitfield mask ) + + enable or disable tracing of different classes of GL commands. + may be the union of any of TRACE_OPERATIONS_BIT_MESA, + TRACE_PRIMITIVES_BIT_MESA, TRACE_ARRAYS_BIT_MESA, TRACE_TEXTURES_BIT_MESA, + and TRACE_PIXELS_BIT_MESA. The special token TRACE_ALL_BITS_MESA + indicates all classes of commands are to be logged. + + TRACE_OPERATIONS_BIT_MESA controls logging of all commands outside of + Begin/End, including Begin/End. + + TRACE_PRIMITIVES_BIT_MESA controls logging of all commands inside of + Begin/End, including Begin/End. + + TRACE_ARRAYS_BIT_MESA controls logging of VertexPointer, NormalPointer, + ColorPointer, IndexPointer, TexCoordPointer and EdgeFlagPointer commands. + + TRACE_TEXTURES_BIT_MESA controls logging of texture data dereferenced by + TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, and + TexSubImage3D commands. + + TRACE_PIXELS_BIT_MESA controls logging of image data dereferenced by + Bitmap and DrawPixels commands. + + TRACE_ERRORS_BIT_MESA controls logging of all errors. If this bit is + set, GetError will be executed whereever applicable, and the result will + be added to the trace as a comment. The error returns are cached and + returned to the application on its GetError calls. If the user does not + wish the additional GetError calls to be performed, this bit should not + be set. + + The command + + void TraceCommentMESA( const ubyte* comment ) + + immediately adds the string to the trace output, surrounded + by C-style comment delimiters. + + The commands + + void TraceTextureMESA( uint name, const ubyte* comment ) + void TraceListMESA( uint name, const ubyte* comment ) + + associates with the texture object or display list specified + by . Logged commands which reference the named texture object or + display list will be annotated with . If IsTexture(name) or + IsList(name) fail (respectively) the command is quietly ignored. + + The commands + + void TracePointerMESA( void* pointer, const ubyte* comment ) + + void TracePointerRangeMESA( const void* first, + const void* last, + const ubyte* comment ) + + associate with the address specified by or with + a range of addresses specified by through . + Any logged commands which reference or an address between + and will be annotated with . + + The command + + void TraceAssertAttribMESA( bitfield attribMask ) + + will add GL state queries and assertion statements to the log to + confirm that the current state at the time TraceAssertAttrib is + executed matches the current state when the trace log is executed + in the future. + + is any value accepted by PushAttrib and specifies + the groups of state variables which are to be asserted. + + The commands NewTraceMESA, EndTraceMESA, EnableTraceMESA, DisableTraceMESA, + TraceAssertAttribMESA, TraceCommentMESA, TraceTextureMESA, TraceListMESA, + TracePointerMESA and TracePointerRangeMESA are not compiled into display lists. + + + Examples: + + The command NewTraceMESA(DEPTH_BUFFER_BIT, "log") will query the state + variables DEPTH_TEST, DEPTH_FUNC, DEPTH_WRITEMASK, and DEPTH_CLEAR_VALUE + to get the values , , , and respectively. + Statements equivalent to the following will then be logged: + + glEnable(GL_DEPTH_TEST); (if is true) + glDisable(GL_DEPTH_TEST); (if is false) + glDepthFunc(); + glDepthMask(); + glClearDepth(); + + + The command TraceAssertAttribMESA(DEPTH_BUFFER_BIT) will query the state + variables DEPTH_TEST, DEPTH_FUNC, DEPTH_WRITEMASK, and DEPTH_CLEAR_VALUE + to get the values , , , and respectively. + The resulting trace might then look will like this: + + { + GLboolean b; + GLint i; + GLfloat f; + b = glIsEnabled(GL_DEPTH_TEST); + assert(b == ); + glGetIntegerv(GL_DEPTH_FUNC, &i); + assert(i == ); + glGetIntegerv(GL_DEPTH_MASK, &i); + assert(i == ); + glGetFloatv(GL_DEPTH_CLEAR_VALUE, &f); + assert(f == ); + } + + +Additions to Chapter 6 of the OpenGL 1.2.1 Specification + (State and State Requests) + + Querying TRACE_MASK_MESA with GetIntegerv, GetFloatv, GetBooleanv or + GetDoublev returns the current command class trace mask. + + Querying TRACE_NAME_MESA with GetString returns the current trace name. + + +Additions to Appendix A of the OpenGL 1.2.1 Specification (Invariance) + + The MESA_trace extension can be used in a way that does not affect data + flow from application to OpenGL, as well as data flow from OpenGL to + application, except for timing, possible print I/O. TRACE_ERRORS_BIT_MESA + will add additional GetError queries. Setting a trace mask with NewTraceMESA + as well as use of TraceAssertAttribMESA might cause additional state queries. + With the possible exception of performance, OpenGL rendering should not be + affected at all by a properly chosen logging operation. + +Additions to the AGL/GLX/WGL Specifications + + None. + +GLX Protocol + + None. The logging operation is carried out client-side, by exporting + entry points to the wrapper functions that execute the logging operation. + +Errors + + INVALID_OPERATION is generated if any trace command except TraceCommentMESA + is called between Begin and End. + +New State + + The current trace name and current command class mask are stored + per-context. + +New Implementation Dependent State + + None. + +Revision History + + * Revision 0.1 - Initial draft from template (bk000415) + * Revision 0.2 - Draft (bk000906) + * Revision 0.3 - Draft (bk000913) + * Revision 0.4 - Reworked text, fixed typos (bp000914) + * Revision 0.5 - Assigned final GLenum values (bp001103) + * Revision 0.6 - TRACE_ERRORS_BIT_MESA (bk000916) + * Revision 0.7 - Added MESA postfix (bk010126) + diff --cc progs/egl/Makefile index 416d2c04b22,948d7356098..75cd411d93d --- a/progs/egl/Makefile +++ b/progs/egl/Makefile @@@ -45,8 -49,15 +49,15 @@@ demo3.o: demo3.c $(HEADERS $(CC) -c $(CFLAGS) -I$(TOP)/include demo3.c + egltri: egltri.o $(TOP)/$(LIB_DIR)/libEGL.so - $(CC) $(CFLAGS) egltri.o -L$(TOP)/$(LIB_DIR) -lGL -lEGL $(LIBDRM_LIB) -o $@ ++ $(CC) $(CFLAGS) egltri.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@ + + egltri.o: egltri.c $(HEADERS) + $(CC) -c $(CFLAGS) -I$(TOP)/include egltri.c + + eglinfo: eglinfo.o $(TOP)/$(LIB_DIR)/libEGL.so - $(CC) $(CFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) -lGL -lEGL $(LIBDRM_LIB) -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) eglinfo.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) -o $@ eglinfo.o: eglinfo.c $(HEADERS) $(CC) -c $(CFLAGS) -I$(TOP)/include eglinfo.c @@@ -59,7 -70,34 +70,29 @@@ eglgears.o: eglgears.c $(HEADERS $(CC) -c $(CFLAGS) -I$(TOP)/include eglgears.c + peglgears: peglgears.o $(TOP)/$(LIB_DIR)/libEGL.so + $(CC) $(CFLAGS) peglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@ + + peglgears.o: peglgears.c $(HEADERS) + $(CC) -c $(CFLAGS) -I$(TOP)/include peglgears.c + + + xeglgears: xeglgears.o $(TOP)/$(LIB_DIR)/libEGL.so + $(CC) $(CFLAGS) xeglgears.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@ + + xeglgears.o: xeglgears.c $(HEADERS) + $(CC) -c $(CFLAGS) -I$(TOP)/include xeglgears.c + + + xegl_tri: xegl_tri.o $(TOP)/$(LIB_DIR)/libEGL.so + $(CC) $(CFLAGS) xegl_tri.o -L$(TOP)/$(LIB_DIR) -lEGL $(LIBDRM_LIB) $(APP_LIB_DEPS) -o $@ + + xegl_tri.o: xegl_tri.c $(HEADERS) + $(CC) -c $(CFLAGS) -I$(TOP)/include xegl_tri.c + + clean: - rm -f *.o *~ - rm -f *.so - rm -f $(PROGRAMS) + -rm -f *.o *~ + -rm -f *.so + -rm -f $(PROGRAMS) + -run: - LD_LIBRARY_PATH=$(TOP)/lib ./egltri - -debug: - LD_LIBRARY_PATH=$(TOP)/lib gdb ./eglgears diff --cc progs/fp/Makefile index 3e524747770,bcff6997969..2089fc5cb3c --- a/progs/fp/Makefile +++ b/progs/fp/Makefile @@@ -8,44 -8,10 +8,10 @@@ TOP = ../. include $(TOP)/configs/current -LIBS = $(APP_LIB_DEPS) +LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) SOURCES = \ - tri-abs.c \ - tri-add.c \ - tri-cmp.c \ - tri-cos.c \ - tri-dp3.c \ - tri-dp4.c \ - tri-dph.c \ - tri-dst.c \ - tri-ex2.c \ - tri-flr.c \ - tri-frc.c \ - tri-kil.c \ - tri-lg2.c \ - tri-lit.c \ - tri-lrp.c \ - tri-mad.c \ - tri-max.c \ - tri-min.c \ - tri-mov.c \ - tri-mul.c \ - tri-pow.c \ - tri-param.c \ - tri-rcp.c \ - tri-rsq.c \ - tri-scs.c \ - tri-sge.c \ - tri-sge2.c \ - tri-sin.c \ - tri-slt.c \ - tri-sub.c \ - tri-swz.c \ - tri-swz2.c \ tri-tex.c \ - tri-xpd.c \ - tri-position.c \ point-position.c \ tri-depth.c \ tri-depth2.c \ diff --cc progs/glsl/.gitignore index 1e0aecebef4,81ecf5bdd5e..09340ff2adb --- a/progs/glsl/.gitignore +++ b/progs/glsl/.gitignore @@@ -1,6 -1,6 +1,7 @@@ +bitmap brick bump + convolutions deriv extfuncs.h mandelbrot diff --cc progs/glsl/Makefile index 850b6bdbd1c,b9cae668152..ba7a4c688ff --- a/progs/glsl/Makefile +++ b/progs/glsl/Makefile @@@ -7,23 -7,15 +7,25 @@@ INCDIR = $(TOP)/includ LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) +LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) + PROGS = \ + bitmap \ brick \ bump \ + convolutions \ deriv \ mandelbrot \ + multitex \ noise \ + points \ + pointcoord \ + texdemo1 \ toyball \ + twoside \ - trirast ++ trirast \ + texdemo1 \ + convolutions ##### RULES ##### @@@ -58,117 -49,25 +60,121 @@@ readtex.h: $(TOP)/progs/util/readtex. readtex.o: readtex.c readtex.h $(CC) -c -I$(INCDIR) $(CFLAGS) readtex.c -brick.c: extfuncs.h -bump.c: extfuncs.h +shaderutil.c: $(TOP)/progs/util/shaderutil.c + cp $< . + +shaderutil.h: $(TOP)/progs/util/shaderutil.h + cp $< . + +shaderutil.o: shaderutil.c shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) shaderutil.c + + + +bitmap.o: bitmap.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) bitmap.c + +bitmap: bitmap.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bitmap.o shaderutil.o $(LIBS) -o $@ + + +brick.o: brick.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) brick.c + +brick: brick.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) brick.o shaderutil.o $(LIBS) -o $@ + + +bump.o: bump.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) bump.c + +bump: bump.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) bump.o shaderutil.o $(LIBS) -o $@ + + +convolutions.o: convolutions.c readtex.h + $(CC) -c -I$(INCDIR) $(CFLAGS) convolutions.c + +convolutions: convolutions.o readtex.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) convolutions.o readtex.o $(LIBS) -o $@ + + +deriv.o: deriv.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) deriv.c -mandelbrot.c: extfuncs.h +deriv: deriv.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) deriv.o shaderutil.o $(LIBS) -o $@ -toyball.c: extfuncs.h -texdemo1: texdemo1.o readtex.o - $(CC) -I$(INCDIR) $(CFLAGS) texdemo1.o readtex.o $(APP_LIB_DEPS) -o $@ +mandelbrot.o: mandelbrot.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) mandelbrot.c -texdemo1.o: texdemo1.c readtex.h extfuncs.h +mandelbrot: mandelbrot.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) mandelbrot.o shaderutil.o $(LIBS) -o $@ + + +multitex.o: multitex.c extfuncs.h readtex.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) multitex.c + +multitex: multitex.o readtex.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) multitex.o readtex.o shaderutil.o $(LIBS) -o $@ + + +noise.o: noise.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) noise.c + +noise: noise.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) noise.o shaderutil.o $(LIBS) -o $@ + + +points.o: points.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) points.c + +points: points.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) points.o shaderutil.o $(LIBS) -o $@ + + +pointcoord.o: pointcoord.c readtex.h extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) pointcoord.c + +pointcoord: pointcoord.o readtex.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) pointcoord.o readtex.o shaderutil.o $(LIBS) -o $@ + + +texdemo1.o: texdemo1.c readtex.h extfuncs.h shaderutil.h $(CC) -c -I$(INCDIR) $(CFLAGS) texdemo1.c +texdemo1: texdemo1.o readtex.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) texdemo1.o readtex.o shaderutil.o $(LIBS) -o $@ + + +toyball.o: toyball.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) toyball.c + +toyball: toyball.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) toyball.o shaderutil.o $(LIBS) -o $@ + + +twoside.o: twoside.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) twoside.c + +twoside: twoside.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) twoside.o shaderutil.o $(LIBS) -o $@ + + +trirast.o: trirast.c extfuncs.h shaderutil.h + $(CC) -c -I$(INCDIR) $(CFLAGS) trirast.c + +trirast: trirast.o shaderutil.o + $(CC) -I$(INCDIR) $(CFLAGS) $(LDFLAGS) trirast.o shaderutil.o $(LIBS) -o $@ + + + convolutions: convolutions.o readtex.o + $(CC) -I$(INCDIR) $(CFLAGS) convolutions.o readtex.o $(APP_LIB_DEPS) -o $@ + convolutions.o: convolutions.c readtex.h + $(CC) -c -I$(INCDIR) $(CFLAGS) convolutions.c clean: diff --cc progs/glsl/convolutions.c index 13c7eab0ea9,9b9ee532453..a25dad5ba92 --- a/progs/glsl/convolutions.c +++ b/progs/glsl/convolutions.c @@@ -229,12 -222,11 +229,12 @@@ static void createProgram(const char *v glAttachShader(program, fragShader); } - glLinkProgramARB(program); + glLinkProgram(program); checkLink(program); - glUseProgramObjectARB(program); + glUseProgram(program); + /* assert(glIsProgram(program)); assert(glIsShader(fragShader)); assert(glIsShader(vertShader)); @@@ -325,12 -316,6 +325,13 @@@ static void menuInit( static void init() { + if (!glutExtensionSupported("GL_ARB_shader_objects") || + !glutExtensionSupported("GL_ARB_vertex_shader") || + !glutExtensionSupported("GL_ARB_fragment_shader")) { + fprintf(stderr, "Sorry, this program requires GL_ARB_shader_objects, GL_ARB_vertex_shader, and GL_ARB_fragment_shader\n"); + exit(1); + } ++ fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); diff --cc progs/glsl/texdemo1.c index 41010746eea,3ceae14b96b..96ddca1f32d --- a/progs/glsl/texdemo1.c +++ b/progs/glsl/texdemo1.c @@@ -49,12 -48,21 +49,13 @@@ static GLfloat TexXrot = 0, TexYrot = 0 static GLfloat Xrot = 20.0, Yrot = 20.0, Zrot = 0.0; static GLfloat EyeDist = 10; static GLboolean Anim = GL_TRUE; + static int win = 0; -struct uniform_info { - const char *name; - GLuint size; - GLint location; - GLenum type; /**< GL_FLOAT or GL_INT */ - GLfloat value[4]; -}; - static struct uniform_info ReflectUniforms[] = { - { "cubeTex", 1, -1, GL_INT, { 0, 0, 0, 0 } }, - { "lightPos", 3, -1, GL_FLOAT, { 10, 10, 20, 0 } }, - { NULL, 0, 0, 0, { 0, 0, 0, 0 } } + { "cubeTex", 1, GL_INT, { 0, 0, 0, 0 }, -1 }, + { "lightPos", 3, GL_FLOAT, { 10, 10, 20, 0 }, -1 }, + END_OF_UNIFORMS }; static struct uniform_info SimpleUniforms[] = { diff --cc progs/tests/.gitignore index 6505c315a67,40cb6850fb9..c5b9e28dab1 --- a/progs/tests/.gitignore +++ b/progs/tests/.gitignore @@@ -38,9 -40,10 +41,11 @@@ getproclist. interleave invert jkrahntest +lineclip manytex + minmag mipmap_limits + mipmap_view multipal no_s3tc packedpixels @@@ -53,10 -56,9 +58,12 @@@ readtex. readtex.h seccolor sharedtex +shader_api +stencil_twoside +stencil_wrap stencilwrap + stencil_wrap + subtex subtexrate tex1d texcmp diff --cc progs/tests/Makefile index cf8e0bfc1e5,7e8c0c8e34d..b1111545126 --- a/progs/tests/Makefile +++ b/progs/tests/Makefile @@@ -61,11 -63,10 +65,12 @@@ SOURCES = random.c \ readrate.c \ seccolor.c \ + shader_api.c \ sharedtex.c \ + stencil_twoside.c \ stencilwrap.c \ stencil_wrap.c \ + subtex \ subtexrate.c \ tex1d.c \ texcompress2.c \ @@@ -127,40 -131,55 +134,55 @@@ arraytexture: arraytexture.o readtex. $(CC) $(CFLAGS) arraytexture.o readtex.o $(LIBS) -o $@ arraytexture.o: arraytexture.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) arraytexture.c -o $@ afsmultiarb: afsmultiarb.o readtex.o - $(CC) $(CFLAGS) afsmultiarb.o readtex.o $(LIBS) -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) afsmultiarb.o readtex.o $(LIBS) -o $@ afsmultiarb.o: afsmultiarb.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) afsmultiarb.c -o $@ drawbuffers: drawbuffers.o - $(CC) $(CFLAGS) drawbuffers.o $(LIBS) -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) drawbuffers.o $(LIBS) -o $@ drawbuffers.o: drawbuffers.c extfuncs.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) drawbuffers.c -o $@ texrect: texrect.o readtex.o - $(CC) $(CFLAGS) texrect.o readtex.o $(LIBS) -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) texrect.o readtex.o $(LIBS) -o $@ texrect.o: texrect.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) texrect.c -o $@ bug_3195: bug_3195.o readtex.o - $(CC) $(CFLAGS) bug_3195.o readtex.o $(LIBS) -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) bug_3195.o readtex.o $(LIBS) -o $@ bug_3195.o: bug_3195.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) bug_3195.c -o $@ invert: invert.o readtex.o - $(CC) $(CFLAGS) invert.o readtex.o $(LIBS) -o $@ + $(CC) $(CFLAGS) $(LDFLAGS) invert.o readtex.o $(LIBS) -o $@ invert.o: invert.c readtex.h - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) invert.c -o $@ + mipmap_view: mipmap_view.o readtex.o + $(CC) $(CFLAGS) mipmap_view.o readtex.o $(LIBS) -o $@ + + mipmap_view.o: mipmap_view.c readtex.h + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + + + fillrate: fillrate.o readtex.o + $(CC) $(CFLAGS) fillrate.o readtex.o $(LIBS) -o $@ + + fillrate.o: fillrate.c readtex.h + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + + + readtex.o: readtex.c - $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@ + $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) readtex.c -o $@ readtex.h: $(TOP)/progs/util/readtex.h diff --cc progs/trivial/Makefile index e72fb078890,786576cd13b..01475f9e5c2 --- a/progs/trivial/Makefile +++ b/progs/trivial/Makefile @@@ -8,12 -8,26 +8,26 @@@ TOP = ../. include $(TOP)/configs/current -LIBS = $(APP_LIB_DEPS) +LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) SOURCES = \ + clear-fbo-tex.c \ + clear-fbo.c \ + clear-scissor.c \ + clear-undefined.c \ clear.c \ + dlist-dangling.c \ + dlist-edgeflag-dangling.c \ + dlist-edgeflag.c \ + drawarrays.c \ + drawelements.c \ + drawrange.c \ + flat-clip.c \ + fs-tri.c \ line-clip.c \ line-cull.c \ + line-smooth.c \ + line-stipple-wide.c \ line-userclip-clip.c \ line-userclip-nop-clip.c \ line-userclip-nop.c \ diff --cc progs/trivial/quad-clip-nearplane.c index be9b9c619ae,e76eb29f890..1e8056c474b --- a/progs/trivial/quad-clip-nearplane.c +++ b/progs/trivial/quad-clip-nearplane.c @@@ -130,10 -118,9 +130,10 @@@ int main(int argc, char **argv exit(1); } - glutInitWindowPosition(0, 0); glutInitWindowSize( 250, 250); + glutInitWindowPosition(0, 0); + glutInitWindowSize( 250, 250); - type = GLUT_RGB; + type = GLUT_RGB | GLUT_ALPHA; type |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE; glutInitDisplayMode(type); diff --cc progs/trivial/tri.c index d4a7f08ae34,12fa8d11b61..c75acb3a5a8 --- a/progs/trivial/tri.c +++ b/progs/trivial/tri.c @@@ -32,8 -32,7 +32,8 @@@ #define CI_OFFSET_2 32 - GLenum doubleBuffer; + GLenum doubleBuffer = 1; +int win; static void Init(void) { @@@ -60,7 -59,6 +60,10 @@@ static void Key(unsigned char key, int switch (key) { case 27: ++<<<<<<< HEAD:progs/trivial/tri.c + glutDestroyWindow(win); ++======= ++>>>>>>> gallium-0.1:progs/trivial/tri.c exit(0); default: return; diff --cc src/egl/drivers/dri/Makefile index af0c40fe2b7,bdc683a0c16..3bd6b524ec4 --- a/src/egl/drivers/dri/Makefile +++ b/src/egl/drivers/dri/Makefile @@@ -42,9 -44,8 +44,9 @@@ default: depend library Makefil library: $(TOP)/$(LIB_DIR)/libEGLdri.so $(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS) - $(TOP)/bin/mklib -o EGLdri -major 1 -minor 0 \ - -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(DRM_LIB) + $(MKLIB) -o EGLdri -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -major 1 -minor 0 \ - -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) ++ -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS) clean: diff --cc src/egl/main/Makefile index 7ab78197c7b,96742bb4bc6..8ea60c0199d --- a/src/egl/main/Makefile +++ b/src/egl/main/Makefile @@@ -46,9 -61,8 +61,9 @@@ default: depend librar library: $(TOP)/$(LIB_DIR)/libEGL.so $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS) - $(TOP)/bin/mklib -o EGL -major 1 -minor 0 \ + $(MKLIB) -o EGL -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -major 1 -minor 0 \ - -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) + -install $(TOP)/$(LIB_DIR) -ldl $(OBJECTS) $(LIBS) diff --cc src/glut/glx/Makefile index 7f886f775ab,910c6fa28a4..b61d5b04789 --- a/src/glut/glx/Makefile +++ b/src/glut/glx/Makefile @@@ -127,8 -113,9 +127,9 @@@ clean depend: $(SOURCES) @ echo "running $(MKDEP)" + @ rm -f depend @ touch depend @ $(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(SOURCES) \ - > /dev/null + $(X11_INCLUDES) > /dev/null include depend diff --cc src/glw/Makefile index 753c4b74d4a,86a0bbaeace..c2e8e3046b5 --- a/src/glw/Makefile +++ b/src/glw/Makefile @@@ -61,9 -49,10 +61,10 @@@ $(TOP)/$(LIB_DIR)/$(GLW_LIB_NAME): $(OB # by any source file. # depend: $(GLW_SOURCES) + rm -f depend touch depend $(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(GLW_SOURCES) \ - > /dev/null + $(X11_INCLUDES) > /dev/null include depend diff --cc src/glx/x11/Makefile index 5d9c61c983a,c99bcf26a90..8d49a174e8f --- a/src/glx/x11/Makefile +++ b/src/glx/x11/Makefile @@@ -31,17 -29,13 +31,17 @@@ SOURCES = xfont.c \ glx_pbuffer.c \ glx_query.c \ - glx_texture_compression.c \ + drisw_glx.c \ + dri_common.c \ dri_glx.c \ - XF86dri.c + XF86dri.c \ + glxhash.c \ + dri2_glx.c \ + dri2.c - include $(TOP)/src/mesa/sources + include $(TOP)/src/mesa/sources.mak - MESA_ASM_API = $(addprefix $(TOP)/src/mesa/, $(ASM_API)) + MESA_GLAPI_ASM_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_ASM_SOURCES)) MESA_GLAPI_SOURCES = $(addprefix $(TOP)/src/mesa/, $(GLAPI_SOURCES)) MESA_GLAPI_OBJECTS = $(addprefix $(TOP)/src/mesa/, $(GLAPI_OBJECTS)) @@@ -71,16 -65,16 +72,17 @@@ default: depend $(TOP)/$(LIB_DIR)/$(GL_ # Make libGL $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME): $(OBJECTS) Makefile - $(TOP)/bin/mklib -o $(GL_LIB) -linker '$(CC)' \ + $(MKLIB) -o $(GL_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -major 1 -minor 2 $(MKLIB_OPTIONS) \ - -install $(TOP)/$(LIB_DIR) $(GL_LIB_DEPS) $(OBJECTS) + -install $(TOP)/$(LIB_DIR) -id $(INSTALL_LIB_DIR)/lib$(GL_LIB).1.dylib \ + $(GL_LIB_DEPS) $(OBJECTS) - depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_ASM_API) Makefile + depend: $(SOURCES) $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) Makefile + rm -f depend touch depend $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) \ - $(MESA_GLAPI_SOURCES) $(MESA_ASM_API) + $(MESA_GLAPI_SOURCES) $(MESA_GLAPI_ASM_SOURCES) # Emacs tags diff --cc src/mesa/Makefile index ba65ce695fb,cd42cd654b0..068d9b3b9c6 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@@ -3,9 -3,9 +3,8 @@@ TOP = ../.. include $(TOP)/configs/current -include sources.mak - +include sources - .SUFFIXES : .cpp .c.o: @@@ -19,27 -19,34 +18,37 @@@ -GLAPI_LIB = libglapi.a +# Default: build dependencies, then asm_subdirs, then convenience +# libs (.a) and finally the device drivers: +default: depend asm_subdirs libmesa.a libglapi.a driver_subdirs + # Default: build dependencies, then asm_subdirs, then convenience + # libs (.a) and finally the device drivers: + default: depend asm_subdirs libmesa.a $(GLAPI_LIB) driver_subdirs - - ###################################################################### # Helper libraries used by many drivers: # Make archive of core mesa object files libmesa.a: $(MESA_OBJECTS) - @ $(TOP)/bin/mklib -o mesa -static $(MESA_OBJECTS) + @ $(MKLIB) -o mesa -static $(MESA_OBJECTS) + +# Make archive of gl* API dispatcher functions only +libglapi.a: $(GLAPI_OBJECTS) + @ $(MKLIB) -o glapi -static $(GLAPI_OBJECTS) + # Make archive of gl* API dispatcher functions only + $(GLAPI_LIB): $(GLAPI_OBJECTS) + @if [ "${WINDOW_SYSTEM}" = "dri" ] ; then \ + touch libglapi.a ; \ + else \ + $(TOP)/bin/mklib -o glapi -static $(GLAPI_OBJECTS) ; \ + fi - ###################################################################### # Device drivers -driver_subdirs: libmesa.a $(GLAPI_LIB) +driver_subdirs: libmesa.a libglapi.a (cd drivers && $(MAKE)) diff --cc src/mesa/drivers/dri/Makefile.template index 072d16ce8bf,3e7e527a982..166621cd6c4 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@@ -2,14 -2,22 +2,17 @@@ MESA_MODULES = $(TOP)/src/mesa/libmesa.a - COMMON_SOURCES = \ + COMMON_GALLIUM_SOURCES = \ ../common/utils.c \ - ../common/texmem.c \ ../common/vblank.c \ ../common/dri_util.c \ - ../common/xmlconfig.c \ - ../common/drirenderbuffer.c + ../common/xmlconfig.c + + COMMON_SOURCES = $(COMMON_GALLIUM_SOURCES) \ + ../../common/driverfuncs.c \ + ../common/texmem.c \ + ../common/drirenderbuffer.c -COMMON_BM_SOURCES = \ - ../common/dri_bufmgr.c \ - ../common/dri_drmpool.c - - ifeq ($(WINDOW_SYSTEM),dri) WINOBJ= WINLIB= @@@ -59,12 -72,12 +62,12 @@@ SHARED_INCLUDES = ##### TARGETS ##### -default: depend symlinks $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) +default: symlinks depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) - $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template + $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template - $(TOP)/bin/mklib -noprefix -o $@ \ - $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS) + $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - $(OBJECTS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS) ++ $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS) $(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME) @@@ -72,9 -85,10 +75,10 @@@ depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS) + rm -f depend touch depend $(MKDEP) $(MKDEP_OPTIONS) $(DRIVER_DEFINES) $(INCLUDES) $(C_SOURCES) \ - $(ASM_SOURCES) 2> /dev/null + $(ASM_SOURCES) # Emacs tags diff --cc src/mesa/drivers/dri/common/dri_util.c index 93b9f458e41,fff79c36ad6..e68faa3f0a0 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@@ -67,19 -111,64 +91,58 @@@ __driUtilMessage(const char *f, ... } } - -/*****************************************************************/ -/** \name Drawable list management */ -/*****************************************************************/ -/*@{*/ - -static GLboolean __driAddDrawable(void *drawHash, __DRIdrawable *pdraw) +GLint +driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 ) { - __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; + if (rect2.x1 > rect1.x1) rect1.x1 = rect2.x1; + if (rect2.x2 < rect1.x2) rect1.x2 = rect2.x2; + if (rect2.y1 > rect1.y1) rect1.y1 = rect2.y1; + if (rect2.y2 < rect1.y2) rect1.y2 = rect2.y2; - if (drmHashInsert(drawHash, pdp->draw, pdraw)) - return GL_FALSE; + if (rect1.x1 > rect1.x2 || rect1.y1 > rect1.y2) return 0; - return GL_TRUE; + return (rect1.x2 - rect1.x1) * (rect1.y2 - rect1.y1); } + static __DRIdrawable *__driFindDrawable(void *drawHash, __DRIid draw) + { + int retcode; + __DRIdrawable *pdraw; + + retcode = drmHashLookup(drawHash, draw, (void *)&pdraw); + if (retcode) + return NULL; + + return pdraw; + } + + + /** + * Find drawables in the local hash that have been destroyed on the + * server. + * + * \param drawHash Hash-table containing all known drawables. + */ + static void __driGarbageCollectDrawables(void *drawHash) + { + __DRIid draw; + __DRInativeDisplay *dpy; + __DRIdrawable *pdraw; + + if (drmHashFirst(drawHash, &draw, (void *)&pdraw) == 1) { + do { + __DRIdrawablePrivate *pdp = (__DRIdrawablePrivate *)pdraw->private; + dpy = pdp->driScreenPriv->display; + if (! (*dri_interface->windowExists)(dpy, draw)) { + /* Destroy the local drawable data, if the drawable no + longer exists in the Xserver */ + (*pdraw->destroyDrawable)(dpy, pdraw->private); + _mesa_free(pdraw); + } + } while (drmHashNext(drawHash, &draw, (void *)&pdraw) == 1); + } + } + -/*@}*/ - - /*****************************************************************/ /** \name Context (un)binding functions */ /*****************************************************************/ diff --cc src/mesa/drivers/dri/common/mmio.h index 89871aab59e,891056e1705..dc43d1cdc9c --- a/src/mesa/drivers/dri/common/mmio.h +++ b/src/mesa/drivers/dri/common/mmio.h @@@ -37,10 -37,10 +37,10 @@@ #if defined( __powerpc__ ) - static INLINE u_int32_t -static __inline__ uint32_t ++static INLINE uint32_t read_MMIO_LE32( volatile void * base, unsigned long offset ) { - u_int32_t val; + uint32_t val; __asm__ __volatile__( "lwbrx %0, %1, %2 ; eieio" : "=r" (val) @@@ -50,10 -50,10 +50,10 @@@ #else - static INLINE u_int32_t -static __inline__ uint32_t ++static INLINE uint32_t read_MMIO_LE32( volatile void * base, unsigned long offset ) { - volatile u_int32_t * p = (volatile u_int32_t *) (((volatile char *) base) + offset); + volatile uint32_t * p = (volatile uint32_t *) (((volatile char *) base) + offset); return LE32_TO_CPU( p[0] ); } diff --cc src/mesa/drivers/dri/common/utils.c index c723dfdeb00,67cffead00f..431c26a19d8 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@@ -519,15 -541,17 +524,19 @@@ GLboolean driClipRectToFramebuffer( con * \c GL_UNSIGNED_3BYTE_8_8_8, \c GL_4FLOAT_32_32_32_32, * \c GL_4HALF_16_16_16_16, etc. We can cross that bridge when we come to it. */ -GLboolean -driFillInModes( __GLcontextModes ** ptr_to_modes, - GLenum fb_format, GLenum fb_type, - const uint8_t * depth_bits, const uint8_t * stencil_bits, - unsigned num_depth_stencil_bits, - const GLenum * db_modes, unsigned num_db_modes, - const u_int8_t * msaa_samples, unsigned num_msaa_modes, - int visType ) ++ ++/* XXX: need to re-add msaa support after gallium-0.1 merge ++ */ ++ +__DRIconfig ** +driCreateConfigs(GLenum fb_format, GLenum fb_type, + const u_int8_t * depth_bits, const u_int8_t * stencil_bits, + unsigned num_depth_stencil_bits, + const GLenum * db_modes, unsigned num_db_modes) { - static const uint8_t bits_table[3][4] = { + static const u_int8_t bits_table[4][4] = { /* R G B A */ + { 3, 3, 2, 0 }, /* Any GL_UNSIGNED_BYTE_3_3_2 */ { 5, 6, 5, 0 }, /* Any GL_UNSIGNED_SHORT_5_6_5 */ { 8, 8, 8, 0 }, /* Any RGB with any GL_UNSIGNED_INT_8_8_8_8 */ { 8, 8, 8, 8 } /* Any RGBA with any GL_UNSIGNED_INT_8_8_8_8 */ diff --cc src/mesa/drivers/dri/ffb/ffb_linetmp.h index aea84f5f23f,e9d8260e1aa..10e1375259b --- a/src/mesa/drivers/dri/ffb/ffb_linetmp.h +++ b/src/mesa/drivers/dri/ffb/ffb_linetmp.h @@@ -1,6 -1,5 +1,5 @@@ - /* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_linetmp.h,v 1.2 2002/02/22 21:32:58 dawes Exp $ */ -static __inline void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0, +static INLINE void TAG(ffb_line)(GLcontext *ctx, ffb_vertex *v0, ffb_vertex *v1 ) { ffbContextPtr fmesa = FFB_CONTEXT(ctx); diff --cc src/mesa/drivers/dri/ffb/ffb_pointtmp.h index c483e205dd1,2c91426b3a2..3003de70c69 --- a/src/mesa/drivers/dri/ffb/ffb_pointtmp.h +++ b/src/mesa/drivers/dri/ffb/ffb_pointtmp.h @@@ -1,6 -1,5 +1,5 @@@ - /* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_pointtmp.h,v 1.3 2002/02/22 21:32:59 dawes Exp $ */ -static __inline void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp ) +static INLINE void TAG(ffb_draw_point)(GLcontext *ctx, ffb_vertex *tmp ) { ffbContextPtr fmesa = FFB_CONTEXT(ctx); ffb_fbcPtr ffb = fmesa->regs; diff --cc src/mesa/drivers/dri/ffb/ffb_xmesa.c index 7fd4e570d33,a31cd57e882..3b7aa45903c --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@@ -624,9 -641,10 +624,9 @@@ ffbFillInModes( __DRIscreenPrivate *psp GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML }; - u_int8_t depth_bits_array[3]; - u_int8_t stencil_bits_array[3]; + uint8_t depth_bits_array[3]; + uint8_t stencil_bits_array[3]; - depth_bits_array[0] = 0; depth_bits_array[1] = depth_bits; depth_bits_array[2] = depth_bits; diff --cc src/mesa/drivers/dri/r128/r128_ioctl.h index 5ed44559a6d,52ae3a293f8..4b0c9cdc7fe --- a/src/mesa/drivers/dri/r128/r128_ioctl.h +++ b/src/mesa/drivers/dri/r128/r128_ioctl.h @@@ -45,10 -44,10 +44,10 @@@ USE OR OTHER DEALINGS IN THE SOFTWARE extern drmBufPtr r128GetBufferLocked( r128ContextPtr rmesa ); extern void r128FlushVerticesLocked( r128ContextPtr rmesa ); -static __inline void *r128AllocDmaLow( r128ContextPtr rmesa, int count, +static INLINE void *r128AllocDmaLow( r128ContextPtr rmesa, int count, int vert_size ) { - u_int32_t *head; + uint32_t *head; int bytes = count * vert_size; if ( !rmesa->vert_buf ) { diff --cc src/mesa/drivers/dri/r128/r128_tex.h index 40168f83bc2,e863436f4b2..77f0201a55e --- a/src/mesa/drivers/dri/r128/r128_tex.h +++ b/src/mesa/drivers/dri/r128/r128_tex.h @@@ -68,9 -67,9 +67,9 @@@ extern void r128InitTextureFuncs( struc #define R128PACKCOLOR4444( r, g, b, a ) \ ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) - static INLINE u_int32_t r128PackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) -static __inline__ uint32_t r128PackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) ++static INLINE uint32_t r128PackColor( GLuint cpp, ++ GLubyte r, GLubyte g, ++ GLubyte b, GLubyte a ) { switch ( cpp ) { case 2: diff --cc src/mesa/drivers/dri/savage/savageioctl.h index 50dce848a27,98629048aef..639605cc517 --- a/src/mesa/drivers/dri/savage/savageioctl.h +++ b/src/mesa/drivers/dri/savage/savageioctl.h @@@ -76,11 -76,11 +76,11 @@@ GLboolean savageHaveIndexedVerts( savag return (imesa->firstElt != -1); } -static __inline +static INLINE - u_int32_t *savageAllocVtxBuf( savageContextPtr imesa, GLuint words ) + uint32_t *savageAllocVtxBuf( savageContextPtr imesa, GLuint words ) { struct savage_vtxbuf_t *buffer = imesa->vtxBuf; - u_int32_t *head; + uint32_t *head; if (buffer == &imesa->dmaVtxBuf) { if (!buffer->total) { @@@ -115,10 -115,10 +115,10 @@@ return head; } -static __inline +static INLINE - u_int32_t *savageAllocIndexedVerts( savageContextPtr imesa, GLuint n ) + uint32_t *savageAllocIndexedVerts( savageContextPtr imesa, GLuint n ) { - u_int32_t *ret; + uint32_t *ret; savageFlushVertices(imesa); ret = savageAllocVtxBuf(imesa, n*imesa->HwVertexSize); imesa->firstElt = imesa->vtxBuf->flushed / imesa->HwVertexSize; @@@ -171,10 -171,10 +171,10 @@@ drm_savage_cmd_header_t *savageAllocCmd * incomplete indexed drawing command yet * - increments the number of elts. Final allocation is done in savageFlushElts */ -static __inline +static INLINE - u_int16_t *savageAllocElts( savageContextPtr imesa, GLuint n ) + uint16_t *savageAllocElts( savageContextPtr imesa, GLuint n ) { - u_int16_t *ret; + uint16_t *ret; GLuint qwords; assert (savageHaveIndexedVerts(imesa)); diff --cc src/mesa/drivers/dri/savage/savagestate.c index c5ef47f2580,84fd3157edf..ceef34c03ec --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@@ -638,15 -638,13 +638,15 @@@ static void savageDDScissor( GLcontext static void savageDDDrawBuffer(GLcontext *ctx, GLenum mode ) { savageContextPtr imesa = SAVAGE_CONTEXT(ctx); - u_int32_t destCtrl = imesa->regs.s4.destCtrl.ui; + uint32_t destCtrl = imesa->regs.s4.destCtrl.ui; - /* - * _DrawDestMask is easier to cope with than . - */ - switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0] ) { - case BUFFER_BIT_FRONT_LEFT: + if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) { + FALLBACK( ctx, SAVAGE_FALLBACK_DRAW_BUFFER, GL_TRUE ); + return; + } + + switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0] ) { + case BUFFER_FRONT_LEFT: imesa->IsDouble = GL_FALSE; imesa->regs.s4.destCtrl.ni.offset = imesa->savageScreen->frontOffset>>11; break; diff --cc src/mesa/drivers/dri/savage/savagetris.c index c67045c8b57,a1c7bb167e7..39b74285f11 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@@ -125,10 -125,10 +125,10 @@@ static void INLINE savage_draw_quad (sa EMIT_VERT (j, vb, vertsize, 0, v3); } -static __inline__ void savage_draw_point (savageContextPtr imesa, +static INLINE void savage_draw_point (savageContextPtr imesa, savageVertexPtr tmp) { GLuint vertsize = imesa->HwVertexSize; - u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); + uint32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); const GLfloat x = tmp->v.x; const GLfloat y = tmp->v.y; const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size, @@@ -281,10 -281,10 +281,10 @@@ static INLINE void savage_ptex_line (sa EMIT_VERT (j, vb, vertsize, 2, &tmp1); } -static __inline__ void savage_ptex_point (savageContextPtr imesa, +static INLINE void savage_ptex_point (savageContextPtr imesa, savageVertexPtr v0) { GLuint vertsize = imesa->HwVertexSize; - u_int32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); + uint32_t *vb = savageAllocVtxBuf (imesa, 6*vertsize); const GLfloat x = v0->v.x; const GLfloat y = v0->v.y; const GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size, diff --cc src/mesa/drivers/dri/unichrome/via_screen.c index 3648710533b,b81549df0e9..9c8eb908f16 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@@ -340,10 -365,13 +340,10 @@@ viaFillInModes( __DRIscreenPrivate *psp /* The 32-bit depth-buffer mode isn't supported yet, so don't actually * enable it. */ - static const u_int8_t depth_bits_array[4] = { 0, 16, 24, 32 }; - static const u_int8_t stencil_bits_array[4] = { 0, 0, 8, 0 }; + static const uint8_t depth_bits_array[4] = { 0, 16, 24, 32 }; + static const uint8_t stencil_bits_array[4] = { 0, 0, 8, 0 }; const unsigned depth_buffer_factor = 3; - - num_modes = depth_buffer_factor * back_buffer_factor * 4; - if ( pixel_bits == 16 ) { fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; diff --cc src/mesa/glapi/glapi.c index 08a26980e19,53efd7eef47..3858a4d42b2 --- a/src/mesa/glapi/glapi.c +++ b/src/mesa/glapi/glapi.c @@@ -50,23 -50,7 +50,23 @@@ +#ifdef HAVE_DIX_CONFIG_H + +#include +#define PUBLIC + +#else + - #include "glheader.h" + #include "main/glheader.h" + +#endif + +#include +#include +#ifdef DEBUG +#include +#endif + #include "glapi.h" #include "glapioffsets.h" #include "glapitable.h" diff --cc src/mesa/main/api_validate.c index 5a199939760,2eb96ae3f4e..bbc5933ab9f --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@@ -116,9 -67,16 +116,15 @@@ _mesa_validate_DrawElements(GLcontext * /* Vertex buffer object tests */ if (ctx->Array.ElementArrayBufferObj->Name) { + /* use indices in the buffer object */ GLuint indexBytes; - /* use indices in the buffer object */ + if (!ctx->Array.ElementArrayBufferObj->Size) { + _mesa_warning(ctx, + "glDrawElements called with empty array elements buffer"); + return GL_FALSE; + } + - /* make sure count doesn't go outside buffer bounds */ if (type == GL_UNSIGNED_INT) { indexBytes = count * sizeof(GLuint); } @@@ -130,8 -88,7 +136,8 @@@ indexBytes = count * sizeof(GLushort); } + /* make sure count doesn't go outside buffer bounds */ - if (indexBytes > ctx->Array.ElementArrayBufferObj->Size) { + if (indexBytes > (GLuint) ctx->Array.ElementArrayBufferObj->Size) { _mesa_warning(ctx, "glDrawElements index out of buffer bounds"); return GL_FALSE; } diff --cc src/mesa/main/attrib.c index c3c1f927fd2,b990369a9e8..ce0733855cc --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@@ -41,13 -42,17 +42,18 @@@ #include "light.h" #include "lines.h" #include "matrix.h" + #include "multisample.h" #include "points.h" #include "polygon.h" + #include "scissor.h" #include "simple_list.h" #include "stencil.h" + #include "texenv.h" + #include "texgen.h" #include "texobj.h" + #include "texparam.h" #include "texstate.h" +#include "varray.h" #include "mtypes.h" #include "math/m_xform.h" diff --cc src/mesa/main/bufferobj.h index 8baa59d6171,024e5a8c3c8..537b2404740 --- a/src/mesa/main/bufferobj.h +++ b/src/mesa/main/bufferobj.h @@@ -104,10 -101,10 +104,9 @@@ _mesa_map_drawpix_pbo(GLcontext *ctx const GLvoid *pixels); extern void - _mesa_unmap_drapix_pbo(GLcontext *ctx, - const struct gl_pixelstore_attrib *unpack); - + _mesa_unmap_drawpix_pbo(GLcontext *ctx, + const struct gl_pixelstore_attrib *unpack); - extern void * _mesa_map_readpix_pbo(GLcontext *ctx, const struct gl_pixelstore_attrib *pack, diff --cc src/mesa/main/buffers.c index 5ab969e0ebb,1d07c68633c..5dd85de272a --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@@ -522,49 -376,16 +377,49 @@@ _mesa_drawbuffers(GLcontext *ctx, GLuin destMask = mask; } - for (output = 0; output < n; output++) { - set_color_output(ctx, output, buffers[output], destMask[output]); + if (n == 1) { + GLuint buf, count = 0; + /* init to -1 to help catch errors */ + fb->_ColorDrawBufferIndexes[0] = -1; + for (buf = 0; buf < BUFFER_COUNT; buf++) { + if (destMask[0] & (1 << buf)) { + fb->_ColorDrawBufferIndexes[count] = buf; + count++; + } + } + fb->ColorDrawBuffer[0] = buffers[0]; + fb->_NumColorDrawBuffers = count; + } + else { + GLuint buf, count = 0; + for (buf = 0; buf < n; buf++ ) { + if (destMask[buf]) { + fb->_ColorDrawBufferIndexes[buf] = _mesa_ffs(destMask[buf]) - 1; + fb->ColorDrawBuffer[buf] = buffers[buf]; + count = buf + 1; + } + else { + fb->_ColorDrawBufferIndexes[buf] = -1; + } + } + /* set remaining outputs to -1 (GL_NONE) */ + while (buf < ctx->Const.MaxDrawBuffers) { + fb->_ColorDrawBufferIndexes[buf] = -1; + fb->ColorDrawBuffer[buf] = GL_NONE; + buf++; + } + fb->_NumColorDrawBuffers = count; } - /* set remaining color outputs to NONE */ - for (output = n; output < ctx->Const.MaxDrawBuffers; output++) { - set_color_output(ctx, output, GL_NONE, 0x0); + if (fb->Name == 0) { + /* also set context drawbuffer state */ + GLuint buf; + for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) { + ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf]; + } } - ctx->NewState |= _NEW_COLOR; + ctx->NewState |= _NEW_BUFFERS; } @@@ -611,34 -443,10 +466,35 @@@ _mesa_ReadBuffer(GLenum buffer if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer)); - if (!_mesa_readbuffer_update_fields(ctx, buffer)) - return; + fb = ctx->ReadBuffer; + + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer)); + + if (fb->Name > 0 && buffer == GL_NONE) { + /* This is legal for user-created framebuffer objects */ + srcBuffer = -1; + } + else { + /* general case / window-system framebuffer */ + srcBuffer = read_buffer_enum_to_index(buffer); + if (srcBuffer == -1) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glReadBuffer(buffer=0x%x)", buffer); + return; + } + supportedMask = supported_buffer_bitmask(ctx, fb); + if (((1 << srcBuffer) & supportedMask) == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glReadBuffer(buffer=0x%x)", buffer); + return; + } + } + + /* OK, all error checking has been completed now */ + _mesa_readbuffer(ctx, buffer, srcBuffer); + ctx->NewState |= _NEW_BUFFERS; /* * Call device driver function. diff --cc src/mesa/main/clear.c index 00000000000,434685984d1..a6257f9b982 mode 000000,100644..100644 --- a/src/mesa/main/clear.c +++ b/src/mesa/main/clear.c @@@ -1,0 -1,179 +1,182 @@@ + /* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + + /** + * \file clear.c + * glClearColor, glClearIndex, glClear() functions. + */ + + + + #include "glheader.h" + #include "clear.h" + #include "context.h" + #include "colormac.h" + #include "state.h" + + + + #if _HAVE_FULL_GL + void GLAPIENTRY + _mesa_ClearIndex( GLfloat c ) + { + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + if (ctx->Color.ClearIndex == (GLuint) c) + return; + + FLUSH_VERTICES(ctx, _NEW_COLOR); + ctx->Color.ClearIndex = (GLuint) c; + + if (!ctx->Visual.rgbMode && ctx->Driver.ClearIndex) { + /* it's OK to call glClearIndex in RGBA mode but it should be a NOP */ + (*ctx->Driver.ClearIndex)( ctx, ctx->Color.ClearIndex ); + } + } + #endif + + + /** + * Specify the clear values for the color buffers. + * + * \param red red color component. + * \param green green color component. + * \param blue blue color component. + * \param alpha alpha component. + * + * \sa glClearColor(). + * + * Clamps the parameters and updates gl_colorbuffer_attrib::ClearColor. On a + * change, flushes the vertices and notifies the driver via the + * dd_function_table::ClearColor callback. + */ + void GLAPIENTRY + _mesa_ClearColor( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) + { + GLfloat tmp[4]; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + + tmp[0] = CLAMP(red, 0.0F, 1.0F); + tmp[1] = CLAMP(green, 0.0F, 1.0F); + tmp[2] = CLAMP(blue, 0.0F, 1.0F); + tmp[3] = CLAMP(alpha, 0.0F, 1.0F); + + if (TEST_EQ_4V(tmp, ctx->Color.ClearColor)) + return; /* no change */ + + FLUSH_VERTICES(ctx, _NEW_COLOR); + COPY_4V(ctx->Color.ClearColor, tmp); + + if (ctx->Visual.rgbMode && ctx->Driver.ClearColor) { + /* it's OK to call glClearColor in CI mode but it should be a NOP */ + (*ctx->Driver.ClearColor)(ctx, ctx->Color.ClearColor); + } + } + + + /** + * Clear buffers. + * + * \param mask bit-mask indicating the buffers to be cleared. + * + * Flushes the vertices and verifies the parameter. If __GLcontextRec::NewState + * is set then calls _mesa_update_state() to update gl_frame_buffer::_Xmin, + * etc. If the rasterization mode is set to GL_RENDER then requests the driver + * to clear the buffers, via the dd_function_table::Clear callback. + */ + void GLAPIENTRY + _mesa_Clear( GLbitfield mask ) + { + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + - FLUSH_CURRENT(ctx, 0); - + if (MESA_VERBOSE & VERBOSE_API) + _mesa_debug(ctx, "glClear 0x%x\n", mask); + + if (mask & ~(GL_COLOR_BUFFER_BIT | + GL_DEPTH_BUFFER_BIT | + GL_STENCIL_BUFFER_BIT | + GL_ACCUM_BUFFER_BIT)) { + /* invalid bit set */ + _mesa_error( ctx, GL_INVALID_VALUE, "glClear(0x%x)", mask); + return; + } + + if (ctx->NewState) { + _mesa_update_state( ctx ); /* update _Xmin, etc */ + } + + if (ctx->DrawBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) { + _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT, + "glClear(incomplete framebuffer)"); + return; + } + - if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0) ++ if (ctx->DrawBuffer->Width == 0 || ctx->DrawBuffer->Height == 0 || ++ ctx->DrawBuffer->_Xmin >= ctx->DrawBuffer->_Xmax || ++ ctx->DrawBuffer->_Ymin >= ctx->DrawBuffer->_Ymax) + return; + + if (ctx->RenderMode == GL_RENDER) { + GLbitfield bufferMask; + + /* don't clear depth buffer if depth writing disabled */ + if (!ctx->Depth.Mask) + mask &= ~GL_DEPTH_BUFFER_BIT; + + /* Build the bitmask to send to device driver's Clear function. + * Note that the GL_COLOR_BUFFER_BIT flag will expand to 0, 1, 2 or 4 + * of the BUFFER_BIT_FRONT/BACK_LEFT/RIGHT flags, or one of the + * BUFFER_BIT_COLORn flags. + */ + bufferMask = 0; + if (mask & GL_COLOR_BUFFER_BIT) { - bufferMask |= ctx->DrawBuffer->_ColorDrawBufferMask[0]; ++ GLuint i; ++ for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { ++ bufferMask |= (1 << ctx->DrawBuffer->_ColorDrawBufferIndexes[i]); ++ } + } + + if ((mask & GL_DEPTH_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveDepthBuffer) { + bufferMask |= BUFFER_BIT_DEPTH; + } + + if ((mask & GL_STENCIL_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveStencilBuffer) { + bufferMask |= BUFFER_BIT_STENCIL; + } + + if ((mask & GL_ACCUM_BUFFER_BIT) + && ctx->DrawBuffer->Visual.haveAccumBuffer) { + bufferMask |= BUFFER_BIT_ACCUM; + } + + ASSERT(ctx->Driver.Clear); + ctx->Driver.Clear(ctx, bufferMask); + } + } diff --cc src/mesa/main/context.c index aa9d1129996,ed3faecf0db..96a8c30106a --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@@ -1261,9 -1294,10 +1316,11 @@@ _mesa_free_context_data( GLcontext *ct _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); + _mesa_free_attrib_data(ctx); _mesa_free_lighting_data( ctx ); + #if FEATURE_evaluators _mesa_free_eval_data( ctx ); + #endif _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); @@@ -1572,7 -1614,20 +1633,22 @@@ _mesa_make_current( GLcontext *newCtx, * or not bound to a user-created FBO. */ if (!newCtx->DrawBuffer || newCtx->DrawBuffer->Name == 0) { - /* fix up the fb fields - these will end up wrong otherwise - * if the DRIdrawable changes, and everything relies on them. - * This is a bit messy (same as needed in _mesa_BindFramebufferEXT) - */ ++ /* KW: merge conflict here, revisit. ++ */ ++ /* fix up the fb fields - these will end up wrong otherwise ++ * if the DRIdrawable changes, and everything relies on them. ++ * This is a bit messy (same as needed in _mesa_BindFramebufferEXT) ++ */ + unsigned int i; + GLenum buffers[MAX_DRAW_BUFFERS]; + _mesa_reference_framebuffer(&newCtx->DrawBuffer, drawBuffer); + + for(i = 0; i < newCtx->Const.MaxDrawBuffers; i++) { + buffers[i] = newCtx->Color.DrawBuffer[i]; + } + + _mesa_drawbuffers(newCtx, newCtx->Const.MaxDrawBuffers, buffers, NULL); } if (!newCtx->ReadBuffer || newCtx->ReadBuffer->Name == 0) { _mesa_reference_framebuffer(&newCtx->ReadBuffer, readBuffer); diff --cc src/mesa/main/drawpix.c index fde93384309,6db198ea3bb..13cfa0e756e --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@@ -374,7 -218,7 +218,7 @@@ _mesa_Bitmap( GLsizei width, GLsizei he if (ctx->RenderMode == GL_RENDER) { /* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */ - const GLfloat epsilon = 0.0001; - const GLfloat epsilon = (const GLfloat)0.0001; ++ const GLfloat epsilon = 0.0001F; GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig); GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig); diff --cc src/mesa/main/glheader.h index 6f3b2089c33,f0f97c218c2..3d413659ec1 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@@ -64,48 -69,35 +64,59 @@@ #include - /* Get typedefs for uintptr_t and friends */ - #if defined(__MINGW32__) || defined(__NetBSD__) - # include - #elif defined(_WIN32) - # include - # if _MSC_VER == 1200 - typedef UINT_PTR uintptr_t; - # endif - #elif defined(__INTERIX) - /* Interix 3.x has a gcc that shadows this. */ - # ifndef _UINTPTR_T_DEFINED - typedef unsigned long uintptr_t; - # define _UINTPTR_T_DEFINED + /* Get standard integer types */ + #if defined(_MSC_VER) + + typedef __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef __int16 int16_t; + typedef unsigned __int16 uint16_t; + # ifndef __eglplatform_h_ + typedef __int32 int32_t; # endif + typedef unsigned __int32 uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; + + # if defined(_WIN64) + typedef __int64 intptr_t; + typedef unsigned __int64 uintptr_t; + # else + typedef __int32 intptr_t; + typedef unsigned __int32 uintptr_t; + # endif + + # define INT64_C(__val) __val##i64 + # define UINT64_C(__val) __val##ui64 + #else - # include + # include #endif +/* For platforms that have the C99 standard uint*_t, + but not the commonly used u_int*_t */ +#if defined(__sun) +# define u_int8_t uint8_t +# define u_int16_t uint16_t +# define u_int32_t uint32_t +# define u_int64_t uint64_t +# define u_intptr_t uintptr_t +#endif + +/* Sun compilers define __i386 instead of the gcc-style __i386__ */ +#ifdef __SUNPRO_C +# if !defined(__i386__) && defined(__i386) +# define __i386__ +# elif !defined(__amd64__) && defined(__amd64) +# define __amd64__ +# elif !defined(__sparc__) && defined(__sparc) +# define __sparc__ +# endif +# if !defined(__volatile) +# define __volatile volatile +# endif +#endif + #if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) # define __WIN32__ # define finite _finite @@@ -266,9 -272,10 +297,10 @@@ #else # define ASSERT(X) #endif + #endif -#if !defined __GNUC__ || __GNUC__ < 3 +#if (!defined(__GNUC__) || __GNUC__ < 3) && (!defined(__IBMC__) || __IBMC__ < 900) # define __builtin_expect(x, y) x #endif diff --cc src/mesa/main/imports.c index 1aebb25163f,7231fa699cb..1307bae0d60 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@@ -557,30 -539,27 +557,30 @@@ _mesa_pow(double x, double y * Find the first bit set in a word. */ int - _mesa_ffs(int i) + _mesa_ffs(int32_t i) { #if (defined(_WIN32) && !defined(__MINGW32__) ) || defined(__IBMC__) || defined(__IBMCPP__) - register int32_t bit = 1; - if ((i & 0xffff) == 0) { - bit += 16; - i >>= 16; - } - if ((i & 0xff) == 0) { - bit += 8; - i >>= 8; - } - if ((i & 0xf) == 0) { - bit += 4; - i >>= 4; - } - if ((i & 0x3) == 0) { - bit += 2; - i >>= 2; + register int bit = 0; + if (i != 0) { + if ((i & 0xffff) == 0) { + bit += 16; + i >>= 16; + } + if ((i & 0xff) == 0) { + bit += 8; + i >>= 8; + } + if ((i & 0xf) == 0) { + bit += 4; + i >>= 4; + } + while ((i & 1) == 0) { + bit++; + i >>= 1; + } + bit++; } - return (i) ? (bit + ((i + 1) & 0x01)) : 0; + return bit; #else return ffs(i); #endif diff --cc src/mesa/main/mipmap.c index 8ca912b3a9d,061378f3b77..1032e9bb72c --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@@ -557,11 -479,11 +479,11 @@@ make_2d_mipmap(GLenum datatype, GLuint dst = dstPtr + border * ((dstWidth + 1) * bpt); for (row = 0; row < dstHeightNB; row++) { - do_row(format, srcWidthNB, srcA, srcB, + do_row(datatype, comps, srcWidthNB, srcA, srcB, dstWidthNB, dst); - srcA += 2 * srcRowStride; - srcB += 2 * srcRowStride; - dst += dstRowStride; + srcA += 2 * srcRowBytes; + srcB += 2 * srcRowBytes; + dst += dstRowBytes; } /* This is ugly but probably won't be used much */ @@@ -816,10 -742,10 +742,10 @@@ make_1d_stack_mipmap(GLenum datatype, G dst = dstPtr + border * ((dstWidth + 1) * bpt); for (row = 0; row < dstHeightNB; row++) { - do_row(format, srcWidthNB, src, src, + do_row(datatype, comps, srcWidthNB, src, src, dstWidthNB, dst); - src += srcRowStride; - dst += dstRowStride; + src += srcRowBytes; + dst += dstRowBytes; } if (border) { @@@ -867,11 -799,11 +799,11 @@@ make_2d_stack_mipmap(GLenum datatype, G for (layer = 0; layer < dstDepthNB; layer++) { for (row = 0; row < dstHeightNB; row++) { - do_row(format, srcWidthNB, srcA, srcB, + do_row(datatype, comps, srcWidthNB, srcA, srcB, dstWidthNB, dst); - srcA += 2 * srcRowStride; - srcB += 2 * srcRowStride; - dst += dstRowStride; + srcA += 2 * srcRowBytes; + srcB += 2 * srcRowBytes; + dst += dstRowBytes; } /* This is ugly but probably won't be used much */ diff --cc src/mesa/main/mtypes.h index 6f17e46d0ee,71a4ca55bc4..300010c3732 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@@ -1546,16 -1560,6 +1549,7 @@@ struct gl_texture_uni }; - struct texenvprog_cache_item; - - struct texenvprog_cache - { - struct texenvprog_cache_item **items; - GLuint size, n_items; - GLcontext *ctx; - }; - + /** * Texture attribute group (GL_TEXTURE_BIT). */ @@@ -1575,8 -1579,17 +1569,7 @@@ struct gl_texture_attri struct gl_texture_unit Unit[MAX_TEXTURE_UNITS]; - /** Proxy texture objects */ -#if 0 - struct gl_texture_object *Proxy1D; - struct gl_texture_object *Proxy2D; - struct gl_texture_object *Proxy3D; - struct gl_texture_object *ProxyCubeMap; - struct gl_texture_object *ProxyRect; - struct gl_texture_object *Proxy1DArray; - struct gl_texture_object *Proxy2DArray; -#else struct gl_texture_object *ProxyTex[NUM_TEXTURE_TARGETS]; -#endif /** GL_EXT_shared_texture_palette */ GLboolean SharedPalette; diff --cc src/mesa/main/points.c index 1458c90ab97,fbedbcb22c4..7e189a0a8c9 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@@ -76,19 -74,11 +74,16 @@@ _mesa_PointParameteri( GLenum pname, GL } - /* - * Added by GL_NV_point_sprite - */ void GLAPIENTRY - _mesa_PointParameterivNV( GLenum pname, const GLint *params ) + _mesa_PointParameteriv( GLenum pname, const GLint *params ) { - const GLfloat value = (GLfloat) params[0]; - _mesa_PointParameterfv(pname, &value); + GLfloat p[3]; + p[0] = (GLfloat) params[0]; + if (pname == GL_DISTANCE_ATTENUATION_EXT) { + p[1] = (GLfloat) params[1]; + p[2] = (GLfloat) params[2]; + } - _mesa_PointParameterfvEXT(pname, p); ++ _mesa_PointParameterfv(pname, p); } diff --cc src/mesa/main/state.c index 7192bed4a3d,344af91e172..5827f2211c0 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@@ -27,818 -27,30 +27,42 @@@ * \file state.c * State management. * - * This file manages recalculation of derived values in the __GLcontextRec. - * Also, this is where we initialize the API dispatch table. + * This file manages recalculation of derived values in GLcontext. */ + #include "glheader.h" - #include "accum.h" - #include "api_loopback.h" - #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program - #include "shader/arbprogram.h" - #endif - #if FEATURE_ATI_fragment_shader - #include "shader/atifragshader.h" - #endif - #include "attrib.h" - #include "blend.h" - #if FEATURE_ARB_vertex_buffer_object - #include "bufferobj.h" - #endif - #include "arrayobj.h" - #include "buffers.h" - #include "clip.h" - #include "colortab.h" + #include "mtypes.h" #include "context.h" - #include "convolve.h" - #include "depth.h" - #include "dlist.h" - #include "drawpix.h" - #include "enable.h" - #include "eval.h" - #include "get.h" - #include "feedback.h" - #include "fog.h" - #if FEATURE_EXT_framebuffer_object - #include "fbobject.h" - #endif + #include "debug.h" + #include "macros.h" + #include "ffvertex_prog.h" #include "framebuffer.h" - #include "hint.h" - #include "histogram.h" - #include "imports.h" #include "light.h" - #include "lines.h" - #include "macros.h" #include "matrix.h" + #if FEATURE_pixel_transfer #include "pixel.h" - #include "points.h" - #include "polygon.h" - #if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query - #include "queryobj.h" #endif - #include "rastpos.h" + #include "shader/program.h" #include "state.h" #include "stencil.h" - #include "teximage.h" + #include "texenvprogram.h" #include "texobj.h" #include "texstate.h" - #include "mtypes.h" - #include "varray.h" - #if FEATURE_NV_vertex_program - #include "shader/nvprogram.h" - #endif - #if FEATURE_NV_fragment_program - #include "shader/nvprogram.h" - #include "shader/program.h" - #include "texenvprogram.h" - #endif - #if FEATURE_ARB_shader_objects - #include "shaders.h" - #endif - #include "debug.h" - #include "glapi/dispatch.h" - - /** - * Initialize a dispatch table with pointers to Mesa's immediate-mode - * commands. - * - * Pointers to glBegin()/glEnd() object commands and a few others - * are provided via the GLvertexformat interface. - * - * \param ctx GL context to which \c exec belongs. - * \param exec dispatch table. - */ - void - _mesa_init_exec_table(struct _glapi_table *exec) - { - #if _HAVE_FULL_GL - _mesa_loopback_init_api_table( exec ); - #endif - - /* load the dispatch slots we understand */ - SET_AlphaFunc(exec, _mesa_AlphaFunc); - SET_BlendFunc(exec, _mesa_BlendFunc); - SET_Clear(exec, _mesa_Clear); - SET_ClearColor(exec, _mesa_ClearColor); - SET_ClearStencil(exec, _mesa_ClearStencil); - SET_ColorMask(exec, _mesa_ColorMask); - SET_CullFace(exec, _mesa_CullFace); - SET_Disable(exec, _mesa_Disable); - SET_DrawBuffer(exec, _mesa_DrawBuffer); - SET_Enable(exec, _mesa_Enable); - SET_Finish(exec, _mesa_Finish); - SET_Flush(exec, _mesa_Flush); - SET_FrontFace(exec, _mesa_FrontFace); - SET_Frustum(exec, _mesa_Frustum); - SET_GetError(exec, _mesa_GetError); - SET_GetFloatv(exec, _mesa_GetFloatv); - SET_GetString(exec, _mesa_GetString); - SET_InitNames(exec, _mesa_InitNames); - SET_LineStipple(exec, _mesa_LineStipple); - SET_LineWidth(exec, _mesa_LineWidth); - SET_LoadIdentity(exec, _mesa_LoadIdentity); - SET_LoadMatrixf(exec, _mesa_LoadMatrixf); - SET_LoadName(exec, _mesa_LoadName); - SET_LogicOp(exec, _mesa_LogicOp); - SET_MatrixMode(exec, _mesa_MatrixMode); - SET_MultMatrixf(exec, _mesa_MultMatrixf); - SET_Ortho(exec, _mesa_Ortho); - SET_PixelStorei(exec, _mesa_PixelStorei); - SET_PopMatrix(exec, _mesa_PopMatrix); - SET_PopName(exec, _mesa_PopName); - SET_PushMatrix(exec, _mesa_PushMatrix); - SET_PushName(exec, _mesa_PushName); - SET_RasterPos2f(exec, _mesa_RasterPos2f); - SET_RasterPos2fv(exec, _mesa_RasterPos2fv); - SET_RasterPos2i(exec, _mesa_RasterPos2i); - SET_RasterPos2iv(exec, _mesa_RasterPos2iv); - SET_ReadBuffer(exec, _mesa_ReadBuffer); - SET_RenderMode(exec, _mesa_RenderMode); - SET_Rotatef(exec, _mesa_Rotatef); - SET_Scalef(exec, _mesa_Scalef); - SET_Scissor(exec, _mesa_Scissor); - SET_SelectBuffer(exec, _mesa_SelectBuffer); - SET_ShadeModel(exec, _mesa_ShadeModel); - SET_StencilFunc(exec, _mesa_StencilFunc); - SET_StencilMask(exec, _mesa_StencilMask); - SET_StencilOp(exec, _mesa_StencilOp); - SET_TexEnvfv(exec, _mesa_TexEnvfv); - SET_TexEnvi(exec, _mesa_TexEnvi); - SET_TexImage2D(exec, _mesa_TexImage2D); - SET_TexParameteri(exec, _mesa_TexParameteri); - SET_Translatef(exec, _mesa_Translatef); - SET_Viewport(exec, _mesa_Viewport); - #if _HAVE_FULL_GL - SET_Accum(exec, _mesa_Accum); - SET_Bitmap(exec, _mesa_Bitmap); - SET_CallList(exec, _mesa_CallList); - SET_CallLists(exec, _mesa_CallLists); - SET_ClearAccum(exec, _mesa_ClearAccum); - SET_ClearDepth(exec, _mesa_ClearDepth); - SET_ClearIndex(exec, _mesa_ClearIndex); - SET_ClipPlane(exec, _mesa_ClipPlane); - SET_ColorMaterial(exec, _mesa_ColorMaterial); - SET_CopyPixels(exec, _mesa_CopyPixels); - SET_CullParameterfvEXT(exec, _mesa_CullParameterfvEXT); - SET_CullParameterdvEXT(exec, _mesa_CullParameterdvEXT); - SET_DeleteLists(exec, _mesa_DeleteLists); - SET_DepthFunc(exec, _mesa_DepthFunc); - SET_DepthMask(exec, _mesa_DepthMask); - SET_DepthRange(exec, _mesa_DepthRange); - SET_DrawPixels(exec, _mesa_DrawPixels); - SET_EndList(exec, _mesa_EndList); - SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); - SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); - SET_Fogf(exec, _mesa_Fogf); - SET_Fogfv(exec, _mesa_Fogfv); - SET_Fogi(exec, _mesa_Fogi); - SET_Fogiv(exec, _mesa_Fogiv); - SET_GenLists(exec, _mesa_GenLists); - SET_GetClipPlane(exec, _mesa_GetClipPlane); - SET_GetBooleanv(exec, _mesa_GetBooleanv); - SET_GetDoublev(exec, _mesa_GetDoublev); - SET_GetIntegerv(exec, _mesa_GetIntegerv); - SET_GetLightfv(exec, _mesa_GetLightfv); - SET_GetLightiv(exec, _mesa_GetLightiv); - SET_GetMapdv(exec, _mesa_GetMapdv); - SET_GetMapfv(exec, _mesa_GetMapfv); - SET_GetMapiv(exec, _mesa_GetMapiv); - SET_GetMaterialfv(exec, _mesa_GetMaterialfv); - SET_GetMaterialiv(exec, _mesa_GetMaterialiv); - SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); - SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); - SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); - SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple); - SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv); - SET_GetTexEnviv(exec, _mesa_GetTexEnviv); - SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv); - SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv); - SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv); - SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv); - SET_GetTexGendv(exec, _mesa_GetTexGendv); - SET_GetTexGenfv(exec, _mesa_GetTexGenfv); - SET_GetTexGeniv(exec, _mesa_GetTexGeniv); - SET_GetTexImage(exec, _mesa_GetTexImage); - SET_Hint(exec, _mesa_Hint); - SET_IndexMask(exec, _mesa_IndexMask); - SET_IsEnabled(exec, _mesa_IsEnabled); - SET_IsList(exec, _mesa_IsList); - SET_LightModelf(exec, _mesa_LightModelf); - SET_LightModelfv(exec, _mesa_LightModelfv); - SET_LightModeli(exec, _mesa_LightModeli); - SET_LightModeliv(exec, _mesa_LightModeliv); - SET_Lightf(exec, _mesa_Lightf); - SET_Lightfv(exec, _mesa_Lightfv); - SET_Lighti(exec, _mesa_Lighti); - SET_Lightiv(exec, _mesa_Lightiv); - SET_ListBase(exec, _mesa_ListBase); - SET_LoadMatrixd(exec, _mesa_LoadMatrixd); - SET_Map1d(exec, _mesa_Map1d); - SET_Map1f(exec, _mesa_Map1f); - SET_Map2d(exec, _mesa_Map2d); - SET_Map2f(exec, _mesa_Map2f); - SET_MapGrid1d(exec, _mesa_MapGrid1d); - SET_MapGrid1f(exec, _mesa_MapGrid1f); - SET_MapGrid2d(exec, _mesa_MapGrid2d); - SET_MapGrid2f(exec, _mesa_MapGrid2f); - SET_MultMatrixd(exec, _mesa_MultMatrixd); - SET_NewList(exec, _mesa_NewList); - SET_PassThrough(exec, _mesa_PassThrough); - SET_PixelMapfv(exec, _mesa_PixelMapfv); - SET_PixelMapuiv(exec, _mesa_PixelMapuiv); - SET_PixelMapusv(exec, _mesa_PixelMapusv); - SET_PixelStoref(exec, _mesa_PixelStoref); - SET_PixelTransferf(exec, _mesa_PixelTransferf); - SET_PixelTransferi(exec, _mesa_PixelTransferi); - SET_PixelZoom(exec, _mesa_PixelZoom); - SET_PointSize(exec, _mesa_PointSize); - SET_PolygonMode(exec, _mesa_PolygonMode); - SET_PolygonOffset(exec, _mesa_PolygonOffset); - SET_PolygonStipple(exec, _mesa_PolygonStipple); - SET_PopAttrib(exec, _mesa_PopAttrib); - SET_PushAttrib(exec, _mesa_PushAttrib); - SET_RasterPos2d(exec, _mesa_RasterPos2d); - SET_RasterPos2dv(exec, _mesa_RasterPos2dv); - SET_RasterPos2s(exec, _mesa_RasterPos2s); - SET_RasterPos2sv(exec, _mesa_RasterPos2sv); - SET_RasterPos3d(exec, _mesa_RasterPos3d); - SET_RasterPos3dv(exec, _mesa_RasterPos3dv); - SET_RasterPos3f(exec, _mesa_RasterPos3f); - SET_RasterPos3fv(exec, _mesa_RasterPos3fv); - SET_RasterPos3i(exec, _mesa_RasterPos3i); - SET_RasterPos3iv(exec, _mesa_RasterPos3iv); - SET_RasterPos3s(exec, _mesa_RasterPos3s); - SET_RasterPos3sv(exec, _mesa_RasterPos3sv); - SET_RasterPos4d(exec, _mesa_RasterPos4d); - SET_RasterPos4dv(exec, _mesa_RasterPos4dv); - SET_RasterPos4f(exec, _mesa_RasterPos4f); - SET_RasterPos4fv(exec, _mesa_RasterPos4fv); - SET_RasterPos4i(exec, _mesa_RasterPos4i); - SET_RasterPos4iv(exec, _mesa_RasterPos4iv); - SET_RasterPos4s(exec, _mesa_RasterPos4s); - SET_RasterPos4sv(exec, _mesa_RasterPos4sv); - SET_ReadPixels(exec, _mesa_ReadPixels); - SET_Rotated(exec, _mesa_Rotated); - SET_Scaled(exec, _mesa_Scaled); - SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT); - SET_TexEnvf(exec, _mesa_TexEnvf); - SET_TexEnviv(exec, _mesa_TexEnviv); - SET_TexGend(exec, _mesa_TexGend); - SET_TexGendv(exec, _mesa_TexGendv); - SET_TexGenf(exec, _mesa_TexGenf); - SET_TexGenfv(exec, _mesa_TexGenfv); - SET_TexGeni(exec, _mesa_TexGeni); - SET_TexGeniv(exec, _mesa_TexGeniv); - SET_TexImage1D(exec, _mesa_TexImage1D); - SET_TexParameterf(exec, _mesa_TexParameterf); - SET_TexParameterfv(exec, _mesa_TexParameterfv); - SET_TexParameteriv(exec, _mesa_TexParameteriv); - SET_Translated(exec, _mesa_Translated); - #endif - - /* 1.1 */ - SET_BindTexture(exec, _mesa_BindTexture); - SET_DeleteTextures(exec, _mesa_DeleteTextures); - SET_GenTextures(exec, _mesa_GenTextures); - #if _HAVE_FULL_GL - SET_AreTexturesResident(exec, _mesa_AreTexturesResident); - SET_ColorPointer(exec, _mesa_ColorPointer); - SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D); - SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D); - SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D); - SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D); - SET_DisableClientState(exec, _mesa_DisableClientState); - SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer); - SET_EnableClientState(exec, _mesa_EnableClientState); - SET_GetPointerv(exec, _mesa_GetPointerv); - SET_IndexPointer(exec, _mesa_IndexPointer); - SET_InterleavedArrays(exec, _mesa_InterleavedArrays); - SET_IsTexture(exec, _mesa_IsTexture); - SET_NormalPointer(exec, _mesa_NormalPointer); - SET_PopClientAttrib(exec, _mesa_PopClientAttrib); - SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures); - SET_PushClientAttrib(exec, _mesa_PushClientAttrib); - SET_TexCoordPointer(exec, _mesa_TexCoordPointer); - SET_TexSubImage1D(exec, _mesa_TexSubImage1D); - SET_TexSubImage2D(exec, _mesa_TexSubImage2D); - SET_VertexPointer(exec, _mesa_VertexPointer); - #endif - - /* 1.2 */ - #if _HAVE_FULL_GL - SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D); - SET_TexImage3D(exec, _mesa_TexImage3D); - SET_TexSubImage3D(exec, _mesa_TexSubImage3D); - #endif - - /* OpenGL 1.2 GL_ARB_imaging */ - #if _HAVE_FULL_GL - SET_BlendColor(exec, _mesa_BlendColor); - SET_BlendEquation(exec, _mesa_BlendEquation); - SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); - SET_ColorSubTable(exec, _mesa_ColorSubTable); - SET_ColorTable(exec, _mesa_ColorTable); - SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); - SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); - SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); - SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); - SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); - SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv); - SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri); - SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv); - SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); - SET_CopyColorTable(exec, _mesa_CopyColorTable); - SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D); - SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D); - SET_GetColorTable(exec, _mesa_GetColorTable); - SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); - SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); - SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter); - SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv); - SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv); - SET_GetHistogram(exec, _mesa_GetHistogram); - SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); - SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv); - SET_GetMinmax(exec, _mesa_GetMinmax); - SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv); - SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv); - SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter); - SET_Histogram(exec, _mesa_Histogram); - SET_Minmax(exec, _mesa_Minmax); - SET_ResetHistogram(exec, _mesa_ResetHistogram); - SET_ResetMinmax(exec, _mesa_ResetMinmax); - SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); - #endif - - /* OpenGL 2.0 */ - SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); - SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate); - SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate); - #if FEATURE_ARB_shader_objects - SET_AttachShader(exec, _mesa_AttachShader); - SET_CreateProgram(exec, _mesa_CreateProgram); - SET_CreateShader(exec, _mesa_CreateShader); - SET_DeleteProgram(exec, _mesa_DeleteProgram); - SET_DeleteShader(exec, _mesa_DeleteShader); - SET_DetachShader(exec, _mesa_DetachShader); - SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders); - SET_GetProgramiv(exec, _mesa_GetProgramiv); - SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog); - SET_GetShaderiv(exec, _mesa_GetShaderiv); - SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog); - SET_IsProgram(exec, _mesa_IsProgram); - SET_IsShader(exec, _mesa_IsShader); - #endif - - /* OpenGL 2.1 */ - #if FEATURE_ARB_shader_objects - SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv); - SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv); - SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv); - SET_UniformMatrix4x2fv(exec, _mesa_UniformMatrix4x2fv); - SET_UniformMatrix3x4fv(exec, _mesa_UniformMatrix3x4fv); - SET_UniformMatrix4x3fv(exec, _mesa_UniformMatrix4x3fv); - #endif - - - /* 2. GL_EXT_blend_color */ - #if 0 - /* SET_BlendColorEXT(exec, _mesa_BlendColorEXT); */ - #endif - - /* 3. GL_EXT_polygon_offset */ - #if _HAVE_FULL_GL - SET_PolygonOffsetEXT(exec, _mesa_PolygonOffsetEXT); - #endif - - /* 6. GL_EXT_texture3d */ - #if 0 - /* SET_CopyTexSubImage3DEXT(exec, _mesa_CopyTexSubImage3D); */ - /* SET_TexImage3DEXT(exec, _mesa_TexImage3DEXT); */ - /* SET_TexSubImage3DEXT(exec, _mesa_TexSubImage3D); */ - #endif - - /* 11. GL_EXT_histogram */ - #if 0 - SET_GetHistogramEXT(exec, _mesa_GetHistogram); - SET_GetHistogramParameterfvEXT(exec, _mesa_GetHistogramParameterfv); - SET_GetHistogramParameterivEXT(exec, _mesa_GetHistogramParameteriv); - SET_GetMinmaxEXT(exec, _mesa_GetMinmax); - SET_GetMinmaxParameterfvEXT(exec, _mesa_GetMinmaxParameterfv); - SET_GetMinmaxParameterivEXT(exec, _mesa_GetMinmaxParameteriv); - #endif - - /* 14. SGI_color_table */ - #if 0 - SET_ColorTableSGI(exec, _mesa_ColorTable); - SET_ColorSubTableSGI(exec, _mesa_ColorSubTable); - SET_GetColorTableSGI(exec, _mesa_GetColorTable); - SET_GetColorTableParameterfvSGI(exec, _mesa_GetColorTableParameterfv); - SET_GetColorTableParameterivSGI(exec, _mesa_GetColorTableParameteriv); - #endif - - /* 30. GL_EXT_vertex_array */ - #if _HAVE_FULL_GL - SET_ColorPointerEXT(exec, _mesa_ColorPointerEXT); - SET_EdgeFlagPointerEXT(exec, _mesa_EdgeFlagPointerEXT); - SET_IndexPointerEXT(exec, _mesa_IndexPointerEXT); - SET_NormalPointerEXT(exec, _mesa_NormalPointerEXT); - SET_TexCoordPointerEXT(exec, _mesa_TexCoordPointerEXT); - SET_VertexPointerEXT(exec, _mesa_VertexPointerEXT); - #endif - - /* 37. GL_EXT_blend_minmax */ - #if 0 - SET_BlendEquationEXT(exec, _mesa_BlendEquationEXT); - #endif - - /* 54. GL_EXT_point_parameters */ - #if _HAVE_FULL_GL - SET_PointParameterfEXT(exec, _mesa_PointParameterfEXT); - SET_PointParameterfvEXT(exec, _mesa_PointParameterfvEXT); - #endif - - /* 97. GL_EXT_compiled_vertex_array */ - #if _HAVE_FULL_GL - SET_LockArraysEXT(exec, _mesa_LockArraysEXT); - SET_UnlockArraysEXT(exec, _mesa_UnlockArraysEXT); - #endif - - /* 148. GL_EXT_multi_draw_arrays */ - #if _HAVE_FULL_GL - SET_MultiDrawArraysEXT(exec, _mesa_MultiDrawArraysEXT); - SET_MultiDrawElementsEXT(exec, _mesa_MultiDrawElementsEXT); - #endif - - /* 173. GL_INGR_blend_func_separate */ - #if _HAVE_FULL_GL - SET_BlendFuncSeparateEXT(exec, _mesa_BlendFuncSeparateEXT); - #endif - - /* 196. GL_MESA_resize_buffers */ - #if _HAVE_FULL_GL - SET_ResizeBuffersMESA(exec, _mesa_ResizeBuffersMESA); - #endif - - /* 197. GL_MESA_window_pos */ - #if _HAVE_FULL_GL - SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA); - SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA); - SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA); - SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA); - SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA); - SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA); - SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA); - SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA); - SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA); - SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA); - SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA); - SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA); - SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA); - SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA); - SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA); - SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA); - SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA); - SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA); - SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA); - SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA); - SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA); - SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA); - SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA); - SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA); - #endif - - /* 200. GL_IBM_multimode_draw_arrays */ - #if _HAVE_FULL_GL - SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM); - SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM); - #endif - - /* 233. GL_NV_vertex_program */ - #if FEATURE_NV_vertex_program - SET_BindProgramNV(exec, _mesa_BindProgram); - SET_DeleteProgramsNV(exec, _mesa_DeletePrograms); - SET_ExecuteProgramNV(exec, _mesa_ExecuteProgramNV); - SET_GenProgramsNV(exec, _mesa_GenPrograms); - SET_AreProgramsResidentNV(exec, _mesa_AreProgramsResidentNV); - SET_RequestResidentProgramsNV(exec, _mesa_RequestResidentProgramsNV); - SET_GetProgramParameterfvNV(exec, _mesa_GetProgramParameterfvNV); - SET_GetProgramParameterdvNV(exec, _mesa_GetProgramParameterdvNV); - SET_GetProgramivNV(exec, _mesa_GetProgramivNV); - SET_GetProgramStringNV(exec, _mesa_GetProgramStringNV); - SET_GetTrackMatrixivNV(exec, _mesa_GetTrackMatrixivNV); - SET_GetVertexAttribdvNV(exec, _mesa_GetVertexAttribdvNV); - SET_GetVertexAttribfvNV(exec, _mesa_GetVertexAttribfvNV); - SET_GetVertexAttribivNV(exec, _mesa_GetVertexAttribivNV); - SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervNV); - SET_IsProgramNV(exec, _mesa_IsProgramARB); - SET_LoadProgramNV(exec, _mesa_LoadProgramNV); - SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); /* alias to ProgramParameter4dNV */ - SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); /* alias to ProgramParameter4dvNV */ - SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); /* alias to ProgramParameter4fNV */ - SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); /* alias to ProgramParameter4fvNV */ - SET_ProgramParameters4dvNV(exec, _mesa_ProgramParameters4dvNV); - SET_ProgramParameters4fvNV(exec, _mesa_ProgramParameters4fvNV); - SET_TrackMatrixNV(exec, _mesa_TrackMatrixNV); - SET_VertexAttribPointerNV(exec, _mesa_VertexAttribPointerNV); - /* glVertexAttrib*NV functions handled in api_loopback.c */ - #endif - - /* 273. GL_APPLE_vertex_array_object */ - SET_BindVertexArrayAPPLE(exec, _mesa_BindVertexArrayAPPLE); - SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE); - SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE); - SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE); - - /* 282. GL_NV_fragment_program */ - #if FEATURE_NV_fragment_program - SET_ProgramNamedParameter4fNV(exec, _mesa_ProgramNamedParameter4fNV); - SET_ProgramNamedParameter4dNV(exec, _mesa_ProgramNamedParameter4dNV); - SET_ProgramNamedParameter4fvNV(exec, _mesa_ProgramNamedParameter4fvNV); - SET_ProgramNamedParameter4dvNV(exec, _mesa_ProgramNamedParameter4dvNV); - SET_GetProgramNamedParameterfvNV(exec, _mesa_GetProgramNamedParameterfvNV); - SET_GetProgramNamedParameterdvNV(exec, _mesa_GetProgramNamedParameterdvNV); - SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); - SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); - SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); - SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); - SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); - SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); - #endif - - /* 262. GL_NV_point_sprite */ - #if _HAVE_FULL_GL - SET_PointParameteriNV(exec, _mesa_PointParameteriNV); - SET_PointParameterivNV(exec, _mesa_PointParameterivNV); - #endif - - /* 268. GL_EXT_stencil_two_side */ - #if _HAVE_FULL_GL - SET_ActiveStencilFaceEXT(exec, _mesa_ActiveStencilFaceEXT); - #endif - - /* ???. GL_EXT_depth_bounds_test */ - SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT); - - /* ARB 1. GL_ARB_multitexture */ - #if _HAVE_FULL_GL - SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB); - SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB); - #endif - - /* ARB 3. GL_ARB_transpose_matrix */ - #if _HAVE_FULL_GL - SET_LoadTransposeMatrixdARB(exec, _mesa_LoadTransposeMatrixdARB); - SET_LoadTransposeMatrixfARB(exec, _mesa_LoadTransposeMatrixfARB); - SET_MultTransposeMatrixdARB(exec, _mesa_MultTransposeMatrixdARB); - SET_MultTransposeMatrixfARB(exec, _mesa_MultTransposeMatrixfARB); - #endif - - /* ARB 5. GL_ARB_multisample */ - #if _HAVE_FULL_GL - SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB); - #endif - - /* ARB 12. GL_ARB_texture_compression */ - #if _HAVE_FULL_GL - SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB); - SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB); - SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB); - SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB); - SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB); - SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB); - SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB); - #endif - - /* ARB 14. GL_ARB_point_parameters */ - /* reuse EXT_point_parameters functions */ - - /* ARB 26. GL_ARB_vertex_program */ - /* ARB 27. GL_ARB_fragment_program */ - #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program - /* glVertexAttrib1sARB aliases glVertexAttrib1sNV */ - /* glVertexAttrib1fARB aliases glVertexAttrib1fNV */ - /* glVertexAttrib1dARB aliases glVertexAttrib1dNV */ - /* glVertexAttrib2sARB aliases glVertexAttrib2sNV */ - /* glVertexAttrib2fARB aliases glVertexAttrib2fNV */ - /* glVertexAttrib2dARB aliases glVertexAttrib2dNV */ - /* glVertexAttrib3sARB aliases glVertexAttrib3sNV */ - /* glVertexAttrib3fARB aliases glVertexAttrib3fNV */ - /* glVertexAttrib3dARB aliases glVertexAttrib3dNV */ - /* glVertexAttrib4sARB aliases glVertexAttrib4sNV */ - /* glVertexAttrib4fARB aliases glVertexAttrib4fNV */ - /* glVertexAttrib4dARB aliases glVertexAttrib4dNV */ - /* glVertexAttrib4NubARB aliases glVertexAttrib4NubNV */ - /* glVertexAttrib1svARB aliases glVertexAttrib1svNV */ - /* glVertexAttrib1fvARB aliases glVertexAttrib1fvNV */ - /* glVertexAttrib1dvARB aliases glVertexAttrib1dvNV */ - /* glVertexAttrib2svARB aliases glVertexAttrib2svNV */ - /* glVertexAttrib2fvARB aliases glVertexAttrib2fvNV */ - /* glVertexAttrib2dvARB aliases glVertexAttrib2dvNV */ - /* glVertexAttrib3svARB aliases glVertexAttrib3svNV */ - /* glVertexAttrib3fvARB aliases glVertexAttrib3fvNV */ - /* glVertexAttrib3dvARB aliases glVertexAttrib3dvNV */ - /* glVertexAttrib4svARB aliases glVertexAttrib4svNV */ - /* glVertexAttrib4fvARB aliases glVertexAttrib4fvNV */ - /* glVertexAttrib4dvARB aliases glVertexAttrib4dvNV */ - /* glVertexAttrib4NubvARB aliases glVertexAttrib4NubvNV */ - /* glVertexAttrib4bvARB handled in api_loopback.c */ - /* glVertexAttrib4ivARB handled in api_loopback.c */ - /* glVertexAttrib4ubvARB handled in api_loopback.c */ - /* glVertexAttrib4usvARB handled in api_loopback.c */ - /* glVertexAttrib4uivARB handled in api_loopback.c */ - /* glVertexAttrib4NbvARB handled in api_loopback.c */ - /* glVertexAttrib4NsvARB handled in api_loopback.c */ - /* glVertexAttrib4NivARB handled in api_loopback.c */ - /* glVertexAttrib4NusvARB handled in api_loopback.c */ - /* glVertexAttrib4NuivARB handled in api_loopback.c */ - SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB); - SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB); - SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB); - SET_ProgramStringARB(exec, _mesa_ProgramStringARB); - /* glBindProgramARB aliases glBindProgramNV */ - /* glDeleteProgramsARB aliases glDeleteProgramsNV */ - /* glGenProgramsARB aliases glGenProgramsNV */ - /* glIsProgramARB aliases glIsProgramNV */ - SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB); - SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB); - SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB); - /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */ - SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB); - SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB); - SET_ProgramEnvParameter4fARB(exec, _mesa_ProgramEnvParameter4fARB); - SET_ProgramEnvParameter4fvARB(exec, _mesa_ProgramEnvParameter4fvARB); - SET_ProgramLocalParameter4dARB(exec, _mesa_ProgramLocalParameter4dARB); - SET_ProgramLocalParameter4dvARB(exec, _mesa_ProgramLocalParameter4dvARB); - SET_ProgramLocalParameter4fARB(exec, _mesa_ProgramLocalParameter4fARB); - SET_ProgramLocalParameter4fvARB(exec, _mesa_ProgramLocalParameter4fvARB); - SET_GetProgramEnvParameterdvARB(exec, _mesa_GetProgramEnvParameterdvARB); - SET_GetProgramEnvParameterfvARB(exec, _mesa_GetProgramEnvParameterfvARB); - SET_GetProgramLocalParameterdvARB(exec, _mesa_GetProgramLocalParameterdvARB); - SET_GetProgramLocalParameterfvARB(exec, _mesa_GetProgramLocalParameterfvARB); - SET_GetProgramivARB(exec, _mesa_GetProgramivARB); - SET_GetProgramStringARB(exec, _mesa_GetProgramStringARB); - #endif - - /* ARB 28. GL_ARB_vertex_buffer_object */ - #if FEATURE_ARB_vertex_buffer_object - SET_BindBufferARB(exec, _mesa_BindBufferARB); - SET_BufferDataARB(exec, _mesa_BufferDataARB); - SET_BufferSubDataARB(exec, _mesa_BufferSubDataARB); - SET_DeleteBuffersARB(exec, _mesa_DeleteBuffersARB); - SET_GenBuffersARB(exec, _mesa_GenBuffersARB); - SET_GetBufferParameterivARB(exec, _mesa_GetBufferParameterivARB); - SET_GetBufferPointervARB(exec, _mesa_GetBufferPointervARB); - SET_GetBufferSubDataARB(exec, _mesa_GetBufferSubDataARB); - SET_IsBufferARB(exec, _mesa_IsBufferARB); - SET_MapBufferARB(exec, _mesa_MapBufferARB); - SET_UnmapBufferARB(exec, _mesa_UnmapBufferARB); - #endif - - /* ARB 29. GL_ARB_occlusion_query */ - #if FEATURE_ARB_occlusion_query - SET_GenQueriesARB(exec, _mesa_GenQueriesARB); - SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB); - SET_IsQueryARB(exec, _mesa_IsQueryARB); - SET_BeginQueryARB(exec, _mesa_BeginQueryARB); - SET_EndQueryARB(exec, _mesa_EndQueryARB); - SET_GetQueryivARB(exec, _mesa_GetQueryivARB); - SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB); - SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB); - #endif - - /* ARB 37. GL_ARB_draw_buffers */ - SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB); - - #if FEATURE_ARB_shader_objects - SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB); - SET_GetHandleARB(exec, _mesa_GetHandleARB); - SET_DetachObjectARB(exec, _mesa_DetachObjectARB); - SET_CreateShaderObjectARB(exec, _mesa_CreateShaderObjectARB); - SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB); - SET_CompileShaderARB(exec, _mesa_CompileShaderARB); - SET_CreateProgramObjectARB(exec, _mesa_CreateProgramObjectARB); - SET_AttachObjectARB(exec, _mesa_AttachObjectARB); - SET_LinkProgramARB(exec, _mesa_LinkProgramARB); - SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB); - SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB); - SET_Uniform1fARB(exec, _mesa_Uniform1fARB); - SET_Uniform2fARB(exec, _mesa_Uniform2fARB); - SET_Uniform3fARB(exec, _mesa_Uniform3fARB); - SET_Uniform4fARB(exec, _mesa_Uniform4fARB); - SET_Uniform1iARB(exec, _mesa_Uniform1iARB); - SET_Uniform2iARB(exec, _mesa_Uniform2iARB); - SET_Uniform3iARB(exec, _mesa_Uniform3iARB); - SET_Uniform4iARB(exec, _mesa_Uniform4iARB); - SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB); - SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB); - SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB); - SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB); - SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB); - SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB); - SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB); - SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB); - SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB); - SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB); - SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB); - SET_GetObjectParameterfvARB(exec, _mesa_GetObjectParameterfvARB); - SET_GetObjectParameterivARB(exec, _mesa_GetObjectParameterivARB); - SET_GetInfoLogARB(exec, _mesa_GetInfoLogARB); - SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB); - SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB); - SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB); - SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB); - SET_GetUniformivARB(exec, _mesa_GetUniformivARB); - SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB); - #endif /* FEATURE_ARB_shader_objects */ - - #if FEATURE_ARB_vertex_shader - SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB); - SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB); - SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB); - #endif /* FEATURE_ARB_vertex_shader */ - - /* GL_ATI_fragment_shader */ - #if FEATURE_ATI_fragment_shader - SET_GenFragmentShadersATI(exec, _mesa_GenFragmentShadersATI); - SET_BindFragmentShaderATI(exec, _mesa_BindFragmentShaderATI); - SET_DeleteFragmentShaderATI(exec, _mesa_DeleteFragmentShaderATI); - SET_BeginFragmentShaderATI(exec, _mesa_BeginFragmentShaderATI); - SET_EndFragmentShaderATI(exec, _mesa_EndFragmentShaderATI); - SET_PassTexCoordATI(exec, _mesa_PassTexCoordATI); - SET_SampleMapATI(exec, _mesa_SampleMapATI); - SET_ColorFragmentOp1ATI(exec, _mesa_ColorFragmentOp1ATI); - SET_ColorFragmentOp2ATI(exec, _mesa_ColorFragmentOp2ATI); - SET_ColorFragmentOp3ATI(exec, _mesa_ColorFragmentOp3ATI); - SET_AlphaFragmentOp1ATI(exec, _mesa_AlphaFragmentOp1ATI); - SET_AlphaFragmentOp2ATI(exec, _mesa_AlphaFragmentOp2ATI); - SET_AlphaFragmentOp3ATI(exec, _mesa_AlphaFragmentOp3ATI); - SET_SetFragmentShaderConstantATI(exec, _mesa_SetFragmentShaderConstantATI); - #endif - - #if FEATURE_EXT_framebuffer_object - SET_IsRenderbufferEXT(exec, _mesa_IsRenderbufferEXT); - SET_BindRenderbufferEXT(exec, _mesa_BindRenderbufferEXT); - SET_DeleteRenderbuffersEXT(exec, _mesa_DeleteRenderbuffersEXT); - SET_GenRenderbuffersEXT(exec, _mesa_GenRenderbuffersEXT); - SET_RenderbufferStorageEXT(exec, _mesa_RenderbufferStorageEXT); - SET_GetRenderbufferParameterivEXT(exec, _mesa_GetRenderbufferParameterivEXT); - SET_IsFramebufferEXT(exec, _mesa_IsFramebufferEXT); - SET_BindFramebufferEXT(exec, _mesa_BindFramebufferEXT); - SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT); - SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT); - SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT); - SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT); - SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT); - SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT); - SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT); - SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT); - SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT); - #endif - - #if FEATURE_EXT_timer_query - SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT); - SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT); - #endif - - #if FEATURE_EXT_framebuffer_blit - SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT); - #endif - - /* GL_EXT_gpu_program_parameters */ - #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program - SET_ProgramEnvParameters4fvEXT(exec, _mesa_ProgramEnvParameters4fvEXT); - SET_ProgramLocalParameters4fvEXT(exec, _mesa_ProgramLocalParameters4fvEXT); - #endif - - /* GL_MESA_texture_array / GL_EXT_texture_array */ - #if FEATURE_EXT_framebuffer_object - SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT); - #endif - - /* GL_ATI_separate_stencil */ - SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI); - } - - - - /**********************************************************************/ - /** \name State update logic */ - /*@{*/ + + +static void +update_separate_specular(GLcontext *ctx) +{ + if (NEED_SECONDARY_COLOR(ctx)) + ctx->_TriangleCaps |= DD_SEPARATE_SPECULAR; + else + ctx->_TriangleCaps &= ~DD_SEPARATE_SPECULAR; +} + + /** * Update state dependent on vertex arrays. */ @@@ -976,17 -188,21 +200,21 @@@ update_program(GLcontext *ctx * 1. OpenGL 2.0/ARB vertex/fragment shaders * 2. ARB/NV vertex/fragment programs * 3. Programs derived from fixed-function state. + * + * Note: it's possible for a vertex shader to get used with a fragment + * program (and vice versa) here, but in practice that shouldn't ever + * come up, or matter. */ - /** - ** Fragment program - **/ -#if 1 - /* XXX get rid of this someday? */ - ctx->FragmentProgram._Active = GL_FALSE; -#endif - if (shProg && shProg->LinkStatus && shProg->FragmentProgram) { - /* user-defined fragment shader */ + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); + + if (shProg && shProg->LinkStatus) { + /* Use shader programs */ + /* XXX this isn't quite right, since we may have either a vertex + * _or_ fragment shader (not always both). + */ + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, + shProg->VertexProgram); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, shProg->FragmentProgram); } @@@ -1225,12 -428,11 +451,14 @@@ _mesa_update_state_locked( GLcontext *c if (new_state & _NEW_STENCIL) _mesa_update_stencil( ctx ); + #if FEATURE_pixel_transfer if (new_state & _IMAGE_NEW_TRANSFER_STATE) _mesa_update_pixel( ctx, new_state ); + #endif + if (new_state & _DD_NEW_SEPARATE_SPECULAR) + update_separate_specular( ctx ); + if (new_state & (_NEW_ARRAY | _NEW_PROGRAM)) update_arrays( ctx ); @@@ -1247,13 -448,7 +475,8 @@@ if (new_state & (_NEW_POINT | _NEW_LINE | _NEW_POLYGON | _NEW_LIGHT | _NEW_STENCIL | _DD_NEW_SEPARATE_SPECULAR)) update_tricaps( ctx, new_state ); +#endif - if (ctx->FragmentProgram._MaintainTexEnvProgram) { - if (new_state & (_NEW_TEXTURE | _DD_NEW_SEPARATE_SPECULAR | _NEW_FOG)) - _mesa_UpdateTexEnvProgram(ctx); - } - /* ctx->_NeedEyeCoords is now up to date. * * If the truth value of this variable has changed, update for the diff --cc src/mesa/main/texenvprogram.c index 512d52704d8,6877ef96f21..713ff3d2564 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@@ -28,23 -28,14 +28,25 @@@ #include "glheader.h" #include "macros.h" #include "enums.h" +#include "shader/program.h" #include "shader/prog_parameter.h" + #include "shader/prog_cache.h" #include "shader/prog_instruction.h" #include "shader/prog_print.h" #include "shader/prog_statevars.h" + #include "shader/programopt.h" #include "texenvprogram.h" + +struct texenvprog_cache_item +{ + GLuint hash; + void *key; + struct gl_fragment_program *data; + struct texenvprog_cache_item *next; +}; + + /** * This MAX is probably a bit generous, but that's OK. There can be * up to four instructions per texture unit (TEX + 3 for combine), @@@ -951,9 -940,13 +953,17 @@@ static void load_texture( struct texenv p->src_texture[unit] = emit_texld( p, OPCODE_TXP, tmp, WRITEMASK_XYZW, unit, dim, texcoord ); ++ + if (p->state->unit[unit].shadow) + p->program->Base.ShadowSamplers |= 1 << unit; - } else ++ + p->program->Base.SamplersUsed |= (1 << unit); + /* This identity mapping should already be in place + * (see _mesa_init_program_struct()) but let's be safe. + */ + p->program->Base.SamplerUnits[unit] = unit; + } + else p->src_texture[unit] = get_zero(p); } } @@@ -1256,36 -1183,13 +1200,16 @@@ _mesa_UpdateTexEnvProgram( GLcontext *c /* If a conventional fragment program/shader isn't in effect... */ if (!ctx->FragmentProgram._Enabled && - (!ctx->Shader.CurrentProgram || !ctx->Shader.CurrentProgram->FragmentProgram)) { + (!ctx->Shader.CurrentProgram || - !ctx->Shader.CurrentProgram->FragmentProgram) ) { ++ !ctx->Shader.CurrentProgram->FragmentProgram) ) ++ { + struct gl_fragment_program *newProg; + - make_state_key(ctx, &key); - hash = hash_key(&key); - - newProg = search_cache(&ctx->Texture.env_fp_cache, hash, &key, sizeof(key)); - - if (!newProg) { - /* create new tex env program */ - - if (0) - _mesa_printf("Building new texenv proggy for key %x\n", hash); - - newProg = (struct gl_fragment_program *) - ctx->Driver.NewProgram(ctx, GL_FRAGMENT_PROGRAM_ARB, 0); - - create_new_program(ctx, &key, newProg); - - /* Our ownership of newProg is transferred to the cache */ - cache_item(ctx, &ctx->Texture.env_fp_cache, hash, &key, newProg); - } ++ newProg = _mesa_get_fixed_func_fragment_program(ctx); - ctx->FragmentProgram._Current - = ctx->FragmentProgram._TexEnvProgram - = _mesa_get_fixed_func_fragment_program(ctx); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, newProg); + _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, newProg); } - else { - /* _Current pointer has been updated in update_program */ - /* ctx->FragmentProgram._Current = ctx->FragmentProgram.Current; */ - } /* Tell the driver about the change. Could define a new target for * this? diff --cc src/mesa/main/texstate.c index dbaeaa201ad,20f9c4512c4..86c54aefc02 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@@ -3211,32 -811,12 +819,36 @@@ _mesa_free_texture_data(GLcontext *ctx for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]); - for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) - _mesa_free_colortable_data( &ctx->Texture.Unit[u].ColorTable ); - _mesa_TexEnvProgramCacheDestroy( ctx ); + #if FEATURE_colortable + { + GLuint i; + for (i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++) + _mesa_free_colortable_data( &ctx->Texture.Unit[i].ColorTable ); + } + #endif } + + +/** + * Update the default texture objects in the given context to reference those + * specified in the shared state and release those referencing the old + * shared state. + */ +void +_mesa_update_default_objects_texture(GLcontext *ctx) +{ + GLuint i; + + for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i]; + + _mesa_reference_texobj(&texUnit->Current1D, ctx->Shared->Default1D); + _mesa_reference_texobj(&texUnit->Current2D, ctx->Shared->Default2D); + _mesa_reference_texobj(&texUnit->Current3D, ctx->Shared->Default3D); + _mesa_reference_texobj(&texUnit->CurrentCubeMap, ctx->Shared->DefaultCubeMap); + _mesa_reference_texobj(&texUnit->CurrentRect, ctx->Shared->DefaultRect); + _mesa_reference_texobj(&texUnit->Current1DArray, ctx->Shared->Default1DArray); + _mesa_reference_texobj(&texUnit->Current2DArray, ctx->Shared->Default2DArray); + } +} diff --cc src/mesa/main/varray.h index bb2d21b469b,f557940738e..97d5c8219d0 --- a/src/mesa/main/varray.h +++ b/src/mesa/main/varray.h @@@ -146,12 -150,21 +150,26 @@@ _mesa_MultiModeDrawElementsIBM( const G GLenum type, const GLvoid * const * indices, GLsizei primcount, GLint modestride ); +extern void GLAPIENTRY +_mesa_LockArraysEXT(GLint first, GLsizei count); + +extern void GLAPIENTRY +_mesa_UnlockArraysEXT( void ); + + extern void GLAPIENTRY + _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count); + + extern void GLAPIENTRY + _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type, + const GLvoid *indices); + + extern void GLAPIENTRY + _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, + GLenum type, const GLvoid *indices); + + + extern void _mesa_init_varray( GLcontext * ctx ); diff --cc src/mesa/shader/prog_execute.c index b9b7712f3f7,5afd9eb1534..32b6ff4fd42 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@@ -90,10 -90,9 +90,10 @@@ get_register_pointer(const struct prog_ const struct gl_program_parameter_list *params; ASSERT(source->File == PROGRAM_LOCAL_PARAM || source->File == PROGRAM_CONSTANT || - source->File == PROGRAM_STATE_VAR); + source->File == PROGRAM_STATE_VAR || + source->File == PROGRAM_UNIFORM); params = machine->CurProgram->Parameters; - if (reg < 0 || reg >= params->NumParameters) + if (reg < 0 || reg >= (GLint)params->NumParameters) return ZeroVec; else return params->ParameterValues[reg]; diff --cc src/mesa/shader/prog_statevars.c index 91392650a36,819db25a001..971eb25a491 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@@ -132,12 -131,8 +131,8 @@@ _mesa_fetch_state(GLcontext *ctx, cons ADD_3V(value, p, eye_z); NORMALIZE_3FV(value); value[3] = 1.0; - } + } return; - case STATE_POSITION_NORMALIZED: - COPY_4V(value, ctx->Light.Light[ln].EyePosition); - NORMALIZE_3FV( value ); - return; default: _mesa_problem(ctx, "Invalid light state in fetch_state"); return; @@@ -440,6 -439,37 +439,36 @@@ value[3] = ctx->Light.Light[ln]._CosCutoff; return; } + + case STATE_LIGHT_POSITION: { + const GLuint ln = (GLuint) state[2]; + COPY_4V(value, ctx->Light.Light[ln]._Position); + return; + } + + case STATE_LIGHT_POSITION_NORMALIZED: { + const GLuint ln = (GLuint) state[2]; + COPY_4V(value, ctx->Light.Light[ln]._Position); + NORMALIZE_3FV( value ); + return; + } + + case STATE_LIGHT_HALF_VECTOR: { + const GLuint ln = (GLuint) state[2]; + GLfloat p[3]; + /* Compute infinite half angle vector: + * halfVector = normalize(normalize(lightPos) + (0, 0, 1)) + * light.EyePosition.w should be 0 for infinite lights. + */ + COPY_3V(p, ctx->Light.Light[ln]._Position); + NORMALIZE_3FV(p); + ADD_3V(value, p, ctx->_EyeZDir); + NORMALIZE_3FV(value); + value[3] = 1.0; + return; + } + + - case STATE_PT_SCALE: value[0] = ctx->Pixel.RedScale; value[1] = ctx->Pixel.GreenScale; diff --cc src/mesa/shader/prog_uniform.c index 0b1d0232a06,f57df3d86dc..25d7c0997bc --- a/src/mesa/shader/prog_uniform.c +++ b/src/mesa/shader/prog_uniform.c @@@ -134,8 -134,8 +134,8 @@@ _mesa_longest_uniform_name(const struc GLint max = 0; GLuint i; for (i = 0; list && i < list->NumUniforms; i++) { -- GLuint len = _mesa_strlen(list->Uniforms[i].Name); - if (len > (GLuint)max) ++ GLint len = (GLint)_mesa_strlen(list->Uniforms[i].Name); + if (len > max) max = len; } return max; diff --cc src/mesa/shader/program.c index 693d73baa2c,b03dd24d112..6263fd277f8 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@@ -540,53 -504,6 +550,52 @@@ _mesa_insert_instructions(struct gl_pro return GL_TRUE; } - +/** + * Delete 'count' instructions at 'start' in the given program. + * Adjust branch targets accordingly. + */ +GLboolean +_mesa_delete_instructions(struct gl_program *prog, GLuint start, GLuint count) +{ + const GLuint origLen = prog->NumInstructions; + const GLuint newLen = origLen - count; + struct prog_instruction *newInst; + GLuint i; + + /* adjust branches */ + for (i = 0; i < prog->NumInstructions; i++) { + struct prog_instruction *inst = prog->Instructions + i; + if (inst->BranchTarget > 0) { + if (inst->BranchTarget >= start) { + inst->BranchTarget -= count; + } + } + } + + /* Alloc storage for new instructions */ + newInst = _mesa_alloc_instructions(newLen); + if (!newInst) { + return GL_FALSE; + } + + /* Copy 'start' instructions into new instruction buffer */ + _mesa_copy_instructions(newInst, prog->Instructions, start); + + /* Copy the remaining/tail instructions to new inst buffer */ + _mesa_copy_instructions(newInst + start, + prog->Instructions + start + count, + newLen - start); + + /* free old instructions */ + _mesa_free_instructions(prog->Instructions, origLen); + + /* install new instructions */ + prog->Instructions = newInst; + prog->NumInstructions = newLen; + + return GL_TRUE; +} + /** * Search instructions for registers that match (oldFile, oldIndex), diff --cc src/mesa/swrast/s_context.c index b64156a82d3,4d9b956f856..2dea8953992 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@@ -26,14 -26,13 +26,14 @@@ * Brian Paul */ - #include "imports.h" + #include "main/imports.h" #include "bufferobj.h" - #include "context.h" - #include "colormac.h" - #include "mtypes.h" + #include "main/context.h" + #include "main/colormac.h" + #include "main/mtypes.h" #include "teximage.h" #include "swrast.h" +#include "shader/prog_parameter.h" #include "shader/prog_statevars.h" #include "s_blend.h" #include "s_context.h" diff --cc src/mesa/tnl/t_vp_build.c index d79f84f1eb4,b3b63cd3e4a..5ef0f7e7056 --- a/src/mesa/tnl/t_vp_build.c +++ b/src/mesa/tnl/t_vp_build.c @@@ -1543,42 -44,9 +44,12 @@@ void _tnl_UpdateFixedFunctionProgram( G if (!ctx->VertexProgram._Current || ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) { - ctx->VertexProgram._Current - = ctx->VertexProgram._TnlProgram - = _mesa_get_fixed_func_vertex_program(ctx); + struct gl_vertex_program *newProg; + - /* Grab all the relevent state and put it in a single structure: - */ - key = make_state_key(ctx); - hash = hash_key(key); - - /* Look for an already-prepared program for this state: - */ - newProg = search_cache( tnl->vp_cache, hash, key, sizeof(*key)); - - /* OK, we'll have to build a new one: - */ - if (!newProg) { - - if (0) - _mesa_printf("Build new TNL program\n"); - - newProg = (struct gl_vertex_program *) - ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); - - create_new_program( key, newProg, ctx->Const.VertexProgram.MaxTemps ); - - if (ctx->Driver.ProgramStringNotify) - ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB, - &newProg->Base ); - - /* Our ownership of newProg is transferred to the cache */ - cache_item(ctx, tnl->vp_cache, hash, key, newProg); - } - else { - FREE(key); - } ++ newProg = _mesa_get_fixed_func_vertex_program(ctx); + + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, newProg); + _mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, newProg); } /* Tell the driver about the change. Could define a new target for