--- mesa-7.0.3.orig/Makefile
+++ mesa-7.0.3/Makefile
@@ -75,10 +75,15 @@
darwin-fat-all \
darwin-static \
darwin-static-x86ppc \
+dragonfly \
+dragonfly-dri \
+dragonfly-dri-amd64 \
+dragonfly-dri-x86 \
freebsd \
freebsd-dri \
freebsd-dri-amd64 \
freebsd-dri-x86 \
+freebsd-static \
hpux10 \
hpux10-gcc \
hpux10-static \
@@ -167,10 +172,10 @@
# Rules for making release tarballs
-DIRECTORY = Mesa-7.0.3
-LIB_NAME = MesaLib-7.0.3
-DEMO_NAME = MesaDemos-7.0.3
-GLUT_NAME = MesaGLUT-7.0.3
+DIRECTORY = Mesa-7.0.4
+LIB_NAME = MesaLib-7.0.4
+DEMO_NAME = MesaDemos-7.0.4
+GLUT_NAME = MesaGLUT-7.0.4
MAIN_FILES = \
$(DIRECTORY)/Makefile* \
--- mesa-7.0.3.orig/bin/mklib
+++ mesa-7.0.3/bin/mklib
@@ -111,6 +111,13 @@
# this is a special case (see bugzilla 10876)
DEPS="$DEPS $1"
;;
+ -Wl*)
+ # Another special case for DragonFly
+ DEPS="$DEPS $1"
+ ;;
+ -Wl*)
+ DEPS="$DEPS $1"
+ ;;
'-pthread')
DEPS="$DEPS -pthread"
;;
@@ -198,7 +205,7 @@
#
case $ARCH in
- 'Linux' | 'OpenBSD' | 'GNU' | GNU/*)
+ 'Linux' | 'OpenBSD' | 'DragonFly' | 'GNU' | GNU/*)
# we assume gcc
if [ "x$LINK" = "x" ] ; then
--- mesa-7.0.3.orig/bin/installmesa
+++ mesa-7.0.3/bin/installmesa
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+#
+# Simple shell script for installing Mesa's header and library files.
+# If the copy commands below don't work on a particular system (i.e. the
+# -f or -d flags), we may need to branch on `uname` to do the right thing.
+#
+
+
+TOP=.
+
+INCLUDE_DIR="/usr/local/include"
+LIB_DIR="/usr/local/lib"
+
+if [ "x$#" = "x0" ] ; then
+echo
+echo "***** Mesa installation - You may need root privileges to do this *****"
+echo
+echo "Default directory for header files is:" ${INCLUDE_DIR}
+echo "Enter new directory or press to accept this default."
+
+read INPUT
+if [ "x${INPUT}" != "x" ] ; then
+ INCLUDE_DIR=${INPUT}
+fi
+
+echo
+echo "Default directory for library files is:" ${LIB_DIR}
+echo "Enter new directory or press to accept this default."
+
+read INPUT
+if [ "x${INPUT}" != "x" ] ; then
+ LIB_DIR=${INPUT}
+fi
+
+echo
+echo "About to install Mesa header files (GL/*.h) in: " ${INCLUDE_DIR}/GL
+echo "and Mesa library files (libGL.*, etc) in: " ${LIB_DIR}
+echo "Press to continue, or -C to abort."
+
+read INPUT
+
+else
+INCLUDE_DIR=$1/include
+LIB_DIR=$1/lib
+fi
+
+# flags:
+# -f = force
+# -d = preserve symlinks (does not work on BSD)
+
+if [ `uname` = "FreeBSD" ] ; then
+ CP_FLAGS="-f"
+elif [ `uname` = "Darwin" ] ; then
+ CP_FLAGS="-f"
+elif [ `uname` = "AIX" ] ; then
+ CP_FLAGS="-fh"
+else
+ CP_FLAGS="-fd"
+fi
+
+
+set -v
+
+mkdir -p ${INCLUDE_DIR}
+mkdir -p ${INCLUDE_DIR}/GL
+# NOT YET: mkdir -p ${INCLUDE_DIR}/GLES
+mkdir -p ${LIB_DIR}
+cp -f ${TOP}/include/GL/*.h ${INCLUDE_DIR}/GL
+cp -f ${TOP}/src/glw/*.h ${INCLUDE_DIR}/GL
+# NOT YET: cp -f ${TOP}/include/GLES/*.h ${INCLUDE_DIR}/GLES
+cp ${CP_FLAGS} ${TOP}/lib*/lib* ${LIB_DIR}
+
+echo "Done."
--- mesa-7.0.3.orig/configs/default
+++ mesa-7.0.3/configs/default
@@ -10,7 +10,7 @@
# Version info
MESA_MAJOR=7
MESA_MINOR=0
-MESA_TINY=3
+MESA_TINY=4
# external projects. This should be useless now that we use libdrm.
DRM_SOURCE_PATH=$(TOP)/../drm
--- mesa-7.0.3.orig/configs/dragonfly
+++ mesa-7.0.3/configs/dragonfly
@@ -0,0 +1,38 @@
+# Configuration for DragonFly
+
+include $(TOP)/configs/default
+
+CONFIG_NAME = DragonFly
+
+# Compiler and flags
+CC = cc
+CXX = c++
+MAKE = gmake
+
+OPT_FLAGS = -O2
+PIC_FLAGS = -fPIC
+
+DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM \
+ -DHZ=100
+
+X11_INCLUDES = -I/usr/pkg/include
+
+CFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES) \
+ -ffast-math -pedantic
+
+CXXFLAGS += $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) $(X11_INCLUDES)
+
+GLUT_CFLAGS = -fexceptions
+
+# Work around aliasing bugs - developers should comment this out
+CFLAGS += -fno-strict-aliasing
+CXXFLAGS += -fno-strict-aliasing
+
+EXTRA_LIB_PATH = -L/usr/pkg/lib
+APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) $(EXTRA_LIB_PATH) -l$(GLUT_LIB) \
+ -l$(GLU_LIB) -l$(GL_LIB) -lXext -lXmu -lXi -lX11 -lm
+
+# Installation directories (for make install)
+INSTALL_DIR = /usr/pkg
+DRI_DRIVER_INSTALL_DIR = /usr/pkg/lib/modules/dri/
+
--- mesa-7.0.3.orig/configs/linux-osmesa
+++ mesa-7.0.3/configs/linux-osmesa
@@ -9,8 +9,17 @@
# Compiler and flags
CC = gcc
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
+
+PIC_FLAGS = -fPIC
+
+DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
+ -D_BSD_SOURCE -D_GNU_SOURCE \
+ -DPTHREADS -DUSE_XSHM -DHAVE_POSIX_MEMALIGN
+
+CFLAGS = -ansi -pedantic $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
+ $(ASM_FLAGS) -ffast-math
+
+CXXFLAGS = -ansi -pedantic $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
# Work around aliasing bugs - developers should comment this out
CFLAGS += -fno-strict-aliasing
@@ -26,3 +35,4 @@
OSMESA_LIB_DEPS = -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
APP_LIB_DEPS = -lOSMesa -lGLU
+
--- mesa-7.0.3.orig/configs/freebsd-static
+++ mesa-7.0.3/configs/freebsd-static
@@ -0,0 +1,27 @@
+# Configuration for generic FreeBSD, making static libs
+# Written by cy on 2008-04-23.
+
+include $(TOP)/configs/freebsd
+
+CONFIG_NAME = freebsd-static
+
+MKLIB_OPTIONS = -static
+PIC_FLAGS =
+
+# Library names (actual file names)
+GL_LIB_NAME = libGL.a
+GLU_LIB_NAME = libGLU.a
+GLUT_LIB_NAME = libglut.a
+GLW_LIB_NAME = libGLw.a
+OSMESA_LIB_NAME = libOSMesa.a
+
+# Library/program dependencies (static libs don't have dependencies)
+GL_LIB_DEPS =
+OSMESA_LIB_DEPS =
+GLU_LIB_DEPS =
+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
--- mesa-7.0.3.orig/configs/linux-osmesa16
+++ mesa-7.0.3/configs/linux-osmesa16
@@ -1,31 +1,19 @@
# Configuration for 16 bits/channel OSMesa library on Linux
-include $(TOP)/configs/default
+include $(TOP)/configs/linux-osmesa
CONFIG_NAME = linux-osmesa16
-# Compiler and flags
-CC = gcc
-CXX = g++
-CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31
-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
-
+DEFINES += -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=32
# Library names
OSMESA_LIB = OSMesa16
-OSMESA_LIB_NAME = libOSMesa16.so
-
# Directories
-SRC_DIRS = mesa glu
-DRIVER_DIRS = osmesa
PROGRAM_DIRS =
-
# Dependencies
-OSMESA_LIB_DEPS = -lm -lpthread
-GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
-APP_LIB_DEPS = -lOSMesa16
+APP_LIB_DEPS = -l$(OSMESA_LIB)
+
--- mesa-7.0.3.orig/configs/linux-osmesa32
+++ mesa-7.0.3/configs/linux-osmesa32
@@ -1,31 +1,22 @@
# Configuration for 32 bits/channel OSMesa library on Linux
-include $(TOP)/configs/default
+include $(TOP)/configs/linux-osmesa
CONFIG_NAME = linux-osmesa32
# Compiler and flags
-CC = gcc
-CXX = g++
-CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=32 -DDEFAULT_SOFTWARE_DEPTH_BITS=31
-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
+DEFINES += -DCHAN_BITS=32 -DDEFAULT_SOFTWARE_DEPTH_BITS=31
# Library names
OSMESA_LIB = OSMesa32
-OSMESA_LIB_NAME = libOSMesa32.so
-
# Directories
-SRC_DIRS = mesa glu
-DRIVER_DIRS = osmesa
PROGRAM_DIRS =
-
# Dependencies
-OSMESA_LIB_DEPS = -lm -lpthread
-GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
-APP_LIB_DEPS = -lOSMesa32
+APP_LIB_DEPS = -l$(OSMESA_LIB)
+
--- mesa-7.0.3.orig/configs/linux-dri-bp
+++ mesa-7.0.3/configs/linux-dri-bp
@@ -0,0 +1,55 @@
+# -*-makefile-*-
+# Configuration for linux-dri: Linux DRI hardware drivers for XFree86 & others
+
+include $(TOP)/configs/default
+
+CONFIG_NAME = linux-dri
+
+# Compiler and flags
+CC = gcc
+CXX = g++
+
+MKDEP = /usr/X11R6/bin/makedepend
+#MKDEP = gcc -M
+#MKDEP_OPTIONS = -MF depend
+
+WARN_FLAGS = -Wall
+OPT_FLAGS = -g
+PIC_FLAGS = -fPIC
+
+# Add '-DGLX_USE_TLS' to ARCH_FLAGS to enable TLS support.
+ARCH_FLAGS ?=
+
+DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE \
+ -D_BSD_SOURCE -D_GNU_SOURCE \
+ -DDRI_NEW_INTERFACE_ONLY -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1
+
+X11_INCLUDES = -I/usr/X11R6/include -I/usr/X11R6/include/X11/extensions
+
+CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) \
+ $(ASM_FLAGS) -std=c99 -ffast-math
+
+CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES)
+
+
+ASM_SOURCES =
+
+# Library/program dependencies
+EXTRA_LIB_PATH=-L/usr/X11R6/lib
+
+DRI_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread -lexpat -ldl
+GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lX11 -lXext -lXxf86vm -lm -lpthread -ldl
+GLUT_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXt -lXi -lm
+GLW_LIB_DEPS = $(EXTRA_LIB_PATH) -L$(LIB_DIR) -l$(GL_LIB) -lXt -lX11
+
+
+# Directories
+SRC_DIRS = glx/x11 mesa glu glut/glx glw
+DRIVER_DIRS = dri
+PROGRAM_DIRS =
+WINDOW_SYSTEM=dri
+
+# ffb and gamma are missing because they have not been converted to use the new
+# interface.
+DRI_DIRS = dri_client i810 i830 i915 mach64 mga r128 r200 radeon s3v \
+ savage sis tdfx trident unichrome fb
--- mesa-7.0.3.orig/configs/linux-osmesa16-static
+++ mesa-7.0.3/configs/linux-osmesa16-static
@@ -1,14 +1,10 @@
# Configuration for 16 bits/channel OSMesa library on Linux
-include $(TOP)/configs/default
+include $(TOP)/configs/linux-osmesa16
CONFIG_NAME = linux-osmesa16-static
# Compiler and flags
-CC = gcc
-CXX = g++
-CFLAGS = -O3 -ansi -pedantic -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -I/usr/X11R6/include -DCHAN_BITS=16 -DDEFAULT_SOFTWARE_DEPTH_BITS=31
-CXXFLAGS = -O3 -ansi -pedantic -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
MKLIB_OPTIONS = -static
PIC_FLAGS =
@@ -17,16 +13,5 @@
CXXFLAGS += -fno-strict-aliasing
# Library names
-OSMESA_LIB = OSMesa16
-OSMESA_LIB_NAME = libOSMesa16.a
+OSMESA_LIB_NAME = lib$(OSMESA_LIB).a
-
-# Directories
-SRC_DIRS = mesa glu
-DRIVER_DIRS = osmesa
-PROGRAM_DIRS =
-
-
-# Dependencies
-OSMESA_LIB_DEPS = -lm -lpthread
-APP_LIB_DEPS = -lOSMesa16
--- mesa-7.0.3.orig/configs/default-bp
+++ mesa-7.0.3/configs/default-bp
@@ -0,0 +1,75 @@
+# Default/template configuration
+
+# This is included by other config files which may override some
+# of these variables.
+
+CONFIG_NAME = default
+
+# Version info
+MESA_MAJOR=6
+MESA_MINOR=3
+MESA_TINY=0
+
+# external projects
+#DRM_SOURCE_PATH=$(TOP)/../drm
+DRM_SOURCE_PATH=/home/projects/DRI-freedesktop/drm
+
+# Compiler and flags
+CC = cc
+CXX = CC
+CFLAGS = -O
+CXXFLAGS = -O
+GLU_CFLAGS =
+
+# Misc tools and flags
+MKLIB_OPTIONS =
+MKDEP = makedepend
+MKDEP_OPTIONS = -fdepend
+MAKE = make
+
+# Library names (base name)
+GL_LIB = GL
+GLU_LIB = GLU
+GLUT_LIB = glut
+GLW_LIB = GLw
+OSMESA_LIB = OSMesa
+
+
+# Library names (actual file names)
+GL_LIB_NAME = lib$(GL_LIB).so
+GLU_LIB_NAME = lib$(GLU_LIB).so
+GLUT_LIB_NAME = lib$(GLUT_LIB).so
+GLW_LIB_NAME = lib$(GLW_LIB).so
+OSMESA_LIB_NAME = lib$(OSMesa).so
+
+
+# Optional assembly language optimization files for libGL
+ASM_SOURCES =
+
+# GLw widget sources (Append "GLwMDrawA.c" here and add -lXm to GLW_LIB_DEPS in
+# order to build the Motif widget too)
+GLW_SOURCES = GLwDrawA.c
+
+
+# Directories
+LIB_DIR = $(TOP)/lib
+INSTALL_PREFIX = /usr/local
+SRC_DIRS = mesa glu glut/glx glw
+GLU_DIRS = sgi
+DRIVER_DIRS = x11 osmesa
+# Which subdirs under $(TOP)/progs/ to enter:
+PROGRAM_DIRS = demos redbook samples xdemos
+
+
+# Library/program dependencies
+GL_LIB_DEPS = -lX11 -lXext -lm -lpthread
+OSMESA_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB)
+GLU_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lm
+GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lX11 -lXmu -lXt -lXi -lm
+GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lXt -lX11
+APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
+
+
+# Shading language support (set to 0 or 1)
+SHADING_LANGUAGE = 0
+
--- mesa-7.0.3.orig/configs/linux-tcc
+++ mesa-7.0.3/configs/linux-tcc
@@ -0,0 +1,22 @@
+# Configuration for debugging on Linux
+
+include $(TOP)/configs/default
+
+CONFIG_NAME = linux-tcc
+
+# Compiler and flags
+CC = gcc
+CXX = g++
+
+TCC_DIR=/home/progs/tcc-0.9.20
+
+CFLAGS = -g -ansi -pedantic -Wall -Wmissing-prototypes -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -I/usr/X11R6/include -DUSE_XSHM -DPTHREADS -DDEBUG -DMESA_DEBUG -DUSE_TCC -I$(TCC_DIR)
+
+CXXFLAGS = -g -ansi -pedantic -Wall -Wundef -fPIC -ffast-math -D_POSIX_SOURCE -D_SVID_SOURCE -D_BSD_SOURCE -DDEBUG -DMESA_DEBUG
+
+GLUT_CFLAGS = -fexceptions
+
+GL_LIB_DEPS = -L/usr/X11R6/lib -lX11 -lXext -lm -lpthread -L$(TCC_DIR) -ltcc -ldl
+GLUT_LIB_DEPS = -L$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -L/usr/X11R6/lib -lX11 -lXmu -lXt -lXi -lm
+GLW_LIB_DEPS = -L$(LIB_DIR) -l$(GL_LIB) -lXt -L/usr/X11R6/lib -lX11
+APP_LIB_DEPS = -L$(LIB_DIR) -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm
--- mesa-7.0.3.orig/configs/debian-default
+++ mesa-7.0.3/configs/debian-default
@@ -0,0 +1,17 @@
+# Define Debian-specific defaults.
+
+CONFIG_NAME = debian-default
+
+OPT_FLAGS = -O2 -g
+
+# override settings in configs/linux-x86-64
+LIB_DIR = lib
+EXTRA_LIB_PATH =
+
+SRC_DIRS = mesa
+PROGRAM_DIRS =
+
+INSTALL_DIR = /usr
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-dri-amd64
+++ mesa-7.0.3/configs/debian-dri-amd64
@@ -0,0 +1,9 @@
+# Configuration for building the DRI drivers on i386.
+
+include $(TOP)/configs/linux-dri-x86-64
+include $(TOP)/configs/debian-dri-default
+
+CONFIG_NAME = debian-dri-amd64
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-dri-any
+++ mesa-7.0.3/configs/debian-dri-any
@@ -0,0 +1,9 @@
+# Configuration for building the DRI drivers on the build architecture.
+
+include $(TOP)/configs/linux-dri
+include $(TOP)/configs/debian-dri-default
+
+CONFIG_NAME = debian-dri-any
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-dri-default
+++ mesa-7.0.3/configs/debian-dri-default
@@ -0,0 +1,36 @@
+# Configuration defaults for building the DRI drivers and DRI/GLX-enabled
+# libGL.
+
+include $(TOP)/configs/debian-default
+
+CONFIG_NAME = debian-dri-default
+
+SRC_DIRS = glx/x11 mesa progs
+DRIVER_DIRS = dri
+PROGRAM_DIRS = xdemos
+PROGS = glxdemo \
+ glxgears \
+ glxheads \
+ glxinfo
+
+LIB_DIR = lib/glx
+
+DRI_DRIVER_INSTALL_DIR = $(INSTALL_DIR)/lib/dri
+DRI_DRIVER_SEARCH_DIR = /usr/lib/dri
+
+DRI_DIRS = mach64 mga r128 r200 r300 radeon s3v savage tdfx trident
+
+ARCH_X86 = i386 amd64
+
+ifneq ($(findstring $(DEB_BUILD_ARCH), $(ARCH_X86)),)
+ DRI_DIRS += i810 i915 i965 sis unichrome
+endif
+
+ifeq ($(DEB_BUILD_ARCH), sparc)
+ DRI_DIRS += ffb
+endif
+
+APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-dri-i386
+++ mesa-7.0.3/configs/debian-dri-i386
@@ -0,0 +1,9 @@
+# Configuration for building the DRI drivers on i386.
+
+include $(TOP)/configs/linux-dri-x86
+include $(TOP)/configs/debian-dri-default
+
+CONFIG_NAME = debian-dri-i386
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-dri-i386-i686
+++ mesa-7.0.3/configs/debian-dri-i386-i686
@@ -0,0 +1,14 @@
+# Configuration for building the DRI drivers on i386.
+
+include $(TOP)/configs/linux-dri-x86
+include $(TOP)/configs/debian-dri-optimized-default
+
+CONFIG_NAME = debian-dri-i386-i686
+
+ARCH_FLAGS = -march=i686
+LIB_DIR = lib/glx/i686/cmov
+
+DRI_DRIVER_INSTALL_DIR = $(INSTALL_DIR)/lib/dri/i686/cmov
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-dri-optimized-default
+++ mesa-7.0.3/configs/debian-dri-optimized-default
@@ -0,0 +1,13 @@
+# Configuration defaults for CPU-optimized builds of the DRI drivers and
+# DRI/GLX-enabled libGL.
+
+include $(TOP)/configs/debian-dri-default
+
+CONFIG_NAME = debian-dri-optimized-default
+
+# override so that the utility programs are not rebuilt with CPU-specific
+# optimizations
+SRC_DIRS = glx/x11 mesa
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-indirect-default
+++ mesa-7.0.3/configs/debian-indirect-default
@@ -0,0 +1,7 @@
+# Configuration defaults for building GLX-enabled libGL.
+
+include $(TOP)/configs/debian-dri-default
+
+CONFIG_NAME = debian-indirect-default
+
+DRI_DIRS =
--- mesa-7.0.3.orig/configs/debian-indirect-hurd-i386
+++ mesa-7.0.3/configs/debian-indirect-hurd-i386
@@ -0,0 +1,9 @@
+# Configuration for building the DRI drivers on the build architecture.
+
+include $(TOP)/configs/linux-indirect
+include $(TOP)/configs/debian-indirect-default
+
+CONFIG_NAME = debian-indirect-hurd-i386
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-osmesa
+++ mesa-7.0.3/configs/debian-osmesa
@@ -0,0 +1,9 @@
+# Configuration for building only OSMesa on Debian.
+
+include $(TOP)/configs/linux-osmesa
+include $(TOP)/configs/debian-osmesa-default
+
+CONFIG_NAME = debian-osmesa
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-osmesa-default
+++ mesa-7.0.3/configs/debian-osmesa-default
@@ -0,0 +1,10 @@
+# Configuration defaults for building OSMesa.
+
+include $(TOP)/configs/debian-default
+
+CONFIG_NAME = debian-osmesa-default
+
+DRIVER_DIRS = osmesa
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-osmesa-static
+++ mesa-7.0.3/configs/debian-osmesa-static
@@ -0,0 +1,9 @@
+# Configuration for building only OSMesa (static version) on Debian.
+
+include $(TOP)/configs/linux-osmesa-static
+include $(TOP)/configs/debian-osmesa-default
+
+CONFIG_NAME = debian-osmesa-static
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-osmesa16
+++ mesa-7.0.3/configs/debian-osmesa16
@@ -0,0 +1,10 @@
+# Configuration for building OSMesa with support for 16 bits per color
+# channel.
+
+include $(TOP)/configs/linux-osmesa16
+include $(TOP)/configs/debian-osmesa-default
+
+CONFIG_NAME = debian-osmesa16
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-osmesa16-static
+++ mesa-7.0.3/configs/debian-osmesa16-static
@@ -0,0 +1,10 @@
+# Configuration for building a static version of OSMesa with support for 16
+# bits per color channel.
+
+include $(TOP)/configs/linux-osmesa16-static
+include $(TOP)/configs/debian-osmesa-default
+
+CONFIG_NAME = debian-osmesa16-static
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-osmesa32
+++ mesa-7.0.3/configs/debian-osmesa32
@@ -0,0 +1,10 @@
+# Configuration for building OSMesa with support for 32 bits per color
+# channel.
+
+include $(TOP)/configs/linux-osmesa32
+include $(TOP)/configs/debian-osmesa-default
+
+CONFIG_NAME = debian-osmesa32
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-osmesa32-static
+++ mesa-7.0.3/configs/debian-osmesa32-static
@@ -0,0 +1,10 @@
+# Configuration for building a static version of OSMesa with support for 32
+# bits per color channel.
+
+include $(TOP)/configs/linux-osmesa32-static
+include $(TOP)/configs/debian-osmesa-default
+
+CONFIG_NAME = debian-osmesa32-static
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-any
+++ mesa-7.0.3/configs/debian-swx11+glu-any
@@ -0,0 +1,9 @@
+# Configuration for building Mesa (swx11 and GLU) on the build architecture.
+
+include $(TOP)/configs/linux
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-any
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-alpha-ev5
+++ mesa-7.0.3/configs/debian-swx11+glu-alpha-ev5
@@ -0,0 +1,12 @@
+# Configuration for building Mesa (swx11 and GLU) on alpha (ev5 optimized).
+
+include $(TOP)/configs/linux-alpha
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-alpha-ev5
+
+SRC_DIRS = mesa
+LIB_DIR = lib/ev5/cmov
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-amd64
+++ mesa-7.0.3/configs/debian-swx11+glu-amd64
@@ -0,0 +1,10 @@
+# Configuration for building Mesa (swx11 and GLU) with runtime-detected
+# assembler optimizations on amd64.
+
+include $(TOP)/configs/linux-x86-64
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-amd64
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-default
+++ mesa-7.0.3/configs/debian-swx11+glu-default
@@ -0,0 +1,14 @@
+# Configuration defaults for building Mesa (swx11 and GLU).
+
+include $(TOP)/configs/debian-default
+
+CONFIG_NAME = debian-swx11+glu-default
+
+SRC_DIRS = mesa glu glw
+DRIVER_DIRS = x11
+
+GLW_SOURCES += GLwMDrawA.c
+GLW_LIB_DEPS += -lXm
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-i386
+++ mesa-7.0.3/configs/debian-swx11+glu-i386
@@ -0,0 +1,10 @@
+# Configuration for building Mesa (swx11 and GLU) with runtime-detected
+# assembler optimizations on i386.
+
+include $(TOP)/configs/linux-x86
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-i386
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-i386-i686
+++ mesa-7.0.3/configs/debian-swx11+glu-i386-i686
@@ -0,0 +1,14 @@
+# Configuration for building Mesa (swx11 and GLU) with runtime-detected
+# assembler optimizations on i386 (i686 optimized).
+
+include $(TOP)/configs/linux-x86
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-i386-i686
+
+ARCH_FLAGS += -march=i686
+SRC_DIRS = mesa
+LIB_DIR = lib/i686/cmov
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-powerpc-603
+++ mesa-7.0.3/configs/debian-swx11+glu-powerpc-603
@@ -0,0 +1,13 @@
+# Configuration for building Mesa (swx11 and GLU) with runtime-detected
+# assembler optimizations on powerpc (603 optimized).
+
+include $(TOP)/configs/linux-ppc
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-powerpc-603
+
+SRC_DIRS = mesa
+LIB_DIR = lib/603/cmov
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-ppc64
+++ mesa-7.0.3/configs/debian-swx11+glu-ppc64
@@ -0,0 +1,11 @@
+# Configuration for building Mesa (swx11 and GLU) with runtime-detected
+# assembler optimizations on ppc64.
+
+include $(TOP)/configs/debian-swx11+glu-any
+
+CONFIG_NAME = debian-swx11+glu-ppc64
+
+LIB_DIR = lib64
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-sparc
+++ mesa-7.0.3/configs/debian-swx11+glu-sparc
@@ -0,0 +1,10 @@
+# Configuration for building Mesa (swx11 and GLU) with runtime-detected
+# assembler optimizations on sparc.
+
+include $(TOP)/configs/linux-sparc
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-sparc
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-sparc-ultrasparc
+++ mesa-7.0.3/configs/debian-swx11+glu-sparc-ultrasparc
@@ -0,0 +1,13 @@
+# Configuration for building Mesa (swx11 and GLU) with runtime-detected
+# assembler optimizations on sparc (ultrasparc-optimized).
+
+include $(TOP)/configs/linux-ultrasparc
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-sparc-ultrasparc
+
+SRC_DIRS = mesa
+LIB_DIR = lib/ultrasparc/cmov
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-static-amd64
+++ mesa-7.0.3/configs/debian-swx11+glu-static-amd64
@@ -0,0 +1,10 @@
+# Configuration for building static versions of the libraries (swx11 and GLU)
+# on amd64.
+
+include $(TOP)/configs/linux-x86-64-static
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-static-amd64
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-static-any
+++ mesa-7.0.3/configs/debian-swx11+glu-static-any
@@ -0,0 +1,10 @@
+# Configuration for building static versions of the libraries (swx11 and GLU)
+# on the build architecture.
+
+include $(TOP)/configs/linux-static
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-static-any
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-static-i386
+++ mesa-7.0.3/configs/debian-swx11+glu-static-i386
@@ -0,0 +1,10 @@
+# Configuration for building static versions of the libraries (swx11 and GLU)
+# on i386.
+
+include $(TOP)/configs/linux-x86-static
+include $(TOP)/configs/debian-swx11+glu-default
+
+CONFIG_NAME = debian-swx11+glu-static-i386
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/debian-swx11+glu-static-ppc64
+++ mesa-7.0.3/configs/debian-swx11+glu-static-ppc64
@@ -0,0 +1,11 @@
+# Configuration for building static versions of the libraries (swx11 and GLU)
+# on ppc64.
+
+include $(TOP)/configs/debian-swx11+glu-static-any
+
+CONFIG_NAME = debian-swx11+glu-static-ppc64
+
+LIB_DIR = lib64
+
+# vim: ft=make
+
--- mesa-7.0.3.orig/configs/linux-osmesa-static
+++ mesa-7.0.3/configs/linux-osmesa-static
@@ -0,0 +1,15 @@
+# Configuration for building only libOSMesa on Linux, no Xlib driver
+# This doesn't really have any Linux dependencies, so it should be usable
+# on other (gcc-based) systems.
+
+include $(TOP)/configs/linux-osmesa
+
+CONFIG_NAME = linux-osmesa-static
+
+# Compiler and flags
+MKLIB_OPTIONS = -static
+PIC_FLAGS =
+
+# Library names
+OSMESA_LIB_NAME = lib$(OSMESA_LIB).a
+
--- mesa-7.0.3.orig/configs/linux-osmesa32-static
+++ mesa-7.0.3/configs/linux-osmesa32-static
@@ -0,0 +1,13 @@
+# Configuration for 32 bits/channel OSMesa library on Linux
+
+include $(TOP)/configs/linux-osmesa32
+
+CONFIG_NAME = linux-osmesa32-static
+
+# Compiler and flags
+MKLIB_OPTIONS = -static
+PIC_FLAGS =
+
+# Library names
+OSMESA_LIB_NAME = lib$(OSMESA_LIB).a
+
--- mesa-7.0.3.orig/configs/dragonfly-dri
+++ mesa-7.0.3/configs/dragonfly-dri
@@ -0,0 +1,56 @@
+# -*-makefile-*-
+# Configuration for dragonfly-dri: DragonFly DRI hardware drivers
+
+include $(TOP)/configs/dragonfly
+
+CONFIG_NAME = dragonfly-dri
+
+# Compiler and flags
+CC = gcc
+CXX = g++
+WARN_FLAGS = -Wall
+OPT_FLAGS = -O -g
+
+EXPAT_INCLUDES = -I/usr/pkg/include
+X11_INCLUDES = -I/usr/pkg/include
+DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
+ -DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
+ -DHAVE_ALIAS
+
+CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) -Wmissing-prototypes \
+ -std=c99 -Wundef -ffast-math $(ASM_FLAGS) $(X11_INCLUDES) $(DEFINES)
+
+CXXFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) $(DEFINES) -Wall -ansi \
+ -pedantic $(ASM_FLAGS) $(X11_INCLUDES)
+
+# Work around aliasing bugs - developers should comment this out
+CFLAGS += -fno-strict-aliasing
+CXXFLAGS += -fno-strict-aliasing
+
+ASM_SOURCES =
+
+# Library/program dependencies
+LIBDRM_CFLAGS = `pkg-config --cflags libdrm`
+LIBDRM_LIB = `pkg-config --libs libdrm`
+DRI_LIB_DEPS = -L/usr/pkg/lib -lm -lpthread -lexpat $(LIBDRM_LIB)
+GL_LIB_DEPS = -L/usr/pkg/lib -lX11 -lXext -lXxf86vm -lXdamage -lXfixes \
+ -lm -lpthread $(LIBDRM_LIB)
+
+GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/pkg/lib -lGLU -lGL -lX11 -lXmu \
+ -lXt -lXi -lm
+GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -L/usr/pkg/lib -lGL -lXt -lX11
+
+
+# Directories
+SRC_DIRS = glx/x11 mesa glu glut/glx glw
+DRIVER_DIRS = dri
+PROGRAM_DIRS =
+WINDOW_SYSTEM = dri
+
+DRM_SOURCE_PATH = $(TOP)/../drm
+
+# ffb and 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 tdfx \
+ unichrome savage sis
+
--- mesa-7.0.3.orig/configs/dragonfly-dri-amd64
+++ mesa-7.0.3/configs/dragonfly-dri-amd64
@@ -0,0 +1,10 @@
+# -*-makefile-*-
+# Configuration for dragonfly-dri-amd64: DragonFly DRI hardware drivers
+
+include $(TOP)/configs/dragonfly-dri
+
+CONFIG_NAME = dragonfly-dri-x86-64
+
+ASM_FLAGS = -DUSE_X86_64_ASM
+ASM_SOURCES = $(X86-64_SOURCES)
+ASM_API = $(X86-64_API)
--- mesa-7.0.3.orig/configs/dragonfly-dri-x86
+++ mesa-7.0.3/configs/dragonfly-dri-x86
@@ -0,0 +1,13 @@
+# -*-makefile-*-
+# Configuration for dragonfly-dri-x86: DragonFly DRI hardware drivers
+
+include $(TOP)/configs/dragonfly-dri
+
+CONFIG_NAME = dragonfly-dri-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-7.0.3.orig/docs/VERSIONS
+++ mesa-7.0.3/docs/VERSIONS
@@ -0,0 +1,1514 @@
+
+
+Mesa Version History
+====================
+
+1.0 beta February 1995
+ Initial release
+
+1.1 beta March 4, 1995
+ Changes:
+ faster point and line drawing (2x faster)
+ more systems supported, better Makefiles
+ Renamed lib*.a files to avoid collisions
+ many small bug fixes
+ New:
+ pseudo-GLX functions added
+ new implementation of evaluators (eval2.c)
+ GLUT support
+
+1.1.1 beta March 7, 1995
+ Changes:
+ Reverted from eval2.c to eval.c due to FPE on Linux
+ more speed improvements
+ more Makefile changes
+
+1.1.2 beta March 14, 1995
+ New:
+ implementation of SGI's blending extensions
+ glXUseXFont implemented
+ added MESA_DEBUG environment variable support
+ Changes:
+ Using eval2.c again
+ more FPE-prevention checks (0-length normals are OK)
+ a few small bug fixes
+ much faster pixel logic ops!
+ faster transformation arithmetic
+
+1.1.3 beta March 31, 1995
+ New:
+ gluScaleImage() and gluBuild2DMipMaps() implemented
+ Mesa widgets for Xt/Motif
+ blendEXT demos
+ added environment variables for selecting visuals
+ Changes:
+ almost all GLUT demos work correctly now
+ faster X device driver functions
+ more bug fixes
+
+1.1.4 beta April 20, 1995
+ Bug fixes:
+ - missing #define SEEK_SET in src-tk/image.c
+ - compile glShadeModel into display lists
+ - fixed pow() domain error in src/light.c
+ - fixed "flickering bitmaps" in double buffer mode
+ - fixed tk.h and aux.h for C++
+ - state of LIGHT_MODEL_LOCAL_VIEWER was inverted
+ New features:
+ - MUCH, MUCH nicer dithering in 8-bit RGB mode
+ - updated widgets and widget demos
+ - Implemented GLXPixmap functions
+ - Added GLU 1.1 and GLX 1.1 functions
+ - Changed the X/Mesa interface API, more versatile
+ - Implemented gluPartialDisk()
+
+1.2 May 22, 1995
+ Bug fixes:
+ - IRIX 4.x makefile problem
+ - modified tk to share root colormap as needed
+ - gluLookAt normalization problem
+ - suppress Expose, NoExpose events in swapbuffers
+ - glBitmap() and glDrawPixels() clipping
+ New features:
+ - GL_BLEND, GL_MODULATE, GL_DECAL, and GL_REPLACE_EXT texture
+ modes implemented
+ - texture maps stored more efficiently
+ - texture maps can be compiled into display lists
+ - Bogdan Sikorski's GLU polygon tesselation code
+ - Linas Vepstas's sweep and extrusion library
+ - glXCreateContext()'s shareList parameter works as it's supposed to.
+ XMesaCreateContext() updated to accept a shareList parameter too.
+ - Mesa can be compiled with real OpenGL .h files
+ - MESA_BACK_BUFFER environment variable
+ - better GLX error checking
+
+1.2.1 June 22, 1995
+ Bug fixes:
+ - X/Mesa double buffer window resize crash
+ - widgets now pass PointerMotion events
+ - X/Mesa incorrect default clear color and drawing color
+ - more robust X MIT-SHM support in X/Mesa
+ - glTexImage( format=GL_LUMINANCE ) didn't work
+ - GL_LINE mode polygons with line width > 1.0 could cause a crash
+ - numerous feedback bugs
+ - glReadPixels() from depth buffer was wrong
+ - error prone depth and stencil buffer allocation
+ New features:
+ - Preliminary Microsoft Windows driver
+ - Implemented a number of missing functions: glEvalCoord[12][df]v(),
+ glGet...(), etc.
+ - Added a few missing symbols to gl.h and glu.h
+ - Faster rendering of smooth-shaded, RGBA, depth-buffered polygons.
+ - Faster rendering of lines when width=2.0
+ - Stencil-related functions now work in display lists
+ Changes:
+ - renamed aux.h as glaux.h (MS-DOS names can't start with aux)
+ - most filenames are in 8.3 format to accomodate MS-DOS
+ - use GLubytes to store arrays of colors instead of GLints
+
+1.2.2 August 2, 1995
+ New features:
+ - texture mapped points and lines
+ - NURBS! (but not 100% complete)
+ - viewports may safely extend beyond window boundaries
+ - MESA_PRIVATE_CMAP environment variable
+ - Grayscale X display support
+ - two new demos: demos/gears.c and demos/shadow.c
+ - MachTen for Macintosh configuration
+ Bug fixes:
+ - glGet*(GL_DEPTH_BITS) returned bytes, not bits
+ - point, line, and bitmap rasterization suffered from roundoff errors
+ - fixed a division by zero error in line clippping
+ - occasional wrong default background color really fixed!
+ - glDepthFunc(GL_ALWAYS) with glDepthMask(GL_FALSE) didn't work
+ - gluBuild2DMipmaps malloc problem fixed
+ - view volume clipping of smooth shaded lines resulted in bad colors
+ Changes:
+ - new visual selection method in glXChooseVisual()
+ - improved GLU quadric functions
+ - call XSync for glFinish and XFlush for glFlush
+ - glVertex() calls now use a function pointer to avoid conditionals
+ - removed contrib directory from Mesa tar file (available on ftp site)
+ - AIX shared library support
+ - Removed GLUenum type as it's not in OpenGL
+
+1.2.3 September 26, 1995
+ New features:
+ - Mesa header files now equivalent to SGI OpenGL headers
+ - Support for HP's Color Recovery dithering displays
+ - Faster vertex transformation
+ - Faster raster operations into X windows under certain conditions
+ - New configurations: HP w/ shared libs, Ultrix w/ GCC, Data General
+ - 4-bit visuals now supported
+ Bug fixes:
+ - glScissor bug fixed
+ - round-off errors in clipping lines against clip planes fixed
+ - byte swapping between hosts and display servers implemented
+ - glGetError() can be called without a current rendering context
+ - problem with accidentally culled polygons is fixed
+ - fixed some widget compilation problems
+
+1.2.4 November 17, 1995
+ New features:
+ - More speed improvements (lighting, fogging, polygon drawing)
+ - Window system and OS-independent off-screen rendering
+ - Preliminary Fortran bindings
+ - glPolygonOffsetEXT implemented
+ - glColorMask and glIndexMask now fully implemented
+ - glPixelZoom implemented
+ - display lists fully implemented
+ - gamma correction
+ - dithering in 8-bit TrueColor/DirectColor visuals
+ Changes:
+ - Improved device driver interface
+ - tk.h renamed to gltk.h to avoid conflicts with Tcl's Tk
+ - Dithering support moved from core into device driver
+ Bug fixes:
+ - glEnable/Disable( GL_LIGHTING ) didn't always take effect
+ - glReadPixels byte swapping was broken
+ - glMaterial with pname==GL_AMBIENT_AND_DIFFUSE was broken
+ - duplicate glColor4b() prototype in GL/gl.h removed
+ - stripes in wave -ci demo fixed
+ - GL_LINEAR_MIPMAP_NEAREST had wrong value
+ - bugs in HP Color Recovery support fixed
+ - fixed bug when blending lines, points, bitmaps outside of window
+
+1.2.5 November 30, 1995
+ New Features:
+ - updated MS Windows driver
+ - new implementation of StaticGray/GrayScale visual support
+ Bug fixes:
+ - pixelzooming with gamma correction or blending didn't work
+ - HP color recovery visual wasn't being picked by glXChooseVisual
+ - glClear didn't always observe glColorMask changes
+ - olympic and offset demos didn't compile on some Suns
+ - texcoord clamping wasn't correct
+ - a polygon optimization introduced an occasional sampling problem
+
+1.2.6 January 26, 1996
+ New Features:
+ - faster line and polygon rendering under certain conditions. See
+ Performance Tips 9 and 10 in README
+ - profiling
+ - lighting is a bit faster
+ - better perspective corrected texture mapping
+ - Amiga AmiWin (X11) support
+ - preliminary Linux SVGA driver
+ Changes:
+ - now using a 16-bit depth buffer, faster, smaller
+ - GL_NORMALIZE is disabled by default
+ Bug fixes:
+ - projective texture mapping
+ - fixed a memory leak in the context destroy function
+ - GL_POLYGON with less than 3 vertices caused a crash
+ - glGet*() returned wrong result for GL_INDEX_MODE
+ - reading pixels from an unmapped X window caused a BadMatch error
+
+1.2.7 March 5, 1996
+ New:
+ - faster lighting
+ - faster 16-bit TrueColor rendering on Linux
+ - faster 32-bit TrueColor rendering on Linux, HP, IBM
+ - non-depth-buffered XImage polygons are faster
+ - vertex array extension
+ - software alpha planes
+ - updated Macintosh driver
+ - new NeXT driver
+ - GLU quadric functions generate texture coordinates
+ - reflect.c demo - reflective, textured surface demo
+ Changes:
+ - gamma correction code moved into the X driver for better performance
+ Bug fixes:
+ - multiple glClipPlane()'s didn't work reliably
+ - glPolygonMode() didn't always work
+ - glCullFace( GL_FRONT_AND_BACK ) didn't work
+ - texture mapping with gamma correction was buggy
+ - floating point exceptions in texture coordinate interpolation
+ - XImage byte swapping didn't always work
+ - polygon edge flags weren't always used correctly
+
+1.2.8 May 22, 1996
+ New:
+ - overlay planes on X servers with the SERVER_OVERLAY_VISUALS property
+ - better monochrome output
+ - more IRIX 6.x configurations
+ - more robust RGB mode color allocation
+ - added MESA_XSYNC environment variable
+ - GLX_MESA_pixmap_colormap and GLX_EXT_visual_info extensions
+ - GL_MESA_window_pos extension
+ - faster glReadPixels/glDrawPixels for GL_DEPTH and GL_UNSIGNED_SHORT
+ and GL_UNSIGNED_INT
+ - driver for prototype Cirrus Mondello 3-D board
+ - updated AmigaDOS driver
+ - a few small speed optimizations in polygon rendering
+ Changes:
+ - internal device driver interface modified to simplify device
+ driver implementations and to support hardware Z buffers
+ - several changes to the X/Mesa interface (xmesa.h)
+ Bug fixes:
+ - fixed pow(0,0) domain error triggered on some systems
+ - glStencilClear() in a display list caused an infinite loop
+ - glRasterPos*() was sometimes off by +/-0.5 in X and Y
+ - color masking and blending were performed in wrong order
+ - auxSolidCylinder() sometimes drew a wire-frame cylinder
+ - fixed file writing bug in osdemo.c
+ - pixel mapping didn't always work
+ - the GL_GEQUAL stencil func didn't work
+ - the GL_INVERT stencil op didn't work
+ - the stencil write mask didn't work
+ - glPush/PopAttrib() didn't do enough error checking
+ - glIsList() didn't always work correctly
+
+2.0 October 10, 1996
+ New:
+ - Implements OpenGL 1.1 API functions
+ - all texture filtering modes supported (mipmapping)
+ - faster texture mapping, see Performance Tip 11 in README
+ - antialiased RGB points
+ - X support for line and polygon stippling
+ - glDrawBuffer( GL_FRONT_AND_BACK ) works
+ - util/ directory of useful stuff
+ - demos/texobj demo of texture objects
+ Changes:
+ - major internal changes for thread-safeness
+ - new device driver interface
+ - MESA_ALPHA env variable removed
+ - triangle rasterizer replaces polygon rasterizer
+ Bug fixes:
+ - glPopAttrib() bug
+ - glDrawBuffer(GL_NONE) works now
+
+2.1 December 14, 1996
+ New:
+ - VMS support
+ - MS-DOS driver
+ - OpenStep support
+ - updated, combined Windows 95/NT driver
+ - implemented glGetLighti() and glGetTexGen*()
+ - GLX does garbage collection of ancillary buffers
+ Bug fixes:
+ - removed unused _EXT constants from gl.h
+ - fixed polygon offset bugs
+ - Z coordinates of clipped lines were incorrect
+ - glEdgeFlag() in display lists didn't always work
+ - glLight*() in display lists didn't work
+ - fixed X line stipple bugs (Michael Pichler)
+ - glXUseXfonts XFreeFont/XFreeFontInfo bug fixed
+ - fixed a feedback bug
+ - glTexGen*() now transforms GL_EYE_PLANE by inverse modelview matrix
+ - polygons were sometimes culled instead of clipped
+ - triangle rasterizer suffered from float/int overflow exceptions
+ - fixed FP underflow exception in lighting (specular exponent)
+ - glEnable/glDisable of GL_EXT_vertex_array enums didn't work
+ - fixed free(NULL) in GLU tesselator code
+ - using 24-bit color on some X servers resulted in garbage rendering
+ - 32-bit per pixel mode for XFree86 now works
+ - glRotate(a,0,0,0) gave unpredictable results
+ - GL_LINE_STRIP with > 480 vertices had occasional clipping problems
+ - 8-bit TrueColor GLXPixmap rendering incorrectly required a colormap
+ - glMaterial() wasn't ignored when GL_COLOR_MATERIAL was enabled
+ - glEnable(GL_COLOR_MATERIAL) followed by glColor() didn't work right
+ - accumulation buffer was limited to positive values
+ - projective textures didn't work
+ - selection buffer overflows weren't handled correctly
+ Changes:
+ - restored the GL_EXT_polygon_offset extension
+ - slightly faster RGB dithering
+ - the SVGA driver works again
+ - Amiga driver now distributed separately
+ - NeXT driver updated for Mesa 2.x
+
+2.2 March 14, 1997
+ New:
+ - better color selection when dithering
+ - added GL_EXT_texture_object extension
+ - updated MS-DOS driver for DJGPP
+ - added openbsd make configuration
+ - faster dithered flat-shaded triangles
+ - various compilation problems with Motif widgets fixed
+ - gl.h, glx.h and glu.h name mangling option
+ - BeOS driver
+ - 3D texture mapping extension
+ - GL_MESA_resize_buffers extension
+ - morph3d, stex3d and spectex demos
+ - 3Dfx support
+ Bug fixes:
+ - glColorMaterial should finally work right in all respects
+ - linear interpolation of mipmap levels was incorrectly weighted
+ - readpix.c didn't compile on Macintosh
+ - GL_INVERT and related logic ops didn't work right
+ - glTexImage[12]D() didn't check its parameters consistantly
+ - fixed a memory leak in glTexImage[12]D()
+ - kludged around a SunOS 5.x/GCC compiler bug in the feedback code
+ - glReadPixels aborted instead of normally catching some errors
+ - a few 1.1 constants were missing or misnamed in gl.h
+ - glBegin(p); glBegin(q); didn't generate an error
+ - fixed a memory leak in GLX code
+ - clipping of concave polygons could cause a core dump
+ - 1-component alpha texture maps didn't work
+ - fixed a GLU polygon tesselator bug
+ - polygons with colinear vertices were sometimes culled
+ - feedback triangle colors were wrong when using smooth shading
+ - textures with borders didn't work correctly
+ - colors returned in feedback mode were wrong when using lighting
+ - spotlights didn't effect ambient lighting correctly
+ - gluPartialDisk() had a few bugs
+ Changes:
+ - device driver interface expanded to support texture mapping
+ - faster matrix inversion subroutine
+ - commented out #include "wmesa_extend.h" from src/wmesa.c
+ - fixed many compiler warnings in the demo programs
+
+2.3 June 30, 1997
+ New:
+ - Mesa distribution divided into two pieces: library code and demos
+ - faster vertex transformation, clip testing, lighting
+ - faster line drawing
+ - TrueColor visuals how have dithering (for depths < 24 bits)
+ - added MESA_NO_DITHER environment variable
+ - new device driver function: NearFar(), RenderVB(), RasterSetup()
+ - added LynxOS configuration
+ - added cygnus Win32 configuration
+ - added texcyl.c GLUT demo
+ - added XMesaDitherColor() to X/Mesa interface
+ - new NURBS code from Bogdan Sikorski
+ - added demos/shape.c (non-rectangular X window!)
+ Bug fixes:
+ - glEnable/DisableClientState() were missing from GL/gl.h
+ - GL_SPHERE_MAP texcoord generation didn't work correctly
+ - glXGetConfig() returned wrong number of depth, stencil, accum bits
+ - glDrawPixels feedback/selection didn't examine RasterPos valid bit
+ - black and white were reversed on some monochrome displays
+ - fixed potential image memory leak (wasn't setting reference counter)
+ - glDrawPixels sometimes didn't recognize some GL state changes
+ - gluProject/UnProject() didn't check for divide by zero
+ - stex3d demo called random() and srandom(), not portable
+ - fixed memory leaks in context.c and drawpix.c
+ - fixed NULL dereferencing problem in gl_update_texture_state()
+ - glReadPixels between glBegin/glEnd didn't generate an error.
+ - fixed memory leak in polygon tesselator (Randy Frank)
+ - fixed seg fault bug drawing flat-shaded, depth-tested lines
+ - clipped GL_TRIANGLE_STRIPs sometimes had wrong color when flat-shaded
+ - glBindTexture sometimes didn't work
+ - fixed a bug deep in glXReleaseBuffersMESA()
+ - fog was mistakenly applied to alpha
+ - glPopMatrix didn't set "dirty matrix" flag
+ - glPolygonStipple pattern was sometimes wrong
+ - glClear wasn't disabled during feedback and selection
+ - fixed memory leak in glTexSubImage[123]D
+ Changes:
+ - many library source files reorganized
+ - faster X color allocation, colors also freed when finished with them
+ - new texture sampling function pointer in texture objects
+ - incorporated 3Dfx VooDoo driver v0.16 into main source tree
+ - many 3Dfx driver updates
+ - cygnus Makefiles now included
+ - updated DOS driver
+ - made a few changes to dosmesa.c and wmesa.c (VB->Unclipped)
+ - internally, colors now stored in GLubytes, not GLfixed
+ - optimized changing of GL_SHININESS parameter
+
+2.4 September 18, 1997
+ New:
+ - updated 3Dfx Glide driver
+ - hacks for 3Dfx rendering into an X window or fullscreen
+ - added depth buffer access functions to X/Mesa and OS/Mesa interfaces
+ Bug fixes:
+ - pixel buffer could overflow with long, wide lines
+ - fixed FP underflow problems in lighting
+ - glTexSubImage1D() had an unitialized variable
+ - incomplete texture objects could cause a segfault
+ - glDrawPixels with GL_COMPILE_AND_EXECUTE caused infinite loop
+ - flat-shaded quads in a strip were miscolored if clipped
+ - mipmapped triangle lod computation now works correctly
+ - fixed a few under/overflow bugs in triangle rasterizer
+ - glArrayElement() assigned bad normal if normal array disabled
+ - changed argument to glXReleaseBuffersMESA()
+ - fixed small triangle underflow bugs in tritemp.h (hopefully)
+ - glBindTexture(target, 0) caused a crash
+ - glTexImage[123]D() with NULL image pointer caused crash
+ - glPixelStore parameters are now ignored during display list execution
+ - fixed a two-sided lighting w/ clipping bug (black vertices)
+ - textures with width!=height were sometimes mis-rendered
+ - "weird" projection matrices could cause div by 0, other fp errors
+ Changes:
+ - changed precompiled header symbol from PCH to PC_HEADER
+ - split api.c into api1.c and api2.c
+ - added hash.c source file (but not used yet)
+ - a few Sun and HP configuration file changes
+ - MESA_GLX_FX env var replaces MESA_FX_WINDOW and MESA_FX_FULLSCREEN
+ - fixed a few cygnus build problems (src/Makefile.cygnus, src/wmesa.c)
+
+2.5 November 20, 1997
+ New:
+ - updated 3Dfx driver (v20) for GLQuake
+ - added GL_EXT_paletted_texture extension
+ - added GL_EXT_shared_texture_palette extension
+ - added GL_EXT_point_parameters extension
+ - now including Mark Kilgard's GLUT library v3.6
+ - new GLUT-based demos in gdemos/
+ - added a few more Unix config targets
+ - added Intel X86 assembly language vertex transformation code
+ - 3Dfx/Glide driver for Mesa now recognizes SST_SCREENREFRESH env var
+ - Windows 95 S3 Virge driver
+ Bug fixes:
+ - glCopyTexImage?D would crash due to uninitialized variable
+ - glColor w/ glColorMaterial in a display list caused a bug
+ - fixed several glDrawPixels() and ReadPixels() bugs in 3Dfx driver
+ - glVertex4*() vertices weren't always projected correctly
+ - trying to use mipmapped textured points or lines caused crash
+ - glColor[34][fd]() values now clamped to [0,1] before int conversion
+ Changes:
+ - new device driver functions for texture mapping
+ - hash tables used for display list and texture object lookup
+ - fixed GLX visual handling code to avoid saving redundant visuals
+ - 3Dfx Glide libraries automatically linked to libMesaGL.so
+ - dropped the Cirrus Logic Mondello code since it's obsolete
+ - updated Cygnus Makefiles (Stephane Rehel)
+ - updated Windows MSVC++ Makefiles (Oleg Letsinsky)
+ - procedure for making library files has changed: scripts now take
+ a major and minor version arguments. Make-config changed a lot.
+ - new implementation of glTexSubImage2D()
+ - updated widgets-mesa directory to create libMesaGLwM.a (Motif widget)
+ - separate linux-glide and linux-386-glide configurations
+
+2.6 February 12, 1998
+ New:
+ - Windows WGL functions
+ - updated VMS, DOS, Windows, Cygnus, BeOS, Amiga compilation support
+ - v0.22 of 3Dfx Glide driver
+ - more X86 assembly language optimizations
+ - faster blending for some modes
+ - XMesaSetFXmode() to switch between 3Dfx window and full-screen mode
+ - added preliminary thread support
+ - added GLX_MESA_copy_sub_buffer extension
+ - some clipping optimizations
+ Bug fixes:
+ - fixed shading/material bug when drawing long primitive strips
+ - fixed clipping problem in long primitive strips
+ - fixed clipping bug when using 3Dfx driver
+ - fixed a problem when trying to use X fonts w/ 3Dfx driver
+ - fixed a texture filter bug in 3Dfx/Glide driver
+ - fixed bug in 3Dfx/Glide driver involving depth mask & clearing
+ - glLoadMatrix to set projection matrix confused the 3Dfx driver
+ - non-identity texture matrices didn't work with linux-386 configs
+ - glGenTextures() didn't reserve the returned texture IDs
+ - NULL proxy image sent to glTexImageXD() caused crash
+ - added texture state validation optimization (Henk Kok)
+ - fixed colormap reuse problem when using both RGB and CI windows
+ - 32bpp True/DirectColor X visuals weren't recognized
+ - fixed potential problem in evaluators memory allocation
+ - fixed assorted demo compilation bugs
+ Changes:
+ - replaced old Mesa/windows/ directory with Mesa/WIN32/ directory
+ - converted a few old glaux/gltk demos to GLUT
+ - renamed directories: demos -> xdemos, gdemos -> demos
+
+
+3.0 September 17, 1998
+ New:
+ - OpenGL 1.2 API
+ - GL_EXT_abgr pixel format extension
+ - GL_SGIS_texture_edge_clamp extension
+ - GL_SGIS_multitexture extension (to be replaced by GL_ARB_multitex)
+ - GL_EXT_multitexture extension (to be replaced by GL_ARB_multitex)
+ - GL_EXT_rescale_normal extension and renormal.c demo
+ - GLX_SGI_video_sync extension (a no-op)
+ - antialiased lines
+ - glGetTexImage() now implemented
+ - glDraw/Copy/ReadPixels() optimizations
+ - optimized textured triangle code (Marten Stromberg)
+ - more optimization of dithered TrueColor triangles in X driver
+ - Linux GGI driver
+ - updated MGL driver
+ Bug fixes:
+ - lots of assorted compilation fixes
+ - glInitNames didn't write initial hit record
+ - glBitmap didn't always check for invalid raster position
+ - switching between GLX and OSMesa contexts caused a crash
+ - fixed uninitialized variable in Mesa widget code
+ - fixed typo in texture code which caused book/texgen to crash
+ - fixed texture sampling bug when filter=GL_LINEAR and wrap=GL_CLAMP
+ - gluDisk() in POINT or LINE mode sometimes failed
+ - fixed texture + fog bug
+ - GL_COMPILE_AND_EXECUTE mode didn't work reliably
+ - glMultMatrix in projection matrix mode w/ 3Dfx driver could fail
+ - glDrawPixels(color index pixels) weren't converted to RGBA
+ - fixed possible getenv() buffer overflow security bug
+ - glBitmap in feedback mode was offset by xOrig, yOrig params
+ - device driver's DrawPixels hook was never used
+ - glDrawPixels with zoomY!=1 and top/bottom clipping didn't work
+ - glDrawPixels optimized for GL_LUMINANCE, GL_LUMINANCE_ALPHA, GLubyte
+ - fixed MakeCurrent bug in GLwRedrawObjects() in MesaWorkstation.c
+ - glCopyTexSubImage2D() didn't work with 3Dfx driver
+ - lines with width = 2 could cause crash
+ - glClear with scissor rect sometimes cleared whole buffer
+ - glTexSubImage2D( .. GL_COLOR_INDEX .. ) didn't work
+ - glTexImageXD( .. GL_ABGR_EXT .. ) didn't work
+ - computation of inverse modelview matrix sometimes failed
+ - fixed GL_CLAMP mode texture sampling bug
+ - textured line interpolation was somewhat broken
+ - textured triangle interpolation was also somewhat broken
+ - glGet(MODELVIEW/PROJECTION/TEXTURE_MATRIX_STACK_DEPTH) off by one
+ - evaluator state wasn't fully initialized
+ - texture coordinate clipping was buggy
+ - evaluator surfaces could be mis-colored
+ - glAccum(GL_RETURN, s) didn't obey glColorMask() settings
+ - zero area polygons shouldn't be culled if polygon mode is point/line
+ - clipped width and height of glReadPixels was sometimes off by one
+ - blending with alpha = 0 or 1.0 wasn't always exact
+ - reading of pixels from clipped region was buggy
+ - minor tweaking of X visual management in GLX emulator
+ - glPolygonStipple now obeys pixel unpacking parameters
+ - glGetPolygonStipple now obeys pixel packing parameters
+ - interleaved vertex array texture coordinates were broken
+ - query of proxy texture internal format was broken
+ - alpha channel wasn't reliably cleared
+ - fixed divide by zero error in gluScaleImage if dest size = 1 x 1
+ Conformance bug fixes:
+ - GL_SELECTION_BUFFER_POINTER and GL_SELECTION_BUFFER_SIZE were missing
+ - GL_TEXTURE_INTERNAL_FORMAT was missing
+ - glGet*(GL_POLYGON_STIPPLE) was broken
+ - glPush/PopAttrib() didn't save/restore all texture state
+ - glBitmap in feedback mode didn't work
+ - feedback of texture coords didn't always work
+ - glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLbyte was broke
+ - glDrawPixels w/ format=GL_DEPTH_COMPONENT, type=GLubyte was broke
+ - glDrawPixels w/ format=GL_STENCIL_INDEX, type=GL_BITMAP was broke
+ Changes:
+ - upgraded GLUT to version 3.7
+ - only GL and GLU library code included in MesaLib.tar.gz
+ - GLUT and all demos now in MesaDemos.tar.gz
+ - glaux and gltk libraries removed
+ - IRIX -n32 and -64 libs go in lib32/ and lib64/ directories
+
+
+3.1 beta 1 November 19, 1998
+ New:
+ - GL_EXT_stencil_wrap extension
+ - GL_INGR_blend_func_separate extension
+ - GL_ARB_multitexture extension
+ - GL_NV_texgen_reflection extension
+ - newly optimized vertex transformation code
+ - updated GLUT 3.7 code
+ - better precision when using 32-bit Z buffer
+ - Allegro DJGPP driver
+ Bug fixes:
+ - glCopyPixels between front/back buffers didn't copy alpha correctly
+ - fixed out-of-bounds memory access in optimized 2-D texture code
+ - glPixelStorei didn't accept GL_PACK/UNPACK_IMAGE_HEIGHT parameter
+ - glGet*() didn't accept GL_MAX_3D_TEXTURE_SIZE parameter
+ - clipping of texture coordinates sometimes had bad R,Q values
+ - GL_CLAMP_TO_EDGE texture sampling was off by 0.5 texels
+ - glEdgeFlagPointer() now takes a GLvoid * instead of GLboolean *
+ - texture was sometimes applied twice with 3Dfx driver
+ - glPush/PopAttrib() fouled up texture object reference counts
+ - glDeleteLists(0, n) caused assertion failure
+ - bilinear texture sampling wasn't accurate enough
+ - glClear w/ glDepthMask(GL_FALSE) didn't work right on 3Dfx
+ - color components were reversed on big endian 32 bpp X visuals
+ Changes:
+ - removed GL_EXT_multitexture extension
+
+
+3.1 beta 2 May 24, 1999
+ New:
+ - multi-textured points and lines (mjk@nvidia.com)
+ - optimized 24bpp X rendering (bernd.paysan@gmx.de)
+ - added allegro support (bernie-t@geocities.com)
+ - cleaned-up Windows-related stuff (Ted Jump)
+ - minor stereo changes (KendallB@scitechsoft.com)
+ - new BeOS driver which implements BGLView class
+ - new Direct3D driver (see src/D3D)
+ - more efficient filled gluCylinder() function
+ - utilities: util/showbuffer.[ch] and util/glstate.[ch]
+ - fixed some IRIX compiler warnings
+ - added support for building Mesa in XFree86 with
+ SGI's GLX (kevin@precisioninsight.com)
+ Bug fixes:
+ - a variety of Windows/Mesa bug fixes (mjk@nvidia.com)
+ - packed pixel images weren't unpacked correctly
+ - patches some win32 files in GLUT (mjk@nvidia.com)
+ - glTexImage[123]D() didn't accept internalFormat == GL_COLOR_INDEX
+ - fixed lighting bug in Keith's new shading code
+ - fixed texture segfault seen in Lament screensaver
+ - fixed miscellaneous low-memory bugs
+ - glClear(GL_COLOR_BUFFER_BIT) with RGBA or CI masking was broken
+ - GL_LINEAR sampling of 3D textures was broken
+ - fixed SVR4 'cc' compiler macro problem (dawes@xfree86.org)
+ - added GL_TEXTURE_PRIORITY fix (keithh@netcomuk.co.uk)
+ - fixed wide point and wide line conformance bugs (brianp)
+ Changes:
+ - some device driver changes (see src/dd.h)
+ - new copyright on core Mesa code
+
+
+3.1 beta 3 September 17, 1999
+ New:
+ - optimized glAccum function
+ - optimized 24bpp rendering in XMesa driver
+ - GLU 1.2 polygon tessellator
+ Bug Fixes:
+ - glGetTexLevelParameter wasn't fully implemented
+ - glXUseXFont now handles multi-byte fonts
+ - glIsEnabled(GL_TEXTURE_2D / 3D) returned wrong result
+ - alpha channel of blending points, lines was sometimes incorrect
+ Changes:
+ - New library names: "libGL" instead of "libMesaGL"
+ - New library numbering: libGL.so.1.2.310
+ - New subdirectories: docs/ and bin/
+ - New Makefile-system (autoconf,automake,libtool)
+
+
+3.1 final December 14, 1999
+ New:
+ - added demos/gloss.c
+ - added xdemos/glxdpyinfo.c
+ - added GLX_ARB_get_proc_address extension
+ - rewritten glTexImage code paths (faster, less memory, bug fixes)
+ Bug Fixes:
+ - several vertex array bug fixes
+ - overlapping glCopyPixels with pixel zooming now works
+ - glXUseXFont() bitmaps were vertically shifted by one pixel
+ - glCopyPixels with pixel zooming now works
+
+
+3.2 final April 24, 2000
+ Bug fixes:
+ - fixed memcpy bugs in span.c
+ - fixed missing glEnd problem in demos/tessdemo.c
+ - fixed bug when clearing 24bpp Ximages
+ - fixed clipping problem found in Unreal Tournament
+ - fixed Loki's "ice bug" and "crazy triangles" seen in Heretic2
+ - fixed Loki's 3dfx RGB vs BGR bug
+ - fixed Loki's 3dfx smooth/flat shading bug in SoF
+ Changes:
+ - updated docs/README file
+ - use bcopy() optimizations on FreeBSD
+ - re-enabled the optimized persp_textured_triangle() function
+
+
+3.2.1 July 19, 2000
+ Bug fixes:
+ - gluBuild2DMipmaps() didn't accept GL_BGRA
+ - Fixed compile/makefile problems on IRIX
+ - fixed segfault in 3dfx driver when using GL selection/feedback
+ - no longer cull very, very tiny triangles
+ - blending w/ drawbuffer==GL_FRONT_BACK caused segfault (sw rendering)
+ - fixed Motif detection code in widgets-mesa/configure.in
+ - glColorMaterial and glMaterial updates to emissive and ambient
+ didn't always work right
+ - Specular highlights weren't always in the right place
+ - clipped GL_LINE mode polygons had interior lines appear
+ - blend term GL_ONE_MINUS_CONSTANT_ALPHA was broken
+ - GL_NICEST fog didn't always work with flat shading
+ - glRect commands in display lists were sometimes miscolored
+ - Line Z offset didn't always work
+ - fixed texgen normal vector problem (gloss's teapot)
+ - numerous GL conformance bugs fixed
+ Changes:
+ - glColorMask(false, false, false, false) handled better/faster
+ - reverted to old GLU polygon tessellator, GLU 1.1
+ - updated Win32 build files
+
+
+3.3 July 21, 2000
+ New:
+ - antialiased triangles now implemented
+ - GL_EXT_texture_env_add texture mode extension
+ - GLX 1.3 API
+ - support for separate draw/read buffers (ie GL_SGI_make_current_read)
+ - thread-safe API dispath
+ - improved glxinfo program
+ - demos/texdown program to measure texture download performance
+ - glext.h header file
+ - demos/geartrain program
+ - GL_EXT_texture_lod_bias extension
+ - demos/lodbias program
+ - further optimized glRead/DrawPixels for 16-bit TrueColor X visuals
+ - GLX_EXT_visual_rating extension (a no-op, however)
+ - GL_HP_occlusion_test extension (for X and OS/Mesa drivers)
+ - demos/occlude program
+ - GL_SGIS_pixel_texture and GL_SGIX_pixel_texture extensions
+ - demos/pixeltex program
+ - GL_SGI_color_matrix extension
+ - GL_SGI_color_table extension
+ - GL_EXT_histogram extension
+ - GL_ARB_texture_cube_map extension
+ - added xdemos/glxheads and xdemos/manywin
+ - demos/texenv.c demo
+ - GL_EXT_texture_env_combine extension (by Holger Waechtler)
+ - Xlib driver is now thread-safe (see xdemos/glthreads)
+ Bug Fixes:
+ - various GL conformance failures fixed since 3.2.1
+ Changes:
+ - gl.h now uses #defines instead of C enums for all tokens
+ - glu.h now uses #defines instead of C enums for all tokens
+ - moved programs from 3Dfx/demos/ into demos/ directory
+
+
+3.4 November 3, 2000
+ New:
+ - optimized glDrawPixels for glPixelZoom(1,-1)
+ Bug Fixes:
+ - widgets-mesa/src/*.c files were missing from 3.3 distro
+ - include/GL/mesa_wgl.h file was missing from 3.3 distro
+ - fixed some Win32 compile problems
+ - texture object priorities weren't getting initialized to 1.0
+ - glAreTexturesResident return value was wrong when using hardware
+ - glXUseXFont segfaulted when using 3dfx driver (via MESA_GLX_FX)
+ - glReadPixels with GLushort packed types was broken
+ - fixed a few bugs in the GL_EXT_texture_env_combine texture code
+ - glPush/PopAttrib(GL_ENABLE_BIT) mishandled multi-texture enables
+ - fixed some typos/bugs in the VB code
+ - glDrawPixels(GL_COLOR_INDEX) to RGB window didn't work
+ - optimized glDrawPixels paths weren't being used
+ - per-fragment fog calculation didn't work without a Z buffer
+ - improved blending accuracy, fixes Glean blendFunc test failures
+ - glPixelStore(GL_PACK/UNPACK_SKIP_IMAGES) wasn't handled correctly
+ - glXGetProcAddressARB() didn't always return the right address
+ - gluBuild[12]DMipmaps() didn't grok the GL_BGR pixel format
+ - texture matrix changes weren't always detected (GLUT projtex demo)
+ - fixed random color problem in vertex fog code
+ - fixed Glide-related bug that let Quake get a 24-bit Z buffer
+ Changes:
+ - finished internal support for compressed textures for DRI
+
+
+3.4.1 February 14, 2001
+ New:
+ - fixed some Linux build problems
+ - fixed some Windows build problems
+ - GL_EXT_texture_env_dot3 extension (Gareth Hughes)
+ Bug fixes:
+ - added RENDER_START/RENDER_FINISH macros for glCopyTexImage in DRI
+ - various state-update code changes needed for DRI bugs
+ - disabled pixel transfer ops in glColorTable commands, not needed
+ - fixed bugs in glCopyConvolutionFilter1D/2D, glGetConvolutionFilter
+ - updated sources and fixed compile problems in widgets-mesa/
+ - GLX_PBUFFER enum value was wrong in glx.h
+ - fixed a glColorMaterial lighting bug
+ - fixed bad args to Read/WriteStencilSpan in h/w stencil clear function
+ - glXCopySubBufferMESA() Y position was off by one
+ - Error checking of glTexSubImage3D() was broken (bug 128775)
+ - glPopAttrib() didn't restore all derived Mesa state correctly
+ - Better glReadPixels accuracy for 16bpp color - fixes lots of OpenGL
+ conformance problems at 16bpp.
+ - clearing depth buffer with scissoring was broken, would segfault
+ - OSMesaGetDepthBuffer() returned bad bytesPerValue value
+ - fixed a line clipping bug (reported by Craig McDaniel)
+ - fixed RGB color over/underflow bug for very tiny triangles
+ Known problems:
+ - NURBS or evaluator surfaces inside display lists don't always work
+
+
+3.4.2 May 17, 2001
+ Bug fixes:
+ - deleting the currently bound texture could cause bad problems
+ - using fog could result in random vertex alpha values
+ - AA triangle rendering could touch pixels outside right window bound
+ - fixed byteswapping problem in clear_32bit_ximage() function
+ - fixed bugs in wglUseFontBitmapsA(), by Frank Warmerdam
+ - fixed memory leak in glXUseXFont()
+ - fragment sampling in AA triangle function was off by 1/2 pixel
+ - Windows: reading pixels from framebuffer didn't always work
+ - glConvolutionFilter2D could segfault or cause FP exception
+ - fixed segfaults in FX and X drivers when using tex unit 1 but not 0
+ - GL_NAND logicop didn't work right in RGBA mode
+ - fixed a memory corruption bug in vertex buffer reset code
+ - clearing the softwara alpha buffer with scissoring was broken
+ - fixed a few color index mode fog bugs
+ - fixed some bad assertions in color index mode
+ - fixed FX line 'stipple' bug #420091
+ - fixed stencil buffer clear width/height typo
+ - fixed GL error glitches in gl[Client]ActiveTextureARB()
+ - fixed Windows compilation problem in texutil.c
+ - fixed 1/8-pixel AA triangle sampling error
+ Changes:
+ - optimized writing mono-colored pixel spans to X pixmaps
+ - increased max viewport size to 2048 x 2048
+
+
+3.5 June 21, 2001
+ New:
+ - internals of Mesa divided into modular pieces (Keith Whitwell)
+ - 100% OpenGL 1.2 conformance (passes all conformance tests)
+ - new AA line algorithm
+ - GL_EXT_convolution extension
+ - GL_ARB_imaging subset
+ - OSMesaCreateContextExt() function
+ - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add)
+ - GL_MAX_TEXTURE_UNITS_ARB now defaults to eight
+ - GL_EXT_fog_coord extension (Keith Whitwell)
+ - GL_EXT_secondary_color extension (Keith Whitwell)
+ - GL_ARB_texture_env_add extension (same as GL_EXT_texture_env_add)
+ - GL_SGIX_depth_texture extension
+ - GL_SGIX_shadow and GL_SGIX_shadow_ambient extensions
+ - demos/shadowtex.c demo of GL_SGIX_depth_texture and GL_SGIX_shadow
+ - GL_ARB_texture_env_combine extension
+ - GL_ARB_texture_env_dot3 extension
+ - GL_ARB_texture_border_clamp (aka GL_SGIS_texture_border_clamp)
+ - OSMesaCreateContextExt() function
+ - libOSMesa.so library, contains the OSMesa driver interface
+ - GL/glxext.h header file for GLX extensions
+ - somewhat faster software texturing, fogging, depth testing
+ - all color-index conformance tests now pass (only 8bpp tested)
+ - SPARC assembly language TCL optimizations (David Miller)
+ - GL_SGIS_generate_mipmap extension
+ Bug Fixes:
+ - fbiRev and tmuRev were unitialized when using Glide3
+ - fixed a few color index mode conformance failures; all pass now
+ - now appling antialiasing coverage to alpha after texturing
+ - colors weren't getting clamped to [0,1] before color table lookup
+ - fixed RISC alignment errors caused by COPY_4UBV macro
+ - drawing wide, flat-shaded lines could cause a segfault
+ - vertices now snapped to 1/16 pixel to fix rendering of tiny triangles
+ Changes:
+ - SGI's Sample Implementation (SI) 1.3 GLU library replaces Mesa GLU
+ - new libOSMesa.so library, contains the OSMesa driver interface
+
+
+4.0 October 22, 2001
+ New:
+ - Mesa 4.0 implements the OpenGL 1.3 specification
+ - GL_IBM_rasterpos_clip extension
+ - GL_EXT_texture_edge_clamp extension (aka GL_SGIS_texture_edge_clamp)
+ - GL_ARB_texture_mirrored_repeat extension
+ - WindML UGL driver (Stephane Raimbault)
+ - added OSMESA_MAX_WIDTH/HEIGHT queries
+ - attempted compiliation fixes for Solaris 5, 7 and 8
+ - updated glext.h and glxext.h files
+ - updated Windows driver (Karl Schultz)
+ Bug fixes:
+ - added some missing GLX 1.3 tokens to include/GL/glx.h
+ - GL_COLOR_MATRIX changes weren't recognized by teximage functions
+ - glCopyPixels with scale and bias was broken
+ - glRasterPos with lighting could segfault
+ - glDeleteTextures could leave a dangling pointer
+ - Proxy textures for cube maps didn't work
+ - fixed a number of 16-bit color channel bugs
+ - fixed a few minor memory leaks
+ - GLX context sharing was broken in 3.5
+ - fixed state-update bugs in glPopClientAttrib()
+ - fixed glDrawRangeElements() bug
+ - fixed a glPush/PopAttrib() bug related to texture binding
+ - flat-shaded, textured lines were broken
+ - fixed a dangling pointer problem in the XMesa code (Chris Burghart)
+ - lighting didn't always produce the correct alpha value
+ - fixed 3DNow! code to not read past end of arrays (Andrew Lewycky)
+
+
+4.0.1 December 17, 2001
+ New:
+ - better sub-pixel sample positions for AA triangles (Ray Tice)
+ - slightly faster blending for (GL_ZERO, GL_ONE) and (GL_ONE, GL_ZERO)
+ Bug fixes:
+ - added missing break statements in glGet*() for multisample cases
+ - fixed uninitialized hash table mutex bug (display lists / texobjs)
+ - fixed bad teximage error check conditional (bug 476846)
+ - fixed demos readtex.c compilation problem on Windows (Karl Schultz)
+ - added missing glGet() query for GL_MAX_TEXTURE_LOD_BIAS_EXT
+ - silence some compiler warnings (gcc 2.96)
+ - enable the #define GL_VERSION_1_3 in GL/gl.h
+ - added GL 1.3 and GLX 1.4 entries to gl_mangle.h and glx_mangle.h
+ - fixed glu.h typedef problem found with MSDev 6.0
+ - build libGL.so with -Bsymbolic (fixes bug found with Chromium)
+ - added missing 'const' to glXGetContextIDEXT() in glxext.h
+ - fixed a few glXGetProcAddress() errors (texture compression, etc)
+ - fixed start index bug in compiled vertex arrays (Keith)
+ - fixed compilation problems in src/SPARC/glapi_sparc.S
+ - fixed triangle strip "parity" bug found in VTK medical1 demo (Keith)
+ - use glXGetProcAddressARB in GLUT to avoid extension linking problems
+ - provoking vertex of flat-shaded, color-index triangles was wrong
+ - fixed a few display list bugs (GLUT walker, molecule, etc) (Keith)
+ - glTexParameter didn't flush the vertex buffer (Ray Tice)
+ - feedback attributes for glDraw/CopyPixels and glBitmap were wrong
+ - fixed bug in normal length caching (ParaView lighting bug)
+ - fixed separate_specular color bug found in Chimera (18 Dec 2001)
+
+
+4.0.2 April 2, 2002
+ New:
+ - New DOS (DJGPP) driver written by Daniel Borca
+ - New driver interface functions for TCL drivers (such as Radeon DRI)
+ - GL_RENDERER string returns "Mesa Offscreen16" or "Mesa Offscreen32"
+ if using deep color channels
+ - latest GL/glext.h and GL/glxext.h headers from SGI
+ Bug fixes:
+ - GL_BLEND with non-black texture env color wasn't always correct
+ - GL_REPLACE with GL_RGB texture format wasn't always correct (alpha)
+ - glTexEnviv( pname != GL_TEXTURE_ENV_COLOR ) was broken
+ - glReadPixels was sometimes mistakenly clipped by the scissor box
+ - glDraw/ReadPixels didn't catch all the errors that they should have
+ - Fixed 24bpp rendering problem in Windows driver (Karl Schultz)
+ - 16-bit GLchan mode fixes (m_trans_tmp.h, s_triangle.c)
+ - Fixed 1-bit float->int conversion bug in glDrawPixels(GL_DEPTH_COMP)
+ - glColorMask as sometimes effecting glXSwapBuffers()
+ - fixed a potential bug in XMesaGarbageCollect()
+ - N threads rendering into one window didn't work reliably
+ - glCopyPixels didn't work for deep color channels
+ - improved 8 -> 16bit/channel texture image conversion (Gerk Huisma)
+ - glPopAttrib() didn't correctly restore user clip planes
+ - user clip planes failed for some perspective projections (Chromium)
+ Known bugs:
+ - mipmap LOD computation
+
+
+4.0.3 June 25, 2002
+ New:
+ - updated GL/glext.h file (version 15)
+ - corrected MMX blend code (Jose Fonseca)
+ - support for software-based alpha planes in Windows driver
+ - updated GGI driver (Filip Spacek)
+ Bug fixes:
+ - glext.h had wrong values for GL_DOT3_RGB[A]_EXT tokens
+ - OSMesaMakeCurrent() didn't recognize buffer size changes
+ - assorted conformance fixes for 16-bit/channel rendering
+ - texcombine alpha subtraction mode was broken
+ - fixed lighting bug with non-uniform scaling and display lists
+ - fixed bug when deleting shared display lists
+ - disabled SPARC cliptest assembly code (Mesa bug 544665)
+ - fixed a couple Solaris compilation/link problems
+ - blending clipped glDrawPixels didn't always work
+ - glGetTexImage() didn't accept packed pixel types
+ - glPixelMapu[is]v() could explode given too large of pixelmap
+ - glGetTexParameter[if]v() didn't accept GL_TEXTURE_MAX_ANISOTROPY_EXT
+ - glXCopyContext() could lead to segfaults
+ - glCullFace(GL_FRONT_AND_BACK) didn't work (bug 572665)
+ Changes:
+ - lots of C++ (g++) code clean-ups
+ - lots of T&L updates for the Radeon DRI driver
+ Known bugs:
+ - mipmap LOD computation (fixed for Mesa 4.1)
+
+
+4.0.4 October 3, 2002
+ New:
+ - GL_NV_texture_rectangle extension
+ - updated glext.h header (version 17)
+ - updated DOS driver (Daniel Borca)
+ - updated BeOS R5 driver (Philippe Houdoin)
+ - added GL_IBM_texture_mirror_repeat
+ - glxinfo now takes -l option to print interesting OpenGL limits info
+ - GL_MESA_ycbcr_texture extension
+ - GL_APPLE_client_storage extension (for some DRI drivers only)
+ - GL_MESA_pack_invert extension
+ Bug fixes:
+ - fixed GL_LINEAR fog bug by adding clamping
+ - fixed FP exceptions found using Alpha CPU
+ - 3dfx MESA_GLX_FX=window (render to window) didn't work
+ - fixed memory leak in wglCreateContest (Karl Schultz)
+ - define GLAPIENTRY and GLAPI if undefined in glu.h
+ - wglGetProcAddress didn't handle all API functions
+ - when testing for OpenGL 1.2 vs 1.3, check for GL_ARB_texture_cube_map
+ - removed GL_MAX_CONVOLUTION_WIDTH/HEIGHT from glGetInteger/Float/etc()
+ - error checking in compressed tex image functions had some glitches
+ - fixed AIX compile problem in src/config.c
+ - glGetTexImage was using pixel unpacking instead of packing params
+ - auto-mipmap generation for cube maps was incorrect
+ Changes:
+ - max texture units reduced to six to accomodate texture rectangles
+ - removed unfinished GL_MESA_sprite_point extension code
+
+
+4.1 October 29, 2002
+ New:
+ - GL_NV_vertex_program extension
+ - GL_NV_vertex_program1_1 extension
+ - GL_ARB_window_pos extension
+ - GL_ARB_depth_texture extension
+ - GL_ARB_shadow extension
+ - GL_ARB_shadow_ambient extension
+ - GL_EXT_shadow_funcs extension
+ - GL_ARB_point_parameters extension
+ - GL_ARB_texture_env_crossbar
+ - GL_NV_point_sprite extension
+ - GL_NV_texture_rectangle extension
+ - GL_EXT_multi_draw_arrays extension
+ - GL_EXT_stencil_two_side extension
+ - GLX_SGIX_fbconfig and GLX_SGIX_pbuffer extensions
+ - GL_ATI_texture_mirror_once extension (Ian Romanick)
+ - massive overhaul/simplification of software rasterizer module,
+ many contributions from Klaus Niederkrueger
+ - faster software texturing in some cases (i.e. trilinear filtering)
+ - new OSMesaGetProcAddress() function
+ - more blend modes implemented with MMX code (Jose Fonseca)
+ - added glutGetProcAddress() to GLUT
+ - added GLUT_FPS env var to compute frames/second in glutSwapBuffers()
+ - pbinfo and pbdemo PBuffer programs
+ - glxinfo -v prints transprent pixel info (Gerd Sussner)
+ Bug fixes:
+ - better mipmap LOD computation (prevents excessive blurriness)
+ - OSMesaMakeCurrent() didn't recognize buffer size changes
+ - assorted conformance fixes for 16-bit/channel rendering
+ - texcombine alpha subtraction mode was broken
+ - fixed some blend problems when GLchan==GLfloat (Gerk Huisma)
+ - clamp colors to [0,inf] in OSMesa if GLchan==GLfloat (Gerk Huisma)
+ - fixed divide by zero error in NURBS tessellator (Jon Perry)
+ - fixed GL_LINEAR fog bug by adding clamping
+ - fixed FP exceptions found using Alpha CPU
+ - 3dfx/glide driver render-to-window feature was broken
+ - added missing GLX_TRANSPARENT_RGB token to glx.h
+ - fixed error checking related to paletted textures
+ - fixed reference count error in glDeleteTextures (Randy Fayan)
+ Changes:
+ - New spec file and Python code to generate some GL dispatch files
+ - Glide driver defaults to "no" with autoconf/automake
+ - updated demos/stex3d with new options
+
+
+5.0 November 13, 2002
+ New:
+ - OpenGL 1.4 support (glGetString(GL_VERSION) returns "1.4")
+ - removed some overlooked debugging code
+ - glxinfo updated to support GLX_ARB_multisample
+ - GLUT now support GLX_ARB_multisample
+ - updated DOS driver (Daniel Borca)
+ Bug fixes:
+ - GL_POINT and GL_LINE-mode polygons didn't obey cull state
+ - fixed potential bug in _mesa_align_malloc/calloc()
+ - fixed missing triangle bug when running vertex programs
+ - fixed a few HPUX compilation problems
+ - FX (Glide) driver didn't compile
+ - setting GL_TEXTURE_BORDER_COLOR with glTexParameteriv() didn't work
+ - a few EXT functions, like glGenTexturesEXT, were no-ops
+ - a few OpenGL 1.4 functions like glFogCoord*, glBlendFuncSeparate,
+ glMultiDrawArrays and glMultiDrawElements were missing
+ - glGet*(GL_ACTIVE_STENCIL_FACE_EXT) was broken
+ - Pentium 4 Mobile was mistakenly identified as having 3DNow!
+ - fixed one-bit error in point/line fragment Z calculation
+ - fixed potential segfault in fakeglx code
+ - fixed color overflow problem in DOT3 texture env mode
+
+
+5.0.1 March 30, 2003
+ New:
+ - DOS driver updates from Daniel Borca
+ - updated GL/gl_mangle.h file (Bill Hoffman)
+ Bug fixes:
+ - auto mipmap generation for cube maps was broken (bug 641363)
+ - writing/clearing software alpha channels was unreliable
+ - minor compilation fixes for OS/2 (Evgeny Kotsuba)
+ - fixed some bad assertions found with shadowtex demo
+ - fixed error checking bug in glCopyTexSubImage2D (bug 659020)
+ - glRotate(angle, -x, 0, 0) was incorrect (bug 659677)
+ - fixed potential segfault in texture object validation (bug 659012)
+ - fixed some bogus code in _mesa_test_os_sse_exception_support (Linus)
+ - fix fog stride bug in tnl code for h/w drivers (Michel Danzer)
+ - fixed glActiveTexture / glMatrixMode(GL_TEXTURE) bug (#669080)
+ - glGet(GL_CURRENT_SECONDARY_COLOR) should return 4 values, not 3
+ - fixed compilation problem on Solaris7/x86 (bug 536406)
+ - fixed prefetch bug in 3DNow! code (Felix Kuhling)
+ - fixed NeXT build problem (FABSF macro)
+ - glDrawPixels Z values when glPixelZoom!=1 were invalid (bug 687811)
+ - zoomed glDraw/CopyPixels with clipping sometimes failed (bug 689964)
+ - AA line and triangle Z values are now rounded, not truncated
+ - fixed color interpolation bug when GLchan==GLfloat (bug 694461)
+ - glArePrograms/TexturesResident() wasn't 100% correct (Jose Fonseca)
+ - fixed a minor GL_COLOR_MATERIAL bug
+ - NV vertex program EXP instruction was broken
+ - glColorMask misbehaved with X window / pixmap rendering
+ - fix autoconf/libtool GLU C++ linker problem on Linux (a total hack)
+ - attempt to fix GGI compilation problem when MesaDemos not present
+ - NV vertex program ARL-relative fetches didn't work
+ Changes:
+ - use glPolygonOffset in gloss demo to avoid z-fighting artifacts
+ - updated winpos and pointblast demos to use ARB extensions
+ - disable SPARC normal transformation code (bug 673938)
+ - GLU fixes for OS/2 (Evgeny Kotsuba)
+
+
+5.0.2 September 5, 2003
+ Bug fixes:
+ - fixed texgen problem causing texcoord's Q to be zero (stex3d)
+ - default GL_TEXTURE_COMPARE_MODE_ARB was wrong
+ - GL_CURRENT_MATRIX_NV query was wrong
+ - GL_CURRENT_MATRIX_STACK_DEPTH_NV query was off by one
+ - GL_LIST_MODE query wasn't correct
+ - GL_FOG_COORDINATE_SOURCE_EXT query wasn't supported
+ - GL_SECONDARY_COLOR_ARRAY_SIZE_EXT query returned wrong value
+ - blended, wide lines didn't always work correctly (bug 711595)
+ - glVertexAttrib4svNV w component was always 1
+ - fixed bug in GL_IBM_rasterpos_clip (missing return)
+ - GL_DEPTH_TEXTURE_MODE = GL_ALPHA didn't work correctly
+ - a few Solaris compilation fixes
+ - fixed glClear() problem for DRI drivers (non-existant stencil, etc)
+ - fixed int/REAL mixup in GLU NURBS curve evaluator (Eric Cazeaux)
+ - fixed delete [] bug in SI GLU (bug 721765) (Diego Santa Cruz)
+ - glFog() didn't clamp fog colors
+ - fixed bad float/int conversion for GL_TEXTURE_PRIORITY in the
+ gl[Get]TexParameteri[v] functions
+ - fixed invalid memory references in glTexGen functions (bug 781602)
+ - integer-valued color arrays weren't handled correctly
+ - glDrawPixels(GL_DEPTH_COMPONENT) with glPixelZoom didn't work
+ - GL_EXT_texture_lod_bias is part of 1.4, overlooked in 5.0.1
+ Changes:
+ - build GLUT with -fexceptions so C++ apps propogate exceptions
+
+
+5.1 December 17, 2003
+ New:
+ - reorganized directory tree
+ - GL_ARB_vertex/fragment_program extensions (Michal Krol & Karl Rasche)
+ - GL_ATI_texture_env_combine3 extension (Ian Romanick)
+ - GL_SGI_texture_color_table extension (Eric Plante)
+ - GL_NV_fragment_program extension
+ - GL_NV_light_max_exponent extension
+ - GL_EXT_texture_rectangle (identical to GL_NV_texture_rectangle)
+ - GL_ARB_occlusion_query extension
+ - GL_ARB_point_sprite extension
+ - GL_ARB_texture_non_power_of_two extension
+ - GL_IBM_multimode_draw_arrays extension
+ - GL_EXT_texture_mirror_clamp extension (Ian Romanick)
+ - GL_ARB_vertex_buffer_object extension
+ - new X86 feature detection code (Petr Sebor)
+ - less memory used for display lists and vertex buffers
+ - demo of per-pixel lighting with a fragment program (demos/fplight.c)
+ - new version (18) of glext.h header
+ - new spriteblast.c demo of GL_ARB_point_sprite
+ - faster glDrawPixels in X11 driver in some cases (see RELNOTES-5.1)
+ - faster glCopyPixels in X11 driver in some cases (see RELNOTES-5.1)
+ Bug fixes:
+ - really enable OpenGL 1.4 features in DOS driver.
+ - fixed issues in glDrawPixels and glCopyPixels for very wide images
+ - glPixelMapf/ui/usv()'s size parameter is GLsizei, not GLint
+ - fixed some texgen bugs reported by Daniel Borca
+ - fixed wglMakeCurrent(NULL, NULL) bug (#835861)
+ - fixed glTexSubImage3D z-offset bug (Cedric Gautier)
+ - fixed RGBA blend enable bug (Ville Syrjala)
+ - glAccum is supposed to be a no-op in selection/feedback mode
+ - fixed texgen bug #597589 (John Popplewell)
+ Changes:
+ - dropped API trace feature (src/Trace/)
+ - documentation overhaul. merged with website content. more html.
+ - glxgears.c demo updated to use GLX swap rate extensions
+ - glTexImage1/2/3D now allows width/height/depth = 0
+ - disable SPARC asm code on Linux (bug 852204)
+
+
+6.0 January 16, 2004
+ New:
+ - full OpenGL 1.5 support
+ - updated GL/glext.h file to version 21
+ Changes:
+ - changed max framebuffer size to 4Kx4K (MAX_WIDTH/HEIGHT in config.h)
+ Bug fixes:
+ - fixed bug in UNCLAMPED_FLOAT_TO_UBYTE macro; solves a color
+ clamping issue
+ - updated suno5-gcc configs
+ - glColor3 functions sometimes resulted in undefined alpha values
+ - fixed FP divide by zero error seen on VMS with xlockmore, others
+ - fixed vertex/fragment program debug problem (bug 873011)
+ - building on AIX with gcc works now
+ - glDeleteProgramsARB failed for ARB fragment programs (bug 876160)
+ - glDrawRangeElements tried to modify potentially read-only storage
+ - updated files for building on Windows
+
+
+6.0.1 April 2, 2004
+ New:
+ - upgraded glext.h to version 22
+ - new build targets (Dan Schikore)
+ - new linux-x86-opteron build target (Heath Feather)
+ Bug fixes:
+ - glBindProgramARB didn't update all necessary state
+ - fixed build problems on OpenBSD
+ - omit CVS directories from tarballs
+ - glGetTexImage(GL_COLOR_INDEX) was broken
+ - fixed an infinite loop in t&l module
+ - silenced some valgrind warnings about using unitialized memory
+ - fixed some compilation/link glitches on IRIX (Mike Stephens)
+ - glBindProgram wasn't getting compiled into display lists
+ - GLX_FBCONFIG_ID wasn't recognized in glXChooseFBConfig() (bug 888079)
+ - two-sided lighting and vertex program didn't work (bug 887330)
+ - stores to program parameter registers in vertex state programs
+ didn't work.
+ - fixed glOrtho bug found with gcc 3.2.2 (RH9)
+ - glXCreateWindow() wasn't fully implemented (bug 890894)
+ - generic vertex attribute arrays didn't work in display lists
+ - vertex buffer objects' default usage and access fields were wrong
+ - glDrawArrays with start!=0 was broken
+ - fragment program PK2H, UP2H, UP4B and UP4UB instructions were broken
+ - linux-osmesa16-static config didn't work
+ - fixed a few color index rendering problems (bug 910687)
+ - glInterleavedArrays didn't respect GL_CLIENT_ACTIVE_TEXTURE
+ - OSMesa RGB and BGR modes were broken
+ - glProgramStringARB mistakenly required a null-terminated string
+ - fragment program XPD instruction was incorrect
+ - glGetMaterial() didn't work reliably
+ - ARB_fragment_program KIL instruction was incorrect
+
+
+6.1 August 18, 2004
+ New:
+ - Revamped Makefile system
+ - glXUseRotatedXFont() utility (see xdemos/xuserotfont.c)
+ - internal driver interface changes related to texture object
+ allocation, vertex/fragment programs, BlendEquationSeparate, etc.
+ - option to walk triangle edges with double-precision floats
+ (Justin Novosad of Discreet) (see config.h file)
+ - support for AUX buffers in software GLX driver
+ - updated glext.h to version 24 and glxext.h to version 6
+ - new MESA_GLX_FORCE_ALPHA and MESA_GLX_DEPTH_BITS env vars
+ - updated BeOS support (Philippe Houdoin)
+ Changes:
+ - fragment fog interpolation is perspective corrected now
+ - new glTexImage code, much cleaner, may be a bit faster
+ Bug fixes:
+ - glArrayElement in display lists didn't handle generic vertex attribs
+ - glFogCoord didn't always work properly
+ - ARB_fragment_program fog options didn't work
+ - frag prog TEX instruction no longer incorrectly divides s,t,r by q
+ - ARB frag prog TEX and TEXP instructions now use LOD=0
+ - glTexEnviv in display lists didn't work
+ - glRasterPos didn't do texgen or apply texture matrix
+ - GL_DOUBLE-valued vertex arrays were broken in some cases
+ - fixed texture rectangle edge/border sampling bugs
+ - sampling an incomplete texture in a fragment program would segfault
+ - glTexImage was missing a few error checks
+ - fixed some minor glGetTexParameter glitches
+ - GL_INTENSITY was mistakenly accepted as a to glTexImage
+ - fragment program writes to RC/HC register were broken
+ - fixed a few glitches in GL_HP_occlusion_test extension
+ - glBeginQueryARB and glEndQueryARB didn't work inside display lists
+ - vertex program state references were broken
+ - fixed triangle color interpolation bug on AIX (Shane Blackett)
+ - fixed a number of minor memory leaks (bug #1002030)
+
+
+6.2 October 2, 2004
+ New:
+ - enabled GL_ARB_texture_rectangle (same as GL_NV_texture_rectangle)
+ - updated Doxygen support (Jose Fonseca)
+ Changes:
+ - some GGI driver updates (Christoph Egger, bug 1025977)
+ Bug fixes:
+ - Omit GL_ARB_texture_non_power_of_two from list of OpenGL 1.5 features
+ - fixed a few compilation issues on IRIX
+ - fixed a matrix classification bug (reported by Wes Bethel)
+ - we weren't reseting the vertex/fragment program error state
+ before parsing (Dave Reveman)
+ - adjust texcoords for sampling texture rectangles (Dave Reveman)
+ - glGet*(GL_MAX_VERTEX_ATTRIBS_ARB) wasn't implemented
+ - repeated calls to glDeleteTexture(t) could lead to a crash
+ - fixed potential ref count bugs in VBOs and vertex/fragment programs
+ - spriteblast demo didn't handle window size changes correctly
+ - glTexSubImage didn't handle pixels=NULL correctly for PBOs
+ - fixed color index mode glDrawPixels bug (Karl Schultz)
+
+
+6.2.1 December 9, 2004
+ Bug fixes:
+ - don't apply regular fog or color sum when using a fragment program
+ - glProgramEnvParameter4fARB always generated an error on
+ GL_FRAGMENT_PROGRAM_ARB (fdo bug 1645)
+ - glVertexAttrib3svNV and glVertexAttrib3svARB were broken
+ - fixed width/height mix-up in glSeparableFilter2D()
+ - fixed regression in glCopyPixels + convolution
+ - glReadPixels from a clipped front color buffer didn't always work
+ - glTexImage didn't accept GL_RED/GREEN/BLUE as the format
+ - Attempting queries/accesses of VBO 0 weren't detected as errors
+ - paletted textures failed if the palette had fewer than 256 entries
+ Changes:
+ - fixed a bunch of compiler warnings found with gcc 3.4
+ - bug reports should to go bugzilla.freedesktop.org
+
+
+6.3 July 20, 2005
+ New:
+ - GL_EXT_framebuffer_object extension
+ - GL_ARB_draw_buffers extension
+ - GL_ARB_pixel_buffer_object extension
+ - GL_OES_read_format extension (Ian Romanick)
+ - DirectFB driver (Claudio Ciccani)
+ - x86_64 vertex transformation code (Mikko T.)
+ - Updated GL/glext.h to version 29
+ Changes:
+ - added -stereo option for glxgears demo (Jacek Rosik)
+ - updated the PBuffer demo code in xdemos/ directory
+ - glDeleteTextures/Programs/Buffers() now makes the object ID
+ available for immediate re-use
+ - assorted 64-bit clean-ups fixes (x86_64 and Win64)
+ - lots of internal changes for GL_EXT_framebuffer_object
+ Bug fixes:
+ - some functions didn't support PBO functionality
+ - glGetTexImage didn't convert color index images to RGBA as required
+ - fragment program texcoords were sometimes wrong for points and lines
+ - fixed problem with negative dot product in arbfplight, fplight demos
+ - fixed bug in perspective correction of antialiased, textured lines
+ - querying GL_POST_CONVOLUTION_ALPHA_BIAS_EXT returned wrong value
+ - fixed a couple per-pixel fog bugs (Soju Matsumoto)
+ - glGetBooleanv(GL_FRAGMENT_PROGRAM_BINDING_NV) was broken
+ - fixed float parsing bug in ARB frag/vert programs (bug 2520)
+ - XMesaGetDepthBuffer() returned incorrect value for bytesPerValue
+ - GL_COLOR_MATERIAL with glColor3 didn't properly set diffuse alpha
+ - glXChooseFBConfig() crashed if attribList pointer was NULL
+ - program state.light[n].spot.direction.w was wrong value (bug 3083)
+ - fragment program fog option required glEnable(GL_FOG) - wrong.
+ - glColorTable() could produce a Mesa implementation error (bug 3135)
+ - RasterPos could get corrupted by color index rendering path
+ - Removed bad XTranslateCoordinates call when rendering to Pixmaps
+ - glPopAttrib() didn't properly restore GL_TEXTURE_GEN enable state
+ - fixed a few Darwin compilation problems
+
+
+6.3.1
+ This was an intermediate release for X.org which wasn't otherwise released.
+
+
+6.3.2 August 19, 2005
+ New:
+ - The distribution now includes the DRI drivers and GLX code
+ Changes:
+ - Made the DRI "new" driver interface standard, remove old code
+ Bug fixes:
+ - GL_ARB_vertex/fragment_shader were mistakenly listed in the
+ extensions string
+ - negative relative addressing in vertex programs was broken
+ - update/fix SPARC assembly code for vertex transformation
+ - fixed memory leak when freeing GLX drawables/renderbuffers
+ - fixed display list memory leak
+ - the GL_PIXEL_MAP_I_TO_I table is now floating point, not integer
+ - wglGetProcAddress() didn't handle wgl-functions
+ - fixed glxext.h cross-compile issue (Colin Harrison)
+ - assorted DRI driver fixes
+
+
+6.4 October 24, 2005
+ New:
+ - Added a fast XOR line drawing function in Xlib driver
+ - Added support for GL_ARB_texture_mirrored_repeat to savage
+ driver (supported only on Savage4 hardware).
+ Changes:
+ - Mesa now packaged in three parts: Library, Demos and GLUT
+ Bug fixes:
+ - GLX_X_RENDERABLE token wasn't accepted by glXChooseFBConfig
+ - Some files were present multiple times in the 6.3.2 tarballs
+ - r200_vtxtmp_x86.S file was missing from 6.3.2 tarball (bug 4207)
+ - glxgears_fbconfig demo didn't work (bug 4237)
+ - fixed bug when bilinear sampling 2d textures with borders
+ - glXCreatePbuffer() could segfault instead of returning 0 (bug 4235)
+ - fixed undefined frexp and rand in X.org libGLcore.a (bug 4242)
+ - fixed a few problems with proxy color tables (bug 4270)
+ - fixed precision problem in Z clearing (bug 4395)
+ - glBitmap, glDraw/CopyPixels mistakenly generated selection hits
+ - fixed potential segfault caused by reading pixels outside
+ of renderbuffer bounds
+ - glGetTexLevelParameter didn't accept GL_TEXTURE_DEPTH_SIZE_ARB
+ - fixed memory corruption bug involving software alpha buffers
+ - glReadPixels clipped by window bounds was sometimes broken
+ - glDraw/CopyPixels of stencil data ignored the stencil write mask
+ - glReadPixels from a texture bound to a framebuffer object didn't work
+ - glIsRender/FramebufferEXT weren't totally correct
+ - fixed a number of point size attenuation/fade bugs
+ - fixed glFogCoord bug 4729
+ - GLX encoding for transpose matrix functions was broken
+ - fixed broken fragment program KIL and SWZ instructions
+ - fragment programs that wrote result.depth.z didn't work
+
+
+6.4.1 November 30, 2005
+ Bug fixes:
+ - redefining a vertex program string didn't take effect in TNL module
+ - fixed occasional segfault upon vertex/fragment parsing error
+ - vertex program LIT instruction didn't handle 0^0=1 correctly
+ - fragment program fog option didn't work with glDrawPixels, glBitmap
+ - USE_MGL_NAMESPACE didn't work for x86-64
+ - OSMesa demos were missing from previous release tarballs
+ - fixed problem with float->ushort conversion in glClear (bug 4992)
+ - popping of GL_EYE_PLANE texgen state was broken (bug 4996)
+ - popping of GL_SPOT_DIRECTION light state was broken (bug 5005)
+ - fixed occasional triangle color interpolation problem on VMS
+ - work around invalid free() call (bug 5131)
+ - fixed BSD X server compilation problem by including stdint.h
+
+
+6.4.2 February 2, 2006
+ New:
+ - added OSMesaColorClamp() function/feature
+ - added wglGetExtensionStringARB() function
+ Bug fixes:
+ - fixed some problems when building on Windows
+ - GLw header files weren't installed by installmesa script (bug 5396)
+ - GL/glfbdev.h file was missing from tarballs
+ - fixed TNL initialization bug which could lead to crash (bug 5791)
+
+
+6.5 March 31, 2006
+ New:
+ - OpenGL Shading Language support through GL_ARB_shader_objects,
+ GL_ARB_shading_language_100, GL_ARB_vertex_shader and
+ GL_ARB_fragment_shader (done by Michal Krol)
+ - GL_EXT_packed_depth_stencil extension
+ - GL_EXT_timer_query extension
+ - GL_EXT_framebuffer_blit extension
+ - GL_ARB_half_float_pixel
+ - reflect demo improved to support multiple windows
+ - singlebuffer demo (shows no/little-flicker single-buffered rendering)
+ - r200: enable GL_ARB_texture_env_crossbar, separate the texture
+ sampling unit bits from the texture env combine enable bits
+ - r200: add support for GL_ATI_fragment_shader
+ - added fast XOR-mode line drawing optimization
+ - radeon: add support for all 3 tmus, GL_ARB_texture_cube_map
+ and GL_EXT_fog_coord
+ - MESA_GLX_ALPHA_BITS env var for xlib driver
+ - many DRI driver updates (including screen rotation support
+ for the Intel DRI driver)
+ Changes:
+ - removed GL_HP_occlusion_test (use GL_ARB_occlusion_query instead)
+ - removed GL_SGIX/SGIS_pixel_texture extensions
+ Bug fixes:
+ - fixed glxcontextmodes.c datatype problem (bug 5835)
+ - fixed aix-gcc build/install bugs (bug 5874)
+ - fixed some bugs in texture env program generation
+ - glXCopyContext() didn't handle texture object bindings properly
+ - glXCopyContext() didn't copy all lighting state
+ - fixed FreeBSD config (Pedro Giffuni)
+ - fixed some minor framebuffer object bugs
+ - replaced dprintf() with _glu_printf() in GLU (bug 6244)
+ - fixed a number of thread safety bugs/regressions
+ - fixed a number of GLU tesselator bugs (John Shell, bug 6339)
+ - paletted texturing was broken w/ floating point palettes (K. Schultz)
+ - lots of assorted framebuffer object bug fixes
+
+6.5.1 August 31, 2006
+ New:
+ - Intel i965 DRI driver
+ - GL_APPLE_vertex_array_object extension (Ian Romanick)
+ - GL_EXT_texture_sRGB extension
+ - GL_EXT_gpu_program_parameters (Ian Romanick)
+ - "engine" demo
+ - updated fbdev driver and GLUT for fbdev (Sean D'Epagnier)
+ - many updates to the DRI drivers
+ Changes:
+ - The glVertexAttribARB functions no longer alias the conventional
+ vertex attributes.
+ - glxinfo program prints more info with -l option
+ - GL_FRAGMENT_PROGRAM_NV and GL_FRAGMENT_PROGRAM_ARB are now
+ compatible, in terms of glBindProgramARB()
+ Bug fixes:
+ - fixed broken texture border handling for depth textures (bug 6498)
+ - removed the test for duplicated framebuffer attachments, per
+ version 117 of the GL_EXT_framebuffer_object specification
+ - fixed a few render-to-texture bugs, including render to depth texture
+ - clipping of lines against user-defined clip planes was broken (6512)
+ - assembly language dispatch for SPARC was broken (bug 6484)
+ - assorted compilation fixes on various Unix platforms (Dan Schikore)
+ - glPopAttrib could restore an invalid value for GL_DRAW_BUFFER
+ - assorted minor fixes for 16 and 32 bit/channel modes
+ - fixed assorted bugs in texture compression paths
+ - fixed indirect rendering vertex array crashes (bug 6863)
+ - glDrawPixels GL_INDEX_OFFSET didn't always work
+ - fixed convolution memory leak (bug 7077)
+ - rectangular depth textures didn't work
+ - invalid mode to glBegin didn't generate an error (bug 7142)
+ - 'normalized' parameter to glVertexAttribPointerARB didn't work
+ - disable bogus GLX_SGI_video_sync extension in xlib driver
+ - fixed R128 driver locking bug (Martijn van Oosterhout)
+ - using evaluators with vertex programs caused crashes (bug 7564)
+ - fragment.position wasn't set correctly for point/line primitives
+ - fixed parser bug for scalar sources for GL_NV_fragment_program
+ - max fragment program length was incorrectly 128, now 1024
+ - writes to result.depth in fragment programs weren't clamped to [0,1]
+ - fixed potential dangling pointer bug in glBindProgram()
+ - fixed some memory leaks (and potential crashes) in Xlib driver
--- mesa-7.0.3.orig/docs/relnotes.html
+++ mesa-7.0.3/docs/relnotes.html
@@ -20,6 +20,7 @@
+7.0.4 release notes
7.0.3 release notes
7.0.2 release notes
7.0.1 release notes
--- mesa-7.0.3.orig/docs/drivers.html
+++ mesa-7.0.3/docs/drivers.html
@@ -0,0 +1,221 @@
+
+
+Writing Mesa Device Drivers
+
+
+
+Writing Mesa Device Drivers
+
+Introduction
+
+
+Several different classes of drivers can be identified:
+
+
+100% Software Driver -
+ a software driver that does not utilize accelerated graphics hardware.
+ Such a driver will basically just write (and read) pixel values to the
+ computer's frame buffer or a malloc'd color buffer.
+ Examples include the X11/XMesa driver, the Windows driver and OSMesa.
+
+
+Hardware Rasterization Driver -
+ for graphics hardware that implements accelerated point/line/triangle
+ rasterization, but relies on core Mesa for vertex transformation.
+ Examples include the DRI 3Dfx, Matrox, and Rage 128 drivers.
+
+
+Hardware Transformation and Rasterization Driver -
+ for graphics hardware that implements accelerated rasterization and vertex
+ transformation.
+ Examples include the DRI Radeon and R200 drivers.
+
+
+
+
+Each class of driver builds on the functionality of the preceeding one.
+For example, a hardware rasterization driver may need to fall back to
+software rasterization when a particular OpenGL state combination is set
+but not supported by the hardware (perhaps smooth, stippled, textured
+triangles).
+
+
+
+Likewise, a hardware transformation driver might need to fall back to
+software-based transformation when a particular, seldom-used lighting
+mode is enabled.
+
+
+
+Getting Started
+
+
+The best way to get started writing a new driver is to find an existing
+driver similar to what you plan to implement, and then study it.
+
+
+It's not feasible for this document to explain every detail of writing
+a driver.
+The minute details can be gleaned by looking at existing drivers.
+This document focuses on the high-level concepts and will perhaps expand
+on the details in the future.
+
+
+For examples of 100% software drivers, the OSMesa and XMesa (fake/stand-alone
+GLX) drivers are the best examples.
+
+
+For examples of hardware drivers, the DRI Radeon and R200 drivers are good
+examples.
+
+
+
+
+Programming API vs. Drivers
+
+
+There are two aspects to a Mesa device driver:
+
+
+
+Public programming API -
+ this is the interface which application programmers use.
+ Examples are the GLX, WGL and OSMesa interfaces.
+ If you're developing a device driver for a new operating system or
+ window system you'll have to design and implement an OpenGL glue
+ interface similar to these.
+ This interface will, in turn, communicate with the internal driver code.
+
+
+Private/internal driver code -
+ this is the code which (effectively) translates OpenGL API calls into
+ rendering operations.
+ The device driver must manage hardware resources, track OpenGL state
+ and implement or dispatch the fundamental rendering operations such as
+ point, line, triangle and image rendering.
+
+
+
+
+The remainder of this document will focus on the later part.
+Furthermore, we'll use the GLX interface for examples.
+
+
+
+In the case of the DRI drivers, the public GLX interface is contained in
+the libGL.so library.
+libGL.so, in turn, dynamically loads one of the DRI drivers (such as
+radeon_dri.so).
+Both libGL.so and the driver modules talk to the X window system via the
+DRI extension.
+Furthermore, the driver modules interface to the graphics hardware with
+the help of a kernel module and the conventional 2D X server driver.
+
+
+
+
+
+Software Driver Overview
+
+
+A software driver is primarily concerned with writing pixel values to the
+system's color buffer (and reading them back).
+The color buffers might be window canvases (typically the front
+color buffer) and/or off-screen image buffers (typically the back color
+buffer).
+The depth, stencil and accumulation buffers will be implemented within
+core Mesa.
+
+
+The software driver must also be concerned with allocation and deallocation
+of rendering contexts, frame buffers and pixel formats (visuals).
+
+
+
+Rendering Contexts
+
+
+The glue interface will always have a function for creating new rendering
+contexts (such as glXCreateContext).
+The device driver must have a function which allocates and initializes
+a device-specific rendering context.
+
+
+
+Frame Buffers
+
+
+The frame buffer can either be a screen region defined by a window
+or the entire screen.
+
+
+In either case, the device driver must implement functions for allocating,
+initializing and managing frame buffers.
+
+
+
+
Spans
+
+
+The fundamental rendering operation is to write (and read)
+spans of pixels to the front / back color buffers.
+A span is a horizontal array of pixel colors with an array of mask
+flags. The span begins at a particular (x,y) screen coordinate,
+extends for N pixels, describes N RGBA colors (or color indexes) and
+has an array of N boolean flags indicating which pixels to write and skip.
+
+
+
Miscellaneous functions
+
+
+Additionally, a software driver will typically have functions for
+binding rendering contexts to frame buffers (via glXMakeCurrent),
+swapping color buffers (via glXSwapBuffers), synchronization
+(via glFlush/glFinish) and queries (via glGetString).
+
+
+Optimizations
+
+
+A software driver might implement optimized routines for drawing lines
+and triangles for common cases (such as smooth shading with depth-testing).
+Then, the span functions can be bypassed for a little extra speed.
+The OSMesa and XMesa drivers have examples of this.
+
+
+
+
+
+
+
+
+Hardware Driver Overview
+
+
+To do...
+
+
+
+
+OOP-Style Inheritance and Specialization
+
+
+Even though Mesa and most device drivers are written in C, object oriented
+programming principles are used in several places.
+
+
+Rendering Contexts
+
+
+Every Mesa device driver will need to define a device-specific rendering
+context structure.
+
+
+
+State Tracking
+
+
+
+
+
+
--- mesa-7.0.3.orig/docs/enums.txt
+++ mesa-7.0.3/docs/enums.txt
@@ -0,0 +1,47 @@
+
+Blocks allocated to Mesa:
+ 0x8750-0x875F
+ 0x8BB0-0x8BBF
+
+
+GL_MESA_packed_depth_stencil
+ GL_DEPTH_STENCIL_MESA 0x8750
+ 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
+
+GL_MESA_trace.spec:
+ GL_TRACE_ALL_BITS_MESA 0xFFFF
+ GL_TRACE_OPERATIONS_BIT_MESA 0x0001
+ GL_TRACE_PRIMITIVES_BIT_MESA 0x0002
+ GL_TRACE_ARRAYS_BIT_MESA 0x0004
+ GL_TRACE_TEXTURES_BIT_MESA 0x0008
+ GL_TRACE_PIXELS_BIT_MESA 0x0010
+ GL_TRACE_ERRORS_BIT_MESA 0x0020
+ GL_TRACE_MASK_MESA 0x8755
+ GL_TRACE_NAME_MESA 0x8756
+
+MESA_ycbcr_texture.spec:
+ GL_YCBCR_MESA 0x8757
+ GL_UNSIGNED_SHORT_8_8_MESA 0x85BA /* same as Apple's */
+ GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB /* same as Apple's */
+
+GL_MESA_pack_invert.spec
+ GL_PACK_INVERT_MESA 0x8758
+
+GL_MESA_shader_debug.spec:
+ GL_DEBUG_OBJECT_MESA 0x8759
+ GL_DEBUG_PRINT_MESA 0x875A
+ GL_DEBUG_ASSERT_MESA 0x875B
+
+GL_MESA_program_debug.spec:
+ GL_FRAGMENT_PROGRAM_CALLBACK_MESA 0x????
+ GL_VERTEX_PROGRAM_CALLBACK_MESA 0x????
+ GL_FRAGMENT_PROGRAM_POSITION_MESA 0x????
+ GL_VERTEX_PROGRAM_POSITION_MESA 0x????
+ GL_FRAGMENT_PROGRAM_CALLBACK_FUNC_MESA 0x????
+ GL_FRAGMENT_PROGRAM_CALLBACK_DATA_MESA 0x????
+ GL_VERTEX_PROGRAM_CALLBACK_FUNC_MESA 0x????
+ GL_VERTEX_PROGRAM_CALLBACK_DATA_MESA 0x????
+
--- mesa-7.0.3.orig/docs/mesa.css
+++ mesa-7.0.3/docs/mesa.css
@@ -0,0 +1,33 @@
+/* Mesa CSS */
+body {
+ background-color: #ffffff;
+ font: 14px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif;
+ color: black;
+ link: #111188;
+}
+
+h1 {
+ font: 24px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif;
+ font-weight: bold;
+ color: black;
+}
+
+h2 {
+ font: 18px 'Lucida Grande', Geneva, Arial, Verdana, sans-serif, bold;
+ font-weight: bold;
+ color: black;
+}
+
+code {
+ font-family: monospace;
+ font-size: 10pt;
+ color: black;
+}
+
+
+pre {
+ /*font-family: monospace;*/
+ font-size: 10pt;
+ /*color: black;*/
+}
+
--- mesa-7.0.3.orig/docs/relnotes-7.0.3.html
+++ mesa-7.0.3/docs/relnotes-7.0.3.html
@@ -17,6 +17,15 @@
MD5 checksums
+3fd1cb76531b2515ef7db92d9a93dbf8 MesaLib-7.0.3.tar.gz
+e6e6379d7793af40a6bc3ce1bace572e MesaLib-7.0.3.tar.bz2
+97882bac195229ee0b78cab82e0e3be1 MesaLib-7.0.3.zip
+8abf6bbcb1661e7dd4ce73b3fbb85898 MesaDemos-7.0.3.tar.gz
+47fd6863621d3c9c7dbb870ab7f0c303 MesaDemos-7.0.3.tar.bz2
+99e442e14da1928f76a7297bb421a3af MesaDemos-7.0.3.zip
+2b50fe9fadc4709b57c52adef09fce3c MesaGLUT-7.0.3.tar.gz
+0ff23c4e91b238abae63a5fc9fa003e7 MesaGLUT-7.0.3.tar.bz2
+70e83554a4462dad28e0d6e20f79aada MesaGLUT-7.0.3.zip
--- mesa-7.0.3.orig/docs/relnotes-7.0.4.html
+++ mesa-7.0.3/docs/relnotes-7.0.4.html
@@ -0,0 +1,70 @@
+
+
+Mesa Release Notes
+
+
+
+
+
+
+
+Mesa 7.0.4 Release Notes / (TBD 2008)
+
+
+Mesa 7.0.4 is a stable release with bug fixes since version 7.0.3.
+
+
+
+MD5 checksums
+
+
+
+
+Bug fixes
+
+define #extension GL_ARB_texture_rectangle in shading language
+ fixed WIN32 compile problem in libGLU
+ Fixed a per-vertex glMaterial bug which could cause bad lighting
+ Fixed potential crash in AA/smoothed triangle rendering when using a fragment shader
+ Fixed glDrawElement + VBO segfault (bug 16156)
+ Fixed GLSL linker bug causing generic vertex attributes to get aliased
+ Fixed stack overflow when using glPixelZoom on Windows
+ Fixed broken all(bvec2) GLSL function, added misc missing bvec constructors
+ ARB program "state.clip[n].plane" didn't parse correctly
+ Fixed broken glGetUniformiv() (bug 13774)
+
+
+Changes
+
+Added support for DragonFly OS
+ Added a build config for FreeBSD static libs (Anatolij Shkodin)
+ Enabled GL_EXT_multi_draw_arrays extension in R200/R300 drivers
+ Enabled GL_ARB_point_sprite extension in I965 driver
+ Enabled GL_EXT_texture_sRGB extension in I965 driver
+ Added support for GL shading language in I965 driver
+
+
+
+
+
+Driver Status
+
+
+Driver Status
+---------------------- ----------------------
+DRI drivers varies with the driver
+XMesa/GLX (on Xlib) implements OpenGL 2.1
+OSMesa (off-screen) implements OpenGL 2.1
+Windows/Win32 implements OpenGL 2.1
+Glide (3dfx Voodoo1/2) implements OpenGL 1.3
+SVGA unsupported
+Wind River UGL unsupported
+DJGPP unsupported
+GGI unsupported
+BeOS unsupported
+Allegro unsupported
+D3D unsupported
+
+
+
+
--- mesa-7.0.3.orig/include/GL/Makefile.am
+++ mesa-7.0.3/include/GL/Makefile.am
@@ -0,0 +1,43 @@
+## Process this file with automake to produce Makefile.in
+
+GLincludedir = $(includedir)/GL
+
+INC_FX = fxmesa.h
+INC_GGI = ggimesa.h
+INC_OSMESA = osmesa.h
+INC_SVGA = svgamesa.h
+INC_X11 = glx.h glxext.h glx_mangle.h xmesa.h xmesa_x.h xmesa_xf86.h
+INC_GLUT = glut.h glutf90.h
+
+if HAVE_FX
+sel_inc_fx = $(INC_FX)
+endif
+
+if HAVE_GGI
+sel_inc_ggi = $(INC_GGI)
+endif
+
+if HAVE_OSMESA
+sel_inc_osmesa = $(INC_OSMESA)
+endif
+
+if HAVE_SVGA
+sel_inc_svga = $(INC_SVGA)
+endif
+
+if HAVE_X11
+sel_inc_x11 = $(INC_X11)
+endif
+
+if NEED_GLUT
+sel_inc_glut = $(INC_GLUT)
+endif
+
+EXTRA_HEADERS = amesa.h dosmesa.h foomesa.h glut_h.dja mesa_wgl.h mglmesa.h \
+ vms_x_fix.h wmesa.h \
+ $(INC_FX) $(INC_GGI) $(INC_OSMESA) $(INC_SVGA) $(INC_X11) $(INC_GLUT)
+
+GLinclude_HEADERS = gl.h glext.h gl_mangle.h glu.h glu_mangle.h \
+ $(sel_inc_fx) $(sel_inc_ggi) $(sel_inc_osmesa) $(sel_inc_svga) \
+ $(sel_inc_x11) $(sel_inc_glut)
+include $(top_srcdir)/common_rules.make
--- mesa-7.0.3.orig/include/GL/glut_h.dja
+++ mesa-7.0.3/include/GL/glut_h.dja
@@ -0,0 +1,340 @@
+
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.1
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+/*
+ * This header file is based on the REAL glut.h by Mark J. Kilgard.
+ *
+ * The DJGPP/ALLEGRO (DJA) GLUT implementation was written by
+ * Bernhard Tschirren (bernie-t@geocities.com) for the sole purpose
+ * of compiling all the sample programs (which use GLUT). Therefore,
+ * is NOT AT ALL a complete version of GLUT!
+ */
+
+
+#ifndef __AGLUT_H__
+#define __AGLUT_H__
+
+#include
+#include
+
+#define GLUTCALLBACK
+#define APIENTRY
+#define GLUTAPI extern
+
+#define GLUT_RGB 0
+#define GLUT_RGBA GLUT_RGB
+#define GLUT_INDEX 1
+#define GLUT_SINGLE 0
+#define GLUT_DOUBLE 2
+#define GLUT_ACCUM 4
+#define GLUT_ALPHA 8
+#define GLUT_DEPTH 16
+#define GLUT_STENCIL 32
+
+/* Mouse buttons. */
+#define GLUT_LEFT_BUTTON 0
+#define GLUT_MIDDLE_BUTTON 1
+#define GLUT_RIGHT_BUTTON 2
+
+/* Mouse button state. */
+#define GLUT_DOWN 0
+#define GLUT_UP 1
+
+/* function keys */
+#define GLUT_KEY_F1 1
+#define GLUT_KEY_F2 2
+#define GLUT_KEY_F3 3
+#define GLUT_KEY_F4 4
+#define GLUT_KEY_F5 5
+#define GLUT_KEY_F6 6
+#define GLUT_KEY_F7 7
+#define GLUT_KEY_F8 8
+#define GLUT_KEY_F9 9
+#define GLUT_KEY_F10 10
+#define GLUT_KEY_F11 11
+#define GLUT_KEY_F12 12
+
+/* directional keys */
+#define GLUT_KEY_LEFT 100
+#define GLUT_KEY_UP 101
+#define GLUT_KEY_RIGHT 102
+#define GLUT_KEY_DOWN 103
+#define GLUT_KEY_PAGE_UP 104
+#define GLUT_KEY_PAGE_DOWN 105
+#define GLUT_KEY_HOME 106
+#define GLUT_KEY_END 107
+#define GLUT_KEY_INSERT 108
+
+/* Entry/exit state. */
+#define GLUT_LEFT 0
+#define GLUT_ENTERED 1
+
+/* Visibility state. */
+#define GLUT_NOT_VISIBLE 0
+#define GLUT_VISIBLE 1
+
+/* Color index component selection values. */
+#define GLUT_RED 0
+#define GLUT_GREEN 1
+#define GLUT_BLUE 2
+
+/* Layers for use. */
+#define GLUT_NORMAL 0
+#define GLUT_OVERLAY 1
+
+/* Stroke font constants (use these in GLUT program). */
+#define GLUT_STROKE_ROMAN ((void*)0)
+#define GLUT_STROKE_MONO_ROMAN ((void*)1)
+
+/* Bitmap font constants (use these in GLUT program). */
+#define GLUT_BITMAP_9_BY_15 ((void*)2)
+#define GLUT_BITMAP_8_BY_13 ((void*)3)
+#define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
+#define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
+#define GLUT_BITMAP_HELVETICA_10 ((void*)6)
+#define GLUT_BITMAP_HELVETICA_12 ((void*)7)
+#define GLUT_BITMAP_HELVETICA_18 ((void*)8)
+
+/* glutGet parameters. */
+#define GLUT_WINDOW_X 100
+#define GLUT_WINDOW_Y 101
+#define GLUT_WINDOW_WIDTH 102
+#define GLUT_WINDOW_HEIGHT 103
+#define GLUT_WINDOW_BUFFER_SIZE 104
+#define GLUT_WINDOW_STENCIL_SIZE 105
+#define GLUT_WINDOW_DEPTH_SIZE 106
+#define GLUT_WINDOW_RED_SIZE 107
+#define GLUT_WINDOW_GREEN_SIZE 108
+#define GLUT_WINDOW_BLUE_SIZE 109
+#define GLUT_WINDOW_ALPHA_SIZE 110
+#define GLUT_WINDOW_ACCUM_RED_SIZE 111
+#define GLUT_WINDOW_ACCUM_GREEN_SIZE 112
+#define GLUT_WINDOW_ACCUM_BLUE_SIZE 113
+#define GLUT_WINDOW_ACCUM_ALPHA_SIZE 114
+#define GLUT_WINDOW_DOUBLEBUFFER 115
+#define GLUT_WINDOW_RGBA 116
+#define GLUT_WINDOW_PARENT 117
+#define GLUT_WINDOW_NUM_CHILDREN 118
+#define GLUT_WINDOW_COLORMAP_SIZE 119
+#define GLUT_WINDOW_NUM_SAMPLES 120
+#define GLUT_WINDOW_STEREO 121
+#define GLUT_WINDOW_CURSOR 122
+#define GLUT_SCREEN_WIDTH 200
+#define GLUT_SCREEN_HEIGHT 201
+#define GLUT_SCREEN_WIDTH_MM 202
+#define GLUT_SCREEN_HEIGHT_MM 203
+#define GLUT_MENU_NUM_ITEMS 300
+#define GLUT_DISPLAY_MODE_POSSIBLE 400
+#define GLUT_INIT_WINDOW_X 500
+#define GLUT_INIT_WINDOW_Y 501
+#define GLUT_INIT_WINDOW_WIDTH 502
+#define GLUT_INIT_WINDOW_HEIGHT 503
+#define GLUT_INIT_DISPLAY_MODE 504
+#define GLUT_ELAPSED_TIME 700
+#define GLUT_WINDOW_FORMAT_ID 123
+
+/* glutDeviceGet parameters. */
+#define GLUT_HAS_KEYBOARD 600
+#define GLUT_HAS_MOUSE 601
+#define GLUT_HAS_SPACEBALL 602
+#define GLUT_HAS_DIAL_AND_BUTTON_BOX 603
+#define GLUT_HAS_TABLET 604
+#define GLUT_NUM_MOUSE_BUTTONS 605
+#define GLUT_NUM_SPACEBALL_BUTTONS 606
+#define GLUT_NUM_BUTTON_BOX_BUTTONS 607
+#define GLUT_NUM_DIALS 608
+#define GLUT_NUM_TABLET_BUTTONS 609
+#define GLUT_DEVICE_IGNORE_KEY_REPEAT 610
+#define GLUT_DEVICE_KEY_REPEAT 611
+#define GLUT_HAS_JOYSTICK 612
+#define GLUT_OWNS_JOYSTICK 613
+#define GLUT_JOYSTICK_BUTTONS 614
+#define GLUT_JOYSTICK_AXES 615
+#define GLUT_JOYSTICK_POLL_RATE 616
+
+/* glutLayerGet parameters. */
+#define GLUT_OVERLAY_POSSIBLE 800
+#define GLUT_LAYER_IN_USE 801
+#define GLUT_HAS_OVERLAY 802
+#define GLUT_TRANSPARENT_INDEX 803
+#define GLUT_NORMAL_DAMAGED 804
+#define GLUT_OVERLAY_DAMAGED 805
+
+/* glutVideoResizeGet parameters. */
+#define GLUT_VIDEO_RESIZE_POSSIBLE 900
+#define GLUT_VIDEO_RESIZE_IN_USE 901
+#define GLUT_VIDEO_RESIZE_X_DELTA 902
+#define GLUT_VIDEO_RESIZE_Y_DELTA 903
+#define GLUT_VIDEO_RESIZE_WIDTH_DELTA 904
+#define GLUT_VIDEO_RESIZE_HEIGHT_DELTA 905
+#define GLUT_VIDEO_RESIZE_X 906
+#define GLUT_VIDEO_RESIZE_Y 907
+#define GLUT_VIDEO_RESIZE_WIDTH 908
+#define GLUT_VIDEO_RESIZE_HEIGHT 909
+
+/* glutUseLayer parameters. */
+#define GLUT_NORMAL 0
+#define GLUT_OVERLAY 1
+
+/* glutGetModifiers return mask. */
+#define GLUT_ACTIVE_SHIFT 1
+#define GLUT_ACTIVE_CTRL 2
+#define GLUT_ACTIVE_ALT 4
+
+/* glutSetCursor parameters. */
+/* Basic arrows. */
+#define GLUT_CURSOR_RIGHT_ARROW 0
+#define GLUT_CURSOR_LEFT_ARROW 1
+/* Symbolic cursor shapes. */
+#define GLUT_CURSOR_INFO 2
+#define GLUT_CURSOR_DESTROY 3
+#define GLUT_CURSOR_HELP 4
+#define GLUT_CURSOR_CYCLE 5
+#define GLUT_CURSOR_SPRAY 6
+#define GLUT_CURSOR_WAIT 7
+#define GLUT_CURSOR_TEXT 8
+#define GLUT_CURSOR_CROSSHAIR 9
+/* Directional cursors. */
+#define GLUT_CURSOR_UP_DOWN 10
+#define GLUT_CURSOR_LEFT_RIGHT 11
+/* Sizing cursors. */
+#define GLUT_CURSOR_TOP_SIDE 12
+#define GLUT_CURSOR_BOTTOM_SIDE 13
+#define GLUT_CURSOR_LEFT_SIDE 14
+#define GLUT_CURSOR_RIGHT_SIDE 15
+#define GLUT_CURSOR_TOP_LEFT_CORNER 16
+#define GLUT_CURSOR_TOP_RIGHT_CORNER 17
+#define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
+#define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
+/* Inherit from parent window. */
+#define GLUT_CURSOR_INHERIT 100
+/* Blank cursor. */
+#define GLUT_CURSOR_NONE 101
+/* Fullscreen crosshair (if available). */
+#define GLUT_CURSOR_FULL_CROSSHAIR 102
+
+/* GLUT initialization sub-API. */
+GLUTAPI void APIENTRY glutInit(int *argcp, char **argv);
+GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode);
+GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y);
+GLUTAPI void APIENTRY glutInitWindowSize(int width, int height);
+GLUTAPI void APIENTRY glutMainLoop(void);
+
+/* GLUT window sub-API. */
+GLUTAPI int APIENTRY glutCreateWindow(const char *title);
+GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
+GLUTAPI void APIENTRY glutDestroyWindow(int win);
+GLUTAPI void APIENTRY glutPostRedisplay(void);
+GLUTAPI void APIENTRY glutSwapBuffers(void);
+GLUTAPI int APIENTRY glutGetWindow(void);
+GLUTAPI void APIENTRY glutSetWindow(int win);
+GLUTAPI void APIENTRY glutSetWindowTitle(const char *title);
+GLUTAPI void APIENTRY glutSetIconTitle(const char *title);
+GLUTAPI void APIENTRY glutPositionWindow(int x, int y);
+GLUTAPI void APIENTRY glutReshapeWindow(int width, int height);
+GLUTAPI void APIENTRY glutPopWindow(void);
+GLUTAPI void APIENTRY glutPushWindow(void);
+GLUTAPI void APIENTRY glutIconifyWindow(void);
+GLUTAPI void APIENTRY glutShowWindow(void);
+GLUTAPI void APIENTRY glutHideWindow(void);
+
+/* GLUT overlay sub-API. */
+GLUTAPI void APIENTRY glutEstablishOverlay(void);
+GLUTAPI void APIENTRY glutRemoveOverlay(void);
+GLUTAPI void APIENTRY glutUseLayer(GLenum layer);
+GLUTAPI void APIENTRY glutPostOverlayRedisplay(void);
+GLUTAPI void APIENTRY glutShowOverlay(void);
+GLUTAPI void APIENTRY glutHideOverlay(void);
+
+/* GLUT menu sub-API. */
+GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *)(int));
+GLUTAPI void APIENTRY glutDestroyMenu(int menu);
+GLUTAPI int APIENTRY glutGetMenu(void);
+GLUTAPI void APIENTRY glutSetMenu(int menu);
+GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
+GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
+GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
+GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
+GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
+GLUTAPI void APIENTRY glutAttachMenu(int button);
+GLUTAPI void APIENTRY glutDetachMenu(int button);
+
+/* GLUT window callback sub-API. */
+GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
+GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
+GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
+GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
+GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
+GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
+GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
+GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
+GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
+GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
+GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
+GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
+GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
+GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
+GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
+GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
+GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
+GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
+GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
+
+/* GLUT color index sub-API. */
+GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
+GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component);
+GLUTAPI void APIENTRY glutCopyColormap(int win);
+
+/* GLUT state retrieval sub-API. */
+GLUTAPI int APIENTRY glutGet(GLenum type);
+GLUTAPI int APIENTRY glutDeviceGet(GLenum type);
+
+/* GLUT font sub-API */
+GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character);
+GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character);
+GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character);
+GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character);
+
+/* GLUT pre-built models sub-API */
+GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
+GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
+GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
+GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
+GLUTAPI void APIENTRY glutWireCube(GLdouble size);
+GLUTAPI void APIENTRY glutSolidCube(GLdouble size);
+GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
+GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
+GLUTAPI void APIENTRY glutWireDodecahedron(void);
+GLUTAPI void APIENTRY glutSolidDodecahedron(void);
+GLUTAPI void APIENTRY glutWireTeapot(GLdouble size);
+GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size);
+GLUTAPI void APIENTRY glutWireOctahedron(void);
+GLUTAPI void APIENTRY glutSolidOctahedron(void);
+GLUTAPI void APIENTRY glutWireTetrahedron(void);
+GLUTAPI void APIENTRY glutSolidTetrahedron(void);
+GLUTAPI void APIENTRY glutWireIcosahedron(void);
+GLUTAPI void APIENTRY glutSolidIcosahedron(void);
+
+#endif /* __AGLUT_H__ */
--- mesa-7.0.3.orig/include/GL/directfbgl.h
+++ mesa-7.0.3/include/GL/directfbgl.h
@@ -0,0 +1,89 @@
+/*
+ (c) Copyright 2001 convergence integrated media GmbH.
+ All rights reserved.
+
+ Written by Denis Oliver Kropp and
+ Andreas Hundt .
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef __DIRECTFBGL_H__
+#define __DIRECTFBGL_H__
+
+#include
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+typedef struct {
+ int buffer_size;
+ int depth_size;
+ int stencil_size;
+ int aux_buffers;
+
+ int red_size;
+ int green_size;
+ int blue_size;
+ int alpha_size;
+
+ int accum_red_size;
+ int accum_green_size;
+ int accum_blue_size;
+ int accum_alpha_size;
+
+ DFBBoolean double_buffer;
+ DFBBoolean stereo;
+} DFBGLAttributes;
+
+
+DEFINE_INTERFACE( IDirectFBGL,
+
+ /** Context handling **/
+
+ /*
+ * Acquire the hardware lock.
+ */
+ DFBResult (*Lock) (
+ IDirectFBGL *thiz
+ );
+
+ /*
+ * Release the lock.
+ */
+ DFBResult (*Unlock) (
+ IDirectFBGL *thiz
+ );
+
+ /*
+ * Query the OpenGL attributes.
+ */
+ DFBResult (*GetAttributes) (
+ IDirectFBGL *thiz,
+ DFBGLAttributes *attributes
+ );
+)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
--- mesa-7.0.3.orig/include/GL/miniglx.h
+++ mesa-7.0.3/include/GL/miniglx.h
@@ -0,0 +1,482 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.1
+ *
+ * Copyright (C) 1999-2004 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 miniglx.h
+ * \brief Mini GLX interface functions.
+ * \author Brian Paul
+ *
+ * See comments miniglx.c for more information.
+ */
+
+#ifndef MINIGLX_H
+#define MINIGLX_H
+
+#include
+#include
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**
+ * \name Replacement Xlib/GLX types
+ */
+/*@{*/
+/**
+ * \brief Boolean type.
+ *
+ * It can have the values #True or #False.
+ */
+#ifndef MINIGLX_NO_XTYPES
+typedef int Bool;
+#endif
+typedef int MINI_Bool;
+
+/**
+ * \brief Color map.
+ *
+ * Alias for private ::MiniGLXColormapRec structure.
+ */
+typedef struct MiniGLXColormapRec *MINI_Colormap;
+#ifndef MINIGLX_NO_XTYPES
+typedef struct MiniGLXColormapRec *Colormap;
+#endif
+
+/**
+ * \brief Window attributes.
+ */
+typedef struct MiniGLXSetWindowAttributesRec {
+ int background_pixel; /**< \brief background pixel */
+ int border_pixel; /**< \brief border pixel value */
+ MINI_Colormap colormap; /**< \brief color map to be associated with window */
+ int event_mask; /**< \brief set of events that should be saved */
+} XSetWindowAttributes;
+
+/**
+ * \brief Visual.
+ *
+ * Alias for the private ::MiniGLXVisualRec structure.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXVisualRec Visual;
+
+/**
+ * \brief Visual information.
+ *
+ * \sa \ref datatypes.
+ */
+#ifndef MINIGLX_NO_XTYPES
+typedef unsigned long VisualID;
+#endif
+typedef unsigned long MINI_VisualID;
+typedef struct MiniGLXXVisualInfoRec {
+ Visual *visual; /**< \brief pointer to the GLX Visual */
+ MINI_VisualID visualid; /**< \brief visual ID */
+ int screen; /**< \brief screen number */
+ int depth; /**< \brief bit depth */
+#if defined(__cplusplus) || defined(c_plusplus)
+ int c_class; /**< \brief class */
+#else
+ int class; /**< \brief class */
+#endif
+ int bits_per_rgb; /**< \brief total bits per pixel */
+} XVisualInfo;
+
+/**
+ * \brief GLX Frame Buffer Configuration (for pbuffers)
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXFBConfigRec {
+ XVisualInfo *visInfo;
+} GLXFBConfig;
+
+
+/**
+ * \brief Display handle.
+ *
+ * Alias for the private ::MiniGLXDisplayRec structure.
+ *
+ * \sa \ref datatypes.
+ */
+#ifndef MINIGLX_NO_XTYPES
+typedef struct MiniGLXDisplayRec Display;
+#endif
+typedef struct MiniGLXDisplayRec MINI_Display;
+
+/**
+ * \brief Window handle.
+ *
+ * Alias for the private ::MiniGLXWindowRec structure.
+ *
+ * \sa \ref datatypes.
+ */
+#ifndef MINIGLX_NO_XTYPES
+typedef struct MiniGLXWindowRec *Window;
+#endif
+typedef struct MiniGLXWindowRec *MINI_Window;
+
+/**
+ * \brief Drawable.
+ *
+ * Alias for the private ::MiniGLXWindowRec structure.
+ *
+ * For Mini GLX only the full-screen window can be used as source and
+ * destination in graphics operations.
+ *
+ * \sa \ref datatypes.
+ */
+#ifndef MINIGLX_NO_XTYPES
+typedef struct MiniGLXWindowRec *Drawable;
+#endif
+typedef struct MiniGLXWindowRec *MINI_Drawable;
+
+/**
+ * \brief GLX drawable.
+ *
+ * Alias for the private ::MiniGLXWindowRec structure.
+ *
+ * Same as #Drawable.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXWindowRec *GLXDrawable;
+
+/**
+ * \brief GLX pbuffer.
+ *
+ * Alias for the private ::MiniGLXWindowRec structure.
+ *
+ * Same as #Drawable.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXWindowRec *GLXPbuffer;
+
+/**
+ * \brief GLX context.
+ *
+ * Alias for the private ::MiniGLXContext structure.
+ *
+ * \sa \ref datatypes.
+ */
+typedef struct MiniGLXContextRec *GLXContext;
+/*@}*/
+
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ MINI_Bool send_event; /* true if this came from a SendEvent request */
+ MINI_Display *display; /* Display the event was read from */
+ MINI_Window window;
+ int x, y;
+ int width, height;
+ int count; /* if non-zero, at least this many more */
+} XExposeEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ MINI_Bool send_event; /* true if this came from a SendEvent request */
+ MINI_Display *display; /* Display the event was read from */
+ MINI_Window parent; /* parent of the window */
+ MINI_Window window; /* window id of window created */
+ int x, y; /* window location */
+ int width, height; /* size of window */
+ int border_width; /* border width */
+ MINI_Bool override_redirect; /* creation should be overridden */
+} XCreateWindowEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ MINI_Bool send_event; /* true if this came from a SendEvent request */
+ MINI_Display *display; /* Display the event was read from */
+ MINI_Window event;
+ MINI_Window window;
+} XDestroyWindowEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ MINI_Bool send_event; /* true if this came from a SendEvent request */
+ MINI_Display *display; /* Display the event was read from */
+ MINI_Window event;
+ MINI_Window window;
+ MINI_Bool from_configure;
+} XUnmapEvent;
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ MINI_Bool send_event; /* true if this came from a SendEvent request */
+ MINI_Display *display; /* Display the event was read from */
+ MINI_Window event;
+ MINI_Window window;
+ MINI_Bool override_redirect; /* boolean, is override set... */
+} XMapEvent;
+
+
+typedef struct {
+ int type;
+ unsigned long serial; /* # of last request processed by server */
+ MINI_Bool send_event; /* true if this came from a SendEvent request */
+ MINI_Display *display; /* Display the event was read from */
+ MINI_Window parent;
+ MINI_Window window;
+} XMapRequestEvent;
+
+typedef union _XEvent {
+ int type; /* must not be changed; first element */
+ XExposeEvent xexpose;
+ XCreateWindowEvent xcreatewindow;
+ XDestroyWindowEvent xdestroywindow;
+ XUnmapEvent xunmap;
+ XMapEvent xmap;
+ XMapRequestEvent xmaprequest;
+ long pad[24];
+} XEvent;
+
+
+/**
+ * \name Xlib constants
+ */
+/*@{*/
+#define False 0
+#define True 1
+#define None 0
+#define AllocNone 0
+#define InputOutput 1
+#define ExposureMask (1L<<15)
+#define StructureNotifyMask (1L<<17)
+#define CWBackPixel (1L<<1)
+#define CWBorderPixel (1L<<3)
+#define CWEventMask (1L<<11)
+#define CWColormap (1L<<13)
+#define PseudoColor 3
+#define TrueColor 4
+#define VisualIDMask 0x1
+#define VisualScreenMask 0x2
+#define Expose 12
+#define CreateNotify 16
+#define DestroyNotify 17
+#define UnmapNotify 18
+#define MapNotify 19
+#define MapRequest 20
+
+/*@}*/
+
+/**
+ * \name Standard GLX tokens
+ */
+/*@{*/
+#define GLX_USE_GL 1
+#define GLX_BUFFER_SIZE 2
+#define GLX_LEVEL 3
+#define GLX_RGBA 4
+#define GLX_DOUBLEBUFFER 5
+#define GLX_STEREO 6
+#define GLX_AUX_BUFFERS 7
+#define GLX_RED_SIZE 8
+#define GLX_GREEN_SIZE 9
+#define GLX_BLUE_SIZE 10
+#define GLX_ALPHA_SIZE 11
+#define GLX_DEPTH_SIZE 12
+#define GLX_STENCIL_SIZE 13
+#define GLX_ACCUM_RED_SIZE 14
+#define GLX_ACCUM_GREEN_SIZE 15
+#define GLX_ACCUM_BLUE_SIZE 16
+#define GLX_ACCUM_ALPHA_SIZE 17
+#define GLX_BAD_ATTRIBUTE 1
+#define GLX_BAD_VISUAL 4
+/*@}*/
+
+
+/**
+ * \name Unique to Mini GLX
+ *
+ * At compile time, the Mini GLX interface version can be tested with the
+ * MINI_GLX_VERSION_1_x preprocessor tokens.
+ *
+ * \sa glXQueryVersion()
+ */
+/*@{*/
+/** \brief Defined if version 1.0 of Mini GLX is supported. */
+#define MINI_GLX_VERSION_1_0 1
+/** \brief Defined if version 1.1 of Mini GLX is supported. */
+#define MINI_GLX_VERSION_1_1 1
+/*@}*/
+
+
+/**
+ * \name Server-specific functions
+ */
+extern MINI_Display *
+__miniglx_StartServer( const char *display_name );
+
+extern int
+__miniglx_Select( MINI_Display *dpy, int maxfd,
+ fd_set *rfds, fd_set *wfds, fd_set *xfds,
+ struct timeval *tv );
+
+
+/**
+ * \name Simulated Xlib functions
+ */
+/*@{*/
+extern MINI_Display *
+XOpenDisplay( const char *dpy_name );
+
+
+extern void
+XCloseDisplay( MINI_Display *display );
+
+extern MINI_Window
+XCreateWindow( MINI_Display *display, MINI_Window parent, int x, int y,
+ unsigned int width, unsigned int height,
+ unsigned int border_width, int depth, unsigned int winclass,
+ Visual *visual, unsigned long valuemask,
+ XSetWindowAttributes *attributes );
+
+extern int
+XNextEvent(MINI_Display *display, XEvent *event_return);
+
+extern MINI_Bool
+XCheckMaskEvent( MINI_Display *dpy, long event_mask, XEvent *event_return );
+
+/**
+ * \brief Return the root window.
+ *
+ * \param display the display handle. It is ignored by Mini GLX, but should be
+ * the value returned by XOpenDisplay().
+ * \param screen the screen number on the host server. It is ignored by Mini
+ * GLX but should be zero.
+ *
+ * \return the root window. Always zero on Mini GLX.
+ */
+#define RootWindow(display, screen) 0
+#define DefaultScreen(dpy) 0
+
+extern void
+XDestroyWindow( MINI_Display *display, MINI_Window w );
+
+extern void
+XMapWindow( MINI_Display *display, MINI_Window w );
+
+/* Should clients have access to this?
+ */
+extern void
+XUnmapWindow( MINI_Display *display, MINI_Window w );
+
+extern MINI_Colormap
+XCreateColormap( MINI_Display *display, MINI_Window w, Visual *visual, int alloc );
+
+extern void
+XFreeColormap( MINI_Display *display, MINI_Colormap cmap );
+
+extern void
+XFree( void *data );
+
+extern XVisualInfo *
+XGetVisualInfo( MINI_Display *display, long vinfo_mask,
+ XVisualInfo *vinfo_template, int *nitems_return );
+/*@}*/
+
+
+
+/**
+ * \name GLX functions
+ */
+/*@{*/
+extern XVisualInfo*
+glXChooseVisual( MINI_Display *dpy, int screen, int *attribList );
+
+extern int
+glXGetConfig( MINI_Display *dpy, XVisualInfo *vis, int attrib, int *value );
+
+extern GLXContext
+glXCreateContext( MINI_Display *dpy, XVisualInfo *vis,
+ GLXContext shareList, MINI_Bool direct );
+
+extern void
+glXDestroyContext( MINI_Display *dpy, GLXContext ctx );
+
+extern MINI_Bool
+glXMakeCurrent( MINI_Display *dpy, GLXDrawable drawable, GLXContext ctx);
+
+extern void
+glXSwapBuffers( MINI_Display *dpy, GLXDrawable drawable );
+
+extern GLXContext
+glXGetCurrentContext( void );
+
+extern GLXDrawable
+glXGetCurrentDrawable( void );
+
+extern void
+(*glXGetProcAddress(const GLubyte *procname))( void );
+
+extern MINI_Bool
+glXQueryVersion( MINI_Display *dpy, int *major, int *minor );
+
+/* Added in MiniGLX 1.1 */
+extern GLXPbuffer
+glXCreatePbuffer( MINI_Display *dpy, GLXFBConfig config, const int *attribList );
+
+extern void
+glXDestroyPbuffer( MINI_Display *dpy, GLXPbuffer pbuf );
+
+extern GLXFBConfig *
+glXChooseFBConfig( MINI_Display *dpy, int screen, const int *attribList,
+ int *nitems );
+
+extern XVisualInfo *
+glXGetVisualFromFBConfig( MINI_Display *dpy, GLXFBConfig config );
+
+extern void *glXAllocateMemoryMESA(Display *dpy, int scrn,
+ size_t size, float readFreq,
+ float writeFreq, float priority);
+
+extern void glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer);
+
+extern GLuint glXGetMemoryOffsetMESA( Display *dpy, int scrn,
+ const void *pointer );
+/*@}*/
+
+extern void
+__glXScrEnableExtension( void *, const char * name );
+
+/*@}*/
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MINIGLX_H */
--- mesa-7.0.3.orig/include/GL/foomesa.h
+++ mesa-7.0.3/include/GL/foomesa.h
@@ -0,0 +1,76 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 3.0
+ * Copyright (C) 1995-1998 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+/*
+ * Example Foo/Mesa interface. See src/ddsample.c for more info.
+ */
+
+
+
+#ifndef FOOMESA_H
+#define FOOMESA_H
+
+
+
+typedef struct foo_mesa_visual *FooMesaVisual;
+
+typedef struct foo_mesa_buffer *FooMesaBuffer;
+
+typedef struct foo_mesa_context *FooMesaContext;
+
+
+
+#ifdef BEOS
+#pragma export on
+#endif
+
+
+extern FooMesaVisual FooMesaChooseVisual( /* your params */ );
+
+extern void FooMesaDestroyVisual( FooMesaVisual visual );
+
+
+extern FooMesaBuffer FooMesaCreateBuffer( FooMesaVisual visual,
+ void *your_window_id );
+
+extern void FooMesaDestroyBuffer( FooMesaBuffer buffer );
+
+
+extern FooMesaContext FooMesaCreateContext( FooMesaVisual visual,
+ FooMesaContext sharelist );
+
+extern void FooMesaDestroyContext( FooMesaContext context );
+
+
+extern void FooMesaMakeCurrent( FooMesaContext context, FooMesaBuffer buffer );
+
+
+extern void FooMesaSwapBuffers( FooMesaBuffer buffer );
+
+
+/* Probably some more functions... */
+
+
+#ifdef BEOS
+#pragma export off
+#endif
+
+#endif
--- mesa-7.0.3.orig/progs/ggi/blah
+++ mesa-7.0.3/progs/ggi/blah
@@ -0,0 +1,2 @@
+Terminating on signal 11
+
--- mesa-7.0.3.orig/progs/ggi/blat
+++ mesa-7.0.3/progs/ggi/blat
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+function foobar() {
+ echo "foo!"
+}
+
+foobar
--- mesa-7.0.3.orig/progs/ggi/box.asc
+++ mesa-7.0.3/progs/ggi/box.asc
@@ -0,0 +1,66 @@
+Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
+
+Named object: "Object01"
+Tri-mesh, Vertices: 8 Faces: 12
+Vertex list:
+Vertex 0: X: -20 Y: -19.999998 Z: 20.000002
+Vertex 1: X: 20 Y: -19.999998 Z: 20.000002
+Vertex 2: X: 20 Y: 20.000002 Z: 19.999998
+Vertex 3: X: -20 Y: 20.000002 Z: 19.999998
+Vertex 4: X: -20 Y: -20.000002 Z: -19.999998
+Vertex 5: X: 20 Y: -20.000002 Z: -19.999998
+Vertex 6: X: 20 Y: 19.999998 Z: -20.000002
+Vertex 7: X: -20 Y: 19.999998 Z: -20.000002
+Face list:
+Face 0: A:0 B:1 C:2 AB:1 BC:1 CA:0
+Smoothing: 1
+Face 1: A:0 B:2 C:3 AB:0 BC:1 CA:1
+Smoothing: 1
+Face 2: A:0 B:4 C:5 AB:1 BC:1 CA:0
+Smoothing: 2
+Face 3: A:0 B:5 C:1 AB:0 BC:1 CA:1
+Smoothing: 2
+Face 4: A:1 B:5 C:6 AB:1 BC:1 CA:0
+Smoothing: 3
+Face 5: A:1 B:6 C:2 AB:0 BC:1 CA:1
+Smoothing: 3
+Face 6: A:2 B:6 C:7 AB:1 BC:1 CA:0
+Smoothing: 4
+Face 7: A:2 B:7 C:3 AB:0 BC:1 CA:1
+Smoothing: 4
+Face 8: A:3 B:7 C:4 AB:1 BC:1 CA:0
+Smoothing: 5
+Face 9: A:3 B:4 C:0 AB:0 BC:1 CA:1
+Smoothing: 5
+Face 10: A:4 B:7 C:6 AB:1 BC:1 CA:0
+Smoothing: 6
+Face 11: A:4 B:6 C:5 AB:0 BC:1 CA:1
+Smoothing: 6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page 1
+
+
+
--- mesa-7.0.3.orig/progs/ggi/cone.asc
+++ mesa-7.0.3/progs/ggi/cone.asc
@@ -0,0 +1,198 @@
+Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
+
+Named object: "Object01"
+Tri-mesh, Vertices: 34 Faces: 64
+Vertex list:
+Vertex 0: X: 60.167416 Y: -87.419525 Z: -53.3088
+Vertex 1: X: 76.70787 Y: -87.419518 Z: -29.84565
+Vertex 2: X: 83.0103 Y: -87.419518 Z: -1.838764
+Vertex 3: X: 78.115204 Y: -87.419518 Z: 26.448057
+Vertex 4: X: 62.767834 Y: -87.41951 Z: 50.708401
+Vertex 5: X: 39.304672 Y: -87.41951 Z: 67.248848
+Vertex 6: X: 11.297782 Y: -87.41951 Z: 73.551254
+Vertex 7: X: -16.989004 Y: -87.41951 Z: 68.656158
+Vertex 8: X: -41.249344 Y: -87.41951 Z: 53.308777
+Vertex 9: X: -57.789783 Y: -87.419518 Z: 29.845612
+Vertex 10: X: -64.092194 Y: -87.419518 Z: 1.838721
+Vertex 11: X: -59.197079 Y: -87.419518 Z: -26.448097
+Vertex 12: X: -43.849678 Y: -87.419525 Z: -50.708427
+Vertex 13: X: -20.386503 Y: -87.419525 Z: -67.248856
+Vertex 14: X: 7.62039 Y: -87.419525 Z: -73.551239
+Vertex 15: X: 35.907204 Y: -87.419525 Z: -68.656105
+Vertex 16: X: 101.684875 Y: 94.590591 Z: -96.955391
+Vertex 17: X: 131.767838 Y: 94.590591 Z: -54.281792
+Vertex 18: X: 143.230377 Y: 94.590599 Z: -3.344275
+Vertex 19: X: 134.327423 Y: 94.590607 Z: 48.102379
+Vertex 20: X: 106.414383 Y: 94.590607 Z: 92.225876
+Vertex 21: X: 63.740765 Y: 94.590607 Z: 122.3088
+Vertex 22: X: 12.803238 Y: 94.590614 Z: 133.771301
+Vertex 23: X: -38.643349 Y: 94.590607 Z: 124.868355
+Vertex 24: X: -82.766846 Y: 94.590607 Z: 96.955307
+Vertex 25: X: -112.849762 Y: 94.590607 Z: 54.281677
+Vertex 26: X: -124.312256 Y: 94.590599 Z: 3.344152
+Vertex 27: X: -115.409271 Y: 94.590591 Z: -48.102493
+Vertex 28: X: -87.496201 Y: 94.590591 Z: -92.225967
+Vertex 29: X: -44.822552 Y: 94.590591 Z: -122.308861
+Vertex 30: X: 6.114983 Y: 94.590584 Z: -133.771332
+Vertex 31: X: 57.561623 Y: 94.590591 Z: -124.868301
+Vertex 32: X: 9.459057 Y: -87.419518 Z: 0.000008
+Vertex 33: X: 9.459057 Y: 94.590599 Z: -0.000008
+Face list:
+Face 0: A:0 B:1 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 1: A:1 B:2 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 2: A:2 B:3 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 3: A:3 B:4 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 4: A:4 B:5 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 5: A:5 B:6 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 6: A:6 B:7 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 7: A:7 B:8 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 8: A:8 B:9 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 9: A:9 B:10 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 10: A:10 B:11 C:32 AB:1 BC:0 CA:0
+
+ Page 1
+
+
+
+Smoothing: 1
+Face 11: A:11 B:12 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 12: A:12 B:13 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 13: A:13 B:14 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 14: A:14 B:15 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 15: A:15 B:0 C:32 AB:1 BC:0 CA:0
+Smoothing: 1
+Face 16: A:0 B:16 C:17 AB:1 BC:1 CA:0
+Smoothing: 2
+Face 17: A:0 B:17 C:1 AB:0 BC:1 CA:1
+Smoothing: 2
+Face 18: A:1 B:17 C:18 AB:1 BC:1 CA:0
+Smoothing: 3
+Face 19: A:1 B:18 C:2 AB:0 BC:1 CA:1
+Smoothing: 3
+Face 20: A:2 B:18 C:19 AB:1 BC:1 CA:0
+Smoothing: 4
+Face 21: A:2 B:19 C:3 AB:0 BC:1 CA:1
+Smoothing: 4
+Face 22: A:3 B:19 C:20 AB:1 BC:1 CA:0
+Smoothing: 5
+Face 23: A:3 B:20 C:4 AB:0 BC:1 CA:1
+Smoothing: 5
+Face 24: A:4 B:20 C:21 AB:1 BC:1 CA:0
+Smoothing: 6
+Face 25: A:4 B:21 C:5 AB:0 BC:1 CA:1
+Smoothing: 6
+Face 26: A:5 B:21 C:22 AB:1 BC:1 CA:0
+Smoothing: 7
+Face 27: A:5 B:22 C:6 AB:0 BC:1 CA:1
+Smoothing: 7
+Face 28: A:6 B:22 C:23 AB:1 BC:1 CA:0
+Smoothing: 8
+Face 29: A:6 B:23 C:7 AB:0 BC:1 CA:1
+Smoothing: 8
+Face 30: A:7 B:23 C:24 AB:1 BC:1 CA:0
+Smoothing: 9
+Face 31: A:7 B:24 C:8 AB:0 BC:1 CA:1
+Smoothing: 9
+Face 32: A:8 B:24 C:25 AB:1 BC:1 CA:0
+Smoothing: 10
+Face 33: A:8 B:25 C:9 AB:0 BC:1 CA:1
+Smoothing: 10
+Face 34: A:9 B:25 C:26 AB:1 BC:1 CA:0
+Smoothing: 11
+Face 35: A:9 B:26 C:10 AB:0 BC:1 CA:1
+Smoothing: 11
+Face 36: A:10 B:26 C:27 AB:1 BC:1 CA:0
+Smoothing: 12
+Face 37: A:10 B:27 C:11 AB:0 BC:1 CA:1
+Smoothing: 12
+Face 38: A:11 B:27 C:28 AB:1 BC:1 CA:0
+Smoothing: 13
+Face 39: A:11 B:28 C:12 AB:0 BC:1 CA:1
+Smoothing: 13
+Face 40: A:12 B:28 C:29 AB:1 BC:1 CA:0
+Smoothing: 14
+
+ Page 2
+
+
+
+Face 41: A:12 B:29 C:13 AB:0 BC:1 CA:1
+Smoothing: 14
+Face 42: A:13 B:29 C:30 AB:1 BC:1 CA:0
+Smoothing: 15
+Face 43: A:13 B:30 C:14 AB:0 BC:1 CA:1
+Smoothing: 15
+Face 44: A:14 B:30 C:31 AB:1 BC:1 CA:0
+Smoothing: 16
+Face 45: A:14 B:31 C:15 AB:0 BC:1 CA:1
+Smoothing: 16
+Face 46: A:15 B:31 C:16 AB:1 BC:1 CA:0
+Smoothing: 17
+Face 47: A:15 B:16 C:0 AB:0 BC:1 CA:1
+Smoothing: 17
+Face 48: A:16 B:33 C:17 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 49: A:17 B:33 C:18 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 50: A:18 B:33 C:19 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 51: A:19 B:33 C:20 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 52: A:20 B:33 C:21 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 53: A:21 B:33 C:22 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 54: A:22 B:33 C:23 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 55: A:23 B:33 C:24 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 56: A:24 B:33 C:25 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 57: A:25 B:33 C:26 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 58: A:26 B:33 C:27 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 59: A:27 B:33 C:28 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 60: A:28 B:33 C:29 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 61: A:29 B:33 C:30 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 62: A:30 B:33 C:31 AB:0 BC:0 CA:1
+Smoothing: 18
+Face 63: A:31 B:33 C:16 AB:0 BC:0 CA:1
+Smoothing: 18
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page 3
+
+
+
--- mesa-7.0.3.orig/progs/ggi/sphere.asc
+++ mesa-7.0.3/progs/ggi/sphere.asc
@@ -0,0 +1,132 @@
+Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
+
+Named object: "Object01"
+Tri-mesh, Vertices: 20 Faces: 36
+Vertex list:
+Vertex 0: X: -210 Y: -432.781738 Z: 180.000031
+Vertex 1: X: -610.810303 Y: 144.260559 Z: 103.580154
+Vertex 2: X: 56.586655 Y: 144.260544 Z: -128.902023
+Vertex 3: X: -75.776352 Y: 144.260605 Z: 565.321838
+Vertex 4: X: -462.815979 Y: -347.937683 Z: 131.797302
+Vertex 5: X: -616.506042 Y: -126.67173 Z: 102.494209
+Vertex 6: X: -41.847229 Y: -347.937683 Z: -14.843644
+Vertex 7: X: 60.375015 Y: -126.671753 Z: -133.291641
+Vertex 8: X: -125.336807 Y: -347.937653 Z: 423.046448
+Vertex 9: X: -73.868958 Y: -126.671692 Z: 570.797424
+Vertex 10: X: -448.353271 Y: 237.304672 Z: -92.34951
+Vertex 11: X: -192.440964 Y: 237.304672 Z: -181.494431
+Vertex 12: X: 145.038193 Y: 237.304672 Z: 109.754745
+Vertex 13: X: 94.283768 Y: 237.304688 Z: 375.953766
+Vertex 14: X: -326.684937 Y: 237.304733 Z: 522.594727
+Vertex 15: X: -531.842834 Y: 237.304718 Z: 345.540588
+Vertex 16: X: -331.419525 Y: -225.964966 Z: -168.564438
+Vertex 17: X: 152.575485 Y: -225.964935 Z: 249.129868
+Vertex 18: X: -451.155914 Y: -225.964905 Z: 459.434662
+Vertex 19: X: -298.413483 Y: 423.31897 Z: 163.142761
+Face list:
+Face 0: A:0 B:4 C:6 AB:1 BC:1 CA:1
+Face 1: A:4 B:5 C:16 AB:1 BC:1 CA:1
+Face 2: A:4 B:16 C:6 AB:1 BC:1 CA:1
+Face 3: A:6 B:16 C:7 AB:1 BC:1 CA:1
+Face 4: A:5 B:1 C:10 AB:1 BC:1 CA:1
+Face 5: A:5 B:10 C:16 AB:1 BC:1 CA:1
+Face 6: A:16 B:10 C:11 AB:1 BC:1 CA:1
+Face 7: A:16 B:11 C:7 AB:1 BC:1 CA:1
+Face 8: A:7 B:11 C:2 AB:1 BC:1 CA:1
+Face 9: A:0 B:6 C:8 AB:1 BC:1 CA:1
+Face 10: A:6 B:7 C:17 AB:1 BC:1 CA:1
+Face 11: A:6 B:17 C:8 AB:1 BC:1 CA:1
+Face 12: A:8 B:17 C:9 AB:1 BC:1 CA:1
+Face 13: A:7 B:2 C:12 AB:1 BC:1 CA:1
+Face 14: A:7 B:12 C:17 AB:1 BC:1 CA:1
+Face 15: A:17 B:12 C:13 AB:1 BC:1 CA:1
+Face 16: A:17 B:13 C:9 AB:1 BC:1 CA:1
+Face 17: A:9 B:13 C:3 AB:1 BC:1 CA:1
+Face 18: A:0 B:8 C:4 AB:1 BC:1 CA:1
+Face 19: A:8 B:9 C:18 AB:1 BC:1 CA:1
+Face 20: A:8 B:18 C:4 AB:1 BC:1 CA:1
+Face 21: A:4 B:18 C:5 AB:1 BC:1 CA:1
+Face 22: A:9 B:3 C:14 AB:1 BC:1 CA:1
+Face 23: A:9 B:14 C:18 AB:1 BC:1 CA:1
+Face 24: A:18 B:14 C:15 AB:1 BC:1 CA:1
+Face 25: A:18 B:15 C:5 AB:1 BC:1 CA:1
+Face 26: A:5 B:15 C:1 AB:1 BC:1 CA:1
+Face 27: A:1 B:15 C:10 AB:1 BC:1 CA:1
+Face 28: A:15 B:14 C:19 AB:1 BC:1 CA:1
+Face 29: A:15 B:19 C:10 AB:1 BC:1 CA:1
+Face 30: A:10 B:19 C:11 AB:1 BC:1 CA:1
+Face 31: A:14 B:3 C:13 AB:1 BC:1 CA:1
+Face 32: A:14 B:13 C:19 AB:1 BC:1 CA:1
+Face 33: A:19 B:13 C:12 AB:1 BC:1 CA:1
+Face 34: A:19 B:12 C:11 AB:1 BC:1 CA:1
+
+ Page 1
+
+
+
+Face 35: A:11 B:12 C:2 AB:1 BC:1 CA:1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page 2
+
+
+
--- mesa-7.0.3.orig/progs/ggi/torus.asc
+++ mesa-7.0.3/progs/ggi/torus.asc
@@ -0,0 +1,264 @@
+Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
+
+Named object: "Object01"
+Tri-mesh, Vertices: 40 Faces: 80
+Vertex list:
+Vertex 0: X: -50.170624 Y: -0.000026 Z: -240.147842
+Vertex 1: X: -80.584503 Y: -63.958851 Z: -205.014572
+Vertex 2: X: -129.795166 Y: -39.528744 Z: -148.16774
+Vertex 3: X: -129.795166 Y: 39.528721 Z: -148.16774
+Vertex 4: X: -80.584503 Y: 63.958797 Z: -205.014572
+Vertex 5: X: 85.963654 Y: -0.000002 Z: 31.490465
+Vertex 6: X: 39.614838 Y: -63.958828 Z: 34.827602
+Vertex 7: X: -35.37915 Y: -39.528728 Z: 40.227196
+Vertex 8: X: -35.37912 Y: 39.528736 Z: 40.227188
+Vertex 9: X: 39.614838 Y: 63.95882 Z: 34.827595
+Vertex 10: X: -9.852051 Y: 0.000023 Z: 319.829254
+Vertex 11: X: -44.985352 Y: -63.958805 Z: 289.415405
+Vertex 12: X: -101.832199 Y: -39.528709 Z: 240.204758
+Vertex 13: X: -101.832184 Y: 39.528755 Z: 240.204773
+Vertex 14: X: -44.985352 Y: 63.958843 Z: 289.415405
+Vertex 15: X: -281.490326 Y: 0.000035 Z: 455.963654
+Vertex 16: X: -284.827484 Y: -63.958794 Z: 409.614868
+Vertex 17: X: -290.227112 Y: -39.528702 Z: 334.62085
+Vertex 18: X: -290.227112 Y: 39.528763 Z: 334.62088
+Vertex 19: X: -284.827484 Y: 63.958855 Z: 409.614838
+Vertex 20: X: -569.829163 Y: 0.000026 Z: 360.14798
+Vertex 21: X: -539.415344 Y: -63.958801 Z: 325.014709
+Vertex 22: X: -490.204712 Y: -39.528709 Z: 268.167847
+Vertex 23: X: -490.204712 Y: 39.528755 Z: 268.167847
+Vertex 24: X: -539.415344 Y: 63.958847 Z: 325.014679
+Vertex 25: X: -705.963684 Y: 0.000002 Z: 88.509598
+Vertex 26: X: -659.614807 Y: -63.958824 Z: 85.172462
+Vertex 27: X: -584.62085 Y: -39.528725 Z: 79.77285
+Vertex 28: X: -584.62085 Y: 39.52874 Z: 79.77285
+Vertex 29: X: -659.614868 Y: 63.958824 Z: 85.172447
+Vertex 30: X: -610.147827 Y: -0.000023 Z: -199.829361
+Vertex 31: X: -575.014587 Y: -63.958847 Z: -169.415497
+Vertex 32: X: -518.167725 Y: -39.528744 Z: -120.204819
+Vertex 33: X: -518.167725 Y: 39.528721 Z: -120.204834
+Vertex 34: X: -575.014587 Y: 63.958801 Z: -169.415497
+Vertex 35: X: -338.509338 Y: -0.000035 Z: -335.963745
+Vertex 36: X: -335.172241 Y: -63.958858 Z: -289.614868
+Vertex 37: X: -329.772675 Y: -39.528751 Z: -214.620865
+Vertex 38: X: -329.772675 Y: 39.528713 Z: -214.620865
+Vertex 39: X: -335.172241 Y: 63.95879 Z: -289.614899
+Face list:
+Face 0: A:0 B:6 C:1 AB:0 BC:1 CA:1
+Smoothing: 1
+Face 1: A:0 B:5 C:6 AB:1 BC:1 CA:0
+Smoothing: 1
+Face 2: A:1 B:7 C:2 AB:0 BC:1 CA:1
+Smoothing: 2
+Face 3: A:1 B:6 C:7 AB:1 BC:1 CA:0
+Smoothing: 2
+Face 4: A:2 B:8 C:3 AB:0 BC:1 CA:1
+Smoothing: 3
+Face 5: A:2 B:7 C:8 AB:1 BC:1 CA:0
+Smoothing: 3
+Face 6: A:3 B:9 C:4 AB:0 BC:1 CA:1
+Smoothing: 4
+Face 7: A:3 B:8 C:9 AB:1 BC:1 CA:0
+
+ Page 1
+
+
+
+Smoothing: 4
+Face 8: A:4 B:5 C:0 AB:0 BC:1 CA:1
+Smoothing: 5
+Face 9: A:4 B:9 C:5 AB:1 BC:1 CA:0
+Smoothing: 5
+Face 10: A:5 B:11 C:6 AB:0 BC:1 CA:1
+Smoothing: 6
+Face 11: A:5 B:10 C:11 AB:1 BC:1 CA:0
+Smoothing: 6
+Face 12: A:6 B:12 C:7 AB:0 BC:1 CA:1
+Smoothing: 7
+Face 13: A:6 B:11 C:12 AB:1 BC:1 CA:0
+Smoothing: 7
+Face 14: A:7 B:13 C:8 AB:0 BC:1 CA:1
+Smoothing: 8
+Face 15: A:7 B:12 C:13 AB:1 BC:1 CA:0
+Smoothing: 8
+Face 16: A:8 B:14 C:9 AB:0 BC:1 CA:1
+Smoothing: 9
+Face 17: A:8 B:13 C:14 AB:1 BC:1 CA:0
+Smoothing: 9
+Face 18: A:9 B:10 C:5 AB:0 BC:1 CA:1
+Smoothing: 10
+Face 19: A:9 B:14 C:10 AB:1 BC:1 CA:0
+Smoothing: 10
+Face 20: A:10 B:16 C:11 AB:0 BC:1 CA:1
+Smoothing: 11
+Face 21: A:10 B:15 C:16 AB:1 BC:1 CA:0
+Smoothing: 11
+Face 22: A:11 B:17 C:12 AB:0 BC:1 CA:1
+Smoothing: 12
+Face 23: A:11 B:16 C:17 AB:1 BC:1 CA:0
+Smoothing: 12
+Face 24: A:12 B:18 C:13 AB:0 BC:1 CA:1
+Smoothing: 13
+Face 25: A:12 B:17 C:18 AB:1 BC:1 CA:0
+Smoothing: 13
+Face 26: A:13 B:19 C:14 AB:0 BC:1 CA:1
+Smoothing: 14
+Face 27: A:13 B:18 C:19 AB:1 BC:1 CA:0
+Smoothing: 14
+Face 28: A:14 B:15 C:10 AB:0 BC:1 CA:1
+Smoothing: 15
+Face 29: A:14 B:19 C:15 AB:1 BC:1 CA:0
+Smoothing: 15
+Face 30: A:15 B:21 C:16 AB:0 BC:1 CA:1
+Smoothing: 16
+Face 31: A:15 B:20 C:21 AB:1 BC:1 CA:0
+Smoothing: 16
+Face 32: A:16 B:22 C:17 AB:0 BC:1 CA:1
+Smoothing: 17
+Face 33: A:16 B:21 C:22 AB:1 BC:1 CA:0
+Smoothing: 17
+Face 34: A:17 B:23 C:18 AB:0 BC:1 CA:1
+Smoothing: 18
+Face 35: A:17 B:22 C:23 AB:1 BC:1 CA:0
+Smoothing: 18
+Face 36: A:18 B:24 C:19 AB:0 BC:1 CA:1
+Smoothing: 19
+Face 37: A:18 B:23 C:24 AB:1 BC:1 CA:0
+Smoothing: 19
+
+ Page 2
+
+
+
+Face 38: A:19 B:20 C:15 AB:0 BC:1 CA:1
+Smoothing: 20
+Face 39: A:19 B:24 C:20 AB:1 BC:1 CA:0
+Smoothing: 20
+Face 40: A:20 B:26 C:21 AB:0 BC:1 CA:1
+Smoothing: 21
+Face 41: A:20 B:25 C:26 AB:1 BC:1 CA:0
+Smoothing: 21
+Face 42: A:21 B:27 C:22 AB:0 BC:1 CA:1
+Smoothing: 22
+Face 43: A:21 B:26 C:27 AB:1 BC:1 CA:0
+Smoothing: 22
+Face 44: A:22 B:28 C:23 AB:0 BC:1 CA:1
+Smoothing: 23
+Face 45: A:22 B:27 C:28 AB:1 BC:1 CA:0
+Smoothing: 23
+Face 46: A:23 B:29 C:24 AB:0 BC:1 CA:1
+Smoothing: 24
+Face 47: A:23 B:28 C:29 AB:1 BC:1 CA:0
+Smoothing: 24
+Face 48: A:24 B:25 C:20 AB:0 BC:1 CA:1
+Smoothing: 25
+Face 49: A:24 B:29 C:25 AB:1 BC:1 CA:0
+Smoothing: 25
+Face 50: A:25 B:31 C:26 AB:0 BC:1 CA:1
+Smoothing: 26
+Face 51: A:25 B:30 C:31 AB:1 BC:1 CA:0
+Smoothing: 26
+Face 52: A:26 B:32 C:27 AB:0 BC:1 CA:1
+Smoothing: 27
+Face 53: A:26 B:31 C:32 AB:1 BC:1 CA:0
+Smoothing: 27
+Face 54: A:27 B:33 C:28 AB:0 BC:1 CA:1
+Smoothing: 28
+Face 55: A:27 B:32 C:33 AB:1 BC:1 CA:0
+Smoothing: 28
+Face 56: A:28 B:34 C:29 AB:0 BC:1 CA:1
+Smoothing: 29
+Face 57: A:28 B:33 C:34 AB:1 BC:1 CA:0
+Smoothing: 29
+Face 58: A:29 B:30 C:25 AB:0 BC:1 CA:1
+Smoothing: 30
+Face 59: A:29 B:34 C:30 AB:1 BC:1 CA:0
+Smoothing: 30
+Face 60: A:30 B:36 C:31 AB:0 BC:1 CA:1
+Smoothing: 31
+Face 61: A:30 B:35 C:36 AB:1 BC:1 CA:0
+Smoothing: 31
+Face 62: A:31 B:37 C:32 AB:0 BC:1 CA:1
+Smoothing: 32
+Face 63: A:31 B:36 C:37 AB:1 BC:1 CA:0
+Smoothing: 32
+Face 64: A:32 B:38 C:33 AB:0 BC:1 CA:1
+Smoothing: 1
+Face 65: A:32 B:37 C:38 AB:1 BC:1 CA:0
+Smoothing: 1
+Face 66: A:33 B:39 C:34 AB:0 BC:1 CA:1
+Smoothing: 2
+Face 67: A:33 B:38 C:39 AB:1 BC:1 CA:0
+Smoothing: 2
+Face 68: A:34 B:35 C:30 AB:0 BC:1 CA:1
+
+ Page 3
+
+
+
+Smoothing: 3
+Face 69: A:34 B:39 C:35 AB:1 BC:1 CA:0
+Smoothing: 3
+Face 70: A:35 B:1 C:36 AB:0 BC:1 CA:1
+Smoothing: 4
+Face 71: A:35 B:0 C:1 AB:1 BC:1 CA:0
+Smoothing: 4
+Face 72: A:36 B:2 C:37 AB:0 BC:1 CA:1
+Smoothing: 5
+Face 73: A:36 B:1 C:2 AB:1 BC:1 CA:0
+Smoothing: 5
+Face 74: A:37 B:3 C:38 AB:0 BC:1 CA:1
+Smoothing: 6
+Face 75: A:37 B:2 C:3 AB:1 BC:1 CA:0
+Smoothing: 6
+Face 76: A:38 B:4 C:39 AB:0 BC:1 CA:1
+Smoothing: 7
+Face 77: A:38 B:3 C:4 AB:1 BC:1 CA:0
+Smoothing: 7
+Face 78: A:39 B:0 C:35 AB:0 BC:1 CA:1
+Smoothing: 8
+Face 79: A:39 B:4 C:0 AB:1 BC:1 CA:0
+Smoothing: 8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page 4
+
+
+
--- mesa-7.0.3.orig/progs/ggi/tube.asc
+++ mesa-7.0.3/progs/ggi/tube.asc
@@ -0,0 +1,396 @@
+Ambient light color: Red=0.039216 Green=0.039216 Blue=0.039216
+
+Named object: "Object01"
+Tri-mesh, Vertices: 64 Faces: 128
+Vertex list:
+Vertex 0: X: 61.483898 Y: 37.836231 Z: -70.94294
+Vertex 1: X: 82.867447 Y: 37.836235 Z: -41.288902
+Vertex 2: X: 91.275154 Y: 37.836239 Z: -5.70901
+Vertex 3: X: 85.427025 Y: 37.836243 Z: 30.380013
+Vertex 4: X: 66.213379 Y: 37.836243 Z: 61.483936
+Vertex 5: X: 36.559322 Y: 37.836246 Z: 82.86747
+Vertex 6: X: 0.979424 Y: 37.836246 Z: 91.275154
+Vertex 7: X: -35.109554 Y: 37.836246 Z: 85.42701
+Vertex 8: X: -66.213478 Y: 37.836246 Z: 66.213356
+Vertex 9: X: -87.597 Y: 37.836243 Z: 36.559303
+Vertex 10: X: -96.004677 Y: 37.836239 Z: 0.979406
+Vertex 11: X: -90.156517 Y: 37.836235 Z: -35.109615
+Vertex 12: X: -70.942848 Y: 37.836235 Z: -66.213516
+Vertex 13: X: -41.288776 Y: 37.836231 Z: -87.597023
+Vertex 14: X: -5.708872 Y: 37.836231 Z: -96.004692
+Vertex 15: X: 30.380142 Y: 37.836231 Z: -90.156502
+Vertex 16: X: 61.483898 Y: -38.14529 Z: -70.942932
+Vertex 17: X: 82.867447 Y: -38.145287 Z: -41.288895
+Vertex 18: X: 91.275154 Y: -38.145283 Z: -5.709003
+Vertex 19: X: 85.427025 Y: -38.145279 Z: 30.38002
+Vertex 20: X: 66.213379 Y: -38.145279 Z: 61.483944
+Vertex 21: X: 36.559322 Y: -38.145275 Z: 82.867477
+Vertex 22: X: 0.979424 Y: -38.145275 Z: 91.275162
+Vertex 23: X: -35.109554 Y: -38.145275 Z: 85.427017
+Vertex 24: X: -66.213478 Y: -38.145275 Z: 66.213364
+Vertex 25: X: -87.597 Y: -38.145279 Z: 36.559311
+Vertex 26: X: -96.004677 Y: -38.145283 Z: 0.979412
+Vertex 27: X: -90.156517 Y: -38.145287 Z: -35.109608
+Vertex 28: X: -70.942848 Y: -38.145287 Z: -66.213516
+Vertex 29: X: -41.288776 Y: -38.14529 Z: -87.597015
+Vertex 30: X: -5.708872 Y: -38.14529 Z: -96.004684
+Vertex 31: X: 30.380142 Y: -38.14529 Z: -90.156494
+Vertex 32: X: 29.53923 Y: 37.836235 Z: -36.632011
+Vertex 33: X: 40.224194 Y: 37.836239 Z: -21.814436
+Vertex 34: X: 44.425369 Y: 37.836239 Z: -4.035822
+Vertex 35: X: 41.503166 Y: 37.836239 Z: 13.997195
+Vertex 36: X: 31.902466 Y: 37.836243 Z: 29.539249
+Vertex 37: X: 17.084883 Y: 37.836243 Z: 40.224201
+Vertex 38: X: -0.693734 Y: 37.836243 Z: 44.425365
+Vertex 39: X: -18.726728 Y: 37.836243 Z: 41.503159
+Vertex 40: X: -34.26878 Y: 37.836243 Z: 31.902454
+Vertex 41: X: -44.953732 Y: 37.836239 Z: 17.084871
+Vertex 42: X: -49.154892 Y: 37.836239 Z: -0.693745
+Vertex 43: X: -46.232677 Y: 37.836239 Z: -18.726759
+Vertex 44: X: -36.631962 Y: 37.836235 Z: -34.268806
+Vertex 45: X: -21.814371 Y: 37.836235 Z: -44.953747
+Vertex 46: X: -4.035751 Y: 37.836235 Z: -49.1549
+Vertex 47: X: 13.997261 Y: 37.836235 Z: -46.23267
+Vertex 48: X: 29.53923 Y: -38.145287 Z: -36.632004
+Vertex 49: X: 40.224194 Y: -38.145283 Z: -21.814428
+Vertex 50: X: 44.425369 Y: -38.145283 Z: -4.035816
+Vertex 51: X: 41.503166 Y: -38.145283 Z: 13.997201
+Vertex 52: X: 31.902466 Y: -38.145279 Z: 29.539257
+Vertex 53: X: 17.084883 Y: -38.145279 Z: 40.224209
+Vertex 54: X: -0.693734 Y: -38.145279 Z: 44.425373
+Vertex 55: X: -18.726728 Y: -38.145279 Z: 41.503166
+
+ Page 1
+
+
+
+Vertex 56: X: -34.26878 Y: -38.145279 Z: 31.902462
+Vertex 57: X: -44.953732 Y: -38.145283 Z: 17.084879
+Vertex 58: X: -49.154892 Y: -38.145283 Z: -0.693738
+Vertex 59: X: -46.232677 Y: -38.145283 Z: -18.726751
+Vertex 60: X: -36.631962 Y: -38.145287 Z: -34.268799
+Vertex 61: X: -21.814371 Y: -38.145287 Z: -44.953739
+Vertex 62: X: -4.035751 Y: -38.145287 Z: -49.154892
+Vertex 63: X: 13.997261 Y: -38.145287 Z: -46.232662
+Face list:
+Face 0: A:0 B:1 C:17 AB:1 BC:1 CA:0
+Smoothing: 1
+Face 1: A:0 B:17 C:16 AB:0 BC:1 CA:1
+Smoothing: 1
+Face 2: A:1 B:2 C:18 AB:1 BC:1 CA:0
+Smoothing: 2
+Face 3: A:1 B:18 C:17 AB:0 BC:1 CA:1
+Smoothing: 2
+Face 4: A:2 B:3 C:19 AB:1 BC:1 CA:0
+Smoothing: 3
+Face 5: A:2 B:19 C:18 AB:0 BC:1 CA:1
+Smoothing: 3
+Face 6: A:3 B:4 C:20 AB:1 BC:1 CA:0
+Smoothing: 4
+Face 7: A:3 B:20 C:19 AB:0 BC:1 CA:1
+Smoothing: 4
+Face 8: A:4 B:5 C:21 AB:1 BC:1 CA:0
+Smoothing: 5
+Face 9: A:4 B:21 C:20 AB:0 BC:1 CA:1
+Smoothing: 5
+Face 10: A:5 B:6 C:22 AB:1 BC:1 CA:0
+Smoothing: 6
+Face 11: A:5 B:22 C:21 AB:0 BC:1 CA:1
+Smoothing: 6
+Face 12: A:6 B:7 C:23 AB:1 BC:1 CA:0
+Smoothing: 7
+Face 13: A:6 B:23 C:22 AB:0 BC:1 CA:1
+Smoothing: 7
+Face 14: A:7 B:8 C:24 AB:1 BC:1 CA:0
+Smoothing: 8
+Face 15: A:7 B:24 C:23 AB:0 BC:1 CA:1
+Smoothing: 8
+Face 16: A:8 B:9 C:25 AB:1 BC:1 CA:0
+Smoothing: 9
+Face 17: A:8 B:25 C:24 AB:0 BC:1 CA:1
+Smoothing: 9
+Face 18: A:9 B:10 C:26 AB:1 BC:1 CA:0
+Smoothing: 10
+Face 19: A:9 B:26 C:25 AB:0 BC:1 CA:1
+Smoothing: 10
+Face 20: A:10 B:11 C:27 AB:1 BC:1 CA:0
+Smoothing: 11
+Face 21: A:10 B:27 C:26 AB:0 BC:1 CA:1
+Smoothing: 11
+Face 22: A:11 B:12 C:28 AB:1 BC:1 CA:0
+Smoothing: 12
+Face 23: A:11 B:28 C:27 AB:0 BC:1 CA:1
+Smoothing: 12
+Face 24: A:12 B:13 C:29 AB:1 BC:1 CA:0
+Smoothing: 13
+Face 25: A:12 B:29 C:28 AB:0 BC:1 CA:1
+Smoothing: 13
+
+ Page 2
+
+
+
+Face 26: A:13 B:14 C:30 AB:1 BC:1 CA:0
+Smoothing: 14
+Face 27: A:13 B:30 C:29 AB:0 BC:1 CA:1
+Smoothing: 14
+Face 28: A:14 B:15 C:31 AB:1 BC:1 CA:0
+Smoothing: 15
+Face 29: A:14 B:31 C:30 AB:0 BC:1 CA:1
+Smoothing: 15
+Face 30: A:15 B:0 C:16 AB:1 BC:1 CA:0
+Smoothing: 16
+Face 31: A:15 B:16 C:31 AB:0 BC:1 CA:1
+Smoothing: 16
+Face 32: A:32 B:49 C:33 AB:0 BC:1 CA:1
+Smoothing: 17
+Face 33: A:32 B:48 C:49 AB:1 BC:1 CA:0
+Smoothing: 17
+Face 34: A:33 B:50 C:34 AB:0 BC:1 CA:1
+Smoothing: 18
+Face 35: A:33 B:49 C:50 AB:1 BC:1 CA:0
+Smoothing: 18
+Face 36: A:34 B:51 C:35 AB:0 BC:1 CA:1
+Smoothing: 19
+Face 37: A:34 B:50 C:51 AB:1 BC:1 CA:0
+Smoothing: 19
+Face 38: A:35 B:52 C:36 AB:0 BC:1 CA:1
+Smoothing: 20
+Face 39: A:35 B:51 C:52 AB:1 BC:1 CA:0
+Smoothing: 20
+Face 40: A:36 B:53 C:37 AB:0 BC:1 CA:1
+Smoothing: 21
+Face 41: A:36 B:52 C:53 AB:1 BC:1 CA:0
+Smoothing: 21
+Face 42: A:37 B:54 C:38 AB:0 BC:1 CA:1
+Smoothing: 22
+Face 43: A:37 B:53 C:54 AB:1 BC:1 CA:0
+Smoothing: 22
+Face 44: A:38 B:55 C:39 AB:0 BC:1 CA:1
+Smoothing: 23
+Face 45: A:38 B:54 C:55 AB:1 BC:1 CA:0
+Smoothing: 23
+Face 46: A:39 B:56 C:40 AB:0 BC:1 CA:1
+Smoothing: 24
+Face 47: A:39 B:55 C:56 AB:1 BC:1 CA:0
+Smoothing: 24
+Face 48: A:40 B:57 C:41 AB:0 BC:1 CA:1
+Smoothing: 25
+Face 49: A:40 B:56 C:57 AB:1 BC:1 CA:0
+Smoothing: 25
+Face 50: A:41 B:58 C:42 AB:0 BC:1 CA:1
+Smoothing: 26
+Face 51: A:41 B:57 C:58 AB:1 BC:1 CA:0
+Smoothing: 26
+Face 52: A:42 B:59 C:43 AB:0 BC:1 CA:1
+Smoothing: 27
+Face 53: A:42 B:58 C:59 AB:1 BC:1 CA:0
+Smoothing: 27
+Face 54: A:43 B:60 C:44 AB:0 BC:1 CA:1
+Smoothing: 28
+Face 55: A:43 B:59 C:60 AB:1 BC:1 CA:0
+Smoothing: 28
+Face 56: A:44 B:61 C:45 AB:0 BC:1 CA:1
+
+ Page 3
+
+
+
+Smoothing: 29
+Face 57: A:44 B:60 C:61 AB:1 BC:1 CA:0
+Smoothing: 29
+Face 58: A:45 B:62 C:46 AB:0 BC:1 CA:1
+Smoothing: 30
+Face 59: A:45 B:61 C:62 AB:1 BC:1 CA:0
+Smoothing: 30
+Face 60: A:46 B:63 C:47 AB:0 BC:1 CA:1
+Smoothing: 31
+Face 61: A:46 B:62 C:63 AB:1 BC:1 CA:0
+Smoothing: 31
+Face 62: A:47 B:48 C:32 AB:0 BC:1 CA:1
+Smoothing: 32
+Face 63: A:47 B:63 C:48 AB:1 BC:1 CA:0
+Smoothing: 32
+Face 64: A:0 B:32 C:33 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 65: A:0 B:33 C:1 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 66: A:1 B:33 C:34 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 67: A:1 B:34 C:2 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 68: A:2 B:34 C:35 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 69: A:2 B:35 C:3 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 70: A:3 B:35 C:36 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 71: A:3 B:36 C:4 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 72: A:4 B:36 C:37 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 73: A:4 B:37 C:5 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 74: A:5 B:37 C:38 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 75: A:5 B:38 C:6 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 76: A:6 B:38 C:39 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 77: A:6 B:39 C:7 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 78: A:7 B:39 C:40 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 79: A:7 B:40 C:8 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 80: A:8 B:40 C:41 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 81: A:8 B:41 C:9 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 82: A:9 B:41 C:42 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 83: A:9 B:42 C:10 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 84: A:10 B:42 C:43 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 85: A:10 B:43 C:11 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 86: A:11 B:43 C:44 AB:0 BC:1 CA:0
+Smoothing: 1
+
+ Page 4
+
+
+
+Face 87: A:11 B:44 C:12 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 88: A:12 B:44 C:45 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 89: A:12 B:45 C:13 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 90: A:13 B:45 C:46 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 91: A:13 B:46 C:14 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 92: A:14 B:46 C:47 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 93: A:14 B:47 C:15 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 94: A:15 B:47 C:32 AB:0 BC:1 CA:0
+Smoothing: 1
+Face 95: A:15 B:32 C:0 AB:0 BC:0 CA:1
+Smoothing: 1
+Face 96: A:16 B:17 C:49 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 97: A:16 B:49 C:48 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 98: A:17 B:18 C:50 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 99: A:17 B:50 C:49 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 100: A:18 B:19 C:51 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 101: A:18 B:51 C:50 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 102: A:19 B:20 C:52 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 103: A:19 B:52 C:51 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 104: A:20 B:21 C:53 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 105: A:20 B:53 C:52 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 106: A:21 B:22 C:54 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 107: A:21 B:54 C:53 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 108: A:22 B:23 C:55 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 109: A:22 B:55 C:54 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 110: A:23 B:24 C:56 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 111: A:23 B:56 C:55 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 112: A:24 B:25 C:57 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 113: A:24 B:57 C:56 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 114: A:25 B:26 C:58 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 115: A:25 B:58 C:57 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 116: A:26 B:27 C:59 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 117: A:26 B:59 C:58 AB:0 BC:1 CA:0
+
+ Page 5
+
+
+
+Smoothing: 2
+Face 118: A:27 B:28 C:60 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 119: A:27 B:60 C:59 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 120: A:28 B:29 C:61 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 121: A:28 B:61 C:60 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 122: A:29 B:30 C:62 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 123: A:29 B:62 C:61 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 124: A:30 B:31 C:63 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 125: A:30 B:63 C:62 AB:0 BC:1 CA:0
+Smoothing: 2
+Face 126: A:31 B:16 C:48 AB:1 BC:0 CA:0
+Smoothing: 2
+Face 127: A:31 B:48 C:63 AB:0 BC:1 CA:0
+Smoothing: 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page 6
+
+
+
--- mesa-7.0.3.orig/progs/util/descrip.mms
+++ mesa-7.0.3/progs/util/descrip.mms
@@ -0,0 +1,42 @@
+# Makefile for GLUT-based demo programs for VMS
+# contributed by Jouk Jansen joukj@crys.chem.uva.nl
+
+
+.first
+ define gl [--.include.gl]
+
+.include [--]mms-config.
+
+##### MACROS #####
+
+INCDIR = ([--.include],[-.util])
+CFLAGS = /include=$(INCDIR)/prefix=all/name=(as_is,short)/float=ieee/ieee=denorm
+
+.ifdef SHARE
+GL_LIBS = $(XLIBS)
+LIB_DEP = [--.lib]$(GL_SHAR) [--.lib]$(GLU_SHAR) [--.lib]$(GLUT_SHAR)
+.else
+GL_LIBS = [--.lib]libGLUT/l,libMesaGLU/l,libMesaGL/l,$(XLIBS)
+LIB_DEP = [--.lib]$(GL_LIB) [--.lib]$(GLU_LIB) [--.lib]$(GLUT_LIB)
+.endif
+
+
+OBJS =readtex.obj,showbuffer.obj
+
+
+##### RULES #####
+.obj.exe :
+ cxxlink $(MMS$TARGET_NAME),$(GL_LIBS)
+
+##### TARGETS #####
+default :
+ $(MMS)$(MMSQUALIFIERS) $(OBJS)
+
+clean :
+ delete *.obj;*
+
+realclean :
+ delete *.obj;*
+
+readtex.obj : readtex.c
+showbuffer.obj : showbuffer.c
--- mesa-7.0.3.orig/progs/util/imagesgi.cpp
+++ mesa-7.0.3/progs/util/imagesgi.cpp
@@ -0,0 +1,369 @@
+/******************************************************************************
+** Filename : imageSgi.cpp
+** UNCLASSIFIED
+**
+** Description : Utility to read SGI image format files. This code was
+** originally a SGI image loading utility provided with the
+** Mesa 3D library @ http://www.mesa3d.org by Brain Paul.
+** This has been extended to read all SGI image formats
+** (e.g. INT, INTA, RGB, RGBA).
+**
+** Revision History:
+** Date Name Description
+** 06/07/99 BRC Initial Release
+**
+** Note:
+**
+** The SGI Image Data (if not RLE)
+**
+** If the image is stored verbatim (without RLE), then image data directly
+** follows the 512 byte header. The data for each scanline of the first
+** channel is written first. If the image has more than 1 channel, all
+** the data for the first channel is written, followed by the remaining
+** channels. If the BPC value is 1, then each scanline is written as XSIZE
+** bytes. If the BPC value is 2, then each scanline is written as XSIZE
+** shorts. These shorts are stored in the byte order described above.
+**
+******************************************************************************/
+#define __IMAGESGI_CPP
+
+#include "imagesgi.h"
+
+#include
+#include
+#include
+#include
+#include
+
+struct sImageSgiRaw
+{
+ struct sImageSgiHeader header;
+ unsigned char *chan0;
+ unsigned char *chan1;
+ unsigned char *chan2;
+ unsigned char *chan3;
+ unsigned int *rowStart;
+ int *rowSize;
+};
+
+// Static routines
+static struct sImageSgiRaw *ImageSgiRawOpen(char const * const fileName);
+static void ImageSgiRawClose(struct sImageSgiRaw *raw);
+static void ImageSgiRawGetRow(struct sImageSgiRaw *raw, unsigned char *buf,
+ int y, int z);
+static void ImageSgiRawGetData(struct sImageSgiRaw *raw, struct sImageSgi
+*final);
+static void *SwitchEndian16(void *value);
+static void *SwitchEndian32(void *value);
+
+// Static variables
+FILE *mFp = NULL;
+unsigned char *mChanTmp = NULL;
+
+
+/*****************************************************************************/
+struct sImageSgi *ImageSgiOpen(char const * const fileName)
+{
+ struct sImageSgiRaw *raw = NULL;
+ struct sImageSgi *final = NULL;
+
+ raw = ImageSgiRawOpen(fileName);
+ final = new struct sImageSgi;
+
+ assert(final);
+ if(final)
+ {
+ final->header = raw->header;
+ final->data = NULL;
+ ImageSgiRawGetData(raw, final);
+ ImageSgiRawClose(raw);
+ }
+
+ return final;
+} // ImageSgiRawOpen
+
+
+/*****************************************************************************/
+void ImageSgiClose(struct sImageSgi *image)
+{
+
+ if(image)
+ {
+ if(image->data)
+ delete[] image->data;
+ image->data = NULL;
+ delete image;
+ }
+ image = NULL;
+
+ return;
+} // ImageSgiClose
+
+
+/*****************************************************************************/
+static struct sImageSgiRaw *ImageSgiRawOpen(char const * const fileName)
+{
+ struct sImageSgiRaw *raw = NULL;
+ int x;
+ int i;
+ bool swapFlag = false;
+ union
+ {
+ int testWord;
+ char testByte[4];
+ } endianTest;
+ endianTest.testWord = 1;
+
+ // Determine endianess of platform.
+ if(endianTest.testByte[0] == 1)
+ swapFlag = true;
+ else
+ swapFlag = false;
+
+ raw = new struct sImageSgiRaw;
+
+ assert(raw);
+ if(raw)
+ {
+ raw->chan0 = NULL;
+ raw->chan1 = NULL;
+ raw->chan2 = NULL;
+ raw->chan3 = NULL;
+ raw->rowStart = NULL;
+ raw->rowSize = NULL;
+ mFp = fopen(fileName, "rb");
+ assert(mFp);
+
+ fread(&raw->header, sizeof(struct sImageSgiHeader), 1, mFp);
+ if(swapFlag == true)
+ {
+ SwitchEndian16(&raw->header.magic);
+ SwitchEndian16(&raw->header.type);
+ SwitchEndian16(&raw->header.dim);
+ SwitchEndian16(&raw->header.xsize);
+ SwitchEndian16(&raw->header.ysize);
+ SwitchEndian16(&raw->header.zsize);
+ }
+
+ mChanTmp = new unsigned char[raw->header.xsize * raw->header.ysize];
+ assert(mChanTmp);
+ switch(raw->header.zsize)
+ {
+ case 4:
+ raw->chan3 = new unsigned char[raw->header.xsize *
+raw->header.ysize];
+ assert(raw->chan3);
+ case 3:
+ raw->chan2 = new unsigned char[raw->header.xsize *
+raw->header.ysize];
+ assert(raw->chan2);
+ case 2:
+ raw->chan1 = new unsigned char[raw->header.xsize *
+raw->header.ysize];
+ assert(raw->chan1);
+ case 1:
+ raw->chan0 = new unsigned char[raw->header.xsize *
+raw->header.ysize];
+ assert(raw->chan0);
+ }
+
+ if(raw->header.type == IMAGE_SGI_TYPE_RLE)
+ {
+ x = raw->header.ysize * raw->header.zsize * sizeof(unsigned int);
+ raw->rowStart = new unsigned int[x];
+ raw->rowSize = new int[x];
+
+ fseek(mFp, sizeof(struct sImageSgiHeader), SEEK_SET);
+ fread(raw->rowStart, 1, x, mFp);
+ fread(raw->rowSize, 1, x, mFp);
+
+ if(swapFlag == true)
+ {
+ for(i=0; irowStart[i]);
+ for(i=0; irowSize[i]);
+ }
+
+ }
+
+ }
+
+ return raw;
+} // ImageSgiRawOpen
+
+
+/*****************************************************************************/
+static void ImageSgiRawClose(struct sImageSgiRaw *raw)
+{
+
+ fclose(mFp);
+ mFp = NULL;
+
+ if(mChanTmp)
+ delete[] mChanTmp;
+ mChanTmp = NULL;
+
+ if(raw->chan0)
+ delete[] raw->chan0;
+ raw->chan0 = NULL;
+
+ if(raw->chan1)
+ delete[] raw->chan1;
+ raw->chan1 = NULL;
+
+ if(raw->chan2)
+ delete[] raw->chan2;
+ raw->chan2 = NULL;
+
+ if(raw->chan3)
+ delete[] raw->chan3;
+ raw->chan3 = NULL;
+
+ if(raw)
+ delete raw;
+ raw = NULL;
+
+ return;
+} // ImageSgiRawClose
+
+
+/*****************************************************************************/
+static void ImageSgiRawGetRow(struct sImageSgiRaw *raw, unsigned char *buf,
+ int y, int z)
+{
+ unsigned char *iPtr = NULL;
+ unsigned char *oPtr = NULL;
+ unsigned char pixel;
+ int count;
+
+ if((raw->header.type & 0xFF00) == 0x0100)
+ {
+ fseek(mFp, raw->rowStart[y+z*raw->header.ysize], SEEK_SET);
+ fread(mChanTmp, 1, (unsigned int)raw->rowSize[y+z*raw->header.ysize],
+mFp);
+ iPtr = mChanTmp;
+ oPtr = buf;
+ while(1)
+ {
+ pixel = *iPtr++;
+ count = (int)(pixel & 0x7F);
+ if(!count)
+ {
+ return;
+ }
+ if (pixel & 0x80)
+ {
+ while (count--)
+ {
+ *oPtr++ = *iPtr++;
+ }
+ }
+ else
+ {
+ pixel = *iPtr++;
+ while (count--)
+ {
+ *oPtr++ = pixel;
+ }
+ }
+ }
+ }
+ else
+ {
+ fseek(mFp,
+ sizeof(struct sImageSgiHeader)+(y*raw->header.xsize) +
+ (z*raw->header.xsize*raw->header.ysize),
+ SEEK_SET);
+ fread(buf, 1, raw->header.xsize, mFp);
+ }
+
+ return;
+} // ImageSgiRawGetRow
+
+
+/*****************************************************************************/
+static void ImageSgiRawGetData(struct sImageSgiRaw *raw, struct sImageSgi
+*final)
+{
+ unsigned char *ptr = NULL;
+ int i, j;
+
+ final->data =
+ new unsigned
+char[raw->header.xsize*raw->header.ysize*raw->header.zsize];
+ assert(final->data);
+
+ ptr = final->data;
+ for(i=0; iheader.ysize; i++)
+ {
+ switch(raw->header.zsize)
+ {
+ case 1:
+ ImageSgiRawGetRow(raw, raw->chan0, i, 0);
+ for(j=0; jheader.xsize; j++)
+ *(ptr++) = raw->chan0[j];
+ break;
+ case 2:
+ ImageSgiRawGetRow(raw, raw->chan0, i, 0);
+ ImageSgiRawGetRow(raw, raw->chan1, i, 1);
+ for(j=0; jheader.xsize; j++)
+ {
+ *(ptr++) = raw->chan0[j];
+ *(ptr++) = raw->chan1[j];
+ }
+ break;
+ case 3:
+ ImageSgiRawGetRow(raw, raw->chan0, i, 0);
+ ImageSgiRawGetRow(raw, raw->chan1, i, 1);
+ ImageSgiRawGetRow(raw, raw->chan2, i, 2);
+ for(j=0; jheader.xsize; j++)
+ {
+ *(ptr++) = raw->chan0[j];
+ *(ptr++) = raw->chan1[j];
+ *(ptr++) = raw->chan2[j];
+ }
+ break;
+ case 4:
+ ImageSgiRawGetRow(raw, raw->chan0, i, 0);
+ ImageSgiRawGetRow(raw, raw->chan1, i, 1);
+ ImageSgiRawGetRow(raw, raw->chan2, i, 2);
+ ImageSgiRawGetRow(raw, raw->chan3, i, 3);
+ for(j=0; jheader.xsize; j++)
+ {
+ *(ptr++) = raw->chan0[j];
+ *(ptr++) = raw->chan1[j];
+ *(ptr++) = raw->chan2[j];
+ *(ptr++) = raw->chan3[j];
+ }
+ break;
+ }
+ }
+
+ return;
+} // ImageSgiRawGetData
+
+
+/*****************************************************************************/
+static void *SwitchEndian16(void *value)
+{
+ short value16 = *(short *) value;
+ value16 = ((value16 & 0xff00) >> 8L) +
+ ((value16 & 0x00ff) << 8L);
+ *(short *)value = value16;
+ return value;
+} // SwitchEndian16
+
+
+/*****************************************************************************/
+static void *SwitchEndian32(void *value)
+{
+ int value32 = *(int *) value;
+ value32 = ((value32 & 0xff000000) >> 24L) +
+ ((value32 & 0x00ff0000) >> 8) +
+ ((value32 & 0x0000ff00) << 8) +
+ ((value32 & 0x000000ff) << 24L);
+ *(int *)value = value32;
+ return value;
+} // SwitchEndian32
+
--- mesa-7.0.3.orig/progs/util/xrotfont.c
+++ mesa-7.0.3/progs/util/xrotfont.c
@@ -0,0 +1,368 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2004 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.
+ */
+
+
+/*
+ * glXUseRotatedXFontMESA() function - like glXUseXFont() but allows
+ * specification of a 0, 90, 180 or 270 degree rotation.
+ * Handy for drawing labels along vertical axes of graphs, etc.
+ *
+ * Based on Mesa's glXUseXFont code written and copyrighted by Thorsten Ohl.
+ */
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+
+/**
+ * Generate OpenGL-compatible bitmap by drawing an X character glyph
+ * to an off-screen pixmap, then getting the image and testing pixels.
+ * \param width bitmap width in pixels
+ * \param height bitmap height in pixels
+ */
+static void
+fill_bitmap(Display *dpy, Pixmap pixmap, GC gc,
+ unsigned int bitmapWidth, unsigned int bitmapHeight,
+ unsigned int charWidth, unsigned int charHeight,
+ int xPos, int yPos, unsigned int c, GLubyte * bitmap,
+ int rotation)
+{
+ const int bytesPerRow = (bitmapWidth + 7) / 8;
+ XImage *image;
+ XChar2b char2b;
+
+ /* clear pixmap to 0 */
+ XSetForeground(dpy, gc, 0);
+ XFillRectangle(dpy, pixmap, gc, 0, 0, charWidth, charHeight);
+
+ /* The glyph is drawn snug up against the left/top edges of the pixmap */
+ XSetForeground(dpy, gc, 1);
+ char2b.byte1 = (c >> 8) & 0xff;
+ char2b.byte2 = (c & 0xff);
+ XDrawString16(dpy, pixmap, gc, xPos, yPos, &char2b, 1);
+
+ /* initialize GL bitmap */
+ memset(bitmap, 0, bytesPerRow * bitmapHeight);
+
+ image = XGetImage(dpy, pixmap, 0, 0, charWidth, charHeight, 1, XYPixmap);
+ if (image) {
+ /* Set appropriate bits in the GL bitmap.
+ * Note: X11 and OpenGL are upside down wrt each other).
+ */
+ unsigned int x, y;
+ if (rotation == 0) {
+ for (y = 0; y < charHeight; y++) {
+ for (x = 0; x < charWidth; x++) {
+ if (XGetPixel(image, x, y)) {
+ int y2 = bitmapHeight - y - 1;
+ bitmap[bytesPerRow * y2 + x / 8] |= (1 << (7 - (x % 8)));
+ }
+ }
+ }
+ }
+ else if (rotation == 90) {
+ for (y = 0; y < charHeight; y++) {
+ for (x = 0; x < charWidth; x++) {
+ if (XGetPixel(image, x, y)) {
+ int x2 = y;
+ int y2 = x;
+ bitmap[bytesPerRow * y2 + x2 / 8] |= (1 << (7 - (x2 % 8)));
+ }
+ }
+ }
+ }
+ else if (rotation == 180) {
+ for (y = 0; y < charHeight; y++) {
+ for (x = 0; x < charWidth; x++) {
+ if (XGetPixel(image, x, y)) {
+ int x2 = charWidth - x - 1;
+ bitmap[bytesPerRow * y + x2 / 8] |= (1 << (7 - (x2 % 8)));
+ }
+ }
+ }
+ }
+ else {
+ for (y = 0; y < charHeight; y++) {
+ for (x = 0; x < charWidth; x++) {
+ if (XGetPixel(image, x, y)) {
+ int x2 = charHeight - y - 1;
+ int y2 = charWidth - x - 1;
+ bitmap[bytesPerRow * y2 + x2 / 8] |= (1 << (7 - (x2 % 8)));
+ }
+ }
+ }
+ }
+ XDestroyImage(image);
+ }
+}
+
+
+/**
+ * Determine if a given glyph is valid and return the
+ * corresponding XCharStruct.
+ */
+static const XCharStruct *
+isvalid(const XFontStruct * fs, unsigned int which)
+{
+ unsigned int rows, pages;
+ unsigned int byte1 = 0, byte2 = 0;
+ int i, valid = 1;
+
+ rows = fs->max_byte1 - fs->min_byte1 + 1;
+ pages = fs->max_char_or_byte2 - fs->min_char_or_byte2 + 1;
+
+ if (rows == 1) {
+ /* "linear" fonts */
+ if ((fs->min_char_or_byte2 > which) || (fs->max_char_or_byte2 < which))
+ valid = 0;
+ }
+ else {
+ /* "matrix" fonts */
+ byte2 = which & 0xff;
+ byte1 = which >> 8;
+ if ((fs->min_char_or_byte2 > byte2) ||
+ (fs->max_char_or_byte2 < byte2) ||
+ (fs->min_byte1 > byte1) || (fs->max_byte1 < byte1))
+ valid = 0;
+ }
+
+ if (valid) {
+ if (fs->per_char) {
+ if (rows == 1) {
+ /* "linear" fonts */
+ return fs->per_char + (which - fs->min_char_or_byte2);
+ }
+ else {
+ /* "matrix" fonts */
+ i = ((byte1 - fs->min_byte1) * pages) +
+ (byte2 - fs->min_char_or_byte2);
+ return fs->per_char + i;
+ }
+ }
+ else {
+ return &fs->min_bounds;
+ }
+ }
+ return NULL;
+}
+
+
+/**
+ * Just like glXUseXFont() but with a rotation parameter.
+ * \param rotation may be 0, 90, 180 or 270 only.
+ */
+void
+glXUseRotatedXFontMESA(Font font, int first, int count, int listbase,
+ int rotation)
+{
+ Display *dpy;
+ Window win;
+ Pixmap pixmap;
+ GC gc;
+ XFontStruct *fs;
+ GLint swapbytes, lsbfirst, rowlength;
+ GLint skiprows, skippixels, alignment;
+ unsigned int maxCharWidth, maxCharHeight;
+ GLubyte *bm;
+ int i;
+
+ if (rotation != 0 &&
+ rotation != 90 &&
+ rotation != 180 &&
+ rotation != 270)
+ return;
+
+ dpy = glXGetCurrentDisplay();
+ if (!dpy)
+ return; /* I guess glXMakeCurrent wasn't called */
+ win = RootWindow(dpy, DefaultScreen(dpy));
+
+ fs = XQueryFont(dpy, font);
+ if (!fs) {
+ fprintf(stderr, "XQueryFont failed");
+ return;
+ }
+
+ /* Allocate a GL bitmap that can fit any character */
+ maxCharWidth = fs->max_bounds.rbearing - fs->min_bounds.lbearing;
+ maxCharHeight = fs->max_bounds.ascent + fs->max_bounds.descent;
+ /* use max, in case we're rotating */
+ if (rotation == 90 || rotation == 270) {
+ /* swap width/height */
+ bm = (GLubyte *) malloc((maxCharHeight + 7) / 8 * maxCharWidth);
+ }
+ else {
+ /* normal or upside down */
+ bm = (GLubyte *) malloc((maxCharWidth + 7) / 8 * maxCharHeight);
+ }
+ if (!bm) {
+ XFreeFontInfo(NULL, fs, 1);
+ fprintf(stderr, "Out of memory in glXUseRotatedXFontMESA");
+ return;
+ }
+
+ /* Save the current packing mode for bitmaps. */
+ glGetIntegerv(GL_UNPACK_SWAP_BYTES, &swapbytes);
+ glGetIntegerv(GL_UNPACK_LSB_FIRST, &lsbfirst);
+ glGetIntegerv(GL_UNPACK_ROW_LENGTH, &rowlength);
+ glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skiprows);
+ glGetIntegerv(GL_UNPACK_SKIP_PIXELS, &skippixels);
+ glGetIntegerv(GL_UNPACK_ALIGNMENT, &alignment);
+
+ /* Enforce a standard packing mode which is compatible with
+ fill_bitmap() from above. This is actually the default mode,
+ except for the (non)alignment. */
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ /* Create pixmap and GC */
+ pixmap = XCreatePixmap(dpy, win, maxCharWidth, maxCharHeight, 1);
+ {
+ XGCValues values;
+ unsigned long valuemask;
+ values.foreground = BlackPixel(dpy, DefaultScreen(dpy));
+ values.background = WhitePixel(dpy, DefaultScreen(dpy));
+ values.font = fs->fid;
+ valuemask = GCForeground | GCBackground | GCFont;
+ gc = XCreateGC(dpy, pixmap, valuemask, &values);
+ }
+
+ for (i = 0; i < count; i++) {
+ const unsigned int c = first + i;
+ const int list = listbase + i;
+ unsigned int charWidth, charHeight;
+ unsigned int bitmapWidth, bitmapHeight;
+ GLfloat xOrig, yOrig, xStep, yStep, dtemp;
+ const XCharStruct *ch;
+ int xPos, yPos;
+ int valid;
+
+ /* check on index validity and get the bounds */
+ ch = isvalid(fs, c);
+ if (!ch) {
+ ch = &fs->max_bounds;
+ valid = 0;
+ }
+ else {
+ valid = 1;
+ }
+
+ /* glBitmap()' parameters:
+ straight from the glXUseXFont(3) manpage. */
+ charWidth = ch->rbearing - ch->lbearing;
+ charHeight = ch->ascent + ch->descent;
+ xOrig = -ch->lbearing;
+ yOrig = ch->descent;
+ xStep = ch->width;
+ yStep = 0;
+
+ /* X11's starting point. */
+ xPos = -ch->lbearing;
+ yPos = ch->ascent;
+
+ /* Apply rotation */
+ switch (rotation) {
+ case 0:
+ /* nothing */
+ bitmapWidth = charWidth;
+ bitmapHeight = charHeight;
+ break;
+ case 90:
+ /* xStep, yStep */
+ dtemp = xStep;
+ xStep = -yStep;
+ yStep = dtemp;
+ /* xOrig, yOrig */
+ yOrig = xOrig;
+ xOrig = charHeight - (charHeight - yPos);
+ /* width, height */
+ bitmapWidth = charHeight;
+ bitmapHeight = charWidth;
+ break;
+ case 180:
+ /* xStep, yStep */
+ xStep = -xStep;
+ yStep = -yStep;
+ /* xOrig, yOrig */
+ xOrig = charWidth - xOrig - 1;
+ yOrig = charHeight - yOrig - 1;
+ bitmapWidth = charWidth;
+ bitmapHeight = charHeight;
+ break;
+ case 270:
+ /* xStep, yStep */
+ dtemp = xStep;
+ xStep = yStep;
+ yStep = -dtemp;
+ /* xOrig, yOrig */
+ dtemp = yOrig;
+ yOrig = charWidth - xOrig;
+ xOrig = dtemp;
+ /* width, height */
+ bitmapWidth = charHeight;
+ bitmapHeight = charWidth;
+ break;
+ default:
+ /* should never get here */
+ ;
+ }
+
+ glNewList(list, GL_COMPILE);
+ if (valid && bitmapWidth > 0 && bitmapHeight > 0) {
+
+ fill_bitmap(dpy, pixmap, gc, bitmapWidth, bitmapHeight,
+ charWidth, charHeight,
+ xPos, yPos, c, bm, rotation);
+
+ glBitmap(bitmapWidth, bitmapHeight, xOrig, yOrig, xStep, yStep, bm);
+ }
+ else {
+ glBitmap(0, 0, 0.0, 0.0, xStep, yStep, NULL);
+ }
+ glEndList();
+ }
+
+ free(bm);
+ XFreeFontInfo(NULL, fs, 1);
+ XFreePixmap(dpy, pixmap);
+ XFreeGC(dpy, gc);
+
+ /* Restore saved packing modes. */
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, swapbytes);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, lsbfirst);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, rowlength);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, skiprows);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, skippixels);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, alignment);
+}
--- mesa-7.0.3.orig/progs/xdemos/glxgears2.c
+++ mesa-7.0.3/progs/xdemos/glxgears2.c
@@ -0,0 +1,522 @@
+/*
+ * Copyright (C) 1999-2001 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.
+ */
+
+/*
+ * This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT)
+ * Port by Brian Paul 23 March 2001
+ *
+ * Command line options:
+ * -info print GL implementation information
+ *
+ */
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+#define BENCHMARK
+
+#ifdef BENCHMARK
+
+/* XXX this probably isn't very portable */
+
+#include
+#include
+
+/* return current time (in seconds) */
+static int
+current_time(void)
+{
+ struct timeval tv;
+#ifdef __VMS
+ (void) gettimeofday(&tv, NULL );
+#else
+ struct timezone tz;
+ (void) gettimeofday(&tv, &tz);
+#endif
+ return (int) tv.tv_sec;
+}
+
+#else /*BENCHMARK*/
+
+/* dummy */
+static int
+current_time(void)
+{
+ return 0;
+}
+
+#endif /*BENCHMARK*/
+
+
+
+#ifndef M_PI
+#define M_PI 3.14159265
+#endif
+
+
+static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0;
+static GLint gear1, gear2, gear3;
+static GLfloat angle = 0.0;
+static GLint WinWidth = 300, WinHeight = 300;
+
+/*
+ *
+ * Draw a gear wheel. You'll probably want to call this function when
+ * building a display list since we do a lot of trig here.
+ *
+ * Input: inner_radius - radius of hole at center
+ * outer_radius - radius at center of teeth
+ * width - width of gear
+ * teeth - number of teeth
+ * tooth_depth - depth of tooth
+ */
+static void
+gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width,
+ GLint teeth, GLfloat tooth_depth)
+{
+ GLint i;
+ GLfloat r0, r1, r2;
+ GLfloat angle, da;
+ GLfloat u, v, len;
+
+ r0 = inner_radius;
+ r1 = outer_radius - tooth_depth / 2.0;
+ r2 = outer_radius + tooth_depth / 2.0;
+
+ da = 2.0 * M_PI / teeth / 4.0;
+
+ glShadeModel(GL_FLAT);
+
+ glNormal3f(0.0, 0.0, 1.0);
+
+ /* draw front face */
+ glBegin(GL_QUAD_STRIP);
+ for (i = 0; i <= teeth; i++) {
+ angle = i * 2.0 * M_PI / teeth;
+ glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
+ glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
+ if (i < teeth) {
+ glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
+ glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
+ width * 0.5);
+ }
+ }
+ glEnd();
+
+ /* draw front sides of teeth */
+ glBegin(GL_QUADS);
+ da = 2.0 * M_PI / teeth / 4.0;
+ for (i = 0; i < teeth; i++) {
+ angle = i * 2.0 * M_PI / teeth;
+
+ glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
+ glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
+ glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
+ width * 0.5);
+ glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
+ width * 0.5);
+ }
+ glEnd();
+
+ glNormal3f(0.0, 0.0, -1.0);
+
+ /* draw back face */
+ glBegin(GL_QUAD_STRIP);
+ for (i = 0; i <= teeth; i++) {
+ angle = i * 2.0 * M_PI / teeth;
+ glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
+ glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
+ if (i < teeth) {
+ glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
+ -width * 0.5);
+ glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
+ }
+ }
+ glEnd();
+
+ /* draw back sides of teeth */
+ glBegin(GL_QUADS);
+ da = 2.0 * M_PI / teeth / 4.0;
+ for (i = 0; i < teeth; i++) {
+ angle = i * 2.0 * M_PI / teeth;
+
+ glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
+ -width * 0.5);
+ glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
+ -width * 0.5);
+ glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
+ glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
+ }
+ glEnd();
+
+ /* draw outward faces of teeth */
+ glBegin(GL_QUAD_STRIP);
+ for (i = 0; i < teeth; i++) {
+ angle = i * 2.0 * M_PI / teeth;
+
+ glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5);
+ glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5);
+ u = r2 * cos(angle + da) - r1 * cos(angle);
+ v = r2 * sin(angle + da) - r1 * sin(angle);
+ len = sqrt(u * u + v * v);
+ u /= len;
+ v /= len;
+ glNormal3f(v, -u, 0.0);
+ glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5);
+ glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5);
+ glNormal3f(cos(angle), sin(angle), 0.0);
+ glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
+ width * 0.5);
+ glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da),
+ -width * 0.5);
+ u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da);
+ v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da);
+ glNormal3f(v, -u, 0.0);
+ glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
+ width * 0.5);
+ glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da),
+ -width * 0.5);
+ glNormal3f(cos(angle), sin(angle), 0.0);
+ }
+
+ glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5);
+ glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5);
+
+ glEnd();
+
+ glShadeModel(GL_SMOOTH);
+
+ /* draw inside radius cylinder */
+ glBegin(GL_QUAD_STRIP);
+ for (i = 0; i <= teeth; i++) {
+ angle = i * 2.0 * M_PI / teeth;
+ glNormal3f(-cos(angle), -sin(angle), 0.0);
+ glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5);
+ glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5);
+ }
+ glEnd();
+}
+
+
+static void
+draw(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glPushMatrix();
+ glRotatef(view_rotx, 1.0, 0.0, 0.0);
+ glRotatef(view_roty, 0.0, 1.0, 0.0);
+ glRotatef(view_rotz, 0.0, 0.0, 1.0);
+
+ glPushMatrix();
+ glTranslatef(-3.0, -2.0, 0.0);
+ glRotatef(angle, 0.0, 0.0, 1.0);
+ glCallList(gear1);
+ glPopMatrix();
+
+ glPushMatrix();
+ glTranslatef(3.1, -2.0, 0.0);
+ glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0);
+ glCallList(gear2);
+ glPopMatrix();
+
+ glPushMatrix();
+ glTranslatef(-3.1, 4.2, 0.0);
+ glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0);
+ glCallList(gear3);
+ glPopMatrix();
+
+ glPopMatrix();
+}
+
+
+/* new window size or exposure */
+static void
+reshape(int width, int height)
+{
+ GLfloat h = (GLfloat) height / (GLfloat) width;
+
+ glViewport(0, 0, (GLint) width, (GLint) height);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0);
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
+ glTranslatef(0.0, 0.0, -40.0);
+ WinWidth = width;
+ WinHeight = height;
+}
+
+
+static void
+init(void)
+{
+ static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 };
+ static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 };
+ static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 };
+ static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 };
+
+ glClearColor(1, 0, 0, 0);
+
+ glLightfv(GL_LIGHT0, GL_POSITION, pos);
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_LIGHTING);
+ glEnable(GL_LIGHT0);
+ glEnable(GL_DEPTH_TEST);
+
+ /* make the gears */
+ gear1 = glGenLists(1);
+ glNewList(gear1, GL_COMPILE);
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
+ gear(1.0, 4.0, 1.0, 20, 0.7);
+ glEndList();
+
+ gear2 = glGenLists(1);
+ glNewList(gear2, GL_COMPILE);
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green);
+ gear(0.5, 2.0, 2.0, 10, 0.7);
+ glEndList();
+
+ gear3 = glGenLists(1);
+ glNewList(gear3, GL_COMPILE);
+ glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue);
+ gear(1.3, 2.0, 0.5, 10, 0.7);
+ glEndList();
+
+ glEnable(GL_NORMALIZE);
+}
+
+
+/*
+ * Create an RGB, double-buffered window.
+ * Return the window and context handles.
+ */
+static void
+make_window( Display *dpy, const char *name,
+ int x, int y, int width, int height,
+ Window *winRet, GLXContext *ctxRet)
+{
+ int attrib[] = { GLX_RGBA,
+ GLX_RED_SIZE, 1,
+ GLX_GREEN_SIZE, 1,
+ GLX_BLUE_SIZE, 1,
+ GLX_DOUBLEBUFFER,
+ GLX_DEPTH_SIZE, 1,
+ None };
+ int scrnum;
+ XSetWindowAttributes attr;
+ unsigned long mask;
+ Window root;
+ Window win;
+ GLXContext ctx;
+ XVisualInfo *visinfo;
+
+ scrnum = DefaultScreen( dpy );
+ root = RootWindow( dpy, scrnum );
+
+ visinfo = glXChooseVisual( dpy, scrnum, attrib );
+ if (!visinfo) {
+ printf("Error: couldn't get an RGB, Double-buffered visual\n");
+ exit(1);
+ }
+
+ /* window attributes */
+ attr.background_pixel = 0;
+ attr.border_pixel = 0;
+ attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone);
+ attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
+ mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
+
+ win = XCreateWindow( dpy, root, 0, 0, width, height,
+ 0, visinfo->depth, InputOutput,
+ visinfo->visual, mask, &attr );
+
+ /* set hints and properties */
+ {
+ XSizeHints sizehints;
+ sizehints.x = x;
+ sizehints.y = y;
+ sizehints.width = width;
+ sizehints.height = height;
+ sizehints.flags = USSize | USPosition;
+ XSetNormalHints(dpy, win, &sizehints);
+ XSetStandardProperties(dpy, win, name, name,
+ None, (char **)NULL, 0, &sizehints);
+ }
+
+ ctx = glXCreateContext( dpy, visinfo, NULL, True );
+ if (!ctx) {
+ printf("Error: glXCreateContext failed\n");
+ exit(1);
+ }
+
+ XFree(visinfo);
+
+ *winRet = win;
+ *ctxRet = ctx;
+}
+
+
+static void
+event_loop(Display *dpy, Window win)
+{
+ while (1) {
+ while (XPending(dpy) > 0) {
+ XEvent event;
+ XNextEvent(dpy, &event);
+ switch (event.type) {
+ case Expose:
+ /* we'll redraw below */
+ break;
+ case ConfigureNotify:
+ reshape(event.xconfigure.width, event.xconfigure.height);
+ break;
+ case KeyPress:
+ {
+ char buffer[10];
+ int r, code;
+ code = XLookupKeysym(&event.xkey, 0);
+ if (code == XK_Left) {
+ view_roty += 5.0;
+ }
+ else if (code == XK_Right) {
+ view_roty -= 5.0;
+ }
+ else if (code == XK_Up) {
+ view_rotx += 5.0;
+ }
+ else if (code == XK_Down) {
+ view_rotx -= 5.0;
+ }
+ else {
+ r = XLookupString(&event.xkey, buffer, sizeof(buffer),
+ NULL, NULL);
+ if (buffer[0] == 27) {
+ /* escape */
+ return;
+ }
+ }
+ }
+ }
+ }
+
+ /* next frame */
+ angle += 2.0;
+
+ draw();
+
+#if 0
+ glXSwapBuffers(dpy, win);
+#else
+ {
+ GLfloat c[4];
+
+ glReadBuffer(GL_BACK);
+
+ glReadPixels(WinWidth-1, 0, 1, 1, GL_RGB, GL_FLOAT, c);
+ printf("Bottom right pixel color: %g, %g, %g\n", c[0], c[1], c[2]);
+
+ glDrawBuffer(GL_FRONT);
+ glWindowPos2iARB(0,0);
+ glCopyPixels(WinWidth/2, 0, WinWidth/2, WinHeight, GL_COLOR);
+ glDrawBuffer(GL_BACK);
+ }
+#endif
+
+ /* calc framerate */
+ {
+ static int t0 = -1;
+ static int frames = 0;
+ int t = current_time();
+
+ if (t0 < 0)
+ t0 = t;
+
+ frames++;
+
+ if (t - t0 >= 5.0) {
+ GLfloat seconds = t - t0;
+ GLfloat fps = frames / seconds;
+ printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds,
+ fps);
+ t0 = t;
+ frames = 0;
+ }
+ }
+ }
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ Display *dpy;
+ Window win;
+ GLXContext ctx;
+ char *dpyName = ":0";
+ GLboolean printInfo = GL_FALSE;
+ int i;
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-display") == 0) {
+ dpyName = argv[i+1];
+ i++;
+ }
+ else if (strcmp(argv[i], "-info") == 0) {
+ printInfo = GL_TRUE;
+ }
+ }
+
+ dpy = XOpenDisplay(dpyName);
+ if (!dpy) {
+ printf("Error: couldn't open display %s\n", dpyName);
+ return -1;
+ }
+
+ make_window(dpy, "glxgears", 0, 0, WinWidth, WinHeight, &win, &ctx);
+ XMapWindow(dpy, win);
+ glXMakeCurrent(dpy, win, ctx);
+
+ if (printInfo) {
+ printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
+ printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
+ printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
+ printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS));
+ }
+
+ init();
+
+ event_loop(dpy, win);
+
+ glXDestroyContext(dpy, ctx);
+ XDestroyWindow(dpy, win);
+ XCloseDisplay(dpy);
+
+ return 0;
+}
--- mesa-7.0.3.orig/src/glu/sgi/libutil/mipmap.c
+++ mesa-7.0.3/src/glu/sgi/libutil/mipmap.c
@@ -6627,7 +6627,7 @@
static TexImage3Dproc pTexImage3D = 0;
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(__WIN32__)
# include
# include
#else
@@ -6642,7 +6642,7 @@
const GLvoid *pixels )
{
if (!pTexImage3D) {
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__WIN32__)
pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3D");
if (!pTexImage3D)
pTexImage3D = (TexImage3Dproc) wglGetProcAddress("glTexImage3DEXT");
--- mesa-7.0.3.orig/src/glu/sgi/libutil/quad.c
+++ mesa-7.0.3/src/glu/sgi/libutil/quad.c
@@ -713,8 +713,8 @@
GLfloat cosCache3b[CACHE_SIZE];
GLfloat angle;
GLfloat zLow, zHigh;
- GLfloat sintemp1, sintemp2, sintemp3 = 0.0, sintemp4 = 0.0;
- GLfloat costemp1, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0;
+ GLfloat sintemp1 = 0.0, sintemp2 = 0.0, sintemp3 = 0.0, sintemp4 = 0.0;
+ GLfloat costemp1 = 0.0, costemp2 = 0.0, costemp3 = 0.0, costemp4 = 0.0;
GLboolean needCache2, needCache3;
GLint start, finish;
--- mesa-7.0.3.orig/src/glut/glx/Makefile
+++ mesa-7.0.3/src/glut/glx/Makefile
@@ -126,6 +126,6 @@
@ echo "running $(MKDEP)"
@ touch depend
@ $(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(SOURCES) \
- > /dev/null
+ $(X11_INCLUDES) > /dev/null
include depend
--- mesa-7.0.3.orig/src/glut/mini/Makefile
+++ mesa-7.0.3/src/glut/mini/Makefile
@@ -0,0 +1,97 @@
+# subset glut
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+MARK = $(TOP)/src/glut/glx
+
+GLUT_MAJOR = 3
+GLUT_MINOR = 7
+GLUT_TINY = 1
+
+INCLUDES = -I$(TOP)/include -I$(MARK)
+
+CORE_SOURCES = \
+ bitmap.c \
+ callback.c \
+ color.c \
+ globals.c \
+ init.c \
+ menu.c \
+ models.c \
+ overlay.c \
+ state.c \
+ teapot.c \
+ window.c
+
+
+MARK_SOURCES = \
+ $(MARK)/glut_8x13.c \
+ $(MARK)/glut_9x15.c \
+ $(MARK)/glut_hel10.c \
+ $(MARK)/glut_hel12.c \
+ $(MARK)/glut_hel18.c \
+ $(MARK)/glut_tr10.c \
+ $(MARK)/glut_tr24.c
+
+SOURCES = $(CORE_SOURCES) $(MARK_SOURCES)
+
+OBJECTS = $(SOURCES:.c=.o)
+
+
+##### RULES #####
+
+.c.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+.S.o:
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+
+
+##### TARGETS #####
+
+default: depend $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME)
+
+
+# Make the library
+$(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
+ $(TOP)/bin/mklib -o $(GLUT_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
+ -major $(GLUT_MAJOR) -minor $(GLUT_MINOR) -patch $(GLUT_TINY) \
+ $(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
+ $(MKLIB_OPTIONS) $(OBJECTS)
+
+
+# Run 'make -f Makefile.solo dep' to update the dependencies if you change
+# what's included by any source file.
+depend: $(SOURCES)
+ touch depend
+ $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(SOURCES) > /dev/null
+
+# Emacs tags
+tags:
+ etags `find . -name \*.[ch]` `find ../include`
+
+
+# glut pkgconfig file
+pcedit = sed \
+ -e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
+ -e 's,@LIB_DIR@,$(LIB_DIR),' \
+ -e 's,@VERSION@,$(GLUT_MAJOR).$(GLUT_MINOR).$(GLUT_TINY),'
+glut.pc: glut.pc.in
+ $(pcedit) $< > $@
+
+install: glut.pc
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/include/GL
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
+ $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(DESTDIR)$(INSTALL_DIR)/include/GL
+ $(INSTALL) $(TOP)/$(LIB_DIR)/libglut* $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 glut.pc $(DESTDIR)$(INSTALL_DIR)/$(LIB_DIR)/pkgconfig
+
+
+# Remove .o and backup files
+clean: depend
+ -rm -f depend
+ -rm -f *.o *~ *.o *~ *.so libglut.so.3.7
+
+include depend
--- mesa-7.0.3.orig/src/glw/Makefile
+++ mesa-7.0.3/src/glw/Makefile
@@ -61,7 +61,7 @@
depend: $(GLW_SOURCES)
touch depend
$(MKDEP) $(MKDEP_OPTIONS) -I$(TOP)/include $(GLW_SOURCES) \
- > /dev/null
+ $(X11_INCLUDES) > /dev/null
include depend
--- mesa-7.0.3.orig/src/mesa/Makefile
+++ mesa-7.0.3/src/mesa/Makefile
@@ -89,7 +89,8 @@
# Stand-alone Mesa libGL and libOSMesa
STAND_ALONE_DRIVER_SOURCES = \
$(COMMON_DRIVER_SOURCES) \
- $(X11_DRIVER_SOURCES)
+ $(X11_DRIVER_SOURCES) \
+ $(GLIDE_DRIVER_SOURCES)
STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o)
--- mesa-7.0.3.orig/src/mesa/sources
+++ mesa-7.0.3/src/mesa/sources
@@ -258,7 +258,6 @@
GLIDE_DRIVER_SOURCES = \
drivers/glide/fxapi.c \
drivers/glide/fxdd.c \
- drivers/glide/fxddspan.c \
drivers/glide/fxddtex.c \
drivers/glide/fxsetup.c \
drivers/glide/fxtexman.c \
@@ -267,6 +266,8 @@
drivers/glide/fxglidew.c \
drivers/glide/fxg.c
+# drivers/fxddspan.c
+
SVGA_DRIVER_SOURCES = \
drivers/svga/svgamesa.c \
drivers/svga/svgamesa8.c \
--- mesa-7.0.3.orig/src/mesa/vbo/vbo_exec_draw.c
+++ mesa-7.0.3/src/mesa/vbo/vbo_exec_draw.c
@@ -187,7 +187,7 @@
arrays[attr].BufferObj = exec->vtx.bufferobj; /* NullBufferObj */
arrays[attr]._MaxElement = count; /* ??? */
- data += exec->vtx.attrsz[attr] * sizeof(GLfloat);
+ data += exec->vtx.attrsz[src] * sizeof(GLfloat);
}
}
}
--- mesa-7.0.3.orig/src/mesa/vbo/vbo_save_api.c
+++ mesa-7.0.3/src/mesa/vbo/vbo_save_api.c
@@ -864,6 +864,9 @@
_ae_map_vbos( ctx );
+ if (ctx->Array.ElementArrayBufferObj->Name)
+ indices = ADD_POINTERS(ctx->Array.ElementArrayBufferObj->Pointer, indices);
+
vbo_save_NotifyBegin( ctx, mode | VBO_SAVE_PRIM_WEAK );
switch (type) {
--- mesa-7.0.3.orig/src/mesa/vbo/vbo_save_draw.c
+++ mesa-7.0.3/src/mesa/vbo/vbo_save_draw.c
@@ -131,7 +131,7 @@
break;
}
- for (attr = 0; attr < VBO_ATTRIB_MAX; attr++) {
+ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
GLuint src = map[attr];
if (node->attrsz[src]) {
@@ -146,7 +146,7 @@
assert(arrays[attr].BufferObj->Name);
- data += node->attrsz[attr] * sizeof(GLfloat);
+ data += node->attrsz[src] * sizeof(GLfloat);
}
}
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/common/vblank.c
+++ mesa-7.0.3/src/mesa/drivers/dri/common/vblank.c
@@ -233,8 +233,8 @@
if ( first_time ) {
fprintf(stderr,
"%s: drmWaitVBlank returned %d, IRQs don't seem to be"
- " working correctly.\nTry running with LIBGL_THROTTLE_REFRESH"
- " and LIBL_SYNC_REFRESH unset.\n", __FUNCTION__, ret);
+ " working correctly.\nTry adjusting the vblank_mode"
+ " configuration parameter.\n", __FUNCTION__, ret);
first_time = GL_FALSE;
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/common/xmlconfig.c
+++ mesa-7.0.3/src/mesa/drivers/dri/common/xmlconfig.c
@@ -63,6 +63,9 @@
#elif defined(__NetBSD__) && defined(__NetBSD_Version) && (__NetBSD_Version >= 106000100)
# include
# define GET_PROGRAM_NAME() getprogname()
+#elif defined(__DragonFly__)
+# include
+# define GET_PROGRAM_NAME() getprogname()
#endif
#if !defined(GET_PROGRAM_NAME)
--- mesa-7.0.3.orig/src/mesa/drivers/dri/common/texmem.c
+++ mesa-7.0.3/src/mesa/drivers/dri/common/texmem.c
@@ -1278,6 +1278,7 @@
else {
firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5);
firstLevel = MAX2(firstLevel, tObj->BaseLevel);
+ firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2);
lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5);
lastLevel = MAX2(lastLevel, t->tObj->BaseLevel);
lastLevel = MIN2(lastLevel, t->tObj->BaseLevel + baseImage->MaxLog2);
--- mesa-7.0.3.orig/src/mesa/drivers/dri/common/xmlpool/Makefile
+++ mesa-7.0.3/src/mesa/drivers/dri/common/xmlpool/Makefile
@@ -0,0 +1,96 @@
+# Convenient makefile for managing translations.
+
+# Prerequisites:
+# - GNU gettext
+# - Python
+
+# Adding new translations
+# -----------------------
+
+# To start working on a new translation edit the POS=... line
+# below. If you want to add for example a french translation, add
+# fr.po.
+
+# Then run "make po" to generate a fresh .po file from translatable
+# strings in t_options.h. Now you can edit the new .po file (fr.po in
+# the example above) to translate the strings. Please make sure that
+# your editor encodes the file in UTF-8.
+
+# Updating existing translations
+# ------------------------------
+
+# Run "make po" to update .po files with new translatable strings from
+# t_options.h. Now you can edit the .po files you're interested
+# in. Please make sure that your editor encodes the file in UTF-8.
+
+# Updating options.h
+# ------------------
+
+# Finally run "make" to generate options.h from t_options.h with all
+# translations. Now you can rebuild the drivers. Any common options
+# used by the drivers will have option descriptions with the latest
+# translations.
+
+# Publishing translations
+# -----------------------
+
+# To get your translation(s) into Mesa CVS, please send me your
+# .po file.
+
+# More information:
+# - info gettext
+
+# The set of supported languages. Add languages as needed.
+POS=de.po es.po nl.po fr.po sv.po
+
+#
+# Don't change anything below, unless you know what you're doing.
+#
+LANGS=$(POS:%.po=%)
+MOS=$(POS:%.po=%/LC_MESSAGES/options.mo)
+POT=xmlpool.pot
+
+.PHONY: all clean pot po mo
+
+all: options.h
+
+# Only intermediate files are cleaned up. options.h is not deleted because
+# it's in CVS.
+clean:
+ rm -f $(POT) *~
+ rm -rf $(LANGS)
+
+# Default target options.h
+options.h: t_options.h mo
+ python gen_xmlpool.py $(LANGS) > options.h
+
+# Update .mo files from the corresponding .po files.
+mo:
+ @for mo in $(MOS); do \
+ lang=$${mo%%/*}; \
+ echo "Updating $$mo from $$lang.po."; \
+ mkdir -p $${mo%/*}; \
+ msgfmt -o $$mo $$lang.po; \
+ done
+
+# Use this target to create or update .po files with new messages in
+# driconf.py.
+po: $(POS)
+
+pot: $(POT)
+
+# Extract message catalog from driconf.py.
+$(POT): t_options.h
+ xgettext -L C --from-code utf-8 -o $(POT) t_options.h
+
+# Create or update a .po file for a specific language.
+%.po: $(POT)
+ @if [ -f $@ ]; then \
+ echo "Merging new strings from $(POT) into $@."; \
+ mv $@ $@~; \
+ msgmerge -o $@ $@~ $(POT); \
+ else \
+ echo "Initializing $@ from $(POT)."; \
+ msginit -i $(POT) -o $@~ --locale=$*; \
+ sed -e 's/charset=.*\\n/charset=UTF-8\\n/' $@~ > $@; \
+ fi
--- mesa-7.0.3.orig/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
+++ mesa-7.0.3/src/mesa/drivers/dri/common/xmlpool/gen_xmlpool.py
@@ -0,0 +1,191 @@
+#!/usr/bin/python
+
+import sys
+import gettext
+import re
+
+# List of supported languages
+languages = sys.argv[1:]
+
+# Escape special characters in C strings
+def escapeCString (s):
+ escapeSeqs = {'\a' : '\\a', '\b' : '\\b', '\f' : '\\f', '\n' : '\\n',
+ '\r' : '\\r', '\t' : '\\t', '\v' : '\\v', '\\' : '\\\\'}
+ # " -> '' is a hack. Quotes (") aren't possible in XML attributes.
+ # Better use Unicode characters for typographic quotes in option
+ # descriptions and translations.
+ i = 0
+ r = ''
+ while i < len(s):
+ # Special case: escape double quote with \u201c or \u201d, depending
+ # on whether it's an open or close quote. This is needed because plain
+ # double quotes are not possible in XML attributes.
+ if s[i] == '"':
+ if i == len(s)-1 or s[i+1].isspace():
+ # close quote
+ q = u'\u201c'
+ else:
+ # open quote
+ q = u'\u201d'
+ r = r + q
+ elif escapeSeqs.has_key(s[i]):
+ r = r + escapeSeqs[s[i]]
+ else:
+ r = r + s[i]
+ i = i + 1
+ return r
+
+# Expand escape sequences in C strings (needed for gettext lookup)
+def expandCString (s):
+ escapeSeqs = {'a' : '\a', 'b' : '\b', 'f' : '\f', 'n' : '\n',
+ 'r' : '\r', 't' : '\t', 'v' : '\v',
+ '"' : '"', '\\' : '\\'}
+ i = 0
+ escape = False
+ hexa = False
+ octa = False
+ num = 0
+ digits = 0
+ r = ''
+ while i < len(s):
+ if not escape:
+ if s[i] == '\\':
+ escape = True
+ else:
+ r = r + s[i]
+ elif hexa:
+ if (s[i] >= '0' and s[i] <= '9') or \
+ (s[i] >= 'a' and s[i] <= 'f') or \
+ (s[i] >= 'A' and s[i] <= 'F'):
+ num = num * 16 + int(s[i],16)
+ digits = digits + 1
+ else:
+ digits = 2
+ if digits >= 2:
+ hexa = False
+ escape = False
+ r = r + chr(num)
+ elif octa:
+ if s[i] >= '0' and s[i] <= '7':
+ num = num * 8 + int(s[i],8)
+ digits = digits + 1
+ else:
+ digits = 3
+ if digits >= 3:
+ octa = False
+ escape = False
+ r = r + chr(num)
+ else:
+ if escapeSeqs.has_key(s[i]):
+ r = r + escapeSeqs[s[i]]
+ escape = False
+ elif s[i] >= '0' and s[i] <= '7':
+ octa = True
+ num = int(s[i],8)
+ if num <= 3:
+ digits = 1
+ else:
+ digits = 2
+ elif s[i] == 'x' or s[i] == 'X':
+ hexa = True
+ num = 0
+ digits = 0
+ else:
+ r = r + s[i]
+ escape = False
+ i = i + 1
+ return r
+
+# Expand matches. The first match is always a DESC or DESC_BEGIN match.
+# Subsequent matches are ENUM matches.
+#
+# DESC, DESC_BEGIN format: \1 \2= \3 \4=gettext(" \5= \6=") \7
+# ENUM format: \1 \2=gettext(" \3= \4=") \5
+def expandMatches (matches, translations, end=None):
+ assert len(matches) > 0
+ nTranslations = len(translations)
+ i = 0
+ # Expand the description+enums for all translations
+ for lang,trans in translations:
+ i = i + 1
+ # Make sure that all but the last line of a simple description
+ # are extended with a backslash.
+ suffix = ''
+ if len(matches) == 1 and i < len(translations) and \
+ not matches[0].expand (r'\7').endswith('\\'):
+ suffix = ' \\'
+ # Expand the description line. Need to use ugettext in order to allow
+ # non-ascii unicode chars in the original English descriptions.
+ text = escapeCString (trans.ugettext (unicode (expandCString (
+ matches[0].expand (r'\5')), "utf-8"))).encode("utf-8")
+ print matches[0].expand (r'\1' + lang + r'\3"' + text + r'"\7') + suffix
+ # Expand any subsequent enum lines
+ for match in matches[1:]:
+ text = escapeCString (trans.ugettext (unicode (expandCString (
+ match.expand (r'\3')), "utf-8"))).encode("utf-8")
+ print match.expand (r'\1"' + text + r'"\5')
+
+ # Expand description end
+ if end:
+ print end,
+
+# Compile a list of translation classes to all supported languages.
+# The first translation is always a NullTranslations.
+translations = [("en", gettext.NullTranslations())]
+for lang in languages:
+ try:
+ trans = gettext.translation ("options", ".", [lang])
+ except IOError:
+ sys.stderr.write ("Warning: language '%s' not found.\n" % lang)
+ continue
+ translations.append ((lang, trans))
+
+# Regular expressions:
+reLibintl_h = re.compile (r'#\s*include\s*')
+reDESC = re.compile (r'(\s*DRI_CONF_DESC\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
+reDESC_BEGIN = re.compile (r'(\s*DRI_CONF_DESC_BEGIN\s*\(\s*)([a-z]+)(\s*,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
+reENUM = re.compile (r'(\s*DRI_CONF_ENUM\s*\([^,]+,\s*)(gettext\s*\(\s*")(.*)("\s*\))(\s*\)[ \t]*\\?)$')
+reDESC_END = re.compile (r'\s*DRI_CONF_DESC_END')
+
+# Print a header
+print \
+"/***********************************************************************\n" \
+" *** THIS FILE IS GENERATED AUTOMATICALLY. DON'T EDIT! ***\n" \
+" ***********************************************************************/"
+
+# Process the options template and generate options.h with all
+# translations.
+template = file ("t_options.h", "r")
+descMatches = []
+for line in template:
+ if len(descMatches) > 0:
+ matchENUM = reENUM .match (line)
+ matchDESC_END = reDESC_END.match (line)
+ if matchENUM:
+ descMatches.append (matchENUM)
+ elif matchDESC_END:
+ expandMatches (descMatches, translations, line)
+ descMatches = []
+ else:
+ sys.stderr.write (
+ "Warning: unexpected line inside description dropped:\n%s\n" \
+ % line)
+ continue
+ if reLibintl_h.search (line):
+ # Ignore (comment out) #include
+ print "/* %s * commented out by gen_xmlpool.py */" % line
+ continue
+ matchDESC = reDESC .match (line)
+ matchDESC_BEGIN = reDESC_BEGIN.match (line)
+ if matchDESC:
+ assert len(descMatches) == 0
+ expandMatches ([matchDESC], translations)
+ elif matchDESC_BEGIN:
+ assert len(descMatches) == 0
+ descMatches = [matchDESC_BEGIN]
+ else:
+ print line,
+
+if len(descMatches) > 0:
+ sys.stderr.write ("Warning: unterminated description at end of file.\n")
+ expandMatches (descMatches, translations)
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/i915_context.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/i915_context.h
@@ -29,6 +29,7 @@
#define I915CONTEXT_INC
#include "intel_context.h"
+#include "i915_reg.h"
#define I915_FALLBACK_TEXTURE 0x1000
#define I915_FALLBACK_COLORMASK 0x2000
@@ -103,6 +104,7 @@
#define I915_PROGRAM_SIZE 192
+#define I915_MAX_INSN (I915_MAX_TEX_INSN+I915_MAX_ALU_INSN)
/* Hardware version of a parsed fragment program. "Derived" from the
* mesa fragment_program struct.
@@ -153,6 +155,10 @@
*/
+ /* Track which R registers are "live" for each instruction.
+ * A register is live between the time it's written to and the last time
+ * it's read. */
+ GLuint usedRegs[I915_MAX_INSN];
/* Helpers for i915_fragprog.c:
*/
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/i915_fragprog.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/i915_fragprog.c
@@ -42,7 +42,20 @@
#include "program.h"
#include "programopt.h"
-
+static const GLfloat sin_quad_constants[2][4] = {
+ {
+ 2.0,
+ -1.0,
+ .5,
+ .75
+ },
+ {
+ 4.0,
+ -4.0,
+ 1.0 / (2.0 * M_PI),
+ .2225
+ }
+};
/* 1, -1/3!, 1/5!, -1/7! */
static const GLfloat sin_constants[4] = { 1.0,
@@ -91,7 +104,7 @@
break;
case FRAG_ATTRIB_FOGC:
src = i915_emit_decl( p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W );
- src = swizzle( src, W, W, W, W );
+ src = swizzle(src, W, ZERO, ZERO, ONE);
break;
case FRAG_ATTRIB_TEX0:
case FRAG_ATTRIB_TEX1:
@@ -211,7 +224,7 @@
GLuint coord = src_vector( p, &inst->SrcReg[0], program); \
/* Texel lookup */ \
\
- i915_emit_texld( p, \
+ i915_emit_texld( p, get_live_regs(p, inst), \
get_result_vector( p, inst ), \
get_result_flags( inst ), \
sampler, \
@@ -234,6 +247,43 @@
#define EMIT_2ARG_ARITH( OP ) EMIT_ARITH( OP, 2 )
#define EMIT_3ARG_ARITH( OP ) EMIT_ARITH( OP, 3 )
+/*
+ * TODO: consider moving this into core
+ */
+static void calc_live_regs( struct i915_fragment_program *p )
+{
+ const struct gl_fragment_program *program = p->ctx->FragmentProgram._Current;
+ GLuint regsUsed = 0xffff0000;
+ GLint i;
+
+ for (i = program->Base.NumInstructions - 1; i >= 0; i--) {
+ struct prog_instruction *inst = &program->Base.Instructions[i];
+ int opArgs = _mesa_num_inst_src_regs(inst->Opcode);
+ int a;
+
+ /* Register is written to: unmark as live for this and preceeding ops */
+ if (inst->DstReg.File == PROGRAM_TEMPORARY)
+ regsUsed &= ~(1 << inst->DstReg.Index);
+
+ for (a = 0; a < opArgs; a++) {
+ /* Register is read from: mark as live for this and preceeding ops */
+ if (inst->SrcReg[a].File == PROGRAM_TEMPORARY)
+ regsUsed |= 1 << inst->SrcReg[a].Index;
+ }
+
+ p->usedRegs[i] = regsUsed;
+ }
+}
+
+static GLuint get_live_regs( struct i915_fragment_program *p,
+ const struct prog_instruction *inst )
+{
+ const struct gl_fragment_program *program = p->ctx->FragmentProgram._Current;
+ GLuint nr = inst - program->Base.Instructions;
+
+ return p->usedRegs[nr];
+}
+
/* Possible concerns:
*
@@ -267,9 +317,18 @@
return;
}
+ if (program->Base.NumInstructions > I915_MAX_INSN) {
+ i915_program_error( p, "Exceeded max instructions" );
+ return;
+ }
+
+ /* Not always needed:
+ */
+ calc_live_regs(p);
+
while (1) {
GLuint src0, src1, src2, flags;
- GLuint tmp = 0;
+ GLuint tmp = 0, consts0 = 0, consts1 = 0;
switch (inst->Opcode) {
case OPCODE_ABS:
@@ -297,67 +356,87 @@
break;
case OPCODE_COS:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
+ src0 = src_vector(p, &inst->SrcReg[0], program);
+ tmp = i915_get_utemp(p);
+ consts0 = i915_emit_const4fv(p, sin_quad_constants[0]);
+ consts1 = i915_emit_const4fv(p, sin_quad_constants[1]);
+
+ /* Reduce range from repeating about [-pi,pi] to [-1,1] */
+ i915_emit_arith(p,
+ A0_MAD,
+ tmp, A0_DEST_CHANNEL_X, 0,
+ src0,
+ swizzle(consts1, Z, ZERO, ZERO, ZERO), /* 1/(2pi) */
+ swizzle(consts0, W, ZERO, ZERO, ZERO)); /* .75 */
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- src0,
- i915_emit_const1f(p, 1.0/(M_PI * 2)),
- 0);
+ i915_emit_arith(p, A0_FRC, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
- i915_emit_arith( p,
- A0_MOD,
+ i915_emit_arith(p,
+ A0_MAD,
tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- 0, 0 );
+ tmp,
+ swizzle(consts0, X, ZERO, ZERO, ZERO), /* 2 */
+ swizzle(consts0, Y, ZERO, ZERO, ZERO)); /* -1 */
- /* By choosing different taylor constants, could get rid of this mul:
+ /* Compute COS with the same calculation used for SIN, but a
+ * different source range has been mapped to [-1,1] this time.
*/
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- i915_emit_const1f(p, (M_PI * 2)),
+
+ /* tmp.y = abs(tmp.x); {x, abs(x), 0, 0} */
+ i915_emit_arith(p,
+ A0_MAX,
+ tmp, A0_DEST_CHANNEL_Y, 0,
+ swizzle(tmp, ZERO, X, ZERO, ZERO),
+ negate(swizzle(tmp, ZERO, X, ZERO, ZERO), 0, 1, 0, 0),
0);
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, 1
- * t0 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1
- * result = DP4 t0, cos_constants
- */
- i915_emit_arith( p,
+ /* tmp.y = tmp.y * tmp.x; {x, x * abs(x), 0, 0} */
+ i915_emit_arith(p,
A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(tmp, X,X,ONE,ONE),
- swizzle(tmp, X,ONE,ONE,ONE), 0);
+ tmp, A0_DEST_CHANNEL_Y, 0,
+ swizzle(tmp, ZERO, X, ZERO, ZERO),
+ tmp,
+ 0);
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X,Y,X,ONE),
- swizzle(tmp, X,X,ONE,ONE), 0);
+ /* tmp.x = tmp.xy DP sin_quad_constants[2].xy */
+ i915_emit_arith(p,
+ A0_DP3,
+ tmp, A0_DEST_CHANNEL_X, 0,
+ tmp,
+ swizzle(consts1, X, Y, ZERO, ZERO),
+ 0);
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XYZ, 0,
- swizzle(tmp, X,X,Z,ONE),
- swizzle(tmp, Z,ONE,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(tmp, ONE,Z,Y,X),
- i915_emit_const4fv( p, cos_constants ), 0);
+ /* tmp.x now contains a first approximation (y). Now, weight it
+ * against tmp.y**2 to get closer.
+ */
+ i915_emit_arith(p,
+ A0_MAX,
+ tmp, A0_DEST_CHANNEL_Y, 0,
+ swizzle(tmp, ZERO, X, ZERO, ZERO),
+ negate(swizzle(tmp, ZERO, X, ZERO, ZERO), 0, 1, 0, 0),
+ 0);
- break;
+ /* tmp.y = tmp.x * tmp.y - tmp.x; {y, y * abs(y) - y, 0, 0} */
+ i915_emit_arith(p,
+ A0_MAD,
+ tmp, A0_DEST_CHANNEL_Y, 0,
+ swizzle(tmp, ZERO, X, ZERO, ZERO),
+ swizzle(tmp, ZERO, Y, ZERO, ZERO),
+ negate(swizzle(tmp, ZERO, X, ZERO, ZERO), 0, 1, 0, 0));
- case OPCODE_DP3:
- EMIT_2ARG_ARITH( A0_DP3 );
- break;
+ /* result = .2225 * tmp.y + tmp.x =.2225(y * abs(y) - y) + y= */
+ i915_emit_arith(p,
+ A0_MAD,
+ get_result_vector(p, inst),
+ get_result_flags(inst), 0,
+ swizzle(consts1, W, W, W, W),
+ swizzle(tmp, Y, Y, Y, Y),
+ swizzle(tmp, X, X, X, X));
+ break;
+
+ case OPCODE_DP3:
+ EMIT_2ARG_ARITH(A0_DP3);
+ break;
case OPCODE_DP4:
EMIT_2ARG_ARITH( A0_DP4 );
@@ -414,11 +493,9 @@
src0 = src_vector( p, &inst->SrcReg[0], program);
tmp = i915_get_utemp( p );
- i915_emit_texld( p,
- tmp, A0_DEST_CHANNEL_ALL, /* use a dummy dest reg */
- 0,
- src0,
- T0_TEXKILL );
+ i915_emit_texld(p, get_live_regs(p, inst),
+ tmp, A0_DEST_CHANNEL_ALL, /* use a dummy dest reg */
+ 0, src0, T0_TEXKILL);
break;
case OPCODE_LG2:
@@ -638,62 +715,86 @@
break;
case OPCODE_SIN:
- src0 = src_vector( p, &inst->SrcReg[0], program);
- tmp = i915_get_utemp( p );
+ src0 = src_vector(p, &inst->SrcReg[0], program);
+ tmp = i915_get_utemp(p);
+ consts0 = i915_emit_const4fv(p, sin_quad_constants[0]);
+ consts1 = i915_emit_const4fv(p, sin_quad_constants[1]);
+
+ /* Reduce range from repeating about [-pi,pi] to [-1,1] */
+ i915_emit_arith(p,
+ A0_MAD,
+ tmp, A0_DEST_CHANNEL_X, 0,
+ src0,
+ swizzle(consts1, Z, ZERO, ZERO, ZERO), /* 1/(2pi) */
+ swizzle(consts0, Z, ZERO, ZERO, ZERO)); /* .5 */
- i915_emit_arith( p,
- A0_MUL,
+ i915_emit_arith(p, A0_FRC, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0);
+ i915_emit_arith(p,
+ A0_MAD,
tmp, A0_DEST_CHANNEL_X, 0,
- src0,
- i915_emit_const1f(p, 1.0/(M_PI * 2)),
+ tmp,
+ swizzle(consts0, X, ZERO, ZERO, ZERO), /* 2 */
+ swizzle(consts0, Y, ZERO, ZERO, ZERO)); /* -1 */
+
+ /* Compute sin using a quadratic and quartic. It gives continuity
+ * that repeating the Taylor series lacks every 2*pi, and has
+ * reduced error.
+ *
+ * The idea was described at:
+ * http://www.devmaster.net/forums/showthread.php?t=5784
+ */
+ /* tmp.y = abs(tmp.x); {x, abs(x), 0, 0} */
+ i915_emit_arith(p,
+ A0_MAX,
+ tmp, A0_DEST_CHANNEL_Y, 0,
+ swizzle(tmp, ZERO, X, ZERO, ZERO),
+ negate(swizzle(tmp, ZERO, X, ZERO, ZERO), 0, 1, 0, 0),
0);
- i915_emit_arith( p,
- A0_MOD,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- 0, 0 );
-
- /* By choosing different taylor constants, could get rid of this mul:
- */
- i915_emit_arith( p,
+ /* tmp.y = tmp.y * tmp.x; {x, x * abs(x), 0, 0} */
+ i915_emit_arith(p,
A0_MUL,
- tmp, A0_DEST_CHANNEL_X, 0,
- tmp,
- i915_emit_const1f(p, (M_PI * 2)),
+ tmp, A0_DEST_CHANNEL_Y, 0,
+ swizzle(tmp, ZERO, X, ZERO, ZERO),
+ tmp,
0);
- /*
- * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1
- * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x
- * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x
- * result = DP4 t1.wzyx, sin_constants
+ /* tmp.x = tmp.xy DP sin_quad_constants[2].xy */
+ i915_emit_arith(p,
+ A0_DP3,
+ tmp, A0_DEST_CHANNEL_X, 0,
+ tmp,
+ swizzle(consts1, X, Y, ZERO, ZERO),
+ 0);
+
+ /* tmp.x now contains a first approximation (y). Now, weight it
+ * against tmp.y**2 to get closer.
*/
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_XY, 0,
- swizzle(tmp, X,X,ONE,ONE),
- swizzle(tmp, X,ONE,ONE,ONE), 0);
+ i915_emit_arith(p,
+ A0_MAX,
+ tmp, A0_DEST_CHANNEL_Y, 0,
+ swizzle(tmp, ZERO, X, ZERO, ZERO),
+ negate(swizzle(tmp, ZERO, X, ZERO, ZERO), 0, 1, 0, 0),
+ 0);
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,X,Y),
- swizzle(tmp, X,X,ONE,ONE), 0);
+ /* tmp.y = tmp.x * tmp.y - tmp.x; {y, y * abs(y) - y, 0, 0} */
+ i915_emit_arith(p,
+ A0_MAD,
+ tmp, A0_DEST_CHANNEL_Y, 0,
+ swizzle(tmp, ZERO, X, ZERO, ZERO),
+ swizzle(tmp, ZERO, Y, ZERO, ZERO),
+ negate(swizzle(tmp, ZERO, X, ZERO, ZERO), 0, 1, 0, 0));
- i915_emit_arith( p,
- A0_MUL,
- tmp, A0_DEST_CHANNEL_ALL, 0,
- swizzle(tmp, X,Y,Y,W),
- swizzle(tmp, X,Z,ONE,ONE), 0);
-
- i915_emit_arith( p,
- A0_DP4,
- get_result_vector( p, inst ),
- get_result_flags( inst ), 0,
- swizzle(tmp, W, Z, Y, X ),
- i915_emit_const4fv( p, sin_constants ), 0);
- break;
+ /* result = .2225 * tmp.y + tmp.x =.2225(y * abs(y) - y) + y= */
+ i915_emit_arith(p,
+ A0_MAD,
+ get_result_vector(p, inst),
+ get_result_flags(inst), 0,
+ swizzle(consts1, W, W, W, W),
+ swizzle(tmp, Y, Y, Y, Y),
+ swizzle(tmp, X, X, X, X));
+
+ break;
case OPCODE_SLT:
EMIT_2ARG_ARITH( A0_SLT );
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/i915_program.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/i915_program.c
@@ -194,27 +194,43 @@
return dest;
}
+static GLuint get_free_rreg (struct i915_fragment_program *p,
+ GLuint live_regs)
+{
+ int bit = ffs(~live_regs);
+ if (!bit) {
+ i915_program_error(p, "Can't find free R reg");
+ return UREG_BAD;
+ }
+ return UREG(REG_TYPE_R, bit - 1);
+}
+
GLuint i915_emit_texld( struct i915_fragment_program *p,
+ GLuint live_regs,
GLuint dest,
GLuint destmask,
GLuint sampler,
GLuint coord,
GLuint op )
{
- if (coord != UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord))) {
- /* No real way to work around this in the general case - need to
- * allocate and declare a new temporary register (a utemp won't
- * do). Will fallback for now.
- */
- i915_program_error(p, "Can't (yet) swizzle TEX arguments");
- return 0;
- }
+ if (coord != UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord))) {
+ /* With the help of the "needed registers" table created earlier, pick
+ * a register we can MOV the swizzled TC to (since TEX doesn't support
+ * swizzled sources) */
+ GLuint swizCoord = get_free_rreg(p, live_regs);
+ if (swizCoord == UREG_BAD)
+ return 0;
+
+ i915_emit_arith( p, A0_MOV, swizCoord, A0_DEST_CHANNEL_ALL, 0, coord, 0, 0 );
+ coord = swizCoord;
+ }
- /* Don't worry about saturate as we only support
+ /* Don't worry about saturate as we only support texture formats
+ * that are always in the 0..1 range.
*/
if (destmask != A0_DEST_CHANNEL_ALL) {
GLuint tmp = i915_get_utemp(p);
- i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, op );
+ i915_emit_texld( p, 0, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, op );
i915_emit_arith( p, A0_MOV, dest, destmask, 0, tmp, 0, 0 );
return dest;
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/i915_program.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/i915_program.h
@@ -110,6 +110,7 @@
extern GLuint i915_emit_texld( struct i915_fragment_program *p,
+ GLuint live_regs,
GLuint dest,
GLuint destmask,
GLuint sampler,
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/i915_texstate.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -454,7 +454,12 @@
case MESA_FORMAT_Z16:
t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_16BIT | MT_16BIT_L16);
+ if (tObj->DepthMode == GL_ALPHA)
+ textureFormat = (MAPSURF_16BIT | MT_16BIT_A16);
+ else if (tObj->DepthMode == GL_INTENSITY)
+ textureFormat = (MAPSURF_16BIT | MT_16BIT_I16);
+ else
+ textureFormat = (MAPSURF_16BIT | MT_16BIT_L16);
break;
case MESA_FORMAT_RGBA_DXT1:
@@ -737,6 +742,9 @@
return GL_FALSE;
}
+ if (tObj->Target == GL_TEXTURE_1D &&
+ tObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB)
+ return GL_FALSE;
/* Update state if this is a different texture object to last
* time.
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/intel_context.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/intel_context.c
@@ -117,6 +117,8 @@
chipset = "Intel(R) 865G"; break;
case PCI_CHIP_I915_G:
chipset = "Intel(R) 915G"; break;
+ case PCI_CHIP_E7221_G:
+ chipset = "Intel (R) E7221G (i915)"; break;
case PCI_CHIP_I915_GM:
chipset = "Intel(R) 915GM"; break;
case PCI_CHIP_I945_G:
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/intel_pixel.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/intel_pixel.c
@@ -228,7 +228,7 @@
__DRIdrawablePrivate *dPriv = intel->driDrawable;
int nbox = dPriv->numClipRects;
int src_offset = intel->readRegion->offset;
- int src_pitch = intel->intelScreen->front.pitch;
+ int src_pitch = intel->intelScreen->front.pitch / intel->intelScreen->cpp; /* in pixels */
int dst_offset = intelAgpOffsetFromVirtual( intel, pixels);
drm_clip_rect_t *box = dPriv->pClipRects;
int i;
@@ -308,7 +308,7 @@
int nbox = dPriv->numClipRects;
int i;
int src_offset = intelAgpOffsetFromVirtual( intel, pixels);
- int src_pitch = pitch;
+ int src_pitch = pitch; /* in pixels */
assert(src_offset != ~0); /* should be caught earlier */
@@ -339,7 +339,7 @@
intelEmitCopyBlitLocked( intel,
intel->intelScreen->cpp,
src_pitch, src_offset,
- intel->intelScreen->front.pitch,
+ intel->intelScreen->front.pitch / intel->intelScreen->cpp, /* in pixels */
intel->drawRegion->offset,
bx - x, by - y,
bx, by,
@@ -364,7 +364,7 @@
GLint pitch = unpack->RowLength ? unpack->RowLength : width;
GLuint dest;
GLuint cpp = intel->intelScreen->cpp;
- GLint size = width * pitch * cpp;
+ GLint size = height * pitch * cpp;
if (INTEL_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/intel_screen.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/intel_screen.c
@@ -53,7 +53,7 @@
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
DRI_CONF_FORCE_S3TC_ENABLE(false)
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ DRI_CONF_ALLOW_LARGE_TEXTURES(2)
DRI_CONF_SECTION_END
DRI_CONF_END;
const GLuint __driNConfigOptions = 4;
@@ -511,6 +511,7 @@
sharedContextPrivate );
case PCI_CHIP_I915_G:
+ case PCI_CHIP_E7221_G:
case PCI_CHIP_I915_GM:
case PCI_CHIP_I945_G:
case PCI_CHIP_I945_GM:
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/intel_tex.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/intel_tex.c
@@ -759,7 +759,7 @@
GLuint face)
{
const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
- const struct gl_texture_image *firstImage = t->image[face][t->base.firstLevel].image;
+ const struct gl_texture_image *firstImage = t->image[face][0].image;
int pitch = firstImage->RowStride * firstImage->TexFormat->TexelBytes;
/* Can we texture out of the existing client data? */
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/intel_state.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/intel_state.c
@@ -189,12 +189,12 @@
if ( intel->sarea->pf_current_page == 1 )
front ^= 1;
- intelSetFrontClipRects( intel );
-
if (front) {
+ intelSetFrontClipRects( intel );
intel->drawRegion = &intel->intelScreen->front;
intel->readRegion = &intel->intelScreen->front;
} else {
+ intelSetBackClipRects( intel );
intel->drawRegion = &intel->intelScreen->back;
intel->readRegion = &intel->intelScreen->back;
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/intel_tris.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/intel_tris.c
@@ -202,12 +202,19 @@
{
GLuint offset = intel->wpos_offset;
GLuint size = intel->wpos_size;
-
- __memcpy( ((char *)v0) + offset, v0, size );
- __memcpy( ((char *)v1) + offset, v1, size );
- __memcpy( ((char *)v2) + offset, v2, size );
+ GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset);
+ GLfloat *v1_wpos = (GLfloat *)((char *)v1 + offset);
+ GLfloat *v2_wpos = (GLfloat *)((char *)v2 + offset);
+
+ __memcpy(v0_wpos, v0, size);
+ __memcpy(v1_wpos, v1, size);
+ __memcpy(v2_wpos, v2, size);
+
+ v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h;
+ v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h;
+ v2_wpos[1] = -v2_wpos[1] + intel->driDrawable->h;
- intel_draw_triangle( intel, v0, v1, v2 );
+ intel_draw_triangle(intel, v0, v1, v2);
}
@@ -217,9 +224,14 @@
{
GLuint offset = intel->wpos_offset;
GLuint size = intel->wpos_size;
+ GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset);
+ GLfloat *v1_wpos = (GLfloat *)((char *)v1 + offset);
- __memcpy( ((char *)v0) + offset, v0, size );
- __memcpy( ((char *)v1) + offset, v1, size );
+ __memcpy(v0_wpos, v0, size);
+ __memcpy(v1_wpos, v1, size);
+
+ v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h;
+ v1_wpos[1] = -v1_wpos[1] + intel->driDrawable->h;
intel_draw_line( intel, v0, v1 );
}
@@ -230,8 +242,10 @@
{
GLuint offset = intel->wpos_offset;
GLuint size = intel->wpos_size;
+ GLfloat *v0_wpos = (GLfloat *)((char *)v0 + offset);
- __memcpy( ((char *)v0) + offset, v0, size );
+ __memcpy(v0_wpos, v0, size);
+ v0_wpos[1] = -v0_wpos[1] + intel->driDrawable->h;
intel_draw_point( intel, v0 );
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/i915_texprog.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/i915_texprog.c
@@ -69,7 +69,7 @@
if (p->VB->TexCoordPtr[unit]->size == 4)
op = T0_TEXLDP;
- p->src_texture = i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL,
+ p->src_texture = i915_emit_texld( p, 0, tmp, A0_DEST_CHANNEL_ALL,
sampler, texcoord, op );
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915/intel_context.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i915/intel_context.h
@@ -361,6 +361,8 @@
#define SUBPIXEL_X 0.125
#define SUBPIXEL_Y 0.125
+#define ALIGN(value, alignment) ((value + alignment - 1) & ~(alignment - 1))
+
#define INTEL_FIREVERTICES(intel) \
do { \
if ((intel)->prim.flush) \
@@ -451,6 +453,7 @@
#define PCI_CHIP_I855_GM 0x3582
#define PCI_CHIP_I865_G 0x2572
#define PCI_CHIP_I915_G 0x2582
+#define PCI_CHIP_E7221_G 0x258A
#define PCI_CHIP_I915_GM 0x2592
#define PCI_CHIP_I945_G 0x2772
#define PCI_CHIP_I945_GM 0x27A2
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/Makefile
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/Makefile
@@ -70,6 +70,7 @@
brw_wm_emit.c \
brw_wm_fp.c \
brw_wm_iz.c \
+ brw_wm_glsl.c \
brw_wm_pass0.c \
brw_wm_pass1.c \
brw_wm_pass2.c \
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_clip.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_clip.h
@@ -42,7 +42,7 @@
* up polygon offset and flatshading at this point:
*/
struct brw_clip_prog_key {
- GLuint attrs:16;
+ GLuint attrs:32;
GLuint primitive:4;
GLuint nr_userclip:3;
GLuint do_flat_shading:1;
@@ -51,7 +51,7 @@
GLuint fill_ccw:2; /* includes cull information */
GLuint offset_cw:1;
GLuint offset_ccw:1;
- GLuint pad0:1;
+ GLuint pad0:17;
GLuint copy_bfc_cw:1;
GLuint copy_bfc_ccw:1;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_cc.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_cc.c
@@ -76,8 +76,8 @@
cc.cc1.stencil_write_mask = brw->attribs.Stencil->WriteMask[0];
cc.cc1.stencil_test_mask = brw->attribs.Stencil->ValueMask[0];
- if (brw->attribs.Stencil->TestTwoSide) {
- cc.cc0.bf_stencil_enable = brw->attribs.Stencil->TestTwoSide;
+ if (brw->attribs.Stencil->_TestTwoSide) {
+ cc.cc0.bf_stencil_enable = brw->attribs.Stencil->_TestTwoSide;
cc.cc0.bf_stencil_func = intel_translate_compare_func(brw->attribs.Stencil->Function[1]);
cc.cc0.bf_stencil_fail_op = intel_translate_stencil_op(brw->attribs.Stencil->FailFunc[1]);
cc.cc0.bf_stencil_pass_depth_fail_op = intel_translate_stencil_op(brw->attribs.Stencil->ZFailFunc[1]);
@@ -90,7 +90,8 @@
/* Not really sure about this:
*/
if (brw->attribs.Stencil->WriteMask[0] ||
- (brw->attribs.Stencil->TestTwoSide && brw->attribs.Stencil->WriteMask[1]))
+ (brw->attribs.Stencil->_TestTwoSide &&
+ brw->attribs.Stencil->WriteMask[1]))
cc.cc0.stencil_write_enable = 1;
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_clip_line.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_clip_line.c
@@ -146,6 +146,15 @@
brw_clip_init_planes(c);
brw_clip_init_clipmask(c);
+ /* -ve rhw workaround */
+ if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw))) {
+ brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
+ brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),
+ brw_imm_ud(1<<20));
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(0x3f));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ }
+
plane_loop = brw_DO(p, BRW_EXECUTE_1);
{
/* if (planemask & 1)
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_clip_state.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_clip_state.c
@@ -43,7 +43,8 @@
memset(&clip, 0, sizeof(clip));
/* CACHE_NEW_CLIP_PROG */
- clip.thread0.grf_reg_count = ((brw->clip.prog_data->total_grf-1) & ~15) / 16;
+ clip.thread0.grf_reg_count =
+ ALIGN(brw->clip.prog_data->total_grf, 16) / 16 - 1;
clip.thread0.kernel_start_pointer = brw->clip.prog_gs_offset >> 6;
clip.thread3.urb_entry_read_length = brw->clip.prog_data->urb_read_length;
clip.thread3.const_urb_entry_read_length = brw->clip.prog_data->curb_read_length;
@@ -55,7 +56,7 @@
/* BRW_NEW_URB_FENCE */
clip.thread4.nr_urb_entries = brw->urb.nr_clip_entries;
clip.thread4.urb_entry_allocation_size = brw->urb.vsize - 1;
- clip.thread4.max_threads = 0; /* Hmm, maybe the max is 1 or 2 threads */
+ clip.thread4.max_threads = 1; /* 2 threads */
if (INTEL_DEBUG & DEBUG_STATS)
clip.thread4.stats_enable = 1;
@@ -73,7 +74,7 @@
clip.clip5.vertex_position_space = BRW_CLIP_NDCSPACE;
clip.clip5.api_mode = BRW_CLIP_API_OGL;
- if (BRW_IS_IGD(brw))
+ if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw))
clip.clip5.negative_w_clip_test = 1;
clip.clip6.clipper_viewport_state_ptr = 0;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_clip_tri.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_clip_tri.c
@@ -42,6 +42,20 @@
#include "brw_util.h"
#include "brw_clip.h"
+static struct brw_reg get_tmp( struct brw_clip_compile *c )
+{
+ struct brw_reg tmp = brw_vec4_grf(c->last_tmp, 0);
+
+ if (++c->last_tmp > c->prog_data.total_grf)
+ c->prog_data.total_grf = c->last_tmp;
+
+ return tmp;
+}
+
+static void release_tmps( struct brw_clip_compile *c )
+{
+ c->last_tmp = c->first_tmp;
+}
void brw_clip_tri_alloc_regs( struct brw_clip_compile *c,
@@ -435,15 +449,104 @@
brw_ENDIF(p, do_clip);
}
+static void brw_clip_test( struct brw_clip_compile *c )
+{
+ struct brw_reg t = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
+ struct brw_reg t1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
+ struct brw_reg t2 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
+ struct brw_reg t3 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD);
+
+ struct brw_reg v0 = get_tmp(c);
+ struct brw_reg v1 = get_tmp(c);
+ struct brw_reg v2 = get_tmp(c);
+
+ struct brw_indirect vt0 = brw_indirect(0, 0);
+ struct brw_indirect vt1 = brw_indirect(1, 0);
+ struct brw_indirect vt2 = brw_indirect(2, 0);
+
+ struct brw_compile *p = &c->func;
+
+ brw_MOV(p, get_addr_reg(vt0), brw_address(c->reg.vertex[0]));
+ brw_MOV(p, get_addr_reg(vt1), brw_address(c->reg.vertex[1]));
+ brw_MOV(p, get_addr_reg(vt2), brw_address(c->reg.vertex[2]));
+ brw_MOV(p, v0, deref_4f(vt0, c->offset[VERT_RESULT_HPOS]));
+ brw_MOV(p, v1, deref_4f(vt1, c->offset[VERT_RESULT_HPOS]));
+ brw_MOV(p, v2, deref_4f(vt2, c->offset[VERT_RESULT_HPOS]));
+
+ /* test nearz, xmin, ymin plane */
+ brw_CMP(p, t1, BRW_CONDITIONAL_LE, negate(v0), get_element(v0, 3));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_CMP(p, t2, BRW_CONDITIONAL_LE, negate(v1), get_element(v1, 3));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_CMP(p, t3, BRW_CONDITIONAL_LE, negate(v2), get_element(v2, 3));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_XOR(p, t, t1, t2);
+ brw_XOR(p, t1, t2, t3);
+ brw_OR(p, t, t, t1);
+
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 0), brw_imm_ud(0));
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<5)));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 1), brw_imm_ud(0));
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<3)));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 2), brw_imm_ud(0));
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<1)));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+
+ /* test farz, xmax, ymax plane */
+ brw_CMP(p, t1, BRW_CONDITIONAL_L, v0, get_element(v0, 3));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_CMP(p, t2, BRW_CONDITIONAL_L, v1, get_element(v1, 3));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_CMP(p, t3, BRW_CONDITIONAL_L, v2, get_element(v2, 3));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+
+ brw_XOR(p, t, t1, t2);
+ brw_XOR(p, t1, t2, t3);
+ brw_OR(p, t, t, t1);
+
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 0), brw_imm_ud(0));
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<4)));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 1), brw_imm_ud(0));
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<2)));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ,
+ get_element(t, 2), brw_imm_ud(0));
+ brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<0)));
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ release_tmps(c);
+}
void brw_emit_tri_clip( struct brw_clip_compile *c )
{
+ struct brw_instruction *neg_rhw;
+ struct brw_compile *p = &c->func;
brw_clip_tri_alloc_regs(c, 3 + c->key.nr_userclip + 6);
brw_clip_tri_init_vertices(c);
brw_clip_init_clipmask(c);
+ /* if -ve rhw workaround bit is set,
+ do cliptest */
+ if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw))) {
+ brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
+ brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2),
+ brw_imm_ud(1<<20));
+ neg_rhw = brw_IF(p, BRW_EXECUTE_1);
+ {
+ brw_clip_test(c);
+ }
+ brw_ENDIF(p, neg_rhw);
+ }
+
/* Can't push into do_clip_tri because with polygon (or quad)
* flatshading, need to apply the flatshade here because we don't
* respect the PV when converting to trifan for emit:
@@ -462,6 +565,3 @@
*/
brw_clip_kill_thread(c);
}
-
-
-
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_context.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_context.c
@@ -44,6 +44,8 @@
#include "api_noop.h"
#include "vtxfmt.h"
+#include "shader/shader_api.h"
+
/***************************************
* Mesa's Driver Functions
***************************************/
@@ -60,12 +62,21 @@
{ NULL, NULL }
};
+static void brwUseProgram(GLcontext *ctx, GLuint program)
+{
+ _mesa_use_program(ctx, program);
+}
+static void brwInitProgFuncs( struct dd_function_table *functions )
+{
+ functions->UseProgram = brwUseProgram;
+}
static void brwInitDriverFunctions( struct dd_function_table *functions )
{
intelInitDriverFunctions( functions );
brwInitTextureFuncs( functions );
brwInitFragProgFuncs( functions );
+ brwInitProgFuncs( functions );
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_eu.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_eu.h
@@ -335,14 +335,14 @@
static __inline struct brw_reg brw_imm_uw( GLushort uw )
{
struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UW);
- imm.dw1.ud = uw;
+ imm.dw1.ud = uw | (uw << 16);
return imm;
}
static __inline struct brw_reg brw_imm_w( GLshort w )
{
struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_W);
- imm.dw1.d = w;
+ imm.dw1.d = w | (w << 16);
return imm;
}
@@ -649,6 +649,16 @@
return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UW);
}
+static __inline struct brw_reg deref_1d(struct brw_indirect ptr, GLint offset)
+{
+ return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_D);
+}
+
+static __inline struct brw_reg deref_1ud(struct brw_indirect ptr, GLint offset)
+{
+ return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UD);
+}
+
static __inline struct brw_reg get_addr_reg(struct brw_indirect ptr)
{
return brw_address_reg(ptr.addr_subnr);
@@ -669,7 +679,10 @@
return ptr;
}
-
+static __inline struct brw_instruction *current_insn( struct brw_compile *p)
+{
+ return &p->store[p->nr_insn];
+}
void brw_pop_insn_state( struct brw_compile *p );
void brw_push_insn_state( struct brw_compile *p );
@@ -809,9 +822,11 @@
struct brw_instruction *brw_DO(struct brw_compile *p,
GLuint execute_size);
-void brw_WHILE(struct brw_compile *p,
+struct brw_instruction *brw_WHILE(struct brw_compile *p,
struct brw_instruction *patch_insn);
+struct brw_instruction *brw_BREAK(struct brw_compile *p);
+struct brw_instruction *brw_CONT(struct brw_compile *p);
/* Forward jumps:
*/
void brw_land_fwd_jump(struct brw_compile *p,
@@ -861,5 +876,6 @@
struct brw_reg dst,
struct brw_reg src);
-
+void brw_set_src1( struct brw_instruction *insn,
+ struct brw_reg reg );
#endif
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_clip_util.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_clip_util.c
@@ -272,6 +272,7 @@
+
struct brw_reg brw_clip_plane0_address( struct brw_clip_compile *c )
{
return brw_address(c->reg.fixed_planes);
@@ -327,8 +328,7 @@
/* Shift so that lowest outcode bit is rightmost:
*/
- brw_MOV(p, c->reg.planemask, incoming);
- brw_SHR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(26));
+ brw_SHR(p, c->reg.planemask, incoming, brw_imm_ud(26));
if (c->key.nr_userclip) {
struct brw_reg tmp = retype(vec1(get_tmp(c)), BRW_REGISTER_TYPE_UD);
@@ -342,15 +342,5 @@
release_tmp(c, tmp);
}
-
- if (!BRW_IS_IGD(p->brw)) {
- /* Test for -ve rhw workaround
- */
- brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
- brw_AND(p, vec1(brw_null_reg()), incoming, brw_imm_ud(1<<20));
- brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(0x3f));
- }
-
- brw_set_predicate_control(p, BRW_PREDICATE_NONE);
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_clip_unfilled.c
@@ -220,8 +220,8 @@
struct brw_indirect vert )
{
struct brw_compile *p = &c->func;
- struct brw_reg pos = deref_4f(vert, c->offset[VERT_RESULT_HPOS]);
- struct brw_reg z = get_element(pos, 2);
+ struct brw_reg z = deref_1f(vert, c->header_position_offset +
+ 2 * type_sz(BRW_REGISTER_TYPE_F));
brw_ADD(p, z, z, vec1(c->reg.offset));
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_curbe.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_curbe.c
@@ -305,7 +305,7 @@
if (!brw_pool_alloc(pool,
bufsz,
- 6,
+ 1 << 6,
&brw->curbe.gs_offset)) {
_mesa_printf("out of GS memory for curbe\n");
assert(0);
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_defines.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_defines.h
@@ -240,6 +240,8 @@
#define BRW_FRONTWINDING_CW 0
#define BRW_FRONTWINDING_CCW 1
+#define BRW_SPRITE_POINT_ENABLE 16
+
#define BRW_INDEX_BYTE 0
#define BRW_INDEX_WORD 1
#define BRW_INDEX_DWORD 2
@@ -816,7 +818,7 @@
#define CMD_STATE_BASE_ADDRESS 0x6101
#define CMD_STATE_INSN_POINTER 0x6102
#define CMD_PIPELINE_SELECT_965 0x6104
-#define CMD_PIPELINE_SELECT_IGD 0x6904
+#define CMD_PIPELINE_SELECT_GM45 0x6904
#define CMD_PIPELINED_STATE_POINTERS 0x7800
#define CMD_BINDING_TABLE_PTRS 0x7801
@@ -824,7 +826,7 @@
#define CMD_VERTEX_ELEMENT 0x7809
#define CMD_INDEX_BUFFER 0x780a
#define CMD_VF_STATISTICS_965 0x780b
-#define CMD_VF_STATISTICS_IGD 0x680b
+#define CMD_VF_STATISTICS_GM45 0x680b
#define CMD_DRAW_RECT 0x7900
#define CMD_BLEND_CONSTANT_COLOR 0x7901
@@ -848,9 +850,12 @@
#define R02_PRIM_END 0x1
#define R02_PRIM_START 0x2
-#define BRW_IS_IGD(brw) ((brw)->intel.intelScreen->deviceID == PCI_CHIP_IGD_GM)
-#define CMD_PIPELINE_SELECT(brw) ((BRW_IS_IGD(brw)) ? CMD_PIPELINE_SELECT_IGD : CMD_PIPELINE_SELECT_965)
-#define CMD_VF_STATISTICS(brw) ((BRW_IS_IGD(brw)) ? CMD_VF_STATISTICS_IGD : CMD_VF_STATISTICS_965)
-#define URB_SIZES(brw) ((BRW_IS_IGD(brw)) ? 384 : 256) /* 512 bit unit */
+#define BRW_IS_GM45(brw) ((brw)->intel.intelScreen->deviceID == PCI_CHIP_GM45_GM)
+#define BRW_IS_G4X(brw) (((brw)->intel.intelScreen->deviceID == PCI_CHIP_IGD_E_G) || \
+ ((brw)->intel.intelScreen->deviceID == PCI_CHIP_G45_G) || \
+ ((brw)->intel.intelScreen->deviceID == PCI_CHIP_Q45_G))
+#define CMD_PIPELINE_SELECT(brw) ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? CMD_PIPELINE_SELECT_GM45 : CMD_PIPELINE_SELECT_965)
+#define CMD_VF_STATISTICS(brw) ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? CMD_VF_STATISTICS_GM45 : CMD_VF_STATISTICS_965)
+#define URB_SIZES(brw) ((BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? 384 : 256) /* 512 bit unit */
#endif
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -291,7 +291,7 @@
struct gl_buffer_object **vbo_return,
GLuint *offset_return )
{
- size = (size + 63) & ~63;
+ size = ALIGN(size, 64);
if (brw->vb.upload.offset + size > BRW_UPLOAD_INIT_SIZE)
wrap_buffers(brw, size);
@@ -593,6 +593,31 @@
ib_size,
index_buffer->ptr,
bufferobj);
+ } else {
+ /* If the index buffer isn't aligned to its element size, we have to
+ * rebase it into a temporary.
+ */
+ if ((get_size(index_buffer->type) - 1) & offset) {
+ struct gl_buffer_object *vbo;
+ GLuint voffset;
+ GLubyte *map = ctx->Driver.MapBuffer(ctx,
+ GL_ELEMENT_ARRAY_BUFFER_ARB,
+ GL_DYNAMIC_DRAW_ARB,
+ bufferobj);
+ map += offset;
+ get_space(brw, ib_size, &vbo, &voffset);
+
+ ctx->Driver.BufferSubData(ctx,
+ GL_ELEMENT_ARRAY_BUFFER_ARB,
+ voffset,
+ ib_size,
+ map,
+ vbo);
+ ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, bufferobj);
+
+ bufferobj = vbo;
+ offset = voffset;
+ }
}
/* Emit the indexbuffer packet:
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -164,7 +164,7 @@
}
-static void brw_set_src1( struct brw_instruction *insn,
+void brw_set_src1( struct brw_instruction *insn,
struct brw_reg reg )
{
assert(reg.file != BRW_MESSAGE_REGISTER_FILE);
@@ -186,7 +186,7 @@
* in the future:
*/
assert (reg.address_mode == BRW_ADDRESS_DIRECT);
- assert (reg.file == BRW_GENERAL_REGISTER_FILE);
+ //assert (reg.file == BRW_GENERAL_REGISTER_FILE);
if (insn->header.access_mode == BRW_ALIGN_1) {
insn->bits3.da1.src1_subreg_nr = reg.subnr;
@@ -329,14 +329,14 @@
{
brw_set_src1(insn, brw_imm_d(0));
- if (BRW_IS_IGD(brw)) {
- insn->bits3.sampler_igd.binding_table_index = binding_table_index;
- insn->bits3.sampler_igd.sampler = sampler;
- insn->bits3.sampler_igd.msg_type = msg_type;
- insn->bits3.sampler_igd.response_length = response_length;
- insn->bits3.sampler_igd.msg_length = msg_length;
- insn->bits3.sampler_igd.end_of_thread = eot;
- insn->bits3.sampler_igd.msg_target = BRW_MESSAGE_TARGET_SAMPLER;
+ if (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) {
+ insn->bits3.sampler_gm45_g4x.binding_table_index = binding_table_index;
+ insn->bits3.sampler_gm45_g4x.sampler = sampler;
+ insn->bits3.sampler_gm45_g4x.msg_type = msg_type;
+ insn->bits3.sampler_gm45_g4x.response_length = response_length;
+ insn->bits3.sampler_gm45_g4x.msg_length = msg_length;
+ insn->bits3.sampler_gm45_g4x.end_of_thread = eot;
+ insn->bits3.sampler_gm45_g4x.msg_target = BRW_MESSAGE_TARGET_SAMPLER;
} else {
insn->bits3.sampler.binding_table_index = binding_table_index;
insn->bits3.sampler.sampler = sampler;
@@ -608,6 +608,34 @@
}
}
+struct brw_instruction *brw_BREAK(struct brw_compile *p)
+{
+ struct brw_instruction *insn;
+ insn = next_insn(p, BRW_OPCODE_BREAK);
+ brw_set_dest(insn, brw_ip_reg());
+ brw_set_src0(insn, brw_ip_reg());
+ brw_set_src1(insn, brw_imm_d(0x0));
+ insn->header.compression_control = BRW_COMPRESSION_NONE;
+ insn->header.execution_size = BRW_EXECUTE_8;
+ insn->header.mask_control = BRW_MASK_DISABLE;
+ insn->bits3.if_else.pad0 = 0;
+ return insn;
+}
+
+struct brw_instruction *brw_CONT(struct brw_compile *p)
+{
+ struct brw_instruction *insn;
+ insn = next_insn(p, BRW_OPCODE_CONTINUE);
+ brw_set_dest(insn, brw_ip_reg());
+ brw_set_src0(insn, brw_ip_reg());
+ brw_set_src1(insn, brw_imm_d(0x0));
+ insn->header.compression_control = BRW_COMPRESSION_NONE;
+ insn->header.execution_size = BRW_EXECUTE_8;
+ insn->header.mask_control = BRW_MASK_DISABLE;
+ insn->bits3.if_else.pad0 = 0;
+ return insn;
+}
+
/* DO/WHILE loop:
*/
struct brw_instruction *brw_DO(struct brw_compile *p, GLuint execute_size)
@@ -619,13 +647,15 @@
/* Override the defaults for this instruction:
*/
- brw_set_dest(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD));
- brw_set_src0(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD));
- brw_set_src1(insn, retype(brw_vec1_grf(0,0), BRW_REGISTER_TYPE_UD));
+ brw_set_dest(insn, brw_null_reg());
+ brw_set_src0(insn, brw_null_reg());
+ brw_set_src1(insn, brw_null_reg());
insn->header.compression_control = BRW_COMPRESSION_NONE;
insn->header.execution_size = execute_size;
+ insn->header.predicate_control = BRW_PREDICATE_NONE;
/* insn->header.mask_control = BRW_MASK_ENABLE; */
+ insn->header.mask_control = BRW_MASK_DISABLE;
return insn;
}
@@ -633,7 +663,7 @@
-void brw_WHILE(struct brw_compile *p,
+struct brw_instruction *brw_WHILE(struct brw_compile *p,
struct brw_instruction *do_insn)
{
struct brw_instruction *insn;
@@ -657,14 +687,16 @@
insn->header.execution_size = do_insn->header.execution_size;
assert(do_insn->header.opcode == BRW_OPCODE_DO);
- insn->bits3.if_else.jump_count = do_insn - insn;
+ insn->bits3.if_else.jump_count = do_insn - insn + 1;
insn->bits3.if_else.pop_count = 0;
insn->bits3.if_else.pad0 = 0;
}
/* insn->header.mask_control = BRW_MASK_ENABLE; */
+ insn->header.mask_control = BRW_MASK_DISABLE;
p->current->header.predicate_control = BRW_PREDICATE_NONE;
+ return insn;
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_gs.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_gs.h
@@ -40,11 +40,11 @@
#define MAX_GS_VERTS (4)
struct brw_gs_prog_key {
+ GLuint attrs:32;
GLuint primitive:4;
- GLuint attrs:16;
GLuint hint_gs_always:1;
GLuint need_gs_prog:1;
- GLuint pad:10;
+ GLuint pad:26;
};
struct brw_gs_compile {
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_gs_state.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_gs_state.c
@@ -46,7 +46,8 @@
/* CACHE_NEW_GS_PROG */
if (brw->gs.prog_active) {
- gs.thread0.grf_reg_count = ((brw->gs.prog_data->total_grf-1) & ~15) / 16;
+ gs.thread0.grf_reg_count =
+ ALIGN(brw->gs.prog_data->total_grf, 16) / 16 - 1;
gs.thread0.kernel_start_pointer = brw->gs.prog_gs_offset >> 6;
gs.thread3.urb_entry_read_length = brw->gs.prog_data->urb_read_length;
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_sf.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_sf.c
@@ -74,6 +74,11 @@
if (c.key.attrs & (1<= VERT_RESULT_TEX0 && i <= VERT_RESULT_TEX7) {
+ c.point_attrs[i].CoordReplace =
+ brw->attribs.Point->CoordReplace[i - VERT_RESULT_TEX0];
+ } else
+ c.point_attrs[i].CoordReplace = GL_FALSE;
idx++;
}
@@ -90,7 +95,10 @@
break;
case SF_POINTS:
c.nr_verts = 1;
- brw_emit_point_setup( &c, GL_TRUE );
+ if (key->do_point_sprite)
+ brw_emit_point_sprite_setup( &c, GL_TRUE );
+ else
+ brw_emit_point_setup( &c, GL_TRUE );
break;
case SF_UNFILLED_TRIS:
c.nr_verts = 3;
@@ -162,7 +170,8 @@
break;
}
-
+ key.do_point_sprite = brw->attribs.Point->PointSprite;
+ key.SpriteOrigin = brw->attribs.Point->SpriteOrigin;
/* _NEW_LIGHT */
key.do_flat_shading = (brw->attribs.Light->ShadeModel == GL_FLAT);
key.do_twoside_color = (brw->attribs.Light->Enabled && brw->attribs.Light->Model.TwoSide);
@@ -179,7 +188,7 @@
const struct brw_tracked_state brw_sf_prog = {
.dirty = {
- .mesa = (_NEW_LIGHT|_NEW_POLYGON),
+ .mesa = (_NEW_LIGHT|_NEW_POLYGON|_NEW_POINT),
.brw = (BRW_NEW_REDUCED_PRIMITIVE),
.cache = CACHE_NEW_VS_PROG
},
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_sf.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_sf.h
@@ -45,14 +45,19 @@
#define SF_UNFILLED_TRIS 3
struct brw_sf_prog_key {
+ GLuint attrs:32;
GLuint primitive:2;
GLuint do_twoside_color:1;
GLuint do_flat_shading:1;
- GLuint attrs:16;
GLuint frontface_ccw:1;
- GLuint pad:11;
+ GLuint do_point_sprite:1;
+ GLuint pad:10;
+ GLenum SpriteOrigin;
};
+struct brw_sf_point_tex {
+ GLboolean CoordReplace;
+};
struct brw_sf_compile {
struct brw_compile func;
@@ -94,12 +99,14 @@
GLubyte attr_to_idx[VERT_RESULT_MAX];
GLubyte idx_to_attr[VERT_RESULT_MAX];
+ struct brw_sf_point_tex point_attrs[VERT_RESULT_MAX];
};
void brw_emit_tri_setup( struct brw_sf_compile *c, GLboolean allocate );
void brw_emit_line_setup( struct brw_sf_compile *c, GLboolean allocate );
void brw_emit_point_setup( struct brw_sf_compile *c, GLboolean allocate );
+void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate );
void brw_emit_anyprim_setup( struct brw_sf_compile *c );
#endif
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_metaops.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_metaops.c
@@ -195,7 +195,7 @@
vp_prog, strlen(vp_prog),
brw->metaops.vp);
- brw->metaops.attribs.VertexProgram->Current = brw->metaops.vp;
+ brw->metaops.attribs.VertexProgram->_Current = brw->metaops.vp;
brw->metaops.attribs.VertexProgram->_Enabled = GL_TRUE;
brw->metaops.attribs.FragmentProgram->_Current = brw->metaops.fp;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -249,7 +249,7 @@
memset(&bd, 0, sizeof(bd));
bd.header.bits.opcode = CMD_DEPTH_BUFFER;
- bd.header.bits.length = BRW_IS_IGD(brw) ? (sizeof(bd)/4-2) : (sizeof(bd)/4-3);
+ bd.header.bits.length = (BRW_IS_GM45(brw) || BRW_IS_G4X(brw)) ? (sizeof(bd)/4-2) : (sizeof(bd)/4-3);
bd.dword1.bits.pitch = (region->pitch * region->cpp) - 1;
switch (region->cpp) {
@@ -366,7 +366,7 @@
{
struct brw_aa_line_parameters balp;
- if (!BRW_IS_IGD(brw))
+ if (!(BRW_IS_GM45(brw) || BRW_IS_G4X(brw)))
return;
/* use legacy aa line coverage computation */
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_program.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_program.c
@@ -125,6 +125,9 @@
struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program;
if (p == vp)
brw->state.dirty.brw |= BRW_NEW_VERTEX_PROGRAM;
+ if (p->program.IsPositionInvariant) {
+ _mesa_insert_mvp_code(ctx, &p->program);
+ }
p->id = brw->program_id++;
p->param_state = p->program.Base.Parameters->StateFlags;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_structs.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_structs.h
@@ -1362,7 +1362,7 @@
GLuint msg_target:4;
GLuint pad1:3;
GLuint end_of_thread:1;
- } sampler_igd;
+ } sampler_gm45_g4x;
struct brw_urb_immediate urb;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_tex.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_tex.c
@@ -154,13 +154,19 @@
case GL_RGB_S3TC:
case GL_RGB4_S3TC:
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgb_dxt1;
+
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ return &_mesa_texformat_rgba_dxt1;
+
case GL_RGBA_S3TC:
case GL_RGBA4_S3TC:
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ return &_mesa_texformat_rgba_dxt3;
+
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- return &_mesa_texformat_rgb_dxt1; /* there is no rgba support? */
+ return &_mesa_texformat_rgba_dxt5;
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16:
@@ -168,6 +174,25 @@
case GL_DEPTH_COMPONENT32:
return &_mesa_texformat_z16;
+ case GL_SRGB_EXT:
+ case GL_SRGB8_EXT:
+ case GL_SRGB_ALPHA_EXT:
+ case GL_SRGB8_ALPHA8_EXT:
+ case GL_SLUMINANCE_EXT:
+ case GL_SLUMINANCE8_EXT:
+ case GL_SLUMINANCE_ALPHA_EXT:
+ case GL_SLUMINANCE8_ALPHA8_EXT:
+ case GL_COMPRESSED_SRGB_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_EXT:
+ case GL_COMPRESSED_SLUMINANCE_EXT:
+ case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
+ return &_mesa_texformat_srgba8;
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ return &_mesa_texformat_srgb_dxt1;
+
default:
fprintf(stderr, "unexpected texture format %s in %s\n",
_mesa_lookup_enum_by_nr(internalFormat),
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_tex_layout.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_tex_layout.c
@@ -37,7 +37,6 @@
#include "intel_tex_layout.h"
#include "macros.h"
-
GLboolean brw_miptree_layout( struct intel_context *intel, struct intel_mipmap_tree *mt )
{
/* XXX: these vary depending on image format:
@@ -53,11 +52,20 @@
GLuint pack_x_pitch, pack_x_nr;
GLuint pack_y_pitch;
GLuint level;
+ GLuint align_h = 2;
+ GLuint align_w = 4;
- mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
+
+ if (mt->compressed) {
+ align_w = intel_compressed_alignment(mt->internal_format);
+ mt->pitch = ALIGN(width, align_w);
+ pack_y_pitch = (height + 3) / 4;
+ } else {
+ mt->pitch = ALIGN(mt->width0 * mt->cpp, 4) / mt->cpp;
+ pack_y_pitch = ALIGN(mt->height0, align_h);
+ }
- pack_y_pitch = MAX2(mt->height0, 2);
pack_x_pitch = mt->pitch;
pack_x_nr = 1;
@@ -83,20 +91,30 @@
mt->total_height += y;
-
- if (pack_x_pitch > 4) {
- pack_x_pitch >>= 1;
- pack_x_nr <<= 1;
- assert(pack_x_pitch * pack_x_nr <= mt->pitch);
- }
-
- if (pack_y_pitch > 2) {
- pack_y_pitch >>= 1;
- }
-
width = minify(width);
height = minify(height);
depth = minify(depth);
+
+ if (mt->compressed) {
+ pack_y_pitch = (height + 3) / 4;
+
+ if (pack_x_pitch > ALIGN(width, align_w)) {
+ pack_x_pitch = ALIGN(width, align_w);
+ pack_x_nr <<= 1;
+ }
+ } else {
+ if (pack_x_pitch > 4) {
+ pack_x_pitch >>= 1;
+ pack_x_nr <<= 1;
+ assert(pack_x_pitch * pack_x_nr <= mt->pitch);
+ }
+
+ if (pack_y_pitch > 2) {
+ pack_y_pitch >>= 1;
+ pack_y_pitch = ALIGN(pack_y_pitch, align_h);
+ }
+ }
+
}
break;
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_urb.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_urb.c
@@ -53,7 +53,7 @@
GLuint min_entry_size;
GLuint max_entry_size;
} limits[CS+1] = {
- { 8, 32, 1, 5 }, /* vs */
+ { 16, 32, 1, 5 }, /* vs */
{ 4, 8, 1, 5 }, /* gs */
{ 6, 8, 1, 5 }, /* clp */
{ 1, 8, 1, 12 }, /* sf */
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_vs.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_vs.h
@@ -67,6 +67,12 @@
struct brw_reg r1;
struct brw_reg regs[PROGRAM_ADDRESS+1][128];
struct brw_reg tmp;
+ struct brw_reg stack;
+
+ struct {
+ GLboolean used_in_src;
+ struct brw_reg reg;
+ } output_regs[128];
struct brw_reg userplane[6];
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_sf_emit.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_sf_emit.c
@@ -503,6 +503,90 @@
}
}
+void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate )
+{
+ struct brw_compile *p = &c->func;
+ GLuint i;
+
+ c->nr_verts = 1;
+
+ if (allocate)
+ alloc_regs(c);
+
+ copy_z_inv_w(c);
+ for (i = 0; i < c->nr_setup_regs; i++)
+ {
+ struct brw_sf_point_tex *tex = &c->point_attrs[c->idx_to_attr[2*i]];
+ struct brw_reg a0 = offset(c->vert[0], i);
+ GLushort pc, pc_persp, pc_linear;
+ GLboolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
+
+ if (pc_persp)
+ {
+ if (!tex->CoordReplace) {
+ brw_set_predicate_control_flag_value(p, pc_persp);
+ brw_MUL(p, a0, a0, c->inv_w[0]);
+ }
+ }
+
+ if (tex->CoordReplace) {
+ /* Caculate 1.0/PointWidth */
+ brw_math(&c->func,
+ c->tmp,
+ BRW_MATH_FUNCTION_INV,
+ BRW_MATH_SATURATE_NONE,
+ 0,
+ c->dx0,
+ BRW_MATH_DATA_SCALAR,
+ BRW_MATH_PRECISION_FULL);
+
+ if (c->key.SpriteOrigin == GL_LOWER_LEFT) {
+ brw_MUL(p, c->m1Cx, c->tmp, c->inv_w[0]);
+ brw_MOV(p, vec1(suboffset(c->m1Cx, 1)), brw_imm_f(0.0));
+ brw_MUL(p, c->m2Cy, c->tmp, negate(c->inv_w[0]));
+ brw_MOV(p, vec1(suboffset(c->m2Cy, 0)), brw_imm_f(0.0));
+ } else {
+ brw_MUL(p, c->m1Cx, c->tmp, c->inv_w[0]);
+ brw_MOV(p, vec1(suboffset(c->m1Cx, 1)), brw_imm_f(0.0));
+ brw_MUL(p, c->m2Cy, c->tmp, c->inv_w[0]);
+ brw_MOV(p, vec1(suboffset(c->m2Cy, 0)), brw_imm_f(0.0));
+ }
+ } else {
+ brw_MOV(p, c->m1Cx, brw_imm_ud(0));
+ brw_MOV(p, c->m2Cy, brw_imm_ud(0));
+ }
+
+ {
+ brw_set_predicate_control_flag_value(p, pc);
+ if (tex->CoordReplace) {
+ if (c->key.SpriteOrigin == GL_LOWER_LEFT) {
+ brw_MUL(p, c->m3C0, c->inv_w[0], brw_imm_f(1.0));
+ brw_MOV(p, vec1(suboffset(c->m3C0, 0)), brw_imm_f(0.0));
+ }
+ else
+ brw_MOV(p, c->m3C0, brw_imm_f(0.0));
+ } else {
+ brw_MOV(p, c->m3C0, a0); /* constant value */
+ }
+
+ /* Copy m0..m3 to URB.
+ */
+ brw_urb_WRITE(p,
+ brw_null_reg(),
+ 0,
+ brw_vec8_grf(0, 0),
+ 0, /* allocate */
+ 1, /* used */
+ 4, /* msg len */
+ 0, /* response len */
+ last, /* eot */
+ last, /* writes complete */
+ i*4, /* urb destination offset */
+ BRW_URB_SWIZZLE_TRANSPOSE);
+ }
+ }
+}
+
/* Points setup - several simplifications as all attributes are
* constant across the face of the point (point sprites excluded!)
*/
@@ -569,6 +653,7 @@
struct brw_compile *p = &c->func;
struct brw_reg ip = brw_ip_reg();
struct brw_reg payload_prim = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0);
+ struct brw_reg payload_attr = get_element_ud(brw_vec1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0), 0);
struct brw_reg primmask;
struct brw_instruction *jmp;
struct brw_reg v1_null_ud = vec1(retype(brw_null_reg(), BRW_REGISTER_TYPE_UD));
@@ -623,6 +708,19 @@
}
brw_land_fwd_jump(p, jmp);
+ brw_set_conditionalmod(p, BRW_CONDITIONAL_Z);
+ brw_AND(p, v1_null_ud, payload_attr, brw_imm_ud(1<flag_value;
+ brw_push_insn_state(p);
+ brw_emit_point_sprite_setup( c, GL_FALSE );
+ brw_pop_insn_state(p);
+ p->flag_value = saveflag;
+ /* note - thread killed in subroutine */
+ }
+ brw_land_fwd_jump(p, jmp);
+
brw_emit_point_setup( c, GL_FALSE );
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_sf_state.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_sf_state.c
@@ -38,6 +38,8 @@
static void upload_sf_vp(struct brw_context *brw)
{
+ GLcontext *ctx = &brw->intel.ctx;
+ const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
struct brw_sf_viewport sfv;
memset(&sfv, 0, sizeof(sfv));
@@ -47,14 +49,14 @@
/* _NEW_VIEWPORT, BRW_NEW_METAOPS */
if (!brw->metaops.active) {
- const GLfloat *v = brw->intel.ctx.Viewport._WindowMap.m;
+ const GLfloat *v = ctx->Viewport._WindowMap.m;
sfv.viewport.m00 = v[MAT_SX];
sfv.viewport.m11 = - v[MAT_SY];
- sfv.viewport.m22 = v[MAT_SZ] * brw->intel.depth_scale;
+ sfv.viewport.m22 = v[MAT_SZ] * depth_scale;
sfv.viewport.m30 = v[MAT_TX];
sfv.viewport.m31 = - v[MAT_TY] + brw->intel.driDrawable->h;
- sfv.viewport.m32 = v[MAT_TZ] * brw->intel.depth_scale;
+ sfv.viewport.m32 = v[MAT_TZ] * depth_scale;
}
else {
sfv.viewport.m00 = 1;
@@ -118,7 +120,7 @@
memset(&sf, 0, sizeof(sf));
/* CACHE_NEW_SF_PROG */
- sf.thread0.grf_reg_count = ((brw->sf.prog_data->total_grf-1) & ~15) / 16;
+ sf.thread0.grf_reg_count = ALIGN(brw->sf.prog_data->total_grf, 16) / 16 - 1;
sf.thread0.kernel_start_pointer = brw->sf.prog_gs_offset >> 6;
sf.thread3.urb_entry_read_length = brw->sf.prog_data->urb_read_length;
@@ -184,6 +186,7 @@
/* _NEW_POINT */
sf.sf6.point_rast_rule = 1; /* opengl conventions */
sf.sf7.point_size = brw->attribs.Point->_Size * (1<<3);
+ sf.sf7.sprite_point = brw->attribs.Point->PointSprite;
sf.sf7.use_point_size_state = !brw->attribs.Point->_Attenuated;
sf.sf7.aa_line_distance_mode = 0;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -134,6 +134,16 @@
WRITEMASK_X);
reg++;
}
+
+ for (i = 0; i < 128; i++) {
+ if (c->output_regs[i].used_in_src) {
+ c->output_regs[i].reg = brw_vec8_grf(reg, 0);
+ reg++;
+ }
+ }
+
+ c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg, 0);
+ reg += 2;
/* Some opcodes need an internal temporary:
@@ -213,57 +223,65 @@
}
}
+static void emit_sop( struct brw_compile *p,
+ struct brw_reg dst,
+ struct brw_reg arg0,
+ struct brw_reg arg1,
+ GLuint cond)
+{
+ brw_MOV(p, dst, brw_imm_f(0.0f));
+ brw_CMP(p, brw_null_reg(), cond, arg0, arg1);
+ brw_MOV(p, dst, brw_imm_f(1.0f));
+ brw_set_predicate_control_flag_value(p, 0xff);
+}
+static void emit_seq( struct brw_compile *p,
+ struct brw_reg dst,
+ struct brw_reg arg0,
+ struct brw_reg arg1 )
+{
+ emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_EQ);
+}
-
+static void emit_sne( struct brw_compile *p,
+ struct brw_reg dst,
+ struct brw_reg arg0,
+ struct brw_reg arg1 )
+{
+ emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_NEQ);
+}
static void emit_slt( struct brw_compile *p,
struct brw_reg dst,
struct brw_reg arg0,
struct brw_reg arg1 )
{
- /* Could be done with an if/else/endif, but this method uses half
- * the instructions. Note that we are careful to reference the
- * arguments before writing the dest. That means we emit the
- * instructions in an odd order and have to play with the flag
- * values.
- */
- brw_push_insn_state(p);
- brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0, arg1);
-
- /* Write all values to 1:
- */
- brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_MOV(p, dst, brw_imm_f(1.0));
+ emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_L);
+}
- /* Where the test succeeded, overwite with zero:
- */
- brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
- brw_MOV(p, dst, brw_imm_f(0.0));
- brw_pop_insn_state(p);
+static void emit_sle( struct brw_compile *p,
+ struct brw_reg dst,
+ struct brw_reg arg0,
+ struct brw_reg arg1 )
+{
+ emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_LE);
}
+static void emit_sgt( struct brw_compile *p,
+ struct brw_reg dst,
+ struct brw_reg arg0,
+ struct brw_reg arg1 )
+{
+ emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_G);
+}
static void emit_sge( struct brw_compile *p,
struct brw_reg dst,
struct brw_reg arg0,
struct brw_reg arg1 )
{
- brw_push_insn_state(p);
- brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_GE, arg0, arg1);
-
- /* Write all values to zero:
- */
- brw_set_predicate_control(p, BRW_PREDICATE_NONE);
- brw_MOV(p, dst, brw_imm_f(0));
-
- /* Where the test succeeded, overwite with 1:
- */
- brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
- brw_MOV(p, dst, brw_imm_f(1.0));
- brw_pop_insn_state(p);
+ emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_GE);
}
-
static void emit_max( struct brw_compile *p,
struct brw_reg dst,
struct brw_reg arg0,
@@ -592,9 +610,13 @@
case PROGRAM_TEMPORARY:
case PROGRAM_INPUT:
case PROGRAM_OUTPUT:
- case PROGRAM_STATE_VAR:
assert(c->regs[file][index].nr != 0);
return c->regs[file][index];
+ case PROGRAM_STATE_VAR:
+ case PROGRAM_CONSTANT:
+ case PROGRAM_UNIFORM:
+ assert(c->regs[PROGRAM_STATE_VAR][index].nr != 0);
+ return c->regs[PROGRAM_STATE_VAR][index];
case PROGRAM_ADDRESS:
assert(index == 0);
return c->regs[file][index];
@@ -668,28 +690,28 @@
* account.
*/
static struct brw_reg get_arg( struct brw_vs_compile *c,
- struct prog_src_register src )
+ struct prog_src_register *src )
{
struct brw_reg reg;
- if (src.File == PROGRAM_UNDEFINED)
+ if (src->File == PROGRAM_UNDEFINED)
return brw_null_reg();
- if (src.RelAddr)
- reg = deref(c, c->regs[PROGRAM_STATE_VAR][0], src.Index);
+ if (src->RelAddr)
+ reg = deref(c, c->regs[PROGRAM_STATE_VAR][0], src->Index);
else
- reg = get_reg(c, src.File, src.Index);
+ reg = get_reg(c, src->File, src->Index);
/* Convert 3-bit swizzle to 2-bit.
*/
- reg.dw1.bits.swizzle = BRW_SWIZZLE4(GET_SWZ(src.Swizzle, 0),
- GET_SWZ(src.Swizzle, 1),
- GET_SWZ(src.Swizzle, 2),
- GET_SWZ(src.Swizzle, 3));
+ reg.dw1.bits.swizzle = BRW_SWIZZLE4(GET_SWZ(src->Swizzle, 0),
+ GET_SWZ(src->Swizzle, 1),
+ GET_SWZ(src->Swizzle, 2),
+ GET_SWZ(src->Swizzle, 3));
/* Note this is ok for non-swizzle instructions:
*/
- reg.negate = src.NegateBase ? 1 : 0;
+ reg.negate = src->NegateBase ? 1 : 0;
return reg;
}
@@ -845,7 +867,7 @@
* Later, clipping will detect ucp[6] and ensure the primitive is
* clipped against all fixed planes.
*/
- if (!BRW_IS_IGD(p->brw) && !c->key.know_w_is_one) {
+ if (!(BRW_IS_GM45(p->brw) || BRW_IS_G4X(p->brw)) && !c->key.know_w_is_one) {
brw_CMP(p,
vec8(brw_null_reg()),
BRW_CONDITIONAL_L,
@@ -891,17 +913,50 @@
}
-
-
+static void
+post_vs_emit( struct brw_vs_compile *c, struct brw_instruction *end_inst )
+{
+ GLuint nr_insns = c->vp->program.Base.NumInstructions;
+ GLuint insn, target_insn;
+ struct prog_instruction *inst1, *inst2;
+ struct brw_instruction *brw_inst1, *brw_inst2;
+ int offset;
+ for (insn = 0; insn < nr_insns; insn++) {
+ inst1 = &c->vp->program.Base.Instructions[insn];
+ brw_inst1 = inst1->Data;
+ switch (inst1->Opcode) {
+ case OPCODE_CAL:
+ case OPCODE_BRA:
+ target_insn = inst1->BranchTarget;
+ inst2 = &c->vp->program.Base.Instructions[target_insn];
+ brw_inst2 = inst2->Data;
+ offset = brw_inst2 - brw_inst1;
+ brw_set_src1(brw_inst1, brw_imm_d(offset*16));
+ break;
+ case OPCODE_END:
+ offset = end_inst - brw_inst1;
+ brw_set_src1(brw_inst1, brw_imm_d(offset*16));
+ break;
+ default:
+ break;
+ }
+ }
+}
/* Emit the fragment program instructions here.
*/
-void brw_vs_emit( struct brw_vs_compile *c )
+void brw_vs_emit(struct brw_vs_compile *c )
{
+#define MAX_IFSN 32
struct brw_compile *p = &c->func;
GLuint nr_insns = c->vp->program.Base.NumInstructions;
- GLuint insn;
+ GLuint insn, if_insn = 0;
+ struct brw_instruction *end_inst;
+ struct brw_instruction *if_inst[MAX_IFSN];
+ struct brw_indirect stack_index = brw_indirect(0, 0);
+ GLuint index;
+ GLuint file;
if (INTEL_DEBUG & DEBUG_VS) {
_mesa_printf("\n\n\nvs-emit:\n");
@@ -912,9 +967,24 @@
brw_set_compression_control(p, BRW_COMPRESSION_NONE);
brw_set_access_mode(p, BRW_ALIGN_16);
+ /* Message registers can't be read, so copy the output into GRF register
+ if they are used in source registers */
+ for (insn = 0; insn < nr_insns; insn++) {
+ GLuint i;
+ struct prog_instruction *inst = &c->vp->program.Base.Instructions[insn];
+ for (i = 0; i < 3; i++) {
+ struct prog_src_register *src = &inst->SrcReg[i];
+ GLuint index = src->Index;
+ GLuint file = src->File;
+ if (file == PROGRAM_OUTPUT && index != VERT_RESULT_HPOS)
+ c->output_regs[index].used_in_src = GL_TRUE;
+ }
+ }
+
/* Static register allocation
*/
brw_vs_alloc_regs(c);
+ brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack));
for (insn = 0; insn < nr_insns; insn++) {
@@ -924,17 +994,29 @@
/* Get argument regs. SWZ is special and does this itself.
*/
+ inst->Data = &p->store[p->nr_insn];
if (inst->Opcode != OPCODE_SWZ)
- for (i = 0; i < 3; i++)
- args[i] = get_arg(c, inst->SrcReg[i]);
+ for (i = 0; i < 3; i++) {
+ struct prog_src_register *src = &inst->SrcReg[i];
+ index = src->Index;
+ file = src->File;
+ if (file == PROGRAM_OUTPUT&&c->output_regs[index].used_in_src)
+ args[i] = c->output_regs[index].reg;
+ else
+ args[i] = get_arg(c, src);
+ }
/* Get dest regs. Note that it is possible for a reg to be both
* dst and arg, given the static allocation of registers. So
* care needs to be taken emitting multi-operation instructions.
- */
- dst = get_dst(c, inst->DstReg);
+ */
+ index = inst->DstReg.Index;
+ file = inst->DstReg.File;
+ if (file == PROGRAM_OUTPUT && c->output_regs[index].used_in_src)
+ dst = c->output_regs[index].reg;
+ else
+ dst = get_dst(c, inst->DstReg);
-
switch (inst->Opcode) {
case OPCODE_ABS:
brw_MOV(p, dst, brw_abs(args[0]));
@@ -1003,12 +1085,25 @@
case OPCODE_RSQ:
emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, args[0], BRW_MATH_PRECISION_FULL);
break;
+
+ case OPCODE_SEQ:
+ emit_seq(p, dst, args[0], args[1]);
+ break;
+ case OPCODE_SNE:
+ emit_sne(p, dst, args[0], args[1]);
+ break;
case OPCODE_SGE:
emit_sge(p, dst, args[0], args[1]);
break;
+ case OPCODE_SGT:
+ emit_sgt(p, dst, args[0], args[1]);
+ break;
case OPCODE_SLT:
emit_slt(p, dst, args[0], args[1]);
break;
+ case OPCODE_SLE:
+ emit_sle(p, dst, args[0], args[1]);
+ break;
case OPCODE_SUB:
brw_ADD(p, dst, args[0], negate(args[1]));
break;
@@ -1021,21 +1116,60 @@
case OPCODE_XPD:
emit_xpd(p, dst, args[0], args[1]);
break;
+ case OPCODE_IF:
+ assert(if_insn < MAX_IFSN);
+ if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8);
+ break;
+ case OPCODE_ELSE:
+ if_inst[if_insn-1] = brw_ELSE(p, if_inst[if_insn-1]);
+ break;
+ case OPCODE_ENDIF:
+ assert(if_insn > 0);
+ brw_ENDIF(p, if_inst[--if_insn]);
+ break;
+ case OPCODE_BRA:
+ brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
+ brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));
+ brw_set_predicate_control_flag_value(p, 0xff);
+ break;
+ case OPCODE_CAL:
+ brw_set_access_mode(p, BRW_ALIGN_1);
+ brw_ADD(p, deref_1d(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16));
+ brw_set_access_mode(p, BRW_ALIGN_16);
+ brw_ADD(p, get_addr_reg(stack_index),
+ get_addr_reg(stack_index), brw_imm_d(4));
+ inst->Data = &p->store[p->nr_insn];
+ brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));
+ break;
+ case OPCODE_RET:
+ brw_ADD(p, get_addr_reg(stack_index),
+ get_addr_reg(stack_index), brw_imm_d(-4));
+ brw_set_access_mode(p, BRW_ALIGN_1);
+ brw_MOV(p, brw_ip_reg(), deref_1d(stack_index, 0));
+ brw_set_access_mode(p, BRW_ALIGN_16);
case OPCODE_END:
+ brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));
+ break;
case OPCODE_PRINT:
+ case OPCODE_BGNSUB:
+ case OPCODE_ENDSUB:
break;
default:
+ _mesa_printf("Unsupport opcode %d in vertex shader\n", inst->Opcode);
break;
}
+ if (inst->DstReg.File == PROGRAM_OUTPUT
+ &&inst->DstReg.Index != VERT_RESULT_HPOS
+ &&c->output_regs[inst->DstReg.Index].used_in_src)
+ brw_MOV(p, get_dst(c, inst->DstReg), dst);
+
release_tmps(c);
}
+ end_inst = &p->store[p->nr_insn];
emit_vertex_write(c);
-
+ post_vs_emit(c, end_inst);
+ for (insn = 0; insn < nr_insns; insn++)
+ c->vp->program.Base.Instructions[insn].Data = NULL;
}
-
-
-
-
-
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_vs_tnl.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_vs_tnl.c
@@ -524,10 +524,13 @@
GLuint nr = p->program->Base.NumInstructions++;
if (nr >= p->nr_instructions) {
+ int new_nr_instructions = p->nr_instructions * 2;
+
p->program->Base.Instructions =
_mesa_realloc(p->program->Base.Instructions,
sizeof(struct prog_instruction) * p->nr_instructions,
- sizeof(struct prog_instruction) * (p->nr_instructions *= 2));
+ sizeof(struct prog_instruction) * new_nr_instructions);
+ p->nr_instructions = new_nr_instructions;
}
{
@@ -1167,6 +1170,11 @@
}
else {
input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
+ if (p->state->fog_option &&
+ p->state->tnl_do_vertex_fog)
+ input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
+ else
+ input = register_input(p, VERT_ATTRIB_FOG);
}
if (p->state->fog_option &&
@@ -1575,7 +1583,7 @@
struct gl_vertex_program *old = brw->tnl_program;
/* _NEW_PROGRAM */
- if (brw->attribs.VertexProgram->_Enabled)
+ if (brw->attribs.VertexProgram->_Current)
return;
/* Grab all the relevent state and put it in a single structure:
@@ -1622,7 +1630,8 @@
_NEW_FOG |
_NEW_HINT |
_NEW_POINT |
- _NEW_TEXTURE),
+ _NEW_TEXTURE |
+ _NEW_TEXTURE_MATRIX),
.brw = (BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_INPUT_VARYING),
.cache = 0
@@ -1638,8 +1647,8 @@
const struct gl_vertex_program *prev = brw->vertex_program;
/* NEW_PROGRAM */
- if (brw->attribs.VertexProgram->_Enabled) {
- brw->vertex_program = brw->attribs.VertexProgram->Current;
+ if (brw->attribs.VertexProgram->_Current) {
+ brw->vertex_program = brw->attribs.VertexProgram->_Current;
}
else {
/* BRW_NEW_TNL_PROGRAM */
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm.c
@@ -29,7 +29,7 @@
* Keith Whitwell
*/
-
+#include "main/texformat.h"
#include "brw_context.h"
#include "brw_util.h"
#include "brw_wm.h"
@@ -66,7 +66,11 @@
case OPCODE_POW:
case OPCODE_SUB:
case OPCODE_SGE:
+ case OPCODE_SGT:
+ case OPCODE_SLE:
case OPCODE_SLT:
+ case OPCODE_SEQ:
+ case OPCODE_SNE:
case OPCODE_ADD:
case OPCODE_MAX:
case OPCODE_MIN:
@@ -150,46 +154,50 @@
c->fp = fp;
c->env_param = brw->intel.ctx.FragmentProgram.Parameters;
- /* Augment fragment program. Add instructions for pre- and
- * post-fragment-program tasks such as interpolation and fogging.
- */
- brw_wm_pass_fp(c);
+ if (brw_wm_is_glsl(&c->fp->program)) {
+ brw_wm_glsl_emit(brw, c);
+ } else {
+ /* Augment fragment program. Add instructions for pre- and
+ * post-fragment-program tasks such as interpolation and fogging.
+ */
+ brw_wm_pass_fp(c);
- /* Translate to intermediate representation. Build register usage
- * chains.
- */
- brw_wm_pass0(c);
-
- /* Dead code removal.
- */
- brw_wm_pass1(c);
-
- /* Hal optimization
- */
- brw_wm_pass_hal (c);
+ /* Translate to intermediate representation. Build register usage
+ * chains.
+ */
+ brw_wm_pass0(c);
+
+ /* Dead code removal.
+ */
+ brw_wm_pass1(c);
+
+ /* Hal optimization
+ */
+ brw_wm_pass_hal (c);
- /* Register allocation.
- */
- c->grf_limit = BRW_WM_MAX_GRF/2;
-
- /* This is where we start emitting gen4 code:
- */
- brw_init_compile(brw, &c->func);
-
- brw_wm_pass2(c);
-
- c->prog_data.total_grf = c->max_wm_grf;
- if (c->last_scratch) {
- c->prog_data.total_scratch =
- c->last_scratch + 0x40;
- } else {
- c->prog_data.total_scratch = 0;
+ /* Register allocation.
+ */
+ c->grf_limit = BRW_WM_MAX_GRF/2;
+
+ /* This is where we start emitting gen4 code:
+ */
+ brw_init_compile(brw, &c->func);
+
+ brw_wm_pass2(c);
+
+ c->prog_data.total_grf = c->max_wm_grf;
+ if (c->last_scratch) {
+ c->prog_data.total_scratch =
+ c->last_scratch + 0x40;
+ } else {
+ c->prog_data.total_scratch = 0;
+ }
+
+ /* Emit GEN4 code.
+ */
+ brw_wm_emit(c);
}
- /* Emit GEN4 code.
- */
- brw_wm_emit(c);
-
/* get the program
*/
program = brw_get_program(&c->func, &program_size);
@@ -242,7 +250,8 @@
lookup |= IZ_STENCIL_TEST_ENABLE_BIT;
if (brw->attribs.Stencil->WriteMask[0] ||
- (brw->attribs.Stencil->TestTwoSide && brw->attribs.Stencil->WriteMask[1]))
+ (brw->attribs.Stencil->_TestTwoSide &&
+ brw->attribs.Stencil->WriteMask[1]))
lookup |= IZ_STENCIL_WRITE_ENABLE_BIT;
}
@@ -284,7 +293,7 @@
/* BRW_NEW_WM_INPUT_DIMENSIONS */
- key->projtex_mask = brw->wm.input_size_masks[4-1];
+ key->projtex_mask = brw->wm.input_size_masks[4-1] >> (FRAG_ATTRIB_TEX0 - FRAG_ATTRIB_WPOS);
/* _NEW_LIGHT */
key->flat_shade = (brw->attribs.Light->ShadeModel == GL_FLAT);
@@ -301,11 +310,38 @@
key->shadowtex_mask |= 1<Image[0][t->BaseLevel]->InternalFormat == GL_YCBCR_MESA)
+ if (t->Image[0][t->BaseLevel]->InternalFormat == GL_YCBCR_MESA) {
key->yuvtex_mask |= 1<Image[0][t->BaseLevel]->TexFormat->MesaFormat ==
+ MESA_FORMAT_YCBCR)
+ key->yuvtex_swap_mask |= 1<< i;
+ }
}
}
-
+
+ /* _NEW_BUFFERS */
+ /*
+ * Include the draw buffer origin and height so that we can calculate
+ * fragment position values relative to the bottom left of the drawable,
+ * from the incoming screen origin relative position we get as part of our
+ * payload.
+ *
+ * We could avoid recompiling by including this as a constant referenced by
+ * our program, but if we were to do that it would also be nice to handle
+ * getting that constant updated at batchbuffer submit time (when we
+ * hold the lock and know where the buffer really is) rather than at emit
+ * time when we don't hold the lock and are just guessing. We could also
+ * just avoid using this as key data if the program doesn't use
+ * fragment.position.
+ *
+ * This pretty much becomes moot with DRI2 and redirected buffers anyway,
+ * as our origins will always be zero then.
+ */
+ if (brw->intel.driDrawable != NULL) {
+ key->origin_x = brw->intel.driDrawable->x;
+ key->origin_y = brw->intel.driDrawable->y;
+ key->drawable_height = brw->intel.driDrawable->h;
+ }
/* Extra info:
*/
@@ -344,6 +380,7 @@
_NEW_POLYGON |
_NEW_LINE |
_NEW_LIGHT |
+ _NEW_BUFFERS |
_NEW_TEXTURE),
.brw = (BRW_NEW_FRAGMENT_PROGRAM |
BRW_NEW_WM_INPUT_DIMENSIONS |
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm.h
@@ -69,9 +69,12 @@
GLuint runtime_check_aads_emit:1;
GLuint yuvtex_mask:8;
- GLuint pad1:24;
+ GLuint yuvtex_swap_mask:8; /* UV swaped */
+ GLuint pad1:16;
GLuint program_string_id:32;
+ GLuint origin_x, origin_y;
+ GLuint drawable_height;
};
@@ -194,6 +197,7 @@
GLuint nr_fp_insns;
GLuint fp_temp;
GLuint fp_interp_emitted;
+ GLuint fp_deriv_emitted;
struct prog_src_register pixel_xy;
struct prog_src_register delta_xy;
@@ -231,6 +235,15 @@
GLuint grf_limit;
GLuint max_wm_grf;
GLuint last_scratch;
+
+ struct {
+ GLboolean inited;
+ struct brw_reg reg;
+ } wm_regs[PROGRAM_PAYLOAD+1][256][4];
+ struct brw_reg stack;
+ struct brw_reg emit_mask_reg;
+ GLuint reg_index;
+ GLuint tmp_index;
};
@@ -259,4 +272,6 @@
GLuint lookup,
struct brw_wm_prog_key *key );
+GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp);
+void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c);
#endif
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm_emit.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm_emit.c
@@ -122,26 +122,30 @@
}
}
-static void emit_wpos_xy(struct brw_compile *p,
- const struct brw_reg *dst,
- GLuint mask,
- const struct brw_reg *arg0)
+static void emit_wpos_xy(struct brw_wm_compile *c,
+ const struct brw_reg *dst,
+ GLuint mask,
+ const struct brw_reg *arg0)
{
- /* Calc delta X,Y by subtracting origin in r1 from the pixel
- * centers.
+ struct brw_compile *p = &c->func;
+
+ /* Calculate the pixel offset from window bottom left into destination
+ * X and Y channels.
*/
if (mask & WRITEMASK_X) {
- brw_MOV(p,
+ /* X' = X - origin */
+ brw_ADD(p,
dst[0],
- retype(arg0[0], BRW_REGISTER_TYPE_UW));
+ retype(arg0[0], BRW_REGISTER_TYPE_W),
+ brw_imm_d(0 - c->key.origin_x));
}
if (mask & WRITEMASK_Y) {
- /* TODO -- window_height - Y */
- brw_MOV(p,
+ /* Y' = height - (Y - origin_y) = height + origin_y - Y */
+ brw_ADD(p,
dst[1],
- negate(retype(arg0[1], BRW_REGISTER_TYPE_UW)));
-
+ negate(retype(arg0[1], BRW_REGISTER_TYPE_W)),
+ brw_imm_d(c->key.origin_y + c->key.drawable_height - 1));
}
}
@@ -219,6 +223,10 @@
if (mask & (1<opcode);
}
for (i = 0; i < 4; i++)
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_state_cache.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_state_cache.c
@@ -149,7 +149,7 @@
GLuint hash = hash_key(key, key_size);
void *tmp = _mesa_malloc(key_size + cache->aux_size);
- if (!brw_pool_alloc(cache->pool, data_size, 6, &offset)) {
+ if (!brw_pool_alloc(cache->pool, data_size, 1 << 6, &offset)) {
/* Should not be possible:
*/
_mesa_printf("brw_pool_alloc failed\n");
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -144,7 +144,7 @@
static struct prog_dst_register get_temp( struct brw_wm_compile *c )
{
- int bit = ffs( ~c->fp_temp );
+ int bit = _mesa_ffs( ~c->fp_temp );
if (!bit) {
_mesa_printf("%s: out of temporaries\n", __FILE__);
@@ -158,7 +158,7 @@
static void release_temp( struct brw_wm_compile *c, struct prog_dst_register temp )
{
- c->fp_temp &= ~1<<(temp.Index + 1 - FIRST_INTERNAL_TEMP);
+ c->fp_temp &= ~(1 << (temp.Index - FIRST_INTERNAL_TEMP));
}
@@ -176,6 +176,7 @@
{
struct prog_instruction *inst = get_fp_inst(c);
*inst = *inst0;
+ inst->Data = (void *)inst0;
return inst;
}
@@ -201,7 +202,6 @@
inst->SrcReg[0] = src0;
inst->SrcReg[1] = src1;
inst->SrcReg[2] = src2;
-
return inst;
}
@@ -361,6 +361,37 @@
c->fp_interp_emitted |= 1<SrcReg[0].Index;
+ struct prog_src_register interp = src_reg(PROGRAM_PAYLOAD, idx);
+
+ c->fp_deriv_emitted |= 1<DstReg,
+ 0, 0, 0,
+ interp,
+ get_pixel_w(c),
+ src_undef());
+}
+
+static void emit_ddy( struct brw_wm_compile *c,
+ const struct prog_instruction *inst )
+{
+ GLuint idx = inst->SrcReg[0].Index;
+ struct prog_src_register interp = src_reg(PROGRAM_PAYLOAD, idx);
+
+ c->fp_deriv_emitted |= 1<DstReg,
+ 0, 0, 0,
+ interp,
+ get_pixel_w(c),
+ src_undef());
+}
/***********************************************************************
* Hacks to extend the program parameter and constant lists.
@@ -463,17 +494,20 @@
if (dst.WriteMask & WRITEMASK_XZ) {
+ struct prog_instruction *swz;
GLuint z = GET_SWZ(src0.Swizzle, Z);
/* dst.xz = swz src0.1zzz
*/
- emit_op(c,
- OPCODE_SWZ,
- dst_mask(dst, WRITEMASK_XZ),
- inst->SaturateMode, 0, 0,
- src_swizzle(src0, SWIZZLE_ONE, z, z, z),
- src_undef(),
- src_undef());
+ swz = emit_op(c,
+ OPCODE_SWZ,
+ dst_mask(dst, WRITEMASK_XZ),
+ inst->SaturateMode, 0, 0,
+ src_swizzle(src0, SWIZZLE_ONE, z, z, z),
+ src_undef(),
+ src_undef());
+ /* Avoid letting negation flag of src0 affect our 1 constant. */
+ swz->SrcReg[0].NegateBase &= ~NEGATE_X;
}
if (dst.WriteMask & WRITEMASK_W) {
/* dst.w = mov src1.w
@@ -496,15 +530,19 @@
struct prog_dst_register dst = inst->DstReg;
if (dst.WriteMask & WRITEMASK_XW) {
+ struct prog_instruction *swz;
+
/* dst.xw = swz src0.1111
*/
- emit_op(c,
- OPCODE_SWZ,
- dst_mask(dst, WRITEMASK_XW),
- 0, 0, 0,
- src_swizzle1(src0, SWIZZLE_ONE),
- src_undef(),
- src_undef());
+ swz = emit_op(c,
+ OPCODE_SWZ,
+ dst_mask(dst, WRITEMASK_XW),
+ 0, 0, 0,
+ src_swizzle1(src0, SWIZZLE_ONE),
+ src_undef(),
+ src_undef());
+ /* Avoid letting the negation flag of src0 affect our 1 constant. */
+ swz->SrcReg[0].NegateBase = 0;
}
@@ -618,17 +656,21 @@
src_undef());
}
else {
+ GLboolean swap_uv = c->key.yuvtex_swap_mask & (1<TexSrcUnit);
+
/*
CONST C0 = { -.5, -.0625, -.5, 1.164 }
CONST C1 = { 1.596, -0.813, 2.018, -.391 }
UYV = TEX ...
UYV.xyz = ADD UYV, C0
UYV.y = MUL UYV.y, C0.w
- RGB.xyz = MAD UYV.xxz, C1, UYV.y
+ if (UV swaped)
+ RGB.xyz = MAD UYV.zzx, C1, UYV.y
+ else
+ RGB.xyz = MAD UYV.xxz, C1, UYV.y
RGB.y = MAD UYV.z, C1.w, RGB.y
*/
struct prog_dst_register dst = inst->DstReg;
- struct prog_src_register src0 = inst->SrcReg[0];
struct prog_dst_register tmp = get_temp(c);
struct prog_src_register tmpsrc = src_reg_from_dst(tmp);
struct prog_src_register C0 = search_or_add_const4f( c, -.5, -.0625, -.5, 1.164 );
@@ -642,7 +684,7 @@
inst->SaturateMode,
inst->TexSrcUnit,
inst->TexSrcTarget,
- src0,
+ coord,
src_undef(),
src_undef());
@@ -658,6 +700,7 @@
/* YUV.y = MUL YUV.y, C0.w
*/
+
emit_op(c,
OPCODE_MUL,
dst_mask(tmp, WRITEMASK_Y),
@@ -666,13 +709,18 @@
src_swizzle1(C0, W),
src_undef());
- /* RGB.xyz = MAD YUV.xxz, C1, YUV.y
+ /*
+ * if (UV swaped)
+ * RGB.xyz = MAD YUV.zzx, C1, YUV.y
+ * else
+ * RGB.xyz = MAD YUV.xxz, C1, YUV.y
*/
+
emit_op(c,
OPCODE_MAD,
dst_mask(dst, WRITEMASK_XYZ),
0, 0, 0,
- src_swizzle(tmpsrc, X,X,Z,Z),
+ swap_uv?src_swizzle(tmpsrc, Z,Z,X,X):src_swizzle(tmpsrc, X,X,Z,Z),
C1,
src_swizzle1(tmpsrc, Y));
@@ -689,7 +737,8 @@
release_temp(c, tmp);
}
- if (inst->TexSrcTarget == GL_TEXTURE_RECTANGLE_NV)
+ if ((inst->TexSrcTarget == TEXTURE_RECT_INDEX) ||
+ (inst->TexSrcTarget == TEXTURE_CUBE_INDEX))
release_temp(c, tmpcoord);
}
@@ -710,7 +759,7 @@
return 0; /* ut2004 gun rendering !?! */
else if (src.File == PROGRAM_INPUT &&
GET_SWZ(src.Swizzle, W) == W &&
- (c->key.projtex_mask & (1<key.projtex_mask & (1<<(src.Index + FRAG_ATTRIB_WPOS - FRAG_ATTRIB_TEX0))) == 0)
return 0;
else
return 1;
@@ -939,7 +988,11 @@
case OPCODE_LIT:
precalc_lit(c, inst);
break;
-
+
+ case OPCODE_TEX:
+ precalc_tex(c, inst);
+ break;
+
case OPCODE_TXP:
precalc_txp(c, inst);
break;
@@ -957,8 +1010,16 @@
*/
out->DstReg.WriteMask = 0;
break;
-
+ case OPCODE_DDX:
+ emit_ddx(c, inst);
+ break;
+ case OPCODE_DDY:
+ emit_ddy(c, inst);
+ break;
case OPCODE_END:
+ emit_fog(c);
+ emit_fb_write(c);
+ break;
case OPCODE_PRINT:
break;
@@ -967,15 +1028,11 @@
break;
}
}
-
- emit_fog(c);
- emit_fb_write(c);
-
if (INTEL_DEBUG & DEBUG_WM) {
- _mesa_printf("\n\n\npass_fp:\n");
- print_insns( c->prog_instructions, c->nr_fp_insns );
- _mesa_printf("\n");
+ _mesa_printf("\n\n\npass_fp:\n");
+ print_insns( c->prog_instructions, c->nr_fp_insns );
+ _mesa_printf("\n");
}
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_vs_state.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_vs_state.c
@@ -44,7 +44,7 @@
/* CACHE_NEW_VS_PROG */
vs.thread0.kernel_start_pointer = brw->vs.prog_gs_offset >> 6;
- vs.thread0.grf_reg_count = ((brw->vs.prog_data->total_grf-1) & ~15) / 16;
+ vs.thread0.grf_reg_count = ALIGN(brw->vs.prog_data->total_grf, 16) / 16 - 1;
vs.thread3.urb_entry_read_length = brw->vs.prog_data->urb_read_length;
vs.thread3.const_urb_entry_read_length = brw->vs.prog_data->curb_read_length;
vs.thread3.dispatch_grf_start_reg = 1;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_blit.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_blit.c
@@ -373,7 +373,7 @@
clear_depth = 0;
if (flags & BUFFER_BIT_DEPTH) {
- clear_depth = (GLuint)(ctx->Depth.Clear * intel->ClearDepth);
+ clear_depth = (GLuint)(ctx->Depth.Clear * ctx->DrawBuffer->_DepthMax);
}
if (flags & BUFFER_BIT_STENCIL) {
@@ -537,7 +537,8 @@
{
struct xy_setup_blit setup;
struct xy_text_immediate_blit text;
- int dwords = ((src_size + 7) & ~7) / 4;
+ int dwords = ALIGN(src_size, 8) / 4;
+ uint32_t opcode, br13;
assert( logic_op - GL_CLEAR >= 0 );
assert( logic_op - GL_CLEAR < 0x10 );
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm_pass0.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm_pass0.c
@@ -168,6 +168,7 @@
case PROGRAM_PAYLOAD:
case PROGRAM_TEMPORARY:
case PROGRAM_OUTPUT:
+ case PROGRAM_VARYING:
break;
case PROGRAM_LOCAL_PARAM:
@@ -179,6 +180,8 @@
break;
case PROGRAM_STATE_VAR:
+ case PROGRAM_UNIFORM:
+ case PROGRAM_CONSTANT:
case PROGRAM_NAMED_PARAM: {
struct gl_program_parameter_list *plist = c->fp->program.Base.Parameters;
@@ -197,6 +200,7 @@
break;
case PROGRAM_STATE_VAR:
+ case PROGRAM_UNIFORM:
/* These may change from run to run:
*/
ref = get_param_ref(c, &plist->ParameterValues[idx][component] );
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm_pass1.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm_pass1.c
@@ -150,12 +150,17 @@
case OPCODE_FLR:
case OPCODE_FRC:
case OPCODE_MOV:
+ case OPCODE_SWZ:
read0 = writemask;
break;
case OPCODE_SUB:
case OPCODE_SLT:
+ case OPCODE_SLE:
case OPCODE_SGE:
+ case OPCODE_SGT:
+ case OPCODE_SEQ:
+ case OPCODE_SNE:
case OPCODE_ADD:
case OPCODE_MAX:
case OPCODE_MIN:
@@ -253,11 +258,9 @@
read0 = WRITEMASK_XYW;
break;
- case OPCODE_SWZ:
case OPCODE_DST:
case OPCODE_TXP:
default:
- assert(0);
break;
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm_pass2.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm_pass2.c
@@ -328,7 +328,7 @@
c->state = PASS2_DONE;
if (INTEL_DEBUG & DEBUG_WM) {
- brw_wm_print_program(c, "pass2/done");
+ brw_wm_print_program(c, "pass2/done");
}
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -54,7 +54,7 @@
case GL_REPEAT:
return BRW_TEXCOORDMODE_WRAP;
case GL_CLAMP:
- return BRW_TEXCOORDMODE_CLAMP_BORDER; /* conform likes it this way */
+ return BRW_TEXCOORDMODE_CLAMP;
case GL_CLAMP_TO_EDGE:
return BRW_TEXCOORDMODE_CLAMP; /* conform likes it this way */
case GL_CLAMP_TO_BORDER:
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm_state.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm_state.c
@@ -34,6 +34,7 @@
#include "brw_context.h"
#include "brw_state.h"
#include "brw_defines.h"
+#include "brw_wm.h"
#include "bufmgr.h"
/***********************************************************************
@@ -62,7 +63,7 @@
memset(&wm, 0, sizeof(wm));
/* CACHE_NEW_WM_PROG */
- wm.thread0.grf_reg_count = ((brw->wm.prog_data->total_grf-1) & ~15) / 16;
+ wm.thread0.grf_reg_count = ALIGN(brw->wm.prog_data->total_grf, 16) / 16 - 1;
wm.thread0.kernel_start_pointer = brw->wm.prog_gs_offset >> 6;
wm.thread3.dispatch_grf_start_reg = brw->wm.prog_data->first_curbe_grf;
wm.thread3.urb_entry_read_length = brw->wm.prog_data->urb_read_length;
@@ -71,7 +72,7 @@
wm.wm5.max_threads = max_threads;
if (brw->wm.prog_data->total_scratch) {
- GLuint per_thread = (brw->wm.prog_data->total_scratch + 1023) / 1024;
+ GLuint per_thread = ALIGN(brw->wm.prog_data->total_scratch, 1024);
GLuint total = per_thread * (max_threads + 1);
/* Scratch space -- just have to make sure there is sufficient
@@ -134,9 +135,13 @@
if (fp->UsesKill ||
brw->attribs.Color->AlphaEnabled)
wm.wm5.program_uses_killpixel = 1;
+
+ if (brw_wm_is_glsl(fp))
+ wm.wm5.enable_8_pix = 1;
+ else
+ wm.wm5.enable_16_pix = 1;
}
- wm.wm5.enable_16_pix = 1;
wm.wm5.thread_dispatch_enable = 1; /* AKA: color_write */
wm.wm5.legacy_line_rast = 0;
wm.wm5.legacy_global_depth_bias = 0;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -69,7 +69,7 @@
}
-static GLuint translate_tex_format( GLuint mesa_format )
+static GLuint translate_tex_format( GLuint mesa_format, GLenum depth_mode )
{
switch( mesa_format ) {
case MESA_FORMAT_L8:
@@ -114,11 +114,29 @@
return BRW_SURFACEFORMAT_FXT1;
case MESA_FORMAT_Z16:
- return BRW_SURFACEFORMAT_L16_UNORM;
+ if (depth_mode == GL_INTENSITY)
+ return BRW_SURFACEFORMAT_I16_UNORM;
+ else if (depth_mode == GL_ALPHA)
+ return BRW_SURFACEFORMAT_A16_UNORM;
+ else
+ return BRW_SURFACEFORMAT_L16_UNORM;
- case MESA_FORMAT_RGBA_DXT1:
case MESA_FORMAT_RGB_DXT1:
- return BRW_SURFACEFORMAT_DXT1_RGB;
+ return BRW_SURFACEFORMAT_DXT1_RGB;
+
+ case MESA_FORMAT_RGBA_DXT1:
+ return BRW_SURFACEFORMAT_BC1_UNORM;
+
+ case MESA_FORMAT_RGBA_DXT3:
+ return BRW_SURFACEFORMAT_BC2_UNORM;
+
+ case MESA_FORMAT_RGBA_DXT5:
+ return BRW_SURFACEFORMAT_BC3_UNORM;
+
+ case MESA_FORMAT_SRGBA8:
+ return BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB;
+ case MESA_FORMAT_SRGB_DXT1:
+ return BRW_SURFACEFORMAT_BC1_UNORM_SRGB;
default:
assert(0);
@@ -141,7 +159,7 @@
surf->ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW;
surf->ss0.surface_type = translate_tex_target(tObj->Target);
- surf->ss0.surface_format = translate_tex_format(firstImage->TexFormat->MesaFormat);
+ surf->ss0.surface_format = translate_tex_format(firstImage->TexFormat->MesaFormat, tObj->DepthMode);
/* This is ok for all textures with channel width 8bit or less:
*/
@@ -181,11 +199,8 @@
{
GLcontext *ctx = &brw->intel.ctx;
struct intel_context *intel = &brw->intel;
- struct brw_surface_binding_table bind;
GLuint i;
- memcpy(&bind, &brw->wm.bind, sizeof(bind));
-
{
struct brw_surface_state surf;
struct intel_region *region = brw->state.draw_region;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_batchbuffer.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_batchbuffer.c
@@ -36,7 +36,7 @@
assert(batch->map == NULL);
batch->offset = (unsigned long)batch->ptr;
- batch->offset = (batch->offset + 63) & ~63;
+ batch->offset = ALIGN(batch->offset, 64);
batch->ptr = (unsigned char *) batch->offset;
if (BATCH_SZ - batch->offset < BATCH_REFILL) {
@@ -216,7 +216,7 @@
GLuint sz )
{
unsigned long ptr = (unsigned long) batch->ptr;
- unsigned long aptr = (ptr + align) & ~((unsigned long)align-1);
+ unsigned long aptr = ALIGN(ptr, align);
GLuint fixup = aptr - ptr;
if (intel_batchbuffer_space(batch) < fixup + sz)
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_buffers.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_buffers.c
@@ -545,15 +545,14 @@
if ( intel->sarea->pf_current_page == 1 )
front ^= 1;
- intelSetFrontClipRects( intel );
-
-
if (front) {
+ intelSetFrontClipRects(intel);
if (intel->draw_region != intel->front_region) {
intel_region_release(intel, &intel->draw_region);
intel_region_reference(&intel->draw_region, intel->front_region);
}
} else {
+ intelSetBackClipRects(intel);
if (intel->draw_region != intel->back_region) {
intel_region_release(intel, &intel->draw_region);
intel_region_reference(&intel->draw_region, intel->back_region);
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_context.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_context.c
@@ -66,6 +66,7 @@
int INTEL_DEBUG = (0);
#endif
+#define need_GL_NV_point_sprite
#define need_GL_ARB_multisample
#define need_GL_ARB_point_parameters
#define need_GL_ARB_texture_compression
@@ -81,6 +82,13 @@
#define need_GL_EXT_fog_coord
#define need_GL_EXT_multi_draw_arrays
#define need_GL_EXT_secondary_color
+#define need_GL_ATI_separate_stencil
+#define need_GL_EXT_point_parameters
+#define need_GL_VERSION_2_0
+#define need_GL_VERSION_2_1
+#define need_GL_ARB_shader_objects
+#define need_GL_ARB_vertex_shader
+
#include "extension_helper.h"
#ifndef VERBOSE
@@ -118,9 +126,17 @@
case PCI_CHIP_I965_GM:
chipset = "Intel(R) 965GM"; break;
break;
- case PCI_CHIP_IGD_GM:
+ case PCI_CHIP_GM45_GM:
+ chipset = "Mobile Intel® GM45 Express Chipset";
+ break;
+ case PCI_CHIP_IGD_E_G:
chipset = "Intel(R) Integrated Graphics Device";
break;
+ case PCI_CHIP_Q45_G:
+ chipset = "Intel(R) Q45/Q43"; break;
+ case PCI_CHIP_G45_G:
+ chipset = "Intel(R) G45/G43"; break;
+
default:
chipset = "Unknown Intel Chipset"; break;
}
@@ -146,6 +162,7 @@
{ "GL_ARB_multisample", GL_ARB_multisample_functions },
{ "GL_ARB_multitexture", NULL },
{ "GL_ARB_point_parameters", GL_ARB_point_parameters_functions },
+ { "GL_NV_point_sprite", GL_NV_point_sprite_functions },
{ "GL_ARB_texture_border_clamp", NULL },
{ "GL_ARB_texture_compression", GL_ARB_texture_compression_functions },
{ "GL_ARB_texture_cube_map", NULL },
@@ -158,6 +175,8 @@
{ "GL_NV_texture_rectangle", NULL },
{ "GL_EXT_texture_rectangle", NULL },
{ "GL_ARB_texture_rectangle", NULL },
+ { "GL_ARB_point_sprite", NULL},
+ { "GL_ARB_point_parameters", NULL },
{ "GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions },
{ "GL_ARB_vertex_program", GL_ARB_vertex_program_functions },
{ "GL_ARB_window_pos", GL_ARB_window_pos_functions },
@@ -171,18 +190,33 @@
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
{ "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions },
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
+ { "GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions },
{ "GL_EXT_stencil_wrap", NULL },
+ /* Do not enable this extension. It conflicts with GL_ATI_separate_stencil
+ * and 2.0's separate stencil, because mesa's computed _TestTwoSide will
+ * only reflect whether it's enabled through this extension, even if the
+ * application is using the other interfaces.
+ */
+/*{ "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions },*/
{ "GL_EXT_texture_edge_clamp", NULL },
{ "GL_EXT_texture_env_combine", NULL },
{ "GL_EXT_texture_env_dot3", NULL },
{ "GL_EXT_texture_filter_anisotropic", NULL },
{ "GL_EXT_texture_lod_bias", NULL },
+ { "GL_EXT_texture_sRGB", NULL },
{ "GL_3DFX_texture_compression_FXT1", NULL },
{ "GL_APPLE_client_storage", NULL },
{ "GL_MESA_pack_invert", NULL },
{ "GL_MESA_ycbcr_texture", NULL },
{ "GL_NV_blend_square", NULL },
{ "GL_SGIS_generate_mipmap", NULL },
+ { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions},
+ { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions},
+ { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions},
+ { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions},
+ { "GL_ARB_fragment_shader", NULL },
+ /* XXX not implement yet, to compile builtin glsl lib */
+ { "GL_ARB_draw_buffers", NULL },
{ NULL, NULL }
};
@@ -399,17 +433,10 @@
switch(mesaVis->depthBits) {
case 0: /* what to do in this case? */
case 16:
- intel->depth_scale = 1.0/0xffff;
intel->polygon_offset_scale = 1.0/0xffff;
- intel->depth_clear_mask = ~0;
- intel->ClearDepth = 0xffff;
break;
case 24:
- intel->depth_scale = 1.0/0xffffff;
intel->polygon_offset_scale = 2.0/0xffffff; /* req'd to pass glean */
- intel->depth_clear_mask = 0x00ffffff;
- intel->stencil_clear_mask = 0xff000000;
- intel->ClearDepth = 0x00ffffff;
break;
default:
assert(0);
@@ -551,6 +578,8 @@
#endif
/* free the Mesa context */
+ intel->ctx.VertexProgram.Current = NULL;
+ intel->ctx.FragmentProgram.Current = NULL;
_mesa_destroy_context(&intel->ctx);
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_screen.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_screen.c
@@ -53,7 +53,7 @@
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
DRI_CONF_FORCE_S3TC_ENABLE(false)
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ DRI_CONF_ALLOW_LARGE_TEXTURES(2)
DRI_CONF_SECTION_END
DRI_CONF_END;
const GLuint __driNConfigOptions = 4;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -75,7 +75,7 @@
mt->width0 = width0;
mt->height0 = height0;
mt->depth0 = depth0;
- mt->cpp = compressed ? 2 : cpp;
+ mt->cpp = cpp;
mt->compressed = compressed;
switch (intel->intelScreen->deviceID) {
@@ -128,7 +128,7 @@
int pitch)
{
if (!mt->compressed)
- pitch = ((pitch * mt->cpp + 3) & ~3) / mt->cpp;
+ pitch = ALIGN(pitch * mt->cpp, 4) / mt->cpp;
return pitch;
}
@@ -234,7 +234,7 @@
-
+extern GLuint intel_compressed_alignment(GLenum);
/* Upload data for a particular image.
*/
GLboolean intel_miptree_image_data(struct intel_context *intel,
@@ -249,6 +249,17 @@
GLuint dst_offset = intel_miptree_image_offset(dst, face, level);
const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level);
GLuint i;
+ GLuint width, height, alignment;
+
+ width = dst->level[level].width;
+ height = dst->level[level].height;
+
+ if (dst->compressed) {
+ alignment = intel_compressed_alignment(dst->internal_format);
+ src_row_pitch = ALIGN(src_row_pitch, alignment);
+ width = ALIGN(width, alignment);
+ height = (height + 3) / 4;
+ }
DBG("%s\n", __FUNCTION__);
for (i = 0; i < depth; i++) {
@@ -260,8 +271,8 @@
src,
src_row_pitch,
0, 0, /* source x,y */
- dst->level[level].width,
- dst->level[level].height))
+ width,
+ height))
return GL_FALSE;
src += src_image_pitch;
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_pixel_bitmap.c
@@ -91,11 +91,6 @@
dest[bit/8] |= 1 << (bit % 8);
}
-static int align(int x, int align)
-{
- return (x + align - 1) & ~(align - 1);
-}
-
/* Extract a rectangle's worth of data from the bitmap. Called
* per-cliprect.
*/
@@ -147,7 +142,7 @@
}
if (row_align)
- bit = (bit + row_align - 1) & ~(row_align - 1);
+ bit = ALIGN(bit, row_align);
}
return count;
@@ -169,11 +164,8 @@
struct intel_context *intel = intel_context(ctx);
struct intel_region *dst = intel_drawbuf_region(intel);
GLfloat tmpColor[4];
-
- union {
- GLuint ui;
- GLubyte ub[4];
- } color;
+ GLubyte ubcolor[4];
+ GLuint color8888, color565;
if (!dst)
return GL_FALSE;
@@ -190,10 +182,14 @@
ADD_3V(tmpColor, tmpColor, ctx->Current.RasterSecondaryColor);
}
- UNCLAMPED_FLOAT_TO_CHAN(color.ub[0], tmpColor[2]);
- UNCLAMPED_FLOAT_TO_CHAN(color.ub[1], tmpColor[1]);
- UNCLAMPED_FLOAT_TO_CHAN(color.ub[2], tmpColor[0]);
- UNCLAMPED_FLOAT_TO_CHAN(color.ub[3], tmpColor[3]);
+ UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[0], tmpColor[0]);
+ UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[1], tmpColor[1]);
+ UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[2], tmpColor[2]);
+ UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[3], tmpColor[3]);
+
+ color8888 = INTEL_PACKCOLOR8888(ubcolor[0], ubcolor[1], ubcolor[2], ubcolor[3]);
+ color565 = INTEL_PACKCOLOR565(ubcolor[0], ubcolor[1], ubcolor[2]);
+
/* Does zoom apply to bitmaps?
*/
@@ -235,10 +231,10 @@
dsty = dPriv->y + (dPriv->h - dsty - height);
dstx = dPriv->x + dstx;
- dest_rect.x1 = dstx;
- dest_rect.y1 = dsty;
- dest_rect.x2 = dstx + width;
- dest_rect.y2 = dsty + height;
+ dest_rect.x1 = dstx < 0 ? 0 : dstx;
+ dest_rect.y1 = dsty < 0 ? 0 : dsty;
+ dest_rect.x2 = dstx + width < 0 ? 0 : dstx + width;
+ dest_rect.y2 = dsty + height < 0 ? 0 : dsty + height;
for (i = 0; i < nbox; i++) {
drm_clip_rect_t rect;
@@ -268,7 +264,7 @@
for (px = 0; px < box_w; px += DX) {
int h = MIN2(DY, box_h - py);
int w = MIN2(DX, box_w - px);
- GLuint sz = align(align(w,8) * h, 64)/8;
+ GLuint sz = ALIGN(ALIGN(w,8) * h, 64)/8;
GLenum logic_op = ctx->Color.ColorLogicOpEnabled ?
ctx->Color.LogicOp : GL_COPY;
@@ -292,7 +288,7 @@
dst->cpp,
(GLubyte *)stipple,
sz,
- color.ui,
+ (dst->cpp == 2) ? color565 : color8888,
dst->pitch,
dst->buffer,
0,
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_tex_validate.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_tex_validate.c
@@ -122,6 +122,29 @@
intel_texture_invalidate( (struct intel_texture_object *) ptr );
}
+#include "texformat.h"
+static GLuint intel_compressed_num_bytes(GLenum mesaFormat)
+{
+ GLuint bytes = 0;
+
+ switch (mesaFormat) {
+ case MESA_FORMAT_RGB_FXT1:
+ case MESA_FORMAT_RGBA_FXT1:
+ case MESA_FORMAT_RGB_DXT1:
+ case MESA_FORMAT_RGBA_DXT1:
+ bytes = 2;
+ break;
+
+ case MESA_FORMAT_RGBA_DXT3:
+ case MESA_FORMAT_RGBA_DXT5:
+ bytes = 4;
+
+ default:
+ break;
+ }
+
+ return bytes;
+}
/*
*/
@@ -132,7 +155,8 @@
GLuint face, i;
GLuint nr_faces = 0;
struct gl_texture_image *firstImage;
-
+ GLuint cpp = 0;
+
if( tObj == intel->frame_buffer_texobj )
return GL_FALSE;
@@ -165,6 +189,12 @@
+ if (firstImage->IsCompressed) {
+ cpp = intel_compressed_num_bytes(firstImage->TexFormat->MesaFormat);
+ } else {
+ cpp = firstImage->TexFormat->TexelBytes;
+ }
+
/* Check tree can hold all active levels. Check tree matches
* target, imageFormat, etc.
*/
@@ -176,7 +206,7 @@
intelObj->mt->width0 != firstImage->Width ||
intelObj->mt->height0 != firstImage->Height ||
intelObj->mt->depth0 != firstImage->Depth ||
- intelObj->mt->cpp != firstImage->TexFormat->TexelBytes ||
+ intelObj->mt->cpp != cpp ||
intelObj->mt->compressed != firstImage->IsCompressed))
{
intel_miptree_destroy(intel, intelObj->mt);
@@ -199,7 +229,7 @@
firstImage->Width,
firstImage->Height,
firstImage->Depth,
- firstImage->TexFormat->TexelBytes,
+ cpp,
firstImage->IsCompressed);
/* Tell the buffer manager that we will manage the backing
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_wm_glsl.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_wm_glsl.c
@@ -0,0 +1,1370 @@
+#include "macros.h"
+#include "shader/prog_parameter.h"
+#include "brw_context.h"
+#include "brw_eu.h"
+#include "brw_wm.h"
+
+/* Only guess, need a flag in gl_fragment_program later */
+GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp)
+{
+ int i;
+ for (i = 0; i < fp->Base.NumInstructions; i++) {
+ struct prog_instruction *inst = &fp->Base.Instructions[i];
+ switch (inst->Opcode) {
+ case OPCODE_IF:
+ case OPCODE_INT:
+ case OPCODE_ENDIF:
+ case OPCODE_CAL:
+ case OPCODE_BRK:
+ case OPCODE_RET:
+ case OPCODE_DDX:
+ case OPCODE_DDY:
+ case OPCODE_BGNLOOP:
+ return GL_TRUE;
+ default:
+ break;
+ }
+ }
+ return GL_FALSE;
+}
+
+static void set_reg(struct brw_wm_compile *c, int file, int index,
+ int component, struct brw_reg reg)
+{
+ c->wm_regs[file][index][component].reg = reg;
+ c->wm_regs[file][index][component].inited = GL_TRUE;
+}
+
+static int get_scalar_dst_index(struct prog_instruction *inst)
+{
+ int i;
+ for (i = 0; i < 4; i++)
+ if (inst->DstReg.WriteMask & (1<tmp_index--, 0);
+ return reg;
+}
+
+static void release_tmps(struct brw_wm_compile *c)
+{
+ c->tmp_index = 127;
+}
+
+static struct brw_reg
+get_reg(struct brw_wm_compile *c, int file, int index, int component, int nr, GLuint neg, GLuint abs)
+{
+ struct brw_reg reg;
+ switch (file) {
+ case PROGRAM_STATE_VAR:
+ case PROGRAM_CONSTANT:
+ case PROGRAM_UNIFORM:
+ file = PROGRAM_STATE_VAR;
+ break;
+ case PROGRAM_UNDEFINED:
+ return brw_null_reg();
+ default:
+ break;
+ }
+
+ if(c->wm_regs[file][index][component].inited)
+ reg = c->wm_regs[file][index][component].reg;
+ else
+ reg = brw_vec8_grf(c->reg_index, 0);
+
+ if(!c->wm_regs[file][index][component].inited) {
+ set_reg(c, file, index, component, reg);
+ c->reg_index++;
+ }
+
+ if (neg & (1<< component)) {
+ reg = negate(reg);
+ }
+ if (abs)
+ reg = brw_abs(reg);
+ return reg;
+}
+
+static void prealloc_reg(struct brw_wm_compile *c)
+{
+ int i, j;
+ struct brw_reg reg;
+ int nr_interp_regs = 0;
+ GLuint inputs = FRAG_BIT_WPOS | c->fp_interp_emitted | c->fp_deriv_emitted;
+
+ for (i = 0; i < 4; i++) {
+ reg = (i < c->key.nr_depth_regs)
+ ? brw_vec8_grf(i*2, 0) : brw_vec8_grf(0, 0);
+ set_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, i, reg);
+ }
+ c->reg_index += 2*c->key.nr_depth_regs;
+ {
+ int nr_params = c->fp->program.Base.Parameters->NumParameters;
+ struct gl_program_parameter_list *plist =
+ c->fp->program.Base.Parameters;
+ int index = 0;
+ c->prog_data.nr_params = 4*nr_params;
+ for (i = 0; i < nr_params; i++) {
+ for (j = 0; j < 4; j++, index++) {
+ reg = brw_vec1_grf(c->reg_index + index/8,
+ index%8);
+ c->prog_data.param[index] =
+ &plist->ParameterValues[i][j];
+ set_reg(c, PROGRAM_STATE_VAR, i, j, reg);
+ }
+ }
+ c->nr_creg = 2*((4*nr_params+15)/16);
+ c->reg_index += c->nr_creg;
+ }
+ for (i = 0; i < FRAG_ATTRIB_MAX; i++) {
+ if (inputs & (1<reg_index, 0);
+ for (j = 0; j < 4; j++)
+ set_reg(c, PROGRAM_PAYLOAD, i, j, reg);
+ c->reg_index += 2;
+
+ }
+ }
+ c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2;
+ c->prog_data.urb_read_length = nr_interp_regs * 2;
+ c->prog_data.curb_read_length = c->nr_creg;
+ c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0);
+ c->reg_index++;
+ c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0);
+ c->reg_index += 2;
+}
+
+static struct brw_reg get_dst_reg(struct brw_wm_compile *c,
+ struct prog_instruction *inst, int component, int nr)
+{
+ return get_reg(c, inst->DstReg.File, inst->DstReg.Index, component, nr,
+ 0, 0);
+}
+
+static struct brw_reg get_src_reg(struct brw_wm_compile *c,
+ struct prog_src_register *src, int index, int nr)
+{
+ int component = GET_SWZ(src->Swizzle, index);
+ return get_reg(c, src->File, src->Index, component, nr,
+ src->NegateBase, src->Abs);
+}
+
+static void emit_abs( struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ int i;
+ struct brw_compile *p = &c->func;
+ brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF);
+ for (i = 0; i < 4; i++) {
+ if (inst->DstReg.WriteMask & (1<SrcReg[0], i, 1);
+ brw_MOV(p, dst, brw_abs(src));
+ }
+ }
+ brw_set_saturate(p, 0);
+}
+
+static void emit_int( struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ int i;
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF);
+ for (i = 0; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ brw_RNDD(p, dst, src);
+ }
+ }
+ brw_set_saturate(p, 0);
+}
+
+static void emit_mov( struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ int i;
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF);
+ for (i = 0; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ brw_MOV(p, dst, src);
+ }
+ }
+ brw_set_saturate(p, 0);
+}
+
+static void emit_pixel_xy(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_reg r1 = brw_vec1_grf(1, 0);
+ struct brw_reg r1_uw = retype(r1, BRW_REGISTER_TYPE_UW);
+
+ struct brw_reg dst0, dst1;
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+
+ dst0 = get_dst_reg(c, inst, 0, 1);
+ dst1 = get_dst_reg(c, inst, 1, 1);
+ /* Calculate pixel centers by adding 1 or 0 to each of the
+ * micro-tile coordinates passed in r1.
+ */
+ if (mask & WRITEMASK_X) {
+ brw_ADD(p,
+ vec8(retype(dst0, BRW_REGISTER_TYPE_UW)),
+ stride(suboffset(r1_uw, 4), 2, 4, 0),
+ brw_imm_v(0x10101010));
+ }
+
+ if (mask & WRITEMASK_Y) {
+ brw_ADD(p,
+ vec8(retype(dst1, BRW_REGISTER_TYPE_UW)),
+ stride(suboffset(r1_uw, 5), 2, 4, 0),
+ brw_imm_v(0x11001100));
+ }
+
+}
+
+static void emit_delta_xy(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_reg r1 = brw_vec1_grf(1, 0);
+ struct brw_reg dst0, dst1, src0, src1;
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+
+ dst0 = get_dst_reg(c, inst, 0, 1);
+ dst1 = get_dst_reg(c, inst, 1, 1);
+ src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[0], 1, 1);
+ /* Calc delta X,Y by subtracting origin in r1 from the pixel
+ * centers.
+ */
+ if (mask & WRITEMASK_X) {
+ brw_ADD(p,
+ dst0,
+ retype(src0, BRW_REGISTER_TYPE_UW),
+ negate(r1));
+ }
+
+ if (mask & WRITEMASK_Y) {
+ brw_ADD(p,
+ dst1,
+ retype(src1, BRW_REGISTER_TYPE_UW),
+ negate(suboffset(r1,1)));
+
+ }
+
+}
+
+
+static void fire_fb_write( struct brw_wm_compile *c,
+ GLuint base_reg,
+ GLuint nr )
+{
+ struct brw_compile *p = &c->func;
+
+ /* Pass through control information:
+ */
+ /* mov (8) m1.0<1>:ud r1.0<8;8,1>:ud { Align1 NoMask } */
+ {
+ brw_push_insn_state(p);
+ brw_set_mask_control(p, BRW_MASK_DISABLE); /* ? */
+ brw_MOV(p,
+ brw_message_reg(base_reg + 1),
+ brw_vec8_grf(1, 0));
+ brw_pop_insn_state(p);
+ }
+ /* Send framebuffer write message: */
+ brw_fb_WRITE(p,
+ retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW),
+ base_reg,
+ retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW),
+ 0, /* render surface always 0 */
+ nr,
+ 0,
+ 1);
+}
+
+static void emit_fb_write(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ int nr = 2;
+ int channel;
+ struct brw_reg src0;//, src1, src2, dst;
+
+ /* Reserve a space for AA - may not be needed:
+ */
+ if (c->key.aa_dest_stencil_reg)
+ nr += 1;
+ {
+ brw_push_insn_state(p);
+ for (channel = 0; channel < 4; channel++) {
+ src0 = get_src_reg(c, &inst->SrcReg[0], channel, 1);
+ /* mov (8) m2.0<1>:ud r28.0<8;8,1>:ud { Align1 } */
+ /* mov (8) m6.0<1>:ud r29.0<8;8,1>:ud { Align1 SecHalf } */
+ brw_MOV(p, brw_message_reg(nr + channel), src0);
+ }
+ /* skip over the regs populated above: */
+ nr += 8;
+ brw_pop_insn_state(p);
+ }
+
+ if (c->key.source_depth_to_render_target)
+ {
+ if (c->key.computes_depth) {
+ src0 = get_src_reg(c, &inst->SrcReg[2], 2, 1);
+ brw_MOV(p, brw_message_reg(nr), src0);
+ } else {
+ src0 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
+ brw_MOV(p, brw_message_reg(nr), src0);
+ }
+
+ nr += 2;
+ }
+
+ fire_fb_write(c, 0, nr);
+}
+
+static void emit_pixel_w( struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ if (mask & WRITEMASK_W) {
+ struct brw_reg dst, src0, delta0, delta1;
+ struct brw_reg interp3;
+
+ dst = get_dst_reg(c, inst, 3, 1);
+ src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
+ delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
+
+ interp3 = brw_vec1_grf(src0.nr+1, 4);
+ /* Calc 1/w - just linterp wpos[3] optimized by putting the
+ * result straight into a message reg.
+ */
+ brw_LINE(p, brw_null_reg(), interp3, delta0);
+ brw_MAC(p, brw_message_reg(2), suboffset(interp3, 1), delta1);
+
+ /* Calc w */
+ brw_math_16( p, dst,
+ BRW_MATH_FUNCTION_INV,
+ BRW_MATH_SATURATE_NONE,
+ 2, brw_null_reg(),
+ BRW_MATH_PRECISION_FULL);
+ }
+}
+
+static void emit_linterp(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ struct brw_reg interp[4];
+ struct brw_reg dst, delta0, delta1;
+ struct brw_reg src0;
+
+ src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
+ delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
+ GLuint nr = src0.nr;
+ int i;
+
+ interp[0] = brw_vec1_grf(nr, 0);
+ interp[1] = brw_vec1_grf(nr, 4);
+ interp[2] = brw_vec1_grf(nr+1, 0);
+ interp[3] = brw_vec1_grf(nr+1, 4);
+
+ for(i = 0; i < 4; i++ ) {
+ if (mask & (1<func;
+ GLuint mask = inst->DstReg.WriteMask;
+
+ struct brw_reg interp[4];
+ struct brw_reg dst, src0;
+
+ src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ GLuint nr = src0.nr;
+ int i;
+
+ interp[0] = brw_vec1_grf(nr, 0);
+ interp[1] = brw_vec1_grf(nr, 4);
+ interp[2] = brw_vec1_grf(nr+1, 0);
+ interp[3] = brw_vec1_grf(nr+1, 4);
+
+ for(i = 0; i < 4; i++ ) {
+ if (mask & (1<func;
+ GLuint mask = inst->DstReg.WriteMask;
+
+ struct brw_reg interp[4];
+ struct brw_reg dst, delta0, delta1;
+ struct brw_reg src0, w;
+
+ src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ delta0 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
+ delta1 = get_src_reg(c, &inst->SrcReg[1], 1, 1);
+ w = get_src_reg(c, &inst->SrcReg[2], 3, 1);
+ GLuint nr = src0.nr;
+ int i;
+
+ interp[0] = brw_vec1_grf(nr, 0);
+ interp[1] = brw_vec1_grf(nr, 4);
+ interp[2] = brw_vec1_grf(nr+1, 0);
+ interp[3] = brw_vec1_grf(nr+1, 4);
+
+ for(i = 0; i < 4; i++ ) {
+ if (mask & (1<func;
+ GLuint mask = inst->DstReg.WriteMask;
+ for (i = 0; i < 4; i++) {
+ GLuint i2 = (i+2)%3;
+ GLuint i1 = (i+1)%3;
+ if (mask & (1<SrcReg[0], i2, 1));
+ src1 = get_src_reg(c, &inst->SrcReg[1], i1, 1);
+ brw_MUL(p, brw_null_reg(), src0, src1);
+ src0 = get_src_reg(c, &inst->SrcReg[0], i1, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[1], i2, 1);
+ brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF);
+ brw_MAC(p, dst, src0, src1);
+ brw_set_saturate(p, 0);
+ }
+ }
+ brw_set_saturate(p, 0);
+}
+
+static void emit_dp3(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_reg src0[3], src1[3], dst;
+ int i;
+ struct brw_compile *p = &c->func;
+ for (i = 0; i < 3; i++) {
+ src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
+ src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ }
+
+ dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
+ brw_MUL(p, brw_null_reg(), src0[0], src1[0]);
+ brw_MAC(p, brw_null_reg(), src0[1], src1[1]);
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ brw_MAC(p, dst, src0[2], src1[2]);
+ brw_set_saturate(p, 0);
+}
+
+static void emit_dp4(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_reg src0[4], src1[4], dst;
+ int i;
+ struct brw_compile *p = &c->func;
+ for (i = 0; i < 4; i++) {
+ src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
+ src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ }
+ dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
+ brw_MUL(p, brw_null_reg(), src0[0], src1[0]);
+ brw_MAC(p, brw_null_reg(), src0[1], src1[1]);
+ brw_MAC(p, brw_null_reg(), src0[2], src1[2]);
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ brw_MAC(p, dst, src0[3], src1[3]);
+ brw_set_saturate(p, 0);
+}
+
+static void emit_dph(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_reg src0[4], src1[4], dst;
+ int i;
+ struct brw_compile *p = &c->func;
+ for (i = 0; i < 4; i++) {
+ src0[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
+ src1[i] = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ }
+ dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
+ brw_MUL(p, brw_null_reg(), src0[0], src1[0]);
+ brw_MAC(p, brw_null_reg(), src0[1], src1[1]);
+ brw_MAC(p, dst, src0[2], src1[2]);
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ brw_ADD(p, dst, src0[3], src1[3]);
+ brw_set_saturate(p, 0);
+}
+
+static void emit_math1(struct brw_wm_compile *c,
+ struct prog_instruction *inst, GLuint func)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg src0, dst;
+
+ src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
+ brw_MOV(p, brw_message_reg(2), src0);
+ brw_math(p,
+ dst,
+ func,
+ (inst->SaturateMode != SATURATE_OFF) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE,
+ 2,
+ brw_null_reg(),
+ BRW_MATH_DATA_VECTOR,
+ BRW_MATH_PRECISION_FULL);
+}
+
+static void emit_rcp(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_math1(c, inst, BRW_MATH_FUNCTION_INV);
+}
+
+static void emit_rsq(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_math1(c, inst, BRW_MATH_FUNCTION_RSQ);
+}
+
+static void emit_sin(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_math1(c, inst, BRW_MATH_FUNCTION_SIN);
+}
+
+static void emit_cos(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_math1(c, inst, BRW_MATH_FUNCTION_COS);
+}
+
+static void emit_ex2(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_math1(c, inst, BRW_MATH_FUNCTION_EXP);
+}
+
+static void emit_lg2(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_math1(c, inst, BRW_MATH_FUNCTION_LOG);
+}
+
+static void emit_add(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg src0, src1, dst;
+ GLuint mask = inst->DstReg.WriteMask;
+ int i;
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ for (i = 0 ; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ brw_ADD(p, dst, src0, src1);
+ }
+ }
+ brw_set_saturate(p, 0);
+}
+
+static void emit_sub(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg src0, src1, dst;
+ GLuint mask = inst->DstReg.WriteMask;
+ int i;
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ for (i = 0 ; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ brw_ADD(p, dst, src0, negate(src1));
+ }
+ }
+ brw_set_saturate(p, 0);
+}
+
+static void emit_mul(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg src0, src1, dst;
+ GLuint mask = inst->DstReg.WriteMask;
+ int i;
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ for (i = 0 ; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ brw_MUL(p, dst, src0, src1);
+ }
+ }
+ brw_set_saturate(p, 0);
+}
+
+static void emit_frc(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg src0, dst;
+ GLuint mask = inst->DstReg.WriteMask;
+ int i;
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ for (i = 0 ; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ brw_FRC(p, dst, src0);
+ }
+ }
+ if (inst->SaturateMode != SATURATE_OFF)
+ brw_set_saturate(p, 0);
+}
+
+static void emit_flr(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg src0, dst;
+ GLuint mask = inst->DstReg.WriteMask;
+ int i;
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ for (i = 0 ; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ brw_RNDD(p, dst, src0);
+ }
+ }
+ brw_set_saturate(p, 0);
+}
+
+static void emit_max(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ struct brw_reg src0, src1, dst;
+ int i;
+ brw_push_insn_state(p);
+ for (i = 0; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ brw_MOV(p, dst, src0);
+ brw_set_saturate(p, 0);
+
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src0, src1);
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
+ brw_MOV(p, dst, src1);
+ brw_set_saturate(p, 0);
+ brw_set_predicate_control_flag_value(p, 0xff);
+ }
+ }
+ brw_pop_insn_state(p);
+}
+
+static void emit_min(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ struct brw_reg src0, src1, dst;
+ int i;
+ brw_push_insn_state(p);
+ for (i = 0; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ brw_MOV(p, dst, src0);
+ brw_set_saturate(p, 0);
+
+ brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src1, src0);
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
+ brw_MOV(p, dst, src1);
+ brw_set_saturate(p, 0);
+ brw_set_predicate_control_flag_value(p, 0xff);
+ }
+ }
+ brw_pop_insn_state(p);
+}
+
+static void emit_pow(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg dst, src0, src1;
+ dst = get_dst_reg(c, inst, get_scalar_dst_index(inst), 1);
+ src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[1], 0, 1);
+
+ brw_MOV(p, brw_message_reg(2), src0);
+ brw_MOV(p, brw_message_reg(3), src1);
+
+ brw_math(p,
+ dst,
+ BRW_MATH_FUNCTION_POW,
+ (inst->SaturateMode != SATURATE_OFF) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE,
+ 2,
+ brw_null_reg(),
+ BRW_MATH_DATA_VECTOR,
+ BRW_MATH_PRECISION_FULL);
+}
+
+static void emit_lrp(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ struct brw_reg dst, tmp1, tmp2, src0, src1, src2;
+ int i;
+ for (i = 0; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+
+ src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+
+ if (src1.nr == dst.nr) {
+ tmp1 = alloc_tmp(c);
+ brw_MOV(p, tmp1, src1);
+ } else
+ tmp1 = src1;
+
+ src2 = get_src_reg(c, &inst->SrcReg[2], i, 1);
+ if (src2.nr == dst.nr) {
+ tmp2 = alloc_tmp(c);
+ brw_MOV(p, tmp2, src2);
+ } else
+ tmp2 = src2;
+
+ brw_ADD(p, dst, negate(src0), brw_imm_f(1.0));
+ brw_MUL(p, brw_null_reg(), dst, tmp2);
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ brw_MAC(p, dst, src0, tmp1);
+ brw_set_saturate(p, 0);
+ }
+ release_tmps(c);
+ }
+}
+
+static void emit_kil(struct brw_wm_compile *c)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg depth = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
+ brw_push_insn_state(p);
+ brw_set_mask_control(p, BRW_MASK_DISABLE);
+ brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); //IMASK
+ brw_AND(p, depth, c->emit_mask_reg, depth);
+ brw_pop_insn_state(p);
+}
+
+static void emit_mad(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ struct brw_reg dst, src0, src1, src2;
+ int i;
+
+ for (i = 0; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ src2 = get_src_reg(c, &inst->SrcReg[2], i, 1);
+ brw_MUL(p, dst, src0, src1);
+
+ brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0);
+ brw_ADD(p, dst, dst, src2);
+ brw_set_saturate(p, 0);
+ }
+ }
+}
+
+static void emit_sop(struct brw_wm_compile *c,
+ struct prog_instruction *inst, GLuint cond)
+{
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ struct brw_reg dst, src0, src1;
+ int i;
+
+ brw_push_insn_state(p);
+ for (i = 0; i < 4; i++) {
+ if (mask & (1<SrcReg[0], i, 1);
+ src1 = get_src_reg(c, &inst->SrcReg[1], i, 1);
+ brw_CMP(p, brw_null_reg(), cond, src0, src1);
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ brw_MOV(p, dst, brw_imm_f(0.0));
+ brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
+ brw_MOV(p, dst, brw_imm_f(1.0));
+ }
+ }
+ brw_pop_insn_state(p);
+}
+
+static void emit_slt(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_sop(c, inst, BRW_CONDITIONAL_L);
+}
+
+static void emit_sle(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_sop(c, inst, BRW_CONDITIONAL_LE);
+}
+
+static void emit_sgt(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_sop(c, inst, BRW_CONDITIONAL_G);
+}
+
+static void emit_sge(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_sop(c, inst, BRW_CONDITIONAL_GE);
+}
+
+static void emit_seq(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_sop(c, inst, BRW_CONDITIONAL_EQ);
+}
+
+static void emit_sne(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ emit_sop(c, inst, BRW_CONDITIONAL_NEQ);
+}
+
+static void emit_ddx(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ GLuint mask = inst->DstReg.WriteMask;
+ struct brw_reg interp[4];
+ struct brw_reg dst;
+ struct brw_reg src0, w;
+ GLuint nr, i;
+ src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ w = get_src_reg(c, &inst->SrcReg[1], 3, 1);
+ nr = src0.nr;
+ interp[0] = brw_vec1_grf(nr, 0);
+ interp[1] = brw_vec1_grf(nr, 4);
+ interp[2] = brw_vec1_grf(nr+1, 0);
+ interp[3] = brw_vec1_grf(nr+1, 4);
+ brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF);
+ for(i = 0; i < 4; i++ ) {
+ if (mask & (1<func;
+ GLuint mask = inst->DstReg.WriteMask;
+ struct brw_reg interp[4];
+ struct brw_reg dst;
+ struct brw_reg src0, w;
+ GLuint nr, i;
+
+ src0 = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ nr = src0.nr;
+ w = get_src_reg(c, &inst->SrcReg[1], 3, 1);
+ interp[0] = brw_vec1_grf(nr, 0);
+ interp[1] = brw_vec1_grf(nr, 4);
+ interp[2] = brw_vec1_grf(nr+1, 0);
+ interp[3] = brw_vec1_grf(nr+1, 4);
+ brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF);
+ for(i = 0; i < 4; i++ ) {
+ if (mask & (1<func;
+ GLuint mask = inst->DstReg.WriteMask;
+ struct brw_reg src0[2], dst[2];
+
+ dst[0] = get_dst_reg(c, inst, 0, 1);
+ dst[1] = get_dst_reg(c, inst, 1, 1);
+
+ src0[0] = get_src_reg(c, &inst->SrcReg[0], 0, 1);
+ src0[1] = get_src_reg(c, &inst->SrcReg[0], 1, 1);
+
+ /* Calculate the pixel offset from window bottom left into destination
+ * X and Y channels.
+ */
+ if (mask & WRITEMASK_X) {
+ /* X' = X - origin_x */
+ brw_ADD(p,
+ dst[0],
+ retype(src0[0], BRW_REGISTER_TYPE_W),
+ brw_imm_d(0 - c->key.origin_x));
+ }
+
+ if (mask & WRITEMASK_Y) {
+ /* Y' = height - (Y - origin_y) = height + origin_y - Y */
+ brw_ADD(p,
+ dst[1],
+ negate(retype(src0[1], BRW_REGISTER_TYPE_W)),
+ brw_imm_d(c->key.origin_y + c->key.drawable_height - 1));
+ }
+}
+
+/* TODO
+ BIAS on SIMD8 not workind yet...
+ */
+static void emit_txb(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg dst[4], src[4], payload_reg;
+ GLuint i;
+ payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0);
+ for (i = 0; i < 4; i++)
+ dst[i] = get_dst_reg(c, inst, i, 1);
+ for (i = 0; i < 4; i++)
+ src[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
+
+ switch (inst->TexSrcTarget) {
+ case TEXTURE_1D_INDEX:
+ brw_MOV(p, brw_message_reg(2), src[0]);
+ brw_MOV(p, brw_message_reg(3), brw_imm_f(0));
+ brw_MOV(p, brw_message_reg(4), brw_imm_f(0));
+ break;
+ case TEXTURE_2D_INDEX:
+ case TEXTURE_RECT_INDEX:
+ brw_MOV(p, brw_message_reg(2), src[0]);
+ brw_MOV(p, brw_message_reg(3), src[1]);
+ brw_MOV(p, brw_message_reg(4), brw_imm_f(0));
+ break;
+ default:
+ brw_MOV(p, brw_message_reg(2), src[0]);
+ brw_MOV(p, brw_message_reg(3), src[1]);
+ brw_MOV(p, brw_message_reg(4), src[2]);
+ break;
+ }
+ brw_MOV(p, brw_message_reg(5), src[3]);
+ brw_MOV(p, brw_message_reg(6), brw_imm_f(0));
+ brw_SAMPLE(p,
+ retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW),
+ 1,
+ retype(payload_reg, BRW_REGISTER_TYPE_UW),
+ inst->TexSrcUnit + 1, /* surface */
+ inst->TexSrcUnit, /* sampler */
+ inst->DstReg.WriteMask,
+ BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS,
+ 4,
+ 4,
+ 0);
+}
+
+static void emit_tex(struct brw_wm_compile *c,
+ struct prog_instruction *inst)
+{
+ struct brw_compile *p = &c->func;
+ struct brw_reg dst[4], src[4], payload_reg;
+ GLuint msg_len;
+ GLuint i, nr;
+ GLuint emit;
+ GLboolean shadow = (c->key.shadowtex_mask & (1<TexSrcUnit)) ? 1 : 0;
+
+ payload_reg = get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, 0, 1, 0, 0);
+
+ for (i = 0; i < 4; i++)
+ dst[i] = get_dst_reg(c, inst, i, 1);
+ for (i = 0; i < 4; i++)
+ src[i] = get_src_reg(c, &inst->SrcReg[0], i, 1);
+
+
+ switch (inst->TexSrcTarget) {
+ case TEXTURE_1D_INDEX:
+ emit = WRITEMASK_X;
+ nr = 1;
+ break;
+ case TEXTURE_2D_INDEX:
+ case TEXTURE_RECT_INDEX:
+ emit = WRITEMASK_XY;
+ nr = 2;
+ break;
+ default:
+ emit = WRITEMASK_XYZ;
+ nr = 3;
+ break;
+ }
+ msg_len = 1;
+
+ for (i = 0; i < nr; i++) {
+ static const GLuint swz[4] = {0,1,2,2};
+ if (emit & (1<TexSrcUnit + 1, /* surface */
+ inst->TexSrcUnit, /* sampler */
+ inst->DstReg.WriteMask,
+ BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE,
+ 4,
+ shadow ? 6 : 4,
+ 0);
+
+ if (shadow)
+ brw_MOV(p, dst[3], brw_imm_f(1.0));
+}
+
+static void post_wm_emit( struct brw_wm_compile *c )
+{
+ GLuint nr_insns = c->fp->program.Base.NumInstructions;
+ GLuint insn, target_insn;
+ struct prog_instruction *inst1, *inst2;
+ struct brw_instruction *brw_inst1, *brw_inst2;
+ int offset;
+ for (insn = 0; insn < nr_insns; insn++) {
+ inst1 = &c->fp->program.Base.Instructions[insn];
+ brw_inst1 = inst1->Data;
+ switch (inst1->Opcode) {
+ case OPCODE_CAL:
+ target_insn = inst1->BranchTarget;
+ inst2 = &c->fp->program.Base.Instructions[target_insn];
+ brw_inst2 = inst2->Data;
+ offset = brw_inst2 - brw_inst1;
+ brw_set_src1(brw_inst1, brw_imm_d(offset*16));
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
+
+{
+#define MAX_IFSN 32
+#define MAX_LOOP_DEPTH 32
+ struct brw_instruction *if_inst[MAX_IFSN], *loop_inst[MAX_LOOP_DEPTH];
+ struct brw_instruction *inst0, *inst1;
+ int i, if_insn = 0, loop_insn = 0;
+ struct brw_compile *p = &c->func;
+ struct brw_indirect stack_index = brw_indirect(0, 0);
+
+ brw_init_compile(brw, &c->func);
+ c->reg_index = 0;
+ prealloc_reg(c);
+ brw_set_compression_control(p, BRW_COMPRESSION_NONE);
+ brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack));
+
+ for (i = 0; i < c->nr_fp_insns; i++) {
+ struct prog_instruction *inst = &c->prog_instructions[i];
+ struct prog_instruction *orig_inst;
+
+ if ((orig_inst = inst->Data) != 0)
+ orig_inst->Data = current_insn(p);
+
+ if (inst->CondUpdate)
+ brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ);
+ else
+ brw_set_conditionalmod(p, BRW_CONDITIONAL_NONE);
+
+ switch (inst->Opcode) {
+ case WM_PIXELXY:
+ emit_pixel_xy(c, inst);
+ break;
+ case WM_DELTAXY:
+ emit_delta_xy(c, inst);
+ break;
+ case WM_PIXELW:
+ emit_pixel_w(c, inst);
+ break;
+ case WM_LINTERP:
+ emit_linterp(c, inst);
+ break;
+ case WM_PINTERP:
+ emit_pinterp(c, inst);
+ break;
+ case WM_CINTERP:
+ emit_cinterp(c, inst);
+ break;
+ case WM_WPOSXY:
+ emit_wpos_xy(c, inst);
+ break;
+ case WM_FB_WRITE:
+ emit_fb_write(c, inst);
+ break;
+ case OPCODE_ABS:
+ emit_abs(c, inst);
+ break;
+ case OPCODE_ADD:
+ emit_add(c, inst);
+ break;
+ case OPCODE_SUB:
+ emit_sub(c, inst);
+ break;
+ case OPCODE_FRC:
+ emit_frc(c, inst);
+ break;
+ case OPCODE_FLR:
+ emit_flr(c, inst);
+ break;
+ case OPCODE_LRP:
+ emit_lrp(c, inst);
+ break;
+ case OPCODE_INT:
+ emit_int(c, inst);
+ break;
+ case OPCODE_MOV:
+ emit_mov(c, inst);
+ break;
+ case OPCODE_DP3:
+ emit_dp3(c, inst);
+ break;
+ case OPCODE_DP4:
+ emit_dp4(c, inst);
+ break;
+ case OPCODE_XPD:
+ emit_xpd(c, inst);
+ break;
+ case OPCODE_DPH:
+ emit_dph(c, inst);
+ break;
+ case OPCODE_RCP:
+ emit_rcp(c, inst);
+ break;
+ case OPCODE_RSQ:
+ emit_rsq(c, inst);
+ break;
+ case OPCODE_SIN:
+ emit_sin(c, inst);
+ break;
+ case OPCODE_COS:
+ emit_cos(c, inst);
+ break;
+ case OPCODE_EX2:
+ emit_ex2(c, inst);
+ break;
+ case OPCODE_LG2:
+ emit_lg2(c, inst);
+ break;
+ case OPCODE_MAX:
+ emit_max(c, inst);
+ break;
+ case OPCODE_MIN:
+ emit_min(c, inst);
+ break;
+ case OPCODE_DDX:
+ emit_ddx(c, inst);
+ break;
+ case OPCODE_DDY:
+ emit_ddy(c, inst);
+ break;
+ case OPCODE_SLT:
+ emit_slt(c, inst);
+ break;
+ case OPCODE_SLE:
+ emit_sle(c, inst);
+ break;
+ case OPCODE_SGT:
+ emit_sgt(c, inst);
+ break;
+ case OPCODE_SGE:
+ emit_sge(c, inst);
+ break;
+ case OPCODE_SEQ:
+ emit_seq(c, inst);
+ break;
+ case OPCODE_SNE:
+ emit_sne(c, inst);
+ break;
+ case OPCODE_MUL:
+ emit_mul(c, inst);
+ break;
+ case OPCODE_POW:
+ emit_pow(c, inst);
+ break;
+ case OPCODE_MAD:
+ emit_mad(c, inst);
+ break;
+ case OPCODE_TEX:
+ emit_tex(c, inst);
+ break;
+ case OPCODE_TXB:
+ emit_txb(c, inst);
+ break;
+ case OPCODE_KIL_NV:
+ emit_kil(c);
+ break;
+ case OPCODE_IF:
+ assert(if_insn < MAX_IFSN);
+ if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8);
+ break;
+ case OPCODE_ELSE:
+ if_inst[if_insn-1] = brw_ELSE(p, if_inst[if_insn-1]);
+ break;
+ case OPCODE_ENDIF:
+ assert(if_insn > 0);
+ brw_ENDIF(p, if_inst[--if_insn]);
+ break;
+ case OPCODE_BGNSUB:
+ case OPCODE_ENDSUB:
+ break;
+ case OPCODE_CAL:
+ brw_push_insn_state(p);
+ brw_set_mask_control(p, BRW_MASK_DISABLE);
+ brw_set_access_mode(p, BRW_ALIGN_1);
+ brw_ADD(p, deref_1ud(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16));
+ brw_set_access_mode(p, BRW_ALIGN_16);
+ brw_ADD(p, get_addr_reg(stack_index),
+ get_addr_reg(stack_index), brw_imm_d(4));
+ orig_inst = inst->Data;
+ orig_inst->Data = &p->store[p->nr_insn];
+ brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));
+ brw_pop_insn_state(p);
+ break;
+
+ case OPCODE_RET:
+ brw_push_insn_state(p);
+ brw_set_mask_control(p, BRW_MASK_DISABLE);
+ brw_ADD(p, get_addr_reg(stack_index),
+ get_addr_reg(stack_index), brw_imm_d(-4));
+ brw_set_access_mode(p, BRW_ALIGN_1);
+ brw_MOV(p, brw_ip_reg(), deref_1ud(stack_index, 0));
+ brw_set_access_mode(p, BRW_ALIGN_16);
+ brw_pop_insn_state(p);
+
+ break;
+ case OPCODE_BGNLOOP:
+ loop_inst[loop_insn++] = brw_DO(p, BRW_EXECUTE_8);
+ break;
+ case OPCODE_BRK:
+ brw_BREAK(p);
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ break;
+ case OPCODE_CONT:
+ brw_CONT(p);
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ break;
+ case OPCODE_ENDLOOP:
+ loop_insn--;
+ inst0 = inst1 = brw_WHILE(p, loop_inst[loop_insn]);
+ /* patch all the BREAK instructions from
+ last BEGINLOOP */
+ while (inst0 > loop_inst[loop_insn]) {
+ inst0--;
+ if (inst0->header.opcode == BRW_OPCODE_BREAK) {
+ inst0->bits3.if_else.jump_count = inst1 - inst0 + 1;
+ inst0->bits3.if_else.pop_count = 0;
+ } else if (inst0->header.opcode == BRW_OPCODE_CONTINUE) {
+ inst0->bits3.if_else.jump_count = inst1 - inst0;
+ inst0->bits3.if_else.pop_count = 0;
+ }
+ }
+ break;
+ default:
+ _mesa_printf("unsupported IR in fragment shader %d\n",
+ inst->Opcode);
+ }
+ if (inst->CondUpdate)
+ brw_set_predicate_control(p, BRW_PREDICATE_NORMAL);
+ else
+ brw_set_predicate_control(p, BRW_PREDICATE_NONE);
+ }
+ post_wm_emit(c);
+ for (i = 0; i < c->fp->program.Base.NumInstructions; i++)
+ c->fp->program.Base.Instructions[i].Data = NULL;
+}
+
+void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c)
+{
+ brw_wm_pass_fp(c);
+ c->tmp_index = 127;
+ brw_wm_emit_glsl(brw, c);
+ c->prog_data.total_grf = c->reg_index;
+ c->prog_data.total_scratch = 0;
+}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_aub_playback.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_aub_playback.c
@@ -144,14 +144,14 @@
{ CMD_STATE_BASE_ADDRESS, "STATE_BASE_ADDRESS", 1 },
{ CMD_STATE_INSN_POINTER, "STATE_INSN_POINTER", 1 },
{ CMD_PIPELINE_SELECT_965, "PIPELINE_SELECT", 0, },
- { CMD_PIPELINE_SELECT_IGD, "PIPELINE_SELECT", 0,},
+ { CMD_PIPELINE_SELECT_GM45, "PIPELINE_SELECT", 0,},
{ CMD_PIPELINED_STATE_POINTERS, "PIPELINED_STATE_POINTERS", 1 },
{ CMD_BINDING_TABLE_PTRS, "BINDING_TABLE_PTRS", 1 },
{ CMD_VERTEX_BUFFER, "VERTEX_BUFFER", 1 },
{ CMD_VERTEX_ELEMENT, "VERTEX_ELEMENT", 1 },
{ CMD_INDEX_BUFFER, "INDEX_BUFFER", 1 },
{ CMD_VF_STATISTICS_965, "VF_STATISTICS", 0 },
- { CMD_VF_STATISTICS_IGD, "VF_STATISTICS", 0 },
+ { CMD_VF_STATISTICS_GM45, "VF_STATISTICS", 0 },
{ CMD_DRAW_RECT, "DRAW_RECT", 1 },
{ CMD_BLEND_CONSTANT_COLOR, "BLEND_CONSTANT_COLOR", 1 },
{ CMD_CHROMA_KEY, "CHROMA_KEY", 1 },
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/brw_state_pool.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/brw_state_pool.c
@@ -41,10 +41,9 @@
GLuint align,
GLuint *offset_return)
{
- GLuint align_mask = (1<offset + align_mask) & ~align_mask) - pool->offset;
+ GLuint fixup = ALIGN(pool->offset, align) - pool->offset;
- size = (size + 3) & ~3;
+ size = ALIGN(size, 4);
if (pool->offset + fixup + size >= pool->size) {
_mesa_printf("%s failed\n", __FUNCTION__);
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/bufmgr_fake.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/bufmgr_fake.c
@@ -169,7 +169,7 @@
if (!block)
return GL_FALSE;
- sz = (buf->size + align-1) & ~(align-1);
+ sz = ALIGN(buf->size, align);
block->mem = mmAllocMem(pool->heap,
sz,
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_batchbuffer.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_batchbuffer.h
@@ -84,7 +84,7 @@
static inline GLuint
intel_batchbuffer_space( struct intel_batchbuffer *batch )
{
- return (BATCH_SZ - BATCH_RESERVED) - (batch->ptr - (batch->map + batch->offset));
+ return (BATCH_SZ - BATCH_RESERVED) - (batch->ptr - batch->map);
}
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i965/intel_context.h
+++ mesa-7.0.3/src/mesa/drivers/dri/i965/intel_context.h
@@ -183,12 +183,8 @@
GLubyte clear_chan[4];
GLuint ClearColor;
- GLuint ClearDepth;
- GLfloat depth_scale;
GLfloat polygon_offset_scale; /* dependent on depth_scale, bpp */
- GLuint depth_clear_mask;
- GLuint stencil_clear_mask;
GLboolean hw_stencil;
GLboolean hw_stipple;
@@ -269,6 +265,8 @@
#define SUBPIXEL_X 0.125
#define SUBPIXEL_Y 0.125
+#define ALIGN(value, alignment) ((value + alignment - 1) & ~(alignment - 1))
+
/* ================================================================
* Color packing:
*/
@@ -387,8 +385,11 @@
#define PCI_CHIP_I946_GZ 0x2972
#define PCI_CHIP_I965_GM 0x2A02
-#define PCI_CHIP_IGD_GM 0x2A42
+#define PCI_CHIP_GM45_GM 0x2A42
+#define PCI_CHIP_IGD_E_G 0x2E02
+#define PCI_CHIP_Q45_G 0x2E12
+#define PCI_CHIP_G45_G 0x2E22
/* ================================================================
* intel_context.c:
--- mesa-7.0.3.orig/src/mesa/drivers/dri/mga/README
+++ mesa-7.0.3/src/mesa/drivers/dri/mga/README
@@ -0,0 +1,26 @@
+MGA DRI driver ported from XF86DRI to FBDRI
+by Denis Oliver Kropp
+
+
+INFO
+
+This driver has been ported from the head branch of XFree86 to
+the embedded-1-branch of Mesa.
+
+
+STATUS
+
+Already working very well as far as I've tested it (16/32 bit).
+glxgears runs at 935 fps (G550 32MB AGP 4x, Athlon 1.33) vs 744 fps with XFree.
+Other demos (terrain, fire, etc.) have been successfully tested as well.
+
+
+TODO
+
+- mgaEngineShutdown
+- mgaEngineRestore
+- SGRAM detection
+- remove some unused bits from server/*
+- subset driver support
+- mgaWaitForVBlank
+- deinitialization (from MGADRICloseScreen) a la radeonDestroyScreen
--- mesa-7.0.3.orig/src/mesa/drivers/dri/r200/r200_context.c
+++ mesa-7.0.3/src/mesa/drivers/dri/r200/r200_context.c
@@ -70,6 +70,7 @@
#define need_GL_ATI_fragment_shader
#define need_GL_EXT_blend_minmax
#define need_GL_EXT_fog_coord
+#define need_GL_EXT_multi_draw_arrays
#define need_GL_EXT_secondary_color
#define need_GL_EXT_blend_equation_separate
#define need_GL_EXT_blend_func_separate
@@ -133,6 +134,7 @@
{ "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions },
{ "GL_EXT_blend_subtract", NULL },
{ "GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
+ { "GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions },
{ "GL_EXT_secondary_color", GL_EXT_secondary_color_functions },
{ "GL_EXT_stencil_wrap", NULL },
{ "GL_EXT_texture_edge_clamp", NULL },
--- mesa-7.0.3.orig/src/mesa/drivers/dri/r200/r200_pixel.c
+++ mesa-7.0.3/src/mesa/drivers/dri/r200/r200_pixel.c
@@ -383,7 +383,7 @@
GLint pitch = unpack->RowLength ? unpack->RowLength : width;
GLuint planemask;
GLuint cpp = rmesa->r200Screen->cpp;
- GLint size = width * pitch * cpp;
+ GLint size = height * pitch * cpp;
if (R200_DEBUG & DEBUG_PIXEL)
fprintf(stderr, "%s\n", __FUNCTION__);
--- mesa-7.0.3.orig/src/mesa/drivers/dri/r200/r200_texstate.c
+++ mesa-7.0.3/src/mesa/drivers/dri/r200/r200_texstate.c
@@ -1818,6 +1818,12 @@
GLboolean ok;
GLuint dbg;
+ /* NOTE: must not manipulate rmesa->state.texture.unit[].unitneeded or
+ rmesa->state.envneeded before a R200_STATECHANGE (or R200_NEWPRIM) since
+ we use these to determine if we want to emit the corresponding state
+ atoms. */
+ R200_NEWPRIM( rmesa );
+
if (ctx->ATIFragmentShader._Enabled) {
GLuint i;
for (i = 0; i < R200_MAX_TEXTURE_UNITS; i++) {
--- mesa-7.0.3.orig/src/mesa/drivers/dri/r200/r200_vertprog.c
+++ mesa-7.0.3/src/mesa/drivers/dri/r200/r200_vertprog.c
@@ -744,9 +744,16 @@
goto next;
case OPCODE_MAD:
+ /* only 2 read ports into temp memory thus may need the macro op MAD_2
+ instead (requiring 2 clocks) if all inputs are in temp memory
+ (and, only if they actually reference 3 distinct temps) */
hw_op=(src[0].File == PROGRAM_TEMPORARY &&
src[1].File == PROGRAM_TEMPORARY &&
- src[2].File == PROGRAM_TEMPORARY) ? R200_VPI_OUT_OP_MAD_2 : R200_VPI_OUT_OP_MAD;
+ src[2].File == PROGRAM_TEMPORARY &&
+ (((src[0].RelAddr << 8) | src[0].Index) != ((src[1].RelAddr << 8) | src[1].Index)) &&
+ (((src[0].RelAddr << 8) | src[0].Index) != ((src[2].RelAddr << 8) | src[2].Index)) &&
+ (((src[1].RelAddr << 8) | src[1].Index) != ((src[2].RelAddr << 8) | src[2].Index))) ?
+ R200_VPI_OUT_OP_MAD_2 : R200_VPI_OUT_OP_MAD;
o_inst->op = MAKE_VSF_OP(hw_op, t_dst(&dst),
t_dst_mask(dst.WriteMask));
@@ -874,8 +881,11 @@
case OPCODE_XPD:
/* mul r0, r1.yzxw, r2.zxyw
mad r0, -r2.yzxw, r1.zxyw, r0
- NOTE: might need MAD_2
*/
+ hw_op=(src[0].File == PROGRAM_TEMPORARY &&
+ src[1].File == PROGRAM_TEMPORARY &&
+ (((src[0].RelAddr << 8) | src[0].Index) != ((src[1].RelAddr << 8) | src[1].Index))) ?
+ R200_VPI_OUT_OP_MAD_2 : R200_VPI_OUT_OP_MAD;
o_inst->op = MAKE_VSF_OP(R200_VPI_OUT_OP_MUL,
(u_temp_i << R200_VPI_OUT_REG_INDEX_SHIFT) | R200_VSF_OUT_CLASS_TMP,
@@ -901,7 +911,7 @@
o_inst++;
u_temp_i--;
- o_inst->op = MAKE_VSF_OP(R200_VPI_OUT_OP_MAD, t_dst(&dst),
+ o_inst->op = MAKE_VSF_OP(hw_op, t_dst(&dst),
t_dst_mask(dst.WriteMask));
o_inst->src0 = MAKE_VSF_SOURCE(t_src_index(vp, &src[1]),
--- mesa-7.0.3.orig/src/mesa/drivers/dri/r300/r300_context.c
+++ mesa-7.0.3/src/mesa/drivers/dri/r300/r300_context.c
@@ -83,6 +83,7 @@
#define need_GL_ARB_vertex_program
#define need_GL_EXT_blend_minmax
//#define need_GL_EXT_fog_coord
+#define need_GL_EXT_multi_draw_arrays
#define need_GL_EXT_secondary_color
#define need_GL_EXT_blend_equation_separate
#define need_GL_EXT_blend_func_separate
@@ -110,6 +111,7 @@
{"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
{"GL_EXT_blend_subtract", NULL},
// {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions },
+ {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions},
{"GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions},
{"GL_EXT_secondary_color", GL_EXT_secondary_color_functions},
{"GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions},
--- mesa-7.0.3.orig/src/mesa/drivers/dri/r300/Lindent
+++ mesa-7.0.3/src/mesa/drivers/dri/r300/Lindent
@@ -0,0 +1,2 @@
+#!/bin/sh
+indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@"
--- mesa-7.0.3.orig/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ mesa-7.0.3/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -90,7 +90,7 @@
DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ DRI_CONF_ALLOW_LARGE_TEXTURES(2)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
DRI_CONF_NO_RAST(false)
@@ -117,7 +117,7 @@
DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER)
DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC)
DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF)
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ DRI_CONF_ALLOW_LARGE_TEXTURES(2)
DRI_CONF_TEXTURE_BLEND_QUALITY(1.0,"0.0:1.0")
DRI_CONF_SECTION_END
DRI_CONF_SECTION_DEBUG
@@ -188,7 +188,7 @@
DRI_CONF_MAX_TEXTURE_IMAGE_UNITS(8, 2, 8)
DRI_CONF_MAX_TEXTURE_COORD_UNITS(8, 2, 8)
DRI_CONF_COMMAND_BUFFER_SIZE(8, 8, 32)
- DRI_CONF_DISABLE_FALLBACK(false)
+ DRI_CONF_DISABLE_FALLBACK(true)
DRI_CONF_DISABLE_DOUBLE_SIDE_STENCIL(false)
DRI_CONF_SECTION_END
DRI_CONF_SECTION_QUALITY
--- mesa-7.0.3.orig/src/mesa/drivers/dri/tdfx/BUGS
+++ mesa-7.0.3/src/mesa/drivers/dri/tdfx/BUGS
@@ -0,0 +1,64 @@
+REMOVE THIS FILE BEFORE MERGING WITH TRUNK
+------------------------------------------
+
+OUTSTANDING BUGS
+
+demos/reflect - reading back Z on Voodoo3, image offset to right
+ Fixed in latest Glide.
+
+Q3 - some polygons drawn as vertical strips, similar to bug that was
+ seen in demos/fire. Voodoo3 only. May be related to glDepthMask
+ or glColorMask.
+
+book/fog - not fogging
+ Fog in orthograph mode still not implemented. Checking with
+ 3dfx engineers for ideas.
+
+Q3 demo crashes after changing display settings
+ but the full Q3 game version seems OK.
+
+
+
+MORE OUTSTANDING BUGS
+
+private context was NULL! causing immediate failure of any glx prog. cant
+reproduce after restarting the X server. putting it down as halluc.
+
+texture object image was NULL, causing segmentation failure. happens with
+prboom. ive put a check in tdfx_texstate.c but this isn't a fix.
+
+prboom, wall textures near first chainsaw aren't bound properly. sideways
+movements causes the wall textures to move with you. prboom busted?
+
+16bpp mode, quake3, windowed, q3dm1, floor under rocketlauncher bands. it
+looks like multitexturing gone wrong. i'll disable a tmu and test.
+
+sof, polygons appear at wrong x,y,z positions, intermittent, have not yet
+found reliable way of reproducing. culling? sometimes polys disappear.
+
+descent3 is all black in 16bpp mode - FIXED (palette problems)
+
+smeared pixels in quake3 - FIXED (texture memory overlapped FB)
+
+
+
+PERFORMANCE COMPARISON (Brian / Alan)
+
+ V3/16 is Voodoo3 in 16bpp on a P3/500
+ V5/16 is Voodoo5 in 16bpp on a P3/600
+ V5/32 is Voodoo5 in 32bpp on a P3/600
+ V5A/16 is Voodoo5 in 16bpp on an Alpha AXP/600
+ V5A/32 is Voodoo5 in 32bpp on an Alpha AXP/600
+
+ tdfx-2-1-branch tdfx-3-0-0-branch
+demo V3/16 V5/16 V5/32 V3/16 V5/16 V5/32 V5A/16 V5A/32
+------------------------------------------------------------------------
+gloss 257 183 174 320 308 177 313 167
+fire 42 39 52 41
+fire (no help) 98 80 50 106 113 73 124 80
+tunnel 61 50 70 58
+tunnel (no help) 167 142 57 138 152 113 171 122
+gears 663 554 540 881 1232 776 1484 830
+teapot 20 21 37 36
+teapot (no help) 22 14 14 24 30 30 43 42
+
--- mesa-7.0.3.orig/src/mesa/drivers/dri/intel/intel_tex_layout.c
+++ mesa-7.0.3/src/mesa/drivers/dri/intel/intel_tex_layout.c
@@ -34,10 +34,21 @@
#include "intel_tex_layout.h"
#include "macros.h"
-
-static int align(int value, int alignment)
+GLuint intel_compressed_alignment(GLenum internalFormat)
{
- return (value + alignment - 1) & ~(alignment - 1);
+ GLuint alignment = 4;
+
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ alignment = 8;
+ break;
+
+ default:
+ break;
+ }
+
+ return alignment;
}
void i945_miptree_layout_2d( struct intel_context *intel, struct intel_mipmap_tree *mt )
@@ -51,17 +62,30 @@
mt->pitch = mt->width0;
+ if (mt->compressed) {
+ align_w = intel_compressed_alignment(mt->internal_format);
+ mt->pitch = ALIGN(mt->width0, align_w);
+ }
+
/* May need to adjust pitch to accomodate the placement of
* the 2nd mipmap. This occurs when the alignment
* constraints of mipmap placement push the right edge of the
* 2nd mipmap out past the width of its parent.
*/
if (mt->first_level != mt->last_level) {
- GLuint mip1_width = align(minify(mt->width0), align_w)
- + minify(minify(mt->width0));
+ GLuint mip1_width;
- if (mip1_width > mt->width0)
- mt->pitch = mip1_width;
+ if (mt->compressed) {
+ mip1_width = ALIGN(minify(mt->width0), align_w)
+ + ALIGN(minify(minify(mt->width0)), align_w);
+ } else {
+ mip1_width = ALIGN(minify(mt->width0), align_w)
+ + minify(minify(mt->width0));
+ }
+
+ if (mip1_width > mt->pitch) {
+ mt->pitch = mip1_width;
+ }
}
/* Pitch must be a whole number of dwords, even though we
@@ -79,7 +103,7 @@
if (mt->compressed)
img_height = MAX2(1, height/4);
else
- img_height = align(height, align_h);
+ img_height = ALIGN(height, align_h);
/* Because the images are packed better, the final offset
@@ -90,7 +114,7 @@
/* Layout_below: step right after second mipmap.
*/
if (level == mt->first_level + 1) {
- x += align(width, align_w);
+ x += ALIGN(width, align_w);
}
else {
y += img_height;
--- mesa-7.0.3.orig/src/mesa/drivers/dri/intel/intel_tex_layout.h
+++ mesa-7.0.3/src/mesa/drivers/dri/intel/intel_tex_layout.h
@@ -39,3 +39,4 @@
}
extern void i945_miptree_layout_2d( struct intel_context *intel, struct intel_mipmap_tree *mt );
+extern GLuint intel_compressed_alignment(GLenum);
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915tex/i915_fragprog.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915tex/i915_fragprog.c
@@ -94,7 +94,7 @@
break;
case FRAG_ATTRIB_FOGC:
src = i915_emit_decl(p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W);
- src = swizzle(src, W, W, W, W);
+ src = swizzle(src, W, ZERO, ZERO, ONE);
break;
case FRAG_ATTRIB_TEX0:
case FRAG_ATTRIB_TEX1:
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915tex/intel_mipmap_tree.c
@@ -365,6 +365,7 @@
}
}
+extern GLuint intel_compressed_alignment(GLenum);
/* Copy mipmap image between trees
*/
void
@@ -382,8 +383,12 @@
const GLuint *src_depth_offset = intel_miptree_depth_offsets(src, level);
GLuint i;
- if (dst->compressed)
- height /= 4;
+ if (dst->compressed) {
+ GLuint alignment = intel_compressed_alignment(dst->internal_format);
+ height = (height + 3) / 4;
+ width = ((width + alignment - 1) & ~(alignment - 1));
+ }
+
for (i = 0; i < depth; i++) {
intel_region_copy(intel->intelScreen,
dst->region, dst_offset + dst_depth_offset[i],
--- mesa-7.0.3.orig/src/mesa/drivers/dri/i915tex/intel_screen.c
+++ mesa-7.0.3/src/mesa/drivers/dri/i915tex/intel_screen.c
@@ -56,7 +56,7 @@
DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
DRI_CONF_FORCE_S3TC_ENABLE(false)
- DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ DRI_CONF_ALLOW_LARGE_TEXTURES(2)
DRI_CONF_SECTION_END DRI_CONF_END;
const GLuint __driNConfigOptions = 4;
--- mesa-7.0.3.orig/src/mesa/drivers/common/driverfuncs.c
+++ mesa-7.0.3/src/mesa/drivers/common/driverfuncs.c
@@ -284,6 +284,7 @@
driver->GetShaderInfoLog = _mesa_get_shader_info_log;
driver->GetShaderSource = _mesa_get_shader_source;
driver->GetUniformfv = _mesa_get_uniformfv;
+ driver->GetUniformiv = _mesa_get_uniformiv;
driver->GetUniformLocation = _mesa_get_uniform_location;
driver->IsProgram = _mesa_is_program;
driver->IsShader = _mesa_is_shader;
--- mesa-7.0.3.orig/src/mesa/drivers/ggi/default/genkgi.h
+++ mesa-7.0.3/src/mesa/drivers/ggi/default/genkgi.h
@@ -0,0 +1,76 @@
+/* $Id: genkgi.h,v 1.3 1999/08/22 08:56:50 jtaylor Exp $
+******************************************************************************
+
+ GGIMesa - KGIcon specific overrides for fbcon-mesa
+ API header
+
+ Copyright (C) 1999 Jon Taylor [taylorj@ggi-project.org]
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+******************************************************************************
+*/
+
+#ifndef _GENKGI_MESA_H
+#define _GENKGI_MESA_H
+
+#undef KGI_USE_PPBUFS
+
+#include
+#include
+
+#include
+#include
+#include
+
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+/* FIXME: LibGGI needs to export its genkgi.h */
+struct genkgi_priv
+{
+ ggi_gc *mapped_gc;
+ unsigned int gc_size;
+ ggifunc_drawline *drawline;
+ ggifunc_drawbox *drawbox;
+ ggifunc_fillscreen *fillscreen;
+ int fd_gc;
+ int close_gc;
+ int fd_kgicommand;
+ uint8 *mapped_kgicommand;
+ uint8 *kgicommand_ptr;
+ unsigned int kgicommand_buffersize;
+};
+
+#define GENKGI_PRIV(vis) ((struct genkgi_priv *)FBDEV_PRIV(vis)->accelpriv)
+
+extern ggifunc_getapi GGIMesa_genkgi_getapi;
+extern ggifunc_flush GGIMesa_genkgi_flush;
+
+struct genkgi_priv_mesa
+{
+ char accel[100];
+ int have_accel;
+ void *accelpriv; /* Private data of subdrivers */
+ struct genkgi_priv *oldpriv; /* LibGGI's private data */
+};
+
+#define GENKGI_PRIV_MESA(vis) ((struct genkgi_priv_mesa *)FBDEV_PRIV_MESA(vis)->accelpriv)
+
+#endif /* _GENKHI_MESA_H */
--- mesa-7.0.3.orig/src/mesa/drivers/glide/fxddspan.c
+++ mesa-7.0.3/src/mesa/drivers/glide/fxddspan.c
@@ -549,6 +549,7 @@
fxSetupDDSpanPointers(GLcontext * ctx)
{
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx );
+#if 0
fxMesaContext fxMesa = FX_CONTEXT(ctx);
switch (fxMesa->colDepth) {
@@ -602,6 +603,8 @@
swdd->WriteStencilPixels = fxWriteStencilPixels;
swdd->ReadStencilPixels = fxReadStencilPixels;
}
+#endif
+
#if 0
swdd->WriteCI8Span = NULL;
swdd->WriteCI32Span = NULL;
--- mesa-7.0.3.orig/src/mesa/drivers/glide/fxddtex.c
+++ mesa-7.0.3/src/mesa/drivers/glide/fxddtex.c
@@ -504,7 +504,7 @@
static GrTexTable_t
convertPalette(const fxMesaContext fxMesa, FxU32 data[256], const struct gl_color_table *table)
{
- const GLubyte *tableUB = (const GLubyte *) table->Table;
+ const GLubyte *tableUB = (const GLubyte *) table->TableUB;
GLint width = table->Size;
FxU32 r, g, b, a;
GLint i;
@@ -580,7 +580,7 @@
tObj->Name, (GLuint) tObj->DriverData);
}
/* This might be a proxy texture. */
- if (!tObj->Palette.Table)
+ if (!tObj->Palette.TableUB) /* TODO: is that ok or should it be TableF? */
return;
if (!tObj->DriverData)
tObj->DriverData = fxAllocTexObjData(fxMesa);
--- mesa-7.0.3.orig/src/mesa/drivers/glide/fxsetup.c
+++ mesa-7.0.3/src/mesa/drivers/glide/fxsetup.c
@@ -154,7 +154,8 @@
}
}
- ti->baseLevelInternalFormat = tObj->Image[0][minl]->Format;
+ /* TODO: right format? */
+ ti->baseLevelInternalFormat = tObj->Image[0][minl]->_BaseFormat;
ti->validated = GL_TRUE;
--- mesa-7.0.3.orig/src/mesa/drivers/glide/fxg.c
+++ mesa-7.0.3/src/mesa/drivers/glide/fxg.c
@@ -2306,4 +2306,18 @@
#undef GET_EXT_ADDR
}
+#else
+
+/*
+ * Need this to provide at least one external definition.
+ */
+
+extern int gl_fxg_dummy_function(void);
+int
+gl_fxg_dummy_function(void)
+{
+ return 0;
+}
+
+
#endif /* FX */
--- mesa-7.0.3.orig/src/mesa/drivers/glide/fxtris.c
+++ mesa-7.0.3/src/mesa/drivers/glide/fxtris.c
@@ -177,22 +177,23 @@
dst->specular[2] = src->g1;
#endif /* !FX_PACKEDCOLOR */
- dst->texcoord[ts0][0] = fxMesa->inv_s0scale * src->tmuvtx[0].sow * w;
- dst->texcoord[ts0][1] = fxMesa->inv_t0scale * src->tmuvtx[0].tow * w;
+ /* TODO: changed "texcoord" to "attrib" */
+ dst->attrib[ts0][0] = fxMesa->inv_s0scale * src->tmuvtx[0].sow * w;
+ dst->attrib[ts0][1] = fxMesa->inv_t0scale * src->tmuvtx[0].tow * w;
if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU0)
- dst->texcoord[ts0][3] = src->tmuvtx[0].oow * w;
+ dst->attrib[ts0][3] = src->tmuvtx[0].oow * w;
else
- dst->texcoord[ts0][3] = 1.0F;
+ dst->attrib[ts0][3] = 1.0F;
if (fxMesa->SetupIndex & SETUP_TMU1) {
- dst->texcoord[ts1][0] = fxMesa->inv_s1scale * src->tmuvtx[1].sow * w;
- dst->texcoord[ts1][1] = fxMesa->inv_t1scale * src->tmuvtx[1].tow * w;
+ dst->attrib[ts1][0] = fxMesa->inv_s1scale * src->tmuvtx[1].sow * w;
+ dst->attrib[ts1][1] = fxMesa->inv_t1scale * src->tmuvtx[1].tow * w;
if (fxMesa->stw_hint_state & GR_STWHINT_W_DIFF_TMU1)
- dst->texcoord[ts1][3] = src->tmuvtx[1].oow * w;
+ dst->attrib[ts1][3] = src->tmuvtx[1].oow * w;
else
- dst->texcoord[ts1][3] = 1.0F;
+ dst->attrib[ts1][3] = 1.0F;
}
dst->pointSize = src->psize;
--- mesa-7.0.3.orig/src/mesa/drivers/glide/fxvbtmp.h
+++ mesa-7.0.3/src/mesa/drivers/glide/fxvbtmp.h
@@ -57,8 +57,13 @@
int i;
if (IND & SETUP_PSIZ) {
+ /*
psize = VB->PointSizePtr->data;
psize_stride = VB->PointSizePtr->stride;
+ */
+ /* TODO: fix this! */
+ psize = 0;
+ psize_stride = 0;
}
if (IND & SETUP_TMU0) {
--- mesa-7.0.3.orig/src/mesa/drivers/windows/fx/fx.rc
+++ mesa-7.0.3/src/mesa/drivers/windows/fx/fx.rc
@@ -0,0 +1,39 @@
+#include
+
+#define PRODNAME "Mesa 6.x"
+#define CONTACTSTR "http://www.mesa3d.org"
+#define HWSTR "3dfx Voodoo Graphics, Voodoo Rush, Voodoo^2, Voodoo Banshee, Velocity 100/200, Voodoo3, Voodoo4, Voodoo5"
+#define COPYRIGHTSTR "Copyright \251 Brian E. Paul"
+
+#define VERSIONSTR "6.3.0.1"
+#define MANVERSION 6
+#define MANREVISION 3
+#define BUILD_NUMBER 1
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
+ PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
+ FILEFLAGSMASK 0x0030003FL
+
+ FILEOS VOS_DOS_WINDOWS32
+ FILETYPE VFT_DRV
+ FILESUBTYPE VFT2_DRV_INSTALLABLE
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "FileDescription", PRODNAME
+ VALUE "FileVersion", VERSIONSTR
+ VALUE "LegalCopyright", COPYRIGHTSTR
+ VALUE "ProductName", PRODNAME
+ VALUE "Graphics Subsystem", HWSTR
+ VALUE "Contact", CONTACTSTR
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ /* the following line should be extended for localized versions */
+ VALUE "Translation", 0x409, 1252
+ END
+END
--- mesa-7.0.3.orig/src/mesa/drivers/windows/gdi/InitCritSections.cpp
+++ mesa-7.0.3/src/mesa/drivers/windows/gdi/InitCritSections.cpp
@@ -0,0 +1,32 @@
+#include "glapi.h"
+#include "glThread.h"
+
+#ifdef WIN32_THREADS
+extern "C" _glthread_Mutex OneTimeLock;
+extern "C" _glthread_Mutex GenTexturesLock;
+
+extern "C" void FreeAllTSD(void);
+
+class _CriticalSectionInit
+{
+public:
+ static _CriticalSectionInit m_inst;
+
+ _CriticalSectionInit()
+ {
+ _glthread_INIT_MUTEX(OneTimeLock);
+ _glthread_INIT_MUTEX(GenTexturesLock);
+ }
+
+ ~_CriticalSectionInit()
+ {
+ _glthread_DESTROY_MUTEX(OneTimeLock);
+ _glthread_DESTROY_MUTEX(GenTexturesLock);
+ FreeAllTSD();
+ }
+};
+
+_CriticalSectionInit _CriticalSectionInit::m_inst;
+
+
+#endif
--- mesa-7.0.3.orig/src/mesa/drivers/windows/gldirect/gldirect.rc
+++ mesa-7.0.3/src/mesa/drivers/windows/gldirect/gldirect.rc
@@ -0,0 +1,43 @@
+/****************************************************************************
+*
+* Mesa 3-D graphics library
+* Direct3D Driver Interface
+*
+* ========================================================================
+*
+* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice shall be included
+* in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+* SCITECH SOFTWARE INC 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.
+*
+* ======================================================================
+*
+* Language: Windows Resource Compiler
+* Environment: Windows 95
+*
+****************************************************************************/
+
+#ifndef WORKSHOP_INVOKED
+ #include
+#endif
+
+#define FILE_DESCRIPTION "SciTech GLDirect"
+#define ORIG_FILENAME "opengl32.dll"
+#define FILE_TYPE VFT_DLL
+
+#include "gldirect/gldver.ver"
--- mesa-7.0.3.orig/src/mesa/drivers/windows/gldirect/opengl32.ref
+++ mesa-7.0.3/src/mesa/drivers/windows/gldirect/opengl32.ref
@@ -0,0 +1,495 @@
+;****************************************************************************
+;*
+;* Mesa 3-D graphics library
+;* Direct3D Driver Interface
+;*
+;* ========================================================================
+;*
+;* Copyright (C) 1991-2004 SciTech Software, Inc. All rights reserved.
+;*
+;* Permission is hereby granted, free of charge, to any person obtaining a
+;* copy of this software and associated documentation files (the "Software"),
+;* to deal in the Software without restriction, including without limitation
+;* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+;* and/or sell copies of the Software, and to permit persons to whom the
+;* Software is furnished to do so, subject to the following conditions:
+;*
+;* The above copyright notice and this permission notice shall be included
+;* in all copies or substantial portions of the Software.
+;*
+;* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+;* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+;* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+;* SCITECH SOFTWARE INC 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.
+;*
+;* ======================================================================
+;*
+;* Language: ANSI C
+;* Environment: Windows 9x/2000/XP/XBox (Win32)
+;*
+;* Description: DLL Module definition file
+;*
+;****************************************************************************/
+
+DESCRIPTION 'GLDirect'
+
+VERSION 3.0
+
+EXPORTS
+ glAccum
+ glAlphaFunc
+ glAreTexturesResident
+ glArrayElement
+ glBegin
+ glBindTexture
+ glBitmap
+ glBlendFunc
+ glCallList
+ glCallLists
+ glClear
+ glClearAccum
+ glClearIndex
+ glClearColor
+ glClearDepth
+ glClearStencil
+ glClipPlane
+ glColor3b
+ glColor3d
+ glColor3f
+ glColor3i
+ glColor3s
+ glColor3ub
+ glColor3ui
+ glColor3us
+ glColor4b
+ glColor4d
+ glColor4f
+ glColor4i
+ glColor4s
+ glColor4ub
+ glColor4ui
+ glColor4us
+ glColor3bv
+ glColor3dv
+ glColor3fv
+ glColor3iv
+ glColor3sv
+ glColor3ubv
+ glColor3uiv
+ glColor3usv
+ glColor4bv
+ glColor4dv
+ glColor4fv
+ glColor4iv
+ glColor4sv
+ glColor4ubv
+ glColor4uiv
+ glColor4usv
+ glColorMask
+ glColorMaterial
+ glColorPointer
+ glColorTableEXT
+ glColorSubTableEXT
+ glCopyPixels
+ glCopyTexImage1D
+ glCopyTexImage2D
+ glCopyTexSubImage1D
+ glCopyTexSubImage2D
+ glCullFace
+ glDepthFunc
+ glDepthMask
+ glDepthRange
+ glDeleteLists
+ glDeleteTextures
+ glDisable
+ glDisableClientState
+ glDrawArrays
+ glDrawBuffer
+ glDrawElements
+ glDrawPixels
+ glEnable
+ glEnableClientState
+ glEnd
+ glEndList
+ glEvalCoord1d
+ glEvalCoord1f
+ glEvalCoord1dv
+ glEvalCoord1fv
+ glEvalCoord2d
+ glEvalCoord2f
+ glEvalCoord2dv
+ glEvalCoord2fv
+ glEvalPoint1
+ glEvalPoint2
+ glEvalMesh1
+ glEdgeFlag
+ glEdgeFlagv
+ glEdgeFlagPointer
+ glEvalMesh2
+ glFeedbackBuffer
+ glFinish
+ glFlush
+ glFogf
+ glFogi
+ glFogfv
+ glFogiv
+ glFrontFace
+ glFrustum
+ glGenLists
+ glGenTextures
+ glGetBooleanv
+ glGetClipPlane
+ glGetColorTableEXT
+ glGetColorTableParameterivEXT
+ glGetColorTableParameterfvEXT
+ glGetDoublev
+ glGetError
+ glGetFloatv
+ glGetIntegerv
+ glGetLightfv
+ glGetLightiv
+ glGetMapdv
+ glGetMapfv
+ glGetMapiv
+ glGetMaterialfv
+ glGetMaterialiv
+ glGetPixelMapfv
+ glGetPixelMapuiv
+ glGetPixelMapusv
+ glGetPointerv
+ glGetPolygonStipple
+ glGetString
+ glGetTexEnvfv
+ glGetTexEnviv
+ glGetTexGeniv
+ glGetTexGendv
+ glGetTexGenfv
+ glGetTexImage
+ glGetTexLevelParameterfv
+ glGetTexLevelParameteriv
+ glGetTexParameterfv
+ glGetTexParameteriv
+ glHint
+ glIndexd
+ glIndexf
+ glIndexi
+ glIndexs
+ glIndexub
+ glIndexdv
+ glIndexfv
+ glIndexiv
+ glIndexsv
+ glIndexubv
+ glIndexMask
+ glIndexPointer
+ glInterleavedArrays
+ glInitNames
+ glIsList
+ glIsTexture
+ glLightf
+ glLighti
+ glLightfv
+ glLightiv
+ glLightModelf
+ glLightModeli
+ glLightModelfv
+ glLightModeliv
+ glLineWidth
+ glLineStipple
+ glListBase
+ glLoadIdentity
+ glLoadMatrixd
+ glLoadMatrixf
+ glLoadName
+ glLogicOp
+ glMap1d
+ glMap1f
+ glMap2d
+ glMap2f
+ glMapGrid1d
+ glMapGrid1f
+ glMapGrid2d
+ glMapGrid2f
+ glMaterialf
+ glMateriali
+ glMaterialfv
+ glMaterialiv
+ glMatrixMode
+ glMultMatrixd
+ glMultMatrixf
+ glNewList
+ glNormal3b
+ glNormal3d
+ glNormal3f
+ glNormal3i
+ glNormal3s
+ glNormal3bv
+ glNormal3dv
+ glNormal3fv
+ glNormal3iv
+ glNormal3sv
+ glNormalPointer
+ glOrtho
+ glPassThrough
+ glPixelMapfv
+ glPixelMapuiv
+ glPixelMapusv
+ glPixelStoref
+ glPixelStorei
+ glPixelTransferf
+ glPixelTransferi
+ glPixelZoom
+ glPointSize
+ glPolygonMode
+ glPolygonOffset
+ glPolygonOffsetEXT
+ glPolygonStipple
+ glPopAttrib
+ glPopClientAttrib
+ glPopMatrix
+ glPopName
+ glPrioritizeTextures
+ glPushMatrix
+ glRasterPos2d
+ glRasterPos2f
+ glRasterPos2i
+ glRasterPos2s
+ glRasterPos3d
+ glRasterPos3f
+ glRasterPos3i
+ glRasterPos3s
+ glRasterPos4d
+ glRasterPos4f
+ glRasterPos4i
+ glRasterPos4s
+ glRasterPos2dv
+ glRasterPos2fv
+ glRasterPos2iv
+ glRasterPos2sv
+ glRasterPos3dv
+ glRasterPos3fv
+ glRasterPos3iv
+ glRasterPos3sv
+ glRasterPos4dv
+ glRasterPos4fv
+ glRasterPos4iv
+ glRasterPos4sv
+ glReadBuffer
+ glReadPixels
+ glRectd
+ glRectf
+ glRecti
+ glRects
+ glRectdv
+ glRectfv
+ glRectiv
+ glRectsv
+ glScissor
+ glIsEnabled
+ glPushAttrib
+ glPushClientAttrib
+ glPushName
+ glRenderMode
+ glRotated
+ glRotatef
+ glSelectBuffer
+ glScaled
+ glScalef
+ glShadeModel
+ glStencilFunc
+ glStencilMask
+ glStencilOp
+ glTexCoord1d
+ glTexCoord1f
+ glTexCoord1i
+ glTexCoord1s
+ glTexCoord2d
+ glTexCoord2f
+ glTexCoord2i
+ glTexCoord2s
+ glTexCoord3d
+ glTexCoord3f
+ glTexCoord3i
+ glTexCoord3s
+ glTexCoord4d
+ glTexCoord4f
+ glTexCoord4i
+ glTexCoord4s
+ glTexCoord1dv
+ glTexCoord1fv
+ glTexCoord1iv
+ glTexCoord1sv
+ glTexCoord2dv
+ glTexCoord2fv
+ glTexCoord2iv
+ glTexCoord2sv
+ glTexCoord3dv
+ glTexCoord3fv
+ glTexCoord3iv
+ glTexCoord3sv
+ glTexCoord4dv
+ glTexCoord4fv
+ glTexCoord4iv
+ glTexCoord4sv
+ glTexCoordPointer
+ glTexGend
+ glTexGenf
+ glTexGeni
+ glTexGendv
+ glTexGeniv
+ glTexGenfv
+ glTexEnvf
+ glTexEnvi
+ glTexEnvfv
+ glTexEnviv
+ glTexImage1D
+ glTexImage2D
+ glTexParameterf
+ glTexParameteri
+ glTexParameterfv
+ glTexParameteriv
+ glTexSubImage1D
+ glTexSubImage2D
+ glTranslated
+ glTranslatef
+ glVertex2d
+ glVertex2f
+ glVertex2i
+ glVertex2s
+ glVertex3d
+ glVertex3f
+ glVertex3i
+ glVertex3s
+ glVertex4d
+ glVertex4f
+ glVertex4i
+ glVertex4s
+ glVertex2dv
+ glVertex2fv
+ glVertex2iv
+ glVertex2sv
+ glVertex3dv
+ glVertex3fv
+ glVertex3iv
+ glVertex3sv
+ glVertex4dv
+ glVertex4fv
+ glVertex4iv
+ glVertex4sv
+ glVertexPointer
+ glViewport
+
+ glBlendEquationEXT
+ glBlendColorEXT
+ glVertexPointerEXT
+ glNormalPointerEXT
+ glColorPointerEXT
+ glIndexPointerEXT
+ glTexCoordPointerEXT
+ glEdgeFlagPointerEXT
+ glGetPointervEXT
+ glArrayElementEXT
+ glDrawArraysEXT
+ glBindTextureEXT
+ glDeleteTexturesEXT
+ glGenTexturesEXT
+ glPrioritizeTexturesEXT
+ glCopyTexSubImage3DEXT
+ glTexImage3DEXT
+ glTexSubImage3DEXT
+
+ glWindowPos4fMESA
+ glWindowPos2iMESA
+ glWindowPos2sMESA
+ glWindowPos2fMESA
+ glWindowPos2dMESA
+ glWindowPos2ivMESA
+ glWindowPos2svMESA
+ glWindowPos2fvMESA
+ glWindowPos2dvMESA
+ glWindowPos3iMESA
+ glWindowPos3sMESA
+ glWindowPos3fMESA
+ glWindowPos3dMESA
+ glWindowPos3ivMESA
+ glWindowPos3svMESA
+ glWindowPos3fvMESA
+ glWindowPos3dvMESA
+ glWindowPos4iMESA
+ glWindowPos4sMESA
+ glWindowPos4dMESA
+ glWindowPos4ivMESA
+ glWindowPos4svMESA
+ glWindowPos4fvMESA
+ glWindowPos4dvMESA
+ glResizeBuffersMESA
+
+ wglCopyContext
+ wglCreateContext
+ wglCreateLayerContext
+ wglDeleteContext
+ wglDescribeLayerPlane
+ wglGetCurrentContext
+ wglGetCurrentDC
+ wglGetLayerPaletteEntries
+ wglGetProcAddress
+ wglMakeCurrent
+ wglRealizeLayerPalette
+ wglSetLayerPaletteEntries
+ wglShareLists
+ wglSwapLayerBuffers
+ wglUseFontBitmapsA
+ wglUseFontBitmapsW
+ wglUseFontOutlinesA
+ wglUseFontOutlinesW
+
+;These functions are identical and therefore share the same addresses
+ ChoosePixelFormat = wglChoosePixelFormat
+ DescribePixelFormat = wglDescribePixelFormat
+ GetPixelFormat = wglGetPixelFormat
+ SetPixelFormat = wglSetPixelFormat
+ SwapBuffers = wglSwapBuffers
+
+ wglChoosePixelFormat
+ wglDescribePixelFormat
+ wglGetPixelFormat
+ wglSetPixelFormat
+ wglSwapBuffers
+
+ glActiveTextureARB
+ glClientActiveTextureARB
+ glMultiTexCoord1dARB
+ glMultiTexCoord1dvARB
+ glMultiTexCoord1fARB
+ glMultiTexCoord1fvARB
+ glMultiTexCoord1iARB
+ glMultiTexCoord1ivARB
+ glMultiTexCoord1sARB
+ glMultiTexCoord1svARB
+ glMultiTexCoord2dARB
+ glMultiTexCoord2dvARB
+ glMultiTexCoord2fARB
+ glMultiTexCoord2fvARB
+ glMultiTexCoord2iARB
+ glMultiTexCoord2ivARB
+ glMultiTexCoord2sARB
+ glMultiTexCoord2svARB
+ glMultiTexCoord3dARB
+ glMultiTexCoord3dvARB
+ glMultiTexCoord3fARB
+ glMultiTexCoord3fvARB
+ glMultiTexCoord3iARB
+ glMultiTexCoord3ivARB
+ glMultiTexCoord3sARB
+ glMultiTexCoord3svARB
+ glMultiTexCoord4dARB
+ glMultiTexCoord4dvARB
+ glMultiTexCoord4fARB
+ glMultiTexCoord4fvARB
+ glMultiTexCoord4iARB
+ glMultiTexCoord4ivARB
+ glMultiTexCoord4sARB
+ glMultiTexCoord4svARB
--- mesa-7.0.3.orig/src/mesa/drivers/x11/fakeglx.c
+++ mesa-7.0.3/src/mesa/drivers/x11/fakeglx.c
@@ -1182,11 +1182,12 @@
* GLX_ARB_multisample
*/
case GLX_SAMPLE_BUFFERS_ARB:
- /* ms not supported */
- return NULL;
case GLX_SAMPLES_ARB:
- /* ms not supported */
- return NULL;
+ parselist++;
+ if (*parselist++ != 0)
+ /* ms not supported */
+ return NULL;
+ break;
/*
* FBConfig attribs.
--- mesa-7.0.3.orig/src/mesa/drivers/x11/xm_glide.c
+++ mesa-7.0.3/src/mesa/drivers/x11/xm_glide.c
@@ -64,7 +64,8 @@
attribs[numAttribs++] = FXMESA_NONE;
/* [dBorca] we should take an envvar for `fxMesaSelectCurrentBoard'!!! */
- hw = fxMesaSelectCurrentBoard(0);
+/* hw = fxMesaSelectCurrentBoard(0); */
+ hw = GR_SSTTYPE_Voodoo2;
/* if these fail, there's a new bug somewhere */
ASSERT(b->mesa_buffer.Width > 0);
--- mesa-7.0.3.orig/src/mesa/drivers/glslcompiler/Makefile
+++ mesa-7.0.3/src/mesa/drivers/glslcompiler/Makefile
@@ -0,0 +1,44 @@
+# Makefile for stand-alone GL-SL compiler
+
+TOP = ../../../..
+
+include $(TOP)/configs/current
+
+
+PROGRAM = glslcompiler
+
+OBJECTS = \
+ glslcompiler.o \
+ ../../glapi/glapi.o \
+ ../../glapi/glthread.o \
+ ../../main/dispatch.o \
+ ../common/driverfuncs.o \
+ ../../libmesa.a
+
+INCLUDES = \
+ -I$(TOP)/include \
+ -I$(TOP)/include/GL/internal \
+ -I$(TOP)/src/mesa \
+ -I$(TOP)/src/mesa/main \
+ -I$(TOP)/src/mesa/glapi \
+ -I$(TOP)/src/mesa/math \
+ -I$(TOP)/src/mesa/transform \
+ -I$(TOP)/src/mesa/shader \
+ -I$(TOP)/src/mesa/swrast \
+ -I$(TOP)/src/mesa/swrast_setup \
+
+
+default: $(PROGRAM)
+ $(INSTALL) $(PROGRAM) $(TOP)/bin
+
+
+glslcompiler: $(OBJECTS)
+ $(CC) $(OBJECTS) -lm -lpthread -o $@
+
+
+glslcompiler.o: glslcompiler.c
+ $(CC) -c $(CFLAGS) $(INCLUDES) glslcompiler.c -o $@
+
+
+clean:
+ rm -f *.o *~ $(PROGRAM)
--- mesa-7.0.3.orig/src/mesa/drivers/glslcompiler/glslcompiler.c
+++ mesa-7.0.3/src/mesa/drivers/glslcompiler/glslcompiler.c
@@ -0,0 +1,358 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5.3
+ *
+ * Copyright (C) 1999-2007 Brian Paul, Tungsten Graphics, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \mainpage
+ *
+ * Stand-alone Shading Language compiler.
+ * Basically, a command-line program which accepts GLSL shaders and emits
+ * vertex/fragment programs (GPU instructions).
+ *
+ * This file is basically just a Mesa device driver but instead of building
+ * a shared library we build an executable.
+ *
+ * We can emit programs in three different formats:
+ * 1. ARB-style (GL_ARB_vertex/fragment_program)
+ * 2. NV-style (GL_NV_vertex/fragment_program)
+ * 3. debug-style (a slightly more sophisticated, internal format)
+ *
+ * Note that the ARB and NV program languages can't express all the
+ * features that might be used by a fragment program (examples being
+ * uniform and varying vars). So, the ARB/NV programs that are
+ * emitted aren't always legal programs in those languages.
+ */
+
+
+#include "imports.h"
+#include "context.h"
+#include "extensions.h"
+#include "framebuffer.h"
+#include "shaders.h"
+#include "shader/shader_api.h"
+#include "shader/prog_print.h"
+#include "drivers/common/driverfuncs.h"
+#include "tnl/tnl.h"
+#include "tnl/t_context.h"
+#include "tnl/t_pipeline.h"
+#include "swrast/swrast.h"
+#include "swrast/s_context.h"
+#include "swrast/s_triangle.h"
+#include "swrast_setup/swrast_setup.h"
+#include "vbo/vbo.h"
+
+
+static const char *Prog = "glslcompiler";
+
+
+struct options {
+ GLboolean LineNumbers;
+ gl_prog_print_mode Mode;
+ const char *VertFile;
+ const char *FragFile;
+ const char *OutputFile;
+};
+
+static struct options Options;
+
+
+/**
+ * GLSL compiler driver context. (kind of an artificial thing for now)
+ */
+struct compiler_context
+{
+ GLcontext MesaContext;
+ int foo;
+};
+
+typedef struct compiler_context CompilerContext;
+
+
+
+static void
+UpdateState(GLcontext *ctx, GLuint new_state)
+{
+ /* easy - just propogate */
+ _swrast_InvalidateState( ctx, new_state );
+ _swsetup_InvalidateState( ctx, new_state );
+ _tnl_InvalidateState( ctx, new_state );
+ _vbo_InvalidateState( ctx, new_state );
+}
+
+
+
+static GLboolean
+CreateContext(void)
+{
+ struct dd_function_table ddFuncs;
+ GLvisual *vis;
+ GLframebuffer *buf;
+ GLcontext *ctx;
+ CompilerContext *cc;
+
+ vis = _mesa_create_visual(GL_TRUE, GL_FALSE, GL_FALSE, /* RGB */
+ 8, 8, 8, 8, /* color */
+ 0, 0, 0, /* z, stencil */
+ 0, 0, 0, 0, 1); /* accum */
+ buf = _mesa_create_framebuffer(vis);
+
+ cc = _mesa_calloc(sizeof(*cc));
+ if (!vis || !buf || !cc) {
+ if (vis)
+ _mesa_destroy_visual(vis);
+ if (buf)
+ _mesa_destroy_framebuffer(buf);
+ return GL_FALSE;
+ }
+
+ _mesa_init_driver_functions(&ddFuncs);
+ ddFuncs.GetString = NULL;/*get_string;*/
+ ddFuncs.UpdateState = UpdateState;
+ ddFuncs.GetBufferSize = NULL;
+
+ ctx = &cc->MesaContext;
+ _mesa_initialize_context(ctx, vis, NULL, &ddFuncs, cc);
+ _mesa_enable_sw_extensions(ctx);
+
+ if (!_swrast_CreateContext( ctx ) ||
+ !_vbo_CreateContext( ctx ) ||
+ !_tnl_CreateContext( ctx ) ||
+ !_swsetup_CreateContext( ctx )) {
+ _mesa_destroy_visual(vis);
+ _mesa_free_context_data(ctx);
+ _mesa_free(cc);
+ return GL_FALSE;
+ }
+ TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;
+ _swsetup_Wakeup( ctx );
+
+ _mesa_make_current(ctx, buf, buf);
+
+ return GL_TRUE;
+}
+
+
+static void
+LoadAndCompileShader(GLuint shader, const char *text)
+{
+ GLint stat;
+ _mesa_ShaderSourceARB(shader, 1, (const GLchar **) &text, NULL);
+ _mesa_CompileShaderARB(shader);
+ _mesa_GetShaderiv(shader, GL_COMPILE_STATUS, &stat);
+ if (!stat) {
+ GLchar log[1000];
+ GLsizei len;
+ _mesa_GetShaderInfoLog(shader, 1000, &len, log);
+ fprintf(stderr, "%s: problem compiling shader: %s\n", Prog, log);
+ exit(1);
+ }
+ else {
+ printf("Shader compiled OK\n");
+ }
+}
+
+
+/**
+ * Read a shader from a file.
+ */
+static void
+ReadShader(GLuint shader, const char *filename)
+{
+ const int max = 100*1000;
+ int n;
+ char *buffer = (char*) malloc(max);
+ FILE *f = fopen(filename, "r");
+ if (!f) {
+ fprintf(stderr, "%s: Unable to open shader file %s\n", Prog, filename);
+ exit(1);
+ }
+
+ n = fread(buffer, 1, max, f);
+ /*
+ printf("%s: read %d bytes from shader file %s\n", Prog, n, filename);
+ */
+ if (n > 0) {
+ buffer[n] = 0;
+ LoadAndCompileShader(shader, buffer);
+ }
+
+ fclose(f);
+ free(buffer);
+}
+
+
+#if 0
+static void
+CheckLink(GLuint prog)
+{
+ GLint stat;
+ _mesa_GetProgramiv(prog, GL_LINK_STATUS, &stat);
+ if (!stat) {
+ GLchar log[1000];
+ GLsizei len;
+ _mesa_GetProgramInfoLog(prog, 1000, &len, log);
+ fprintf(stderr, "%s: Linker error:\n%s\n", Prog, log);
+ }
+ else {
+ fprintf(stderr, "%s: Link success!\n", Prog);
+ }
+}
+#endif
+
+
+static void
+PrintShaderInstructions(GLuint shader, FILE *f)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl_shader *sh = _mesa_lookup_shader(ctx, shader);
+ GLuint i;
+
+ for (i = 0; i < sh->NumPrograms; i++) {
+ struct gl_program *prog = sh->Programs[i];
+ _mesa_print_program_opt(prog, Options.Mode, Options.LineNumbers);
+ }
+}
+
+
+static GLuint
+CompileShader(const char *filename, GLenum type)
+{
+ GLuint shader;
+
+ assert(type == GL_FRAGMENT_SHADER ||
+ type == GL_VERTEX_SHADER);
+
+ shader = _mesa_CreateShader(type);
+ ReadShader(shader, filename);
+
+ return shader;
+}
+
+
+static void
+Usage(void)
+{
+ printf("Mesa GLSL stand-alone compiler\n");
+ printf("Usage:\n");
+ printf(" --vs FILE vertex shader input filename\n");
+ printf(" --fs FILE fragment shader input filename\n");
+ printf(" --arb emit ARB-style instructions (the default)\n");
+ printf(" --nv emit NV-style instructions\n");
+ printf(" --debug emit debug-style instructions\n");
+ printf(" --number, -n emit line numbers\n");
+ printf(" --output, -o FILE output filename\n");
+ printf(" --help display this information\n");
+}
+
+
+static void
+ParseOptions(int argc, char *argv[])
+{
+ int i;
+
+ Options.LineNumbers = GL_FALSE;
+ Options.Mode = PROG_PRINT_ARB;
+ Options.VertFile = NULL;
+ Options.FragFile = NULL;
+ Options.OutputFile = NULL;
+
+ if (argc == 1) {
+ Usage();
+ exit(0);
+ }
+
+ for (i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "--vs") == 0) {
+ Options.VertFile = argv[i + 1];
+ i++;
+ }
+ else if (strcmp(argv[i], "--fs") == 0) {
+ Options.FragFile = argv[i + 1];
+ i++;
+ }
+ else if (strcmp(argv[i], "--arb") == 0) {
+ Options.Mode = PROG_PRINT_ARB;
+ }
+ else if (strcmp(argv[i], "--nv") == 0) {
+ Options.Mode = PROG_PRINT_NV;
+ }
+ else if (strcmp(argv[i], "--debug") == 0) {
+ Options.Mode = PROG_PRINT_DEBUG;
+ }
+ else if (strcmp(argv[i], "--number") == 0 ||
+ strcmp(argv[i], "-n") == 0) {
+ Options.LineNumbers = GL_TRUE;
+ }
+ else if (strcmp(argv[i], "--output") == 0 ||
+ strcmp(argv[i], "-o") == 0) {
+ Options.OutputFile = argv[i + 1];
+ i++;
+ }
+ else if (strcmp(argv[i], "--help") == 0) {
+ Usage();
+ exit(0);
+ }
+ else {
+ printf("Unknown option: %s\n", argv[i]);
+ Usage();
+ exit(1);
+ }
+ }
+}
+
+
+int
+main(int argc, char *argv[])
+{
+ GLuint shader = 0;
+
+ if (!CreateContext()) {
+ fprintf(stderr, "%s: Failed to create compiler context\n", Prog);
+ exit(1);
+ }
+
+ ParseOptions(argc, argv);
+
+ if (Options.VertFile) {
+ shader = CompileShader(Options.VertFile, GL_VERTEX_SHADER);
+ }
+ else if (Options.FragFile) {
+ shader = CompileShader(Options.FragFile, GL_FRAGMENT_SHADER);
+ }
+
+ if (shader) {
+ if (Options.OutputFile) {
+ fclose(stdout);
+ /*stdout =*/ freopen(Options.OutputFile, "w", stdout);
+ }
+ if (stdout) {
+ PrintShaderInstructions(shader, stdout);
+ }
+ if (Options.OutputFile) {
+ fclose(stdout);
+ }
+ }
+
+ return 0;
+}
--- mesa-7.0.3.orig/src/mesa/glapi/glapi.c
+++ mesa-7.0.3/src/mesa/glapi/glapi.c
@@ -724,7 +724,7 @@
* \returns
* The offset in the dispatch table of the named function. A pointer to the
* driver's implementation of the named function should be stored at
- * \c dispatch_table[\c offset].
+ * \c dispatch_table[\c offset]. Return -1 if error/problem.
*
* \sa glXGetProcAddress
*
@@ -773,7 +773,7 @@
*/
if (!function_names[i] || function_names[i][0] != 'g' || function_names[i][1] != 'l')
- return GL_FALSE;
+ return -1;
/* Determine if the named function already exists. If the function does
* exist, it must have the same parameter signature as the function
--- mesa-7.0.3.orig/src/mesa/glapi/Makefile
+++ mesa-7.0.3/src/mesa/glapi/Makefile
@@ -0,0 +1,117 @@
+# This file isn't used during a normal compilation since we don't want to
+# require Python in order to compile Mesa.
+# Instead, when the Mesa developers update/change the API interface it's
+# up to him/her to re-run this makefile and check in the newly generated files.
+
+
+TOP = ../../..
+include $(TOP)/configs/current
+
+GLX_DIR = ../../glx/x11
+
+OUTPUTS = glprocs.h glapitemp.h glapioffsets.h glapitable.h dispatch.h \
+ ../main/enums.c \
+ ../x86/glapi_x86.S \
+ ../x86-64/glapi_x86-64.S \
+ ../sparc/glapi_sparc.S \
+ ../drivers/dri/common/extension_helper.h \
+ $(GLX_DIR)/indirect.c \
+ $(GLX_DIR)/indirect.h \
+ $(GLX_DIR)/indirect_init.c \
+ $(GLX_DIR)/indirect_size.h \
+ $(GLX_DIR)/indirect_size.c \
+ $(GLX_DIR)/indirect_dispatch.c \
+ $(GLX_DIR)/indirect_dispatch_swap.c \
+ $(GLX_DIR)/indirect_dispatch.h \
+ $(GLX_DIR)/indirect_reqsize.c \
+ $(GLX_DIR)/indirect_reqsize.h \
+ $(GLX_DIR)/indirect_size_get.c \
+ $(GLX_DIR)/indirect_size_get.h \
+ $(GLX_DIR)/indirect_table.c
+
+API_XML = gl_API.xml \
+ EXT_framebuffer_object.xml \
+ APPLE_vertex_array_object.xml
+
+COMMON = gl_XML.py glX_XML.py license.py $(API_XML) typeexpr.py
+COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py
+
+all: $(OUTPUTS)
+
+glprocs.h: gl_procs.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< > $@
+
+glapitemp.h: gl_apitemp.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< > $@
+
+glapioffsets.h: gl_offsets.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< > $@
+
+glapitable.h: gl_table.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< > $@
+
+dispatch.h: gl_table.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@
+
+../main/enums.c: gl_enums.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< > $@
+
+../x86/glapi_x86.S: gl_x86_asm.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< > $@
+
+../x86-64/glapi_x86-64.S: gl_x86-64_asm.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< > $@
+
+../sparc/glapi_sparc.S: gl_SPARC_asm.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< > $@
+
+
+../drivers/dri/common/extension_helper.h: extension_helper.py $(COMMON)
+ $(PYTHON2) $(PYTHON_FLAGS) $< > $@
+
+$(GLX_DIR)/indirect.c: glX_proto_send.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@
+
+$(GLX_DIR)/indirect.h: glX_proto_send.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m init_h > $@
+
+$(GLX_DIR)/indirect_init.c: glX_proto_send.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m init_c > $@
+
+$(GLX_DIR)/indirect_size.h: glX_proto_size.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-set -h _INDIRECT_SIZE_H_ \
+ | $(INDENT) $(INDENT_FLAGS) > $@
+
+$(GLX_DIR)/indirect_size.c: glX_proto_size.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c --only-set \
+ | $(INDENT) $(INDENT_FLAGS) > $@
+
+$(GLX_DIR)/indirect_dispatch.c: glX_proto_recv.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c > $@
+
+$(GLX_DIR)/indirect_dispatch_swap.c: glX_proto_recv.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_c -s > $@
+
+$(GLX_DIR)/indirect_dispatch.h: glX_proto_recv.py gl_and_glX_API.xml $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m dispatch_h -f gl_and_glX_API.xml -s > $@
+
+$(GLX_DIR)/indirect_size_get.h: glX_proto_size.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m size_h --only-get -h '_INDIRECT_SIZE_GET_H_' \
+ | $(INDENT) $(INDENT_FLAGS) > $@
+
+$(GLX_DIR)/indirect_size_get.c: glX_proto_size.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m size_c | $(INDENT) $(INDENT_FLAGS) > $@
+
+$(GLX_DIR)/indirect_reqsize.h: glX_proto_size.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_h --only-get -h '_INDIRECT_SIZE_GET_H_' \
+ | $(INDENT) $(INDENT_FLAGS) -l200 > $@
+
+$(GLX_DIR)/indirect_reqsize.c: glX_proto_size.py $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -m reqsize_c | $(INDENT) $(INDENT_FLAGS) > $@
+
+$(GLX_DIR)/indirect_table.c: glX_server_table.py gl_and_glX_API.xml $(COMMON_GLX)
+ $(PYTHON2) $(PYTHON_FLAGS) $< -f gl_and_glX_API.xml > $@
+
+clean:
+ rm -f *~ *.pyo
+ rm -f $(OUTPUTS)
--- mesa-7.0.3.orig/src/mesa/glapi/APPLE_vertex_array_object.xml
+++ mesa-7.0.3/src/mesa/glapi/APPLE_vertex_array_object.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- mesa-7.0.3.orig/src/mesa/glapi/EXT_framebuffer_object.xml
+++ mesa-7.0.3/src/mesa/glapi/EXT_framebuffer_object.xml
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- mesa-7.0.3.orig/src/mesa/glapi/extension_helper.py
+++ mesa-7.0.3/src/mesa/glapi/extension_helper.py
@@ -0,0 +1,321 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML
+import license
+import sys, getopt, string
+
+vtxfmt = [
+ "ArrayElement", \
+ "Color3f", \
+ "Color3fv", \
+ "Color4f", \
+ "Color4fv", \
+ "EdgeFlag", \
+ "EdgeFlagv", \
+ "EvalCoord1f", \
+ "EvalCoord1fv", \
+ "EvalCoord2f", \
+ "EvalCoord2fv", \
+ "EvalPoint1", \
+ "EvalPoint2", \
+ "FogCoordfEXT", \
+ "FogCoordfvEXT", \
+ "Indexf", \
+ "Indexfv", \
+ "Materialfv", \
+ "MultiTexCoord1fARB", \
+ "MultiTexCoord1fvARB", \
+ "MultiTexCoord2fARB", \
+ "MultiTexCoord2fvARB", \
+ "MultiTexCoord3fARB", \
+ "MultiTexCoord3fvARB", \
+ "MultiTexCoord4fARB", \
+ "MultiTexCoord4fvARB", \
+ "Normal3f", \
+ "Normal3fv", \
+ "SecondaryColor3fEXT", \
+ "SecondaryColor3fvEXT", \
+ "TexCoord1f", \
+ "TexCoord1fv", \
+ "TexCoord2f", \
+ "TexCoord2fv", \
+ "TexCoord3f", \
+ "TexCoord3fv", \
+ "TexCoord4f", \
+ "TexCoord4fv", \
+ "Vertex2f", \
+ "Vertex2fv", \
+ "Vertex3f", \
+ "Vertex3fv", \
+ "Vertex4f", \
+ "Vertex4fv", \
+ "CallList", \
+ "CallLists", \
+ "Begin", \
+ "End", \
+ "VertexAttrib1fNV", \
+ "VertexAttrib1fvNV", \
+ "VertexAttrib2fNV", \
+ "VertexAttrib2fvNV", \
+ "VertexAttrib3fNV", \
+ "VertexAttrib3fvNV", \
+ "VertexAttrib4fNV", \
+ "VertexAttrib4fvNV", \
+ "VertexAttrib1fARB", \
+ "VertexAttrib1fvARB", \
+ "VertexAttrib2fARB", \
+ "VertexAttrib2fvARB", \
+ "VertexAttrib3fARB", \
+ "VertexAttrib3fvARB", \
+ "VertexAttrib4fARB", \
+ "VertexAttrib4fvARB", \
+ "Rectf", \
+ "DrawArrays", \
+ "DrawElements", \
+ "DrawRangeElements", \
+ "EvalMesh1", \
+ "EvalMesh2", \
+]
+
+def all_entrypoints_in_abi(f, abi, api):
+ for n in f.entry_points:
+ [category, num] = api.get_category_for_name( n )
+ if category not in abi:
+ return 0
+
+ return 1
+
+
+def any_entrypoints_in_abi(f, abi, api):
+ for n in f.entry_points:
+ [category, num] = api.get_category_for_name( n )
+ if category in abi:
+ return 1
+
+ return 0
+
+
+def condition_for_function(f, abi, all_not_in_ABI):
+ """Create a C-preprocessor condition for the function.
+
+ There are two modes of operation. If all_not_in_ABI is set, a
+ condition is only created is all of the entry-point names for f are
+ not in the selected ABI. If all_not_in_ABI is not set, a condition
+ is created if any entryp-point name is not in the selected ABI.
+ """
+
+ condition = []
+ for n in f.entry_points:
+ [category, num] = api.get_category_for_name( n )
+ if category not in abi:
+ condition.append( 'defined(need_%s)' % (gl_XML.real_category_name( category )) )
+ elif all_not_in_ABI:
+ return []
+
+ return condition
+
+
+class PrintGlExtensionGlue(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "extension_helper.py (from Mesa)"
+ self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
+ return
+
+
+ def printRealHeader(self):
+ print '#include "utils.h"'
+ print '#include "dispatch.h"'
+ print ''
+ return
+
+
+ def printBody(self, api):
+ abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
+
+ category_list = {}
+
+ print '#ifndef NULL'
+ print '# define NULL 0'
+ print '#endif'
+ print ''
+
+ for f in api.functionIterateAll():
+ condition = condition_for_function(f, abi, 0)
+ if len(condition):
+ print '#if %s' % (string.join(condition, " || "))
+ print 'static const char %s_names[] = ' % (f.name)
+
+ parameter_signature = ''
+ for p in f.parameterIterator():
+ # FIXME: This is a *really* ugly hack. :(
+
+ tn = p.type_expr.get_base_type_node()
+ if p.is_pointer():
+ parameter_signature += 'p'
+ elif tn.integer:
+ parameter_signature += 'i'
+ elif tn.size == 4:
+ parameter_signature += 'f'
+ else:
+ parameter_signature += 'd'
+
+ print ' "%s\\0" /* Parameter signature */' % (parameter_signature)
+
+ for n in f.entry_points:
+ print ' "gl%s\\0"' % (n)
+
+ [category, num] = api.get_category_for_name( n )
+ if category not in abi:
+ c = gl_XML.real_category_name(category)
+ if not category_list.has_key(c):
+ category_list[ c ] = []
+
+ category_list[ c ].append( f )
+
+ print ' "";'
+ print '#endif'
+ print ''
+
+ keys = category_list.keys()
+ keys.sort()
+
+ for category in keys:
+ print '#if defined(need_%s)' % (category)
+ print 'static const struct dri_extension_function %s_functions[] = {' % (category)
+
+ for f in category_list[ category ]:
+ # A function either has an offset that is
+ # assigned by the ABI, or it has a remap
+ # index.
+ if any_entrypoints_in_abi(f, abi, api):
+ index_name = "-1"
+ offset = f.offset
+ else:
+ index_name = "%s_remap_index" % (f.name)
+ offset = -1
+
+ print ' { %s_names, %s, %d },' % (f.name, index_name, offset)
+
+
+ print ' { NULL, 0, 0 }'
+ print '};'
+ print '#endif'
+ print ''
+
+ return
+
+
+class PrintInitDispatch(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "extension_helper.py (from Mesa)"
+ self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
+ return
+
+
+ def do_function_body(self, api, abi, vtxfmt_only):
+ last_condition_string = None
+ for f in api.functionIterateByOffset():
+ if (f.name in vtxfmt) and not vtxfmt_only:
+ continue
+
+ if (f.name not in vtxfmt) and vtxfmt_only:
+ continue
+
+ condition = condition_for_function(f, abi, 1)
+ condition_string = string.join(condition, " || ")
+
+ if condition_string != last_condition_string:
+ if last_condition_string:
+ print '#endif /* %s */' % (last_condition_string)
+
+ if condition_string:
+ print '#if %s' % (condition_string)
+
+ if vtxfmt_only:
+ print ' disp->%s = vfmt->%s;' % (f.name, f.name)
+ else:
+ print ' disp->%s = _mesa_%s;' % (f.name, f.name)
+
+ last_condition_string = condition_string
+
+ if last_condition_string:
+ print '#endif /* %s */' % (last_condition_string)
+
+
+
+ def printBody(self, api):
+ abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
+
+ print 'void driver_init_exec_table(struct _glapi_table *disp)'
+ print '{'
+ self.do_function_body(api, abi, 0)
+ print '}'
+ print ''
+ print 'void driver_install_vtxfmt(struct _glapi_table *disp, const GLvertexformat *vfmt)'
+ print '{'
+ self.do_function_body(api, abi, 1)
+ print '}'
+
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
+ print " -m output_mode Output mode can be one of 'extensions' or 'exec_init'."
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
+ except Exception,e:
+ show_usage()
+
+ mode = "extensions"
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+ if arg == '-m':
+ mode = val
+
+
+ api = gl_XML.parse_GL_API( file_name )
+
+ if mode == "extensions":
+ printer = PrintGlExtensionGlue()
+ elif mode == "exec_init":
+ printer = PrintInitDispatch()
+ else:
+ show_usage()
+
+ printer.Print( api )
--- mesa-7.0.3.orig/src/mesa/glapi/glX_API.xml
+++ mesa-7.0.3/src/mesa/glapi/glX_API.xml
@@ -0,0 +1,222 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- mesa-7.0.3.orig/src/mesa/glapi/glX_XML.py
+++ mesa-7.0.3/src/mesa/glapi/glX_XML.py
@@ -0,0 +1,565 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML
+import license
+import sys, getopt, string
+
+
+class glx_item_factory(gl_XML.gl_item_factory):
+ """Factory to create GLX protocol oriented objects derived from gl_item."""
+
+ def create_item(self, name, element, context):
+ if name == "function":
+ return glx_function(element, context)
+ elif name == "enum":
+ return glx_enum(element, context)
+ elif name == "api":
+ return glx_api(self)
+ else:
+ return gl_XML.gl_item_factory.create_item(self, name, element, context)
+
+
+class glx_enum(gl_XML.gl_enum):
+ def __init__(self, element, context):
+ gl_XML.gl_enum.__init__(self, element, context)
+
+ self.functions = {}
+
+ child = element.children
+ while child:
+ if child.type == "element" and child.name == "size":
+ n = child.nsProp( "name", None )
+ c = child.nsProp( "count", None )
+ m = child.nsProp( "mode", None )
+
+ if not c:
+ c = self.default_count
+ else:
+ c = int(c)
+
+ if m == "get":
+ mode = 0
+ else:
+ mode = 1
+
+ if not self.functions.has_key(n):
+ self.functions[ n ] = [c, mode]
+
+ child = child.next
+
+ return
+
+
+class glx_function(gl_XML.gl_function):
+ def __init__(self, element, context):
+ self.glx_rop = 0
+ self.glx_sop = 0
+ self.glx_vendorpriv = 0
+
+ self.glx_vendorpriv_names = []
+
+ # If this is set to true, it means that GLdouble parameters should be
+ # written to the GLX protocol packet in the order they appear in the
+ # prototype. This is different from the "classic" ordering. In the
+ # classic ordering GLdoubles are written to the protocol packet first,
+ # followed by non-doubles. NV_vertex_program was the first extension
+ # to break with this tradition.
+
+ self.glx_doubles_in_order = 0
+
+ self.vectorequiv = None
+ self.output = None
+ self.can_be_large = 0
+ self.reply_always_array = 0
+ self.dimensions_in_reply = 0
+ self.img_reset = None
+
+ self.server_handcode = 0
+ self.client_handcode = 0
+ self.ignore = 0
+
+ self.count_parameter_list = []
+ self.counter_list = []
+ self.parameters_by_name = {}
+ self.offsets_calculated = 0
+
+ gl_XML.gl_function.__init__(self, element, context)
+ return
+
+
+ def process_element(self, element):
+ gl_XML.gl_function.process_element(self, element)
+
+ self.vectorequiv = element.nsProp( "vectorequiv", None )
+
+
+ name = element.nsProp("name", None)
+ if name == self.name:
+ for param in self.parameters:
+ self.parameters_by_name[ param.name ] = param
+
+ if len(param.count_parameter_list):
+ self.count_parameter_list.extend( param.count_parameter_list )
+
+ if param.counter and param.counter not in self.counter_list:
+ self.counter_list.append(param.counter)
+
+
+ child = element.children
+ while child:
+ if child.type == "element":
+ if child.name == "glx":
+ rop = child.nsProp( 'rop', None )
+ sop = child.nsProp( 'sop', None )
+ vop = child.nsProp( 'vendorpriv', None )
+
+ if rop:
+ self.glx_rop = int(rop)
+
+ if sop:
+ self.glx_sop = int(sop)
+
+ if vop:
+ self.glx_vendorpriv = int(vop)
+ self.glx_vendorpriv_names.append(name)
+
+ self.img_reset = child.nsProp( 'img_reset', None )
+
+ # The 'handcode' attribute can be one of 'true',
+ # 'false', 'client', or 'server'.
+
+ handcode = child.nsProp( 'handcode', None )
+ if handcode == "false":
+ self.server_handcode = 0
+ self.client_handcode = 0
+ elif handcode == "true":
+ self.server_handcode = 1
+ self.client_handcode = 1
+ elif handcode == "client":
+ self.server_handcode = 0
+ self.client_handcode = 1
+ elif handcode == "server":
+ self.server_handcode = 1
+ self.client_handcode = 0
+ else:
+ raise RuntimeError('Invalid handcode mode "%s" in function "%s".' % (handcode, self.name))
+
+ self.ignore = gl_XML.is_attr_true( child, 'ignore' )
+ self.can_be_large = gl_XML.is_attr_true( child, 'large' )
+ self.glx_doubles_in_order = gl_XML.is_attr_true( child, 'doubles_in_order' )
+ self.reply_always_array = gl_XML.is_attr_true( child, 'always_array' )
+ self.dimensions_in_reply = gl_XML.is_attr_true( child, 'dimensions_in_reply' )
+
+ child = child.next
+
+
+ # Do some validation of the GLX protocol information. As
+ # new tests are discovered, they should be added here.
+
+ for param in self.parameters:
+ if param.is_output and self.glx_rop != 0:
+ raise RuntimeError("Render / RenderLarge commands cannot have outputs (%s)." % (self.name))
+
+ return
+
+
+ def has_variable_size_request(self):
+ """Determine if the GLX request packet is variable sized.
+
+ The GLX request packet is variable sized in several common
+ situations.
+
+ 1. The function has a non-output parameter that is counted
+ by another parameter (e.g., the 'textures' parameter of
+ glDeleteTextures).
+
+ 2. The function has a non-output parameter whose count is
+ determined by another parameter that is an enum (e.g., the
+ 'params' parameter of glLightfv).
+
+ 3. The function has a non-output parameter that is an
+ image.
+
+ 4. The function must be hand-coded on the server.
+ """
+
+ if self.glx_rop == 0:
+ return 0
+
+ if self.server_handcode or self.images:
+ return 1
+
+ for param in self.parameters:
+ if not param.is_output:
+ if param.counter or len(param.count_parameter_list):
+ return 1
+
+ return 0
+
+
+ def variable_length_parameter(self):
+ for param in self.parameters:
+ if not param.is_output:
+ if param.counter or len(param.count_parameter_list):
+ return param
+
+ return None
+
+
+ def calculate_offsets(self):
+ if not self.offsets_calculated:
+ # Calculate the offset of the first function parameter
+ # in the GLX command packet. This byte offset is
+ # measured from the end of the Render / RenderLarge
+ # header. The offset for all non-pixel commends is
+ # zero. The offset for pixel commands depends on the
+ # number of dimensions of the pixel data.
+
+ if len(self.images) and not self.images[0].is_output:
+ [dim, junk, junk, junk, junk] = self.images[0].get_dimensions()
+
+ # The base size is the size of the pixel pack info
+ # header used by images with the specified number
+ # of dimensions.
+
+ if dim <= 2:
+ offset = 20
+ elif dim <= 4:
+ offset = 36
+ else:
+ raise RuntimeError('Invalid number of dimensions %u for parameter "%s" in function "%s".' % (dim, self.image.name, self.name))
+ else:
+ offset = 0
+
+ for param in self.parameterIterateGlxSend():
+ if param.img_null_flag:
+ offset += 4
+
+ if param.name != self.img_reset:
+ param.offset = offset
+ if not param.is_variable_length() and not param.is_client_only:
+ offset += param.size()
+
+ if self.pad_after( param ):
+ offset += 4
+
+
+ self.offsets_calculated = 1
+ return
+
+
+ def offset_of(self, param_name):
+ self.calculate_offsets()
+ return self.parameters_by_name[ param_name ].offset
+
+
+ def parameterIterateGlxSend(self, include_variable_parameters = 1):
+ """Create an iterator for parameters in GLX request order."""
+
+ # The parameter lists are usually quite short, so it's easier
+ # (i.e., less code) to just generate a new list with the
+ # required elements than it is to create a new iterator class.
+
+ temp = [ [], [], [] ]
+ for param in self.parameters:
+ if param.is_output: continue
+
+ if param.is_variable_length():
+ temp[2].append( param )
+ elif not self.glx_doubles_in_order and param.is_64_bit():
+ temp[0].append( param )
+ else:
+ temp[1].append( param )
+
+ parameters = temp[0]
+ parameters.extend( temp[1] )
+ if include_variable_parameters:
+ parameters.extend( temp[2] )
+ return parameters.__iter__()
+
+
+ def parameterIterateCounters(self):
+ temp = []
+ for name in self.counter_list:
+ temp.append( self.parameters_by_name[ name ] )
+
+ return temp.__iter__()
+
+
+ def parameterIterateOutputs(self):
+ temp = []
+ for p in self.parameters:
+ if p.is_output:
+ temp.append( p )
+
+ return temp
+
+
+ def command_fixed_length(self):
+ """Return the length, in bytes as an integer, of the
+ fixed-size portion of the command."""
+
+ if len(self.parameters) == 0:
+ return 0
+
+ self.calculate_offsets()
+
+ size = 0
+ for param in self.parameterIterateGlxSend(0):
+ if param.name != self.img_reset and not param.is_client_only:
+ if size == 0:
+ size = param.offset + param.size()
+ else:
+ size += param.size()
+
+ if self.pad_after( param ):
+ size += 4
+
+ for param in self.images:
+ if param.img_null_flag or param.is_output:
+ size += 4
+
+ return size
+
+
+ def command_variable_length(self):
+ """Return the length, as a string, of the variable-sized
+ portion of the command."""
+
+ size_string = ""
+ for p in self.parameterIterateGlxSend():
+ if (not p.is_output) and (p.is_variable_length() or p.is_image()):
+ # FIXME Replace the 1 in the size_string call
+ # FIXME w/0 to eliminate some un-needed parnes
+ # FIXME This would already be done, but it
+ # FIXME adds some extra diffs to the generated
+ # FIXME code.
+
+ size_string = size_string + " + __GLX_PAD(%s)" % (p.size_string(1))
+
+ return size_string
+
+
+ def command_length(self):
+ size = self.command_fixed_length()
+
+ if self.glx_rop != 0:
+ size += 4
+
+ size = ((size + 3) & ~3)
+ return "%u%s" % (size, self.command_variable_length())
+
+
+ def opcode_real_value(self):
+ """Get the true numeric value of the GLX opcode
+
+ Behaves similarly to opcode_value, except for
+ X_GLXVendorPrivate and X_GLXVendorPrivateWithReply commands.
+ In these cases the value for the GLX opcode field (i.e.,
+ 16 for X_GLXVendorPrivate or 17 for
+ X_GLXVendorPrivateWithReply) is returned. For other 'single'
+ commands, the opcode for the command (e.g., 101 for
+ X_GLsop_NewList) is returned."""
+
+ if self.glx_vendorpriv != 0:
+ if self.needs_reply():
+ return 17
+ else:
+ return 16
+ else:
+ return self.opcode_value()
+
+
+ def opcode_value(self):
+ """Get the unique protocol opcode for the glXFunction"""
+
+ if (self.glx_rop == 0) and self.vectorequiv:
+ equiv = self.context.functions_by_name[ self.vectorequiv ]
+ self.glx_rop = equiv.glx_rop
+
+
+ if self.glx_rop != 0:
+ return self.glx_rop
+ elif self.glx_sop != 0:
+ return self.glx_sop
+ elif self.glx_vendorpriv != 0:
+ return self.glx_vendorpriv
+ else:
+ return -1
+
+
+ def opcode_rop_basename(self):
+ """Return either the name to be used for GLX protocol enum.
+
+ Returns either the name of the function or the name of the
+ name of the equivalent vector (e.g., glVertex3fv for
+ glVertex3f) function."""
+
+ if self.vectorequiv == None:
+ return self.name
+ else:
+ return self.vectorequiv
+
+
+ def opcode_name(self):
+ """Get the unique protocol enum name for the glXFunction"""
+
+ if (self.glx_rop == 0) and self.vectorequiv:
+ equiv = self.context.functions_by_name[ self.vectorequiv ]
+ self.glx_rop = equiv.glx_rop
+ self.glx_doubles_in_order = equiv.glx_doubles_in_order
+
+
+ if self.glx_rop != 0:
+ return "X_GLrop_%s" % (self.opcode_rop_basename())
+ elif self.glx_sop != 0:
+ return "X_GLsop_%s" % (self.name)
+ elif self.glx_vendorpriv != 0:
+ return "X_GLvop_%s" % (self.name)
+ else:
+ raise RuntimeError('Function "%s" has no opcode.' % (self.name))
+
+
+ def opcode_vendor_name(self, name):
+ if name in self.glx_vendorpriv_names:
+ return "X_GLvop_%s" % (name)
+ else:
+ raise RuntimeError('Function "%s" has no VendorPrivate opcode.' % (name))
+
+
+ def opcode_real_name(self):
+ """Get the true protocol enum name for the GLX opcode
+
+ Behaves similarly to opcode_name, except for
+ X_GLXVendorPrivate and X_GLXVendorPrivateWithReply commands.
+ In these cases the string 'X_GLXVendorPrivate' or
+ 'X_GLXVendorPrivateWithReply' is returned. For other
+ single or render commands 'X_GLsop' or 'X_GLrop' plus the
+ name of the function returned."""
+
+ if self.glx_vendorpriv != 0:
+ if self.needs_reply():
+ return "X_GLXVendorPrivateWithReply"
+ else:
+ return "X_GLXVendorPrivate"
+ else:
+ return self.opcode_name()
+
+
+ def needs_reply(self):
+ try:
+ x = self._needs_reply
+ except Exception, e:
+ x = 0
+ if self.return_type != 'void':
+ x = 1
+
+ for param in self.parameters:
+ if param.is_output:
+ x = 1
+ break
+
+ self._needs_reply = x
+
+ return x
+
+
+ def pad_after(self, p):
+ """Returns the name of the field inserted after the
+ specified field to pad out the command header."""
+
+ for image in self.images:
+ if image.img_pad_dimensions:
+ if not image.height:
+ if p.name == image.width:
+ return "height"
+ elif p.name == image.img_xoff:
+ return "yoffset"
+ elif not image.extent:
+ if p.name == image.depth:
+ # Should this be "size4d"?
+ return "extent"
+ elif p.name == image.img_zoff:
+ return "woffset"
+
+ return None
+
+
+ def has_different_protocol(self, name):
+ """Returns true if the named version of the function uses different protocol from the other versions.
+
+ Some functions, such as glDeleteTextures and
+ glDeleteTexturesEXT are functionally identical, but have
+ different protocol. This function returns true if the
+ named function is an alias name and that named version uses
+ different protocol from the function that is aliased.
+ """
+
+ return (name in self.glx_vendorpriv_names) and self.glx_sop
+
+
+ def static_glx_name(self, name):
+ if self.has_different_protocol(name):
+ for n in self.glx_vendorpriv_names:
+ if n in self.static_entry_points:
+ return n
+
+ return self.static_name(name)
+
+
+ def client_supported_for_indirect(self):
+ """Returns true if the function is supported on the client
+ side for indirect rendering."""
+
+ return not self.ignore and (self.offset != -1) and (self.glx_rop or self.glx_sop or self.glx_vendorpriv or self.vectorequiv or self.client_handcode)
+
+
+class glx_function_iterator:
+ """Class to iterate over a list of glXFunctions"""
+
+ def __init__(self, context):
+ self.iterator = context.functionIterateByOffset()
+ return
+
+
+ def __iter__(self):
+ return self
+
+
+ def next(self):
+ f = self.iterator.next()
+ if f.client_supported_for_indirect():
+ return f
+ else:
+ return self.next()
+
+
+class glx_api(gl_XML.gl_api):
+ def functionIterateGlx(self):
+ return glx_function_iterator(self)
+
--- mesa-7.0.3.orig/src/mesa/glapi/glX_doc.py
+++ mesa-7.0.3/src/mesa/glapi/glX_doc.py
@@ -0,0 +1,280 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML, glX_XML, glX_proto_common, license
+import sys, getopt
+
+
+class glx_doc_item_factory(glX_proto_common.glx_proto_item_factory):
+ """Factory to create GLX protocol documentation oriented objects derived from glItem."""
+
+ def create_item(self, name, element, context):
+ if name == "parameter":
+ return glx_doc_parameter(element, context)
+ else:
+ return glX_proto_common.glx_proto_item_factory.create_item(self, name, element, context)
+
+
+class glx_doc_parameter(gl_XML.gl_parameter):
+ def packet_type(self, type_dict):
+ """Get the type string for the packet header
+
+ GLX protocol documentation uses type names like CARD32,
+ FLOAT64, LISTofCARD8, and ENUM. This function converts the
+ type of the parameter to one of these names."""
+
+ list_of = ""
+ if self.is_array():
+ list_of = "LISTof"
+
+ t_name = self.get_base_type_string()
+ if not type_dict.has_key( t_name ):
+ type_name = "CARD8"
+ else:
+ type_name = type_dict[ t_name ]
+
+ return "%s%s" % (list_of, type_name)
+
+
+ def packet_size(self):
+ p = None
+ s = self.size()
+ if s == 0:
+ a_prod = "n"
+ b_prod = self.p_type.size
+
+ if not self.count_parameter_list and self.counter:
+ a_prod = self.counter
+ elif self.count_parameter_list and not self.counter or self.is_output:
+ pass
+ elif self.count_parameter_list and self.counter:
+ b_prod = self.counter
+ else:
+ raise RuntimeError("Parameter '%s' to function '%s' has size 0." % (self.name, self.context.name))
+
+ ss = "%s*%s" % (a_prod, b_prod)
+
+ return [ss, p]
+ else:
+ if s % 4 != 0:
+ p = "p"
+
+ return [str(s), p]
+
+class PrintGlxProtoText(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+ self.license = ""
+
+
+ def printHeader(self):
+ return
+
+
+ def body_size(self, f):
+ # At some point, refactor this function and
+ # glXFunction::command_payload_length.
+
+ size = 0;
+ size_str = ""
+ pad_str = ""
+ plus = ""
+ for p in f.parameterIterateGlxSend():
+ [s, pad] = p.packet_size()
+ try:
+ size += int(s)
+ except Exception,e:
+ size_str += "%s%s" % (plus, s)
+ plus = "+"
+
+ if pad != None:
+ pad_str = pad
+
+ return [size, size_str, pad_str]
+
+
+ def print_render_header(self, f):
+ [size, size_str, pad_str] = self.body_size(f)
+ size += 4;
+
+ if size_str == "":
+ s = "%u" % ((size + 3) & ~3)
+ elif pad_str != "":
+ s = "%u+%s+%s" % (size, size_str, pad_str)
+ else:
+ s = "%u+%s" % (size, size_str)
+
+ print ' 2 %-15s rendering command length' % (s)
+ print ' 2 %-4u rendering command opcode' % (f.glx_rop)
+ return
+
+
+ def print_single_header(self, f):
+ [size, size_str, pad_str] = self.body_size(f)
+ size = ((size + 3) / 4) + 2;
+
+ if f.glx_vendorpriv != 0:
+ size += 1
+
+ print ' 1 CARD8 opcode (X assigned)'
+ print ' 1 %-4u GLX opcode (%s)' % (f.opcode_real_value(), f.opcode_real_name())
+
+ if size_str == "":
+ s = "%u" % (size)
+ elif pad_str != "":
+ s = "%u+((%s+%s)/4)" % (size, size_str, pad_str)
+ else:
+ s = "%u+((%s)/4)" % (size, size_str)
+
+ print ' 2 %-15s request length' % (s)
+
+ if f.glx_vendorpriv != 0:
+ print ' 4 %-4u vendor specific opcode' % (f.opcode_value())
+
+ print ' 4 GLX_CONTEXT_TAG context tag'
+
+ return
+
+
+ def print_reply(self, f):
+ print ' =>'
+ print ' 1 1 reply'
+ print ' 1 unused'
+ print ' 2 CARD16 sequence number'
+
+ if f.output == None:
+ print ' 4 0 reply length'
+ elif f.reply_always_array:
+ print ' 4 m reply length'
+ else:
+ print ' 4 m reply length, m = (n == 1 ? 0 : n)'
+
+
+ output = None
+ for x in f.parameterIterateOutputs():
+ output = x
+ break
+
+
+ unused = 24
+ if f.return_type != 'void':
+ print ' 4 %-15s return value' % (f.return_type)
+ unused -= 4
+ elif output != None:
+ print ' 4 unused'
+ unused -= 4
+
+ if output != None:
+ print ' 4 CARD32 n'
+ unused -= 4
+
+ if output != None:
+ if not f.reply_always_array:
+ print ''
+ print ' if (n = 1) this follows:'
+ print ''
+ print ' 4 CARD32 %s' % (output.name)
+ print ' %-2u unused' % (unused - 4)
+ print ''
+ print ' otherwise this follows:'
+ print ''
+
+ print ' %-2u unused' % (unused)
+
+ [s, pad] = output.packet_size()
+ print ' %-8s %-15s %s' % (s, output.packet_type( self.type_map ), output.name)
+ if pad != None:
+ try:
+ bytes = int(s)
+ bytes = 4 - (bytes & 3)
+ print ' %-8u %-15s unused' % (bytes, "")
+ except Exception,e:
+ print ' %-8s %-15s unused, %s=pad(%s)' % (pad, "", pad, s)
+ else:
+ print ' %-2u unused' % (unused)
+
+
+ def print_body(self, f):
+ for p in f.parameterIterateGlxSend():
+ [s, pad] = p.packet_size()
+ print ' %-8s %-15s %s' % (s, p.packet_type( self.type_map ), p.name)
+ if pad != None:
+ try:
+ bytes = int(s)
+ bytes = 4 - (bytes & 3)
+ print ' %-8u %-15s unused' % (bytes, "")
+ except Exception,e:
+ print ' %-8s %-15s unused, %s=pad(%s)' % (pad, "", pad, s)
+
+ def printBody(self, api):
+ self.type_map = {}
+ for t in api.typeIterate():
+ self.type_map[ "GL" + t.name ] = t.glx_name
+
+
+ # At some point this should be expanded to support pixel
+ # functions, but I'm not going to lose any sleep over it now.
+
+ for f in api.functionIterateByOffset():
+ if f.client_handcode or f.server_handcode or f.vectorequiv or len(f.get_images()):
+ continue
+
+
+ if f.glx_rop:
+ print ' %s' % (f.name)
+ self.print_render_header(f)
+ elif f.glx_sop or f.glx_vendorpriv:
+ print ' %s' % (f.name)
+ self.print_single_header(f)
+ else:
+ continue
+
+ self.print_body(f)
+
+ if f.needs_reply():
+ self.print_reply(f)
+
+ print ''
+ return
+
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+
+ api = gl_XML.parse_GL_API( file_name, glx_doc_item_factory() )
+
+ printer = PrintGlxProtoText()
+ printer.Print( api )
--- mesa-7.0.3.orig/src/mesa/glapi/glX_proto_common.py
+++ mesa-7.0.3/src/mesa/glapi/glX_proto_common.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML, glX_XML
+import string
+
+
+class glx_proto_item_factory(glX_XML.glx_item_factory):
+ """Factory to create GLX protocol oriented objects derived from gl_item."""
+
+ def create_item(self, name, element, context):
+ if name == "type":
+ return glx_proto_type(element, context)
+ else:
+ return glX_XML.glx_item_factory.create_item(self, name, element, context)
+
+
+class glx_proto_type(gl_XML.gl_type):
+ def __init__(self, element, context):
+ gl_XML.gl_type.__init__(self, element, context)
+
+ self.glx_name = element.nsProp( "glx_name", None )
+ return
+
+
+class glx_print_proto(gl_XML.gl_print_base):
+ def size_call(self, func, outputs_also = 0):
+ """Create C code to calculate 'compsize'.
+
+ Creates code to calculate 'compsize'. If the function does
+ not need 'compsize' to be calculated, None will be
+ returned."""
+
+ compsize = None
+
+ for param in func.parameterIterator():
+ if outputs_also or not param.is_output:
+ if param.is_image():
+ [dim, w, h, d, junk] = param.get_dimensions()
+
+ compsize = '__glImageSize(%s, %s, %s, %s, %s, %s)' % (w, h, d, param.img_format, param.img_type, param.img_target)
+ if not param.img_send_null:
+ compsize = '(%s != NULL) ? %s : 0' % (param.name, compsize)
+
+ return compsize
+
+ elif len(param.count_parameter_list):
+ parameters = string.join( param.count_parameter_list, "," )
+ compsize = "__gl%s_size(%s)" % (func.name, parameters)
+
+ return compsize
+
+ return None
+
+
+ def emit_packet_size_calculation(self, f, bias):
+ # compsize is only used in the command size calculation if
+ # the function has a non-output parameter that has a non-empty
+ # counter_parameter_list.
+
+ compsize = self.size_call(f)
+ if compsize:
+ print ' const GLuint compsize = %s;' % (compsize)
+
+ if bias:
+ print ' const GLuint cmdlen = %s - %u;' % (f.command_length(), bias)
+ else:
+ print ' const GLuint cmdlen = %s;' % (f.command_length())
+
+ #print ''
+ return compsize
--- mesa-7.0.3.orig/src/mesa/glapi/glX_proto_recv.py
+++ mesa-7.0.3/src/mesa/glapi/glX_proto_recv.py
@@ -0,0 +1,552 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML, glX_XML, glX_proto_common, license
+import sys, getopt, string
+
+
+class PrintGlxDispatch_h(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "glX_proto_recv.py (from Mesa)"
+ self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM")
+
+ self.header_tag = "_INDIRECT_DISPATCH_H_"
+ return
+
+
+ def printRealHeader(self):
+ self.printVisibility( "HIDDEN", "hidden" )
+ print 'struct __GLXclientStateRec;'
+ print ''
+ return
+
+
+ def printBody(self, api):
+ for func in api.functionIterateAll():
+ if not func.ignore and not func.vectorequiv:
+ if func.glx_rop:
+ print 'extern HIDDEN void __glXDisp_%s(GLbyte * pc);' % (func.name)
+ print 'extern HIDDEN void __glXDispSwap_%s(GLbyte * pc);' % (func.name)
+ elif func.glx_sop or func.glx_vendorpriv:
+ print 'extern HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name)
+ print 'extern HIDDEN int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (func.name)
+
+ if func.glx_sop and func.glx_vendorpriv:
+ n = func.glx_vendorpriv_names[0]
+ print 'extern HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (n)
+ print 'extern HIDDEN int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (n)
+
+ return
+
+
+class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
+ def __init__(self, do_swap):
+ gl_XML.gl_print_base.__init__(self)
+ self.name = "glX_proto_recv.py (from Mesa)"
+ self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM")
+
+ self.real_types = [ '', '', 'uint16_t', '', 'uint32_t', '', '', '', 'uint64_t' ]
+ self.do_swap = do_swap
+ return
+
+
+ def printRealHeader(self):
+ print '#include '
+ print '#include '
+ print '#include '
+
+ print '#include '
+ print '#include "indirect_size.h"'
+ print '#include "indirect_size_get.h"'
+ print '#include "indirect_dispatch.h"'
+ print '#include "glxserver.h"'
+ print '#include "glxbyteorder.h"'
+ print '#include "indirect_util.h"'
+ print '#include "singlesize.h"'
+ print '#include "glapitable.h"'
+ print '#include "glapi.h"'
+ print '#include "glthread.h"'
+ print '#include "dispatch.h"'
+ print ''
+ print '#define __GLX_PAD(x) (((x) + 3) & ~3)'
+ print ''
+ print 'typedef struct {'
+ print ' __GLX_PIXEL_3D_HDR;'
+ print '} __GLXpixel3DHeader;'
+ print ''
+ print 'extern GLboolean __glXErrorOccured( void );'
+ print 'extern void __glXClearErrorOccured( void );'
+ print ''
+ print 'static const unsigned dummy_answer[2] = {0, 0};'
+ print ''
+ return
+
+
+ def printBody(self, api):
+ if self.do_swap:
+ self.emit_swap_wrappers(api)
+
+
+ for func in api.functionIterateByOffset():
+ if not func.ignore and not func.server_handcode and not func.vectorequiv and (func.glx_rop or func.glx_sop or func.glx_vendorpriv):
+ self.printFunction(func, func.name)
+ if func.glx_sop and func.glx_vendorpriv:
+ self.printFunction(func, func.glx_vendorpriv_names[0])
+
+
+ return
+
+
+ def printFunction(self, f, name):
+ if (f.glx_sop or f.glx_vendorpriv) and (len(f.get_images()) != 0):
+ return
+
+ if not self.do_swap:
+ base = '__glXDisp'
+ else:
+ base = '__glXDispSwap'
+
+ if f.glx_rop:
+ print 'void %s_%s(GLbyte * pc)' % (base, name)
+ else:
+ print 'int %s_%s(__GLXclientState *cl, GLbyte *pc)' % (base, name)
+
+ print '{'
+
+ if f.glx_rop or f.vectorequiv:
+ self.printRenderFunction(f)
+ elif f.glx_sop or f.glx_vendorpriv:
+ if len(f.get_images()) == 0:
+ self.printSingleFunction(f, name)
+ else:
+ print "/* Missing GLX protocol for %s. */" % (name)
+
+ print '}'
+ print ''
+ return
+
+
+ def swap_name(self, bytes):
+ return 'bswap_%u_array' % (8 * bytes)
+
+
+ def emit_swap_wrappers(self, api):
+ self.type_map = {}
+ already_done = [ ]
+
+ for t in api.typeIterate():
+ te = t.get_type_expression()
+ t_size = te.get_element_size()
+
+ if t_size > 1 and t.glx_name:
+
+ t_name = "GL" + t.name
+ self.type_map[ t_name ] = t.glx_name
+
+ if t.glx_name not in already_done:
+ real_name = self.real_types[t_size]
+
+ print 'static %s' % (t_name)
+ print 'bswap_%s( const void * src )' % (t.glx_name)
+ print '{'
+ print ' union { %s dst; %s ret; } x;' % (real_name, t_name)
+ print ' x.dst = bswap_%u( *(%s *) src );' % (t_size * 8, real_name)
+ print ' return x.ret;'
+ print '}'
+ print ''
+ already_done.append( t.glx_name )
+
+ for bits in [16, 32, 64]:
+ print 'static void *'
+ print 'bswap_%u_array( uint%u_t * src, unsigned count )' % (bits, bits)
+ print '{'
+ print ' unsigned i;'
+ print ''
+ print ' for ( i = 0 ; i < count ; i++ ) {'
+ print ' uint%u_t temp = bswap_%u( src[i] );' % (bits, bits)
+ print ' src[i] = temp;'
+ print ' }'
+ print ''
+ print ' return src;'
+ print '}'
+ print ''
+
+
+ def fetch_param(self, param):
+ t = param.type_string()
+ o = param.offset
+ element_size = param.size() / param.get_element_count()
+
+ if self.do_swap and (element_size != 1):
+ if param.is_array():
+ real_name = self.real_types[ element_size ]
+
+ swap_func = self.swap_name( element_size )
+ return ' (%-8s)%s( (%s *) (pc + %2s), %s )' % (t, swap_func, real_name, o, param.count)
+ else:
+ t_name = param.get_base_type_string()
+ return ' (%-8s)bswap_%-7s( pc + %2s )' % (t, self.type_map[ t_name ], o)
+ else:
+ if param.is_array():
+ return ' (%-8s)(pc + %2u)' % (t, o)
+ else:
+ return '*(%-8s *)(pc + %2u)' % (t, o)
+
+ return None
+
+
+ def emit_function_call(self, f, retval_assign, indent):
+ list = []
+
+ for param in f.parameterIterator():
+
+ if param.is_counter or param.is_image() or param.is_output or param.name in f.count_parameter_list or len(param.count_parameter_list):
+ location = param.name
+ else:
+ location = self.fetch_param(param)
+
+ list.append( '%s %s' % (indent, location) )
+
+
+ if len( list ):
+ print '%s %sCALL_%s( GET_DISPATCH(), (' % (indent, retval_assign, f.name)
+ print string.join( list, ",\n" )
+ print '%s ) );' % (indent)
+ else:
+ print '%s %sCALL_%s( GET_DISPATCH(), () );' % (indent, retval_assign, f.name)
+ return
+
+
+ def common_func_print_just_start(self, f, indent):
+ align64 = 0
+ need_blank = 0
+
+
+ f.calculate_offsets()
+ for param in f.parameterIterateGlxSend():
+ # If any parameter has a 64-bit base type, then we
+ # have to do alignment magic for the while thing.
+
+ if param.is_64_bit():
+ align64 = 1
+
+
+ # FIXME img_null_flag is over-loaded. In addition to
+ # FIXME being used for images, it is used to signify
+ # FIXME NULL data pointers for vertex buffer object
+ # FIXME related functions. Re-name it to null_data
+ # FIXME or something similar.
+
+ if param.img_null_flag:
+ print '%s const CARD32 ptr_is_null = *(CARD32 *)(pc + %s);' % (indent, param.offset - 4)
+ cond = '(ptr_is_null != 0) ? NULL : '
+ else:
+ cond = ""
+
+
+ type_string = param.type_string()
+
+ if param.is_image():
+ offset = f.offset_of( param.name )
+
+ print '%s %s const %s = (%s) %s(pc + %s);' % (indent, type_string, param.name, type_string, cond, offset)
+
+ if param.depth:
+ print '%s __GLXpixel3DHeader * const hdr = (__GLXpixel3DHeader *)(pc);' % (indent)
+ else:
+ print '%s __GLXpixelHeader * const hdr = (__GLXpixelHeader *)(pc);' % (indent)
+
+ need_blank = 1
+ elif param.is_counter or param.name in f.count_parameter_list:
+ location = self.fetch_param(param)
+ print '%s const %s %s = %s;' % (indent, type_string, param.name, location)
+ need_blank = 1
+ elif len(param.count_parameter_list):
+ if param.size() == 1 and not self.do_swap:
+ location = self.fetch_param(param)
+ print '%s %s %s = %s%s;' % (indent, type_string, param.name, cond, location)
+ else:
+ print '%s %s %s;' % (indent, type_string, param.name)
+ need_blank = 1
+
+
+
+ if need_blank:
+ print ''
+
+ if align64:
+ print '#ifdef __GLX_ALIGN64'
+
+ if f.has_variable_size_request():
+ self.emit_packet_size_calculation(f, 4)
+ s = "cmdlen"
+ else:
+ s = str((f.command_fixed_length() + 3) & ~3)
+
+ print ' if ((unsigned long)(pc) & 7) {'
+ print ' (void) memmove(pc-4, pc, %s);' % (s)
+ print ' pc -= 4;'
+ print ' }'
+ print '#endif'
+ print ''
+
+
+ need_blank = 0
+ if self.do_swap:
+ for param in f.parameterIterateGlxSend():
+ if param.count_parameter_list:
+ o = param.offset
+ count = param.get_element_count()
+ type_size = param.size() / count
+
+ if param.counter:
+ count_name = param.counter
+ else:
+ count_name = str(count)
+
+ # This is basically an ugly special-
+ # case for glCallLists.
+
+ if type_size == 1:
+ x = []
+ x.append( [1, ['BYTE', 'UNSIGNED_BYTE', '2_BYTES', '3_BYTES', '4_BYTES']] )
+ x.append( [2, ['SHORT', 'UNSIGNED_SHORT']] )
+ x.append( [4, ['INT', 'UNSIGNED_INT', 'FLOAT']] )
+
+ print ' switch(%s) {' % (param.count_parameter_list[0])
+ for sub in x:
+ for t_name in sub[1]:
+ print ' case GL_%s:' % (t_name)
+
+ if sub[0] == 1:
+ print ' %s = (%s) (pc + %s); break;' % (param.name, param.type_string(), o)
+ else:
+ swap_func = self.swap_name(sub[0])
+ print ' %s = (%s) %s( (%s *) (pc + %s), %s ); break;' % (param.name, param.type_string(), swap_func, self.real_types[sub[0]], o, count_name)
+ print ' default:'
+ print ' return;'
+ print ' }'
+ else:
+ swap_func = self.swap_name(type_size)
+ compsize = self.size_call(f, 1)
+ print ' %s = (%s) %s( (%s *) (pc + %s), %s );' % (param.name, param.type_string(), swap_func, self.real_types[type_size], o, compsize)
+
+ need_blank = 1
+
+ else:
+ for param in f.parameterIterateGlxSend():
+ if param.count_parameter_list:
+ print '%s %s = (%s) (pc + %s);' % (indent, param.name, param.type_string(), param.offset)
+ need_blank = 1
+
+
+ if need_blank:
+ print ''
+
+
+ return
+
+
+ def printSingleFunction(self, f, name):
+ if name not in f.glx_vendorpriv_names:
+ print ' xGLXSingleReq * const req = (xGLXSingleReq *) pc;'
+ else:
+ print ' xGLXVendorPrivateReq * const req = (xGLXVendorPrivateReq *) pc;'
+
+ print ' int error;'
+
+ if self.do_swap:
+ print ' __GLXcontext * const cx = __glXForceCurrent(cl, bswap_CARD32( &req->contextTag ), &error);'
+ else:
+ print ' __GLXcontext * const cx = __glXForceCurrent(cl, req->contextTag, &error);'
+
+ print ''
+ if name not in f.glx_vendorpriv_names:
+ print ' pc += __GLX_SINGLE_HDR_SIZE;'
+ else:
+ print ' pc += __GLX_VENDPRIV_HDR_SIZE;'
+
+ print ' if ( cx != NULL ) {'
+ self.common_func_print_just_start(f, " ")
+
+
+ if f.return_type != 'void':
+ print ' %s retval;' % (f.return_type)
+ retval_string = "retval"
+ retval_assign = "retval = "
+ else:
+ retval_string = "0"
+ retval_assign = ""
+
+
+ type_size = 0
+ answer_string = "dummy_answer"
+ answer_count = "0"
+ is_array_string = "GL_FALSE"
+
+ for param in f.parameterIterateOutputs():
+ answer_type = param.get_base_type_string()
+ if answer_type == "GLvoid":
+ answer_type = "GLubyte"
+
+
+ c = param.get_element_count()
+ type_size = (param.size() / c)
+ if type_size == 1:
+ size_scale = ""
+ else:
+ size_scale = " * %u" % (type_size)
+
+
+ if param.count_parameter_list:
+ print ' const GLuint compsize = %s;' % (self.size_call(f, 1))
+ print ' %s answerBuffer[200];' % (answer_type)
+ print ' %s %s = __glXGetAnswerBuffer(cl, compsize%s, answerBuffer, sizeof(answerBuffer), %u);' % (param.type_string(), param.name, size_scale, type_size )
+ answer_string = param.name
+ answer_count = "compsize"
+
+ print ''
+ print ' if (%s == NULL) return BadAlloc;' % (param.name)
+ print ' __glXClearErrorOccured();'
+ print ''
+ elif param.counter:
+ print ' %s answerBuffer[200];' % (answer_type)
+ print ' %s %s = __glXGetAnswerBuffer(cl, %s%s, answerBuffer, sizeof(answerBuffer), %u);' % (param.type_string(), param.name, param.counter, size_scale, type_size)
+ answer_string = param.name
+ answer_count = param.counter
+ elif c >= 1:
+ print ' %s %s[%u];' % (answer_type, param.name, c)
+ answer_string = param.name
+ answer_count = "%u" % (c)
+
+ if f.reply_always_array:
+ is_array_string = "GL_TRUE"
+
+
+ self.emit_function_call(f, retval_assign, " ")
+
+
+ if f.needs_reply():
+ if self.do_swap:
+ for param in f.parameterIterateOutputs():
+ c = param.get_element_count()
+ type_size = (param.size() / c)
+
+ if type_size > 1:
+ swap_name = self.swap_name( type_size )
+ print ' (void) %s( (uint%u_t *) %s, %s );' % (swap_name, 8 * type_size, param.name, answer_count)
+
+
+ reply_func = '__glXSendReplySwap'
+ else:
+ reply_func = '__glXSendReply'
+
+ print ' %s(cl->client, %s, %s, %u, %s, %s);' % (reply_func, answer_string, answer_count, type_size, is_array_string, retval_string)
+ #elif f.note_unflushed:
+ # print ' cx->hasUnflushedCommands = GL_TRUE;'
+
+ print ' error = Success;'
+ print ' }'
+ print ''
+ print ' return error;'
+ return
+
+
+ def printRenderFunction(self, f):
+ # There are 4 distinct phases in a rendering dispatch function.
+ # In the first phase we compute the sizes and offsets of each
+ # element in the command. In the second phase we (optionally)
+ # re-align 64-bit data elements. In the third phase we
+ # (optionally) byte-swap array data. Finally, in the fourth
+ # phase we actually dispatch the function.
+
+ self.common_func_print_just_start(f, "")
+
+ images = f.get_images()
+ if len(images):
+ if self.do_swap:
+ pre = "bswap_CARD32( & "
+ post = " )"
+ else:
+ pre = ""
+ post = ""
+
+ img = images[0]
+
+ # swapBytes and lsbFirst are single byte fields, so
+ # the must NEVER be byte-swapped.
+
+ if not (img.img_type == "GL_BITMAP" and img.img_format == "GL_COLOR_INDEX"):
+ print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SWAP_BYTES, hdr->swapBytes) );'
+
+ print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_LSB_FIRST, hdr->lsbFirst) );'
+
+ print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ROW_LENGTH, (GLint) %shdr->rowLength%s) );' % (pre, post)
+ if img.depth:
+ print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_IMAGE_HEIGHT, (GLint) %shdr->imageHeight%s) );' % (pre, post)
+ print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_ROWS, (GLint) %shdr->skipRows%s) );' % (pre, post)
+ if img.depth:
+ print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_IMAGES, (GLint) %shdr->skipImages%s) );' % (pre, post)
+ print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_SKIP_PIXELS, (GLint) %shdr->skipPixels%s) );' % (pre, post)
+ print ' CALL_PixelStorei( GET_DISPATCH(), (GL_UNPACK_ALIGNMENT, (GLint) %shdr->alignment%s) );' % (pre, post)
+ print ''
+
+
+ self.emit_function_call(f, "", "")
+ return
+
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:s")
+ except Exception,e:
+ show_usage()
+
+ mode = "dispatch_c"
+ do_swap = 0
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+ elif arg == "-m":
+ mode = val
+ elif arg == "-s":
+ do_swap = 1
+
+ if mode == "dispatch_c":
+ printer = PrintGlxDispatchFunctions(do_swap)
+ elif mode == "dispatch_h":
+ printer = PrintGlxDispatch_h()
+ else:
+ show_usage()
+
+ api = gl_XML.parse_GL_API( file_name, glX_proto_common.glx_proto_item_factory() )
+
+ printer.Print( api )
--- mesa-7.0.3.orig/src/mesa/glapi/glX_proto_send.py
+++ mesa-7.0.3/src/mesa/glapi/glX_proto_send.py
@@ -0,0 +1,1016 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+# Jeremy Kolb
+
+import gl_XML, glX_XML, glX_proto_common, license
+import sys, getopt, copy, string
+
+def convertStringForXCB(str):
+ tmp = ""
+ special = [ "ARB" ]
+ i = 0
+ while i < len(str):
+ if str[i:i+3] in special:
+ tmp = '%s_%s' % (tmp, string.lower(str[i:i+3]))
+ i = i + 2;
+ elif str[i].isupper():
+ tmp = '%s_%s' % (tmp, string.lower(str[i]))
+ else:
+ tmp = '%s%s' % (tmp, str[i])
+ i += 1
+ return tmp
+
+def hash_pixel_function(func):
+ """Generate a 'unique' key for a pixel function. The key is based on
+ the parameters written in the command packet. This includes any
+ padding that might be added for the original function and the 'NULL
+ image' flag."""
+
+
+ h = ""
+ hash_pre = ""
+ hash_suf = ""
+ for param in func.parameterIterateGlxSend():
+ if param.is_image():
+ [dim, junk, junk, junk, junk] = param.get_dimensions()
+
+ d = (dim + 1) & ~1
+ hash_pre = "%uD%uD_" % (d - 1, d)
+
+ if param.img_null_flag:
+ hash_suf = "_NF"
+
+ h += "%u" % (param.size())
+
+ if func.pad_after(param):
+ h += "4"
+
+
+ n = func.name.replace("%uD" % (dim), "")
+ n = "__glx_%s_%uD%uD" % (n, d - 1, d)
+
+ h = hash_pre + h + hash_suf
+ return [h, n]
+
+
+class glx_pixel_function_stub(glX_XML.glx_function):
+ """Dummy class used to generate pixel "utility" functions that are
+ shared by multiple dimension image functions. For example, these
+ objects are used to generate shared functions used to send GLX
+ protocol for TexImage1D and TexImage2D, TexSubImage1D and
+ TexSubImage2D, etc."""
+
+ def __init__(self, func, name):
+ # The parameters to the utility function are the same as the
+ # parameters to the real function except for the added "pad"
+ # parameters.
+
+ self.name = name
+ self.images = []
+ self.parameters = []
+ self.parameters_by_name = {}
+ for _p in func.parameterIterator():
+ p = copy.copy(_p)
+ self.parameters.append(p)
+ self.parameters_by_name[ p.name ] = p
+
+
+ if p.is_image():
+ self.images.append(p)
+ p.height = "height"
+
+ if p.img_yoff == None:
+ p.img_yoff = "yoffset"
+
+ if p.depth:
+ if p.extent == None:
+ p.extent = "extent"
+
+ if p.img_woff == None:
+ p.img_woff = "woffset"
+
+
+ pad_name = func.pad_after(p)
+ if pad_name:
+ pad = copy.copy(p)
+ pad.name = pad_name
+ self.parameters.append(pad)
+ self.parameters_by_name[ pad.name ] = pad
+
+
+ self.return_type = func.return_type
+
+ self.glx_rop = ~0
+ self.glx_sop = 0
+ self.glx_vendorpriv = 0
+
+ self.glx_doubles_in_order = func.glx_doubles_in_order
+
+ self.vectorequiv = None
+ self.output = None
+ self.can_be_large = func.can_be_large
+ self.reply_always_array = func.reply_always_array
+ self.dimensions_in_reply = func.dimensions_in_reply
+ self.img_reset = None
+
+ self.server_handcode = 0
+ self.client_handcode = 0
+ self.ignore = 0
+
+ self.count_parameter_list = func.count_parameter_list
+ self.counter_list = func.counter_list
+ self.offsets_calculated = 0
+ return
+
+
+class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
+ def __init__(self):
+ glX_proto_common.glx_print_proto.__init__(self)
+ self.name = "glX_proto_send.py (from Mesa)"
+ self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004, 2005", "IBM")
+
+
+ self.last_category = ""
+ self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32]
+ self.pixel_stubs = {}
+ self.debug = 0
+ return
+
+ def printRealHeader(self):
+ print ''
+ print '#include '
+ print '#include "indirect.h"'
+ print '#include "glxclient.h"'
+ print '#include "indirect_size.h"'
+ print '#include "dispatch.h"'
+ print '#include "glapi.h"'
+ print '#include "glthread.h"'
+ print '#include '
+ print '#ifdef USE_XCB'
+ print '#include '
+ print '#include '
+ print '#include '
+ print '#endif /* USE_XCB */'
+
+ print ''
+ print '#define __GLX_PAD(n) (((n) + 3) & ~3)'
+ print ''
+ self.printFastcall()
+ self.printNoinline()
+ print ''
+ print '#if !defined __GNUC__ || __GNUC__ < 3'
+ print '# define __builtin_expect(x, y) x'
+ print '#endif'
+ print ''
+ print '/* If the size and opcode values are known at compile-time, this will, on'
+ print ' * x86 at least, emit them with a single instruction.'
+ print ' */'
+ print '#define emit_header(dest, op, size) \\'
+ print ' do { union { short s[2]; int i; } temp; \\'
+ print ' temp.s[0] = (size); temp.s[1] = (op); \\'
+ print ' *((int *)(dest)) = temp.i; } while(0)'
+ print ''
+ print """NOINLINE CARD32
+__glXReadReply( Display *dpy, size_t size, void * dest, GLboolean reply_is_always_array )
+{
+ xGLXSingleReply reply;
+
+ (void) _XReply(dpy, (xReply *) & reply, 0, False);
+ if (size != 0) {
+ if ((reply.length > 0) || reply_is_always_array) {
+ const GLint bytes = (reply_is_always_array)
+ ? (4 * reply.length) : (reply.size * size);
+ const GLint extra = 4 - (bytes & 3);
+
+ _XRead(dpy, dest, bytes);
+ if ( extra < 4 ) {
+ _XEatData(dpy, extra);
+ }
+ }
+ else {
+ (void) memcpy( dest, &(reply.pad3), size);
+ }
+ }
+
+ return reply.retval;
+}
+
+NOINLINE void
+__glXReadPixelReply( Display *dpy, __GLXcontext * gc, unsigned max_dim,
+ GLint width, GLint height, GLint depth, GLenum format, GLenum type,
+ void * dest, GLboolean dimensions_in_reply )
+{
+ xGLXSingleReply reply;
+ GLint size;
+
+ (void) _XReply(dpy, (xReply *) & reply, 0, False);
+
+ if ( dimensions_in_reply ) {
+ width = reply.pad3;
+ height = reply.pad4;
+ depth = reply.pad5;
+
+ if ((height == 0) || (max_dim < 2)) { height = 1; }
+ if ((depth == 0) || (max_dim < 3)) { depth = 1; }
+ }
+
+ size = reply.length * 4;
+ if (size != 0) {
+ void * buf = Xmalloc( size );
+
+ if ( buf == NULL ) {
+ _XEatData(dpy, size);
+ __glXSetError(gc, GL_OUT_OF_MEMORY);
+ }
+ else {
+ const GLint extra = 4 - (size & 3);
+
+ _XRead(dpy, buf, size);
+ if ( extra < 4 ) {
+ _XEatData(dpy, extra);
+ }
+
+ __glEmptyImage(gc, 3, width, height, depth, format, type,
+ buf, dest);
+ Xfree(buf);
+ }
+ }
+}
+
+#define X_GLXSingle 0
+
+NOINLINE FASTCALL GLubyte *
+__glXSetupSingleRequest( __GLXcontext * gc, GLint sop, GLint cmdlen )
+{
+ xGLXSingleReq * req;
+ Display * const dpy = gc->currentDpy;
+
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ LockDisplay(dpy);
+ GetReqExtra(GLXSingle, cmdlen, req);
+ req->reqType = gc->majorOpcode;
+ req->contextTag = gc->currentContextTag;
+ req->glxCode = sop;
+ return (GLubyte *)(req) + sz_xGLXSingleReq;
+}
+
+NOINLINE FASTCALL GLubyte *
+__glXSetupVendorRequest( __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen )
+{
+ xGLXVendorPrivateReq * req;
+ Display * const dpy = gc->currentDpy;
+
+ (void) __glXFlushRenderBuffer(gc, gc->pc);
+ LockDisplay(dpy);
+ GetReqExtra(GLXVendorPrivate, cmdlen, req);
+ req->reqType = gc->majorOpcode;
+ req->glxCode = code;
+ req->vendorCode = vop;
+ req->contextTag = gc->currentContextTag;
+ return (GLubyte *)(req) + sz_xGLXVendorPrivateReq;
+}
+
+const GLuint __glXDefaultPixelStore[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
+
+#define zero (__glXDefaultPixelStore+0)
+#define one (__glXDefaultPixelStore+8)
+#define default_pixel_store_1D (__glXDefaultPixelStore+4)
+#define default_pixel_store_1D_size 20
+#define default_pixel_store_2D (__glXDefaultPixelStore+4)
+#define default_pixel_store_2D_size 20
+#define default_pixel_store_3D (__glXDefaultPixelStore+0)
+#define default_pixel_store_3D_size 36
+#define default_pixel_store_4D (__glXDefaultPixelStore+0)
+#define default_pixel_store_4D_size 36
+"""
+
+ for size in self.generic_sizes:
+ self.print_generic_function(size)
+ return
+
+
+ def printBody(self, api):
+
+ self.pixel_stubs = {}
+ generated_stubs = []
+
+ for func in api.functionIterateGlx():
+ if func.client_handcode: continue
+
+ # If the function is a pixel function with a certain
+ # GLX protocol signature, create a fake stub function
+ # for it. For example, create a single stub function
+ # that is used to implement both glTexImage1D and
+ # glTexImage2D.
+
+ if func.glx_rop != 0:
+ do_it = 0
+ for image in func.get_images():
+ if image.img_pad_dimensions:
+ do_it = 1
+ break
+
+
+ if do_it:
+ [h, n] = hash_pixel_function(func)
+
+
+ self.pixel_stubs[ func.name ] = n
+ if h not in generated_stubs:
+ generated_stubs.append(h)
+
+ fake_func = glx_pixel_function_stub( func, n )
+ self.printFunction(fake_func, fake_func.name)
+
+
+ self.printFunction(func, func.name)
+ if func.glx_sop and func.glx_vendorpriv:
+ self.printFunction(func, func.glx_vendorpriv_names[0])
+
+ return
+
+
+ def printFunction(self, func, name):
+ footer = '}\n'
+ if func.glx_rop == ~0:
+ print 'static %s' % (func.return_type)
+ print '%s( unsigned opcode, unsigned dim, %s )' % (func.name, func.get_parameter_string())
+ print '{'
+ else:
+ if func.has_different_protocol(name):
+ if func.return_type == "void":
+ ret_string = ''
+ else:
+ ret_string = "return "
+
+ func_name = func.static_glx_name(name)
+ print '#define %s %d' % (func.opcode_vendor_name(name), func.glx_vendorpriv)
+ print '%s gl%s(%s)' % (func.return_type, func_name, func.get_parameter_string())
+ print '{'
+ print ' __GLXcontext * const gc = __glXGetCurrentContext();'
+ print ''
+ print ' if (gc->isDirect) {'
+ print ' %sCALL_%s(GET_DISPATCH(), (%s));' % (ret_string, func.name, func.get_called_parameter_string())
+ print ' } else {'
+ footer = '}\n}\n'
+ else:
+ print '#define %s %d' % (func.opcode_name(), func.opcode_value())
+
+ print '%s __indirect_gl%s(%s)' % (func.return_type, name, func.get_parameter_string())
+ print '{'
+
+
+ if func.glx_rop != 0 or func.vectorequiv != None:
+ if len(func.images):
+ self.printPixelFunction(func)
+ else:
+ self.printRenderFunction(func)
+ elif func.glx_sop != 0 or func.glx_vendorpriv != 0:
+ self.printSingleFunction(func, name)
+ pass
+ else:
+ print "/* Missing GLX protocol for %s. */" % (name)
+
+ print footer
+ return
+
+
+ def print_generic_function(self, n):
+ size = (n + 3) & ~3
+ print """static FASTCALL NOINLINE void
+generic_%u_byte( GLint rop, const void * ptr )
+{
+ __GLXcontext * const gc = __glXGetCurrentContext();
+ const GLuint cmdlen = %u;
+
+ emit_header(gc->pc, rop, cmdlen);
+ (void) memcpy((void *)(gc->pc + 4), ptr, %u);
+ gc->pc += cmdlen;
+ if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
+}
+""" % (n, size + 4, size)
+ return
+
+
+ def common_emit_one_arg(self, p, pc, adjust, extra_offset):
+ if p.is_array():
+ src_ptr = p.name
+ else:
+ src_ptr = "&" + p.name
+
+ if not extra_offset:
+ print '(void) memcpy((void *)(%s + %u), (void *)(%s), %s);' \
+ % (pc, p.offset + adjust, src_ptr, p.size_string() )
+ else:
+ print '(void) memcpy((void *)(%s + %u + %s), (void *)(%s), %s);' \
+ % (pc, p.offset + adjust, extra_offset, src_ptr, p.size_string() )
+
+ def common_emit_args(self, f, pc, adjust, skip_vla):
+ extra_offset = None
+
+ for p in f.parameterIterateGlxSend( not skip_vla ):
+ if p.name != f.img_reset:
+ self.common_emit_one_arg(p, pc, adjust, extra_offset)
+
+ if p.is_variable_length():
+ temp = p.size_string()
+ if extra_offset:
+ extra_offset += " + %s" % (temp)
+ else:
+ extra_offset = temp
+
+ return
+
+
+ def pixel_emit_args(self, f, pc, large):
+ """Emit the arguments for a pixel function. This differs from
+ common_emit_args in that pixel functions may require padding
+ be inserted (i.e., for the missing width field for
+ TexImage1D), and they may also require a 'NULL image' flag
+ be inserted before the image data."""
+
+ if large:
+ adjust = 8
+ else:
+ adjust = 4
+
+ for param in f.parameterIterateGlxSend():
+ if not param.is_image():
+ self.common_emit_one_arg(param, pc, adjust, None)
+
+ if f.pad_after(param):
+ print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset + param.size()) + adjust)
+
+ else:
+ [dim, width, height, depth, extent] = param.get_dimensions()
+ if f.glx_rop == ~0:
+ dim_str = "dim"
+ else:
+ dim_str = str(dim)
+
+ if param.img_null_flag:
+ if large:
+ print '(void) memcpy((void *)(%s + %u), zero, 4);' % (pc, (param.offset - 4) + adjust)
+ else:
+ print '(void) memcpy((void *)(%s + %u), (void *)((%s == NULL) ? one : zero), 4);' % (pc, (param.offset - 4) + adjust, param.name)
+
+
+ pixHeaderPtr = "%s + %u" % (pc, adjust)
+ pcPtr = "%s + %u" % (pc, param.offset + adjust)
+
+ if not large:
+ if param.img_send_null:
+ condition = '(compsize > 0) && (%s != NULL)' % (param.name)
+ else:
+ condition = 'compsize > 0'
+
+ print 'if (%s) {' % (condition)
+ print ' (*gc->fillImage)(gc, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr)
+ print '} else {'
+ print ' (void) memcpy( %s, default_pixel_store_%uD, default_pixel_store_%uD_size );' % (pixHeaderPtr, dim, dim)
+ print '}'
+ else:
+ print '__glXSendLargeImage(gc, compsize, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr)
+
+ return
+
+
+ def large_emit_begin(self, f, op_name = None):
+ if not op_name:
+ op_name = f.opcode_real_name()
+
+ print 'const GLint op = %s;' % (op_name)
+ print 'const GLuint cmdlenLarge = cmdlen + 4;'
+ print 'GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);'
+ print '(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);'
+ print '(void) memcpy((void *)(pc + 4), (void *)(&op), 4);'
+ return
+
+
+ def common_func_print_just_start(self, f):
+ print ' __GLXcontext * const gc = __glXGetCurrentContext();'
+
+ # The only reason that single and vendor private commands need
+ # a variable called 'dpy' is becuase they use the SyncHandle
+ # macro. For whatever brain-dead reason, that macro is hard-
+ # coded to use a variable called 'dpy' instead of taking a
+ # parameter.
+
+ # FIXME Simplify the logic related to skip_condition and
+ # FIXME condition_list in this function. Basically, remove
+ # FIXME skip_condition, and just append the "dpy != NULL" type
+ # FIXME condition to condition_list from the start. The only
+ # FIXME reason it's done in this confusing way now is to
+ # FIXME minimize the diffs in the generated code.
+
+ if not f.glx_rop:
+ for p in f.parameterIterateOutputs():
+ if p.is_image():
+ print ' const __GLXattribute * const state = gc->client_state_private;'
+ break
+
+ print ' Display * const dpy = gc->currentDpy;'
+ skip_condition = "dpy != NULL"
+ elif f.can_be_large:
+ skip_condition = "gc->currentDpy != NULL"
+ else:
+ skip_condition = None
+
+
+ if f.return_type != 'void':
+ print ' %s retval = (%s) 0;' % (f.return_type, f.return_type)
+
+
+ self.emit_packet_size_calculation(f, 0)
+
+ condition_list = []
+ for p in f.parameterIterateCounters():
+ condition_list.append( "%s >= 0" % (p.name) )
+
+ if skip_condition:
+ condition_list.append( skip_condition )
+
+ if len( condition_list ) > 0:
+ if len( condition_list ) > 1:
+ skip_condition = "(%s)" % (string.join( condition_list, ") && (" ))
+ else:
+ skip_condition = "%s" % (condition_list.pop(0))
+
+ print ' if (__builtin_expect(%s, 1)) {' % (skip_condition)
+ return 1
+ else:
+ return 0
+
+
+ def printSingleFunction(self, f, name):
+ self.common_func_print_just_start(f)
+
+ if self.debug:
+ print ' printf( "Enter %%s...\\n", "gl%s" );' % (f.name)
+
+ if name not in f.glx_vendorpriv_names:
+
+ # XCB specific:
+ print '#ifdef USE_XCB'
+ if self.debug:
+ print ' printf("\\tUsing XCB.\\n");'
+ print ' xcb_connection_t *c = XGetXCBConnection(dpy);'
+ print ' (void) __glXFlushRenderBuffer(gc, gc->pc);'
+ xcb_name = 'xcb_glx%s' % convertStringForXCB(name)
+
+ iparams=[]
+ extra_iparams = []
+ output = None
+ for p in f.parameterIterator():
+ if p.is_output:
+ output = p
+
+ if p.is_image():
+ if p.img_format != "GL_COLOR_INDEX" or p.img_type != "GL_BITMAP":
+ extra_iparams.append("state->storePack.swapEndian")
+ else:
+ extra_iparams.append("0")
+
+ # Hardcode this in. lsb_first param (apparently always GL_FALSE)
+ # also present in GetPolygonStipple, but taken care of above.
+ if xcb_name == "xcb_glx_read_pixels":
+ extra_iparams.append("0")
+ else:
+ iparams.append(p.name)
+
+
+ xcb_request = '%s(%s)' % (xcb_name, ", ".join(["c", "gc->currentContextTag"] + iparams + extra_iparams))
+
+ if f.needs_reply():
+ print ' %s_reply_t *reply = %s_reply(c, %s, NULL);' % (xcb_name, xcb_name, xcb_request)
+ if output and f.reply_always_array:
+ print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string())
+
+ elif output and not f.reply_always_array:
+ if not output.is_image():
+ print ' if (%s_data_length(reply) == 0)' % (xcb_name)
+ print ' (void)memcpy(%s, &reply->datum, sizeof(reply->datum));' % (output.name)
+ print ' else'
+ print ' (void)memcpy(%s, %s_data(reply), %s_data_length(reply) * sizeof(%s));' % (output.name, xcb_name, xcb_name, output.get_base_type_string())
+
+
+ if f.return_type != 'void':
+ print ' retval = reply->ret_val;'
+ print ' free(reply);'
+ else:
+ print ' ' + xcb_request + ';'
+ print '#else'
+ # End of XCB specific.
+
+
+ if f.parameters != []:
+ pc_decl = "GLubyte const * pc ="
+ else:
+ pc_decl = "(void)"
+
+ if name in f.glx_vendorpriv_names:
+ print ' %s __glXSetupVendorRequest(gc, %s, %s, cmdlen);' % (pc_decl, f.opcode_real_name(), f.opcode_vendor_name(name))
+ else:
+ print ' %s __glXSetupSingleRequest(gc, %s, cmdlen);' % (pc_decl, f.opcode_name())
+
+ self.common_emit_args(f, "pc", 0, 0)
+
+ images = f.get_images()
+
+ for img in images:
+ if img.is_output:
+ o = f.command_fixed_length() - 4
+ print ' *(int32_t *)(pc + %u) = 0;' % (o)
+ if img.img_format != "GL_COLOR_INDEX" or img.img_type != "GL_BITMAP":
+ print ' * (int8_t *)(pc + %u) = state->storePack.swapEndian;' % (o)
+
+ if f.img_reset:
+ print ' * (int8_t *)(pc + %u) = %s;' % (o + 1, f.img_reset)
+
+
+ return_name = ''
+ if f.needs_reply():
+ if f.return_type != 'void':
+ return_name = " retval"
+ return_str = " retval = (%s)" % (f.return_type)
+ else:
+ return_str = " (void)"
+
+ got_reply = 0
+
+ for p in f.parameterIterateOutputs():
+ if p.is_image():
+ [dim, w, h, d, junk] = p.get_dimensions()
+ if f.dimensions_in_reply:
+ print " __glXReadPixelReply(dpy, gc, %u, 0, 0, 0, %s, %s, %s, GL_TRUE);" % (dim, p.img_format, p.img_type, p.name)
+ else:
+ print " __glXReadPixelReply(dpy, gc, %u, %s, %s, %s, %s, %s, %s, GL_FALSE);" % (dim, w, h, d, p.img_format, p.img_type, p.name)
+
+ got_reply = 1
+ else:
+ if f.reply_always_array:
+ aa = "GL_TRUE"
+ else:
+ aa = "GL_FALSE"
+
+ # gl_parameter.size() returns the size
+ # of the entire data item. If the
+ # item is a fixed-size array, this is
+ # the size of the whole array. This
+ # is not what __glXReadReply wants. It
+ # wants the size of a single data
+ # element in the reply packet.
+ # Dividing by the array size (1 for
+ # non-arrays) gives us this.
+
+ s = p.size() / p.get_element_count()
+ print " %s __glXReadReply(dpy, %s, %s, %s);" % (return_str, s, p.name, aa)
+ got_reply = 1
+
+
+ # If a reply wasn't read to fill an output parameter,
+ # read a NULL reply to get the return value.
+
+ if not got_reply:
+ print " %s __glXReadReply(dpy, 0, NULL, GL_FALSE);" % (return_str)
+
+
+ elif self.debug:
+ # Only emit the extra glFinish call for functions
+ # that don't already require a reply from the server.
+ print ' __indirect_glFinish();'
+
+ if self.debug:
+ print ' printf( "Exit %%s.\\n", "gl%s" );' % (name)
+
+
+ print ' UnlockDisplay(dpy); SyncHandle();'
+
+ if name not in f.glx_vendorpriv_names:
+ print '#endif /* USE_XCB */'
+
+ print ' }'
+ print ' return%s;' % (return_name)
+ return
+
+
+ def printPixelFunction(self, f):
+ if self.pixel_stubs.has_key( f.name ):
+ # Normally gl_function::get_parameter_string could be
+ # used. However, this call needs to have the missing
+ # dimensions (e.g., a fake height value for
+ # glTexImage1D) added in.
+
+ p_string = ""
+ for param in f.parameterIterateGlxSend():
+ p_string += ", " + param.name
+
+ if param.is_image():
+ [dim, junk, junk, junk, junk] = param.get_dimensions()
+
+ if f.pad_after(param):
+ p_string += ", 1"
+
+ print ' %s(%s, %u%s );' % (self.pixel_stubs[f.name] , f.opcode_name(), dim, p_string)
+ return
+
+
+ if self.common_func_print_just_start(f):
+ trailer = " }"
+ else:
+ trailer = None
+
+
+ if f.can_be_large:
+ print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {'
+ print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {'
+ print ' (void) __glXFlushRenderBuffer(gc, gc->pc);'
+ print ' }'
+
+ if f.glx_rop == ~0:
+ opcode = "opcode"
+ else:
+ opcode = f.opcode_real_name()
+
+ print 'emit_header(gc->pc, %s, cmdlen);' % (opcode)
+
+ self.pixel_emit_args( f, "gc->pc", 0 )
+ print 'gc->pc += cmdlen;'
+ print 'if (gc->pc > gc->limit) { (void) __glXFlushRenderBuffer(gc, gc->pc); }'
+
+ if f.can_be_large:
+ print '}'
+ print 'else {'
+
+ self.large_emit_begin(f, opcode)
+ self.pixel_emit_args(f, "pc", 1)
+
+ print '}'
+
+ if trailer: print trailer
+ return
+
+
+ def printRenderFunction(self, f):
+ # There is a class of GL functions that take a single pointer
+ # as a parameter. This pointer points to a fixed-size chunk
+ # of data, and the protocol for this functions is very
+ # regular. Since they are so regular and there are so many
+ # of them, special case them with generic functions. On
+ # x86, this saves about 26KB in the libGL.so binary.
+
+ if f.variable_length_parameter() == None and len(f.parameters) == 1:
+ p = f.parameters[0]
+ if p.is_pointer():
+ cmdlen = f.command_fixed_length()
+ if cmdlen in self.generic_sizes:
+ print ' generic_%u_byte( %s, %s );' % (cmdlen, f.opcode_real_name(), p.name)
+ return
+
+ if self.common_func_print_just_start(f):
+ trailer = " }"
+ else:
+ trailer = None
+
+ if self.debug:
+ print 'printf( "Enter %%s...\\n", "gl%s" );' % (f.name)
+
+ if f.can_be_large:
+ print 'if (cmdlen <= gc->maxSmallRenderCommandSize) {'
+ print ' if ( (gc->pc + cmdlen) > gc->bufEnd ) {'
+ print ' (void) __glXFlushRenderBuffer(gc, gc->pc);'
+ print ' }'
+
+ print 'emit_header(gc->pc, %s, cmdlen);' % (f.opcode_real_name())
+
+ self.common_emit_args(f, "gc->pc", 4, 0)
+ print 'gc->pc += cmdlen;'
+ print 'if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }'
+
+ if f.can_be_large:
+ print '}'
+ print 'else {'
+
+ self.large_emit_begin(f)
+ self.common_emit_args(f, "pc", 8, 1)
+
+ p = f.variable_length_parameter()
+ print ' __glXSendLargeCommand(gc, pc, %u, %s, %s);' % (p.offset + 8, p.name, p.size_string())
+ print '}'
+
+ if self.debug:
+ print '__indirect_glFinish();'
+ print 'printf( "Exit %%s.\\n", "gl%s" );' % (f.name)
+
+ if trailer: print trailer
+ return
+
+
+class PrintGlxProtoInit_c(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "glX_proto_send.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
+ return
+
+
+ def printRealHeader(self):
+ print """/**
+ * \\file indirect_init.c
+ * Initialize indirect rendering dispatch table.
+ *
+ * \\author Kevin E. Martin
+ * \\author Brian Paul
+ * \\author Ian Romanick
+ */
+
+#include "indirect_init.h"
+#include "indirect.h"
+#include "glapi.h"
+
+
+/**
+ * No-op function used to initialize functions that have no GLX protocol
+ * support.
+ */
+static int NoOp(void)
+{
+ return 0;
+}
+
+/**
+ * Create and initialize a new GL dispatch table. The table is initialized
+ * with GLX indirect rendering protocol functions.
+ */
+__GLapi * __glXNewIndirectAPI( void )
+{
+ __GLapi *glAPI;
+ GLuint entries;
+
+ entries = _glapi_get_dispatch_table_size();
+ glAPI = (__GLapi *) Xmalloc(entries * sizeof(void *));
+
+ /* first, set all entries to point to no-op functions */
+ {
+ int i;
+ void **dispatch = (void **) glAPI;
+ for (i = 0; i < entries; i++) {
+ dispatch[i] = (void *) NoOp;
+ }
+ }
+
+ /* now, initialize the entries we understand */"""
+
+ def printRealFooter(self):
+ print """
+ return glAPI;
+}
+"""
+ return
+
+
+ def printBody(self, api):
+ for [name, number] in api.categoryIterate():
+ if number != None:
+ preamble = '\n /* %3u. %s */\n\n' % (int(number), name)
+ else:
+ preamble = '\n /* %s */\n\n' % (name)
+
+ for func in api.functionIterateByCategory(name):
+ if func.client_supported_for_indirect():
+ print '%s glAPI->%s = __indirect_gl%s;' % (preamble, func.name, func.name)
+ preamble = ''
+
+ return
+
+
+class PrintGlxProtoInit_h(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "glX_proto_send.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+(C) Copyright IBM Corporation 2004""", "PRECISION INSIGHT, IBM")
+ self.header_tag = "_INDIRECT_H_"
+
+ self.last_category = ""
+ return
+
+
+ def printRealHeader(self):
+ print """/**
+ * \\file
+ * Prototypes for indirect rendering functions.
+ *
+ * \\author Kevin E. Martin
+ * \\author Ian Romanick
+ */
+"""
+ self.printVisibility( "HIDDEN", "hidden" )
+ self.printFastcall()
+ self.printNoinline()
+
+ print """
+#include "glxclient.h"
+
+extern HIDDEN NOINLINE CARD32 __glXReadReply( Display *dpy, size_t size,
+ void * dest, GLboolean reply_is_always_array );
+
+extern HIDDEN NOINLINE void __glXReadPixelReply( Display *dpy,
+ __GLXcontext * gc, unsigned max_dim, GLint width, GLint height,
+ GLint depth, GLenum format, GLenum type, void * dest,
+ GLboolean dimensions_in_reply );
+
+extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupSingleRequest(
+ __GLXcontext * gc, GLint sop, GLint cmdlen );
+
+extern HIDDEN NOINLINE FASTCALL GLubyte * __glXSetupVendorRequest(
+ __GLXcontext * gc, GLint code, GLint vop, GLint cmdlen );
+"""
+
+
+ def printBody(self, api):
+ for func in api.functionIterateGlx():
+ params = func.get_parameter_string()
+
+ print 'extern HIDDEN %s __indirect_gl%s(%s);' % (func.return_type, func.name, params)
+
+ for n in func.entry_points:
+ if func.has_different_protocol(n):
+ asdf = func.static_glx_name(n)
+ if asdf not in func.static_entry_points:
+ print 'extern HIDDEN %s gl%s(%s);' % (func.return_type, asdf, params)
+ else:
+ print 'GLAPI %s GLAPIENTRY gl%s(%s);' % (func.return_type, asdf, params)
+
+ break
+
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m output_mode] [-d]" % sys.argv[0]
+ print " -m output_mode Output mode can be one of 'proto', 'init_c' or 'init_h'."
+ print " -d Enable extra debug information in the generated code."
+ sys.exit(1)
+
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:d")
+ except Exception,e:
+ show_usage()
+
+ debug = 0
+ mode = "proto"
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+ elif arg == "-m":
+ mode = val
+ elif arg == "-d":
+ debug = 1
+
+ if mode == "proto":
+ printer = PrintGlxProtoStubs()
+ elif mode == "init_c":
+ printer = PrintGlxProtoInit_c()
+ elif mode == "init_h":
+ printer = PrintGlxProtoInit_h()
+ else:
+ show_usage()
+
+
+ printer.debug = debug
+ api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() )
+
+ printer.Print( api )
--- mesa-7.0.3.orig/src/mesa/glapi/glX_proto_size.py
+++ mesa-7.0.3/src/mesa/glapi/glX_proto_size.py
@@ -0,0 +1,699 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML, glX_XML
+import license
+import sys, getopt, copy, string
+
+
+class glx_enum_function:
+ def __init__(self, func_name, enum_dict):
+ self.name = func_name
+ self.mode = 1
+ self.sig = None
+
+ # "enums" is a set of lists. The element in the set is the
+ # value of the enum. The list is the list of names for that
+ # value. For example, [0x8126] = {"POINT_SIZE_MIN",
+ # "POINT_SIZE_MIN_ARB", "POINT_SIZE_MIN_EXT",
+ # "POINT_SIZE_MIN_SGIS"}.
+
+ self.enums = {}
+
+ # "count" is indexed by count values. Each element of count
+ # is a list of index to "enums" that have that number of
+ # associated data elements. For example, [4] =
+ # {GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, GL_EMISSION,
+ # GL_AMBIENT_AND_DIFFUSE} (the enum names are used here,
+ # but the actual hexadecimal values would be in the array).
+
+ self.count = {}
+
+
+ # Fill self.count and self.enums using the dictionary of enums
+ # that was passed in. The generic Get functions (e.g.,
+ # GetBooleanv and friends) are handled specially here. In
+ # the data the generic Get functions are refered to as "Get".
+
+ if func_name in ["GetIntegerv", "GetBooleanv", "GetFloatv", "GetDoublev"]:
+ match_name = "Get"
+ else:
+ match_name = func_name
+
+ mode_set = 0
+ for enum_name in enum_dict:
+ e = enum_dict[ enum_name ]
+
+ if e.functions.has_key( match_name ):
+ [count, mode] = e.functions[ match_name ]
+
+ if mode_set and mode != self.mode:
+ raise RuntimeError("Not all enums for %s have the same mode." % (func_name))
+
+ self.mode = mode
+
+ if self.enums.has_key( e.value ):
+ if e.name not in self.enums[ e.value ]:
+ self.enums[ e.value ].append( e )
+ else:
+ if not self.count.has_key( count ):
+ self.count[ count ] = []
+
+ self.enums[ e.value ] = [ e ]
+ self.count[ count ].append( e.value )
+
+
+ return
+
+
+ def signature( self ):
+ if self.sig == None:
+ self.sig = ""
+ for i in self.count:
+ if i == None:
+ raise RuntimeError("i is None. WTF?")
+
+ self.count[i].sort()
+ for e in self.count[i]:
+ self.sig += "%04x,%d," % (e, i)
+
+ return self.sig
+
+
+ def is_set( self ):
+ return self.mode
+
+
+ def PrintUsingTable(self):
+ """Emit the body of the __gl*_size function using a pair
+ of look-up tables and a mask. The mask is calculated such
+ that (e & mask) is unique for all the valid values of e for
+ this function. The result of (e & mask) is used as an index
+ into the first look-up table. If it matches e, then the
+ same entry of the second table is returned. Otherwise zero
+ is returned.
+
+ It seems like this should cause better code to be generated.
+ However, on x86 at least, the resulting .o file is about 20%
+ larger then the switch-statment version. I am leaving this
+ code in because the results may be different on other
+ platforms (e.g., PowerPC or x86-64)."""
+
+ return 0
+ count = 0
+ for a in self.enums:
+ count += 1
+
+ if self.count.has_key(-1):
+ return 0
+
+ # Determine if there is some mask M, such that M = (2^N) - 1,
+ # that will generate unique values for all of the enums.
+
+ mask = 0
+ for i in [1, 2, 3, 4, 5, 6, 7, 8]:
+ mask = (1 << i) - 1
+
+ fail = 0;
+ for a in self.enums:
+ for b in self.enums:
+ if a != b:
+ if (a & mask) == (b & mask):
+ fail = 1;
+
+ if not fail:
+ break;
+ else:
+ mask = 0
+
+ if (mask != 0) and (mask < (2 * count)):
+ masked_enums = {}
+ masked_count = {}
+
+ for i in range(0, mask + 1):
+ masked_enums[i] = "0";
+ masked_count[i] = 0;
+
+ for c in self.count:
+ for e in self.count[c]:
+ i = e & mask
+ enum_obj = self.enums[e][0]
+ masked_enums[i] = '0x%04x /* %s */' % (e, enum_obj.name )
+ masked_count[i] = c
+
+
+ print ' static const GLushort a[%u] = {' % (mask + 1)
+ for e in masked_enums:
+ print ' %s, ' % (masked_enums[e])
+ print ' };'
+
+ print ' static const GLubyte b[%u] = {' % (mask + 1)
+ for c in masked_count:
+ print ' %u, ' % (masked_count[c])
+ print ' };'
+
+ print ' const unsigned idx = (e & 0x%02xU);' % (mask)
+ print ''
+ print ' return (e == a[idx]) ? (GLint) b[idx] : 0;'
+ return 1;
+ else:
+ return 0;
+
+
+ def PrintUsingSwitch(self, name):
+ """Emit the body of the __gl*_size function using a
+ switch-statement."""
+
+ print ' switch( e ) {'
+
+ for c in self.count:
+ for e in self.count[c]:
+ first = 1
+
+ # There may be multiple enums with the same
+ # value. This happens has extensions are
+ # promoted from vendor-specific or EXT to
+ # ARB and to the core. Emit the first one as
+ # a case label, and emit the others as
+ # commented-out case labels.
+
+ list = {}
+ for enum_obj in self.enums[e]:
+ list[ enum_obj.priority() ] = enum_obj.name
+
+ keys = list.keys()
+ keys.sort()
+ for k in keys:
+ j = list[k]
+ if first:
+ print ' case GL_%s:' % (j)
+ first = 0
+ else:
+ print '/* case GL_%s:*/' % (j)
+
+ if c == -1:
+ print ' return __gl%s_variable_size( e );' % (name)
+ else:
+ print ' return %u;' % (c)
+
+ print ' default: return 0;'
+ print ' }'
+
+
+ def Print(self, name):
+ print 'INTERNAL PURE FASTCALL GLint'
+ print '__gl%s_size( GLenum e )' % (name)
+ print '{'
+
+ if not self.PrintUsingTable():
+ self.PrintUsingSwitch(name)
+
+ print '}'
+ print ''
+
+
+class glx_server_enum_function(glx_enum_function):
+ def __init__(self, func, enum_dict):
+ glx_enum_function.__init__(self, func.name, enum_dict)
+
+ self.function = func
+ return
+
+
+ def signature( self ):
+ if self.sig == None:
+ sig = glx_enum_function.signature(self)
+
+ p = self.function.variable_length_parameter()
+ if p:
+ sig += "%u" % (p.size())
+
+ self.sig = sig
+
+ return self.sig;
+
+
+ def Print(self, name, printer):
+ f = self.function
+ printer.common_func_print_just_header( f )
+
+ fixup = []
+
+ foo = {}
+ for param_name in f.count_parameter_list:
+ o = f.offset_of( param_name )
+ foo[o] = param_name
+
+ for param_name in f.counter_list:
+ o = f.offset_of( param_name )
+ foo[o] = param_name
+
+ keys = foo.keys()
+ keys.sort()
+ for o in keys:
+ p = f.parameters_by_name[ foo[o] ]
+
+ printer.common_emit_one_arg(p, "pc", 0)
+ fixup.append( p.name )
+
+
+ print ' GLsizei compsize;'
+ print ''
+
+ printer.common_emit_fixups(fixup)
+
+ print ''
+ print ' compsize = __gl%s_size(%s);' % (f.name, string.join(f.count_parameter_list, ","))
+ p = f.variable_length_parameter()
+ print ' return __GLX_PAD(%s);' % (p.size_string())
+
+ print '}'
+ print ''
+
+
+class PrintGlxSizeStubs_common(gl_XML.gl_print_base):
+ do_get = (1 << 0)
+ do_set = (1 << 1)
+
+ def __init__(self, which_functions):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "glX_proto_size.py (from Mesa)"
+ self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2004", "IBM")
+
+ self.emit_set = ((which_functions & PrintGlxSizeStubs_common.do_set) != 0)
+ self.emit_get = ((which_functions & PrintGlxSizeStubs_common.do_get) != 0)
+ return
+
+
+class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
+ def printRealHeader(self):
+ print ''
+ print '#include '
+ if self.emit_get:
+ print '#include "indirect_size_get.h"'
+ print '#include "glxserver.h"'
+ print '#include "indirect_util.h"'
+
+ print '#include "indirect_size.h"'
+
+ print ''
+ self.printPure()
+ print ''
+ self.printFastcall()
+ print ''
+ self.printVisibility( "INTERNAL", "internal" )
+ print ''
+ print ''
+ print '#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__APPLE__)'
+ print '# undef HAVE_ALIAS'
+ print '#endif'
+ print '#ifdef HAVE_ALIAS'
+ print '# define ALIAS2(from,to) \\'
+ print ' INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\'
+ print ' __attribute__ ((alias( # to )));'
+ print '# define ALIAS(from,to) ALIAS2( from, __gl ## to ## _size )'
+ print '#else'
+ print '# define ALIAS(from,to) \\'
+ print ' INTERNAL PURE FASTCALL GLint __gl ## from ## _size( GLenum e ) \\'
+ print ' { return __gl ## to ## _size( e ); }'
+ print '#endif'
+ print ''
+ print ''
+
+
+ def printBody(self, api):
+ enum_sigs = {}
+ aliases = []
+
+ for func in api.functionIterateGlx():
+ ef = glx_enum_function( func.name, api.enums_by_name )
+ if len(ef.enums) == 0:
+ continue
+
+ if (ef.is_set() and self.emit_set) or (not ef.is_set() and self.emit_get):
+ sig = ef.signature()
+ if enum_sigs.has_key( sig ):
+ aliases.append( [func.name, enum_sigs[ sig ]] )
+ else:
+ enum_sigs[ sig ] = func.name
+ ef.Print( func.name )
+
+
+ for [alias_name, real_name] in aliases:
+ print 'ALIAS( %s, %s )' % (alias_name, real_name)
+
+
+
+class PrintGlxSizeStubs_h(PrintGlxSizeStubs_common):
+ def printRealHeader(self):
+ print """/**
+ * \\file
+ * Prototypes for functions used to determine the number of data elements in
+ * various GLX protocol messages.
+ *
+ * \\author Ian Romanick
+ */
+"""
+ self.printPure();
+ print ''
+ self.printFastcall();
+ print ''
+ self.printVisibility( "INTERNAL", "internal" );
+ print ''
+
+
+ def printBody(self, api):
+ for func in api.functionIterateGlx():
+ ef = glx_enum_function( func.name, api.enums_by_name )
+ if len(ef.enums) == 0:
+ continue
+
+ if (ef.is_set() and self.emit_set) or (not ef.is_set() and self.emit_get):
+ print 'extern INTERNAL PURE FASTCALL GLint __gl%s_size(GLenum);' % (func.name)
+
+
+class PrintGlxReqSize_common(gl_XML.gl_print_base):
+ """Common base class for PrintGlxSizeReq_h and PrintGlxSizeReq_h.
+
+ The main purpose of this common base class is to provide the infrastructure
+ for the derrived classes to iterate over the same set of functions.
+ """
+
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "glX_proto_size.py (from Mesa)"
+ self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM")
+
+
+class PrintGlxReqSize_h(PrintGlxReqSize_common):
+ def __init__(self):
+ PrintGlxReqSize_common.__init__(self)
+ self.header_tag = "_INDIRECT_REQSIZE_H_"
+
+
+ def printRealHeader(self):
+ self.printVisibility("HIDDEN", "hidden")
+ print ''
+ self.printPure()
+ print ''
+
+
+ def printBody(self, api):
+ for func in api.functionIterateGlx():
+ if not func.ignore and func.has_variable_size_request():
+ print 'extern PURE HIDDEN int __glX%sReqSize(const GLbyte *pc, Bool swap);' % (func.name)
+
+
+class PrintGlxReqSize_c(PrintGlxReqSize_common):
+ """Create the server-side 'request size' functions.
+
+ Create the server-side functions that are used to determine what the
+ size of a varible length command should be. The server then uses
+ this value to determine if the incoming command packed it malformed.
+ """
+
+ def __init__(self):
+ PrintGlxReqSize_common.__init__(self)
+ self.counter_sigs = {}
+
+
+ def printRealHeader(self):
+ print ''
+ print '#include '
+ print '#include "glxserver.h"'
+ print '#include "glxbyteorder.h"'
+ print '#include "indirect_size.h"'
+ print '#include "indirect_reqsize.h"'
+ print ''
+ print '#define __GLX_PAD(x) (((x) + 3) & ~3)'
+ print ''
+ print '#if defined(__CYGWIN__) || defined(__MINGW32__)'
+ print '# undef HAVE_ALIAS'
+ print '#endif'
+ print '#ifdef HAVE_ALIAS'
+ print '# define ALIAS2(from,to) \\'
+ print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \\'
+ print ' __attribute__ ((alias( # to )));'
+ print '# define ALIAS(from,to) ALIAS2( from, __glX ## to ## ReqSize )'
+ print '#else'
+ print '# define ALIAS(from,to) \\'
+ print ' GLint __glX ## from ## ReqSize( const GLbyte * pc, Bool swap ) \\'
+ print ' { return __glX ## to ## ReqSize( pc, swap ); }'
+ print '#endif'
+ print ''
+ print ''
+
+
+ def printBody(self, api):
+ aliases = []
+ enum_functions = {}
+ enum_sigs = {}
+
+ for func in api.functionIterateGlx():
+ if not func.has_variable_size_request(): continue
+
+ ef = glx_server_enum_function( func, api.enums_by_name )
+ if len(ef.enums) == 0: continue
+
+ sig = ef.signature()
+
+ if not enum_functions.has_key(func.name):
+ enum_functions[ func.name ] = sig
+
+ if not enum_sigs.has_key( sig ):
+ enum_sigs[ sig ] = ef
+
+
+
+ for func in api.functionIterateGlx():
+ # Even though server-handcode fuctions are on "the
+ # list", and prototypes are generated for them, there
+ # isn't enough information to generate a size
+ # function. If there was enough information, they
+ # probably wouldn't need to be handcoded in the first
+ # place!
+
+ if func.server_handcode: continue
+ if not func.has_variable_size_request(): continue
+
+ if enum_functions.has_key(func.name):
+ sig = enum_functions[func.name]
+ ef = enum_sigs[ sig ]
+
+ if ef.name != func.name:
+ aliases.append( [func.name, ef.name] )
+ else:
+ ef.Print( func.name, self )
+
+ elif func.images:
+ self.printPixelFunction(func)
+ elif func.has_variable_size_request():
+ a = self.printCountedFunction(func)
+ if a: aliases.append(a)
+
+
+ for [alias_name, real_name] in aliases:
+ print 'ALIAS( %s, %s )' % (alias_name, real_name)
+
+ return
+
+
+ def common_emit_fixups(self, fixup):
+ """Utility function to emit conditional byte-swaps."""
+
+ if fixup:
+ print ' if (swap) {'
+ for name in fixup:
+ print ' %s = bswap_32(%s);' % (name, name)
+ print ' }'
+
+ return
+
+
+ def common_emit_one_arg(self, p, pc, adjust):
+ offset = p.offset
+ dst = p.string()
+ src = '(%s *)' % (p.type_string())
+ print '%-18s = *%11s(%s + %u);' % (dst, src, pc, offset + adjust);
+ return
+
+
+ def common_func_print_just_header(self, f):
+ print 'int'
+ print '__glX%sReqSize( const GLbyte * pc, Bool swap )' % (f.name)
+ print '{'
+
+
+ def printPixelFunction(self, f):
+ self.common_func_print_just_header(f)
+
+ f.offset_of( f.parameters[0].name )
+ [dim, w, h, d, junk] = f.get_images()[0].get_dimensions()
+
+ print ' GLint row_length = * (GLint *)(pc + 4);'
+
+ if dim < 3:
+ fixup = ['row_length', 'skip_rows', 'alignment']
+ print ' GLint image_height = 0;'
+ print ' GLint skip_images = 0;'
+ print ' GLint skip_rows = * (GLint *)(pc + 8);'
+ print ' GLint alignment = * (GLint *)(pc + 16);'
+ else:
+ fixup = ['row_length', 'image_height', 'skip_rows', 'skip_images', 'alignment']
+ print ' GLint image_height = * (GLint *)(pc + 8);'
+ print ' GLint skip_rows = * (GLint *)(pc + 16);'
+ print ' GLint skip_images = * (GLint *)(pc + 20);'
+ print ' GLint alignment = * (GLint *)(pc + 32);'
+
+ img = f.images[0]
+ for p in f.parameterIterateGlxSend():
+ if p.name in [w, h, d, img.img_format, img.img_type, img.img_target]:
+ self.common_emit_one_arg(p, "pc", 0)
+ fixup.append( p.name )
+
+ print ''
+
+ self.common_emit_fixups(fixup)
+
+ print ''
+ print ' return __glXImageSize(%s, %s, %s, %s, %s, %s,' % (img.img_format, img.img_type, img.img_target, w, h, d )
+ print ' image_height, row_length, skip_images,'
+ print ' skip_rows, alignment);'
+ print '}'
+ print ''
+ return
+
+
+ def printCountedFunction(self, f):
+
+ sig = ""
+ offset = 0
+ fixup = []
+ params = []
+ plus = ''
+ size = ''
+ param_offsets = {}
+
+ # Calculate the offset of each counter parameter and the
+ # size string for the variable length parameter(s). While
+ # that is being done, calculate a unique signature for this
+ # function.
+
+ for p in f.parameterIterateGlxSend():
+ if p.is_counter:
+ fixup.append( p.name )
+ params.append( p )
+ elif p.counter:
+ s = p.size()
+ if s == 0: s = 1
+
+ sig += "(%u,%u)" % (f.offset_of(p.counter), s)
+ size += '%s%s' % (plus, p.size_string())
+ plus = ' + '
+
+
+ # If the calculated signature matches a function that has
+ # already be emitted, don't emit this function. Instead, add
+ # it to the list of function aliases.
+
+ if self.counter_sigs.has_key(sig):
+ n = self.counter_sigs[sig];
+ alias = [f.name, n]
+ else:
+ alias = None
+ self.counter_sigs[sig] = f.name
+
+ self.common_func_print_just_header(f)
+
+ for p in params:
+ self.common_emit_one_arg(p, "pc", 0)
+
+
+ print ''
+ self.common_emit_fixups(fixup)
+ print ''
+
+ print ' return __GLX_PAD(%s);' % (size)
+ print '}'
+ print ''
+
+ return alias
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] -m output_mode [--only-get | --only-set] [--get-alias-set]" % sys.argv[0]
+ print " -m output_mode Output mode can be one of 'size_c' or 'size_h'."
+ print " --only-get Only emit 'get'-type functions."
+ print " --only-set Only emit 'set'-type functions."
+ print ""
+ print "By default, both 'get' and 'set'-type functions are emitted."
+ sys.exit(1)
+
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:h:", ["only-get", "only-set", "header-tag"])
+ except Exception,e:
+ show_usage()
+
+ mode = None
+ header_tag = None
+ which_functions = PrintGlxSizeStubs_common.do_get | PrintGlxSizeStubs_common.do_set
+
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+ elif arg == "-m":
+ mode = val
+ elif arg == "--only-get":
+ which_functions = PrintGlxSizeStubs_common.do_get
+ elif arg == "--only-set":
+ which_functions = PrintGlxSizeStubs_common.do_set
+ elif (arg == '-h') or (arg == "--header-tag"):
+ header_tag = val
+
+ if mode == "size_c":
+ printer = PrintGlxSizeStubs_c( which_functions )
+ elif mode == "size_h":
+ printer = PrintGlxSizeStubs_h( which_functions )
+ if header_tag:
+ printer.header_tag = header_tag
+ elif mode == "reqsize_c":
+ printer = PrintGlxReqSize_c()
+ elif mode == "reqsize_h":
+ printer = PrintGlxReqSize_h()
+ else:
+ show_usage()
+
+ api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() )
+
+
+ printer.Print( api )
--- mesa-7.0.3.orig/src/mesa/glapi/glX_server_table.py
+++ mesa-7.0.3/src/mesa/glapi/glX_server_table.py
@@ -0,0 +1,411 @@
+#!/bin/env python
+
+# (C) Copyright IBM Corporation 2005, 2006
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML, glX_XML, glX_proto_common, license
+import sys, getopt
+
+
+def log2(value):
+ for i in range(0, 30):
+ p = 1 << i
+ if p >= value:
+ return i
+
+ return -1
+
+
+def round_down_to_power_of_two(n):
+ """Returns the nearest power-of-two less than or equal to n."""
+
+ for i in range(30, 0, -1):
+ p = 1 << i
+ if p <= n:
+ return p
+
+ return -1
+
+
+class function_table:
+ def __init__(self, name, do_size_check):
+ self.name_base = name
+ self.do_size_check = do_size_check
+
+
+ self.max_bits = 1
+ self.next_opcode_threshold = (1 << self.max_bits)
+ self.max_opcode = 0
+
+ self.functions = {}
+ self.lookup_table = []
+
+ # Minimum number of opcodes in a leaf node.
+ self.min_op_bits = 3
+ self.min_op_count = (1 << self.min_op_bits)
+ return
+
+
+ def append(self, opcode, func):
+ self.functions[opcode] = func
+
+ if opcode > self.max_opcode:
+ self.max_opcode = opcode
+
+ if opcode > self.next_opcode_threshold:
+ bits = log2(opcode)
+ if (1 << bits) <= opcode:
+ bits += 1
+
+ self.max_bits = bits
+ self.next_opcode_threshold = 1 << bits
+ return
+
+
+ def divide_group(self, min_opcode, total):
+ """Divide the group starting min_opcode into subgroups.
+ Returns a tuple containing the number of bits consumed by
+ the node, the list of the children's tuple, and the number
+ of entries in the final array used by this node and its
+ children, and the depth of the subtree rooted at the node."""
+
+ remaining_bits = self.max_bits - total
+ next_opcode = min_opcode + (1 << remaining_bits)
+ empty_children = 0
+
+ for M in range(0, remaining_bits):
+ op_count = 1 << (remaining_bits - M);
+ child_count = 1 << M;
+
+ empty_children = 0
+ full_children = 0
+ for i in range(min_opcode, next_opcode, op_count):
+ used = 0
+ empty = 0
+
+ for j in range(i, i + op_count):
+ if self.functions.has_key(j):
+ used += 1;
+ else:
+ empty += 1;
+
+
+ if empty == op_count:
+ empty_children += 1
+
+ if used == op_count:
+ full_children += 1
+
+ if (empty_children > 0) or (full_children == child_count) or (op_count <= self.min_op_count):
+ break
+
+
+ # If all the remaining bits are used by this node, as is the
+ # case when M is 0 or remaining_bits, the node is a leaf.
+
+ if (M == 0) or (M == remaining_bits):
+ return [remaining_bits, [], 0, 0]
+ else:
+ children = []
+ count = 1
+ depth = 1
+ all_children_are_nonempty_leaf_nodes = 1
+ for i in range(min_opcode, next_opcode, op_count):
+ n = self.divide_group(i, total + M)
+
+ if not (n[1] == [] and not self.is_empty_leaf(i, n[0])):
+ all_children_are_nonempty_leaf_nodes = 0
+
+ children.append(n)
+ count += n[2] + 1
+
+ if n[3] >= depth:
+ depth = n[3] + 1
+
+ # If all of the child nodes are non-empty leaf nodes, pull
+ # them up and make this node a leaf.
+
+ if all_children_are_nonempty_leaf_nodes:
+ return [remaining_bits, [], 0, 0]
+ else:
+ return [M, children, count, depth]
+
+
+ def is_empty_leaf(self, base_opcode, M):
+ for op in range(base_opcode, base_opcode + (1 << M)):
+ if self.functions.has_key(op):
+ return 0
+ break
+
+ return 1
+
+
+ def dump_tree(self, node, base_opcode, remaining_bits, base_entry, depth):
+ M = node[0]
+ children = node[1]
+ child_M = remaining_bits - M
+
+
+ # This actually an error condition.
+ if children == []:
+ return
+
+ print ' /* [%u] -> opcode range [%u, %u], node depth %u */' % (base_entry, base_opcode, base_opcode + (1 << remaining_bits), depth)
+ print ' %u,' % (M)
+
+ base_entry += (1 << M) + 1
+
+ child_index = base_entry
+ child_base_opcode = base_opcode
+ for child in children:
+ if child[1] == []:
+ if self.is_empty_leaf(child_base_opcode, child_M):
+ print ' EMPTY_LEAF,'
+ else:
+ # Emit the index of the next dispatch
+ # function. Then add all the
+ # dispatch functions for this leaf
+ # node to the dispatch function
+ # lookup table.
+
+ print ' LEAF(%u),' % (len(self.lookup_table))
+
+ for op in range(child_base_opcode, child_base_opcode + (1 << child_M)):
+ if self.functions.has_key(op):
+ func = self.functions[op]
+ size = func.command_fixed_length()
+
+ if func.glx_rop != 0:
+ size += 4
+
+ size = ((size + 3) & ~3)
+
+ if func.has_variable_size_request():
+ size_name = "__glX%sReqSize" % (func.name)
+ else:
+ size_name = ""
+
+ if func.glx_vendorpriv == op:
+ func_name = func.glx_vendorpriv_names[0]
+ else:
+ func_name = func.name
+
+ temp = [op, "__glXDisp_%s" % (func_name), "__glXDispSwap_%s" % (func_name), size, size_name]
+ else:
+ temp = [op, "NULL", "NULL", 0, ""]
+
+ self.lookup_table.append(temp)
+ else:
+ print ' %u,' % (child_index)
+ child_index += child[2]
+
+ child_base_opcode += 1 << child_M
+
+ print ''
+
+ child_index = base_entry
+ for child in children:
+ if child[1] != []:
+ self.dump_tree(child, base_opcode, remaining_bits - M, child_index, depth + 1)
+ child_index += child[2]
+
+ base_opcode += 1 << (remaining_bits - M)
+
+
+ def Print(self):
+ # Each dispatch table consists of two data structures.
+ #
+ # The first structure is an N-way tree where the opcode for
+ # the function is the key. Each node switches on a range of
+ # bits from the opcode. M bits are extracted from the opcde
+ # and are used as an index to select one of the N, where
+ # N = 2^M, children.
+ #
+ # The tree is stored as a flat array. The first value is the
+ # number of bits, M, used by the node. For inner nodes, the
+ # following 2^M values are indexes into the array for the
+ # child nodes. For leaf nodes, the followign 2^M values are
+ # indexes into the second data structure.
+ #
+ # If an inner node's child index is 0, the child is an empty
+ # leaf node. That is, none of the opcodes selectable from
+ # that child exist. Since most of the possible opcode space
+ # is unused, this allows compact data storage.
+ #
+ # The second data structure is an array of pairs of function
+ # pointers. Each function contains a pointer to a protocol
+ # decode function and a pointer to a byte-swapped protocol
+ # decode function. Elements in this array are selected by the
+ # leaf nodes of the first data structure.
+ #
+ # As the tree is traversed, an accumulator is kept. This
+ # accumulator counts the bits of the opcode consumed by the
+ # traversal. When accumulator + M = B, where B is the
+ # maximum number of bits in an opcode, the traversal has
+ # reached a leaf node. The traversal starts with the most
+ # significant bits and works down to the least significant
+ # bits.
+ #
+ # Creation of the tree is the most complicated part. At
+ # each node the elements are divided into groups of 2^M
+ # elements. The value of M selected is the smallest possible
+ # value where all of the groups are either empty or full, or
+ # the groups are a preset minimum size. If all the children
+ # of a node are non-empty leaf nodes, the children are merged
+ # to create a single leaf node that replaces the parent.
+
+ tree = self.divide_group(0, 0)
+
+ print '/*****************************************************************/'
+ print '/* tree depth = %u */' % (tree[3])
+ print 'static const int_fast16_t %s_dispatch_tree[%u] = {' % (self.name_base, tree[2])
+ self.dump_tree(tree, 0, self.max_bits, 0, 1)
+ print '};\n'
+
+ # After dumping the tree, dump the function lookup table.
+
+ print 'static const void *%s_function_table[%u][2] = {' % (self.name_base, len(self.lookup_table))
+ index = 0
+ for func in self.lookup_table:
+ opcode = func[0]
+ name = func[1]
+ name_swap = func[2]
+
+ print ' /* [% 3u] = %5u */ {%s, %s},' % (index, opcode, name, name_swap)
+
+ index += 1
+
+ print '};\n'
+
+ if self.do_size_check:
+ var_table = []
+
+ print 'static const int_fast16_t %s_size_table[%u][2] = {' % (self.name_base, len(self.lookup_table))
+ index = 0
+ var_table = []
+ for func in self.lookup_table:
+ opcode = func[0]
+ fixed = func[3]
+ var = func[4]
+
+ if var != "":
+ var_offset = "%2u" % (len(var_table))
+ var_table.append(var)
+ else:
+ var_offset = "~0"
+
+ print ' /* [%3u] = %5u */ {%3u, %s},' % (index, opcode, fixed, var_offset)
+ index += 1
+
+
+ print '};\n'
+
+
+ print 'static const gl_proto_size_func %s_size_func_table[%u] = {' % (self.name_base, len(var_table))
+ for func in var_table:
+ print ' %s,' % (func)
+
+ print '};\n'
+
+
+ print 'const struct __glXDispatchInfo %s_dispatch_info = {' % (self.name_base)
+ print ' %u,' % (self.max_bits)
+ print ' %s_dispatch_tree,' % (self.name_base)
+ print ' %s_function_table,' % (self.name_base)
+ if self.do_size_check:
+ print ' %s_size_table,' % (self.name_base)
+ print ' %s_size_func_table' % (self.name_base)
+ else:
+ print ' NULL,'
+ print ' NULL'
+ print '};\n'
+ return
+
+
+class PrintGlxDispatchTables(glX_proto_common.glx_print_proto):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+ self.name = "glX_server_table.py (from Mesa)"
+ self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005, 2006", "IBM")
+
+ self.rop_functions = function_table("Render", 1)
+ self.sop_functions = function_table("Single", 0)
+ self.vop_functions = function_table("VendorPriv", 0)
+ return
+
+
+ def printRealHeader(self):
+ print '#include '
+ print '#include "glxserver.h"'
+ print '#include "glxext.h"'
+ print '#include "indirect_dispatch.h"'
+ print '#include "indirect_reqsize.h"'
+ print '#include "g_disptab.h"'
+ print '#include "indirect_table.h"'
+ print ''
+ return
+
+
+ def printBody(self, api):
+ for f in api.functionIterateAll():
+ if not f.ignore and f.vectorequiv == None:
+ if f.glx_rop != 0:
+ self.rop_functions.append(f.glx_rop, f)
+ if f.glx_sop != 0:
+ self.sop_functions.append(f.glx_sop, f)
+ if f.glx_vendorpriv != 0:
+ self.vop_functions.append(f.glx_vendorpriv, f)
+
+ self.sop_functions.Print()
+ self.rop_functions.Print()
+ self.vop_functions.Print()
+ return
+
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m")
+ except Exception,e:
+ show_usage()
+
+ mode = "table_c"
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+ elif arg == "-m":
+ mode = val
+
+ if mode == "table_c":
+ printer = PrintGlxDispatchTables()
+ else:
+ show_usage()
+
+
+ api = gl_XML.parse_GL_API( file_name, glX_XML.glx_item_factory() )
+
+
+ printer.Print( api )
--- mesa-7.0.3.orig/src/mesa/glapi/gl_API.dtd
+++ mesa-7.0.3/src/mesa/glapi/gl_API.dtd
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- mesa-7.0.3.orig/src/mesa/glapi/gl_API.xml
+++ mesa-7.0.3/src/mesa/glapi/gl_API.xml
@@ -0,0 +1,12347 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- mesa-7.0.3.orig/src/mesa/glapi/gl_SPARC_asm.py
+++ mesa-7.0.3/src/mesa/glapi/gl_SPARC_asm.py
@@ -0,0 +1,153 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import license
+import gl_XML, glX_XML
+import sys, getopt
+
+class PrintGenericStubs(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+ self.name = "gl_SPARC_asm.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+
+
+ def printRealHeader(self):
+ print '#include "glapioffsets.h"'
+ print ''
+ print '#ifdef __arch64__'
+ print '# define GL_STUB(fn,off)\t\t\t\t\\'
+ print 'fn:\t\t\t\t\t\\'
+ print '\tsethi\t%hi(0xDEADBEEF), %g4 ;\t\t\t\\'
+ print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\'
+ print '\tor\t%g4, %lo(0xDEADBEEF), %g4 ;\t\t\\'
+ print '\tor\t%g1, %lo(0xDEADBEEF), %g1 ;\t\t\\'
+ print '\tsllx\t%g4, 32, %g4 ;\t\t\t\t\\'
+ print '\tldx\t[%g1 + %g4], %g1 ;\t\t\t\\'
+ print '\tsethi\t%hi(8 * off), %g4 ;\t\t\t\\'
+ print '\tor\t%g4, %lo(8 * off), %g4 ;\t\t\\'
+ print '\tldx\t[%g1 + %g4], %g5 ;\t\t\t\\'
+ print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
+ print '\tnop'
+ print '#else'
+ print '# define GL_STUB(fn,off)\t\t\t\t\\'
+ print 'fn:\t\t\t\t\t\\'
+ print '\tsethi\t%hi(0xDEADBEEF), %g1 ;\t\t\t\\'
+ print '\tld\t[%g1 + %lo(0xDEADBEEF)], %g1 ;\t\t\\'
+ print '\tld\t[%g1 + (4 * off)], %g5 ;\t\t\\'
+ print '\tjmpl\t%g5, %g0 ;\t\t\t\t\\'
+ print '\tnop'
+ print '#endif'
+ print ''
+ print '#define GL_STUB_ALIAS(fn,alias) fn = alias'
+ print ''
+ print '.text'
+ print '.align 32'
+ print '\t\t.globl __glapi_sparc_icache_flush ; .type __glapi_sparc_icache_flush,#function'
+ print '__glapi_sparc_icache_flush: /* %o0 = insn_addr */'
+ print '\tflush\t%o0'
+ print '\tretl'
+ print '\tnop'
+ print ''
+ print '.data'
+ print '.align 64'
+ print ''
+ return
+
+
+ def printBody(self, api):
+ for f in api.functionIterateByOffset():
+ if f.is_static_entry_point(f.name):
+ name = f.name
+ else:
+ name = "_dispatch_stub_%u" % (f.offset)
+
+ print '\t\t.globl gl%s ; .type gl%s,#function' % (name, name)
+
+ print '\t\t.globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function'
+ print '_mesa_sparc_glapi_begin:'
+ print ''
+
+ for f in api.functionIterateByOffset():
+ if f.is_static_entry_point(f.name):
+ name = f.name
+ else:
+ name = "_dispatch_stub_%u" % (f.offset)
+
+ print '\tGL_STUB(gl%s, _gloffset_%s)' % (name, name)
+
+ print ''
+ print '\t\t.globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function'
+ print '_mesa_sparc_glapi_end:'
+ print ''
+
+
+ for f in api.functionIterateByOffset():
+ for n in f.entry_points:
+ if n != f.name:
+ if f.is_static_entry_point(n):
+ text = '\t.globl gl%s ; .type gl%s,#function ; gl%s = gl%s' % (n, n, n, f.name)
+
+ if f.has_different_protocol(n):
+ print '#ifndef GLX_INDIRECT_RENDERING'
+ print text
+ print '#endif'
+ else:
+ print text
+
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+ mode = "generic"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == '-m':
+ mode = val
+ elif arg == "-f":
+ file_name = val
+
+ if mode == "generic":
+ printer = PrintGenericStubs()
+ else:
+ print "ERROR: Invalid mode \"%s\" specified." % mode
+ show_usage()
+
+ api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+ printer.Print(api)
--- mesa-7.0.3.orig/src/mesa/glapi/gl_XML.py
+++ mesa-7.0.3/src/mesa/glapi/gl_XML.py
@@ -0,0 +1,960 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import libxml2
+import re, sys, string
+import typeexpr
+
+
+def parse_GL_API( file_name, factory = None ):
+ doc = libxml2.readFile( file_name, None, libxml2.XML_PARSE_XINCLUDE + libxml2.XML_PARSE_NOBLANKS + libxml2.XML_PARSE_DTDVALID + libxml2.XML_PARSE_DTDATTR + libxml2.XML_PARSE_DTDLOAD + libxml2.XML_PARSE_NOENT )
+ ret = doc.xincludeProcess()
+
+ if not factory:
+ factory = gl_item_factory()
+
+ api = factory.create_item( "api", None, None )
+ api.process_element( doc )
+
+ # After the XML has been processed, we need to go back and assign
+ # dispatch offsets to the functions that request that their offsets
+ # be assigned by the scripts. Typically this means all functions
+ # that are not part of the ABI.
+
+ for func in api.functionIterateByCategory():
+ if func.assign_offset:
+ func.offset = api.next_offset;
+ api.next_offset += 1
+
+ doc.freeDoc()
+
+ return api
+
+
+def is_attr_true( element, name ):
+ """Read a name value from an element's attributes.
+
+ The value read from the attribute list must be either 'true' or
+ 'false'. If the value is 'false', zero will be returned. If the
+ value is 'true', non-zero will be returned. An exception will be
+ raised for any other value."""
+
+ value = element.nsProp( name, None )
+ if value == "true":
+ return 1
+ elif value == "false":
+ return 0
+ else:
+ raise RuntimeError('Invalid value "%s" for boolean "%s".' % (value, name))
+
+
+class gl_print_base:
+ """Base class of all API pretty-printers.
+
+ In the model-view-controller pattern, this is the view. Any derived
+ class will want to over-ride the printBody, printRealHader, and
+ printRealFooter methods. Some derived classes may want to over-ride
+ printHeader and printFooter, or even Print (though this is unlikely).
+ """
+
+ def __init__(self):
+ # Name of the script that is generating the output file.
+ # Every derived class should set this to the name of its
+ # source file.
+
+ self.name = "a"
+
+
+ # License on the *generated* source file. This may differ
+ # from the license on the script that is generating the file.
+ # Every derived class should set this to some reasonable
+ # value.
+ #
+ # See license.py for an example of a reasonable value.
+
+ self.license = "The license for this file is unspecified."
+
+
+ # The header_tag is the name of the C preprocessor define
+ # used to prevent multiple inclusion. Typically only
+ # generated C header files need this to be set. Setting it
+ # causes code to be generated automatically in printHeader
+ # and printFooter.
+
+ self.header_tag = None
+
+
+ # List of file-private defines that must be undefined at the
+ # end of the file. This can be used in header files to define
+ # names for use in the file, then undefine them at the end of
+ # the header file.
+
+ self.undef_list = []
+ return
+
+
+ def Print(self, api):
+ self.printHeader()
+ self.printBody(api)
+ self.printFooter()
+ return
+
+
+ def printHeader(self):
+ """Print the header associated with all files and call the printRealHeader method."""
+
+ print '/* DO NOT EDIT - This file generated automatically by %s script */' \
+ % (self.name)
+ print ''
+ print '/*'
+ print ' * ' + self.license.replace('\n', '\n * ')
+ print ' */'
+ print ''
+ if self.header_tag:
+ print '#if !defined( %s )' % (self.header_tag)
+ print '# define %s' % (self.header_tag)
+ print ''
+ self.printRealHeader();
+ return
+
+
+ def printFooter(self):
+ """Print the header associated with all files and call the printRealFooter method."""
+
+ self.printRealFooter()
+
+ if self.undef_list:
+ print ''
+ for u in self.undef_list:
+ print "# undef %s" % (u)
+
+ if self.header_tag:
+ print ''
+ print '#endif /* !defined( %s ) */' % (self.header_tag)
+
+
+ def printRealHeader(self):
+ """Print the "real" header for the created file.
+
+ In the base class, this function is empty. All derived
+ classes should over-ride this function."""
+ return
+
+
+ def printRealFooter(self):
+ """Print the "real" footer for the created file.
+
+ In the base class, this function is empty. All derived
+ classes should over-ride this function."""
+ return
+
+
+ def printPure(self):
+ """Conditionally define `PURE' function attribute.
+
+ Conditionally defines a preprocessor macro `PURE' that wraps
+ GCC's `pure' function attribute. The conditional code can be
+ easilly adapted to other compilers that support a similar
+ feature.
+
+ The name is also added to the file's undef_list.
+ """
+ self.undef_list.append("PURE")
+ print """# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define PURE __attribute__((pure))
+# else
+# define PURE
+# endif"""
+ return
+
+
+ def printFastcall(self):
+ """Conditionally define `FASTCALL' function attribute.
+
+ Conditionally defines a preprocessor macro `FASTCALL' that
+ wraps GCC's `fastcall' function attribute. The conditional
+ code can be easilly adapted to other compilers that support a
+ similar feature.
+
+ The name is also added to the file's undef_list.
+ """
+
+ self.undef_list.append("FASTCALL")
+ print """# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+# define FASTCALL __attribute__((fastcall))
+# else
+# define FASTCALL
+# endif"""
+ return
+
+
+ def printVisibility(self, S, s):
+ """Conditionally define visibility function attribute.
+
+ Conditionally defines a preprocessor macro name S that wraps
+ GCC's visibility function attribute. The visibility used is
+ the parameter s. The conditional code can be easilly adapted
+ to other compilers that support a similar feature.
+
+ The name is also added to the file's undef_list.
+ """
+
+ self.undef_list.append(S)
+ print """# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__)
+# define %s __attribute__((visibility("%s")))
+# else
+# define %s
+# endif""" % (S, s, S)
+ return
+
+
+ def printNoinline(self):
+ """Conditionally define `NOINLINE' function attribute.
+
+ Conditionally defines a preprocessor macro `NOINLINE' that
+ wraps GCC's `noinline' function attribute. The conditional
+ code can be easilly adapted to other compilers that support a
+ similar feature.
+
+ The name is also added to the file's undef_list.
+ """
+
+ self.undef_list.append("NOINLINE")
+ print """# if defined(__GNUC__)
+# define NOINLINE __attribute__((noinline))
+# else
+# define NOINLINE
+# endif"""
+ return
+
+
+def real_function_name(element):
+ name = element.nsProp( "name", None )
+ alias = element.nsProp( "alias", None )
+
+ if alias:
+ return alias
+ else:
+ return name
+
+
+def real_category_name(c):
+ if re.compile("[1-9][0-9]*[.][0-9]+").match(c):
+ return "GL_VERSION_" + c.replace(".", "_")
+ else:
+ return c
+
+
+def classify_category(name, number):
+ """Based on the category name and number, select a numerical class for it.
+
+ Categories are divided into four classes numbered 0 through 3. The
+ classes are:
+
+ 0. Core GL versions, sorted by version number.
+ 1. ARB extensions, sorted by extension number.
+ 2. Non-ARB extensions, sorted by extension number.
+ 3. Un-numbered extensions, sorted by extension name.
+ """
+
+ try:
+ core_version = float(name)
+ except Exception,e:
+ core_version = 0.0
+
+ if core_version > 0.0:
+ cat_type = 0
+ key = name
+ elif name.startswith("GL_ARB_") or name.startswith("GLX_ARB_") or name.startswith("WGL_ARB_"):
+ cat_type = 1
+ key = int(number)
+ else:
+ if number != None:
+ cat_type = 2
+ key = int(number)
+ else:
+ cat_type = 3
+ key = name
+
+
+ return [cat_type, key]
+
+
+def create_parameter_string(parameters, include_names):
+ """Create a parameter string from a list of gl_parameters."""
+
+ list = []
+ for p in parameters:
+ if include_names:
+ list.append( p.string() )
+ else:
+ list.append( p.type_string() )
+
+ if len(list) == 0: list = ["void"]
+
+ return string.join(list, ", ")
+
+
+class gl_item:
+ def __init__(self, element, context):
+ self.context = context
+ self.name = element.nsProp( "name", None )
+ self.category = real_category_name( element.parent.nsProp( "name", None ) )
+ return
+
+
+class gl_type( gl_item ):
+ def __init__(self, element, context):
+ gl_item.__init__(self, element, context)
+ self.size = int( element.nsProp( "size", None ), 0 )
+
+ te = typeexpr.type_expression( None )
+ tn = typeexpr.type_node()
+ tn.size = int( element.nsProp( "size", None ), 0 )
+ tn.integer = not is_attr_true( element, "float" )
+ tn.unsigned = is_attr_true( element, "unsigned" )
+ tn.name = "GL" + self.name
+ te.set_base_type_node( tn )
+
+ self.type_expr = te
+ return
+
+
+ def get_type_expression(self):
+ return self.type_expr
+
+
+class gl_enum( gl_item ):
+ def __init__(self, element, context):
+ gl_item.__init__(self, element, context)
+ self.value = int( element.nsProp( "value", None ), 0 )
+
+ temp = element.nsProp( "count", None )
+ if not temp or temp == "?":
+ self.default_count = -1
+ else:
+ try:
+ c = int(temp)
+ except Exception,e:
+ raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp, self.name, n))
+
+ self.default_count = c
+
+ return
+
+
+ def priority(self):
+ """Calculate a 'priority' for this enum name.
+
+ When an enum is looked up by number, there may be many
+ possible names, but only one is the 'prefered' name. The
+ priority is used to select which name is the 'best'.
+
+ Highest precedence is given to core GL name. ARB extension
+ names have the next highest, followed by EXT extension names.
+ Vendor extension names are the lowest.
+ """
+
+ if self.name.endswith( "_BIT" ):
+ bias = 1
+ else:
+ bias = 0
+
+ if self.category.startswith( "GL_VERSION_" ):
+ priority = 0
+ elif self.category.startswith( "GL_ARB_" ):
+ priority = 2
+ elif self.category.startswith( "GL_EXT_" ):
+ priority = 4
+ else:
+ priority = 6
+
+ return priority + bias
+
+
+
+class gl_parameter:
+ def __init__(self, element, context):
+ self.name = element.nsProp( "name", None )
+
+ ts = element.nsProp( "type", None )
+ self.type_expr = typeexpr.type_expression( ts, context )
+
+ temp = element.nsProp( "variable_param", None )
+ if temp:
+ self.count_parameter_list = temp.split( ' ' )
+ else:
+ self.count_parameter_list = []
+
+ # The count tag can be either a numeric string or the name of
+ # a variable. If it is the name of a variable, the int(c)
+ # statement will throw an exception, and the except block will
+ # take over.
+
+ c = element.nsProp( "count", None )
+ try:
+ count = int(c)
+ self.count = count
+ self.counter = None
+ except Exception,e:
+ count = 1
+ self.count = 0
+ self.counter = c
+
+ self.count_scale = int(element.nsProp( "count_scale", None ))
+
+ elements = (count * self.count_scale)
+ if elements == 1:
+ elements = 0
+
+ #if ts == "GLdouble":
+ # print '/* stack size -> %s = %u (before)*/' % (self.name, self.type_expr.get_stack_size())
+ # print '/* # elements = %u */' % (elements)
+ self.type_expr.set_elements( elements )
+ #if ts == "GLdouble":
+ # print '/* stack size -> %s = %u (after) */' % (self.name, self.type_expr.get_stack_size())
+
+ self.is_client_only = is_attr_true( element, 'client_only' )
+ self.is_counter = is_attr_true( element, 'counter' )
+ self.is_output = is_attr_true( element, 'output' )
+
+
+ # Pixel data has special parameters.
+
+ self.width = element.nsProp('img_width', None)
+ self.height = element.nsProp('img_height', None)
+ self.depth = element.nsProp('img_depth', None)
+ self.extent = element.nsProp('img_extent', None)
+
+ self.img_xoff = element.nsProp('img_xoff', None)
+ self.img_yoff = element.nsProp('img_yoff', None)
+ self.img_zoff = element.nsProp('img_zoff', None)
+ self.img_woff = element.nsProp('img_woff', None)
+
+ self.img_format = element.nsProp('img_format', None)
+ self.img_type = element.nsProp('img_type', None)
+ self.img_target = element.nsProp('img_target', None)
+
+ self.img_pad_dimensions = is_attr_true( element, 'img_pad_dimensions' )
+ self.img_null_flag = is_attr_true( element, 'img_null_flag' )
+ self.img_send_null = is_attr_true( element, 'img_send_null' )
+
+ return
+
+
+ def compatible(self, other):
+ return 1
+
+
+ def is_array(self):
+ return self.is_pointer()
+
+
+ def is_pointer(self):
+ return self.type_expr.is_pointer()
+
+
+ def is_image(self):
+ if self.width:
+ return 1
+ else:
+ return 0
+
+
+ def is_variable_length(self):
+ return len(self.count_parameter_list) or self.counter
+
+
+ def is_64_bit(self):
+ count = self.type_expr.get_element_count()
+ if count:
+ if (self.size() / count) == 8:
+ return 1
+ else:
+ if self.size() == 8:
+ return 1
+
+ return 0
+
+
+ def string(self):
+ return self.type_expr.original_string + " " + self.name
+
+
+ def type_string(self):
+ return self.type_expr.original_string
+
+
+ def get_base_type_string(self):
+ return self.type_expr.get_base_name()
+
+
+ def get_dimensions(self):
+ if not self.width:
+ return [ 0, "0", "0", "0", "0" ]
+
+ dim = 1
+ w = self.width
+ h = "1"
+ d = "1"
+ e = "1"
+
+ if self.height:
+ dim = 2
+ h = self.height
+
+ if self.depth:
+ dim = 3
+ d = self.depth
+
+ if self.extent:
+ dim = 4
+ e = self.extent
+
+ return [ dim, w, h, d, e ]
+
+
+ def get_stack_size(self):
+ return self.type_expr.get_stack_size()
+
+
+ def size(self):
+ if self.is_image():
+ return 0
+ else:
+ return self.type_expr.get_element_size()
+
+
+ def get_element_count(self):
+ c = self.type_expr.get_element_count()
+ if c == 0:
+ return 1
+
+ return c
+
+
+ def size_string(self, use_parens = 1):
+ s = self.size()
+ if self.counter or self.count_parameter_list:
+ list = [ "compsize" ]
+
+ if self.counter and self.count_parameter_list:
+ list.append( self.counter )
+ elif self.counter:
+ list = [ self.counter ]
+
+ if s > 1:
+ list.append( str(s) )
+
+ if len(list) > 1 and use_parens :
+ return "(%s)" % (string.join(list, " * "))
+ else:
+ return string.join(list, " * ")
+
+ elif self.is_image():
+ return "compsize"
+ else:
+ return str(s)
+
+
+ def format_string(self):
+ if self.type_expr.original_string == "GLenum":
+ return "0x%x"
+ else:
+ return self.type_expr.format_string()
+
+
+
+class gl_function( gl_item ):
+ def __init__(self, element, context):
+ self.context = context
+ self.name = None
+
+ self.entry_points = []
+ self.return_type = "void"
+ self.parameters = []
+ self.offset = -1
+ self.initialized = 0
+ self.images = []
+
+ self.assign_offset = 0
+
+ self.static_entry_points = []
+
+ # Track the parameter string (for the function prototype)
+ # for each entry-point. This is done because some functions
+ # change their prototype slightly when promoted from extension
+ # to ARB extension to core. glTexImage3DEXT and glTexImage3D
+ # are good examples of this. Scripts that need to generate
+ # code for these differing aliases need to real prototype
+ # for each entry-point. Otherwise, they may generate code
+ # that won't compile.
+
+ self.parameter_strings = {}
+
+ self.process_element( element )
+
+ return
+
+
+ def process_element(self, element):
+ name = element.nsProp( "name", None )
+ alias = element.nsProp( "alias", None )
+
+ if is_attr_true(element, "static_dispatch"):
+ self.static_entry_points.append(name)
+
+ self.entry_points.append( name )
+ if alias:
+ true_name = alias
+ else:
+ true_name = name
+
+ # Only try to set the offset when a non-alias
+ # entry-point is being processes.
+
+ offset = element.nsProp( "offset", None )
+ if offset:
+ try:
+ o = int( offset )
+ self.offset = o
+ except Exception, e:
+ self.offset = -1
+ if offset == "assign":
+ self.assign_offset = 1
+
+
+ if not self.name:
+ self.name = true_name
+ elif self.name != true_name:
+ raise RuntimeError("Function true name redefined. Was %s, now %s." % (self.name, true_name))
+
+
+ # There are two possible cases. The first time an entry-point
+ # with data is seen, self.initialized will be 0. On that
+ # pass, we just fill in the data. The next time an
+ # entry-point with data is seen, self.initialized will be 1.
+ # On that pass we have to make that the new values match the
+ # valuse from the previous entry-point.
+
+ parameters = []
+ return_type = "void"
+ child = element.children
+ while child:
+ if child.type == "element":
+ if child.name == "return":
+ return_type = child.nsProp( "type", None )
+ elif child.name == "param":
+ param = self.context.factory.create_item( "parameter", child, self.context)
+ parameters.append( param )
+
+ child = child.next
+
+
+ if self.initialized:
+ if self.return_type != return_type:
+ raise RuntimeError( "Return type changed in %s. Was %s, now %s." % (name, self.return_type, return_type))
+
+ if len(parameters) != len(self.parameters):
+ raise RuntimeError( "Parameter count mismatch in %s. Was %d, now %d." % (name, len(self.parameters), len(parameters)))
+
+ for j in range(0, len(parameters)):
+ p1 = parameters[j]
+ p2 = self.parameters[j]
+ if not p1.compatible( p2 ):
+ raise RuntimeError( 'Parameter type mismatch in %s. "%s" was "%s", now "%s".' % (name, p2.name, p2.type_expr.original_string, p1.type_expr.original_string))
+
+
+ if true_name == name or not self.initialized:
+ self.return_type = return_type
+ self.parameters = parameters
+
+ for param in self.parameters:
+ if param.is_image():
+ self.images.append( param )
+
+ if element.children:
+ self.initialized = 1
+ self.parameter_strings[name] = create_parameter_string(parameters, 1)
+ else:
+ self.parameter_strings[name] = None
+
+ return
+
+
+ def get_images(self):
+ """Return potentially empty list of input images."""
+ return self.images
+
+
+ def parameterIterator(self):
+ return self.parameters.__iter__();
+
+
+ def get_parameter_string(self, entrypoint = None):
+ if entrypoint:
+ s = self.parameter_strings[ entrypoint ]
+ if s:
+ return s
+
+ return create_parameter_string( self.parameters, 1 )
+
+ def get_called_parameter_string(self):
+ p_string = ""
+ comma = ""
+
+ for p in self.parameterIterator():
+ p_string = p_string + comma + p.name
+ comma = ", "
+
+ return p_string
+
+
+ def is_static_entry_point(self, name):
+ return name in self.static_entry_points
+
+ def dispatch_name(self):
+ if self.name in self.static_entry_points:
+ return self.name
+ else:
+ return "_dispatch_stub_%u" % (self.offset)
+
+ def static_name(self, name):
+ if name in self.static_entry_points:
+ return name
+ else:
+ return "_dispatch_stub_%u" % (self.offset)
+
+
+class gl_item_factory:
+ """Factory to create objects derived from gl_item."""
+
+ def create_item(self, item_name, element, context):
+ if item_name == "function":
+ return gl_function(element, context)
+ if item_name == "type":
+ return gl_type(element, context)
+ elif item_name == "enum":
+ return gl_enum(element, context)
+ elif item_name == "parameter":
+ return gl_parameter(element, context)
+ elif item_name == "api":
+ return gl_api(self)
+ else:
+ return None
+
+
+class gl_api:
+ def __init__(self, factory):
+ self.functions_by_name = {}
+ self.enums_by_name = {}
+ self.types_by_name = {}
+
+ self.category_dict = {}
+ self.categories = [{}, {}, {}, {}]
+
+ self.factory = factory
+
+ self.next_offset = 0
+
+ typeexpr.create_initial_types()
+ return
+
+
+ def process_element(self, doc):
+ element = doc.children
+ while element.type != "element" or element.name != "OpenGLAPI":
+ element = element.next
+
+ if element:
+ self.process_OpenGLAPI(element)
+ return
+
+
+ def process_OpenGLAPI(self, element):
+ child = element.children
+ while child:
+ if child.type == "element":
+ if child.name == "category":
+ self.process_category( child )
+ elif child.name == "OpenGLAPI":
+ self.process_OpenGLAPI( child )
+
+ child = child.next
+
+ return
+
+
+ def process_category(self, cat):
+ cat_name = cat.nsProp( "name", None )
+ cat_number = cat.nsProp( "number", None )
+
+ [cat_type, key] = classify_category(cat_name, cat_number)
+ self.categories[cat_type][key] = [cat_name, cat_number]
+
+ child = cat.children
+ while child:
+ if child.type == "element":
+ if child.name == "function":
+ func_name = real_function_name( child )
+
+ temp_name = child.nsProp( "name", None )
+ self.category_dict[ temp_name ] = [cat_name, cat_number]
+
+ if self.functions_by_name.has_key( func_name ):
+ func = self.functions_by_name[ func_name ]
+ func.process_element( child )
+ else:
+ func = self.factory.create_item( "function", child, self )
+ self.functions_by_name[ func_name ] = func
+
+ if func.offset >= self.next_offset:
+ self.next_offset = func.offset + 1
+
+
+ elif child.name == "enum":
+ enum = self.factory.create_item( "enum", child, self )
+ self.enums_by_name[ enum.name ] = enum
+ elif child.name == "type":
+ t = self.factory.create_item( "type", child, self )
+ self.types_by_name[ "GL" + t.name ] = t
+
+
+ child = child.next
+
+ return
+
+
+ def functionIterateByCategory(self, cat = None):
+ """Iterate over functions by category.
+
+ If cat is None, all known functions are iterated in category
+ order. See classify_category for details of the ordering.
+ Within a category, functions are sorted by name. If cat is
+ not None, then only functions in that category are iterated.
+ """
+ lists = [{}, {}, {}, {}]
+
+ for func in self.functionIterateAll():
+ [cat_name, cat_number] = self.category_dict[func.name]
+
+ if (cat == None) or (cat == cat_name):
+ [func_cat_type, key] = classify_category(cat_name, cat_number)
+
+ if not lists[func_cat_type].has_key(key):
+ lists[func_cat_type][key] = {}
+
+ lists[func_cat_type][key][func.name] = func
+
+
+ functions = []
+ for func_cat_type in range(0,4):
+ keys = lists[func_cat_type].keys()
+ keys.sort()
+
+ for key in keys:
+ names = lists[func_cat_type][key].keys()
+ names.sort()
+
+ for name in names:
+ functions.append(lists[func_cat_type][key][name])
+
+ return functions.__iter__()
+
+
+ def functionIterateByOffset(self):
+ max_offset = -1
+ for func in self.functions_by_name.itervalues():
+ if func.offset > max_offset:
+ max_offset = func.offset
+
+
+ temp = [None for i in range(0, max_offset + 1)]
+ for func in self.functions_by_name.itervalues():
+ if func.offset != -1:
+ temp[ func.offset ] = func
+
+
+ list = []
+ for i in range(0, max_offset + 1):
+ if temp[i]:
+ list.append(temp[i])
+
+ return list.__iter__();
+
+
+ def functionIterateAll(self):
+ return self.functions_by_name.itervalues()
+
+
+ def enumIterateByName(self):
+ keys = self.enums_by_name.keys()
+ keys.sort()
+
+ list = []
+ for enum in keys:
+ list.append( self.enums_by_name[ enum ] )
+
+ return list.__iter__()
+
+
+ def categoryIterate(self):
+ """Iterate over categories.
+
+ Iterate over all known categories in the order specified by
+ classify_category. Each iterated value is a tuple of the
+ name and number (which may be None) of the category.
+ """
+
+ list = []
+ for cat_type in range(0,4):
+ keys = self.categories[cat_type].keys()
+ keys.sort()
+
+ for key in keys:
+ list.append(self.categories[cat_type][key])
+
+ return list.__iter__()
+
+
+ def get_category_for_name( self, name ):
+ if self.category_dict.has_key(name):
+ return self.category_dict[name]
+ else:
+ return ["", None]
+
+
+ def typeIterate(self):
+ return self.types_by_name.itervalues()
+
+
+ def find_type( self, type_name ):
+ if type_name in self.types_by_name:
+ return self.types_by_name[ type_name ].type_expr
+ else:
+ print "Unable to find base type matching \"%s\"." % (type_name)
+ return None
--- mesa-7.0.3.orig/src/mesa/glapi/gl_and_glX_API.xml
+++ mesa-7.0.3/src/mesa/glapi/gl_and_glX_API.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
--- mesa-7.0.3.orig/src/mesa/glapi/gl_apitemp.py
+++ mesa-7.0.3/src/mesa/glapi/gl_apitemp.py
@@ -0,0 +1,250 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML, glX_XML
+import license
+import sys, getopt
+
+class PrintGlOffsets(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "gl_apitemp.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+
+ self.undef_list.append( "KEYWORD1" )
+ self.undef_list.append( "KEYWORD1_ALT" )
+ self.undef_list.append( "KEYWORD2" )
+ self.undef_list.append( "NAME" )
+ self.undef_list.append( "DISPATCH" )
+ self.undef_list.append( "RETURN_DISPATCH" )
+ self.undef_list.append( "DISPATCH_TABLE_NAME" )
+ self.undef_list.append( "UNUSED_TABLE_NAME" )
+ self.undef_list.append( "TABLE_ENTRY" )
+
+
+ def printFunction(self, f, name):
+ p_string = ""
+ o_string = ""
+ t_string = ""
+ comma = ""
+
+ if f.is_static_entry_point(name):
+ keyword = "KEYWORD1"
+ else:
+ keyword = "KEYWORD1_ALT"
+
+ n = f.static_name(name)
+
+ for p in f.parameterIterator():
+ if p.is_pointer():
+ cast = "(const void *) "
+ else:
+ cast = ""
+
+ t_string = t_string + comma + p.format_string()
+ p_string = p_string + comma + p.name
+ o_string = o_string + comma + cast + p.name
+ comma = ", "
+
+
+ if f.return_type != 'void':
+ dispatch = "RETURN_DISPATCH"
+ else:
+ dispatch = "DISPATCH"
+
+ if f.has_different_protocol(name):
+ print '#ifndef GLX_INDIRECT_RENDERING'
+
+ if not f.is_static_entry_point(name):
+ print '%s %s KEYWORD2 NAME(%s)(%s);' % (keyword, f.return_type, n, f.get_parameter_string(name))
+ print ''
+
+ print '%s %s KEYWORD2 NAME(%s)(%s)' % (keyword, f.return_type, n, f.get_parameter_string(name))
+ print '{'
+ if p_string == "":
+ print ' %s(%s, (), (F, "gl%s();\\n"));' \
+ % (dispatch, f.name, name)
+ else:
+ print ' %s(%s, (%s), (F, "gl%s(%s);\\n", %s));' \
+ % (dispatch, f.name, p_string, name, t_string, o_string)
+ print '}'
+ if f.has_different_protocol(name):
+ print '#endif /* GLX_INDIRECT_RENDERING */'
+ print ''
+ return
+
+ def printRealHeader(self):
+ print ''
+ self.printVisibility( "HIDDEN", "hidden" )
+ print """
+/*
+ * This file is a template which generates the OpenGL API entry point
+ * functions. It should be included by a .c file which first defines
+ * the following macros:
+ * KEYWORD1 - usually nothing, but might be __declspec(dllexport) on Win32
+ * KEYWORD2 - usually nothing, but might be __stdcall on Win32
+ * NAME(n) - builds the final function name (usually add "gl" prefix)
+ * DISPATCH(func, args, msg) - code to do dispatch of named function.
+ * msg is a printf-style debug message.
+ * RETURN_DISPATCH(func, args, msg) - code to do dispatch with a return value
+ *
+ * Here is an example which generates the usual OpenGL functions:
+ * #define KEYWORD1
+ * #define KEYWORD2
+ * #define NAME(func) gl##func
+ * #define DISPATCH(func, args, msg) \\
+ * struct _glapi_table *dispatch = CurrentDispatch; \\
+ * (*dispatch->func) args
+ * #define RETURN DISPATCH(func, args, msg) \\
+ * struct _glapi_table *dispatch = CurrentDispatch; \\
+ * return (*dispatch->func) args
+ *
+ */
+
+
+#if defined( NAME )
+#ifndef KEYWORD1
+#define KEYWORD1
+#endif
+
+#ifndef KEYWORD1_ALT
+#define KEYWORD1_ALT HIDDEN
+#endif
+
+#ifndef KEYWORD2
+#define KEYWORD2
+#endif
+
+#ifndef DISPATCH
+#error DISPATCH must be defined
+#endif
+
+#ifndef RETURN_DISPATCH
+#error RETURN_DISPATCH must be defined
+#endif
+
+"""
+ return
+
+
+
+ def printInitDispatch(self, api):
+ print """
+#endif /* defined( NAME ) */
+
+/*
+ * This is how a dispatch table can be initialized with all the functions
+ * we generated above.
+ */
+#ifdef DISPATCH_TABLE_NAME
+
+#ifndef TABLE_ENTRY
+#error TABLE_ENTRY must be defined
+#endif
+
+static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
+ for f in api.functionIterateByOffset():
+ print ' TABLE_ENTRY(%s),' % (f.dispatch_name())
+
+ print ' /* A whole bunch of no-op functions. These might be called'
+ print ' * when someone tries to call a dynamically-registered'
+ print ' * extension function without a current rendering context.'
+ print ' */'
+ for i in range(1, 100):
+ print ' TABLE_ENTRY(Unused),'
+
+ print '};'
+ print '#endif /* DISPATCH_TABLE_NAME */'
+ print ''
+ return
+
+
+ def printAliasedTable(self, api):
+ print """
+/*
+ * This is just used to silence compiler warnings.
+ * We list the functions which are not otherwise used.
+ */
+#ifdef UNUSED_TABLE_NAME
+static _glapi_proc UNUSED_TABLE_NAME[] = {"""
+
+ for f in api.functionIterateByOffset():
+ for n in f.entry_points:
+ if n != f.name:
+ if f.is_static_entry_point(n):
+ text = ' TABLE_ENTRY(%s),' % (n)
+
+ if f.has_different_protocol(n):
+ print '#ifndef GLX_INDIRECT_RENDERING'
+ print text
+ print '#endif'
+ else:
+ print text
+ print '};'
+ print '#endif /*UNUSED_TABLE_NAME*/'
+ print ''
+ return
+
+
+ def printBody(self, api):
+ for func in api.functionIterateByOffset():
+ got_stub = 0
+ for n in func.entry_points:
+ if func.is_static_entry_point(n):
+ self.printFunction(func, n)
+ elif not got_stub:
+ self.printFunction(func, n)
+ got_stub = 1
+
+ self.printInitDispatch(api)
+ self.printAliasedTable(api)
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+
+ api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+
+ printer = PrintGlOffsets()
+ printer.Print(api)
--- mesa-7.0.3.orig/src/mesa/glapi/gl_enums.py
+++ mesa-7.0.3/src/mesa/glapi/gl_enums.py
@@ -0,0 +1,217 @@
+#!/usr/bin/python2
+# -*- Mode: Python; py-indent-offset: 8 -*-
+
+# (C) Copyright Zack Rusin 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Zack Rusin
+
+import license
+import gl_XML
+import sys, getopt
+
+class PrintGlEnums(gl_XML.gl_print_base):
+
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "gl_enums.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2005 Brian Paul All Rights Reserved.""", "BRIAN PAUL")
+ self.enum_table = {}
+
+
+ def printRealHeader(self):
+ print '#include "glheader.h"'
+ print '#include "enums.h"'
+ print '#include "imports.h"'
+ print ''
+ print 'typedef struct {'
+ print ' size_t offset;'
+ print ' int n;'
+ print '} enum_elt;'
+ print ''
+ return
+
+ def print_code(self):
+ print """
+#define Elements(x) sizeof(x)/sizeof(*x)
+
+typedef int (*cfunc)(const void *, const void *);
+
+/**
+ * Compare a key name to an element in the \c all_enums array.
+ *
+ * \c bsearch always passes the key as the first parameter and the pointer
+ * to the array element as the second parameter. We can elimiate some
+ * extra work by taking advantage of that fact.
+ *
+ * \param a Pointer to the desired enum name.
+ * \param b Pointer to an element of the \c all_enums array.
+ */
+static int compar_name( const char *a, const enum_elt *b )
+{
+ return _mesa_strcmp( a, & enum_string_table[ b->offset ] );
+}
+
+/**
+ * Compare a key enum value to an element in the \c all_enums array.
+ *
+ * \c bsearch always passes the key as the first parameter and the pointer
+ * to the array element as the second parameter. We can elimiate some
+ * extra work by taking advantage of that fact.
+ *
+ * \param a Pointer to the desired enum name.
+ * \param b Pointer to an index into the \c all_enums array.
+ */
+static int compar_nr( const int *a, const unsigned *b )
+{
+ return a[0] - all_enums[*b].n;
+}
+
+
+static char token_tmp[20];
+
+const char *_mesa_lookup_enum_by_nr( int nr )
+{
+ unsigned * i;
+
+ i = (unsigned *)bsearch( & nr, reduced_enums, Elements(reduced_enums),
+ sizeof(reduced_enums[0]), (cfunc) compar_nr );
+
+ if ( i != NULL ) {
+ return & enum_string_table[ all_enums[ *i ].offset ];
+ }
+ else {
+ /* this is not re-entrant safe, no big deal here */
+ _mesa_sprintf(token_tmp, "0x%x", nr);
+ return token_tmp;
+ }
+}
+
+int _mesa_lookup_enum_by_name( const char *symbol )
+{
+ enum_elt * f = NULL;
+
+ if ( symbol != NULL ) {
+ f = (enum_elt *)bsearch( symbol, all_enums, Elements(all_enums),
+ sizeof( enum_elt ), (cfunc) compar_name );
+ }
+
+ return (f != NULL) ? f->n : -1;
+}
+
+"""
+ return
+
+
+ def printBody(self, api):
+ self.process_enums( api )
+
+ keys = self.enum_table.keys()
+ keys.sort()
+
+ name_table = []
+ enum_table = {}
+
+ for enum in keys:
+ low_pri = 9
+ for [name, pri] in self.enum_table[ enum ]:
+ name_table.append( [name, enum] )
+
+ if pri < low_pri:
+ low_pri = pri
+ enum_table[enum] = name
+
+
+ name_table.sort()
+
+ string_offsets = {}
+ i = 0;
+ print 'LONGSTRING static const char enum_string_table[] = '
+ for [name, enum] in name_table:
+ print ' "%s\\0"' % (name)
+ string_offsets[ name ] = i
+ i += len(name) + 1
+
+ print ' ;'
+ print ''
+
+
+ print 'static const enum_elt all_enums[%u] =' % (len(name_table))
+ print '{'
+ for [name, enum] in name_table:
+ print ' { %5u, 0x%08X }, /* %s */' % (string_offsets[name], enum, name)
+ print '};'
+ print ''
+
+ print 'static const unsigned reduced_enums[%u] =' % (len(keys))
+ print '{'
+ for enum in keys:
+ name = enum_table[ enum ]
+ if [name, enum] not in name_table:
+ print ' /* Error! %s, 0x%04x */ 0,' % (name, enum)
+ else:
+ i = name_table.index( [name, enum] )
+
+ print ' %4u, /* %s */' % (i, name)
+ print '};'
+
+
+ self.print_code()
+ return
+
+
+ def process_enums(self, api):
+ self.enum_table = {}
+
+ for obj in api.enumIterateByName():
+ if obj.value not in self.enum_table:
+ self.enum_table[ obj.value ] = []
+
+
+ name = "GL_" + obj.name
+ priority = obj.priority()
+ self.enum_table[ obj.value ].append( [name, priority] )
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+
+ api = gl_XML.parse_GL_API( file_name )
+
+ printer = PrintGlEnums()
+ printer.Print( api )
--- mesa-7.0.3.orig/src/mesa/glapi/gl_offsets.py
+++ mesa-7.0.3/src/mesa/glapi/gl_offsets.py
@@ -0,0 +1,103 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML
+import license
+import sys, getopt
+
+class PrintGlOffsets(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "gl_offsets.py (from Mesa)"
+ self.header_tag = '_GLAPI_OFFSETS_H_'
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+ return
+
+ def printBody(self, api):
+ abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
+
+ functions = []
+ abi_functions = []
+ count = 0
+ for f in api.functionIterateByOffset():
+ [category, num] = api.get_category_for_name( f.name )
+ if category not in abi:
+ functions.append( [f, count] )
+ count += 1
+ else:
+ abi_functions.append( f )
+
+
+ for f in abi_functions:
+ print '#define _gloffset_%s %d' % (f.name, f.offset)
+ last_static = f.offset
+
+ print ''
+ print '#if !defined(IN_DRI_DRIVER)'
+ print ''
+
+ for [f, index] in functions:
+ print '#define _gloffset_%s %d' % (f.name, f.offset)
+
+ print '#define _gloffset_FIRST_DYNAMIC %d' % (api.next_offset)
+
+ print ''
+ print '#else'
+ print ''
+
+ for [f, index] in functions:
+ print '#define _gloffset_%s driDispatchRemapTable[%s_remap_index]' % (f.name, f.name)
+
+ print ''
+ print '#endif /* !defined(IN_DRI_DRIVER) */'
+
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+
+ api = gl_XML.parse_GL_API( file_name )
+
+ printer = PrintGlOffsets()
+ printer.Print( api )
--- mesa-7.0.3.orig/src/mesa/glapi/gl_procs.py
+++ mesa-7.0.3/src/mesa/glapi/gl_procs.py
@@ -0,0 +1,189 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import license
+import gl_XML, glX_XML
+import sys, getopt
+
+class PrintGlProcs(gl_XML.gl_print_base):
+ def __init__(self, long_strings):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.long_strings = long_strings
+ self.name = "gl_procs.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004, 2006""", "BRIAN PAUL, IBM")
+
+
+ def printRealHeader(self):
+ print """
+/* This file is only included by glapi.c and is used for
+ * the GetProcAddress() function
+ */
+
+typedef struct {
+ GLint Name_offset;
+#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)
+ _glapi_proc Address;
+#endif
+ GLuint Offset;
+} glprocs_table_t;
+
+#if !defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , o }
+#elif defined(NEED_FUNCTION_POINTER) && !defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f1 , o }
+#elif defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f2 , o }
+#elif !defined(NEED_FUNCTION_POINTER) && defined(GLX_INDIRECT_RENDERING)
+# define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o }
+#endif
+
+"""
+ return
+
+ def printRealFooter(self):
+ print ''
+ print '#undef NAME_FUNC_OFFSET'
+ return
+
+ def printFunctionString(self, name):
+ if self.long_strings:
+ print ' "gl%s\\0"' % (name)
+ else:
+ print " 'g','l',",
+ for c in name:
+ print "'%s'," % (c),
+
+ print "'\\0',"
+
+
+ def printBody(self, api):
+ print ''
+ if self.long_strings:
+ print 'static const char gl_string_table[] ='
+ else:
+ print 'static const char gl_string_table[] = {'
+
+ base_offset = 0
+ table = []
+ for func in api.functionIterateByOffset():
+ name = func.dispatch_name()
+ self.printFunctionString(func.name)
+ table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.name))
+
+ # The length of the function's name, plus 2 for "gl",
+ # plus 1 for the NUL.
+
+ base_offset += len(func.name) + 3
+
+
+ for func in api.functionIterateByOffset():
+ for n in func.entry_points:
+ if n != func.name:
+ name = func.dispatch_name()
+ self.printFunctionString( n )
+
+ if func.has_different_protocol(n):
+ alt_name = "gl" + func.static_glx_name(n)
+ table.append((base_offset, "gl" + name, alt_name, alt_name, func.name))
+ else:
+ table.append((base_offset, "gl" + name, "gl" + name, "NULL", func.name))
+
+ base_offset += len(n) + 3
+
+
+ if self.long_strings:
+ print ' ;'
+ else:
+ print '};'
+
+ print ''
+ print ''
+ print "#ifdef USE_MGL_NAMESPACE"
+ for func in api.functionIterateByOffset():
+ for n in func.entry_points:
+ if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)):
+ print '#define gl_dispatch_stub_%u mgl_dispatch_stub_%u' % (func.offset, func.offset)
+ break
+ print "#endif /* USE_MGL_NAMESPACE */"
+ print ''
+ print ''
+ print '/* FIXME: Having these (incorrect) prototypes here is ugly. */'
+ print '#if defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING)'
+ for func in api.functionIterateByOffset():
+ for n in func.entry_points:
+ if (not func.is_static_entry_point(func.name)) or (func.has_different_protocol(n) and not func.is_static_entry_point(n)):
+ print 'extern void gl_dispatch_stub_%u(void);' % (func.offset)
+ break
+
+ print '#endif /* defined(NEED_FUNCTION_POINTER) || defined(GLX_INDIRECT_RENDERING) */'
+
+ print ''
+ print 'static const glprocs_table_t static_functions[] = {'
+
+ for info in table:
+ print ' NAME_FUNC_OFFSET(%5u, %s, %s, %s, _gloffset_%s),' % info
+
+ print ' NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)'
+ print '};'
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m mode]" % sys.argv[0]
+ print "mode can be one of:"
+ print " long - Create code for compilers that can handle very"
+ print " long string constants. (default)"
+ print " short - Create code for compilers that can only handle"
+ print " ANSI C89 string constants."
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
+ except Exception,e:
+ show_usage()
+
+ long_string = 1
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+ elif arg == "-m":
+ if val == "short":
+ long_string = 0
+ elif val == "long":
+ long_string = 1
+ else:
+ show_usage()
+
+ api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+ printer = PrintGlProcs(long_string)
+ printer.Print(api)
--- mesa-7.0.3.orig/src/mesa/glapi/gl_table.py
+++ mesa-7.0.3/src/mesa/glapi/gl_table.py
@@ -0,0 +1,198 @@
+#!/usr/bin/python2
+
+# (C) Copyright IBM Corporation 2004
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import gl_XML
+import license
+import sys, getopt
+
+class PrintGlTable(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.header_tag = '_GLAPI_TABLE_H_'
+ self.name = "gl_table.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
+ return
+
+
+ def printBody(self, api):
+ for f in api.functionIterateByOffset():
+ arg_string = f.get_parameter_string()
+ print ' %s (GLAPIENTRYP %s)(%s); /* %d */' % (f.return_type, f.name, arg_string, f.offset)
+
+
+ def printRealHeader(self):
+ print '#ifndef GLAPIENTRYP'
+ print '# ifndef GLAPIENTRY'
+ print '# define GLAPIENTRY'
+ print '# endif'
+ print ''
+ print '# define GLAPIENTRYP GLAPIENTRY *'
+ print '#endif'
+ print ''
+ print 'typedef void (*_glapi_proc)(void); /* generic function pointer */'
+ print ''
+ print 'struct _glapi_table'
+ print '{'
+ return
+
+
+ def printRealFooter(self):
+ print '};'
+ return
+
+
+class PrintRemapTable(gl_XML.gl_print_base):
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.header_tag = '_DISPATCH_H_'
+ self.name = "gl_table.py (from Mesa)"
+ self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
+ return
+
+
+ def printRealHeader(self):
+ print """/**
+ * \\file dispatch.h
+ * Macros for handling GL dispatch tables.
+ *
+ * For each known GL function, there are 3 macros in this file. The first
+ * macro is named CALL_FuncName and is used to call that GL function using
+ * the specified dispatch table. The other 2 macros, called GET_FuncName
+ * can SET_FuncName, are used to get and set the dispatch pointer for the
+ * named function in the specified dispatch table.
+ */
+"""
+
+ return
+
+ def printBody(self, api):
+ print '#define CALL_by_offset(disp, cast, offset, parameters) \\'
+ print ' (*(cast (GET_by_offset(disp, offset)))) parameters'
+ print '#define GET_by_offset(disp, offset) \\'
+ print ' (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL'
+ print '#define SET_by_offset(disp, offset, fn) \\'
+ print ' do { \\'
+ print ' if ( (offset) < 0 ) { \\'
+ print ' /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\\n", */ \\'
+ print ' /* __func__, __LINE__, disp, offset, # fn); */ \\'
+ print ' /* abort(); */ \\'
+ print ' } \\'
+ print ' else { \\'
+ print ' ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \\'
+ print ' } \\'
+ print ' } while(0)'
+ print ''
+
+ abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ]
+
+ functions = []
+ abi_functions = []
+ count = 0
+ for f in api.functionIterateByOffset():
+ [category, num] = api.get_category_for_name( f.name )
+ if category not in abi:
+ functions.append( [f, count] )
+ count += 1
+ else:
+ abi_functions.append( f )
+
+
+ for f in abi_functions:
+ print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name)
+ print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name)
+ print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name)
+
+
+ print ''
+ print '#if !defined(IN_DRI_DRIVER)'
+ print ''
+
+ for [f, index] in functions:
+ print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name)
+ print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name)
+ print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name)
+
+ print ''
+ print '#else'
+ print ''
+ print '#define driDispatchRemapTable_size %u' % (count)
+ print 'extern int driDispatchRemapTable[ driDispatchRemapTable_size ];'
+ print ''
+
+ for [f, index] in functions:
+ print '#define %s_remap_index %u' % (f.name, index)
+
+ print ''
+
+ for [f, index] in functions:
+ arg_string = gl_XML.create_parameter_string( f.parameters, 0 )
+ cast = '%s (GLAPIENTRYP)(%s)' % (f.return_type, arg_string)
+
+ print '#define CALL_%s(disp, parameters) CALL_by_offset(disp, (%s), driDispatchRemapTable[%s_remap_index], parameters)' % (f.name, cast, f.name)
+ print '#define GET_%s(disp) GET_by_offset(disp, driDispatchRemapTable[%s_remap_index])' % (f.name, f.name)
+ print '#define SET_%s(disp, fn) SET_by_offset(disp, driDispatchRemapTable[%s_remap_index], fn)' % (f.name, f.name)
+
+
+ print ''
+ print '#endif /* !defined(IN_DRI_DRIVER) */'
+ return
+
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m mode]" % sys.argv[0]
+ print " -m mode Mode can be 'table' or 'remap_table'."
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "f:m:")
+ except Exception,e:
+ show_usage()
+
+ mode = "table"
+ for (arg,val) in args:
+ if arg == "-f":
+ file_name = val
+ elif arg == "-m":
+ mode = val
+
+ if mode == "table":
+ printer = PrintGlTable()
+ elif mode == "remap_table":
+ printer = PrintRemapTable()
+ else:
+ show_usage()
+
+ api = gl_XML.parse_GL_API( file_name )
+
+ printer.Print( api )
--- mesa-7.0.3.orig/src/mesa/glapi/gl_x86-64_asm.py
+++ mesa-7.0.3/src/mesa/glapi/gl_x86-64_asm.py
@@ -0,0 +1,334 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import license
+import gl_XML, glX_XML
+import sys, getopt, copy
+
+def should_use_push(registers):
+ for [reg, offset] in registers:
+ if reg[1:4] == "xmm":
+ return 0
+
+ N = len(registers)
+ return (N & 1) != 0
+
+
+def local_size(registers):
+ # The x86-64 ABI says "the value (%rsp - 8) is always a multiple of
+ # 16 when control is transfered to the function entry point." This
+ # means that the local stack usage must be (16*N)+8 for some value
+ # of N. (16*N)+8 = (8*(2N))+8 = 8*(2N+1). As long as N is odd, we
+ # meet this requirement.
+
+ N = (len(registers) | 1)
+ return 8*N
+
+
+def save_all_regs(registers):
+ adjust_stack = 0
+ if not should_use_push(registers):
+ adjust_stack = local_size(registers)
+ print '\tsubq\t$%u, %%rsp' % (adjust_stack)
+
+ for [reg, stack_offset] in registers:
+ save_reg( reg, stack_offset, adjust_stack )
+ return
+
+
+def restore_all_regs(registers):
+ adjust_stack = 0
+ if not should_use_push(registers):
+ adjust_stack = local_size(registers)
+
+ temp = copy.deepcopy(registers)
+ while len(temp):
+ [reg, stack_offset] = temp.pop()
+ restore_reg(reg, stack_offset, adjust_stack)
+
+ if adjust_stack:
+ print '\taddq\t$%u, %%rsp' % (adjust_stack)
+ return
+
+
+def save_reg(reg, offset, use_move):
+ if use_move:
+ if offset == 0:
+ print '\tmovq\t%s, (%%rsp)' % (reg)
+ else:
+ print '\tmovq\t%s, %u(%%rsp)' % (reg, offset)
+ else:
+ print '\tpushq\t%s' % (reg)
+
+ return
+
+
+def restore_reg(reg, offset, use_move):
+ if use_move:
+ if offset == 0:
+ print '\tmovq\t(%%rsp), %s' % (reg)
+ else:
+ print '\tmovq\t%u(%%rsp), %s' % (offset, reg)
+ else:
+ print '\tpopq\t%s' % (reg)
+
+ return
+
+
+class PrintGenericStubs(gl_XML.gl_print_base):
+
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "gl_x86-64_asm.py (from Mesa)"
+ self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
+ return
+
+
+ def get_stack_size(self, f):
+ size = 0
+ for p in f.parameterIterator():
+ size += p.get_stack_size()
+
+ return size
+
+
+ def printRealHeader(self):
+ print "/* If we build with gcc's -fvisibility=hidden flag, we'll need to change"
+ print " * the symbol visibility mode to 'default'."
+ print ' */'
+ print ''
+ print '#include "../x86/assyntax.h"'
+ print ''
+ print '#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303'
+ print '# pragma GCC visibility push(default)'
+ print '# define HIDDEN(x) .hidden x'
+ print '#else'
+ print '# define HIDDEN(x)'
+ print '#endif'
+ print ''
+ print '# if defined(USE_MGL_NAMESPACE)'
+ print '# define GL_PREFIX(n) GLNAME(CONCAT(mgl,n))'
+ print '# define _glapi_Dispatch _mglapi_Dispatch'
+ print '# else'
+ print '# define GL_PREFIX(n) GLNAME(CONCAT(gl,n))'
+ print '# endif'
+ print ''
+ print '#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
+ print '# define THREADS'
+ print '#endif'
+ print ''
+ print '\t.text'
+ print ''
+ print '#ifdef GLX_USE_TLS'
+ print ''
+ print '\t.globl _x86_64_get_get_dispatch; HIDDEN(_x86_64_get_get_dispatch)'
+ print '_x86_64_get_get_dispatch:'
+ print '\tlea\t_x86_64_get_dispatch(%rip), %rax'
+ print '\tret'
+ print ''
+ print '\t.p2align\t4,,15'
+ print '_x86_64_get_dispatch:'
+ print '\tmovq\t_glapi_tls_Dispatch@GOTTPOFF(%rip), %rax'
+ print '\tmovq\t%fs:(%rax), %rax'
+ print '\tret'
+ print '\t.size\t_x86_64_get_dispatch, .-_x86_64_get_dispatch'
+ print ''
+ print '#elif defined(PTHREADS)'
+ print ''
+ print '\t.extern\t_glapi_Dispatch'
+ print '\t.extern\t_gl_DispatchTSD'
+ print '\t.extern\tpthread_getspecific'
+ print ''
+ print '\t.p2align\t4,,15'
+ print '_x86_64_get_dispatch:'
+ print '\tmovq\t_gl_DispatchTSD(%rip), %rdi'
+ print '\tjmp\tpthread_getspecific@PLT'
+ print ''
+ print '#elif defined(THREADS)'
+ print ''
+ print '\t.extern\t_glapi_get_dispatch'
+ print ''
+ print '#endif'
+ print ''
+ return
+
+
+ def printRealFooter(self):
+ print ''
+ print '#if defined(GLX_USE_TLS) && defined(__linux__)'
+ print ' .section ".note.ABI-tag", "a"'
+ print ' .p2align 2'
+ print ' .long 1f - 0f /* name length */'
+ print ' .long 3f - 2f /* data length */'
+ print ' .long 1 /* note length */'
+ print '0: .asciz "GNU" /* vendor name */'
+ print '1: .p2align 2'
+ print '2: .long 0 /* note data: the ABI tag */'
+ print ' .long 2,4,20 /* Minimum kernel version w/TLS */'
+ print '3: .p2align 2 /* pad out section */'
+ print '#endif /* GLX_USE_TLS */'
+ print ''
+ print '#if defined (__ELF__) && defined (__linux__)'
+ print ' .section .note.GNU-stack,"",%progbits'
+ print '#endif'
+ return
+
+
+ def printFunction(self, f):
+
+ # The x86-64 ABI divides function parameters into a couple
+ # classes. For the OpenGL interface, the only ones that are
+ # relevent are INTEGER and SSE. Basically, the first 8
+ # GLfloat or GLdouble parameters are placed in %xmm0 - %xmm7,
+ # the first 6 non-GLfloat / non-GLdouble parameters are placed
+ # in registers listed in int_parameters.
+ #
+ # If more parameters than that are required, they are passed
+ # on the stack. Therefore, we just have to make sure that
+ # %esp hasn't changed when we jump to the actual function.
+ # Since we're jumping to the function (and not calling it), we
+ # have to make sure of that anyway!
+
+ int_parameters = ["%rdi", "%rsi", "%rdx", "%rcx", "%r8", "%r9"]
+
+ int_class = 0
+ sse_class = 0
+ stack_offset = 0
+ registers = []
+ for p in f.parameterIterator():
+ type_name = p.get_base_type_string()
+
+ if p.is_pointer() or (type_name != "GLfloat" and type_name != "GLdouble"):
+ if int_class < 6:
+ registers.append( [int_parameters[int_class], stack_offset] )
+ int_class += 1
+ stack_offset += 8
+ else:
+ if sse_class < 8:
+ registers.append( ["%%xmm%u" % (sse_class), stack_offset] )
+ sse_class += 1
+ stack_offset += 8
+
+ if ((int_class & 1) == 0) and (sse_class == 0):
+ registers.append( ["%rbp", 0] )
+
+
+ name = f.dispatch_name()
+
+ print '\t.p2align\t4,,15'
+ print '\t.globl\tGL_PREFIX(%s)' % (name)
+ print '\t.type\tGL_PREFIX(%s), @function' % (name)
+ if not f.is_static_entry_point(f.name):
+ print '\tHIDDEN(GL_PREFIX(%s))' % (name)
+ print 'GL_PREFIX(%s):' % (name)
+ print '#if defined(GLX_USE_TLS)'
+ print '\tcall\t_x86_64_get_dispatch@PLT'
+ print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
+ print '\tjmp\t*%r11'
+ print '#elif defined(PTHREADS)'
+
+ save_all_regs(registers)
+ print '\tcall\t_x86_64_get_dispatch@PLT'
+ restore_all_regs(registers)
+
+ if f.offset == 0:
+ print '\tmovq\t(%rax), %r11'
+ else:
+ print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
+
+ print '\tjmp\t*%r11'
+
+ print '#else'
+ print '\tmovq\t_glapi_Dispatch(%rip), %rax'
+ print '\ttestq\t%rax, %rax'
+ print '\tje\t1f'
+ print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
+ print '\tjmp\t*%r11'
+ print '1:'
+
+ save_all_regs(registers)
+ print '\tcall\t_glapi_get_dispatch'
+ restore_all_regs(registers)
+
+ print '\tmovq\t%u(%%rax), %%r11' % (f.offset * 8)
+ print '\tjmp\t*%r11'
+ print '#endif /* defined(GLX_USE_TLS) */'
+
+ print '\t.size\tGL_PREFIX(%s), .-GL_PREFIX(%s)' % (name, name)
+ print ''
+ return
+
+
+ def printBody(self, api):
+ for f in api.functionIterateByOffset():
+ self.printFunction(f)
+
+
+ for f in api.functionIterateByOffset():
+ dispatch = f.dispatch_name()
+ for n in f.entry_points:
+ if n != f.name:
+ if f.is_static_entry_point(n):
+ text = '\t.globl GL_PREFIX(%s) ; .set GL_PREFIX(%s), GL_PREFIX(%s)' % (n, n, dispatch)
+
+ if f.has_different_protocol(n):
+ print '#ifndef GLX_INDIRECT_RENDERING'
+ print text
+ print '#endif'
+ else:
+ print text
+
+ return
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+ mode = "generic"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == '-m':
+ mode = val
+ elif arg == "-f":
+ file_name = val
+
+ if mode == "generic":
+ printer = PrintGenericStubs()
+ else:
+ print "ERROR: Invalid mode \"%s\" specified." % mode
+ show_usage()
+
+ api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+ printer.Print(api)
--- mesa-7.0.3.orig/src/mesa/glapi/gl_x86_asm.py
+++ mesa-7.0.3/src/mesa/glapi/gl_x86_asm.py
@@ -0,0 +1,267 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2004, 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import license
+import gl_XML, glX_XML
+import sys, getopt
+
+class PrintGenericStubs(gl_XML.gl_print_base):
+
+ def __init__(self):
+ gl_XML.gl_print_base.__init__(self)
+
+ self.name = "gl_x86_asm.py (from Mesa)"
+ self.license = license.bsd_license_template % ( \
+"""Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+(C) Copyright IBM Corporation 2004, 2005""", "BRIAN PAUL, IBM")
+ return
+
+
+ def get_stack_size(self, f):
+ size = 0
+ for p in f.parameterIterator():
+ size += p.get_stack_size()
+
+ return size
+
+
+ def printRealHeader(self):
+ print '#include "assyntax.h"'
+ print '#include "glapioffsets.h"'
+ print ''
+ print '#if defined(STDCALL_API)'
+ print '# if defined(USE_MGL_NAMESPACE)'
+ print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n2))'
+ print '# else'
+ print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n2))'
+ print '# endif'
+ print '#else'
+ print '# if defined(USE_MGL_NAMESPACE)'
+ print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(mgl,n))'
+ print '# define _glapi_Dispatch _mglapi_Dispatch'
+ print '# else'
+ print '# define GL_PREFIX(n,n2) GLNAME(CONCAT(gl,n))'
+ print '# endif'
+ print '#endif'
+ print ''
+ print '#define GL_OFFSET(x) CODEPTR(REGOFF(4 * x, EAX))'
+ print ''
+ print '#if defined(GNU_ASSEMBLER) && !defined(__DJGPP__) && !defined(__MINGW32__)'
+ print '#define GLOBL_FN(x) GLOBL x ; .type x, function'
+ print '#else'
+ print '#define GLOBL_FN(x) GLOBL x'
+ print '#endif'
+ print ''
+ print '#if defined(PTHREADS) || defined(USE_XTHREADS) || defined(SOLARIS_THREADS) || defined(WIN32_THREADS) || defined(BEOS_THREADS)'
+ print '# define THREADS'
+ print '#endif'
+ print ''
+ print '#ifdef GLX_USE_TLS'
+ print ''
+ print '#ifdef GLX_X86_READONLY_TEXT'
+ print '# define CTX_INSNS MOV_L(GS:(EAX), EAX)'
+ print '#else'
+ print '# define CTX_INSNS NOP /* Pad for init_glapi_relocs() */'
+ print '#endif'
+ print ''
+ print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
+ print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
+ print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
+ print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
+ print '\tCALL(_x86_get_dispatch) ;\t\t\t\\'
+ print '\tCTX_INSNS ; \\'
+ print '\tJMP(GL_OFFSET(off))'
+ print ''
+ print '#elif defined(PTHREADS)'
+ print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
+ print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
+ print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
+ print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
+ print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\'
+ print '\tTEST_L(EAX, EAX) ;\t\t\t\t\\'
+ print '\tJE(1f) ;\t\t\t\t\t\\'
+ print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
+ print '1:\tCALL(_x86_get_dispatch) ;\t\t\t\\'
+ print '\tJMP(GL_OFFSET(off))'
+ print '#elif defined(THREADS)'
+ print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
+ print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
+ print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
+ print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
+ print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\'
+ print '\tTEST_L(EAX, EAX) ;\t\t\t\t\\'
+ print '\tJE(1f) ;\t\t\t\t\t\\'
+ print '\tJMP(GL_OFFSET(off)) ;\t\t\t\t\\'
+ print '1:\tCALL(_glapi_get_dispatch) ;\t\t\t\\'
+ print '\tJMP(GL_OFFSET(off))'
+ print '#else /* Non-threaded version. */'
+ print '# define GL_STUB(fn,off,fn_alt)\t\t\t\\'
+ print 'ALIGNTEXT16;\t\t\t\t\t\t\\'
+ print 'GLOBL_FN(GL_PREFIX(fn, fn_alt));\t\t\t\\'
+ print 'GL_PREFIX(fn, fn_alt):\t\t\t\t\t\\'
+ print '\tMOV_L(CONTENT(GLNAME(_glapi_Dispatch)), EAX) ;\t\\'
+ print '\tJMP(GL_OFFSET(off))'
+ print '#endif'
+ print ''
+ print '#ifdef HAVE_ALIAS'
+ print '# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt)\t\\'
+ print '\t.globl\tGL_PREFIX(fn, fn_alt) ;\t\t\t\\'
+ print '\t.set\tGL_PREFIX(fn, fn_alt), GL_PREFIX(alias, alias_alt)'
+ print '#else'
+ print '# define GL_STUB_ALIAS(fn,off,fn_alt,alias,alias_alt)\t\\'
+ print ' GL_STUB(fn, off, fn_alt)'
+ print '#endif'
+ print ''
+ print 'SEG_TEXT'
+ print ''
+ print '#ifdef GLX_USE_TLS'
+ print ''
+ print '\tGLOBL\tGLNAME(_x86_get_dispatch)'
+ print '\tHIDDEN(GLNAME(_x86_get_dispatch))'
+ print 'ALIGNTEXT16'
+ print 'GLNAME(_x86_get_dispatch):'
+ print '\tcall 1f'
+ print '1:\tpopl %eax'
+ print '\taddl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax'
+ print '\tmovl _glapi_tls_Dispatch@GOTNTPOFF(%eax), %eax'
+ print '\tret'
+ print ''
+ print '#elif defined(PTHREADS)'
+ print 'EXTERN GLNAME(_glapi_Dispatch)'
+ print 'EXTERN GLNAME(_gl_DispatchTSD)'
+ print 'EXTERN GLNAME(pthread_getspecific)'
+ print ''
+ print 'ALIGNTEXT16'
+ print 'GLNAME(_x86_get_dispatch):'
+ print '\tSUB_L(CONST(24), ESP)'
+ print '\tPUSH_L(GLNAME(_gl_DispatchTSD))'
+ print '\tCALL(GLNAME(pthread_getspecific))'
+ print '\tADD_L(CONST(28), ESP)'
+ print '\tRET'
+ print '#elif defined(THREADS)'
+ print 'EXTERN GLNAME(_glapi_get_dispatch)'
+ print '#endif'
+ print ''
+
+ print '#if defined( GLX_USE_TLS ) && !defined( GLX_X86_READONLY_TEXT )'
+ print '\t\t.section\twtext, "awx", @progbits'
+ print '#endif /* defined( GLX_USE_TLS ) */'
+
+ print ''
+ print '\t\tALIGNTEXT16'
+ print '\t\tGLOBL GLNAME(gl_dispatch_functions_start)'
+ print '\t\tHIDDEN(GLNAME(gl_dispatch_functions_start))'
+ print 'GLNAME(gl_dispatch_functions_start):'
+ print ''
+ return
+
+
+ def printRealFooter(self):
+ print ''
+ print '\t\tGLOBL\tGLNAME(gl_dispatch_functions_end)'
+ print '\t\tHIDDEN(GLNAME(gl_dispatch_functions_end))'
+ print '\t\tALIGNTEXT16'
+ print 'GLNAME(gl_dispatch_functions_end):'
+ print ''
+ print '#if defined(GLX_USE_TLS) && defined(__linux__)'
+ print ' .section ".note.ABI-tag", "a"'
+ print ' .p2align 2'
+ print ' .long 1f - 0f /* name length */'
+ print ' .long 3f - 2f /* data length */'
+ print ' .long 1 /* note length */'
+ print '0: .asciz "GNU" /* vendor name */'
+ print '1: .p2align 2'
+ print '2: .long 0 /* note data: the ABI tag */'
+ print ' .long 2,4,20 /* Minimum kernel version w/TLS */'
+ print '3: .p2align 2 /* pad out section */'
+ print '#endif /* GLX_USE_TLS */'
+ print ''
+ print '#if defined (__ELF__) && defined (__linux__)'
+ print ' .section .note.GNU-stack,"",%progbits'
+ print '#endif'
+ return
+
+
+ def printBody(self, api):
+ for f in api.functionIterateByOffset():
+ name = f.dispatch_name()
+ stack = self.get_stack_size(f)
+ alt = "%s@%u" % (name, stack)
+
+ print '\tGL_STUB(%s, _gloffset_%s, %s)' % (name, f.name, alt)
+
+ if not f.is_static_entry_point(f.name):
+ print '\tHIDDEN(GL_PREFIX(%s, %s))' % (name, alt)
+
+
+ for f in api.functionIterateByOffset():
+ name = f.dispatch_name()
+ stack = self.get_stack_size(f)
+ alt = "%s@%u" % (name, stack)
+
+ if f.is_static_entry_point(f.name):
+ for n in f.entry_points:
+ if n != f.name:
+ alt2 = "%s@%u" % (n, stack)
+ text = '\tGL_STUB_ALIAS(%s, _gloffset_%s, %s, %s, %s)' % (n, f.name, alt2, f.name, alt)
+
+ if f.has_different_protocol(n):
+ print '#ifndef GLX_INDIRECT_RENDERING'
+ print text
+ print '#endif'
+ else:
+ print text
+
+ return
+
+def show_usage():
+ print "Usage: %s [-f input_file_name] [-m output_mode]" % sys.argv[0]
+ sys.exit(1)
+
+if __name__ == '__main__':
+ file_name = "gl_API.xml"
+ mode = "generic"
+
+ try:
+ (args, trail) = getopt.getopt(sys.argv[1:], "m:f:")
+ except Exception,e:
+ show_usage()
+
+ for (arg,val) in args:
+ if arg == '-m':
+ mode = val
+ elif arg == "-f":
+ file_name = val
+
+ if mode == "generic":
+ printer = PrintGenericStubs()
+ else:
+ print "ERROR: Invalid mode \"%s\" specified." % mode
+ show_usage()
+
+ api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+ printer.Print(api)
--- mesa-7.0.3.orig/src/mesa/glapi/license.py
+++ mesa-7.0.3/src/mesa/glapi/license.py
@@ -0,0 +1,47 @@
+# (C) Copyright IBM Corporation 2004
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+bsd_license_template = """%s
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sub license,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+%s,
+AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE."""
--- mesa-7.0.3.orig/src/mesa/glapi/mesadef.py
+++ mesa-7.0.3/src/mesa/glapi/mesadef.py
@@ -0,0 +1,223 @@
+#!/usr/bin/env python
+
+# $Id: mesadef.py,v 1.4 2006/01/25 15:05:36 brianp Exp $
+
+# Mesa 3-D graphics library
+# Version: 4.1
+#
+# Copyright (C) 1999-2001 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.
+
+
+# Generate the mesa.def file for Windows.
+#
+# Usage:
+# mesadef.py >mesa.def
+# Then copy to src/mesa/drivers/windows/gdi
+#
+# Dependencies:
+# The apispec file must be in the current directory.
+
+
+
+import apiparser
+import string
+
+
+def PrintHead():
+ print '; DO NOT EDIT - This file generated automatically by mesadef.py script'
+ print 'DESCRIPTION \'Mesa (OpenGL work-alike) for Win32\''
+ print 'VERSION 6.0'
+ print ';'
+ print '; Module definition file for Mesa (OPENGL32.DLL)'
+ print ';'
+ print '; Note: The OpenGL functions use the STDCALL'
+ print '; function calling convention. Microsoft\'s'
+ print '; OPENGL32 uses this convention and so must the'
+ print '; Mesa OPENGL32 so that the Mesa DLL can be used'
+ print '; as a drop-in replacement.'
+ print ';'
+ print '; The linker exports STDCALL entry points with'
+ print '; \'decorated\' names; e.g., _glBegin@0, where the'
+ print '; trailing number is the number of bytes of '
+ print '; parameter data pushed onto the stack. The'
+ print '; callee is responsible for popping this data'
+ print '; off the stack, usually via a RETF n instruction.'
+ print ';'
+ print '; However, the Microsoft OPENGL32.DLL does not export'
+ print '; the decorated names, even though the calling convention'
+ print '; is STDCALL. So, this module definition file is'
+ print '; needed to force the Mesa OPENGL32.DLL to export the'
+ print '; symbols in the same manner as the Microsoft DLL.'
+ print '; Were it not for this problem, this file would not'
+ print '; be needed (for the gl* functions) since the entry'
+ print '; points are compiled with dllexport declspec.'
+ print ';'
+ print '; However, this file is still needed to export "internal"'
+ print '; Mesa symbols for the benefit of the OSMESA32.DLL.'
+ print ';'
+ print 'EXPORTS'
+ return
+#enddef
+
+
+def PrintTail():
+ print ';'
+ print '; WGL API'
+ print '\twglChoosePixelFormat'
+ print '\twglCopyContext'
+ print '\twglCreateContext'
+ print '\twglCreateLayerContext'
+ print '\twglDeleteContext'
+ print '\twglDescribeLayerPlane'
+ print '\twglDescribePixelFormat'
+ print '\twglGetCurrentContext'
+ print '\twglGetCurrentDC'
+ print '\twglGetExtensionsStringARB'
+ print '\twglGetLayerPaletteEntries'
+ print '\twglGetPixelFormat'
+ print '\twglGetProcAddress'
+ print '\twglMakeCurrent'
+ print '\twglRealizeLayerPalette'
+ print '\twglSetLayerPaletteEntries'
+ print '\twglSetPixelFormat'
+ print '\twglShareLists'
+ print '\twglSwapBuffers'
+ print '\twglSwapLayerBuffers'
+ print '\twglUseFontBitmapsA'
+ print '\twglUseFontBitmapsW'
+ print '\twglUseFontOutlinesA'
+ print '\twglUseFontOutlinesW'
+ print ';'
+ print '; Mesa internals - mostly for OSMESA'
+ print '\t_ac_CreateContext'
+ print '\t_ac_DestroyContext'
+ print '\t_ac_InvalidateState'
+ print '\t_glapi_get_context'
+ print '\t_glapi_get_proc_address'
+ print '\t_mesa_buffer_data'
+ print '\t_mesa_buffer_map'
+ print '\t_mesa_buffer_subdata'
+ print '\t_mesa_bzero'
+ print '\t_mesa_calloc'
+ print '\t_mesa_choose_tex_format'
+ print '\t_mesa_compressed_texture_size'
+ print '\t_mesa_create_framebuffer'
+ print '\t_mesa_create_visual'
+ print '\t_mesa_delete_buffer_object'
+ print '\t_mesa_delete_texture_object'
+ print '\t_mesa_destroy_framebuffer'
+ print '\t_mesa_destroy_visual'
+ print '\t_mesa_enable_1_3_extensions'
+ print '\t_mesa_enable_1_4_extensions'
+ print '\t_mesa_enable_1_5_extensions'
+ print '\t_mesa_enable_sw_extensions'
+ print '\t_mesa_error'
+ print '\t_mesa_free'
+ print '\t_mesa_free_context_data'
+ print '\t_mesa_get_current_context'
+ print '\t_mesa_init_default_imports'
+ print '\t_mesa_initialize_context'
+ print '\t_mesa_make_current'
+ print '\t_mesa_memcpy'
+ print '\t_mesa_memset'
+ print '\t_mesa_new_buffer_object'
+ print '\t_mesa_new_texture_object'
+ print '\t_mesa_problem'
+ print '\t_mesa_ResizeBuffersMESA'
+ print '\t_mesa_store_compressed_teximage1d'
+ print '\t_mesa_store_compressed_teximage2d'
+ print '\t_mesa_store_compressed_teximage3d'
+ print '\t_mesa_store_compressed_texsubimage1d'
+ print '\t_mesa_store_compressed_texsubimage2d'
+ print '\t_mesa_store_compressed_texsubimage3d'
+ print '\t_mesa_store_teximage1d'
+ print '\t_mesa_store_teximage2d'
+ print '\t_mesa_store_teximage3d'
+ print '\t_mesa_store_texsubimage1d'
+ print '\t_mesa_store_texsubimage2d'
+ print '\t_mesa_store_texsubimage3d'
+ print '\t_mesa_strcmp'
+ print '\t_mesa_test_proxy_teximage'
+ print '\t_mesa_Viewport'
+ print '\t_swrast_Accum'
+ print '\t_swrast_alloc_buffers'
+ print '\t_swrast_Bitmap'
+ print '\t_swrast_CopyPixels'
+ print '\t_swrast_DrawPixels'
+ print '\t_swrast_GetDeviceDriverReference'
+ print '\t_swrast_Clear'
+ print '\t_swrast_choose_line'
+ print '\t_swrast_choose_triangle'
+ print '\t_swrast_CopyColorSubTable'
+ print '\t_swrast_CopyColorTable'
+ print '\t_swrast_CopyConvolutionFilter1D'
+ print '\t_swrast_CopyConvolutionFilter2D'
+ print '\t_swrast_copy_teximage1d'
+ print '\t_swrast_copy_teximage2d'
+ print '\t_swrast_copy_texsubimage1d'
+ print '\t_swrast_copy_texsubimage2d'
+ print '\t_swrast_copy_texsubimage3d'
+ print '\t_swrast_CreateContext'
+ print '\t_swrast_DestroyContext'
+ print '\t_swrast_InvalidateState'
+ print '\t_swrast_ReadPixels'
+ print '\t_swrast_zbuffer_address'
+ print '\t_swsetup_Wakeup'
+ print '\t_swsetup_CreateContext'
+ print '\t_swsetup_DestroyContext'
+ print '\t_swsetup_InvalidateState'
+ print '\t_tnl_CreateContext'
+ print '\t_tnl_DestroyContext'
+ print '\t_tnl_InvalidateState'
+ print '\t_tnl_MakeCurrent'
+ print '\t_tnl_run_pipeline'
+#enddef
+
+
+records = []
+
+def FindOffset(funcName):
+ for (name, alias, offset) in records:
+ if name == funcName:
+ return offset
+ #endif
+ #endfor
+ return -1
+#enddef
+
+
+def EmitEntry(name, returnType, argTypeList, argNameList, alias, offset):
+ if alias == '':
+ dispatchName = name
+ else:
+ dispatchName = alias
+ if offset < 0:
+ offset = FindOffset(dispatchName)
+ if offset >= 0 and string.find(name, "unused") == -1:
+ print '\tgl%s' % (name)
+ # save this info in case we need to look up an alias later
+ records.append((name, dispatchName, offset))
+
+#enddef
+
+
+PrintHead()
+apiparser.ProcessSpecFile("APIspec", EmitEntry)
+PrintTail()
--- mesa-7.0.3.orig/src/mesa/glapi/next_available_offset.sh
+++ mesa-7.0.3/src/mesa/glapi/next_available_offset.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+#
+# (C) Copyright IBM Corporation 2004
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+# Trivial shell script to search the API definition file and print out the
+# next numerically available API entry-point offset. This could probably
+# be made smarter, but it would be better to use the existin Python
+# framework to do that. This is just a quick-and-dirty hack.
+
+num=$(grep 'offset="' gl_API.xml |\
+ sed 's/.\+ offset="//g;s/".*$//g' |\
+ grep -v '?' |\
+ sort -rn |\
+ head -1)
+
+echo $((num + 1))
--- mesa-7.0.3.orig/src/mesa/glapi/typeexpr.py
+++ mesa-7.0.3/src/mesa/glapi/typeexpr.py
@@ -0,0 +1,292 @@
+#!/usr/bin/env python
+
+# (C) Copyright IBM Corporation 2005
+# 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
+# on the rights to use, copy, modify, merge, publish, distribute, sub
+# license, and/or sell copies of the Software, and to permit persons to whom
+# the Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+#
+# Authors:
+# Ian Romanick
+
+import string, copy
+
+class type_node:
+ def __init__(self):
+ self.pointer = 0 # bool
+ self.const = 0 # bool
+ self.signed = 1 # bool
+ self.integer = 1 # bool
+
+ # If elements is set to non-zero, then field is an array.
+ self.elements = 0
+
+ self.name = None
+ self.size = 0 # type's size in bytes
+ return
+
+
+ def string(self):
+ """Return string representation of this type_node."""
+ s = ""
+
+ if self.pointer:
+ s = "* "
+
+ if self.const:
+ s += "const "
+
+ if not self.pointer:
+ if self.integer:
+ if self.signed:
+ s += "signed "
+ else:
+ s += "unsigned "
+
+ if self.name:
+ s += "%s " % (self.name)
+
+ return s
+
+
+class type_table:
+ def __init__(self):
+ self.types_by_name = {}
+ return
+
+
+ def add_type(self, type_expr):
+ self.types_by_name[ type_expr.get_base_name() ] = type_expr
+ return
+
+
+ def find_type(self, name):
+ if name in self.types_by_name:
+ return self.types_by_name[ name ]
+ else:
+ return None
+
+
+def create_initial_types():
+ tt = type_table()
+
+ basic_types = [
+ ("char", 1, 1),
+ ("short", 2, 1),
+ ("int", 4, 1),
+ ("long", 4, 1),
+ ("float", 4, 0),
+ ("double", 8, 0),
+ ("enum", 4, 1)
+ ]
+
+ for (type_name, type_size, integer) in basic_types:
+ te = type_expression(None)
+ tn = type_node()
+ tn.name = type_name
+ tn.size = type_size
+ tn.integer = integer
+ te.expr.append(tn)
+ tt.add_type( te )
+
+ type_expression.built_in_types = tt
+ return
+
+
+class type_expression:
+ built_in_types = None
+
+ def __init__(self, type_string, extra_types = None):
+ self.expr = []
+
+ if not type_string:
+ return
+
+ self.original_string = type_string
+
+ if not type_expression.built_in_types:
+ raise RuntimeError("create_initial_types must be called before creating type_expression objects.")
+
+ # Replace '*' with ' * ' in type_string. Then, split the string
+ # into tokens, separated by spaces.
+ tokens = string.split( string.replace( type_string, "*", " * " ) )
+
+ const = 0
+ t = None
+ signed = 0
+ unsigned = 0
+
+ for i in tokens:
+ if i == "const":
+ if t and t.pointer:
+ t.const = 1
+ else:
+ const = 1
+ elif i == "signed":
+ signed = 1
+ elif i == "unsigned":
+ unsigned = 1
+ elif i == "*":
+ # This is a quirky special-case because of the
+ # way the C works for types. If 'unsigned' is
+ # specified all by itself, it is treated the
+ # same as "unsigned int".
+
+ if unsigned:
+ self.set_base_type( "int", signed, unsigned, const, extra_types )
+ const = 0
+ signed = 0
+ unsigned = 0
+
+ if not self.expr:
+ raise RuntimeError("Invalid type expression (dangling pointer)")
+
+ if signed:
+ raise RuntimeError("Invalid type expression (signed / unsigned applied to pointer)")
+
+ t = type_node()
+ t.pointer = 1
+ self.expr.append( t )
+ else:
+ if self.expr:
+ raise RuntimeError('Invalid type expression (garbage after pointer qualifier -> "%s")' % (self.original_string))
+
+ self.set_base_type( i, signed, unsigned, const, extra_types )
+ const = 0
+ signed = 0
+ unsigned = 0
+
+ if signed and unsigned:
+ raise RuntimeError("Invalid type expression (both signed and unsigned specified)")
+
+
+ if const:
+ raise RuntimeError("Invalid type expression (dangling const)")
+
+ if unsigned:
+ raise RuntimeError("Invalid type expression (dangling signed)")
+
+ if signed:
+ raise RuntimeError("Invalid type expression (dangling unsigned)")
+
+ return
+
+
+ def set_base_type(self, type_name, signed, unsigned, const, extra_types):
+ te = type_expression.built_in_types.find_type( type_name )
+ if not te:
+ te = extra_types.find_type( type_name )
+
+ if not te:
+ raise RuntimeError('Unknown base type "%s".' % (type_name))
+
+ self.expr = copy.deepcopy(te.expr)
+
+ t = self.expr[ len(self.expr) - 1 ]
+ t.const = const
+ if signed:
+ t.signed = 1
+ elif unsigned:
+ t.signed = 0
+
+
+ def set_base_type_node(self, tn):
+ self.expr = [tn]
+ return
+
+
+ def set_elements(self, count):
+ tn = self.expr[0]
+
+ tn.elements = count
+ return
+
+
+ def string(self):
+ s = ""
+ for t in self.expr:
+ s += t.string()
+
+ return s
+
+
+ def get_base_type_node(self):
+ return self.expr[0]
+
+
+ def get_base_name(self):
+ if len(self.expr):
+ return self.expr[0].name
+ else:
+ return None
+
+
+ def get_element_size(self):
+ tn = self.expr[0]
+
+ if tn.elements:
+ return tn.elements * tn.size
+ else:
+ return tn.size
+
+
+ def get_element_count(self):
+ tn = self.expr[0]
+ return tn.elements
+
+
+ def get_stack_size(self):
+ tn = self.expr[ len(self.expr) - 1 ]
+
+ if tn.elements or tn.pointer:
+ return 4
+ elif not tn.integer:
+ return tn.size
+ else:
+ return 4
+
+
+ def is_pointer(self):
+ tn = self.expr[ len(self.expr) - 1 ]
+ return tn.pointer
+
+
+ def format_string(self):
+ tn = self.expr[ len(self.expr) - 1 ]
+ if tn.pointer:
+ return "%p"
+ elif not tn.integer:
+ return "%f"
+ else:
+ return "%d"
+
+
+
+if __name__ == '__main__':
+
+ types_to_try = [ "int", "int *", "const int *", "int * const", "const int * const", \
+ "unsigned * const *", \
+ "float", "const double", "double * const"]
+
+ create_initial_types()
+
+ for t in types_to_try:
+ print 'Trying "%s"...' % (t)
+ te = type_expression( t )
+ print 'Got "%s" (%u, %u).' % (te.string(), te.get_stack_size(), te.get_element_size())
--- mesa-7.0.3.orig/src/mesa/main/context.c
+++ mesa-7.0.3/src/mesa/main/context.c
@@ -610,6 +610,21 @@
}
/**
+ * Callback for freeing shader program data. Call it before delete_shader_cb
+ * to avoid memory access error.
+ */
+static void
+free_shader_program_data_cb(GLuint id, void *data, void *userData)
+{
+ GLcontext *ctx = (GLcontext *) userData;
+ struct gl_shader_program *shProg = (struct gl_shader_program *) data;
+
+ if (shProg->Type == GL_SHADER_PROGRAM_MESA) {
+ _mesa_free_shader_program_data(ctx, shProg);
+ }
+}
+
+/**
* Callback for deleting shader and shader programs objects.
* Called by _mesa_HashDeleteAll().
*/
@@ -708,6 +723,7 @@
_mesa_DeleteHashTable(ss->ArrayObjects);
#if FEATURE_ARB_shader_objects
+ _mesa_HashWalk(ss->ShaderObjects, free_shader_program_data_cb, ctx);
_mesa_HashDeleteAll(ss->ShaderObjects, delete_shader_cb, ctx);
_mesa_DeleteHashTable(ss->ShaderObjects);
#endif
--- mesa-7.0.3.orig/src/mesa/main/dd.h
+++ mesa-7.0.3/src/mesa/main/dd.h
@@ -862,6 +862,8 @@
GLsizei *length, GLcharARB *sourceOut);
void (*GetUniformfv)(GLcontext *ctx, GLuint program, GLint location,
GLfloat *params);
+ void (*GetUniformiv)(GLcontext *ctx, GLuint program, GLint location,
+ GLint *params);
GLint (*GetUniformLocation)(GLcontext *ctx, GLuint program,
const GLcharARB *name);
GLboolean (*IsProgram)(GLcontext *ctx, GLuint name);
--- mesa-7.0.3.orig/src/mesa/main/dlist.c
+++ mesa-7.0.3/src/mesa/main/dlist.c
@@ -3246,6 +3246,36 @@
static void GLAPIENTRY
+save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref,
+ GLuint mask)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ /* GL_FRONT */
+ n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
+ if (n) {
+ n[1].e = GL_FRONT;
+ n[2].e = frontfunc;
+ n[3].i = ref;
+ n[4].ui = mask;
+ }
+ /* GL_BACK */
+ n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4);
+ if (n) {
+ n[1].e = GL_BACK;
+ n[2].e = backfunc;
+ n[3].i = ref;
+ n[4].ui = mask;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_StencilFuncSeparate(ctx->Exec, (GL_FRONT, frontfunc, ref, mask));
+ CALL_StencilFuncSeparate(ctx->Exec, (GL_BACK, backfunc, ref, mask));
+ }
+}
+
+
+static void GLAPIENTRY
save_StencilMaskSeparate(GLenum face, GLuint mask)
{
GET_CURRENT_CONTEXT(ctx);
@@ -7870,6 +7900,9 @@
SET_StencilMaskSeparate(table, save_StencilMaskSeparate);
SET_StencilOpSeparate(table, save_StencilOpSeparate);
+ /* ATI_separate_stencil */
+ SET_StencilFuncSeparateATI(table, save_StencilFuncSeparateATI);
+
/* GL_ARB_imaging */
/* Not all are supported */
SET_BlendColor(table, save_BlendColor);
--- mesa-7.0.3.orig/src/mesa/main/drawpix.c
+++ mesa-7.0.3/src/mesa/main/drawpix.c
@@ -342,8 +342,9 @@
if (ctx->RenderMode == GL_RENDER) {
/* Truncate, to satisfy conformance tests (matches SGI's OpenGL). */
- GLint x = IFLOOR(ctx->Current.RasterPos[0] - xorig);
- GLint y = IFLOOR(ctx->Current.RasterPos[1] - yorig);
+ const GLfloat epsilon = 0.0001;
+ GLint x = IFLOOR(ctx->Current.RasterPos[0] + epsilon - xorig);
+ GLint y = IFLOOR(ctx->Current.RasterPos[1] + epsilon - yorig);
ctx->Driver.Bitmap( ctx, x, y, width, height, &ctx->Unpack, bitmap );
}
#if _HAVE_FULL_GL
--- mesa-7.0.3.orig/src/mesa/main/image.c
+++ mesa-7.0.3/src/mesa/main/image.c
@@ -3963,7 +3963,7 @@
DEPTH_VALUES(GLuint, UINT_TO_FLOAT);
break;
case GL_UNSIGNED_INT_24_8_EXT: /* GL_EXT_packed_depth_stencil */
- if (dstType == GL_UNSIGNED_INT &&
+ if (dstType == GL_UNSIGNED_INT_24_8_EXT &&
depthScale == (GLfloat) 0xffffff &&
ctx->Pixel.DepthScale == 1.0 &&
ctx->Pixel.DepthBias == 0.0) {
--- mesa-7.0.3.orig/src/mesa/main/mm.c
+++ mesa-7.0.3/src/mesa/main/mm.c
@@ -53,7 +53,7 @@
}
struct mem_block *
-mmInit(int ofs, int size)
+mmInit(unsigned int ofs, int size)
{
struct mem_block *heap, *block;
@@ -91,7 +91,7 @@
static struct mem_block *
SliceBlock(struct mem_block *p,
- int startofs, int size,
+ unsigned int startofs, int size,
int reserved, int alignment)
{
struct mem_block *newblock;
@@ -164,8 +164,8 @@
{
struct mem_block *p;
const int mask = (1 << align2)-1;
- int startofs = 0;
- int endofs;
+ unsigned int startofs = 0;
+ unsigned int endofs;
if (!heap || align2 < 0 || size <= 0)
return NULL;
--- mesa-7.0.3.orig/src/mesa/main/texstate.c
+++ mesa-7.0.3/src/mesa/main/texstate.c
@@ -209,6 +209,9 @@
return;
}
+ if (mode == GL_REPLACE_EXT)
+ mode = GL_REPLACE;
+
switch (mode) {
case GL_REPLACE:
case GL_MODULATE:
@@ -311,7 +314,9 @@
switch (pname) {
case GL_TEXTURE_ENV_MODE:
{
- const GLenum mode = (GLenum) (GLint) *param;
+ GLenum mode = (GLenum) (GLint) *param;
+ if (mode == GL_REPLACE_EXT)
+ mode = GL_REPLACE;
if (texUnit->EnvMode == mode)
return;
if (mode == GL_MODULATE ||
--- mesa-7.0.3.orig/src/mesa/main/depthstencil.c
+++ mesa-7.0.3/src/mesa/main/depthstencil.c
@@ -213,7 +213,7 @@
const void *values, const GLubyte *mask)
{
struct gl_renderbuffer *dsrb = z24rb->Wrapped;
- const GLubyte *src = (const GLubyte *) values;
+ const GLuint *src = (const GLuint *) values;
ASSERT(z24rb->DataType == GL_UNSIGNED_INT);
ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT);
ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT);
--- mesa-7.0.3.orig/src/mesa/main/execmem.c
+++ mesa-7.0.3/src/mesa/main/execmem.c
@@ -36,7 +36,7 @@
-#if defined(__linux__)
+#if defined(__linux__) || defined(__OpenBSD__)
/*
* Allocate a large block of memory which can hold code then dole it out
@@ -47,6 +47,11 @@
#include
#include "mm.h"
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+
#define EXEC_HEAP_SIZE (10*1024*1024)
_glthread_DECLARE_STATIC_MUTEX(exec_mutex);
--- mesa-7.0.3.orig/src/mesa/main/texstore.c
+++ mesa-7.0.3/src/mesa/main/texstore.c
@@ -2320,6 +2320,8 @@
GLboolean
_mesa_texstore_z24_s8(TEXSTORE_PARAMS)
{
+ const GLfloat depthScale = (GLfloat) 0xffffff;
+
ASSERT(dstFormat == &_mesa_texformat_z24_s8);
ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT);
ASSERT(srcType == GL_UNSIGNED_INT_24_8_EXT);
@@ -2356,9 +2358,9 @@
GLint i;
/* the 24 depth bits will be in the high position: */
_mesa_unpack_depth_span(ctx, srcWidth,
- GL_UNSIGNED_INT, /* dst type */
+ GL_UNSIGNED_INT_24_8_EXT, /* dst type */
dstRow, /* dst addr */
- (GLfloat) 0xffffff, /* depthScale */
+ depthScale,
srcType, src, srcPacking);
/* get the 8-bit stencil values */
_mesa_unpack_stencil_span(ctx, srcWidth,
--- mesa-7.0.3.orig/src/mesa/main/imports.c
+++ mesa-7.0.3/src/mesa/main/imports.c
@@ -104,6 +104,8 @@
(void) posix_memalign(& mem, alignment, bytes);
return mem;
+#elif defined(_WIN32) && defined(_MSC_VER)
+ return _aligned_malloc(bytes, alignment);
#else
uintptr_t ptr, buf;
@@ -144,6 +146,15 @@
}
return mem;
+#elif defined(_WIN32) && defined(_MSC_VER)
+ void *mem;
+
+ mem = _aligned_malloc(bytes, alignment);
+ if (mem != NULL) {
+ (void) memset(mem, 0, bytes);
+ }
+
+ return mem;
#else
uintptr_t ptr, buf;
@@ -180,6 +191,8 @@
{
#if defined(HAVE_POSIX_MEMALIGN)
free(ptr);
+#elif defined(_WIN32) && defined(_MSC_VER)
+ _aligned_free(ptr);
#else
void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
void *realAddr = *cubbyHole;
@@ -194,6 +207,10 @@
_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
unsigned long alignment)
{
+#if defined(_WIN32) && defined(_MSC_VER)
+ (void) oldSize;
+ return _aligned_realloc(oldBuffer, newSize, alignment);
+#else
const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
void *newBuf = _mesa_align_malloc(newSize, alignment);
if (newBuf && oldBuffer && copySize > 0) {
@@ -202,6 +219,7 @@
if (oldBuffer)
_mesa_align_free(oldBuffer);
return newBuf;
+#endif
}
@@ -258,7 +276,7 @@
void
_mesa_bzero( void *dst, size_t n )
{
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__DragonFly__)
bzero( dst, n );
#else
memset( dst, 0, n );
@@ -560,6 +578,7 @@
bit++;
i >>= 1;
}
+ bit++;
}
return bit;
#else
--- mesa-7.0.3.orig/src/mesa/main/texenvprogram.c
+++ mesa-7.0.3/src/mesa/main/texenvprogram.c
@@ -1242,7 +1242,7 @@
/* If a conventional fragment program/shader isn't in effect... */
if (!ctx->FragmentProgram._Enabled &&
- !ctx->Shader.CurrentProgram) {
+ (!ctx->Shader.CurrentProgram || !ctx->Shader.CurrentProgram->FragmentProgram)) {
make_state_key(ctx, &key);
hash = hash_key(&key);
@@ -1271,7 +1271,8 @@
}
}
else {
- ctx->FragmentProgram._Current = ctx->FragmentProgram.Current;
+ /* _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
--- mesa-7.0.3.orig/src/mesa/main/mm.h
+++ mesa-7.0.3/src/mesa/main/mm.h
@@ -39,7 +39,8 @@
struct mem_block *next, *prev;
struct mem_block *next_free, *prev_free;
struct mem_block *heap;
- int ofs,size;
+ unsigned int ofs;
+ int size;
unsigned int free:1;
unsigned int reserved:1;
};
@@ -50,7 +51,7 @@
* input: total size in bytes
* return: a heap pointer if OK, NULL if error
*/
-extern struct mem_block *mmInit(int ofs, int size);
+extern struct mem_block *mmInit(unsigned int ofs, int size);
/**
* Allocate 'size' bytes with 2^align2 bytes alignment,
--- mesa-7.0.3.orig/src/mesa/main/texcompress_s3tc.c
+++ mesa-7.0.3/src/mesa/main/texcompress_s3tc.c
@@ -577,6 +577,32 @@
NULL /* StoreTexel */
};
+#if FEATURE_EXT_texture_sRGB
+const struct gl_texture_format _mesa_texformat_srgb_dxt1 = {
+ MESA_FORMAT_SRGB_DXT1, /* MesaFormat */
+ GL_RGB, /* BaseFormat */
+ GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
+ 4, /*approx*/ /* RedBits */
+ 4, /*approx*/ /* GreenBits */
+ 4, /*approx*/ /* BlueBits */
+ 0, /* AlphaBits */
+ 0, /* LuminanceBits */
+ 0, /* IntensityBits */
+ 0, /* IndexBits */
+ 0, /* DepthBits */
+ 0, /* StencilBits */
+ 0, /* TexelBytes */
+ texstore_rgb_dxt1, /* StoreTexImageFunc */
+ NULL, /*impossible*/ /* FetchTexel1D */
+ fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */
+ NULL, /*impossible*/ /* FetchTexel3D */
+ NULL, /*impossible*/ /* FetchTexel1Df */
+ fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
+ NULL, /*impossible*/ /* FetchTexel3Df */
+ NULL /* StoreTexel */
+};
+#endif
+
const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
MESA_FORMAT_RGBA_DXT1, /* MesaFormat */
GL_RGBA, /* BaseFormat */
--- mesa-7.0.3.orig/src/mesa/main/shaders.c
+++ mesa-7.0.3/src/mesa/main/shaders.c
@@ -309,11 +309,7 @@
_mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params)
{
GET_CURRENT_CONTEXT(ctx);
- GLfloat fparams[16]; /* XXX is 16 enough? */
- GLuint i;
- ctx->Driver.GetUniformfv(ctx, program, location, fparams);
- for (i = 0; i < 16; i++)
- params[i] = (GLint) fparams[i]; /* XXX correct? */
+ ctx->Driver.GetUniformiv(ctx, program, location, params);
}
--- mesa-7.0.3.orig/src/mesa/main/version.h
+++ mesa-7.0.3/src/mesa/main/version.h
@@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
- * Version: 7.0.3
+ * Version: 7.0.4
*
* Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
*
@@ -30,8 +30,8 @@
/* Mesa version */
#define MESA_MAJOR 7
#define MESA_MINOR 0
-#define MESA_PATCH 3
-#define MESA_VERSION_STRING "7.0.3"
+#define MESA_PATCH 4
+#define MESA_VERSION_STRING "7.0.4"
/* To make version comparison easy */
#define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
--- mesa-7.0.3.orig/src/mesa/main/texformat.h
+++ mesa-7.0.3/src/mesa/main/texformat.h
@@ -97,6 +97,7 @@
MESA_FORMAT_SRGBA8,
MESA_FORMAT_SL8,
MESA_FORMAT_SLA8,
+ MESA_FORMAT_SRGB_DXT1,
/*@}*/
#endif
@@ -168,6 +169,7 @@
extern const struct gl_texture_format _mesa_texformat_srgba8;
extern const struct gl_texture_format _mesa_texformat_sl8;
extern const struct gl_texture_format _mesa_texformat_sla8;
+extern const struct gl_texture_format _mesa_texformat_srgb_dxt1;
/*@}*/
#endif
--- mesa-7.0.3.orig/src/mesa/main/get_gen.py
+++ mesa-7.0.3/src/mesa/main/get_gen.py
@@ -0,0 +1,1214 @@
+#!/usr/bin/env python
+
+# Mesa 3-D graphics library
+#
+# Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# This script is used to generate the get.c file:
+# python get_gen.py > get.c
+
+
+import string
+
+
+GLint = 1
+GLenum = 2
+GLfloat = 3
+GLdouble = 4
+GLboolean = 5
+GLfloatN = 6 # A normalized value, such as a color or depth range
+
+
+TypeStrings = {
+ GLint : "GLint",
+ GLenum : "GLenum",
+ GLfloat : "GLfloat",
+ GLdouble : "GLdouble",
+ GLboolean : "GLboolean"
+}
+
+
+# Each entry is a tuple of:
+# - the GL state name, such as GL_CURRENT_COLOR
+# - the state datatype, one of GLint, GLfloat, GLboolean or GLenum
+# - list of code fragments to get the state, such as ["ctx->Foo.Bar"]
+# - optional extra code or empty string
+# - optional extensions to check, or None
+#
+StateVars = [
+ ( "GL_ACCUM_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.accumRedBits"],
+ "", None ),
+ ( "GL_ACCUM_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.accumGreenBits"],
+ "", None ),
+ ( "GL_ACCUM_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.accumBlueBits"],
+ "", None ),
+ ( "GL_ACCUM_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.accumAlphaBits"],
+ "", None ),
+ ( "GL_ACCUM_CLEAR_VALUE", GLfloatN,
+ [ "ctx->Accum.ClearColor[0]",
+ "ctx->Accum.ClearColor[1]",
+ "ctx->Accum.ClearColor[2]",
+ "ctx->Accum.ClearColor[3]" ],
+ "", None ),
+ ( "GL_ALPHA_BIAS", GLfloat, ["ctx->Pixel.AlphaBias"], "", None ),
+ ( "GL_ALPHA_BITS", GLint, ["ctx->DrawBuffer->Visual.alphaBits"],
+ "", None ),
+ ( "GL_ALPHA_SCALE", GLfloat, ["ctx->Pixel.AlphaScale"], "", None ),
+ ( "GL_ALPHA_TEST", GLboolean, ["ctx->Color.AlphaEnabled"], "", None ),
+ ( "GL_ALPHA_TEST_FUNC", GLenum, ["ctx->Color.AlphaFunc"], "", None ),
+ ( "GL_ALPHA_TEST_REF", GLfloatN, ["ctx->Color.AlphaRef"], "", None ),
+ ( "GL_ATTRIB_STACK_DEPTH", GLint, ["ctx->AttribStackDepth"], "", None ),
+ ( "GL_AUTO_NORMAL", GLboolean, ["ctx->Eval.AutoNormal"], "", None ),
+ ( "GL_AUX_BUFFERS", GLint, ["ctx->DrawBuffer->Visual.numAuxBuffers"],
+ "", None ),
+ ( "GL_BLEND", GLboolean, ["ctx->Color.BlendEnabled"], "", None ),
+ ( "GL_BLEND_DST", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
+ ( "GL_BLEND_SRC", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
+ ( "GL_BLEND_SRC_RGB_EXT", GLenum, ["ctx->Color.BlendSrcRGB"], "", None ),
+ ( "GL_BLEND_DST_RGB_EXT", GLenum, ["ctx->Color.BlendDstRGB"], "", None ),
+ ( "GL_BLEND_SRC_ALPHA_EXT", GLenum, ["ctx->Color.BlendSrcA"], "", None ),
+ ( "GL_BLEND_DST_ALPHA_EXT", GLenum, ["ctx->Color.BlendDstA"], "", None ),
+ ( "GL_BLEND_EQUATION", GLenum, ["ctx->Color.BlendEquationRGB "], "", None),
+ ( "GL_BLEND_EQUATION_ALPHA_EXT", GLenum, ["ctx->Color.BlendEquationA "],
+ "", None ),
+ ( "GL_BLEND_COLOR_EXT", GLfloatN,
+ [ "ctx->Color.BlendColor[0]",
+ "ctx->Color.BlendColor[1]",
+ "ctx->Color.BlendColor[2]",
+ "ctx->Color.BlendColor[3]"], "", None ),
+ ( "GL_BLUE_BIAS", GLfloat, ["ctx->Pixel.BlueBias"], "", None ),
+ ( "GL_BLUE_BITS", GLint, ["ctx->DrawBuffer->Visual.blueBits"], "", None ),
+ ( "GL_BLUE_SCALE", GLfloat, ["ctx->Pixel.BlueScale"], "", None ),
+ ( "GL_CLIENT_ATTRIB_STACK_DEPTH", GLint,
+ ["ctx->ClientAttribStackDepth"], "", None ),
+ ( "GL_CLIP_PLANE0", GLboolean,
+ [ "(ctx->Transform.ClipPlanesEnabled >> 0) & 1" ], "", None ),
+ ( "GL_CLIP_PLANE1", GLboolean,
+ [ "(ctx->Transform.ClipPlanesEnabled >> 1) & 1" ], "", None ),
+ ( "GL_CLIP_PLANE2", GLboolean,
+ [ "(ctx->Transform.ClipPlanesEnabled >> 2) & 1" ], "", None ),
+ ( "GL_CLIP_PLANE3", GLboolean,
+ [ "(ctx->Transform.ClipPlanesEnabled >> 3) & 1" ], "", None ),
+ ( "GL_CLIP_PLANE4", GLboolean,
+ [ "(ctx->Transform.ClipPlanesEnabled >> 4) & 1" ], "", None ),
+ ( "GL_CLIP_PLANE5", GLboolean,
+ [ "(ctx->Transform.ClipPlanesEnabled >> 5) & 1" ], "", None ),
+ ( "GL_COLOR_CLEAR_VALUE", GLfloatN,
+ [ "ctx->Color.ClearColor[0]",
+ "ctx->Color.ClearColor[1]",
+ "ctx->Color.ClearColor[2]",
+ "ctx->Color.ClearColor[3]" ], "", None ),
+ ( "GL_COLOR_MATERIAL", GLboolean,
+ ["ctx->Light.ColorMaterialEnabled"], "", None ),
+ ( "GL_COLOR_MATERIAL_FACE", GLenum,
+ ["ctx->Light.ColorMaterialFace"], "", None ),
+ ( "GL_COLOR_MATERIAL_PARAMETER", GLenum,
+ ["ctx->Light.ColorMaterialMode"], "", None ),
+ ( "GL_COLOR_WRITEMASK", GLint,
+ [ "ctx->Color.ColorMask[RCOMP] ? 1 : 0",
+ "ctx->Color.ColorMask[GCOMP] ? 1 : 0",
+ "ctx->Color.ColorMask[BCOMP] ? 1 : 0",
+ "ctx->Color.ColorMask[ACOMP] ? 1 : 0" ], "", None ),
+ ( "GL_CULL_FACE", GLboolean, ["ctx->Polygon.CullFlag"], "", None ),
+ ( "GL_CULL_FACE_MODE", GLenum, ["ctx->Polygon.CullFaceMode"], "", None ),
+ ( "GL_CURRENT_COLOR", GLfloatN,
+ [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][0]",
+ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][1]",
+ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][2]",
+ "ctx->Current.Attrib[VERT_ATTRIB_COLOR0][3]" ],
+ "FLUSH_CURRENT(ctx, 0);", None ),
+ ( "GL_CURRENT_INDEX", GLfloat,
+ [ "ctx->Current.Attrib[VERT_ATTRIB_COLOR_INDEX][0]" ],
+ "FLUSH_CURRENT(ctx, 0);", None ),
+ ( "GL_CURRENT_NORMAL", GLfloatN,
+ [ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][0]",
+ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][1]",
+ "ctx->Current.Attrib[VERT_ATTRIB_NORMAL][2]"],
+ "FLUSH_CURRENT(ctx, 0);", None ),
+ ( "GL_CURRENT_RASTER_COLOR", GLfloatN,
+ ["ctx->Current.RasterColor[0]",
+ "ctx->Current.RasterColor[1]",
+ "ctx->Current.RasterColor[2]",
+ "ctx->Current.RasterColor[3]"], "", None ),
+ ( "GL_CURRENT_RASTER_DISTANCE", GLfloat,
+ ["ctx->Current.RasterDistance"], "", None ),
+ ( "GL_CURRENT_RASTER_INDEX", GLfloat,
+ ["ctx->Current.RasterIndex"], "", None ),
+ ( "GL_CURRENT_RASTER_POSITION", GLfloat,
+ ["ctx->Current.RasterPos[0]",
+ "ctx->Current.RasterPos[1]",
+ "ctx->Current.RasterPos[2]",
+ "ctx->Current.RasterPos[3]"], "", None ),
+ ( "GL_CURRENT_RASTER_SECONDARY_COLOR", GLfloatN,
+ ["ctx->Current.RasterSecondaryColor[0]",
+ "ctx->Current.RasterSecondaryColor[1]",
+ "ctx->Current.RasterSecondaryColor[2]",
+ "ctx->Current.RasterSecondaryColor[3]"], "", None ),
+ ( "GL_CURRENT_RASTER_TEXTURE_COORDS", GLfloat,
+ ["ctx->Current.RasterTexCoords[texUnit][0]",
+ "ctx->Current.RasterTexCoords[texUnit][1]",
+ "ctx->Current.RasterTexCoords[texUnit][2]",
+ "ctx->Current.RasterTexCoords[texUnit][3]"],
+ "const GLuint texUnit = ctx->Texture.CurrentUnit;", None ),
+ ( "GL_CURRENT_RASTER_POSITION_VALID", GLboolean,
+ ["ctx->Current.RasterPosValid"], "", None ),
+ ( "GL_CURRENT_TEXTURE_COORDS", GLfloat,
+ ["ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][0]",
+ "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][1]",
+ "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][2]",
+ "ctx->Current.Attrib[VERT_ATTRIB_TEX0 + texUnit][3]"],
+ "const GLuint texUnit = ctx->Texture.CurrentUnit;", None ),
+ ( "GL_DEPTH_BIAS", GLfloat, ["ctx->Pixel.DepthBias"], "", None ),
+ ( "GL_DEPTH_BITS", GLint, ["ctx->DrawBuffer->Visual.depthBits"],
+ "", None ),
+ ( "GL_DEPTH_CLEAR_VALUE", GLfloat, ["ctx->Depth.Clear"], "", None ),
+ ( "GL_DEPTH_FUNC", GLenum, ["ctx->Depth.Func"], "", None ),
+ ( "GL_DEPTH_RANGE", GLfloatN,
+ [ "ctx->Viewport.Near", "ctx->Viewport.Far" ], "", None ),
+ ( "GL_DEPTH_SCALE", GLfloat, ["ctx->Pixel.DepthScale"], "", None ),
+ ( "GL_DEPTH_TEST", GLboolean, ["ctx->Depth.Test"], "", None ),
+ ( "GL_DEPTH_WRITEMASK", GLboolean, ["ctx->Depth.Mask"], "", None ),
+ ( "GL_DITHER", GLboolean, ["ctx->Color.DitherFlag"], "", None ),
+ ( "GL_DOUBLEBUFFER", GLboolean,
+ ["ctx->DrawBuffer->Visual.doubleBufferMode"], "", None ),
+ ( "GL_DRAW_BUFFER", GLenum, ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", None ),
+ ( "GL_EDGE_FLAG", GLboolean, ["(ctx->Current.Attrib[VERT_ATTRIB_EDGEFLAG][0] == 1.0)"],
+ "FLUSH_CURRENT(ctx, 0);", None ),
+ ( "GL_FEEDBACK_BUFFER_SIZE", GLint, ["ctx->Feedback.BufferSize"], "", None ),
+ ( "GL_FEEDBACK_BUFFER_TYPE", GLenum, ["ctx->Feedback.Type"], "", None ),
+ ( "GL_FOG", GLboolean, ["ctx->Fog.Enabled"], "", None ),
+ ( "GL_FOG_COLOR", GLfloatN,
+ [ "ctx->Fog.Color[0]",
+ "ctx->Fog.Color[1]",
+ "ctx->Fog.Color[2]",
+ "ctx->Fog.Color[3]" ], "", None ),
+ ( "GL_FOG_DENSITY", GLfloat, ["ctx->Fog.Density"], "", None ),
+ ( "GL_FOG_END", GLfloat, ["ctx->Fog.End"], "", None ),
+ ( "GL_FOG_HINT", GLenum, ["ctx->Hint.Fog"], "", None ),
+ ( "GL_FOG_INDEX", GLfloat, ["ctx->Fog.Index"], "", None ),
+ ( "GL_FOG_MODE", GLenum, ["ctx->Fog.Mode"], "", None ),
+ ( "GL_FOG_START", GLfloat, ["ctx->Fog.Start"], "", None ),
+ ( "GL_FRONT_FACE", GLenum, ["ctx->Polygon.FrontFace"], "", None ),
+ ( "GL_GREEN_BIAS", GLfloat, ["ctx->Pixel.GreenBias"], "", None ),
+ ( "GL_GREEN_BITS", GLint, ["ctx->DrawBuffer->Visual.greenBits"],
+ "", None ),
+ ( "GL_GREEN_SCALE", GLfloat, ["ctx->Pixel.GreenScale"], "", None ),
+ ( "GL_INDEX_BITS", GLint, ["ctx->DrawBuffer->Visual.indexBits"],
+ "", None ),
+ ( "GL_INDEX_CLEAR_VALUE", GLint, ["ctx->Color.ClearIndex"], "", None ),
+ ( "GL_INDEX_MODE", GLboolean, ["!ctx->DrawBuffer->Visual.rgbMode"],
+ "", None ),
+ ( "GL_INDEX_OFFSET", GLint, ["ctx->Pixel.IndexOffset"], "", None ),
+ ( "GL_INDEX_SHIFT", GLint, ["ctx->Pixel.IndexShift"], "", None ),
+ ( "GL_INDEX_WRITEMASK", GLint, ["ctx->Color.IndexMask"], "", None ),
+ ( "GL_LIGHT0", GLboolean, ["ctx->Light.Light[0].Enabled"], "", None ),
+ ( "GL_LIGHT1", GLboolean, ["ctx->Light.Light[1].Enabled"], "", None ),
+ ( "GL_LIGHT2", GLboolean, ["ctx->Light.Light[2].Enabled"], "", None ),
+ ( "GL_LIGHT3", GLboolean, ["ctx->Light.Light[3].Enabled"], "", None ),
+ ( "GL_LIGHT4", GLboolean, ["ctx->Light.Light[4].Enabled"], "", None ),
+ ( "GL_LIGHT5", GLboolean, ["ctx->Light.Light[5].Enabled"], "", None ),
+ ( "GL_LIGHT6", GLboolean, ["ctx->Light.Light[6].Enabled"], "", None ),
+ ( "GL_LIGHT7", GLboolean, ["ctx->Light.Light[7].Enabled"], "", None ),
+ ( "GL_LIGHTING", GLboolean, ["ctx->Light.Enabled"], "", None ),
+ ( "GL_LIGHT_MODEL_AMBIENT", GLfloatN,
+ ["ctx->Light.Model.Ambient[0]",
+ "ctx->Light.Model.Ambient[1]",
+ "ctx->Light.Model.Ambient[2]",
+ "ctx->Light.Model.Ambient[3]"], "", None ),
+ ( "GL_LIGHT_MODEL_COLOR_CONTROL", GLenum,
+ ["ctx->Light.Model.ColorControl"], "", None ),
+ ( "GL_LIGHT_MODEL_LOCAL_VIEWER", GLboolean,
+ ["ctx->Light.Model.LocalViewer"], "", None ),
+ ( "GL_LIGHT_MODEL_TWO_SIDE", GLboolean, ["ctx->Light.Model.TwoSide"], "", None ),
+ ( "GL_LINE_SMOOTH", GLboolean, ["ctx->Line.SmoothFlag"], "", None ),
+ ( "GL_LINE_SMOOTH_HINT", GLenum, ["ctx->Hint.LineSmooth"], "", None ),
+ ( "GL_LINE_STIPPLE", GLboolean, ["ctx->Line.StippleFlag"], "", None ),
+ ( "GL_LINE_STIPPLE_PATTERN", GLint, ["ctx->Line.StipplePattern"], "", None ),
+ ( "GL_LINE_STIPPLE_REPEAT", GLint, ["ctx->Line.StippleFactor"], "", None ),
+ ( "GL_LINE_WIDTH", GLfloat, ["ctx->Line.Width"], "", None ),
+ ( "GL_LINE_WIDTH_GRANULARITY", GLfloat,
+ ["ctx->Const.LineWidthGranularity"], "", None ),
+ ( "GL_LINE_WIDTH_RANGE", GLfloat,
+ ["ctx->Const.MinLineWidthAA",
+ "ctx->Const.MaxLineWidthAA"], "", None ),
+ ( "GL_ALIASED_LINE_WIDTH_RANGE", GLfloat,
+ ["ctx->Const.MinLineWidth",
+ "ctx->Const.MaxLineWidth"], "", None ),
+ ( "GL_LIST_BASE", GLint, ["ctx->List.ListBase"], "", None ),
+ ( "GL_LIST_INDEX", GLint, ["ctx->ListState.CurrentListNum"], "", None ),
+ ( "GL_LIST_MODE", GLenum, ["mode"],
+ """GLenum mode;
+ if (!ctx->CompileFlag)
+ mode = 0;
+ else if (ctx->ExecuteFlag)
+ mode = GL_COMPILE_AND_EXECUTE;
+ else
+ mode = GL_COMPILE;""", None ),
+ ( "GL_INDEX_LOGIC_OP", GLboolean, ["ctx->Color.IndexLogicOpEnabled"], "", None ),
+ ( "GL_COLOR_LOGIC_OP", GLboolean, ["ctx->Color.ColorLogicOpEnabled"], "", None ),
+ ( "GL_LOGIC_OP_MODE", GLenum, ["ctx->Color.LogicOp"], "", None ),
+ ( "GL_MAP1_COLOR_4", GLboolean, ["ctx->Eval.Map1Color4"], "", None ),
+ ( "GL_MAP1_GRID_DOMAIN", GLfloat,
+ ["ctx->Eval.MapGrid1u1",
+ "ctx->Eval.MapGrid1u2"], "", None ),
+ ( "GL_MAP1_GRID_SEGMENTS", GLint, ["ctx->Eval.MapGrid1un"], "", None ),
+ ( "GL_MAP1_INDEX", GLboolean, ["ctx->Eval.Map1Index"], "", None ),
+ ( "GL_MAP1_NORMAL", GLboolean, ["ctx->Eval.Map1Normal"], "", None ),
+ ( "GL_MAP1_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map1TextureCoord1"], "", None ),
+ ( "GL_MAP1_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map1TextureCoord2"], "", None ),
+ ( "GL_MAP1_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map1TextureCoord3"], "", None ),
+ ( "GL_MAP1_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map1TextureCoord4"], "", None ),
+ ( "GL_MAP1_VERTEX_3", GLboolean, ["ctx->Eval.Map1Vertex3"], "", None ),
+ ( "GL_MAP1_VERTEX_4", GLboolean, ["ctx->Eval.Map1Vertex4"], "", None ),
+ ( "GL_MAP2_COLOR_4", GLboolean, ["ctx->Eval.Map2Color4"], "", None ),
+ ( "GL_MAP2_GRID_DOMAIN", GLfloat,
+ ["ctx->Eval.MapGrid2u1",
+ "ctx->Eval.MapGrid2u2",
+ "ctx->Eval.MapGrid2v1",
+ "ctx->Eval.MapGrid2v2"], "", None ),
+ ( "GL_MAP2_GRID_SEGMENTS", GLint,
+ ["ctx->Eval.MapGrid2un",
+ "ctx->Eval.MapGrid2vn"], "", None ),
+ ( "GL_MAP2_INDEX", GLboolean, ["ctx->Eval.Map2Index"], "", None ),
+ ( "GL_MAP2_NORMAL", GLboolean, ["ctx->Eval.Map2Normal"], "", None ),
+ ( "GL_MAP2_TEXTURE_COORD_1", GLboolean, ["ctx->Eval.Map2TextureCoord1"], "", None ),
+ ( "GL_MAP2_TEXTURE_COORD_2", GLboolean, ["ctx->Eval.Map2TextureCoord2"], "", None ),
+ ( "GL_MAP2_TEXTURE_COORD_3", GLboolean, ["ctx->Eval.Map2TextureCoord3"], "", None ),
+ ( "GL_MAP2_TEXTURE_COORD_4", GLboolean, ["ctx->Eval.Map2TextureCoord4"], "", None ),
+ ( "GL_MAP2_VERTEX_3", GLboolean, ["ctx->Eval.Map2Vertex3"], "", None ),
+ ( "GL_MAP2_VERTEX_4", GLboolean, ["ctx->Eval.Map2Vertex4"], "", None ),
+ ( "GL_MAP_COLOR", GLboolean, ["ctx->Pixel.MapColorFlag"], "", None ),
+ ( "GL_MAP_STENCIL", GLboolean, ["ctx->Pixel.MapStencilFlag"], "", None ),
+ ( "GL_MATRIX_MODE", GLenum, ["ctx->Transform.MatrixMode"], "", None ),
+
+ ( "GL_MAX_ATTRIB_STACK_DEPTH", GLint, ["MAX_ATTRIB_STACK_DEPTH"], "", None ),
+ ( "GL_MAX_CLIENT_ATTRIB_STACK_DEPTH", GLint, ["MAX_CLIENT_ATTRIB_STACK_DEPTH"], "", None ),
+ ( "GL_MAX_CLIP_PLANES", GLint, ["ctx->Const.MaxClipPlanes"], "", None ),
+ ( "GL_MAX_ELEMENTS_VERTICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
+ ( "GL_MAX_ELEMENTS_INDICES", GLint, ["ctx->Const.MaxArrayLockSize"], "", None ),
+ ( "GL_MAX_EVAL_ORDER", GLint, ["MAX_EVAL_ORDER"], "", None ),
+ ( "GL_MAX_LIGHTS", GLint, ["ctx->Const.MaxLights"], "", None ),
+ ( "GL_MAX_LIST_NESTING", GLint, ["MAX_LIST_NESTING"], "", None ),
+ ( "GL_MAX_MODELVIEW_STACK_DEPTH", GLint, ["MAX_MODELVIEW_STACK_DEPTH"], "", None ),
+ ( "GL_MAX_NAME_STACK_DEPTH", GLint, ["MAX_NAME_STACK_DEPTH"], "", None ),
+ ( "GL_MAX_PIXEL_MAP_TABLE", GLint, ["MAX_PIXEL_MAP_TABLE"], "", None ),
+ ( "GL_MAX_PROJECTION_STACK_DEPTH", GLint, ["MAX_PROJECTION_STACK_DEPTH"], "", None ),
+ ( "GL_MAX_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.MaxTextureLevels - 1)"], "", None ),
+ ( "GL_MAX_3D_TEXTURE_SIZE", GLint, ["1 << (ctx->Const.Max3DTextureLevels - 1)"], "", None ),
+ ( "GL_MAX_TEXTURE_STACK_DEPTH", GLint, ["MAX_TEXTURE_STACK_DEPTH"], "", None ),
+ ( "GL_MAX_VIEWPORT_DIMS", GLint,
+ ["ctx->Const.MaxViewportWidth", "ctx->Const.MaxViewportHeight"],
+ "", None ),
+ ( "GL_MODELVIEW_MATRIX", GLfloat,
+ [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
+ "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
+ "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
+ "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
+ "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
+ ( "GL_MODELVIEW_STACK_DEPTH", GLint, ["ctx->ModelviewMatrixStack.Depth + 1"], "", None ),
+ ( "GL_NAME_STACK_DEPTH", GLint, ["ctx->Select.NameStackDepth"], "", None ),
+ ( "GL_NORMALIZE", GLboolean, ["ctx->Transform.Normalize"], "", None ),
+ ( "GL_PACK_ALIGNMENT", GLint, ["ctx->Pack.Alignment"], "", None ),
+ ( "GL_PACK_LSB_FIRST", GLboolean, ["ctx->Pack.LsbFirst"], "", None ),
+ ( "GL_PACK_ROW_LENGTH", GLint, ["ctx->Pack.RowLength"], "", None ),
+ ( "GL_PACK_SKIP_PIXELS", GLint, ["ctx->Pack.SkipPixels"], "", None ),
+ ( "GL_PACK_SKIP_ROWS", GLint, ["ctx->Pack.SkipRows"], "", None ),
+ ( "GL_PACK_SWAP_BYTES", GLboolean, ["ctx->Pack.SwapBytes"], "", None ),
+ ( "GL_PACK_SKIP_IMAGES_EXT", GLint, ["ctx->Pack.SkipImages"], "", None ),
+ ( "GL_PACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Pack.ImageHeight"], "", None ),
+ ( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", None ),
+ ( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum,
+ ["ctx->Hint.PerspectiveCorrection"], "", None ),
+ ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->PixelMaps.AtoA.Size"], "", None ),
+ ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->PixelMaps.BtoB.Size"], "", None ),
+ ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->PixelMaps.GtoG.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->PixelMaps.ItoA.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->PixelMaps.ItoB.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->PixelMaps.ItoG.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->PixelMaps.ItoI.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->PixelMaps.ItoR.Size"], "", None ),
+ ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->PixelMaps.RtoR.Size"], "", None ),
+ ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->PixelMaps.StoS.Size"], "", None ),
+ ( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ),
+ ( "GL_POINT_SIZE_GRANULARITY", GLfloat,
+ ["ctx->Const.PointSizeGranularity"], "", None ),
+ ( "GL_POINT_SIZE_RANGE", GLfloat,
+ ["ctx->Const.MinPointSizeAA",
+ "ctx->Const.MaxPointSizeAA"], "", None ),
+ ( "GL_ALIASED_POINT_SIZE_RANGE", GLfloat,
+ ["ctx->Const.MinPointSize",
+ "ctx->Const.MaxPointSize"], "", None ),
+ ( "GL_POINT_SMOOTH", GLboolean, ["ctx->Point.SmoothFlag"], "", None ),
+ ( "GL_POINT_SMOOTH_HINT", GLenum, ["ctx->Hint.PointSmooth"], "", None ),
+ ( "GL_POINT_SIZE_MIN_EXT", GLfloat, ["ctx->Point.MinSize"], "", None ),
+ ( "GL_POINT_SIZE_MAX_EXT", GLfloat, ["ctx->Point.MaxSize"], "", None ),
+ ( "GL_POINT_FADE_THRESHOLD_SIZE_EXT", GLfloat,
+ ["ctx->Point.Threshold"], "", None ),
+ ( "GL_DISTANCE_ATTENUATION_EXT", GLfloat,
+ ["ctx->Point.Params[0]",
+ "ctx->Point.Params[1]",
+ "ctx->Point.Params[2]"], "", None ),
+ ( "GL_POLYGON_MODE", GLenum,
+ ["ctx->Polygon.FrontMode",
+ "ctx->Polygon.BackMode"], "", None ),
+ ( "GL_POLYGON_OFFSET_BIAS_EXT", GLfloat, ["ctx->Polygon.OffsetUnits"], "", None ),
+ ( "GL_POLYGON_OFFSET_FACTOR", GLfloat, ["ctx->Polygon.OffsetFactor "], "", None ),
+ ( "GL_POLYGON_OFFSET_UNITS", GLfloat, ["ctx->Polygon.OffsetUnits "], "", None ),
+ ( "GL_POLYGON_SMOOTH", GLboolean, ["ctx->Polygon.SmoothFlag"], "", None ),
+ ( "GL_POLYGON_SMOOTH_HINT", GLenum, ["ctx->Hint.PolygonSmooth"], "", None ),
+ ( "GL_POLYGON_STIPPLE", GLboolean, ["ctx->Polygon.StippleFlag"], "", None ),
+ ( "GL_PROJECTION_MATRIX", GLfloat,
+ [ "matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
+ "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
+ "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
+ "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
+ "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
+ ( "GL_PROJECTION_STACK_DEPTH", GLint,
+ ["ctx->ProjectionMatrixStack.Depth + 1"], "", None ),
+ ( "GL_READ_BUFFER", GLenum, ["ctx->ReadBuffer->ColorReadBuffer"], "", None ),
+ ( "GL_RED_BIAS", GLfloat, ["ctx->Pixel.RedBias"], "", None ),
+ ( "GL_RED_BITS", GLint, ["ctx->DrawBuffer->Visual.redBits"], "", None ),
+ ( "GL_RED_SCALE", GLfloat, ["ctx->Pixel.RedScale"], "", None ),
+ ( "GL_RENDER_MODE", GLenum, ["ctx->RenderMode"], "", None ),
+ ( "GL_RESCALE_NORMAL", GLboolean,
+ ["ctx->Transform.RescaleNormals"], "", None ),
+ ( "GL_RGBA_MODE", GLboolean, ["ctx->DrawBuffer->Visual.rgbMode"],
+ "", None ),
+ ( "GL_SCISSOR_BOX", GLint,
+ ["ctx->Scissor.X",
+ "ctx->Scissor.Y",
+ "ctx->Scissor.Width",
+ "ctx->Scissor.Height"], "", None ),
+ ( "GL_SCISSOR_TEST", GLboolean, ["ctx->Scissor.Enabled"], "", None ),
+ ( "GL_SELECTION_BUFFER_SIZE", GLint, ["ctx->Select.BufferSize"], "", None ),
+ ( "GL_SHADE_MODEL", GLenum, ["ctx->Light.ShadeModel"], "", None ),
+ ( "GL_SHARED_TEXTURE_PALETTE_EXT", GLboolean,
+ ["ctx->Texture.SharedPalette"], "", None ),
+ ( "GL_STENCIL_BITS", GLint, ["ctx->DrawBuffer->Visual.stencilBits"], "", None ),
+ ( "GL_STENCIL_CLEAR_VALUE", GLint, ["ctx->Stencil.Clear"], "", None ),
+ ( "GL_STENCIL_FAIL", GLenum,
+ ["ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]"], "", None ),
+ ( "GL_STENCIL_FUNC", GLenum,
+ ["ctx->Stencil.Function[ctx->Stencil.ActiveFace]"], "", None ),
+ ( "GL_STENCIL_PASS_DEPTH_FAIL", GLenum,
+ ["ctx->Stencil.ZFailFunc[ctx->Stencil.ActiveFace]"], "", None ),
+ ( "GL_STENCIL_PASS_DEPTH_PASS", GLenum,
+ ["ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]"], "", None ),
+ ( "GL_STENCIL_REF", GLint,
+ ["ctx->Stencil.Ref[ctx->Stencil.ActiveFace]"], "", None ),
+ ( "GL_STENCIL_TEST", GLboolean, ["ctx->Stencil.Enabled"], "", None ),
+ ( "GL_STENCIL_VALUE_MASK", GLint,
+ ["ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]"], "", None ),
+ ( "GL_STENCIL_WRITEMASK", GLint,
+ ["ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]"], "", None ),
+ ( "GL_STEREO", GLboolean, ["ctx->DrawBuffer->Visual.stereoMode"],
+ "", None ),
+ ( "GL_SUBPIXEL_BITS", GLint, ["ctx->Const.SubPixelBits"], "", None ),
+ ( "GL_TEXTURE_1D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_1D)"], "", None ),
+ ( "GL_TEXTURE_2D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_2D)"], "", None ),
+ ( "GL_TEXTURE_3D", GLboolean, ["_mesa_IsEnabled(GL_TEXTURE_3D)"], "", None ),
+ ( "GL_TEXTURE_BINDING_1D", GLint,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current1D->Name"], "", None ),
+ ( "GL_TEXTURE_BINDING_2D", GLint,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current2D->Name"], "", None ),
+ ( "GL_TEXTURE_BINDING_3D", GLint,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].Current3D->Name"], "", None ),
+ ( "GL_TEXTURE_ENV_COLOR", GLfloatN,
+ ["color[0]", "color[1]", "color[2]", "color[3]"],
+ "const GLfloat *color = ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvColor;",
+ None ),
+ ( "GL_TEXTURE_ENV_MODE", GLenum,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].EnvMode"], "", None ),
+ ( "GL_TEXTURE_GEN_S", GLboolean,
+ ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)"], "", None ),
+ ( "GL_TEXTURE_GEN_T", GLboolean,
+ ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & T_BIT) ? 1 : 0)"], "", None ),
+ ( "GL_TEXTURE_GEN_R", GLboolean,
+ ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & R_BIT) ? 1 : 0)"], "", None ),
+ ( "GL_TEXTURE_GEN_Q", GLboolean,
+ ["((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & Q_BIT) ? 1 : 0)"], "", None ),
+ ( "GL_TEXTURE_MATRIX", GLfloat,
+ ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
+ "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
+ "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
+ "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
+ "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
+ ( "GL_TEXTURE_STACK_DEPTH", GLint,
+ ["ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1"], "", None ),
+ ( "GL_UNPACK_ALIGNMENT", GLint, ["ctx->Unpack.Alignment"], "", None ),
+ ( "GL_UNPACK_LSB_FIRST", GLboolean, ["ctx->Unpack.LsbFirst"], "", None ),
+ ( "GL_UNPACK_ROW_LENGTH", GLint, ["ctx->Unpack.RowLength"], "", None ),
+ ( "GL_UNPACK_SKIP_PIXELS", GLint, ["ctx->Unpack.SkipPixels"], "", None ),
+ ( "GL_UNPACK_SKIP_ROWS", GLint, ["ctx->Unpack.SkipRows"], "", None ),
+ ( "GL_UNPACK_SWAP_BYTES", GLboolean, ["ctx->Unpack.SwapBytes"], "", None ),
+ ( "GL_UNPACK_SKIP_IMAGES_EXT", GLint, ["ctx->Unpack.SkipImages"], "", None ),
+ ( "GL_UNPACK_IMAGE_HEIGHT_EXT", GLint, ["ctx->Unpack.ImageHeight"], "", None ),
+ ( "GL_UNPACK_CLIENT_STORAGE_APPLE", GLboolean, ["ctx->Unpack.ClientStorage"], "", None ),
+ ( "GL_VIEWPORT", GLint, [ "ctx->Viewport.X", "ctx->Viewport.Y",
+ "ctx->Viewport.Width", "ctx->Viewport.Height" ], "", None ),
+ ( "GL_ZOOM_X", GLfloat, ["ctx->Pixel.ZoomX"], "", None ),
+ ( "GL_ZOOM_Y", GLfloat, ["ctx->Pixel.ZoomY"], "", None ),
+
+ # Vertex arrays
+ ( "GL_VERTEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Vertex.Enabled"], "", None ),
+ ( "GL_VERTEX_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Vertex.Size"], "", None ),
+ ( "GL_VERTEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Vertex.Type"], "", None ),
+ ( "GL_VERTEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Vertex.Stride"], "", None ),
+ ( "GL_VERTEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_NORMAL_ARRAY", GLenum, ["ctx->Array.ArrayObj->Normal.Enabled"], "", None ),
+ ( "GL_NORMAL_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Normal.Type"], "", None ),
+ ( "GL_NORMAL_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Normal.Stride"], "", None ),
+ ( "GL_NORMAL_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_COLOR_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Color.Enabled"], "", None ),
+ ( "GL_COLOR_ARRAY_SIZE", GLint, ["ctx->Array.ArrayObj->Color.Size"], "", None ),
+ ( "GL_COLOR_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Color.Type"], "", None ),
+ ( "GL_COLOR_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Color.Stride"], "", None ),
+ ( "GL_COLOR_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_INDEX_ARRAY", GLboolean, ["ctx->Array.ArrayObj->Index.Enabled"], "", None ),
+ ( "GL_INDEX_ARRAY_TYPE", GLenum, ["ctx->Array.ArrayObj->Index.Type"], "", None ),
+ ( "GL_INDEX_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->Index.Stride"], "", None ),
+ ( "GL_INDEX_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY", GLboolean,
+ ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY_SIZE", GLint,
+ ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY_TYPE", GLenum,
+ ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY_STRIDE", GLint,
+ ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride"], "", None ),
+ ( "GL_TEXTURE_COORD_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+ ( "GL_EDGE_FLAG_ARRAY", GLboolean, ["ctx->Array.ArrayObj->EdgeFlag.Enabled"], "", None ),
+ ( "GL_EDGE_FLAG_ARRAY_STRIDE", GLint, ["ctx->Array.ArrayObj->EdgeFlag.Stride"], "", None ),
+ ( "GL_EDGE_FLAG_ARRAY_COUNT_EXT", GLint, ["0"], "", None ),
+
+ # GL_ARB_multitexture
+ ( "GL_MAX_TEXTURE_UNITS_ARB", GLint,
+ ["ctx->Const.MaxTextureUnits"], "", ["ARB_multitexture"] ),
+ ( "GL_ACTIVE_TEXTURE_ARB", GLint,
+ [ "GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit"], "", ["ARB_multitexture"] ),
+ ( "GL_CLIENT_ACTIVE_TEXTURE_ARB", GLint,
+ ["GL_TEXTURE0_ARB + ctx->Array.ActiveTexture"], "", ["ARB_multitexture"] ),
+
+ # GL_ARB_texture_cube_map
+ ( "GL_TEXTURE_CUBE_MAP_ARB", GLboolean,
+ ["_mesa_IsEnabled(GL_TEXTURE_CUBE_MAP_ARB)"], "", ["ARB_texture_cube_map"] ),
+ ( "GL_TEXTURE_BINDING_CUBE_MAP_ARB", GLint,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentCubeMap->Name"],
+ "", ["ARB_texture_cube_map"] ),
+ ( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB", GLint,
+ ["(1 << (ctx->Const.MaxCubeTextureLevels - 1))"],
+ "", ["ARB_texture_cube_map"]),
+
+ # GL_ARB_texture_compression */
+ ( "GL_TEXTURE_COMPRESSION_HINT_ARB", GLint,
+ ["ctx->Hint.TextureCompression"], "", ["ARB_texture_compression"] ),
+ ( "GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB", GLint,
+ ["_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)"],
+ "", ["ARB_texture_compression"] ),
+ ( "GL_COMPRESSED_TEXTURE_FORMATS_ARB", GLenum,
+ [],
+ """GLint formats[100];
+ GLuint i, n = _mesa_get_compressed_formats(ctx, formats, GL_FALSE);
+ ASSERT(n <= 100);
+ for (i = 0; i < n; i++)
+ params[i] = ENUM_TO_INT(formats[i]);""",
+ ["ARB_texture_compression"] ),
+
+ # GL_EXT_compiled_vertex_array
+ ( "GL_ARRAY_ELEMENT_LOCK_FIRST_EXT", GLint, ["ctx->Array.LockFirst"],
+ "", ["EXT_compiled_vertex_array"] ),
+ ( "GL_ARRAY_ELEMENT_LOCK_COUNT_EXT", GLint, ["ctx->Array.LockCount"],
+ "", ["EXT_compiled_vertex_array"] ),
+
+ # GL_ARB_transpose_matrix
+ ( "GL_TRANSPOSE_COLOR_MATRIX_ARB", GLfloat,
+ ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
+ "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
+ "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
+ "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
+ "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
+ ( "GL_TRANSPOSE_MODELVIEW_MATRIX_ARB", GLfloat,
+ ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
+ "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
+ "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
+ "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
+ "const GLfloat *matrix = ctx->ModelviewMatrixStack.Top->m;", None ),
+ ( "GL_TRANSPOSE_PROJECTION_MATRIX_ARB", GLfloat,
+ ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
+ "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
+ "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
+ "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
+ "const GLfloat *matrix = ctx->ProjectionMatrixStack.Top->m;", None ),
+ ( "GL_TRANSPOSE_TEXTURE_MATRIX_ARB", GLfloat,
+ ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
+ "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
+ "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
+ "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
+ "const GLfloat *matrix = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Top->m;", None ),
+
+ # GL_SGI_color_matrix (also in 1.2 imaging)
+ ( "GL_COLOR_MATRIX_SGI", GLfloat,
+ ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
+ "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
+ "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
+ "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
+ "const GLfloat *matrix = ctx->ColorMatrixStack.Top->m;", None ),
+ ( "GL_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
+ ["ctx->ColorMatrixStack.Depth + 1"], "", None ),
+ ( "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI", GLint,
+ ["MAX_COLOR_STACK_DEPTH"], "", None ),
+ ( "GL_POST_COLOR_MATRIX_RED_SCALE_SGI", GLfloat,
+ ["ctx->Pixel.PostColorMatrixScale[0]"], "", None ),
+ ( "GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI", GLfloat,
+ ["ctx->Pixel.PostColorMatrixScale[1]"], "", None ),
+ ( "GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI", GLfloat,
+ ["ctx->Pixel.PostColorMatrixScale[2]"], "", None ),
+ ( "GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI", GLfloat,
+ ["ctx->Pixel.PostColorMatrixScale[3]"], "", None ),
+ ( "GL_POST_COLOR_MATRIX_RED_BIAS_SGI", GLfloat,
+ ["ctx->Pixel.PostColorMatrixBias[0]"], "", None ),
+ ( "GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI", GLfloat,
+ ["ctx->Pixel.PostColorMatrixBias[1]"], "", None ),
+ ( "GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI", GLfloat,
+ ["ctx->Pixel.PostColorMatrixBias[2]"], "", None ),
+ ( "GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI", GLfloat,
+ ["ctx->Pixel.PostColorMatrixBias[3]"], "", None ),
+
+ # GL_EXT_convolution (also in 1.2 imaging)
+ ( "GL_CONVOLUTION_1D_EXT", GLboolean,
+ ["ctx->Pixel.Convolution1DEnabled"], "", ["EXT_convolution"] ),
+ ( "GL_CONVOLUTION_2D_EXT", GLboolean,
+ ["ctx->Pixel.Convolution2DEnabled"], "", ["EXT_convolution"] ),
+ ( "GL_SEPARABLE_2D_EXT", GLboolean,
+ ["ctx->Pixel.Separable2DEnabled"], "", ["EXT_convolution"] ),
+ ( "GL_POST_CONVOLUTION_RED_SCALE_EXT", GLfloat,
+ ["ctx->Pixel.PostConvolutionScale[0]"], "", ["EXT_convolution"] ),
+ ( "GL_POST_CONVOLUTION_GREEN_SCALE_EXT", GLfloat,
+ ["ctx->Pixel.PostConvolutionScale[1]"], "", ["EXT_convolution"] ),
+ ( "GL_POST_CONVOLUTION_BLUE_SCALE_EXT", GLfloat,
+ ["ctx->Pixel.PostConvolutionScale[2]"], "", ["EXT_convolution"] ),
+ ( "GL_POST_CONVOLUTION_ALPHA_SCALE_EXT", GLfloat,
+ ["ctx->Pixel.PostConvolutionScale[3]"], "", ["EXT_convolution"] ),
+ ( "GL_POST_CONVOLUTION_RED_BIAS_EXT", GLfloat,
+ ["ctx->Pixel.PostConvolutionBias[0]"], "", ["EXT_convolution"] ),
+ ( "GL_POST_CONVOLUTION_GREEN_BIAS_EXT", GLfloat,
+ ["ctx->Pixel.PostConvolutionBias[1]"], "", ["EXT_convolution"] ),
+ ( "GL_POST_CONVOLUTION_BLUE_BIAS_EXT", GLfloat,
+ ["ctx->Pixel.PostConvolutionBias[2]"], "", ["EXT_convolution"] ),
+ ( "GL_POST_CONVOLUTION_ALPHA_BIAS_EXT", GLfloat,
+ ["ctx->Pixel.PostConvolutionBias[3]"], "", ["EXT_convolution"] ),
+
+ # GL_EXT_histogram / GL_ARB_imaging
+ ( "GL_HISTOGRAM", GLboolean,
+ [ "ctx->Pixel.HistogramEnabled" ], "", ["EXT_histogram"] ),
+ ( "GL_MINMAX", GLboolean,
+ [ "ctx->Pixel.MinMaxEnabled" ], "", ["EXT_histogram"] ),
+
+ # GL_SGI_color_table / GL_ARB_imaging
+ ( "GL_COLOR_TABLE_SGI", GLboolean,
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_PRECONVOLUTION]"], "", ["SGI_color_table"] ),
+ ( "GL_POST_CONVOLUTION_COLOR_TABLE_SGI", GLboolean,
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCONVOLUTION]"], "", ["SGI_color_table"] ),
+ ( "GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI", GLboolean,
+ ["ctx->Pixel.ColorTableEnabled[COLORTABLE_POSTCOLORMATRIX]"], "", ["SGI_color_table"] ),
+
+ # GL_SGI_texture_color_table
+ ( "GL_TEXTURE_COLOR_TABLE_SGI", GLboolean,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].ColorTableEnabled"],
+ "", ["SGI_texture_color_table"] ),
+
+ # GL_EXT_secondary_color
+ ( "GL_COLOR_SUM_EXT", GLboolean,
+ ["ctx->Fog.ColorSumEnabled"], "",
+ ["EXT_secondary_color", "ARB_vertex_program"] ),
+ ( "GL_CURRENT_SECONDARY_COLOR_EXT", GLfloatN,
+ ["ctx->Current.Attrib[VERT_ATTRIB_COLOR1][0]",
+ "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][1]",
+ "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][2]",
+ "ctx->Current.Attrib[VERT_ATTRIB_COLOR1][3]"],
+ "FLUSH_CURRENT(ctx, 0);", ["EXT_secondary_color"] ),
+ ( "GL_SECONDARY_COLOR_ARRAY_EXT", GLboolean,
+ ["ctx->Array.ArrayObj->SecondaryColor.Enabled"], "", ["EXT_secondary_color"] ),
+ ( "GL_SECONDARY_COLOR_ARRAY_TYPE_EXT", GLenum,
+ ["ctx->Array.ArrayObj->SecondaryColor.Type"], "", ["EXT_secondary_color"] ),
+ ( "GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT", GLint,
+ ["ctx->Array.ArrayObj->SecondaryColor.Stride"], "", ["EXT_secondary_color"] ),
+ ( "GL_SECONDARY_COLOR_ARRAY_SIZE_EXT", GLint,
+ ["ctx->Array.ArrayObj->SecondaryColor.Size"], "", ["EXT_secondary_color"] ),
+
+ # GL_EXT_fog_coord
+ ( "GL_CURRENT_FOG_COORDINATE_EXT", GLfloat,
+ ["ctx->Current.Attrib[VERT_ATTRIB_FOG][0]"],
+ "FLUSH_CURRENT(ctx, 0);", ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_EXT", GLboolean, ["ctx->Array.ArrayObj->FogCoord.Enabled"],
+ "", ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_TYPE_EXT", GLenum, ["ctx->Array.ArrayObj->FogCoord.Type"],
+ "", ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_STRIDE_EXT", GLint, ["ctx->Array.ArrayObj->FogCoord.Stride"],
+ "", ["EXT_fog_coord"] ),
+ ( "GL_FOG_COORDINATE_SOURCE_EXT", GLenum, ["ctx->Fog.FogCoordinateSource"],
+ "", ["EXT_fog_coord"] ),
+
+ # GL_EXT_texture_lod_bias
+ ( "GL_MAX_TEXTURE_LOD_BIAS_EXT", GLfloat,
+ ["ctx->Const.MaxTextureLodBias"], "", ["EXT_texture_lod_bias"]),
+
+ # GL_EXT_texture_filter_anisotropic
+ ( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT", GLfloat,
+ ["ctx->Const.MaxTextureMaxAnisotropy"], "", ["EXT_texture_filter_anisotropic"]),
+
+ # GL_ARB_multisample
+ ( "GL_MULTISAMPLE_ARB", GLboolean,
+ ["ctx->Multisample.Enabled"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_ALPHA_TO_COVERAGE_ARB", GLboolean,
+ ["ctx->Multisample.SampleAlphaToCoverage"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_ALPHA_TO_ONE_ARB", GLboolean,
+ ["ctx->Multisample.SampleAlphaToOne"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_COVERAGE_ARB", GLboolean,
+ ["ctx->Multisample.SampleCoverage"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_COVERAGE_VALUE_ARB", GLfloat,
+ ["ctx->Multisample.SampleCoverageValue"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_COVERAGE_INVERT_ARB", GLboolean,
+ ["ctx->Multisample.SampleCoverageInvert"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLE_BUFFERS_ARB", GLint,
+ ["ctx->DrawBuffer->Visual.sampleBuffers"], "", ["ARB_multisample"] ),
+ ( "GL_SAMPLES_ARB", GLint,
+ ["ctx->DrawBuffer->Visual.samples"], "", ["ARB_multisample"] ),
+
+ # GL_IBM_rasterpos_clip
+ ( "GL_RASTER_POSITION_UNCLIPPED_IBM", GLboolean,
+ ["ctx->Transform.RasterPositionUnclipped"], "", ["IBM_rasterpos_clip"] ),
+
+ # GL_NV_point_sprite
+ ( "GL_POINT_SPRITE_NV", GLboolean, ["ctx->Point.PointSprite"], # == GL_POINT_SPRITE_ARB
+ "", ["NV_point_sprite", "ARB_point_sprite"] ),
+ ( "GL_POINT_SPRITE_R_MODE_NV", GLenum, ["ctx->Point.SpriteRMode"],
+ "", ["NV_point_sprite"] ),
+ ( "GL_POINT_SPRITE_COORD_ORIGIN", GLenum, ["ctx->Point.SpriteOrigin"],
+ "", ["NV_point_sprite", "ARB_point_sprite"] ),
+
+ # GL_SGIS_generate_mipmap
+ ( "GL_GENERATE_MIPMAP_HINT_SGIS", GLenum, ["ctx->Hint.GenerateMipmap"],
+ "", ["SGIS_generate_mipmap"] ),
+
+ # GL_NV_vertex_program
+ ( "GL_VERTEX_PROGRAM_BINDING_NV", GLint,
+ ["(ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)"],
+ "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY0_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[0].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY1_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[1].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY2_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[2].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY3_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[3].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY4_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[4].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY5_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[5].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY6_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[6].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY7_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[7].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY8_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[8].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY9_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[9].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY10_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[10].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY11_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[11].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY12_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[12].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY13_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[13].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY14_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[14].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_VERTEX_ATTRIB_ARRAY15_NV", GLboolean,
+ ["ctx->Array.ArrayObj->VertexAttrib[15].Enabled"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB0_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[0]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB1_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[1]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB2_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[2]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB3_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[3]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB4_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[4]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB5_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[5]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB6_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[6]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB7_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[7]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB8_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[8]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB9_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[9]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB10_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[10]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB11_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[11]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB12_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[12]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB13_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[13]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB14_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[14]"], "", ["NV_vertex_program"] ),
+ ( "GL_MAP1_VERTEX_ATTRIB15_4_NV", GLboolean,
+ ["ctx->Eval.Map1Attrib[15]"], "", ["NV_vertex_program"] ),
+
+ # GL_NV_fragment_program
+ ( "GL_FRAGMENT_PROGRAM_NV", GLboolean,
+ ["ctx->FragmentProgram.Enabled"], "", ["NV_fragment_program"] ),
+ ( "GL_FRAGMENT_PROGRAM_BINDING_NV", GLint,
+ ["ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0"],
+ "", ["NV_fragment_program"] ),
+ ( "GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV", GLint,
+ ["MAX_NV_FRAGMENT_PROGRAM_PARAMS"], "", ["NV_fragment_program"] ),
+
+ # GL_NV_texture_rectangle
+ ( "GL_TEXTURE_RECTANGLE_NV", GLboolean,
+ ["_mesa_IsEnabled(GL_TEXTURE_RECTANGLE_NV)"], "", ["NV_texture_rectangle"] ),
+ ( "GL_TEXTURE_BINDING_RECTANGLE_NV", GLint,
+ ["ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentRect->Name"],
+ "", ["NV_texture_rectangle"] ),
+ ( "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV", GLint,
+ ["ctx->Const.MaxTextureRectSize"], "", ["NV_texture_rectangle"] ),
+
+ # GL_EXT_stencil_two_side
+ ( "GL_STENCIL_TEST_TWO_SIDE_EXT", GLboolean,
+ ["ctx->Stencil.TestTwoSide"], "", ["EXT_stencil_two_side"] ),
+ ( "GL_ACTIVE_STENCIL_FACE_EXT", GLenum,
+ ["ctx->Stencil.ActiveFace ? GL_BACK : GL_FRONT"],
+ "", ["EXT_stencil_two_side"] ),
+
+ # GL_NV_light_max_exponent
+ ( "GL_MAX_SHININESS_NV", GLfloat,
+ ["ctx->Const.MaxShininess"], "", ["NV_light_max_exponent"] ),
+ ( "GL_MAX_SPOT_EXPONENT_NV", GLfloat,
+ ["ctx->Const.MaxSpotExponent"], "", ["NV_light_max_exponent"] ),
+
+ # GL_ARB_vertex_buffer_object
+ ( "GL_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ArrayBufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_VERTEX_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ArrayObj->Vertex.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_NORMAL_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ArrayObj->Normal.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ArrayObj->Color.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_INDEX_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ArrayObj->Index.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name"],
+ "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name"], "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name"],
+ "", ["ARB_vertex_buffer_object"] ),
+ ( "GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ArrayObj->FogCoord.BufferObj->Name"],
+ "", ["ARB_vertex_buffer_object"] ),
+ # GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB - not supported
+ ( "GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB", GLint,
+ ["ctx->Array.ElementArrayBufferObj->Name"],
+ "", ["ARB_vertex_buffer_object"] ),
+
+ # GL_EXT_pixel_buffer_object
+ ( "GL_PIXEL_PACK_BUFFER_BINDING_EXT", GLint,
+ ["ctx->Pack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
+ ( "GL_PIXEL_UNPACK_BUFFER_BINDING_EXT", GLint,
+ ["ctx->Unpack.BufferObj->Name"], "", ["EXT_pixel_buffer_object"] ),
+
+ # GL_ARB_vertex_program
+ ( "GL_VERTEX_PROGRAM_ARB", GLboolean, # == GL_VERTEX_PROGRAM_NV
+ ["ctx->VertexProgram.Enabled"], "",
+ ["ARB_vertex_program", "NV_vertex_program"] ),
+ ( "GL_VERTEX_PROGRAM_POINT_SIZE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_POINT_SIZE_NV
+ ["ctx->VertexProgram.PointSizeEnabled"], "",
+ ["ARB_vertex_program", "NV_vertex_program"] ),
+ ( "GL_VERTEX_PROGRAM_TWO_SIDE_ARB", GLboolean, # == GL_VERTEX_PROGRAM_TWO_SIDE_NV
+ ["ctx->VertexProgram.TwoSideEnabled"], "",
+ ["ARB_vertex_program", "NV_vertex_program"] ),
+ ( "GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB", GLint, # == GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV
+ ["ctx->Const.MaxProgramMatrixStackDepth"], "",
+ ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
+ ( "GL_MAX_PROGRAM_MATRICES_ARB", GLint, # == GL_MAX_TRACK_MATRICES_NV
+ ["ctx->Const.MaxProgramMatrices"], "",
+ ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
+ ( "GL_CURRENT_MATRIX_STACK_DEPTH_ARB", GLboolean, # == GL_CURRENT_MATRIX_STACK_DEPTH_NV
+ ["ctx->CurrentStack->Depth + 1"], "",
+ ["ARB_vertex_program", "ARB_fragment_program", "NV_vertex_program"] ),
+ ( "GL_CURRENT_MATRIX_ARB", GLfloat, # == GL_CURRENT_MATRIX_NV
+ ["matrix[0]", "matrix[1]", "matrix[2]", "matrix[3]",
+ "matrix[4]", "matrix[5]", "matrix[6]", "matrix[7]",
+ "matrix[8]", "matrix[9]", "matrix[10]", "matrix[11]",
+ "matrix[12]", "matrix[13]", "matrix[14]", "matrix[15]" ],
+ "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
+ ["ARB_vertex_program", "ARB_fragment_program", "NV_fragment_program"] ),
+ ( "GL_TRANSPOSE_CURRENT_MATRIX_ARB", GLfloat,
+ ["matrix[0]", "matrix[4]", "matrix[8]", "matrix[12]",
+ "matrix[1]", "matrix[5]", "matrix[9]", "matrix[13]",
+ "matrix[2]", "matrix[6]", "matrix[10]", "matrix[14]",
+ "matrix[3]", "matrix[7]", "matrix[11]", "matrix[15]"],
+ "const GLfloat *matrix = ctx->CurrentStack->Top->m;",
+ ["ARB_vertex_program", "ARB_fragment_program"] ),
+ ( "GL_MAX_VERTEX_ATTRIBS_ARB", GLint,
+ ["ctx->Const.VertexProgram.MaxAttribs"], "", ["ARB_vertex_program"] ),
+ ( "GL_PROGRAM_ERROR_POSITION_ARB", GLint, # == GL_PROGRAM_ERROR_POSITION_NV
+ ["ctx->Program.ErrorPos"], "", ["NV_vertex_program",
+ "ARB_vertex_program", "NV_fragment_program", "ARB_fragment_program"] ),
+
+ # GL_ARB_fragment_program
+ ( "GL_FRAGMENT_PROGRAM_ARB", GLboolean,
+ ["ctx->FragmentProgram.Enabled"], "", ["ARB_fragment_program"] ),
+ ( "GL_MAX_TEXTURE_COORDS_ARB", GLint, # == GL_MAX_TEXTURE_COORDS_NV
+ ["ctx->Const.MaxTextureCoordUnits"], "",
+ ["ARB_fragment_program", "NV_fragment_program"] ),
+ ( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB", GLint, # == GL_MAX_TEXTURE_IMAGE_UNITS_NV
+ ["ctx->Const.MaxTextureImageUnits"], "",
+ ["ARB_fragment_program", "NV_fragment_program"] ),
+
+ # GL_EXT_depth_bounds_test
+ ( "GL_DEPTH_BOUNDS_TEST_EXT", GLboolean,
+ ["ctx->Depth.BoundsTest"], "", ["EXT_depth_bounds_test"] ),
+ ( "GL_DEPTH_BOUNDS_EXT", GLfloat,
+ ["ctx->Depth.BoundsMin", "ctx->Depth.BoundsMax"],
+ "", ["EXT_depth_bounds_test"] ),
+
+ # GL_MESA_program_debug
+ ( "GL_FRAGMENT_PROGRAM_CALLBACK_MESA", GLboolean,
+ ["ctx->FragmentProgram.CallbackEnabled"], "", ["MESA_program_debug"] ),
+ ( "GL_VERTEX_PROGRAM_CALLBACK_MESA", GLboolean,
+ ["ctx->VertexProgram.CallbackEnabled"], "", ["MESA_program_debug"] ),
+ ( "GL_FRAGMENT_PROGRAM_POSITION_MESA", GLint,
+ ["ctx->FragmentProgram.CurrentPosition"], "", ["MESA_program_debug"] ),
+ ( "GL_VERTEX_PROGRAM_POSITION_MESA", GLint,
+ ["ctx->VertexProgram.CurrentPosition"], "", ["MESA_program_debug"] ),
+
+ # GL_ARB_draw_buffers
+ ( "GL_MAX_DRAW_BUFFERS_ARB", GLint,
+ ["ctx->Const.MaxDrawBuffers"], "", ["ARB_draw_buffers"] ),
+ ( "GL_DRAW_BUFFER0_ARB", GLenum,
+ ["ctx->DrawBuffer->ColorDrawBuffer[0]"], "", ["ARB_draw_buffers"] ),
+ ( "GL_DRAW_BUFFER1_ARB", GLenum,
+ ["buffer"],
+ """GLenum buffer;
+ if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+ return;
+ }
+ buffer = ctx->DrawBuffer->ColorDrawBuffer[1];""", ["ARB_draw_buffers"] ),
+ ( "GL_DRAW_BUFFER2_ARB", GLenum,
+ ["buffer"],
+ """GLenum buffer;
+ if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+ return;
+ }
+ buffer = ctx->DrawBuffer->ColorDrawBuffer[2];""", ["ARB_draw_buffers"] ),
+ ( "GL_DRAW_BUFFER3_ARB", GLenum,
+ ["buffer"],
+ """GLenum buffer;
+ if (pname - GL_DRAW_BUFFER0_ARB >= ctx->Const.MaxDrawBuffers) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGet(GL_DRAW_BUFFERx_ARB)");
+ return;
+ }
+ buffer = ctx->DrawBuffer->ColorDrawBuffer[3];""", ["ARB_draw_buffers"] ),
+ # XXX Add more GL_DRAW_BUFFERn_ARB entries as needed in the future
+
+ # GL_OES_read_format
+ ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint,
+ ["ctx->Const.ColorReadType"], "", ["OES_read_format"] ),
+ ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint,
+ ["ctx->Const.ColorReadFormat"], "", ["OES_read_format"] ),
+
+ # GL_ATI_fragment_shader
+ ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ),
+ ( "GL_NUM_FRAGMENT_CONSTANTS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
+ ( "GL_NUM_PASSES_ATI", GLint, ["2"], "", ["ATI_fragment_shader"] ),
+ ( "GL_NUM_INSTRUCTIONS_PER_PASS_ATI", GLint, ["8"], "", ["ATI_fragment_shader"] ),
+ ( "GL_NUM_INSTRUCTIONS_TOTAL_ATI", GLint, ["16"], "", ["ATI_fragment_shader"] ),
+ ( "GL_COLOR_ALPHA_PAIRING_ATI", GLboolean, ["GL_TRUE"], "", ["ATI_fragment_shader"] ),
+ ( "GL_NUM_LOOPBACK_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
+ ( "GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", GLint, ["3"], "", ["ATI_fragment_shader"] ),
+
+ # OpenGL 2.0
+ ( "GL_STENCIL_BACK_FUNC", GLenum, ["ctx->Stencil.Function[1]"], "", None ),
+ ( "GL_STENCIL_BACK_VALUE_MASK", GLint, ["ctx->Stencil.ValueMask[1]"], "", None ),
+ ( "GL_STENCIL_BACK_WRITEMASK", GLint, ["ctx->Stencil.WriteMask[1]"], "", None ),
+ ( "GL_STENCIL_BACK_REF", GLint, ["ctx->Stencil.Ref[1]"], "", None ),
+ ( "GL_STENCIL_BACK_FAIL", GLenum, ["ctx->Stencil.FailFunc[1]"], "", None ),
+ ( "GL_STENCIL_BACK_PASS_DEPTH_FAIL", GLenum, ["ctx->Stencil.ZFailFunc[1]"], "", None ),
+ ( "GL_STENCIL_BACK_PASS_DEPTH_PASS", GLenum, ["ctx->Stencil.ZPassFunc[1]"], "", None ),
+
+ # GL_EXT_framebuffer_object
+ ( "GL_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->DrawBuffer->Name"], "",
+ ["EXT_framebuffer_object"] ),
+ ( "GL_RENDERBUFFER_BINDING_EXT", GLint,
+ ["ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0"], "",
+ ["EXT_framebuffer_object"] ),
+ ( "GL_MAX_COLOR_ATTACHMENTS_EXT", GLint,
+ ["ctx->Const.MaxColorAttachments"], "",
+ ["EXT_framebuffer_object"] ),
+ ( "GL_MAX_RENDERBUFFER_SIZE_EXT", GLint,
+ ["ctx->Const.MaxRenderbufferSize"], "",
+ ["EXT_framebuffer_object"] ),
+
+ # GL_EXT_framebuffer_blit
+ # NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT
+ ( "GL_READ_FRAMEBUFFER_BINDING_EXT", GLint, ["ctx->ReadBuffer->Name"], "",
+ ["EXT_framebuffer_blit"] ),
+
+ # GL_ARB_fragment_shader
+ ( "GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", GLint,
+ ["ctx->Const.FragmentProgram.MaxUniformComponents"], "",
+ ["ARB_fragment_shader"] ),
+ ( "GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB", GLenum,
+ ["ctx->Hint.FragmentShaderDerivative"], "", ["ARB_fragment_shader"] ),
+
+ # GL_ARB_vertex_shader
+ ( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB", GLint,
+ ["ctx->Const.VertexProgram.MaxUniformComponents"], "",
+ ["ARB_vertex_shader"] ),
+ ( "GL_MAX_VARYING_FLOATS_ARB", GLint,
+ ["ctx->Const.MaxVarying * 4"], "", ["ARB_vertex_shader"] ),
+ ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint,
+ ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ),
+ ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint,
+ ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ),
+
+ # GL_ARB_shader_objects
+ # Actually, this token isn't part of GL_ARB_shader_objects, but is
+ # close enough for now.
+ ( "GL_CURRENT_PROGRAM", GLint,
+ ["ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0"],
+ "", ["ARB_shader_objects"] )
+]
+
+
+def ConversionFunc(fromType, toType):
+ """Return the name of the macro to convert between two data types."""
+ if fromType == toType:
+ return ""
+ elif fromType == GLfloat and toType == GLint:
+ return "IROUND"
+ elif fromType == GLfloatN and toType == GLfloat:
+ return ""
+ elif fromType == GLint and toType == GLfloat: # but not GLfloatN!
+ return "(GLfloat)"
+ else:
+ if fromType == GLfloatN:
+ fromType = GLfloat
+ fromStr = TypeStrings[fromType]
+ fromStr = string.upper(fromStr[2:])
+ toStr = TypeStrings[toType]
+ toStr = string.upper(toStr[2:])
+ return fromStr + "_TO_" + toStr
+
+
+def EmitGetFunction(stateVars, returnType):
+ """Emit the code to implement glGetBooleanv, glGetIntegerv or glGetFloatv."""
+ assert (returnType == GLboolean or
+ returnType == GLint or
+ returnType == GLfloat)
+
+ strType = TypeStrings[returnType]
+ # Capitalize first letter of return type
+ if returnType == GLint:
+ function = "GetIntegerv"
+ elif returnType == GLboolean:
+ function = "GetBooleanv"
+ elif returnType == GLfloat:
+ function = "GetFloatv"
+ else:
+ abort()
+
+ print "void GLAPIENTRY"
+ print "_mesa_%s( GLenum pname, %s *params )" % (function, strType)
+ print "{"
+ print " GET_CURRENT_CONTEXT(ctx);"
+ print " ASSERT_OUTSIDE_BEGIN_END(ctx);"
+ print ""
+ print " if (!params)"
+ print " return;"
+ print ""
+ print " if (ctx->NewState)"
+ print " _mesa_update_state(ctx);"
+ print ""
+ print " if (ctx->Driver.%s &&" % function
+ print " ctx->Driver.%s(ctx, pname, params))" % function
+ print " return;"
+ print ""
+ print " switch (pname) {"
+
+ for (name, varType, state, optionalCode, extensions) in stateVars:
+ print " case " + name + ":"
+ if extensions:
+ if len(extensions) == 1:
+ print (' CHECK_EXT1(%s, "%s");' %
+ (extensions[0], function))
+ elif len(extensions) == 2:
+ print (' CHECK_EXT2(%s, %s, "%s");' %
+ (extensions[0], extensions[1], function))
+ elif len(extensions) == 3:
+ print (' CHECK_EXT3(%s, %s, %s, "%s");' %
+ (extensions[0], extensions[1], extensions[2], function))
+ else:
+ assert len(extensions) == 4
+ print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' %
+ (extensions[0], extensions[1], extensions[2], extensions[3], function))
+ if optionalCode:
+ print " {"
+ print " " + optionalCode
+ conversion = ConversionFunc(varType, returnType)
+ n = len(state)
+ for i in range(n):
+ if conversion:
+ print " params[%d] = %s(%s);" % (i, conversion, state[i])
+ else:
+ print " params[%d] = %s;" % (i, state[i])
+ if optionalCode:
+ print " }"
+ print " break;"
+
+ print " default:"
+ print ' _mesa_error(ctx, GL_INVALID_ENUM, "gl%s(pname=0x%%x)", pname);' % function
+ print " }"
+ print "}"
+ print ""
+ return
+
+
+
+def EmitHeader():
+ """Print the get.c file header."""
+ print """
+/***
+ *** NOTE!!! DO NOT EDIT THIS FILE!!! IT IS GENERATED BY get_gen.py
+ ***/
+
+#include "glheader.h"
+#include "context.h"
+#include "enable.h"
+#include "extensions.h"
+#include "fbobject.h"
+#include "get.h"
+#include "macros.h"
+#include "mtypes.h"
+#include "state.h"
+#include "texcompress.h"
+
+
+#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
+
+#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
+
+#define ENUM_TO_BOOLEAN(E) ( (E) ? GL_TRUE : GL_FALSE )
+#define ENUM_TO_INT(E) ( (GLint) (E) )
+#define ENUM_TO_FLOAT(E) ( (GLfloat) (E) )
+
+#define BOOLEAN_TO_INT(B) ( (GLint) (B) )
+#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
+
+
+/*
+ * Check if named extension is enabled, if not generate error and return.
+ */
+#define CHECK_EXT1(EXT1, FUNC) \\
+ if (!ctx->Extensions.EXT1) { \\
+ _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
+ return; \\
+ }
+
+/*
+ * Check if either of two extensions is enabled.
+ */
+#define CHECK_EXT2(EXT1, EXT2, FUNC) \\
+ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2) { \\
+ _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
+ return; \\
+ }
+
+/*
+ * Check if either of three extensions is enabled.
+ */
+#define CHECK_EXT3(EXT1, EXT2, EXT3, FUNC) \\
+ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\
+ !ctx->Extensions.EXT3) { \\
+ _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
+ return; \\
+ }
+
+/*
+ * Check if either of four extensions is enabled.
+ */
+#define CHECK_EXT4(EXT1, EXT2, EXT3, EXT4, FUNC) \\
+ if (!ctx->Extensions.EXT1 && !ctx->Extensions.EXT2 && \\
+ !ctx->Extensions.EXT3 && !ctx->Extensions.EXT4) { \\
+ _mesa_error(ctx, GL_INVALID_ENUM, FUNC "(0x%x)", (int) pname); \\
+ return; \\
+ }
+
+"""
+ return
+
+
+
+def EmitGetDoublev():
+ print """
+void GLAPIENTRY
+_mesa_GetDoublev( GLenum pname, GLdouble *params )
+{
+ const GLfloat magic = -1234.5F;
+ GLfloat values[16];
+ GLuint i;
+
+ if (!params)
+ return;
+
+ /* Init temp array to magic numbers so we can figure out how many values
+ * are returned by the GetFloatv() call.
+ */
+ for (i = 0; i < 16; i++)
+ values[i] = magic;
+
+ _mesa_GetFloatv(pname, values);
+
+ for (i = 0; i < 16 && values[i] != magic; i++)
+ params[i] = (GLdouble) values[i];
+}
+"""
+
+
+
+
+EmitHeader()
+# XXX Maybe sort the StateVars list
+EmitGetFunction(StateVars, GLboolean)
+EmitGetFunction(StateVars, GLfloat)
+EmitGetFunction(StateVars, GLint)
+EmitGetDoublev()
+
--- mesa-7.0.3.orig/src/mesa/main/Makefile.ugl
+++ mesa-7.0.3/src/mesa/main/Makefile.ugl
@@ -0,0 +1,364 @@
+# Mesa 3-D graphics library
+# Version: 4.1
+#
+# Copyright (C) 2001 Wind River Systems, Inc
+
+# The MIT License
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+# Makefile for core library
+
+# This makefile can moved all objects files in MESA_OBJ for use with
+# ld in windShell or create a library from objects files in their
+# associated .c folder.
+#
+# For an easy inclusion of lib$(CPU)$(TOOL)GL.a in vxworks image, this
+# makefile collects together all .o in an only file
+# (obj$(CPU)$(TOOL)GL.o). This operation is unnecessary for
+# lib$(CPU)$(TOOL)OSMesa.a and lib$(CPU)$(TOOL)UglMesa.a because they
+# already contain only one file.
+#
+##### MACROS #####
+MESA_MAJOR=4
+MESA_MINOR=1
+MESA_TINY=0
+VERSION=$(MESA_MAJOR).$(MESA_MINOR)
+
+GL_MAJOR = 1
+GL_MINOR = 2
+GL_TINY = 0$(MESA_MAJOR)0$(MESA_MINOR)0$(MESA_TINY)
+
+##### RULES #####
+
+include ..\rules.windml
+
+#### GL #####
+
+GL_SOURCES = \
+ api_arrayelt.c \
+ api_loopback.c \
+ api_noop.c \
+ api_validate.c \
+ accum.c \
+ arbprogram.c \
+ attrib.c \
+ blend.c \
+ bufferobj.c \
+ buffers.c \
+ clip.c \
+ colortab.c \
+ context.c \
+ convolve.c \
+ debug.c \
+ depth.c \
+ dispatch.c \
+ dlist.c \
+ drawpix.c \
+ enable.c \
+ enums.c \
+ eval.c \
+ extensions.c \
+ feedback.c \
+ fog.c \
+ get.c \
+ glapi.c \
+ glthread.c \
+ hash.c \
+ hint.c \
+ histogram.c \
+ image.c \
+ imports.c \
+ light.c \
+ lines.c \
+ matrix.c \
+ pixel.c \
+ points.c \
+ polygon.c \
+ rastpos.c \
+ state.c \
+ stencil.c \
+ texcompress.c \
+ texformat.c \
+ teximage.c \
+ texobj.c \
+ texstate.c \
+ texstore.c \
+ texutil.c \
+ varray.c \
+ vtxfmt.c \
+ X86/x86.c \
+ X86/common_x86.c \
+ X86/3dnow.c \
+ X86/sse.c \
+ math/m_debug_clip.c \
+ math/m_debug_norm.c \
+ math/m_debug_vertex.c \
+ math/m_debug_xform.c \
+ math/m_eval.c \
+ math/m_matrix.c \
+ math/m_translate.c \
+ math/m_vector.c \
+ math/m_vertices.c \
+ math/m_xform.c \
+ array_cache/ac_context.c \
+ array_cache/ac_import.c \
+ swrast/s_aaline.c \
+ swrast/s_aatriangle.c \
+ swrast/s_accum.c \
+ swrast/s_alpha.c \
+ swrast/s_alphabuf.c \
+ swrast/s_bitmap.c \
+ swrast/s_blend.c \
+ swrast/s_buffers.c \
+ swrast/s_copypix.c \
+ swrast/s_context.c \
+ swrast/s_depth.c \
+ swrast/s_drawpix.c \
+ swrast/s_feedback.c \
+ swrast/s_fog.c \
+ swrast/s_imaging.c \
+ swrast/s_lines.c \
+ swrast/s_logic.c \
+ swrast/s_masking.c \
+ swrast/s_pixeltex.c \
+ swrast/s_points.c \
+ swrast/s_readpix.c \
+ swrast/s_span.c \
+ swrast/s_stencil.c \
+ swrast/s_texture.c \
+ swrast/s_texstore.c \
+ swrast/s_triangle.c \
+ swrast/s_zoom.c \
+ swrast_setup/ss_context.c \
+ swrast_setup/ss_triangle.c \
+ swrast_setup/ss_vb.c \
+ tnl/t_array_api.c \
+ tnl/t_array_import.c \
+ tnl/t_context.c \
+ tnl/t_eval_api.c \
+ tnl/t_imm_alloc.c \
+ tnl/t_imm_api.c \
+ tnl/t_imm_debug.c \
+ tnl/t_imm_dlist.c \
+ tnl/t_imm_elt.c \
+ tnl/t_imm_eval.c \
+ tnl/t_imm_exec.c \
+ tnl/t_imm_fixup.c \
+ tnl/t_pipeline.c \
+ tnl/t_vb_fog.c \
+ tnl/t_vb_light.c \
+ tnl/t_vb_normals.c \
+ tnl/t_vb_points.c \
+ tnl/t_vb_render.c \
+ tnl/t_vb_texgen.c \
+ tnl/t_vb_texmat.c \
+ tnl/t_vb_vertex.c
+
+GL_OBJECTS = $(GL_SOURCES:.c=.o)
+GL_OBJNAME = $(MESA_LIBDIR)/objMesaGL.o
+
+#### X86 #####
+
+x86_files = \
+ X86/common_x86_asm.S \
+ X86/glapi_x86.S \
+ X86/x86_cliptest.S \
+ X86/x86_vertex.S \
+ X86/x86_xform2.S \
+ X86/x86_xform3.S \
+ X86/x86_xform4.S \
+
+x3dnow_files = \
+ X86/3dnow_normal.S \
+ X86/3dnow_vertex.S \
+ X86/3dnow_xform1.S \
+ X86/3dnow_xform2.S \
+ X86/3dnow_xform3.S \
+ X86/3dnow_xform4.S
+
+sse_files = \
+ X86/sse_normal.S \
+ X86/sse_vertex.S \
+ X86/sse_xform1.S \
+ X86/sse_xform2.S \
+ X86/sse_xform3.S \
+ X86/sse_xform4.S
+
+mmx_files = X86/mmx_blend.S
+
+X86_OBJNAME = $(MESA_LIBDIR)/objMesaX86.o
+
+##### UGL #####
+
+UGL_SOURCES = \
+ windml/ugl_api.c \
+ windml/ugl_dd.c \
+ windml/ugl_span.c \
+ windml/ugl_line.c \
+ windml/ugl_tri.c \
+ windml/tornado/torMesaUGLInit.c
+
+UGL_OBJECTS = $(UGL_SOURCES:.c=.o)
+UGL_OBJNAME = $(MESA_LIBDIR)/objMesaUGL.o
+
+##### OS #####
+
+OS_SOURCES = OSmesa/osmesa.c windml/tornado/torMesaOSInit.c
+OS_OBJECTS = $(OS_SOURCES:.c=.o)
+OS_OBJNAME = $(MESA_LIBDIR)/objMesaOS.o
+
+##### GLUTSHAPES #####
+
+GLUTSHAPES_SOURCES = \
+ windml/ugl_glutshapes.c \
+ windml/tornado/torGLUTShapesInit.c
+
+GLUTSHAPES_OBJECTS = $(GLUTSHAPES_SOURCES:.c=.o)
+GLUTSHAPES_OBJNAME = $(MESA_LIBDIR)/objGLUTShapes.o
+
+SOURCES = $(GL_SOURCES) $(UGL_SOURCES) $(OS_SOURCES) \
+ $(GLUTSHAPES_SOURCES)
+
+##### TARGETS #####
+
+all: depend.$(CPU)$(TOOL) cfgX86 $(X86_OBJNAME) $(GL_OBJNAME)\
+$(UGL_OBJNAME) $(OS_OBJNAME) $(GLUTSHAPES_OBJNAME)
+
+#histogram.o:
+# $(CC) $(CFLAGS) -O1 $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $<
+
+#image.o:
+# $(CC) $(CFLAGS) -O1 $(OPTION_OBJECT_ONLY) $(OPTION_OBJECT_NAME)$@ $<
+
+cfgX86:
+ifdef HAVE_3DNOW
+x3dnow_sources = $(x3dnow_files)
+CFLAGS_3DNOW = -DUSE_3DNOW_ASM
+HAVE_X86 = 1
+endif
+ifdef HAVE_SSE
+sse_sources = $(sse_files)
+CFLAGS_SSE = -DUSE_SSE_ASM
+HAVE_X86 = 1
+endif
+ifdef HAVE_MMX
+mmx_sources = $(mmx_files)
+CFLAGS_MMX = -DUSE_MMX_ASM
+HAVE_X86 = 1
+endif
+ifdef HAVE_X86
+x86_sources = $(x86_files)
+CFLAGS_X86 = -DUSE_X86_ASM
+endif
+X86_SOURCES = $(x86_sources) $(mmx_sources) \
+ $(x3dnow_sources) $(sse_sources)
+X86_OBJECTS = $(X86_SOURCES:.S=.o)
+CFLAGS_USE_X86 = $(CFLAGS_3DNOW) $(CFLAGS_SSE) $(CFLAGS_MMX) $(CFLAGS_X86)
+
+#X86/matypes.h: mtypes.h tnl/t_context.h X86/gen_matypes.c
+# $(CC) -I ./ X86/gen_matypes.c -o X86/gen_matypes
+# ./X86/gen_matypes > X86/matypes.h
+# $(RM) X86/gen_matypes
+# $(RM) X86/gen_matypes.o
+
+# Make the Mesax86 library
+$(X86_OBJNAME): $(X86_OBJECTS)
+ifdef HAVE_X86
+# $(LD) -r $(X86_OBJECTS) -o $(MESA_OBJNAME)
+ $(LD) -r $(X86_OBJECTS) -o $(X86_OBJNAME)
+# $(AR) rus $(MESA_LIBNAME) $(X86_OBJNAME)
+# $(RM) $(X86_OBJNAME)
+endif
+
+# Make the GL library
+$(GL_OBJNAME): $(GL_OBJECTS)
+# $(LD) -r $(GL_OBJECTS) -o $(MESA_OBJNAME)
+ $(LD) -r $(GL_OBJECTS) -o $(GL_OBJNAME)
+# $(AR) rus $(MESA_LIBNAME) $(GL_OBJNAME)
+# $(AR) rus $(VX_LIBNAME) $(GL_OBJNAME)
+# $(RM) $(GL_OBJNAME)
+
+# Make the UGLMesa library
+$(UGL_OBJNAME): $(UGL_OBJECTS)
+# $(LD) -r $(UGL_OBJECTS) -o $(MESA_OBJNAME)
+ $(LD) -r $(UGL_OBJECTS) -o $(UGL_OBJNAME)
+# $(AR) rus $(MESA_LIBNAME) $(UGL_OBJNAME)
+# $(AR) rus $(VX_LIBNAME) $(UGL_OBJNAME)
+# $(RM) $(UGL_OBJNAME)
+
+# Make the OSMesa library
+$(OS_OBJNAME): $(OS_OBJECTS)
+# $(LD) -r $(OS_OBJECTS) -o $(MESA_OBJNAME)
+ $(LD) -r $(OS_OBJECTS) -o $(OS_OBJNAME)
+# $(AR) rus $(MESA_LIBNAME) $(OS_OBJNAME)
+# $(AR) rus $(VX_LIBNAME) $(OS_OBJNAME)
+# $(RM) $(OS_OBJNAME)
+
+# Make the GLUT Shapes library
+$(GLUTSHAPES_OBJNAME): $(GLUTSHAPES_OBJECTS)
+# $(LD) -r $(GLUTSHAPES_OBJECTS) -o $(MESA_OBJNAME)
+ $(LD) -r $(GLUTSHAPES_OBJECTS) -o $(GLUTSHAPES_OBJNAME)
+# $(AR) rus $(MESA_LIBNAME) $(GLUTSHAPES_OBJNAME)
+# $(AR) rus $(VX_LIBNAME) $(GLUTSHAPES_OBJNAME)
+# $(RM) $(GLUTSHAPES_OBJNAME)
+
+depend.$(CPU)$(TOOL):
+ifeq ($(WIND_HOST_TYPE),x86-win32)
+ @ $(RM) $@
+ @ $(ECHO) Creating depend.$(CPU)$(TOOL)
+ifneq ($(SOURCES),)
+ @ for %f in ($(SOURCES)) do \
+ $(CC) -MM $(CFLAGS) %f >>$@
+endif
+else
+Makefile
+ @ $(RM) $@
+ @ $(ECHO) "Creating depend.$(CPU)$(TOOL)"
+ifneq ($(SOURCES),)
+ @ for FILE in $(filter-out $(NODEPENDOBJS), $(SOURCES)); \
+ do \
+ $(CC) -MM $(CFLAGS) $$FILE \
+ | $(TCL) $(BIN_DIR)/depend.tcl $(TGT_DIR) >>$@; \
+ done
+endif
+endif
+
+.PHONY = clean
+
+clean:
+# $(AR) d $(MESA_LIBNAME) $(GL_OBJNAME)
+# $(AR) d $(MESA_LIBNAME) $(UGL_OBJNAME)
+# $(AR) d $(MESA_LIBNAME) $(OS_OBJNAME)
+# $(AR) d $(MESA_LIBNAME) $(GLUTSHAPES_OBJNAME)
+# $(AR) d $(VX_LIBNAME) $(GL_OBJNAME)
+# $(AR) d $(VX_LIBNAME) $(UGL_OBJNAME)
+# $(AR) d $(VX_LIBNAME) $(OS_OBJNAME)
+# $(AR) d $(VX_LIBNAME) $(GLUTSHAPES_OBJNAME)
+ $(RM) $(GL_OBJECTS)
+ $(RM) $(UGL_OBJECTS)
+ $(RM) $(OS_OBJECTS)
+ $(RM) $(GLUTSHAPES_OBJECTS)
+ $(RM) $(GL_OBJNAME)
+ $(RM) $(UGL_OBJNAME)
+ $(RM) $(OS_OBJNAME)
+ $(RM) $(GLUTSHAPES_OBJNAME)
+ $(RM) depend.$(CPU)$(TOOL)
+
+include depend.$(CPU)$(TOOL)
+
--- mesa-7.0.3.orig/src/mesa/main/Makefile.win
+++ mesa-7.0.3/src/mesa/main/Makefile.win
@@ -0,0 +1,208 @@
+# Makefile for Win32
+#
+# NOTE: the install target may overwrite important files in the system dirs
+# Check first, before making the install target.
+#
+# This builds both the osmesa and Windows drivers.
+#
+
+!include
+
+TOP = ..
+SUBDIRS = osmesa.dir
+
+CORE_SRCS = \
+ api_loopback.c \
+ api_noop.c \
+ api_validate.c \
+ accum.c \
+ arbprogram.c \
+ attrib.c \
+ blend.c \
+ bufferobj.c \
+ buffers.c \
+ clip.c \
+ colortab.c \
+ context.c \
+ convolve.c \
+ debug.c \
+ depth.c \
+ dispatch.c \
+ dlist.c \
+ drawpix.c \
+ enable.c \
+ enums.c \
+ eval.c \
+ extensions.c \
+ feedback.c \
+ fog.c \
+ get.c \
+ glapi.c \
+ glthread.c \
+ hash.c \
+ hint.c \
+ histogram.c \
+ image.c \
+ imports.c \
+ light.c \
+ lines.c \
+ matrix.c \
+ nvprogram.c \
+ nvfragparse.c \
+ nvvertexec.c \
+ nvvertparse.c \
+ pixel.c \
+ points.c \
+ polygon.c \
+ rastpos.c \
+ state.c \
+ stencil.c \
+ texcompress.c \
+ texcompress_fxt1.c \
+ texcompress_s3tc.c \
+ teximage.c \
+ texformat.c \
+ texobj.c \
+ texstate.c \
+ texstore.c \
+ varray.c \
+ vtxfmt.c \
+# X86\x86.c \
+# X86\common_x86.c \
+# X86\3dnow.c \
+# X86\sse.c \
+ math\m_debug_norm.c \
+ math\m_debug_xform.c \
+ math\m_eval.c \
+ math\m_matrix.c \
+ math\m_translate.c \
+ math\m_vector.c \
+ math\m_xform.c \
+ array_cache\ac_context.c \
+ array_cache\ac_import.c \
+ swrast\s_aaline.c \
+ swrast\s_aatriangle.c \
+ swrast\s_accum.c \
+ swrast\s_alpha.c \
+ swrast\s_alphabuf.c \
+ swrast\s_bitmap.c \
+ swrast\s_blend.c \
+ swrast\s_buffers.c \
+ swrast\s_copypix.c \
+ swrast\s_context.c \
+ swrast\s_depth.c \
+ swrast\s_drawpix.c \
+ swrast\s_feedback.c \
+ swrast\s_fog.c \
+ swrast\s_imaging.c \
+ swrast\s_lines.c \
+ swrast\s_logic.c \
+ swrast\s_masking.c \
+ swrast\s_nvfragprog.c \
+ swrast\s_pixeltex.c \
+ swrast\s_points.c \
+ swrast\s_readpix.c \
+ swrast\s_span.c \
+ swrast\s_stencil.c \
+ swrast\s_texstore.c \
+ swrast\s_texture.c \
+ swrast\s_triangle.c \
+ swrast\s_zoom.c \
+ swrast_setup\ss_context.c \
+ swrast_setup\ss_triangle.c \
+ swrast_setup\ss_vb.c \
+ tnl\t_array_api.c \
+ tnl\t_array_import.c \
+ tnl\t_context.c \
+ tnl\t_eval_api.c \
+ tnl\t_imm_alloc.c \
+ tnl\t_imm_api.c \
+ tnl\t_imm_debug.c \
+ tnl\t_imm_dlist.c \
+ tnl\t_imm_elt.c \
+ tnl\t_imm_eval.c \
+ tnl\t_imm_exec.c \
+ tnl\t_imm_fixup.c \
+ tnl\t_pipeline.c \
+ tnl\t_vb_fog.c \
+ tnl\t_vb_light.c \
+ tnl\t_vb_normals.c \
+ tnl\t_vb_points.c \
+ tnl\t_vb_program.c \
+ tnl\t_vb_render.c \
+ tnl\t_vb_texgen.c \
+ tnl\t_vb_texmat.c \
+ tnl\t_vb_vertex.c
+
+DRIVER_SRCS = \
+ Trace\tr_context.c \
+ Trace\tr_control.c \
+ Trace\tr_error.c \
+ Trace\tr_support.c \
+ Trace\tr_wrapper.c \
+ Trace\tr_write.c \
+ Windows\wgl.c \
+ Windows\wmesa.c
+
+ASM_SRCS =
+
+SRCS = $(CORE_SRCS) $(DRIVER_SRCS)
+
+all : mesadll $(SUBDIRS)
+
+!include "$(TOP)/mesawin32.mak"
+
+mesadll : $(MESADLL)
+
+CFLAGS = $(cvarsdll) $(CFLAGS) -D_OPENGL32_ -DBUILD_GL32 -DNO_PARALLEL -DNO_STEREO
+!IFNDEF NODEBUG
+CFLAGS = $(CFLAGS) -DMESA_DEBUG
+!ENDIF
+LFLAGS = $(dlllflags) $(lcommon) $(LFLAGS)
+
+OBJS = $(ASM_SRCS:.S=.obj) $(CORE_SRCS:.c=.obj) $(DRIVER_SRCS:.c=.obj)
+LIBS = winmm.lib $(guilibsdll)
+
+$(MESADLL) : $(OBJS) mesa.def
+ $(link) $(LFLAGS) -out:$(MESADLL) -def:mesa.def $(OBJS) $(LIBS)
+ @echo "copying Mesa dynamic link library to lib directory..."
+ -copy $(MESADLL) ..\lib
+ @echo "copying Mesa import library to lib directory..."
+ -copy $(MESALIB) ..\lib
+
+$(SUBDIRS) :
+ @echo.
+ @echo Making in $* directory
+ @cd $*
+ @nmake -f Makefile.win -nologo
+ @cd ..
+
+install : $(MESADLL)
+ @echo.
+ @echo "copying Mesa dynamic link library to system directory..."
+ -copy $(MESADLL) $(DLLINSTALL)
+ @echo "copying Mesa header files to include directory..."
+ -copy ..\..\include\GL\gl.h $(INCLUDEINSTALL)
+ -copy ..\..\include\GL\glext.h $(INCLUDEINSTALL)
+ @echo "copying Mesa import library to library directory..."
+ -copy $(MESALIB) $(LIBINSTALL)
+
+clean ::
+ @del /f tnl\*.obj
+ @del /f swrast_setup\*.obj
+ @del /f math\*.obj
+ @del /f array_cache\*.obj
+ @del /f swrast\*.obj
+ @del /f Trace\*.obj
+ @del /f osmesa\*.obj
+ @del /f Windows\*.obj
+
+clobber ::
+ @del /f OSmesa\*.lib
+ @del /f OSmesa\*.exp
+ @del /f OSmesa\*.dll
+
+# override default inference rule with one that writes the object to
+# the same subdir that the c file is in.
+.c.obj :
+ $(cc) $(CFLAGS) -I. $< /Fo$*.obj
--- mesa-7.0.3.orig/src/mesa/shader/arbprogparse.c
+++ mesa-7.0.3/src/mesa/shader/arbprogparse.c
@@ -1123,7 +1123,9 @@
struct arb_program *Program,
gl_state_index state_tokens[STATE_LENGTH])
{
- switch (*(*inst)++) {
+ GLubyte token = *(*inst)++;
+
+ switch (token) {
case STATE_MATERIAL_PARSER:
state_tokens[0] = STATE_MATERIAL;
state_tokens[1] = parse_face_type (inst);
@@ -1308,7 +1310,6 @@
case STATE_CLIP_PLANE:
state_tokens[0] = STATE_CLIPPLANE;
- state_tokens[1] = parse_integer (inst, Program);
if (parse_clipplane_num (ctx, inst, Program,
(GLint *) &state_tokens[1]))
return 1;
@@ -1760,7 +1761,9 @@
gl_state_index state_tokens[STATE_LENGTH] = {0, 0, 0, 0, 0};
GLfloat const_values[4];
- switch (*(*inst)++) {
+ GLubyte token = *(*inst)++;
+
+ switch (token) {
case PARAM_STATE_ELEMENT:
if (parse_state_single_item (ctx, inst, Program, state_tokens))
return 1;
--- mesa-7.0.3.orig/src/mesa/shader/program.c
+++ mesa-7.0.3/src/mesa/shader/program.c
@@ -187,7 +187,6 @@
{
(void) ctx;
if (prog) {
- _mesa_bzero(prog, sizeof(*prog));
prog->Id = id;
prog->Target = target;
prog->Resident = GL_TRUE;
--- mesa-7.0.3.orig/src/mesa/shader/arbprogram.syn
+++ mesa-7.0.3/src/mesa/shader/arbprogram.syn
@@ -0,0 +1,2786 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.2
+ *
+ * Copyright (C) 1999-2004 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 arbprogram.syn
+ * ARB_fragment/vertex_program syntax
+ * \author Michal Krol
+ */
+
+.syntax program;
+
+/*
+ This value must be incremented every time emit code values or structure of the production
+ array changes. This value is placed at the beginning of the production array. The loader
+ compares the value with its REVISION value. If they do not match, the loader is not up
+ to date.
+*/
+.emtcode REVISION 0x09
+
+/* program type */
+.emtcode FRAGMENT_PROGRAM 0x01
+.emtcode VERTEX_PROGRAM 0x02
+
+/* program section */
+.emtcode OPTION 0x01
+.emtcode INSTRUCTION 0x02
+.emtcode DECLARATION 0x03
+.emtcode END 0x04
+
+/* GL_ARB_fragment_program option */
+.emtcode ARB_PRECISION_HINT_FASTEST 0x00
+.emtcode ARB_PRECISION_HINT_NICEST 0x01
+.emtcode ARB_FOG_EXP 0x02
+.emtcode ARB_FOG_EXP2 0x03
+.emtcode ARB_FOG_LINEAR 0x04
+
+/* GL_ARB_vertex_program option */
+.emtcode ARB_POSITION_INVARIANT 0x05
+
+/* GL_ARB_fragment_program_shadow option */
+.emtcode ARB_FRAGMENT_PROGRAM_SHADOW 0x06
+
+/* GL_ARB_draw_buffers option */
+.emtcode ARB_DRAW_BUFFERS 0x07
+
+/* GL_ARB_fragment_program instruction class */
+.emtcode OP_ALU_INST 0x00
+.emtcode OP_TEX_INST 0x01
+
+/* GL_ARB_vertex_program instruction class */
+/* OP_ALU_INST */
+
+/* GL_ARB_fragment_program instruction type */
+.emtcode OP_ALU_VECTOR 0x00
+.emtcode OP_ALU_SCALAR 0x01
+.emtcode OP_ALU_BINSC 0x02
+.emtcode OP_ALU_BIN 0x03
+.emtcode OP_ALU_TRI 0x04
+.emtcode OP_ALU_SWZ 0x05
+.emtcode OP_TEX_SAMPLE 0x06
+.emtcode OP_TEX_KIL 0x07
+
+/* GL_ARB_vertex_program instruction type */
+.emtcode OP_ALU_ARL 0x08
+/* OP_ALU_VECTOR */
+/* OP_ALU_SCALAR */
+/* OP_ALU_BINSC */
+/* OP_ALU_BIN */
+/* OP_ALU_TRI */
+/* OP_ALU_SWZ */
+
+/* GL_ARB_fragment_program instruction code */
+.emtcode OP_ABS 0x00
+.emtcode OP_ABS_SAT 0x1B
+.emtcode OP_FLR 0x09
+.emtcode OP_FLR_SAT 0x26
+.emtcode OP_FRC 0x0A
+.emtcode OP_FRC_SAT 0x27
+.emtcode OP_LIT 0x0C
+.emtcode OP_LIT_SAT 0x2A
+.emtcode OP_MOV 0x11
+.emtcode OP_MOV_SAT 0x30
+.emtcode OP_COS 0x1F
+.emtcode OP_COS_SAT 0x20
+.emtcode OP_EX2 0x07
+.emtcode OP_EX2_SAT 0x25
+.emtcode OP_LG2 0x0B
+.emtcode OP_LG2_SAT 0x29
+.emtcode OP_RCP 0x14
+.emtcode OP_RCP_SAT 0x33
+.emtcode OP_RSQ 0x15
+.emtcode OP_RSQ_SAT 0x34
+.emtcode OP_SIN 0x38
+.emtcode OP_SIN_SAT 0x39
+.emtcode OP_SCS 0x35
+.emtcode OP_SCS_SAT 0x36
+.emtcode OP_POW 0x13
+.emtcode OP_POW_SAT 0x32
+.emtcode OP_ADD 0x01
+.emtcode OP_ADD_SAT 0x1C
+.emtcode OP_DP3 0x03
+.emtcode OP_DP3_SAT 0x21
+.emtcode OP_DP4 0x04
+.emtcode OP_DP4_SAT 0x22
+.emtcode OP_DPH 0x05
+.emtcode OP_DPH_SAT 0x23
+.emtcode OP_DST 0x06
+.emtcode OP_DST_SAT 0x24
+.emtcode OP_MAX 0x0F
+.emtcode OP_MAX_SAT 0x2E
+.emtcode OP_MIN 0x10
+.emtcode OP_MIN_SAT 0x2F
+.emtcode OP_MUL 0x12
+.emtcode OP_MUL_SAT 0x31
+.emtcode OP_SGE 0x16
+.emtcode OP_SGE_SAT 0x37
+.emtcode OP_SLT 0x17
+.emtcode OP_SLT_SAT 0x3A
+.emtcode OP_SUB 0x18
+.emtcode OP_SUB_SAT 0x3B
+.emtcode OP_XPD 0x1A
+.emtcode OP_XPD_SAT 0x43
+.emtcode OP_CMP 0x1D
+.emtcode OP_CMP_SAT 0x1E
+.emtcode OP_LRP 0x2B
+.emtcode OP_LRP_SAT 0x2C
+.emtcode OP_MAD 0x0E
+.emtcode OP_MAD_SAT 0x2D
+.emtcode OP_SWZ 0x19
+.emtcode OP_SWZ_SAT 0x3C
+.emtcode OP_TEX 0x3D
+.emtcode OP_TEX_SAT 0x3E
+.emtcode OP_TXB 0x3F
+.emtcode OP_TXB_SAT 0x40
+.emtcode OP_TXP 0x41
+.emtcode OP_TXP_SAT 0x42
+.emtcode OP_KIL 0x28
+
+/* GL_ARB_vertex_program instruction code */
+.emtcode OP_ARL 0x02
+/* OP_ABS */
+/* OP_FLR */
+/* OP_FRC */
+/* OP_LIT */
+/* OP_MOV */
+/* OP_EX2 */
+.emtcode OP_EXP 0x08
+/* OP_LG2 */
+.emtcode OP_LOG 0x0D
+/* OP_RCP */
+/* OP_RSQ */
+/* OP_POW */
+/* OP_ADD */
+/* OP_DP3 */
+/* OP_DP4 */
+/* OP_DPH */
+/* OP_DST */
+/* OP_MAX */
+/* OP_MIN */
+/* OP_MUL */
+/* OP_SGE */
+/* OP_SLT */
+/* OP_SUB */
+/* OP_XPD */
+/* OP_MAD */
+/* OP_SWZ */
+
+/* fragment attribute binding */
+.emtcode FRAGMENT_ATTRIB_COLOR 0x01
+.emtcode FRAGMENT_ATTRIB_TEXCOORD 0x02
+.emtcode FRAGMENT_ATTRIB_FOGCOORD 0x03
+.emtcode FRAGMENT_ATTRIB_POSITION 0x04
+
+/* vertex attribute binding */
+.emtcode VERTEX_ATTRIB_POSITION 0x01
+.emtcode VERTEX_ATTRIB_WEIGHT 0x02
+.emtcode VERTEX_ATTRIB_NORMAL 0x03
+.emtcode VERTEX_ATTRIB_COLOR 0x04
+.emtcode VERTEX_ATTRIB_FOGCOORD 0x05
+.emtcode VERTEX_ATTRIB_TEXCOORD 0x06
+.emtcode VERTEX_ATTRIB_MATRIXINDEX 0x07
+.emtcode VERTEX_ATTRIB_GENERIC 0x08
+
+/* fragment result binding */
+.emtcode FRAGMENT_RESULT_COLOR 0x01
+.emtcode FRAGMENT_RESULT_DEPTH 0x02
+
+/* vertex result binding */
+.emtcode VERTEX_RESULT_POSITION 0x01
+.emtcode VERTEX_RESULT_COLOR 0x02
+.emtcode VERTEX_RESULT_FOGCOORD 0x03
+.emtcode VERTEX_RESULT_POINTSIZE 0x04
+.emtcode VERTEX_RESULT_TEXCOORD 0x05
+
+/* texture target */
+.emtcode TEXTARGET_1D 0x01
+.emtcode TEXTARGET_2D 0x02
+.emtcode TEXTARGET_3D 0x03
+.emtcode TEXTARGET_RECT 0x04
+.emtcode TEXTARGET_CUBE 0x05
+/* GL_ARB_fragment_program_shadow */
+.emtcode TEXTARGET_SHADOW1D 0x06
+.emtcode TEXTARGET_SHADOW2D 0x07
+.emtcode TEXTARGET_SHADOWRECT 0x08
+
+/* face type */
+.emtcode FACE_FRONT 0x00
+.emtcode FACE_BACK 0x01
+
+/* color type */
+.emtcode COLOR_PRIMARY 0x00
+.emtcode COLOR_SECONDARY 0x01
+
+/* component */
+.emtcode COMPONENT_X 0x00
+.emtcode COMPONENT_Y 0x01
+.emtcode COMPONENT_Z 0x02
+.emtcode COMPONENT_W 0x03
+.emtcode COMPONENT_0 0x04
+.emtcode COMPONENT_1 0x05
+
+/* array index type */
+.emtcode ARRAY_INDEX_ABSOLUTE 0x00
+.emtcode ARRAY_INDEX_RELATIVE 0x01
+
+/* matrix name */
+.emtcode MATRIX_MODELVIEW 0x01
+.emtcode MATRIX_PROJECTION 0x02
+.emtcode MATRIX_MVP 0x03
+.emtcode MATRIX_TEXTURE 0x04
+.emtcode MATRIX_PALETTE 0x05
+.emtcode MATRIX_PROGRAM 0x06
+
+/* matrix modifier */
+.emtcode MATRIX_MODIFIER_IDENTITY 0x00
+.emtcode MATRIX_MODIFIER_INVERSE 0x01
+.emtcode MATRIX_MODIFIER_TRANSPOSE 0x02
+.emtcode MATRIX_MODIFIER_INVTRANS 0x03
+
+/* constant type */
+.emtcode CONSTANT_SCALAR 0x01
+.emtcode CONSTANT_VECTOR 0x02
+
+/* program param type */
+.emtcode PROGRAM_PARAM_ENV 0x01
+.emtcode PROGRAM_PARAM_LOCAL 0x02
+
+/* register type */
+.emtcode REGISTER_ATTRIB 0x01
+.emtcode REGISTER_PARAM 0x02
+.emtcode REGISTER_RESULT 0x03
+.emtcode REGISTER_ESTABLISHED_NAME 0x04
+
+/* param binding */
+.emtcode PARAM_NULL 0x00
+.emtcode PARAM_ARRAY_ELEMENT 0x01
+.emtcode PARAM_STATE_ELEMENT 0x02
+.emtcode PARAM_PROGRAM_ELEMENT 0x03
+.emtcode PARAM_PROGRAM_ELEMENTS 0x04
+.emtcode PARAM_CONSTANT 0x05
+
+/* param state property */
+.emtcode STATE_MATERIAL 0x01
+.emtcode STATE_LIGHT 0x02
+.emtcode STATE_LIGHT_MODEL 0x03
+.emtcode STATE_LIGHT_PROD 0x04
+.emtcode STATE_FOG 0x05
+.emtcode STATE_MATRIX_ROWS 0x06
+/* GL_ARB_fragment_program */
+.emtcode STATE_TEX_ENV 0x07
+.emtcode STATE_DEPTH 0x08
+/* GL_ARB_vertex_program */
+.emtcode STATE_TEX_GEN 0x09
+.emtcode STATE_CLIP_PLANE 0x0A
+.emtcode STATE_POINT 0x0B
+
+/* state material property */
+.emtcode MATERIAL_AMBIENT 0x01
+.emtcode MATERIAL_DIFFUSE 0x02
+.emtcode MATERIAL_SPECULAR 0x03
+.emtcode MATERIAL_EMISSION 0x04
+.emtcode MATERIAL_SHININESS 0x05
+
+/* state light property */
+.emtcode LIGHT_AMBIENT 0x01
+.emtcode LIGHT_DIFFUSE 0x02
+.emtcode LIGHT_SPECULAR 0x03
+.emtcode LIGHT_POSITION 0x04
+.emtcode LIGHT_ATTENUATION 0x05
+.emtcode LIGHT_HALF 0x06
+.emtcode LIGHT_SPOT_DIRECTION 0x07
+
+/* state light model property */
+.emtcode LIGHT_MODEL_AMBIENT 0x01
+.emtcode LIGHT_MODEL_SCENECOLOR 0x02
+
+/* state light product property */
+.emtcode LIGHT_PROD_AMBIENT 0x01
+.emtcode LIGHT_PROD_DIFFUSE 0x02
+.emtcode LIGHT_PROD_SPECULAR 0x03
+
+/* state texture environment property */
+.emtcode TEX_ENV_COLOR 0x01
+
+/* state texture generation coord property */
+.emtcode TEX_GEN_EYE 0x01
+.emtcode TEX_GEN_OBJECT 0x02
+
+/* state fog property */
+.emtcode FOG_COLOR 0x01
+.emtcode FOG_PARAMS 0x02
+
+/* state depth property */
+.emtcode DEPTH_RANGE 0x01
+
+/* state point parameters property */
+.emtcode POINT_SIZE 0x01
+.emtcode POINT_ATTENUATION 0x02
+
+/* declaration */
+.emtcode ATTRIB 0x01
+.emtcode PARAM 0x02
+.emtcode TEMP 0x03
+.emtcode OUTPUT 0x04
+.emtcode ALIAS 0x05
+/* GL_ARB_vertex_program */
+.emtcode ADDRESS 0x06
+
+/* error messages */
+.errtext UNKNOWN_PROGRAM_SIGNATURE "1001: '$e_signature$': unknown program signature"
+.errtext MISSING_END_OR_INVALID_STATEMENT "1002: '$e_statement$': invalid statement"
+.errtext CODE_AFTER_END "1003: '$e_statement$': code after 'END' keyword"
+.errtext INVALID_PROGRAM_OPTION "1004: '$e_identifier$': invalid program option"
+.errtext EXT_SWIZ_COMP_EXPECTED "1005: extended swizzle component expected but '$e_token$' found"
+.errtext TEX_TARGET_EXPECTED "1006: texture target expected but '$e_token$' found"
+.errtext TEXTURE_EXPECTED "1007: 'texture' expected but '$e_identifier$' found"
+.errtext SOURCE_REGISTER_EXPECTED "1008: source register expected but '$e_token$' found"
+.errtext DESTINATION_REGISTER_EXPECTED "1009: destination register expected but '$e_token$' found"
+.errtext INVALID_ADDRESS_COMPONENT "1010: '$e_identifier$': invalid address component"
+.errtext INVALID_ADDRESS_WRITEMASK "1011: '$e_identifier$': invalid address writemask"
+.errtext INVALID_COMPONENT "1012: '$e_charordigit$': invalid component"
+.errtext INVALID_SUFFIX "1013: '$e_identifier$': invalid suffix"
+.errtext INVALID_WRITEMASK "1014: '$e_identifier$': invalid writemask"
+.errtext FRAGMENT_EXPECTED "1015: 'fragment' expected but '$e_identifier$' found"
+.errtext VERTEX_EXPECTED "1016: 'vertex' expected but '$e_identifier$' found"
+.errtext INVALID_FRAGMENT_PROPERTY "1017: '$e_identifier$': invalid fragment property"
+.errtext INVALID_VERTEX_PROPERTY "1018: '$e_identifier$': invalid vertex property"
+.errtext INVALID_STATE_PROPERTY "1019: '$e_identifier$': invalid state property"
+.errtext INVALID_MATERIAL_PROPERTY "1020: '$e_identifier$': invalid material property"
+.errtext INVALID_LIGHT_PROPERTY "1021: '$e_identifier$': invalid light property"
+.errtext INVALID_SPOT_PROPERTY "1022: '$e_identifier$': invalid spot property"
+.errtext INVALID_LIGHTMODEL_PROPERTY "1023: '$e_identifier$': invalid light model property"
+.errtext INVALID_LIGHTPROD_PROPERTY "1024: '$e_identifier$': invalid light product property"
+.errtext INVALID_TEXENV_PROPERTY "1025: '$e_identifier$': invalid texture environment property"
+.errtext INVALID_TEXGEN_PROPERTY "1026: '$e_identifier$': invalid texture generating property"
+.errtext INVALID_TEXGEN_COORD "1027: '$e_identifier$': invalid texture generating coord"
+.errtext INVALID_FOG_PROPERTY "1028: '$e_identifier$': invalid fog property"
+.errtext INVALID_DEPTH_PROPERTY "1029: '$e_identifier$': invalid depth property"
+.errtext INVALID_CLIPPLANE_PROPERTY "1030: '$e_identifier$': invalid clip plane property"
+.errtext INVALID_POINT_PROPERTY "1031: '$e_identifier$': invalid point property"
+.errtext MATRIX_ROW_SELECTOR_OR_MODIFIER_EXPECTED "1032: matrix row selector or modifier expected but '$e_token$' found"
+.errtext INVALID_MATRIX_NAME "1033: '$e_identifier$': invalid matrix name"
+.errtext INVALID_PROGRAM_PROPERTY "1034: '$e_identifier$': invalid program property"
+.errtext RESULT_EXPECTED "1035: 'result' expected but '$e_token$' found"
+.errtext INVALID_RESULT_PROPERTY "1036: '$e_identifier$': invalid result property"
+.errtext INVALID_FACE_PROPERTY "1037: '$e_identifier$': invalid face property"
+.errtext INVALID_COLOR_PROPERTY "1038: '$e_identifier$': invalid color property"
+.errtext IDENTIFIER_EXPECTED "1039: identifier expected but '$e_token$' found"
+.errtext RESERVED_KEYWORD "1040: use of reserved keyword as an identifier"
+.errtext INTEGER_EXPECTED "1041: integer value expected but '$e_token$' found"
+.errtext MISSING_SEMICOLON "1042: ';' expected but '$e_token$' found"
+.errtext MISSING_COMMA "1043: ',' expected but '$e_token$' found"
+.errtext MISSING_LBRACKET "1044: '[' expected but '$e_token$' found"
+.errtext MISSING_RBRACKET "1045: ']' expected but '$e_token$' found"
+.errtext MISSING_DOT "1046: '.' expected but '$e_token$' found"
+.errtext MISSING_EQUAL "1047: '=' expected but '$e_token$' found"
+.errtext MISSING_LBRACE "1048: '{' expected but '$e_token$' found"
+.errtext MISSING_RBRACE "1049: '}' expected but '$e_token$' found"
+.errtext MISSING_DOTDOT "1050: '..' expected but '$e_token$' found"
+.errtext MISSING_FRACTION_OR_EXPONENT "1051: missing fraction part or exponent"
+.errtext MISSING_DOT_OR_EXPONENT "1052: missing '.' or exponent"
+.errtext EXPONENT_VALUE_EXPECTED "1053: exponent value expected"
+.errtext INTEGER_OUT_OF_RANGE "1054: integer value out of range"
+.errtext OPERATION_NEEDS_DESTINATION_VARIABLE "1055: operation needs destination variable"
+.errtext OPERATION_NEEDS_SOURCE_VARIABLE "1056: operation needs source variable"
+.errtext ADDRESS_REGISTER_EXPECTED "1057: address register expected but '$e_token$' found"
+.errtext ADDRESS_REGISTER_OR_INTEGER_EXPECTED "1058: address register or integer literal expected but '$e_token$' found"
+
+/* extension presence condition registers */
+
+/* GL_ARB_vertex_blend */
+/* GL_EXT_vertex_weighting */
+.regbyte vertex_blend 0x00
+
+/* GL_ARB_matrix_palette */
+.regbyte matrix_palette 0x00
+
+/* GL_ARB_point_parameters */
+/* GL_EXT_point_parameters */
+.regbyte point_parameters 0x00
+
+/* GL_EXT_secondary_color */
+.regbyte secondary_color 0x00
+
+/* GL_EXT_fog_coord */
+.regbyte fog_coord 0x00
+
+/* GL_EXT_texture_rectangle */
+/* GL_NV_texture_rectangle */
+.regbyte texture_rectangle 0x00
+
+/* GL_ARB_fragment_program_shadow */
+.regbyte fragment_program_shadow 0x00
+
+/* GL_ARB_draw_buffers */
+.regbyte draw_buffers 0x00
+
+/* option presence condition registers */
+/* they are all initially set to zero - when a particular OPTION is encountered, the appropriate */
+/* register is set to 1 to indicate that the OPTION was specified. */
+
+/* GL_ARB_fragment_program */
+.regbyte ARB_precision_hint_fastest 0x00
+.regbyte ARB_precision_hint_nicest 0x00
+.regbyte ARB_fog_exp 0x00
+.regbyte ARB_fog_exp2 0x00
+.regbyte ARB_fog_linear 0x00
+
+/* GL_ARB_vertex_program */
+.regbyte ARB_position_invariant 0x00
+
+/* GL_ARB_fragment_program_shadow */
+.regbyte ARB_fragment_program_shadow 0x00
+
+/* GL_ARB_draw_buffers */
+.regbyte ARB_draw_buffers 0x00
+
+/* program target condition register */
+/* this syntax script deals with two program targets - VERTEX_PROGRAM and FRAGMENT_PROGRAM. */
+/* to distinguish between them we need a register that will store for us the current target. */
+/* the client will typically set the register to apropriate value before parsing a particular */
+/* program. the mapping between program targets and their values is listed below. */
+/* */
+/* program target register value */
+/* ---------------------------------------------- */
+/* FRAGMENT_PROGRAM 0x10 */
+/* VERTEX_PROGRAM 0x20 */
+/* */
+/* the initial value of the register is 0 to catch potential errors with not setting the register */
+/* with the proper value. */
+.regbyte program_target 0x00
+
+/*
+ ::= "END"
+*/
+program
+ programs .error UNKNOWN_PROGRAM_SIGNATURE .emit REVISION;
+programs
+ .if (program_target == 0x10) frag_program_1_0 .emit FRAGMENT_PROGRAM .emit 0x01 .emit 0x00 .or
+ .if (program_target == 0x20) vert_program_1_0 .emit VERTEX_PROGRAM .emit 0x01 .emit 0x00;
+frag_program_1_0
+ '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'f' .and 'p' .and '1' .and '.' .and '0' .and
+ optional_space .and fp_optionSequence .and fp_statementSequence .and
+ "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
+ '\0' .error CODE_AFTER_END;
+vert_program_1_0
+ '!' .and '!' .and 'A' .and 'R' .and 'B' .and 'v' .and 'p' .and '1' .and '.' .and '0' .and
+ optional_space .and vp_optionSequence .and vp_statementSequence .and
+ "END" .error MISSING_END_OR_INVALID_STATEMENT .emit END .and optional_space .and
+ '\0' .error CODE_AFTER_END;
+
+/*
+ ::=
+ | ""
+*/
+fp_optionSequence
+ .loop fp_option;
+vp_optionSequence
+ .loop vp_option;
+
+/*
+ ::= "OPTION" ";"
+
+NOTE: options ARB_precision_hint_nicest and ARB_precision_hint_fastest are exclusive. When one of
+ these options is encountered, the other one is automatically disabled.
+ the same applies to options ARB_fog_exp, ARB_fog_exp2 and ARB_fog_linear.
+*/
+fp_option
+ "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
+ fp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
+vp_option
+ "OPTION" .emit OPTION .and space .error IDENTIFIER_EXPECTED .and
+ vp_optionString .error INVALID_PROGRAM_OPTION .and semicolon;
+fp_optionString
+ .if (ARB_precision_hint_nicest == 0x00) "ARB_precision_hint_fastest"
+ .emit ARB_PRECISION_HINT_FASTEST .load ARB_precision_hint_fastest 0x01 .or
+ .if (ARB_precision_hint_fastest == 0x00) "ARB_precision_hint_nicest"
+ .emit ARB_PRECISION_HINT_NICEST .load ARB_precision_hint_nicest 0x01 .or
+ fp_ARB_fog_exp .emit ARB_FOG_EXP .load ARB_fog_exp 0x01 .or
+ fp_ARB_fog_exp2 .emit ARB_FOG_EXP2 .load ARB_fog_exp2 0x01 .or
+ fp_ARB_fog_linear .emit ARB_FOG_LINEAR .load ARB_fog_linear 0x01 .or
+ .if (fragment_program_shadow != 0x00) "ARB_fragment_program_shadow"
+ .emit ARB_FRAGMENT_PROGRAM_SHADOW .load ARB_fragment_program_shadow 0x01 .or
+ .if (draw_buffers != 0x00) "ARB_draw_buffers" .emit ARB_DRAW_BUFFERS
+ .load ARB_draw_buffers 0x01;
+vp_optionString
+ "ARB_position_invariant" .emit ARB_POSITION_INVARIANT .load ARB_position_invariant 0x01;
+fp_ARB_fog_exp
+ .if (ARB_fog_exp2 == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp";
+fp_ARB_fog_exp2
+ .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_linear == 0x00) "ARB_fog_exp2";
+fp_ARB_fog_linear
+ .if (ARB_fog_exp == 0x00) .true .and .if (ARB_fog_exp2 == 0x00) "ARB_fog_linear";
+
+/*
+ ::=
+ | ""
+*/
+fp_statementSequence
+ .loop fp_statement;
+vp_statementSequence
+ .loop vp_statement;
+
+/*
+ ::= ";"
+ | ";"
+
+NOTE: ".emit $" in the definitions below means that we output instruction position (offset of
+ the first character of instruction) for program debugging purposes.
+*/
+fp_statement
+ fp_statement_1 .or fp_statement_2;
+vp_statement
+ vp_statement_1 .or vp_statement_2;
+fp_statement_1
+ fp_instruction .emit INSTRUCTION .emit $ .and semicolon;
+fp_statement_2
+ fp_namingStatement .emit DECLARATION .and semicolon;
+vp_statement_1
+ vp_instruction .emit INSTRUCTION .emit $ .and semicolon;
+vp_statement_2
+ vp_namingStatement .emit DECLARATION .and semicolon;
+
+/*
+fragment program
+ ::=
+ |
+
+vertex program
+ ::=
+ |
+ |
+ |
+ |
+ |
+ |
+*/
+fp_instruction
+ ALUInstruction .emit OP_ALU_INST .or
+ TexInstruction .emit OP_TEX_INST;
+vp_instruction
+ ARL_instruction .emit OP_ALU_ARL .or
+ vp_VECTORop_instruction .emit OP_ALU_VECTOR .or
+ vp_SCALARop_instruction .emit OP_ALU_SCALAR .or
+ vp_BINSCop_instruction .emit OP_ALU_BINSC .or
+ vp_BINop_instruction .emit OP_ALU_BIN .or
+ vp_TRIop_instruction .emit OP_ALU_TRI .or
+ vp_SWZ_instruction .emit OP_ALU_SWZ;
+
+/*
+fragment program
+ ::=
+ |
+ |
+ |
+ |
+ |
+*/
+ALUInstruction
+ fp_VECTORop_instruction .emit OP_ALU_VECTOR .or
+ fp_SCALARop_instruction .emit OP_ALU_SCALAR .or
+ fp_BINSCop_instruction .emit OP_ALU_BINSC .or
+ fp_BINop_instruction .emit OP_ALU_BIN .or
+ fp_TRIop_instruction .emit OP_ALU_TRI .or
+ fp_SWZ_instruction .emit OP_ALU_SWZ;
+
+/*
+fragment program
+ ::=
+ |
+*/
+TexInstruction
+ SAMPLE_instruction .emit OP_TEX_SAMPLE .or
+ KIL_instruction .emit OP_TEX_KIL;
+
+/*
+vertex program
+ ::= "ARL" ","
+*/
+ARL_instruction
+ "ARL" .emit OP_ARL .and space_dst .and maskedAddrReg .and comma .and vp_scalarSrcReg;
+
+/*
+fragment program
+ ::= ","
+
+
+vertex program
+ ::= ","
+*/
+fp_VECTORop_instruction
+ fp_VECTORop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg;
+vp_VECTORop_instruction
+ vp_VECTORop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg;
+
+/*
+fragment program
+ ::= "ABS" | "ABS_SAT"
+ | "FLR" | "FLR_SAT"
+ | "FRC" | "FRC_SAT"
+ | "LIT" | "LIT_SAT"
+ | "MOV" | "MOV_SAT"
+
+vertex program
+ ::= "ABS"
+ | "FLR"
+ | "FRC"
+ | "LIT"
+ | "MOV"
+*/
+fp_VECTORop
+ "ABS" .emit OP_ABS .or "ABS_SAT" .emit OP_ABS_SAT .or
+ "FLR" .emit OP_FLR .or "FLR_SAT" .emit OP_FLR_SAT .or
+ "FRC" .emit OP_FRC .or "FRC_SAT" .emit OP_FRC_SAT .or
+ "LIT" .emit OP_LIT .or "LIT_SAT" .emit OP_LIT_SAT .or
+ "MOV" .emit OP_MOV .or "MOV_SAT" .emit OP_MOV_SAT;
+vp_VECTORop
+ "ABS" .emit OP_ABS .or
+ "FLR" .emit OP_FLR .or
+ "FRC" .emit OP_FRC .or
+ "LIT" .emit OP_LIT .or
+ "MOV" .emit OP_MOV;
+
+/*
+ ::= ","
+*/
+fp_SCALARop_instruction
+ fp_SCALARop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg;
+vp_SCALARop_instruction
+ vp_SCALARop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg;
+
+/*
+fragment program
+ ::= "COS" | "COS_SAT"
+ | "EX2" | "EX2_SAT"
+ | "LG2" | "LG2_SAT"
+ | "RCP" | "RCP_SAT"
+ | "RSQ" | "RSQ_SAT"
+ | "SIN" | "SIN_SAT"
+ | "SCS" | "SCS_SAT"
+
+vertex program
+ ::= "EX2"
+ | "EXP"
+ | "LG2"
+ | "LOG"
+ | "RCP"
+ | "RSQ"
+*/
+fp_SCALARop
+ "COS" .emit OP_COS .or "COS_SAT" .emit OP_COS_SAT .or
+ "EX2" .emit OP_EX2 .or "EX2_SAT" .emit OP_EX2_SAT .or
+ "LG2" .emit OP_LG2 .or "LG2_SAT" .emit OP_LG2_SAT .or
+ "RCP" .emit OP_RCP .or "RCP_SAT" .emit OP_RCP_SAT .or
+ "RSQ" .emit OP_RSQ .or "RSQ_SAT" .emit OP_RSQ_SAT .or
+ "SIN" .emit OP_SIN .or "SIN_SAT" .emit OP_SIN_SAT .or
+ "SCS" .emit OP_SCS .or "SCS_SAT" .emit OP_SCS_SAT;
+vp_SCALARop
+ "EX2" .emit OP_EX2 .or
+ "EXP" .emit OP_EXP .or
+ "LG2" .emit OP_LG2 .or
+ "LOG" .emit OP_LOG .or
+ "RCP" .emit OP_RCP .or
+ "RSQ" .emit OP_RSQ;
+
+/*
+ ::= "," ","
+
+*/
+fp_BINSCop_instruction
+ fp_BINSCop .and space_dst .and fp_maskedDstReg .and comma .and fp_scalarSrcReg .and comma .and
+ fp_scalarSrcReg;
+vp_BINSCop_instruction
+ vp_BINSCop .and space_dst .and vp_maskedDstReg .and comma .and vp_scalarSrcReg .and comma .and
+ vp_scalarSrcReg;
+
+/*
+fragment program
+ ::= "POW" | "POW_SAT"
+
+vertex program
+ ::= "POW"
+*/
+fp_BINSCop
+ "POW" .emit OP_POW .or "POW_SAT" .emit OP_POW_SAT;
+vp_BINSCop
+ "POW" .emit OP_POW;
+
+/*
+fragment program
+ ::= ","
+ ","
+
+vertex program
+ ::= ","
+ ","
+*/
+fp_BINop_instruction
+ fp_BINop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
+ vectorSrcReg;
+vp_BINop_instruction
+ vp_BINop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
+ swizzleSrcReg;
+
+/*
+fragment program
+ ::= "ADD" | "ADD_SAT"
+ | "DP3" | "DP3_SAT"
+ | "DP4" | "DP4_SAT"
+ | "DPH" | "DPH_SAT"
+ | "DST" | "DST_SAT"
+ | "MAX" | "MAX_SAT"
+ | "MIN" | "MIN_SAT"
+ | "MUL" | "MUL_SAT"
+ | "SGE" | "SGE_SAT"
+ | "SLT" | "SLT_SAT"
+ | "SUB" | "SUB_SAT"
+ | "XPD" | "XPD_SAT"
+
+vertex program
+ ::= "ADD"
+ | "DP3"
+ | "DP4"
+ | "DPH"
+ | "DST"
+ | "MAX"
+ | "MIN"
+ | "MUL"
+ | "SGE"
+ | "SLT"
+ | "SUB"
+ | "XPD"
+*/
+fp_BINop
+ "ADD" .emit OP_ADD .or "ADD_SAT" .emit OP_ADD_SAT .or
+ "DP3" .emit OP_DP3 .or "DP3_SAT" .emit OP_DP3_SAT .or
+ "DP4" .emit OP_DP4 .or "DP4_SAT" .emit OP_DP4_SAT .or
+ "DPH" .emit OP_DPH .or "DPH_SAT" .emit OP_DPH_SAT .or
+ "DST" .emit OP_DST .or "DST_SAT" .emit OP_DST_SAT .or
+ "MAX" .emit OP_MAX .or "MAX_SAT" .emit OP_MAX_SAT .or
+ "MIN" .emit OP_MIN .or "MIN_SAT" .emit OP_MIN_SAT .or
+ "MUL" .emit OP_MUL .or "MUL_SAT" .emit OP_MUL_SAT .or
+ "SGE" .emit OP_SGE .or "SGE_SAT" .emit OP_SGE_SAT .or
+ "SLT" .emit OP_SLT .or "SLT_SAT" .emit OP_SLT_SAT .or
+ "SUB" .emit OP_SUB .or "SUB_SAT" .emit OP_SUB_SAT .or
+ "XPD" .emit OP_XPD .or "XPD_SAT" .emit OP_XPD_SAT;
+vp_BINop
+ "ADD" .emit OP_ADD .or
+ "DP3" .emit OP_DP3 .or
+ "DP4" .emit OP_DP4 .or
+ "DPH" .emit OP_DPH .or
+ "DST" .emit OP_DST .or
+ "MAX" .emit OP_MAX .or
+ "MIN" .emit OP_MIN .or
+ "MUL" .emit OP_MUL .or
+ "SGE" .emit OP_SGE .or
+ "SLT" .emit OP_SLT .or
+ "SUB" .emit OP_SUB .or
+ "XPD" .emit OP_XPD;
+
+/*
+fragment program
+ ::= ","
+ "," ","
+
+
+vertex program
+ ::= ","
+ "," ","
+
+*/
+fp_TRIop_instruction
+ fp_TRIop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
+ vectorSrcReg .and comma .and vectorSrcReg;
+vp_TRIop_instruction
+ vp_TRIop .and space_dst .and vp_maskedDstReg .and comma .and swizzleSrcReg .and comma .and
+ swizzleSrcReg .and comma .and swizzleSrcReg;
+
+/*
+fragment program
+ ::= "CMP" | "CMP_SAT"
+ | "LRP" | "LRP_SAT"
+ | "MAD" | "MAD_SAT"
+
+vertex program
+ ::= "MAD"
+*/
+fp_TRIop
+ "CMP" .emit OP_CMP .or "CMP_SAT" .emit OP_CMP_SAT .or
+ "LRP" .emit OP_LRP .or "LRP_SAT" .emit OP_LRP_SAT .or
+ "MAD" .emit OP_MAD .or "MAD_SAT" .emit OP_MAD_SAT;
+vp_TRIop
+ "MAD" .emit OP_MAD;
+
+/*
+fragment program
+ ::= ","
+ ","
+
+vertex program
+ ::= "SWZ" "," ","
+
+*/
+fp_SWZ_instruction
+ SWZop .and space_dst .and fp_maskedDstReg .and comma .and fp_srcReg .and comma .and
+ fp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
+vp_SWZ_instruction
+ "SWZ" .emit OP_SWZ .and space_dst .and vp_maskedDstReg .and comma .and vp_srcReg .and comma .and
+ vp_extendedSwizzle .error EXT_SWIZ_COMP_EXPECTED;
+
+/*
+fragment program
+ ::= "SWZ" | "SWZ_SAT"
+*/
+SWZop
+ "SWZ" .emit OP_SWZ .or "SWZ_SAT" .emit OP_SWZ_SAT;
+
+/*
+fragment program
+ ::= ","
+ "," ","
+
+*/
+SAMPLE_instruction
+ SAMPLEop .and space_dst .and fp_maskedDstReg .and comma .and vectorSrcReg .and comma .and
+ texImageUnit .and comma .and texTarget .error TEX_TARGET_EXPECTED;
+
+/*
+fragment program
+ ::= "TEX" | "TEX_SAT"
+ | "TXP" | "TXP_SAT"
+ | "TXB" | "TXB_SAT"
+*/
+SAMPLEop
+ "TEX" .emit OP_TEX .or "TEX_SAT" .emit OP_TEX_SAT .or
+ "TXB" .emit OP_TXB .or "TXB_SAT" .emit OP_TXB_SAT .or
+ "TXP" .emit OP_TXP .or "TXP_SAT" .emit OP_TXP_SAT;
+
+/*
+fragment program
+ ::= "KIL"
+*/
+KIL_instruction
+ "KIL" .emit OP_KIL .and space_src .and vectorSrcReg;
+
+/*
+fragment program
+ ::= "texture"
+*/
+texImageUnit
+ "texture" .error TEXTURE_EXPECTED .and optTexImageUnitNum;
+
+/*
+fragment program
+ ::= "1D"
+ | "2D"
+ | "3D"
+ | "CUBE"
+ | "RECT"
+ | (if option ARB_fragment_program_shadow present)
+*/
+texTarget
+ "1D" .emit TEXTARGET_1D .or
+ "2D" .emit TEXTARGET_2D .or
+ "3D" .emit TEXTARGET_3D .or
+ .if (texture_rectangle != 0x00) "RECT" .emit TEXTARGET_RECT .or
+ "CUBE" .emit TEXTARGET_CUBE .or
+ .if (ARB_fragment_program_shadow != 0x00) shadowTarget;
+
+/*
+GL_ARB_fragment_program_shadow
+ ::= "SHADOW1D"
+ | "SHADOW2D"
+ | "SHADOWRECT"
+*/
+shadowTarget
+ "SHADOW1D" .emit TEXTARGET_SHADOW1D .or
+ "SHADOW2D" .emit TEXTARGET_SHADOW2D .or
+ .if (texture_rectangle != 0x00) "SHADOWRECT" .emit TEXTARGET_SHADOWRECT;
+
+/*
+fragment program
+ ::= ""
+ | "[" "]"
+*/
+optTexImageUnitNum
+ optTexImageUnitNum_1 .or .true .emit 0x00;
+optTexImageUnitNum_1
+ lbracket_ne .and texImageUnitNum .and rbracket;
+
+/*
+fragment program
+ ::= from 0 to
+ MAX_TEXTURE_IMAGE_UNITS_ARB-1
+*/
+texImageUnitNum
+ integer;
+
+/*
+ ::=
+*/
+fp_scalarSrcReg
+ optionalSign .and fp_srcReg .and fp_scalarSuffix;
+vp_scalarSrcReg
+ optionalSign .and vp_srcReg .and vp_scalarSuffix;
+
+/*
+vertex program
+ ::=